Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changes to invokedynamic enabling.

* On Java 6, on only if explicitly turned on (for JSR292 backport)
* On OpenJDK Java 7, on only if explicitly turned on (temporarily)
* On OpenJDK Java 8, on by default unless turned off
  • Loading branch information...
commit 01a0a734ba5f8f3fe1b090594d66d40a12d58c9b 1 parent 9b1cc7b
@headius headius authored
View
15 src/org/jruby/RubyInstanceConfig.java
@@ -1529,9 +1529,18 @@ public boolean shouldPrecompileAll() {
public static final boolean USE_INVOKEDYNAMIC;
static {
- if (JAVA_VERSION == Opcodes.V1_7) {
- // if on Java 7, on by default unless turned off
- // TODO: turned off temporarily due to the lack of 100% working OpenJDK indy support
+ boolean isHotspot =
+ SafePropertyAccessor.getProperty("java.vm.name", "").contains("Hotspot") ||
+ SafePropertyAccessor.getProperty("java.vm.name", "").contains("OpenJDK");
+
+ String version = SafePropertyAccessor.getProperty("java.specification.version", "1.6");
+
+ if (isHotspot && version.equals("1.7")) {
+ // if on OpenJDK 7, on by default unless turned off
+ // TODO: turned off temporarily due to the lack of 100% working OpenJDK7 indy support
+ USE_INVOKEDYNAMIC = Options.COMPILE_INVOKEDYNAMIC.load() && Options.COMPILE_INVOKEDYNAMIC.isSpecified();
+ } else if (isHotspot && version.equals("1.8")) {
+ // OpenJDK 8 will have the new 100% working logic soon, so we enable by default
USE_INVOKEDYNAMIC = Options.COMPILE_INVOKEDYNAMIC.load();
} else {
// if not on Java 7, on only if explicitly turned on
View
3  src/org/jruby/util/cli/Options.java
@@ -75,8 +75,7 @@ public static String dump() {
public static final Option<Boolean> COMPILE_FASTSEND = bool(COMPILER, "compile.fastsend", false, "Compile obj.__send__(<literal>, ...) as obj.<literal>(...).");
public static final Option<Boolean> COMPILE_INLINEDYNCALLS = bool(COMPILER, "compile.inlineDyncalls", false, "Emit method lookup + invoke inline in bytecode.");
public static final Option<Boolean> COMPILE_FASTMASGN = bool(COMPILER, "compile.fastMasgn", false, "Return true from multiple assignment instead of a new array.");
- // TODO: turned off temporarily due to the lack of 100% working OpenJDK indy support
- public static final Option<Boolean> COMPILE_INVOKEDYNAMIC = bool(COMPILER, "compile.invokedynamic", false, "Use invokedynamic for optimizing Ruby code");
+ public static final Option<Boolean> COMPILE_INVOKEDYNAMIC = bool(COMPILER, "compile.invokedynamic", true, "Use invokedynamic for optimizing Ruby code");
public static final Option<Integer> INVOKEDYNAMIC_MAXFAIL = integer(INVOKEDYNAMIC, "invokedynamic.maxfail", 1000, "Maximum call site failures after which to inline cache.");
public static final Option<Integer> INVOKEDYNAMIC_MAXPOLY = integer(INVOKEDYNAMIC, "invokedynamic.maxpoly", 2, "Maximum polymorphism of PIC binding.");
Please sign in to comment.
Something went wrong with that request. Please try again.