From 52b6b44c06da290d60e4f2ae437dbfd4934c55e0 Mon Sep 17 00:00:00 2001 From: Theresa Mammarella Date: Mon, 4 Dec 2023 14:41:11 -0500 Subject: [PATCH] Allow ValueType creation with new//putfield Signed-off-by: Theresa Mammarella --- runtime/bcutil/cfreader.c | 18 +++--------------- runtime/nls/cfre/cfrerr.nls | 8 -------- runtime/oti/j9modifiers_api.h | 2 +- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/runtime/bcutil/cfreader.c b/runtime/bcutil/cfreader.c index 6900e0c1b54..f60f9d3bed6 100644 --- a/runtime/bcutil/cfreader.c +++ b/runtime/bcutil/cfreader.c @@ -1876,22 +1876,10 @@ checkMethods(J9PortLibrary* portLib, J9CfrClassFile* classfile, U_8* segment, U_ } if (nameIndexOK && utf8Equal(&classfile->constantPool[method->nameIndex], "", 6)) { -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - /** - * The spec says a method of a value class cannot be . A method of an abstract class cannot be . - * For a value abstract class, its constructor is compiled into now, so allow in abstract classes. - */ - if (J9_IS_CLASSFILE_VALUETYPE(classfile) && J9_ARE_NO_BITS_SET(classfile->accessFlags, CFR_ACC_ABSTRACT)) { - errorCode = J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS__ID; + /* check no invalid flags set */ + if (value & ~CFR_INIT_METHOD_ACCESS_MASK) { + errorCode = J9NLS_CFR_ERR_INIT_METHOD__ID; goto _errorFound; - } else -#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ - { - /* check no invalid flags set */ - if (value & ~CFR_INIT_METHOD_ACCESS_MASK) { - errorCode = J9NLS_CFR_ERR_INIT_METHOD__ID; - goto _errorFound; - } } /* Java SE 9 Edition: diff --git a/runtime/nls/cfre/cfrerr.nls b/runtime/nls/cfre/cfrerr.nls index 03e03665aaf..279d2a85fc4 100644 --- a/runtime/nls/cfre/cfrerr.nls +++ b/runtime/nls/cfre/cfrerr.nls @@ -1505,14 +1505,6 @@ J9NLS_CFR_ERR_INVALID_FLAGS_ON_NEW.system_action=The JVM will throw a verificati J9NLS_CFR_ERR_INVALID_FLAGS_ON_NEW.user_response=Contact the provider of the class file for a corrected version. # END NON-TRANSLATABLE -# is not translatable -J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS=Methods of value classes cannot be named -# START NON-TRANSLATABLE -J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS.explanation=Please consult the Java Virtual Machine Specification for a detailed explanation. -J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS.system_action=The JVM will throw a verification or classloading related exception such as java.lang.ClassFormatError. -J9NLS_CFR_ERR_INIT_ON_VALUE_CLASS.user_response=Contact the provider of the class file for a corrected version. -# END NON-TRANSLATABLE - J9NLS_CFR_ERR_MISSING_ACC_STATIC_ON_ABSTRACT_IDENTITYLESS_CLASS_FIELD=In an abstract non-identity class, each field must be declared static. # START NON-TRANSLATABLE J9NLS_CFR_ERR_MISSING_ACC_STATIC_ON_ABSTRACT_IDENTITYLESS_CLASS_FIELD.explanation=Please consult the Java Virtual Machine Specification for a detailed explanation. diff --git a/runtime/oti/j9modifiers_api.h b/runtime/oti/j9modifiers_api.h index 088291e292c..892d719c89b 100644 --- a/runtime/oti/j9modifiers_api.h +++ b/runtime/oti/j9modifiers_api.h @@ -140,7 +140,7 @@ /* Class instances are allocated via the new bytecode */ #define J9ROMCLASS_ALLOCATES_VIA_NEW(romClass) \ - J9_ARE_NO_BITS_SET((romClass)->modifiers, J9AccAbstract | J9AccInterface | J9AccClassArray | J9AccValueType) + J9_ARE_NO_BITS_SET((romClass)->modifiers, J9AccAbstract | J9AccInterface | J9AccClassArray) /* Class instances are allocated via J9RAMClass->totalInstanceSize */ #define J9ROMCLASS_ALLOCATE_USES_TOTALINSTANCESIZE(romClass) \