File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
src/main/java/org/truffleruby Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change
1
+ # truffleruby_primitives: true
2
+
1
3
# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved. This
2
4
# code is released under a tri EPL/GPL/LGPL license. You can use it,
3
5
# redistribute it and/or modify it under the terms of the:
63
65
raise "The file #{ filename } wasn't updated with actual AST"
64
66
end
65
67
else
68
+ # the multi-context mode introduces some changes in the AST:
69
+ # - static lexical scopes aren't set
70
+ # - ReadConstantWithLexicalScopeNode is used instead of ReadConstantWithLexicalScopeNode
71
+ # - ReadClassVariableNode.lexicalScopeNode is GetDynamicLexicalScopeNode instead of (ObjectLiteralNode object = :: Object)
72
+ # - WriteConstantNode.moduleNode uses DynamicLexicalScopeNode instead of (LexicalScopeNode lexicalScope = :: Object)
73
+ # - WriteClassVariableNode.lexicalScopeNode uses GetDynamicLexicalScopeNode instead of (LexicalScopeNode lexicalScope = :: Object)
74
+ if !Primitive . vm_single_context? &&
75
+ expected_ast . include? ( "staticLexicalScope" ) ||
76
+ expected_ast . include? ( "ReadConstantWithLexicalScopeNode" ) ||
77
+ expected_ast . include? ( "ReadClassVariableNode" ) ||
78
+ expected_ast . include? ( "WriteConstantNode" ) ||
79
+ expected_ast . include? ( "WriteClassVariableNode" )
80
+ skip "Static lexical scopes are never set in multi context mode"
81
+ end
82
+
83
+ if TruffleRuby . jit?
84
+ skip "Don't run parsing specs when JIT is enabled because it affects AST"
85
+ end
86
+
66
87
# actual test check
67
88
actual_ast . should == expected_ast . strip
68
89
end
Original file line number Diff line number Diff line change @@ -658,4 +658,13 @@ protected long argvLength() {
658
658
}
659
659
}
660
660
661
+ @ Primitive (name = "vm_single_context?" )
662
+ public abstract static class VMSingleContext extends PrimitiveArrayArgumentsNode {
663
+
664
+ @ Specialization
665
+ protected boolean singleContext () {
666
+ return isSingleContext ();
667
+ }
668
+ }
669
+
661
670
}
Original file line number Diff line number Diff line change 34
34
35
35
public abstract class TruffleASTPrinter {
36
36
37
- private static final Set <String > attributesToIgnore = Set .of ("sourceCharIndex" , "sourceLength" );
37
+ // Skip the following node attributes:
38
+ // - "sourceCharIndex", "sourceLength" - are incorrect and will have correct values in YARP
39
+ // - "RubyRootNode.bodyCopy" - is set if clone-uninitialized is forced
40
+ private static final Set <String > attributesToIgnore = Set .of ("sourceCharIndex" , "sourceLength" , "bodyCopy" );
38
41
39
42
public static String dump (RubyRootNode rootNode , String focusedNodeClassName , int index ) {
40
43
final Node node ;
You can’t perform that action at this time.
0 commit comments