diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ArgBits.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ArgBits.java index d1f2ec49010..17bbf6af796 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ArgBits.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/ArgBits.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 IBM Corp. and others + * Copyright (c) 2009, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -22,6 +22,7 @@ package com.ibm.j9ddr.vm29.j9; import java.util.Arrays; +import com.ibm.j9ddr.vm29.pointer.helper.J9ClassHelper; /** * @author andhall @@ -49,7 +50,7 @@ public class ArgBits /* Parse the signature inside the ()'s */ char thisChar; while ((thisChar = signature.charAt(++stringPtr)) != ')') { - if ((thisChar == '[') || (thisChar == 'L')) { + if ((thisChar == '[') || J9ClassHelper.isRefOrValSignature(thisChar)) { /* Mark a bit for objects or arrays */ resultArray[writePtr] |= argBit; @@ -58,7 +59,7 @@ public class ArgBits stringPtr++; } - if (thisChar == 'L' ) { + if (J9ClassHelper.isRefOrValSignature(thisChar)) { /* Walk past the name of the object class */ while ((thisChar = signature.charAt(stringPtr)) != ';') { stringPtr++; diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/SendSlot.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/SendSlot.java index be8620eefad..9604bdeec05 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/SendSlot.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/SendSlot.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2014 IBM Corp. and others + * Copyright (c) 2009, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -23,6 +23,7 @@ import com.ibm.j9ddr.CorruptDataException; import com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer; +import com.ibm.j9ddr.vm29.pointer.helper.J9ClassHelper; import com.ibm.j9ddr.vm29.pointer.helper.J9UTF8Helper; import com.ibm.j9ddr.vm29.types.UDATA; @@ -46,13 +47,17 @@ public static UDATA getSendSlotsFromSignature(J9UTF8Pointer signature) throws Co case '[': /* skip all '['s */ for (i++; J9UTF8Helper.stringValue(signature).charAt(i) == '['; i++); - if (J9UTF8Helper.stringValue(signature).charAt(i) == 'L') { + char charAti = J9UTF8Helper.stringValue(signature).charAt(i); + if (J9ClassHelper.isRefOrValSignature(charAti)) { /* FALL THRU */ } else { sendArgs = sendArgs.add(1); break; } case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ for (i++; J9UTF8Helper.stringValue(signature).charAt(i) != ';'; i++); sendArgs = sendArgs.add(1); break; diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackmap/StackMap.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackmap/StackMap.java index 28420645d3d..9490d88307c 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackmap/StackMap.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackmap/StackMap.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2019 IBM Corp. and others + * Copyright (c) 2009, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -75,6 +75,7 @@ import com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodRefPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer; +import com.ibm.j9ddr.vm29.pointer.helper.J9ClassHelper; import com.ibm.j9ddr.vm29.pointer.helper.J9UTF8Helper; import com.ibm.j9ddr.vm29.types.I16; import com.ibm.j9ddr.vm29.types.I32; @@ -502,7 +503,7 @@ private int mapStack(U16 totalStack, byte[] map, utf8Signature = J9ROMFieldRefPointer.cast(pool.add(index)).nameAndSignature().signature(); signature = J9UTF8Helper.stringValue(utf8Signature).charAt(0); - if ((signature == 'L') || (signature == '[')) { + if (J9ClassHelper.isRefOrValSignature(signature) || (signature == '[')) { PUSH(OBJ); } else { PUSH(INT); @@ -515,7 +516,7 @@ private int mapStack(U16 totalStack, byte[] map, utf8Signature = J9ROMFieldRefPointer.cast(pool.add(index)).nameAndSignature().signature(); signature = J9UTF8Helper.stringValue(utf8Signature).charAt(0); - if ((signature == 'L') || (signature == '[')) { + if (J9ClassHelper.isRefOrValSignature(signature) || (signature == '[')) { PUSH(OBJ); } else { PUSH(INT); @@ -568,11 +569,11 @@ private int mapStack(U16 totalStack, byte[] map, POP(); if (args[i] == '[') { while (args[++i] == '['); - if (args[i] != 'L') { + if (J9ClassHelper.isRefOrValSignature(args[i])) { continue; } } - if (args[i] == 'L') { + if (J9ClassHelper.isRefOrValSignature(args[i])) { while (args[++i] != ';'); continue; } @@ -583,7 +584,7 @@ private int mapStack(U16 totalStack, byte[] map, signature = args[i + 1]; if (signature != 'V') { - if ((signature == 'L') || (signature == '[')) { + if (J9ClassHelper.isRefOrValSignature(signature) || (signature == '[')) { PUSH(OBJ); } else { PUSH(INT); @@ -612,11 +613,11 @@ private int mapStack(U16 totalStack, byte[] map, POP(); if (args[i] == '[') { while (args[++i] == '['); - if (args[i] != 'L') { + if (J9ClassHelper.isRefOrValSignature(args[i])) { continue; } } - if (args[i] == 'L') { + if (J9ClassHelper.isRefOrValSignature(args[i])) { while (args[++i] != ';'); continue; } @@ -627,7 +628,7 @@ private int mapStack(U16 totalStack, byte[] map, signature = args[i + 1]; if (signature != 'V') { - if ((signature == 'L') || (signature == '[')) { + if (J9ClassHelper.isRefOrValSignature(signature) || (signature == '[')) { PUSH(OBJ); } else { PUSH(INT); diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackwalker/JITStackWalker.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackwalker/JITStackWalker.java index 2dca4c89084..7f4dea41651 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackwalker/JITStackWalker.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/j9/stackwalker/JITStackWalker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2022 IBM Corp. and others + * Copyright (c) 2009, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -555,10 +555,10 @@ private void jitWalkResolveMethodFrame(WalkState walkState) throws CorruptDataEx while ((sigChar = jitNextSigChar(signatureString)) != ')') { switch (sigChar) { - /*[IF INLINE-TYPES]*/ - case 'Q': /* fall through */ - /*[ENDIF] INLINE-TYPES*/ case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ if (J9SW_ARGUMENT_REGISTER_COUNT_DEFINED && ! stackSpillCount.eq(0) ) { if ((walkState.flags & J9_STACKWALK_ITERATE_O_SLOTS) != 0) { try { @@ -635,10 +635,10 @@ private char jitNextSigChar(String signatureString) throws CorruptDataException } /* Fall through to consume type name, utfChar == 'L' for return value */ - /*[IF INLINE-TYPES]*/ - case 'Q': /* fall through */ - /*[ENDIF] INLINE-TYPES*/ case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ while (signatureString.charAt(charIndex++) != ';') ; } return utfChar; diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassHelper.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassHelper.java index 5ddb585bd43..e54a16ded76 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassHelper.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2021 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -167,8 +167,11 @@ public static String getJavaName(J9ClassPointer clazz) throws CorruptDataExcepti case 'S': return "void" + aritySuffix; case 'V': return "void" + aritySuffix; case 'Z': return "boolean" + aritySuffix; - - case 'L': + + case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ return getName(arrayClass.leafComponentType()) + aritySuffix; } @@ -526,4 +529,18 @@ public static boolean isAnonymousClass(J9ClassPointer clazz) throws CorruptDataE return J9ROMClassHelper.isAnonymousClass(clazz.romClass()); } + /** + * Queries if a given char is the first character of a reference or value type signature. + * Equivalent to J9's IS_REF_OR_VAL_SIGNATURE macro. + * + * @param firstChar the first character of the signature being checked + * @return true if the character indicates the beginning of a reference or value signature, false otherwise + */ + public static boolean isRefOrValSignature(char firstChar) { + return firstChar == 'L' + /*[IF INLINE-TYPES]*/ + || (firstChar == 'Q') + /*[ENDIF] INLINE-TYPES */ + ; + } } diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassLoaderHelper.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassLoaderHelper.java index f9c82ff901d..0cf88ba56af 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassLoaderHelper.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9ClassLoaderHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2014 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -31,6 +31,7 @@ import com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer; import com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer; +import com.ibm.j9ddr.vm29.pointer.helper.J9ClassHelper; public class J9ClassLoaderHelper { @@ -68,8 +69,8 @@ public static J9ClassPointer findClass(J9ClassLoaderPointer classLoader, String Iterator classIterator = ClassIterator.fromJ9Classloader(classLoader); int arity = calculateClassArity(signature); - - if (arity > 0 && signature.charAt(arity) != 'L') { + + if ((arity > 0) && !J9ClassHelper.isRefOrValSignature(signature.charAt(arity))) { return PRIMITIVE_TO_CLASS.get(signature.charAt(arity)); } else { while (classIterator.hasNext()) { diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9IndexableObjectHelper.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9IndexableObjectHelper.java index 8637508f4cf..79f54b4fe55 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9IndexableObjectHelper.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/pointer/helper/J9IndexableObjectHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2021 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -291,8 +291,11 @@ public static void getData(J9IndexableObjectPointer objPointer, Object dst, int getBooleanData(objPointer, (boolean[])dst, start, length, destStart); break; } - + case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ case '[': { if (! (dst instanceof J9ObjectPointer[])) { @@ -462,8 +465,11 @@ public static Object getData(J9IndexableObjectPointer objPointer) throws Corrupt getBooleanData(objPointer, data, 0, arraySize, 0); return data; } - + case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ case '[': { J9ObjectPointer[] data = new J9ObjectPointer[arraySize]; @@ -540,6 +546,9 @@ public static String getDataAsString(J9IndexableObjectPointer array, int dumpLim break; case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ case '[': { J9ObjectPointer item = ((J9ObjectPointer[])data)[i]; diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9StaticsCommand.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9StaticsCommand.java index c03d46c1493..b8880338642 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9StaticsCommand.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/commands/J9StaticsCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2019 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -84,6 +84,9 @@ public void run(String command, String[] args, Context context, PrintStream out) switch (sig.charAt(0)) { case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ case '[': CommandUtils.dbgPrint(out, "\t%s %s %s (!j9romstaticfieldshape %s) = !j9object %s\n", fieldAddress.getHexAddress(), name, sig, field.getHexAddress(), fieldAddress.at(0).getHexValue()); diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/structureformat/extensions/J9ObjectStructureFormatter.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/structureformat/extensions/J9ObjectStructureFormatter.java index c88506e5f50..98bbb7998a8 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/structureformat/extensions/J9ObjectStructureFormatter.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/tools/ddrinteractive/structureformat/extensions/J9ObjectStructureFormatter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2020 IBM Corp. and others + * Copyright (c) 2010, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -221,13 +221,16 @@ private void formatArrayObject(PrintStream out, J9ClassPointer localClazz, U8Poi } break; case 'L': + /*[IF INLINE-TYPES]*/ + case 'Q': + /*[ENDIF] INLINE-TYPES */ case '[': if (ValueTypeHelper.getValueTypeHelper().isJ9ClassIsFlattened(localClazz)) { formatFlattenedObjectArray(out, tabLevel, begin, finish, array); } else { formatReferenceObjectArray(out, tabLevel, localClazz, begin, finish, array); } - break; + break; } } diff --git a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/view/dtfj/java/DTFJJavaClass.java b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/view/dtfj/java/DTFJJavaClass.java index 6aacc22700f..1736b9d02d6 100644 --- a/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/view/dtfj/java/DTFJJavaClass.java +++ b/debugtools/DDR_VM/src/com/ibm/j9ddr/vm29/view/dtfj/java/DTFJJavaClass.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -326,8 +326,8 @@ boolean isObjectArray() throws CorruptDataException, com.ibm.j9ddr.CorruptDataEx if (isArray()) { J9ArrayClassPointer arrayClass = J9ArrayClassPointer.cast(j9class); - //Any multi-dimensional array is an object array, as is any single dimensional array with an object type (i.e. [Lwhatever;) - if(arrayClass.arity().gt(1) || getName().charAt(1) == 'L') { + // Any multi-dimensional array is an object array, as is any single dimensional array with an object type (i.e. [Lwhatever; or [Qwhatever;). + if (arrayClass.arity().gt(1) || J9ClassHelper.isRefOrValSignature(getName().charAt(1))) { isObjectArray = true; } else { isObjectArray = false; diff --git a/jcl/src/java.base/share/classes/java/lang/J9VMInternals.java b/jcl/src/java.base/share/classes/java/lang/J9VMInternals.java index fc7e8e23028..239f75d6ea0 100644 --- a/jcl/src/java.base/share/classes/java/lang/J9VMInternals.java +++ b/jcl/src/java.base/share/classes/java/lang/J9VMInternals.java @@ -1,6 +1,6 @@ /*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/ /******************************************************************************* - * Copyright (c) 1998, 2022 IBM Corp. and others + * Copyright (c) 1998, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -507,7 +507,7 @@ static int fastIdentityHashCode(Object anObject) { */ static native int identityHashCode(Object anObject); - /*[IF INLINE-TYPES] */ + /*[IF INLINE-TYPES]*/ /** * Answers an integer hash code for the parameter. * The caller must ensure that the parameter is a value type. diff --git a/jcl/src/java.base/share/classes/java/lang/Object.java b/jcl/src/java.base/share/classes/java/lang/Object.java index 21c31665f13..9e001d28e6c 100644 --- a/jcl/src/java.base/share/classes/java/lang/Object.java +++ b/jcl/src/java.base/share/classes/java/lang/Object.java @@ -1,6 +1,6 @@ /*[INCLUDE-IF JAVA_SPEC_VERSION >= 8]*/ /******************************************************************************* - * Copyright (c) 1998, 2022 IBM Corp. and others + * Copyright (c) 1998, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -134,7 +134,7 @@ protected void finalize () throws Throwable { * @see #equals */ public int hashCode() { - /*[IF INLINE-TYPES] */ + /*[IF INLINE-TYPES]*/ if (this.getClass().isValue()) { return J9VMInternals.valueHashCode(this); } diff --git a/jcl/src/java.base/share/classes/java/lang/invoke/MethodTypeHelper.java b/jcl/src/java.base/share/classes/java/lang/invoke/MethodTypeHelper.java index 75f552b711a..31e2cdcbb68 100644 --- a/jcl/src/java.base/share/classes/java/lang/invoke/MethodTypeHelper.java +++ b/jcl/src/java.base/share/classes/java/lang/invoke/MethodTypeHelper.java @@ -1,6 +1,6 @@ /*[INCLUDE-IF Sidecar18-SE]*/ /******************************************************************************* - * Copyright (c) 2020, 2022 IBM Corp. and others + * Copyright (c) 2020, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -195,13 +195,17 @@ else if (PrimitiveClass.isPrimitiveClass(c)) { /* * Convert the string from bytecode format to the format needed for ClassLoader#loadClass(). * Change all '/' to '.'. - * Remove the 'L' & ';' from objects, unless they are array classes. + * Remove the 'L', 'Q', and ';' from objects, unless they are array classes. */ private static final Class nonPrimitiveClassFromString(String name, ClassLoader classLoader) { try { name = name.replace('/', '.'); - if (name.indexOf('L') == 0) { - // Remove the 'L' and ';' + if ((name.charAt(0) == 'L') + /*[IF INLINE-TYPES]*/ + || (name.charAt(0) == 'Q') + /*[ENDIF] INLINE-TYPES */ + ) { + // Remove the 'L'/'Q' and ';'. name = name.substring(1, name.length() - 1); } return Class.forName(name, false, classLoader); @@ -218,13 +222,21 @@ static final int parseIntoClass(char[] signature, int index, ArrayList> char current = signature[index]; Class c; - if ((current == 'L') || (current == '[')) { + if ((current == 'L') || (current == '[') + /*[IF INLINE-TYPES]*/ + || (current == 'Q') + /*[ENDIF] INLINE-TYPES */ + ) { int start = index; while(signature[index] == '[') { index++; } String name; - if (signature[index] != 'L') { + if ((signature[index] != 'L') + /*[IF INLINE-TYPES]*/ + && (signature[index] != 'Q') + /*[ENDIF] INLINE-TYPES */ + ) { name = descriptor.substring(start, index + 1); } else { int end = descriptor.indexOf(';', index); diff --git a/runtime/bcutil/ClassFileWriter.cpp b/runtime/bcutil/ClassFileWriter.cpp index d326976564b..485cbeb9d88 100644 --- a/runtime/bcutil/ClassFileWriter.cpp +++ b/runtime/bcutil/ClassFileWriter.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2021 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1250,11 +1250,14 @@ ClassFileWriter::computeArgsCount(U_16 methodRefIndex) while ((index < count) && ('[' == sig[index])) { index += 1; } - if ('L' != sig[index]) { + if (!IS_REF_OR_VAL_SIGNATURE(sig[index])) { break; } /* fall through */ case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ index += 1; while ((index < count) && (';' != sig[index])) { index += 1; diff --git a/runtime/bcutil/ROMClassWriter.cpp b/runtime/bcutil/ROMClassWriter.cpp index 25f913743ea..4bcb55c280c 100644 --- a/runtime/bcutil/ROMClassWriter.cpp +++ b/runtime/bcutil/ROMClassWriter.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2021 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -2146,7 +2146,7 @@ ROMClassWriter::writeNativeSignature(Cursor *cursor, U_8 *methodDescriptor, U_8 } else { cursor->writeU8(nativeArgCharConversion[methodDescriptor[index] - 'A'], Cursor::GENERIC); } - if ('L' == methodDescriptor[index]) { + if (IS_REF_OR_VAL_SIGNATURE(methodDescriptor[index])) { while (';' != methodDescriptor[index]) { ++index; } diff --git a/runtime/bcutil/cfreader.c b/runtime/bcutil/cfreader.c index 4f73394932c..7a26af9c4bc 100644 --- a/runtime/bcutil/cfreader.c +++ b/runtime/bcutil/cfreader.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1844,7 +1844,7 @@ checkMethods(J9PortLibrary* portLib, J9CfrClassFile* classfile, U_8* segment, U_ goto _errorFound; } } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* Check interface-method-only access flag constraints. */ if (classfile->accessFlags & CFR_ACC_INTERFACE) { @@ -1909,7 +1909,7 @@ checkMethods(J9PortLibrary* portLib, J9CfrClassFile* classfile, U_8* segment, U_ } } } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ _nameCheck: @@ -2067,7 +2067,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut goto _errorFound; } } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } if(checkAttributes(portLib, classfile, code->attributes, code->attributesCount, segment, -1, code->codeLength, flags)) { @@ -2092,7 +2092,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut errorCode = J9NLS_CFR_ERR_EXCEPTION_IS_REFERENCETYPE_DESCRIPTOR__ID; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } break; @@ -2237,7 +2237,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut errorCode = J9NLS_CFR_ERR_INNER_CLASS_REFERENCETYPE__ID; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* Check class name integrity? */ innerClassArrayIndexTable[value] = j; @@ -2265,9 +2265,9 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut if ( #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) bcvIsReferenceTypeDescriptor(classInfoUtf8) -#else /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ ('[' == classInfoUtf8->bytes[0]) -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ ) { errorCode = J9NLS_CFR_ERR_OUTER_CLASS_REFERENCETYPE_DESCRIPTOR__ID; goto _errorFound; @@ -2349,7 +2349,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut errorCode = J9NLS_CFR_ERR_ENCLOSING_METHOD_CLASS_INDEX_IS_REFERENCETYPE__ID; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ value = enclosing->methodIndex; if(value >= cpCount) { @@ -2540,7 +2540,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut errorCode = J9NLS_CFR_ERR_NEST_HOST_INVALID_REFERENCETYPE_DESCRIPTOR__ID; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ break; case CFR_ATTRIBUTE_NestMembers: { @@ -2560,7 +2560,7 @@ checkAttributes(J9PortLibrary* portLib, J9CfrClassFile* classfile, J9CfrAttribut errorCode = J9NLS_CFR_ERR_NEST_MEMBER_INVALID_REFERENCETYPE_DESCRIPTOR__ID; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } break; } @@ -2734,7 +2734,7 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32 offset = endOfConstantPool + 2; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } value = classfile->superClass; @@ -2766,7 +2766,7 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32 offset = endOfConstantPool + 4; goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } for (i = 0; i < classfile->interfacesCount; i++) { @@ -2800,7 +2800,7 @@ checkClass(J9PortLibrary *portLib, J9CfrClassFile* classfile, U_8* segment, U_32 offset = endOfConstantPool + 4 + (i << 1); goto _errorFound; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } /* Check that interfaces subclass object. */ diff --git a/runtime/bcutil/jsrinliner.c b/runtime/bcutil/jsrinliner.c index 138fd705f7d..f3d69147d39 100644 --- a/runtime/bcutil/jsrinliner.c +++ b/runtime/bcutil/jsrinliner.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1159,11 +1159,11 @@ evaluateCodeBlock (I_32 hasRET, J9JSRICodeBlock ** blockParentPointer, U_32 star stackError |= popStack (jsrData); if (args[step] == '[') { while (args[++step] == '['); - if (args[step] != 'L') { + if (!IS_REF_OR_VAL_SIGNATURE(args[step])) { continue; } } - if (args[step] == 'L') { + if (IS_REF_OR_VAL_SIGNATURE(args[step])) { while (args[++step] != ';'); continue; } diff --git a/runtime/bcverify/bcverify.c b/runtime/bcverify/bcverify.c index adbb5759ad9..2ca7f780c62 100644 --- a/runtime/bcverify/bcverify.c +++ b/runtime/bcverify/bcverify.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1166,6 +1166,9 @@ printMethod (J9BytecodeVerificationData * verifyData) break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -1220,8 +1223,11 @@ printMethod (J9BytecodeVerificationData * verifyData) case 'J': printf( "long"); break; - + case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { diff --git a/runtime/bcverify/staticverify.c b/runtime/bcverify/staticverify.c index 26f4410ff2c..87369a9ea58 100644 --- a/runtime/bcverify/staticverify.c +++ b/runtime/bcverify/staticverify.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1005,7 +1005,7 @@ checkBytecodeStructure (J9CfrClassFile * classfile, UDATA methodIndex, UDATA len errorType = J9NLS_CFR_ERR_ACONST_INIT_INVALID_ARRAY__ID; goto _verifyError; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ break; case CFR_BC_newarray: @@ -1680,10 +1680,10 @@ j9bcv_verifyClassStructure (J9PortLibrary * portLib, J9CfrClassFile * classfile, end = utf8->slot1; switch (utf8->bytes[arity]) { -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - case 'Q': /* fall through */ -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ case 'L': /* object array */ +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ if (utf8->bytes[--end] != ';') { errorType = J9NLS_CFR_ERR_BAD_CLASS_NAME__ID; goto _formatError; @@ -1842,7 +1842,7 @@ j9bcv_verifyClassStructure (J9PortLibrary * portLib, J9CfrClassFile * classfile, goto _formatError; } } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } break; @@ -1919,9 +1919,9 @@ j9bcv_verifyClassStructure (J9PortLibrary * portLib, J9CfrClassFile * classfile, if ( #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) (CFR_METHOD_NAME_NEW == isInit) -#else /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ FALSE -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ ) { U_16 returnChar = getReturnTypeFromSignature(info->bytes, info->slot1, NULL); if (J9_IS_CLASSFILE_PRIMITIVE_VALUETYPE(classfile)) { diff --git a/runtime/cfdumper/main.c b/runtime/cfdumper/main.c index efe371e1b5a..81d3ea4e91a 100644 --- a/runtime/cfdumper/main.c +++ b/runtime/cfdumper/main.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1107,6 +1107,9 @@ static void printMethod(J9CfrClassFile* classfile, J9CfrMethod* method) break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -1163,6 +1166,9 @@ static void printMethod(J9CfrClassFile* classfile, J9CfrMethod* method) break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -1277,8 +1283,10 @@ static void printField(J9CfrClassFile* classfile, J9CfrField* field) case 'J': j9tty_printf( PORTLIB, "long"); break; - case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -1373,6 +1381,9 @@ static void printDisassembledMethod(J9CfrClassFile* classfile, J9CfrMethod* meth break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -1429,6 +1440,9 @@ static void printDisassembledMethod(J9CfrClassFile* classfile, J9CfrMethod* meth break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ i++; while(string[i] != ';') { @@ -4428,6 +4442,9 @@ static void sun_formatField(J9CfrClassFile* classfile, J9CfrField* field, char * switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); @@ -4675,6 +4692,9 @@ static void sun_formatMethod(J9CfrClassFile* classfile, J9CfrMethod* method, cha switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); @@ -4740,6 +4760,9 @@ static void sun_formatMethod(J9CfrClassFile* classfile, J9CfrMethod* method, cha switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); @@ -5193,6 +5216,9 @@ static void j9_formatField(J9ROMClass* romClass, J9ROMFieldShape* field, char *f switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); @@ -5465,6 +5491,9 @@ static void j9_formatMethod(J9ROMClass* romClass, J9ROMMethod* method, char *for switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); @@ -5531,6 +5560,9 @@ static void j9_formatMethod(J9ROMClass* romClass, J9ROMMethod* method, char *for switch(string[j++]) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while((ch2 = string[j++]) != ';') { if(ch2 == '/') j9tty_output_char('.'); diff --git a/runtime/codert_vm/decomp.cpp b/runtime/codert_vm/decomp.cpp index 95f9d4abf38..873b48c645b 100644 --- a/runtime/codert_vm/decomp.cpp +++ b/runtime/codert_vm/decomp.cpp @@ -936,12 +936,12 @@ decompileOuterFrame(J9VMThread * currentThread, J9JITDecompileState * decompileS break; case 'J': #ifdef J9VM_ENV_DATA64 - case '[': /* fall through */ -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - case 'Q': /* fall through */ -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ + case '[': case 'L': -#endif /* #ifdef J9VM_ENV_DATA64 */ +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* J9VM_ENV_DATA64 */ j2iFrame->exitPoint = J9_BUILDER_SYMBOL(jitExitInterpreterJ); break; default: @@ -1076,14 +1076,14 @@ fixStackForNewDecompilation(J9VMThread * currentThread, J9StackWalkState * walkS *pcStoreAddress = (U_8 *) J9_BUILDER_SYMBOL(jitDecompileOnReturnJ); break; #ifdef J9VM_ENV_DATA64 - case '[': /* fall through */ -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - case 'Q': /* fall through */ -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ + case '[': case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ *pcStoreAddress = (U_8 *) J9_BUILDER_SYMBOL(jitDecompileOnReturnL); break; -#endif /* #ifdef J9VM_ENV_DATA64 */ +#endif /* J9VM_ENV_DATA64 */ default: *pcStoreAddress = (U_8 *) J9_BUILDER_SYMBOL(jitDecompileOnReturn1); break; diff --git a/runtime/codert_vm/jswalk.c b/runtime/codert_vm/jswalk.c index 2800e760d6b..fb7f7522339 100644 --- a/runtime/codert_vm/jswalk.c +++ b/runtime/codert_vm/jswalk.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1225,10 +1225,10 @@ static void jitWalkResolveMethodFrame(J9StackWalkState *walkState) while ((sigChar = jitNextSigChar(&sigData)) != ')') { switch (sigChar) { -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - case 'Q': /* fall through */ -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ #ifdef J9SW_ARGUMENT_REGISTER_COUNT if (stackSpillCount) { @@ -1335,10 +1335,10 @@ static UDATA jitNextSigChar(U_8 ** utfData) } /* Fall through to consume type name, utfChar == 'L' for return value */ -#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) - case 'Q': /* fall through */ -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while (jitNextUTFChar(utfData) != ';') ; } diff --git a/runtime/gc_check/CheckEngine.cpp b/runtime/gc_check/CheckEngine.cpp index 74a03de52a8..53d17d2ed0e 100644 --- a/runtime/gc_check/CheckEngine.cpp +++ b/runtime/gc_check/CheckEngine.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -897,9 +897,9 @@ GC_CheckEngine::checkClassStatics(J9JavaVM* vm, J9Class* clazz) U_8* toSearchString = J9UTF8_DATA(sigUTF); UDATA toSearchLength = J9UTF8_LENGTH(sigUTF); - if ('L' == J9UTF8_DATA(sigUTF)[0]) { + if (IS_REF_OR_VAL_SIGNATURE(toSearchString[0])) { /* Convert signature to class name: - * Entering 'L' as well as closing ';' must be removed to get a proper class name + * Entering 'L'/'Q' as well as closing ';' must be removed to get a proper class name */ toSearchString += 1; toSearchLength -= 2; diff --git a/runtime/gc_realtime/MetronomeAlarm.cpp b/runtime/gc_realtime/MetronomeAlarm.cpp index ef4a854fa24..6d7800ae77c 100644 --- a/runtime/gc_realtime/MetronomeAlarm.cpp +++ b/runtime/gc_realtime/MetronomeAlarm.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -45,7 +45,7 @@ #include #include #include -#endif /* #if defined(LINUX) */ +#endif /* defined(LINUX) */ #if defined(LINUX) && !defined(J9ZTPF) #include #include diff --git a/runtime/gc_realtime/OSInterface.cpp b/runtime/gc_realtime/OSInterface.cpp index d6b778d23ca..df562a1eff6 100644 --- a/runtime/gc_realtime/OSInterface.cpp +++ b/runtime/gc_realtime/OSInterface.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -35,7 +35,7 @@ #include #include #include -#endif /* #if defined(LINUX) */ +#endif /* defined(LINUX) */ #if defined(LINUX) && !defined(J9ZTPF) #include diff --git a/runtime/j9vm/jvm.h b/runtime/j9vm/jvm.h index 224dd8e110c..c2a28f366c4 100644 --- a/runtime/j9vm/jvm.h +++ b/runtime/j9vm/jvm.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2018 IBM Corp. and others + * Copyright (c) 2002, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -42,7 +42,7 @@ extern "C" { /* There is a collision between J9's definition of BOOLEAN and WIN32 headers */ #define BOOLEAN_COLLISION_DETECTED BOOLEAN #undef BOOLEAN -#endif /* #ifdef BOOLEAN */ +#endif /* BOOLEAN */ /* Undefine the winsockapi because winsock2 defines it. Removes warnings. */ #if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_) @@ -54,7 +54,7 @@ extern "C" { #ifdef BOOLEAN_COLLISION_DETECTED #define BOOLEAN UDATA #undef BOOLEAN_COLLISION_DETECTED -#endif /* #ifdef BOOLEAN_COLLISION_DETECTED */ +#endif /* BOOLEAN_COLLISION_DETECTED */ #endif /* WIN32 */ diff --git a/runtime/jcl/common/java_dyn_methodhandle.c b/runtime/jcl/common/java_dyn_methodhandle.c index ca319346a14..b713e4d93fc 100644 --- a/runtime/jcl/common/java_dyn_methodhandle.c +++ b/runtime/jcl/common/java_dyn_methodhandle.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2022 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -345,7 +345,7 @@ accessCheckFieldSignature(J9VMThread *currentThread, J9Class* lookupClass, UDATA sigOffset += 1; } - if ('L' == lookupSigData[sigOffset]) { + if (IS_REF_OR_VAL_SIGNATURE(lookupSigData[sigOffset])) { BOOLEAN isVirtual = (0 == (((J9ROMFieldShape*)romField)->modifiers & J9AccStatic)); j9object_t argsArray = J9VMJAVALANGINVOKEMETHODTYPE_PTYPES(currentThread, methodType); U_32 numParameters = J9INDEXABLEOBJECT_SIZE(currentThread, argsArray); @@ -433,7 +433,7 @@ accessCheckMethodSignature(J9VMThread *currentThread, J9Method *method, j9object endIndex = index; /* If this entry is a class type, we need to do a classloader check on it */ - if ('L' == lookupSigData[index]) { + if (IS_REF_OR_VAL_SIGNATURE(lookupSigData[index])) { index += 1; clazz = J9JAVAARRAYOFOBJECT_LOAD(currentThread, argsArray, i); @@ -462,7 +462,7 @@ accessCheckMethodSignature(J9VMThread *currentThread, J9Method *method, j9object while ('[' == lookupSigData[index]) { index += 1; } - if('L' == lookupSigData[index]) { + if(IS_REF_OR_VAL_SIGNATURE(lookupSigData[index])) { J9Class *returnRamClass = NULL; /* Grab the MethodType returnType */ clazz = J9VMJAVALANGINVOKEMETHODTYPE_RTYPE(currentThread, methodType); diff --git a/runtime/jcl/common/java_lang_invoke_MethodHandleNatives.cpp b/runtime/jcl/common/java_lang_invoke_MethodHandleNatives.cpp index 8c6c7cde339..bc9e1a8e60d 100644 --- a/runtime/jcl/common/java_lang_invoke_MethodHandleNatives.cpp +++ b/runtime/jcl/common/java_lang_invoke_MethodHandleNatives.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, 2022 IBM Corp. and others + * Copyright (c) 2021, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -1008,11 +1008,11 @@ Java_java_lang_invoke_MethodHandleNatives_resolve( J9BytecodeVerificationData *verifyData = vm->bytecodeVerificationData; U_16 sigOffset = 0; - /* Skip the '[', 'L' prefix */ + /* Skip the '[', 'L', or 'Q' prefix */ while ('[' == J9UTF8_DATA(signature)[sigOffset]) { sigOffset += 1; } - if ('L' == J9UTF8_DATA(signature)[sigOffset]) { + if (IS_REF_OR_VAL_SIGNATURE(J9UTF8_DATA(signature)[sigOffset])) { sigOffset += 1; omrthread_monitor_enter(vm->classTableMutex); UDATA clConstraintResult = verifyData->checkClassLoadingConstraintForNameFunction( diff --git a/runtime/jcl/common/java_lang_invoke_VarHandle.c b/runtime/jcl/common/java_lang_invoke_VarHandle.c index 84ebc10ec48..b0fb27ab93c 100644 --- a/runtime/jcl/common/java_lang_invoke_VarHandle.c +++ b/runtime/jcl/common/java_lang_invoke_VarHandle.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 IBM Corp. and others + * Copyright (c) 2016, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -51,7 +51,7 @@ accessCheckFieldType(J9VMThread *currentThread, J9Class* lookupClass, J9Class* t if (NULL != verifyData) { U_8 *lookupSigData = J9UTF8_DATA(lookupSig); /* Only check reference types (not primitive types) */ - if ('L' == *lookupSigData) { + if (IS_REF_OR_VAL_SIGNATURE(*lookupSigData)) { J9ClassLoader *lookupClassloader = lookupClass->classLoader; J9ClassLoader *typeClassloader = type->classLoader; if (typeClassloader != lookupClassloader) { diff --git a/runtime/jcl/common/reflecthelp.c b/runtime/jcl/common/reflecthelp.c index f897fdf9329..1b0a190228e 100644 --- a/runtime/jcl/common/reflecthelp.c +++ b/runtime/jcl/common/reflecthelp.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2022 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -258,11 +258,14 @@ computeArgCount(J9ROMMethod *method) while ((index < count) && ('[' == bytes[index])) { index += 1; } - if ('L' != bytes[index]) { + if (!IS_REF_OR_VAL_SIGNATURE(bytes[index])) { break; } /* fall through */ case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ index += 1; while ((index < count) && (';' != bytes[index])) { index += 1; @@ -549,7 +552,7 @@ getArgCountFromSignature(J9UTF8* signature) i++; } /* skip class name */ - if ('L' == sigData[i]) { + if (IS_REF_OR_VAL_SIGNATURE(sigData[i])) { while (';' != sigData[i]) { i++; } diff --git a/runtime/jnichk/jnicbuf.c b/runtime/jnichk/jnicbuf.c index 6839b9d07b0..4992e5dbc97 100644 --- a/runtime/jnichk/jnicbuf.c +++ b/runtime/jnichk/jnicbuf.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -108,6 +108,9 @@ computeArgsCRC(const jvalue *args, jmethodID methodID) /* ignore square brackets and just count the leaf type as one argument */ break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while (*++sigArgs != ';') { /* skip up to the semi-colon */ } diff --git a/runtime/jnichk/jnicheck.c b/runtime/jnichk/jnicheck.c index c965c4634bc..e3ac3e91bd7 100644 --- a/runtime/jnichk/jnicheck.c +++ b/runtime/jnichk/jnicheck.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2020 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -478,6 +478,9 @@ jniCheckCallV(const char* function, JNIEnv* env, jobject receiver, UDATA methodT } switch (*sigArgs) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ case '[': sigArgs = jniCheckObjectArg(function, env, va_arg(args, jobject), sigArgs, argNum, trace); break; @@ -526,6 +529,9 @@ jniCheckCallA(const char* function, JNIEnv* env, jobject receiver, UDATA methodT } switch (*sigArgs) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ case '[': sigArgs = jniCheckObjectArg(function, env, args++->l, sigArgs, argNum, trace); break; @@ -1923,6 +1929,9 @@ jniDecodeValue(J9VMThread * vmThread, UDATA sigChar, void * valuePtr, char ** ou written = j9str_printf(PORTLIB, *outputBuffer, *outputBufferLength, "(jboolean)%s", *((I_32 *) valuePtr) ? "true" : "false"); break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ written = j9str_printf(PORTLIB, *outputBuffer, *outputBufferLength, "(jobject)0x%p", *((UDATA *) valuePtr)); break; default: @@ -1961,6 +1970,9 @@ static UDATA jniNextSigChar(U_8 ** utfData) /* Fall through to consume type name, utfChar == 'L' for return value */ case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while (*data++ != ';') ; } @@ -2453,6 +2465,9 @@ jniCheckObjectArg(const char* function, JNIEnv* env, jobject aJobject, char* sig switch (*sigArgs) { case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ while (*sigArgs != ';') { sigArgs++; } @@ -2461,7 +2476,7 @@ jniCheckObjectArg(const char* function, JNIEnv* env, jobject aJobject, char* sig while (*sigArgs == '[') { sigArgs++; } - if (*sigArgs == 'L') { + if (IS_REF_OR_VAL_SIGNATURE(*sigArgs)) { while (*sigArgs != ';') { sigArgs++; } diff --git a/runtime/jvmti/jvmtiForceEarlyReturn.c b/runtime/jvmti/jvmtiForceEarlyReturn.c index 5d1bf8ba63a..f0846c5c993 100644 --- a/runtime/jvmti/jvmtiForceEarlyReturn.c +++ b/runtime/jvmti/jvmtiForceEarlyReturn.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -191,6 +191,9 @@ jvmtiForceEarlyReturn(jvmtiEnv* env, methodReturnType = JVMTI_TYPE_JDOUBLE; break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ methodReturnType = JVMTI_TYPE_JOBJECT; break; } diff --git a/runtime/jvmti/jvmtiHelpers.c b/runtime/jvmti/jvmtiHelpers.c index 66f4e4c1f9b..8c84ebb9ba1 100644 --- a/runtime/jvmti/jvmtiHelpers.c +++ b/runtime/jvmti/jvmtiHelpers.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -661,7 +661,7 @@ skipSignature(U_8 ** pUtfData) /* Skip to the end of Object type signatures */ - if (utfChar == 'L') { + if (IS_REF_OR_VAL_SIGNATURE(utfChar)) { do { utfChar = nextUTFChar(pUtfData); } while (utfChar != ';'); @@ -921,6 +921,9 @@ fillInJValue(char signatureType, jvalue * jvaluePtr, void * valueAddress, j9obje memcpy(&(jvaluePtr->d), valueAddress, 8); break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ object = *((j9object_t*) valueAddress); if (object == NULL) { jvaluePtr->l = NULL; diff --git a/runtime/jvmti/jvmtiLocalVariable.c b/runtime/jvmti/jvmtiLocalVariable.c index 6ff98f77419..d3593c450c9 100644 --- a/runtime/jvmti/jvmtiLocalVariable.c +++ b/runtime/jvmti/jvmtiLocalVariable.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -385,6 +385,9 @@ jvmtiGetOrSetLocal(jvmtiEnv *env, memcpy(slotAddress - 1, value_ptr, sizeof(U_64)); break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* Perform type check? */ *((j9object_t *)slotAddress) = (NULL == value_ptr) ? NULL : *((j9object_t *)value_ptr); break; @@ -409,6 +412,9 @@ jvmtiGetOrSetLocal(jvmtiEnv *env, } break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* CMVC 109592 - Must not modify the stack while a thread is halted for inspection - this includes creation of JNI local refs */ objectFetched = TRUE; PUSH_OBJECT_IN_SPECIAL_FRAME(currentThread, slotValid ? *((j9object_t *)slotAddress) : NULL); diff --git a/runtime/oti/bcverify_api.h b/runtime/oti/bcverify_api.h index fe878ffdee2..33ae979d6aa 100644 --- a/runtime/oti/bcverify_api.h +++ b/runtime/oti/bcverify_api.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -159,7 +159,7 @@ bcvIsInitOrClinitOrNew (J9CfrConstantPoolInfo * info); */ BOOLEAN bcvIsReferenceTypeDescriptor(J9CfrConstantPoolInfo * info); -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* ---------------- clconstraints.c ---------------- */ diff --git a/runtime/oti/cfreader.h b/runtime/oti/cfreader.h index 448707931bd..ac61220a11d 100644 --- a/runtime/oti/cfreader.h +++ b/runtime/oti/cfreader.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -77,13 +77,13 @@ #define CFR_STACKMAP_TYPE_BOOL_ARRAY 0x10 #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) #define CFR_STACKMAP_TYPE_PRIMITIVE_OBJECT 0x11 -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ #define CFR_METHOD_NAME_INIT 1 #define CFR_METHOD_NAME_CLINIT 2 #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) #define CFR_METHOD_NAME_NEW 3 -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ #define CFR_METHOD_NAME_INVALID -1 /* Macros. */ diff --git a/runtime/oti/j9modifiers_api.h b/runtime/oti/j9modifiers_api.h index 23227abe478..bec25aa0469 100644 --- a/runtime/oti/j9modifiers_api.h +++ b/runtime/oti/j9modifiers_api.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2022 IBM Corp. and others + * Copyright (c) 2009, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -90,10 +90,10 @@ */ #define J9ROMCLASS_IS_VALUE(romClass) _J9ROMCLASS_SUNMODIFIER_IS_SET((romClass), J9AccValueType) #define J9ROMCLASS_IS_PRIMITIVE_VALUE_TYPE(romClass) _J9ROMCLASS_SUNMODIFIER_IS_SET((romClass), J9AccPrimitiveValueType) -#else /* #ifdef J9VM_OPT_VALHALLA_VALUE_TYPES */ +#else /* J9VM_OPT_VALHALLA_VALUE_TYPES */ #define J9ROMCLASS_IS_VALUE(romClass) FALSE #define J9ROMCLASS_IS_PRIMITIVE_VALUE_TYPE(romClass) FALSE -#endif /* #ifdef J9VM_OPT_VALHALLA_VALUE_TYPES */ +#endif /* J9VM_OPT_VALHALLA_VALUE_TYPES */ #define J9ROMMETHOD_IS_GETTER(romMethod) _J9ROMMETHOD_J9MODIFIER_IS_SET((romMethod), J9AccGetterMethod) #define J9ROMMETHOD_IS_FORWARDER(romMethod) _J9ROMMETHOD_J9MODIFIER_IS_SET((romMethod), J9AccForwarderMethod) diff --git a/runtime/rastrace/method_trace.c b/runtime/rastrace/method_trace.c index fd172fe9569..b1e8b1c1c83 100644 --- a/runtime/rastrace/method_trace.c +++ b/runtime/rastrace/method_trace.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2019 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -488,11 +488,14 @@ traceMethodArguments(J9VMThread* thr, J9UTF8* signature, UDATA* arg0EA, char* bu switch (*sigChar) { case '[': case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ traceMethodArgObject(thr, arg0EA--, cursor, endOfBuf - cursor); while (*sigChar == '[') { sigChar++; } - if (*sigChar == 'L' ) { + if (IS_REF_OR_VAL_SIGNATURE(*sigChar)) { while (*sigChar != ';') { sigChar++; } @@ -567,6 +570,9 @@ traceMethodReturnVal(J9VMThread* thr, J9UTF8* signature, void* returnValuePtr, c switch (*(++sigChar)) { case '[': case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ traceMethodArgObject(thr, returnValuePtr, cursor, endOfBuf - cursor); break; case 'J': diff --git a/runtime/stackmap/debuglocalmap.c b/runtime/stackmap/debuglocalmap.c index a26054f209d..bbd28af3882 100644 --- a/runtime/stackmap/debuglocalmap.c +++ b/runtime/stackmap/debuglocalmap.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -662,7 +662,7 @@ validateLocalSlot(J9VMThread *currentThread, J9Method *ramMethod, U_32 offsetPC, break; } } else { - if ((slotSignature == 'L') || (slotSignature == '[')) { + if ((slotSignature == '[') || IS_REF_OR_VAL_SIGNATURE(slotSignature)) { if ((localMap[slot / 32] & (1 << (slot % 32))) == 0) { rc = J9_SLOT_VALIDATE_ERROR_LOCAL_MAP_MISMATCH; } diff --git a/runtime/tests/jvmtitests/agent/strings.c b/runtime/tests/jvmtitests/agent/strings.c index 8f6eff66499..285bf168f62 100644 --- a/runtime/tests/jvmtitests/agent/strings.c +++ b/runtime/tests/jvmtitests/agent/strings.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2018 IBM Corp. and others + * Copyright (c) 2001, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -202,6 +202,9 @@ getTypeString(agentEnv * env, jthread currentThread, JNIEnv * jni_env, char sign sprintf(typeStr, "(jdouble) %f", jvaluePtr->d); break; case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ if (jvaluePtr->l == NULL) { sprintf(typeStr, "(jobject) null"); } else { diff --git a/runtime/util/argbits.c b/runtime/util/argbits.c index 913e8d21349..d7c577f175b 100644 --- a/runtime/util/argbits.c +++ b/runtime/util/argbits.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2014 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -40,12 +40,12 @@ argBitsFromSignature(U_8 * signature, U_32 * resultArrayBase, UDATA resultArrayS /* Parse the signature inside the ()'s */ while (*(++signature) != ')') { - if ((*signature == '[') || (*signature == 'L')) { + if ((*signature == '[') || IS_REF_OR_VAL_SIGNATURE(*signature)) { *resultArrayBase |= argBit; while (*signature == '[') { signature++; } - if (*signature == 'L' ) { + if (IS_REF_OR_VAL_SIGNATURE(*signature)) { while (*signature != ';') { signature++; } diff --git a/runtime/util/hshelp.c b/runtime/util/hshelp.c index 744e68fd394..e5646b6f870 100644 --- a/runtime/util/hshelp.c +++ b/runtime/util/hshelp.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2021 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -518,7 +518,7 @@ iterateToNextArgument(U_32 sigIndex, U_32 sigLength, U_8* sigData) if (sigIndex >= sigLength) return sigIndex; /* check for object */ - if ('L' == sigData[sigIndex]) { + if (IS_REF_OR_VAL_SIGNATURE(sigData[sigIndex])) { while ((sigIndex < sigLength) && (';' != sigData[sigIndex])) { sigIndex += 1; } diff --git a/runtime/verbose/errormessageframeworkrtv.c b/runtime/verbose/errormessageframeworkrtv.c index 021d1b7b7eb..ec2b35889ad 100644 --- a/runtime/verbose/errormessageframeworkrtv.c +++ b/runtime/verbose/errormessageframeworkrtv.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2022 IBM Corp. and others + * Copyright (c) 2015, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -437,9 +437,9 @@ getBCVDataType(J9BytecodeVerificationData* verifyData, MethodContextInfo* method #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) if (J9_ARE_ALL_BITS_SET(bcvType, BCV_PRIMITIVE_VALUETYPE)) { - typeNameIndex = CFR_STACKMAP_TYPE_PRIMITIVE_OBJECT; + typeNameIndex = CFR_STACKMAP_TYPE_PRIMITIVE_OBJECT; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* Set the expected type to 'reference' if the type data extracted from bytecode is 'reference' type. * Note: according to the JVM Specification, the expected type for aastore is 'java/lang/Object' rather than 'reference'. diff --git a/runtime/verbose/errormessagehelper.c b/runtime/verbose/errormessagehelper.c index a394ac62971..919a710c1e0 100644 --- a/runtime/verbose/errormessagehelper.c +++ b/runtime/verbose/errormessagehelper.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2022 IBM Corp. and others + * Copyright (c) 2015, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -651,11 +651,11 @@ convertBcvToCfrType(MethodContextInfo* methodInfo, StackMapFrame* stackMapFrame, default: { U_8 objTypeTag = CFR_STACKMAP_TYPE_OBJECT; - #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) if (J9_ARE_ALL_BITS_SET(bcvType, BCV_PRIMITIVE_VALUETYPE)) { objTypeTag = CFR_STACKMAP_TYPE_PRIMITIVE_OBJECT; } - #endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ *currentVerificationTypeEntry = pushVerificationTypeInfo(methodInfo, stackMapFrame, *currentVerificationTypeEntry, objTypeTag, INDEX_CLASSNAMELIST, bcvType); break; } @@ -870,7 +870,7 @@ mapDataTypeToUTF8String(J9UTF8Ref* dataType, StackMapFrame* stackMapFrame, Metho case CFR_STACKMAP_TYPE_OBJECT: #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) case CFR_STACKMAP_TYPE_PRIMITIVE_OBJECT: -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ { /* Set the name string for object reference. * Identify what the type index value is according to the index attribute. @@ -889,8 +889,8 @@ mapDataTypeToUTF8String(J9UTF8Ref* dataType, StackMapFrame* stackMapFrame, Metho dataType->bytes = methodInfo->signature.bytes + typeValue; dataType->length = typeLength; - /* Ignore 'L' and ';' to get the full string of argument in signature */ - if ('L' == *dataType->bytes) { + /* Ignore 'L', 'Q', and ';' to get the full string of argument in signature */ + if (IS_REF_OR_VAL_SIGNATURE(*dataType->bytes)) { dataType->bytes += 1; dataType->length -= 2; } @@ -1019,7 +1019,7 @@ printTypeInfoToBuffer(MessageBuffer* buf, U_8 tag, J9UTF8Ref* dataType, BOOLEAN 1, ";" /* class suffix ';' */ ); break; -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ default: Assert_VRB_ShouldNeverHappen(); break; diff --git a/runtime/verutil/chverify.c b/runtime/verutil/chverify.c index 88e1e3c1b5f..f892afbfe7d 100644 --- a/runtime/verutil/chverify.c +++ b/runtime/verutil/chverify.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -151,7 +151,7 @@ isInitOrClinitOrNewImpl (J9CfrConstantPoolInfo * info) if (J9UTF8_DATA_EQUALS("", 6, name, info->slot1)) { return CFR_METHOD_NAME_NEW; } -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ return CFR_METHOD_NAME_INVALID; } return 0; /* not or */ diff --git a/runtime/vm/ValueTypeHelpers.cpp b/runtime/vm/ValueTypeHelpers.cpp index 47b9b60119e..23dca035b3e 100644 --- a/runtime/vm/ValueTypeHelpers.cpp +++ b/runtime/vm/ValueTypeHelpers.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019, 2022 IBM Corp. and others + * Copyright (c) 2019, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -259,9 +259,9 @@ getDefaultValueSlotAddress(J9Class* clazz) j9object_t* result = &clazz->flattenedClassCache->defaultValue; Assert_VM_notNull(*result); return result; -#else /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#else /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ return NULL; -#endif /* #if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ } } /* extern "C" */ diff --git a/runtime/vm/bindnatv.cpp b/runtime/vm/bindnatv.cpp index 32349073b2d..891080b88ec 100644 --- a/runtime/vm/bindnatv.cpp +++ b/runtime/vm/bindnatv.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -650,7 +650,10 @@ nativeSignature(J9Method* nativeMethod, char *resultBuffer) parsingReturnType = TRUE; continue; case 'L': - nextType = 'L'; +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ + nextType = (char)ch; while(J9UTF8_DATA(methodSig)[i++] != ';') {} /* a type string - loop scanning for ';' to end it - i points past ';' when done loop */ break; case 'Z': diff --git a/runtime/vm/extendedMessageNPE.cpp b/runtime/vm/extendedMessageNPE.cpp index 683fddf2374..c7cfa93caf1 100644 --- a/runtime/vm/extendedMessageNPE.cpp +++ b/runtime/vm/extendedMessageNPE.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2022 IBM Corp. and others + * Copyright (c) 2020, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -213,7 +213,11 @@ convertMethodSignature(J9VMThread *vmThread, J9UTF8 *methodSig) /* int */ bufferSize += 3; break; - case 'L': { + case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ + { i += 1; UDATA objSize = 0; while (';' != string[i]) { @@ -257,7 +261,7 @@ convertMethodSignature(J9VMThread *vmThread, J9UTF8 *methodSig) i += 1; } const char *elementType = NULL; - if ('L' == string[i]) { + if (IS_REF_OR_VAL_SIGNATURE(string[i])) { i += 1; UDATA objSize = 0; diff --git a/runtime/vm/jnicsup.cpp b/runtime/vm/jnicsup.cpp index 57cf67e9a22..700ee4f6db4 100644 --- a/runtime/vm/jnicsup.cpp +++ b/runtime/vm/jnicsup.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -543,7 +543,10 @@ UDATA JNICALL pushArguments(J9VMThread *vmThread, J9Method* method, void *args) sigChar += 1; } skipSignature = ('L' == *sigChar++); - case 'L': /* FALLTHROUGH */ + case 'L': +#if defined(J9VM_OPT_VALHALLA_VALUE_TYPES) + case 'Q': +#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */ /* skip the rest of the signature */ if (skipSignature) { while (';' != *sigChar) { @@ -594,7 +597,7 @@ UDATA JNICALL pushArguments(J9VMThread *vmThread, J9Method* method, void *args) break; case ')': vmThread->sp = sp; - return (*sigChar == 'L' || *sigChar == '[') ? J9_SSF_RETURNS_OBJECT : 0; + return (IS_REF_OR_VAL_SIGNATURE(*sigChar) || *sigChar == '[') ? J9_SSF_RETURNS_OBJECT : 0; } } } diff --git a/runtime/vm/resolvesupport.cpp b/runtime/vm/resolvesupport.cpp index 14bae6d5ad1..2f903520ea3 100644 --- a/runtime/vm/resolvesupport.cpp +++ b/runtime/vm/resolvesupport.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 1991, 2022 IBM Corp. and others + * Copyright (c) 1991, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -245,8 +245,8 @@ findFieldSignatureClass(J9VMThread *vmStruct, J9ConstantPool *ramCP, UDATA field if ('[' == J9UTF8_DATA(signature)[0]) { resolvedClass = internalFindClassUTF8(vmStruct, J9UTF8_DATA(signature), J9UTF8_LENGTH(signature), classLoader, J9_FINDCLASS_FLAG_THROW_ON_FAIL); } else { - Assert_VM_true('L' == J9UTF8_DATA(signature)[0]); - /* skip fieldSignature's L and ; to have only CLASSNAME required for internalFindClassUTF8 */ + Assert_VM_true(IS_REF_OR_VAL_SIGNATURE(J9UTF8_DATA(signature)[0])); + /* skip fieldSignature's L/Q and ; to have only CLASSNAME required for internalFindClassUTF8 */ resolvedClass = internalFindClassUTF8(vmStruct, &J9UTF8_DATA(signature)[1], J9UTF8_LENGTH(signature)-2, classLoader, J9_FINDCLASS_FLAG_THROW_ON_FAIL); } diff --git a/sourcetools/j9constantpool/com/ibm/oti/VMCPTool/FieldRef.java b/sourcetools/j9constantpool/com/ibm/oti/VMCPTool/FieldRef.java index 7cacd77d2fc..7cf033aff98 100644 --- a/sourcetools/j9constantpool/com/ibm/oti/VMCPTool/FieldRef.java +++ b/sourcetools/j9constantpool/com/ibm/oti/VMCPTool/FieldRef.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2021 IBM Corp. and others + * Copyright (c) 2004, 2023 IBM Corp. and others * * This program and the accompanying materials are made available under * the terms of the Eclipse Public License 2.0 which accompanies this @@ -124,6 +124,7 @@ protected String fieldType() { switch (((Alias) primary).nas.signature.data.charAt(0)) { case '[': case 'L': + case 'Q': return "OBJECT"; default: // Do nothing @@ -153,6 +154,7 @@ protected String fieldType() { switch (((Alias) primary).nas.signature.data.charAt(0)) { case '[': case 'L': + case 'Q': return "OBJECT"; case 'J': return "I64";