16
16
import java .util .concurrent .atomic .AtomicLong ;
17
17
18
18
import com .oracle .truffle .api .dsl .Bind ;
19
+ import com .oracle .truffle .api .dsl .GenerateCached ;
20
+ import com .oracle .truffle .api .dsl .GenerateInline ;
19
21
import com .oracle .truffle .api .nodes .Node ;
20
22
import org .truffleruby .RubyContext ;
21
23
import org .truffleruby .RubyLanguage ;
@@ -283,35 +285,39 @@ public static final class HandleBlockHolder {
283
285
}
284
286
285
287
@ GenerateUncached
288
+ @ GenerateInline
289
+ @ GenerateCached (false )
286
290
public abstract static class AllocateHandleNode extends RubyBaseNode {
287
291
288
292
private static final Set <ValueWrapper > keepAlive = ConcurrentHashMap .newKeySet ();
289
293
290
- public abstract long execute (ValueWrapper wrapper );
294
+ public abstract long execute (Node node , ValueWrapper wrapper );
291
295
292
296
@ Specialization (guards = "!isSharedObject(wrapper)" )
293
- long allocateHandleOnKnownThread (ValueWrapper wrapper ) {
294
- if (getContext ().getOptions ().CEXTS_KEEP_HANDLES_ALIVE ) {
297
+ static long allocateHandleOnKnownThread (Node node , ValueWrapper wrapper ) {
298
+ if (getContext (node ).getOptions ().CEXTS_KEEP_HANDLES_ALIVE ) {
295
299
keepAlive (wrapper );
296
300
}
297
301
return allocateHandle (
302
+ node ,
298
303
wrapper ,
299
- getContext (),
300
- getLanguage (),
301
- getBlockHolder (getContext (), getLanguage ()),
304
+ getContext (node ),
305
+ getLanguage (node ),
306
+ getBlockHolder (getContext (node ), getLanguage (node )),
302
307
false );
303
308
}
304
309
305
310
@ Specialization (guards = "isSharedObject(wrapper)" )
306
- long allocateSharedHandleOnKnownThread (ValueWrapper wrapper ) {
307
- if (getContext ().getOptions ().CEXTS_KEEP_HANDLES_ALIVE ) {
311
+ static long allocateSharedHandleOnKnownThread (Node node , ValueWrapper wrapper ) {
312
+ if (getContext (node ).getOptions ().CEXTS_KEEP_HANDLES_ALIVE ) {
308
313
keepAlive (wrapper );
309
314
}
310
315
return allocateHandle (
316
+ node ,
311
317
wrapper ,
312
- getContext (),
313
- getLanguage (),
314
- getBlockHolder (getContext (), getLanguage ()),
318
+ getContext (node ),
319
+ getLanguage (node ),
320
+ getBlockHolder (getContext (node ), getLanguage (node )),
315
321
true );
316
322
}
317
323
@@ -320,8 +326,8 @@ protected static void keepAlive(ValueWrapper wrapper) {
320
326
keepAlive .add (wrapper );
321
327
}
322
328
323
- protected long allocateHandle (ValueWrapper wrapper , RubyContext context , RubyLanguage language ,
324
- HandleBlockHolder holder , boolean shared ) {
329
+ protected static long allocateHandle (Node node , ValueWrapper wrapper , RubyContext context ,
330
+ RubyLanguage language , HandleBlockHolder holder , boolean shared ) {
325
331
HandleBlock block ;
326
332
if (shared ) {
327
333
block = holder .sharedHandleBlock ;
@@ -334,7 +340,7 @@ protected long allocateHandle(ValueWrapper wrapper, RubyContext context, RubyLan
334
340
}
335
341
336
342
if (context .getOptions ().BACKTRACE_ON_TO_NATIVE ) {
337
- context .getDefaultBacktraceFormatter ().printBacktraceOnEnvStderr ("ValueWrapper#toNative: " , this );
343
+ context .getDefaultBacktraceFormatter ().printBacktraceOnEnvStderr ("ValueWrapper#toNative: " , node );
338
344
}
339
345
340
346
if (block == null || block .isFull ()) {
0 commit comments