Skip to content

Commit 95a54f7

Browse files
committed
Add NOT_YET_COMPUTED_IDENTITY_HASH_CODE marker.
1 parent 6c47c24 commit 95a54f7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/meta/DirectSubstrateObjectConstant.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public SubstrateObjectConstant uncompress() {
7979

8080
@Override
8181
public int getIdentityHashCode() {
82-
if (identityHashCode == 0) {
82+
if (identityHashCode == NOT_YET_COMPUTED_IDENTITY_HASH_CODE) {
8383
VMError.guarantee(!SubstrateUtil.HOSTED);
8484
identityHashCode = computeIdentityHashCode(object);
8585
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/meta/SubstrateObjectConstant.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@
3535
import jdk.vm.ci.meta.VMConstant;
3636

3737
public abstract class SubstrateObjectConstant implements JavaConstant, TypedConstant, CompressibleConstant, VMConstant {
38+
protected static final int NOT_YET_COMPUTED_IDENTITY_HASH_CODE = -1;
39+
3840
public static JavaConstant forObject(Object object) {
39-
return forObject(object, false, 0);
41+
return forObject(object, false, NOT_YET_COMPUTED_IDENTITY_HASH_CODE);
4042
}
4143

4244
public static JavaConstant forObject(Object object, int identityHashCode) {
4345
return forObject(object, false, identityHashCode);
4446
}
4547

4648
public static JavaConstant forObject(Object object, boolean compressed) {
47-
return forObject(object, compressed, 0);
49+
return forObject(object, compressed, NOT_YET_COMPUTED_IDENTITY_HASH_CODE);
4850
}
4951

5052
public static JavaConstant forObject(Object object, boolean compressed, int identityHashCode) {

0 commit comments

Comments
 (0)