Skip to content

Commit a20e4f8

Browse files
committed
Also allocate HPy handle for boxable values
1 parent 86f333b commit a20e4f8

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyDebugContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444

4545
import com.oracle.graal.python.util.PythonUtils;
4646
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
47-
import com.oracle.truffle.api.profiles.ConditionProfile;
4847

4948
public final class GraalHPyDebugContext extends GraalHPyContext {
5049

@@ -99,7 +98,7 @@ public int newGeneration() {
9998
}
10099

101100
private void trackHandle(GraalHPyHandle handle) {
102-
int id = handle.getId(this, ConditionProfile.getUncached());
101+
int id = handle.getIdDebug(this);
103102
if (id >= generationTable.length) {
104103
int newSize = Math.max(16, generationTable.length * 2);
105104
generationTable = PythonUtils.arrayCopyOf(generationTable, newSize);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyHandle.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ public int getId(GraalHPyContext context, ConditionProfile hasIdProfile) {
9999
return result;
100100
}
101101

102+
public int getIdDebug(GraalHPyContext context) {
103+
int result = id;
104+
if (id == -1) {
105+
result = context.getHPyHandleForObject(this);
106+
id = result;
107+
}
108+
return result;
109+
}
110+
102111
@ExportMessage
103112
boolean isPointer(
104113
@Exclusive @Cached ConditionProfile isNativeProfile) {

0 commit comments

Comments
 (0)