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: 9810a5060392^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3c5c26d4e5e5
Choose a head ref
  • 6 commits
  • 24 files changed
  • 1 contributor

Commits on Dec 15, 2014

  1. Copy the full SHA
    9810a50 View commit details

Commits on Dec 16, 2014

  1. Copy the full SHA
    0eee052 View commit details
  2. Copy the full SHA
    3e82545 View commit details
  3. Copy the full SHA
    579881f View commit details
  4. Copy the full SHA
    4b6b34a View commit details
  5. Copy the full SHA
    3c5c26d View commit details
Showing with 1,017 additions and 418 deletions.
  1. +1 −1 core/src/main/java/org/jruby/RubyHash.java
  2. +5 −0 core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  3. +2 −0 core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
  4. +37 −1 core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
  5. +5 −17 core/src/main/java/org/jruby/truffle/nodes/core/HashGuards.java
  6. +230 −277 core/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java
  7. +9 −7 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  8. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/NilClassNodes.java
  9. +3 −3 core/src/main/java/org/jruby/truffle/nodes/core/SystemNode.java
  10. +70 −0 core/src/main/java/org/jruby/truffle/nodes/hash/FindBucketNode.java
  11. +11 −19 core/src/main/java/org/jruby/truffle/nodes/literal/HashLiteralNode.java
  12. +3 −3 core/src/main/java/org/jruby/truffle/nodes/methods/arguments/CheckArityNode.java
  13. +3 −7 core/src/main/java/org/jruby/truffle/nodes/methods/arguments/ReadKeywordArgumentNode.java
  14. +8 −8 core/src/main/java/org/jruby/truffle/nodes/methods/arguments/ReadKeywordRestArgumentNode.java
  15. +12 −22 core/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  16. +34 −52 core/src/main/java/org/jruby/truffle/runtime/core/RubyHash.java
  17. +81 −0 core/src/main/java/org/jruby/truffle/runtime/hash/Bucket.java
  18. +49 −0 core/src/main/java/org/jruby/truffle/runtime/hash/BucketSearchResult.java
  19. +33 −0 core/src/main/java/org/jruby/truffle/runtime/hash/Entry.java
  20. +213 −0 core/src/main/java/org/jruby/truffle/runtime/hash/HashOperations.java
  21. +1 −0 core/src/main/ruby/jruby/truffle/core.rb
  22. +17 −0 core/src/main/ruby/jruby/truffle/core/config.rb
  23. +10 −0 core/src/main/ruby/jruby/truffle/core/kernel.rb
  24. +179 −0 test/truffle/hash_stress_test.rb
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -314,7 +314,7 @@ private final void alloc(int buckets) {
* ============================
*/

private static final int MRI_PRIMES[] = {
public static final int MRI_PRIMES[] = {
8 + 3, 16 + 3, 32 + 5, 64 + 3, 128 + 3, 256 + 27, 512 + 9, 1024 + 9, 2048 + 5, 4096 + 3,
8192 + 27, 16384 + 43, 32768 + 3, 65536 + 45, 131072 + 29, 262144 + 3, 524288 + 21, 1048576 + 7,
2097152 + 17, 4194304 + 15, 8388608 + 9, 16777216 + 43, 33554432 + 35, 67108864 + 15,
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
import org.jruby.truffle.runtime.core.RubyHash;
import org.jruby.truffle.runtime.core.RubyRange;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.hash.BucketSearchResult;
import org.jruby.truffle.runtime.rubinius.RubiniusByteArray;
import org.jruby.truffle.runtime.rubinius.RubiniusChannel;

@@ -191,6 +192,10 @@ public RubyEncodingConverter executeRubyEncodingConverter(VirtualFrame frame) th
return RubyTypesGen.RUBYTYPES.expectRubyEncodingConverter(execute(frame));
}

public BucketSearchResult executeBucketSearchResult(VirtualFrame frame) throws UnexpectedResultException {
return RubyTypesGen.RUBYTYPES.expectBucketSearchResult(execute(frame));
}

public Dispatch.DispatchAction executeDispatchAction(VirtualFrame frame) {
throw new UnsupportedOperationException();
}
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/RubyTypes.java
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
import org.jruby.truffle.runtime.core.RubyHash;
import org.jruby.truffle.runtime.core.RubyRange;
import org.jruby.truffle.runtime.core.RubyBasicObject;
import org.jruby.truffle.runtime.hash.BucketSearchResult;
import org.jruby.truffle.runtime.rubinius.RubiniusByteArray;
import org.jruby.truffle.runtime.rubinius.RubiniusChannel;
import org.jruby.truffle.runtime.LexicalScope;
@@ -61,6 +62,7 @@
RubiniusByteArray.class, //
RubyEncodingConverter.class, //
RubyBasicObject.class, //
BucketSearchResult.class, //
Object[].class})

public class RubyTypes {
38 changes: 37 additions & 1 deletion core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -1110,7 +1110,6 @@ public ClearNode(ClearNode prev) {
@Specialization
public RubyArray clear(RubyArray array) {
notDesignedForCompilation();

array.setSize(0);
return array;
}
@@ -3551,6 +3550,43 @@ public RubyArray toA(RubyArray array) {

}

@CoreMethod(names = "uniq")
public abstract static class UniqNode extends CoreMethodNode {

public UniqNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

public UniqNode(UniqNode prev) {
super(prev);
}

@Specialization
public RubyArray uniq(RubyArray array) {
notDesignedForCompilation();

final RubyArray uniq = new RubyArray(getContext().getCoreLibrary().getArrayClass(), null, 0);

for (Object value : array.slowToArray()) {
boolean duplicate = false;

for (Object compare : uniq.slowToArray()) {
if ((boolean) DebugOperations.send(getContext(), value, "==", null, compare)) {
duplicate = true;
break;
}
}

if (!duplicate) {
uniq.slowPush(value);
}
}

return uniq;
}

}

@CoreMethod(names = "unshift", argumentsAsArray = true)
public abstract static class UnshiftNode extends CoreMethodNode {

22 changes: 5 additions & 17 deletions core/src/main/java/org/jruby/truffle/nodes/core/HashGuards.java
Original file line number Diff line number Diff line change
@@ -10,8 +10,7 @@
package org.jruby.truffle.nodes.core;

import org.jruby.truffle.runtime.core.RubyHash;

import java.util.LinkedHashMap;
import org.jruby.truffle.runtime.hash.Bucket;

public class HashGuards {

@@ -20,23 +19,12 @@ public static boolean isNull(RubyHash hash) {
}

public static boolean isObjectArray(RubyHash hash) {
return hash.getStore() instanceof Object[];
}

public static boolean isObjectLinkedHashMap(RubyHash hash) {
return hash.getStore() instanceof LinkedHashMap<?, ?>;
}

public static boolean isOtherNull(RubyHash hash, RubyHash other) {
return other.getStore() == null;
}

public static boolean isOtherObjectArray(RubyHash hash, RubyHash other) {
return other.getStore() instanceof Object[];
// Arrays are covariant in Java!
return hash.getStore() instanceof Object[] && !(hash.getStore() instanceof Bucket[]);
}

public static boolean isOtherObjectLinkedHashMap(RubyHash hash, RubyHash other) {
return other.getStore() instanceof LinkedHashMap<?, ?>;
public static boolean isBucketArray(RubyHash hash) {
return hash.getStore() instanceof Bucket[];
}

}
Loading