Skip to content

Commit

Permalink
[GR-17457] Cleanup RubyLauncher and update comment
Browse files Browse the repository at this point in the history
PullRequest: truffleruby/4244
  • Loading branch information
eregon committed Apr 18, 2024
2 parents 11f1b26 + fbe2dea commit 401e061
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
17 changes: 7 additions & 10 deletions src/launcher/java/org/truffleruby/launcher/RubyLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ protected String getMainClass() {
return RubyLauncher.class.getName();
}

@Override
protected void validateArguments(Map<String, String> polyglotOptions) {
}

@Override
protected void printVersion() {
getOutput().println(TruffleRuby.getVersionString(getImplementationNameFromEngine()));
Expand Down Expand Up @@ -131,10 +127,11 @@ protected List<String> preprocessArguments(List<String> args, Map<String, String
if (config.readRubyOptEnv) {
/* Calling processArguments() here will also add any unrecognized arguments such as
* --jvm/--native/--vm.* arguments and polyglot options to `config.getUnknownArguments()`, which will
* then be processed by AbstractLanguageLauncher and Launcher. If we are going to run Native, Launcher
* will apply VM options to the current process. If we are going to run on JVM, Launcher will collect
* them and pass them when execve()'ing to bin/java. Polyglot options are parsed by
* AbstractLanguageLauncher in the final process. */
* then be processed by AbstractLanguageLauncher. For VM arguments, #validateVmArguments() will be
* called to check that the guessed --vm.* arguments match the actual ones (should always be the case,
* except if --vm.* arguments are added dynamically like --vm.Xmn1g for gem/bundle on native). If they
* do not match then the thin launcher will relaunch by execve(). Polyglot options are parsed by
* AbstractLanguageLauncher#parseUnrecognizedOptions. */
// Process RUBYOPT
final List<String> rubyoptArgs = getArgsFromEnvVariable("RUBYOPT");
new CommandLineParser(rubyoptArgs, config, false, true).processArguments();
Expand Down Expand Up @@ -382,7 +379,7 @@ private static List<String> getArgsFromEnvVariable(String name) {
String value = System.getenv(name);
if (value != null) {
value = value.strip();
if (value.length() != 0) {
if (!value.isEmpty()) {
return new ArrayList<>(Arrays.asList(value.split("\\s+")));
}
}
Expand All @@ -391,7 +388,7 @@ private static List<String> getArgsFromEnvVariable(String name) {

private static List<String> getPathListFromEnvVariable(String name) {
final String value = System.getenv(name);
if (value != null && value.length() != 0) {
if (value != null && !value.isEmpty()) {
return new ArrayList<>(Arrays.asList(value.split(":")));
}
return Collections.emptyList();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/truffleruby/cext/CExtNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ public abstract static class MarkObjectOnCallExit extends PrimitiveArrayArgument

@Specialization
Object markOnCallExit(Object object,
@Cached WrapNode wrapNode,
@Cached MarkingServiceNodes.QueueForMarkOnExitNode markOnExitNode) {
markOnExitNode.execute(wrapNode.execute(object));
@Cached WrapNode wrapNode) {
ValueWrapper wrapper = wrapNode.execute(object);
getLanguage().getCurrentThread().getCurrentFiber().extensionCallStack.markOnExitObject(wrapper);
return nil;
}
}
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/org/truffleruby/core/MarkingServiceNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import com.oracle.truffle.api.dsl.GenerateCached;
import com.oracle.truffle.api.dsl.GenerateInline;
import com.oracle.truffle.api.dsl.NeverDefault;
import com.oracle.truffle.api.dsl.NonIdempotent;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
Expand Down Expand Up @@ -76,22 +75,6 @@ protected static ExtensionCallStack getStack(Node node) {
}
}

public static final class QueueForMarkOnExitNode extends RubyBaseNode {

@NeverDefault
public static QueueForMarkOnExitNode create() {
return new QueueForMarkOnExitNode();
}

public void execute(ValueWrapper object) {
addToList(getLanguage().getCurrentThread().getCurrentFiber().extensionCallStack, object);
}

protected void addToList(ExtensionCallStack stack, ValueWrapper object) {
stack.markOnExitObject(object);
}
}

@GenerateInline
@GenerateCached(false)
public abstract static class RunMarkOnExitNode extends RubyBaseNode {
Expand Down

0 comments on commit 401e061

Please sign in to comment.