47
47
import com .oracle .truffle .api .dsl .ImportStatic ;
48
48
import com .oracle .truffle .api .dsl .Specialization ;
49
49
import org .truffleruby .language .objects .AllocationTracing ;
50
+ import org .truffleruby .language .objects .WriteObjectFieldNode ;
50
51
51
52
@ CoreModule (value = "Truffle::FFI::Pointer" , isClass = true )
52
53
public abstract class PointerNodes {
@@ -503,7 +504,8 @@ public abstract static class PointerReadPointerNode extends PrimitiveArrayArgume
503
504
504
505
@ Specialization
505
506
RubyPointer readPointer (long address ,
506
- @ Cached CheckNullPointerNode checkNullPointerNode ) {
507
+ @ Cached CheckNullPointerNode checkNullPointerNode ,
508
+ @ Cached WriteObjectFieldNode writeTypeSize ) {
507
509
final Pointer ptr = new Pointer (getContext (), address );
508
510
checkNullPointerNode .execute (this , ptr );
509
511
final Pointer readPointer = ptr .readPointer (getContext (), 0 );
@@ -512,6 +514,10 @@ RubyPointer readPointer(long address,
512
514
getLanguage ().truffleFFIPointerShape ,
513
515
readPointer );
514
516
AllocationTracing .trace (instance , this );
517
+
518
+ // We don't call Truffle::FFI::Pointer#initialize so we manually set it instead
519
+ writeTypeSize .execute (this , instance , "@type_size" , 1 );
520
+
515
521
return instance ;
516
522
}
517
523
0 commit comments