@@ -404,19 +404,13 @@ long doLongNativeWrapper(LongNativeWrapper object) {
404
404
return object .getValue ();
405
405
}
406
406
407
- @ Specialization (guards = {"isPrimitiveNativeWrapper (object)" , "object.isNative()" })
407
+ @ Specialization (guards = {"!isBoolNativeWrapper (object)" , "object.isNative()" })
408
408
Object doPrimitiveNativeWrapper (PrimitiveNativeWrapper object ) {
409
409
return getMaterializeNode ().execute (object );
410
410
}
411
411
412
- @ Specialization (guards = {"!isPrimitiveNativeWrapper(object)" , "object.getClass() == cachedClass" }, limit = "3" )
413
- Object doNativeWrapper (PythonNativeWrapper object ,
414
- @ SuppressWarnings ("unused" ) @ Cached ("object.getClass()" ) Class <? extends PythonNativeWrapper > cachedClass ) {
415
- return CompilerDirectives .castExact (object , cachedClass ).getDelegate ();
416
- }
417
-
418
- @ Specialization (guards = "!isPrimitiveNativeWrapper(object)" , replaces = "doNativeWrapper" )
419
- Object doNativeWrapperGeneric (PythonNativeWrapper object ) {
412
+ @ Specialization (guards = "!isPrimitiveNativeWrapper(object)" )
413
+ Object doNativeWrapper (PythonNativeWrapper object ) {
420
414
return object .getDelegate ();
421
415
}
422
416
@@ -473,7 +467,11 @@ Object run(Object obj) {
473
467
}
474
468
475
469
protected static boolean isPrimitiveNativeWrapper (PythonNativeWrapper object ) {
476
- return object instanceof PrimitiveNativeWrapper && !(object instanceof BoolNativeWrapper );
470
+ return object instanceof PrimitiveNativeWrapper ;
471
+ }
472
+
473
+ protected static boolean isBoolNativeWrapper (PythonNativeWrapper object ) {
474
+ return object instanceof BoolNativeWrapper ;
477
475
}
478
476
479
477
protected boolean isForeignObject (TruffleObject obj , GetLazyClassNode getClassNode , IsBuiltinClassProfile isForeignClassProfile ) {
@@ -598,16 +596,41 @@ public abstract static class ToJavaNode extends CExtBaseNode {
598
596
599
597
public abstract Object execute (Object value );
600
598
599
+ public abstract boolean executeBool (boolean value );
600
+
601
+ public abstract byte executeByte (byte value );
602
+
603
+ public abstract int executeInt (int value );
604
+
605
+ public abstract long executeLong (long value );
606
+
607
+ public abstract double executeDouble (double value );
608
+
601
609
@ Specialization
602
610
PythonAbstractObject doPythonObject (PythonAbstractObject value ) {
603
611
return value ;
604
612
}
605
613
606
614
@ Specialization
607
- Object doWrapper (PythonObjectNativeWrapper value ) {
615
+ Object doWrapper (PythonNativeWrapper value ) {
608
616
return toJavaNode .execute (value );
609
617
}
610
618
619
+ @ Specialization
620
+ String doString (String object ) {
621
+ return object ;
622
+ }
623
+
624
+ @ Specialization
625
+ boolean doBoolean (boolean b ) {
626
+ return b ;
627
+ }
628
+
629
+ @ Specialization
630
+ byte doLong (byte b ) {
631
+ return b ;
632
+ }
633
+
611
634
@ Fallback
612
635
Object doForeign (Object value ) {
613
636
if (callNativeNode == null ) {
0 commit comments