File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -255,16 +255,17 @@ void toNative(
255255 @ Bind Node inliningTarget ,
256256 @ Cached CApiTransitions .FirstToNativeNode firstToNativeNode ) {
257257 if (!isNative ()) {
258+ boolean immortal ;
258259 if (isBool ()) {
259260 assert (PythonContext .get (inliningTarget ).getCApiContext ().getCachedBooleanPrimitiveNativeWrapper (value != 0 ) == this );
260- setNativePointer (firstToNativeNode .execute (inliningTarget , this , true /* immortal */ ));
261- return ;
261+ immortal = true ;
262+ } else {
263+ // small int values are cached and will be immortal
264+ immortal = isIntLike () && CApiGuards .isSmallLong (value );
265+ // if this wrapper wraps a small int value, this wrapper is one of the cached
266+ // primitive native wrappers
267+ assert !immortal || (PythonContext .get (inliningTarget ).getCApiContext ().getCachedPrimitiveNativeWrapper (value ) == this );
262268 }
263- // small int values are cached and will be immortal
264- boolean immortal = isIntLike () && CApiGuards .isSmallLong (value );
265- // if this wrapper wraps a small int value, this wrapper is one of the cached primitive
266- // native wrappers
267- assert !immortal || (PythonContext .get (inliningTarget ).getCApiContext ().getCachedPrimitiveNativeWrapper (value ) == this );
268269 setNativePointer (firstToNativeNode .execute (inliningTarget , this , immortal ));
269270 }
270271 }
You can’t perform that action at this time.
0 commit comments