Skip to content

Commit

Permalink
Move some cexts debugging options as internal since they are only mea…
Browse files Browse the repository at this point in the history
…nt for debugging
  • Loading branch information
eregon committed Oct 30, 2023
1 parent 34abcef commit 781ea1b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 36 deletions.
20 changes: 10 additions & 10 deletions src/main/java/org/truffleruby/options/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@ public final class Options {
public final boolean BACKTRACE_ON_NEW_FIBER;
/** --cexts=true */
public final boolean CEXTS;
/** --cexts-sulong=false */
public final boolean CEXTS_SULONG;
/** --cexts-lock=true */
public final boolean CEXT_LOCK;
/** --cexts-prepend-toolchain-to-path=true */
public final boolean CEXTS_PREPEND_TOOLCHAIN_TO_PATH;
/** --keep-handles-alive=false */
public final boolean CEXTS_KEEP_HANDLES_ALIVE;
/** --options-log=false */
public final boolean OPTIONS_LOG;
/** --log-load=false */
Expand Down Expand Up @@ -173,6 +169,10 @@ public final class Options {
public final boolean CEXTS_TO_NATIVE_COUNT;
/** --backtraces-to-native=false */
public final boolean BACKTRACE_ON_TO_NATIVE;
/** --keep-handles-alive=false */
public final boolean CEXTS_KEEP_HANDLES_ALIVE;
/** --cexts-sulong=false */
public final boolean CEXTS_SULONG;
/** --basic-ops-log-rewrite=false */
public final boolean BASICOPS_LOG_REWRITE;
/** --array-small=3 */
Expand Down Expand Up @@ -254,10 +254,8 @@ public Options(Env env, OptionValues options, LanguageOptions languageOptions) {
BACKTRACE_ON_NEW_THREAD = options.get(OptionsCatalog.BACKTRACE_ON_NEW_THREAD_KEY);
BACKTRACE_ON_NEW_FIBER = options.get(OptionsCatalog.BACKTRACE_ON_NEW_FIBER_KEY);
CEXTS = options.get(OptionsCatalog.CEXTS_KEY);
CEXTS_SULONG = options.get(OptionsCatalog.CEXTS_SULONG_KEY);
CEXT_LOCK = options.get(OptionsCatalog.CEXT_LOCK_KEY);
CEXTS_PREPEND_TOOLCHAIN_TO_PATH = options.get(OptionsCatalog.CEXTS_PREPEND_TOOLCHAIN_TO_PATH_KEY);
CEXTS_KEEP_HANDLES_ALIVE = options.get(OptionsCatalog.CEXTS_KEEP_HANDLES_ALIVE_KEY);
OPTIONS_LOG = options.get(OptionsCatalog.OPTIONS_LOG_KEY);
LOG_LOAD = options.get(OptionsCatalog.LOG_LOAD_KEY);
LOG_AUTOLOAD = options.get(OptionsCatalog.LOG_AUTOLOAD_KEY);
Expand Down Expand Up @@ -287,6 +285,8 @@ public Options(Env env, OptionValues options, LanguageOptions languageOptions) {
CEXTS_TO_NATIVE_STATS = options.get(OptionsCatalog.CEXTS_TO_NATIVE_STATS_KEY);
CEXTS_TO_NATIVE_COUNT = options.hasBeenSet(OptionsCatalog.CEXTS_TO_NATIVE_COUNT_KEY) ? options.get(OptionsCatalog.CEXTS_TO_NATIVE_COUNT_KEY) : CEXTS_TO_NATIVE_STATS;
BACKTRACE_ON_TO_NATIVE = options.get(OptionsCatalog.BACKTRACE_ON_TO_NATIVE_KEY);
CEXTS_KEEP_HANDLES_ALIVE = options.get(OptionsCatalog.CEXTS_KEEP_HANDLES_ALIVE_KEY);
CEXTS_SULONG = options.get(OptionsCatalog.CEXTS_SULONG_KEY);
BASICOPS_LOG_REWRITE = options.get(OptionsCatalog.BASICOPS_LOG_REWRITE_KEY);
ARRAY_SMALL = options.get(OptionsCatalog.ARRAY_SMALL_KEY);
CEXTS_MARKING_CACHE = options.get(OptionsCatalog.CEXTS_MARKING_CACHE_KEY);
Expand Down Expand Up @@ -392,14 +392,10 @@ public Object fromDescriptor(OptionDescriptor descriptor) {
return BACKTRACE_ON_NEW_FIBER;
case "ruby.cexts":
return CEXTS;
case "ruby.cexts-sulong":
return CEXTS_SULONG;
case "ruby.cexts-lock":
return CEXT_LOCK;
case "ruby.cexts-prepend-toolchain-to-path":
return CEXTS_PREPEND_TOOLCHAIN_TO_PATH;
case "ruby.keep-handles-alive":
return CEXTS_KEEP_HANDLES_ALIVE;
case "ruby.options-log":
return OPTIONS_LOG;
case "ruby.log-load":
Expand Down Expand Up @@ -458,6 +454,10 @@ public Object fromDescriptor(OptionDescriptor descriptor) {
return CEXTS_TO_NATIVE_COUNT;
case "ruby.backtraces-to-native":
return BACKTRACE_ON_TO_NATIVE;
case "ruby.keep-handles-alive":
return CEXTS_KEEP_HANDLES_ALIVE;
case "ruby.cexts-sulong":
return CEXTS_SULONG;
case "ruby.basic-ops-log-rewrite":
return BASICOPS_LOG_REWRITE;
case "ruby.array-small":
Expand Down
5 changes: 3 additions & 2 deletions src/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ EXPERT:

# C extension options
CEXTS: [cexts, boolean, true, Enable use of C extensions]
CEXTS_SULONG: [cexts-sulong, boolean, false, Run C extensions on Sulong instead of natively]
CEXT_LOCK: [cexts-lock, boolean, true, Use a Global Lock when running C extensions]
CEXTS_PREPEND_TOOLCHAIN_TO_PATH: [cexts-prepend-toolchain-to-path, boolean, true, Prepend the GraalVM LLVM Toolchain to PATH when installing gems]
CEXTS_KEEP_HANDLES_ALIVE: [keep-handles-alive, boolean, false, Keep handles for value wrappers alive forever]

# Debugging the values of options
OPTIONS_LOG: [options-log, boolean, false, Log the final value of all options]
Expand Down Expand Up @@ -177,6 +175,9 @@ INTERNAL: # Options for debugging the TruffleRuby implementation
CEXTS_TO_NATIVE_STATS: [cexts-to-native-stats, boolean, false, Track the number of conversions of VALUEs to native and print the stats at application exit]
CEXTS_TO_NATIVE_COUNT: [cexts-to-native-count, boolean, CEXTS_TO_NATIVE_STATS, Track the number of conversions of VALUEs to native]
BACKTRACE_ON_TO_NATIVE: [backtraces-to-native, boolean, false, Show a backtrace when a ValueWrapper handle is created for a Ruby object]
CEXTS_KEEP_HANDLES_ALIVE: [keep-handles-alive, boolean, false, Keep handles for value wrappers alive forever]
# jt clean cexts && TRUFFLERUBYOPT="--experimental-options --cexts-sulong" jt build && TRUFFLERUBYOPT="--experimental-options --cexts-sulong" jt test :capi
CEXTS_SULONG: [cexts-sulong, boolean, false, "Run C extensions on Sulong instead of natively, requires rebuilding TruffleRuby from source with this option"]

# Options to debug the implementation
LAZY_BUILTINS: [lazy-builtins, boolean, LAZY_CALLTARGETS, Load builtin classes (core methods & primitives) lazily on first use]
Expand Down
48 changes: 24 additions & 24 deletions src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ public final class OptionsCatalog {
public static final OptionKey<Boolean> BACKTRACE_ON_NEW_THREAD_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> BACKTRACE_ON_NEW_FIBER_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> CEXTS_KEY = new OptionKey<>(true);
public static final OptionKey<Boolean> CEXTS_SULONG_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> CEXT_LOCK_KEY = new OptionKey<>(true);
public static final OptionKey<Boolean> CEXTS_PREPEND_TOOLCHAIN_TO_PATH_KEY = new OptionKey<>(true);
public static final OptionKey<Boolean> CEXTS_KEEP_HANDLES_ALIVE_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> OPTIONS_LOG_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> LOG_LOAD_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> LOG_AUTOLOAD_KEY = new OptionKey<>(false);
Expand Down Expand Up @@ -106,6 +104,8 @@ public final class OptionsCatalog {
public static final OptionKey<Boolean> CEXTS_TO_NATIVE_STATS_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> CEXTS_TO_NATIVE_COUNT_KEY = new OptionKey<>(CEXTS_TO_NATIVE_STATS_KEY.getDefaultValue());
public static final OptionKey<Boolean> BACKTRACE_ON_TO_NATIVE_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> CEXTS_KEEP_HANDLES_ALIVE_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> CEXTS_SULONG_KEY = new OptionKey<>(false);
public static final OptionKey<Boolean> LAZY_BUILTINS_KEY = new OptionKey<>(LAZY_CALLTARGETS_KEY.getDefaultValue());
public static final OptionKey<Boolean> LAZY_TRANSLATION_CORE_KEY = new OptionKey<>(LAZY_CALLTARGETS_KEY.getDefaultValue());
public static final OptionKey<Boolean> CHAOS_DATA_KEY = new OptionKey<>(false);
Expand Down Expand Up @@ -574,14 +574,6 @@ public final class OptionsCatalog {
.usageSyntax("")
.build();

public static final OptionDescriptor CEXTS_SULONG = OptionDescriptor
.newBuilder(CEXTS_SULONG_KEY, "ruby.cexts-sulong")
.help("Run C extensions on Sulong instead of natively")
.category(OptionCategory.EXPERT)
.stability(OptionStability.EXPERIMENTAL)
.usageSyntax("")
.build();

public static final OptionDescriptor CEXT_LOCK = OptionDescriptor
.newBuilder(CEXT_LOCK_KEY, "ruby.cexts-lock")
.help("Use a Global Lock when running C extensions")
Expand All @@ -598,14 +590,6 @@ public final class OptionsCatalog {
.usageSyntax("")
.build();

public static final OptionDescriptor CEXTS_KEEP_HANDLES_ALIVE = OptionDescriptor
.newBuilder(CEXTS_KEEP_HANDLES_ALIVE_KEY, "ruby.keep-handles-alive")
.help("Keep handles for value wrappers alive forever")
.category(OptionCategory.EXPERT)
.stability(OptionStability.EXPERIMENTAL)
.usageSyntax("")
.build();

public static final OptionDescriptor OPTIONS_LOG = OptionDescriptor
.newBuilder(OPTIONS_LOG_KEY, "ruby.options-log")
.help("Log the final value of all options")
Expand Down Expand Up @@ -854,6 +838,22 @@ public final class OptionsCatalog {
.usageSyntax("")
.build();

public static final OptionDescriptor CEXTS_KEEP_HANDLES_ALIVE = OptionDescriptor
.newBuilder(CEXTS_KEEP_HANDLES_ALIVE_KEY, "ruby.keep-handles-alive")
.help("Keep handles for value wrappers alive forever")
.category(OptionCategory.INTERNAL)
.stability(OptionStability.EXPERIMENTAL)
.usageSyntax("")
.build();

public static final OptionDescriptor CEXTS_SULONG = OptionDescriptor
.newBuilder(CEXTS_SULONG_KEY, "ruby.cexts-sulong")
.help("Run C extensions on Sulong instead of natively, requires rebuilding TruffleRuby from source with this option")
.category(OptionCategory.INTERNAL)
.stability(OptionStability.EXPERIMENTAL)
.usageSyntax("")
.build();

public static final OptionDescriptor LAZY_BUILTINS = OptionDescriptor
.newBuilder(LAZY_BUILTINS_KEY, "ruby.lazy-builtins")
.help("Load builtin classes (core methods & primitives) lazily on first use")
Expand Down Expand Up @@ -1430,14 +1430,10 @@ public static OptionDescriptor fromName(String name) {
return BACKTRACE_ON_NEW_FIBER;
case "ruby.cexts":
return CEXTS;
case "ruby.cexts-sulong":
return CEXTS_SULONG;
case "ruby.cexts-lock":
return CEXT_LOCK;
case "ruby.cexts-prepend-toolchain-to-path":
return CEXTS_PREPEND_TOOLCHAIN_TO_PATH;
case "ruby.keep-handles-alive":
return CEXTS_KEEP_HANDLES_ALIVE;
case "ruby.options-log":
return OPTIONS_LOG;
case "ruby.log-load":
Expand Down Expand Up @@ -1500,6 +1496,10 @@ public static OptionDescriptor fromName(String name) {
return CEXTS_TO_NATIVE_COUNT;
case "ruby.backtraces-to-native":
return BACKTRACE_ON_TO_NATIVE;
case "ruby.keep-handles-alive":
return CEXTS_KEEP_HANDLES_ALIVE;
case "ruby.cexts-sulong":
return CEXTS_SULONG;
case "ruby.lazy-builtins":
return LAZY_BUILTINS;
case "ruby.lazy-translation-core":
Expand Down Expand Up @@ -1676,10 +1676,8 @@ public static OptionDescriptor[] allDescriptors() {
BACKTRACE_ON_NEW_THREAD,
BACKTRACE_ON_NEW_FIBER,
CEXTS,
CEXTS_SULONG,
CEXT_LOCK,
CEXTS_PREPEND_TOOLCHAIN_TO_PATH,
CEXTS_KEEP_HANDLES_ALIVE,
OPTIONS_LOG,
LOG_LOAD,
LOG_AUTOLOAD,
Expand Down Expand Up @@ -1711,6 +1709,8 @@ public static OptionDescriptor[] allDescriptors() {
CEXTS_TO_NATIVE_STATS,
CEXTS_TO_NATIVE_COUNT,
BACKTRACE_ON_TO_NATIVE,
CEXTS_KEEP_HANDLES_ALIVE,
CEXTS_SULONG,
LAZY_BUILTINS,
LAZY_TRANSLATION_CORE,
CHAOS_DATA,
Expand Down

0 comments on commit 781ea1b

Please sign in to comment.