Skip to content

Commit d836477

Browse files
committed
Throw IdentityException in monitorenter
...if class is value type Signed-off-by: Theresa Mammarella <[email protected]>
1 parent 2d614e1 commit d836477

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

runtime/oti/vmconstantpool.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
2323
<vmconstantpool>
2424
<classref name="java/lang/ArrayStoreException"/>
2525
<classref name="java/lang/ClassCastException"/>
26+
<classref name="java/lang/IdentityException" flags="opt_valhallaValueTypes"/>
2627
<classref name="java/lang/IllegalMonitorStateException"/>
2728
<classref name="java/lang/IndexOutOfBoundsException"/>
2829
<classref name="java/lang/NegativeArraySizeException"/>

runtime/vm/BytecodeInterpreter.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11224,7 +11224,7 @@ arrayIndex: {
1122411224
#define badClassName J9ROMCLASS_CLASSNAME(J9OBJECT_CLAZZ(_currentThread, (j9object_t)_currentThread->tempSlot)->romClass)
1122511225
#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES)
1122611226
if (J9_IS_J9CLASS_VALUETYPE(J9OBJECT_CLAZZ(_currentThread, (j9object_t)_currentThread->tempSlot))) {
11227-
setCurrentExceptionNLSWithArgs(_currentThread, J9NLS_VM_ERROR_BYTECODE_OBJECTREF_CANNOT_BE_VALUE_TYPE, J9VMCONSTANTPOOL_JAVALANGILLEGALMONITORSTATEEXCEPTION, J9UTF8_LENGTH(badClassName), J9UTF8_DATA(badClassName));
11227+
setCurrentExceptionNLSWithArgs(_currentThread, J9NLS_VM_ERROR_BYTECODE_OBJECTREF_CANNOT_BE_VALUE_TYPE, J9VMCONSTANTPOOL_JAVALANGIDENTITYEXCEPTION, J9UTF8_LENGTH(badClassName), J9UTF8_DATA(badClassName));
1122811228
} else
1122911229
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
1123011230
{

test/functional/Valhalla/src_qtypes/org/openj9/test/lworld/ValueTypeTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ static public void testMonitorEnterAndExitOnValueType() throws Throwable {
990990
try {
991991
monitorEnterAndExitOnValueType.invoke(valueType);
992992
Assert.fail("should throw exception. MonitorExit cannot be used with ValueType");
993-
} catch (IllegalMonitorStateException e) {}
993+
} catch (IdentityException e) {}
994994

995995
try {
996996
monitorEnterAndExitOnValueType.invoke(valueTypeArray);

0 commit comments

Comments
 (0)