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 May 29, 2024
1 parent adc3dfa commit c007c74
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 @@ -82,7 +82,7 @@ jobs:
- name: rake test:jruby
run: bin/jruby --dev -S rake test:jruby

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

strategy:
Expand All @@ -91,10 +91,10 @@ jobs:
java-version: ['17', '21']
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: Bootstrap build
Expand Down Expand Up @@ -419,7 +419,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-17-indy, rake-test-17, 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-17-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;

// This section holds all Options for JRuby. They will be listed in the
Expand All @@ -71,7 +70,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 @@ -287,11 +286,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 c007c74

Please sign in to comment.