31
31
@ ReportPolymorphism
32
32
@ GenerateUncached
33
33
@ GenerateCached (false )
34
- @ GenerateInline ( inlineByDefault = true )
34
+ @ GenerateInline
35
35
public abstract class ForeignClassNode extends RubyBaseNode {
36
36
37
37
// Specs for traits are in
@@ -75,21 +75,21 @@ boolean isSet(int traits) {
75
75
public abstract RubyClass execute (Node node , Object value );
76
76
77
77
@ Specialization (guards = "getTraits(object, interop) == cachedTraits" , limit = "getInteropCacheLimit()" )
78
- protected RubyClass cached (Object object ,
78
+ protected static RubyClass cached (Node node , Object object ,
79
79
@ CachedLibrary ("object" ) InteropLibrary interop ,
80
80
@ Cached ("getTraits(object, interop)" ) int cachedTraits ) {
81
81
assert RubyGuards .isForeignObject (object );
82
- return classForTraits (cachedTraits );
82
+ return classForTraits (node , cachedTraits );
83
83
}
84
84
85
85
@ Specialization (replaces = "cached" , limit = "getInteropCacheLimit()" )
86
- protected RubyClass uncached (Object object ,
86
+ protected static RubyClass uncached (Node node , Object object ,
87
87
@ CachedLibrary ("object" ) InteropLibrary interop ) {
88
88
assert RubyGuards .isForeignObject (object );
89
- return classForTraits (getTraits (object , interop ));
89
+ return classForTraits (node , getTraits (object , interop ));
90
90
}
91
91
92
- protected int getTraits (Object object , InteropLibrary interop ) {
92
+ protected static int getTraits (Object object , InteropLibrary interop ) {
93
93
return (interop .hasHashEntries (object ) ? Trait .HASH .bit : 0 ) +
94
94
(interop .hasArrayElements (object ) ? Trait .ARRAY .bit : 0 ) +
95
95
(interop .isException (object ) ? Trait .EXCEPTION .bit : 0 ) +
@@ -104,25 +104,25 @@ protected int getTraits(Object object, InteropLibrary interop) {
104
104
(interop .isString (object ) ? Trait .STRING .bit : 0 );
105
105
}
106
106
107
- private RubyClass classForTraits (int traits ) {
108
- RubyClass rubyClass = coreLibrary ().polyglotForeignClasses [traits ];
107
+ private static RubyClass classForTraits (Node node , int traits ) {
108
+ RubyClass rubyClass = coreLibrary (node ).polyglotForeignClasses [traits ];
109
109
if (rubyClass == null ) {
110
110
CompilerDirectives .transferToInterpreterAndInvalidate ();
111
- rubyClass = resolvePolyglotForeignClass (traits );
112
- coreLibrary ().polyglotForeignClasses [traits ] = rubyClass ;
111
+ rubyClass = resolvePolyglotForeignClass (node , traits );
112
+ coreLibrary (node ).polyglotForeignClasses [traits ] = rubyClass ;
113
113
}
114
114
return rubyClass ;
115
115
}
116
116
117
- private RubyClass resolvePolyglotForeignClass (int traits ) {
117
+ private static RubyClass resolvePolyglotForeignClass (Node node , int traits ) {
118
118
final ArrayList <RubySymbol > traitsList = new ArrayList <>();
119
119
for (Trait trait : Trait .VALUES ) {
120
120
if (trait .isSet (traits )) {
121
- traitsList .add (getSymbol (trait .name ));
121
+ traitsList .add (getSymbol (node , trait .name ));
122
122
}
123
123
}
124
124
final Object [] traitSymbols = traitsList .toArray ();
125
- return (RubyClass ) DispatchNode .getUncached ().call (coreLibrary ().truffleInteropOperationsModule ,
125
+ return (RubyClass ) DispatchNode .getUncached ().call (coreLibrary (node ).truffleInteropOperationsModule ,
126
126
"resolve_polyglot_class" , traitSymbols );
127
127
}
128
128
}
0 commit comments