Skip to content

Commit 401e061

Browse files
committed
[GR-17457] Cleanup RubyLauncher and update comment
PullRequest: truffleruby/4244
2 parents 11f1b26 + fbe2dea commit 401e061

File tree

3 files changed

+10
-30
lines changed

3 files changed

+10
-30
lines changed

src/launcher/java/org/truffleruby/launcher/RubyLauncher.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ protected String getMainClass() {
8787
return RubyLauncher.class.getName();
8888
}
8989

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

392389
private static List<String> getPathListFromEnvVariable(String name) {
393390
final String value = System.getenv(name);
394-
if (value != null && value.length() != 0) {
391+
if (value != null && !value.isEmpty()) {
395392
return new ArrayList<>(Arrays.asList(value.split(":")));
396393
}
397394
return Collections.emptyList();

src/main/java/org/truffleruby/cext/CExtNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ public abstract static class MarkObjectOnCallExit extends PrimitiveArrayArgument
446446

447447
@Specialization
448448
Object markOnCallExit(Object object,
449-
@Cached WrapNode wrapNode,
450-
@Cached MarkingServiceNodes.QueueForMarkOnExitNode markOnExitNode) {
451-
markOnExitNode.execute(wrapNode.execute(object));
449+
@Cached WrapNode wrapNode) {
450+
ValueWrapper wrapper = wrapNode.execute(object);
451+
getLanguage().getCurrentThread().getCurrentFiber().extensionCallStack.markOnExitObject(wrapper);
452452
return nil;
453453
}
454454
}

src/main/java/org/truffleruby/core/MarkingServiceNodes.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import com.oracle.truffle.api.dsl.GenerateCached;
1313
import com.oracle.truffle.api.dsl.GenerateInline;
14-
import com.oracle.truffle.api.dsl.NeverDefault;
1514
import com.oracle.truffle.api.dsl.NonIdempotent;
1615
import com.oracle.truffle.api.nodes.Node;
1716
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
@@ -76,22 +75,6 @@ protected static ExtensionCallStack getStack(Node node) {
7675
}
7776
}
7877

79-
public static final class QueueForMarkOnExitNode extends RubyBaseNode {
80-
81-
@NeverDefault
82-
public static QueueForMarkOnExitNode create() {
83-
return new QueueForMarkOnExitNode();
84-
}
85-
86-
public void execute(ValueWrapper object) {
87-
addToList(getLanguage().getCurrentThread().getCurrentFiber().extensionCallStack, object);
88-
}
89-
90-
protected void addToList(ExtensionCallStack stack, ValueWrapper object) {
91-
stack.markOnExitObject(object);
92-
}
93-
}
94-
9578
@GenerateInline
9679
@GenerateCached(false)
9780
public abstract static class RunMarkOnExitNode extends RubyBaseNode {

0 commit comments

Comments
 (0)