@@ -66,8 +66,8 @@ public static void checkNull(
66
66
67
67
private abstract static class PointerPrimitiveArrayArgumentsNode extends PrimitiveArrayArgumentsNode {
68
68
69
- protected void checkNull (Pointer ptr , InlinedBranchProfile nullPointerProfile ) {
70
- PointerNodes .checkNull (ptr , getContext (), this , nullPointerProfile );
69
+ protected static void checkNull (Node node , Pointer ptr , InlinedBranchProfile nullPointerProfile ) {
70
+ PointerNodes .checkNull (ptr , getContext (node ), node , nullPointerProfile );
71
71
}
72
72
73
73
}
@@ -245,7 +245,7 @@ public abstract static class PointerCopyMemoryNode extends PointerPrimitiveArray
245
245
protected Object copyMemory (long to , long from , long size ,
246
246
@ Cached InlinedBranchProfile nullPointerProfile ) {
247
247
final Pointer ptr = new Pointer (getContext (), to );
248
- checkNull (ptr , nullPointerProfile );
248
+ checkNull (this , ptr , nullPointerProfile );
249
249
ptr .writeBytes (0 , new Pointer (getContext (), from ), 0 , size );
250
250
return nil ;
251
251
}
@@ -268,7 +268,7 @@ protected RubyString readStringToNull(long address, long limit,
268
268
@ CachedLibrary (limit = "1" ) @ Shared InteropLibrary interop ,
269
269
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
270
270
final Pointer ptr = new Pointer (getContext (), address );
271
- checkNull (ptr , nullPointerProfile );
271
+ checkNull (this , ptr , nullPointerProfile );
272
272
final byte [] bytes = ptr .readZeroTerminatedByteArray (getContext (), interop , 0 , limit );
273
273
return createString (fromByteArrayNode , bytes , Encodings .BINARY );
274
274
}
@@ -279,7 +279,7 @@ protected RubyString readStringToNull(long address, Nil limit,
279
279
@ Cached @ Shared TruffleString .FromByteArrayNode fromByteArrayNode ,
280
280
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
281
281
final Pointer ptr = new Pointer (getContext (), address );
282
- checkNull (ptr , nullPointerProfile );
282
+ checkNull (this , ptr , nullPointerProfile );
283
283
final byte [] bytes = ptr .readZeroTerminatedByteArray (getContext (), interop , 0 );
284
284
return createString (fromByteArrayNode , bytes , Encodings .BINARY );
285
285
}
@@ -298,7 +298,7 @@ protected Object readBytes(RubyByteArray array, int arrayOffset, long address, i
298
298
// No need to check the pointer address if we read nothing
299
299
return nil ;
300
300
} else {
301
- checkNull (ptr , nullPointerProfile );
301
+ checkNull (this , ptr , nullPointerProfile );
302
302
final byte [] bytes = array .bytes ;
303
303
ptr .readBytes (0 , bytes , arrayOffset , length );
304
304
return nil ;
@@ -320,7 +320,7 @@ protected RubyString readBytes(long address, int length,
320
320
// No need to check the pointer address if we read nothing
321
321
return createString (TStringConstants .EMPTY_BINARY , Encodings .BINARY );
322
322
} else {
323
- checkNull (ptr , nullPointerProfile );
323
+ checkNull (this , ptr , nullPointerProfile );
324
324
final byte [] bytes = new byte [length ];
325
325
ptr .readBytes (0 , bytes , 0 , length );
326
326
return createString (fromByteArrayNode , bytes , Encodings .BINARY );
@@ -347,7 +347,7 @@ protected static Object writeBytes(long address, Object string, int index, int l
347
347
348
348
if (nonZeroProfile .profile (node , length != 0 )) {
349
349
// No need to check the pointer address if we write nothing
350
- checkNull (ptr , nullPointerProfile );
350
+ checkNull (node , ptr , nullPointerProfile );
351
351
352
352
copyToNativeMemoryNode .execute (tstring , index , ptr , 0 , length , encoding );
353
353
}
@@ -366,7 +366,7 @@ public abstract static class PointerReadCharNode extends PointerPrimitiveArrayAr
366
366
protected int readCharSigned (long address ,
367
367
@ Cached InlinedBranchProfile nullPointerProfile ) {
368
368
final Pointer ptr = new Pointer (getContext (), address );
369
- checkNull (ptr , nullPointerProfile );
369
+ checkNull (this , ptr , nullPointerProfile );
370
370
return ptr .readByte (0 );
371
371
}
372
372
@@ -379,7 +379,7 @@ public abstract static class PointerReadUCharNode extends PointerPrimitiveArrayA
379
379
protected int readCharUnsigned (long address ,
380
380
@ Cached InlinedBranchProfile nullPointerProfile ) {
381
381
final Pointer ptr = new Pointer (getContext (), address );
382
- checkNull (ptr , nullPointerProfile );
382
+ checkNull (this , ptr , nullPointerProfile );
383
383
return Byte .toUnsignedInt (ptr .readByte (0 ));
384
384
}
385
385
@@ -392,7 +392,7 @@ public abstract static class PointerReadShortNode extends PointerPrimitiveArrayA
392
392
protected int readShortSigned (long address ,
393
393
@ Cached InlinedBranchProfile nullPointerProfile ) {
394
394
final Pointer ptr = new Pointer (getContext (), address );
395
- checkNull (ptr , nullPointerProfile );
395
+ checkNull (this , ptr , nullPointerProfile );
396
396
return ptr .readShort (0 );
397
397
}
398
398
}
@@ -404,7 +404,7 @@ public abstract static class PointerReadUShortNode extends PointerPrimitiveArray
404
404
protected int readShortUnsigned (long address ,
405
405
@ Cached InlinedBranchProfile nullPointerProfile ) {
406
406
final Pointer ptr = new Pointer (getContext (), address );
407
- checkNull (ptr , nullPointerProfile );
407
+ checkNull (this , ptr , nullPointerProfile );
408
408
return Short .toUnsignedInt (ptr .readShort (0 ));
409
409
}
410
410
@@ -417,7 +417,7 @@ public abstract static class PointerReadIntNode extends PointerPrimitiveArrayArg
417
417
protected int readIntSigned (long address ,
418
418
@ Cached InlinedBranchProfile nullPointerProfile ) {
419
419
final Pointer ptr = new Pointer (getContext (), address );
420
- checkNull (ptr , nullPointerProfile );
420
+ checkNull (this , ptr , nullPointerProfile );
421
421
return ptr .readInt (0 );
422
422
}
423
423
@@ -430,7 +430,7 @@ public abstract static class PointerReadUIntNode extends PointerPrimitiveArrayAr
430
430
protected long readIntUnsigned (long address ,
431
431
@ Cached InlinedBranchProfile nullPointerProfile ) {
432
432
final Pointer ptr = new Pointer (getContext (), address );
433
- checkNull (ptr , nullPointerProfile );
433
+ checkNull (this , ptr , nullPointerProfile );
434
434
return Integer .toUnsignedLong (ptr .readInt (0 ));
435
435
}
436
436
@@ -443,7 +443,7 @@ public abstract static class PointerReadLongNode extends PointerPrimitiveArrayAr
443
443
protected long readLongSigned (long address ,
444
444
@ Cached InlinedBranchProfile nullPointerProfile ) {
445
445
final Pointer ptr = new Pointer (getContext (), address );
446
- checkNull (ptr , nullPointerProfile );
446
+ checkNull (this , ptr , nullPointerProfile );
447
447
return ptr .readLong (0 );
448
448
}
449
449
@@ -456,7 +456,7 @@ public abstract static class PointerReadULongNode extends PointerPrimitiveArrayA
456
456
protected Object readLongUnsigned (long address ,
457
457
@ Cached InlinedBranchProfile nullPointerProfile ) {
458
458
final Pointer ptr = new Pointer (getContext (), address );
459
- checkNull (ptr , nullPointerProfile );
459
+ checkNull (this , ptr , nullPointerProfile );
460
460
return readUnsignedLong (ptr , 0 );
461
461
}
462
462
@@ -475,7 +475,7 @@ public abstract static class PointerReadFloatNode extends PointerPrimitiveArrayA
475
475
protected double readFloat (long address ,
476
476
@ Cached InlinedBranchProfile nullPointerProfile ) {
477
477
final Pointer ptr = new Pointer (getContext (), address );
478
- checkNull (ptr , nullPointerProfile );
478
+ checkNull (this , ptr , nullPointerProfile );
479
479
return ptr .readFloat (0 );
480
480
}
481
481
@@ -488,7 +488,7 @@ public abstract static class PointerReadDoubleNode extends PointerPrimitiveArray
488
488
protected double readDouble (long address ,
489
489
@ Cached InlinedBranchProfile nullPointerProfile ) {
490
490
final Pointer ptr = new Pointer (getContext (), address );
491
- checkNull (ptr , nullPointerProfile );
491
+ checkNull (this , ptr , nullPointerProfile );
492
492
return ptr .readDouble (0 );
493
493
}
494
494
@@ -501,7 +501,7 @@ public abstract static class PointerReadPointerNode extends PointerPrimitiveArra
501
501
protected RubyPointer readPointer (long address ,
502
502
@ Cached InlinedBranchProfile nullPointerProfile ) {
503
503
final Pointer ptr = new Pointer (getContext (), address );
504
- checkNull (ptr , nullPointerProfile );
504
+ checkNull (this , ptr , nullPointerProfile );
505
505
final Pointer readPointer = ptr .readPointer (getContext (), 0 );
506
506
final RubyPointer instance = new RubyPointer (
507
507
coreLibrary ().truffleFFIPointerClass ,
@@ -521,7 +521,7 @@ public abstract static class PointerWriteCharNode extends PointerPrimitiveArrayA
521
521
protected Object writeChar (long address , int value ,
522
522
@ Cached InlinedBranchProfile nullPointerProfile ) {
523
523
final Pointer ptr = new Pointer (getContext (), address );
524
- checkNull (ptr , nullPointerProfile );
524
+ checkNull (this , ptr , nullPointerProfile );
525
525
byte byteValue = (byte ) value ;
526
526
ptr .writeByte (0 , byteValue );
527
527
return nil ;
@@ -537,7 +537,7 @@ public abstract static class PointerWriteUCharNode extends PointerPrimitiveArray
537
537
protected Object writeChar (long address , int value ,
538
538
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
539
539
final Pointer ptr = new Pointer (getContext (), address );
540
- checkNull (ptr , nullPointerProfile );
540
+ checkNull (this , ptr , nullPointerProfile );
541
541
byte byteValue = (byte ) value ;
542
542
ptr .writeByte (0 , byteValue );
543
543
return nil ;
@@ -547,7 +547,7 @@ protected Object writeChar(long address, int value,
547
547
protected Object writeUnsignedChar (long address , int value ,
548
548
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
549
549
final Pointer ptr = new Pointer (getContext (), address );
550
- checkNull (ptr , nullPointerProfile );
550
+ checkNull (this , ptr , nullPointerProfile );
551
551
byte signed = (byte ) value ; // Same as value - 2^8
552
552
ptr .writeByte (0 , signed );
553
553
return nil ;
@@ -563,7 +563,7 @@ public abstract static class PointerWriteShortNode extends PointerPrimitiveArray
563
563
protected Object writeShort (long address , int value ,
564
564
@ Cached InlinedBranchProfile nullPointerProfile ) {
565
565
final Pointer ptr = new Pointer (getContext (), address );
566
- checkNull (ptr , nullPointerProfile );
566
+ checkNull (this , ptr , nullPointerProfile );
567
567
short shortValue = (short ) value ;
568
568
ptr .writeShort (0 , shortValue );
569
569
return nil ;
@@ -579,7 +579,7 @@ public abstract static class PointerWriteUShortNode extends PointerPrimitiveArra
579
579
protected Object writeShort (long address , int value ,
580
580
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
581
581
final Pointer ptr = new Pointer (getContext (), address );
582
- checkNull (ptr , nullPointerProfile );
582
+ checkNull (this , ptr , nullPointerProfile );
583
583
short shortValue = (short ) value ;
584
584
ptr .writeShort (0 , shortValue );
585
585
return nil ;
@@ -589,7 +589,7 @@ protected Object writeShort(long address, int value,
589
589
protected Object writeUnsignedSort (long address , int value ,
590
590
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
591
591
final Pointer ptr = new Pointer (getContext (), address );
592
- checkNull (ptr , nullPointerProfile );
592
+ checkNull (this , ptr , nullPointerProfile );
593
593
short signed = (short ) value ; // Same as value - 2^16
594
594
ptr .writeShort (0 , signed );
595
595
return nil ;
@@ -604,7 +604,7 @@ public abstract static class PointerWriteIntNode extends PointerPrimitiveArrayAr
604
604
protected Object writeInt (long address , int value ,
605
605
@ Cached InlinedBranchProfile nullPointerProfile ) {
606
606
final Pointer ptr = new Pointer (getContext (), address );
607
- checkNull (ptr , nullPointerProfile );
607
+ checkNull (this , ptr , nullPointerProfile );
608
608
ptr .writeInt (0 , value );
609
609
return nil ;
610
610
}
@@ -621,7 +621,7 @@ public abstract static class PointerWriteUIntNode extends PointerPrimitiveArrayA
621
621
protected Object writeInt (long address , int value ,
622
622
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
623
623
final Pointer ptr = new Pointer (getContext (), address );
624
- checkNull (ptr , nullPointerProfile );
624
+ checkNull (this , ptr , nullPointerProfile );
625
625
ptr .writeInt (0 , value );
626
626
return nil ;
627
627
}
@@ -630,7 +630,7 @@ protected Object writeInt(long address, int value,
630
630
protected Object writeUnsignedInt (long address , long value ,
631
631
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
632
632
final Pointer ptr = new Pointer (getContext (), address );
633
- checkNull (ptr , nullPointerProfile );
633
+ checkNull (this , ptr , nullPointerProfile );
634
634
int signed = (int ) value ; // Same as value - 2^32
635
635
ptr .writeInt (0 , signed );
636
636
return nil ;
@@ -645,7 +645,7 @@ public abstract static class PointerWriteLongNode extends PointerPrimitiveArrayA
645
645
protected Object writeLong (long address , long value ,
646
646
@ Cached InlinedBranchProfile nullPointerProfile ) {
647
647
final Pointer ptr = new Pointer (getContext (), address );
648
- checkNull (ptr , nullPointerProfile );
648
+ checkNull (this , ptr , nullPointerProfile );
649
649
ptr .writeLong (0 , value );
650
650
return nil ;
651
651
}
@@ -659,7 +659,7 @@ public abstract static class PointerWriteULongNode extends PointerPrimitiveArray
659
659
protected Object writeLong (long address , long value ,
660
660
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
661
661
final Pointer ptr = new Pointer (getContext (), address );
662
- checkNull (ptr , nullPointerProfile );
662
+ checkNull (this , ptr , nullPointerProfile );
663
663
ptr .writeLong (0 , value );
664
664
return nil ;
665
665
}
@@ -668,7 +668,7 @@ protected Object writeLong(long address, long value,
668
668
protected Object writeUnsignedLong (long address , RubyBignum value ,
669
669
@ Cached @ Shared InlinedBranchProfile nullPointerProfile ) {
670
670
final Pointer ptr = new Pointer (getContext (), address );
671
- checkNull (ptr , nullPointerProfile );
671
+ checkNull (this , ptr , nullPointerProfile );
672
672
writeUnsignedLong (ptr , 0 , value );
673
673
return nil ;
674
674
}
@@ -691,7 +691,7 @@ public abstract static class PointerWriteFloatNode extends PointerPrimitiveArray
691
691
protected Object writeFloat (long address , double value ,
692
692
@ Cached InlinedBranchProfile nullPointerProfile ) {
693
693
final Pointer ptr = new Pointer (getContext (), address );
694
- checkNull (ptr , nullPointerProfile );
694
+ checkNull (this , ptr , nullPointerProfile );
695
695
ptr .writeFloat (0 , (float ) value );
696
696
return nil ;
697
697
}
@@ -705,7 +705,7 @@ public abstract static class PointerWriteDoubleNode extends PointerPrimitiveArra
705
705
protected Object writeDouble (long address , double value ,
706
706
@ Cached InlinedBranchProfile nullPointerProfile ) {
707
707
final Pointer ptr = new Pointer (getContext (), address );
708
- checkNull (ptr , nullPointerProfile );
708
+ checkNull (this , ptr , nullPointerProfile );
709
709
ptr .writeDouble (0 , value );
710
710
return nil ;
711
711
}
@@ -719,7 +719,7 @@ public abstract static class PointerWritePointerNode extends PointerPrimitiveArr
719
719
protected Object writePointer (long address , long value ,
720
720
@ Cached InlinedBranchProfile nullPointerProfile ) {
721
721
final Pointer ptr = new Pointer (getContext (), address );
722
- checkNull (ptr , nullPointerProfile );
722
+ checkNull (this , ptr , nullPointerProfile );
723
723
ptr .writePointer (0 , value );
724
724
return nil ;
725
725
}
0 commit comments