Skip to content

Commit 524ec4c

Browse files
committed
Do not trigger sharing of return values in the RubyLauncher
* The returned lambda would share its class, and then its superclasses including Object and then all constants. At least this is not necessary for the RubyLauncher.
1 parent e64d434 commit 524ec4c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/truffleruby/language/RubyParsingRequestNode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ public Object execute(VirtualFrame frame) {
9090
frame.getArguments());
9191
final Object value = callNode.call(arguments);
9292

93-
// The return value will be leaked to Java, share it.
94-
if (context.getOptions().SHARED_OBJECTS_ENABLED) {
93+
// The return value will be leaked to Java, so share it if the Context API is used.
94+
// We share conditionally on EMBEDDED to avoid sharing return values used in RubyLauncher.
95+
if (context.getOptions().SHARED_OBJECTS_ENABLED && context.getOptions().EMBEDDED) {
9596
SharedObjects.writeBarrier(context, value);
9697
}
9798

0 commit comments

Comments
 (0)