Skip to content

Commit

Permalink
Enable invokedynamic by default
Browse files Browse the repository at this point in the history
There will be some impact to startup and warmup time initially but
this is the future of JRuby.
  • Loading branch information
headius committed Nov 22, 2024
1 parent dae3f9c commit 94bc193
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
- name: rake test:jruby
run: bin/jruby --dev -S rake test:jruby

rake-test-21-indy:
rake-test-21-indy-off:
runs-on: ubuntu-latest

strategy:
Expand All @@ -103,10 +103,10 @@ jobs:
java-version: ['21', '23']
fail-fast: false

name: rake ${{ matrix.target }} (Java ${{ matrix.java-version }} +indy)
name: rake ${{ matrix.target }} (Java ${{ matrix.java-version }} -indy)

env:
JRUBY_OPTS: '-Xcompile.invokedynamic -X+C -Xjit.threshold=0'
JRUBY_OPTS: '-Xcompile.invokedynamic=false -X+C -Xjit.threshold=0'

steps:
- name: checkout
Expand Down Expand Up @@ -469,7 +469,7 @@ jobs:
permissions:
contents: none
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/jruby-9.5' }}
needs: [mvn-test, mvn-test-extended, mvn-test-windows, dependency-check, rake-test, rake-test-21-indy, rake-test-21, test-versions, sequel, concurrent-ruby, jruby-tests-dev, regression-specs-jit]
needs: [mvn-test, mvn-test-extended, mvn-test-windows, dependency-check, rake-test, rake-test-21-indy-off, rake-test-17, test-versions, sequel, concurrent-ruby, jruby-tests-dev, regression-specs-jit]
uses: jruby/jruby/.github/workflows/snapshot-publish.yml@6cd0d4d96d9406635183d81cf91acc82cd78245f
secrets:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
Expand Down
8 changes: 1 addition & 7 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
*/
public class Options {
private static final List<Option> _loadedOptions = new ArrayList<>(240);
private static final boolean INVOKEDYNAMIC_DEFAULT = calculateInvokedynamicDefault();
private static final boolean COLOR = System.console() != null;

public static final String IR_PRINT_PATTERN_NO_PATTERN_STRING = "<NO_PATTERN>";
Expand All @@ -73,7 +72,7 @@ public class Options {

public static final Option<CompileMode> COMPILE_MODE = enumeration(COMPILER, "compile.mode", CompileMode.class, CompileMode.JIT, "Set compilation mode. JIT = at runtime; FORCE = before execution.");
public static final Option<Boolean> COMPILE_DUMP = bool(COMPILER, "compile.dump", false, "Dump to console all bytecode generated at runtime.");
public static final Option<Boolean> COMPILE_INVOKEDYNAMIC = bool(COMPILER, "compile.invokedynamic", INVOKEDYNAMIC_DEFAULT, "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<Boolean> COMPILE_CACHE_CLASSES = bool(COMPILER, "compile.cache.classes", false, "Use cache of compiled script classes");
public static final Option<Boolean> COMPILE_CACHE_CLASSES_LOGGING = bool(COMPILER, "compile.cache.classes.logging", false, "Log whether cached script classes are being saved or used");

Expand Down Expand Up @@ -290,11 +289,6 @@ private static <T extends Enum<T>> Option<T> enumeration(Category category, Stri
return option;
}

private static boolean calculateInvokedynamicDefault() {
// We were defaulting on for Java 8 and might again later if JEP 210 helps reduce warmup time.
return false;
}

private static Verbosity calculateVerbosityDefault() {
Boolean verbose = CLI_VERBOSE.load();
if (verbose == null) return Verbosity.NIL;
Expand Down

0 comments on commit 94bc193

Please sign in to comment.