Skip to content

Commit 825b24b

Browse files
committed
[GR-17457] Move allocations related to adding methods behind a TruffleBoundary
PullRequest: truffleruby/3239
2 parents 20b6cc7 + 41a15e9 commit 825b24b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/truffleruby/language/methods/LiteralMethodDefinitionNode.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package org.truffleruby.language.methods;
1111

12+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1213
import com.oracle.truffle.api.instrumentation.InstrumentableNode;
1314
import com.oracle.truffle.api.instrumentation.StandardTags;
1415
import com.oracle.truffle.api.instrumentation.Tag;
@@ -60,16 +61,20 @@ public Object execute(VirtualFrame frame) {
6061
visibility = DeclarationContext.findVisibility(frame);
6162
}
6263

63-
final DeclarationContext declarationContext = RubyArguments
64-
.getDeclarationContext(frame)
65-
.withVisibility(Visibility.PUBLIC);
6664
final InternalMethod currentMethod = RubyArguments.getMethod(frame);
65+
final DeclarationContext declarationContext = RubyArguments.getDeclarationContext(frame);
6766

67+
return addMethod(module, visibility, currentMethod, declarationContext);
68+
}
69+
70+
@TruffleBoundary
71+
private Object addMethod(RubyModule module, Visibility visibility, InternalMethod currentMethod,
72+
DeclarationContext declarationContext) {
6873
final InternalMethod method = new InternalMethod(
6974
getContext(),
7075
sharedMethodInfo,
7176
currentMethod.getLexicalScope(),
72-
declarationContext,
77+
declarationContext.withVisibility(Visibility.PUBLIC),
7378
name,
7479
module,
7580
visibility,

0 commit comments

Comments
 (0)