Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a7fc49d78647
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a9e1b0befd1b
Choose a head ref
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on May 1, 2015

  1. Copy the full SHA
    abf0176 View commit details
  2. Copy the full SHA
    888e48d View commit details
  3. Copy the full SHA
    a9e1b0b View commit details

This file was deleted.

41 changes: 0 additions & 41 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/HashGuards.java

This file was deleted.

144 changes: 94 additions & 50 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -60,19 +60,19 @@ public HashSearchResult search(VirtualFrame frame, RubyHash hash, Object key) {
while (entry != null) {
if (byIdentityProfile.profile(hash.isCompareByIdentity())) {
if (equalNode.executeReferenceEqual(frame, key, entry.getKey())) {
return new HashSearchResult(index, previousEntry, entry);
return new HashSearchResult(hashed, index, previousEntry, entry);
}
} else {
if (eqlNode.callBoolean(frame, key, "eql?", null, entry.getKey())) {
return new HashSearchResult(index, previousEntry, entry);
return new HashSearchResult(hashed, index, previousEntry, entry);
}
}

previousEntry = entry;
entry = entry.getNextInLookup();
}

return new HashSearchResult(index, previousEntry, null);
return new HashSearchResult(hashed, index, previousEntry, null);
}

@Override
12 changes: 11 additions & 1 deletion truffle/src/main/java/org/jruby/truffle/runtime/hash/Entry.java
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
*/
public class Entry {

private int hashed;
private Object key;
private Object value;

@@ -23,11 +24,20 @@ public class Entry {
private Entry previousInSequence;
private Entry nextInSequence;

public Entry(Object key, Object value) {
public Entry(int hashed, Object key, Object value) {
this.hashed = hashed;
this.key = key;
this.value = value;
}

public int getHashed() {
return hashed;
}

public void setHashed(int hashed) {
this.hashed = hashed;
}

public Object getKey() {
return key;
}
Original file line number Diff line number Diff line change
@@ -157,19 +157,19 @@ public static HashSearchResult verySlowFindBucket(RubyHash hash, Object key, boo
}

if ((boolean) DebugOperations.send(hash.getContext(), key, method, null, entry.getKey())) {
return new HashSearchResult(bucketIndex, previousEntry, entry);
return new HashSearchResult(hashed, bucketIndex, previousEntry, entry);
}

previousEntry = entry;
entry = entry.getNextInLookup();
}

return new HashSearchResult(bucketIndex, previousEntry, null);
return new HashSearchResult(hashed, bucketIndex, previousEntry, null);
}

public static void setAtBucket(RubyHash hash, HashSearchResult hashSearchResult, Object key, Object value) {
if (hashSearchResult.getEntry() == null) {
final Entry entry = new Entry(key, value);
final Entry entry = new Entry(hashSearchResult.getHashed(), key, value);

if (hashSearchResult.getPreviousEntry() == null) {
((Entry[]) hash.getStore())[hashSearchResult.getIndex()] = entry;
@@ -192,6 +192,7 @@ public static void setAtBucket(RubyHash hash, HashSearchResult hashSearchResult,

// Update the key (it overwrites even it it's eql?) and value

entry.setHashed(hashSearchResult.getHashed());
entry.setKey(key);
entry.setValue(value);
}
Original file line number Diff line number Diff line change
@@ -25,16 +25,22 @@
*/
public class HashSearchResult {

private final int hashed;
private final int index;
private final Entry previousEntry;
private final Entry entry;
private final int index;

public HashSearchResult(int index, Entry previousEntry, Entry entry) {
public HashSearchResult(int hashed, int index, Entry previousEntry, Entry entry) {
this.hashed = hashed;
this.index = index;
this.previousEntry = previousEntry;
this.entry = entry;
}

public int getHashed() {
return hashed;
}

public int getIndex() {
return index;
}