View direct_access.patch
commit fd79f530c513260c26c8153e34cd1c60705705a1
Author: Charles Oliver Nutter <headius@headius.com>
Date: Fri Sep 23 14:28:13 2016 -0500
Compile scope variable accesses to direct fields.
diff --git a/core/src/main/java/org/jruby/Ruby.java b/core/src/main/java/org/jruby/Ruby.java
index ae7fc8b..4e278ae 100644
--- a/core/src/main/java/org/jruby/Ruby.java
+++ b/core/src/main/java/org/jruby/Ruby.java
View gist:2c0b2459d8e5fb3c69bbaec254295ea8
BEFORE
ALOAD 6
ALOAD 9
INVOKEVIRTUAL org/jruby/runtime/DynamicScope.setValueZeroDepthZeroVoid (Lorg/jruby/runtime/builtin/IRubyObject;)V
ALOAD 6
ALOAD 10
INVOKEVIRTUAL org/jruby/runtime/DynamicScope.setValueOneDepthZeroVoid (Lorg/jruby/runtime/builtin/IRubyObject;)V
ALOAD 6
ALOAD 11
View 0.soft_ordering.diff
diff --git a/core/src/main/java/org/jruby/RubyArray.java b/core/src/main/java/org/jruby/RubyArray.java
index 04fbeef..1c32bb39 100644
--- a/core/src/main/java/org/jruby/RubyArray.java
+++ b/core/src/main/java/org/jruby/RubyArray.java
@@ -71,6 +71,7 @@ import org.jruby.util.io.EncodingUtils;
import java.io.IOException;
import java.lang.reflect.Array;
+import java.lang.reflect.Field;
import java.util.Arrays;
View .diff
diff --git a/core/src/main/java/org/jruby/RubyBasicObject.java b/core/src/main/java/org/jruby/RubyBasicObject.java
index fc181c9..107146a 100644
--- a/core/src/main/java/org/jruby/RubyBasicObject.java
+++ b/core/src/main/java/org/jruby/RubyBasicObject.java
@@ -69,6 +69,7 @@ import org.jruby.runtime.builtin.Variable;
import org.jruby.runtime.component.VariableEntry;
import org.jruby.runtime.marshal.CoreObjectType;
import org.jruby.util.ArraySupport;
+import org.jruby.util.ConvertBytes;
import org.jruby.util.IdUtil;
View JceSecurity.java
private static void setupJurisdictionPolicies() throws Exception {
String javaHomeDir = System.getProperty("java.home");
String sep = File.separator;
String pathToPolicyJar = javaHomeDir + sep + "lib" + sep +
"security" + sep;
File exportJar = new File(pathToPolicyJar, "US_export_policy.jar");
File importJar = new File(pathToPolicyJar, "local_policy.jar");
URL jceCipherURL = ClassLoader.getSystemResource
("javax/crypto/Cipher.class");
View console.txt
[] ~/projects/jruby $ jruby dltest.rb
LoadError: threads "Ruby-0-Thread-1: dltest.rb:2" and "Ruby-0-Thread-2: dltest.rb:2" will deadlock requiring "/Users/headius/projects/jruby/class_a.rb"
require at org/jruby/RubyKernel.java:955
require at /Users/headius/projects/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
<main> at /Users/headius/projects/jruby/class_b.rb:2
require at org/jruby/RubyKernel.java:955
(root) at /Users/headius/projects/jruby/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
block in dltest.rb at dltest.rb:10
[] ~/projects/jruby $ jruby dltest.rb
View jruby-4037.diff
diff --git a/core/src/main/java/org/jruby/RubyHash.java b/core/src/main/java/org/jruby/RubyHash.java
index 190077a..b78c87f 100644
--- a/core/src/main/java/org/jruby/RubyHash.java
+++ b/core/src/main/java/org/jruby/RubyHash.java
@@ -44,16 +44,20 @@ import org.jruby.anno.JRubyMethod;
import org.jruby.common.IRubyWarnings.ID;
import org.jruby.exceptions.RaiseException;
import org.jruby.javasupport.JavaUtil;
+import org.jruby.parser.StaticScope;
import org.jruby.runtime.Arity;
View partials.rb
N=1000_000_000
def threaded_partial_sum(nthreads, n)
puts "Partial sum on #{nthreads} thread(s)"
sum = nthreads.times.collect { 0 }
t1 = Time.now
threads = nthreads.times.collect do |num|
Thread.new do
i=num
psum = 0
View gist:bbf80f8dcca87cd651b7d67398c0190a
public static RUBY$method$foo$1(Lorg/jruby/runtime/ThreadContext;Lorg/jruby/parser/StaticScope;Lorg/jruby/runtime/builtin/IRubyObject;Lorg/jruby/runtime/Block;Lorg/jruby/RubyModule;Ljava/lang/String;)Lorg/jruby/runtime/builtin/IRubyObject;
L0
NOP
NOP
L1
LINENUMBER 2 L1
ALOAD 0
INVOKEDYNAMIC fixnum(Lorg/jruby/runtime/ThreadContext;)Lorg/jruby/runtime/builtin/IRubyObject; [
// handle kind 0x6 : INVOKESTATIC
org/jruby/ir/targets/FixnumObjectSite.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;J)Ljava/lang/invoke/CallSite;
View bench_recursive_fib.rb
# run with: mx vm -XX:+UseJVMCICompiler -Djruby.home=<jruby home> -Djruby.compile.invokedynamic -jar <jruby home>/lib/jruby.jar ../rubybench/time/bench_fib_recursive.rb 1000 35
require 'benchmark'
def fib_ruby(n)
if n < 2
n
else
fib_ruby(n - 2) + fib_ruby(n - 1)
end