diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java index 0ea4b14d4a21..1b5ed6127681 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ClassfileParser.java @@ -101,13 +101,16 @@ import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; import com.oracle.truffle.espresso.classfile.constantpool.Utf8Constant; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUtf8; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserSignatures; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; @@ -586,7 +589,7 @@ private ParserKlass parseClassImpl() throws ValidationException { // TODO(peterssen): Verify class names. Symbol thisKlassType = parsingContext.getOrCreateTypeFromName(thisKlassName); - if (Types.isPrimitive(thisKlassType) || Types.isArray(thisKlassType)) { + if (TypeSymbols.isPrimitive(thisKlassType) || TypeSymbols.isArray(thisKlassType)) { throw classFormatError(".this_class cannot be array nor primitive " + classType); } @@ -600,11 +603,11 @@ private ParserKlass parseClassImpl() throws ValidationException { Symbol superKlass = parseSuperKlass(); - if (!Type.java_lang_Object.equals(classType) && superKlass == null) { + if (!ParserTypes.java_lang_Object.equals(classType) && superKlass == null) { throw classFormatError("Class " + classType + " must have a superclass"); } - if (isInterface && !Type.java_lang_Object.equals(superKlass)) { + if (isInterface && !ParserTypes.java_lang_Object.equals(superKlass)) { throw classFormatError("Interface " + classType + " must extend java.lang.Object"); } @@ -628,17 +631,7 @@ private ParserKlass parseClassImpl() throws ValidationException { // Ensure there are no trailing bytes stream.checkEndOfFile(); - long hiddenKlassId = -1; // no id - if (isHidden) { - assert requestedClassType != null; - hiddenKlassId = parsingContext.getNewKlassId(); - thisKlassName = parsingContext.getOrCreateName(Types.hiddenClassName(requestedClassType, hiddenKlassId)); - thisKlassType = parsingContext.getOrCreateTypeFromName(thisKlassName); - pool = pool.patchForHiddenClass(thisKlassIndex, thisKlassName); - classFlags |= Constants.ACC_IS_HIDDEN_CLASS; - } - - return new ParserKlass(pool, classFlags, thisKlassName, thisKlassType, superKlass, superInterfaces, methods, fields, attributes, thisKlassIndex, hiddenKlassId); + return new ParserKlass(pool, classFlags, thisKlassName, thisKlassType, superKlass, superInterfaces, methods, fields, attributes, thisKlassIndex, -1); } public static Symbol getClassName(ParsingContext parsingContext, byte[] bytes) throws ValidationException { @@ -668,7 +661,7 @@ private ParserMethod[] parseMethods(boolean isInterface) throws ValidationExcept * Classes in general have lots of methods: use a hash set rather than array lookup for dup * check. */ - final HashSet dup = HashSet.newHashSet(methodCount); + final HashSet dup = new HashSet<>(methodCount); for (int i = 0; i < methodCount; ++i) { ParserMethod method; try (DebugCloseable closeable = PARSE_SINGLE_METHOD.scope(parsingContext.getTimers())) { @@ -831,42 +824,42 @@ private class CommonAttributeParser { Attribute signature = null; Attribute parseCommonAttribute(Symbol attributeName, int attributeSize) throws ValidationException { - if (infoType.supports(RUNTIME_VISIBLE_ANNOTATIONS) && attributeName.equals(Name.RuntimeVisibleAnnotations)) { + if (infoType.supports(RUNTIME_VISIBLE_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeVisibleAnnotations)) { if (runtimeVisibleAnnotations != null) { throw classFormatError("Duplicate RuntimeVisibleAnnotations attribute"); } return runtimeVisibleAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(RUNTIME_VISIBLE_TYPE_ANNOTATIONS) && attributeName.equals(Name.RuntimeVisibleTypeAnnotations)) { + } else if (infoType.supports(RUNTIME_VISIBLE_TYPE_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeVisibleTypeAnnotations)) { if (runtimeVisibleTypeAnnotations != null) { throw classFormatError("Duplicate RuntimeVisibleTypeAnnotations attribute"); } return runtimeVisibleTypeAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(RUNTIME_INVISIBLE_ANNOTATIONS) && attributeName.equals(Name.RuntimeInvisibleAnnotations)) { + } else if (infoType.supports(RUNTIME_INVISIBLE_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeInvisibleAnnotations)) { if (runtimeInvisibleAnnotations != null) { throw classFormatError("Duplicate RuntimeVisibleTypeAnnotations attribute"); } return runtimeInvisibleAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(RUNTIME_INVISIBLE_TYPE_ANNOTATIONS) && attributeName.equals(Name.RuntimeInvisibleTypeAnnotations)) { + } else if (infoType.supports(RUNTIME_INVISIBLE_TYPE_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeInvisibleTypeAnnotations)) { if (runtimeInvisibleTypeAnnotations != null) { throw classFormatError("Duplicate RuntimeInvisibleTypeAnnotations attribute"); } return runtimeInvisibleTypeAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS) && attributeName.equals(Name.RuntimeVisibleParameterAnnotations)) { + } else if (infoType.supports(RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeVisibleParameterAnnotations)) { if (runtimeVisibleParameterAnnotations != null) { throw classFormatError("Duplicate RuntimeVisibleParameterAnnotations attribute"); } return runtimeVisibleParameterAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS) && attributeName.equals(Name.RuntimeInvisibleParameterAnnotations)) { + } else if (infoType.supports(RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS) && attributeName.equals(ParserNames.RuntimeInvisibleParameterAnnotations)) { if (runtimeInvisibleParameterAnnotations != null) { throw classFormatError("Duplicate RuntimeVisibleParameterAnnotations attribute"); } return runtimeInvisibleParameterAnnotations = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(ANNOTATION_DEFAULT) && attributeName.equals(Name.AnnotationDefault)) { + } else if (infoType.supports(ANNOTATION_DEFAULT) && attributeName.equals(ParserNames.AnnotationDefault)) { if (annotationDefault != null) { throw classFormatError("Duplicate AnnotationDefault attribute"); } return annotationDefault = new Attribute(attributeName, stream.readByteArray(attributeSize)); - } else if (infoType.supports(SIGNATURE) && attributeName.equals(Name.Signature)) { + } else if (infoType.supports(SIGNATURE) && attributeName.equals(ParserNames.Signature)) { if (parsingContext.getJavaVersion().java9OrLater() && signature != null) { throw classFormatError("Duplicate AnnotationDefault attribute"); } @@ -896,7 +889,7 @@ RuntimeVisibleAnnotationsAttribute parseRuntimeVisibleAnnotations(int attributeS }; } - Attribute attribute = new Attribute(Name.RuntimeVisibleAnnotations, data); + Attribute attribute = new Attribute(ParserNames.RuntimeVisibleAnnotations, data); runtimeVisibleAnnotations = attribute; return new RuntimeVisibleAnnotationsAttribute(attribute, flags); } @@ -909,21 +902,21 @@ private int parseMethodVMAnnotations(ClassfileStream subStream) { Utf8Constant constant = pool.utf8At(typeIndex, "annotation type"); // Validation of the type is done at runtime by guest java code. Symbol annotType = constant.unsafeSymbolValue(); - if (Type.java_lang_invoke_LambdaForm$Compiled.equals(annotType)) { + if (ParserTypes.java_lang_invoke_LambdaForm$Compiled.equals(annotType)) { flags |= ACC_LAMBDA_FORM_COMPILED; - } else if (Type.java_lang_invoke_LambdaForm$Hidden.equals(annotType) || - Type.jdk_internal_vm_annotation_Hidden.equals(annotType)) { + } else if (ParserTypes.java_lang_invoke_LambdaForm$Hidden.equals(annotType) || + ParserTypes.jdk_internal_vm_annotation_Hidden.equals(annotType)) { flags |= ACC_HIDDEN; - } else if (Type.sun_reflect_CallerSensitive.equals(annotType) || - Type.jdk_internal_reflect_CallerSensitive.equals(annotType)) { + } else if (ParserTypes.sun_reflect_CallerSensitive.equals(annotType) || + ParserTypes.jdk_internal_reflect_CallerSensitive.equals(annotType)) { flags |= ACC_CALLER_SENSITIVE; - } else if (Type.java_lang_invoke_ForceInline.equals(annotType) || - Type.jdk_internal_vm_annotation_ForceInline.equals(annotType)) { + } else if (ParserTypes.java_lang_invoke_ForceInline.equals(annotType) || + ParserTypes.jdk_internal_vm_annotation_ForceInline.equals(annotType)) { flags |= ACC_FORCE_INLINE; - } else if (Type.java_lang_invoke_DontInline.equals(annotType) || - Type.jdk_internal_vm_annotation_DontInline.equals(annotType)) { + } else if (ParserTypes.java_lang_invoke_DontInline.equals(annotType) || + ParserTypes.jdk_internal_vm_annotation_DontInline.equals(annotType)) { flags |= ACC_DONT_INLINE; - } else if (Type.jdk_internal_misc_ScopedMemoryAccess$Scoped.equals(annotType)) { + } else if (ParserTypes.jdk_internal_misc_ScopedMemoryAccess$Scoped.equals(annotType)) { flags |= ACC_SCOPED; } } @@ -938,7 +931,7 @@ private int parseFieldVMAnnotations(ClassfileStream subStream) { Utf8Constant constant = pool.utf8At(typeIndex, "annotation type"); // Validation of the type is done at runtime by guest java code. Symbol annotType = constant.unsafeSymbolValue(); - if (Type.jdk_internal_vm_annotation_Stable.equals(annotType)) { + if (ParserTypes.jdk_internal_vm_annotation_Stable.equals(annotType)) { flags |= ACC_STABLE; } } @@ -964,7 +957,7 @@ private ParserMethod parseMethod(boolean isInterface) throws ValidationException try (DebugCloseable nameCheck = NAME_CHECK.scope(parsingContext.getTimers())) { name = validateMethodName(pool.utf8At(nameIndex, "method name"), true); - if (name.equals(Name._clinit_)) { + if (name.equals(ParserNames._clinit_)) { // Class and interface initialization methods (3.9) are called // implicitly by the Java virtual machine; the value of their // access_flags item is ignored except for the settings of the @@ -979,7 +972,7 @@ private ParserMethod parseMethod(boolean isInterface) throws ValidationException } // extraFlags = INITIALIZER | methodFlags; isClinit = true; - } else if (name.equals(Name._init_)) { + } else if (name.equals(ParserNames._init_)) { if (isInterface) { throw classFormatError("Method is not valid in an interface."); } @@ -1010,10 +1003,12 @@ private ParserMethod parseMethod(boolean isInterface) throws ValidationException */ int slots = pool.utf8At(signatureIndex).validateSignatureGetSlots(isInit || isClinit); - signature = Signatures.check(pool.symbolAt(signatureIndex, "method descriptor")); + assert Validation.validSignatureDescriptor(pool.symbolAtUnsafe(signatureIndex)); + signature = pool.symbolAtUnsafe(signatureIndex, "method descriptor"); + if (isClinit && majorVersion >= JAVA_7_VERSION) { // Checks clinit takes no arguments. - if (!signature.equals(Signature._void)) { + if (!signature.equals(ParserSignatures._void)) { throw classFormatError("Method has invalid signature: " + signature); } } @@ -1022,7 +1017,7 @@ private ParserMethod parseMethod(boolean isInterface) throws ValidationException throw classFormatError("Too many arguments in method signature: " + signature); } - if (name.equals(Name.finalize) && signature.equals(Signature._void) && !Modifier.isStatic(methodFlags) && !Type.java_lang_Object.equals(classType)) { + if (ParserNames.finalize.equals(name) && ParserSignatures._void.equals(signature) && !Modifier.isStatic(methodFlags) && !ParserTypes.java_lang_Object.equals(classType)) { // This class has a finalizer method implementation (ignore for // java.lang.Object). classFlags |= ACC_FINALIZER; @@ -1041,30 +1036,30 @@ private ParserMethod parseMethod(boolean isInterface) throws ValidationException for (int i = 0; i < attributeCount; ++i) { final int attributeNameIndex = stream.readU2(); - final Symbol attributeName = pool.symbolAt(attributeNameIndex, "attribute name"); + final Symbol attributeName = pool.symbolAtUnsafe(attributeNameIndex, "attribute name"); final int attributeSize = stream.readS4(); final int startPosition = stream.getPosition(); - if (attributeName.equals(Name.Code)) { + if (attributeName.equals(ParserNames.Code)) { if (codeAttribute != null) { throw classFormatError("Duplicate Code attribute"); } try (DebugCloseable code = CODE_PARSE.scope(parsingContext.getTimers())) { methodAttributes[i] = codeAttribute = parseCodeAttribute(attributeName); } - } else if (attributeName.equals(Name.Exceptions)) { + } else if (attributeName.equals(ParserNames.Exceptions)) { if (checkedExceptions != null) { throw classFormatError("Duplicate Exceptions attribute"); } methodAttributes[i] = checkedExceptions = parseExceptions(attributeName); - } else if (attributeName.equals(Name.Synthetic)) { + } else if (attributeName.equals(ParserNames.Synthetic)) { methodFlags |= ACC_SYNTHETIC; methodAttributes[i] = checkedExceptions = new Attribute(attributeName, null); } else if (majorVersion >= JAVA_1_5_VERSION) { - if (attributeName.equals(Name.RuntimeVisibleAnnotations)) { + if (attributeName.equals(ParserNames.RuntimeVisibleAnnotations)) { RuntimeVisibleAnnotationsAttribute annotations = commonAttributeParser.parseRuntimeVisibleAnnotations(attributeSize, AnnotationLocation.Method); methodFlags |= annotations.flags; methodAttributes[i] = annotations.attribute; - } else if (attributeName.equals(Name.MethodParameters)) { + } else if (attributeName.equals(ParserNames.MethodParameters)) { if (methodParameters != null) { throw classFormatError("Duplicate MethodParameters attribute"); } @@ -1181,39 +1176,39 @@ private Attribute[] parseClassAttributes() throws ValidationException { final Attribute[] classAttributes = spawnAttributesArray(attributeCount); for (int i = 0; i < attributeCount; i++) { final int attributeNameIndex = stream.readU2(); - final Symbol attributeName = pool.symbolAt(attributeNameIndex, "attribute name"); + final Symbol attributeName = pool.symbolAtUnsafe(attributeNameIndex, "attribute name"); final int attributeSize = stream.readS4(); final int startPosition = stream.getPosition(); - if (attributeName.equals(Name.SourceFile)) { + if (attributeName.equals(ParserNames.SourceFile)) { if (sourceFileName != null) { throw classFormatError("Duplicate SourceFile attribute"); } classAttributes[i] = sourceFileName = parseSourceFileAttribute(attributeName); - } else if (attributeName.equals(Name.SourceDebugExtension)) { + } else if (attributeName.equals(ParserNames.SourceDebugExtension)) { if (sourceDebugExtensionAttribute != null) { throw classFormatError("Duplicate SourceDebugExtension attribute"); } classAttributes[i] = sourceDebugExtensionAttribute = parseSourceDebugExtensionAttribute(attributeName, attributeSize); - } else if (attributeName.equals(Name.Synthetic)) { + } else if (attributeName.equals(ParserNames.Synthetic)) { classFlags |= ACC_SYNTHETIC; classAttributes[i] = new Attribute(attributeName, null); - } else if (attributeName.equals(Name.InnerClasses)) { + } else if (attributeName.equals(ParserNames.InnerClasses)) { if (innerClasses != null) { throw classFormatError("Duplicate InnerClasses attribute"); } classAttributes[i] = innerClasses = parseInnerClasses(attributeName); } else if (majorVersion >= JAVA_1_5_VERSION) { - if (majorVersion >= JAVA_7_VERSION && attributeName.equals(Name.BootstrapMethods)) { + if (majorVersion >= JAVA_7_VERSION && attributeName.equals(ParserNames.BootstrapMethods)) { if (bootstrapMethods != null) { throw classFormatError("Duplicate BootstrapMethods attribute"); } classAttributes[i] = bootstrapMethods = parseBootstrapMethods(attributeName); - } else if (attributeName.equals(Name.EnclosingMethod)) { + } else if (attributeName.equals(ParserNames.EnclosingMethod)) { if (enclosingMethod != null) { throw classFormatError("Duplicate EnclosingMethod attribute"); } classAttributes[i] = enclosingMethod = parseEnclosingMethodAttribute(attributeName); - } else if (majorVersion >= JAVA_11_VERSION && attributeName.equals(Name.NestHost)) { + } else if (majorVersion >= JAVA_11_VERSION && attributeName.equals(ParserNames.NestHost)) { if (nestHost != null) { throw classFormatError("Duplicate NestHost attribute"); } @@ -1224,7 +1219,7 @@ private Attribute[] parseClassAttributes() throws ValidationException { throw classFormatError("Attribute length of NestHost must be 2"); } classAttributes[i] = nestHost = parseNestHostAttribute(attributeName); - } else if (majorVersion >= JAVA_11_VERSION && attributeName.equals(Name.NestMembers)) { + } else if (majorVersion >= JAVA_11_VERSION && attributeName.equals(ParserNames.NestMembers)) { if (nestMembers != null) { throw classFormatError("Duplicate NestMembers attribute"); } @@ -1232,12 +1227,12 @@ private Attribute[] parseClassAttributes() throws ValidationException { throw classFormatError("Classfile cannot have both a nest members and a nest host attribute."); } classAttributes[i] = nestMembers = parseNestMembers(attributeName); - } else if (majorVersion >= JAVA_14_VERSION && attributeName.equals(Name.Record)) { + } else if (majorVersion >= JAVA_14_VERSION && attributeName.equals(ParserNames.Record)) { if (record != null) { throw classFormatError("Duplicate Record attribute"); } classAttributes[i] = record = parseRecord(attributeName); - } else if (majorVersion >= JAVA_17_VERSION && attributeName.equals(Name.PermittedSubclasses)) { + } else if (majorVersion >= JAVA_17_VERSION && attributeName.equals(ParserNames.PermittedSubclasses)) { if (permittedSubclasses != null) { throw classFormatError("Duplicate PermittedSubclasses attribute"); } @@ -1265,18 +1260,18 @@ private Attribute[] parseClassAttributes() throws ValidationException { } private SourceFileAttribute parseSourceFileAttribute(Symbol name) { - assert Name.SourceFile.equals(name); + assert ParserNames.SourceFile.equals(name); int sourceFileIndex = stream.readU2(); return new SourceFileAttribute(name, sourceFileIndex); } private SourceDebugExtensionAttribute parseSourceDebugExtensionAttribute(Symbol name, int attributeLength) { - assert Name.SourceDebugExtension.equals(name); + assert ParserNames.SourceDebugExtension.equals(name); byte[] debugExBytes = stream.readByteArray(attributeLength); String debugExtension = null; try { - debugExtension = ModifiedUtf8.toJavaString(debugExBytes); + debugExtension = ModifiedUTF8.toJavaString(debugExBytes); } catch (IOException e) { // not able to convert the debug extension bytes to Java String // this isn't critical, so we'll just mark as null @@ -1285,7 +1280,7 @@ private SourceDebugExtensionAttribute parseSourceDebugExtensionAttribute(Symbol< } private LineNumberTableAttribute parseLineNumberTable(Symbol name) { - assert Name.LineNumberTable.equals(name); + assert ParserNames.LineNumberTable.equals(name); int entryCount = stream.readU2(); if (entryCount == 0) { return LineNumberTableAttribute.EMPTY; @@ -1302,17 +1297,17 @@ private LineNumberTableAttribute parseLineNumberTable(Symbol name) { } private LocalVariableTable parseLocalVariableAttribute(Symbol name, int codeLength, int maxLocals) throws ValidationException { - assert Name.LocalVariableTable.equals(name); + assert ParserNames.LocalVariableTable.equals(name); return parseLocalVariableTable(name, codeLength, maxLocals); } private LocalVariableTable parseLocalVariableTypeAttribute(Symbol name, int codeLength, int maxLocals) throws ValidationException { - assert Name.LocalVariableTypeTable.equals(name); + assert ParserNames.LocalVariableTypeTable.equals(name); return parseLocalVariableTable(name, codeLength, maxLocals); } private LocalVariableTable parseLocalVariableTable(Symbol name, int codeLength, int maxLocals) throws ValidationException { - boolean isLVTT = Name.LocalVariableTypeTable.equals(name); + boolean isLVTT = ParserNames.LocalVariableTypeTable.equals(name); int entryCount = stream.readU2(); if (entryCount == 0) { return isLVTT ? LocalVariableTable.EMPTY_LVTT : LocalVariableTable.EMPTY_LVT; @@ -1338,7 +1333,7 @@ private LocalVariableTable parseLocalVariableTable(Symbol name, int codeLe int extraSlot = 0; if (!isLVTT) { Symbol type = validateType(typeNameOrSignature, false); - if (type == Type._long || type == Type._double) { + if (type == ParserTypes._long || type == ParserTypes._double) { extraSlot = 1; } } @@ -1358,7 +1353,7 @@ private LocalVariableTable parseLocalVariableTable(Symbol name, int codeLe } private SignatureAttribute parseSignatureAttribute(Symbol name) throws ValidationException { - assert Name.Signature.equals(name); + assert ParserNames.Signature.equals(name); int signatureIndex = stream.readU2(); validateEncoding(pool.utf8At(signatureIndex, "signature attribute")); return new SignatureAttribute(name, signatureIndex); @@ -1379,7 +1374,7 @@ private MethodParametersAttribute parseMethodParameters(Symbol name) { } private ExceptionsAttribute parseExceptions(Symbol name) { - assert Name.Exceptions.equals(name); + assert ParserNames.Exceptions.equals(name); int entryCount = stream.readU2(); int[] entries = new int[entryCount]; for (int i = 0; i < entryCount; ++i) { @@ -1433,7 +1428,7 @@ private BootstrapMethodsAttribute parseBootstrapMethods(Symbol name) { } private InnerClassesAttribute parseInnerClasses(Symbol name) throws ValidationException { - assert Name.InnerClasses.equals(name); + assert ParserNames.InnerClasses.equals(name); final int entryCount = stream.readU2(); boolean duplicateInnerClass = false; @@ -1603,7 +1598,7 @@ private Attribute[] parseRecordComponentAttributes() throws ValidationException Attribute[] componentAttributes = new Attribute[size]; CommonAttributeParser commonAttributeParser = new CommonAttributeParser(InfoType.Record); for (int j = 0; j < size; j++) { - final Symbol attributeName = pool.symbolAt(stream.readU2(), "attribute name"); + final Symbol attributeName = pool.symbolAtUnsafe(stream.readU2(), "attribute name"); final int attributeSize = stream.readS4(); Attribute attr = commonAttributeParser.parseCommonAttribute(attributeName, attributeSize); componentAttributes[j] = attr == null ? new Attribute(attributeName, stream.readByteArray(attributeSize)) : attr; @@ -1673,18 +1668,18 @@ private CodeAttribute parseCodeAttribute(Symbol name) throws ValidationExc for (int i = 0; i < attributeCount; i++) { final int attributeNameIndex = stream.readU2(); final Symbol attributeName; - attributeName = pool.symbolAt(attributeNameIndex, "attribute name"); + attributeName = pool.symbolAtUnsafe(attributeNameIndex, "attribute name"); final int attributeSize = stream.readS4(); final int startPosition = stream.getPosition(); - if (attributeName.equals(Name.LineNumberTable)) { + if (attributeName.equals(ParserNames.LineNumberTable)) { codeAttributes[i] = parseLineNumberTable(attributeName); - } else if (attributeName.equals(Name.LocalVariableTable)) { + } else if (attributeName.equals(ParserNames.LocalVariableTable)) { codeAttributes[i] = parseLocalVariableAttribute(attributeName, codeLength, maxLocals); totalLocalTableCount++; - } else if (attributeName.equals(Name.LocalVariableTypeTable)) { + } else if (attributeName.equals(ParserNames.LocalVariableTypeTable)) { codeAttributes[i] = parseLocalVariableTypeAttribute(attributeName, codeLength, maxLocals); - } else if (attributeName.equals(Name.StackMapTable)) { + } else if (attributeName.equals(ParserNames.StackMapTable)) { if (stackMapTable != null) { throw classFormatError("Duplicate StackMapTable attribute"); } @@ -1714,14 +1709,14 @@ private void validateLocalTables(Attribute[] codeAttributes) { EconomicMap table = EconomicMap.create(Local.localEquivalence); ArrayList typeTables = new ArrayList<>(); for (Attribute attr : codeAttributes) { - if (attr.getName() == Name.LocalVariableTable) { + if (attr.getName() == ParserNames.LocalVariableTable) { LocalVariableTable localTable = (LocalVariableTable) attr; for (Local local : localTable.getLocals()) { if (table.put(local, false) != null) { throw classFormatError("Duplicate local in local variable table: " + local); } } - } else if (attr.getName() == Name.LocalVariableTypeTable) { + } else if (attr.getName() == ParserNames.LocalVariableTypeTable) { typeTables.add((LocalVariableTable) attr); } } @@ -1811,10 +1806,10 @@ private ParserField parseField(boolean isInterface) throws ValidationException { for (int i = 0; i < attributeCount; ++i) { final int attributeNameIndex = stream.readU2(); - final Symbol attributeName = pool.symbolAt(attributeNameIndex, "attribute name"); + final Symbol attributeName = pool.symbolAtUnsafe(attributeNameIndex, "attribute name"); final int attributeSize = stream.readS4(); final int startPosition = stream.getPosition(); - if (isStatic && attributeName.equals(Name.ConstantValue)) { + if (isStatic && attributeName.equals(ParserNames.ConstantValue)) { if (constantValue != null) { throw classFormatError("Duplicate ConstantValue attribute"); } @@ -1824,21 +1819,21 @@ private ParserField parseField(boolean isInterface) throws ValidationException { } PoolConstant entry = pool.at(constantValue.getConstantValueIndex(), "constant value index"); boolean isValid = switch (entry.tag()) { - case INTEGER -> Types.getJavaKind(descriptor).isStackInt(); - case FLOAT -> descriptor == Type._float; - case LONG -> descriptor == Type._long; - case DOUBLE -> descriptor == Type._double; - case STRING -> descriptor == Type.java_lang_String; + case INTEGER -> TypeSymbols.getJavaKind(descriptor).isStackInt(); + case FLOAT -> descriptor == ParserTypes._float; + case LONG -> descriptor == ParserTypes._long; + case DOUBLE -> descriptor == ParserTypes._double; + case STRING -> descriptor == ParserTypes.java_lang_String; default -> false; }; if (!isValid) { throw classFormatError("Invalid ConstantValue index entry type"); } - } else if (attributeName.equals(Name.Synthetic)) { + } else if (attributeName.equals(ParserNames.Synthetic)) { fieldFlags |= ACC_SYNTHETIC; fieldAttributes[i] = new Attribute(attributeName, null); } else if (majorVersion >= JAVA_1_5_VERSION) { - if (attributeName.equals(Name.RuntimeVisibleAnnotations)) { + if (attributeName.equals(ParserNames.RuntimeVisibleAnnotations)) { RuntimeVisibleAnnotationsAttribute annotations = commonAttributeParser.parseRuntimeVisibleAnnotations(attributeSize, AnnotationLocation.Field); fieldFlags |= annotations.flags; fieldAttributes[i] = annotations.attribute; @@ -1857,7 +1852,7 @@ private ParserField parseField(boolean isInterface) throws ValidationException { } } - final JavaKind kind = Types.getJavaKind(descriptor); + final JavaKind kind = TypeSymbols.getJavaKind(descriptor); if (kind == JavaKind.Void) { throw classFormatError("Fields cannot be of type void"); } @@ -1885,7 +1880,7 @@ private ParserField parseField(boolean isInterface) throws ValidationException { valid = (tag == Tag.DOUBLE); break; case Object: - valid = (tag == Tag.STRING) && descriptor.equals(Type.java_lang_String); + valid = (tag == Tag.STRING) && descriptor.equals(ParserTypes.java_lang_String); break; default: { throw classFormatError("Cannot have ConstantValue for fields of type " + kind); @@ -1925,7 +1920,7 @@ private ParserField[] parseFields(boolean isInterface) throws ValidationExceptio private Symbol parseSuperKlass() { int index = stream.readU2(); if (index == 0) { - if (!classType.equals(Type.java_lang_Object)) { + if (!classType.equals(ParserTypes.java_lang_Object)) { throw classFormatError("Invalid superclass index 0"); } return null; @@ -1947,13 +1942,13 @@ private Symbol[] parseInterfaces() { if (interfaceType == null) { throw classFormatError(classType + " contains invalid superinterface name: " + interfaceName); } - if (Types.isPrimitive(interfaceType) || Types.isArray(interfaceType)) { + if (TypeSymbols.isPrimitive(interfaceType) || TypeSymbols.isArray(interfaceType)) { throw classFormatError(classType + " superinterfaces cannot contain arrays nor primitives"); } interfaces[i] = interfaceType; } // Check for duplicate interfaces in the interface array. - Set> present = HashSet.newHashSet(interfaces.length); + Set> present = new HashSet<>(interfaces.length); for (Symbol t : interfaces) { if (!present.add(t)) { throw classFormatError("Duplicate interface name in classfile: " + t); @@ -1997,7 +1992,7 @@ public int hashCode() { // Encoding (Modified UTF8) - private Symbol validateEncoding(Utf8Constant utf8Constant) throws ValidationException { + private Symbol validateEncoding(Utf8Constant utf8Constant) throws ValidationException { if (!validate) { return utf8Constant.unsafeSymbolValue(); } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java index 0b15aba69dfe..05018fbb1bcf 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ConstantPool.java @@ -52,8 +52,8 @@ import com.oracle.truffle.espresso.classfile.constantpool.NameAndTypeConstant; import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; import com.oracle.truffle.espresso.classfile.constantpool.Utf8Constant; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.ModifiedUTF8; /** * Immutable, shareable constant-pool representation. @@ -243,11 +243,11 @@ public final double doubleAt(int index, String description) { } } - public final Symbol symbolAt(int index) { - return symbolAt(index, null); + public final Symbol symbolAtUnsafe(int index) { + return symbolAtUnsafe(index, null); } - public final Symbol symbolAt(int index, String description) { + public final Symbol symbolAtUnsafe(int index, String description) { try { final Utf8Constant constant = (Utf8Constant) at(index); return constant.unsafeSymbolValue(); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java index 34639aa85fd4..eb6f73d08e30 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ExceptionHandler.java @@ -25,7 +25,7 @@ import java.util.Objects; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; /** * Represents an exception handler within the bytecodes. diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ImmutableConstantPool.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ImmutableConstantPool.java index 1cc4cef98e31..b3734c4abad2 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ImmutableConstantPool.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ImmutableConstantPool.java @@ -99,7 +99,7 @@ public int getMinorVersion() { return minorVersion; } - ImmutableConstantPool patchForHiddenClass(int thisKlassIndex, Symbol newName) { + public ImmutableConstantPool patchForHiddenClass(int thisKlassIndex, Symbol newName) { int newNamePos = constants.length; Utf8Constant newNameConstant = new Utf8Constant(newName); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java index dd5f82ff834e..972cb587efe0 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/JavaKind.java @@ -37,10 +37,10 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.descriptors.ErrorUtil; -import com.oracle.truffle.espresso.classfile.descriptors.StaticSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; /** * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, @@ -105,8 +105,8 @@ public enum JavaKind { this.primitiveJavaClass = primitiveJavaClass; this.boxedJavaClass = boxedJavaClass; this.basicType = basicType; - this.type = (primitiveJavaClass != null) ? StaticSymbols.putType("" + typeChar) : null; - this.name = StaticSymbols.putName(javaName); + this.type = (primitiveJavaClass != null) ? ParserSymbols.SYMBOLS.putType("" + typeChar) : null; + this.name = ParserSymbols.SYMBOLS.putName(javaName); this.unwrapMethodName = (primitiveJavaClass != null) ? javaName + "Value" : null; this.unwrapMethodDesc = (primitiveJavaClass != null) ? "()" + typeChar : null; this.wrapperValueOfDesc = (primitiveJavaClass != null) ? "(" + typeChar + ")Ljava/lang/" + boxedJavaClass.getSimpleName() + ";" : null; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java index 0a96a92726c9..4c2c5aa2367c 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserField.java @@ -28,10 +28,10 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.espresso.classfile.attributes.Attribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; public final class ParserField { public static final ParserField[] EMPTY_ARRAY = new ParserField[0]; @@ -42,6 +42,7 @@ public final class ParserField { private final int flags; private final Symbol name; private final Symbol type; + @CompilationFinal(dimensions = 1) // private final Attribute[] attributes; @@ -85,6 +86,6 @@ public boolean isFinal() { } public JavaKind getKind() { - return Types.getJavaKind(type); + return TypeSymbols.getJavaKind(type); } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java index 4373e3e723a9..09569fa88db3 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserKlass.java @@ -24,9 +24,9 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.espresso.classfile.attributes.Attribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; /** * Immutable raw representation of classes in Espresso, this is the output of the parser, super @@ -133,6 +133,10 @@ public Attribute getAttribute(Symbol attributeName) { return null; } + public Attribute[] getAttributes() { + return attributes; + } + public int getThisKlassIndex() { return thisKlassIndex; } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java index c6cb51712f5c..1eafb80b1439 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParserMethod.java @@ -24,9 +24,9 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.espresso.classfile.attributes.Attribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; /** * Immutable raw representation of methods in Espresso, this is the output of the parser. diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java index 9400d555b6c7..8450d8b2079a 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/ParsingContext.java @@ -26,9 +26,9 @@ import com.oracle.truffle.espresso.classfile.constantpool.Utf8Constant; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.perf.TimerCollection; public interface ParsingContext { @@ -50,8 +50,6 @@ public interface ParsingContext { Utf8Constant getOrCreateUtf8Constant(ByteSequence bytes); - long getNewKlassId(); - interface Logger { void log(String message); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java index 50186e7a1ffd..93e0aa0ace1d 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Attribute.java @@ -26,8 +26,8 @@ import java.util.Objects; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class Attribute { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java index c6995ee9c93f..edd032a71261 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/BootstrapMethodsAttribute.java @@ -23,12 +23,13 @@ package com.oracle.truffle.espresso.classfile.attributes; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class BootstrapMethodsAttribute extends Attribute { - public static final Symbol NAME = Name.BootstrapMethods; + public static final Symbol NAME = ParserNames.BootstrapMethods; public Entry[] getEntries() { return entries; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java index de9073378095..6933f73a03ea 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/CodeAttribute.java @@ -35,12 +35,13 @@ import com.oracle.truffle.espresso.classfile.ClassfileParser; import com.oracle.truffle.espresso.classfile.ExceptionHandler; import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class CodeAttribute extends Attribute { - public static final Symbol NAME = Name.Code; + public static final Symbol NAME = ParserNames.Code; private final int majorVersion; @@ -99,7 +100,7 @@ public ExceptionHandler[] getExceptionHandlers() { public StackMapTableAttribute getStackMapFrame() { for (Attribute attr : attributes) { - if (attr.getName() == Name.StackMapTable) { + if (attr.getName() == ParserNames.StackMapTable) { return (StackMapTableAttribute) attr; } } @@ -152,7 +153,7 @@ private static byte computeFlags(byte[] code) { public LineNumberTableAttribute getLineNumberTableAttribute() { for (Attribute attr : attributes) { - if (attr.getName() == Name.LineNumberTable) { + if (attr.getName() == ParserNames.LineNumberTable) { return (LineNumberTableAttribute) attr; } } @@ -161,7 +162,7 @@ public LineNumberTableAttribute getLineNumberTableAttribute() { public LocalVariableTable getLocalvariableTable() { for (Attribute attr : attributes) { - if (attr.getName() == Name.LocalVariableTable) { + if (attr.getName() == ParserNames.LocalVariableTable) { return (LocalVariableTable) attr; } } @@ -170,7 +171,7 @@ public LocalVariableTable getLocalvariableTable() { public LocalVariableTable getLocalvariableTypeTable() { for (Attribute attr : attributes) { - if (attr.getName() == Name.LocalVariableTypeTable) { + if (attr.getName() == ParserNames.LocalVariableTypeTable) { return (LocalVariableTable) attr; } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java index c0d639aa25e0..f93ea5417f13 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ConstantValueAttribute.java @@ -22,8 +22,9 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; /** * The ConstantValue attribute is a fixed-length attribute in the attributes table of a field_info @@ -41,7 +42,7 @@ * structure. */ public final class ConstantValueAttribute extends Attribute { - public static final Symbol NAME = Name.ConstantValue; + public static final Symbol NAME = ParserNames.ConstantValue; private final int constantValueIndex; public ConstantValueAttribute(int constantValueIndex) { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java index 76106d3ccf25..99e4940077b6 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/EnclosingMethodAttribute.java @@ -23,12 +23,13 @@ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class EnclosingMethodAttribute extends Attribute { - public static final Symbol NAME = Name.EnclosingMethod; + public static final Symbol NAME = ParserNames.EnclosingMethod; private final int classIndex; private final int methodIndex; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java index 97a0258cbfb3..0e44e4b98bdb 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/ExceptionsAttribute.java @@ -22,12 +22,13 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class ExceptionsAttribute extends Attribute { - public static final Symbol NAME = Name.Exceptions; + public static final Symbol NAME = ParserNames.Exceptions; private final int[] checkedExceptionsCPI; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java index 5c457f4c5d13..93bb4f0ab51f 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/InnerClassesAttribute.java @@ -23,14 +23,15 @@ package com.oracle.truffle.espresso.classfile.attributes; -import static com.oracle.truffle.api.CompilerDirectives.CompilationFinal; - +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; + +import static com.oracle.truffle.api.CompilerDirectives.CompilationFinal; public final class InnerClassesAttribute extends Attribute { - public static final Symbol NAME = Name.InnerClasses; + public static final Symbol NAME = ParserNames.InnerClasses; public static class Entry { public final int innerClassIndex; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java index b02514f22b1f..2eead7002a3f 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LineNumberTableAttribute.java @@ -25,8 +25,9 @@ import java.util.AbstractList; import java.util.List; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; /** * Maps bytecode indexes to source line numbers. @@ -35,7 +36,7 @@ */ public final class LineNumberTableAttribute extends Attribute implements LineNumberTableRef { - public static final Symbol NAME = Name.LineNumberTable; + public static final Symbol NAME = ParserNames.LineNumberTable; // Use an empty char array rather than null to throw IooB exceptions, rather than NPE. public static final LineNumberTableAttribute EMPTY = new LineNumberTableAttribute(NAME, new char[0]); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java index f9ca462f2d66..076c45ff9790 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/Local.java @@ -27,10 +27,10 @@ import org.graalvm.collections.Equivalence; import com.oracle.truffle.espresso.classfile.JavaKind; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; /** * Describes the type and bytecode index range in which a local variable is live. @@ -91,7 +91,7 @@ public Symbol getType() { } public JavaKind getJavaKind() { - return type == null ? JavaKind.Object : Types.getJavaKind(type); + return type == null ? JavaKind.Object : TypeSymbols.getJavaKind(type); } public int getSlot() { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java index da6597116299..371be4927746 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/LocalVariableTable.java @@ -26,8 +26,9 @@ import java.util.List; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; /** * Describes the {@link Local}s for a Java method. @@ -36,8 +37,8 @@ */ public final class LocalVariableTable extends Attribute implements LocalVariableTableRef { - public static final LocalVariableTable EMPTY_LVT = new LocalVariableTable(Name.LocalVariableTable, Local.EMPTY_ARRAY); - public static final LocalVariableTable EMPTY_LVTT = new LocalVariableTable(Name.LocalVariableTypeTable, Local.EMPTY_ARRAY); + public static final LocalVariableTable EMPTY_LVT = new LocalVariableTable(ParserNames.LocalVariableTable, Local.EMPTY_ARRAY); + public static final LocalVariableTable EMPTY_LVTT = new LocalVariableTable(ParserNames.LocalVariableTypeTable, Local.EMPTY_ARRAY); @CompilationFinal(dimensions = 1) // private final Local[] locals; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java index 7644e26a5727..776ebedabb2d 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/MethodParametersAttribute.java @@ -22,12 +22,13 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class MethodParametersAttribute extends Attribute { - public static final Symbol NAME = Name.MethodParameters; + public static final Symbol NAME = ParserNames.MethodParameters; public static final MethodParametersAttribute EMPTY = new MethodParametersAttribute(NAME, Entry.EMPTY_ARRAY); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java index a2822bb5ab79..9685b314eb0f 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestHostAttribute.java @@ -23,11 +23,12 @@ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class NestHostAttribute extends Attribute { - public static final Symbol NAME = Name.NestHost; + public static final Symbol NAME = ParserNames.NestHost; public final int hostClassIndex; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java index b0f129c93b40..34745d68f580 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/NestMembersAttribute.java @@ -24,11 +24,12 @@ package com.oracle.truffle.espresso.classfile.attributes; import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class NestMembersAttribute extends Attribute { - public static final Symbol NAME = Name.NestMembers; + public static final Symbol NAME = ParserNames.NestMembers; @CompilerDirectives.CompilationFinal(dimensions = 1)// private final int[] classes; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java index 305402ae7295..86f7ebce9458 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/PermittedSubclassesAttribute.java @@ -24,11 +24,12 @@ package com.oracle.truffle.espresso.classfile.attributes; import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class PermittedSubclassesAttribute extends Attribute { - public static final Symbol NAME = Name.PermittedSubclasses; + public static final Symbol NAME = ParserNames.PermittedSubclasses; public static final PermittedSubclassesAttribute EMPTY = new PermittedSubclassesAttribute(NAME, new char[0]); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java index a4a7c983c8a2..541f41161b9a 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/RecordAttribute.java @@ -24,11 +24,12 @@ package com.oracle.truffle.espresso.classfile.attributes; import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class RecordAttribute extends Attribute { - public static final Symbol NAME = Name.Record; + public static final Symbol NAME = ParserNames.Record; @CompilerDirectives.CompilationFinal(dimensions = 1) // private final RecordComponentInfo[] components; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java index 07738ebc3d41..acd4561c2697 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SignatureAttribute.java @@ -22,12 +22,13 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class SignatureAttribute extends Attribute { - public static final Symbol NAME = Name.Signature; + public static final Symbol NAME = ParserNames.Signature; private final char signatureIndex; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java index 0ee8a4a15d84..54a11e7ab03f 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceDebugExtensionAttribute.java @@ -22,12 +22,13 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class SourceDebugExtensionAttribute extends Attribute { - public static final Symbol NAME = Name.SourceDebugExtension; + public static final Symbol NAME = ParserNames.SourceDebugExtension; private final String debugExtension; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java index dfc75792a9ae..618f47c9b5bc 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/SourceFileAttribute.java @@ -22,12 +22,13 @@ */ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public final class SourceFileAttribute extends Attribute { - public static final Symbol NAME = Name.SourceFile; + public static final Symbol NAME = ParserNames.SourceFile; private final int sourceFileIndex; diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java index cf03734c8611..96e1e9543762 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/attributes/StackMapTableAttribute.java @@ -23,16 +23,17 @@ package com.oracle.truffle.espresso.classfile.attributes; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public class StackMapTableAttribute extends Attribute { - public static final Symbol NAME = Symbol.Name.StackMapTable; + public static final Symbol NAME = ParserNames.StackMapTable; public static final StackMapTableAttribute EMPTY = new StackMapTableAttribute(NAME, null); - public StackMapTableAttribute(Symbol name, byte[] data) { + public StackMapTableAttribute(Symbol name, byte[] data) { super(name, data); } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/BootstrapMethodConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/BootstrapMethodConstant.java index 75b8dd60e859..d8d80bf257e4 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/BootstrapMethodConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/BootstrapMethodConstant.java @@ -23,8 +23,9 @@ package com.oracle.truffle.espresso.classfile.constantpool; import com.oracle.truffle.espresso.classfile.ConstantPool; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; /** * Interface denoting a bootstrap method constant entry in a constant pool. @@ -48,7 +49,7 @@ public Symbol getName(ConstantPool pool) { return getNameAndType(pool).getName(pool); } - public Symbol getDescriptor(ConstantPool pool) { + public Symbol getDescriptor(ConstantPool pool) { return getNameAndType(pool).getDescriptor(pool); } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassConstant.java index 4f08a2846098..e46a70ab0934 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassConstant.java @@ -26,8 +26,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; @@ -80,7 +80,7 @@ final class Index implements ImmutableClassConstant, Resolvable { @Override public Symbol getName(ConstantPool pool) { - return pool.symbolAt(classNameIndex); + return pool.symbolAtUnsafe(classNameIndex); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassMethodRefConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassMethodRefConstant.java index 1df8c7d7cd8b..e06763a80ac5 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassMethodRefConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/ClassMethodRefConstant.java @@ -24,9 +24,10 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface ClassMethodRefConstant extends MethodRefConstant { @@ -53,7 +54,7 @@ public void validate(ConstantPool pool) throws ValidationException { // initialization method (§2.9). The return type of such a method must be void. pool.nameAndTypeAt(nameAndTypeIndex).validateMethod(pool, false, true); Symbol name = pool.nameAndTypeAt(nameAndTypeIndex).getName(pool); - if (Name._init_.equals(name)) { + if (ParserNames._init_.equals(name)) { Symbol descriptor = pool.nameAndTypeAt(nameAndTypeIndex).getDescriptor(pool); int len = descriptor.length(); if (len <= 2 || (descriptor.byteAt(len - 2) != ')' || descriptor.byteAt(len - 1) != 'V')) { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/DynamicConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/DynamicConstant.java index 27089bec4da0..6af5d8511626 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/DynamicConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/DynamicConstant.java @@ -27,8 +27,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface DynamicConstant extends BootstrapMethodConstant { @@ -48,7 +48,7 @@ final class Indexes extends BootstrapMethodConstant.Indexes implements DynamicCo } public Symbol getTypeSymbol(ConstantPool pool) { - return Types.fromSymbol(pool.nameAndTypeAt(nameAndTypeIndex).getDescriptor(pool)); + return TypeSymbols.fromDescriptorUnsafe(pool.nameAndTypeAt(nameAndTypeIndex).getDescriptor(pool)); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/FieldRefConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/FieldRefConstant.java index 2d5aa9969201..996dbb1d13c8 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/FieldRefConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/FieldRefConstant.java @@ -25,8 +25,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface FieldRefConstant extends MemberRefConstant { @@ -45,9 +45,8 @@ final class Indexes extends MemberRefConstant.Indexes implements FieldRefConstan super(classIndex, nameAndTypeIndex); } - @SuppressWarnings("uncheked") public Symbol getType(ConstantPool pool) { - return Types.fromDescriptor(getDescriptor(pool)); + return TypeSymbols.fromDescriptorUnsafe(getDescriptor(pool)); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/InvokeDynamicConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/InvokeDynamicConstant.java index c256b03298af..ab1bdc3e5e9e 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/InvokeDynamicConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/InvokeDynamicConstant.java @@ -26,9 +26,11 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface InvokeDynamicConstant extends BootstrapMethodConstant { @@ -51,10 +53,6 @@ final class Indexes extends BootstrapMethodConstant.Indexes implements InvokeDyn super(bootstrapMethodAttrIndex, nameAndTypeIndex); } - public Symbol getSignature(ConstantPool pool) { - return Signatures.check(getDescriptor(pool)); - } - @Override public void dump(ByteBuffer buf) { buf.putChar(bootstrapMethodAttrIndex); @@ -63,7 +61,13 @@ public void dump(ByteBuffer buf) { @Override public void validate(ConstantPool pool) throws ValidationException { - getNameAndType(pool).validateMethod(pool, false); + pool.nameAndTypeAt(nameAndTypeIndex).validateMethod(pool, false); + } + + public Symbol getSignature(ConstantPool pool) { + Symbol descriptor = pool.nameAndTypeAt(nameAndTypeIndex).getDescriptor(pool); + assert Validation.validSignatureDescriptor(descriptor); + return SignatureSymbols.fromDescriptorUnsafe(descriptor); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MemberRefConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MemberRefConstant.java index 0a0f489834c4..1f0289487288 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MemberRefConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MemberRefConstant.java @@ -25,9 +25,9 @@ import java.nio.ByteBuffer; import com.oracle.truffle.espresso.classfile.ConstantPool; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; /** diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodHandleConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodHandleConstant.java index 675dbee82cb9..ccc48900bc37 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodHandleConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodHandleConstant.java @@ -37,8 +37,9 @@ import com.oracle.truffle.espresso.classfile.ClassfileParser; import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface MethodHandleConstant extends PoolConstant { @@ -75,13 +76,13 @@ public void validate(ConstantPool pool) throws ValidationException { member.validate(pool); Symbol memberName = member.getName(pool); - if (Name._clinit_.equals(memberName)) { + if (ParserNames._clinit_.equals(memberName)) { throw ValidationException.raise("Ill-formed constant: " + tag()); } // If the value is 8 (REF_newInvokeSpecial), the name of the method represented by a // CONSTANT_Methodref_info structure must be . - if (Name._init_.equals(memberName) && refKind != REF_newInvokeSpecial) { + if (ParserNames._init_.equals(memberName) && refKind != REF_newInvokeSpecial) { throw ValidationException.raise("Ill-formed constant: " + tag()); } @@ -93,7 +94,7 @@ public void validate(ConstantPool pool) throws ValidationException { // (REF_invokeStatic), 7 (REF_invokeSpecial), or 9 (REF_invokeInterface), the name of // the method represented by a CONSTANT_Methodref_info structure or a // CONSTANT_InterfaceMethodref_info structure must not be or . - if (memberName.equals(Name._init_) || memberName.equals(Name._clinit_)) { + if (memberName.equals(ParserNames._init_) || memberName.equals(ParserNames._clinit_)) { if (refKind == REF_invokeVirtual || refKind == REF_invokeStatic || refKind == REF_invokeSpecial || diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodRefConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodRefConstant.java index d60506ba26c6..27dfaf866ea6 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodRefConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodRefConstant.java @@ -23,8 +23,8 @@ package com.oracle.truffle.espresso.classfile.constantpool; import com.oracle.truffle.espresso.classfile.ConstantPool; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface MethodRefConstant extends MemberRefConstant { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodTypeConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodTypeConstant.java index 2f2015d5f07b..2ade6f217b83 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodTypeConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/MethodTypeConstant.java @@ -22,12 +22,11 @@ */ package com.oracle.truffle.espresso.classfile.constantpool; -import static com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; - import java.nio.ByteBuffer; import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; @@ -56,7 +55,7 @@ final class Index implements MethodTypeConstant, ImmutablePoolConstant, Resolvab * a name */ public Symbol getSignature(ConstantPool pool) { - return pool.symbolAt(descriptorIndex); + return pool.symbolAtUnsafe(descriptorIndex); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/NameAndTypeConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/NameAndTypeConstant.java index 17f706d23fe0..458367ad2e3e 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/NameAndTypeConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/NameAndTypeConstant.java @@ -22,15 +22,16 @@ */ package com.oracle.truffle.espresso.classfile.constantpool; -import java.nio.ByteBuffer; - import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; +import java.nio.ByteBuffer; + public interface NameAndTypeConstant extends ImmutablePoolConstant { static NameAndTypeConstant create(int nameIndex, int typeIndex) { @@ -83,12 +84,12 @@ final class Indexes implements NameAndTypeConstant { @Override public Symbol getName(ConstantPool pool) { - return pool.symbolAt(nameIndex); + return pool.symbolAtUnsafe(nameIndex); } @Override public Symbol getDescriptor(ConstantPool pool) { - return pool.symbolAt(typeIndex); + return pool.symbolAtUnsafe(typeIndex); } @Override @@ -113,8 +114,8 @@ public void validate(ConstantPool pool) throws ValidationException { @Override public void validateMethod(ConstantPool pool, boolean allowClinit, boolean checkVoidInitOrClinit) throws ValidationException { pool.utf8At(nameIndex).validateMethodName(allowClinit); - Symbol symbol = pool.symbolAt(nameIndex); - boolean isInitOrClinit = checkVoidInitOrClinit && (Name._init_.equals(symbol) || Name._clinit_.equals(symbol)); + Symbol symbol = pool.symbolAtUnsafe(nameIndex); + boolean isInitOrClinit = checkVoidInitOrClinit && (ParserNames._init_.equals(symbol) || ParserNames._clinit_.equals(symbol)); pool.utf8At(typeIndex).validateSignature(isInitOrClinit); } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/StringConstant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/StringConstant.java index 9ff19443f4b8..ae7462465fd4 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/StringConstant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/StringConstant.java @@ -26,8 +26,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.ModifiedUTF8; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; public interface StringConstant extends PoolConstant { @@ -65,7 +65,7 @@ public void dump(ByteBuffer buf) { * a name */ public Symbol getSymbol(ConstantPool pool) { - return pool.symbolAt(utf8Index); + return pool.symbolAtUnsafe(utf8Index); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/Utf8Constant.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/Utf8Constant.java index aebe766a7c9c..3852d50953ba 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/Utf8Constant.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/constantpool/Utf8Constant.java @@ -26,11 +26,11 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ConstantPool.Tag; -import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUtf8; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; @@ -75,7 +75,7 @@ public void validate(ConstantPool pool) throws ValidationException { validateUTF8(); } - public Symbol validateUTF8() throws ValidationException { + public Symbol validateUTF8() throws ValidationException { if ((validationCache & VALID_UTF8) == 0) { if (!Validation.validModifiedUTF8(unsafeSymbolValue())) { throw ValidationException.raise("Ill-formed modified-UTF8 entry"); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java index 613c6f6e7db4..e36f3581ceb5 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ByteSequence.java @@ -76,14 +76,14 @@ public int length() { } @Override - public int offset() { + int offset() { return offset; } }; } public static ByteSequence create(String str) { - final byte[] bytes = ModifiedUtf8.fromJavaString(str); + final byte[] bytes = ModifiedUTF8.fromJavaString(str); return ByteSequence.wrap(bytes, 0, bytes.length); } @@ -108,7 +108,7 @@ public static ByteSequence from(ByteBuffer buffer) { */ public abstract int length(); - public abstract int offset(); + abstract int offset(); /** * Returns the byte value at the specified index. An index ranges from zero to @@ -174,7 +174,7 @@ public final boolean contentStartsWith(ByteSequence other) { @Override public String toString() { try { - return ModifiedUtf8.toJavaString(getUnderlyingBytes(), offset(), length()); + return ModifiedUTF8.toJavaString(getUnderlyingBytes(), offset(), length()); } catch (IOException e) { throw new IllegalStateException(e); } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java new file mode 100644 index 000000000000..f811d075c2a7 --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Descriptor.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.classfile.descriptors; + +/** + * Tag type representing JVM type descriptors encoded in Modified UTF-8 format. Used as a type + * parameter in {@code Symbol}. + */ +public abstract sealed class Descriptor extends ModifiedUTF8 permits Signature, Type { +} diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUtf8.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java similarity index 92% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUtf8.java rename to espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java index 6a7a386aa14f..2b9b018812d6 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUtf8.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ModifiedUTF8.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,12 +29,22 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; /** - * Modified UTF-8 conversions. + * Provides Modified UTF-8 encoding methods. + *

+ * Tag type representing Java's Modified UTF-8 encoding format. Used as a type parameter in + * {@code Symbol} for type safety. */ -public final class ModifiedUtf8 { +public sealed class ModifiedUTF8 permits Descriptor, Name { - private ModifiedUtf8() { - /* no instances */ + /** + * Type-safe cast from Symbol with ModifiedUTF8 bound to Symbol. + * + * @param symbol The symbol to cast + * @return The input symbol cast to Symbol + */ + @SuppressWarnings("unchecked") + public static Symbol fromSymbol(Symbol symbol) { + return (Symbol) symbol; } public static int utfLength(String str) { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java new file mode 100644 index 000000000000..6af6847e3c6d --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Name.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.classfile.descriptors; + +/** + * Tag type representing a name encoded in Modified UTF-8 format. Used as a type parameter in + * {@code Symbol}. + */ +public final class Name extends ModifiedUTF8 { +} diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java new file mode 100644 index 000000000000..968637b9c8cb --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/NameSymbols.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.classfile.descriptors; + +/** + * Manages access to "name" symbols used in class files and other JVM structures. + *

+ * Name symbols represent identifiers like class names, method names, field names, etc. While names + * do not have a strictly defined format, they typically follow Java identifier naming conventions. + */ +public final class NameSymbols { + private final Symbols symbols; + + /** + * Creates a new NameSymbols instance to manage name symbol operations. + * + * @param symbols The underlying Symbols instance that handles symbol storage and retrieval + */ + public NameSymbols(Symbols symbols) { + this.symbols = symbols; + } + + /** + * Looks up an existing name symbol from a byte sequence. Only returns symbols that have been + * previously created. + * + * @param nameBytes The name as a byte sequence to look up + * @return The existing Symbol for the name, or null if no matching symbol exists + */ + public Symbol lookup(ByteSequence nameBytes) { + return symbols.lookup(nameBytes); + } + + /** + * Looks up an existing name symbol from a string. Only returns symbols that have been + * previously created. + * + * @param nameString The name as a string to look up + * @return The existing Symbol for the name, or null if no matching symbol exists + */ + public Symbol lookup(String nameString) { + return lookup(ByteSequence.create(nameString)); + } + + /** + * Creates a new name symbol or retrieves an existing one from a string. If the symbol doesn't + * exist, it will be created. + * + * @param nameString The name as a string to create or retrieve + * @return A new or existing Symbol representing the name + */ + public Symbol getOrCreate(String nameString) { + return getOrCreate(ByteSequence.create(nameString)); + } + + /** + * Creates a new name symbol or retrieves an existing one from a byte sequence. If the symbol + * doesn't exist, it will be created. + * + * @param nameBytes The name as a byte sequence to create or retrieve + * @return A new or existing Symbol representing the name + */ + public Symbol getOrCreate(ByteSequence nameBytes) { + return symbols.symbolify(nameBytes); + } + + /** + * Determines if a package represents the unnamed package. The unnamed package is represented by + * an empty symbol. + * + * @param pkg The package to check + * @return true if the package is unnamed (zero length), false otherwise + */ + public static boolean isUnnamedPackage(Symbol pkg) { + return pkg.length() == 0; + } +} diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java new file mode 100644 index 000000000000..118b278feb5d --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/ParserSymbols.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.classfile.descriptors; + +import com.oracle.truffle.espresso.classfile.JavaKind; + +/** + * Predefined symbols used by the parser and shared with Espresso. Contains static definitions for + * commonly used types, names and signatures. + *

+ * This class is not meant for general symbol management - use {@link Symbols}, {@link TypeSymbols}, + * {@link NameSymbols} etc. for that purpose. + *

+ * The symbols are initialized in a specific order via the inner classes: + *

    + *
  • {@link ParserTypes} - Core Java types and primitives + *
  • {@link ParserNames} - Common names and attribute names + *
  • {@link ParserSignatures} - Method signatures + *
+ *

+ * Once initialized, the symbols are frozen and no more symbols can be added. + */ +public final class ParserSymbols { + + public static final StaticSymbols SYMBOLS = new StaticSymbols(); + + static { + ParserNames.ensureInitialized(); + ParserTypes.ensureInitialized(); + ParserSignatures.ensureInitialized(); + JavaKind.ensureInitialized(); + } + + public static void ensureInitialized() { + /* nop */ + } + + public static final class ParserTypes { + // Core types. + public static final Symbol java_lang_String = SYMBOLS.putType("Ljava/lang/String;"); + public static final Symbol java_lang_Object = SYMBOLS.putType("Ljava/lang/Object;"); + public static final Symbol java_lang_Class = SYMBOLS.putType("Ljava/lang/Class;"); + public static final Symbol java_lang_Cloneable = SYMBOLS.putType("Ljava/lang/Cloneable;"); + public static final Symbol java_io_Serializable = SYMBOLS.putType("Ljava/io/Serializable;"); + + public static final Symbol java_lang_invoke_LambdaForm$Compiled = SYMBOLS.putType("Ljava/lang/invoke/LambdaForm$Compiled;"); + public static final Symbol java_lang_invoke_LambdaForm$Hidden = SYMBOLS.putType("Ljava/lang/invoke/LambdaForm$Hidden;"); + public static final Symbol jdk_internal_vm_annotation_Hidden = SYMBOLS.putType("Ljdk/internal/vm/annotation/Hidden;"); + public static final Symbol jdk_internal_vm_annotation_Stable = SYMBOLS.putType("Ljdk/internal/vm/annotation/Stable;"); + public static final Symbol sun_reflect_CallerSensitive = SYMBOLS.putType("Lsun/reflect/CallerSensitive;"); + public static final Symbol jdk_internal_reflect_CallerSensitive = SYMBOLS.putType("Ljdk/internal/reflect/CallerSensitive;"); + public static final Symbol java_lang_invoke_ForceInline = SYMBOLS.putType("Ljava/lang/invoke/ForceInline;"); + public static final Symbol jdk_internal_vm_annotation_ForceInline = SYMBOLS.putType("Ljdk/internal/vm/annotation/ForceInline;"); + public static final Symbol java_lang_invoke_DontInline = SYMBOLS.putType("Ljava/lang/invoke/DontInline;"); + public static final Symbol jdk_internal_vm_annotation_DontInline = SYMBOLS.putType("Ljdk/internal/vm/annotation/DontInline;"); + + // ScopedMemoryAccess + public static final Symbol jdk_internal_misc_ScopedMemoryAccess$Scoped = SYMBOLS.putType("Ljdk/internal/misc/ScopedMemoryAccess$Scoped;"); + + // Primitive types. + public static final Symbol _boolean = SYMBOLS.putType("Z" /* boolean */); + public static final Symbol _byte = SYMBOLS.putType("B" /* byte */); + public static final Symbol _char = SYMBOLS.putType("C" /* char */); + public static final Symbol _short = SYMBOLS.putType("S" /* short */); + public static final Symbol _int = SYMBOLS.putType("I" /* int */); + public static final Symbol _float = SYMBOLS.putType("F" /* float */); + public static final Symbol _double = SYMBOLS.putType("D" /* double */); + public static final Symbol _long = SYMBOLS.putType("J" /* long */); + public static final Symbol _void = SYMBOLS.putType("V" /* void */); + + public static void ensureInitialized() { + /* nop */ + } + } + + public static final class ParserNames { + // general + public static final Symbol _init_ = SYMBOLS.putName(""); + public static final Symbol _clinit_ = SYMBOLS.putName(""); + + public static final Symbol finalize = SYMBOLS.putName("finalize"); + + // Attribute names + public static final Symbol AnnotationDefault = SYMBOLS.putName("AnnotationDefault"); + public static final Symbol BootstrapMethods = SYMBOLS.putName("BootstrapMethods"); + public static final Symbol Code = SYMBOLS.putName("Code"); + public static final Symbol ConstantValue = SYMBOLS.putName("ConstantValue"); + public static final Symbol Deprecated = SYMBOLS.putName("Deprecated"); + public static final Symbol EnclosingMethod = SYMBOLS.putName("EnclosingMethod"); + public static final Symbol Exceptions = SYMBOLS.putName("Exceptions"); + public static final Symbol InnerClasses = SYMBOLS.putName("InnerClasses"); + public static final Symbol LineNumberTable = SYMBOLS.putName("LineNumberTable"); + public static final Symbol LocalVariableTable = SYMBOLS.putName("LocalVariableTable"); + public static final Symbol LocalVariableTypeTable = SYMBOLS.putName("LocalVariableTypeTable"); + public static final Symbol MethodParameters = SYMBOLS.putName("MethodParameters"); + public static final Symbol NestHost = SYMBOLS.putName("NestHost"); + public static final Symbol NestMembers = SYMBOLS.putName("NestMembers"); + public static final Symbol PermittedSubclasses = SYMBOLS.putName("PermittedSubclasses"); + public static final Symbol Record = SYMBOLS.putName("Record"); + public static final Symbol RuntimeVisibleAnnotations = SYMBOLS.putName("RuntimeVisibleAnnotations"); + public static final Symbol RuntimeInvisibleAnnotations = SYMBOLS.putName("RuntimeInvisibleAnnotations"); + public static final Symbol RuntimeVisibleTypeAnnotations = SYMBOLS.putName("RuntimeVisibleTypeAnnotations"); + public static final Symbol RuntimeInvisibleTypeAnnotations = SYMBOLS.putName("RuntimeInvisibleTypeAnnotations"); + public static final Symbol RuntimeVisibleParameterAnnotations = SYMBOLS.putName("RuntimeVisibleParameterAnnotations"); + public static final Symbol RuntimeInvisibleParameterAnnotations = SYMBOLS.putName("RuntimeInvisibleParameterAnnotations"); + public static final Symbol Signature = SYMBOLS.putName("Signature"); + public static final Symbol SourceFile = SYMBOLS.putName("SourceFile"); + public static final Symbol SourceDebugExtension = SYMBOLS.putName("SourceDebugExtension"); + public static final Symbol StackMapTable = SYMBOLS.putName("StackMapTable"); + public static final Symbol Synthetic = SYMBOLS.putName("Synthetic"); + public static final Symbol clone = SYMBOLS.putName("clone"); + + public static void ensureInitialized() { + /* nop */ + } + } + + public static final class ParserSignatures { + public static final Symbol _void = SYMBOLS.putSignature(ParserTypes._void); + + public static void ensureInitialized() { + /* nop */ + } + } +} diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Names.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java similarity index 51% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Names.java rename to espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java index ec56ec62e875..a21fa3528cec 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Names.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,39 +22,19 @@ */ package com.oracle.truffle.espresso.classfile.descriptors; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserSignatures; /** - * Manages access to "name" symbols. + * Tag type representing method and field signatures encoded in Modified UTF-8 format. Used as a + * type parameter in {@code Symbol}. * - * Names do not have a well-defined format, except for not being empty. + *

+ * Inherits from {@link Descriptor} to indicate that signatures follow the JVM descriptor format + * with additional method parameter information. * - * TODO(peterssen): In debug mode this class should warn if name symbol is valid type or signature. + *

+ * Related symbols follow a naming convention: {@code returnType_parameterType1_parameterType2} + * using unqualified type names. Example: {@link ParserSignatures#_void} for void methods. */ -public final class Names { - private final Symbols symbols; - - public Names(Symbols symbols) { - this.symbols = symbols; - } - - public Symbol lookup(ByteSequence bytes) { - return symbols.lookup(bytes); - } - - public Symbol lookup(String name) { - return lookup(ByteSequence.create(name)); - } - - public Symbol getOrCreate(String name) { - return getOrCreate(ByteSequence.create(name)); - } - - public Symbol getOrCreate(ByteSequence name) { - return symbols.symbolify(name); - } - - public static boolean isUnnamedPackage(Symbol pkg) { - return pkg.length() == 0; - } +public final class Signature extends Descriptor { } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signatures.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java similarity index 60% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signatures.java rename to espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java index b290e34c06a1..8154dd801b5c 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Signatures.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/SignatureSymbols.java @@ -29,36 +29,105 @@ import java.util.Iterator; import java.util.List; import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Function; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.ParserException; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; /** - * Represents a method signature provided by the runtime. + * Represents and manages method signature symbols for the Java runtime. * - * Two representations for method signatures : + * Method signatures can be represented in two forms: *

    - *
  • Raw: {@link Symbol}<{@link Signature}> - *
  • Parsed: {@link Symbol}<{@link Type}>[] which includes the return type at the end. + *
  • Raw: {@link Symbol}<{@link Signature}> - The original signature string + *
  • Parsed: {@link Symbol}<{@link Type}>[] - Array of parameter types with return type at + * the end *
* + * The signature format follows the JVM specification for method descriptors. + * * @see Method * Descriptors */ -public final class Signatures { - private final Types types; +public final class SignatureSymbols { + private final TypeSymbols typeSymbols; private final Symbols symbols; private final ConcurrentHashMap, Symbol[]> parsedSignatures = new ConcurrentHashMap<>(); - public Signatures(Symbols symbols, Types types) { + /** + * Creates a new SignatureSymbols instance. + * + * @param symbols The Symbols instance for symbol management + * @param typeSymbols The TypeSymbols instance for handling type descriptors + */ + public SignatureSymbols(Symbols symbols, TypeSymbols typeSymbols) { this.symbols = symbols; - this.types = types; + this.typeSymbols = typeSymbols; + } + + /** + * Looks up an existing valid method signature from a string. + * + * @param signatureString The method signature string to look up + * @return The signature Symbol if valid and exists, null otherwise + * + * @see Validation#validSignatureDescriptor(ByteSequence) + */ + public Symbol lookupValidSignature(String signatureString) { + return lookupValidSignature(ByteSequence.create(signatureString)); + } + + /** + * Looks up an existing valid method signature from a byte sequence. + * + * @param signatureBytes The method signature bytes to look up + * @return The signature Symbol if valid and exists, null otherwise + * + * @see Validation#validSignatureDescriptor(ByteSequence) + */ + public Symbol lookupValidSignature(ByteSequence signatureBytes) { + if (!Validation.validSignatureDescriptor(signatureBytes)) { + return null; + } + return symbols.lookup(signatureBytes); + } + + /** + * Creates or retrieves a valid method signature symbol from a byte sequence. + * + * @param signatureBytes The method signature bytes to create or retrieve + * @return The signature Symbol if valid, null otherwise + * + * @see Validation#validSignatureDescriptor(ByteSequence) + */ + public Symbol getOrCreateValidSignature(ByteSequence signatureBytes) { + if (!Validation.validSignatureDescriptor(signatureBytes)) { + return null; + } + return symbols.symbolify(signatureBytes); + } + + /** + * Returns the TypeSymbols instance used by this SignatureSymbols. + * + * @return The TypeSymbols instance for handling type descriptors + */ + public TypeSymbols getTypes() { + return typeSymbols; + } + + /** + * Gets or computes the parsed form of a method signature. The parsed form is an array of Type + * symbols where the last element is the return type and all preceding elements are parameter + * types. Results are cached for performance. + * + * @param signature The method signature to parse + * @return Array of Type symbols representing parameter types followed by return type + */ + public Symbol[] parsed(Symbol signature) { + return parsedSignatures.computeIfAbsent(signature, key -> parse(SignatureSymbols.this.getTypes(), signature, 0)); } /** @@ -87,56 +156,31 @@ public Symbol toBasic(Symbol raw, boolean keepLastArg) { return makeRaw(rtype, buf.toArray(Symbol.EMPTY_ARRAY)); } - private static Symbol toBasic(Symbol t) { - if (t == Type.java_lang_Object || Types.isArray(t)) { - return Type.java_lang_Object; - } else if (t == Type._int || t == Type._short || t == Type._boolean || t == Type._char) { - return Type._int; + private static Symbol toBasic(Symbol type) { + if (type == ParserTypes.java_lang_Object || TypeSymbols.isArray(type)) { + return ParserTypes.java_lang_Object; + } else if (type == ParserTypes._int || type == ParserTypes._short || type == ParserTypes._boolean || type == ParserTypes._char) { + return ParserTypes._int; } else { - return t; + return type; } } - public Symbol lookupValidSignature(String signatureString) { - if (!isValid(signatureString)) { - return null; - } - return symbols.lookup(signatureString); - } - - public Symbol lookupValidSignature(ByteSequence signatureBytes) { - if (!isValid(signatureBytes)) { - return null; - } - return symbols.lookup(signatureBytes); - } - - public Symbol symbolifyValidSignature(ByteSequence signatureBytes) { - if (!isValid(signatureBytes)) { - return null; - } - return symbols.symbolify(signatureBytes); - } - - public Types getTypes() { - return types; - } - /** * Parses a signature descriptor string into its parameter and return type components. * * @return the parsed parameter types followed by the return type. - * @throws ParserException.ClassFormatError if {@code string} is not well formed + * @throws ParserException.ClassFormatError if {the signature is not well-formed */ @SuppressWarnings({"rawtypes", "unchecked"}) - static Symbol[] parse(Types typeDescriptors, Symbol signature, int startIndex) throws ParserException.ClassFormatError { + static Symbol[] parse(TypeSymbols typeSymbols, Symbol signature, int startIndex) throws ParserException.ClassFormatError { if ((startIndex > signature.length() - 3) || signature.byteAt(startIndex) != '(') { throw new ParserException.ClassFormatError("Invalid method signature: " + signature); } final List> buf = new ArrayList<>(); int i = startIndex + 1; while (signature.byteAt(i) != ')') { - final Symbol descriptor = typeDescriptors.parse(signature, i, true); + final Symbol descriptor = typeSymbols.parse(signature, i, true); buf.add(descriptor); i = i + descriptor.length(); if (i >= signature.length()) { @@ -144,7 +188,7 @@ static Symbol[] parse(Types typeDescriptors, Symbol signature, } } i++; - final Symbol descriptor = typeDescriptors.parse(signature, i, true); + final Symbol descriptor = typeSymbols.parse(signature, i, true); if (i + descriptor.length() != signature.length()) { throw new ParserException.ClassFormatError("Invalid method signature: " + signature); } @@ -153,31 +197,15 @@ static Symbol[] parse(Types typeDescriptors, Symbol signature, return descriptors; } - /** - * Parses a raw signature descriptor into its parameter and return type components. - * - * @return the parsed parameter types followed by the return type. - * @throws ParserException.ClassFormatError if {@code string} is not well formed - */ - public static int skipValidSignature(Symbol signature, int beginIndex) throws ParserException.ClassFormatError { - if ((beginIndex > signature.length() - 3) || signature.byteAt(beginIndex) != '(') { - throw new ParserException.ClassFormatError("Invalid method signature: " + signature); - } - int i = beginIndex + 1; - while (signature.byteAt(i) != ')') { - int endIndex = Types.skipValidTypeDescriptor(signature, i, true); - if (i >= signature.length()) { - throw new ParserException.ClassFormatError("Invalid method signature: " + signature); - } - i = endIndex; - } - i++; - return Types.skipValidTypeDescriptor(signature, i, true); + @SuppressWarnings("unchecked") + public static Symbol fromDescriptor(Symbol descriptor) { + ErrorUtil.guarantee(Validation.validSignatureDescriptor(descriptor), "invalid signature"); + return (Symbol) descriptor; } @SuppressWarnings("unchecked") - public static Symbol check(Symbol descriptor) { - assert isValid((Symbol) descriptor); + public static Symbol fromDescriptorUnsafe(Symbol descriptor) { + assert Validation.validSignatureDescriptor(descriptor) : "invalid signature " + descriptor; return (Symbol) descriptor; } @@ -192,7 +220,7 @@ public static Symbol returnType(final Symbol[] signature) { * Gets the kind of the return type in this (parsed) signature object. */ public static JavaKind returnKind(final Symbol[] signature) { - return Types.getJavaKind(returnType(signature)); + return TypeSymbols.getJavaKind(returnType(signature)); } /** @@ -202,7 +230,7 @@ public static JavaKind returnKind(final Symbol[] signature) { public static int getNumberOfSlots(final Symbol[] signature) { int slots = 0; for (Symbol type : signature) { - slots += Types.getJavaKind(type).getSlotCount(); + slots += TypeSymbols.getJavaKind(type).getSlotCount(); } return slots; } @@ -247,7 +275,7 @@ private static final class SignatureIter implements Iterable>, Iter private SignatureIter(final Symbol[] signature, boolean reverse, boolean withReturnType) { this.signature = signature; int tmpStart = 0; - int tmpEnd = Signatures.parameterCount(signature); + int tmpEnd = SignatureSymbols.parameterCount(signature); int tmpStep = 1; if (withReturnType) { tmpEnd = signature.length; @@ -287,37 +315,11 @@ private int nextIdx() { } } - /** - * Validates a raw signature. - */ - public static boolean isValid(Symbol signature) { - int endIndex = skipValidSignature(signature, 0); - return endIndex == signature.length(); - } - - public static boolean isValid(@SuppressWarnings("unused") String signatureString) { - // TODO(peterssen): Implement FAST validation. - return true; - } - - public static boolean isValid(@SuppressWarnings("unused") ByteSequence signatureBytes) { - // TODO: Implement FAST validation. - return true; - } - - public static Symbol verify(Symbol signature) { - int endIndex = skipValidSignature(signature, 0); - if (endIndex != signature.length()) { - throw new ParserException.ClassFormatError("Invalid signature descriptor " + signature); - } - return signature; - } - /** * Gets the kind of the `paramIndex`-th parameter in this (parsed) signature object. */ public static JavaKind parameterKind(final Symbol[] signature, int paramIndex) { - return Types.getJavaKind(signature[paramIndex]); + return TypeSymbols.getJavaKind(signature[paramIndex]); } /** @@ -330,68 +332,25 @@ public static Symbol parameterType(final Symbol[] signature, int par @SuppressWarnings({"varargs", "rawtypes"}) @SafeVarargs - public static final Symbol[] makeParsedUncached(Symbol returnType, Symbol... parameterTypes) { + public static Symbol[] makeParsedUncached(Symbol returnType, Symbol... parameterTypes) { final Symbol[] signature = Arrays.copyOf(parameterTypes, parameterTypes.length + 1); signature[signature.length - 1] = returnType; return signature; } - @SuppressWarnings({"unchecked", "rawtypes"}) - public Symbol makeRaw(Class returnClass, Class... parameterClasses) { - Symbol[] parameterTypes = new Symbol[parameterClasses.length]; - for (int i = 0; i < parameterClasses.length; ++i) { - parameterTypes[i] = getTypes().fromClass(parameterClasses[i]); - } - return makeRaw(getTypes().fromClass(returnClass), parameterTypes); - } - @SafeVarargs public final Symbol makeRaw(Symbol returnType, Symbol... parameterTypes) { - if (parameterTypes == null || parameterTypes.length == 0) { - final byte[] bytes = new byte[2 + returnType.length()]; - returnType.writeTo(bytes, 2); - bytes[0] = '('; - bytes[1] = ')'; - return symbols.symbolify(ByteSequence.wrap(bytes)); - } - - int totalLength = returnType.length(); - for (Symbol param : parameterTypes) { - totalLength += param.length(); - } - - final byte[] bytes = new byte[totalLength + 2]; // + () - - int pos = 0; - bytes[pos++] = '('; - for (Symbol param : parameterTypes) { - param.writeTo(bytes, pos); - pos += param.length(); - } - bytes[pos++] = ')'; - returnType.writeTo(bytes, pos); - pos += returnType.length(); - assert pos == totalLength + 2; - return symbols.symbolify(ByteSequence.wrap(bytes)); - } - - public Symbol getOrCreateValidSignature(String signatureString) { - return symbols.symbolify(ByteSequence.create(checkSignature(signatureString))); - } - - private static String checkSignature(String signatureString) { - // FIXME(peterssen): Do check. - return signatureString; + return symbols.symbolify(createSignature(returnType, parameterTypes)); } @SafeVarargs - static byte[] buildSignatureBytes(Symbol returnType, Symbol... parameterTypes) { + static ByteSequence createSignature(Symbol returnType, Symbol... parameterTypes) { if (parameterTypes == null || parameterTypes.length == 0) { byte[] bytes = new byte[/* () */ 2 + returnType.length()]; bytes[0] = '('; bytes[1] = ')'; returnType.writeTo(bytes, 2); - return bytes; + return ByteSequence.wrap(bytes); } int totalLength = returnType.length(); @@ -411,15 +370,6 @@ static byte[] buildSignatureBytes(Symbol returnType, Symbol... param returnType.writeTo(bytes, pos); pos += returnType.length(); assert pos == totalLength + 2; - return bytes; - } - - public Symbol[] parsed(Symbol signature) { - return parsedSignatures.computeIfAbsent(signature, new Function, Symbol[]>() { - @Override - public Symbol[] apply(Symbol key) { - return parse(Signatures.this.getTypes(), signature, 0); - } - }); + return ByteSequence.wrap(bytes); } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java index 8f7eecceb34f..91eda81b2359 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/StaticSymbols.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,50 +22,65 @@ */ package com.oracle.truffle.espresso.classfile.descriptors; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; - /** - * Global symbols for Espresso. - * - *

* To be populated in static initializers, always before the first runtime symbol table is spawned. * + *

* Once the first runtime symbol table is created, this table is frozen and no more symbols can be * added. The frozen symbols are used as seed to create new runtime symbol tables. */ public final class StaticSymbols { - private StaticSymbols() { - /* no instances */ + private boolean frozen = false; + private final Symbols symbols; + + public StaticSymbols(StaticSymbols seed) { + this.symbols = new Symbols(seed.freeze()); } - private static boolean frozen = false; - private static final Symbols symbols = new Symbols(); + public StaticSymbols() { + this.symbols = new Symbols(); + } - public static Symbol putName(String name) { + public Symbol putName(String nameString) { + ErrorUtil.guarantee(!nameString.isEmpty(), "empty name"); + ByteSequence byteSequence = ByteSequence.create(nameString); + Symbol name = symbols.lookup(byteSequence); + if (name != null) { + return name; + } ErrorUtil.guarantee(!isFrozen(), "static symbols are frozen"); - ErrorUtil.guarantee(!name.isEmpty(), "empty name"); - return symbols.symbolify(ByteSequence.create(name)); + return symbols.symbolify(byteSequence); } - public static Symbol putType(String internalName) { + public Symbol putType(String internalName) { + ByteSequence byteSequence = ByteSequence.create(internalName); + ErrorUtil.guarantee(Validation.validTypeDescriptor(byteSequence, true), "invalid type"); + Symbol type = symbols.lookup(byteSequence); + if (type != null) { + return type; + } ErrorUtil.guarantee(!isFrozen(), "static symbols are frozen"); - return symbols.symbolify(ByteSequence.create(Types.checkType(internalName))); + return symbols.symbolify(byteSequence); } @SafeVarargs - public static Symbol putSignature(Symbol returnType, Symbol... parameterTypes) { + public final Symbol putSignature(Symbol returnType, Symbol... parameterTypes) { + ByteSequence signatureBytes = SignatureSymbols.createSignature(returnType, parameterTypes); + ErrorUtil.guarantee(Validation.validSignatureDescriptor(signatureBytes, false), "invalid signature"); + Symbol signature = symbols.lookup(signatureBytes); + if (signature != null) { + return signature; + } ErrorUtil.guarantee(!isFrozen(), "static symbols are frozen"); - return symbols.symbolify(ByteSequence.wrap(Signatures.buildSignatureBytes(returnType, parameterTypes))); + return symbols.symbolify(signatureBytes); } - public static boolean isFrozen() { + public boolean isFrozen() { return frozen; } - public static Symbols freeze() { + public Symbols freeze() { frozen = true; return symbols; } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java index 00331f5bb5b5..fc7b81df66cb 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbol.java @@ -25,58 +25,153 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; /** - * An immutable byte string (modified-UTF8) for internal use in Espresso.
- * Symbols are unique during it's lifetime and can be reference-compared for equality. Internal - * meta-data in Espresso is stored using symbols: names, signatures, type descriptors and constant - * pool (modified-)UTF8 entries. - *

- * Symbols provides several advantages over {@link String} for storing meta-data: + * An immutable byte string (modified-UTF8) representing internal metadata in Espresso. Symbols are + * unique during their lifetime and can be compared for equality using reference comparison (==). + * They are used to store various types of metadata including names, signatures, type descriptors, + * and constant pool entries. + * + *

Key Features

+ *
    + *
  • Guest-Host Separation: Provides clear separation between guest JVM and host JVM + * strings
  • + *
  • Memory Efficiency: Uses a compact byte array representation
  • + *
  • Performance: Enables fast reference equality comparison (==) due to global + * uniqueness
  • + *
  • Deduplication: Automatically handles string deduplication to save memory
  • + *
  • Zero-Cost Type Safety: Uses generic type parameters for compile-time type + * checking
  • + *
  • Copy Optimization: Data is copied only once during symbol creation
  • + *
  • Compilation Benefits: Contents are {@link CompilationFinal} for optimal partial + * evaluation
  • + *
+ * + *

Type Safety Tags

The Symbol class uses generic type parameters for enhanced type safety + * with no runtime overhead: *
    - *
  • Clear separation between guest and host - *
  • Compact representation - *
  • Globally unique + cheap equality comparison - *
  • Seamless de-duplication - *
  • 0-cost tagging for improved type-safety - *
  • Copy-less symbolification, symbols are only copied once, when they are being - * created/persisted - *
  • Contents are effectively {@link CompilationFinal partial-evaluation constant} + *
  • {@code Symbol} - For identifiers (field, class, or method names) + * + *
    + * Example: Symbol<Name> methodName = ...
    + * 
    + * + *
  • + *
  • {@code Symbol} - For constant pool UTF-8 strings + * + *
    + * Example: Symbol<ModifiedUTF8> constString = ...
    + * 
    + * + *
  • + *
  • {@code Symbol} - For type or signature descriptors + * + *
    + * Example: Symbol<? extends Descriptor> desc = ...
    + * 
    + * + *
  • + *
  • {@code Symbol} - For method/field signature descriptors + * + *
    + * Example: Symbol<Signature> methodSignature = ...
    + * 
    + * + *
  • + *
  • {@code Symbol} - For type descriptors in internal form + * + *
    + * Example: Symbol<Type> typeDescriptor = ...
    + * 
    + * + *
  • *
* - * Symbols can be tagged, with no runtime cost, for additional type safety: + *

Usage Example

+ * + *
+ * // Creating a method name symbol
+ * Symbol<Name> methodName = ...;
+ *
+ * // Creating a method signature symbol
+ * Symbol<Signature> signature = ...;
+ *
+ * // Fast equality comparison
+ * if (methodName == otherMethodName) {
+ *     // Symbols are identical
+ * }
+ * 
+ * + *

Important Notes

*
    - *
  • Symbol<{@link Name}> identifiers, field/class/method names. - *
  • Symbol<{@link ModifiedUTF8}> strings from the constant pool. - *
  • Symbol<? extends {@link Descriptor}> valid types or signatures - *
  • Symbol<{@link Signature}> valid signature descriptor in internal form - *
  • Symbol<{@link Type}> valid type descriptor in internal form + *
  • Thread Safety Warning: Do not synchronize on symbols. Class loading operations rely on + * exclusive ownership of symbol monitors, and synchronizing on symbols may cause deadlocks.
  • + *
  • Immutability: Symbols are immutable once created. Any modification attempts will + * result in a new Symbol instance.
  • + *
  • Memory Management: Symbols are managed by the symbol table and should not be created + * directly using constructors.
  • *
* - * Note: Do not synchronize on symbols; class loading relies on exclusive ownership of the - * symbol's monitors, it may cause unexpected dead-locks. + * @param Generic type parameter for compile-time type safety checking. The type parameter + * should be one of: {@link Name}, {@link ModifiedUTF8}, {@link Descriptor}, + * {@link Signature}, or {@link Type}. * - * @param generic tag for improved type-safety + * @see ByteSequence + * @see Name + * @see ModifiedUTF8 + * @see Descriptor + * @see Signature + * @see Type */ public final class Symbol extends ByteSequence { @SuppressWarnings("rawtypes") public static final Symbol[] EMPTY_ARRAY = new Symbol[0]; + /** + * Creates a new Symbol with the specified byte array and pre-computed hash code. + * + * @param bytes The byte array containing the symbol data + * @param hashCode Pre-computed hash code for the symbol + */ Symbol(byte[] bytes, int hashCode) { super(bytes, hashCode); } + /** + * Creates a new Symbol with the specified byte array, computing its hash code. + * + * @param value The byte array containing the symbol data + */ Symbol(byte[] value) { this(value, ByteSequence.hashOfRange(value, 0, value.length)); } + /** + * Returns an empty array of symbols with the specified type parameter. + * + * @param The type parameter for the empty array + * @return An empty array of symbols + */ @SuppressWarnings("unchecked") public static Symbol[] emptyArray() { return EMPTY_ARRAY; } + /** + * Returns a subsequence of this symbol from the specified index to the end. + * + * @param from The starting index (inclusive) + * @return A ByteSequence representing the subsequence + */ ByteSequence substring(int from) { return substring(from, length()); } + /** + * Returns a subsequence of this symbol between the specified indices. + * + * @param from The starting index (inclusive) + * @param to The ending index (exclusive) + * @return A ByteSequence representing the subsequence + */ ByteSequence substring(int from, int to) { assert 0 <= from && from <= to && to <= length(); if (from == 0 && to == length()) { @@ -85,1378 +180,41 @@ ByteSequence substring(int from, int to) { return subSequence(from, to - from); } + /** + * Returns the byte at the specified index in this symbol. + * + * @param index The index of the byte to retrieve + * @return The byte value at the specified index + */ @Override public byte byteAt(int index) { return value[index]; } + /** + * Returns the length of this symbol in bytes. + * + * @return The number of bytes in this symbol + */ @Override public int length() { return value.length; } + /** + * Returns the offset of this symbol's data in its backing array. Always returns 0 as Symbol + * instances use their entire backing array. + * + * @return Always returns 0 + */ @Override - public int offset() { + int offset() { return 0; } + // Included to prevent Truffle complaining about block-listed Object#equals. @Override public boolean equals(Object that) { return this == that; } - - public static class ModifiedUTF8 { - - @SuppressWarnings("unchecked") - public static Symbol fromSymbol(Symbol symbol) { - return (Symbol) symbol; - } - } - - public static class Descriptor extends ModifiedUTF8 { - } - - /** - * Contains commonly used (name) symbols. - * - * Symbols declared here must match exactly the field name; notable exceptions include - * {@link #_init_}, {@link #_clinit_} and hidden field names. - */ - public static final class Name extends ModifiedUTF8 { - public static void ensureInitialized() { - /* nop */ - } - - // java.base - public static final Symbol java_base = StaticSymbols.putName("java.base"); - - // general - public static final Symbol _init_ = StaticSymbols.putName(""); - public static final Symbol _clinit_ = StaticSymbols.putName(""); - - // Boxing and String - public static final Symbol value = StaticSymbols.putName("value"); - public static final Symbol valueOf = StaticSymbols.putName("valueOf"); - public static final Symbol booleanValue = StaticSymbols.putName("booleanValue"); - public static final Symbol byteValue = StaticSymbols.putName("byteValue"); - public static final Symbol shortValue = StaticSymbols.putName("shortValue"); - public static final Symbol intValue = StaticSymbols.putName("intValue"); - public static final Symbol longValue = StaticSymbols.putName("longValue"); - public static final Symbol floatValue = StaticSymbols.putName("floatValue"); - public static final Symbol doubleValue = StaticSymbols.putName("doubleValue"); - - // Field, Thread, Module and MemberName - public static final Symbol name = StaticSymbols.putName("name"); - // Thread and Runnable - public static final Symbol run = StaticSymbols.putName("run"); - // Thread and System - public static final Symbol exit = StaticSymbols.putName("exit"); - // Thread - public static final Symbol getThreadGroup = StaticSymbols.putName("getThreadGroup"); - // Object and arrays - public static final Symbol clone = StaticSymbols.putName("clone"); - public static final Symbol toString = StaticSymbols.putName("toString"); - // variable 'this' name - public static final Symbol thiz = StaticSymbols.putName("this"); - - // finding main - public static final Symbol checkAndLoadMain = StaticSymbols.putName("checkAndLoadMain"); - public static final Symbol main = StaticSymbols.putName("main"); - - // Reflection - public static final Symbol clazz = StaticSymbols.putName("clazz"); - public static final Symbol getParameterTypes = StaticSymbols.putName("getParameterTypes"); - public static final Symbol override = StaticSymbols.putName("override"); - public static final Symbol parameterTypes = StaticSymbols.putName("parameterTypes"); - public static final Symbol root = StaticSymbols.putName("root"); - public static final Symbol signature = StaticSymbols.putName("signature"); - public static final Symbol slot = StaticSymbols.putName("slot"); - public static final Symbol type = StaticSymbols.putName("type"); - public static final Symbol getRawType = StaticSymbols.putName("getRawType"); - public static final Symbol getActualTypeArguments = StaticSymbols.putName("getActualTypeArguments"); - - // java.lang.* - // j.l.AssertionStatusDirectives - public static final Symbol classes = StaticSymbols.putName("classes"); - public static final Symbol classEnabled = StaticSymbols.putName("classEnabled"); - public static final Symbol deflt = StaticSymbols.putName("deflt"); - public static final Symbol packages = StaticSymbols.putName("packages"); - public static final Symbol packageEnabled = StaticSymbols.putName("packageEnabled"); - - // j.l.Class - public static final Symbol checkPackageAccess = StaticSymbols.putName("checkPackageAccess"); - public static final Symbol getName = StaticSymbols.putName("getName"); - public static final Symbol getSimpleName = StaticSymbols.putName("getSimpleName"); - public static final Symbol getTypeName = StaticSymbols.putName("getTypeName"); - public static final Symbol forName = StaticSymbols.putName("forName"); - public static final Symbol module = StaticSymbols.putName("module"); - public static final Symbol classData = StaticSymbols.putName("classData"); - public static final Symbol classLoader = StaticSymbols.putName("classLoader"); - public static final Symbol classRedefinedCount = StaticSymbols.putName("classRedefinedCount"); - public static final Symbol componentType = StaticSymbols.putName("componentType"); - - // j.l.ClassLoader - public static final Symbol addClass = StaticSymbols.putName("addClass"); - public static final Symbol findNative = StaticSymbols.putName("findNative"); - public static final Symbol getSystemClassLoader = StaticSymbols.putName("getSystemClassLoader"); - public static final Symbol loadClass = StaticSymbols.putName("loadClass"); - public static final Symbol getResourceAsStream = StaticSymbols.putName("getResourceAsStream"); - public static final Symbol parent = StaticSymbols.putName("parent"); - public static final Symbol unnamedModule = StaticSymbols.putName("unnamedModule"); - public static final Symbol nameAndId = StaticSymbols.putName("nameAndId"); - public static final Symbol HIDDEN_CLASS_LOADER_REGISTRY = StaticSymbols.putName("0HIDDEN_CLASS_LOADER_REGISTRY"); - - // j.l.Module - public static final Symbol loader = StaticSymbols.putName("loader"); - - // j.l.RecordComponent - public static final Symbol accessor = StaticSymbols.putName("accessor"); - public static final Symbol annotations = StaticSymbols.putName("annotations"); - public static final Symbol typeAnnotations = StaticSymbols.putName("typeAnnotations"); - - // j.l.String - public static final Symbol hash = StaticSymbols.putName("hash"); - public static final Symbol hashCode = StaticSymbols.putName("hashCode"); - public static final Symbol length = StaticSymbols.putName("length"); - public static final Symbol toCharArray = StaticSymbols.putName("toCharArray"); - public static final Symbol charAt = StaticSymbols.putName("charAt"); - public static final Symbol coder = StaticSymbols.putName("coder"); - public static final Symbol COMPACT_STRINGS = StaticSymbols.putName("COMPACT_STRINGS"); - public static final Symbol indexOf = StaticSymbols.putName("indexOf"); - - // j.l.Throwable - public static final Symbol backtrace = StaticSymbols.putName("backtrace"); - public static final Symbol stackTrace = StaticSymbols.putName("stackTrace"); - public static final Symbol cause = StaticSymbols.putName("cause"); - public static final Symbol depth = StaticSymbols.putName("depth"); - public static final Symbol fillInStackTrace = StaticSymbols.putName("fillInStackTrace"); - public static final Symbol fillInStackTrace0 = StaticSymbols.putName("fillInStackTrace0"); - public static final Symbol getMessage = StaticSymbols.putName("getMessage"); - public static final Symbol getCause = StaticSymbols.putName("getCause"); - public static final Symbol detailMessage = StaticSymbols.putName("detailMessage"); - public static final Symbol printStackTrace = StaticSymbols.putName("printStackTrace"); - public static final Symbol extendedMessageState = StaticSymbols.putName("extendedMessageState"); - - // j.l.Thread - public static final Symbol add = StaticSymbols.putName("add"); - public static final Symbol checkAccess = StaticSymbols.putName("checkAccess"); - public static final Symbol daemon = StaticSymbols.putName("daemon"); - public static final Symbol dispatchUncaughtException = StaticSymbols.putName("dispatchUncaughtException"); - public static final Symbol getStackTrace = StaticSymbols.putName("getStackTrace"); - public static final Symbol group = StaticSymbols.putName("group"); - public static final Symbol holder = StaticSymbols.putName("holder"); - public static final Symbol VTHREAD_GROUP = StaticSymbols.putName("VTHREAD_GROUP"); - public static final Symbol inheritedAccessControlContext = StaticSymbols.putName("inheritedAccessControlContext"); - public static final Symbol maxPriority = StaticSymbols.putName("maxPriority"); - public static final Symbol priority = StaticSymbols.putName("priority"); - public static final Symbol remove = StaticSymbols.putName("remove"); - public static final Symbol stop = StaticSymbols.putName("stop"); - public static final Symbol threadStatus = StaticSymbols.putName("threadStatus"); - public static final Symbol toThreadState = StaticSymbols.putName("toThreadState"); - public static final Symbol contextClassLoader = StaticSymbols.putName("contextClassLoader"); - - public static final Symbol EMPTY = StaticSymbols.putName("EMPTY"); - public static final Symbol precision = StaticSymbols.putName("precision"); - - // j.l.StackTraceElement - public static final Symbol declaringClassObject = StaticSymbols.putName("declaringClassObject"); - public static final Symbol classLoaderName = StaticSymbols.putName("classLoaderName"); - public static final Symbol moduleName = StaticSymbols.putName("moduleName"); - public static final Symbol moduleVersion = StaticSymbols.putName("moduleVersion"); - public static final Symbol declaringClass = StaticSymbols.putName("declaringClass"); - public static final Symbol methodName = StaticSymbols.putName("methodName"); - public static final Symbol fileName = StaticSymbols.putName("fileName"); - public static final Symbol lineNumber = StaticSymbols.putName("lineNumber"); - - // j.l.System - public static final Symbol err = StaticSymbols.putName("err"); - public static final Symbol getProperty = StaticSymbols.putName("getProperty"); - public static final Symbol in = StaticSymbols.putName("in"); - public static final Symbol initializeSystemClass = StaticSymbols.putName("initializeSystemClass"); - public static final Symbol initPhase1 = StaticSymbols.putName("initPhase1"); - public static final Symbol initPhase2 = StaticSymbols.putName("initPhase2"); - public static final Symbol initPhase3 = StaticSymbols.putName("initPhase3"); - public static final Symbol out = StaticSymbols.putName("out"); - public static final Symbol security = StaticSymbols.putName("security"); - public static final Symbol setProperty = StaticSymbols.putName("setProperty"); - - // j.l.Shutdown - public static final Symbol shutdown = StaticSymbols.putName("shutdown"); - - // j.l.StackStreamFactory - public static final Symbol doStackWalk = StaticSymbols.putName("doStackWalk"); - public static final Symbol callStackWalk = StaticSymbols.putName("callStackWalk"); - - // j.l.StackFrameInfo - public static final Symbol memberName = StaticSymbols.putName("memberName"); - public static final Symbol bci = StaticSymbols.putName("bci"); - - // java.nio.ByteBuffer - public static final Symbol wrap = StaticSymbols.putName("wrap"); - public static final Symbol order = StaticSymbols.putName("order"); - public static final Symbol isReadOnly = StaticSymbols.putName("isReadOnly"); - public static final Symbol getShort = StaticSymbols.putName("getShort"); - public static final Symbol getInt = StaticSymbols.putName("getInt"); - public static final Symbol getLong = StaticSymbols.putName("getLong"); - public static final Symbol getFloat = StaticSymbols.putName("getFloat"); - public static final Symbol getDouble = StaticSymbols.putName("getDouble"); - public static final Symbol putShort = StaticSymbols.putName("putShort"); - public static final Symbol putInt = StaticSymbols.putName("putInt"); - public static final Symbol putLong = StaticSymbols.putName("putLong"); - public static final Symbol putFloat = StaticSymbols.putName("putFloat"); - public static final Symbol putDouble = StaticSymbols.putName("putDouble"); - - // java.nio.ByteOrder - public static final Symbol LITTLE_ENDIAN = StaticSymbols.putName("LITTLE_ENDIAN"); - - // java.nio.Buffer - public static final Symbol address = StaticSymbols.putName("address"); - public static final Symbol capacity = StaticSymbols.putName("capacity"); - public static final Symbol limit = StaticSymbols.putName("limit"); - public static final Symbol wait = StaticSymbols.putName("wait"); - - // java.io.InputStream - public static final Symbol available = StaticSymbols.putName("available"); - public static final Symbol read = StaticSymbols.putName("read"); - public static final Symbol close = StaticSymbols.putName("close"); - - // java.io.PrintStream - public static final Symbol println = StaticSymbols.putName("println"); - - // java.lang.invoke.* - // CallSite - public static final Symbol target = StaticSymbols.putName("target"); - - // java.lang.Enum - public static final Symbol $VALUES = StaticSymbols.putName("$VALUES"); - public static final Symbol ENUM$VALUES = StaticSymbols.putName("ENUM$VALUES"); - - // LambdaForm - public static final Symbol compileToBytecode = StaticSymbols.putName("compileToBytecode"); - public static final Symbol isCompiled = StaticSymbols.putName("isCompiled"); - public static final Symbol vmentry = StaticSymbols.putName("vmentry"); - public static final Symbol getCallerClass = StaticSymbols.putName("getCallerClass"); - - public static final Symbol createMemoryPool = StaticSymbols.putName("createMemoryPool"); - public static final Symbol createMemoryManager = StaticSymbols.putName("createMemoryManager"); - public static final Symbol createGarbageCollector = StaticSymbols.putName("createGarbageCollector"); - public static final Symbol tid = StaticSymbols.putName("tid"); - public static final Symbol eetop = StaticSymbols.putName("eetop"); - public static final Symbol getFromClass = StaticSymbols.putName("getFromClass"); - - // MemberName - public static final Symbol flags = StaticSymbols.putName("flags"); - public static final Symbol form = StaticSymbols.putName("form"); - - // MethodHandle - public static final Symbol invoke = StaticSymbols.putName("invoke"); - public static final Symbol invokeExact = StaticSymbols.putName("invokeExact"); - public static final Symbol invokeBasic = StaticSymbols.putName("invokeBasic"); - public static final Symbol invokeWithArguments = StaticSymbols.putName("invokeWithArguments"); - public static final Symbol linkToVirtual = StaticSymbols.putName("linkToVirtual"); - public static final Symbol linkToStatic = StaticSymbols.putName("linkToStatic"); - public static final Symbol linkToInterface = StaticSymbols.putName("linkToInterface"); - public static final Symbol linkToSpecial = StaticSymbols.putName("linkToSpecial"); - public static final Symbol linkToNative = StaticSymbols.putName("linkToNative"); - public static final Symbol asFixedArity = StaticSymbols.putName("asFixedArity"); - public static final Symbol member = StaticSymbols.putName("member"); - - // VarHandles - public static final Symbol getStaticFieldFromBaseAndOffset = StaticSymbols.putName("getStaticFieldFromBaseAndOffset"); - - // MethodHandleNatives - public static final Symbol findMethodHandleType = StaticSymbols.putName("findMethodHandleType"); - public static final Symbol linkMethod = StaticSymbols.putName("linkMethod"); - public static final Symbol linkCallSite = StaticSymbols.putName("linkCallSite"); - public static final Symbol linkDynamicConstant = StaticSymbols.putName("linkDynamicConstant"); - public static final Symbol linkMethodHandleConstant = StaticSymbols.putName("linkMethodHandleConstant"); - - // MethodHandles - public static final Symbol lookup = StaticSymbols.putName("lookup"); - - // MethodType - public static final Symbol ptypes = StaticSymbols.putName("ptypes"); - public static final Symbol rtype = StaticSymbols.putName("rtype"); - - // java.lang.invoke.LambdaMetafactory - public static final Symbol metafactory = StaticSymbols.putName("metafactory"); - public static final Symbol altMetafactory = StaticSymbols.putName("altMetafactory"); - - // j.l.ref.Finalizer - public static final Symbol finalize = StaticSymbols.putName("finalize"); - public static final Symbol register = StaticSymbols.putName("register"); - public static final Symbol runFinalizer = StaticSymbols.putName("runFinalizer"); - - // j.l.ref.Reference - public static final Symbol discovered = StaticSymbols.putName("discovered"); - public static final Symbol enqueue = StaticSymbols.putName("enqueue"); - public static final Symbol getFromInactiveFinalReference = StaticSymbols.putName("getFromInactiveFinalReference"); - public static final Symbol clearInactiveFinalReference = StaticSymbols.putName("clearInactiveFinalReference"); - public static final Symbol lock = StaticSymbols.putName("lock"); - public static final Symbol next = StaticSymbols.putName("next"); - public static final Symbol NULL = StaticSymbols.putName("NULL"); - public static final Symbol pending = StaticSymbols.putName("pending"); - public static final Symbol processPendingLock = StaticSymbols.putName("processPendingLock"); - public static final Symbol queue = StaticSymbols.putName("queue"); - public static final Symbol referent = StaticSymbols.putName("referent"); - - // java.util.regex - public static final Symbol parentPattern = StaticSymbols.putName("parentPattern"); - public static final Symbol pattern = StaticSymbols.putName("pattern"); - public static final Symbol flags0 = StaticSymbols.putName("flags0"); - public static final Symbol compiled = StaticSymbols.putName("compiled"); - public static final Symbol namedGroups = StaticSymbols.putName("namedGroups"); - public static final Symbol compile = StaticSymbols.putName("compile"); - public static final Symbol capturingGroupCount = StaticSymbols.putName("capturingGroupCount"); - public static final Symbol groupCount = StaticSymbols.putName("groupCount"); - public static final Symbol match = StaticSymbols.putName("match"); - public static final Symbol search = StaticSymbols.putName("search"); - public static final Symbol modCount = StaticSymbols.putName("modCount"); - public static final Symbol to = StaticSymbols.putName("to"); - public static final Symbol transparentBounds = StaticSymbols.putName("transparentBounds"); - public static final Symbol anchoringBounds = StaticSymbols.putName("anchoringBounds"); - public static final Symbol locals = StaticSymbols.putName("locals"); - public static final Symbol localsPos = StaticSymbols.putName("localsPos"); - public static final Symbol hitEnd = StaticSymbols.putName("hitEnd"); - public static final Symbol requireEnd = StaticSymbols.putName("requireEnd"); - public static final Symbol localTCNCount = StaticSymbols.putName("localTCNCount"); - public static final Symbol localCount = StaticSymbols.putName("localCount"); - public static final Symbol reset = StaticSymbols.putName("reset"); - public static final Symbol groups = StaticSymbols.putName("groups"); - public static final Symbol first = StaticSymbols.putName("first"); - public static final Symbol last = StaticSymbols.putName("last"); - public static final Symbol oldLast = StaticSymbols.putName("oldLast"); - // java.security.ProtectionDomain - public static final Symbol impliesCreateAccessControlContext = StaticSymbols.putName("impliesCreateAccessControlContext"); - - // java.security.AccessControlContext - public static final Symbol context = StaticSymbols.putName("context"); - public static final Symbol isAuthorized = StaticSymbols.putName("isAuthorized"); - public static final Symbol isPrivileged = StaticSymbols.putName("isPrivileged"); - public static final Symbol privilegedContext = StaticSymbols.putName("privilegedContext"); - public static final Symbol doPrivileged = StaticSymbols.putName("doPrivileged"); - public static final Symbol executePrivileged = StaticSymbols.putName("executePrivileged"); - - // jdk.internal.misc.UnsafeConstants - public static final Symbol ADDRESS_SIZE0 = StaticSymbols.putName("ADDRESS_SIZE0"); - public static final Symbol PAGE_SIZE = StaticSymbols.putName("PAGE_SIZE"); - public static final Symbol BIG_ENDIAN = StaticSymbols.putName("BIG_ENDIAN"); - public static final Symbol UNALIGNED_ACCESS = StaticSymbols.putName("UNALIGNED_ACCESS"); - public static final Symbol DATA_CACHE_LINE_FLUSH_SIZE = StaticSymbols.putName("DATA_CACHE_LINE_FLUSH_SIZE"); - - // sun.launcher.LauncherHelper - public static final Symbol printHelpMessage = StaticSymbols.putName("printHelpMessage"); - public static final Symbol ostream = StaticSymbols.putName("ostream"); - - // sun.reflect.ConstantPool - public static final Symbol constantPoolOop = StaticSymbols.putName("constantPoolOop"); - - // sun.misc.SignalHandler - public static final Symbol handle = StaticSymbols.putName("handle"); - public static final Symbol SIG_DFL = StaticSymbols.putName("SIG_DFL"); - public static final Symbol SIG_IGN = StaticSymbols.putName("SIG_IGN"); - // sun.misc.NativeSignalHandler - public static final Symbol handler = StaticSymbols.putName("handler"); - // sun.nio.ch.NativeThread - public static final Symbol isNativeThread = StaticSymbols.putName("isNativeThread"); - public static final Symbol current0 = StaticSymbols.putName("current0"); - public static final Symbol signal = StaticSymbols.putName("signal"); - public static final Symbol init = StaticSymbols.putName("init"); - - // jdk.internal.util.ArraysSupport - public static final Symbol vectorizedMismatch = StaticSymbols.putName("vectorizedMismatch"); - - // Attribute names - public static final Symbol AnnotationDefault = StaticSymbols.putName("AnnotationDefault"); - public static final Symbol BootstrapMethods = StaticSymbols.putName("BootstrapMethods"); - public static final Symbol Code = StaticSymbols.putName("Code"); - public static final Symbol ConstantValue = StaticSymbols.putName("ConstantValue"); - public static final Symbol Deprecated = StaticSymbols.putName("Deprecated"); - public static final Symbol EnclosingMethod = StaticSymbols.putName("EnclosingMethod"); - public static final Symbol Exceptions = StaticSymbols.putName("Exceptions"); - public static final Symbol InnerClasses = StaticSymbols.putName("InnerClasses"); - public static final Symbol LineNumberTable = StaticSymbols.putName("LineNumberTable"); - public static final Symbol LocalVariableTable = StaticSymbols.putName("LocalVariableTable"); - public static final Symbol LocalVariableTypeTable = StaticSymbols.putName("LocalVariableTypeTable"); - public static final Symbol MethodParameters = StaticSymbols.putName("MethodParameters"); - public static final Symbol NestHost = StaticSymbols.putName("NestHost"); - public static final Symbol NestMembers = StaticSymbols.putName("NestMembers"); - public static final Symbol PermittedSubclasses = StaticSymbols.putName("PermittedSubclasses"); - public static final Symbol Record = StaticSymbols.putName("Record"); - public static final Symbol RuntimeVisibleAnnotations = StaticSymbols.putName("RuntimeVisibleAnnotations"); - public static final Symbol RuntimeInvisibleAnnotations = StaticSymbols.putName("RuntimeInvisibleAnnotations"); - public static final Symbol RuntimeVisibleTypeAnnotations = StaticSymbols.putName("RuntimeVisibleTypeAnnotations"); - public static final Symbol RuntimeInvisibleTypeAnnotations = StaticSymbols.putName("RuntimeInvisibleTypeAnnotations"); - public static final Symbol RuntimeVisibleParameterAnnotations = StaticSymbols.putName("RuntimeVisibleParameterAnnotations"); - public static final Symbol RuntimeInvisibleParameterAnnotations = StaticSymbols.putName("RuntimeInvisibleParameterAnnotations"); - public static final Symbol Signature = StaticSymbols.putName("Signature"); - public static final Symbol SourceFile = StaticSymbols.putName("SourceFile"); - public static final Symbol SourceDebugExtension = StaticSymbols.putName("SourceDebugExtension"); - public static final Symbol StackMapTable = StaticSymbols.putName("StackMapTable"); - public static final Symbol Synthetic = StaticSymbols.putName("Synthetic"); - - // Interop conversions - public static final Symbol seconds = StaticSymbols.putName("seconds"); - public static final Symbol nanos = StaticSymbols.putName("nanos"); - public static final Symbol year = StaticSymbols.putName("year"); - public static final Symbol month = StaticSymbols.putName("month"); - public static final Symbol day = StaticSymbols.putName("day"); - public static final Symbol toLocalDate = StaticSymbols.putName("toLocalDate"); - public static final Symbol toLocalTime = StaticSymbols.putName("toLocalTime"); - public static final Symbol toInstant = StaticSymbols.putName("toInstant"); - public static final Symbol from = StaticSymbols.putName("from"); - public static final Symbol ofInstant = StaticSymbols.putName("ofInstant"); - public static final Symbol getZone = StaticSymbols.putName("getZone"); - public static final Symbol getId = StaticSymbols.putName("getId"); - public static final Symbol of = StaticSymbols.putName("of"); - public static final Symbol compose = StaticSymbols.putName("compose"); - public static final Symbol toByteArray = StaticSymbols.putName("toByteArray"); - - public static final Symbol hour = StaticSymbols.putName("hour"); - public static final Symbol minute = StaticSymbols.putName("minute"); - public static final Symbol second = StaticSymbols.putName("second"); - public static final Symbol nano = StaticSymbols.putName("nano"); - public static final Symbol atZone = StaticSymbols.putName("atZone"); - public static final Symbol ofEpochSecond = StaticSymbols.putName("ofEpochSecond"); - - // Map / List / Iterator - public static final Symbol get = StaticSymbols.putName("get"); - public static final Symbol set = StaticSymbols.putName("set"); - public static final Symbol iterator = StaticSymbols.putName("iterator"); - public static final Symbol put = StaticSymbols.putName("put"); - public static final Symbol size = StaticSymbols.putName("size"); - public static final Symbol containsKey = StaticSymbols.putName("containsKey"); - public static final Symbol getKey = StaticSymbols.putName("getKey"); - public static final Symbol getValue = StaticSymbols.putName("getValue"); - public static final Symbol setValue = StaticSymbols.putName("setValue"); - public static final Symbol entrySet = StaticSymbols.putName("entrySet"); - public static final Symbol hasNext = StaticSymbols.putName("hasNext"); - public static final Symbol toArray = StaticSymbols.putName("toArray"); - - // Hidden field names. Starts with a 0 in order for the names to be illegal identifiers. - - // MemberName - public static final Symbol HIDDEN_VMINDEX = StaticSymbols.putName("0HIDDEN_VMINDEX"); - public static final Symbol HIDDEN_VMTARGET = StaticSymbols.putName("0HIDDEN_VMTARGET"); - - // Method - public static final Symbol HIDDEN_METHOD_KEY = StaticSymbols.putName("0HIDDEN_METHOD_KEY"); - public static final Symbol HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = StaticSymbols.putName("0HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); - - // Constructor - public static final Symbol HIDDEN_CONSTRUCTOR_KEY = StaticSymbols.putName("0HIDDEN_CONSTRUCTOR_KEY"); - public static final Symbol HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = StaticSymbols.putName("0HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); - - // Field - public static final Symbol HIDDEN_FIELD_KEY = StaticSymbols.putName("0HIDDEN_FIELD_KEY"); - public static final Symbol HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = StaticSymbols.putName("0HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); - - // Throwable - public static final Symbol HIDDEN_FRAMES = StaticSymbols.putName("0HIDDEN_FRAMES"); - public static final Symbol HIDDEN_EXCEPTION_WRAPPER = StaticSymbols.putName("0HIDDEN_EXCEPTION_WRAPPER"); - - // Thread - public static final Symbol interrupted = StaticSymbols.putName("interrupted"); - public static final Symbol interrupt = StaticSymbols.putName("interrupt"); - public static final Symbol HIDDEN_DEPRECATION_SUPPORT = StaticSymbols.putName("0HIDDEN_DEPRECATION_SUPPORT"); - public static final Symbol HIDDEN_THREAD_UNPARK_SIGNALS = StaticSymbols.putName("0HIDDEN_THREAD_UNPARK_SIGNALS"); - public static final Symbol HIDDEN_THREAD_PARK_LOCK = StaticSymbols.putName("0HIDDEN_THREAD_PARK_LOCK"); - public static final Symbol HIDDEN_HOST_THREAD = StaticSymbols.putName("0HIDDEN_HOST_THREAD"); - public static final Symbol HIDDEN_ESPRESSO_MANAGED = StaticSymbols.putName("0HIDDEN_ESPRESSO_MANAGED"); - public static final Symbol HIDDEN_INTERRUPTED = StaticSymbols.putName("0HIDDEN_INTERRUPTED"); - public static final Symbol HIDDEN_THREAD_PENDING_MONITOR = StaticSymbols.putName("0HIDDEN_THREAD_PENDING_MONITOR"); - public static final Symbol HIDDEN_THREAD_WAITING_MONITOR = StaticSymbols.putName("0HIDDEN_THREAD_WAITING_MONITOR"); - public static final Symbol HIDDEN_THREAD_BLOCKED_COUNT = StaticSymbols.putName("0HIDDEN_THREAD_BLOCKED_COUNT"); - public static final Symbol HIDDEN_THREAD_WAITED_COUNT = StaticSymbols.putName("0HIDDEN_THREAD_WAITED_COUNT"); - public static final Symbol HIDDEN_THREAD_DEPTH_FIRST_NUMBER = StaticSymbols.putName("0HIDDEN_THREAD_DEPTH_FIRST_NUMBER"); - public static final Symbol HIDDEN_THREAD_SCOPED_VALUE_CACHE = StaticSymbols.putName("0HIDDEN_THREAD_SCOPED_VALUE_CACHE"); - - // Class - public static final Symbol HIDDEN_MIRROR_KLASS = StaticSymbols.putName("0HIDDEN_MIRROR_KLASS"); - public static final Symbol HIDDEN_SIGNERS = StaticSymbols.putName("0HIDDEN_SIGNERS"); - public static final Symbol HIDDEN_PROTECTION_DOMAIN = StaticSymbols.putName("0HIDDEN_PROTECTION_DOMAIN"); - - // Module - public static final Symbol HIDDEN_MODULE_ENTRY = StaticSymbols.putName("0HIDDEN_MODULE_ENTRY"); - - // Pattern - public static final Symbol HIDDEN_TREGEX_MATCH = StaticSymbols.putName("0HIDDEN_TREGEX_MATCH"); - public static final Symbol HIDDEN_TREGEX_FULLMATCH = StaticSymbols.putName("0HIDDEN_TREGEX_FULLMATCH"); - public static final Symbol HIDDEN_TREGEX_SEARCH = StaticSymbols.putName("0HIDDEN_TREGEX_SEARCH"); - public static final Symbol HIDDEN_TREGEX_UNSUPPORTED = StaticSymbols.putName("0HIDDEN_TREGEX_UNSUPPORTED"); - - // Matcher - public static final Symbol HIDDEN_TREGEX_TSTRING = StaticSymbols.putName("0HIDDEN_TREGEX_TSTRING"); - public static final Symbol HIDDEN_TREGEX_OLD_LAST_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_OLD_LAST_BACKUP"); - public static final Symbol HIDDEN_TREGEX_MOD_COUNT_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_MOD_COUNT_BACKUP"); - public static final Symbol HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP"); - public static final Symbol HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP"); - public static final Symbol HIDDEN_TREGEX_FROM_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_FROM_BACKUP"); - public static final Symbol HIDDEN_TREGEX_TO_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_TO_BACKUP"); - public static final Symbol HIDDEN_TREGEX_MATCHING_MODE_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_MATCHING_MODE_BACKUP"); - public static final Symbol HIDDEN_TREGEX_SEARCH_FROM_BACKUP = StaticSymbols.putName("0HIDDEN_TREGEX_SEARCH_FROM_BACKUP"); - - // Reference - public static final Symbol processPendingReferences = StaticSymbols.putName("processPendingReferences"); - public static final Symbol tryHandlePending = StaticSymbols.putName("tryHandlePending"); - public static final Symbol poll = StaticSymbols.putName("poll"); - public static final Symbol HIDDEN_HOST_REFERENCE = StaticSymbols.putName("0HIDDEN_HOST_REFERENCE"); - - // Secrets - public static final Symbol javaLangAccess = StaticSymbols.putName("javaLangAccess"); - - // Polyglot ExceptionType - public static final Symbol EXIT = StaticSymbols.putName("EXIT"); - public static final Symbol INTERRUPT = StaticSymbols.putName("INTERRUPT"); - public static final Symbol RUNTIME_ERROR = StaticSymbols.putName("RUNTIME_ERROR"); - public static final Symbol PARSE_ERROR = StaticSymbols.putName("PARSE_ERROR"); - public static final Symbol create = StaticSymbols.putName("create"); - public static final Symbol toGuest = StaticSymbols.putName("toGuest"); - - // Interop VM helpers - public static final Symbol getDynamicModuleDescriptor = StaticSymbols.putName("getDynamicModuleDescriptor"); - public static final Symbol getEspressoType = StaticSymbols.putName("getEspressoType"); - public static final Symbol HIDDEN_INTERNAL_TYPE = StaticSymbols.putName("0HIDDEN_INTERNAL_TYPE"); - public static final Symbol rawType = StaticSymbols.putName("rawType"); - - public static final Symbol espresso_polyglot = StaticSymbols.putName("espresso.polyglot"); - - // Class redefinition plugin helpers - public static final Symbol flushFromCaches = StaticSymbols.putName("flushFromCaches"); - public static final Symbol generateProxyClass = StaticSymbols.putName("generateProxyClass"); - public static final Symbol removeBeanInfo = StaticSymbols.putName("removeBeanInfo"); - - public static final Symbol platformClassLoader = StaticSymbols.putName("platformClassLoader"); - public static final Symbol bootModules = StaticSymbols.putName("bootModules"); - public static final Symbol platformModules = StaticSymbols.putName("platformModules"); - public static final Symbol descriptor = StaticSymbols.putName("descriptor"); - public static final Symbol ofSystem = StaticSymbols.putName("ofSystem"); - public static final Symbol defineModule = StaticSymbols.putName("defineModule"); - - // Continuations - public static final Symbol suspend = StaticSymbols.putName("suspend"); - public static final Symbol stackFrameHead = StaticSymbols.putName("stackFrameHead"); - public static final Symbol HIDDEN_CONTINUATION_FRAME_RECORD = StaticSymbols.putName("0HIDDEN_CONTINUATION_FRAME_RECORD"); - public static final Symbol pointers = StaticSymbols.putName("pointers"); - public static final Symbol primitives = StaticSymbols.putName("primitives"); - public static final Symbol method = StaticSymbols.putName("method"); - - // JVMCI - public static final Symbol runtime = StaticSymbols.putName("runtime"); - public static final Symbol forBasicType = StaticSymbols.putName("forBasicType"); - public static final Symbol openJVMCITo = StaticSymbols.putName("openJVMCITo"); - public static final Symbol NULL_POINTER = StaticSymbols.putName("NULL_POINTER"); - public static final Symbol ILLEGAL = StaticSymbols.putName("ILLEGAL"); - public static final Symbol forInt = StaticSymbols.putName("forInt"); - public static final Symbol forLong = StaticSymbols.putName("forLong"); - public static final Symbol forFloat = StaticSymbols.putName("forFloat"); - public static final Symbol forDouble = StaticSymbols.putName("forDouble"); - public static final Symbol forPrimitive = StaticSymbols.putName("forPrimitive"); - public static final Symbol code = StaticSymbols.putName("code"); - public static final Symbol INVOKE_BASIC = StaticSymbols.putName("INVOKE_BASIC"); - public static final Symbol LINK_TO_VIRTUAL = StaticSymbols.putName("LINK_TO_VIRTUAL"); - public static final Symbol LINK_TO_STATIC = StaticSymbols.putName("LINK_TO_STATIC"); - public static final Symbol LINK_TO_SPECIAL = StaticSymbols.putName("LINK_TO_SPECIAL"); - public static final Symbol LINK_TO_INTERFACE = StaticSymbols.putName("LINK_TO_INTERFACE"); - public static final Symbol LINK_TO_NATIVE = StaticSymbols.putName("LINK_TO_NATIVE"); - public static final Symbol HIDDEN_OBJECTKLASS_MIRROR = StaticSymbols.putName("0HIDDEN_KLASS_MIRROR"); - public static final Symbol HIDDEN_JVMCIINDY = StaticSymbols.putName("0HIDDEN_JVMCIINDY"); - public static final Symbol HIDDEN_FIELD_MIRROR = StaticSymbols.putName("0HIDDEN_FIELD_MIRROR"); - public static final Symbol HIDDEN_METHOD_MIRROR = StaticSymbols.putName("0HIDDEN_METHOD_MIRROR"); - public static final Symbol HIDDEN_OBJECT_CONSTANT = StaticSymbols.putName("0HIDDEN_OBJECT_CONSTANT"); - - // Panama - public static final Symbol segmentMaskOrSize = StaticSymbols.putName("segmentMaskOrSize"); - public static final Symbol indexOrOffset = StaticSymbols.putName("indexOrOffset"); - public static final Symbol downcallStubAddress = StaticSymbols.putName("downcallStubAddress"); - public static final Symbol argRegs = StaticSymbols.putName("argRegs"); - public static final Symbol retRegs = StaticSymbols.putName("retRegs"); - - public static final Symbol exclusiveOwnerThread = StaticSymbols.putName("exclusiveOwnerThread"); - } - - /** - * Contains commonly used (type) symbols. - * - *

- * Naming convention: Use the fully qualified type name, '_' as package separator and '$' as - * separator for inner classes.
- * - {@link #_long}
- * - {@link #java_lang_Object}
- * - {@link #java_lang_String_array}
- * - {@link #java_lang_ref_Finalizer$FinalizerThread}
- */ - public static final class Type extends Descriptor { - - public static void ensureInitialized() { - /* nop */ - } - - // Core types. - public static final Symbol java_lang_String = StaticSymbols.putType("Ljava/lang/String;"); - public static final Symbol java_lang_String_array = StaticSymbols.putType("[Ljava/lang/String;"); - public static final Symbol java_lang_CharSequence = StaticSymbols.putType("Ljava/lang/CharSequence;"); - - public static final Symbol java_lang_Object = StaticSymbols.putType("Ljava/lang/Object;"); - public static final Symbol java_lang_Object_array = StaticSymbols.putType("[Ljava/lang/Object;"); - - public static final Symbol java_lang_Class = StaticSymbols.putType("Ljava/lang/Class;"); - public static final Symbol java_lang_Class_array = StaticSymbols.putType("[Ljava/lang/Class;"); - - public static final Symbol java_lang_Enum = StaticSymbols.putType("Ljava/lang/Enum;"); - - public static final Symbol java_lang_Throwable = StaticSymbols.putType("Ljava/lang/Throwable;"); - public static final Symbol java_lang_Exception = StaticSymbols.putType("Ljava/lang/Exception;"); - public static final Symbol java_lang_System = StaticSymbols.putType("Ljava/lang/System;"); - public static final Symbol java_security_ProtectionDomain = StaticSymbols.putType("Ljava/security/ProtectionDomain;"); - public static final Symbol java_security_ProtectionDomain_array = StaticSymbols.putType("[Ljava/security/ProtectionDomain;"); - public static final Symbol java_security_AccessControlContext = StaticSymbols.putType("Ljava/security/AccessControlContext;"); - public static final Symbol java_security_AccessController = StaticSymbols.putType("Ljava/security/AccessController;"); - public static final Symbol java_lang_SecurityManager = StaticSymbols.putType("Ljava/lang/SecurityManager;"); - public static final Symbol java_security_CodeSource = StaticSymbols.putType("Ljava/security/CodeSource;"); - public static final Symbol java_security_PermissionCollection = StaticSymbols.putType("Ljava/security/PermissionCollection;"); - - public static final Symbol java_lang_ClassLoader = StaticSymbols.putType("Ljava/lang/ClassLoader;"); - public static final Symbol java_lang_ClassLoader$NativeLibrary = StaticSymbols.putType("Ljava/lang/ClassLoader$NativeLibrary;"); - public static final Symbol jdk_internal_loader_NativeLibraries = StaticSymbols.putType("Ljdk/internal/loader/NativeLibraries;"); - public static final Symbol sun_misc_Launcher$ExtClassLoader = StaticSymbols.putType("Lsun/misc/Launcher$ExtClassLoader;"); - public static final Symbol jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl = StaticSymbols.putType("Ljdk/internal/loader/RawNativeLibraries$RawNativeLibraryImpl;"); - public static final Symbol jdk_internal_util_ArraysSupport = StaticSymbols.putType("Ljdk/internal/util/ArraysSupport;"); - public static final Symbol java_io_InputStream = StaticSymbols.putType("Ljava/io/InputStream;"); - public static final Symbol java_io_PrintStream = StaticSymbols.putType("Ljava/io/PrintStream;"); - public static final Symbol java_nio_file_Path = StaticSymbols.putType("Ljava/nio/file/Path;"); - public static final Symbol java_nio_file_Path_array = StaticSymbols.putType("[Ljava/nio/file/Path;"); - public static final Symbol java_nio_file_Paths = StaticSymbols.putType("Ljava/nio/file/Paths;"); - public static final Symbol sun_nio_ch_NativeThread = StaticSymbols.putType("Lsun/nio/ch/NativeThread;"); - - public static final Symbol jdk_internal_loader_ClassLoaders = StaticSymbols.putType("Ljdk/internal/loader/ClassLoaders;"); - public static final Symbol jdk_internal_loader_ClassLoaders$PlatformClassLoader = StaticSymbols.putType("Ljdk/internal/loader/ClassLoaders$PlatformClassLoader;"); - public static final Symbol jdk_internal_loader_ClassLoaders$AppClassLoader = StaticSymbols.putType("Ljdk/internal/loader/ClassLoaders$AppClassLoader;"); - public static final Symbol sun_misc_Launcher$AppClassLoader = StaticSymbols.putType("Lsun/misc/Launcher$AppClassLoader;"); - public static final Symbol jdk_internal_module_ModuleLoaderMap = StaticSymbols.putType("Ljdk/internal/module/ModuleLoaderMap;"); - public static final Symbol jdk_internal_module_ModuleLoaderMap_Modules = StaticSymbols.putType("Ljdk/internal/module/ModuleLoaderMap$Modules;"); - public static final Symbol jdk_internal_module_SystemModuleFinders = StaticSymbols.putType("Ljdk/internal/module/SystemModuleFinders;"); - public static final Symbol jdk_internal_module_SystemModules = StaticSymbols.putType("Ljdk/internal/module/SystemModules;"); - public static final Symbol java_lang_module_ModuleFinder = StaticSymbols.putType("Ljava/lang/module/ModuleFinder;"); - public static final Symbol java_lang_module_ModuleFinder_array = StaticSymbols.putType("[Ljava/lang/module/ModuleFinder;"); - public static final Symbol jdk_internal_module_ModulePath = StaticSymbols.putType("Ljdk/internal/module/ModulePath;"); - public static final Symbol jdk_internal_module_Modules = StaticSymbols.putType("Ljdk/internal/module/Modules;"); - public static final Symbol java_lang_module_ModuleDescriptor = StaticSymbols.putType("Ljava/lang/module/ModuleDescriptor;"); - - // URL class loader - public static final Symbol java_net_URLClassLoader = StaticSymbols.putType("Ljava/net/URLClassLoader;"); - public static final Symbol java_net_URL = StaticSymbols.putType("Ljava/net/URL;"); - public static final Symbol java_net_URI = StaticSymbols.putType("Ljava/net/URI;"); - public static final Symbol java_net_URL_array = StaticSymbols.putType("[Ljava/net/URL;"); - - public static final Symbol java_beans_Introspector = StaticSymbols.putType("Ljava/beans/Introspector;"); - public static final Symbol java_beans_ThreadGroupContext = StaticSymbols.putType("Ljava/beans/ThreadGroupContext;"); - - public static final Symbol java_lang_reflect_Proxy = StaticSymbols.putType("Ljava/lang/reflect/Proxy;"); - public static final Symbol java_lang_reflect_ProxyGenerator = StaticSymbols.putType("Ljava/lang/reflect/ProxyGenerator;"); - public static final Symbol sun_misc_ProxyGenerator = StaticSymbols.putType("Lsun/misc/ProxyGenerator;"); - - // Primitive types. - public static final Symbol _boolean = StaticSymbols.putType("Z" /* boolean */); - public static final Symbol _byte = StaticSymbols.putType("B" /* byte */); - public static final Symbol _char = StaticSymbols.putType("C" /* char */); - public static final Symbol _short = StaticSymbols.putType("S" /* short */); - public static final Symbol _int = StaticSymbols.putType("I" /* int */); - public static final Symbol _float = StaticSymbols.putType("F" /* float */); - public static final Symbol _double = StaticSymbols.putType("D" /* double */); - public static final Symbol _long = StaticSymbols.putType("J" /* long */); - public static final Symbol _void = StaticSymbols.putType("V" /* void */); - - public static final Symbol _boolean_array = StaticSymbols.putType("[Z" /* boolean[] */); - public static final Symbol _byte_array = StaticSymbols.putType("[B" /* byte[] */); - public static final Symbol _char_array = StaticSymbols.putType("[C" /* char[] */); - public static final Symbol _short_array = StaticSymbols.putType("[S" /* short[] */); - public static final Symbol _int_array = StaticSymbols.putType("[I" /* int[] */); - public static final Symbol _float_array = StaticSymbols.putType("[F" /* float[] */); - public static final Symbol _double_array = StaticSymbols.putType("[D" /* double[] */); - public static final Symbol _long_array = StaticSymbols.putType("[J" /* long[] */); - - // Boxed types. - public static final Symbol java_lang_Boolean = StaticSymbols.putType("Ljava/lang/Boolean;"); - public static final Symbol java_lang_Byte = StaticSymbols.putType("Ljava/lang/Byte;"); - public static final Symbol java_lang_Character = StaticSymbols.putType("Ljava/lang/Character;"); - public static final Symbol java_lang_Short = StaticSymbols.putType("Ljava/lang/Short;"); - public static final Symbol java_lang_Integer = StaticSymbols.putType("Ljava/lang/Integer;"); - public static final Symbol java_lang_Float = StaticSymbols.putType("Ljava/lang/Float;"); - public static final Symbol java_lang_Double = StaticSymbols.putType("Ljava/lang/Double;"); - public static final Symbol java_lang_Long = StaticSymbols.putType("Ljava/lang/Long;"); - public static final Symbol java_lang_Void = StaticSymbols.putType("Ljava/lang/Void;"); - public static final Symbol java_lang_Number = StaticSymbols.putType("Ljava/lang/Number;"); - - public static final Symbol java_lang_Cloneable = StaticSymbols.putType("Ljava/lang/Cloneable;"); - - public static final Symbol java_lang_StackOverflowError = StaticSymbols.putType("Ljava/lang/StackOverflowError;"); - public static final Symbol java_lang_VirtualMachineError = StaticSymbols.putType("Ljava/lang/VirtualMachineError;"); - public static final Symbol java_lang_OutOfMemoryError = StaticSymbols.putType("Ljava/lang/OutOfMemoryError;"); - public static final Symbol java_lang_AssertionError = StaticSymbols.putType("Ljava/lang/AssertionError;"); - - public static final Symbol java_lang_NullPointerException = StaticSymbols.putType("Ljava/lang/NullPointerException;"); - public static final Symbol java_lang_ClassCastException = StaticSymbols.putType("Ljava/lang/ClassCastException;"); - public static final Symbol java_lang_ArrayStoreException = StaticSymbols.putType("Ljava/lang/ArrayStoreException;"); - public static final Symbol java_lang_ArithmeticException = StaticSymbols.putType("Ljava/lang/ArithmeticException;"); - public static final Symbol java_lang_IllegalMonitorStateException = StaticSymbols.putType("Ljava/lang/IllegalMonitorStateException;"); - public static final Symbol java_lang_IllegalArgumentException = StaticSymbols.putType("Ljava/lang/IllegalArgumentException;"); - public static final Symbol java_lang_IllegalStateException = StaticSymbols.putType("Ljava/lang/IllegalStateException;"); - public static final Symbol java_lang_ClassNotFoundException = StaticSymbols.putType("Ljava/lang/ClassNotFoundException;"); - public static final Symbol java_lang_NoClassDefFoundError = StaticSymbols.putType("Ljava/lang/NoClassDefFoundError;"); - public static final Symbol java_lang_InterruptedException = StaticSymbols.putType("Ljava/lang/InterruptedException;"); - public static final Symbol java_lang_ThreadDeath = StaticSymbols.putType("Ljava/lang/ThreadDeath;"); - public static final Symbol java_lang_NegativeArraySizeException = StaticSymbols.putType("Ljava/lang/NegativeArraySizeException;"); - public static final Symbol java_lang_RuntimeException = StaticSymbols.putType("Ljava/lang/RuntimeException;"); - public static final Symbol java_lang_IndexOutOfBoundsException = StaticSymbols.putType("Ljava/lang/IndexOutOfBoundsException;"); - public static final Symbol java_lang_ArrayIndexOutOfBoundsException = StaticSymbols.putType("Ljava/lang/ArrayIndexOutOfBoundsException;"); - public static final Symbol java_lang_StringIndexOutOfBoundsException = StaticSymbols.putType("Ljava/lang/StringIndexOutOfBoundsException;"); - public static final Symbol java_lang_ExceptionInInitializerError = StaticSymbols.putType("Ljava/lang/ExceptionInInitializerError;"); - public static final Symbol java_lang_InstantiationException = StaticSymbols.putType("Ljava/lang/InstantiationException;"); - public static final Symbol java_lang_InstantiationError = StaticSymbols.putType("Ljava/lang/InstantiationError;"); - public static final Symbol java_lang_CloneNotSupportedException = StaticSymbols.putType("Ljava/lang/CloneNotSupportedException;"); - public static final Symbol java_lang_SecurityException = StaticSymbols.putType("Ljava/lang/SecurityException;"); - public static final Symbol java_lang_LinkageError = StaticSymbols.putType("Ljava/lang/LinkageError;"); - public static final Symbol java_lang_BootstrapMethodError = StaticSymbols.putType("Ljava/lang/BootstrapMethodError;"); - public static final Symbol java_lang_NoSuchFieldException = StaticSymbols.putType("Ljava/lang/NoSuchFieldException;"); - public static final Symbol java_lang_NoSuchMethodException = StaticSymbols.putType("Ljava/lang/NoSuchMethodException;"); - public static final Symbol java_lang_UnsupportedOperationException = StaticSymbols.putType("Ljava/lang/UnsupportedOperationException;"); - public static final Symbol java_lang_UnsupportedClassVersionError = StaticSymbols.putType("Ljava/lang/UnsupportedClassVersionError;"); - public static final Symbol java_lang_reflect_InvocationTargetException = StaticSymbols.putType("Ljava/lang/reflect/InvocationTargetException;"); - public static final Symbol java_lang_NumberFormatException = StaticSymbols.putType("Ljava/lang/NumberFormatException;"); - - public static final Symbol java_lang_reflect_Type = StaticSymbols.putType("Ljava/lang/reflect/Type;"); - public static final Symbol java_lang_reflect_Type_array = StaticSymbols.putType("[Ljava/lang/reflect/Type;"); - public static final Symbol java_lang_reflect_ParameterizedType = StaticSymbols.putType("Ljava/lang/reflect/ParameterizedType;"); - - public static final Symbol java_lang_Thread = StaticSymbols.putType("Ljava/lang/Thread;"); - public static final Symbol java_lang_Thread_FieldHolder = StaticSymbols.putType("Ljava/lang/Thread$FieldHolder;"); - public static final Symbol java_lang_Thread_Constants = StaticSymbols.putType("Ljava/lang/Thread$Constants;"); - public static final Symbol java_lang_ThreadGroup = StaticSymbols.putType("Ljava/lang/ThreadGroup;"); - public static final Symbol java_lang_BaseVirtualThread = StaticSymbols.putType("Ljava/lang/BaseVirtualThread;"); - - public static final Symbol java_lang_Runnable = StaticSymbols.putType("Ljava/lang/Runnable;"); - - public static final Symbol sun_misc_VM = StaticSymbols.putType("Lsun/misc/VM;"); - public static final Symbol jdk_internal_misc_VM = StaticSymbols.putType("Ljdk/internal/misc/VM;"); - public static final Symbol java_lang_Thread$State = StaticSymbols.putType("Ljava/lang/Thread$State;"); - public static final Symbol jdk_internal_vm_ContinuationScope = StaticSymbols.putType("Ljdk/internal/vm/ContinuationScope;"); - public static final Symbol jdk_internal_vm_Continuation = StaticSymbols.putType("Ljdk/internal/vm/Continuation;"); - - public static final Symbol sun_misc_Signal = StaticSymbols.putType("Lsun/misc/Signal;"); - public static final Symbol jdk_internal_misc_Signal = StaticSymbols.putType("Ljdk/internal/misc/Signal;"); - public static final Symbol sun_misc_NativeSignalHandler = StaticSymbols.putType("Lsun/misc/NativeSignalHandler;"); - public static final Symbol jdk_internal_misc_Signal$NativeHandler = StaticSymbols.putType("Ljdk/internal/misc/Signal$NativeHandler;"); - public static final Symbol sun_misc_SignalHandler = StaticSymbols.putType("Lsun/misc/SignalHandler;"); - public static final Symbol jdk_internal_misc_Signal$Handler = StaticSymbols.putType("Ljdk/internal/misc/Signal$Handler;"); - - public static final Symbol sun_nio_ch_DirectBuffer = StaticSymbols.putType("Lsun/nio/ch/DirectBuffer;"); - public static final Symbol java_nio_Buffer = StaticSymbols.putType("Ljava/nio/Buffer;"); - - // Guest reflection. - public static final Symbol java_lang_reflect_Field = StaticSymbols.putType("Ljava/lang/reflect/Field;"); - public static final Symbol java_lang_reflect_Method = StaticSymbols.putType("Ljava/lang/reflect/Method;"); - public static final Symbol java_lang_reflect_Constructor = StaticSymbols.putType("Ljava/lang/reflect/Constructor;"); - public static final Symbol java_lang_reflect_Parameter = StaticSymbols.putType("Ljava/lang/reflect/Parameter;"); - public static final Symbol java_lang_reflect_Executable = StaticSymbols.putType("Ljava/lang/reflect/Executable;"); - public static final Symbol sun_reflect_Reflection = StaticSymbols.putType("Lsun/reflect/Reflection;"); - public static final Symbol jdk_internal_reflect_Reflection = StaticSymbols.putType("Ljdk/internal/reflect/Reflection;"); - - // MagicAccessorImpl is not public. - public static final Symbol sun_reflect_MagicAccessorImpl = StaticSymbols.putType("Lsun/reflect/MagicAccessorImpl;"); - public static final Symbol jdk_internal_reflect_MagicAccessorImpl = StaticSymbols.putType("Ljdk/internal/reflect/MagicAccessorImpl;"); - // DelegatingClassLoader is not public. - public static final Symbol sun_reflect_DelegatingClassLoader = StaticSymbols.putType("Lsun/reflect/DelegatingClassLoader;"); - public static final Symbol jdk_internal_reflect_DelegatingClassLoader = StaticSymbols.putType("Ljdk/internal/reflect/DelegatingClassLoader;"); - - // MethodAccessorImpl is not public. - public static final Symbol sun_reflect_MethodAccessorImpl = StaticSymbols.putType("Lsun/reflect/MethodAccessorImpl;"); - public static final Symbol jdk_internal_reflect_MethodAccessorImpl = StaticSymbols.putType("Ljdk/internal/reflect/MethodAccessorImpl;"); - public static final Symbol sun_reflect_ConstructorAccessorImpl = StaticSymbols.putType("Lsun/reflect/ConstructorAccessorImpl;"); - public static final Symbol jdk_internal_reflect_ConstructorAccessorImpl = StaticSymbols.putType("Ljdk/internal/reflect/ConstructorAccessorImpl;"); - public static final Symbol jdk_internal_reflect_NativeConstructorAccessorImpl = StaticSymbols.putType("Ljdk/internal/reflect/NativeConstructorAccessorImpl;"); - - public static final Symbol sun_reflect_ConstantPool = StaticSymbols.putType("Lsun/reflect/ConstantPool;"); - public static final Symbol jdk_internal_reflect_ConstantPool = StaticSymbols.putType("Ljdk/internal/reflect/ConstantPool;"); - - public static final Symbol java_io_Serializable = StaticSymbols.putType("Ljava/io/Serializable;"); - public static final Symbol java_nio_ByteBuffer = StaticSymbols.putType("Ljava/nio/ByteBuffer;"); - public static final Symbol java_nio_DirectByteBuffer = StaticSymbols.putType("Ljava/nio/DirectByteBuffer;"); - public static final Symbol java_nio_ByteOrder = StaticSymbols.putType("Ljava/nio/ByteOrder;"); - - public static final Symbol java_security_PrivilegedActionException = StaticSymbols.putType("Ljava/security/PrivilegedActionException;"); - - // Shutdown is not public. - public static final Symbol java_lang_Shutdown = StaticSymbols.putType("Ljava/lang/Shutdown;"); - - public static final Symbol sun_launcher_LauncherHelper = StaticSymbols.putType("Lsun/launcher/LauncherHelper;"); - - // Finalizer is not public. - public static final Symbol java_lang_ref_Finalizer = StaticSymbols.putType("Ljava/lang/ref/Finalizer;"); - public static final Symbol java_lang_ref_Reference = StaticSymbols.putType("Ljava/lang/ref/Reference;"); - public static final Symbol java_lang_ref_FinalReference = StaticSymbols.putType("Ljava/lang/ref/FinalReference;"); - public static final Symbol java_lang_ref_WeakReference = StaticSymbols.putType("Ljava/lang/ref/WeakReference;"); - public static final Symbol java_lang_ref_SoftReference = StaticSymbols.putType("Ljava/lang/ref/SoftReference;"); - public static final Symbol java_lang_ref_PhantomReference = StaticSymbols.putType("Ljava/lang/ref/PhantomReference;"); - public static final Symbol java_lang_ref_ReferenceQueue = StaticSymbols.putType("Ljava/lang/ref/ReferenceQueue;"); - public static final Symbol java_lang_ref_Reference$Lock = StaticSymbols.putType("Ljava/lang/ref/Reference$Lock;"); - - public static final Symbol sun_misc_Cleaner = StaticSymbols.putType("Lsun/misc/Cleaner;"); - public static final Symbol jdk_internal_ref_Cleaner = StaticSymbols.putType("Ljdk/internal/ref/Cleaner;"); - - public static final Symbol java_lang_StackTraceElement = StaticSymbols.putType("Ljava/lang/StackTraceElement;"); - public static final Symbol java_lang_StackTraceElement_array = StaticSymbols.putType("[Ljava/lang/StackTraceElement;"); - - public static final Symbol java_lang_Error = StaticSymbols.putType("Ljava/lang/Error;"); - public static final Symbol java_lang_NoSuchFieldError = StaticSymbols.putType("Ljava/lang/NoSuchFieldError;"); - public static final Symbol java_lang_NoSuchMethodError = StaticSymbols.putType("Ljava/lang/NoSuchMethodError;"); - public static final Symbol java_lang_IllegalAccessError = StaticSymbols.putType("Ljava/lang/IllegalAccessError;"); - public static final Symbol java_lang_IncompatibleClassChangeError = StaticSymbols.putType("Ljava/lang/IncompatibleClassChangeError;"); - public static final Symbol java_lang_AbstractMethodError = StaticSymbols.putType("Ljava/lang/AbstractMethodError;"); - public static final Symbol java_lang_InternalError = StaticSymbols.putType("Ljava/lang/InternalError;"); - public static final Symbol java_lang_VerifyError = StaticSymbols.putType("Ljava/lang/VerifyError;"); - public static final Symbol java_lang_ClassFormatError = StaticSymbols.putType("Ljava/lang/ClassFormatError;"); - public static final Symbol java_lang_ClassCircularityError = StaticSymbols.putType("Ljava/lang/ClassCircularityError;"); - public static final Symbol java_lang_UnsatisfiedLinkError = StaticSymbols.putType("Ljava/lang/UnsatisfiedLinkError;"); - - public static final Symbol java_lang_invoke_MethodType = StaticSymbols.putType("Ljava/lang/invoke/MethodType;"); - - public static final Symbol java_lang_AssertionStatusDirectives = StaticSymbols.putType("Ljava/lang/AssertionStatusDirectives;"); - - public static final Symbol java_lang_invoke_MethodHandles = StaticSymbols.putType("Ljava/lang/invoke/MethodHandles;"); - public static final Symbol java_lang_invoke_VarHandle = StaticSymbols.putType("Ljava/lang/invoke/VarHandle;"); - public static final Symbol java_lang_invoke_VarHandles = StaticSymbols.putType("Ljava/lang/invoke/VarHandles;"); - public static final Symbol java_lang_invoke_MethodHandles$Lookup = StaticSymbols.putType("Ljava/lang/invoke/MethodHandles$Lookup;"); - public static final Symbol java_lang_invoke_CallSite = StaticSymbols.putType("Ljava/lang/invoke/CallSite;"); - public static final Symbol java_lang_invoke_DirectMethodHandle = StaticSymbols.putType("Ljava/lang/invoke/DirectMethodHandle;"); - public static final Symbol java_lang_invoke_LambdaMetafactory = StaticSymbols.putType("Ljava/lang/invoke/LambdaMetafactory;"); - - // MethodHandleNatives is not public. - public static final Symbol java_lang_invoke_MethodHandleNatives = StaticSymbols.putType("Ljava/lang/invoke/MethodHandleNatives;"); - public static final Symbol java_lang_invoke_MemberName = StaticSymbols.putType("Ljava/lang/invoke/MemberName;"); - public static final Symbol java_lang_invoke_MethodHandle = StaticSymbols.putType("Ljava/lang/invoke/MethodHandle;"); - public static final Symbol java_lang_invoke_LambdaForm = StaticSymbols.putType("Ljava/lang/invoke/LambdaForm;"); - public static final Symbol java_lang_invoke_LambdaForm$Compiled = StaticSymbols.putType("Ljava/lang/invoke/LambdaForm$Compiled;"); - public static final Symbol java_lang_invoke_LambdaForm$Hidden = StaticSymbols.putType("Ljava/lang/invoke/LambdaForm$Hidden;"); - public static final Symbol jdk_internal_vm_annotation_Hidden = StaticSymbols.putType("Ljdk/internal/vm/annotation/Hidden;"); - public static final Symbol jdk_internal_vm_annotation_Stable = StaticSymbols.putType("Ljdk/internal/vm/annotation/Stable;"); - public static final Symbol sun_reflect_CallerSensitive = StaticSymbols.putType("Lsun/reflect/CallerSensitive;"); - public static final Symbol jdk_internal_reflect_CallerSensitive = StaticSymbols.putType("Ljdk/internal/reflect/CallerSensitive;"); - public static final Symbol java_lang_invoke_ForceInline = StaticSymbols.putType("Ljava/lang/invoke/ForceInline;"); - public static final Symbol jdk_internal_vm_annotation_ForceInline = StaticSymbols.putType("Ljdk/internal/vm/annotation/ForceInline;"); - public static final Symbol java_lang_invoke_DontInline = StaticSymbols.putType("Ljava/lang/invoke/DontInline;"); - public static final Symbol jdk_internal_vm_annotation_DontInline = StaticSymbols.putType("Ljdk/internal/vm/annotation/DontInline;"); - - // ScopedMemoryAccess - public static final Symbol jdk_internal_misc_ScopedMemoryAccess$Scoped = StaticSymbols.putType("Ljdk/internal/misc/ScopedMemoryAccess$Scoped;"); - - // Modules - public static final Symbol java_lang_Module = StaticSymbols.putType("Ljava/lang/Module;"); - - // Record - public static final Symbol java_lang_Record = StaticSymbols.putType("Ljava/lang/Record;"); - public static final Symbol java_lang_reflect_RecordComponent = StaticSymbols.putType("Ljava/lang/reflect/RecordComponent;"); - - // Unsafe Constants (required for 13+) - public static final Symbol jdk_internal_misc_UnsafeConstants = StaticSymbols.putType("Ljdk/internal/misc/UnsafeConstants;"); - - // Stack walking API - public static final Symbol java_lang_StackWalker = StaticSymbols.putType("Ljava/lang/StackWalker;"); - public static final Symbol java_lang_StackStreamFactory = StaticSymbols.putType("Ljava/lang/StackStreamFactory;"); - public static final Symbol java_lang_StackStreamFactory_AbstractStackWalker = StaticSymbols.putType("Ljava/lang/StackStreamFactory$AbstractStackWalker;"); - public static final Symbol java_lang_StackFrameInfo = StaticSymbols.putType("Ljava/lang/StackFrameInfo;"); - - // Special threads - public static final Symbol java_lang_ref_Finalizer$FinalizerThread = StaticSymbols.putType("Ljava/lang/ref/Finalizer$FinalizerThread;"); - public static final Symbol java_lang_ref_Reference$ReferenceHandler = StaticSymbols.putType("Ljava/lang/ref/Reference$ReferenceHandler;"); - public static final Symbol jdk_internal_misc_InnocuousThread = StaticSymbols.putType("Ljdk/internal/misc/InnocuousThread;"); - public static final Symbol sun_misc_InnocuousThread = StaticSymbols.putType("Lsun/misc/InnocuousThread;"); - // java.management - public static final Symbol java_lang_management_MemoryManagerMXBean = StaticSymbols.putType("Ljava/lang/management/MemoryManagerMXBean;"); - public static final Symbol java_lang_management_MemoryPoolMXBean = StaticSymbols.putType("Ljava/lang/management/MemoryPoolMXBean;"); - public static final Symbol java_lang_management_GarbageCollectorMXBean = StaticSymbols.putType("Ljava/lang/management/GarbageCollectorMXBean;"); - public static final Symbol sun_management_ManagementFactory = StaticSymbols.putType("Lsun/management/ManagementFactory;"); - public static final Symbol sun_management_ManagementFactoryHelper = StaticSymbols.putType("Lsun/management/ManagementFactoryHelper;"); - public static final Symbol java_lang_management_MemoryUsage = StaticSymbols.putType("Ljava/lang/management/MemoryUsage;"); - public static final Symbol java_lang_management_ThreadInfo = StaticSymbols.putType("Ljava/lang/management/ThreadInfo;"); - - // Secrets - public static final Symbol sun_misc_SharedSecrets = StaticSymbols.putType("Lsun/misc/SharedSecrets;"); - public static final Symbol jdk_internal_misc_SharedSecrets = StaticSymbols.putType("Ljdk/internal/misc/SharedSecrets;"); - public static final Symbol jdk_internal_access_SharedSecrets = StaticSymbols.putType("Ljdk/internal/access/SharedSecrets;"); - public static final Symbol sun_misc_JavaLangAccess = StaticSymbols.putType("Lsun/misc/JavaLangAccess;"); - public static final Symbol jdk_internal_misc_JavaLangAccess = StaticSymbols.putType("Ljdk/internal/misc/JavaLangAccess;"); - public static final Symbol jdk_internal_access_JavaLangAccess = StaticSymbols.putType("Ljdk/internal/access/JavaLangAccess;"); - - // Interop conversions. - public static final Symbol java_time_Duration = StaticSymbols.putType("Ljava/time/Duration;"); - public static final Symbol java_time_LocalTime = StaticSymbols.putType("Ljava/time/LocalTime;"); - public static final Symbol java_time_LocalDateTime = StaticSymbols.putType("Ljava/time/LocalDateTime;"); - public static final Symbol java_time_LocalDate = StaticSymbols.putType("Ljava/time/LocalDate;"); - public static final Symbol java_time_Instant = StaticSymbols.putType("Ljava/time/Instant;"); - public static final Symbol java_time_ZonedDateTime = StaticSymbols.putType("Ljava/time/ZonedDateTime;"); - public static final Symbol java_util_Date = StaticSymbols.putType("Ljava/util/Date;"); - public static final Symbol java_time_ZoneId = StaticSymbols.putType("Ljava/time/ZoneId;"); - - // List / Map / Iterator - public static final Symbol java_lang_Iterable = StaticSymbols.putType("Ljava/lang/Iterable;"); - public static final Symbol java_util_List = StaticSymbols.putType("Ljava/util/List;"); - public static final Symbol java_util_Map = StaticSymbols.putType("Ljava/util/Map;"); - public static final Symbol java_util_HashMap = StaticSymbols.putType("Ljava/util/HashMap;"); - public static final Symbol java_util_Iterator = StaticSymbols.putType("Ljava/util/Iterator;"); - public static final Symbol java_util_NoSuchElementException = StaticSymbols.putType("Ljava/util/NoSuchElementException;"); - public static final Symbol java_util_Map_Entry = StaticSymbols.putType("Ljava/util/Map$Entry;"); - public static final Symbol java_util_Set = StaticSymbols.putType("Ljava/util/Set;"); - public static final Symbol java_util_Collection = StaticSymbols.putType("Ljava/util/Collection;"); - - // Optional - public static final Symbol java_util_Optional = StaticSymbols.putType("Ljava/util/Optional;"); - - // java.util.regex - public static final Symbol java_util_regex_Pattern = StaticSymbols.putType("Ljava/util/regex/Pattern;"); - public static final Symbol java_util_regex_Pattern_Node = StaticSymbols.putType("Ljava/util/regex/Pattern$Node;"); - public static final Symbol java_util_regex_Matcher = StaticSymbols.putType("Ljava/util/regex/Matcher;"); - public static final Symbol java_util_regex_IntHashSet = StaticSymbols.putType("Ljava/util/regex/IntHashSet;"); - public static final Symbol java_util_regex_IntHashSet_array = StaticSymbols.putType("[Ljava/util/regex/IntHashSet;"); - - public static final Symbol java_util_concurrent_locks_AbstractOwnableSynchronizer = StaticSymbols.putType("Ljava/util/concurrent/locks/AbstractOwnableSynchronizer;"); - public static final Symbol java_util_concurrent_locks_ReentrantLock_Sync = StaticSymbols.putType("Ljava/util/concurrent/locks/ReentrantLock$Sync;"); - public static final Symbol java_util_concurrent_locks_ReentrantReadWriteLock_Sync = StaticSymbols.putType("Ljava/util/concurrent/locks/ReentrantReadWriteLock$Sync;"); - - // java math - public static final Symbol java_math_BigInteger = StaticSymbols.putType("Ljava/math/BigInteger;"); - public static final Symbol java_math_BigDecimal = StaticSymbols.putType("Ljava/math/BigDecimal;"); - public static final Symbol java_math_MathContext = StaticSymbols.putType("Ljava/math/MathContext;"); - public static final Symbol java_math_RoundingMode = StaticSymbols.putType("Ljava/math/RoundingMode;"); - - // Polyglot/interop API. - public static final Symbol com_oracle_truffle_espresso_polyglot_Polyglot = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/Polyglot;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_ArityException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/ArityException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_UnknownIdentifierException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/UnknownIdentifierException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_UnsupportedMessageException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/UnsupportedMessageException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_UnsupportedTypeException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/UnsupportedTypeException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/InvalidArrayIndexException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/InvalidBufferOffsetException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_StopIterationException = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/StopIterationException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_UnknownKeyException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/UnknownKeyException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_ForeignException = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/ForeignException;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_ExceptionType = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/ExceptionType;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_VMHelper = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/VMHelper;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_TypeLiteral = StaticSymbols.putType("Lcom/oracle/truffle/espresso/polyglot/TypeLiteral;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_TypeLiteral$InternalTypeLiteral = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/TypeLiteral$InternalTypeLiteral;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterable = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignIterable;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignList = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignList;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignCollection = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignCollection;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterator = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignIterator;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignMap = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignMap;"); - public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignSet = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignSet;"); - - public static final Symbol com_oracle_truffle_espresso_polyglot_impl_EspressoForeignNumber = StaticSymbols.putType( - "Lcom/oracle/truffle/espresso/polyglot/impl/EspressoForeignNumber;"); - - // Continuations - public static final Symbol org_graalvm_continuations_ContinuationImpl = StaticSymbols.putType( - "Lorg/graalvm/continuations/ContinuationImpl;"); - public static final Symbol org_graalvm_continuations_ContinuationImpl_FrameRecord = StaticSymbols.putType( - "Lorg/graalvm/continuations/ContinuationImpl$FrameRecord;"); - public static final Symbol org_graalvm_continuations_IllegalMaterializedRecordException = StaticSymbols.putType( - "Lorg/graalvm/continuations/IllegalMaterializedRecordException;"); - public static final Symbol org_graalvm_continuations_IllegalContinuationStateException = StaticSymbols.putType( - "Lorg/graalvm/continuations/IllegalContinuationStateException;"); - - // JVMCI - public static final Symbol jdk_vm_ci_runtime_JVMCIRuntime = StaticSymbols.putType("Ljdk/vm/ci/runtime/JVMCIRuntime;"); - public static final Symbol jdk_vm_ci_services_Services = StaticSymbols.putType("Ljdk/vm/ci/services/Services;"); - public static final Symbol jdk_vm_ci_meta_UnresolvedJavaType = StaticSymbols.putType("Ljdk/vm/ci/meta/UnresolvedJavaType;"); - public static final Symbol jdk_vm_ci_meta_UnresolvedJavaField = StaticSymbols.putType("Ljdk/vm/ci/meta/UnresolvedJavaField;"); - public static final Symbol jdk_vm_ci_meta_LineNumberTable = StaticSymbols.putType("Ljdk/vm/ci/meta/LineNumberTable;"); - public static final Symbol jdk_vm_ci_meta_LocalVariableTable = StaticSymbols.putType("Ljdk/vm/ci/meta/LocalVariableTable;"); - public static final Symbol jdk_vm_ci_meta_Local = StaticSymbols.putType("Ljdk/vm/ci/meta/Local;"); - public static final Symbol jdk_vm_ci_meta_Local_array = StaticSymbols.putType("[Ljdk/vm/ci/meta/Local;"); - public static final Symbol jdk_vm_ci_meta_JavaType = StaticSymbols.putType("Ljdk/vm/ci/meta/JavaType;"); - public static final Symbol jdk_vm_ci_meta_ExceptionHandler = StaticSymbols.putType("Ljdk/vm/ci/meta/ExceptionHandler;"); - public static final Symbol jdk_vm_ci_meta_JavaConstant = StaticSymbols.putType("Ljdk/vm/ci/meta/JavaConstant;"); - public static final Symbol jdk_vm_ci_meta_JavaConstant_array = StaticSymbols.putType("[Ljdk/vm/ci/meta/JavaConstant;"); - public static final Symbol jdk_vm_ci_meta_PrimitiveConstant = StaticSymbols.putType("Ljdk/vm/ci/meta/PrimitiveConstant;"); - public static final Symbol jdk_vm_ci_meta_MethodHandleAccessProvider$IntrinsicMethod = StaticSymbols.putType("Ljdk/vm/ci/meta/MethodHandleAccessProvider$IntrinsicMethod;"); - // @formatter:off - public static final Symbol com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/EspressoJVMCIRuntime;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedInstanceType;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaField;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaMethod;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedArrayType = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedArrayType;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedPrimitiveType;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaType = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaType;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoConstantPool;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoObjectConstant;"); - public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoBootstrapMethodInvocation = StaticSymbols.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoBootstrapMethodInvocation;"); - // @formatter:on - - public static final Symbol jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler = StaticSymbols.putType("Lcom/oracle/truffle/espresso/graal/DummyEspressoGraalJVMCICompiler;"); - public static final Symbol jdk_graal_compiler_api_runtime_GraalJVMCICompiler = StaticSymbols.putType("Ljdk/graal/compiler/api/runtime/GraalJVMCICompiler;"); - - // Panama - public static final Symbol jdk_internal_foreign_abi_VMStorage = StaticSymbols.putType("Ljdk/internal/foreign/abi/VMStorage;"); - public static final Symbol jdk_internal_foreign_abi_NativeEntryPoint = StaticSymbols.putType("Ljdk/internal/foreign/abi/NativeEntryPoint;"); - public static final Symbol jdk_internal_foreign_abi_UpcallLinker_CallRegs = StaticSymbols.putType("Ljdk/internal/foreign/abi/UpcallLinker$CallRegs;"); - public static final Symbol jdk_internal_foreign_abi_VMStorage_array = StaticSymbols.putType("[Ljdk/internal/foreign/abi/VMStorage;"); - } - - /** - * Contains commonly used (signature) symbols. - * - *

- * Naming convention: Use the concatenation of the return type (first) and the parameter types, - * separated by '_'. Always use unqualified type names.
- * {@link #Object}
- * {@link #_void_String_array}
- * {@link #Thread$State_int}
- * {@link #_void}
- */ - public static final class Signature extends Descriptor { - - public static void ensureInitialized() { - /* nop */ - } - - public static final Symbol _boolean = StaticSymbols.putSignature(Type._boolean); - public static final Symbol _byte = StaticSymbols.putSignature(Type._byte); - public static final Symbol _short = StaticSymbols.putSignature(Type._short); - public static final Symbol _char = StaticSymbols.putSignature(Type._char); - public static final Symbol _int = StaticSymbols.putSignature(Type._int); - public static final Symbol _long = StaticSymbols.putSignature(Type._long); - public static final Symbol _float = StaticSymbols.putSignature(Type._float); - public static final Symbol _double = StaticSymbols.putSignature(Type._double); - public static final Symbol _void = StaticSymbols.putSignature(Type._void); - - public static final Symbol Class = StaticSymbols.putSignature(Type.java_lang_Class); - public static final Symbol LocalDate = StaticSymbols.putSignature(Type.java_time_LocalDate); - public static final Symbol LocalDate_int_int_int = StaticSymbols.putSignature(Type.java_time_LocalDate, Type._int, Type._int, Type._int); - public static final Symbol LocalTime = StaticSymbols.putSignature(Type.java_time_LocalTime); - public static final Symbol LocalDateTime_LocalDate_LocalTime = StaticSymbols.putSignature(Type.java_time_LocalDateTime, Type.java_time_LocalDate, Type.java_time_LocalTime); - public static final Symbol LocalTime_int_int_int_int = StaticSymbols.putSignature(Type.java_time_LocalTime, Type._int, Type._int, Type._int, Type._int); - public static final Symbol Instant = StaticSymbols.putSignature(Type.java_time_Instant); - public static final Symbol Date_Instant = StaticSymbols.putSignature(Type.java_util_Date, Type.java_time_Instant); - public static final Symbol Instant_long_long = StaticSymbols.putSignature(Type.java_time_Instant, Type._long, Type._long); - public static final Symbol ZoneId = StaticSymbols.putSignature(Type.java_time_ZoneId); - public static final Symbol ZonedDateTime_Instant_ZoneId = StaticSymbols.putSignature(Type.java_time_ZonedDateTime, Type.java_time_Instant, Type.java_time_ZoneId); - public static final Symbol ZonedDateTime_ZoneId = StaticSymbols.putSignature(Type.java_time_ZonedDateTime, Type.java_time_ZoneId); - public static final Symbol ZoneId_String = StaticSymbols.putSignature(Type.java_time_ZoneId, Type.java_lang_String); - - public static final Symbol _void_Object = StaticSymbols.putSignature(Type._void, Type.java_lang_Object); - public static final Symbol Object_Object = StaticSymbols.putSignature(Type.java_lang_Object, Type.java_lang_Object); - public static final Symbol Object_Object_Object = StaticSymbols.putSignature(Type.java_lang_Object, Type.java_lang_Object, Type.java_lang_Object); - public static final Symbol Object_int = StaticSymbols.putSignature(Type.java_lang_Object, Type._int); - public static final Symbol Object_int_Object = StaticSymbols.putSignature(Type.java_lang_Object, Type._int, Type.java_lang_Object); - - public static final Symbol Object = StaticSymbols.putSignature(Type.java_lang_Object); - public static final Symbol String = StaticSymbols.putSignature(Type.java_lang_String); - public static final Symbol _void_CharSequence_Pattern = StaticSymbols.putSignature(Type._void, Type.java_util_regex_Pattern, Type.java_lang_CharSequence); - public static final Symbol Matcher_CharSequence = StaticSymbols.putSignature(Type.java_util_regex_Matcher, Type.java_lang_CharSequence); - public static final Symbol ClassLoader = StaticSymbols.putSignature(Type.java_lang_ClassLoader); - public static final Symbol Map = StaticSymbols.putSignature(Type.java_util_Map); - public static final Symbol _void_URL_array_ClassLoader = StaticSymbols.putSignature(Type._void, Type.java_net_URL_array, Type.java_lang_ClassLoader); - public static final Symbol Class_PermissionDomain = StaticSymbols.putSignature(Type._void, Type.java_lang_Class, Type.java_security_ProtectionDomain); - - public static final Symbol _void_Class = StaticSymbols.putSignature(Type._void, Type.java_lang_Class); - public static final Symbol Class_array = StaticSymbols.putSignature(Type.java_lang_Class_array); - - public static final Symbol Object_String_String = StaticSymbols.putSignature(Type.java_lang_Object, Type.java_lang_String, Type.java_lang_String); - public static final Symbol _void_String_array = StaticSymbols.putSignature(Type._void, Type.java_lang_String_array); - public static final Symbol Class_String_boolean_ClassLoader = StaticSymbols.putSignature(Type.java_lang_Class, Type.java_lang_String, Type._boolean, Type.java_lang_ClassLoader); - - public static final Symbol Throwable = StaticSymbols.putSignature(Type.java_lang_Throwable); - public static final Symbol _void_Throwable = StaticSymbols.putSignature(Type._void, Type.java_lang_Throwable); - public static final Symbol StackTraceElement_array = StaticSymbols.putSignature(Type.java_lang_StackTraceElement_array); - public static final Symbol _void_String_Throwable = StaticSymbols.putSignature(Type._void, Type.java_lang_String, Type.java_lang_Throwable); - public static final Symbol _void_String = StaticSymbols.putSignature(Type._void, Type.java_lang_String); - public static final Symbol _void_String_int = StaticSymbols.putSignature(Type._void, Type.java_lang_String, Type._int); - public static final Symbol Class_String = StaticSymbols.putSignature(Type.java_lang_Class, Type.java_lang_String); - public static final Symbol InputStream_String = StaticSymbols.putSignature(Type.java_io_InputStream, Type.java_lang_String); - public static final Symbol _int_byte_array_int_int = StaticSymbols.putSignature(Type._int, Type._byte_array, Type._int, Type._int); - public static final Symbol ByteBuffer_int_byte_array_int_int = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._byte_array, Type._int, Type._int); - public static final Symbol ByteBuffer_int_byte = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._byte); - public static final Symbol ByteBuffer_int_short = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._short); - public static final Symbol ByteBuffer_int_int = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._int); - public static final Symbol ByteBuffer_int_long = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._long); - public static final Symbol ByteBuffer_int_float = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._float); - public static final Symbol ByteBuffer_int_double = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._int, Type._double); - public static final Symbol _byte_int = StaticSymbols.putSignature(Type._byte, Type._int); - public static final Symbol _short_int = StaticSymbols.putSignature(Type._short, Type._int); - public static final Symbol _int_int = StaticSymbols.putSignature(Type._int, Type._int); - public static final Symbol _long_int = StaticSymbols.putSignature(Type._long, Type._int); - public static final Symbol _float_int = StaticSymbols.putSignature(Type._float, Type._int); - public static final Symbol _double_int = StaticSymbols.putSignature(Type._double, Type._int); - public static final Symbol ByteBuffer_byte_array = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type._byte_array); - public static final Symbol ByteOrder = StaticSymbols.putSignature(Type.java_nio_ByteOrder); - public static final Symbol ByteBuffer_ByteOrder = StaticSymbols.putSignature(Type.java_nio_ByteBuffer, Type.java_nio_ByteOrder); - public static final Symbol _long_ClassLoader_String = StaticSymbols.putSignature(Type._long, Type.java_lang_ClassLoader, Type.java_lang_String); - public static final Symbol _void_Exception = StaticSymbols.putSignature(Type._void, Type.java_lang_Exception); - public static final Symbol _void_String_String_String_int = StaticSymbols.putSignature(Type._void, Type.java_lang_String, Type.java_lang_String, Type.java_lang_String, Type._int); - public static final Symbol _void_int = StaticSymbols.putSignature(Type._void, Type._int); - public static final Symbol _void_boolean = StaticSymbols.putSignature(Type._void, Type._boolean); - public static final Symbol _void_long = StaticSymbols.putSignature(Type._void, Type._long); - public static final Symbol _void_long_int = StaticSymbols.putSignature(Type._void, Type._long, Type._int); - public static final Symbol _void_long_long = StaticSymbols.putSignature(Type._void, Type._long, Type._long); - public static final Symbol _boolean_int = StaticSymbols.putSignature(Type._boolean, Type._int); - public static final Symbol _boolean_int_int = StaticSymbols.putSignature(Type._boolean, Type._int, Type._int); - public static final Symbol _boolean_long = StaticSymbols.putSignature(Type._boolean, Type._long); - public static final Symbol _int_int_int = StaticSymbols.putSignature(Type._int, Type._int, Type._int); - public static final Symbol _void_char_array = StaticSymbols.putSignature(Type._void, Type._char_array); - public static final Symbol _void_byte_array = StaticSymbols.putSignature(Type._void, Type._byte_array); - public static final Symbol _byte_array = StaticSymbols.putSignature(Type._byte_array); - public static final Symbol _char_array = StaticSymbols.putSignature(Type._char_array); - public static final Symbol _int_boolean_boolean = StaticSymbols.putSignature(Type._int, Type._boolean, Type._boolean); - public static final Symbol _boolean_boolean = StaticSymbols.putSignature(Type._boolean, Type._boolean); - public static final Symbol _boolean_Object = StaticSymbols.putSignature(Type._boolean, Type.java_lang_Object); - public static final Symbol Object_long_int_int_int_int = StaticSymbols.putSignature(Type.java_lang_Object, Type._long, Type._int, Type._int, Type._int, Type._int); - public static final Symbol Object_long_int_int_int_Object_array = StaticSymbols.putSignature(Type.java_lang_Object, Type._long, Type._int, Type._int, Type._int, - Type.java_lang_Object_array); - public static final Symbol _int_Object_long_Object_long_int_int = StaticSymbols.putSignature(Type._int, Type.java_lang_Object, Type._long, Type.java_lang_Object, Type._long, - Type._int, Type._int); - public static final Symbol Object_long_int_ContinuationScope_Continuation_int_int_Object_array = StaticSymbols.putSignature(Type.java_lang_Object, Type._long, Type._int, - Type.jdk_internal_vm_ContinuationScope, Type.jdk_internal_vm_Continuation, Type._int, Type._int, - Type.java_lang_Object_array); - public static final Symbol _byte_array_String_Class_array_int = StaticSymbols.putSignature(Type._byte_array, Type.java_lang_String, Type.java_lang_Class_array, Type._int); - public static final Symbol _byte_array_ClassLoader_String_List_int = StaticSymbols.putSignature(Type._byte_array, Type.java_lang_ClassLoader, Type.java_lang_String, - Type.java_util_List, - Type._int); - - public static final Symbol _void_BigInteger_int_MathContext = StaticSymbols.putSignature(Type._void, Type.java_math_BigInteger, Type._int, Type.java_math_MathContext); - - public static final Symbol Boolean_boolean = StaticSymbols.putSignature(Type.java_lang_Boolean, Type._boolean); - public static final Symbol Byte_byte = StaticSymbols.putSignature(Type.java_lang_Byte, Type._byte); - public static final Symbol Character_char = StaticSymbols.putSignature(Type.java_lang_Character, Type._char); - public static final Symbol Short_short = StaticSymbols.putSignature(Type.java_lang_Short, Type._short); - public static final Symbol Float_float = StaticSymbols.putSignature(Type.java_lang_Float, Type._float); - public static final Symbol Integer_int = StaticSymbols.putSignature(Type.java_lang_Integer, Type._int); - public static final Symbol Double_double = StaticSymbols.putSignature(Type.java_lang_Double, Type._double); - public static final Symbol Long_long = StaticSymbols.putSignature(Type.java_lang_Long, Type._long); - - public static final Symbol Object_array_Object_array = StaticSymbols.putSignature(Type.java_lang_Object_array, Type.java_lang_Object_array); - public static final Symbol Object_Object_array = StaticSymbols.putSignature(Type.java_lang_Object, Type.java_lang_Object_array); - - public static final Symbol java_util_Iterator = StaticSymbols.putSignature(Type.java_util_Iterator); - public static final Symbol java_util_Set = StaticSymbols.putSignature(Type.java_util_Set); - public static final Symbol Set_Object_array = StaticSymbols.putSignature(Type.java_util_Set, Type.java_lang_Object_array); - - public static final Symbol java_lang_reflect_Method_init_signature = StaticSymbols.putSignature(Type._void, - /* declaringClass */ Type.java_lang_Class, - /* name */ Type.java_lang_String, - /* parameterTypes */ Type.java_lang_Class_array, - /* returnType */ Type.java_lang_Class, - /* checkedExceptions */ Type.java_lang_Class_array, - /* modifiers */ Type._int, - /* slot */ Type._int, - /* signature */ Type.java_lang_String, - /* annotations */ Type._byte_array, - /* parameterAnnotations */ Type._byte_array, - /* annotationDefault */ Type._byte_array); - - public static final Symbol java_lang_reflect_Constructor_init_signature = StaticSymbols.putSignature(Type._void, - /* declaringClass */ Type.java_lang_Class, - /* parameterTypes */ Type.java_lang_Class_array, - /* checkedExceptions */ Type.java_lang_Class_array, - /* modifiers */ Type._int, - /* slot */ Type._int, - /* signature */ Type.java_lang_String, - /* annotations */ Type._byte_array, - /* parameterAnnotations */ Type._byte_array); - - public static final Symbol java_lang_reflect_Field_init_signature = StaticSymbols.putSignature(Type._void, - /* declaringClass */ Type.java_lang_Class, - /* name */ Type.java_lang_String, - /* type */ Type.java_lang_Class, - /* modifiers */ Type._int, - /* slot */ Type._int, - /* signature */ Type.java_lang_String, - /* annotations */ Type._byte_array); - - public static final Symbol java_lang_reflect_Field_init_signature_15 = StaticSymbols.putSignature(Type._void, - /* declaringClass */ Type.java_lang_Class, - /* name */ Type.java_lang_String, - /* type */ Type.java_lang_Class, - /* modifiers */ Type._int, - /* trustedFinal */ Type._boolean, - /* slot */ Type._int, - /* signature */ Type.java_lang_String, - /* annotations */ Type._byte_array); - - public static final Symbol MethodType_Class_Class = StaticSymbols.putSignature(Type.java_lang_invoke_MethodType, Type.java_lang_Class, Type.java_lang_Class_array); - public static final Symbol MethodType_String_ClassLoader = StaticSymbols.putSignature(Type.java_lang_invoke_MethodType, Type.java_lang_String, Type.java_lang_ClassLoader); - - public static final Symbol Java_lang_reflect_Type = StaticSymbols.putSignature(Type.java_lang_reflect_Type); - public static final Symbol Type_array = StaticSymbols.putSignature(Type.java_lang_reflect_Type_array); - - public static final Symbol MemberName = StaticSymbols.putSignature(Type.java_lang_invoke_MemberName); - - public static final Symbol MemberName_Class_int_Class_String_Object_Object_array = StaticSymbols.putSignature(Type.java_lang_invoke_MemberName, Type.java_lang_Class, Type._int, - Type.java_lang_Class, Type.java_lang_String, Type.java_lang_Object, Type.java_lang_Object_array); - public static final Symbol MethodHandle_Class_int_Class_String_Object = StaticSymbols.putSignature(Type.java_lang_invoke_MethodHandle, Type.java_lang_Class, Type._int, - Type.java_lang_Class, Type.java_lang_String, Type.java_lang_Object); - public static final Symbol MemberName_Object_Object_Object_Object_Object_Object_array = StaticSymbols.putSignature( - Type.java_lang_invoke_MemberName, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object_array); - public static final Symbol MemberName_Object_int_Object_Object_Object_Object_Object_array = StaticSymbols.putSignature( - Type.java_lang_invoke_MemberName, - Type.java_lang_Object, - Type._int, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object_array); - public static final Symbol Object_Object_int_Object_Object_Object_Object = StaticSymbols.putSignature( - Type.java_lang_Object, - Type.java_lang_Object, - Type._int, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object); - public static final Symbol Object_Object_Object_Object_Object_Object = StaticSymbols.putSignature( - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object, - Type.java_lang_Object); - public static final Symbol MethodHandles$Lookup = StaticSymbols.putSignature(Type.java_lang_invoke_MethodHandles$Lookup); - public static final Symbol MethodHandle = StaticSymbols.putSignature(Type.java_lang_invoke_MethodHandle); - - public static final Symbol CallSite_Lookup_String_MethodType_MethodType_MethodHandle_MethodType = StaticSymbols.putSignature( - Type.java_lang_invoke_CallSite, - Type.java_lang_invoke_MethodHandles$Lookup, - Type.java_lang_String, - Type.java_lang_invoke_MethodType, - Type.java_lang_invoke_MethodType, - Type.java_lang_invoke_MethodHandle, - Type.java_lang_invoke_MethodType); - public static final Symbol CallSite_Lookup_String_MethodType_Object_array = StaticSymbols.putSignature( - Type.java_lang_invoke_CallSite, - Type.java_lang_invoke_MethodHandles$Lookup, - Type.java_lang_String, - Type.java_lang_invoke_MethodType, - Type.java_lang_Object_array); - - public static final Symbol Field_Object_long_Class = StaticSymbols.putSignature(Type.java_lang_reflect_Field, Type.java_lang_Object, Type._long, Type.java_lang_Class); - - public static final Symbol Thread$State_int = StaticSymbols.putSignature(Type.java_lang_Thread$State, Type._int); - public static final Symbol _void_ThreadGroup_String = StaticSymbols.putSignature(Type._void, Type.java_lang_ThreadGroup, Type.java_lang_String); - public static final Symbol _void_ThreadGroup_Runnable = StaticSymbols.putSignature(Type._void, Type.java_lang_ThreadGroup, Type.java_lang_Runnable); - public static final Symbol ThreadGroup = StaticSymbols.putSignature(Type.java_lang_ThreadGroup); - public static final Symbol _void_Thread = StaticSymbols.putSignature(Type._void, Type.java_lang_Thread); - - public static final Symbol Reference = StaticSymbols.putSignature(Type.java_lang_ref_Reference); - public static final Symbol _void_sun_misc_JavaLangAccess = StaticSymbols.putSignature(Type._void, Type.sun_misc_JavaLangAccess); - public static final Symbol _void_jdk_internal_misc_JavaLangAccess = StaticSymbols.putSignature(Type._void, Type.jdk_internal_misc_JavaLangAccess); - public static final Symbol _void_jdk_internal_access_JavaLangAccess = StaticSymbols.putSignature(Type._void, Type.jdk_internal_access_JavaLangAccess); - - public static final Symbol _void_CodeSource_PermissionCollection = StaticSymbols.putSignature(Type._void, Type.java_security_CodeSource, Type.java_security_PermissionCollection); - - // java.management - public static final Symbol MemoryPoolMXBean_String_boolean_long_long = StaticSymbols.putSignature(Type.java_lang_management_MemoryPoolMXBean, Type.java_lang_String, Type._boolean, - Type._long, Type._long); - public static final Symbol MemoryManagerMXBean_String = StaticSymbols.putSignature(Type.java_lang_management_MemoryManagerMXBean, Type.java_lang_String); - public static final Symbol GarbageCollectorMXBean_String_String = StaticSymbols.putSignature(Type.java_lang_management_GarbageCollectorMXBean, Type.java_lang_String, - Type.java_lang_String); - - // Polyglot/interop API. - public static final Symbol UnsupportedMessageException = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException); - public static final Symbol UnsupportedMessageException_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException, - Type.java_lang_Throwable); - - public static final Symbol UnsupportedTypeException_Object_array_String = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException, - Type.java_lang_Object_array, - Type.java_lang_String); - public static final Symbol UnsupportedTypeException_Object_array_String_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException, - Type.java_lang_Object_array, - Type.java_lang_String, - Type.java_lang_Throwable); - - public static final Symbol UnknownIdentifierException_String = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException, - Type.java_lang_String); - public static final Symbol UnknownIdentifierException_String_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException, - Type.java_lang_String, Type.java_lang_Throwable); - - public static final Symbol ArityException_int_int_int = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_ArityException, Type._int, Type._int, Type._int); - public static final Symbol ArityException_int_int_int_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_ArityException, Type._int, Type._int, - Type._int, Type.java_lang_Throwable); - - public static final Symbol InvalidArrayIndexException_long = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException, Type._long); - public static final Symbol InvalidArrayIndexException_long_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException, Type._long, - Type.java_lang_Throwable); - - public static final Symbol InvalidBufferOffsetException_long_long = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException, Type._long, - Type._long); - public static final Symbol InvalidBufferOffsetException_long_long_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException, - Type._long, Type._long, Type.java_lang_Throwable); - - public static final Symbol StopIterationException = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_StopIterationException); - public static final Symbol StopIterationException_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_StopIterationException, Type.java_lang_Throwable); - public static final Symbol UnknownKeyException_Object = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnknownKeyException, - Type.java_lang_Object); - public static final Symbol UnknownKeyException_Object_Throwable = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_polyglot_UnknownKeyException, - Type.java_lang_Object, Type.java_lang_Throwable); - - // JVMCI - public static final Symbol EspressoJVMCIRuntime = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime); - public static final Symbol _void_EspressoResolvedJavaType_int_Class = StaticSymbols.putSignature(Type._void, Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaType, - Type._int, Type.java_lang_Class); - public static final Symbol _void_EspressoResolvedInstanceType = StaticSymbols.putSignature(Type._void, Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); - public static final Symbol EspressoResolvedPrimitiveType_int = StaticSymbols.putSignature(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType, Type._int); - public static final Symbol DummyEspressoGraalJVMCICompiler_JVMCIRuntime = StaticSymbols.putSignature(Type.jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler, - Type.jdk_vm_ci_runtime_JVMCIRuntime); - public static final Symbol _void_Module = StaticSymbols.putSignature(Type._void, Type.java_lang_Module); - public static final Symbol _void_Local_array = StaticSymbols.putSignature(Type._void, Type.jdk_vm_ci_meta_Local_array); - public static final Symbol _void_int_array_int_array = StaticSymbols.putSignature(Type._void, Type._int_array, Type._int_array); - public static final Symbol _void_String_JavaType_int_int_int = StaticSymbols.putSignature(Type._void, Type.java_lang_String, Type.jdk_vm_ci_meta_JavaType, Type._int, Type._int, - Type._int); - public static final Symbol _void_int_int_int_int_JavaType = StaticSymbols.putSignature(Type._void, Type._int, Type._int, Type._int, Type._int, Type.jdk_vm_ci_meta_JavaType); - public static final Symbol _void_JavaType_String_JavaType = StaticSymbols.putSignature(Type._void, Type.jdk_vm_ci_meta_JavaType, Type.java_lang_String, - Type.jdk_vm_ci_meta_JavaType); - public static final Symbol PrimitiveConstant_int = StaticSymbols.putSignature(Type.jdk_vm_ci_meta_PrimitiveConstant, Type._int); - public static final Symbol PrimitiveConstant_long = StaticSymbols.putSignature(Type.jdk_vm_ci_meta_PrimitiveConstant, Type._long); - public static final Symbol PrimitiveConstant_float = StaticSymbols.putSignature(Type.jdk_vm_ci_meta_PrimitiveConstant, Type._float); - public static final Symbol PrimitiveConstant_double = StaticSymbols.putSignature(Type.jdk_vm_ci_meta_PrimitiveConstant, Type._double); - public static final Symbol PrimitiveConstant_char_long = StaticSymbols.putSignature(Type.jdk_vm_ci_meta_PrimitiveConstant, Type._char, Type._long); - public static final Symbol _void_boolean_EspressoResolvedJavaMethod_String_JavaConstant_JavaConstant_array = StaticSymbols.putSignature(Type._void, Type._boolean, - Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod, Type.java_lang_String, Type.jdk_vm_ci_meta_JavaConstant, Type.jdk_vm_ci_meta_JavaConstant_array); - - public static final Symbol _void_sun_misc_Signal = StaticSymbols.putSignature(Type._void, Type.sun_misc_Signal); - public static final Symbol _void_jdk_internal_misc_Signal = StaticSymbols.putSignature(Type._void, Type.jdk_internal_misc_Signal); - - public static final Symbol Path_String_String_array = StaticSymbols.putSignature(Type.java_nio_file_Path, Type.java_lang_String, Type.java_lang_String_array); - public static final Symbol ModuleFinder = StaticSymbols.putSignature(Type.java_lang_module_ModuleFinder); - public static final Symbol ModuleFinder_SystemModules = StaticSymbols.putSignature(Type.java_lang_module_ModuleFinder, Type.jdk_internal_module_SystemModules); - public static final Symbol ModuleFinder_Path_array = StaticSymbols.putSignature(Type.java_lang_module_ModuleFinder, Type.java_nio_file_Path_array); - public static final Symbol ModuleFinder_ModuleFinder_array = StaticSymbols.putSignature(Type.java_lang_module_ModuleFinder, Type.java_lang_module_ModuleFinder_array); - public static final Symbol Module_ClassLoader_ModuleDescriptor_URI = StaticSymbols.putSignature(Type.java_lang_Module, Type.java_lang_ClassLoader, - Type.java_lang_module_ModuleDescriptor, Type.java_net_URI); - public static final Symbol ModuleDescriptor_String_String = StaticSymbols.putSignature(Type.java_lang_module_ModuleDescriptor, Type.java_lang_String, Type.java_lang_String); - - // Continuations - public static final Symbol _void_FrameRecord_Object_array_long_array_Method_int_int_Object = StaticSymbols.putSignature( - Type._void, - Type.java_lang_Object_array, - Type._long_array, - Type.java_lang_reflect_Method, - Type._int, - Type._int, - Type.java_lang_Object); - } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java index 9957a67c4ab8..34b5e0dbd347 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Symbols.java @@ -46,26 +46,26 @@ public Symbols(Symbols seed) { @SuppressWarnings("unchecked") @TruffleBoundary - Symbol lookup(ByteSequence sequence) { - return (Symbol) symbols.get(new SymbolKey(sequence)); + Symbol lookup(ByteSequence byteSequence) { + return (Symbol) symbols.get(new SymbolKey(byteSequence)); } - Symbol lookup(String str) { - return lookup(ByteSequence.create(str)); + Symbol lookup(String string) { + return lookup(ByteSequence.create(string)); } @SuppressWarnings("unchecked") @TruffleBoundary - Symbol symbolify(final ByteSequence sequence) { - final SymbolKey key = new SymbolKey(sequence); + Symbol symbolify(ByteSequence byteSequence) { + final SymbolKey key = new SymbolKey(byteSequence); return (Symbol) symbols.computeIfAbsent(key, new Function>() { @Override public Symbol apply(SymbolKey unused) { // Create Symbol - final byte[] bytes = Arrays.copyOfRange(sequence.getUnderlyingBytes(), - sequence.offset(), - sequence.offset() + sequence.length()); - Symbol computed = new Symbol<>(bytes, sequence.hashCode()); + final byte[] rawBytes = Arrays.copyOfRange(byteSequence.getUnderlyingBytes(), + byteSequence.offset(), + byteSequence.offset() + byteSequence.length()); + Symbol computed = new Symbol<>(rawBytes, byteSequence.hashCode()); // Swap the byte sequence, which could be holding a large underlying byte array, by // a fresh symbol. // diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java new file mode 100644 index 000000000000..11b1979729ce --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Type.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.classfile.descriptors; + +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; + +/** + * Contains commonly used (type) symbols. + * + *

+ * Naming convention: Use the fully qualified type name, '_' as package separator and '$' as + * separator for inner classes.
+ * - {@link ParserTypes#_long}
+ * - {@link ParserTypes#java_lang_Object}
+ */ +public final class Type extends Descriptor { +} diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Types.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java similarity index 77% rename from espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Types.java rename to espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java index 9fd02e066721..bf84f9760a44 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Types.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/TypeSymbols.java @@ -24,49 +24,77 @@ import static com.oracle.truffle.espresso.classfile.descriptors.ByteSequence.EMPTY; import static com.oracle.truffle.espresso.classfile.descriptors.ByteSequence.wrap; -import static com.oracle.truffle.espresso.classfile.descriptors.Validation.validClassNameEntry; import java.util.Arrays; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.ParserException; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; /** * Manages creation and parsing of type descriptors ("field descriptors" in the JVMS). * * @see "https://docs.oracle.com/javase/specs/jvms/se10/html/jvms-4.html#jvms-4.3.2" */ -public final class Types { +public final class TypeSymbols { private final Symbols symbols; - public Types(Symbols symbols) { + public TypeSymbols(Symbols symbols) { this.symbols = symbols; } - @SuppressWarnings("unchecked") - public static Symbol fromDescriptor(Symbol descriptor) { - Symbol type = (Symbol) descriptor; - // TODO(peterssen): Turn check into assert, maybe? - if (!isValid(type)) { + /** + * Creates or retrieves a Type symbol for a valid type descriptor string. + * + * @param typeString The type descriptor string to process + * @return A Symbol representing the type, or null if the descriptor is invalid + */ + public Symbol getOrCreateValidType(String typeString) { + return getOrCreateValidType(ByteSequence.create(typeString)); + } + + /** + * Creates or retrieves a Type symbol for a valid type descriptor byte sequence. + * + * @param typeBytes The type descriptor byte sequence to process + * @return A Symbol representing the type, or null if the descriptor is invalid + */ + public Symbol getOrCreateValidType(ByteSequence typeBytes) { + if (Validation.validTypeDescriptor(typeBytes, true)) { + return symbols.symbolify(typeBytes); + } else { return null; } - return type; } - public Symbol getOrCreate(String name) { - return getOrCreate(ByteSequence.create(name)); + /** + * Looks up an existing Type symbol for a valid type descriptor string. + * + * @param typeString The type descriptor string to look up + * @return The existing Symbol for the type, or null if not found or invalid + * + * @see Validation#validTypeDescriptor(ByteSequence, boolean) + */ + public Symbol lookupValidType(String typeString) { + ByteSequence byteSequence = ByteSequence.create(typeString); + return lookupValidType(byteSequence); } - public Symbol getOrCreate(ByteSequence name) { - if (!Validation.validTypeDescriptor(name, true)) { + /** + * Looks up an existing Type symbol for a valid type descriptor byte sequence. + * + * @param typeBytes The type descriptor byte sequence to look up + * @return The existing Symbol for the type, or null if not found or invalid + * + * @see Validation#validTypeDescriptor(ByteSequence, boolean) + */ + public Symbol lookupValidType(ByteSequence typeBytes) { + if (Validation.validTypeDescriptor(typeBytes, true)) { + return symbols.lookup(typeBytes); + } else { return null; } - return symbols.symbolify(name); } public static String internalFromClassName(String className) { @@ -116,7 +144,10 @@ public static ByteSequence hiddenClassName(Symbol type, long id) { @TruffleBoundary public Symbol fromClassGetName(String className) { - return symbols.symbolify(ByteSequence.create(checkType(internalFromClassName(className)))); + String internalName = internalFromClassName(className); + ByteSequence byteSequence = ByteSequence.create(internalName); + ErrorUtil.guarantee(Validation.validTypeDescriptor(byteSequence, true), "invalid type"); + return symbols.symbolify(byteSequence); } public static Symbol forPrimitive(JavaKind kind) { @@ -138,7 +169,7 @@ Symbol parse(Symbol descriptor, int beginIndex, bool if (endIndex == beginIndex + 1) { try { return forPrimitive(JavaKind.fromPrimitiveOrVoidTypeChar((char) descriptor.byteAt(beginIndex))); - } catch (IllegalArgumentException e) { + } catch (IllegalStateException e) { throw new ParserException.ClassFormatError("invalid descriptor: " + descriptor); } } @@ -197,7 +228,7 @@ static int skipValidTypeDescriptor(Symbol descriptor, int */ public Symbol arrayOf(Symbol type, int dimensions) { assert dimensions > 0; - if (Types.getArrayDimensions(type) + dimensions > 255) { + if (TypeSymbols.getArrayDimensions(type) + dimensions > 255) { throw new ParserException.ClassFormatError("Array type with more than 255 dimensions"); } // Prepend #dimensions '[' to type descriptor. @@ -277,29 +308,6 @@ public static int getArrayDimensions(ByteSequence type) { return dims; } - private static boolean isValid(Symbol type) { - if (type.length() == 0) { - return false; - } - if (type.length() == 1) { - return isPrimitive(type); - } - char first = (char) type.byteAt(0); - int beginIndex; - if (first == '[') { - beginIndex = 0; - while (beginIndex < type.length() && type.byteAt(beginIndex) == '[') { - ++beginIndex; - } - } else if (first == 'L') { - beginIndex = 0; - } else { - return false; - } - int endIndex = skipValidTypeDescriptor(type, beginIndex, true); - return endIndex == type.length(); - } - public static boolean isArray(Symbol type) { assert type.length() > 0 : "empty symbol"; return type.length() > 0 && type.byteAt(0) == '['; @@ -321,23 +329,10 @@ public Symbol getElementalType(Symbol type) { public Symbol fromClass(Class clazz) { ByteSequence descriptor = ByteSequence.create(internalFromClassName(clazz.getName())); - assert Validation.validTypeDescriptor(descriptor, true); + assert Validation.validTypeDescriptor(descriptor, true) : descriptor; return symbols.symbolify(descriptor); } - static ByteSequence checkType(ByteSequence sequence) { - // FIXME(peterssen): Do check. - return Validation.validTypeDescriptor(sequence, true) ? sequence : null; - } - - public static String checkType(String type) { - // FIXME(peterssen): Do check. - if (type.length() <= 0) { - throw new IllegalStateException(type); - } - return type; - } - public static String binaryName(Symbol type) { if (isArray(type)) { return type.toString().replace('/', '.'); @@ -350,19 +345,46 @@ public static String binaryName(Symbol type) { @SuppressWarnings("unchecked") public static Symbol fromSymbol(Symbol symbol) { - Symbol type = (Symbol) symbol; - assert isValid(type) : "Type validity should have been checked beforehand"; - return type; + ErrorUtil.guarantee(Validation.validTypeDescriptor(symbol, true), "invalid type"); + return (Symbol) symbol; + } + + @SuppressWarnings("unchecked") + public static Symbol fromSymbolUnsafe(Symbol symbol) { + assert Validation.validTypeDescriptor(symbol, true) : symbol; + return (Symbol) symbol; } - public Symbol fromName(Symbol name) { + @SuppressWarnings("unchecked") + public static Symbol fromDescriptorUnsafe(Symbol descriptor) { + assert Validation.validTypeDescriptor(descriptor, true) : descriptor; + return (Symbol) descriptor; + } + + /** + * Converts a name symbol, as appear in constant pool entries to a type symbol. For historical + * reasons, class name entries are not in internal form. For classes, the class name entry is + * {@code java/lang/Thread} instead of {@code Ljava/lang/Thread;}. For arrays, the class name is + * already in internal form. Primitives are not allowed. + */ + public Symbol fromClassNameEntry(Symbol name) { + ErrorUtil.guarantee(Validation.validClassNameEntry(name), "invalid class name entry"); + ErrorUtil.guarantee(!isPrimitive(name), "unexpected primitive name"); if (name.byteAt(0) == '[') { - // TODO(peterssen): Verify . or / separators. return fromSymbol(name); } return symbols.symbolify(nameToType(name)); } + public Symbol fromClassNameEntryUnsafe(Symbol name) { + assert Validation.validClassNameEntry(name) : name; + assert !isPrimitive(name) : name; + if (name.byteAt(0) == '[') { + return fromSymbolUnsafe(name); + } + return symbols.symbolify(nameToType(name)); + } + public static ByteSequence nameToType(ByteSequence name) { if (name.byteAt(0) == '[') { assert Validation.validTypeDescriptor(name, true) : "Type validity should have been checked beforehand: " + name; @@ -373,28 +395,10 @@ public static ByteSequence nameToType(ByteSequence name) { bytes[0] = 'L'; bytes[bytes.length - 1] = ';'; ByteSequence wrap = ByteSequence.wrap(bytes); - assert checkType(wrap) != null : "Type validity should have been checked beforehand: " + name; + assert Validation.validTypeDescriptor(wrap, true) : wrap; return wrap; } - public Symbol lookup(String type) { - return symbols.lookup(checkType(type)); - } - - public Symbol lookupName(Symbol name) { - if (!validClassNameEntry(name)) { - return null; - } - if (name.byteAt(0) == '[') { - return fromSymbol(name); - } - return symbols.lookup(nameToType(name)); - } - - public Symbol lookupType(ByteSequence type) { - return symbols.lookup(type); - } - public static ByteSequence getRuntimePackage(ByteSequence symbol) { if (symbol.byteAt(0) == '[') { int arrayDimensions = getArrayDimensions(symbol); diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java index 3bb07fe333f4..073e132dcc99 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/descriptors/Validation.java @@ -23,7 +23,7 @@ package com.oracle.truffle.espresso.classfile.descriptors; import com.oracle.truffle.espresso.classfile.Constants; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; public final class Validation { private Validation() { @@ -95,7 +95,7 @@ public static boolean validMethodName(ByteSequence bytes, boolean allowClinit) { } char first = (char) bytes.byteAt(0); if (first == '<') { - return bytes.contentEquals(Name._init_) || (allowClinit && bytes.contentEquals(Name._clinit_)); + return bytes.contentEquals(ParserNames._init_) || (allowClinit && bytes.contentEquals(ParserNames._clinit_)); } for (int i = 0; i < bytes.length(); ++i) { char ch = (char) bytes.byteAt(i); @@ -343,6 +343,6 @@ private static boolean validPrimitiveChar(byte ch) { } public static boolean validModifiedUTF8(ByteSequence bytes) { - return ModifiedUtf8.isValid(bytes.getUnderlyingBytes(), bytes.offset(), bytes.length()); + return ModifiedUTF8.isValid(bytes.getUnderlyingBytes(), bytes.offset(), bytes.length()); } } diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java index eaa7cf640c06..5868979373d0 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractModuleTable.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import java.util.concurrent.locks.ReadWriteLock; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public abstract class AbstractModuleTable> extends EntryTable> { public AbstractModuleTable(ReadWriteLock lock) { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java index 35b57d7b2031..4b7caaf5a8cd 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/AbstractPackageTable.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import java.util.concurrent.locks.ReadWriteLock; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public abstract class AbstractPackageTable, ME extends AbstractModuleTable.AbstractModuleEntry> extends EntryTable { public AbstractPackageTable(ReadWriteLock lock) { diff --git a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java index a8235679cefd..9bc03cf1c205 100644 --- a/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java +++ b/espresso/src/com.oracle.truffle.espresso.classfile/src/com/oracle/truffle/espresso/classfile/tables/EntryTable.java @@ -28,8 +28,8 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.function.Consumer; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; public abstract class EntryTable { private final HashMap, T> entries = new HashMap<>(); diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java index d52461b21a76..aa977733500a 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/MethodAccess.java @@ -25,9 +25,9 @@ import com.oracle.truffle.espresso.classfile.ExceptionHandler; import com.oracle.truffle.espresso.classfile.attributes.CodeAttribute; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; /** * Represents a {@link java.lang.reflect.Method}, and provides access to various runtime metadata. diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java index 88f77c897c2b..a51a98e023db 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/Named.java @@ -23,8 +23,8 @@ package com.oracle.truffle.espresso.shared.meta; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; /** * A {@link Named} object must provide a {@link #getSymbolicName() symbolic name}. diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java index 24e814227870..7c93d55c6fe4 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/RuntimeAccess.java @@ -25,7 +25,7 @@ import com.oracle.truffle.espresso.classfile.JavaVersion; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; /** * Provides access to some VM-specific capabilities, such as throwing exceptions, or obtaining the diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java index 9921734747f3..fa0db7aeb877 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/SymbolPool.java @@ -23,28 +23,29 @@ package com.oracle.truffle.espresso.shared.meta; -import com.oracle.truffle.espresso.classfile.descriptors.Names; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.NameSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; /** * Provides access to various Symbol pools. */ public interface SymbolPool { /** - * @return The {@link Names} pool. + * @return The {@link Name} pool. */ - Names getNames(); + NameSymbols getNames(); /** * @return The {@link Type} pool. */ - Types getTypes(); + TypeSymbols getTypes(); /** * @return The {@link Signature} pool. */ - Signatures getSignatures(); + SignatureSymbols getSignatures(); } diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java index fdcb6a5bb257..26717b187cee 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/meta/TypeAccess.java @@ -24,10 +24,10 @@ package com.oracle.truffle.espresso.shared.meta; import com.oracle.truffle.espresso.classfile.ConstantPool; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.shared.resolver.LinkResolver; /** diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java index e40f36098377..67c74759ff30 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/resolver/LinkResolver.java @@ -22,10 +22,10 @@ */ package com.oracle.truffle.espresso.shared.resolver; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.shared.meta.ErrorType; import com.oracle.truffle.espresso.shared.meta.FieldAccess; import com.oracle.truffle.espresso.shared.meta.MethodAccess; diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java index 3fa9b13d65f0..4f9493049d36 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/MethodVerifier.java @@ -261,12 +261,14 @@ import com.oracle.truffle.espresso.classfile.constantpool.InvokeDynamicConstant; import com.oracle.truffle.espresso.classfile.constantpool.MemberRefConstant; import com.oracle.truffle.espresso.classfile.constantpool.MethodRefConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; import com.oracle.truffle.espresso.shared.meta.FieldAccess; @@ -546,7 +548,7 @@ private MethodVerifier(R runtime, CodeAttribute codeAttribute, M m, boolean useS jlThrowable = new ReferenceOperand<>(knownTypes.java_lang_Throwable()); thisOperand = new ReferenceOperand<>(thisKlass); - returnOperand = kindToOperand(Signatures.returnType(sig)); + returnOperand = kindToOperand(SignatureSymbols.returnType(sig)); } private MethodVerifier(R runtime, CodeAttribute codeAttribute, M m) { @@ -1549,7 +1551,7 @@ private int verify(int bci, OperandStack stack, Locals l case RETURN: verifyGuarantee(returnOperand == voidOp, "Encountered RETURN, but method return type is not void: " + returnOperand); // Only j.l.Object. can omit calling another initializer. - if (isInstanceInit(methodName) && thisKlass.getSymbolicType() != Type.java_lang_Object) { + if (isInstanceInit(methodName) && thisKlass.getSymbolicType() != ParserTypes.java_lang_Object) { verifyGuarantee(calledConstructor, "Did not call super() or this() in constructor " + thisKlass.getJavaName() + "." + methodName); } return bci; @@ -1635,18 +1637,18 @@ private Symbol getTypeFromPool(int c, String s) { validateOrFailVerification(pc, pool); ClassConstant.ImmutableClassConstant cc = (ClassConstant.ImmutableClassConstant) pc; assert Validation.validClassNameEntry(cc.getName(pool)); - return runtime.getSymbolPool().getTypes().fromName(cc.getName(pool)); + return runtime.getSymbolPool().getTypes().fromClassNameEntry(cc.getName(pool)); } private void verifyMultiNewArray(int bci, OperandStack stack) { // Check CP validity Symbol type = getTypeFromPool(code.readCPI(bci), "Invalid CP constant for MULTIANEWARRAY: "); - verifyGuarantee(Types.isArray(type), "Class " + type + " for MULTINEWARRAY is not an array type."); + verifyGuarantee(TypeSymbols.isArray(type), "Class " + type + " for MULTINEWARRAY is not an array type."); // Check dimensions int dim = code.readUByte(bci + 3); verifyGuarantee(dim > 0, "Negative or 0 dimension for MULTIANEWARRAY: " + dim); - verifyGuarantee(Types.getArrayDimensions(type) >= dim, "Incompatible dimensions from constant pool: " + Types.getArrayDimensions(type) + " and instruction: " + dim); + verifyGuarantee(TypeSymbols.getArrayDimensions(type) >= dim, "Incompatible dimensions from constant pool: " + TypeSymbols.getArrayDimensions(type) + " and instruction: " + dim); // Pop lengths for (int i = 0; i < dim; i++) { @@ -1663,7 +1665,7 @@ private void verifyInstanceOf(int bci, OperandStack stack) { // Check CP validity Symbol type = getTypeFromPool(code.readCPI(bci), "Invalid CP constant for INSTANCEOF: "); - verifyGuarantee(!Types.isPrimitive(type), "Primitive type for INSTANCEOF: " + type); + verifyGuarantee(!TypeSymbols.isPrimitive(type), "Primitive type for INSTANCEOF: " + type); // push result stack.pushInt(); @@ -1676,7 +1678,7 @@ private void verifyCheckCast(int bci, OperandStack stack) { // Check CP validity int cpi = code.readCPI(bci); Symbol type = getTypeFromPool(cpi, "Invalid CP constant for CHECKCAST: "); - verifyGuarantee(!Types.isPrimitive(type), "Primitive type for CHECKCAST: " + type); + verifyGuarantee(!TypeSymbols.isPrimitive(type), "Primitive type for CHECKCAST: " + type); // push new type Operand castOp = spawnFromType(type, cpi); @@ -1691,7 +1693,7 @@ private void verifyNewObjectArray(int bci, OperandStack stack) { // Check CP validity int cpi = code.readCPI(bci); Symbol type = getTypeFromPool(cpi, "Invalid CP constant for ANEWARRAY: "); - verifyGuarantee(!Types.isPrimitive(type), "Primitive type for ANEWARRAY: " + type); + verifyGuarantee(!TypeSymbols.isPrimitive(type), "Primitive type for ANEWARRAY: " + type); // Pop length stack.popInt(); @@ -1720,7 +1722,7 @@ private void verifyNewPrimitiveArray(int bci, OperandStack stack) { private void verifyNew(int bci, OperandStack stack) { // Check CP validity Symbol type = getTypeFromPool(code.readCPI(bci), "Invalid CP constant for NEW: "); - verifyGuarantee(!Types.isPrimitive(type) && !Types.isArray(type), "use NEWARRAY for creating array or primitive type: " + type); + verifyGuarantee(!TypeSymbols.isPrimitive(type) && !TypeSymbols.isArray(type), "use NEWARRAY for creating array or primitive type: " + type); // push result Operand op = new UninitReferenceOperand<>(type, bci); @@ -1743,7 +1745,7 @@ private void verifyPutField(int bci, OperandStack stack, int curOpco if (curOpcode == PUTFIELD) { // Pop and check verifier assert Validation.validClassNameEntry(frc.getHolderKlassName(pool)); - Symbol fieldHolderType = runtime.getSymbolPool().getTypes().fromName(frc.getHolderKlassName(pool)); + Symbol fieldHolderType = runtime.getSymbolPool().getTypes().fromClassNameEntry(frc.getHolderKlassName(pool)); Operand fieldHolder = kindToOperand(fieldHolderType); Operand receiver = checkInitAccess(stack.popRef(fieldHolder), fieldHolder); verifyGuarantee(!receiver.isArrayType(), "Trying to access field of an array type: " + receiver); @@ -1766,7 +1768,7 @@ private void verifyGetField(int bci, OperandStack stack, int curOpco if (curOpcode == GETFIELD) { // Pop and check receiver assert Validation.validClassNameEntry(frc.getHolderKlassName(pool)); - Symbol fieldHolderType = runtime.getSymbolPool().getTypes().fromName(frc.getHolderKlassName(pool)); + Symbol fieldHolderType = runtime.getSymbolPool().getTypes().fromClassNameEntry(frc.getHolderKlassName(pool)); Operand fieldHolder = kindToOperand(fieldHolderType); Operand receiver = checkInitAccess(stack.popRef(fieldHolder), fieldHolder); checkProtectedMember(receiver, fieldHolderType, frc, false); @@ -1870,11 +1872,11 @@ private MethodRefConstant.Indexes getMethodRefConstant(int bci) { } private static boolean isClassInit(Symbol calledMethodName) { - return Name._clinit_.equals(calledMethodName); + return ParserNames._clinit_.equals(calledMethodName); } private static boolean isInstanceInit(Symbol calledMethodName) { - return Name._init_.equals(calledMethodName); + return ParserNames._init_.equals(calledMethodName); } private Operand popSignatureGetReturnOp(OperandStack stack, MethodRefConstant.Indexes mrc) { @@ -1927,7 +1929,7 @@ private void verifyInvokeInterface(int bci, OperandStack stack) { verifyGuarantee(count == descCount, "Inconsistent redundant argument count for INVOKEINTERFACE."); assert Validation.validClassNameEntry(mrc.getHolderKlassName(pool)); - Symbol methodHolder = runtime.getSymbolPool().getTypes().fromName(mrc.getHolderKlassName(pool)); + Symbol methodHolder = runtime.getSymbolPool().getTypes().fromClassNameEntry(mrc.getHolderKlassName(pool)); Operand methodHolderOp = kindToOperand(methodHolder); @@ -1979,13 +1981,13 @@ private void verifyInvokeSpecial(int bci, OperandStack stack, Locals Operand returnOp = popSignatureGetReturnOp(stack, mrc); assert Validation.validClassNameEntry(mrc.getHolderKlassName(pool)); - Symbol methodHolder = runtime.getSymbolPool().getTypes().fromName(mrc.getHolderKlassName(pool)); + Symbol methodHolder = runtime.getSymbolPool().getTypes().fromClassNameEntry(mrc.getHolderKlassName(pool)); Operand methodHolderOp = kindToOperand(methodHolder); if (isInstanceInit(calledMethodName)) { UninitReferenceOperand toInit = (UninitReferenceOperand) stack.popUninitRef(methodHolderOp); if (toInit.isUninitThis()) { - verifyGuarantee(Name._init_.equals(methodName), "Encountered UninitializedThis outside of Constructor: " + toInit); + verifyGuarantee(ParserNames._init_.equals(methodName), "Encountered UninitializedThis outside of Constructor: " + toInit); boolean isValidInitThis = toInit.getType() == methodHolder || // Here, the superKlass cannot be null, as the j.l.Object case would // have been handled by the previous check. @@ -2042,7 +2044,7 @@ private void verifyInvokeVirtual(int bci, OperandStack stack) { Operand returnOp = popSignatureGetReturnOp(stack, mrc); assert Validation.validClassNameEntry(mrc.getHolderKlassName(pool)); - Symbol methodHolder = runtime.getSymbolPool().getTypes().fromName(mrc.getHolderKlassName(pool)); + Symbol methodHolder = runtime.getSymbolPool().getTypes().fromClassNameEntry(mrc.getHolderKlassName(pool)); Operand methodHolderOp = kindToOperand(methodHolder); Operand stackOp = checkInit(stack.popRef(methodHolderOp)); @@ -2210,9 +2212,9 @@ private void checkProtectedMember(Operand stackOp, Symbol hold if (member == null || !member.isProtected()) { return; } - if (!thisKlass.getSymbolicRuntimePackage().contentEquals(Types.getRuntimePackage(holderType))) { + if (!thisKlass.getSymbolicRuntimePackage().contentEquals(TypeSymbols.getRuntimePackage(holderType))) { if (method) { - if (stackOp.isArrayType() && Type.java_lang_Object.equals(holderType) && Name.clone.equals(member.getSymbolicName())) { + if (stackOp.isArrayType() && ParserTypes.java_lang_Object.equals(holderType) && ParserNames.clone.equals(member.getSymbolicName())) { // Special case: Arrays pretend to implement Object.clone(). return; } @@ -2286,7 +2288,7 @@ private Operand[] getOperandSig(Symbol toParse) { */ private Operand kindToOperand(Symbol type) { // @formatter:off - switch (Types.getJavaKind(type)) { + switch (TypeSymbols.getJavaKind(type)) { case Boolean: return booleanOperand; case Byte : return byteOp; case Short : return shortOp; @@ -2304,8 +2306,8 @@ private Operand kindToOperand(Symbol type) { } private Operand spawnFromType(Symbol type, int cpi) { - if (Types.isArray(type)) { - return new ArrayOperand<>(kindToOperand(runtime.getSymbolPool().getTypes().getElementalType(type)), Types.getArrayDimensions(type)); + if (TypeSymbols.isArray(type)) { + return new ArrayOperand<>(kindToOperand(runtime.getSymbolPool().getTypes().getElementalType(type)), TypeSymbols.getArrayDimensions(type)); } else { return new ReferenceOperand<>(type, cpi); } @@ -2404,11 +2406,11 @@ public String toExternalString() { return getThisKlass().getHostType() + "." + getMethodName(); } - private Types getTypes() { + private TypeSymbols getTypes() { return runtime.getSymbolPool().getTypes(); } - private Signatures getSignatures() { + private SignatureSymbols getSignatures() { return runtime.getSymbolPool().getSignatures(); } } diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java index 7db094e417de..227ee6c59855 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/Operand.java @@ -22,6 +22,7 @@ */ package com.oracle.truffle.espresso.shared.verifier; +import static com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; import static com.oracle.truffle.espresso.shared.verifier.MethodVerifier.failNoClassDefFound; import static com.oracle.truffle.espresso.shared.verifier.MethodVerifier.failVerify; import static com.oracle.truffle.espresso.shared.verifier.VerifierError.fatal; @@ -30,7 +31,7 @@ import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.shared.meta.ClassLoadingException; import com.oracle.truffle.espresso.shared.meta.FieldAccess; import com.oracle.truffle.espresso.shared.meta.MethodAccess; @@ -280,7 +281,7 @@ C getKlass(MethodVerifier methodVerifier) { @Override boolean compliesWith(Operand other, MethodVerifier methodVerifier) { if (other.isReference()) { - if (type == null || other.getType() == Type.java_lang_Object) { + if (type == null || other.getType() == ParserTypes.java_lang_Object) { return true; } if (other.getType() == null) { @@ -372,17 +373,17 @@ final class ArrayOperand, C extends TypeAccess< boolean compliesWith(Operand other, MethodVerifier methodVerifier) { if (other.isArrayType()) { if (other.getDimensions() < getDimensions()) { - return other.getElemental().isReference() && (other.getElemental().getType() == Type.java_lang_Object || - other.getElemental().getType() == Type.java_lang_Cloneable || - other.getElemental().getType() == Type.java_io_Serializable); + return other.getElemental().isReference() && (other.getElemental().getType() == ParserTypes.java_lang_Object || + other.getElemental().getType() == ParserTypes.java_lang_Cloneable || + other.getElemental().getType() == ParserTypes.java_io_Serializable); } else if (other.getDimensions() == getDimensions()) { return elemental.compliesWith(other.getElemental(), methodVerifier); } return false; } - return (other.isTopOperand()) || (other.isReference() && (other.getType() == Type.java_lang_Object || - other.getType() == Type.java_lang_Cloneable || - other.getType() == Type.java_io_Serializable)); + return (other.isTopOperand()) || (other.isReference() && (other.getType() == ParserTypes.java_lang_Object || + other.getType() == ParserTypes.java_lang_Cloneable || + other.getType() == ParserTypes.java_io_Serializable)); } @Override @@ -431,7 +432,7 @@ Operand mergeWith(Operand other, MethodVerifier Object[] return new ArrayOperand<>(methodVerifier.jlObject, newDim - 1); } - if (smallestElemental.getType() == Type.java_lang_Cloneable || smallestElemental.getType() == Type.java_io_Serializable) { + if (smallestElemental.getType() == ParserTypes.java_lang_Cloneable || smallestElemental.getType() == ParserTypes.java_io_Serializable) { // example: (Cloneable[][] U _[][][]) -> Cloneable[][] return new ArrayOperand<>(smallestElemental, newDim); } diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java index 2a26d4257053..0fc20a80292a 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/StackFrame.java @@ -26,7 +26,7 @@ import static com.oracle.truffle.espresso.shared.verifier.MethodVerifier.formatGuarantee; import static com.oracle.truffle.espresso.shared.verifier.MethodVerifier.verifyGuarantee; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserNames; import com.oracle.truffle.espresso.shared.meta.FieldAccess; import com.oracle.truffle.espresso.shared.meta.MethodAccess; import com.oracle.truffle.espresso.shared.meta.RuntimeAccess; @@ -474,7 +474,7 @@ final class Locals, C extends TypeAccess(mv.getThisKlass()); } else { registers[index++] = new ReferenceOperand<>(mv.getThisKlass()); diff --git a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java index ac9bc8c0175b..5458325357e8 100644 --- a/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java +++ b/espresso/src/com.oracle.truffle.espresso.shared/src/com/oracle/truffle/espresso/shared/verifier/VerificationTypeInfo.java @@ -36,9 +36,10 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols.ParserTypes; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; public abstract class VerificationTypeInfo { @@ -80,7 +81,7 @@ public String toString(ConstantPool pool) { * ({@code null}, {@code illegal} or {@code uninitializedThis}), this method will throw a * {@link VerifierError}. */ - public abstract Symbol getType(ConstantPool pool, Types types, BytecodeStream bs); + public abstract Symbol getType(ConstantPool pool, TypeSymbols types, BytecodeStream bs); public final boolean hasType() { return !isNull() && !isIllegal() && !isUninitializedThis(); @@ -146,16 +147,16 @@ static VerificationTypeInfo get(int tag) { } @Override - public Symbol getType(ConstantPool pool, Types types, BytecodeStream bs) { + public Symbol getType(ConstantPool pool, TypeSymbols types, BytecodeStream bs) { switch (tag) { case ITEM_Integer: - return Type._int; + return ParserTypes._int; case ITEM_Float: - return Type._float; + return ParserTypes._float; case ITEM_Double: - return Type._double; + return ParserTypes._double; case ITEM_Long: - return Type._long; + return ParserTypes._long; case ITEM_Null: // fall through case ITEM_Bogus: // fall through default: @@ -196,7 +197,7 @@ protected String fromCP(ConstantPool pool) { } @Override - public Symbol getType(ConstantPool pool, Types types, BytecodeStream bs) { + public Symbol getType(ConstantPool pool, TypeSymbols types, BytecodeStream bs) { throw fatal("newThis.getType() called."); } @@ -229,8 +230,8 @@ protected String fromCP(ConstantPool pool) { } @Override - public Symbol getType(ConstantPool pool, Types types, BytecodeStream bs) { - return types.fromName(pool.classAt(bs.readCPI(getNewOffset())).getName(pool)); + public Symbol getType(ConstantPool pool, TypeSymbols types, BytecodeStream bs) { + return types.fromClassNameEntry(pool.classAt(bs.readCPI(getNewOffset())).getName(pool)); } } @@ -258,7 +259,7 @@ protected String fromCP(ConstantPool pool) { } @Override - public Symbol getType(ConstantPool pool, Types types, BytecodeStream bs) { - return types.fromName(pool.classAt(getConstantPoolOffset()).getName(pool)); + public Symbol getType(ConstantPool pool, TypeSymbols types, BytecodeStream bs) { + return types.fromClassNameEntry(pool.classAt(getConstantPoolOffset()).getName(pool)); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoLanguage.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoLanguage.java index 6ddee61ce777..08dd16986858 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoLanguage.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoLanguage.java @@ -61,15 +61,13 @@ import com.oracle.truffle.api.staticobject.StaticShape; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.JavaVersion; -import com.oracle.truffle.espresso.classfile.descriptors.Names; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; -import com.oracle.truffle.espresso.classfile.descriptors.StaticSymbols; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.NameSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbols; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Utf8ConstantTable; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols; import com.oracle.truffle.espresso.impl.EspressoType; import com.oracle.truffle.espresso.impl.SuppressFBWarnings; import com.oracle.truffle.espresso.meta.EspressoError; @@ -118,9 +116,9 @@ public final class EspressoLanguage extends TruffleLanguage imp public static final String FILE_EXTENSION = ".class"; @CompilationFinal private Utf8ConstantTable utf8Constants; - @CompilationFinal private Names names; - @CompilationFinal private Types types; - @CompilationFinal private Signatures signatures; + @CompilationFinal private NameSymbols nameSymbols; + @CompilationFinal private TypeSymbols typeSymbols; + @CompilationFinal private SignatureSymbols signatureSymbols; private final StaticProperty arrayProperty = new DefaultStaticProperty("array"); // This field should be final, but creating a shape requires a fully-initialized instance of @@ -170,19 +168,18 @@ public final class EspressoLanguage extends TruffleLanguage imp public EspressoLanguage() { // Initialize statically defined symbols and substitutions. + // Initialization order is very fragile. + ParserSymbols.ensureInitialized(); JavaKind.ensureInitialized(); - Name.ensureInitialized(); - Type.ensureInitialized(); - Signature.ensureInitialized(); Substitutions.ensureInitialized(); - + EspressoSymbols.ensureInitialized(); // Raw symbols are not exposed directly, use the typed interfaces: Names, Types and // Signatures instead. - Symbols symbols = new Symbols(StaticSymbols.freeze()); + Symbols symbols = new Symbols(EspressoSymbols.SYMBOLS.freeze()); this.utf8Constants = new Utf8ConstantTable(symbols); - this.names = new Names(symbols); - this.types = new Types(symbols); - this.signatures = new Signatures(symbols, types); + this.nameSymbols = new NameSymbols(symbols); + this.typeSymbols = new TypeSymbols(symbols); + this.signatureSymbols = new SignatureSymbols(symbols, typeSymbols); } @Override @@ -304,9 +301,9 @@ protected void initializeContext(final EspressoContext context) throws Exception private void extractDataFrom(EspressoLanguage other) { javaVersion = other.javaVersion; utf8Constants = other.getUtf8ConstantTable(); - names = other.getNames(); - types = other.getTypes(); - signatures = other.getSignatures(); + nameSymbols = other.getNames(); + typeSymbols = other.getTypes(); + signatureSymbols = other.getSignatures(); languageCache.importFrom(other.getLanguageCache()); } @@ -434,18 +431,18 @@ public Utf8ConstantTable getUtf8ConstantTable() { } @Override - public Names getNames() { - return names; + public NameSymbols getNames() { + return nameSymbols; } @Override - public Types getTypes() { - return types; + public TypeSymbols getTypes() { + return typeSymbols; } @Override - public Signatures getSignatures() { - return signatures; + public SignatureSymbols getSignatures() { + return signatureSymbols; } @Override diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoScope.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoScope.java index d20b6afc5baa..2edec110088f 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoScope.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/EspressoScope.java @@ -43,6 +43,7 @@ import com.oracle.truffle.api.library.ExportMessage; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.attributes.Local; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.nodes.EspressoFrame; @@ -50,7 +51,7 @@ public final class EspressoScope { - public static Object createVariables(Local[] liveLocals, Frame frame, Symbol scopeName) { + public static Object createVariables(Local[] liveLocals, Frame frame, Symbol scopeName) { int slotCount = liveLocals.length; Map slotsMap; Map identifiersMap; @@ -87,9 +88,9 @@ static final class VariablesMapObject implements TruffleObject { final Map slots; final Map identifiers; final Frame frame; - final Symbol scopeName; + final Symbol scopeName; - private VariablesMapObject(Map slots, Map identifiers, Frame frame, Symbol scopeName) { + private VariablesMapObject(Map slots, Map identifiers, Frame frame, Symbol scopeName) { this.slots = slots; this.identifiers = identifiers; this.frame = frame; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/EspressoFrameDescriptor.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/EspressoFrameDescriptor.java index 3210a853571e..9df9c8c883f4 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/EspressoFrameDescriptor.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/EspressoFrameDescriptor.java @@ -36,7 +36,7 @@ import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.meta.EspressoError; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameAnalysis.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameAnalysis.java index 274bcd4a20ec..6f0e12d4ee23 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameAnalysis.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameAnalysis.java @@ -243,11 +243,12 @@ import com.oracle.truffle.espresso.classfile.bytecode.BytecodeSwitch; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; import com.oracle.truffle.espresso.classfile.constantpool.DynamicConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -317,8 +318,8 @@ private FrameAnalysis(int targetBci, Method.MethodVersion m, LivenessAnalysis la } private static void popSignature(Symbol[] sig, boolean isStatic, Builder frame) { - for (Symbol t : Signatures.iterable(sig, true, false)) { - JavaKind k = Types.getJavaKind(t).getStackKind(); + for (Symbol t : SignatureSymbols.iterable(sig, true, false)) { + JavaKind k = TypeSymbols.getJavaKind(t).getStackKind(); frame.pop(k); } if (!isStatic) { @@ -388,8 +389,8 @@ private void buildInitialFrames() { receiverShift = 1; } int localPos = 0; - for (int sigPos = 0; sigPos < Signatures.parameterCount(sig); sigPos++) { - Symbol type = Signatures.parameterType(sig, sigPos); + for (int sigPos = 0; sigPos < SignatureSymbols.parameterCount(sig); sigPos++) { + Symbol type = SignatureSymbols.parameterType(sig, sigPos); FrameType ft; ft = FrameType.forType(type); frame.putLocal(receiverShift + localPos, ft); @@ -742,7 +743,7 @@ private void buildStates(int startBci) { } case PUTSTATIC, PUTFIELD: { Symbol type = queryPoolType(bs.readCPI(bci), ConstantPool.Tag.FIELD_REF); - if (Types.getJavaKind(type).needsTwoSlots()) { + if (TypeSymbols.getJavaKind(type).needsTwoSlots()) { frame.pop2(); } else { frame.pop(); @@ -805,21 +806,21 @@ private void buildStates(int startBci) { private static FrameType newPrimitiveArray(byte b) { switch (b) { case Constants.JVM_ArrayType_Boolean: - return FrameType.forType(Type._boolean_array); + return FrameType.forType(Types._boolean_array); case Constants.JVM_ArrayType_Char: - return FrameType.forType(Type._char_array); + return FrameType.forType(Types._char_array); case Constants.JVM_ArrayType_Float: - return FrameType.forType(Type._float_array); + return FrameType.forType(Types._float_array); case Constants.JVM_ArrayType_Double: - return FrameType.forType(Type._double_array); + return FrameType.forType(Types._double_array); case Constants.JVM_ArrayType_Byte: - return FrameType.forType(Type._byte_array); + return FrameType.forType(Types._byte_array); case Constants.JVM_ArrayType_Short: - return FrameType.forType(Type._short_array); + return FrameType.forType(Types._short_array); case Constants.JVM_ArrayType_Int: - return FrameType.forType(Type._int_array); + return FrameType.forType(Types._int_array); case Constants.JVM_ArrayType_Long: - return FrameType.forType(Type._long_array); + return FrameType.forType(Types._long_array); default: throw EspressoError.shouldNotReachHere(); } @@ -828,8 +829,8 @@ private static FrameType newPrimitiveArray(byte b) { private void handleInvoke(Builder frame, int bci, int opcode, boolean pushResult, ConstantPool.Tag tag) { Symbol[] sig = queryPoolSignature(bs.readCPI(bci), tag); popSignature(sig, opcode == INVOKESTATIC || opcode == INVOKEDYNAMIC, frame); - if (pushResult && Signatures.returnKind(sig) != JavaKind.Void) { - frame.push(FrameType.forType(Signatures.returnType(sig))); + if (pushResult && SignatureSymbols.returnKind(sig) != JavaKind.Void) { + frame.push(FrameType.forType(SignatureSymbols.returnType(sig))); } } @@ -865,16 +866,16 @@ private void ldc(int bci, Builder frame) { frame.push(FrameType.DOUBLE); break; case CLASS: - frame.push(FrameType.forType(Type.java_lang_Class)); + frame.push(FrameType.forType(Types.java_lang_Class)); break; case STRING: - frame.push(FrameType.forType(Type.java_lang_String)); + frame.push(FrameType.forType(Types.java_lang_String)); break; case METHODHANDLE: - frame.push(FrameType.forType(Type.java_lang_invoke_MethodHandle)); + frame.push(FrameType.forType(Types.java_lang_invoke_MethodHandle)); break; case METHODTYPE: - frame.push(FrameType.forType(Type.java_lang_invoke_MethodType)); + frame.push(FrameType.forType(Types.java_lang_invoke_MethodType)); break; case DYNAMIC: { Symbol t = ((DynamicConstant.Indexes) pool.at(cpi)).getTypeSymbol(pool); @@ -979,7 +980,7 @@ private Symbol queryPoolType(int cpi, ConstantPool.Tag tag) { if (pool.isResolutionSuccessAt(cpi)) { return pool.resolvedKlassAt(m.getDeclaringKlass(), cpi).getType(); } - return lang.getTypes().fromName(pool.classAt(cpi).getName(pool)); + return lang.getTypes().fromClassNameEntry(pool.classAt(cpi).getName(pool)); case FIELD_REF: if (pool.isResolutionSuccessAt(cpi)) { return pool.resolvedFieldAt(m.getDeclaringKlass(), cpi).getType(); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameType.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameType.java index 581456eb6ad0..ec903bcd0226 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameType.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/frame/FrameType.java @@ -25,8 +25,9 @@ import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.meta.EspressoError; public abstract class FrameType { @@ -38,7 +39,7 @@ public abstract class FrameType { public static final FrameType ILLEGAL = new IllegalFrameType(); public static final FrameType NULL = new NullFrameType(); - public static final FrameType THROWABLE = new TypedFrameType(Type.java_lang_Throwable); + public static final FrameType THROWABLE = new TypedFrameType(Types.java_lang_Throwable); private final JavaKind kind; @@ -62,8 +63,8 @@ public boolean isNull() { public static FrameType forType(Symbol type) { assert type != null; - if (Types.isPrimitive(type)) { - return forPrimitive(Types.getJavaKind(type).getStackKind()); + if (TypeSymbols.isPrimitive(type)) { + return forPrimitive(TypeSymbols.getJavaKind(type).getStackKind()); } return forRefType(type); } @@ -173,7 +174,7 @@ public boolean isReference() { final class NullFrameType extends ReferenceFrameType { @Override public Symbol type() { - return Type.java_lang_Object; + return Types.java_lang_Object; } @Override diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/hierarchy/DefaultClassHierarchyOracle.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/hierarchy/DefaultClassHierarchyOracle.java index 1d48904e29b7..b08818a519cc 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/hierarchy/DefaultClassHierarchyOracle.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/hierarchy/DefaultClassHierarchyOracle.java @@ -23,7 +23,7 @@ package com.oracle.truffle.espresso.analysis.hierarchy; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -161,7 +161,7 @@ private void updateLeafAssumptions(Method.MethodVersion[] itable, ObjectKlass cu @Override public SingleImplementor initializeImplementorForNewKlass(ObjectKlass klass) { // java.io.Serializable and java.lang.Cloneable are always implemented by all arrays - if (klass.getType() == Symbol.Type.java_io_Serializable || klass.getType() == Symbol.Type.java_lang_Cloneable) { + if (klass.getType() == Types.java_io_Serializable || klass.getType() == Types.java_lang_Cloneable) { return SingleImplementor.MultipleImplementors; } if (klass.isAbstract() || klass.isInterface()) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/liveness/LivenessAnalysis.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/liveness/LivenessAnalysis.java index e0a264ce69fe..2285a9dfb03b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/liveness/LivenessAnalysis.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/analysis/liveness/LivenessAnalysis.java @@ -46,10 +46,10 @@ import com.oracle.truffle.espresso.analysis.liveness.actions.MultiAction; import com.oracle.truffle.espresso.analysis.liveness.actions.NullOutAction; import com.oracle.truffle.espresso.analysis.liveness.actions.SelectEdgeAction; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugTimer; import com.oracle.truffle.espresso.classfile.perf.TimerCollection; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.EspressoError; @@ -244,7 +244,7 @@ private static boolean enableLivenessAnalysis(EspressoOptions.LivenessAnalysisMo private static boolean isExempt(Method m) { if ((m.getDeclaringKlass() == m.getMeta().java_security_AccessController && - m.getName() == Symbol.Name.executePrivileged) || m.isScoped()) { + m.getName() == Names.executePrivileged) || m.isScoped()) { // Special case: // Frame locals inspection is necessary for access control. return true; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/CallSiteLink.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/CallSiteLink.java index f5a2f80ac166..46afa328475f 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/CallSiteLink.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/CallSiteLink.java @@ -24,7 +24,7 @@ import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/Resolution.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/Resolution.java index 07d6b470bbc0..f850a8c72c31 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/Resolution.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/Resolution.java @@ -44,13 +44,14 @@ import com.oracle.truffle.espresso.classfile.constantpool.MethodTypeConstant; import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; @@ -114,7 +115,7 @@ public static ResolvedClassConstant resolveClassConstant(ClassConstant.Index thi Symbol klassName = thiz.getName(pool); try { EspressoContext context = pool.getContext(); - Symbol type = context.getTypes().fromName(klassName); + Symbol type = context.getTypes().fromClassNameEntry(klassName); Klass klass = context.getMeta().resolveSymbolOrFail(type, accessingKlass.getDefiningClassLoader(), accessingKlass.protectionDomain()); Klass checkedKlass = klass.getElementalType(); if (!Klass.checkAccess(checkedKlass, accessingKlass, false)) { @@ -176,7 +177,7 @@ public static ResolvedClassConstant resolveClassConstant(ClassConstant.WithStrin try { EspressoContext context = pool.getContext(); Meta meta = context.getMeta(); - Klass klass = meta.resolveSymbolOrFail(context.getTypes().fromName(klassName), accessingKlass.getDefiningClassLoader(), accessingKlass.protectionDomain()); + Klass klass = meta.resolveSymbolOrFail(context.getTypes().fromClassNameEntryUnsafe(klassName), accessingKlass.getDefiningClassLoader(), accessingKlass.protectionDomain()); if (!Klass.checkAccess(klass.getElementalType(), accessingKlass, false)) { context.getLogger().log(Level.FINE, "Access check of: " + klass.getType() + " from " + accessingKlass.getType() + " throws IllegalAccessError"); @@ -249,7 +250,7 @@ public static boolean memberCheckAccess(Klass accessingKlass, Klass resolvedKlas return true; } Klass memberKlass = member.getDeclaringKlass(); - if (member instanceof Method && Name.clone.equals(member.getName()) && memberKlass.isJavaLangObject()) { + if (member instanceof Method && Names.clone.equals(member.getName()) && memberKlass.isJavaLangObject()) { if (resolvedKlass.isArray()) { return true; } @@ -482,14 +483,14 @@ public static Resolvable.ResolvedConstant resolveClassMethodRefConstant(ClassMet } public static StaticObject signatureToMethodType(Symbol[] signature, ObjectKlass accessingKlass, boolean failWithBME, Meta meta) { - Symbol rt = Signatures.returnType(signature); - int pcount = Signatures.parameterCount(signature); + Symbol rt = SignatureSymbols.returnType(signature); + int pcount = SignatureSymbols.parameterCount(signature); StaticObject[] ptypes = new StaticObject[pcount]; StaticObject rtype; try { for (int i = 0; i < pcount; i++) { - Symbol paramType = Signatures.parameterType(signature, i); + Symbol paramType = SignatureSymbols.parameterType(signature, i); ptypes[i] = meta.resolveSymbolAndAccessCheck(paramType, accessingKlass).mirror(); } } catch (EspressoException e) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedInvokeDynamicConstant.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedInvokeDynamicConstant.java index 7b26712202f0..51ef2ab8dca5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedInvokeDynamicConstant.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedInvokeDynamicConstant.java @@ -27,9 +27,9 @@ import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.espresso.classfile.attributes.BootstrapMethodsAttribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.meta.EspressoError; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedStringConstant.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedStringConstant.java index 45551590a7cc..49079a8a3a14 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedStringConstant.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/constantpool/ResolvedStringConstant.java @@ -24,7 +24,7 @@ import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.substitutions.JavaType; @@ -32,7 +32,7 @@ public class ResolvedStringConstant implements StringConstant, Resolvable.Resolv private final @JavaType(String.class) StaticObject resolved; ResolvedStringConstant(@JavaType(String.class) StaticObject resolved) { - assert Type.java_lang_String == resolved.getKlass().getType(); + assert Types.java_lang_String == resolved.getKlass().getType(); this.resolved = resolved; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/EspressoSymbols.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/EspressoSymbols.java new file mode 100644 index 000000000000..d7a4b0ec7ddc --- /dev/null +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/EspressoSymbols.java @@ -0,0 +1,1279 @@ +/* + * Copyright (c) 2024, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.espresso.descriptors; + +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.ParserSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.StaticSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; + +public class EspressoSymbols { + + public static final StaticSymbols SYMBOLS = new StaticSymbols(ParserSymbols.SYMBOLS); + + static { + Names.ensureInitialized(); + Types.ensureInitialized(); + Signatures.ensureInitialized(); + } + + public static void ensureInitialized() { + /* nop */ + } + + /** + * Contains commonly used (type) symbols. + * + *

+ * Naming convention: Use the fully qualified type name, '_' as package separator and '$' as + * separator for inner classes.
+ * - {@link #_long}
+ * - {@link #java_lang_Object}
+ * - {@link #java_lang_String_array}
+ * - {@link #java_lang_ref_Finalizer$FinalizerThread}
+ */ + public static final class Types { + + public static void ensureInitialized() { + // Sanity check. + assert Types.java_lang_Object == ParserSymbols.ParserTypes.java_lang_Object; + } + + // Core types. + public static final Symbol java_lang_String = SYMBOLS.putType("Ljava/lang/String;"); + public static final Symbol java_lang_String_array = SYMBOLS.putType("[Ljava/lang/String;"); + public static final Symbol java_lang_CharSequence = SYMBOLS.putType("Ljava/lang/CharSequence;"); + + public static final Symbol java_lang_Object = SYMBOLS.putType("Ljava/lang/Object;"); + public static final Symbol java_lang_Object_array = SYMBOLS.putType("[Ljava/lang/Object;"); + + public static final Symbol java_lang_Class = SYMBOLS.putType("Ljava/lang/Class;"); + public static final Symbol java_lang_Class_array = SYMBOLS.putType("[Ljava/lang/Class;"); + + public static final Symbol java_lang_Enum = SYMBOLS.putType("Ljava/lang/Enum;"); + + public static final Symbol java_lang_Throwable = SYMBOLS.putType("Ljava/lang/Throwable;"); + public static final Symbol java_lang_Exception = SYMBOLS.putType("Ljava/lang/Exception;"); + public static final Symbol java_lang_System = SYMBOLS.putType("Ljava/lang/System;"); + public static final Symbol java_security_ProtectionDomain = SYMBOLS.putType("Ljava/security/ProtectionDomain;"); + public static final Symbol java_security_ProtectionDomain_array = SYMBOLS.putType("[Ljava/security/ProtectionDomain;"); + public static final Symbol java_security_AccessControlContext = SYMBOLS.putType("Ljava/security/AccessControlContext;"); + public static final Symbol java_security_AccessController = SYMBOLS.putType("Ljava/security/AccessController;"); + public static final Symbol java_lang_SecurityManager = SYMBOLS.putType("Ljava/lang/SecurityManager;"); + public static final Symbol java_security_CodeSource = SYMBOLS.putType("Ljava/security/CodeSource;"); + public static final Symbol java_security_PermissionCollection = SYMBOLS.putType("Ljava/security/PermissionCollection;"); + + public static final Symbol java_lang_ClassLoader = SYMBOLS.putType("Ljava/lang/ClassLoader;"); + public static final Symbol java_lang_ClassLoader$NativeLibrary = SYMBOLS.putType("Ljava/lang/ClassLoader$NativeLibrary;"); + public static final Symbol jdk_internal_loader_NativeLibraries = SYMBOLS.putType("Ljdk/internal/loader/NativeLibraries;"); + public static final Symbol sun_misc_Launcher$ExtClassLoader = SYMBOLS.putType("Lsun/misc/Launcher$ExtClassLoader;"); + public static final Symbol jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl = SYMBOLS.putType("Ljdk/internal/loader/RawNativeLibraries$RawNativeLibraryImpl;"); + public static final Symbol jdk_internal_util_ArraysSupport = SYMBOLS.putType("Ljdk/internal/util/ArraysSupport;"); + public static final Symbol java_io_InputStream = SYMBOLS.putType("Ljava/io/InputStream;"); + public static final Symbol java_io_PrintStream = SYMBOLS.putType("Ljava/io/PrintStream;"); + public static final Symbol java_nio_file_Path = SYMBOLS.putType("Ljava/nio/file/Path;"); + public static final Symbol java_nio_file_Path_array = SYMBOLS.putType("[Ljava/nio/file/Path;"); + public static final Symbol java_nio_file_Paths = SYMBOLS.putType("Ljava/nio/file/Paths;"); + public static final Symbol sun_nio_ch_NativeThread = SYMBOLS.putType("Lsun/nio/ch/NativeThread;"); + + public static final Symbol jdk_internal_loader_ClassLoaders = SYMBOLS.putType("Ljdk/internal/loader/ClassLoaders;"); + public static final Symbol jdk_internal_loader_ClassLoaders$PlatformClassLoader = SYMBOLS.putType("Ljdk/internal/loader/ClassLoaders$PlatformClassLoader;"); + public static final Symbol jdk_internal_loader_ClassLoaders$AppClassLoader = SYMBOLS.putType("Ljdk/internal/loader/ClassLoaders$AppClassLoader;"); + public static final Symbol sun_misc_Launcher$AppClassLoader = SYMBOLS.putType("Lsun/misc/Launcher$AppClassLoader;"); + public static final Symbol jdk_internal_module_ModuleLoaderMap = SYMBOLS.putType("Ljdk/internal/module/ModuleLoaderMap;"); + public static final Symbol jdk_internal_module_ModuleLoaderMap_Modules = SYMBOLS.putType("Ljdk/internal/module/ModuleLoaderMap$Modules;"); + public static final Symbol jdk_internal_module_SystemModuleFinders = SYMBOLS.putType("Ljdk/internal/module/SystemModuleFinders;"); + public static final Symbol jdk_internal_module_SystemModules = SYMBOLS.putType("Ljdk/internal/module/SystemModules;"); + public static final Symbol java_lang_module_ModuleFinder = SYMBOLS.putType("Ljava/lang/module/ModuleFinder;"); + public static final Symbol java_lang_module_ModuleFinder_array = SYMBOLS.putType("[Ljava/lang/module/ModuleFinder;"); + public static final Symbol jdk_internal_module_ModulePath = SYMBOLS.putType("Ljdk/internal/module/ModulePath;"); + public static final Symbol jdk_internal_module_Modules = SYMBOLS.putType("Ljdk/internal/module/Modules;"); + public static final Symbol java_lang_module_ModuleDescriptor = SYMBOLS.putType("Ljava/lang/module/ModuleDescriptor;"); + + // URL class loader + public static final Symbol java_net_URLClassLoader = SYMBOLS.putType("Ljava/net/URLClassLoader;"); + public static final Symbol java_net_URL = SYMBOLS.putType("Ljava/net/URL;"); + public static final Symbol java_net_URI = SYMBOLS.putType("Ljava/net/URI;"); + public static final Symbol java_net_URL_array = SYMBOLS.putType("[Ljava/net/URL;"); + + public static final Symbol java_beans_Introspector = SYMBOLS.putType("Ljava/beans/Introspector;"); + public static final Symbol java_beans_ThreadGroupContext = SYMBOLS.putType("Ljava/beans/ThreadGroupContext;"); + + public static final Symbol java_lang_reflect_Proxy = SYMBOLS.putType("Ljava/lang/reflect/Proxy;"); + public static final Symbol java_lang_reflect_ProxyGenerator = SYMBOLS.putType("Ljava/lang/reflect/ProxyGenerator;"); + public static final Symbol sun_misc_ProxyGenerator = SYMBOLS.putType("Lsun/misc/ProxyGenerator;"); + + // Primitive types. + public static final Symbol _boolean = SYMBOLS.putType("Z" /* boolean */); + public static final Symbol _byte = SYMBOLS.putType("B" /* byte */); + public static final Symbol _char = SYMBOLS.putType("C" /* char */); + public static final Symbol _short = SYMBOLS.putType("S" /* short */); + public static final Symbol _int = SYMBOLS.putType("I" /* int */); + public static final Symbol _float = SYMBOLS.putType("F" /* float */); + public static final Symbol _double = SYMBOLS.putType("D" /* double */); + public static final Symbol _long = SYMBOLS.putType("J" /* long */); + public static final Symbol _void = SYMBOLS.putType("V" /* void */); + + public static final Symbol _boolean_array = SYMBOLS.putType("[Z" /* boolean[] */); + public static final Symbol _byte_array = SYMBOLS.putType("[B" /* byte[] */); + public static final Symbol _char_array = SYMBOLS.putType("[C" /* char[] */); + public static final Symbol _short_array = SYMBOLS.putType("[S" /* short[] */); + public static final Symbol _int_array = SYMBOLS.putType("[I" /* int[] */); + public static final Symbol _float_array = SYMBOLS.putType("[F" /* float[] */); + public static final Symbol _double_array = SYMBOLS.putType("[D" /* double[] */); + public static final Symbol _long_array = SYMBOLS.putType("[J" /* long[] */); + + // Boxed types. + public static final Symbol java_lang_Boolean = SYMBOLS.putType("Ljava/lang/Boolean;"); + public static final Symbol java_lang_Byte = SYMBOLS.putType("Ljava/lang/Byte;"); + public static final Symbol java_lang_Character = SYMBOLS.putType("Ljava/lang/Character;"); + public static final Symbol java_lang_Short = SYMBOLS.putType("Ljava/lang/Short;"); + public static final Symbol java_lang_Integer = SYMBOLS.putType("Ljava/lang/Integer;"); + public static final Symbol java_lang_Float = SYMBOLS.putType("Ljava/lang/Float;"); + public static final Symbol java_lang_Double = SYMBOLS.putType("Ljava/lang/Double;"); + public static final Symbol java_lang_Long = SYMBOLS.putType("Ljava/lang/Long;"); + public static final Symbol java_lang_Void = SYMBOLS.putType("Ljava/lang/Void;"); + public static final Symbol java_lang_Number = SYMBOLS.putType("Ljava/lang/Number;"); + + public static final Symbol java_lang_Cloneable = SYMBOLS.putType("Ljava/lang/Cloneable;"); + + public static final Symbol java_lang_StackOverflowError = SYMBOLS.putType("Ljava/lang/StackOverflowError;"); + public static final Symbol java_lang_VirtualMachineError = SYMBOLS.putType("Ljava/lang/VirtualMachineError;"); + public static final Symbol java_lang_OutOfMemoryError = SYMBOLS.putType("Ljava/lang/OutOfMemoryError;"); + public static final Symbol java_lang_AssertionError = SYMBOLS.putType("Ljava/lang/AssertionError;"); + + public static final Symbol java_lang_NullPointerException = SYMBOLS.putType("Ljava/lang/NullPointerException;"); + public static final Symbol java_lang_ClassCastException = SYMBOLS.putType("Ljava/lang/ClassCastException;"); + public static final Symbol java_lang_ArrayStoreException = SYMBOLS.putType("Ljava/lang/ArrayStoreException;"); + public static final Symbol java_lang_ArithmeticException = SYMBOLS.putType("Ljava/lang/ArithmeticException;"); + public static final Symbol java_lang_IllegalMonitorStateException = SYMBOLS.putType("Ljava/lang/IllegalMonitorStateException;"); + public static final Symbol java_lang_IllegalArgumentException = SYMBOLS.putType("Ljava/lang/IllegalArgumentException;"); + public static final Symbol java_lang_IllegalStateException = SYMBOLS.putType("Ljava/lang/IllegalStateException;"); + public static final Symbol java_lang_ClassNotFoundException = SYMBOLS.putType("Ljava/lang/ClassNotFoundException;"); + public static final Symbol java_lang_NoClassDefFoundError = SYMBOLS.putType("Ljava/lang/NoClassDefFoundError;"); + public static final Symbol java_lang_InterruptedException = SYMBOLS.putType("Ljava/lang/InterruptedException;"); + public static final Symbol java_lang_ThreadDeath = SYMBOLS.putType("Ljava/lang/ThreadDeath;"); + public static final Symbol java_lang_NegativeArraySizeException = SYMBOLS.putType("Ljava/lang/NegativeArraySizeException;"); + public static final Symbol java_lang_RuntimeException = SYMBOLS.putType("Ljava/lang/RuntimeException;"); + public static final Symbol java_lang_IndexOutOfBoundsException = SYMBOLS.putType("Ljava/lang/IndexOutOfBoundsException;"); + public static final Symbol java_lang_ArrayIndexOutOfBoundsException = SYMBOLS.putType("Ljava/lang/ArrayIndexOutOfBoundsException;"); + public static final Symbol java_lang_StringIndexOutOfBoundsException = SYMBOLS.putType("Ljava/lang/StringIndexOutOfBoundsException;"); + public static final Symbol java_lang_ExceptionInInitializerError = SYMBOLS.putType("Ljava/lang/ExceptionInInitializerError;"); + public static final Symbol java_lang_InstantiationException = SYMBOLS.putType("Ljava/lang/InstantiationException;"); + public static final Symbol java_lang_InstantiationError = SYMBOLS.putType("Ljava/lang/InstantiationError;"); + public static final Symbol java_lang_CloneNotSupportedException = SYMBOLS.putType("Ljava/lang/CloneNotSupportedException;"); + public static final Symbol java_lang_SecurityException = SYMBOLS.putType("Ljava/lang/SecurityException;"); + public static final Symbol java_lang_LinkageError = SYMBOLS.putType("Ljava/lang/LinkageError;"); + public static final Symbol java_lang_BootstrapMethodError = SYMBOLS.putType("Ljava/lang/BootstrapMethodError;"); + public static final Symbol java_lang_NoSuchFieldException = SYMBOLS.putType("Ljava/lang/NoSuchFieldException;"); + public static final Symbol java_lang_NoSuchMethodException = SYMBOLS.putType("Ljava/lang/NoSuchMethodException;"); + public static final Symbol java_lang_UnsupportedOperationException = SYMBOLS.putType("Ljava/lang/UnsupportedOperationException;"); + public static final Symbol java_lang_UnsupportedClassVersionError = SYMBOLS.putType("Ljava/lang/UnsupportedClassVersionError;"); + public static final Symbol java_lang_reflect_InvocationTargetException = SYMBOLS.putType("Ljava/lang/reflect/InvocationTargetException;"); + public static final Symbol java_lang_NumberFormatException = SYMBOLS.putType("Ljava/lang/NumberFormatException;"); + + public static final Symbol java_lang_reflect_Type = SYMBOLS.putType("Ljava/lang/reflect/Type;"); + public static final Symbol java_lang_reflect_Type_array = SYMBOLS.putType("[Ljava/lang/reflect/Type;"); + public static final Symbol java_lang_reflect_ParameterizedType = SYMBOLS.putType("Ljava/lang/reflect/ParameterizedType;"); + + public static final Symbol java_lang_Thread = SYMBOLS.putType("Ljava/lang/Thread;"); + public static final Symbol java_lang_Thread_FieldHolder = SYMBOLS.putType("Ljava/lang/Thread$FieldHolder;"); + public static final Symbol java_lang_Thread_Constants = SYMBOLS.putType("Ljava/lang/Thread$Constants;"); + public static final Symbol java_lang_ThreadGroup = SYMBOLS.putType("Ljava/lang/ThreadGroup;"); + public static final Symbol java_lang_BaseVirtualThread = SYMBOLS.putType("Ljava/lang/BaseVirtualThread;"); + + public static final Symbol java_lang_Runnable = SYMBOLS.putType("Ljava/lang/Runnable;"); + + public static final Symbol sun_misc_VM = SYMBOLS.putType("Lsun/misc/VM;"); + public static final Symbol jdk_internal_misc_VM = SYMBOLS.putType("Ljdk/internal/misc/VM;"); + public static final Symbol java_lang_Thread$State = SYMBOLS.putType("Ljava/lang/Thread$State;"); + public static final Symbol jdk_internal_vm_ContinuationScope = SYMBOLS.putType("Ljdk/internal/vm/ContinuationScope;"); + public static final Symbol jdk_internal_vm_Continuation = SYMBOLS.putType("Ljdk/internal/vm/Continuation;"); + + public static final Symbol sun_misc_Signal = SYMBOLS.putType("Lsun/misc/Signal;"); + public static final Symbol jdk_internal_misc_Signal = SYMBOLS.putType("Ljdk/internal/misc/Signal;"); + public static final Symbol sun_misc_NativeSignalHandler = SYMBOLS.putType("Lsun/misc/NativeSignalHandler;"); + public static final Symbol jdk_internal_misc_Signal$NativeHandler = SYMBOLS.putType("Ljdk/internal/misc/Signal$NativeHandler;"); + public static final Symbol sun_misc_SignalHandler = SYMBOLS.putType("Lsun/misc/SignalHandler;"); + public static final Symbol jdk_internal_misc_Signal$Handler = SYMBOLS.putType("Ljdk/internal/misc/Signal$Handler;"); + + public static final Symbol sun_nio_ch_DirectBuffer = SYMBOLS.putType("Lsun/nio/ch/DirectBuffer;"); + public static final Symbol java_nio_Buffer = SYMBOLS.putType("Ljava/nio/Buffer;"); + + // Guest reflection. + public static final Symbol java_lang_reflect_Field = SYMBOLS.putType("Ljava/lang/reflect/Field;"); + public static final Symbol java_lang_reflect_Method = SYMBOLS.putType("Ljava/lang/reflect/Method;"); + public static final Symbol java_lang_reflect_Constructor = SYMBOLS.putType("Ljava/lang/reflect/Constructor;"); + public static final Symbol java_lang_reflect_Parameter = SYMBOLS.putType("Ljava/lang/reflect/Parameter;"); + public static final Symbol java_lang_reflect_Executable = SYMBOLS.putType("Ljava/lang/reflect/Executable;"); + public static final Symbol sun_reflect_Reflection = SYMBOLS.putType("Lsun/reflect/Reflection;"); + public static final Symbol jdk_internal_reflect_Reflection = SYMBOLS.putType("Ljdk/internal/reflect/Reflection;"); + + // MagicAccessorImpl is not public. + public static final Symbol sun_reflect_MagicAccessorImpl = SYMBOLS.putType("Lsun/reflect/MagicAccessorImpl;"); + public static final Symbol jdk_internal_reflect_MagicAccessorImpl = SYMBOLS.putType("Ljdk/internal/reflect/MagicAccessorImpl;"); + // DelegatingClassLoader is not public. + public static final Symbol sun_reflect_DelegatingClassLoader = SYMBOLS.putType("Lsun/reflect/DelegatingClassLoader;"); + public static final Symbol jdk_internal_reflect_DelegatingClassLoader = SYMBOLS.putType("Ljdk/internal/reflect/DelegatingClassLoader;"); + + // MethodAccessorImpl is not public. + public static final Symbol sun_reflect_MethodAccessorImpl = SYMBOLS.putType("Lsun/reflect/MethodAccessorImpl;"); + public static final Symbol jdk_internal_reflect_MethodAccessorImpl = SYMBOLS.putType("Ljdk/internal/reflect/MethodAccessorImpl;"); + public static final Symbol sun_reflect_ConstructorAccessorImpl = SYMBOLS.putType("Lsun/reflect/ConstructorAccessorImpl;"); + public static final Symbol jdk_internal_reflect_ConstructorAccessorImpl = SYMBOLS.putType("Ljdk/internal/reflect/ConstructorAccessorImpl;"); + public static final Symbol jdk_internal_reflect_NativeConstructorAccessorImpl = SYMBOLS.putType("Ljdk/internal/reflect/NativeConstructorAccessorImpl;"); + + public static final Symbol sun_reflect_ConstantPool = SYMBOLS.putType("Lsun/reflect/ConstantPool;"); + public static final Symbol jdk_internal_reflect_ConstantPool = SYMBOLS.putType("Ljdk/internal/reflect/ConstantPool;"); + + public static final Symbol java_io_Serializable = SYMBOLS.putType("Ljava/io/Serializable;"); + public static final Symbol java_nio_ByteBuffer = SYMBOLS.putType("Ljava/nio/ByteBuffer;"); + public static final Symbol java_nio_DirectByteBuffer = SYMBOLS.putType("Ljava/nio/DirectByteBuffer;"); + public static final Symbol java_nio_ByteOrder = SYMBOLS.putType("Ljava/nio/ByteOrder;"); + + public static final Symbol java_security_PrivilegedActionException = SYMBOLS.putType("Ljava/security/PrivilegedActionException;"); + + // Shutdown is not public. + public static final Symbol java_lang_Shutdown = SYMBOLS.putType("Ljava/lang/Shutdown;"); + + public static final Symbol sun_launcher_LauncherHelper = SYMBOLS.putType("Lsun/launcher/LauncherHelper;"); + + // Finalizer is not public. + public static final Symbol java_lang_ref_Finalizer = SYMBOLS.putType("Ljava/lang/ref/Finalizer;"); + public static final Symbol java_lang_ref_Reference = SYMBOLS.putType("Ljava/lang/ref/Reference;"); + public static final Symbol java_lang_ref_FinalReference = SYMBOLS.putType("Ljava/lang/ref/FinalReference;"); + public static final Symbol java_lang_ref_WeakReference = SYMBOLS.putType("Ljava/lang/ref/WeakReference;"); + public static final Symbol java_lang_ref_SoftReference = SYMBOLS.putType("Ljava/lang/ref/SoftReference;"); + public static final Symbol java_lang_ref_PhantomReference = SYMBOLS.putType("Ljava/lang/ref/PhantomReference;"); + public static final Symbol java_lang_ref_ReferenceQueue = SYMBOLS.putType("Ljava/lang/ref/ReferenceQueue;"); + public static final Symbol java_lang_ref_Reference$Lock = SYMBOLS.putType("Ljava/lang/ref/Reference$Lock;"); + + public static final Symbol sun_misc_Cleaner = SYMBOLS.putType("Lsun/misc/Cleaner;"); + public static final Symbol jdk_internal_ref_Cleaner = SYMBOLS.putType("Ljdk/internal/ref/Cleaner;"); + + public static final Symbol java_lang_StackTraceElement = SYMBOLS.putType("Ljava/lang/StackTraceElement;"); + public static final Symbol java_lang_StackTraceElement_array = SYMBOLS.putType("[Ljava/lang/StackTraceElement;"); + + public static final Symbol java_lang_Error = SYMBOLS.putType("Ljava/lang/Error;"); + public static final Symbol java_lang_NoSuchFieldError = SYMBOLS.putType("Ljava/lang/NoSuchFieldError;"); + public static final Symbol java_lang_NoSuchMethodError = SYMBOLS.putType("Ljava/lang/NoSuchMethodError;"); + public static final Symbol java_lang_IllegalAccessError = SYMBOLS.putType("Ljava/lang/IllegalAccessError;"); + public static final Symbol java_lang_IncompatibleClassChangeError = SYMBOLS.putType("Ljava/lang/IncompatibleClassChangeError;"); + public static final Symbol java_lang_AbstractMethodError = SYMBOLS.putType("Ljava/lang/AbstractMethodError;"); + public static final Symbol java_lang_InternalError = SYMBOLS.putType("Ljava/lang/InternalError;"); + public static final Symbol java_lang_VerifyError = SYMBOLS.putType("Ljava/lang/VerifyError;"); + public static final Symbol java_lang_ClassFormatError = SYMBOLS.putType("Ljava/lang/ClassFormatError;"); + public static final Symbol java_lang_ClassCircularityError = SYMBOLS.putType("Ljava/lang/ClassCircularityError;"); + public static final Symbol java_lang_UnsatisfiedLinkError = SYMBOLS.putType("Ljava/lang/UnsatisfiedLinkError;"); + + public static final Symbol java_lang_invoke_MethodType = SYMBOLS.putType("Ljava/lang/invoke/MethodType;"); + + public static final Symbol java_lang_AssertionStatusDirectives = SYMBOLS.putType("Ljava/lang/AssertionStatusDirectives;"); + + public static final Symbol java_lang_invoke_MethodHandles = SYMBOLS.putType("Ljava/lang/invoke/MethodHandles;"); + public static final Symbol java_lang_invoke_VarHandle = SYMBOLS.putType("Ljava/lang/invoke/VarHandle;"); + public static final Symbol java_lang_invoke_VarHandles = SYMBOLS.putType("Ljava/lang/invoke/VarHandles;"); + public static final Symbol java_lang_invoke_MethodHandles$Lookup = SYMBOLS.putType("Ljava/lang/invoke/MethodHandles$Lookup;"); + public static final Symbol java_lang_invoke_CallSite = SYMBOLS.putType("Ljava/lang/invoke/CallSite;"); + public static final Symbol java_lang_invoke_DirectMethodHandle = SYMBOLS.putType("Ljava/lang/invoke/DirectMethodHandle;"); + public static final Symbol java_lang_invoke_LambdaMetafactory = SYMBOLS.putType("Ljava/lang/invoke/LambdaMetafactory;"); + + // MethodHandleNatives is not public. + public static final Symbol java_lang_invoke_MethodHandleNatives = SYMBOLS.putType("Ljava/lang/invoke/MethodHandleNatives;"); + public static final Symbol java_lang_invoke_MemberName = SYMBOLS.putType("Ljava/lang/invoke/MemberName;"); + public static final Symbol java_lang_invoke_MethodHandle = SYMBOLS.putType("Ljava/lang/invoke/MethodHandle;"); + public static final Symbol java_lang_invoke_LambdaForm = SYMBOLS.putType("Ljava/lang/invoke/LambdaForm;"); + public static final Symbol java_lang_invoke_LambdaForm$Compiled = SYMBOLS.putType("Ljava/lang/invoke/LambdaForm$Compiled;"); + public static final Symbol java_lang_invoke_LambdaForm$Hidden = SYMBOLS.putType("Ljava/lang/invoke/LambdaForm$Hidden;"); + public static final Symbol jdk_internal_vm_annotation_Hidden = SYMBOLS.putType("Ljdk/internal/vm/annotation/Hidden;"); + public static final Symbol jdk_internal_vm_annotation_Stable = SYMBOLS.putType("Ljdk/internal/vm/annotation/Stable;"); + public static final Symbol sun_reflect_CallerSensitive = SYMBOLS.putType("Lsun/reflect/CallerSensitive;"); + public static final Symbol jdk_internal_reflect_CallerSensitive = SYMBOLS.putType("Ljdk/internal/reflect/CallerSensitive;"); + public static final Symbol java_lang_invoke_ForceInline = SYMBOLS.putType("Ljava/lang/invoke/ForceInline;"); + public static final Symbol jdk_internal_vm_annotation_ForceInline = SYMBOLS.putType("Ljdk/internal/vm/annotation/ForceInline;"); + public static final Symbol java_lang_invoke_DontInline = SYMBOLS.putType("Ljava/lang/invoke/DontInline;"); + public static final Symbol jdk_internal_vm_annotation_DontInline = SYMBOLS.putType("Ljdk/internal/vm/annotation/DontInline;"); + + // ScopedMemoryAccess + public static final Symbol jdk_internal_misc_ScopedMemoryAccess$Scoped = SYMBOLS.putType("Ljdk/internal/misc/ScopedMemoryAccess$Scoped;"); + + // Modules + public static final Symbol java_lang_Module = SYMBOLS.putType("Ljava/lang/Module;"); + + // Record + public static final Symbol java_lang_Record = SYMBOLS.putType("Ljava/lang/Record;"); + public static final Symbol java_lang_reflect_RecordComponent = SYMBOLS.putType("Ljava/lang/reflect/RecordComponent;"); + + // Unsafe Constants (required for 13+) + public static final Symbol jdk_internal_misc_UnsafeConstants = SYMBOLS.putType("Ljdk/internal/misc/UnsafeConstants;"); + + // Stack walking API + public static final Symbol java_lang_StackWalker = SYMBOLS.putType("Ljava/lang/StackWalker;"); + public static final Symbol java_lang_StackStreamFactory = SYMBOLS.putType("Ljava/lang/StackStreamFactory;"); + public static final Symbol java_lang_StackStreamFactory_AbstractStackWalker = SYMBOLS.putType("Ljava/lang/StackStreamFactory$AbstractStackWalker;"); + public static final Symbol java_lang_StackFrameInfo = SYMBOLS.putType("Ljava/lang/StackFrameInfo;"); + + // Special threads + public static final Symbol java_lang_ref_Finalizer$FinalizerThread = SYMBOLS.putType("Ljava/lang/ref/Finalizer$FinalizerThread;"); + public static final Symbol java_lang_ref_Reference$ReferenceHandler = SYMBOLS.putType("Ljava/lang/ref/Reference$ReferenceHandler;"); + public static final Symbol jdk_internal_misc_InnocuousThread = SYMBOLS.putType("Ljdk/internal/misc/InnocuousThread;"); + public static final Symbol sun_misc_InnocuousThread = SYMBOLS.putType("Lsun/misc/InnocuousThread;"); + // java.management + public static final Symbol java_lang_management_MemoryManagerMXBean = SYMBOLS.putType("Ljava/lang/management/MemoryManagerMXBean;"); + public static final Symbol java_lang_management_MemoryPoolMXBean = SYMBOLS.putType("Ljava/lang/management/MemoryPoolMXBean;"); + public static final Symbol java_lang_management_GarbageCollectorMXBean = SYMBOLS.putType("Ljava/lang/management/GarbageCollectorMXBean;"); + public static final Symbol sun_management_ManagementFactory = SYMBOLS.putType("Lsun/management/ManagementFactory;"); + public static final Symbol sun_management_ManagementFactoryHelper = SYMBOLS.putType("Lsun/management/ManagementFactoryHelper;"); + public static final Symbol java_lang_management_MemoryUsage = SYMBOLS.putType("Ljava/lang/management/MemoryUsage;"); + public static final Symbol java_lang_management_ThreadInfo = SYMBOLS.putType("Ljava/lang/management/ThreadInfo;"); + + // Secrets + public static final Symbol sun_misc_SharedSecrets = SYMBOLS.putType("Lsun/misc/SharedSecrets;"); + public static final Symbol jdk_internal_misc_SharedSecrets = SYMBOLS.putType("Ljdk/internal/misc/SharedSecrets;"); + public static final Symbol jdk_internal_access_SharedSecrets = SYMBOLS.putType("Ljdk/internal/access/SharedSecrets;"); + public static final Symbol sun_misc_JavaLangAccess = SYMBOLS.putType("Lsun/misc/JavaLangAccess;"); + public static final Symbol jdk_internal_misc_JavaLangAccess = SYMBOLS.putType("Ljdk/internal/misc/JavaLangAccess;"); + public static final Symbol jdk_internal_access_JavaLangAccess = SYMBOLS.putType("Ljdk/internal/access/JavaLangAccess;"); + + // Interop conversions. + public static final Symbol java_time_Duration = SYMBOLS.putType("Ljava/time/Duration;"); + public static final Symbol java_time_LocalTime = SYMBOLS.putType("Ljava/time/LocalTime;"); + public static final Symbol java_time_LocalDateTime = SYMBOLS.putType("Ljava/time/LocalDateTime;"); + public static final Symbol java_time_LocalDate = SYMBOLS.putType("Ljava/time/LocalDate;"); + public static final Symbol java_time_Instant = SYMBOLS.putType("Ljava/time/Instant;"); + public static final Symbol java_time_ZonedDateTime = SYMBOLS.putType("Ljava/time/ZonedDateTime;"); + public static final Symbol java_util_Date = SYMBOLS.putType("Ljava/util/Date;"); + public static final Symbol java_time_ZoneId = SYMBOLS.putType("Ljava/time/ZoneId;"); + + // List / Map / Iterator + public static final Symbol java_lang_Iterable = SYMBOLS.putType("Ljava/lang/Iterable;"); + public static final Symbol java_util_List = SYMBOLS.putType("Ljava/util/List;"); + public static final Symbol java_util_Map = SYMBOLS.putType("Ljava/util/Map;"); + public static final Symbol java_util_HashMap = SYMBOLS.putType("Ljava/util/HashMap;"); + public static final Symbol java_util_Iterator = SYMBOLS.putType("Ljava/util/Iterator;"); + public static final Symbol java_util_NoSuchElementException = SYMBOLS.putType("Ljava/util/NoSuchElementException;"); + public static final Symbol java_util_Map_Entry = SYMBOLS.putType("Ljava/util/Map$Entry;"); + public static final Symbol java_util_Set = SYMBOLS.putType("Ljava/util/Set;"); + public static final Symbol java_util_Collection = SYMBOLS.putType("Ljava/util/Collection;"); + + // Optional + public static final Symbol java_util_Optional = SYMBOLS.putType("Ljava/util/Optional;"); + + // java.util.regex + public static final Symbol java_util_regex_Pattern = SYMBOLS.putType("Ljava/util/regex/Pattern;"); + public static final Symbol java_util_regex_Pattern_Node = SYMBOLS.putType("Ljava/util/regex/Pattern$Node;"); + public static final Symbol java_util_regex_Matcher = SYMBOLS.putType("Ljava/util/regex/Matcher;"); + public static final Symbol java_util_regex_IntHashSet = SYMBOLS.putType("Ljava/util/regex/IntHashSet;"); + public static final Symbol java_util_regex_IntHashSet_array = SYMBOLS.putType("[Ljava/util/regex/IntHashSet;"); + + public static final Symbol java_util_concurrent_locks_AbstractOwnableSynchronizer = SYMBOLS.putType("Ljava/util/concurrent/locks/AbstractOwnableSynchronizer;"); + public static final Symbol java_util_concurrent_locks_ReentrantLock_Sync = SYMBOLS.putType("Ljava/util/concurrent/locks/ReentrantLock$Sync;"); + public static final Symbol java_util_concurrent_locks_ReentrantReadWriteLock_Sync = SYMBOLS.putType("Ljava/util/concurrent/locks/ReentrantReadWriteLock$Sync;"); + + // java math + public static final Symbol java_math_BigInteger = SYMBOLS.putType("Ljava/math/BigInteger;"); + public static final Symbol java_math_BigDecimal = SYMBOLS.putType("Ljava/math/BigDecimal;"); + public static final Symbol java_math_MathContext = SYMBOLS.putType("Ljava/math/MathContext;"); + public static final Symbol java_math_RoundingMode = SYMBOLS.putType("Ljava/math/RoundingMode;"); + + // Polyglot/interop API. + public static final Symbol com_oracle_truffle_espresso_polyglot_Polyglot = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/Polyglot;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_ArityException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/ArityException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_UnknownIdentifierException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/UnknownIdentifierException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_UnsupportedMessageException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/UnsupportedMessageException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_UnsupportedTypeException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/UnsupportedTypeException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/InvalidArrayIndexException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/InvalidBufferOffsetException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_StopIterationException = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/StopIterationException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_UnknownKeyException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/UnknownKeyException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_ForeignException = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/ForeignException;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_ExceptionType = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/ExceptionType;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_VMHelper = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/VMHelper;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_TypeLiteral = SYMBOLS.putType("Lcom/oracle/truffle/espresso/polyglot/TypeLiteral;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_TypeLiteral$InternalTypeLiteral = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/TypeLiteral$InternalTypeLiteral;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterable = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignIterable;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignList = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignList;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignCollection = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignCollection;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterator = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignIterator;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignMap = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignMap;"); + public static final Symbol com_oracle_truffle_espresso_polyglot_collections_EspressoForeignSet = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/collections/EspressoForeignSet;"); + + public static final Symbol com_oracle_truffle_espresso_polyglot_impl_EspressoForeignNumber = SYMBOLS.putType( + "Lcom/oracle/truffle/espresso/polyglot/impl/EspressoForeignNumber;"); + + // Continuations + public static final Symbol org_graalvm_continuations_ContinuationImpl = SYMBOLS.putType( + "Lorg/graalvm/continuations/ContinuationImpl;"); + public static final Symbol org_graalvm_continuations_ContinuationImpl_FrameRecord = SYMBOLS.putType( + "Lorg/graalvm/continuations/ContinuationImpl$FrameRecord;"); + public static final Symbol org_graalvm_continuations_IllegalMaterializedRecordException = SYMBOLS.putType( + "Lorg/graalvm/continuations/IllegalMaterializedRecordException;"); + public static final Symbol org_graalvm_continuations_IllegalContinuationStateException = SYMBOLS.putType( + "Lorg/graalvm/continuations/IllegalContinuationStateException;"); + + // JVMCI + public static final Symbol jdk_vm_ci_runtime_JVMCIRuntime = SYMBOLS.putType("Ljdk/vm/ci/runtime/JVMCIRuntime;"); + public static final Symbol jdk_vm_ci_services_Services = SYMBOLS.putType("Ljdk/vm/ci/services/Services;"); + public static final Symbol jdk_vm_ci_meta_UnresolvedJavaType = SYMBOLS.putType("Ljdk/vm/ci/meta/UnresolvedJavaType;"); + public static final Symbol jdk_vm_ci_meta_UnresolvedJavaField = SYMBOLS.putType("Ljdk/vm/ci/meta/UnresolvedJavaField;"); + public static final Symbol jdk_vm_ci_meta_LineNumberTable = SYMBOLS.putType("Ljdk/vm/ci/meta/LineNumberTable;"); + public static final Symbol jdk_vm_ci_meta_LocalVariableTable = SYMBOLS.putType("Ljdk/vm/ci/meta/LocalVariableTable;"); + public static final Symbol jdk_vm_ci_meta_Local = SYMBOLS.putType("Ljdk/vm/ci/meta/Local;"); + public static final Symbol jdk_vm_ci_meta_Local_array = SYMBOLS.putType("[Ljdk/vm/ci/meta/Local;"); + public static final Symbol jdk_vm_ci_meta_JavaType = SYMBOLS.putType("Ljdk/vm/ci/meta/JavaType;"); + public static final Symbol jdk_vm_ci_meta_ExceptionHandler = SYMBOLS.putType("Ljdk/vm/ci/meta/ExceptionHandler;"); + public static final Symbol jdk_vm_ci_meta_JavaConstant = SYMBOLS.putType("Ljdk/vm/ci/meta/JavaConstant;"); + public static final Symbol jdk_vm_ci_meta_JavaConstant_array = SYMBOLS.putType("[Ljdk/vm/ci/meta/JavaConstant;"); + public static final Symbol jdk_vm_ci_meta_PrimitiveConstant = SYMBOLS.putType("Ljdk/vm/ci/meta/PrimitiveConstant;"); + public static final Symbol jdk_vm_ci_meta_MethodHandleAccessProvider$IntrinsicMethod = SYMBOLS.putType("Ljdk/vm/ci/meta/MethodHandleAccessProvider$IntrinsicMethod;"); + // @formatter:off + public static final Symbol com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/EspressoJVMCIRuntime;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedInstanceType;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaField;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaMethod;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedArrayType = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedArrayType;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedPrimitiveType;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaType = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoResolvedJavaType;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoConstantPool;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoObjectConstant;"); + public static final Symbol com_oracle_truffle_espresso_jvmci_meta_EspressoBootstrapMethodInvocation = SYMBOLS.putType("Lcom/oracle/truffle/espresso/jvmci/meta/EspressoBootstrapMethodInvocation;"); + // @formatter:on + + public static final Symbol jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler = SYMBOLS.putType("Lcom/oracle/truffle/espresso/graal/DummyEspressoGraalJVMCICompiler;"); + public static final Symbol jdk_graal_compiler_api_runtime_GraalJVMCICompiler = SYMBOLS.putType("Ljdk/graal/compiler/api/runtime/GraalJVMCICompiler;"); + + // Panama + public static final Symbol jdk_internal_foreign_abi_VMStorage = SYMBOLS.putType("Ljdk/internal/foreign/abi/VMStorage;"); + public static final Symbol jdk_internal_foreign_abi_NativeEntryPoint = SYMBOLS.putType("Ljdk/internal/foreign/abi/NativeEntryPoint;"); + public static final Symbol jdk_internal_foreign_abi_UpcallLinker_CallRegs = SYMBOLS.putType("Ljdk/internal/foreign/abi/UpcallLinker$CallRegs;"); + public static final Symbol jdk_internal_foreign_abi_VMStorage_array = SYMBOLS.putType("[Ljdk/internal/foreign/abi/VMStorage;"); + } + + /** + * Contains commonly used (name) symbols. + * + * Symbols declared here must match exactly the field name; notable exceptions include + * {@link Names#_init_}, {@link Names#_clinit_} and hidden field names. + */ + public static class Names { + + // java.base + public static final Symbol java_base = SYMBOLS.putName("java.base"); + // general + public static final Symbol _init_ = SYMBOLS.putName(""); + public static final Symbol _clinit_ = SYMBOLS.putName(""); + // Boxing and String + public static final Symbol value = SYMBOLS.putName("value"); + public static final Symbol valueOf = SYMBOLS.putName("valueOf"); + public static final Symbol booleanValue = SYMBOLS.putName("booleanValue"); + public static final Symbol byteValue = SYMBOLS.putName("byteValue"); + public static final Symbol shortValue = SYMBOLS.putName("shortValue"); + public static final Symbol intValue = SYMBOLS.putName("intValue"); + public static final Symbol longValue = SYMBOLS.putName("longValue"); + public static final Symbol floatValue = SYMBOLS.putName("floatValue"); + public static final Symbol doubleValue = SYMBOLS.putName("doubleValue"); + // Field, Thread, Module and MemberName + public static final Symbol name = SYMBOLS.putName("name"); + // Thread and Runnable + public static final Symbol run = SYMBOLS.putName("run"); + // Thread and System + public static final Symbol exit = SYMBOLS.putName("exit"); + // Thread + public static final Symbol getThreadGroup = SYMBOLS.putName("getThreadGroup"); + // Object and arrays + public static final Symbol clone = SYMBOLS.putName("clone"); + public static final Symbol toString = SYMBOLS.putName("toString"); + // variable 'this' name + public static final Symbol thiz = SYMBOLS.putName("this"); + // finding main + public static final Symbol checkAndLoadMain = SYMBOLS.putName("checkAndLoadMain"); + public static final Symbol main = SYMBOLS.putName("main"); + // Reflection + public static final Symbol clazz = SYMBOLS.putName("clazz"); + public static final Symbol getParameterTypes = SYMBOLS.putName("getParameterTypes"); + public static final Symbol override = SYMBOLS.putName("override"); + public static final Symbol parameterTypes = SYMBOLS.putName("parameterTypes"); + public static final Symbol root = SYMBOLS.putName("root"); + public static final Symbol signature = SYMBOLS.putName("signature"); + public static final Symbol slot = SYMBOLS.putName("slot"); + public static final Symbol type = SYMBOLS.putName("type"); + public static final Symbol getRawType = SYMBOLS.putName("getRawType"); + public static final Symbol getActualTypeArguments = SYMBOLS.putName("getActualTypeArguments"); + // java.lang.* + // j.l.AssertionStatusDirectives + public static final Symbol classes = SYMBOLS.putName("classes"); + public static final Symbol classEnabled = SYMBOLS.putName("classEnabled"); + public static final Symbol deflt = SYMBOLS.putName("deflt"); + public static final Symbol packages = SYMBOLS.putName("packages"); + public static final Symbol packageEnabled = SYMBOLS.putName("packageEnabled"); + // j.l.Class + public static final Symbol checkPackageAccess = SYMBOLS.putName("checkPackageAccess"); + public static final Symbol getName = SYMBOLS.putName("getName"); + public static final Symbol getSimpleName = SYMBOLS.putName("getSimpleName"); + public static final Symbol getTypeName = SYMBOLS.putName("getTypeName"); + public static final Symbol forName = SYMBOLS.putName("forName"); + public static final Symbol module = SYMBOLS.putName("module"); + public static final Symbol classData = SYMBOLS.putName("classData"); + public static final Symbol classLoader = SYMBOLS.putName("classLoader"); + public static final Symbol classRedefinedCount = SYMBOLS.putName("classRedefinedCount"); + public static final Symbol componentType = SYMBOLS.putName("componentType"); + // j.l.ClassLoader + public static final Symbol addClass = SYMBOLS.putName("addClass"); + public static final Symbol findNative = SYMBOLS.putName("findNative"); + public static final Symbol getSystemClassLoader = SYMBOLS.putName("getSystemClassLoader"); + public static final Symbol loadClass = SYMBOLS.putName("loadClass"); + public static final Symbol getResourceAsStream = SYMBOLS.putName("getResourceAsStream"); + public static final Symbol parent = SYMBOLS.putName("parent"); + public static final Symbol unnamedModule = SYMBOLS.putName("unnamedModule"); + public static final Symbol nameAndId = SYMBOLS.putName("nameAndId"); + public static final Symbol HIDDEN_CLASS_LOADER_REGISTRY = SYMBOLS.putName("0HIDDEN_CLASS_LOADER_REGISTRY"); + // j.l.Module + public static final Symbol loader = SYMBOLS.putName("loader"); + // j.l.RecordComponent + public static final Symbol accessor = SYMBOLS.putName("accessor"); + public static final Symbol annotations = SYMBOLS.putName("annotations"); + public static final Symbol typeAnnotations = SYMBOLS.putName("typeAnnotations"); + // j.l.String + public static final Symbol hash = SYMBOLS.putName("hash"); + public static final Symbol hashCode = SYMBOLS.putName("hashCode"); + public static final Symbol length = SYMBOLS.putName("length"); + public static final Symbol toCharArray = SYMBOLS.putName("toCharArray"); + public static final Symbol charAt = SYMBOLS.putName("charAt"); + public static final Symbol coder = SYMBOLS.putName("coder"); + public static final Symbol COMPACT_STRINGS = SYMBOLS.putName("COMPACT_STRINGS"); + public static final Symbol indexOf = SYMBOLS.putName("indexOf"); + // j.l.Throwable + public static final Symbol backtrace = SYMBOLS.putName("backtrace"); + public static final Symbol stackTrace = SYMBOLS.putName("stackTrace"); + public static final Symbol cause = SYMBOLS.putName("cause"); + public static final Symbol depth = SYMBOLS.putName("depth"); + public static final Symbol fillInStackTrace = SYMBOLS.putName("fillInStackTrace"); + public static final Symbol fillInStackTrace0 = SYMBOLS.putName("fillInStackTrace0"); + public static final Symbol getMessage = SYMBOLS.putName("getMessage"); + public static final Symbol getCause = SYMBOLS.putName("getCause"); + public static final Symbol detailMessage = SYMBOLS.putName("detailMessage"); + public static final Symbol printStackTrace = SYMBOLS.putName("printStackTrace"); + public static final Symbol extendedMessageState = SYMBOLS.putName("extendedMessageState"); + // j.l.Thread + public static final Symbol add = SYMBOLS.putName("add"); + public static final Symbol checkAccess = SYMBOLS.putName("checkAccess"); + public static final Symbol daemon = SYMBOLS.putName("daemon"); + public static final Symbol dispatchUncaughtException = SYMBOLS.putName("dispatchUncaughtException"); + public static final Symbol getStackTrace = SYMBOLS.putName("getStackTrace"); + public static final Symbol group = SYMBOLS.putName("group"); + public static final Symbol holder = SYMBOLS.putName("holder"); + public static final Symbol VTHREAD_GROUP = SYMBOLS.putName("VTHREAD_GROUP"); + public static final Symbol inheritedAccessControlContext = SYMBOLS.putName("inheritedAccessControlContext"); + public static final Symbol maxPriority = SYMBOLS.putName("maxPriority"); + public static final Symbol priority = SYMBOLS.putName("priority"); + public static final Symbol remove = SYMBOLS.putName("remove"); + public static final Symbol stop = SYMBOLS.putName("stop"); + public static final Symbol threadStatus = SYMBOLS.putName("threadStatus"); + public static final Symbol toThreadState = SYMBOLS.putName("toThreadState"); + public static final Symbol contextClassLoader = SYMBOLS.putName("contextClassLoader"); + public static final Symbol EMPTY = SYMBOLS.putName("EMPTY"); + public static final Symbol precision = SYMBOLS.putName("precision"); + // j.l.StackTraceElement + public static final Symbol declaringClassObject = SYMBOLS.putName("declaringClassObject"); + public static final Symbol classLoaderName = SYMBOLS.putName("classLoaderName"); + public static final Symbol moduleName = SYMBOLS.putName("moduleName"); + public static final Symbol moduleVersion = SYMBOLS.putName("moduleVersion"); + public static final Symbol declaringClass = SYMBOLS.putName("declaringClass"); + public static final Symbol methodName = SYMBOLS.putName("methodName"); + public static final Symbol fileName = SYMBOLS.putName("fileName"); + public static final Symbol lineNumber = SYMBOLS.putName("lineNumber"); + // j.l.System + public static final Symbol err = SYMBOLS.putName("err"); + public static final Symbol getProperty = SYMBOLS.putName("getProperty"); + public static final Symbol in = SYMBOLS.putName("in"); + public static final Symbol initializeSystemClass = SYMBOLS.putName("initializeSystemClass"); + public static final Symbol initPhase1 = SYMBOLS.putName("initPhase1"); + public static final Symbol initPhase2 = SYMBOLS.putName("initPhase2"); + public static final Symbol initPhase3 = SYMBOLS.putName("initPhase3"); + public static final Symbol out = SYMBOLS.putName("out"); + public static final Symbol security = SYMBOLS.putName("security"); + public static final Symbol setProperty = SYMBOLS.putName("setProperty"); + // j.l.Shutdown + public static final Symbol shutdown = SYMBOLS.putName("shutdown"); + // j.l.StackStreamFactory + public static final Symbol doStackWalk = SYMBOLS.putName("doStackWalk"); + public static final Symbol callStackWalk = SYMBOLS.putName("callStackWalk"); + // j.l.StackFrameInfo + public static final Symbol memberName = SYMBOLS.putName("memberName"); + public static final Symbol bci = SYMBOLS.putName("bci"); + // java.nio.ByteBuffer + public static final Symbol wrap = SYMBOLS.putName("wrap"); + public static final Symbol order = SYMBOLS.putName("order"); + public static final Symbol isReadOnly = SYMBOLS.putName("isReadOnly"); + public static final Symbol getShort = SYMBOLS.putName("getShort"); + public static final Symbol getInt = SYMBOLS.putName("getInt"); + public static final Symbol getLong = SYMBOLS.putName("getLong"); + public static final Symbol getFloat = SYMBOLS.putName("getFloat"); + public static final Symbol getDouble = SYMBOLS.putName("getDouble"); + public static final Symbol putShort = SYMBOLS.putName("putShort"); + public static final Symbol putInt = SYMBOLS.putName("putInt"); + public static final Symbol putLong = SYMBOLS.putName("putLong"); + public static final Symbol putFloat = SYMBOLS.putName("putFloat"); + public static final Symbol putDouble = SYMBOLS.putName("putDouble"); + // java.nio.ByteOrder + public static final Symbol LITTLE_ENDIAN = SYMBOLS.putName("LITTLE_ENDIAN"); + // java.nio.Buffer + public static final Symbol address = SYMBOLS.putName("address"); + public static final Symbol capacity = SYMBOLS.putName("capacity"); + public static final Symbol limit = SYMBOLS.putName("limit"); + public static final Symbol wait = SYMBOLS.putName("wait"); + // java.io.InputStream + public static final Symbol available = SYMBOLS.putName("available"); + public static final Symbol read = SYMBOLS.putName("read"); + public static final Symbol close = SYMBOLS.putName("close"); + // java.io.PrintStream + public static final Symbol println = SYMBOLS.putName("println"); + // java.lang.invoke.* + // CallSite + public static final Symbol target = SYMBOLS.putName("target"); + // java.lang.Enum + public static final Symbol $VALUES = SYMBOLS.putName("$VALUES"); + public static final Symbol ENUM$VALUES = SYMBOLS.putName("ENUM$VALUES"); + // LambdaForm + public static final Symbol compileToBytecode = SYMBOLS.putName("compileToBytecode"); + public static final Symbol isCompiled = SYMBOLS.putName("isCompiled"); + public static final Symbol vmentry = SYMBOLS.putName("vmentry"); + public static final Symbol getCallerClass = SYMBOLS.putName("getCallerClass"); + public static final Symbol createMemoryPool = SYMBOLS.putName("createMemoryPool"); + public static final Symbol createMemoryManager = SYMBOLS.putName("createMemoryManager"); + public static final Symbol createGarbageCollector = SYMBOLS.putName("createGarbageCollector"); + public static final Symbol tid = SYMBOLS.putName("tid"); + public static final Symbol eetop = SYMBOLS.putName("eetop"); + public static final Symbol getFromClass = SYMBOLS.putName("getFromClass"); + // MemberName + public static final Symbol flags = SYMBOLS.putName("flags"); + public static final Symbol form = SYMBOLS.putName("form"); + // MethodHandle + public static final Symbol invoke = SYMBOLS.putName("invoke"); + public static final Symbol invokeExact = SYMBOLS.putName("invokeExact"); + public static final Symbol invokeBasic = SYMBOLS.putName("invokeBasic"); + public static final Symbol invokeWithArguments = SYMBOLS.putName("invokeWithArguments"); + public static final Symbol linkToVirtual = SYMBOLS.putName("linkToVirtual"); + public static final Symbol linkToStatic = SYMBOLS.putName("linkToStatic"); + public static final Symbol linkToInterface = SYMBOLS.putName("linkToInterface"); + public static final Symbol linkToSpecial = SYMBOLS.putName("linkToSpecial"); + public static final Symbol linkToNative = SYMBOLS.putName("linkToNative"); + public static final Symbol asFixedArity = SYMBOLS.putName("asFixedArity"); + public static final Symbol member = SYMBOLS.putName("member"); + // VarHandles + public static final Symbol getStaticFieldFromBaseAndOffset = SYMBOLS.putName("getStaticFieldFromBaseAndOffset"); + // MethodHandleNatives + public static final Symbol findMethodHandleType = SYMBOLS.putName("findMethodHandleType"); + public static final Symbol linkMethod = SYMBOLS.putName("linkMethod"); + public static final Symbol linkCallSite = SYMBOLS.putName("linkCallSite"); + public static final Symbol linkDynamicConstant = SYMBOLS.putName("linkDynamicConstant"); + public static final Symbol linkMethodHandleConstant = SYMBOLS.putName("linkMethodHandleConstant"); + // MethodHandles + public static final Symbol lookup = SYMBOLS.putName("lookup"); + // MethodType + public static final Symbol ptypes = SYMBOLS.putName("ptypes"); + public static final Symbol rtype = SYMBOLS.putName("rtype"); + // java.lang.invoke.LambdaMetafactory + public static final Symbol metafactory = SYMBOLS.putName("metafactory"); + public static final Symbol altMetafactory = SYMBOLS.putName("altMetafactory"); + // j.l.ref.Finalizer + public static final Symbol finalize = SYMBOLS.putName("finalize"); + public static final Symbol register = SYMBOLS.putName("register"); + public static final Symbol runFinalizer = SYMBOLS.putName("runFinalizer"); + // j.l.ref.Reference + public static final Symbol discovered = SYMBOLS.putName("discovered"); + public static final Symbol enqueue = SYMBOLS.putName("enqueue"); + public static final Symbol getFromInactiveFinalReference = SYMBOLS.putName("getFromInactiveFinalReference"); + public static final Symbol clearInactiveFinalReference = SYMBOLS.putName("clearInactiveFinalReference"); + public static final Symbol lock = SYMBOLS.putName("lock"); + public static final Symbol next = SYMBOLS.putName("next"); + public static final Symbol NULL = SYMBOLS.putName("NULL"); + public static final Symbol pending = SYMBOLS.putName("pending"); + public static final Symbol processPendingLock = SYMBOLS.putName("processPendingLock"); + public static final Symbol queue = SYMBOLS.putName("queue"); + public static final Symbol referent = SYMBOLS.putName("referent"); + // java.util.regex + public static final Symbol parentPattern = SYMBOLS.putName("parentPattern"); + public static final Symbol pattern = SYMBOLS.putName("pattern"); + public static final Symbol flags0 = SYMBOLS.putName("flags0"); + public static final Symbol compiled = SYMBOLS.putName("compiled"); + public static final Symbol namedGroups = SYMBOLS.putName("namedGroups"); + public static final Symbol compile = SYMBOLS.putName("compile"); + public static final Symbol capturingGroupCount = SYMBOLS.putName("capturingGroupCount"); + public static final Symbol groupCount = SYMBOLS.putName("groupCount"); + public static final Symbol match = SYMBOLS.putName("match"); + public static final Symbol search = SYMBOLS.putName("search"); + public static final Symbol modCount = SYMBOLS.putName("modCount"); + public static final Symbol to = SYMBOLS.putName("to"); + public static final Symbol transparentBounds = SYMBOLS.putName("transparentBounds"); + public static final Symbol anchoringBounds = SYMBOLS.putName("anchoringBounds"); + public static final Symbol locals = SYMBOLS.putName("locals"); + public static final Symbol localsPos = SYMBOLS.putName("localsPos"); + public static final Symbol hitEnd = SYMBOLS.putName("hitEnd"); + public static final Symbol requireEnd = SYMBOLS.putName("requireEnd"); + public static final Symbol localTCNCount = SYMBOLS.putName("localTCNCount"); + public static final Symbol localCount = SYMBOLS.putName("localCount"); + public static final Symbol reset = SYMBOLS.putName("reset"); + public static final Symbol groups = SYMBOLS.putName("groups"); + public static final Symbol first = SYMBOLS.putName("first"); + public static final Symbol last = SYMBOLS.putName("last"); + public static final Symbol oldLast = SYMBOLS.putName("oldLast"); + // java.security.ProtectionDomain + public static final Symbol impliesCreateAccessControlContext = SYMBOLS.putName("impliesCreateAccessControlContext"); + // java.security.AccessControlContext + public static final Symbol context = SYMBOLS.putName("context"); + public static final Symbol isAuthorized = SYMBOLS.putName("isAuthorized"); + public static final Symbol isPrivileged = SYMBOLS.putName("isPrivileged"); + public static final Symbol privilegedContext = SYMBOLS.putName("privilegedContext"); + public static final Symbol doPrivileged = SYMBOLS.putName("doPrivileged"); + public static final Symbol executePrivileged = SYMBOLS.putName("executePrivileged"); + // jdk.internal.misc.UnsafeConstants + public static final Symbol ADDRESS_SIZE0 = SYMBOLS.putName("ADDRESS_SIZE0"); + public static final Symbol PAGE_SIZE = SYMBOLS.putName("PAGE_SIZE"); + public static final Symbol BIG_ENDIAN = SYMBOLS.putName("BIG_ENDIAN"); + public static final Symbol UNALIGNED_ACCESS = SYMBOLS.putName("UNALIGNED_ACCESS"); + public static final Symbol DATA_CACHE_LINE_FLUSH_SIZE = SYMBOLS.putName("DATA_CACHE_LINE_FLUSH_SIZE"); + // sun.launcher.LauncherHelper + public static final Symbol printHelpMessage = SYMBOLS.putName("printHelpMessage"); + public static final Symbol ostream = SYMBOLS.putName("ostream"); + // sun.reflect.ConstantPool + public static final Symbol constantPoolOop = SYMBOLS.putName("constantPoolOop"); + // sun.misc.SignalHandler + public static final Symbol handle = SYMBOLS.putName("handle"); + public static final Symbol SIG_DFL = SYMBOLS.putName("SIG_DFL"); + public static final Symbol SIG_IGN = SYMBOLS.putName("SIG_IGN"); + // sun.misc.NativeSignalHandler + public static final Symbol handler = SYMBOLS.putName("handler"); + // sun.nio.ch.NativeThread + public static final Symbol isNativeThread = SYMBOLS.putName("isNativeThread"); + public static final Symbol current0 = SYMBOLS.putName("current0"); + public static final Symbol signal = SYMBOLS.putName("signal"); + public static final Symbol init = SYMBOLS.putName("init"); + // jdk.internal.util.ArraysSupport + public static final Symbol vectorizedMismatch = SYMBOLS.putName("vectorizedMismatch"); + // Attribute names + public static final Symbol AnnotationDefault = SYMBOLS.putName("AnnotationDefault"); + public static final Symbol BootstrapMethods = SYMBOLS.putName("BootstrapMethods"); + public static final Symbol Code = SYMBOLS.putName("Code"); + public static final Symbol ConstantValue = SYMBOLS.putName("ConstantValue"); + public static final Symbol Deprecated = SYMBOLS.putName("Deprecated"); + public static final Symbol EnclosingMethod = SYMBOLS.putName("EnclosingMethod"); + public static final Symbol Exceptions = SYMBOLS.putName("Exceptions"); + public static final Symbol InnerClasses = SYMBOLS.putName("InnerClasses"); + public static final Symbol LineNumberTable = SYMBOLS.putName("LineNumberTable"); + public static final Symbol LocalVariableTable = SYMBOLS.putName("LocalVariableTable"); + public static final Symbol LocalVariableTypeTable = SYMBOLS.putName("LocalVariableTypeTable"); + public static final Symbol MethodParameters = SYMBOLS.putName("MethodParameters"); + public static final Symbol NestHost = SYMBOLS.putName("NestHost"); + public static final Symbol NestMembers = SYMBOLS.putName("NestMembers"); + public static final Symbol PermittedSubclasses = SYMBOLS.putName("PermittedSubclasses"); + public static final Symbol Record = SYMBOLS.putName("Record"); + public static final Symbol RuntimeVisibleAnnotations = SYMBOLS.putName("RuntimeVisibleAnnotations"); + public static final Symbol RuntimeInvisibleAnnotations = SYMBOLS.putName("RuntimeInvisibleAnnotations"); + public static final Symbol RuntimeVisibleTypeAnnotations = SYMBOLS.putName("RuntimeVisibleTypeAnnotations"); + public static final Symbol RuntimeInvisibleTypeAnnotations = SYMBOLS.putName("RuntimeInvisibleTypeAnnotations"); + public static final Symbol RuntimeVisibleParameterAnnotations = SYMBOLS.putName("RuntimeVisibleParameterAnnotations"); + public static final Symbol RuntimeInvisibleParameterAnnotations = SYMBOLS.putName("RuntimeInvisibleParameterAnnotations"); + public static final Symbol Signature = SYMBOLS.putName("Signature"); + public static final Symbol SourceFile = SYMBOLS.putName("SourceFile"); + public static final Symbol SourceDebugExtension = SYMBOLS.putName("SourceDebugExtension"); + public static final Symbol StackMapTable = SYMBOLS.putName("StackMapTable"); + public static final Symbol Synthetic = SYMBOLS.putName("Synthetic"); + // Interop conversions + public static final Symbol seconds = SYMBOLS.putName("seconds"); + public static final Symbol nanos = SYMBOLS.putName("nanos"); + public static final Symbol year = SYMBOLS.putName("year"); + public static final Symbol month = SYMBOLS.putName("month"); + public static final Symbol day = SYMBOLS.putName("day"); + public static final Symbol toLocalDate = SYMBOLS.putName("toLocalDate"); + public static final Symbol toLocalTime = SYMBOLS.putName("toLocalTime"); + public static final Symbol toInstant = SYMBOLS.putName("toInstant"); + public static final Symbol from = SYMBOLS.putName("from"); + public static final Symbol ofInstant = SYMBOLS.putName("ofInstant"); + public static final Symbol getZone = SYMBOLS.putName("getZone"); + public static final Symbol getId = SYMBOLS.putName("getId"); + public static final Symbol of = SYMBOLS.putName("of"); + public static final Symbol compose = SYMBOLS.putName("compose"); + public static final Symbol toByteArray = SYMBOLS.putName("toByteArray"); + public static final Symbol hour = SYMBOLS.putName("hour"); + public static final Symbol minute = SYMBOLS.putName("minute"); + public static final Symbol second = SYMBOLS.putName("second"); + public static final Symbol nano = SYMBOLS.putName("nano"); + public static final Symbol atZone = SYMBOLS.putName("atZone"); + public static final Symbol ofEpochSecond = SYMBOLS.putName("ofEpochSecond"); + // Map / List / Iterator + public static final Symbol get = SYMBOLS.putName("get"); + public static final Symbol set = SYMBOLS.putName("set"); + public static final Symbol iterator = SYMBOLS.putName("iterator"); + public static final Symbol put = SYMBOLS.putName("put"); + public static final Symbol size = SYMBOLS.putName("size"); + public static final Symbol containsKey = SYMBOLS.putName("containsKey"); + public static final Symbol getKey = SYMBOLS.putName("getKey"); + public static final Symbol getValue = SYMBOLS.putName("getValue"); + public static final Symbol setValue = SYMBOLS.putName("setValue"); + public static final Symbol entrySet = SYMBOLS.putName("entrySet"); + public static final Symbol hasNext = SYMBOLS.putName("hasNext"); + public static final Symbol toArray = SYMBOLS.putName("toArray"); + // MemberName + public static final Symbol HIDDEN_VMINDEX = SYMBOLS.putName("0HIDDEN_VMINDEX"); + public static final Symbol HIDDEN_VMTARGET = SYMBOLS.putName("0HIDDEN_VMTARGET"); + // Method + public static final Symbol HIDDEN_METHOD_KEY = SYMBOLS.putName("0HIDDEN_METHOD_KEY"); + public static final Symbol HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = SYMBOLS.putName("0HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); + // Constructor + public static final Symbol HIDDEN_CONSTRUCTOR_KEY = SYMBOLS.putName("0HIDDEN_CONSTRUCTOR_KEY"); + public static final Symbol HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = SYMBOLS.putName("0HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); + // Field + public static final Symbol HIDDEN_FIELD_KEY = SYMBOLS.putName("0HIDDEN_FIELD_KEY"); + public static final Symbol HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = SYMBOLS.putName("0HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS"); + // Throwable + public static final Symbol HIDDEN_FRAMES = SYMBOLS.putName("0HIDDEN_FRAMES"); + public static final Symbol HIDDEN_EXCEPTION_WRAPPER = SYMBOLS.putName("0HIDDEN_EXCEPTION_WRAPPER"); + // Thread + public static final Symbol interrupted = SYMBOLS.putName("interrupted"); + public static final Symbol interrupt = SYMBOLS.putName("interrupt"); + public static final Symbol HIDDEN_DEPRECATION_SUPPORT = SYMBOLS.putName("0HIDDEN_DEPRECATION_SUPPORT"); + public static final Symbol HIDDEN_THREAD_UNPARK_SIGNALS = SYMBOLS.putName("0HIDDEN_THREAD_UNPARK_SIGNALS"); + public static final Symbol HIDDEN_THREAD_PARK_LOCK = SYMBOLS.putName("0HIDDEN_THREAD_PARK_LOCK"); + public static final Symbol HIDDEN_HOST_THREAD = SYMBOLS.putName("0HIDDEN_HOST_THREAD"); + public static final Symbol HIDDEN_ESPRESSO_MANAGED = SYMBOLS.putName("0HIDDEN_ESPRESSO_MANAGED"); + public static final Symbol HIDDEN_INTERRUPTED = SYMBOLS.putName("0HIDDEN_INTERRUPTED"); + public static final Symbol HIDDEN_THREAD_PENDING_MONITOR = SYMBOLS.putName("0HIDDEN_THREAD_PENDING_MONITOR"); + public static final Symbol HIDDEN_THREAD_WAITING_MONITOR = SYMBOLS.putName("0HIDDEN_THREAD_WAITING_MONITOR"); + public static final Symbol HIDDEN_THREAD_BLOCKED_COUNT = SYMBOLS.putName("0HIDDEN_THREAD_BLOCKED_COUNT"); + public static final Symbol HIDDEN_THREAD_WAITED_COUNT = SYMBOLS.putName("0HIDDEN_THREAD_WAITED_COUNT"); + public static final Symbol HIDDEN_THREAD_DEPTH_FIRST_NUMBER = SYMBOLS.putName("0HIDDEN_THREAD_DEPTH_FIRST_NUMBER"); + public static final Symbol HIDDEN_THREAD_SCOPED_VALUE_CACHE = SYMBOLS.putName("0HIDDEN_THREAD_SCOPED_VALUE_CACHE"); + // Class + public static final Symbol HIDDEN_MIRROR_KLASS = SYMBOLS.putName("0HIDDEN_MIRROR_KLASS"); + public static final Symbol HIDDEN_SIGNERS = SYMBOLS.putName("0HIDDEN_SIGNERS"); + public static final Symbol HIDDEN_PROTECTION_DOMAIN = SYMBOLS.putName("0HIDDEN_PROTECTION_DOMAIN"); + // Module + public static final Symbol HIDDEN_MODULE_ENTRY = SYMBOLS.putName("0HIDDEN_MODULE_ENTRY"); + // Pattern + public static final Symbol HIDDEN_TREGEX_MATCH = SYMBOLS.putName("0HIDDEN_TREGEX_MATCH"); + public static final Symbol HIDDEN_TREGEX_FULLMATCH = SYMBOLS.putName("0HIDDEN_TREGEX_FULLMATCH"); + public static final Symbol HIDDEN_TREGEX_SEARCH = SYMBOLS.putName("0HIDDEN_TREGEX_SEARCH"); + public static final Symbol HIDDEN_TREGEX_UNSUPPORTED = SYMBOLS.putName("0HIDDEN_TREGEX_UNSUPPORTED"); + // Matcher + public static final Symbol HIDDEN_TREGEX_TSTRING = SYMBOLS.putName("0HIDDEN_TREGEX_TSTRING"); + public static final Symbol HIDDEN_TREGEX_OLD_LAST_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_OLD_LAST_BACKUP"); + public static final Symbol HIDDEN_TREGEX_MOD_COUNT_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_MOD_COUNT_BACKUP"); + public static final Symbol HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP"); + public static final Symbol HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP"); + public static final Symbol HIDDEN_TREGEX_FROM_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_FROM_BACKUP"); + public static final Symbol HIDDEN_TREGEX_TO_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_TO_BACKUP"); + public static final Symbol HIDDEN_TREGEX_MATCHING_MODE_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_MATCHING_MODE_BACKUP"); + public static final Symbol HIDDEN_TREGEX_SEARCH_FROM_BACKUP = SYMBOLS.putName("0HIDDEN_TREGEX_SEARCH_FROM_BACKUP"); + // Reference + public static final Symbol processPendingReferences = SYMBOLS.putName("processPendingReferences"); + public static final Symbol tryHandlePending = SYMBOLS.putName("tryHandlePending"); + public static final Symbol poll = SYMBOLS.putName("poll"); + public static final Symbol HIDDEN_HOST_REFERENCE = SYMBOLS.putName("0HIDDEN_HOST_REFERENCE"); + // Secrets + public static final Symbol javaLangAccess = SYMBOLS.putName("javaLangAccess"); + // Polyglot ExceptionType + public static final Symbol EXIT = SYMBOLS.putName("EXIT"); + public static final Symbol INTERRUPT = SYMBOLS.putName("INTERRUPT"); + public static final Symbol RUNTIME_ERROR = SYMBOLS.putName("RUNTIME_ERROR"); + public static final Symbol PARSE_ERROR = SYMBOLS.putName("PARSE_ERROR"); + public static final Symbol create = SYMBOLS.putName("create"); + public static final Symbol toGuest = SYMBOLS.putName("toGuest"); + // Interop VM helpers + public static final Symbol getDynamicModuleDescriptor = SYMBOLS.putName("getDynamicModuleDescriptor"); + public static final Symbol getEspressoType = SYMBOLS.putName("getEspressoType"); + public static final Symbol HIDDEN_INTERNAL_TYPE = SYMBOLS.putName("0HIDDEN_INTERNAL_TYPE"); + public static final Symbol rawType = SYMBOLS.putName("rawType"); + public static final Symbol espresso_polyglot = SYMBOLS.putName("espresso.polyglot"); + // Class redefinition plugin helpers + public static final Symbol flushFromCaches = SYMBOLS.putName("flushFromCaches"); + public static final Symbol generateProxyClass = SYMBOLS.putName("generateProxyClass"); + public static final Symbol removeBeanInfo = SYMBOLS.putName("removeBeanInfo"); + public static final Symbol platformClassLoader = SYMBOLS.putName("platformClassLoader"); + public static final Symbol bootModules = SYMBOLS.putName("bootModules"); + public static final Symbol platformModules = SYMBOLS.putName("platformModules"); + public static final Symbol descriptor = SYMBOLS.putName("descriptor"); + public static final Symbol ofSystem = SYMBOLS.putName("ofSystem"); + public static final Symbol defineModule = SYMBOLS.putName("defineModule"); + // Continuations + public static final Symbol suspend = SYMBOLS.putName("suspend"); + public static final Symbol stackFrameHead = SYMBOLS.putName("stackFrameHead"); + public static final Symbol HIDDEN_CONTINUATION_FRAME_RECORD = SYMBOLS.putName("0HIDDEN_CONTINUATION_FRAME_RECORD"); + public static final Symbol pointers = SYMBOLS.putName("pointers"); + public static final Symbol primitives = SYMBOLS.putName("primitives"); + public static final Symbol method = SYMBOLS.putName("method"); + // Panama + public static final Symbol segmentMaskOrSize = SYMBOLS.putName("segmentMaskOrSize"); + public static final Symbol indexOrOffset = SYMBOLS.putName("indexOrOffset"); + public static final Symbol downcallStubAddress = SYMBOLS.putName("downcallStubAddress"); + public static final Symbol argRegs = SYMBOLS.putName("argRegs"); + public static final Symbol retRegs = SYMBOLS.putName("retRegs"); + public static final Symbol exclusiveOwnerThread = SYMBOLS.putName("exclusiveOwnerThread"); + + // JVMCI + public static final Symbol runtime = SYMBOLS.putName("runtime"); + public static final Symbol forBasicType = SYMBOLS.putName("forBasicType"); + public static final Symbol openJVMCITo = SYMBOLS.putName("openJVMCITo"); + public static final Symbol NULL_POINTER = SYMBOLS.putName("NULL_POINTER"); + public static final Symbol ILLEGAL = SYMBOLS.putName("ILLEGAL"); + public static final Symbol forInt = SYMBOLS.putName("forInt"); + public static final Symbol forLong = SYMBOLS.putName("forLong"); + public static final Symbol forFloat = SYMBOLS.putName("forFloat"); + public static final Symbol forDouble = SYMBOLS.putName("forDouble"); + public static final Symbol forPrimitive = SYMBOLS.putName("forPrimitive"); + public static final Symbol code = SYMBOLS.putName("code"); + public static final Symbol INVOKE_BASIC = SYMBOLS.putName("INVOKE_BASIC"); + public static final Symbol LINK_TO_VIRTUAL = SYMBOLS.putName("LINK_TO_VIRTUAL"); + public static final Symbol LINK_TO_STATIC = SYMBOLS.putName("LINK_TO_STATIC"); + public static final Symbol LINK_TO_SPECIAL = SYMBOLS.putName("LINK_TO_SPECIAL"); + public static final Symbol LINK_TO_INTERFACE = SYMBOLS.putName("LINK_TO_INTERFACE"); + public static final Symbol LINK_TO_NATIVE = SYMBOLS.putName("LINK_TO_NATIVE"); + public static final Symbol HIDDEN_OBJECTKLASS_MIRROR = SYMBOLS.putName("0HIDDEN_KLASS_MIRROR"); + public static final Symbol HIDDEN_JVMCIINDY = SYMBOLS.putName("0HIDDEN_JVMCIINDY"); + public static final Symbol HIDDEN_FIELD_MIRROR = SYMBOLS.putName("0HIDDEN_FIELD_MIRROR"); + public static final Symbol HIDDEN_METHOD_MIRROR = SYMBOLS.putName("0HIDDEN_METHOD_MIRROR"); + public static final Symbol HIDDEN_OBJECT_CONSTANT = SYMBOLS.putName("0HIDDEN_OBJECT_CONSTANT"); + + public static void ensureInitialized() { + assert _init_ == ParserSymbols.ParserNames._init_; + } + } + + public static class Signatures { + + public static final Symbol _boolean = SYMBOLS.putSignature(Types._boolean); + public static final Symbol _byte = SYMBOLS.putSignature(Types._byte); + public static final Symbol _short = SYMBOLS.putSignature(Types._short); + public static final Symbol _char = SYMBOLS.putSignature(Types._char); + public static final Symbol _int = SYMBOLS.putSignature(Types._int); + public static final Symbol _long = SYMBOLS.putSignature(Types._long); + public static final Symbol _float = SYMBOLS.putSignature(Types._float); + public static final Symbol _double = SYMBOLS.putSignature(Types._double); + public static final Symbol _void = SYMBOLS.putSignature(Types._void); + public static final Symbol Class = SYMBOLS.putSignature(Types.java_lang_Class); + public static final Symbol LocalDate = SYMBOLS.putSignature(Types.java_time_LocalDate); + public static final Symbol LocalDate_int_int_int = SYMBOLS.putSignature(Types.java_time_LocalDate, Types._int, Types._int, Types._int); + public static final Symbol LocalTime = SYMBOLS.putSignature(Types.java_time_LocalTime); + public static final Symbol LocalDateTime_LocalDate_LocalTime = SYMBOLS.putSignature(Types.java_time_LocalDateTime, Types.java_time_LocalDate, Types.java_time_LocalTime); + public static final Symbol LocalTime_int_int_int_int = SYMBOLS.putSignature(Types.java_time_LocalTime, Types._int, Types._int, Types._int, Types._int); + public static final Symbol Instant = SYMBOLS.putSignature(Types.java_time_Instant); + public static final Symbol Date_Instant = SYMBOLS.putSignature(Types.java_util_Date, Types.java_time_Instant); + public static final Symbol Instant_long_long = SYMBOLS.putSignature(Types.java_time_Instant, Types._long, Types._long); + public static final Symbol ZoneId = SYMBOLS.putSignature(Types.java_time_ZoneId); + public static final Symbol ZonedDateTime_Instant_ZoneId = SYMBOLS.putSignature(Types.java_time_ZonedDateTime, Types.java_time_Instant, Types.java_time_ZoneId); + public static final Symbol ZonedDateTime_ZoneId = SYMBOLS.putSignature(Types.java_time_ZonedDateTime, Types.java_time_ZoneId); + public static final Symbol ZoneId_String = SYMBOLS.putSignature(Types.java_time_ZoneId, Types.java_lang_String); + public static final Symbol _void_Object = SYMBOLS.putSignature(Types._void, Types.java_lang_Object); + public static final Symbol Object_Object = SYMBOLS.putSignature(Types.java_lang_Object, Types.java_lang_Object); + public static final Symbol Object_Object_Object = SYMBOLS.putSignature(Types.java_lang_Object, Types.java_lang_Object, Types.java_lang_Object); + public static final Symbol Object_int = SYMBOLS.putSignature(Types.java_lang_Object, Types._int); + public static final Symbol Object_int_Object = SYMBOLS.putSignature(Types.java_lang_Object, Types._int, Types.java_lang_Object); + public static final Symbol Object = SYMBOLS.putSignature(Types.java_lang_Object); + public static final Symbol String = SYMBOLS.putSignature(Types.java_lang_String); + public static final Symbol _void_CharSequence_Pattern = SYMBOLS.putSignature(Types._void, Types.java_util_regex_Pattern, Types.java_lang_CharSequence); + public static final Symbol Matcher_CharSequence = SYMBOLS.putSignature(Types.java_util_regex_Matcher, Types.java_lang_CharSequence); + public static final Symbol ClassLoader = SYMBOLS.putSignature(Types.java_lang_ClassLoader); + public static final Symbol Map = SYMBOLS.putSignature(Types.java_util_Map); + public static final Symbol _void_URL_array_ClassLoader = SYMBOLS.putSignature(Types._void, Types.java_net_URL_array, Types.java_lang_ClassLoader); + public static final Symbol Class_PermissionDomain = SYMBOLS.putSignature(Types._void, Types.java_lang_Class, Types.java_security_ProtectionDomain); + public static final Symbol _void_Class = SYMBOLS.putSignature(Types._void, Types.java_lang_Class); + public static final Symbol Class_array = SYMBOLS.putSignature(Types.java_lang_Class_array); + public static final Symbol Object_String_String = SYMBOLS.putSignature(Types.java_lang_Object, Types.java_lang_String, Types.java_lang_String); + public static final Symbol _void_String_array = SYMBOLS.putSignature(Types._void, Types.java_lang_String_array); + public static final Symbol Class_String_boolean_ClassLoader = SYMBOLS.putSignature(Types.java_lang_Class, Types.java_lang_String, Types._boolean, Types.java_lang_ClassLoader); + public static final Symbol Throwable = SYMBOLS.putSignature(Types.java_lang_Throwable); + public static final Symbol _void_Throwable = SYMBOLS.putSignature(Types._void, Types.java_lang_Throwable); + public static final Symbol StackTraceElement_array = SYMBOLS.putSignature(Types.java_lang_StackTraceElement_array); + public static final Symbol _void_String_Throwable = SYMBOLS.putSignature(Types._void, Types.java_lang_String, Types.java_lang_Throwable); + public static final Symbol _void_String = SYMBOLS.putSignature(Types._void, Types.java_lang_String); + public static final Symbol _void_String_int = SYMBOLS.putSignature(Types._void, Types.java_lang_String, Types._int); + public static final Symbol Class_String = SYMBOLS.putSignature(Types.java_lang_Class, Types.java_lang_String); + public static final Symbol InputStream_String = SYMBOLS.putSignature(Types.java_io_InputStream, Types.java_lang_String); + public static final Symbol _int_byte_array_int_int = SYMBOLS.putSignature(Types._int, Types._byte_array, Types._int, Types._int); + public static final Symbol ByteBuffer_int_byte_array_int_int = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._byte_array, Types._int, Types._int); + public static final Symbol ByteBuffer_int_byte = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._byte); + public static final Symbol ByteBuffer_int_short = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._short); + public static final Symbol ByteBuffer_int_int = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._int); + public static final Symbol ByteBuffer_int_long = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._long); + public static final Symbol ByteBuffer_int_float = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._float); + public static final Symbol ByteBuffer_int_double = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._int, Types._double); + public static final Symbol _byte_int = SYMBOLS.putSignature(Types._byte, Types._int); + public static final Symbol _short_int = SYMBOLS.putSignature(Types._short, Types._int); + public static final Symbol _int_int = SYMBOLS.putSignature(Types._int, Types._int); + public static final Symbol _long_int = SYMBOLS.putSignature(Types._long, Types._int); + public static final Symbol _float_int = SYMBOLS.putSignature(Types._float, Types._int); + public static final Symbol _double_int = SYMBOLS.putSignature(Types._double, Types._int); + public static final Symbol ByteBuffer_byte_array = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types._byte_array); + public static final Symbol ByteOrder = SYMBOLS.putSignature(Types.java_nio_ByteOrder); + public static final Symbol ByteBuffer_ByteOrder = SYMBOLS.putSignature(Types.java_nio_ByteBuffer, Types.java_nio_ByteOrder); + public static final Symbol _long_ClassLoader_String = SYMBOLS.putSignature(Types._long, Types.java_lang_ClassLoader, Types.java_lang_String); + public static final Symbol _void_Exception = SYMBOLS.putSignature(Types._void, Types.java_lang_Exception); + public static final Symbol _void_String_String_String_int = SYMBOLS.putSignature(Types._void, Types.java_lang_String, Types.java_lang_String, Types.java_lang_String, Types._int); + public static final Symbol _void_int = SYMBOLS.putSignature(Types._void, Types._int); + public static final Symbol _void_boolean = SYMBOLS.putSignature(Types._void, Types._boolean); + public static final Symbol _void_long = SYMBOLS.putSignature(Types._void, Types._long); + public static final Symbol _void_long_int = SYMBOLS.putSignature(Types._void, Types._long, Types._int); + public static final Symbol _void_long_long = SYMBOLS.putSignature(Types._void, Types._long, Types._long); + public static final Symbol _boolean_int = SYMBOLS.putSignature(Types._boolean, Types._int); + public static final Symbol _boolean_int_int = SYMBOLS.putSignature(Types._boolean, Types._int, Types._int); + public static final Symbol _boolean_long = SYMBOLS.putSignature(Types._boolean, Types._long); + public static final Symbol _int_int_int = SYMBOLS.putSignature(Types._int, Types._int, Types._int); + public static final Symbol _void_char_array = SYMBOLS.putSignature(Types._void, Types._char_array); + public static final Symbol _void_byte_array = SYMBOLS.putSignature(Types._void, Types._byte_array); + public static final Symbol _byte_array = SYMBOLS.putSignature(Types._byte_array); + public static final Symbol _char_array = SYMBOLS.putSignature(Types._char_array); + public static final Symbol _int_boolean_boolean = SYMBOLS.putSignature(Types._int, Types._boolean, Types._boolean); + public static final Symbol _boolean_boolean = SYMBOLS.putSignature(Types._boolean, Types._boolean); + public static final Symbol _boolean_Object = SYMBOLS.putSignature(Types._boolean, Types.java_lang_Object); + public static final Symbol Object_long_int_int_int_int = SYMBOLS.putSignature(Types.java_lang_Object, Types._long, Types._int, Types._int, Types._int, Types._int); + public static final Symbol Object_long_int_int_int_Object_array = SYMBOLS.putSignature(Types.java_lang_Object, Types._long, Types._int, Types._int, Types._int, + Types.java_lang_Object_array); + public static final Symbol _int_Object_long_Object_long_int_int = SYMBOLS.putSignature(Types._int, Types.java_lang_Object, Types._long, Types.java_lang_Object, Types._long, + Types._int, Types._int); + public static final Symbol Object_long_int_ContinuationScope_Continuation_int_int_Object_array = SYMBOLS.putSignature(Types.java_lang_Object, Types._long, Types._int, + Types.jdk_internal_vm_ContinuationScope, Types.jdk_internal_vm_Continuation, Types._int, Types._int, + Types.java_lang_Object_array); + public static final Symbol _byte_array_String_Class_array_int = SYMBOLS.putSignature(Types._byte_array, Types.java_lang_String, Types.java_lang_Class_array, Types._int); + public static final Symbol _byte_array_ClassLoader_String_List_int = SYMBOLS.putSignature(Types._byte_array, Types.java_lang_ClassLoader, Types.java_lang_String, + Types.java_util_List, + Types._int); + public static final Symbol _void_BigInteger_int_MathContext = SYMBOLS.putSignature(Types._void, Types.java_math_BigInteger, Types._int, Types.java_math_MathContext); + public static final Symbol Boolean_boolean = SYMBOLS.putSignature(Types.java_lang_Boolean, Types._boolean); + public static final Symbol Byte_byte = SYMBOLS.putSignature(Types.java_lang_Byte, Types._byte); + public static final Symbol Character_char = SYMBOLS.putSignature(Types.java_lang_Character, Types._char); + public static final Symbol Short_short = SYMBOLS.putSignature(Types.java_lang_Short, Types._short); + public static final Symbol Float_float = SYMBOLS.putSignature(Types.java_lang_Float, Types._float); + public static final Symbol Integer_int = SYMBOLS.putSignature(Types.java_lang_Integer, Types._int); + public static final Symbol Double_double = SYMBOLS.putSignature(Types.java_lang_Double, Types._double); + public static final Symbol Long_long = SYMBOLS.putSignature(Types.java_lang_Long, Types._long); + public static final Symbol Object_array_Object_array = SYMBOLS.putSignature(Types.java_lang_Object_array, Types.java_lang_Object_array); + public static final Symbol Object_Object_array = SYMBOLS.putSignature(Types.java_lang_Object, Types.java_lang_Object_array); + public static final Symbol java_util_Iterator = SYMBOLS.putSignature(Types.java_util_Iterator); + public static final Symbol java_util_Set = SYMBOLS.putSignature(Types.java_util_Set); + public static final Symbol Set_Object_array = SYMBOLS.putSignature(Types.java_util_Set, Types.java_lang_Object_array); + public static final Symbol java_lang_reflect_Method_init_signature = SYMBOLS.putSignature(Types._void, + /* declaringClass */ Types.java_lang_Class, + /* name */ Types.java_lang_String, + /* parameterTypes */ Types.java_lang_Class_array, + /* returnType */ Types.java_lang_Class, + /* checkedExceptions */ Types.java_lang_Class_array, + /* modifiers */ Types._int, + /* slot */ Types._int, + /* signature */ Types.java_lang_String, + /* annotations */ Types._byte_array, + /* parameterAnnotations */ Types._byte_array, + /* annotationDefault */ Types._byte_array); + public static final Symbol java_lang_reflect_Constructor_init_signature = SYMBOLS.putSignature(Types._void, + /* declaringClass */ Types.java_lang_Class, + /* parameterTypes */ Types.java_lang_Class_array, + /* checkedExceptions */ Types.java_lang_Class_array, + /* modifiers */ Types._int, + /* slot */ Types._int, + /* signature */ Types.java_lang_String, + /* annotations */ Types._byte_array, + /* parameterAnnotations */ Types._byte_array); + public static final Symbol java_lang_reflect_Field_init_signature = SYMBOLS.putSignature(Types._void, + /* declaringClass */ Types.java_lang_Class, + /* name */ Types.java_lang_String, + /* type */ Types.java_lang_Class, + /* modifiers */ Types._int, + /* slot */ Types._int, + /* signature */ Types.java_lang_String, + /* annotations */ Types._byte_array); + public static final Symbol java_lang_reflect_Field_init_signature_15 = SYMBOLS.putSignature(Types._void, + /* declaringClass */ Types.java_lang_Class, + /* name */ Types.java_lang_String, + /* type */ Types.java_lang_Class, + /* modifiers */ Types._int, + /* trustedFinal */ Types._boolean, + /* slot */ Types._int, + /* signature */ Types.java_lang_String, + /* annotations */ Types._byte_array); + public static final Symbol MethodType_Class_Class = SYMBOLS.putSignature(Types.java_lang_invoke_MethodType, Types.java_lang_Class, Types.java_lang_Class_array); + public static final Symbol MethodType_String_ClassLoader = SYMBOLS.putSignature(Types.java_lang_invoke_MethodType, Types.java_lang_String, Types.java_lang_ClassLoader); + public static final Symbol Java_lang_reflect_Type = SYMBOLS.putSignature(Types.java_lang_reflect_Type); + public static final Symbol Type_array = SYMBOLS.putSignature(Types.java_lang_reflect_Type_array); + public static final Symbol MemberName = SYMBOLS.putSignature(Types.java_lang_invoke_MemberName); + public static final Symbol MemberName_Class_int_Class_String_Object_Object_array = SYMBOLS.putSignature(Types.java_lang_invoke_MemberName, Types.java_lang_Class, Types._int, + Types.java_lang_Class, Types.java_lang_String, Types.java_lang_Object, Types.java_lang_Object_array); + public static final Symbol MethodHandle_Class_int_Class_String_Object = SYMBOLS.putSignature(Types.java_lang_invoke_MethodHandle, Types.java_lang_Class, Types._int, + Types.java_lang_Class, Types.java_lang_String, Types.java_lang_Object); + public static final Symbol MemberName_Object_Object_Object_Object_Object_Object_array = SYMBOLS.putSignature( + Types.java_lang_invoke_MemberName, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object_array); + public static final Symbol MemberName_Object_int_Object_Object_Object_Object_Object_array = SYMBOLS.putSignature( + Types.java_lang_invoke_MemberName, + Types.java_lang_Object, + Types._int, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object_array); + public static final Symbol Object_Object_int_Object_Object_Object_Object = SYMBOLS.putSignature( + Types.java_lang_Object, + Types.java_lang_Object, + Types._int, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object); + public static final Symbol Object_Object_Object_Object_Object_Object = SYMBOLS.putSignature( + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object, + Types.java_lang_Object); + public static final Symbol MethodHandles$Lookup = SYMBOLS.putSignature(Types.java_lang_invoke_MethodHandles$Lookup); + public static final Symbol MethodHandle = SYMBOLS.putSignature(Types.java_lang_invoke_MethodHandle); + public static final Symbol CallSite_Lookup_String_MethodType_MethodType_MethodHandle_MethodType = SYMBOLS.putSignature( + Types.java_lang_invoke_CallSite, + Types.java_lang_invoke_MethodHandles$Lookup, + Types.java_lang_String, + Types.java_lang_invoke_MethodType, + Types.java_lang_invoke_MethodType, + Types.java_lang_invoke_MethodHandle, + Types.java_lang_invoke_MethodType); + public static final Symbol CallSite_Lookup_String_MethodType_Object_array = SYMBOLS.putSignature( + Types.java_lang_invoke_CallSite, + Types.java_lang_invoke_MethodHandles$Lookup, + Types.java_lang_String, + Types.java_lang_invoke_MethodType, + Types.java_lang_Object_array); + public static final Symbol Field_Object_long_Class = SYMBOLS.putSignature(Types.java_lang_reflect_Field, Types.java_lang_Object, Types._long, Types.java_lang_Class); + public static final Symbol Thread$State_int = SYMBOLS.putSignature(Types.java_lang_Thread$State, Types._int); + public static final Symbol _void_ThreadGroup_String = SYMBOLS.putSignature(Types._void, Types.java_lang_ThreadGroup, Types.java_lang_String); + public static final Symbol _void_ThreadGroup_Runnable = SYMBOLS.putSignature(Types._void, Types.java_lang_ThreadGroup, Types.java_lang_Runnable); + public static final Symbol ThreadGroup = SYMBOLS.putSignature(Types.java_lang_ThreadGroup); + public static final Symbol _void_Thread = SYMBOLS.putSignature(Types._void, Types.java_lang_Thread); + public static final Symbol Reference = SYMBOLS.putSignature(Types.java_lang_ref_Reference); + public static final Symbol _void_sun_misc_JavaLangAccess = SYMBOLS.putSignature(Types._void, Types.sun_misc_JavaLangAccess); + public static final Symbol _void_jdk_internal_misc_JavaLangAccess = SYMBOLS.putSignature(Types._void, Types.jdk_internal_misc_JavaLangAccess); + public static final Symbol _void_jdk_internal_access_JavaLangAccess = SYMBOLS.putSignature(Types._void, Types.jdk_internal_access_JavaLangAccess); + public static final Symbol _void_CodeSource_PermissionCollection = SYMBOLS.putSignature(Types._void, Types.java_security_CodeSource, Types.java_security_PermissionCollection); + // java.management + public static final Symbol MemoryPoolMXBean_String_boolean_long_long = SYMBOLS.putSignature(Types.java_lang_management_MemoryPoolMXBean, Types.java_lang_String, Types._boolean, + Types._long, Types._long); + public static final Symbol MemoryManagerMXBean_String = SYMBOLS.putSignature(Types.java_lang_management_MemoryManagerMXBean, Types.java_lang_String); + public static final Symbol GarbageCollectorMXBean_String_String = SYMBOLS.putSignature(Types.java_lang_management_GarbageCollectorMXBean, Types.java_lang_String, + Types.java_lang_String); + // Polyglot/interop API. + public static final Symbol UnsupportedMessageException = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException); + public static final Symbol UnsupportedMessageException_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException, + Types.java_lang_Throwable); + public static final Symbol UnsupportedTypeException_Object_array_String = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException, + Types.java_lang_Object_array, + Types.java_lang_String); + public static final Symbol UnsupportedTypeException_Object_array_String_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException, + Types.java_lang_Object_array, + Types.java_lang_String, + Types.java_lang_Throwable); + public static final Symbol UnknownIdentifierException_String = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException, + Types.java_lang_String); + public static final Symbol UnknownIdentifierException_String_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException, + Types.java_lang_String, Types.java_lang_Throwable); + public static final Symbol ArityException_int_int_int = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_ArityException, Types._int, Types._int, Types._int); + public static final Symbol ArityException_int_int_int_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_ArityException, Types._int, Types._int, + Types._int, + Types.java_lang_Throwable); + public static final Symbol InvalidArrayIndexException_long = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException, Types._long); + public static final Symbol InvalidArrayIndexException_long_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException, Types._long, + Types.java_lang_Throwable); + public static final Symbol InvalidBufferOffsetException_long_long = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException, Types._long, + Types._long); + public static final Symbol InvalidBufferOffsetException_long_long_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException, + Types._long, Types._long, + Types.java_lang_Throwable); + public static final Symbol StopIterationException = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_StopIterationException); + public static final Symbol StopIterationException_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_StopIterationException, Types.java_lang_Throwable); + public static final Symbol UnknownKeyException_Object = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnknownKeyException, + Types.java_lang_Object); + public static final Symbol UnknownKeyException_Object_Throwable = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_polyglot_UnknownKeyException, + Types.java_lang_Object, Types.java_lang_Throwable); + + // JVMCI + public static final Symbol EspressoJVMCIRuntime = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime); + public static final Symbol _void_EspressoResolvedJavaType_int_Class = SYMBOLS.putSignature(Types._void, Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaType, + Types._int, Types.java_lang_Class); + public static final Symbol _void_EspressoResolvedInstanceType = SYMBOLS.putSignature(Types._void, Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); + public static final Symbol EspressoResolvedPrimitiveType_int = SYMBOLS.putSignature(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType, Types._int); + public static final Symbol DummyEspressoGraalJVMCICompiler_JVMCIRuntime = SYMBOLS.putSignature(Types.jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler, + Types.jdk_vm_ci_runtime_JVMCIRuntime); + public static final Symbol _void_Module = SYMBOLS.putSignature(Types._void, Types.java_lang_Module); + public static final Symbol _void_Local_array = SYMBOLS.putSignature(Types._void, Types.jdk_vm_ci_meta_Local_array); + public static final Symbol _void_int_array_int_array = SYMBOLS.putSignature(Types._void, Types._int_array, Types._int_array); + public static final Symbol _void_String_JavaType_int_int_int = SYMBOLS.putSignature(Types._void, Types.java_lang_String, Types.jdk_vm_ci_meta_JavaType, Types._int, Types._int, + Types._int); + public static final Symbol _void_int_int_int_int_JavaType = SYMBOLS.putSignature(Types._void, Types._int, Types._int, Types._int, Types._int, Types.jdk_vm_ci_meta_JavaType); + public static final Symbol _void_JavaType_String_JavaType = SYMBOLS.putSignature(Types._void, Types.jdk_vm_ci_meta_JavaType, Types.java_lang_String, + Types.jdk_vm_ci_meta_JavaType); + public static final Symbol PrimitiveConstant_int = SYMBOLS.putSignature(Types.jdk_vm_ci_meta_PrimitiveConstant, Types._int); + public static final Symbol PrimitiveConstant_long = SYMBOLS.putSignature(Types.jdk_vm_ci_meta_PrimitiveConstant, Types._long); + public static final Symbol PrimitiveConstant_float = SYMBOLS.putSignature(Types.jdk_vm_ci_meta_PrimitiveConstant, Types._float); + public static final Symbol PrimitiveConstant_double = SYMBOLS.putSignature(Types.jdk_vm_ci_meta_PrimitiveConstant, Types._double); + public static final Symbol PrimitiveConstant_char_long = SYMBOLS.putSignature(Types.jdk_vm_ci_meta_PrimitiveConstant, Types._char, Types._long); + public static final Symbol _void_boolean_EspressoResolvedJavaMethod_String_JavaConstant_JavaConstant_array = SYMBOLS.putSignature(Types._void, Types._boolean, + Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod, Types.java_lang_String, Types.jdk_vm_ci_meta_JavaConstant, Types.jdk_vm_ci_meta_JavaConstant_array); + + public static final Symbol _void_sun_misc_Signal = SYMBOLS.putSignature(Types._void, Types.sun_misc_Signal); + public static final Symbol _void_jdk_internal_misc_Signal = SYMBOLS.putSignature(Types._void, Types.jdk_internal_misc_Signal); + public static final Symbol Path_String_String_array = SYMBOLS.putSignature(Types.java_nio_file_Path, Types.java_lang_String, Types.java_lang_String_array); + public static final Symbol ModuleFinder = SYMBOLS.putSignature(Types.java_lang_module_ModuleFinder); + public static final Symbol ModuleFinder_SystemModules = SYMBOLS.putSignature(Types.java_lang_module_ModuleFinder, Types.jdk_internal_module_SystemModules); + public static final Symbol ModuleFinder_Path_array = SYMBOLS.putSignature(Types.java_lang_module_ModuleFinder, Types.java_nio_file_Path_array); + public static final Symbol ModuleFinder_ModuleFinder_array = SYMBOLS.putSignature(Types.java_lang_module_ModuleFinder, Types.java_lang_module_ModuleFinder_array); + public static final Symbol Module_ClassLoader_ModuleDescriptor_URI = SYMBOLS.putSignature(Types.java_lang_Module, Types.java_lang_ClassLoader, + Types.java_lang_module_ModuleDescriptor, Types.java_net_URI); + public static final Symbol ModuleDescriptor_String_String = SYMBOLS.putSignature(Types.java_lang_module_ModuleDescriptor, Types.java_lang_String, Types.java_lang_String); + // Continuations + public static final Symbol _void_FrameRecord_Object_array_long_array_Method_int_int_Object = SYMBOLS.putSignature( + Types._void, + Types.java_lang_Object_array, + Types._long_array, + Types.java_lang_reflect_Method, + Types._int, + Types._int, + Types.java_lang_Object); + + public static void ensureInitialized() { + assert _void == ParserSymbols.ParserSignatures._void; + } + } +} diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ffi/nfi/NativeUtils.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ffi/nfi/NativeUtils.java index dbbe8d41dcd3..311c6d5e63d8 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ffi/nfi/NativeUtils.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/ffi/nfi/NativeUtils.java @@ -34,7 +34,7 @@ import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUtf8; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; import com.oracle.truffle.espresso.ffi.Pointer; import com.oracle.truffle.espresso.ffi.RawPointer; import com.oracle.truffle.espresso.meta.EspressoError; @@ -182,7 +182,7 @@ public static String fromUTF8Ptr(long rawBytesPtr) { buf.clear(); buf.get(bytes); try { - return ModifiedUtf8.toJavaString(bytes); + return ModifiedUTF8.toJavaString(bytes); } catch (IOException e) { // return StaticObject.NULL; throw EspressoError.shouldNotReachHere(e); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ArrayKlass.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ArrayKlass.java index d33989948023..c85da277243a 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ArrayKlass.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ArrayKlass.java @@ -36,10 +36,10 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.JavaKind; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.impl.ModuleTable.ModuleEntry; import com.oracle.truffle.espresso.impl.PackageTable.PackageEntry; import com.oracle.truffle.espresso.jdwp.api.MethodRef; @@ -65,7 +65,7 @@ public final class ArrayKlass extends Klass { EspressoError.guarantee(componentType.getJavaKind() != JavaKind.Void, "Invalid void[] class."); this.componentType = componentType; this.elementalType = componentType.getElementalType(); - this.dimension = Types.getArrayDimensions(getType()); + this.dimension = TypeSymbols.getArrayDimensions(getType()); this.redefineAssumption = componentType.getRedefineAssumption(); assert getMeta().java_lang_Class != null; initializeEspressoClass(); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/BootClassRegistry.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/BootClassRegistry.java index 2f47425a7ac6..99c53beb9f0e 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/BootClassRegistry.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/BootClassRegistry.java @@ -25,10 +25,10 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.ClasspathFile; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; import com.oracle.truffle.espresso.classfile.perf.DebugTimer; @@ -64,7 +64,7 @@ public BootClassRegistry(long loaderID) { @SuppressWarnings("try") public Klass loadKlassImpl(EspressoContext context, Symbol type) throws EspressoClassLoadingException { ClassLoadingEnv env = context.getClassLoadingEnv(); - if (Types.isPrimitive(type)) { + if (TypeSymbols.isPrimitive(type)) { return null; } ClasspathFile classpathFile; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassLoadingEnv.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassLoadingEnv.java index f0016b5826b1..67007a18d135 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassLoadingEnv.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassLoadingEnv.java @@ -34,10 +34,10 @@ import com.oracle.truffle.espresso.classfile.ParsingContext; import com.oracle.truffle.espresso.classfile.constantpool.Utf8Constant; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.TimerCollection; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.meta.Meta; @@ -182,18 +182,13 @@ public Symbol getOrCreateName(ByteSequence byteSequence) { @Override public Symbol getOrCreateTypeFromName(ByteSequence byteSequence) { - return env.getTypes().getOrCreate(Types.nameToType(byteSequence)); + return env.getTypes().getOrCreateValidType(TypeSymbols.nameToType(byteSequence)); } @Override public Utf8Constant getOrCreateUtf8Constant(ByteSequence bytes) { return env.getLanguage().getUtf8ConstantTable().getOrCreate(bytes); } - - @Override - public long getNewKlassId() { - return env.getNewKlassId(); - } }; } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistries.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistries.java index c552ac147083..ec080b308a5e 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistries.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistries.java @@ -35,10 +35,11 @@ import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.jdwp.api.ModuleRef; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.meta.Meta; @@ -75,7 +76,7 @@ public ClassRegistries(EspressoContext context) { } public void initJavaBaseModule() { - this.javaBaseModule = bootClassRegistry.modules().createAndAddEntry(Name.java_base, null, null, false, null); + this.javaBaseModule = bootClassRegistry.modules().createAndAddEntry(Names.java_base, null, null, false, null); } public ClassRegistry getClassRegistry(@JavaType(ClassLoader.class) StaticObject classLoader) { @@ -127,7 +128,7 @@ public ModuleTable.ModuleEntry getJavaBaseModule() { public ModuleTable.ModuleEntry getPolyglotAPIModule() { if (polyglotAPIModule == null) { - polyglotAPIModule = findPlatformOrBootModule(Name.espresso_polyglot); + polyglotAPIModule = findPlatformOrBootModule(Names.espresso_polyglot); } return polyglotAPIModule; } @@ -166,12 +167,12 @@ public boolean javaBaseDefined() { public Klass findLoadedClass(Symbol type, @JavaType(ClassLoader.class) StaticObject classLoader) { assert classLoader != null : "use StaticObject.NULL for BCL"; - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { Klass elemental = findLoadedClass(context.getTypes().getElementalType(type), classLoader); if (elemental == null) { return null; } - return elemental.getArrayClass(Types.getArrayDimensions(type)); + return elemental.getArrayClass(TypeSymbols.getArrayDimensions(type)); } ClassRegistry registry = getClassRegistry(classLoader); @@ -274,12 +275,12 @@ public ModuleTable.ModuleEntry findUniqueModule(Symbol name) { public Klass loadKlass(Symbol type, @JavaType(ClassLoader.class) StaticObject classLoader, StaticObject protectionDomain) throws EspressoClassLoadingException { assert classLoader != null : "use StaticObject.NULL for BCL"; - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { Klass elemental = loadKlass(context.getTypes().getElementalType(type), classLoader, protectionDomain); if (elemental == null) { return null; } - return elemental.getArrayClass(Types.getArrayDimensions(type)); + return elemental.getArrayClass(TypeSymbols.getArrayDimensions(type)); } ClassRegistry registry = getClassRegistry(classLoader); return registry.loadKlass(context, type, protectionDomain); @@ -299,14 +300,14 @@ public BootClassRegistry getBootClassRegistry() { @TruffleBoundary public void checkLoadingConstraint(Symbol type, StaticObject loader1, StaticObject loader2, Function errorHandler) { Symbol toCheck = context.getTypes().getElementalType(type); - if (!Types.isPrimitive(toCheck) && loader1 != loader2) { + if (!TypeSymbols.isPrimitive(toCheck) && loader1 != loader2) { constraints.checkConstraint(toCheck, loader1, loader2, errorHandler); } } void recordConstraint(Symbol type, Klass klass, StaticObject loader) { - assert !Types.isArray(type); - if (!Types.isPrimitive(type)) { + assert !TypeSymbols.isArray(type); + if (!TypeSymbols.isPrimitive(type)) { constraints.recordConstraint(type, klass, loader, m -> { throw context.throwError(ErrorType.LinkageError, m); }); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistry.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistry.java index 9fbd61505620..3f00d5213718 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistry.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ClassRegistry.java @@ -37,8 +37,8 @@ import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.constantpool.PoolConstant; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugTimer; import com.oracle.truffle.espresso.constantpool.Resolution; @@ -289,12 +289,12 @@ public void initUnnamedModule(StaticObject unnamedModule) { @SuppressWarnings("try") Klass loadKlass(EspressoContext context, Symbol type, StaticObject protectionDomain) throws EspressoClassLoadingException { ClassLoadingEnv env = context.getClassLoadingEnv(); - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { Klass elemental = loadKlass(context, env.getTypes().getElementalType(type), protectionDomain); if (elemental == null) { return null; } - return elemental.getArrayClass(Types.getArrayDimensions(type)); + return elemental.getArrayClass(TypeSymbols.getArrayDimensions(type)); } loadKlassCountInc(); @@ -343,13 +343,13 @@ public List getLoadedKlasses() { } public Klass findLoadedKlass(ClassLoadingEnv env, Symbol type) { - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { Symbol elemental = env.getTypes().getElementalType(type); Klass elementalKlass = findLoadedKlass(env, elemental); if (elementalKlass == null) { return null; } - return elementalKlass.getArrayClass(Types.getArrayDimensions(type)); + return elementalKlass.getArrayClass(TypeSymbols.getArrayDimensions(type)); } ClassRegistries.RegistryEntry entry = classes.get(type); if (entry == null) { @@ -605,7 +605,7 @@ public void onClassRenamed(ObjectKlass renamedKlass) { renamedKlass.getRegistries().recordConstraint(renamedKlass.getType(), renamedKlass, renamedKlass.getDefiningClassLoader()); } - public void onInnerClassRemoved(Symbol type) { + public void onInnerClassRemoved(Symbol type) { // "unload" the class by removing from classes ClassRegistries.RegistryEntry removed = classes.remove(type); // purge class loader constraint for this type diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ConstantPoolPatcher.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ConstantPoolPatcher.java index 3a5da0cbbcaa..84adfadf45fe 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ConstantPoolPatcher.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ConstantPoolPatcher.java @@ -30,8 +30,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.ParserException; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.redefinition.InnerClassRedefiner; import com.oracle.truffle.espresso.runtime.EspressoContext; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/EnumConstantField.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/EnumConstantField.java index 0d2eeefe8232..0e61d34e0132 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/EnumConstantField.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/EnumConstantField.java @@ -24,7 +24,7 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; @@ -34,7 +34,7 @@ public final class EnumConstantField extends Field { public EnumConstantField(ObjectKlass.KlassVersion holder, LinkedField linkedField, RuntimeConstantPool pool) { super(holder, linkedField, pool); - assert Types.isReference(linkedField.getType()); + assert TypeSymbols.isReference(linkedField.getType()); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ExtensionFieldsMetadata.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ExtensionFieldsMetadata.java index 3bfa05f6807d..0efca7f250e5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ExtensionFieldsMetadata.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ExtensionFieldsMetadata.java @@ -31,8 +31,8 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.espresso.classfile.ParserField; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.redefinition.ClassRedefinition; final class ExtensionFieldsMetadata { @@ -84,7 +84,7 @@ private static List initNewFields(ObjectKlass.KlassVersion holder, List

getGenericSignature() { if (attr == null) { genericSignature = ModifiedUTF8.fromSymbol(getType()); } else { - genericSignature = pool.symbolAt(attr.getSignatureIndex()); + genericSignature = pool.symbolAtUnsafe(attr.getSignatureIndex()); } } return genericSignature; @@ -981,12 +982,12 @@ public Field getCompatibleField() { public StaticObject makeMirror(Meta meta) { StaticObject instance = meta.java_lang_reflect_Field.allocateInstance(meta.getContext()); - Attribute rawRuntimeVisibleAnnotations = getAttribute(Name.RuntimeVisibleAnnotations); + Attribute rawRuntimeVisibleAnnotations = getAttribute(Names.RuntimeVisibleAnnotations); StaticObject runtimeVisibleAnnotations = rawRuntimeVisibleAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Name.RuntimeVisibleTypeAnnotations); + Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Names.RuntimeVisibleTypeAnnotations); StaticObject runtimeVisibleTypeAnnotations = rawRuntimeVisibleTypeAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleTypeAnnotations.getData(), meta) : StaticObject.NULL; @@ -1018,7 +1019,7 @@ public StaticObject makeMirror(Meta meta) { } public int getConstantValueIndex() { - ConstantValueAttribute a = (ConstantValueAttribute) getAttribute(Symbol.Name.ConstantValue); + ConstantValueAttribute a = (ConstantValueAttribute) getAttribute(Names.ConstantValue); if (a == null) { return 0; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/GuestClassRegistry.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/GuestClassRegistry.java index 74f418ce8d82..11258a3282c5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/GuestClassRegistry.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/GuestClassRegistry.java @@ -24,11 +24,11 @@ package com.oracle.truffle.espresso.impl; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.runtime.EspressoContext; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.substitutions.JavaType; @@ -67,8 +67,8 @@ public GuestClassRegistry(ClassLoadingEnv env, @JavaType(ClassLoader.class) Stat super(env.getNewLoaderId()); assert StaticObject.notNull(classLoader) : "cannot be the BCL"; this.classLoader = classLoader; - this.loadClass = classLoader.getKlass().lookupMethod(Name.loadClass, Signature.Class_String); - this.addClass = classLoader.getKlass().lookupMethod(Name.addClass, Signature._void_Class); + this.loadClass = classLoader.getKlass().lookupMethod(Names.loadClass, Signatures.Class_String); + this.addClass = classLoader.getKlass().lookupMethod(Names.addClass, Signatures._void_Class); if (env.getJavaVersion().modulesEnabled()) { StaticObject unnamedModule = env.getMeta().java_lang_ClassLoader_unnamedModule.getObject(classLoader); assert StaticObject.notNull(unnamedModule); @@ -81,7 +81,7 @@ public GuestClassRegistry(ClassLoadingEnv env, @JavaType(ClassLoader.class) Stat public Klass loadKlassImpl(EspressoContext context, Symbol type) { assert StaticObject.notNull(classLoader); ClassLoadingEnv env = context.getClassLoadingEnv(); - StaticObject guestClass = (StaticObject) loadClass.invokeDirect(classLoader, env.getMeta().toGuestString(Types.binaryName(type))); + StaticObject guestClass = (StaticObject) loadClass.invokeDirect(classLoader, env.getMeta().toGuestString(TypeSymbols.binaryName(type))); Klass klass = guestClass.getMirrorKlass(); context.getRegistries().recordConstraint(type, klass, getClassLoader()); ClassRegistries.RegistryEntry entry = new ClassRegistries.RegistryEntry(klass); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/InterfaceTables.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/InterfaceTables.java index b03f6504609e..54723b6d9ee9 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/InterfaceTables.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/InterfaceTables.java @@ -27,9 +27,9 @@ import java.util.Comparator; import com.oracle.truffle.api.CompilerAsserts; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.runtime.EspressoContext; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Klass.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Klass.java index f84aaacc7122..15d00df7ef9f 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Klass.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Klass.java @@ -64,12 +64,15 @@ import com.oracle.truffle.espresso.classfile.Constants; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ModuleTable.ModuleEntry; import com.oracle.truffle.espresso.impl.PackageTable.PackageEntry; import com.oracle.truffle.espresso.jdwp.api.ClassStatusConstants; @@ -377,7 +380,7 @@ static boolean doObject(Klass receiver) { } /* Check that the class has a public constructor */ for (Method m : receiver.getDeclaredMethods()) { - if (m.isPublic() && !m.isStatic() && m.getName().equals(Name._init_)) { + if (m.isPublic() && !m.isStatic() && m.getName().equals(Names._init_)) { return true; } } @@ -498,7 +501,7 @@ static StaticObject doMultidimensionalArray(Klass receiver, Object[] arguments, return context.getAllocator().createNewMultiArray(arrayKlass.getComponentType(), dimensions); } - static final String INIT_NAME = Name._init_.toString(); + static final String INIT_NAME = Names._init_.toString(); @Specialization(guards = "isObjectKlass(receiver)") static Object doObject(Klass receiver, Object[] arguments, @@ -977,7 +980,7 @@ public final ArrayKlass getArrayClass() { private synchronized ArrayKlass createArrayKlass() { CompilerAsserts.neverPartOfCompilation(); ArrayKlass result = this.arrayKlass; - if (result == null && Type._void != getType()) { // ignore void[] + if (result == null && Types._void != getType()) { // ignore void[] this.arrayKlass = result = new ArrayKlass(this); } return result; @@ -1275,7 +1278,7 @@ public Klass[] getImplementedInterfaces() { * Returns the {@code } method for this class if there is one. */ public Method getClassInitializer() { - Method clinit = lookupDeclaredMethod(Name._clinit_, Signature._void); + Method clinit = lookupDeclaredMethod(Names._clinit_, Signatures._void); if (clinit != null && clinit.isStatic()) { return clinit; } @@ -1653,7 +1656,7 @@ public final StaticObject allocateInstance(EspressoContext ctx) { @CompilationFinal private final Symbol runtimePackage; private Symbol initRuntimePackage() { - ByteSequence hostPkgName = Types.getRuntimePackage(type); + ByteSequence hostPkgName = TypeSymbols.getRuntimePackage(type); return getNames().getOrCreate(hostPkgName); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LanguageAccess.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LanguageAccess.java index 0ec1df887228..7d1fc0aee8da 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LanguageAccess.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LanguageAccess.java @@ -25,22 +25,22 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.EspressoOptions; import com.oracle.truffle.espresso.classfile.JavaVersion; -import com.oracle.truffle.espresso.classfile.descriptors.Names; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.NameSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; public interface LanguageAccess { EspressoLanguage getLanguage(); - default Names getNames() { + default NameSymbols getNames() { return getLanguage().getNames(); } - default Types getTypes() { + default TypeSymbols getTypes() { return getLanguage().getTypes(); } - default Signatures getSignatures() { + default SignatureSymbols getSignatures() { return getLanguage().getSignatures(); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedField.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedField.java index ec28b84908f3..94647cde8138 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedField.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedField.java @@ -30,10 +30,10 @@ import com.oracle.truffle.espresso.classfile.ParserField; import com.oracle.truffle.espresso.classfile.attributes.Attribute; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; @@ -101,7 +101,7 @@ private IdMode idMode() { static String idFromNameAndType(Symbol name, ByteSequence t) { // Strip 'L' and ';' from the type symbol. - int arrayDims = Types.getArrayDimensions(t); + int arrayDims = TypeSymbols.getArrayDimensions(t); if (arrayDims > 0) { // Component string StringBuilder typeString = new StringBuilder(idFromNameAndType(name, t.subSequence(arrayDims, t.length() - arrayDims))); @@ -114,7 +114,7 @@ static String idFromNameAndType(Symbol name, ByteSequence t) { return typeString.toString(); } String typeString = t.toString(); - if (Types.isReference(t)) { + if (TypeSymbols.isReference(t)) { typeString = typeString.substring(1, typeString.length() - 1); typeString = typeString.replace('/', '_'); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlass.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlass.java index 608da854b016..a038f51f6b8d 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlass.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlass.java @@ -33,9 +33,10 @@ import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.ParserMethod; import com.oracle.truffle.espresso.classfile.attributes.Attribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject.StaticObjectFactory; // Structural shareable klass (superklass in superinterfaces resolved and linked) @@ -87,7 +88,7 @@ private LinkedKlass(ParserKlass parserKlass, LinkedKlass superKlass, LinkedKlass // Super interfaces are not checked for finalizers; a default .finalize method will be // resolved to Object.finalize, making the finalizer not observable. this.hasFinalizer = ((parserKlass.getFlags() & ACC_FINALIZER) != 0) || (superKlass != null && (superKlass.getFlags() & ACC_FINALIZER) != 0); - assert !this.hasFinalizer || !Type.java_lang_Object.equals(parserKlass.getType()) : "java.lang.Object cannot be marked as finalizable"; + assert !this.hasFinalizer || !Types.java_lang_Object.equals(parserKlass.getType()) : "java.lang.Object cannot be marked as finalizable"; final int methodCount = parserKlass.getMethods().length; LinkedMethod[] linkedMethods = new LinkedMethod[methodCount]; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlassFieldLayout.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlassFieldLayout.java index f17795d5fc6a..f9d12f8ae145 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlassFieldLayout.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedKlassFieldLayout.java @@ -38,9 +38,11 @@ import com.oracle.truffle.espresso.classfile.JavaVersion.VersionRange; import com.oracle.truffle.espresso.classfile.ParserField; import com.oracle.truffle.espresso.classfile.ParserKlass; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject.StaticObjectFactory; @@ -140,7 +142,7 @@ private static boolean storeAsFinal(ParserKlass klass, ParserField field) { // value of one of these fields is stored as final, the corresponding set method has no // effect on already compiled methods that folded the read of the field value during // compilation. - if (klassType == Type.java_lang_System && (fieldName == Name.in || fieldName == Name.out || fieldName == Name.err)) { + if (klassType == Types.java_lang_System && (fieldName == Names.in || fieldName == Names.out || fieldName == Names.err)) { return false; } return field.isFinal(); @@ -175,94 +177,94 @@ private static class HiddenField { private static final int NO_ADDITIONAL_FLAGS = 0; private static final HiddenField[] EMPTY = new HiddenField[0]; private static final Map, HiddenField[]> REGISTRY = Map.ofEntries( - entry(Type.java_lang_invoke_MemberName, new HiddenField[]{ - new HiddenField(Name.HIDDEN_VMTARGET), - new HiddenField(Name.HIDDEN_VMINDEX) + entry(Types.java_lang_invoke_MemberName, new HiddenField[]{ + new HiddenField(Names.HIDDEN_VMTARGET), + new HiddenField(Names.HIDDEN_VMINDEX) }), - entry(Type.java_lang_reflect_Method, new HiddenField[]{ - new HiddenField(Name.HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), - new HiddenField(Name.HIDDEN_METHOD_KEY) + entry(Types.java_lang_reflect_Method, new HiddenField[]{ + new HiddenField(Names.HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), + new HiddenField(Names.HIDDEN_METHOD_KEY) }), - entry(Type.java_lang_reflect_Constructor, new HiddenField[]{ - new HiddenField(Name.HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), - new HiddenField(Name.HIDDEN_CONSTRUCTOR_KEY) + entry(Types.java_lang_reflect_Constructor, new HiddenField[]{ + new HiddenField(Names.HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), + new HiddenField(Names.HIDDEN_CONSTRUCTOR_KEY) }), - entry(Type.java_lang_reflect_Field, new HiddenField[]{ - new HiddenField(Name.HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), - new HiddenField(Name.HIDDEN_FIELD_KEY) + entry(Types.java_lang_reflect_Field, new HiddenField[]{ + new HiddenField(Names.HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS), + new HiddenField(Names.HIDDEN_FIELD_KEY) }), // All references (including strong) get an extra hidden field, this // simplifies the code for weak/soft/phantom/final references. - entry(Type.java_lang_ref_Reference, new HiddenField[]{ + entry(Types.java_lang_ref_Reference, new HiddenField[]{ - new HiddenField(Name.HIDDEN_HOST_REFERENCE) + new HiddenField(Names.HIDDEN_HOST_REFERENCE) }), - entry(Type.java_lang_Throwable, new HiddenField[]{ - new HiddenField(Name.HIDDEN_FRAMES), - new HiddenField(Name.HIDDEN_EXCEPTION_WRAPPER) + entry(Types.java_lang_Throwable, new HiddenField[]{ + new HiddenField(Names.HIDDEN_FRAMES), + new HiddenField(Names.HIDDEN_EXCEPTION_WRAPPER) }), - entry(Type.java_lang_Thread, new HiddenField[]{ - new HiddenField(Name.HIDDEN_INTERRUPTED, Type._boolean, VersionRange.lower(13), NO_ADDITIONAL_FLAGS), - new HiddenField(Name.HIDDEN_HOST_THREAD), - new HiddenField(Name.HIDDEN_ESPRESSO_MANAGED, Type._boolean, VersionRange.ALL, NO_ADDITIONAL_FLAGS), - new HiddenField(Name.HIDDEN_DEPRECATION_SUPPORT), - new HiddenField(Name.HIDDEN_THREAD_UNPARK_SIGNALS, Type._int, VersionRange.ALL, Constants.ACC_VOLATILE), - new HiddenField(Name.HIDDEN_THREAD_PARK_LOCK, Type.java_lang_Object, VersionRange.ALL, Constants.ACC_FINAL), - new HiddenField(Name.HIDDEN_THREAD_SCOPED_VALUE_CACHE), + entry(Types.java_lang_Thread, new HiddenField[]{ + new HiddenField(Names.HIDDEN_INTERRUPTED, Types._boolean, VersionRange.lower(13), NO_ADDITIONAL_FLAGS), + new HiddenField(Names.HIDDEN_HOST_THREAD), + new HiddenField(Names.HIDDEN_ESPRESSO_MANAGED, Types._boolean, VersionRange.ALL, NO_ADDITIONAL_FLAGS), + new HiddenField(Names.HIDDEN_DEPRECATION_SUPPORT), + new HiddenField(Names.HIDDEN_THREAD_UNPARK_SIGNALS, Types._int, VersionRange.ALL, Constants.ACC_VOLATILE), + new HiddenField(Names.HIDDEN_THREAD_PARK_LOCK, Types.java_lang_Object, VersionRange.ALL, Constants.ACC_FINAL), + new HiddenField(Names.HIDDEN_THREAD_SCOPED_VALUE_CACHE), // Only used for j.l.management bookkeeping. - new HiddenField(Name.HIDDEN_THREAD_PENDING_MONITOR), - new HiddenField(Name.HIDDEN_THREAD_WAITING_MONITOR), - new HiddenField(Name.HIDDEN_THREAD_BLOCKED_COUNT), - new HiddenField(Name.HIDDEN_THREAD_WAITED_COUNT), - new HiddenField(Name.HIDDEN_THREAD_DEPTH_FIRST_NUMBER), + new HiddenField(Names.HIDDEN_THREAD_PENDING_MONITOR), + new HiddenField(Names.HIDDEN_THREAD_WAITING_MONITOR), + new HiddenField(Names.HIDDEN_THREAD_BLOCKED_COUNT), + new HiddenField(Names.HIDDEN_THREAD_WAITED_COUNT), + new HiddenField(Names.HIDDEN_THREAD_DEPTH_FIRST_NUMBER), }), - entry(Type.java_lang_Class, new HiddenField[]{ - new HiddenField(Name.HIDDEN_SIGNERS), - new HiddenField(Name.HIDDEN_MIRROR_KLASS, Constants.ACC_FINAL), - new HiddenField(Name.HIDDEN_PROTECTION_DOMAIN), - new HiddenField(Name.HIDDEN_JVMCIINDY, Type.java_lang_Object, EspressoLanguage::isJVMCIEnabled, NO_ADDITIONAL_FLAGS) + entry(Types.java_lang_Class, new HiddenField[]{ + new HiddenField(Names.HIDDEN_SIGNERS), + new HiddenField(Names.HIDDEN_MIRROR_KLASS, Constants.ACC_FINAL), + new HiddenField(Names.HIDDEN_PROTECTION_DOMAIN), + new HiddenField(Names.HIDDEN_JVMCIINDY, Types.java_lang_Object, EspressoLanguage::isJVMCIEnabled, NO_ADDITIONAL_FLAGS) }), - entry(Type.java_lang_ClassLoader, new HiddenField[]{ - new HiddenField(Name.HIDDEN_CLASS_LOADER_REGISTRY) + entry(Types.java_lang_ClassLoader, new HiddenField[]{ + new HiddenField(Names.HIDDEN_CLASS_LOADER_REGISTRY) }), - entry(Type.java_lang_Module, new HiddenField[]{ - new HiddenField(Name.HIDDEN_MODULE_ENTRY) + entry(Types.java_lang_Module, new HiddenField[]{ + new HiddenField(Names.HIDDEN_MODULE_ENTRY) }), - entry(Type.java_util_regex_Pattern, new HiddenField[]{ - new HiddenField(Name.HIDDEN_TREGEX_MATCH), - new HiddenField(Name.HIDDEN_TREGEX_FULLMATCH), - new HiddenField(Name.HIDDEN_TREGEX_SEARCH), - new HiddenField(Name.HIDDEN_TREGEX_UNSUPPORTED) + entry(Types.java_util_regex_Pattern, new HiddenField[]{ + new HiddenField(Names.HIDDEN_TREGEX_MATCH), + new HiddenField(Names.HIDDEN_TREGEX_FULLMATCH), + new HiddenField(Names.HIDDEN_TREGEX_SEARCH), + new HiddenField(Names.HIDDEN_TREGEX_UNSUPPORTED) }), - entry(Type.java_util_regex_Matcher, new HiddenField[]{ - new HiddenField(Name.HIDDEN_TREGEX_TSTRING), - new HiddenField(Name.HIDDEN_TREGEX_OLD_LAST_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_MOD_COUNT_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_FROM_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_TO_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_SEARCH_FROM_BACKUP), - new HiddenField(Name.HIDDEN_TREGEX_MATCHING_MODE_BACKUP) + entry(Types.java_util_regex_Matcher, new HiddenField[]{ + new HiddenField(Names.HIDDEN_TREGEX_TSTRING), + new HiddenField(Names.HIDDEN_TREGEX_OLD_LAST_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_MOD_COUNT_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_FROM_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_TO_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_SEARCH_FROM_BACKUP), + new HiddenField(Names.HIDDEN_TREGEX_MATCHING_MODE_BACKUP) }), - entry(Type.com_oracle_truffle_espresso_polyglot_TypeLiteral, new HiddenField[]{ - new HiddenField(Name.HIDDEN_INTERNAL_TYPE)}), - entry(Type.org_graalvm_continuations_ContinuationImpl, new HiddenField[]{ - new HiddenField(Name.HIDDEN_CONTINUATION_FRAME_RECORD) + entry(Types.com_oracle_truffle_espresso_polyglot_TypeLiteral, new HiddenField[]{ + new HiddenField(Names.HIDDEN_INTERNAL_TYPE)}), + entry(Types.org_graalvm_continuations_ContinuationImpl, new HiddenField[]{ + new HiddenField(Names.HIDDEN_CONTINUATION_FRAME_RECORD) }), - entry(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType, new HiddenField[]{ - new HiddenField(Name.HIDDEN_OBJECTKLASS_MIRROR), + entry(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType, new HiddenField[]{ + new HiddenField(Names.HIDDEN_OBJECTKLASS_MIRROR), }), - entry(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField, new HiddenField[]{ - new HiddenField(Name.HIDDEN_FIELD_MIRROR) + entry(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField, new HiddenField[]{ + new HiddenField(Names.HIDDEN_FIELD_MIRROR) }), - entry(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod, new HiddenField[]{ - new HiddenField(Name.HIDDEN_METHOD_MIRROR) + entry(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod, new HiddenField[]{ + new HiddenField(Names.HIDDEN_METHOD_MIRROR) }), - entry(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant, new HiddenField[]{ - new HiddenField(Name.HIDDEN_OBJECT_CONSTANT) + entry(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant, new HiddenField[]{ + new HiddenField(Names.HIDDEN_OBJECT_CONSTANT) })); private final Symbol name; @@ -271,11 +273,11 @@ private static class HiddenField { private final int additionalFlags; HiddenField(Symbol name) { - this(name, Type.java_lang_Object, NO_PREDICATE, NO_ADDITIONAL_FLAGS); + this(name, Types.java_lang_Object, NO_PREDICATE, NO_ADDITIONAL_FLAGS); } HiddenField(Symbol name, int additionalFlags) { - this(name, Type.java_lang_Object, NO_PREDICATE, additionalFlags); + this(name, Types.java_lang_Object, NO_PREDICATE, additionalFlags); } HiddenField(Symbol name, Symbol type, VersionRange versionRange, int additionalFlags) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedMethod.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedMethod.java index 208baa47cfe2..9254ce10d7de 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedMethod.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LinkedMethod.java @@ -24,9 +24,9 @@ import com.oracle.truffle.espresso.classfile.ParserMethod; import com.oracle.truffle.espresso.classfile.attributes.Attribute; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; public final class LinkedMethod { private final ParserMethod parserMethod; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LoadingConstraints.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LoadingConstraints.java index 5a80e185c7c1..c086e067a01d 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LoadingConstraints.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/LoadingConstraints.java @@ -29,7 +29,7 @@ import java.util.logging.Level; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugTimer; import com.oracle.truffle.espresso.meta.EspressoError; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Member.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Member.java index 9c215817ce2b..cdc9288f0461 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Member.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Member.java @@ -22,16 +22,16 @@ */ package com.oracle.truffle.espresso.impl; +import java.util.function.Function; + import com.oracle.truffle.api.dsl.Idempotent; +import com.oracle.truffle.espresso.classfile.descriptors.Descriptor; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Descriptor; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.constantpool.Resolution; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.shared.meta.MemberAccess; -import java.util.function.Function; - public abstract class Member implements MemberAccess { public abstract Symbol getName(); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Method.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Method.java index 22e6715c72d7..4bd5d4d222d0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Method.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/Method.java @@ -88,12 +88,14 @@ import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.ffi.NativeAccess; import com.oracle.truffle.espresso.ffi.NativeSignature; import com.oracle.truffle.espresso.ffi.NativeType; @@ -288,10 +290,10 @@ public int[] getSOEHandlerInfo() { ArrayList toArray = new ArrayList<>(); for (ExceptionHandler handler : getExceptionHandlers()) { if (handler.isCatchAll() // - || handler.getCatchType() == Type.java_lang_StackOverflowError // - || handler.getCatchType() == Type.java_lang_VirtualMachineError // - || handler.getCatchType() == Type.java_lang_Error // - || handler.getCatchType() == Type.java_lang_Throwable) { + || handler.getCatchType() == Types.java_lang_StackOverflowError // + || handler.getCatchType() == Types.java_lang_VirtualMachineError // + || handler.getCatchType() == Types.java_lang_Error // + || handler.getCatchType() == Types.java_lang_Throwable) { toArray.add(handler.getStartBCI()); toArray.add(handler.getEndBCI()); toArray.add(handler.getHandlerBCI()); @@ -309,8 +311,8 @@ public int[] getSOEHandlerInfo() { } public static NativeSignature buildJniNativeSignature(Symbol[] signature) { - NativeType returnType = NativeAccess.kindToNativeType(Signatures.returnKind(signature)); - int argCount = Signatures.parameterCount(signature); + NativeType returnType = NativeAccess.kindToNativeType(SignatureSymbols.returnKind(signature)); + int argCount = SignatureSymbols.parameterCount(signature); // Prepend JNIEnv* and class|receiver. NativeType[] parameterTypes = new NativeType[argCount + 2]; @@ -322,7 +324,7 @@ public static NativeSignature buildJniNativeSignature(Symbol[] signature) parameterTypes[1] = NativeType.OBJECT; for (int i = 0; i < argCount; ++i) { - parameterTypes[i + 2] = NativeAccess.kindToNativeType(Signatures.parameterKind(signature, i)); + parameterTypes[i + 2] = NativeAccess.kindToNativeType(SignatureSymbols.parameterKind(signature, i)); } return NativeSignature.create(returnType, parameterTypes); @@ -419,7 +421,7 @@ private CallTarget lookupJniCallTarget(Meta meta, boolean fullSignature) { } public boolean isConstructor() { - return Name._init_.equals(getName()); + return Names._init_.equals(getName()); } public boolean isDefault() { @@ -468,7 +470,7 @@ public boolean hasReceiver() { * Determines if this method is {@link java.lang.Object#Object()}. */ public boolean isJavaLangObjectInit() { - return getDeclaringKlass().isJavaLangObject() && Name._init_.equals(getName()); + return getDeclaringKlass().isJavaLangObject() && Names._init_.equals(getName()); } // region Meta.Method @@ -486,7 +488,7 @@ public Object invokeWithConversions(Object self, Object... args) { tls.blockContinuationSuspension(); try { getLanguage().clearPendingException(); - assert args.length == Signatures.parameterCount(getParsedSignature()); + assert args.length == SignatureSymbols.parameterCount(getParsedSignature()); // assert !isStatic() || ((StaticObject) self).isStatic(); final Object[] filteredArgs; @@ -523,7 +525,7 @@ public Object invokeDirect(Object... args) { try { getLanguage().clearPendingException(); assert !isStatic(); - assert args.length == Signatures.parameterCount(getParsedSignature()) + 1; + assert args.length == SignatureSymbols.parameterCount(getParsedSignature()) + 1; assert getDeclaringKlass().isAssignableFrom(((StaticObject) args[0]).getKlass()); return getCallTarget().call(args); } finally { @@ -552,7 +554,7 @@ public Object invokeDirectStatic(Object... args) { try { getLanguage().clearPendingException(); assert isStatic(); - assert args.length == Signatures.parameterCount(getParsedSignature()); + assert args.length == SignatureSymbols.parameterCount(getParsedSignature()); getDeclaringKlass().safeInitialize(); return getCallTarget().call(args); } finally { @@ -581,7 +583,7 @@ public Object invokeDirectSpecial(Object... args) { } public boolean isClassInitializer() { - return Name._clinit_.equals(getName()) && isStatic(); + return Names._clinit_.equals(getName()) && isStatic(); } @Override @@ -625,16 +627,16 @@ public String toString() { } public JavaKind getReturnKind() { - return Signatures.returnKind(getParsedSignature()); + return SignatureSymbols.returnKind(getParsedSignature()); } public Klass[] resolveParameterKlasses() { // TODO(peterssen): Use resolved signature. final Symbol[] signature = getParsedSignature(); - int paramCount = Signatures.parameterCount(signature); + int paramCount = SignatureSymbols.parameterCount(signature); Klass[] paramsKlasses = paramCount > 0 ? new Klass[paramCount] : Klass.EMPTY_ARRAY; for (int i = 0; i < paramCount; ++i) { - Symbol paramType = Signatures.parameterType(signature, i); + Symbol paramType = SignatureSymbols.parameterType(signature, i); paramsKlasses[i] = getMeta().resolveSymbolOrFail(paramType, getDeclaringKlass().getDefiningClassLoader(), getDeclaringKlass().protectionDomain()); @@ -694,14 +696,14 @@ private EspressoType getGenericEspressoType(ReturnType type) { public Klass resolveReturnKlass() { // TODO(peterssen): Use resolved signature. - return getMeta().resolveSymbolOrFail(Signatures.returnType(getParsedSignature()), + return getMeta().resolveSymbolOrFail(SignatureSymbols.returnType(getParsedSignature()), getDeclaringKlass().getDefiningClassLoader(), getDeclaringKlass().protectionDomain()); } @Idempotent public int getParameterCount() { - return Signatures.parameterCount(getParsedSignature()); + return SignatureSymbols.parameterCount(getParsedSignature()); } public int getArgumentCount() { @@ -743,7 +745,7 @@ public static Method getHostReflectiveConstructorRoot(StaticObject seed, Meta me Klass holder = meta.java_lang_reflect_Constructor_clazz.getObject(rootMethod).getMirrorKlass(meta); Symbol signature = rebuildConstructorSignature(meta, rootMethod); assert signature != null; - Method method = holder.lookupDeclaredMethod(Name._init_, signature, Klass.LookupMode.INSTANCE_ONLY); + Method method = holder.lookupDeclaredMethod(Names._init_, signature, Klass.LookupMode.INSTANCE_ONLY); assert method != null; // remember the mapping for the next query meta.HIDDEN_CONSTRUCTOR_KEY.setHiddenObject(rootMethod, method); @@ -797,14 +799,14 @@ public boolean isSignaturePolymorphicDeclared() { return false; } Symbol[] signature = getParsedSignature(); - if (Signatures.parameterCount(signature) != 1) { + if (SignatureSymbols.parameterCount(signature) != 1) { return false; } - if (Signatures.parameterType(signature, 0) != Type.java_lang_Object_array) { + if (SignatureSymbols.parameterType(signature, 0) != Types.java_lang_Object_array) { return false; } if (getJavaVersion().java8OrEarlier()) { - if (Signatures.returnType(signature) != Type.java_lang_Object) { + if (SignatureSymbols.returnType(signature) != Types.java_lang_Object) { return false; } } @@ -846,7 +848,7 @@ public void setPoisonPill() { } public boolean hasSourceFileAttribute() { - return declaringKlass.getAttribute(Name.SourceFile) != null; + return declaringKlass.getAttribute(Names.SourceFile) != null; } public String report(int curBCI) { @@ -1031,7 +1033,7 @@ public String getGenericSignatureAsString() { if (attr == null) { genericSignature = ""; // if no generics, the generic signature is empty } else { - genericSignature = getRuntimeConstantPool().symbolAt(attr.getSignatureIndex()).toString(); + genericSignature = getRuntimeConstantPool().symbolAtUnsafe(attr.getSignatureIndex()).toString(); } } return genericSignature; @@ -1132,7 +1134,7 @@ public SharedRedefinitionContent redefine(ObjectKlass.KlassVersion klassVersion, // install the new method version immediately LinkedMethod newLinkedMethod = new LinkedMethod(newMethod); RuntimeConstantPool runtimePool = new RuntimeConstantPool(newKlass.getConstantPool(), klassVersion.getKlass()); - CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Name.Code); + CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Names.Code); MethodVersion oldVersion = methodVersion; methodVersion = oldVersion.replace(klassVersion, runtimePool, newLinkedMethod, newCodeAttribute); ids.replaceObject(oldVersion, methodVersion); @@ -1199,17 +1201,17 @@ public StaticObject makeMirror(Meta meta) { @TruffleBoundary public StaticObject makeConstructorMirror(Meta meta) { assert isConstructor(); - Attribute rawRuntimeVisibleAnnotations = getAttribute(Name.RuntimeVisibleAnnotations); + Attribute rawRuntimeVisibleAnnotations = getAttribute(Names.RuntimeVisibleAnnotations); StaticObject runtimeVisibleAnnotations = rawRuntimeVisibleAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawRuntimeVisibleParameterAnnotations = getAttribute(Name.RuntimeVisibleParameterAnnotations); + Attribute rawRuntimeVisibleParameterAnnotations = getAttribute(Names.RuntimeVisibleParameterAnnotations); StaticObject runtimeVisibleParameterAnnotations = rawRuntimeVisibleParameterAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleParameterAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Name.RuntimeVisibleTypeAnnotations); + Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Names.RuntimeVisibleTypeAnnotations); StaticObject runtimeVisibleTypeAnnotations = rawRuntimeVisibleTypeAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleTypeAnnotations.getData(), meta) : StaticObject.NULL; @@ -1259,22 +1261,22 @@ public StaticObject apply(int j) { @TruffleBoundary public StaticObject makeMethodMirror(Meta meta) { assert !isConstructor(); - Attribute rawRuntimeVisibleAnnotations = getAttribute(Name.RuntimeVisibleAnnotations); + Attribute rawRuntimeVisibleAnnotations = getAttribute(Names.RuntimeVisibleAnnotations); StaticObject runtimeVisibleAnnotations = rawRuntimeVisibleAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawRuntimeVisibleParameterAnnotations = getAttribute(Name.RuntimeVisibleParameterAnnotations); + Attribute rawRuntimeVisibleParameterAnnotations = getAttribute(Names.RuntimeVisibleParameterAnnotations); StaticObject runtimeVisibleParameterAnnotations = rawRuntimeVisibleParameterAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleParameterAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Name.RuntimeVisibleTypeAnnotations); + Attribute rawRuntimeVisibleTypeAnnotations = getAttribute(Names.RuntimeVisibleTypeAnnotations); StaticObject runtimeVisibleTypeAnnotations = rawRuntimeVisibleTypeAnnotations != null ? StaticObject.wrap(rawRuntimeVisibleTypeAnnotations.getData(), meta) : StaticObject.NULL; - Attribute rawAnnotationDefault = getAttribute(Name.AnnotationDefault); + Attribute rawAnnotationDefault = getAttribute(Names.AnnotationDefault); StaticObject annotationDefault = rawAnnotationDefault != null ? StaticObject.wrap(rawAnnotationDefault.getData(), meta) : StaticObject.NULL; @@ -1296,10 +1298,10 @@ public StaticObject apply(int j) { } }); - SignatureAttribute signatureAttribute = (SignatureAttribute) getAttribute(Name.Signature); + SignatureAttribute signatureAttribute = (SignatureAttribute) getAttribute(Names.Signature); StaticObject guestGenericSignature = StaticObject.NULL; if (signatureAttribute != null) { - String sig = getConstantPool().symbolAt(signatureAttribute.getSignatureIndex(), "signature").toString(); + String sig = getConstantPool().symbolAtUnsafe(signatureAttribute.getSignatureIndex(), "signature").toString(); guestGenericSignature = meta.toGuestString(sig); } @@ -1490,7 +1492,7 @@ public SourceSection getSourceSectionAtBCI(int bci) { public void initRefKind() { if (Modifier.isStatic(linkedMethod.getFlags())) { this.refKind = REF_invokeStatic; - } else if (Modifier.isPrivate(linkedMethod.getFlags()) || Name._init_.equals(linkedMethod.getName())) { + } else if (Modifier.isPrivate(linkedMethod.getFlags()) || Names._init_.equals(linkedMethod.getName())) { this.refKind = REF_invokeSpecial; } else if (klassVersion.isInterface()) { this.refKind = REF_invokeInterface; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ModuleTable.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ModuleTable.java index 2c34d002a706..466760430cb4 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ModuleTable.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ModuleTable.java @@ -24,9 +24,10 @@ import java.util.concurrent.locks.ReadWriteLock; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.tables.AbstractModuleTable; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.jdwp.api.ModuleRef; import com.oracle.truffle.espresso.meta.Meta; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; @@ -65,7 +66,7 @@ public Object classLoader() { return meta.java_lang_Module_loader.getObject(module); } else { // this must be the early java.base module - assert name.equals(Name.java_base); + assert name.equals(Names.java_base); return StaticObject.NULL; } } @@ -79,7 +80,7 @@ public ClassRegistry registry(Meta meta) { return registries.getClassRegistry(loader); } else { // this must be the early java.base module - assert name.equals(Name.java_base); + assert name.equals(Names.java_base); return registries.getBootClassRegistry(); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ObjectKlass.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ObjectKlass.java index 977094fbaaeb..7df117a282da 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ObjectKlass.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/ObjectKlass.java @@ -75,13 +75,15 @@ import com.oracle.truffle.espresso.classfile.attributes.SourceFileAttribute; import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; -import com.oracle.truffle.espresso.classfile.descriptors.Names; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.NameSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ModuleTable.ModuleEntry; import com.oracle.truffle.espresso.impl.PackageTable.PackageEntry; import com.oracle.truffle.espresso.jdwp.api.Ids; @@ -212,7 +214,7 @@ public ObjectKlass(EspressoContext context, LinkedKlass linkedKlass, ObjectKlass LinkedField lkField = lkStaticFields[i]; // User-defined static non-final fields should remain modifiable. if (superKlass == getMeta().java_lang_Enum && !isEnumValuesField(lkField) // - && Types.isReference(lkField.getType()) && Modifier.isFinal(lkField.getFlags())) { + && TypeSymbols.isReference(lkField.getType()) && Modifier.isFinal(lkField.getFlags())) { staticField = new EnumConstantField(klassVersion, lkField, pool); } else { staticField = new Field(klassVersion, lkField, pool); @@ -243,8 +245,8 @@ public ObjectKlass(EspressoContext context, LinkedKlass linkedKlass, ObjectKlass } private static boolean isEnumValuesField(LinkedField lkStaticFields) { - return lkStaticFields.getName() == Name.$VALUES || - lkStaticFields.getName() == Name.ENUM$VALUES; + return lkStaticFields.getName() == Names.$VALUES || + lkStaticFields.getName() == Names.ENUM$VALUES; } private void addSubType(ObjectKlass objectKlass) { @@ -798,7 +800,7 @@ public Klass getEnclosingType() { public Method[] getDeclaredConstructors() { List constructors = new ArrayList<>(); for (Method m : getDeclaredMethods()) { - if (Name._init_.equals(m.getName())) { + if (Names._init_.equals(m.getName())) { constructors.add(m); } } @@ -1185,7 +1187,7 @@ public Method resolveInterfaceMethod(Symbol methodName, Symbol * specified by the interface method reference, which has its ACC_PUBLIC flag set and does * not have its ACC_STATIC flag set, method lookup succeeds. */ - assert getSuperKlass().getType() == Type.java_lang_Object; + assert getSuperKlass().getType() == Types.java_lang_Object; Method m = getSuperKlass().lookupDeclaredMethod(methodName, signature); if (m != null && m.isPublic() && !m.isStatic()) { return m; @@ -1347,7 +1349,7 @@ public List> getNestedTypeNames() { } private void initPackage(@JavaType(ClassLoader.class) StaticObject classLoader) { - if (!Names.isUnnamedPackage(getRuntimePackage())) { + if (!NameSymbols.isUnnamedPackage(getRuntimePackage())) { ClassRegistry registry = getRegistries().getClassRegistry(classLoader); PackageEntry entry = registry.packages().lookup(getRuntimePackage()); // If the package name is not found in the loader's package @@ -1437,7 +1439,7 @@ public String getGenericTypeAsString() { if (attr == null) { genericSignature = ""; // if no generics, the generic signature is empty } else { - genericSignature = getConstantPool().symbolAt(attr.getSignatureIndex()).toString(); + genericSignature = getConstantPool().symbolAtUnsafe(attr.getSignatureIndex()).toString(); } } return genericSignature; @@ -1636,7 +1638,7 @@ private void incrementKlassRedefinitionCount() { // we need to invalidate the super class method, to allow // for new method dispatch lookup private void checkSuperMethods(ObjectKlass superKlass, int flags, Symbol methodName, Symbol signature, List invalidatedClasses) { - if (!Modifier.isStatic(flags) && !Modifier.isPrivate(flags) && !Name._init_.equals(methodName)) { + if (!Modifier.isStatic(flags) && !Modifier.isPrivate(flags) && !Names._init_.equals(methodName)) { ObjectKlass currentKlass = this; ObjectKlass currentSuper = superKlass; while (currentSuper != null) { @@ -1677,10 +1679,10 @@ private List getSubTypes() { } private static boolean isVirtual(ParserMethod m) { - return !Modifier.isStatic(m.getFlags()) && !Modifier.isPrivate(m.getFlags()) && !Name._init_.equals(m.getName()); + return !Modifier.isStatic(m.getFlags()) && !Modifier.isPrivate(m.getFlags()) && !Names._init_.equals(m.getName()); } - public void patchClassName(Symbol newName, Symbol newType) { + public void patchClassName(Symbol newName, Symbol newType) { name = newName; type = newType; } @@ -1851,7 +1853,7 @@ private KlassVersion(KlassVersion oldVersion, RuntimeConstantPool pool, LinkedKl methods[i] = redefineContent.getMethodVersion(); int flags = newMethod.getFlags(); - if (!Modifier.isStatic(flags) && !Modifier.isPrivate(flags) && !Name._init_.equals(newMethod.getName())) { + if (!Modifier.isStatic(flags) && !Modifier.isPrivate(flags) && !Names._init_.equals(newMethod.getName())) { copyCheckMap.put(declMethod, redefineContent); } } @@ -2050,7 +2052,7 @@ private HierarchyInfo updateHierarchyInfo() { } public String getSourceFile() { - SourceFileAttribute sfa = (SourceFileAttribute) getAttribute(Name.SourceFile); + SourceFileAttribute sfa = (SourceFileAttribute) getAttribute(Names.SourceFile); if (sfa == null) { return null; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PackageTable.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PackageTable.java index 297cc3dda6c3..121f9a3753c0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PackageTable.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PackageTable.java @@ -24,8 +24,8 @@ import java.util.concurrent.locks.ReadWriteLock; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.classfile.tables.AbstractPackageTable; import com.oracle.truffle.espresso.impl.ModuleTable.ModuleEntry; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PrimitiveKlass.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PrimitiveKlass.java index d42699688235..40ad20e7c6cf 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PrimitiveKlass.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/PrimitiveKlass.java @@ -28,9 +28,9 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.JavaKind; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; import com.oracle.truffle.espresso.impl.ModuleTable.ModuleEntry; import com.oracle.truffle.espresso.impl.ObjectKlass.KlassVersion; import com.oracle.truffle.espresso.impl.PackageTable.PackageEntry; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/VirtualTable.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/VirtualTable.java index 50b6c025f888..07c994362005 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/VirtualTable.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/VirtualTable.java @@ -25,7 +25,7 @@ import java.util.ArrayList; import java.util.Arrays; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.meta.Meta; /** @@ -48,7 +48,7 @@ public static Method.MethodVersion[] create(ObjectKlass superKlass, Method.Metho tmp = new ArrayList<>(); } for (Method.MethodVersion m : declaredMethods) { - if (!m.isPrivate() && !m.isStatic() && !Name._clinit_.equals(m.getName()) && !Name._init_.equals(m.getName())) { + if (!m.isPrivate() && !m.isStatic() && !Names._clinit_.equals(m.getName()) && !Names._init_.equals(m.getName())) { // Do not bloat the vtable with methods that cannot be called through // virtual invocation. checkOverride(superKlass, m, tmp, thisKlass, overrides, isRedefinition); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/generics/factory/CoreReflectionFactory.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/generics/factory/CoreReflectionFactory.java index 12eed052ef24..948f56dd842b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/generics/factory/CoreReflectionFactory.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/impl/generics/factory/CoreReflectionFactory.java @@ -68,7 +68,7 @@ public EspressoType makeParameterizedType(EspressoType declaration, } public EspressoType makeNamedType(String dotName) { - return klass.getMeta().loadKlassOrNull(klass.getTypes().getOrCreate(toInternalName(dotName)), getDefiningClassLoader(), StaticObject.NULL); + return klass.getMeta().loadKlassOrNull(klass.getTypes().getOrCreateValidType(toInternalName(dotName)), getDefiningClassLoader(), StaticObject.NULL); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/JniEnv.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/JniEnv.java index c85f2027c17f..06343d9c29f7 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/JniEnv.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/JniEnv.java @@ -52,13 +52,14 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUtf8; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.descriptors.Validation; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.ffi.NativeAccess; import com.oracle.truffle.espresso.ffi.NativeSignature; import com.oracle.truffle.espresso.ffi.NativeType; @@ -324,7 +325,7 @@ public Object[] popVarArgs(@Pointer TruffleObject varargsPtr, final Symbol public Object[] popVarArgs(@Pointer TruffleObject varargsPtr, final Symbol[] signature, StaticObject receiver) { VarArgs varargs = new VarArgsImpl(varargsPtr); - int paramCount = Signatures.parameterCount(signature); + int paramCount = SignatureSymbols.parameterCount(signature); int argCount = paramCount; int argOffset = 0; if (receiver != null) { @@ -336,7 +337,7 @@ public Object[] popVarArgs(@Pointer TruffleObject varargsPtr, final Symbol args[0] = receiver; } for (int i = 0; i < paramCount; ++i) { - JavaKind kind = Signatures.parameterKind(signature, i); + JavaKind kind = SignatureSymbols.parameterKind(signature, i); // @formatter:off switch (kind) { case Boolean : args[i + argOffset] = varargs.popBoolean(); break; @@ -442,7 +443,7 @@ private WeakHandles methodIds() { Field field = null; Symbol fieldName = getNames().lookup(name); if (fieldName != null) { - Symbol fieldType = getTypes().lookup(type); + Symbol fieldType = getTypes().lookupValidType(type); if (fieldType != null) { // Lookup only if name and type are known symbols. klass.safeInitialize(); @@ -485,7 +486,7 @@ private WeakHandles methodIds() { Field field = null; Symbol fieldName = getNames().lookup(name); if (fieldName != null) { - Symbol fieldType = getTypes().lookup(type); + Symbol fieldType = getTypes().lookupValidType(type); if (fieldType != null) { Klass klass = clazz.getMirrorKlass(getMeta()); klass.safeInitialize(); @@ -583,7 +584,7 @@ private WeakHandles methodIds() { klass.safeInitialize(); // Lookup only if name and type are known symbols. - if (Name._clinit_.equals(methodName)) { + if (Names._clinit_.equals(methodName)) { // Never search superclasses for static initializers. method = klass.lookupDeclaredMethod(methodName, methodSignature); } else { @@ -1580,7 +1581,7 @@ public int GetStringLength(@JavaType(String.class) StaticObject string) { ByteBuffer isCopyBuf = NativeUtils.directByteBuffer(isCopyPtr, 1); isCopyBuf.put((byte) 1); // always copy since pinning is not supported } - byte[] bytes = ModifiedUtf8.fromJavaString(getMeta().toHostString(str), true); + byte[] bytes = ModifiedUTF8.fromJavaString(getMeta().toHostString(str), true); ByteBuffer region = allocateDirect(bytes.length); region.put(bytes); return NativeUtils.byteBufferPointer(region); @@ -1688,7 +1689,7 @@ public void GetStringRegion(@JavaType(String.class) StaticObject str, int start, @JniImpl public int GetStringUTFLength(@JavaType(String.class) StaticObject string) { - return ModifiedUtf8.utfLength(getMeta().toHostString(string)); + return ModifiedUTF8.utfLength(getMeta().toHostString(string)); } @JniImpl @@ -1700,7 +1701,7 @@ public void GetStringUTFRegion(@JavaType(String.class) StaticObject str, int sta throw meta.throwException(meta.java_lang_StringIndexOutOfBoundsException); } // always 0-terminated. - byte[] bytes = ModifiedUtf8.fromJavaString(hostString, start, len, true); + byte[] bytes = ModifiedUTF8.fromJavaString(hostString, start, len, true); ByteBuffer buf = NativeUtils.directByteBuffer(bufPtr, bytes.length, JavaKind.Byte); buf.put(bytes); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/Mangle.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/Mangle.java index 5481fdf53427..2b4df3422184 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/Mangle.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jni/Mangle.java @@ -23,9 +23,9 @@ package com.oracle.truffle.espresso.jni; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.MetaUtil; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jvmci/JVMCIUtils.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jvmci/JVMCIUtils.java index 7f8c2dbbbd60..0fa553cf43c3 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jvmci/JVMCIUtils.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/jvmci/JVMCIUtils.java @@ -27,10 +27,10 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.constantpool.ClassConstant; import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -45,7 +45,7 @@ private JVMCIUtils() { @TruffleBoundary public static ObjectKlass findInstanceType(Symbol symbol, ObjectKlass accessingKlass, boolean resolve, Meta meta) { - assert !Types.isArray(symbol); + assert !TypeSymbols.isArray(symbol); StaticObject loader = accessingKlass.getDefiningClassLoader(); if (resolve) { return (ObjectKlass) meta.loadKlassOrFail(symbol, loader, accessingKlass.protectionDomain()); @@ -56,7 +56,7 @@ public static ObjectKlass findInstanceType(Symbol symbol, ObjectKlass acce @TruffleBoundary public static Klass findType(Symbol symbol, ObjectKlass accessingKlass, boolean resolve, Meta meta) { - if (Types.isPrimitive(symbol)) { + if (TypeSymbols.isPrimitive(symbol)) { return meta.resolvePrimitive(symbol); } else { return findObjectType(symbol, accessingKlass, resolve, meta); @@ -65,12 +65,12 @@ public static Klass findType(Symbol symbol, ObjectKlass accessingKlass, bo @TruffleBoundary public static Klass findObjectType(Symbol symbol, ObjectKlass accessingKlass, boolean resolve, Meta meta) { - if (Types.isArray(symbol)) { + if (TypeSymbols.isArray(symbol)) { Klass elemental = findType(meta.getTypes().getElementalType(symbol), accessingKlass, resolve, meta); if (elemental == null) { return null; } - return elemental.getArrayClass(Types.getArrayDimensions(symbol)); + return elemental.getArrayClass(TypeSymbols.getArrayDimensions(symbol)); } else { return findInstanceType(symbol, accessingKlass, resolve, meta); } @@ -83,11 +83,11 @@ public static Klass findObjectType(ClassConstant classConstant, RuntimeConstantP Symbol name = ((ClassConstant.ImmutableClassConstant) classConstant).getName(pool); Symbol type; if (resolve) { - type = meta.getTypes().fromName(name); + type = meta.getTypes().fromClassNameEntry(name); } else { - type = meta.getTypes().lookupName(name); + type = meta.getTypes().lookupValidType(TypeSymbols.nameToType(name)); } - if (type == null || Types.isPrimitive(type)) { + if (type == null || TypeSymbols.isPrimitive(type)) { return null; } return findObjectType(type, pool.getHolder(), resolve, meta); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/DiffVersionLoadHelper.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/DiffVersionLoadHelper.java index 1517fed19a7b..82a2eaaeffd3 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/DiffVersionLoadHelper.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/DiffVersionLoadHelper.java @@ -24,10 +24,10 @@ package com.oracle.truffle.espresso.meta; import com.oracle.truffle.espresso.classfile.JavaVersion.VersionRange; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/ExceptionDispatch.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/ExceptionDispatch.java index 2da54755f127..e6c12d27bad9 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/ExceptionDispatch.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/ExceptionDispatch.java @@ -24,7 +24,8 @@ package com.oracle.truffle.espresso.meta; import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.ContextAccessImpl; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.runtime.EspressoContext; @@ -113,21 +114,21 @@ private void slowInitEx(StaticObject ex, ObjectKlass klass, StaticObject message @CompilerDirectives.TruffleBoundary private static void doFullInit(StaticObject ex, ObjectKlass klass, StaticObject message, StaticObject cause) { - klass.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void_String_Throwable).invokeDirectSpecial(ex, message, cause); + klass.lookupDeclaredMethod(Names._init_, Signatures._void_String_Throwable).invokeDirectSpecial(ex, message, cause); } @CompilerDirectives.TruffleBoundary private static void doCauseInit(StaticObject ex, ObjectKlass klass, StaticObject cause) { - klass.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void_Throwable).invokeDirectSpecial(ex, cause); + klass.lookupDeclaredMethod(Names._init_, Signatures._void_Throwable).invokeDirectSpecial(ex, cause); } @CompilerDirectives.TruffleBoundary private static void doMessageInit(StaticObject ex, ObjectKlass klass, StaticObject message) { - klass.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void_String).invokeDirectSpecial(ex, message); + klass.lookupDeclaredMethod(Names._init_, Signatures._void_String).invokeDirectSpecial(ex, message); } @CompilerDirectives.TruffleBoundary private static void doInit(StaticObject ex, ObjectKlass klass) { - klass.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void).invokeDirectSpecial(ex); + klass.lookupDeclaredMethod(Names._init_, Signatures._void).invokeDirectSpecial(ex); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java index abd621e1d679..188002fa490b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java @@ -47,11 +47,13 @@ import com.oracle.truffle.espresso.EspressoOptions.SpecComplianceMode; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.ContextAccessImpl; import com.oracle.truffle.espresso.impl.EspressoClassLoadingException; @@ -93,25 +95,25 @@ public Meta(EspressoContext context) { // Core types. // Object and Class (+ Class fields) must be initialized before all other classes in order // to eagerly create the guest Class instances. - java_lang_Object = knownKlass(Type.java_lang_Object); + java_lang_Object = knownKlass(Types.java_lang_Object); // Cloneable must be loaded before Serializable. - java_lang_Cloneable = knownKlass(Type.java_lang_Cloneable); - java_lang_Class = knownKlass(Type.java_lang_Class); - java_lang_Class_classRedefinedCount = java_lang_Class.requireDeclaredField(Name.classRedefinedCount, Type._int); - java_lang_Class_name = java_lang_Class.requireDeclaredField(Name.name, Type.java_lang_String); - java_lang_Class_classLoader = java_lang_Class.requireDeclaredField(Name.classLoader, Type.java_lang_ClassLoader); + java_lang_Cloneable = knownKlass(Types.java_lang_Cloneable); + java_lang_Class = knownKlass(Types.java_lang_Class); + java_lang_Class_classRedefinedCount = java_lang_Class.requireDeclaredField(Names.classRedefinedCount, Types._int); + java_lang_Class_name = java_lang_Class.requireDeclaredField(Names.name, Types.java_lang_String); + java_lang_Class_classLoader = java_lang_Class.requireDeclaredField(Names.classLoader, Types.java_lang_ClassLoader); java_lang_Class_componentType = diff() // - .field(VERSION_9_OR_HIGHER, Name.componentType, Type.java_lang_Class)// + .field(VERSION_9_OR_HIGHER, Names.componentType, Types.java_lang_Class)// .notRequiredField(java_lang_Class); java_lang_Class_classData = diff() // - .field(higher(15), Name.classData, Type.java_lang_Object)// + .field(higher(15), Names.classData, Types.java_lang_Object)// .notRequiredField(java_lang_Class); - HIDDEN_MIRROR_KLASS = java_lang_Class.requireHiddenField(Name.HIDDEN_MIRROR_KLASS); - HIDDEN_SIGNERS = java_lang_Class.requireHiddenField(Name.HIDDEN_SIGNERS); - HIDDEN_PROTECTION_DOMAIN = java_lang_Class.requireHiddenField(Name.HIDDEN_PROTECTION_DOMAIN); + HIDDEN_MIRROR_KLASS = java_lang_Class.requireHiddenField(Names.HIDDEN_MIRROR_KLASS); + HIDDEN_SIGNERS = java_lang_Class.requireHiddenField(Names.HIDDEN_SIGNERS); + HIDDEN_PROTECTION_DOMAIN = java_lang_Class.requireHiddenField(Names.HIDDEN_PROTECTION_DOMAIN); if (getJavaVersion().modulesEnabled()) { - java_lang_Class_module = java_lang_Class.requireDeclaredField(Name.module, Type.java_lang_Module); + java_lang_Class_module = java_lang_Class.requireDeclaredField(Names.module, Types.java_lang_Module); } else { java_lang_Class_module = null; } @@ -122,30 +124,30 @@ public Meta(EspressoContext context) { initializeEspressoClassInHierarchy(java_lang_Class); // From now on, all Klass'es will safely initialize the guest Class. - java_io_Serializable = knownKlass(Type.java_io_Serializable); + java_io_Serializable = knownKlass(Types.java_io_Serializable); ARRAY_SUPERINTERFACES = new ObjectKlass[]{java_lang_Cloneable, java_io_Serializable}; java_lang_Object_array = java_lang_Object.array(); - java_lang_Enum = knownKlass(Type.java_lang_Enum); + java_lang_Enum = knownKlass(Types.java_lang_Enum); EspressoError.guarantee( new HashSet<>(Arrays.asList(ARRAY_SUPERINTERFACES)).equals(new HashSet<>(Arrays.asList(java_lang_Object_array.getSuperInterfaces()))), "arrays super interfaces must contain java.lang.Cloneable and java.io.Serializable"); java_lang_Class_array = java_lang_Class.array(); - java_lang_Class_getName = java_lang_Class.requireDeclaredMethod(Name.getName, Signature.String); - java_lang_Class_getSimpleName = java_lang_Class.requireDeclaredMethod(Name.getSimpleName, Signature.String); - java_lang_Class_getTypeName = java_lang_Class.requireDeclaredMethod(Name.getTypeName, Signature.String); - java_lang_Class_forName_String = java_lang_Class.requireDeclaredMethod(Name.forName, Signature.Class_String); - java_lang_Class_forName_String_boolean_ClassLoader = java_lang_Class.requireDeclaredMethod(Name.forName, Signature.Class_String_boolean_ClassLoader); + java_lang_Class_getName = java_lang_Class.requireDeclaredMethod(Names.getName, Signatures.String); + java_lang_Class_getSimpleName = java_lang_Class.requireDeclaredMethod(Names.getSimpleName, Signatures.String); + java_lang_Class_getTypeName = java_lang_Class.requireDeclaredMethod(Names.getTypeName, Signatures.String); + java_lang_Class_forName_String = java_lang_Class.requireDeclaredMethod(Names.forName, Signatures.Class_String); + java_lang_Class_forName_String_boolean_ClassLoader = java_lang_Class.requireDeclaredMethod(Names.forName, Signatures.Class_String_boolean_ClassLoader); if (getLanguage().isJVMCIEnabled()) { - HIDDEN_JVMCIINDY = java_lang_Class.requireHiddenField(Name.HIDDEN_JVMCIINDY); + HIDDEN_JVMCIINDY = java_lang_Class.requireHiddenField(Names.HIDDEN_JVMCIINDY); } else { HIDDEN_JVMCIINDY = null; } - java_lang_String = knownKlass(Type.java_lang_String); + java_lang_String = knownKlass(Types.java_lang_String); java_lang_String_array = java_lang_String.array(); - java_lang_CharSequence = knownKlass(Type.java_lang_CharSequence); + java_lang_CharSequence = knownKlass(Types.java_lang_CharSequence); // Primitives. _boolean = new PrimitiveKlass(context, JavaKind.Boolean); @@ -180,15 +182,15 @@ public Meta(EspressoContext context) { _long_array = _long.array(); // Boxed types. - java_lang_Boolean = knownKlass(Type.java_lang_Boolean); - java_lang_Byte = knownKlass(Type.java_lang_Byte); - java_lang_Character = knownKlass(Type.java_lang_Character); - java_lang_Short = knownKlass(Type.java_lang_Short); - java_lang_Float = knownKlass(Type.java_lang_Float); - java_lang_Integer = knownKlass(Type.java_lang_Integer); - java_lang_Double = knownKlass(Type.java_lang_Double); - java_lang_Long = knownKlass(Type.java_lang_Long); - java_lang_Void = knownKlass(Type.java_lang_Void); + java_lang_Boolean = knownKlass(Types.java_lang_Boolean); + java_lang_Byte = knownKlass(Types.java_lang_Byte); + java_lang_Character = knownKlass(Types.java_lang_Character); + java_lang_Short = knownKlass(Types.java_lang_Short); + java_lang_Float = knownKlass(Types.java_lang_Float); + java_lang_Integer = knownKlass(Types.java_lang_Integer); + java_lang_Double = knownKlass(Types.java_lang_Double); + java_lang_Long = knownKlass(Types.java_lang_Long); + java_lang_Void = knownKlass(Types.java_lang_Void); BOXED_PRIMITIVE_KLASSES = new ObjectKlass[]{ java_lang_Boolean, @@ -202,74 +204,74 @@ public Meta(EspressoContext context) { java_lang_Void }; - java_lang_Number = knownKlass(Type.java_lang_Number); - - java_lang_Boolean_valueOf = java_lang_Boolean.requireDeclaredMethod(Name.valueOf, Signature.Boolean_boolean); - java_lang_Byte_valueOf = java_lang_Byte.requireDeclaredMethod(Name.valueOf, Signature.Byte_byte); - java_lang_Character_valueOf = java_lang_Character.requireDeclaredMethod(Name.valueOf, Signature.Character_char); - java_lang_Short_valueOf = java_lang_Short.requireDeclaredMethod(Name.valueOf, Signature.Short_short); - java_lang_Float_valueOf = java_lang_Float.requireDeclaredMethod(Name.valueOf, Signature.Float_float); - java_lang_Integer_valueOf = java_lang_Integer.requireDeclaredMethod(Name.valueOf, Signature.Integer_int); - java_lang_Double_valueOf = java_lang_Double.requireDeclaredMethod(Name.valueOf, Signature.Double_double); - java_lang_Long_valueOf = java_lang_Long.requireDeclaredMethod(Name.valueOf, Signature.Long_long); - - java_lang_Boolean_value = java_lang_Boolean.requireDeclaredField(Name.value, Type._boolean); - java_lang_Byte_value = java_lang_Byte.requireDeclaredField(Name.value, Type._byte); - java_lang_Character_value = java_lang_Character.requireDeclaredField(Name.value, Type._char); - java_lang_Short_value = java_lang_Short.requireDeclaredField(Name.value, Type._short); - java_lang_Float_value = java_lang_Float.requireDeclaredField(Name.value, Type._float); - java_lang_Integer_value = java_lang_Integer.requireDeclaredField(Name.value, Type._int); - java_lang_Double_value = java_lang_Double.requireDeclaredField(Name.value, Type._double); - java_lang_Long_value = java_lang_Long.requireDeclaredField(Name.value, Type._long); + java_lang_Number = knownKlass(Types.java_lang_Number); + + java_lang_Boolean_valueOf = java_lang_Boolean.requireDeclaredMethod(Names.valueOf, Signatures.Boolean_boolean); + java_lang_Byte_valueOf = java_lang_Byte.requireDeclaredMethod(Names.valueOf, Signatures.Byte_byte); + java_lang_Character_valueOf = java_lang_Character.requireDeclaredMethod(Names.valueOf, Signatures.Character_char); + java_lang_Short_valueOf = java_lang_Short.requireDeclaredMethod(Names.valueOf, Signatures.Short_short); + java_lang_Float_valueOf = java_lang_Float.requireDeclaredMethod(Names.valueOf, Signatures.Float_float); + java_lang_Integer_valueOf = java_lang_Integer.requireDeclaredMethod(Names.valueOf, Signatures.Integer_int); + java_lang_Double_valueOf = java_lang_Double.requireDeclaredMethod(Names.valueOf, Signatures.Double_double); + java_lang_Long_valueOf = java_lang_Long.requireDeclaredMethod(Names.valueOf, Signatures.Long_long); + + java_lang_Boolean_value = java_lang_Boolean.requireDeclaredField(Names.value, Types._boolean); + java_lang_Byte_value = java_lang_Byte.requireDeclaredField(Names.value, Types._byte); + java_lang_Character_value = java_lang_Character.requireDeclaredField(Names.value, Types._char); + java_lang_Short_value = java_lang_Short.requireDeclaredField(Names.value, Types._short); + java_lang_Float_value = java_lang_Float.requireDeclaredField(Names.value, Types._float); + java_lang_Integer_value = java_lang_Integer.requireDeclaredField(Names.value, Types._int); + java_lang_Double_value = java_lang_Double.requireDeclaredField(Names.value, Types._double); + java_lang_Long_value = java_lang_Long.requireDeclaredField(Names.value, Types._long); java_lang_String_value = diff() // - .field(VERSION_8_OR_LOWER, Name.value, Type._char_array) // - .field(VERSION_9_OR_HIGHER, Name.value, Type._byte_array) // + .field(VERSION_8_OR_LOWER, Names.value, Types._char_array) // + .field(VERSION_9_OR_HIGHER, Names.value, Types._byte_array) // .field(java_lang_String); - java_lang_String_hash = java_lang_String.requireDeclaredField(Name.hash, Type._int); - java_lang_String_hashCode = java_lang_String.requireDeclaredMethod(Name.hashCode, Signature._int); - java_lang_String_length = java_lang_String.requireDeclaredMethod(Name.length, Signature._int); - java_lang_String_toCharArray = java_lang_String.requireDeclaredMethod(Name.toCharArray, Signature._char_array); - java_lang_String_indexOf = java_lang_String.requireDeclaredMethod(Name.indexOf, Signature._int_int_int); - java_lang_String_init_char_array = java_lang_String.requireDeclaredMethod(Name._init_, Signature._void_char_array); + java_lang_String_hash = java_lang_String.requireDeclaredField(Names.hash, Types._int); + java_lang_String_hashCode = java_lang_String.requireDeclaredMethod(Names.hashCode, Signatures._int); + java_lang_String_length = java_lang_String.requireDeclaredMethod(Names.length, Signatures._int); + java_lang_String_toCharArray = java_lang_String.requireDeclaredMethod(Names.toCharArray, Signatures._char_array); + java_lang_String_indexOf = java_lang_String.requireDeclaredMethod(Names.indexOf, Signatures._int_int_int); + java_lang_String_init_char_array = java_lang_String.requireDeclaredMethod(Names._init_, Signatures._void_char_array); if (getJavaVersion().java9OrLater()) { - java_lang_String_coder = java_lang_String.requireDeclaredField(Name.coder, Type._byte); - java_lang_String_COMPACT_STRINGS = java_lang_String.requireDeclaredField(Name.COMPACT_STRINGS, Type._boolean); + java_lang_String_coder = java_lang_String.requireDeclaredField(Names.coder, Types._byte); + java_lang_String_COMPACT_STRINGS = java_lang_String.requireDeclaredField(Names.COMPACT_STRINGS, Types._boolean); } else { java_lang_String_coder = null; java_lang_String_COMPACT_STRINGS = null; } - java_lang_CharSequence_toString = java_lang_CharSequence.requireDeclaredMethod(Name.toString, Signature.String); + java_lang_CharSequence_toString = java_lang_CharSequence.requireDeclaredMethod(Names.toString, Signatures.String); - java_lang_Throwable = knownKlass(Type.java_lang_Throwable); - java_lang_Throwable_getStackTrace = java_lang_Throwable.requireDeclaredMethod(Name.getStackTrace, Signature.StackTraceElement_array); - java_lang_Throwable_getMessage = java_lang_Throwable.requireDeclaredMethod(Name.getMessage, Signature.String); - java_lang_Throwable_getCause = java_lang_Throwable.requireDeclaredMethod(Name.getCause, Signature.Throwable); - java_lang_Throwable_printStackTrace = java_lang_Throwable.requireDeclaredMethod(Name.printStackTrace, Signature._void); - HIDDEN_FRAMES = java_lang_Throwable.requireHiddenField(Name.HIDDEN_FRAMES); - HIDDEN_EXCEPTION_WRAPPER = java_lang_Throwable.requireHiddenField(Name.HIDDEN_EXCEPTION_WRAPPER); - java_lang_Throwable_backtrace = java_lang_Throwable.requireDeclaredField(Name.backtrace, Type.java_lang_Object); - java_lang_Throwable_stackTrace = java_lang_Throwable.requireDeclaredField(Name.stackTrace, Type.java_lang_StackTraceElement_array); - java_lang_Throwable_detailMessage = java_lang_Throwable.requireDeclaredField(Name.detailMessage, Type.java_lang_String); - java_lang_Throwable_cause = java_lang_Throwable.requireDeclaredField(Name.cause, Type.java_lang_Throwable); + java_lang_Throwable = knownKlass(Types.java_lang_Throwable); + java_lang_Throwable_getStackTrace = java_lang_Throwable.requireDeclaredMethod(Names.getStackTrace, Signatures.StackTraceElement_array); + java_lang_Throwable_getMessage = java_lang_Throwable.requireDeclaredMethod(Names.getMessage, Signatures.String); + java_lang_Throwable_getCause = java_lang_Throwable.requireDeclaredMethod(Names.getCause, Signatures.Throwable); + java_lang_Throwable_printStackTrace = java_lang_Throwable.requireDeclaredMethod(Names.printStackTrace, Signatures._void); + HIDDEN_FRAMES = java_lang_Throwable.requireHiddenField(Names.HIDDEN_FRAMES); + HIDDEN_EXCEPTION_WRAPPER = java_lang_Throwable.requireHiddenField(Names.HIDDEN_EXCEPTION_WRAPPER); + java_lang_Throwable_backtrace = java_lang_Throwable.requireDeclaredField(Names.backtrace, Types.java_lang_Object); + java_lang_Throwable_stackTrace = java_lang_Throwable.requireDeclaredField(Names.stackTrace, Types.java_lang_StackTraceElement_array); + java_lang_Throwable_detailMessage = java_lang_Throwable.requireDeclaredField(Names.detailMessage, Types.java_lang_String); + java_lang_Throwable_cause = java_lang_Throwable.requireDeclaredField(Names.cause, Types.java_lang_Throwable); if (getJavaVersion().java9OrLater()) { - java_lang_Throwable_depth = java_lang_Throwable.requireDeclaredField(Name.depth, Type._int); + java_lang_Throwable_depth = java_lang_Throwable.requireDeclaredField(Names.depth, Types._int); } else { java_lang_Throwable_depth = null; } - java_lang_StackTraceElement = knownKlass(Type.java_lang_StackTraceElement); - java_lang_StackTraceElement_init = java_lang_StackTraceElement.requireDeclaredMethod(Name._init_, Signature._void_String_String_String_int); - java_lang_StackTraceElement_declaringClass = java_lang_StackTraceElement.requireDeclaredField(Name.declaringClass, Type.java_lang_String); - java_lang_StackTraceElement_methodName = java_lang_StackTraceElement.requireDeclaredField(Name.methodName, Type.java_lang_String); - java_lang_StackTraceElement_fileName = java_lang_StackTraceElement.requireDeclaredField(Name.fileName, Type.java_lang_String); - java_lang_StackTraceElement_lineNumber = java_lang_StackTraceElement.requireDeclaredField(Name.lineNumber, Type._int); + java_lang_StackTraceElement = knownKlass(Types.java_lang_StackTraceElement); + java_lang_StackTraceElement_init = java_lang_StackTraceElement.requireDeclaredMethod(Names._init_, Signatures._void_String_String_String_int); + java_lang_StackTraceElement_declaringClass = java_lang_StackTraceElement.requireDeclaredField(Names.declaringClass, Types.java_lang_String); + java_lang_StackTraceElement_methodName = java_lang_StackTraceElement.requireDeclaredField(Names.methodName, Types.java_lang_String); + java_lang_StackTraceElement_fileName = java_lang_StackTraceElement.requireDeclaredField(Names.fileName, Types.java_lang_String); + java_lang_StackTraceElement_lineNumber = java_lang_StackTraceElement.requireDeclaredField(Names.lineNumber, Types._int); if (getJavaVersion().java9OrLater()) { - java_lang_StackTraceElement_declaringClassObject = java_lang_StackTraceElement.requireDeclaredField(Name.declaringClassObject, Type.java_lang_Class); - java_lang_StackTraceElement_classLoaderName = java_lang_StackTraceElement.requireDeclaredField(Name.classLoaderName, Type.java_lang_String); - java_lang_StackTraceElement_moduleName = java_lang_StackTraceElement.requireDeclaredField(Name.moduleName, Type.java_lang_String); - java_lang_StackTraceElement_moduleVersion = java_lang_StackTraceElement.requireDeclaredField(Name.moduleVersion, Type.java_lang_String); + java_lang_StackTraceElement_declaringClassObject = java_lang_StackTraceElement.requireDeclaredField(Names.declaringClassObject, Types.java_lang_Class); + java_lang_StackTraceElement_classLoaderName = java_lang_StackTraceElement.requireDeclaredField(Names.classLoaderName, Types.java_lang_String); + java_lang_StackTraceElement_moduleName = java_lang_StackTraceElement.requireDeclaredField(Names.moduleName, Types.java_lang_String); + java_lang_StackTraceElement_moduleVersion = java_lang_StackTraceElement.requireDeclaredField(Names.moduleVersion, Types.java_lang_String); } else { java_lang_StackTraceElement_declaringClassObject = null; java_lang_StackTraceElement_classLoaderName = null; @@ -277,80 +279,80 @@ public Meta(EspressoContext context) { java_lang_StackTraceElement_moduleVersion = null; } - java_lang_Exception = knownKlass(Type.java_lang_Exception); - java_lang_reflect_InvocationTargetException = knownKlass(Type.java_lang_reflect_InvocationTargetException); - java_lang_NegativeArraySizeException = knownKlass(Type.java_lang_NegativeArraySizeException); - java_lang_IllegalArgumentException = knownKlass(Type.java_lang_IllegalArgumentException); - java_lang_IllegalStateException = knownKlass(Type.java_lang_IllegalStateException); - java_lang_NullPointerException = knownKlass(Type.java_lang_NullPointerException); + java_lang_Exception = knownKlass(Types.java_lang_Exception); + java_lang_reflect_InvocationTargetException = knownKlass(Types.java_lang_reflect_InvocationTargetException); + java_lang_NegativeArraySizeException = knownKlass(Types.java_lang_NegativeArraySizeException); + java_lang_IllegalArgumentException = knownKlass(Types.java_lang_IllegalArgumentException); + java_lang_IllegalStateException = knownKlass(Types.java_lang_IllegalStateException); + java_lang_NullPointerException = knownKlass(Types.java_lang_NullPointerException); if (getJavaVersion().java14OrLater()) { - java_lang_NullPointerException_extendedMessageState = java_lang_NullPointerException.requireDeclaredField(Name.extendedMessageState, Type._int); + java_lang_NullPointerException_extendedMessageState = java_lang_NullPointerException.requireDeclaredField(Names.extendedMessageState, Types._int); } else { java_lang_NullPointerException_extendedMessageState = null; } - java_lang_ClassNotFoundException = knownKlass(Type.java_lang_ClassNotFoundException); - java_lang_NoClassDefFoundError = knownKlass(Type.java_lang_NoClassDefFoundError); - java_lang_InterruptedException = knownKlass(Type.java_lang_InterruptedException); - java_lang_ThreadDeath = knownKlass(Type.java_lang_ThreadDeath); - - java_lang_RuntimeException = knownKlass(Type.java_lang_RuntimeException); - java_lang_IllegalMonitorStateException = knownKlass(Type.java_lang_IllegalMonitorStateException); - java_lang_ArrayStoreException = knownKlass(Type.java_lang_ArrayStoreException); - java_lang_IndexOutOfBoundsException = knownKlass(Type.java_lang_IndexOutOfBoundsException); - java_lang_ArrayIndexOutOfBoundsException = knownKlass(Type.java_lang_ArrayIndexOutOfBoundsException); - java_lang_StringIndexOutOfBoundsException = knownKlass(Type.java_lang_StringIndexOutOfBoundsException); - java_lang_ExceptionInInitializerError = knownKlass(Type.java_lang_ExceptionInInitializerError); - java_lang_InstantiationException = knownKlass(Type.java_lang_InstantiationException); - java_lang_InstantiationError = knownKlass(Type.java_lang_InstantiationError); - java_lang_CloneNotSupportedException = knownKlass(Type.java_lang_CloneNotSupportedException); - java_lang_SecurityException = knownKlass(Type.java_lang_SecurityException); - java_lang_ArithmeticException = knownKlass(Type.java_lang_ArithmeticException); - java_lang_LinkageError = knownKlass(Type.java_lang_LinkageError); - java_lang_NoSuchFieldException = knownKlass(Type.java_lang_NoSuchFieldException); - java_lang_NoSuchMethodException = knownKlass(Type.java_lang_NoSuchMethodException); - java_lang_UnsupportedOperationException = knownKlass(Type.java_lang_UnsupportedOperationException); - java_util_NoSuchElementException = knownKlass(Type.java_util_NoSuchElementException); - java_lang_NumberFormatException = knownKlass(Type.java_lang_NumberFormatException); - - java_lang_StackOverflowError = knownKlass(Type.java_lang_StackOverflowError); - java_lang_OutOfMemoryError = knownKlass(Type.java_lang_OutOfMemoryError); - java_lang_ClassCastException = knownKlass(Type.java_lang_ClassCastException); - java_lang_AbstractMethodError = knownKlass(Type.java_lang_AbstractMethodError); - java_lang_InternalError = knownKlass(Type.java_lang_InternalError); - java_lang_VerifyError = knownKlass(Type.java_lang_VerifyError); - java_lang_ClassFormatError = knownKlass(Type.java_lang_ClassFormatError); - java_lang_ClassCircularityError = knownKlass(Type.java_lang_ClassCircularityError); - java_lang_UnsatisfiedLinkError = knownKlass(Type.java_lang_UnsatisfiedLinkError); - java_lang_UnsupportedClassVersionError = knownKlass(Type.java_lang_UnsupportedClassVersionError); - - java_lang_Error = knownKlass(Type.java_lang_Error); - java_lang_NoSuchFieldError = knownKlass(Type.java_lang_NoSuchFieldError); - java_lang_NoSuchMethodError = knownKlass(Type.java_lang_NoSuchMethodError); - java_lang_IllegalAccessError = knownKlass(Type.java_lang_IllegalAccessError); - java_lang_IncompatibleClassChangeError = knownKlass(Type.java_lang_IncompatibleClassChangeError); - java_lang_BootstrapMethodError = knownKlass(Type.java_lang_BootstrapMethodError); + java_lang_ClassNotFoundException = knownKlass(Types.java_lang_ClassNotFoundException); + java_lang_NoClassDefFoundError = knownKlass(Types.java_lang_NoClassDefFoundError); + java_lang_InterruptedException = knownKlass(Types.java_lang_InterruptedException); + java_lang_ThreadDeath = knownKlass(Types.java_lang_ThreadDeath); + + java_lang_RuntimeException = knownKlass(Types.java_lang_RuntimeException); + java_lang_IllegalMonitorStateException = knownKlass(Types.java_lang_IllegalMonitorStateException); + java_lang_ArrayStoreException = knownKlass(Types.java_lang_ArrayStoreException); + java_lang_IndexOutOfBoundsException = knownKlass(Types.java_lang_IndexOutOfBoundsException); + java_lang_ArrayIndexOutOfBoundsException = knownKlass(Types.java_lang_ArrayIndexOutOfBoundsException); + java_lang_StringIndexOutOfBoundsException = knownKlass(Types.java_lang_StringIndexOutOfBoundsException); + java_lang_ExceptionInInitializerError = knownKlass(Types.java_lang_ExceptionInInitializerError); + java_lang_InstantiationException = knownKlass(Types.java_lang_InstantiationException); + java_lang_InstantiationError = knownKlass(Types.java_lang_InstantiationError); + java_lang_CloneNotSupportedException = knownKlass(Types.java_lang_CloneNotSupportedException); + java_lang_SecurityException = knownKlass(Types.java_lang_SecurityException); + java_lang_ArithmeticException = knownKlass(Types.java_lang_ArithmeticException); + java_lang_LinkageError = knownKlass(Types.java_lang_LinkageError); + java_lang_NoSuchFieldException = knownKlass(Types.java_lang_NoSuchFieldException); + java_lang_NoSuchMethodException = knownKlass(Types.java_lang_NoSuchMethodException); + java_lang_UnsupportedOperationException = knownKlass(Types.java_lang_UnsupportedOperationException); + java_util_NoSuchElementException = knownKlass(Types.java_util_NoSuchElementException); + java_lang_NumberFormatException = knownKlass(Types.java_lang_NumberFormatException); + + java_lang_StackOverflowError = knownKlass(Types.java_lang_StackOverflowError); + java_lang_OutOfMemoryError = knownKlass(Types.java_lang_OutOfMemoryError); + java_lang_ClassCastException = knownKlass(Types.java_lang_ClassCastException); + java_lang_AbstractMethodError = knownKlass(Types.java_lang_AbstractMethodError); + java_lang_InternalError = knownKlass(Types.java_lang_InternalError); + java_lang_VerifyError = knownKlass(Types.java_lang_VerifyError); + java_lang_ClassFormatError = knownKlass(Types.java_lang_ClassFormatError); + java_lang_ClassCircularityError = knownKlass(Types.java_lang_ClassCircularityError); + java_lang_UnsatisfiedLinkError = knownKlass(Types.java_lang_UnsatisfiedLinkError); + java_lang_UnsupportedClassVersionError = knownKlass(Types.java_lang_UnsupportedClassVersionError); + + java_lang_Error = knownKlass(Types.java_lang_Error); + java_lang_NoSuchFieldError = knownKlass(Types.java_lang_NoSuchFieldError); + java_lang_NoSuchMethodError = knownKlass(Types.java_lang_NoSuchMethodError); + java_lang_IllegalAccessError = knownKlass(Types.java_lang_IllegalAccessError); + java_lang_IncompatibleClassChangeError = knownKlass(Types.java_lang_IncompatibleClassChangeError); + java_lang_BootstrapMethodError = knownKlass(Types.java_lang_BootstrapMethodError); // Initialize dispatch once common exceptions are discovered. this.dispatch = new ExceptionDispatch(this); - java_security_PrivilegedActionException = knownKlass(Type.java_security_PrivilegedActionException); - java_security_PrivilegedActionException_init_Exception = java_security_PrivilegedActionException.requireDeclaredMethod(Name._init_, Signature._void_Exception); + java_security_PrivilegedActionException = knownKlass(Types.java_security_PrivilegedActionException); + java_security_PrivilegedActionException_init_Exception = java_security_PrivilegedActionException.requireDeclaredMethod(Names._init_, Signatures._void_Exception); - java_lang_ClassLoader = knownKlass(Type.java_lang_ClassLoader); + java_lang_ClassLoader = knownKlass(Types.java_lang_ClassLoader); java_lang_ClassLoader$NativeLibrary = diff() // - .klass(lower(14), Type.java_lang_ClassLoader$NativeLibrary) // - .klass(higher(15), Type.jdk_internal_loader_NativeLibraries) // + .klass(lower(14), Types.java_lang_ClassLoader$NativeLibrary) // + .klass(higher(15), Types.jdk_internal_loader_NativeLibraries) // .klass(); - java_lang_ClassLoader$NativeLibrary_getFromClass = java_lang_ClassLoader$NativeLibrary.requireDeclaredMethod(Name.getFromClass, Signature.Class); - java_lang_ClassLoader_checkPackageAccess = java_lang_ClassLoader.requireDeclaredMethod(Name.checkPackageAccess, Signature.Class_PermissionDomain); - java_lang_ClassLoader_findNative = java_lang_ClassLoader.requireDeclaredMethod(Name.findNative, Signature._long_ClassLoader_String); - java_lang_ClassLoader_getSystemClassLoader = java_lang_ClassLoader.requireDeclaredMethod(Name.getSystemClassLoader, Signature.ClassLoader); - java_lang_ClassLoader_parent = java_lang_ClassLoader.requireDeclaredField(Name.parent, Type.java_lang_ClassLoader); - HIDDEN_CLASS_LOADER_REGISTRY = java_lang_ClassLoader.requireHiddenField(Name.HIDDEN_CLASS_LOADER_REGISTRY); + java_lang_ClassLoader$NativeLibrary_getFromClass = java_lang_ClassLoader$NativeLibrary.requireDeclaredMethod(Names.getFromClass, Signatures.Class); + java_lang_ClassLoader_checkPackageAccess = java_lang_ClassLoader.requireDeclaredMethod(Names.checkPackageAccess, Signatures.Class_PermissionDomain); + java_lang_ClassLoader_findNative = java_lang_ClassLoader.requireDeclaredMethod(Names.findNative, Signatures._long_ClassLoader_String); + java_lang_ClassLoader_getSystemClassLoader = java_lang_ClassLoader.requireDeclaredMethod(Names.getSystemClassLoader, Signatures.ClassLoader); + java_lang_ClassLoader_parent = java_lang_ClassLoader.requireDeclaredField(Names.parent, Types.java_lang_ClassLoader); + HIDDEN_CLASS_LOADER_REGISTRY = java_lang_ClassLoader.requireHiddenField(Names.HIDDEN_CLASS_LOADER_REGISTRY); if (getJavaVersion().java9OrLater()) { - java_lang_ClassLoader_unnamedModule = java_lang_ClassLoader.requireDeclaredField(Name.unnamedModule, Type.java_lang_Module); - java_lang_ClassLoader_name = java_lang_ClassLoader.requireDeclaredField(Name.name, Type.java_lang_String); - java_lang_ClassLoader_nameAndId = java_lang_ClassLoader.requireDeclaredField(Name.nameAndId, Type.java_lang_String); + java_lang_ClassLoader_unnamedModule = java_lang_ClassLoader.requireDeclaredField(Names.unnamedModule, Types.java_lang_Module); + java_lang_ClassLoader_name = java_lang_ClassLoader.requireDeclaredField(Names.name, Types.java_lang_String); + java_lang_ClassLoader_nameAndId = java_lang_ClassLoader.requireDeclaredField(Names.nameAndId, Types.java_lang_String); } else { java_lang_ClassLoader_unnamedModule = null; java_lang_ClassLoader_name = null; @@ -358,151 +360,151 @@ public Meta(EspressoContext context) { } if (getJavaVersion().java19OrLater()) { - jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl = knownKlass(Type.jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl); - jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl_handle = jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl.requireDeclaredField(Name.handle, Type._long); + jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl = knownKlass(Types.jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl); + jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl_handle = jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl.requireDeclaredField(Names.handle, Types._long); } else { jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl = null; jdk_internal_loader_RawNativeLibraries$RawNativeLibraryImpl_handle = null; } if (getJavaVersion().java9OrLater()) { - jdk_internal_util_ArraysSupport = knownKlass(Type.jdk_internal_util_ArraysSupport); - jdk_internal_util_ArraysSupport_vectorizedMismatch = jdk_internal_util_ArraysSupport.requireDeclaredMethod(Name.vectorizedMismatch, Signature._int_Object_long_Object_long_int_int); + jdk_internal_util_ArraysSupport = knownKlass(Types.jdk_internal_util_ArraysSupport); + jdk_internal_util_ArraysSupport_vectorizedMismatch = jdk_internal_util_ArraysSupport.requireDeclaredMethod(Names.vectorizedMismatch, Signatures._int_Object_long_Object_long_int_int); } else { jdk_internal_util_ArraysSupport = null; jdk_internal_util_ArraysSupport_vectorizedMismatch = null; } - java_net_URL = knownKlass(Type.java_net_URL); + java_net_URL = knownKlass(Types.java_net_URL); - java_lang_ClassLoader_getResourceAsStream = java_lang_ClassLoader.requireDeclaredMethod(Name.getResourceAsStream, Signature.InputStream_String); - java_lang_ClassLoader_loadClass = java_lang_ClassLoader.requireDeclaredMethod(Name.loadClass, Signature.Class_String); - java_io_InputStream = knownKlass(Type.java_io_InputStream); - java_io_InputStream_read = java_io_InputStream.requireDeclaredMethod(Name.read, Signature._int_byte_array_int_int); - java_io_InputStream_close = java_io_InputStream.requireDeclaredMethod(Name.close, Signature._void); - java_io_PrintStream = knownKlass(Type.java_io_PrintStream); - java_io_PrintStream_println = java_io_PrintStream.requireDeclaredMethod(Name.println, Signature._void_String); - java_nio_file_Path = knownKlass(Type.java_nio_file_Path); - java_nio_file_Paths = knownKlass(Type.java_nio_file_Paths); - java_nio_file_Paths_get = java_nio_file_Paths.requireDeclaredMethod(Name.get, Signature.Path_String_String_array); + java_lang_ClassLoader_getResourceAsStream = java_lang_ClassLoader.requireDeclaredMethod(Names.getResourceAsStream, Signatures.InputStream_String); + java_lang_ClassLoader_loadClass = java_lang_ClassLoader.requireDeclaredMethod(Names.loadClass, Signatures.Class_String); + java_io_InputStream = knownKlass(Types.java_io_InputStream); + java_io_InputStream_read = java_io_InputStream.requireDeclaredMethod(Names.read, Signatures._int_byte_array_int_int); + java_io_InputStream_close = java_io_InputStream.requireDeclaredMethod(Names.close, Signatures._void); + java_io_PrintStream = knownKlass(Types.java_io_PrintStream); + java_io_PrintStream_println = java_io_PrintStream.requireDeclaredMethod(Names.println, Signatures._void_String); + java_nio_file_Path = knownKlass(Types.java_nio_file_Path); + java_nio_file_Paths = knownKlass(Types.java_nio_file_Paths); + java_nio_file_Paths_get = java_nio_file_Paths.requireDeclaredMethod(Names.get, Signatures.Path_String_String_array); - ObjectKlass nioNativeThreadKlass = knownKlass(Type.sun_nio_ch_NativeThread); - sun_nio_ch_NativeThread_init = nioNativeThreadKlass.lookupDeclaredMethod(Name.init, Signature._void); + ObjectKlass nioNativeThreadKlass = knownKlass(Types.sun_nio_ch_NativeThread); + sun_nio_ch_NativeThread_init = nioNativeThreadKlass.lookupDeclaredMethod(Names.init, Signatures._void); if (getJavaVersion().java21OrLater()) { - sun_nio_ch_NativeThread_isNativeThread = nioNativeThreadKlass.requireDeclaredMethod(Name.isNativeThread, Signature._boolean_long); - sun_nio_ch_NativeThread_current0 = nioNativeThreadKlass.lookupDeclaredMethod(Name.current0, Signature._long); + sun_nio_ch_NativeThread_isNativeThread = nioNativeThreadKlass.requireDeclaredMethod(Names.isNativeThread, Signatures._boolean_long); + sun_nio_ch_NativeThread_current0 = nioNativeThreadKlass.lookupDeclaredMethod(Names.current0, Signatures._long); sun_nio_ch_NativeThread_signal = null; } else { sun_nio_ch_NativeThread_isNativeThread = null; sun_nio_ch_NativeThread_current0 = null; - sun_nio_ch_NativeThread_signal = nioNativeThreadKlass.requireDeclaredMethod(Name.signal, Signature._void_long); + sun_nio_ch_NativeThread_signal = nioNativeThreadKlass.requireDeclaredMethod(Names.signal, Signatures._void_long); } - sun_launcher_LauncherHelper = knownKlass(Type.sun_launcher_LauncherHelper); - sun_launcher_LauncherHelper_printHelpMessage = sun_launcher_LauncherHelper.requireDeclaredMethod(Name.printHelpMessage, Signature._void_boolean); - sun_launcher_LauncherHelper_ostream = sun_launcher_LauncherHelper.requireDeclaredField(Name.ostream, Type.java_io_PrintStream); + sun_launcher_LauncherHelper = knownKlass(Types.sun_launcher_LauncherHelper); + sun_launcher_LauncherHelper_printHelpMessage = sun_launcher_LauncherHelper.requireDeclaredMethod(Names.printHelpMessage, Signatures._void_boolean); + sun_launcher_LauncherHelper_ostream = sun_launcher_LauncherHelper.requireDeclaredField(Names.ostream, Types.java_io_PrintStream); // Guest reflection. - java_lang_reflect_Executable = knownKlass(Type.java_lang_reflect_Executable); - java_lang_reflect_Constructor = knownKlass(Type.java_lang_reflect_Constructor); - java_lang_reflect_Constructor_init = java_lang_reflect_Constructor.requireDeclaredMethod(Name._init_, Signature.java_lang_reflect_Constructor_init_signature); - - HIDDEN_CONSTRUCTOR_KEY = java_lang_reflect_Constructor.requireHiddenField(Name.HIDDEN_CONSTRUCTOR_KEY); - HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Constructor.requireHiddenField(Name.HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); - java_lang_reflect_Constructor_clazz = java_lang_reflect_Constructor.requireDeclaredField(Name.clazz, Type.java_lang_Class); - java_lang_reflect_Constructor_root = java_lang_reflect_Constructor.requireDeclaredField(Name.root, Type.java_lang_reflect_Constructor); - java_lang_reflect_Constructor_parameterTypes = java_lang_reflect_Constructor.requireDeclaredField(Name.parameterTypes, Type.java_lang_Class_array); - java_lang_reflect_Constructor_signature = java_lang_reflect_Constructor.requireDeclaredField(Name.signature, Type.java_lang_String); - - java_lang_reflect_Method = knownKlass(Type.java_lang_reflect_Method); - java_lang_reflect_Method_init = java_lang_reflect_Method.lookupDeclaredMethod(Name._init_, Signature.java_lang_reflect_Method_init_signature); - HIDDEN_METHOD_KEY = java_lang_reflect_Method.requireHiddenField(Name.HIDDEN_METHOD_KEY); - HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Method.requireHiddenField(Name.HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); - java_lang_reflect_Method_root = java_lang_reflect_Method.requireDeclaredField(Name.root, Type.java_lang_reflect_Method); - java_lang_reflect_Method_clazz = java_lang_reflect_Method.requireDeclaredField(Name.clazz, Type.java_lang_Class); - java_lang_reflect_Method_parameterTypes = java_lang_reflect_Method.requireDeclaredField(Name.parameterTypes, Type.java_lang_Class_array); - - java_lang_reflect_Parameter = knownKlass(Type.java_lang_reflect_Parameter); - java_lang_reflect_ParameterizedType = knownKlass(Type.java_lang_reflect_ParameterizedType); - java_lang_reflect_ParameterizedType_getRawType = java_lang_reflect_ParameterizedType.requireDeclaredMethod(Name.getRawType, Signature.Java_lang_reflect_Type); - - java_lang_reflect_Field = knownKlass(Type.java_lang_reflect_Field); - HIDDEN_FIELD_KEY = java_lang_reflect_Field.requireHiddenField(Name.HIDDEN_FIELD_KEY); - HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Field.requireHiddenField(Name.HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); - java_lang_reflect_Field_root = java_lang_reflect_Field.requireDeclaredField(Name.root, java_lang_reflect_Field.getType()); - java_lang_reflect_Field_class = java_lang_reflect_Field.requireDeclaredField(Name.clazz, Type.java_lang_Class); - java_lang_reflect_Field_name = java_lang_reflect_Field.requireDeclaredField(Name.name, Type.java_lang_String); - java_lang_reflect_Field_type = java_lang_reflect_Field.requireDeclaredField(Name.type, Type.java_lang_Class); + java_lang_reflect_Executable = knownKlass(Types.java_lang_reflect_Executable); + java_lang_reflect_Constructor = knownKlass(Types.java_lang_reflect_Constructor); + java_lang_reflect_Constructor_init = java_lang_reflect_Constructor.requireDeclaredMethod(Names._init_, Signatures.java_lang_reflect_Constructor_init_signature); + + HIDDEN_CONSTRUCTOR_KEY = java_lang_reflect_Constructor.requireHiddenField(Names.HIDDEN_CONSTRUCTOR_KEY); + HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Constructor.requireHiddenField(Names.HIDDEN_CONSTRUCTOR_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); + java_lang_reflect_Constructor_clazz = java_lang_reflect_Constructor.requireDeclaredField(Names.clazz, Types.java_lang_Class); + java_lang_reflect_Constructor_root = java_lang_reflect_Constructor.requireDeclaredField(Names.root, Types.java_lang_reflect_Constructor); + java_lang_reflect_Constructor_parameterTypes = java_lang_reflect_Constructor.requireDeclaredField(Names.parameterTypes, Types.java_lang_Class_array); + java_lang_reflect_Constructor_signature = java_lang_reflect_Constructor.requireDeclaredField(Names.signature, Types.java_lang_String); + + java_lang_reflect_Method = knownKlass(Types.java_lang_reflect_Method); + java_lang_reflect_Method_init = java_lang_reflect_Method.lookupDeclaredMethod(Names._init_, Signatures.java_lang_reflect_Method_init_signature); + HIDDEN_METHOD_KEY = java_lang_reflect_Method.requireHiddenField(Names.HIDDEN_METHOD_KEY); + HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Method.requireHiddenField(Names.HIDDEN_METHOD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); + java_lang_reflect_Method_root = java_lang_reflect_Method.requireDeclaredField(Names.root, Types.java_lang_reflect_Method); + java_lang_reflect_Method_clazz = java_lang_reflect_Method.requireDeclaredField(Names.clazz, Types.java_lang_Class); + java_lang_reflect_Method_parameterTypes = java_lang_reflect_Method.requireDeclaredField(Names.parameterTypes, Types.java_lang_Class_array); + + java_lang_reflect_Parameter = knownKlass(Types.java_lang_reflect_Parameter); + java_lang_reflect_ParameterizedType = knownKlass(Types.java_lang_reflect_ParameterizedType); + java_lang_reflect_ParameterizedType_getRawType = java_lang_reflect_ParameterizedType.requireDeclaredMethod(Names.getRawType, Signatures.Java_lang_reflect_Type); + + java_lang_reflect_Field = knownKlass(Types.java_lang_reflect_Field); + HIDDEN_FIELD_KEY = java_lang_reflect_Field.requireHiddenField(Names.HIDDEN_FIELD_KEY); + HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS = java_lang_reflect_Field.requireHiddenField(Names.HIDDEN_FIELD_RUNTIME_VISIBLE_TYPE_ANNOTATIONS); + java_lang_reflect_Field_root = java_lang_reflect_Field.requireDeclaredField(Names.root, java_lang_reflect_Field.getType()); + java_lang_reflect_Field_class = java_lang_reflect_Field.requireDeclaredField(Names.clazz, Types.java_lang_Class); + java_lang_reflect_Field_name = java_lang_reflect_Field.requireDeclaredField(Names.name, Types.java_lang_String); + java_lang_reflect_Field_type = java_lang_reflect_Field.requireDeclaredField(Names.type, Types.java_lang_Class); java_lang_reflect_Field_init = diff() // - .method(lower(14), Name._init_, Signature.java_lang_reflect_Field_init_signature) // - .method(higher(15), Name._init_, Signature.java_lang_reflect_Field_init_signature_15) // + .method(lower(14), Names._init_, Signatures.java_lang_reflect_Field_init_signature) // + .method(higher(15), Names._init_, Signatures.java_lang_reflect_Field_init_signature_15) // .method(java_lang_reflect_Field); - java_lang_Shutdown = knownKlass(Type.java_lang_Shutdown); - java_lang_Shutdown_shutdown = java_lang_Shutdown.requireDeclaredMethod(Name.shutdown, Signature._void); + java_lang_Shutdown = knownKlass(Types.java_lang_Shutdown); + java_lang_Shutdown_shutdown = java_lang_Shutdown.requireDeclaredMethod(Names.shutdown, Signatures._void); - java_nio_Buffer = knownKlass(Type.java_nio_Buffer); - sun_nio_ch_DirectBuffer = knownKlass(Type.sun_nio_ch_DirectBuffer); - java_nio_Buffer_address = java_nio_Buffer.requireDeclaredField(Name.address, Type._long); - java_nio_Buffer_capacity = java_nio_Buffer.requireDeclaredField(Name.capacity, Type._int); - java_nio_Buffer_limit = java_nio_Buffer.requireDeclaredMethod(Name.limit, Signature._int); - java_nio_Buffer_isReadOnly = java_nio_Buffer.requireDeclaredMethod(Name.isReadOnly, Signature._boolean); + java_nio_Buffer = knownKlass(Types.java_nio_Buffer); + sun_nio_ch_DirectBuffer = knownKlass(Types.sun_nio_ch_DirectBuffer); + java_nio_Buffer_address = java_nio_Buffer.requireDeclaredField(Names.address, Types._long); + java_nio_Buffer_capacity = java_nio_Buffer.requireDeclaredField(Names.capacity, Types._int); + java_nio_Buffer_limit = java_nio_Buffer.requireDeclaredMethod(Names.limit, Signatures._int); + java_nio_Buffer_isReadOnly = java_nio_Buffer.requireDeclaredMethod(Names.isReadOnly, Signatures._boolean); - java_nio_ByteBuffer = knownKlass(Type.java_nio_ByteBuffer); - java_nio_ByteBuffer_wrap = java_nio_ByteBuffer.requireDeclaredMethod(Name.wrap, Signature.ByteBuffer_byte_array); + java_nio_ByteBuffer = knownKlass(Types.java_nio_ByteBuffer); + java_nio_ByteBuffer_wrap = java_nio_ByteBuffer.requireDeclaredMethod(Names.wrap, Signatures.ByteBuffer_byte_array); if (getJavaVersion().java13OrLater()) { - java_nio_ByteBuffer_get = java_nio_ByteBuffer.requireDeclaredMethod(Name.get, Signature.ByteBuffer_int_byte_array_int_int); + java_nio_ByteBuffer_get = java_nio_ByteBuffer.requireDeclaredMethod(Names.get, Signatures.ByteBuffer_int_byte_array_int_int); } else { java_nio_ByteBuffer_get = null; } - java_nio_ByteBuffer_getByte = java_nio_ByteBuffer.requireDeclaredMethod(Name.get, Signature._byte_int); - java_nio_ByteBuffer_getShort = java_nio_ByteBuffer.requireDeclaredMethod(Name.getShort, Signature._short_int); - java_nio_ByteBuffer_getInt = java_nio_ByteBuffer.requireDeclaredMethod(Name.getInt, Signature._int_int); - java_nio_ByteBuffer_getLong = java_nio_ByteBuffer.requireDeclaredMethod(Name.getLong, Signature._long_int); - java_nio_ByteBuffer_getFloat = java_nio_ByteBuffer.requireDeclaredMethod(Name.getFloat, Signature._float_int); - java_nio_ByteBuffer_getDouble = java_nio_ByteBuffer.requireDeclaredMethod(Name.getDouble, Signature._double_int); - java_nio_ByteBuffer_putByte = java_nio_ByteBuffer.requireDeclaredMethod(Name.put, Signature.ByteBuffer_int_byte); - java_nio_ByteBuffer_putShort = java_nio_ByteBuffer.requireDeclaredMethod(Name.putShort, Signature.ByteBuffer_int_short); - java_nio_ByteBuffer_putInt = java_nio_ByteBuffer.requireDeclaredMethod(Name.putInt, Signature.ByteBuffer_int_int); - java_nio_ByteBuffer_putLong = java_nio_ByteBuffer.requireDeclaredMethod(Name.putLong, Signature.ByteBuffer_int_long); - java_nio_ByteBuffer_putFloat = java_nio_ByteBuffer.requireDeclaredMethod(Name.putFloat, Signature.ByteBuffer_int_float); - java_nio_ByteBuffer_putDouble = java_nio_ByteBuffer.requireDeclaredMethod(Name.putDouble, Signature.ByteBuffer_int_double); - java_nio_ByteBuffer_order = java_nio_ByteBuffer.requireDeclaredMethod(Name.order, Signature.ByteOrder); - java_nio_ByteBuffer_setOrder = java_nio_ByteBuffer.requireDeclaredMethod(Name.order, Signature.ByteBuffer_ByteOrder); - - java_nio_DirectByteBuffer = knownKlass(Type.java_nio_DirectByteBuffer); + java_nio_ByteBuffer_getByte = java_nio_ByteBuffer.requireDeclaredMethod(Names.get, Signatures._byte_int); + java_nio_ByteBuffer_getShort = java_nio_ByteBuffer.requireDeclaredMethod(Names.getShort, Signatures._short_int); + java_nio_ByteBuffer_getInt = java_nio_ByteBuffer.requireDeclaredMethod(Names.getInt, Signatures._int_int); + java_nio_ByteBuffer_getLong = java_nio_ByteBuffer.requireDeclaredMethod(Names.getLong, Signatures._long_int); + java_nio_ByteBuffer_getFloat = java_nio_ByteBuffer.requireDeclaredMethod(Names.getFloat, Signatures._float_int); + java_nio_ByteBuffer_getDouble = java_nio_ByteBuffer.requireDeclaredMethod(Names.getDouble, Signatures._double_int); + java_nio_ByteBuffer_putByte = java_nio_ByteBuffer.requireDeclaredMethod(Names.put, Signatures.ByteBuffer_int_byte); + java_nio_ByteBuffer_putShort = java_nio_ByteBuffer.requireDeclaredMethod(Names.putShort, Signatures.ByteBuffer_int_short); + java_nio_ByteBuffer_putInt = java_nio_ByteBuffer.requireDeclaredMethod(Names.putInt, Signatures.ByteBuffer_int_int); + java_nio_ByteBuffer_putLong = java_nio_ByteBuffer.requireDeclaredMethod(Names.putLong, Signatures.ByteBuffer_int_long); + java_nio_ByteBuffer_putFloat = java_nio_ByteBuffer.requireDeclaredMethod(Names.putFloat, Signatures.ByteBuffer_int_float); + java_nio_ByteBuffer_putDouble = java_nio_ByteBuffer.requireDeclaredMethod(Names.putDouble, Signatures.ByteBuffer_int_double); + java_nio_ByteBuffer_order = java_nio_ByteBuffer.requireDeclaredMethod(Names.order, Signatures.ByteOrder); + java_nio_ByteBuffer_setOrder = java_nio_ByteBuffer.requireDeclaredMethod(Names.order, Signatures.ByteBuffer_ByteOrder); + + java_nio_DirectByteBuffer = knownKlass(Types.java_nio_DirectByteBuffer); java_nio_DirectByteBuffer_init_long_int = diff() // - .method(lower(20), Name._init_, Signature._void_long_int) // - .method(higher(21), Name._init_, Signature._void_long_long) // + .method(lower(20), Names._init_, Signatures._void_long_int) // + .method(higher(21), Names._init_, Signatures._void_long_long) // .method(java_nio_DirectByteBuffer); - java_nio_ByteOrder = knownKlass(Type.java_nio_ByteOrder); - java_nio_ByteOrder_LITTLE_ENDIAN = java_nio_ByteOrder.requireDeclaredField(Name.LITTLE_ENDIAN, Type.java_nio_ByteOrder); - java_nio_ByteOrder_BIG_ENDIAN = java_nio_ByteOrder.requireDeclaredField(Name.BIG_ENDIAN, Type.java_nio_ByteOrder); + java_nio_ByteOrder = knownKlass(Types.java_nio_ByteOrder); + java_nio_ByteOrder_LITTLE_ENDIAN = java_nio_ByteOrder.requireDeclaredField(Names.LITTLE_ENDIAN, Types.java_nio_ByteOrder); + java_nio_ByteOrder_BIG_ENDIAN = java_nio_ByteOrder.requireDeclaredField(Names.BIG_ENDIAN, Types.java_nio_ByteOrder); - java_lang_Thread = knownKlass(Type.java_lang_Thread); + java_lang_Thread = knownKlass(Types.java_lang_Thread); // The interrupted field is no longer hidden as of JDK14+ HIDDEN_INTERRUPTED = diff() // - .field(lower(13), Name.HIDDEN_INTERRUPTED, Type._boolean)// - .field(higher(14), Name.interrupted, Type._boolean) // + .field(lower(13), Names.HIDDEN_INTERRUPTED, Types._boolean)// + .field(higher(14), Names.interrupted, Types._boolean) // .maybeHiddenfield(java_lang_Thread); - HIDDEN_HOST_THREAD = java_lang_Thread.requireHiddenField(Name.HIDDEN_HOST_THREAD); - HIDDEN_ESPRESSO_MANAGED = java_lang_Thread.requireHiddenField(Name.HIDDEN_ESPRESSO_MANAGED); - HIDDEN_DEPRECATION_SUPPORT = java_lang_Thread.requireHiddenField(Name.HIDDEN_DEPRECATION_SUPPORT); - HIDDEN_THREAD_UNPARK_SIGNALS = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_UNPARK_SIGNALS); - HIDDEN_THREAD_PARK_LOCK = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_PARK_LOCK); + HIDDEN_HOST_THREAD = java_lang_Thread.requireHiddenField(Names.HIDDEN_HOST_THREAD); + HIDDEN_ESPRESSO_MANAGED = java_lang_Thread.requireHiddenField(Names.HIDDEN_ESPRESSO_MANAGED); + HIDDEN_DEPRECATION_SUPPORT = java_lang_Thread.requireHiddenField(Names.HIDDEN_DEPRECATION_SUPPORT); + HIDDEN_THREAD_UNPARK_SIGNALS = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_UNPARK_SIGNALS); + HIDDEN_THREAD_PARK_LOCK = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_PARK_LOCK); if (getJavaVersion().java19OrLater()) { - HIDDEN_THREAD_SCOPED_VALUE_CACHE = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_SCOPED_VALUE_CACHE); + HIDDEN_THREAD_SCOPED_VALUE_CACHE = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_SCOPED_VALUE_CACHE); } else { HIDDEN_THREAD_SCOPED_VALUE_CACHE = null; } if (context.getEspressoEnv().EnableManagement) { - HIDDEN_THREAD_PENDING_MONITOR = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_PENDING_MONITOR); - HIDDEN_THREAD_WAITING_MONITOR = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_WAITING_MONITOR); - HIDDEN_THREAD_BLOCKED_COUNT = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_BLOCKED_COUNT); - HIDDEN_THREAD_WAITED_COUNT = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_WAITED_COUNT); - HIDDEN_THREAD_DEPTH_FIRST_NUMBER = java_lang_Thread.requireHiddenField(Name.HIDDEN_THREAD_DEPTH_FIRST_NUMBER); + HIDDEN_THREAD_PENDING_MONITOR = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_PENDING_MONITOR); + HIDDEN_THREAD_WAITING_MONITOR = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_WAITING_MONITOR); + HIDDEN_THREAD_BLOCKED_COUNT = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_BLOCKED_COUNT); + HIDDEN_THREAD_WAITED_COUNT = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_WAITED_COUNT); + HIDDEN_THREAD_DEPTH_FIRST_NUMBER = java_lang_Thread.requireHiddenField(Names.HIDDEN_THREAD_DEPTH_FIRST_NUMBER); } else { HIDDEN_THREAD_PENDING_MONITOR = null; HIDDEN_THREAD_WAITING_MONITOR = null; @@ -512,213 +514,214 @@ public Meta(EspressoContext context) { } if (getJavaVersion().java19OrLater()) { - java_lang_BaseVirtualThread = knownKlass(Type.java_lang_BaseVirtualThread); + java_lang_BaseVirtualThread = knownKlass(Types.java_lang_BaseVirtualThread); java_lang_Thread_threadGroup = null; - java_lang_Thread$FieldHolder = knownKlass(Type.java_lang_Thread_FieldHolder); - java_lang_Thread$Constants = knownKlass(Type.java_lang_Thread_Constants); - java_lang_Thread$FieldHolder_group = java_lang_Thread$FieldHolder.requireDeclaredField(Name.group, Type.java_lang_ThreadGroup); - java_lang_Thread$Constants_VTHREAD_GROUP = java_lang_Thread$Constants.requireDeclaredField(Name.VTHREAD_GROUP, Type.java_lang_ThreadGroup); + java_lang_Thread$FieldHolder = knownKlass(Types.java_lang_Thread_FieldHolder); + java_lang_Thread$Constants = knownKlass(Types.java_lang_Thread_Constants); + java_lang_Thread$FieldHolder_group = java_lang_Thread$FieldHolder.requireDeclaredField(Names.group, Types.java_lang_ThreadGroup); + java_lang_Thread$Constants_VTHREAD_GROUP = java_lang_Thread$Constants.requireDeclaredField(Names.VTHREAD_GROUP, Types.java_lang_ThreadGroup); } else { java_lang_BaseVirtualThread = null; java_lang_Thread$FieldHolder = null; java_lang_Thread$Constants = null; - java_lang_Thread_threadGroup = java_lang_Thread.requireDeclaredField(Name.group, Type.java_lang_ThreadGroup); + java_lang_Thread_threadGroup = java_lang_Thread.requireDeclaredField(Names.group, Types.java_lang_ThreadGroup); java_lang_Thread$FieldHolder_group = null; java_lang_Thread$Constants_VTHREAD_GROUP = null; } - java_lang_ThreadGroup = knownKlass(Type.java_lang_ThreadGroup); + java_lang_ThreadGroup = knownKlass(Types.java_lang_ThreadGroup); if (getJavaVersion().java17OrEarlier()) { - java_lang_ThreadGroup_add = java_lang_ThreadGroup.requireDeclaredMethod(Name.add, Signature._void_Thread); + java_lang_ThreadGroup_add = java_lang_ThreadGroup.requireDeclaredMethod(Names.add, Signatures._void_Thread); } else { java_lang_ThreadGroup_add = null; } - java_lang_Thread_dispatchUncaughtException = java_lang_Thread.requireDeclaredMethod(Name.dispatchUncaughtException, Signature._void_Throwable); - java_lang_Thread_init_ThreadGroup_Runnable = java_lang_Thread.requireDeclaredMethod(Name._init_, Signature._void_ThreadGroup_Runnable); - java_lang_Thread_init_ThreadGroup_String = java_lang_Thread.requireDeclaredMethod(Name._init_, Signature._void_ThreadGroup_String); - java_lang_Thread_interrupt = java_lang_Thread.requireDeclaredMethod(Name.interrupt, Signature._void); - java_lang_Thread_exit = java_lang_Thread.requireDeclaredMethod(Name.exit, Signature._void); - java_lang_Thread_run = java_lang_Thread.requireDeclaredMethod(Name.run, Signature._void); - java_lang_Thread_getThreadGroup = java_lang_Thread.requireDeclaredMethod(Name.getThreadGroup, Signature.ThreadGroup); + java_lang_Thread_dispatchUncaughtException = java_lang_Thread.requireDeclaredMethod(Names.dispatchUncaughtException, Signatures._void_Throwable); + java_lang_Thread_init_ThreadGroup_Runnable = java_lang_Thread.requireDeclaredMethod(Names._init_, Signatures._void_ThreadGroup_Runnable); + java_lang_Thread_init_ThreadGroup_String = java_lang_Thread.requireDeclaredMethod(Names._init_, Signatures._void_ThreadGroup_String); + java_lang_Thread_interrupt = java_lang_Thread.requireDeclaredMethod(Names.interrupt, Signatures._void); + java_lang_Thread_exit = java_lang_Thread.requireDeclaredMethod(Names.exit, Signatures._void); + java_lang_Thread_run = java_lang_Thread.requireDeclaredMethod(Names.run, Signatures._void); + java_lang_Thread_getThreadGroup = java_lang_Thread.requireDeclaredMethod(Names.getThreadGroup, Signatures.ThreadGroup); if (getJavaVersion().java17OrEarlier()) { java_lang_Thread_holder = null; - java_lang_Thread_threadStatus = java_lang_Thread.requireDeclaredField(Name.threadStatus, Type._int); + java_lang_Thread_threadStatus = java_lang_Thread.requireDeclaredField(Names.threadStatus, Types._int); java_lang_Thread$FieldHolder_threadStatus = null; - java_lang_Thread_priority = java_lang_Thread.requireDeclaredField(Name.priority, _int.getType()); + java_lang_Thread_priority = java_lang_Thread.requireDeclaredField(Names.priority, _int.getType()); java_lang_Thread$FieldHolder_priority = null; - java_lang_Thread_daemon = java_lang_Thread.requireDeclaredField(Name.daemon, Type._boolean); + java_lang_Thread_daemon = java_lang_Thread.requireDeclaredField(Names.daemon, Types._boolean); java_lang_Thread$FieldHolder_daemon = null; } else { - java_lang_Thread_holder = java_lang_Thread.requireDeclaredField(Name.holder, java_lang_Thread$FieldHolder.getType()); + java_lang_Thread_holder = java_lang_Thread.requireDeclaredField(Names.holder, java_lang_Thread$FieldHolder.getType()); java_lang_Thread_threadStatus = null; - java_lang_Thread$FieldHolder_threadStatus = java_lang_Thread$FieldHolder.requireDeclaredField(Name.threadStatus, Type._int); + java_lang_Thread$FieldHolder_threadStatus = java_lang_Thread$FieldHolder.requireDeclaredField(Names.threadStatus, Types._int); java_lang_Thread_priority = null; - java_lang_Thread$FieldHolder_priority = java_lang_Thread$FieldHolder.requireDeclaredField(Name.priority, _int.getType()); + java_lang_Thread$FieldHolder_priority = java_lang_Thread$FieldHolder.requireDeclaredField(Names.priority, _int.getType()); java_lang_Thread_daemon = null; - java_lang_Thread$FieldHolder_daemon = java_lang_Thread$FieldHolder.requireDeclaredField(Name.daemon, Type._boolean); + java_lang_Thread$FieldHolder_daemon = java_lang_Thread$FieldHolder.requireDeclaredField(Names.daemon, Types._boolean); } - java_lang_Thread_tid = java_lang_Thread.requireDeclaredField(Name.tid, Type._long); - java_lang_Thread_eetop = java_lang_Thread.requireDeclaredField(Name.eetop, Type._long); - java_lang_Thread_contextClassLoader = java_lang_Thread.requireDeclaredField(Name.contextClassLoader, Type.java_lang_ClassLoader); + java_lang_Thread_tid = java_lang_Thread.requireDeclaredField(Names.tid, Types._long); + java_lang_Thread_eetop = java_lang_Thread.requireDeclaredField(Names.eetop, Types._long); + java_lang_Thread_contextClassLoader = java_lang_Thread.requireDeclaredField(Names.contextClassLoader, Types.java_lang_ClassLoader); - java_lang_Thread_name = java_lang_Thread.requireDeclaredField(Name.name, java_lang_String.getType()); - java_lang_Thread_inheritedAccessControlContext = java_lang_Thread.requireDeclaredField(Name.inheritedAccessControlContext, Type.java_security_AccessControlContext); - java_lang_Thread_checkAccess = java_lang_Thread.requireDeclaredMethod(Name.checkAccess, Signature._void); - java_lang_Thread_stop = java_lang_Thread.requireDeclaredMethod(Name.stop, Signature._void); - java_lang_ThreadGroup_maxPriority = java_lang_ThreadGroup.requireDeclaredField(Name.maxPriority, Type._int); + java_lang_Thread_name = java_lang_Thread.requireDeclaredField(Names.name, java_lang_String.getType()); + java_lang_Thread_inheritedAccessControlContext = java_lang_Thread.requireDeclaredField(Names.inheritedAccessControlContext, Types.java_security_AccessControlContext); + java_lang_Thread_checkAccess = java_lang_Thread.requireDeclaredMethod(Names.checkAccess, Signatures._void); + java_lang_Thread_stop = java_lang_Thread.requireDeclaredMethod(Names.stop, Signatures._void); + java_lang_ThreadGroup_maxPriority = java_lang_ThreadGroup.requireDeclaredField(Names.maxPriority, Types._int); - java_lang_ref_Finalizer$FinalizerThread = knownKlass(Type.java_lang_ref_Finalizer$FinalizerThread); - java_lang_ref_Reference$ReferenceHandler = knownKlass(Type.java_lang_ref_Reference$ReferenceHandler); + java_lang_ref_Finalizer$FinalizerThread = knownKlass(Types.java_lang_ref_Finalizer$FinalizerThread); + java_lang_ref_Reference$ReferenceHandler = knownKlass(Types.java_lang_ref_Reference$ReferenceHandler); misc_InnocuousThread = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_InnocuousThread) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_InnocuousThread) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_InnocuousThread) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_misc_InnocuousThread) // .klass(); - java_lang_System = knownKlass(Type.java_lang_System); - java_lang_System_exit = java_lang_System.requireDeclaredMethod(Name.exit, Signature._void_int); - java_lang_System_securityManager = java_lang_System.requireDeclaredField(Name.security, Type.java_lang_SecurityManager); + java_lang_System = knownKlass(Types.java_lang_System); + java_lang_System_exit = java_lang_System.requireDeclaredMethod(Names.exit, Signatures._void_int); + java_lang_System_securityManager = java_lang_System.requireDeclaredField(Names.security, Types.java_lang_SecurityManager); - java_security_ProtectionDomain = knownKlass(Type.java_security_ProtectionDomain); + java_security_ProtectionDomain = knownKlass(Types.java_security_ProtectionDomain); java_security_ProtectionDomain_impliesCreateAccessControlContext = diff() // - .method(lower(11), Name.impliesCreateAccessControlContext, Signature._boolean) // + .method(lower(11), Names.impliesCreateAccessControlContext, Signatures._boolean) // .notRequiredMethod(java_security_ProtectionDomain); java_security_ProtectionDomain_init_CodeSource_PermissionCollection = diff() // - .method(lower(11), Name._init_, Signature._void_CodeSource_PermissionCollection) // + .method(lower(11), Names._init_, Signatures._void_CodeSource_PermissionCollection) // .notRequiredMethod(java_security_ProtectionDomain); - java_security_AccessControlContext = knownKlass(Type.java_security_AccessControlContext); - java_security_AccessControlContext_context = java_security_AccessControlContext.requireDeclaredField(Name.context, Type.java_security_ProtectionDomain_array); - java_security_AccessControlContext_privilegedContext = java_security_AccessControlContext.requireDeclaredField(Name.privilegedContext, Type.java_security_AccessControlContext); - java_security_AccessControlContext_isPrivileged = java_security_AccessControlContext.requireDeclaredField(Name.isPrivileged, Type._boolean); - java_security_AccessControlContext_isAuthorized = java_security_AccessControlContext.requireDeclaredField(Name.isAuthorized, Type._boolean); - java_security_AccessController = knownKlass(Type.java_security_AccessController); - - java_lang_invoke_MethodType = knownKlass(Type.java_lang_invoke_MethodType); - java_lang_invoke_MethodType_ptypes = java_lang_invoke_MethodType.requireDeclaredField(Name.ptypes, Type.java_lang_Class_array); - java_lang_invoke_MethodType_rtype = java_lang_invoke_MethodType.requireDeclaredField(Name.rtype, Type.java_lang_Class); - - java_lang_invoke_MemberName = knownKlass(Type.java_lang_invoke_MemberName); - HIDDEN_VMINDEX = java_lang_invoke_MemberName.requireHiddenField(Name.HIDDEN_VMINDEX); - HIDDEN_VMTARGET = java_lang_invoke_MemberName.requireHiddenField(Name.HIDDEN_VMTARGET); - java_lang_invoke_MemberName_clazz = java_lang_invoke_MemberName.requireDeclaredField(Name.clazz, Type.java_lang_Class); - java_lang_invoke_MemberName_name = java_lang_invoke_MemberName.requireDeclaredField(Name.name, Type.java_lang_String); - java_lang_invoke_MemberName_type = java_lang_invoke_MemberName.requireDeclaredField(Name.type, Type.java_lang_Object); - java_lang_invoke_MemberName_flags = java_lang_invoke_MemberName.requireDeclaredField(Name.flags, Type._int); - - java_lang_invoke_MethodHandle = knownKlass(Type.java_lang_invoke_MethodHandle); - java_lang_invoke_MethodHandle_invokeExact = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.invokeExact, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_invoke = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.invoke, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_invokeBasic = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.invokeBasic, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_invokeWithArguments = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.invokeWithArguments, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_linkToInterface = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.linkToInterface, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_linkToSpecial = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.linkToSpecial, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_linkToStatic = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.linkToStatic, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_linkToVirtual = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.linkToVirtual, Signature.Object_Object_array); - java_lang_invoke_MethodHandle_asFixedArity = java_lang_invoke_MethodHandle.requireDeclaredMethod(Name.asFixedArity, Signature.MethodHandle); - java_lang_invoke_MethodHandle_type = java_lang_invoke_MethodHandle.requireDeclaredField(Name.type, Type.java_lang_invoke_MethodType); - java_lang_invoke_MethodHandle_form = java_lang_invoke_MethodHandle.requireDeclaredField(Name.form, Type.java_lang_invoke_LambdaForm); - - java_lang_invoke_MethodHandles = knownKlass(Type.java_lang_invoke_MethodHandles); - java_lang_invoke_MethodHandles_lookup = java_lang_invoke_MethodHandles.requireDeclaredMethod(Name.lookup, Signature.MethodHandles$Lookup); - - java_lang_invoke_DirectMethodHandle = knownKlass(Type.java_lang_invoke_DirectMethodHandle); - java_lang_invoke_DirectMethodHandle_member = java_lang_invoke_DirectMethodHandle.requireDeclaredField(Name.member, Type.java_lang_invoke_MemberName); + java_security_AccessControlContext = knownKlass(Types.java_security_AccessControlContext); + java_security_AccessControlContext_context = java_security_AccessControlContext.requireDeclaredField(Names.context, Types.java_security_ProtectionDomain_array); + java_security_AccessControlContext_privilegedContext = java_security_AccessControlContext.requireDeclaredField(Names.privilegedContext, Types.java_security_AccessControlContext); + java_security_AccessControlContext_isPrivileged = java_security_AccessControlContext.requireDeclaredField(Names.isPrivileged, Types._boolean); + java_security_AccessControlContext_isAuthorized = java_security_AccessControlContext.requireDeclaredField(Names.isAuthorized, Types._boolean); + java_security_AccessController = knownKlass(Types.java_security_AccessController); + + java_lang_invoke_MethodType = knownKlass(Types.java_lang_invoke_MethodType); + java_lang_invoke_MethodType_ptypes = java_lang_invoke_MethodType.requireDeclaredField(Names.ptypes, Types.java_lang_Class_array); + java_lang_invoke_MethodType_rtype = java_lang_invoke_MethodType.requireDeclaredField(Names.rtype, Types.java_lang_Class); + + java_lang_invoke_MemberName = knownKlass(Types.java_lang_invoke_MemberName); + HIDDEN_VMINDEX = java_lang_invoke_MemberName.requireHiddenField(Names.HIDDEN_VMINDEX); + HIDDEN_VMTARGET = java_lang_invoke_MemberName.requireHiddenField(Names.HIDDEN_VMTARGET); + java_lang_invoke_MemberName_clazz = java_lang_invoke_MemberName.requireDeclaredField(Names.clazz, Types.java_lang_Class); + java_lang_invoke_MemberName_name = java_lang_invoke_MemberName.requireDeclaredField(Names.name, Types.java_lang_String); + java_lang_invoke_MemberName_type = java_lang_invoke_MemberName.requireDeclaredField(Names.type, Types.java_lang_Object); + java_lang_invoke_MemberName_flags = java_lang_invoke_MemberName.requireDeclaredField(Names.flags, Types._int); + + java_lang_invoke_MethodHandle = knownKlass(Types.java_lang_invoke_MethodHandle); + java_lang_invoke_MethodHandle_invokeExact = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.invokeExact, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_invoke = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.invoke, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_invokeBasic = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.invokeBasic, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_invokeWithArguments = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.invokeWithArguments, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_linkToInterface = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.linkToInterface, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_linkToSpecial = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.linkToSpecial, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_linkToStatic = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.linkToStatic, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_linkToVirtual = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.linkToVirtual, Signatures.Object_Object_array); + java_lang_invoke_MethodHandle_asFixedArity = java_lang_invoke_MethodHandle.requireDeclaredMethod(Names.asFixedArity, Signatures.MethodHandle); + java_lang_invoke_MethodHandle_type = java_lang_invoke_MethodHandle.requireDeclaredField(Names.type, Types.java_lang_invoke_MethodType); + java_lang_invoke_MethodHandle_form = java_lang_invoke_MethodHandle.requireDeclaredField(Names.form, Types.java_lang_invoke_LambdaForm); + + java_lang_invoke_MethodHandles = knownKlass(Types.java_lang_invoke_MethodHandles); + java_lang_invoke_MethodHandles_lookup = java_lang_invoke_MethodHandles.requireDeclaredMethod(Names.lookup, Signatures.MethodHandles$Lookup); + + java_lang_invoke_DirectMethodHandle = knownKlass(Types.java_lang_invoke_DirectMethodHandle); + java_lang_invoke_DirectMethodHandle_member = java_lang_invoke_DirectMethodHandle.requireDeclaredField(Names.member, Types.java_lang_invoke_MemberName); // j.l.i.VarHandles is there in JDK9+, but we only need it to be known for 14+ java_lang_invoke_VarHandles = diff() // - .klass(higher(14), Type.java_lang_invoke_VarHandles) // + .klass(higher(14), Types.java_lang_invoke_VarHandles) // .notRequiredKlass(); java_lang_invoke_VarHandles_getStaticFieldFromBaseAndOffset = diff() // - .method(higher(14), Name.getStaticFieldFromBaseAndOffset, Signature.Field_Object_long_Class) // + .method(higher(14), Names.getStaticFieldFromBaseAndOffset, Signatures.Field_Object_long_Class) // .notRequiredMethod(java_lang_invoke_VarHandles); - java_lang_invoke_CallSite = knownKlass(Type.java_lang_invoke_CallSite); - java_lang_invoke_CallSite_target = java_lang_invoke_CallSite.requireDeclaredField(Name.target, Type.java_lang_invoke_MethodHandle); + java_lang_invoke_CallSite = knownKlass(Types.java_lang_invoke_CallSite); + java_lang_invoke_CallSite_target = java_lang_invoke_CallSite.requireDeclaredField(Names.target, Types.java_lang_invoke_MethodHandle); - java_lang_invoke_LambdaForm = knownKlass(Type.java_lang_invoke_LambdaForm); - java_lang_invoke_LambdaForm_vmentry = java_lang_invoke_LambdaForm.requireDeclaredField(Name.vmentry, Type.java_lang_invoke_MemberName); - java_lang_invoke_LambdaForm_isCompiled = java_lang_invoke_LambdaForm.requireDeclaredField(Name.isCompiled, Type._boolean); + java_lang_invoke_LambdaForm = knownKlass(Types.java_lang_invoke_LambdaForm); + java_lang_invoke_LambdaForm_vmentry = java_lang_invoke_LambdaForm.requireDeclaredField(Names.vmentry, Types.java_lang_invoke_MemberName); + java_lang_invoke_LambdaForm_isCompiled = java_lang_invoke_LambdaForm.requireDeclaredField(Names.isCompiled, Types._boolean); java_lang_invoke_LambdaForm_compileToBytecode = diff() // - .method(VERSION_8_OR_LOWER, Name.compileToBytecode, Signature.MemberName) // - .method(VERSION_9_OR_HIGHER, Name.compileToBytecode, Signature._void) // + .method(VERSION_8_OR_LOWER, Names.compileToBytecode, Signatures.MemberName) // + .method(VERSION_9_OR_HIGHER, Names.compileToBytecode, Signatures._void) // .method(java_lang_invoke_LambdaForm); - java_lang_invoke_MethodHandleNatives = knownKlass(Type.java_lang_invoke_MethodHandleNatives); - java_lang_invoke_MethodHandleNatives_linkMethod = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Name.linkMethod, Signature.MemberName_Class_int_Class_String_Object_Object_array); + java_lang_invoke_MethodHandleNatives = knownKlass(Types.java_lang_invoke_MethodHandleNatives); + java_lang_invoke_MethodHandleNatives_linkMethod = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Names.linkMethod, + Signatures.MemberName_Class_int_Class_String_Object_Object_array); java_lang_invoke_MethodHandleNatives_linkCallSite = diff() // - .method(VERSION_8_OR_LOWER, Name.linkCallSite, Signature.MemberName_Object_Object_Object_Object_Object_Object_array) // - .method(VERSION_9_OR_HIGHER, Name.linkCallSite, Signature.MemberName_Object_int_Object_Object_Object_Object_Object_array) // - .method(VERSION_19_OR_HIGHER, Name.linkCallSite, Signature.MemberName_Object_Object_Object_Object_Object_Object_array) // + .method(VERSION_8_OR_LOWER, Names.linkCallSite, Signatures.MemberName_Object_Object_Object_Object_Object_Object_array) // + .method(VERSION_9_OR_HIGHER, Names.linkCallSite, Signatures.MemberName_Object_int_Object_Object_Object_Object_Object_array) // + .method(VERSION_19_OR_HIGHER, Names.linkCallSite, Signatures.MemberName_Object_Object_Object_Object_Object_Object_array) // .method(java_lang_invoke_MethodHandleNatives); - java_lang_invoke_MethodHandleNatives_linkMethodHandleConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Name.linkMethodHandleConstant, - Signature.MethodHandle_Class_int_Class_String_Object); - java_lang_invoke_MethodHandleNatives_findMethodHandleType = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Name.findMethodHandleType, Signature.MethodType_Class_Class); + java_lang_invoke_MethodHandleNatives_linkMethodHandleConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Names.linkMethodHandleConstant, + Signatures.MethodHandle_Class_int_Class_String_Object); + java_lang_invoke_MethodHandleNatives_findMethodHandleType = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Names.findMethodHandleType, Signatures.MethodType_Class_Class); - java_lang_ref_Finalizer = knownKlass(Type.java_lang_ref_Finalizer); - java_lang_ref_Finalizer_register = java_lang_ref_Finalizer.requireDeclaredMethod(Name.register, Signature._void_Object); + java_lang_ref_Finalizer = knownKlass(Types.java_lang_ref_Finalizer); + java_lang_ref_Finalizer_register = java_lang_ref_Finalizer.requireDeclaredMethod(Names.register, Signatures._void_Object); - java_lang_Object_wait = java_lang_Object.requireDeclaredMethod(Name.wait, Signature._void_long); - java_lang_Object_toString = java_lang_Object.requireDeclaredMethod(Name.toString, Signature.String); + java_lang_Object_wait = java_lang_Object.requireDeclaredMethod(Names.wait, Signatures._void_long); + java_lang_Object_toString = java_lang_Object.requireDeclaredMethod(Names.toString, Signatures.String); // References - java_lang_ref_Reference = knownKlass(Type.java_lang_ref_Reference); - java_lang_ref_Reference_referent = java_lang_ref_Reference.requireDeclaredField(Name.referent, Type.java_lang_Object); - java_lang_ref_Reference_enqueue = java_lang_ref_Reference.requireDeclaredMethod(Name.enqueue, Signature._boolean); + java_lang_ref_Reference = knownKlass(Types.java_lang_ref_Reference); + java_lang_ref_Reference_referent = java_lang_ref_Reference.requireDeclaredField(Names.referent, Types.java_lang_Object); + java_lang_ref_Reference_enqueue = java_lang_ref_Reference.requireDeclaredMethod(Names.enqueue, Signatures._boolean); java_lang_ref_Reference_getFromInactiveFinalReference = diff() // - .method(VERSION_16_OR_HIGHER, Name.getFromInactiveFinalReference, Signature.Object) // + .method(VERSION_16_OR_HIGHER, Names.getFromInactiveFinalReference, Signatures.Object) // .notRequiredMethod(java_lang_ref_Reference); java_lang_ref_Reference_clearInactiveFinalReference = diff() // - .method(VERSION_16_OR_HIGHER, Name.clearInactiveFinalReference, Signature._void) // + .method(VERSION_16_OR_HIGHER, Names.clearInactiveFinalReference, Signatures._void) // .notRequiredMethod(java_lang_ref_Reference); - java_lang_ref_Reference_discovered = java_lang_ref_Reference.requireDeclaredField(Name.discovered, Type.java_lang_ref_Reference); - java_lang_ref_Reference_next = java_lang_ref_Reference.requireDeclaredField(Name.next, Type.java_lang_ref_Reference); - java_lang_ref_Reference_queue = java_lang_ref_Reference.requireDeclaredField(Name.queue, Type.java_lang_ref_ReferenceQueue); - java_lang_ref_ReferenceQueue = knownKlass(Type.java_lang_ref_ReferenceQueue); - java_lang_ref_ReferenceQueue_NULL = java_lang_ref_ReferenceQueue.requireDeclaredField(Name.NULL, Type.java_lang_ref_ReferenceQueue); - - java_lang_ref_WeakReference = knownKlass(Type.java_lang_ref_WeakReference); - java_lang_ref_SoftReference = knownKlass(Type.java_lang_ref_SoftReference); - java_lang_ref_PhantomReference = knownKlass(Type.java_lang_ref_PhantomReference); - java_lang_ref_FinalReference = knownKlass(Type.java_lang_ref_FinalReference); - HIDDEN_HOST_REFERENCE = java_lang_ref_Reference.requireHiddenField(Name.HIDDEN_HOST_REFERENCE); - - java_lang_AssertionStatusDirectives = knownKlass(Type.java_lang_AssertionStatusDirectives); - java_lang_AssertionStatusDirectives_classes = java_lang_AssertionStatusDirectives.requireDeclaredField(Name.classes, Type.java_lang_String_array); - java_lang_AssertionStatusDirectives_classEnabled = java_lang_AssertionStatusDirectives.requireDeclaredField(Name.classEnabled, Type._boolean_array); - java_lang_AssertionStatusDirectives_packages = java_lang_AssertionStatusDirectives.requireDeclaredField(Name.packages, Type.java_lang_String_array); - java_lang_AssertionStatusDirectives_packageEnabled = java_lang_AssertionStatusDirectives.requireDeclaredField(Name.packageEnabled, Type._boolean_array); - java_lang_AssertionStatusDirectives_deflt = java_lang_AssertionStatusDirectives.requireDeclaredField(Name.deflt, Type._boolean); + java_lang_ref_Reference_discovered = java_lang_ref_Reference.requireDeclaredField(Names.discovered, Types.java_lang_ref_Reference); + java_lang_ref_Reference_next = java_lang_ref_Reference.requireDeclaredField(Names.next, Types.java_lang_ref_Reference); + java_lang_ref_Reference_queue = java_lang_ref_Reference.requireDeclaredField(Names.queue, Types.java_lang_ref_ReferenceQueue); + java_lang_ref_ReferenceQueue = knownKlass(Types.java_lang_ref_ReferenceQueue); + java_lang_ref_ReferenceQueue_NULL = java_lang_ref_ReferenceQueue.requireDeclaredField(Names.NULL, Types.java_lang_ref_ReferenceQueue); + + java_lang_ref_WeakReference = knownKlass(Types.java_lang_ref_WeakReference); + java_lang_ref_SoftReference = knownKlass(Types.java_lang_ref_SoftReference); + java_lang_ref_PhantomReference = knownKlass(Types.java_lang_ref_PhantomReference); + java_lang_ref_FinalReference = knownKlass(Types.java_lang_ref_FinalReference); + HIDDEN_HOST_REFERENCE = java_lang_ref_Reference.requireHiddenField(Names.HIDDEN_HOST_REFERENCE); + + java_lang_AssertionStatusDirectives = knownKlass(Types.java_lang_AssertionStatusDirectives); + java_lang_AssertionStatusDirectives_classes = java_lang_AssertionStatusDirectives.requireDeclaredField(Names.classes, Types.java_lang_String_array); + java_lang_AssertionStatusDirectives_classEnabled = java_lang_AssertionStatusDirectives.requireDeclaredField(Names.classEnabled, Types._boolean_array); + java_lang_AssertionStatusDirectives_packages = java_lang_AssertionStatusDirectives.requireDeclaredField(Names.packages, Types.java_lang_String_array); + java_lang_AssertionStatusDirectives_packageEnabled = java_lang_AssertionStatusDirectives.requireDeclaredField(Names.packageEnabled, Types._boolean_array); + java_lang_AssertionStatusDirectives_deflt = java_lang_AssertionStatusDirectives.requireDeclaredField(Names.deflt, Types._boolean); // Classes and Members that differ from Java 8 to 11 if (getJavaVersion().java9OrLater()) { java_lang_System_initializeSystemClass = null; - jdk_internal_loader_ClassLoaders = knownKlass(Type.jdk_internal_loader_ClassLoaders); - jdk_internal_loader_ClassLoaders_platformClassLoader = jdk_internal_loader_ClassLoaders.requireDeclaredMethod(Name.platformClassLoader, Signature.ClassLoader); - jdk_internal_loader_ClassLoaders$PlatformClassLoader = knownKlass(Type.jdk_internal_loader_ClassLoaders$PlatformClassLoader); - java_lang_StackWalker = knownKlass(Type.java_lang_StackWalker); - java_lang_StackStreamFactory_AbstractStackWalker = knownKlass(Type.java_lang_StackStreamFactory_AbstractStackWalker); - java_lang_StackStreamFactory_AbstractStackWalker_doStackWalk = java_lang_StackStreamFactory_AbstractStackWalker.requireDeclaredMethod(Name.doStackWalk, - Signature.Object_long_int_int_int_int); - - java_lang_StackStreamFactory = knownKlass(Type.java_lang_StackStreamFactory); - - java_lang_StackFrameInfo = knownKlass(Type.java_lang_StackFrameInfo); - java_lang_StackFrameInfo_memberName = java_lang_StackFrameInfo.requireDeclaredField(Name.memberName, Type.java_lang_Object); - java_lang_StackFrameInfo_bci = java_lang_StackFrameInfo.requireDeclaredField(Name.bci, Type._int); - - java_lang_System_initPhase1 = java_lang_System.requireDeclaredMethod(Name.initPhase1, Signature._void); - java_lang_System_initPhase2 = java_lang_System.requireDeclaredMethod(Name.initPhase2, Signature._int_boolean_boolean); - java_lang_System_initPhase3 = java_lang_System.requireDeclaredMethod(Name.initPhase3, Signature._void); + jdk_internal_loader_ClassLoaders = knownKlass(Types.jdk_internal_loader_ClassLoaders); + jdk_internal_loader_ClassLoaders_platformClassLoader = jdk_internal_loader_ClassLoaders.requireDeclaredMethod(Names.platformClassLoader, Signatures.ClassLoader); + jdk_internal_loader_ClassLoaders$PlatformClassLoader = knownKlass(Types.jdk_internal_loader_ClassLoaders$PlatformClassLoader); + java_lang_StackWalker = knownKlass(Types.java_lang_StackWalker); + java_lang_StackStreamFactory_AbstractStackWalker = knownKlass(Types.java_lang_StackStreamFactory_AbstractStackWalker); + java_lang_StackStreamFactory_AbstractStackWalker_doStackWalk = java_lang_StackStreamFactory_AbstractStackWalker.requireDeclaredMethod(Names.doStackWalk, + Signatures.Object_long_int_int_int_int); + + java_lang_StackStreamFactory = knownKlass(Types.java_lang_StackStreamFactory); + + java_lang_StackFrameInfo = knownKlass(Types.java_lang_StackFrameInfo); + java_lang_StackFrameInfo_memberName = java_lang_StackFrameInfo.requireDeclaredField(Names.memberName, Types.java_lang_Object); + java_lang_StackFrameInfo_bci = java_lang_StackFrameInfo.requireDeclaredField(Names.bci, Types._int); + + java_lang_System_initPhase1 = java_lang_System.requireDeclaredMethod(Names.initPhase1, Signatures._void); + java_lang_System_initPhase2 = java_lang_System.requireDeclaredMethod(Names.initPhase2, Signatures._int_boolean_boolean); + java_lang_System_initPhase3 = java_lang_System.requireDeclaredMethod(Names.initPhase3, Signatures._void); } else { - java_lang_System_initializeSystemClass = java_lang_System.requireDeclaredMethod(Name.initializeSystemClass, Signature._void); + java_lang_System_initializeSystemClass = java_lang_System.requireDeclaredMethod(Names.initializeSystemClass, Signatures._void); jdk_internal_loader_ClassLoaders = null; jdk_internal_loader_ClassLoaders_platformClassLoader = null; jdk_internal_loader_ClassLoaders$PlatformClassLoader = null; @@ -738,18 +741,18 @@ public Meta(EspressoContext context) { } jdk_internal_loader_ClassLoaders$AppClassLoader = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_Launcher$AppClassLoader) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_loader_ClassLoaders$AppClassLoader) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_Launcher$AppClassLoader) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_loader_ClassLoaders$AppClassLoader) // .klass(); if (getJavaVersion().modulesEnabled()) { - java_lang_Module = knownKlass(Type.java_lang_Module); - java_lang_Module_name = java_lang_Module.requireDeclaredField(Name.name, Type.java_lang_String); - java_lang_Module_loader = java_lang_Module.requireDeclaredField(Name.loader, Type.java_lang_ClassLoader); - java_lang_Module_descriptor = java_lang_Module.requireDeclaredField(Name.descriptor, Type.java_lang_module_ModuleDescriptor); - HIDDEN_MODULE_ENTRY = java_lang_Module.requireHiddenField(Name.HIDDEN_MODULE_ENTRY); - java_lang_module_ModuleDescriptor = knownKlass(Type.java_lang_module_ModuleDescriptor); - java_lang_module_ModuleDescriptor_packages = java_lang_module_ModuleDescriptor.requireDeclaredField(Name.packages, Type.java_util_Set); + java_lang_Module = knownKlass(Types.java_lang_Module); + java_lang_Module_name = java_lang_Module.requireDeclaredField(Names.name, Types.java_lang_String); + java_lang_Module_loader = java_lang_Module.requireDeclaredField(Names.loader, Types.java_lang_ClassLoader); + java_lang_Module_descriptor = java_lang_Module.requireDeclaredField(Names.descriptor, Types.java_lang_module_ModuleDescriptor); + HIDDEN_MODULE_ENTRY = java_lang_Module.requireHiddenField(Names.HIDDEN_MODULE_ENTRY); + java_lang_module_ModuleDescriptor = knownKlass(Types.java_lang_module_ModuleDescriptor); + java_lang_module_ModuleDescriptor_packages = java_lang_module_ModuleDescriptor.requireDeclaredField(Names.packages, Types.java_util_Set); } else { java_lang_Module = null; java_lang_Module_name = null; @@ -761,245 +764,245 @@ public Meta(EspressoContext context) { } java_lang_Record = diff() // - .klass(VERSION_16_OR_HIGHER, Type.java_lang_Record) // + .klass(VERSION_16_OR_HIGHER, Types.java_lang_Record) // .notRequiredKlass(); java_lang_reflect_RecordComponent = diff() // - .klass(VERSION_16_OR_HIGHER, Type.java_lang_reflect_RecordComponent) // + .klass(VERSION_16_OR_HIGHER, Types.java_lang_reflect_RecordComponent) // .notRequiredKlass(); java_lang_reflect_RecordComponent_clazz = diff() // - .field(ALL, Name.clazz, Type.java_lang_Class) // + .field(ALL, Names.clazz, Types.java_lang_Class) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_name = diff() // - .field(ALL, Name.name, Type.java_lang_String) // + .field(ALL, Names.name, Types.java_lang_String) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_type = diff() // - .field(ALL, Name.type, Type.java_lang_Class) // + .field(ALL, Names.type, Types.java_lang_Class) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_accessor = diff() // - .field(ALL, Name.accessor, Type.java_lang_reflect_Method) // + .field(ALL, Names.accessor, Types.java_lang_reflect_Method) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_signature = diff() // - .field(ALL, Name.signature, Type.java_lang_String) // + .field(ALL, Names.signature, Types.java_lang_String) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_annotations = diff() // - .field(ALL, Name.annotations, Type._byte_array) // + .field(ALL, Names.annotations, Types._byte_array) // .notRequiredField(java_lang_reflect_RecordComponent); java_lang_reflect_RecordComponent_typeAnnotations = diff() // - .field(ALL, Name.typeAnnotations, Type._byte_array) // + .field(ALL, Names.typeAnnotations, Types._byte_array) // .notRequiredField(java_lang_reflect_RecordComponent); sun_reflect_MagicAccessorImpl = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_MagicAccessorImpl) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_MagicAccessorImpl) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_MagicAccessorImpl) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_MagicAccessorImpl) // .klass(); sun_reflect_DelegatingClassLoader = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_DelegatingClassLoader) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_DelegatingClassLoader) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_DelegatingClassLoader) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_DelegatingClassLoader) // .klass(); sun_reflect_MethodAccessorImpl = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_MethodAccessorImpl) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_MethodAccessorImpl) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_MethodAccessorImpl) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_MethodAccessorImpl) // .klass(); sun_reflect_ConstructorAccessorImpl = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_ConstructorAccessorImpl) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_ConstructorAccessorImpl) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_ConstructorAccessorImpl) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_ConstructorAccessorImpl) // .klass(); sun_misc_Signal = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_Signal) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_Signal) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_Signal) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_misc_Signal) // .klass(); - sun_misc_Signal_name = sun_misc_Signal.requireDeclaredField(Name.name, Type.java_lang_String); - sun_misc_Signal_init_String = sun_misc_Signal.requireDeclaredMethod(Name._init_, Signature._void_String); + sun_misc_Signal_name = sun_misc_Signal.requireDeclaredField(Names.name, Types.java_lang_String); + sun_misc_Signal_init_String = sun_misc_Signal.requireDeclaredMethod(Names._init_, Signatures._void_String); sun_misc_NativeSignalHandler = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_NativeSignalHandler) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_Signal$NativeHandler) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_NativeSignalHandler) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_misc_Signal$NativeHandler) // .klass(); - sun_misc_NativeSignalHandler_handler = sun_misc_NativeSignalHandler.requireDeclaredField(Name.handler, Type._long); + sun_misc_NativeSignalHandler_handler = sun_misc_NativeSignalHandler.requireDeclaredField(Names.handler, Types._long); sun_misc_SignalHandler = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_SignalHandler) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_Signal$Handler) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_SignalHandler) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_misc_Signal$Handler) // .klass(); sun_misc_SignalHandler_handle = diff() // - .method(VERSION_8_OR_LOWER, Name.handle, Signature._void_sun_misc_Signal) // - .method(VERSION_9_OR_HIGHER, Name.handle, Signature._void_jdk_internal_misc_Signal) // + .method(VERSION_8_OR_LOWER, Names.handle, Signatures._void_sun_misc_Signal) // + .method(VERSION_9_OR_HIGHER, Names.handle, Signatures._void_jdk_internal_misc_Signal) // .method(sun_misc_SignalHandler); sun_misc_SignalHandler_SIG_DFL = diff() // - .field(VERSION_8_OR_LOWER, Name.SIG_DFL, Type.sun_misc_SignalHandler) // - .field(VERSION_9_OR_HIGHER, Name.SIG_DFL, Type.jdk_internal_misc_Signal$Handler) // + .field(VERSION_8_OR_LOWER, Names.SIG_DFL, Types.sun_misc_SignalHandler) // + .field(VERSION_9_OR_HIGHER, Names.SIG_DFL, Types.jdk_internal_misc_Signal$Handler) // .field(sun_misc_SignalHandler); sun_misc_SignalHandler_SIG_IGN = diff() // - .field(VERSION_8_OR_LOWER, Name.SIG_IGN, Type.sun_misc_SignalHandler) // - .field(VERSION_9_OR_HIGHER, Name.SIG_IGN, Type.jdk_internal_misc_Signal$Handler) // + .field(VERSION_8_OR_LOWER, Names.SIG_IGN, Types.sun_misc_SignalHandler) // + .field(VERSION_9_OR_HIGHER, Names.SIG_IGN, Types.jdk_internal_misc_Signal$Handler) // .field(sun_misc_SignalHandler); sun_reflect_ConstantPool = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_ConstantPool) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_ConstantPool) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_ConstantPool) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_ConstantPool) // .klass(); - sun_reflect_ConstantPool_constantPoolOop = sun_reflect_ConstantPool.requireDeclaredField(Name.constantPoolOop, Type.java_lang_Object); + sun_reflect_ConstantPool_constantPoolOop = sun_reflect_ConstantPool.requireDeclaredField(Names.constantPoolOop, Types.java_lang_Object); sun_misc_Cleaner = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_Cleaner) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_ref_Cleaner) // + .klass(VERSION_8_OR_LOWER, Types.sun_misc_Cleaner) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_ref_Cleaner) // .klass(); if (getJavaVersion().java8OrEarlier()) { - java_lang_ref_Reference_pending = java_lang_ref_Reference.requireDeclaredField(Name.pending, Type.java_lang_ref_Reference); + java_lang_ref_Reference_pending = java_lang_ref_Reference.requireDeclaredField(Names.pending, Types.java_lang_ref_Reference); } else { java_lang_ref_Reference_pending = null; } java_lang_ref_Reference_lock = diff() // - .field(VERSION_8_OR_LOWER, Name.lock, Type.java_lang_ref_Reference$Lock) // - .field(VERSION_9_OR_HIGHER, Name.processPendingLock, Type.java_lang_Object) // + .field(VERSION_8_OR_LOWER, Names.lock, Types.java_lang_ref_Reference$Lock) // + .field(VERSION_9_OR_HIGHER, Names.processPendingLock, Types.java_lang_Object) // .field(java_lang_ref_Reference); sun_reflect_Reflection = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_reflect_Reflection) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_Reflection) // + .klass(VERSION_8_OR_LOWER, Types.sun_reflect_Reflection) // + .klass(VERSION_9_OR_HIGHER, Types.jdk_internal_reflect_Reflection) // .klass(); - sun_reflect_Reflection_getCallerClass = sun_reflect_Reflection.requireDeclaredMethod(Name.getCallerClass, Signature.Class); + sun_reflect_Reflection_getCallerClass = sun_reflect_Reflection.requireDeclaredMethod(Names.getCallerClass, Signatures.Class); if (getJavaVersion().java11OrLater()) { if (getJavaVersion().java17OrEarlier()) { - java_lang_invoke_MethodHandleNatives_linkDynamicConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Name.linkDynamicConstant, - Signature.Object_Object_int_Object_Object_Object_Object); + java_lang_invoke_MethodHandleNatives_linkDynamicConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Names.linkDynamicConstant, + Signatures.Object_Object_int_Object_Object_Object_Object); } else { - java_lang_invoke_MethodHandleNatives_linkDynamicConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Name.linkDynamicConstant, - Signature.Object_Object_Object_Object_Object_Object); + java_lang_invoke_MethodHandleNatives_linkDynamicConstant = java_lang_invoke_MethodHandleNatives.requireDeclaredMethod(Names.linkDynamicConstant, + Signatures.Object_Object_Object_Object_Object_Object); } } else { java_lang_invoke_MethodHandleNatives_linkDynamicConstant = null; } - ObjectKlass lambdaMetafactory = knownKlass(Type.java_lang_invoke_LambdaMetafactory); - java_lang_invoke_LambdaMetafactory_metafactory = lambdaMetafactory.requireDeclaredMethod(Name.metafactory, Signature.CallSite_Lookup_String_MethodType_MethodType_MethodHandle_MethodType); - java_lang_invoke_LambdaMetafactory_altMetafactory = lambdaMetafactory.requireDeclaredMethod(Name.altMetafactory, Signature.CallSite_Lookup_String_MethodType_Object_array); + ObjectKlass lambdaMetafactory = knownKlass(Types.java_lang_invoke_LambdaMetafactory); + java_lang_invoke_LambdaMetafactory_metafactory = lambdaMetafactory.requireDeclaredMethod(Names.metafactory, Signatures.CallSite_Lookup_String_MethodType_MethodType_MethodHandle_MethodType); + java_lang_invoke_LambdaMetafactory_altMetafactory = lambdaMetafactory.requireDeclaredMethod(Names.altMetafactory, Signatures.CallSite_Lookup_String_MethodType_Object_array); // Interop - java_time_Duration = knownKlass(Type.java_time_Duration); - java_time_Duration_seconds = java_time_Duration.requireDeclaredField(Name.seconds, Type._long); - java_time_Duration_nanos = java_time_Duration.requireDeclaredField(Name.nanos, Type._int); - - java_time_Instant = knownKlass(Type.java_time_Instant); - java_time_Instant_seconds = java_time_Instant.requireDeclaredField(Name.seconds, Type._long); - java_time_Instant_nanos = java_time_Instant.requireDeclaredField(Name.nanos, Type._int); - java_time_Instant_atZone = java_time_Instant.requireDeclaredMethod(Name.atZone, Signature.ZonedDateTime_ZoneId); + java_time_Duration = knownKlass(Types.java_time_Duration); + java_time_Duration_seconds = java_time_Duration.requireDeclaredField(Names.seconds, Types._long); + java_time_Duration_nanos = java_time_Duration.requireDeclaredField(Names.nanos, Types._int); + + java_time_Instant = knownKlass(Types.java_time_Instant); + java_time_Instant_seconds = java_time_Instant.requireDeclaredField(Names.seconds, Types._long); + java_time_Instant_nanos = java_time_Instant.requireDeclaredField(Names.nanos, Types._int); + java_time_Instant_atZone = java_time_Instant.requireDeclaredMethod(Names.atZone, Signatures.ZonedDateTime_ZoneId); assert java_time_Instant_atZone.isFinalFlagSet() || java_time_Instant.isFinalFlagSet(); - java_time_Instant_ofEpochSecond = java_time_Instant.requireDeclaredMethod(Name.ofEpochSecond, Signature.Instant_long_long); - - java_time_LocalTime = knownKlass(Type.java_time_LocalTime); - java_time_LocalTime_hour = java_time_LocalTime.requireDeclaredField(Name.hour, Type._byte); - java_time_LocalTime_minute = java_time_LocalTime.requireDeclaredField(Name.minute, Type._byte); - java_time_LocalTime_second = java_time_LocalTime.requireDeclaredField(Name.second, Type._byte); - java_time_LocalTime_nano = java_time_LocalTime.requireDeclaredField(Name.nano, Type._int); - java_time_LocalTime_of = java_time_LocalTime.requireDeclaredMethod(Name.of, Signature.LocalTime_int_int_int_int); - - java_time_LocalDateTime = knownKlass(Type.java_time_LocalDateTime); - java_time_LocalDateTime_toLocalDate = java_time_LocalDateTime.requireDeclaredMethod(Name.toLocalDate, Signature.LocalDate); - java_time_LocalDateTime_toLocalTime = java_time_LocalDateTime.requireDeclaredMethod(Name.toLocalTime, Signature.LocalTime); + java_time_Instant_ofEpochSecond = java_time_Instant.requireDeclaredMethod(Names.ofEpochSecond, Signatures.Instant_long_long); + + java_time_LocalTime = knownKlass(Types.java_time_LocalTime); + java_time_LocalTime_hour = java_time_LocalTime.requireDeclaredField(Names.hour, Types._byte); + java_time_LocalTime_minute = java_time_LocalTime.requireDeclaredField(Names.minute, Types._byte); + java_time_LocalTime_second = java_time_LocalTime.requireDeclaredField(Names.second, Types._byte); + java_time_LocalTime_nano = java_time_LocalTime.requireDeclaredField(Names.nano, Types._int); + java_time_LocalTime_of = java_time_LocalTime.requireDeclaredMethod(Names.of, Signatures.LocalTime_int_int_int_int); + + java_time_LocalDateTime = knownKlass(Types.java_time_LocalDateTime); + java_time_LocalDateTime_toLocalDate = java_time_LocalDateTime.requireDeclaredMethod(Names.toLocalDate, Signatures.LocalDate); + java_time_LocalDateTime_toLocalTime = java_time_LocalDateTime.requireDeclaredMethod(Names.toLocalTime, Signatures.LocalTime); assert java_time_LocalDateTime_toLocalTime.isFinalFlagSet() || java_time_LocalDateTime.isFinalFlagSet(); - java_time_LocalDateTime_of = java_time_LocalDateTime.requireDeclaredMethod(Name.of, Signature.LocalDateTime_LocalDate_LocalTime); + java_time_LocalDateTime_of = java_time_LocalDateTime.requireDeclaredMethod(Names.of, Signatures.LocalDateTime_LocalDate_LocalTime); - java_time_LocalDate = knownKlass(Type.java_time_LocalDate); - java_time_LocalDate_year = java_time_LocalDate.requireDeclaredField(Name.year, Type._int); + java_time_LocalDate = knownKlass(Types.java_time_LocalDate); + java_time_LocalDate_year = java_time_LocalDate.requireDeclaredField(Names.year, Types._int); assert java_time_LocalDate_year.getKind() == JavaKind.Int; - java_time_LocalDate_month = java_time_LocalDate.requireDeclaredField(Name.month, Type._short); + java_time_LocalDate_month = java_time_LocalDate.requireDeclaredField(Names.month, Types._short); assert java_time_LocalDate_month.getKind() == JavaKind.Short; - java_time_LocalDate_day = java_time_LocalDate.requireDeclaredField(Name.day, Type._short); + java_time_LocalDate_day = java_time_LocalDate.requireDeclaredField(Names.day, Types._short); assert java_time_LocalDate_day.getKind() == JavaKind.Short; - java_time_LocalDate_of = java_time_LocalDate.requireDeclaredMethod(Name.of, Signature.LocalDate_int_int_int); + java_time_LocalDate_of = java_time_LocalDate.requireDeclaredMethod(Names.of, Signatures.LocalDate_int_int_int); - java_time_ZonedDateTime = knownKlass(Type.java_time_ZonedDateTime); - java_time_ZonedDateTime_toLocalTime = java_time_ZonedDateTime.requireDeclaredMethod(Name.toLocalTime, Signature.LocalTime); + java_time_ZonedDateTime = knownKlass(Types.java_time_ZonedDateTime); + java_time_ZonedDateTime_toLocalTime = java_time_ZonedDateTime.requireDeclaredMethod(Names.toLocalTime, Signatures.LocalTime); assert java_time_ZonedDateTime_toLocalTime.isFinalFlagSet() || java_time_ZonedDateTime.isFinalFlagSet(); - java_time_ZonedDateTime_toLocalDate = java_time_ZonedDateTime.requireDeclaredMethod(Name.toLocalDate, Signature.LocalDate); + java_time_ZonedDateTime_toLocalDate = java_time_ZonedDateTime.requireDeclaredMethod(Names.toLocalDate, Signatures.LocalDate); assert java_time_ZonedDateTime_toLocalDate.isFinalFlagSet() || java_time_ZonedDateTime.isFinalFlagSet(); - java_time_ZonedDateTime_getZone = java_time_ZonedDateTime.requireDeclaredMethod(Name.getZone, Signature.ZoneId); + java_time_ZonedDateTime_getZone = java_time_ZonedDateTime.requireDeclaredMethod(Names.getZone, Signatures.ZoneId); assert java_time_ZonedDateTime_getZone.isFinalFlagSet() || java_time_ZonedDateTime.isFinalFlagSet(); - java_time_ZonedDateTime_toInstant = java_time_ZonedDateTime.requireMethod(Name.toInstant, Signature.Instant); // default + java_time_ZonedDateTime_toInstant = java_time_ZonedDateTime.requireMethod(Names.toInstant, Signatures.Instant); // default assert java_time_ZonedDateTime_toInstant.isFinalFlagSet() || java_time_ZonedDateTime.isFinalFlagSet(); - java_time_ZonedDateTime_ofInstant = java_time_ZonedDateTime.requireDeclaredMethod(Name.ofInstant, Signature.ZonedDateTime_Instant_ZoneId); - - java_util_Date = knownKlass(Type.java_util_Date); - java_util_Date_toInstant = java_util_Date.requireDeclaredMethod(Name.toInstant, Signature.Instant); - java_util_Date_from = java_util_Date.requireDeclaredMethod(Name.from, Signature.Date_Instant); - java_time_ZoneId = knownKlass(Type.java_time_ZoneId); - java_time_ZoneId_getId = java_time_ZoneId.requireDeclaredMethod(Name.getId, Signature.String); - java_time_ZoneId_of = java_time_ZoneId.requireDeclaredMethod(Name.of, Signature.ZoneId_String); + java_time_ZonedDateTime_ofInstant = java_time_ZonedDateTime.requireDeclaredMethod(Names.ofInstant, Signatures.ZonedDateTime_Instant_ZoneId); + + java_util_Date = knownKlass(Types.java_util_Date); + java_util_Date_toInstant = java_util_Date.requireDeclaredMethod(Names.toInstant, Signatures.Instant); + java_util_Date_from = java_util_Date.requireDeclaredMethod(Names.from, Signatures.Date_Instant); + java_time_ZoneId = knownKlass(Types.java_time_ZoneId); + java_time_ZoneId_getId = java_time_ZoneId.requireDeclaredMethod(Names.getId, Signatures.String); + java_time_ZoneId_of = java_time_ZoneId.requireDeclaredMethod(Names.of, Signatures.ZoneId_String); assert java_time_ZoneId_of.isStatic(); - java_util_Map = knownKlass(Type.java_util_Map); - java_util_Map_get = java_util_Map.requireDeclaredMethod(Name.get, Signature.Object_Object); - java_util_Map_put = java_util_Map.requireDeclaredMethod(Name.put, Signature.Object_Object_Object); - java_util_Map_size = java_util_Map.requireDeclaredMethod(Name.size, Signature._int); - java_util_Map_remove = java_util_Map.requireDeclaredMethod(Name.remove, Signature.Object_Object); - java_util_Map_containsKey = java_util_Map.requireDeclaredMethod(Name.containsKey, Signature._boolean_Object); - java_util_Map_entrySet = java_util_Map.requireDeclaredMethod(Name.entrySet, Signature.java_util_Set); + java_util_Map = knownKlass(Types.java_util_Map); + java_util_Map_get = java_util_Map.requireDeclaredMethod(Names.get, Signatures.Object_Object); + java_util_Map_put = java_util_Map.requireDeclaredMethod(Names.put, Signatures.Object_Object_Object); + java_util_Map_size = java_util_Map.requireDeclaredMethod(Names.size, Signatures._int); + java_util_Map_remove = java_util_Map.requireDeclaredMethod(Names.remove, Signatures.Object_Object); + java_util_Map_containsKey = java_util_Map.requireDeclaredMethod(Names.containsKey, Signatures._boolean_Object); + java_util_Map_entrySet = java_util_Map.requireDeclaredMethod(Names.entrySet, Signatures.java_util_Set); assert java_util_Map.isInterface(); - java_util_HashMap = knownKlass(Type.java_util_HashMap); - java_util_HashMap_init = java_util_HashMap.requireDeclaredMethod(Name._init_, Signature._void_int); - java_util_HashMap_put = java_util_HashMap.requireDeclaredMethod(Name.put, Signature.Object_Object_Object); - - java_util_Map_Entry = knownKlass(Type.java_util_Map_Entry); - java_util_Map_Entry_getKey = java_util_Map_Entry.requireDeclaredMethod(Name.getKey, Signature.Object); - java_util_Map_Entry_getValue = java_util_Map_Entry.requireDeclaredMethod(Name.getValue, Signature.Object); - java_util_Map_Entry_setValue = java_util_Map_Entry.requireDeclaredMethod(Name.setValue, Signature.Object_Object); - - java_util_List = knownKlass(Type.java_util_List); - java_util_List_get = java_util_List.requireDeclaredMethod(Name.get, Signature.Object_int); - java_util_List_set = java_util_List.requireDeclaredMethod(Name.set, Signature.Object_int_Object); - java_util_List_size = java_util_List.requireDeclaredMethod(Name.size, Signature._int); - java_util_List_add = java_util_List.requireDeclaredMethod(Name.add, Signature._boolean_Object); - java_util_List_remove = java_util_List.requireDeclaredMethod(Name.remove, Signature.Object_int); + java_util_HashMap = knownKlass(Types.java_util_HashMap); + java_util_HashMap_init = java_util_HashMap.requireDeclaredMethod(Names._init_, Signatures._void_int); + java_util_HashMap_put = java_util_HashMap.requireDeclaredMethod(Names.put, Signatures.Object_Object_Object); + + java_util_Map_Entry = knownKlass(Types.java_util_Map_Entry); + java_util_Map_Entry_getKey = java_util_Map_Entry.requireDeclaredMethod(Names.getKey, Signatures.Object); + java_util_Map_Entry_getValue = java_util_Map_Entry.requireDeclaredMethod(Names.getValue, Signatures.Object); + java_util_Map_Entry_setValue = java_util_Map_Entry.requireDeclaredMethod(Names.setValue, Signatures.Object_Object); + + java_util_List = knownKlass(Types.java_util_List); + java_util_List_get = java_util_List.requireDeclaredMethod(Names.get, Signatures.Object_int); + java_util_List_set = java_util_List.requireDeclaredMethod(Names.set, Signatures.Object_int_Object); + java_util_List_size = java_util_List.requireDeclaredMethod(Names.size, Signatures._int); + java_util_List_add = java_util_List.requireDeclaredMethod(Names.add, Signatures._boolean_Object); + java_util_List_remove = java_util_List.requireDeclaredMethod(Names.remove, Signatures.Object_int); assert java_util_List.isInterface(); - java_util_Set = knownKlass(Type.java_util_Set); - java_util_Set_add = java_util_Set.requireDeclaredMethod(Name.add, Signature._boolean_Object); + java_util_Set = knownKlass(Types.java_util_Set); + java_util_Set_add = java_util_Set.requireDeclaredMethod(Names.add, Signatures._boolean_Object); assert java_util_Set.isInterface(); if (getJavaVersion().java9OrLater()) { - java_util_Set_of = java_util_Set.requireDeclaredMethod(Name.of, Signature.Set_Object_array); + java_util_Set_of = java_util_Set.requireDeclaredMethod(Names.of, Signatures.Set_Object_array); } else { java_util_Set_of = null; } - java_lang_Iterable = knownKlass(Type.java_lang_Iterable); - java_lang_Iterable_iterator = java_lang_Iterable.requireDeclaredMethod(Name.iterator, Signature.java_util_Iterator); + java_lang_Iterable = knownKlass(Types.java_lang_Iterable); + java_lang_Iterable_iterator = java_lang_Iterable.requireDeclaredMethod(Names.iterator, Signatures.java_util_Iterator); assert java_lang_Iterable.isInterface(); - java_util_Iterator = knownKlass(Type.java_util_Iterator); - java_util_Iterator_next = java_util_Iterator.requireDeclaredMethod(Name.next, Signature.Object); - java_util_Iterator_hasNext = java_util_Iterator.requireDeclaredMethod(Name.hasNext, Signature._boolean); - java_util_Iterator_remove = java_util_Iterator.requireDeclaredMethod(Name.remove, Signature._void); + java_util_Iterator = knownKlass(Types.java_util_Iterator); + java_util_Iterator_next = java_util_Iterator.requireDeclaredMethod(Names.next, Signatures.Object); + java_util_Iterator_hasNext = java_util_Iterator.requireDeclaredMethod(Names.hasNext, Signatures._boolean); + java_util_Iterator_remove = java_util_Iterator.requireDeclaredMethod(Names.remove, Signatures._void); assert java_util_Iterator.isInterface(); - java_util_Collection = knownKlass(Type.java_util_Collection); - java_util_Collection_size = java_util_Collection.requireDeclaredMethod(Name.size, Signature._int); - java_util_Collection_toArray = java_util_Collection.requireDeclaredMethod(Name.toArray, Signature.Object_array_Object_array); + java_util_Collection = knownKlass(Types.java_util_Collection); + java_util_Collection_size = java_util_Collection.requireDeclaredMethod(Names.size, Signatures._int); + java_util_Collection_toArray = java_util_Collection.requireDeclaredMethod(Names.toArray, Signatures.Object_array_Object_array); - java_util_Optional = knownKlass(Type.java_util_Optional); - java_util_Optional_EMPTY = java_util_Optional.requireDeclaredField(Name.EMPTY, Type.java_util_Optional); - java_util_Optional_value = java_util_Optional.requireDeclaredField(Name.value, Type.java_lang_Object); + java_util_Optional = knownKlass(Types.java_util_Optional); + java_util_Optional_EMPTY = java_util_Optional.requireDeclaredField(Names.EMPTY, Types.java_util_Optional); + java_util_Optional_value = java_util_Optional.requireDeclaredField(Names.value, Types.java_lang_Object); - java_util_regex_Pattern = knownKlass(Type.java_util_regex_Pattern); - java_util_regex_Pattern_init = java_util_regex_Pattern.requireMethod(Name._init_, Signature._void_String_int); - java_util_regex_Pattern_compile = java_util_regex_Pattern.requireDeclaredMethod(Name.compile, Signature._void); + java_util_regex_Pattern = knownKlass(Types.java_util_regex_Pattern); + java_util_regex_Pattern_init = java_util_regex_Pattern.requireMethod(Names._init_, Signatures._void_String_int); + java_util_regex_Pattern_compile = java_util_regex_Pattern.requireDeclaredMethod(Names.compile, Signatures._void); if (context.getJavaVersion().java20OrLater()) { - java_util_regex_Pattern_namedGroups = java_util_regex_Pattern.requireMethod(Name.namedGroups, Signature.Map); + java_util_regex_Pattern_namedGroups = java_util_regex_Pattern.requireMethod(Names.namedGroups, Signatures.Map); } else { java_util_regex_Pattern_namedGroups = null; } if (context.regexSubstitutionsEnabled()) { - java_util_regex_Pattern_HIDDEN_tregexMatch = java_util_regex_Pattern.requireHiddenField(Name.HIDDEN_TREGEX_MATCH); - java_util_regex_Pattern_HIDDEN_tregexFullmatch = java_util_regex_Pattern.requireHiddenField(Name.HIDDEN_TREGEX_FULLMATCH); - java_util_regex_Pattern_HIDDEN_tregexSearch = java_util_regex_Pattern.requireHiddenField(Name.HIDDEN_TREGEX_SEARCH); - java_util_regex_Pattern_HIDDEN_unsupported = java_util_regex_Pattern.requireHiddenField(Name.HIDDEN_TREGEX_UNSUPPORTED); + java_util_regex_Pattern_HIDDEN_tregexMatch = java_util_regex_Pattern.requireHiddenField(Names.HIDDEN_TREGEX_MATCH); + java_util_regex_Pattern_HIDDEN_tregexFullmatch = java_util_regex_Pattern.requireHiddenField(Names.HIDDEN_TREGEX_FULLMATCH); + java_util_regex_Pattern_HIDDEN_tregexSearch = java_util_regex_Pattern.requireHiddenField(Names.HIDDEN_TREGEX_SEARCH); + java_util_regex_Pattern_HIDDEN_unsupported = java_util_regex_Pattern.requireHiddenField(Names.HIDDEN_TREGEX_UNSUPPORTED); } else { java_util_regex_Pattern_HIDDEN_tregexMatch = null; java_util_regex_Pattern_HIDDEN_tregexFullmatch = null; @@ -1008,15 +1011,15 @@ public Meta(EspressoContext context) { } if (context.getJavaVersion().java21OrLater()) { - java_util_regex_Pattern_pattern = java_util_regex_Pattern.requireDeclaredField(Name.pattern, Type.java_lang_String); - java_util_regex_Pattern_flags = java_util_regex_Pattern.requireDeclaredField(Name.flags, Type._int); - java_util_regex_Pattern_flags0 = java_util_regex_Pattern.requireDeclaredField(Name.flags0, Type._int); - java_util_regex_Pattern_compiled = java_util_regex_Pattern.requireDeclaredField(Name.compiled, Type._boolean); - java_util_regex_Pattern_namedGroups_field = java_util_regex_Pattern.requireDeclaredField(Name.namedGroups, Type.java_util_Map); - java_util_regex_Pattern_capturingGroupCount = java_util_regex_Pattern.requireDeclaredField(Name.capturingGroupCount, Type._int); - java_util_regex_Pattern_root = java_util_regex_Pattern.requireDeclaredField(Name.root, Type.java_util_regex_Pattern_Node); - java_util_regex_Pattern_localCount = java_util_regex_Pattern.requireDeclaredField(Name.localCount, Type._int); - java_util_regex_Pattern_localTCNCount = java_util_regex_Pattern.requireDeclaredField(Name.localTCNCount, Type._int); + java_util_regex_Pattern_pattern = java_util_regex_Pattern.requireDeclaredField(Names.pattern, Types.java_lang_String); + java_util_regex_Pattern_flags = java_util_regex_Pattern.requireDeclaredField(Names.flags, Types._int); + java_util_regex_Pattern_flags0 = java_util_regex_Pattern.requireDeclaredField(Names.flags0, Types._int); + java_util_regex_Pattern_compiled = java_util_regex_Pattern.requireDeclaredField(Names.compiled, Types._boolean); + java_util_regex_Pattern_namedGroups_field = java_util_regex_Pattern.requireDeclaredField(Names.namedGroups, Types.java_util_Map); + java_util_regex_Pattern_capturingGroupCount = java_util_regex_Pattern.requireDeclaredField(Names.capturingGroupCount, Types._int); + java_util_regex_Pattern_root = java_util_regex_Pattern.requireDeclaredField(Names.root, Types.java_util_regex_Pattern_Node); + java_util_regex_Pattern_localCount = java_util_regex_Pattern.requireDeclaredField(Names.localCount, Types._int); + java_util_regex_Pattern_localTCNCount = java_util_regex_Pattern.requireDeclaredField(Names.localTCNCount, Types._int); } else { java_util_regex_Pattern_pattern = null; java_util_regex_Pattern_flags = null; @@ -1029,25 +1032,25 @@ public Meta(EspressoContext context) { java_util_regex_Pattern_localTCNCount = null; } - java_util_regex_Matcher = knownKlass(Type.java_util_regex_Matcher); - java_util_regex_Matcher_init = java_util_regex_Matcher.requireMethod(Name._init_, Signature._void_CharSequence_Pattern); - java_util_regex_Matcher_reset = java_util_regex_Matcher.requireMethod(Name.reset, Signature.Matcher_CharSequence); - java_util_regex_Matcher_match = java_util_regex_Matcher.requireMethod(Name.match, Signature._boolean_int_int); - java_util_regex_Matcher_search = java_util_regex_Matcher.requireMethod(Name.search, Signature._boolean_int); - java_util_regex_Matcher_groupCount = java_util_regex_Matcher.requireDeclaredMethod(Name.groupCount, Signature._int); - java_util_regex_Matcher_hitEnd = java_util_regex_Matcher.requireDeclaredField(Name.hitEnd, Type._boolean); - java_util_regex_Matcher_requireEnd = java_util_regex_Matcher.requireDeclaredField(Name.requireEnd, Type._boolean); + java_util_regex_Matcher = knownKlass(Types.java_util_regex_Matcher); + java_util_regex_Matcher_init = java_util_regex_Matcher.requireMethod(Names._init_, Signatures._void_CharSequence_Pattern); + java_util_regex_Matcher_reset = java_util_regex_Matcher.requireMethod(Names.reset, Signatures.Matcher_CharSequence); + java_util_regex_Matcher_match = java_util_regex_Matcher.requireMethod(Names.match, Signatures._boolean_int_int); + java_util_regex_Matcher_search = java_util_regex_Matcher.requireMethod(Names.search, Signatures._boolean_int); + java_util_regex_Matcher_groupCount = java_util_regex_Matcher.requireDeclaredMethod(Names.groupCount, Signatures._int); + java_util_regex_Matcher_hitEnd = java_util_regex_Matcher.requireDeclaredField(Names.hitEnd, Types._boolean); + java_util_regex_Matcher_requireEnd = java_util_regex_Matcher.requireDeclaredField(Names.requireEnd, Types._boolean); if (context.regexSubstitutionsEnabled()) { - java_util_regex_Matcher_HIDDEN_tstring = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_TSTRING); - java_util_regex_Matcher_HIDDEN_oldLastBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_OLD_LAST_BACKUP); - java_util_regex_Matcher_HIDDEN_modCountBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_MOD_COUNT_BACKUP); - java_util_regex_Matcher_HIDDEN_transparentBoundsBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP); - java_util_regex_Matcher_HIDDEN_anchoringBoundsBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP); - java_util_regex_Matcher_HIDDEN_fromBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_FROM_BACKUP); - java_util_regex_Matcher_HIDDEN_toBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_TO_BACKUP); - java_util_regex_Matcher_HIDDEN_matchingModeBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_MATCHING_MODE_BACKUP); - java_util_regex_Matcher_HIDDEN_searchFromBackup = java_util_regex_Matcher.requireHiddenField(Name.HIDDEN_TREGEX_SEARCH_FROM_BACKUP); + java_util_regex_Matcher_HIDDEN_tstring = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_TSTRING); + java_util_regex_Matcher_HIDDEN_oldLastBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_OLD_LAST_BACKUP); + java_util_regex_Matcher_HIDDEN_modCountBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_MOD_COUNT_BACKUP); + java_util_regex_Matcher_HIDDEN_transparentBoundsBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_TRANSPARENT_BOUNDS_BACKUP); + java_util_regex_Matcher_HIDDEN_anchoringBoundsBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_ANCHORING_BOUNDS_BACKUP); + java_util_regex_Matcher_HIDDEN_fromBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_FROM_BACKUP); + java_util_regex_Matcher_HIDDEN_toBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_TO_BACKUP); + java_util_regex_Matcher_HIDDEN_matchingModeBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_MATCHING_MODE_BACKUP); + java_util_regex_Matcher_HIDDEN_searchFromBackup = java_util_regex_Matcher.requireHiddenField(Names.HIDDEN_TREGEX_SEARCH_FROM_BACKUP); } else { java_util_regex_Matcher_HIDDEN_tstring = null; java_util_regex_Matcher_HIDDEN_oldLastBackup = null; @@ -1061,18 +1064,18 @@ public Meta(EspressoContext context) { } if (context.getJavaVersion().java21OrLater()) { - java_util_regex_Matcher_parentPattern = java_util_regex_Matcher.requireDeclaredField(Name.parentPattern, Type.java_util_regex_Pattern); - java_util_regex_Matcher_groups = java_util_regex_Matcher.requireDeclaredField(Name.groups, Type._int_array); - java_util_regex_Matcher_first = java_util_regex_Matcher.requireDeclaredField(Name.first, Type._int); - java_util_regex_Matcher_last = java_util_regex_Matcher.requireDeclaredField(Name.last, Type._int); - java_util_regex_Matcher_oldLast = java_util_regex_Matcher.requireDeclaredField(Name.oldLast, Type._int); - java_util_regex_Matcher_from = java_util_regex_Matcher.requireDeclaredField(Name.from, Type._int); - java_util_regex_Matcher_to = java_util_regex_Matcher.requireDeclaredField(Name.to, Type._int); - java_util_regex_Matcher_modCount = java_util_regex_Matcher.requireDeclaredField(Name.modCount, Type._int); - java_util_regex_Matcher_transparentBounds = java_util_regex_Matcher.requireDeclaredField(Name.transparentBounds, Type._boolean); - java_util_regex_Matcher_anchoringBounds = java_util_regex_Matcher.requireDeclaredField(Name.anchoringBounds, Type._boolean); - java_util_regex_Matcher_locals = java_util_regex_Matcher.requireDeclaredField(Name.locals, Type._int_array); - java_util_regex_Matcher_localsPos = java_util_regex_Matcher.requireDeclaredField(Name.localsPos, Type.java_util_regex_IntHashSet_array); + java_util_regex_Matcher_parentPattern = java_util_regex_Matcher.requireDeclaredField(Names.parentPattern, Types.java_util_regex_Pattern); + java_util_regex_Matcher_groups = java_util_regex_Matcher.requireDeclaredField(Names.groups, Types._int_array); + java_util_regex_Matcher_first = java_util_regex_Matcher.requireDeclaredField(Names.first, Types._int); + java_util_regex_Matcher_last = java_util_regex_Matcher.requireDeclaredField(Names.last, Types._int); + java_util_regex_Matcher_oldLast = java_util_regex_Matcher.requireDeclaredField(Names.oldLast, Types._int); + java_util_regex_Matcher_from = java_util_regex_Matcher.requireDeclaredField(Names.from, Types._int); + java_util_regex_Matcher_to = java_util_regex_Matcher.requireDeclaredField(Names.to, Types._int); + java_util_regex_Matcher_modCount = java_util_regex_Matcher.requireDeclaredField(Names.modCount, Types._int); + java_util_regex_Matcher_transparentBounds = java_util_regex_Matcher.requireDeclaredField(Names.transparentBounds, Types._boolean); + java_util_regex_Matcher_anchoringBounds = java_util_regex_Matcher.requireDeclaredField(Names.anchoringBounds, Types._boolean); + java_util_regex_Matcher_locals = java_util_regex_Matcher.requireDeclaredField(Names.locals, Types._int_array); + java_util_regex_Matcher_localsPos = java_util_regex_Matcher.requireDeclaredField(Names.localsPos, Types.java_util_regex_IntHashSet_array); } else { java_util_regex_Matcher_parentPattern = null; @@ -1090,36 +1093,36 @@ public Meta(EspressoContext context) { } if (context.getJavaVersion().java21OrLater()) { - java_util_regex_IntHashSet = knownKlass(Type.java_util_regex_IntHashSet); + java_util_regex_IntHashSet = knownKlass(Types.java_util_regex_IntHashSet); } else { java_util_regex_IntHashSet = null; } - java_util_concurrent_locks_AbstractOwnableSynchronizer = knownKlass(Type.java_util_concurrent_locks_AbstractOwnableSynchronizer); - java_util_concurrent_locks_AbstractOwnableSynchronizer_exclusiveOwnerThread = java_util_concurrent_locks_AbstractOwnableSynchronizer.requireDeclaredField(Name.exclusiveOwnerThread, - Type.java_lang_Thread); - java_util_concurrent_locks_ReentrantLock_Sync = knownKlass(Type.java_util_concurrent_locks_ReentrantLock_Sync); - java_util_concurrent_locks_ReentrantReadWriteLock_Sync = knownKlass(Type.java_util_concurrent_locks_ReentrantReadWriteLock_Sync); + java_util_concurrent_locks_AbstractOwnableSynchronizer = knownKlass(Types.java_util_concurrent_locks_AbstractOwnableSynchronizer); + java_util_concurrent_locks_AbstractOwnableSynchronizer_exclusiveOwnerThread = java_util_concurrent_locks_AbstractOwnableSynchronizer.requireDeclaredField(Names.exclusiveOwnerThread, + Types.java_lang_Thread); + java_util_concurrent_locks_ReentrantLock_Sync = knownKlass(Types.java_util_concurrent_locks_ReentrantLock_Sync); + java_util_concurrent_locks_ReentrantReadWriteLock_Sync = knownKlass(Types.java_util_concurrent_locks_ReentrantReadWriteLock_Sync); - java_math_BigInteger = knownKlass(Type.java_math_BigInteger); - java_math_BigInteger_init = java_math_BigInteger.requireDeclaredMethod(Name._init_, Signature._void_byte_array); - java_math_BigInteger_toByteArray = java_math_BigInteger.requireDeclaredMethod(Name.toByteArray, Signature._byte_array); + java_math_BigInteger = knownKlass(Types.java_math_BigInteger); + java_math_BigInteger_init = java_math_BigInteger.requireDeclaredMethod(Names._init_, Signatures._void_byte_array); + java_math_BigInteger_toByteArray = java_math_BigInteger.requireDeclaredMethod(Names.toByteArray, Signatures._byte_array); - java_math_BigDecimal = knownKlass(Type.java_math_BigDecimal); - java_math_BigDecimal_init = java_math_BigDecimal.requireDeclaredMethod(Name._init_, Signature._void_BigInteger_int_MathContext); + java_math_BigDecimal = knownKlass(Types.java_math_BigDecimal); + java_math_BigDecimal_init = java_math_BigDecimal.requireDeclaredMethod(Names._init_, Signatures._void_BigInteger_int_MathContext); - java_math_MathContext = knownKlass(Type.java_math_MathContext); - java_math_MathContext_init = java_math_MathContext.requireDeclaredMethod(Name._init_, Signature._void_int); + java_math_MathContext = knownKlass(Types.java_math_MathContext); + java_math_MathContext_init = java_math_MathContext.requireDeclaredMethod(Names._init_, Signatures._void_int); jdk_internal_misc_UnsafeConstants = diff() // - .klass(higher(13), Type.jdk_internal_misc_UnsafeConstants) // + .klass(higher(13), Types.jdk_internal_misc_UnsafeConstants) // .notRequiredKlass(); if (jdk_internal_misc_UnsafeConstants != null) { - jdk_internal_misc_UnsafeConstants_ADDRESS_SIZE0 = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Name.ADDRESS_SIZE0, Type._int); - jdk_internal_misc_UnsafeConstants_PAGE_SIZE = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Name.PAGE_SIZE, Type._int); - jdk_internal_misc_UnsafeConstants_BIG_ENDIAN = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Name.BIG_ENDIAN, Type._boolean); - jdk_internal_misc_UnsafeConstants_UNALIGNED_ACCESS = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Name.UNALIGNED_ACCESS, Type._boolean); - jdk_internal_misc_UnsafeConstants_DATA_CACHE_LINE_FLUSH_SIZE = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Name.DATA_CACHE_LINE_FLUSH_SIZE, Type._int); + jdk_internal_misc_UnsafeConstants_ADDRESS_SIZE0 = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Names.ADDRESS_SIZE0, Types._int); + jdk_internal_misc_UnsafeConstants_PAGE_SIZE = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Names.PAGE_SIZE, Types._int); + jdk_internal_misc_UnsafeConstants_BIG_ENDIAN = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Names.BIG_ENDIAN, Types._boolean); + jdk_internal_misc_UnsafeConstants_UNALIGNED_ACCESS = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Names.UNALIGNED_ACCESS, Types._boolean); + jdk_internal_misc_UnsafeConstants_DATA_CACHE_LINE_FLUSH_SIZE = jdk_internal_misc_UnsafeConstants.requireDeclaredField(Names.DATA_CACHE_LINE_FLUSH_SIZE, Types._int); } else { jdk_internal_misc_UnsafeConstants_ADDRESS_SIZE0 = null; jdk_internal_misc_UnsafeConstants_PAGE_SIZE = null; @@ -1129,18 +1132,18 @@ public Meta(EspressoContext context) { } if (getJavaVersion().java9OrLater()) { - jdk_internal_module_ModuleLoaderMap = knownKlass(Type.jdk_internal_module_ModuleLoaderMap); - jdk_internal_module_ModuleLoaderMap_bootModules = jdk_internal_module_ModuleLoaderMap.requireDeclaredMethod(Name.bootModules, Signature.java_util_Set); - jdk_internal_module_ModuleLoaderMap_platformModules = jdk_internal_module_ModuleLoaderMap.requireDeclaredMethod(Name.platformModules, Signature.java_util_Set); - jdk_internal_module_SystemModuleFinders = knownKlass(Type.jdk_internal_module_SystemModuleFinders); - jdk_internal_module_SystemModuleFinders_of = jdk_internal_module_SystemModuleFinders.requireDeclaredMethod(Name.of, Signature.ModuleFinder_SystemModules); - jdk_internal_module_SystemModuleFinders_ofSystem = jdk_internal_module_SystemModuleFinders.requireDeclaredMethod(Name.ofSystem, Signature.ModuleFinder); - jdk_internal_module_ModulePath = knownKlass(Type.jdk_internal_module_ModulePath); - jdk_internal_module_ModulePath_of = jdk_internal_module_ModulePath.requireDeclaredMethod(Name.of, Signature.ModuleFinder_Path_array); - java_lang_module_ModuleFinder = knownKlass(Type.java_lang_module_ModuleFinder); - java_lang_module_ModuleFinder_compose = java_lang_module_ModuleFinder.requireDeclaredMethod(Name.compose, Signature.ModuleFinder_ModuleFinder_array); - jdk_internal_module_Modules = knownKlass(Type.jdk_internal_module_Modules); - jdk_internal_module_Modules_defineModule = jdk_internal_module_Modules.requireDeclaredMethod(Name.defineModule, Signature.Module_ClassLoader_ModuleDescriptor_URI); + jdk_internal_module_ModuleLoaderMap = knownKlass(Types.jdk_internal_module_ModuleLoaderMap); + jdk_internal_module_ModuleLoaderMap_bootModules = jdk_internal_module_ModuleLoaderMap.requireDeclaredMethod(Names.bootModules, Signatures.java_util_Set); + jdk_internal_module_ModuleLoaderMap_platformModules = jdk_internal_module_ModuleLoaderMap.requireDeclaredMethod(Names.platformModules, Signatures.java_util_Set); + jdk_internal_module_SystemModuleFinders = knownKlass(Types.jdk_internal_module_SystemModuleFinders); + jdk_internal_module_SystemModuleFinders_of = jdk_internal_module_SystemModuleFinders.requireDeclaredMethod(Names.of, Signatures.ModuleFinder_SystemModules); + jdk_internal_module_SystemModuleFinders_ofSystem = jdk_internal_module_SystemModuleFinders.requireDeclaredMethod(Names.ofSystem, Signatures.ModuleFinder); + jdk_internal_module_ModulePath = knownKlass(Types.jdk_internal_module_ModulePath); + jdk_internal_module_ModulePath_of = jdk_internal_module_ModulePath.requireDeclaredMethod(Names.of, Signatures.ModuleFinder_Path_array); + java_lang_module_ModuleFinder = knownKlass(Types.java_lang_module_ModuleFinder); + java_lang_module_ModuleFinder_compose = java_lang_module_ModuleFinder.requireDeclaredMethod(Names.compose, Signatures.ModuleFinder_ModuleFinder_array); + jdk_internal_module_Modules = knownKlass(Types.jdk_internal_module_Modules); + jdk_internal_module_Modules_defineModule = jdk_internal_module_Modules.requireDeclaredMethod(Names.defineModule, Signatures.Module_ClassLoader_ModuleDescriptor_URI); } else { jdk_internal_module_ModuleLoaderMap = null; jdk_internal_module_ModuleLoaderMap_bootModules = null; @@ -1157,15 +1160,15 @@ public Meta(EspressoContext context) { } if (getJavaVersion().java20OrLater()) { - jdk_internal_foreign_abi_VMStorage = knownKlass(Type.jdk_internal_foreign_abi_VMStorage); - jdk_internal_foreign_abi_VMStorage_type = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Name.type, Type._byte); - jdk_internal_foreign_abi_VMStorage_segmentMaskOrSize = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Name.segmentMaskOrSize, Type._short); - jdk_internal_foreign_abi_VMStorage_indexOrOffset = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Name.indexOrOffset, Type._int); - jdk_internal_foreign_abi_NativeEntryPoint = knownKlass(Type.jdk_internal_foreign_abi_NativeEntryPoint); - jdk_internal_foreign_abi_NativeEntryPoint_downcallStubAddress = jdk_internal_foreign_abi_NativeEntryPoint.requireDeclaredField(Name.downcallStubAddress, Type._long); - jdk_internal_foreign_abi_UpcallLinker_CallRegs = knownKlass(Type.jdk_internal_foreign_abi_UpcallLinker_CallRegs); - jdk_internal_foreign_abi_UpcallLinker_CallRegs_argRegs = jdk_internal_foreign_abi_UpcallLinker_CallRegs.requireDeclaredField(Name.argRegs, Type.jdk_internal_foreign_abi_VMStorage_array); - jdk_internal_foreign_abi_UpcallLinker_CallRegs_retRegs = jdk_internal_foreign_abi_UpcallLinker_CallRegs.requireDeclaredField(Name.retRegs, Type.jdk_internal_foreign_abi_VMStorage_array); + jdk_internal_foreign_abi_VMStorage = knownKlass(Types.jdk_internal_foreign_abi_VMStorage); + jdk_internal_foreign_abi_VMStorage_type = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Names.type, Types._byte); + jdk_internal_foreign_abi_VMStorage_segmentMaskOrSize = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Names.segmentMaskOrSize, Types._short); + jdk_internal_foreign_abi_VMStorage_indexOrOffset = jdk_internal_foreign_abi_VMStorage.requireDeclaredField(Names.indexOrOffset, Types._int); + jdk_internal_foreign_abi_NativeEntryPoint = knownKlass(Types.jdk_internal_foreign_abi_NativeEntryPoint); + jdk_internal_foreign_abi_NativeEntryPoint_downcallStubAddress = jdk_internal_foreign_abi_NativeEntryPoint.requireDeclaredField(Names.downcallStubAddress, Types._long); + jdk_internal_foreign_abi_UpcallLinker_CallRegs = knownKlass(Types.jdk_internal_foreign_abi_UpcallLinker_CallRegs); + jdk_internal_foreign_abi_UpcallLinker_CallRegs_argRegs = jdk_internal_foreign_abi_UpcallLinker_CallRegs.requireDeclaredField(Names.argRegs, Types.jdk_internal_foreign_abi_VMStorage_array); + jdk_internal_foreign_abi_UpcallLinker_CallRegs_retRegs = jdk_internal_foreign_abi_UpcallLinker_CallRegs.requireDeclaredField(Names.retRegs, Types.jdk_internal_foreign_abi_VMStorage_array); } else { // also exists in a different shape in 19 but we don't support that jdk_internal_foreign_abi_VMStorage = null; @@ -1180,10 +1183,10 @@ public Meta(EspressoContext context) { } jdk_internal_module_ModuleLoaderMap_Modules = diff() // - .klass(VERSION_17_OR_HIGHER, Type.jdk_internal_module_ModuleLoaderMap_Modules) // + .klass(VERSION_17_OR_HIGHER, Types.jdk_internal_module_ModuleLoaderMap_Modules) // .notRequiredKlass(); jdk_internal_module_ModuleLoaderMap_Modules_clinit = diff() // - .method(ALL, Name._clinit_, Signature._void) // + .method(ALL, Names._clinit_, Signatures._void) // .notRequiredMethod(jdk_internal_module_ModuleLoaderMap_Modules); interopDispatch = new InteropKlassesDispatch(this); @@ -1211,22 +1214,22 @@ private static void initializeEspressoClassInHierarchy(ObjectKlass klass) { */ public void postSystemInit() { // java.management - java_lang_management_MemoryUsage = loadKlassWithBootClassLoader(Type.java_lang_management_MemoryUsage); + java_lang_management_MemoryUsage = loadKlassWithBootClassLoader(Types.java_lang_management_MemoryUsage); - java_lang_management_ThreadInfo = loadKlassWithBootClassLoader(Type.java_lang_management_ThreadInfo); + java_lang_management_ThreadInfo = loadKlassWithBootClassLoader(Types.java_lang_management_ThreadInfo); sun_management_ManagementFactory = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_management_ManagementFactory) // - .klass(VERSION_9_OR_HIGHER, Type.sun_management_ManagementFactoryHelper) // + .klass(VERSION_8_OR_LOWER, Types.sun_management_ManagementFactory) // + .klass(VERSION_9_OR_HIGHER, Types.sun_management_ManagementFactoryHelper) // .notRequiredKlass(); if (sun_management_ManagementFactory != null) { // MemoryPoolMXBean createMemoryPool(String var0, boolean var1, long var2, long var4) - sun_management_ManagementFactory_createMemoryPool = sun_management_ManagementFactory.requireDeclaredMethod(Name.createMemoryPool, Signature.MemoryPoolMXBean_String_boolean_long_long); + sun_management_ManagementFactory_createMemoryPool = sun_management_ManagementFactory.requireDeclaredMethod(Names.createMemoryPool, Signatures.MemoryPoolMXBean_String_boolean_long_long); // MemoryManagerMXBean createMemoryManager(String var0) - sun_management_ManagementFactory_createMemoryManager = sun_management_ManagementFactory.requireDeclaredMethod(Name.createMemoryManager, Signature.MemoryManagerMXBean_String); + sun_management_ManagementFactory_createMemoryManager = sun_management_ManagementFactory.requireDeclaredMethod(Names.createMemoryManager, Signatures.MemoryManagerMXBean_String); // GarbageCollectorMXBean createGarbageCollector(String var0, String var1) - sun_management_ManagementFactory_createGarbageCollector = sun_management_ManagementFactory.requireDeclaredMethod(Name.createGarbageCollector, - Signature.GarbageCollectorMXBean_String_String); + sun_management_ManagementFactory_createGarbageCollector = sun_management_ManagementFactory.requireDeclaredMethod(Names.createGarbageCollector, + Signatures.GarbageCollectorMXBean_String_String); } else { // MemoryPoolMXBean createMemoryPool(String var0, boolean var1, long var2, long var4) sun_management_ManagementFactory_createMemoryPool = null; @@ -1237,20 +1240,20 @@ public void postSystemInit() { } // used for class redefinition - java_lang_reflect_Proxy = knownKlass(Type.java_lang_reflect_Proxy); + java_lang_reflect_Proxy = knownKlass(Types.java_lang_reflect_Proxy); // java.beans package only available if java.desktop module is present on JDK9+ - java_beans_ThreadGroupContext = loadKlassWithBootClassLoader(Type.java_beans_ThreadGroupContext); - java_beans_Introspector = loadKlassWithBootClassLoader(Type.java_beans_Introspector); + java_beans_ThreadGroupContext = loadKlassWithBootClassLoader(Types.java_beans_ThreadGroupContext); + java_beans_Introspector = loadKlassWithBootClassLoader(Types.java_beans_Introspector); - java_beans_ThreadGroupContext_init = java_beans_ThreadGroupContext != null ? java_beans_ThreadGroupContext.requireDeclaredMethod(Name._init_, Signature._void) : null; - java_beans_ThreadGroupContext_removeBeanInfo = java_beans_ThreadGroupContext != null ? java_beans_ThreadGroupContext.requireDeclaredMethod(Name.removeBeanInfo, Signature._void_Class) : null; - java_beans_Introspector_flushFromCaches = java_beans_Introspector != null ? java_beans_Introspector.requireDeclaredMethod(Name.flushFromCaches, Signature._void_Class) : null; + java_beans_ThreadGroupContext_init = java_beans_ThreadGroupContext != null ? java_beans_ThreadGroupContext.requireDeclaredMethod(Names._init_, Signatures._void) : null; + java_beans_ThreadGroupContext_removeBeanInfo = java_beans_ThreadGroupContext != null ? java_beans_ThreadGroupContext.requireDeclaredMethod(Names.removeBeanInfo, Signatures._void_Class) : null; + java_beans_Introspector_flushFromCaches = java_beans_Introspector != null ? java_beans_Introspector.requireDeclaredMethod(Names.flushFromCaches, Signatures._void_Class) : null; // sun.misc.Proxygenerator -> java.lang.reflect.Proxygenerator in JDK 9 if (getJavaVersion().java8OrEarlier()) { - sun_misc_ProxyGenerator = knownKlass(Type.sun_misc_ProxyGenerator); - sun_misc_ProxyGenerator_generateProxyClass = sun_misc_ProxyGenerator.lookupDeclaredMethod(Name.generateProxyClass, Signature._byte_array_String_Class_array_int); + sun_misc_ProxyGenerator = knownKlass(Types.sun_misc_ProxyGenerator); + sun_misc_ProxyGenerator_generateProxyClass = sun_misc_ProxyGenerator.lookupDeclaredMethod(Names.generateProxyClass, Signatures._byte_array_String_Class_array_int); java_lang_reflect_ProxyGenerator = null; java_lang_reflect_ProxyGenerator_generateProxyClass = null; @@ -1258,10 +1261,10 @@ public void postSystemInit() { sun_misc_ProxyGenerator = null; sun_misc_ProxyGenerator_generateProxyClass = null; - java_lang_reflect_ProxyGenerator = knownKlass(Type.java_lang_reflect_ProxyGenerator); + java_lang_reflect_ProxyGenerator = knownKlass(Types.java_lang_reflect_ProxyGenerator); java_lang_reflect_ProxyGenerator_generateProxyClass = diff() // - .method(lower(13), Name.generateProxyClass, Signature._byte_array_String_Class_array_int) // - .method(higher(14), Name.generateProxyClass, Signature._byte_array_ClassLoader_String_List_int) // + .method(lower(13), Names.generateProxyClass, Signatures._byte_array_String_Class_array_int) // + .method(higher(14), Names.generateProxyClass, Signatures._byte_array_ClassLoader_String_List_int) // .notRequiredMethod(java_lang_reflect_ProxyGenerator); } @@ -2019,27 +2022,27 @@ public final class ContinuumSupport { public final ObjectKlass org_graalvm_continuations_IllegalContinuationStateException; private ContinuumSupport() { - ObjectKlass org_graalvm_continuations_ContinuationImpl = knownKlass(Type.org_graalvm_continuations_ContinuationImpl); - org_graalvm_continuations_ContinuationImpl_run = org_graalvm_continuations_ContinuationImpl.requireDeclaredMethod(Name.run, Signature._void); - org_graalvm_continuations_ContinuationImpl_suspend = org_graalvm_continuations_ContinuationImpl.requireDeclaredMethod(Name.suspend, Signature._void); - org_graalvm_continuations_ContinuationImpl_stackFrameHead = org_graalvm_continuations_ContinuationImpl.requireDeclaredField(Name.stackFrameHead, - Type.org_graalvm_continuations_ContinuationImpl_FrameRecord); - HIDDEN_CONTINUATION_FRAME_RECORD = org_graalvm_continuations_ContinuationImpl.requireHiddenField(Name.HIDDEN_CONTINUATION_FRAME_RECORD); - org_graalvm_continuations_ContinuationImpl_FrameRecord = knownKlass(Type.org_graalvm_continuations_ContinuationImpl_FrameRecord); + ObjectKlass org_graalvm_continuations_ContinuationImpl = knownKlass(Types.org_graalvm_continuations_ContinuationImpl); + org_graalvm_continuations_ContinuationImpl_run = org_graalvm_continuations_ContinuationImpl.requireDeclaredMethod(Names.run, Signatures._void); + org_graalvm_continuations_ContinuationImpl_suspend = org_graalvm_continuations_ContinuationImpl.requireDeclaredMethod(Names.suspend, Signatures._void); + org_graalvm_continuations_ContinuationImpl_stackFrameHead = org_graalvm_continuations_ContinuationImpl.requireDeclaredField(Names.stackFrameHead, + Types.org_graalvm_continuations_ContinuationImpl_FrameRecord); + HIDDEN_CONTINUATION_FRAME_RECORD = org_graalvm_continuations_ContinuationImpl.requireHiddenField(Names.HIDDEN_CONTINUATION_FRAME_RECORD); + org_graalvm_continuations_ContinuationImpl_FrameRecord = knownKlass(Types.org_graalvm_continuations_ContinuationImpl_FrameRecord); org_graalvm_continuations_ContinuationImpl_FrameRecord_pointers = org_graalvm_continuations_ContinuationImpl_FrameRecord.requireDeclaredField( - Name.pointers, Type.java_lang_Object_array); + Names.pointers, Types.java_lang_Object_array); org_graalvm_continuations_ContinuationImpl_FrameRecord_primitives = org_graalvm_continuations_ContinuationImpl_FrameRecord.requireDeclaredField( - Name.primitives, Type._long_array); + Names.primitives, Types._long_array); org_graalvm_continuations_ContinuationImpl_FrameRecord_method = org_graalvm_continuations_ContinuationImpl_FrameRecord.requireDeclaredField( - Name.method, Type.java_lang_reflect_Method); + Names.method, Types.java_lang_reflect_Method); org_graalvm_continuations_ContinuationImpl_FrameRecord_next = org_graalvm_continuations_ContinuationImpl_FrameRecord.requireDeclaredField( - Name.next, Type.org_graalvm_continuations_ContinuationImpl_FrameRecord); + Names.next, Types.org_graalvm_continuations_ContinuationImpl_FrameRecord); org_graalvm_continuations_ContinuationImpl_FrameRecord_bci = org_graalvm_continuations_ContinuationImpl_FrameRecord.requireDeclaredField( - Name.bci, Type._int); + Names.bci, Types._int); org_graalvm_continuations_IllegalMaterializedRecordException = knownKlass( - Type.org_graalvm_continuations_IllegalMaterializedRecordException); + Types.org_graalvm_continuations_IllegalMaterializedRecordException); org_graalvm_continuations_IllegalContinuationStateException = knownKlass( - Type.org_graalvm_continuations_IllegalContinuationStateException); + Types.org_graalvm_continuations_IllegalContinuationStateException); } } @@ -2108,74 +2111,74 @@ private PolyglotSupport() { // polyglot.jar is either on boot class path (JDK 8) // or defined by a platform module (JDK 11+) if (getJavaVersion().java8OrEarlier()) { - EspressoError.guarantee(loadKlassWithBootClassLoader(Type.com_oracle_truffle_espresso_polyglot_Polyglot) != null, + EspressoError.guarantee(loadKlassWithBootClassLoader(Types.com_oracle_truffle_espresso_polyglot_Polyglot) != null, "polyglot.jar (Polyglot API) is not accessible"); } else { - EspressoError.guarantee(loadKlassOrNull(Type.com_oracle_truffle_espresso_polyglot_Polyglot, getPlatformClassLoader()) != null, + EspressoError.guarantee(loadKlassOrNull(Types.com_oracle_truffle_espresso_polyglot_Polyglot, getPlatformClassLoader()) != null, "polyglot.jar (Polyglot API) is not accessible"); } - ArityException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_ArityException); - ArityException_create_int_int_int = ArityException.requireDeclaredMethod(Name.create, Signature.ArityException_int_int_int); - ArityException_create_int_int_int_Throwable = ArityException.requireDeclaredMethod(Name.create, Signature.ArityException_int_int_int_Throwable); + ArityException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_ArityException); + ArityException_create_int_int_int = ArityException.requireDeclaredMethod(Names.create, Signatures.ArityException_int_int_int); + ArityException_create_int_int_int_Throwable = ArityException.requireDeclaredMethod(Names.create, Signatures.ArityException_int_int_int_Throwable); - UnknownIdentifierException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException); - UnknownIdentifierException_create_String = UnknownIdentifierException.requireDeclaredMethod(Name.create, Signature.UnknownIdentifierException_String); - UnknownIdentifierException_create_String_Throwable = UnknownIdentifierException.requireDeclaredMethod(Name.create, Signature.UnknownIdentifierException_String_Throwable); + UnknownIdentifierException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_UnknownIdentifierException); + UnknownIdentifierException_create_String = UnknownIdentifierException.requireDeclaredMethod(Names.create, Signatures.UnknownIdentifierException_String); + UnknownIdentifierException_create_String_Throwable = UnknownIdentifierException.requireDeclaredMethod(Names.create, Signatures.UnknownIdentifierException_String_Throwable); - UnsupportedMessageException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException); - UnsupportedMessageException_create = UnsupportedMessageException.requireDeclaredMethod(Name.create, Signature.UnsupportedMessageException); - UnsupportedMessageException_create_Throwable = UnsupportedMessageException.requireDeclaredMethod(Name.create, Signature.UnsupportedMessageException_Throwable); + UnsupportedMessageException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_UnsupportedMessageException); + UnsupportedMessageException_create = UnsupportedMessageException.requireDeclaredMethod(Names.create, Signatures.UnsupportedMessageException); + UnsupportedMessageException_create_Throwable = UnsupportedMessageException.requireDeclaredMethod(Names.create, Signatures.UnsupportedMessageException_Throwable); - UnsupportedTypeException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException); - UnsupportedTypeException_create_Object_array_String = UnsupportedTypeException.requireDeclaredMethod(Name.create, Signature.UnsupportedTypeException_Object_array_String); - UnsupportedTypeException_create_Object_array_String_Throwable = UnsupportedTypeException.requireDeclaredMethod(Name.create, - Signature.UnsupportedTypeException_Object_array_String_Throwable); + UnsupportedTypeException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_UnsupportedTypeException); + UnsupportedTypeException_create_Object_array_String = UnsupportedTypeException.requireDeclaredMethod(Names.create, Signatures.UnsupportedTypeException_Object_array_String); + UnsupportedTypeException_create_Object_array_String_Throwable = UnsupportedTypeException.requireDeclaredMethod(Names.create, + Signatures.UnsupportedTypeException_Object_array_String_Throwable); - InvalidArrayIndexException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException); - InvalidArrayIndexException_create_long = InvalidArrayIndexException.requireDeclaredMethod(Name.create, Signature.InvalidArrayIndexException_long); - InvalidArrayIndexException_create_long_Throwable = InvalidArrayIndexException.requireDeclaredMethod(Name.create, Signature.InvalidArrayIndexException_long_Throwable); + InvalidArrayIndexException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_InvalidArrayIndexException); + InvalidArrayIndexException_create_long = InvalidArrayIndexException.requireDeclaredMethod(Names.create, Signatures.InvalidArrayIndexException_long); + InvalidArrayIndexException_create_long_Throwable = InvalidArrayIndexException.requireDeclaredMethod(Names.create, Signatures.InvalidArrayIndexException_long_Throwable); - InvalidBufferOffsetException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException); - InvalidBufferOffsetException_create_long_long = InvalidBufferOffsetException.requireDeclaredMethod(Name.create, Signature.InvalidBufferOffsetException_long_long); - InvalidBufferOffsetException_create_long_long_Throwable = InvalidBufferOffsetException.requireDeclaredMethod(Name.create, Signature.InvalidBufferOffsetException_long_long_Throwable); + InvalidBufferOffsetException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_InvalidBufferOffsetException); + InvalidBufferOffsetException_create_long_long = InvalidBufferOffsetException.requireDeclaredMethod(Names.create, Signatures.InvalidBufferOffsetException_long_long); + InvalidBufferOffsetException_create_long_long_Throwable = InvalidBufferOffsetException.requireDeclaredMethod(Names.create, Signatures.InvalidBufferOffsetException_long_long_Throwable); - StopIterationException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_StopIterationException); - StopIterationException_create = StopIterationException.requireDeclaredMethod(Name.create, Signature.StopIterationException); - StopIterationException_create_Throwable = StopIterationException.requireDeclaredMethod(Name.create, Signature.StopIterationException_Throwable); + StopIterationException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_StopIterationException); + StopIterationException_create = StopIterationException.requireDeclaredMethod(Names.create, Signatures.StopIterationException); + StopIterationException_create_Throwable = StopIterationException.requireDeclaredMethod(Names.create, Signatures.StopIterationException_Throwable); - UnknownKeyException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_UnknownKeyException); - UnknownKeyException_create_Object = UnknownKeyException.requireDeclaredMethod(Name.create, Signature.UnknownKeyException_Object); - UnknownKeyException_create_Object_Throwable = UnknownKeyException.requireDeclaredMethod(Name.create, Signature.UnknownKeyException_Object_Throwable); + UnknownKeyException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_UnknownKeyException); + UnknownKeyException_create_Object = UnknownKeyException.requireDeclaredMethod(Names.create, Signatures.UnknownKeyException_Object); + UnknownKeyException_create_Object_Throwable = UnknownKeyException.requireDeclaredMethod(Names.create, Signatures.UnknownKeyException_Object_Throwable); - ForeignException = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_ForeignException); - ExceptionType = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_ExceptionType); + ForeignException = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_ForeignException); + ExceptionType = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_ExceptionType); - ExceptionType_EXIT = ExceptionType.requireDeclaredField(Name.EXIT, - Type.com_oracle_truffle_espresso_polyglot_ExceptionType); - ExceptionType_INTERRUPT = ExceptionType.requireDeclaredField(Name.INTERRUPT, - Type.com_oracle_truffle_espresso_polyglot_ExceptionType); - ExceptionType_RUNTIME_ERROR = ExceptionType.requireDeclaredField(Name.RUNTIME_ERROR, - Type.com_oracle_truffle_espresso_polyglot_ExceptionType); - ExceptionType_PARSE_ERROR = ExceptionType.requireDeclaredField(Name.PARSE_ERROR, - Type.com_oracle_truffle_espresso_polyglot_ExceptionType); + ExceptionType_EXIT = ExceptionType.requireDeclaredField(Names.EXIT, + Types.com_oracle_truffle_espresso_polyglot_ExceptionType); + ExceptionType_INTERRUPT = ExceptionType.requireDeclaredField(Names.INTERRUPT, + Types.com_oracle_truffle_espresso_polyglot_ExceptionType); + ExceptionType_RUNTIME_ERROR = ExceptionType.requireDeclaredField(Names.RUNTIME_ERROR, + Types.com_oracle_truffle_espresso_polyglot_ExceptionType); + ExceptionType_PARSE_ERROR = ExceptionType.requireDeclaredField(Names.PARSE_ERROR, + Types.com_oracle_truffle_espresso_polyglot_ExceptionType); - TypeLiteral = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_TypeLiteral); - TypeLiteral_rawType = TypeLiteral.requireDeclaredField(Name.rawType, Type.java_lang_Class); - HIDDEN_TypeLiteral_internalType = TypeLiteral.requireHiddenField(Name.HIDDEN_INTERNAL_TYPE); - TypeLiteral$InternalTypeLiteral = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_TypeLiteral$InternalTypeLiteral); + TypeLiteral = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_TypeLiteral); + TypeLiteral_rawType = TypeLiteral.requireDeclaredField(Names.rawType, Types.java_lang_Class); + HIDDEN_TypeLiteral_internalType = TypeLiteral.requireHiddenField(Names.HIDDEN_INTERNAL_TYPE); + TypeLiteral$InternalTypeLiteral = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_TypeLiteral$InternalTypeLiteral); - VMHelper = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_VMHelper); - VMHelper_getDynamicModuleDescriptor = VMHelper.requireDeclaredMethod(Name.getDynamicModuleDescriptor, Signature.ModuleDescriptor_String_String); + VMHelper = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_VMHelper); + VMHelper_getDynamicModuleDescriptor = VMHelper.requireDeclaredMethod(Names.getDynamicModuleDescriptor, Signatures.ModuleDescriptor_String_String); - EspressoForeignList = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignList); - EspressoForeignCollection = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignCollection); - EspressoForeignIterable = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterable); - EspressoForeignIterator = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterator); - EspressoForeignMap = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignMap); - EspressoForeignSet = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignSet); + EspressoForeignList = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignList); + EspressoForeignCollection = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignCollection); + EspressoForeignIterable = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterable); + EspressoForeignIterator = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignIterator); + EspressoForeignMap = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignMap); + EspressoForeignSet = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_collections_EspressoForeignSet); - EspressoForeignNumber = knownPlatformKlass(Type.com_oracle_truffle_espresso_polyglot_impl_EspressoForeignNumber); + EspressoForeignNumber = knownPlatformKlass(Types.com_oracle_truffle_espresso_polyglot_impl_EspressoForeignNumber); } } @@ -2264,87 +2267,87 @@ public final class JVMCISupport { private JVMCISupport() { // JVMCI - EspressoJVMCIRuntime = knownKlass(Type.com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime); - EspressoJVMCIRuntime_runtime = EspressoJVMCIRuntime.requireDeclaredMethod(Name.runtime, Signature.EspressoJVMCIRuntime); + EspressoJVMCIRuntime = knownKlass(Types.com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime); + EspressoJVMCIRuntime_runtime = EspressoJVMCIRuntime.requireDeclaredMethod(Names.runtime, Signatures.EspressoJVMCIRuntime); - EspressoResolvedInstanceType = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); - EspressoResolvedInstanceType_init = EspressoResolvedInstanceType.requireDeclaredMethod(Name._init_, Signature._void); - HIDDEN_OBJECTKLASS_MIRROR = EspressoResolvedInstanceType.requireHiddenField(Name.HIDDEN_OBJECTKLASS_MIRROR); + EspressoResolvedInstanceType = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); + EspressoResolvedInstanceType_init = EspressoResolvedInstanceType.requireDeclaredMethod(Names._init_, Signatures._void); + HIDDEN_OBJECTKLASS_MIRROR = EspressoResolvedInstanceType.requireHiddenField(Names.HIDDEN_OBJECTKLASS_MIRROR); - EspressoResolvedJavaField = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField); - EspressoResolvedJavaField_init = EspressoResolvedJavaField.requireDeclaredMethod(Name._init_, Signature._void_EspressoResolvedInstanceType); - HIDDEN_FIELD_MIRROR = EspressoResolvedJavaField.requireHiddenField(Name.HIDDEN_FIELD_MIRROR); + EspressoResolvedJavaField = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField); + EspressoResolvedJavaField_init = EspressoResolvedJavaField.requireDeclaredMethod(Names._init_, Signatures._void_EspressoResolvedInstanceType); + HIDDEN_FIELD_MIRROR = EspressoResolvedJavaField.requireHiddenField(Names.HIDDEN_FIELD_MIRROR); - EspressoResolvedJavaMethod = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod); - EspressoResolvedJavaMethod_init = EspressoResolvedJavaMethod.requireDeclaredMethod(Name._init_, Signature._void_EspressoResolvedInstanceType); - HIDDEN_METHOD_MIRROR = EspressoResolvedJavaMethod.requireHiddenField(Name.HIDDEN_METHOD_MIRROR); - EspressoResolvedJavaMethod_holder = EspressoResolvedJavaMethod.requireDeclaredField(Name.holder, Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); + EspressoResolvedJavaMethod = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod); + EspressoResolvedJavaMethod_init = EspressoResolvedJavaMethod.requireDeclaredMethod(Names._init_, Signatures._void_EspressoResolvedInstanceType); + HIDDEN_METHOD_MIRROR = EspressoResolvedJavaMethod.requireHiddenField(Names.HIDDEN_METHOD_MIRROR); + EspressoResolvedJavaMethod_holder = EspressoResolvedJavaMethod.requireDeclaredField(Names.holder, Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); - EspressoResolvedArrayType = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedArrayType); - EspressoResolvedArrayType_init = EspressoResolvedArrayType.requireDeclaredMethod(Name._init_, Signature._void_EspressoResolvedJavaType_int_Class); + EspressoResolvedArrayType = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedArrayType); + EspressoResolvedArrayType_init = EspressoResolvedArrayType.requireDeclaredMethod(Names._init_, Signatures._void_EspressoResolvedJavaType_int_Class); - EspressoResolvedPrimitiveType = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType); - EspressoResolvedPrimitiveType_forBasicType = EspressoResolvedPrimitiveType.requireDeclaredMethod(Name.forBasicType, Signature.EspressoResolvedPrimitiveType_int); + EspressoResolvedPrimitiveType = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedPrimitiveType); + EspressoResolvedPrimitiveType_forBasicType = EspressoResolvedPrimitiveType.requireDeclaredMethod(Names.forBasicType, Signatures.EspressoResolvedPrimitiveType_int); - EspressoConstantPool = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool); - EspressoConstantPool_holder = EspressoConstantPool.requireDeclaredField(Name.holder, Type.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); + EspressoConstantPool = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool); + EspressoConstantPool_holder = EspressoConstantPool.requireDeclaredField(Names.holder, Types.com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType); - EspressoObjectConstant = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant); - EspressoObjectConstant_init = EspressoObjectConstant.requireDeclaredMethod(Name._init_, Signature._void); - HIDDEN_OBJECT_CONSTANT = EspressoObjectConstant.requireHiddenField(Name.HIDDEN_OBJECT_CONSTANT); + EspressoObjectConstant = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoObjectConstant); + EspressoObjectConstant_init = EspressoObjectConstant.requireDeclaredMethod(Names._init_, Signatures._void); + HIDDEN_OBJECT_CONSTANT = EspressoObjectConstant.requireHiddenField(Names.HIDDEN_OBJECT_CONSTANT); - EspressoBootstrapMethodInvocation = knownKlass(Type.com_oracle_truffle_espresso_jvmci_meta_EspressoBootstrapMethodInvocation); - EspressoBootstrapMethodInvocation_init = EspressoBootstrapMethodInvocation.requireDeclaredMethod(Name._init_, - Signature._void_boolean_EspressoResolvedJavaMethod_String_JavaConstant_JavaConstant_array); + EspressoBootstrapMethodInvocation = knownKlass(Types.com_oracle_truffle_espresso_jvmci_meta_EspressoBootstrapMethodInvocation); + EspressoBootstrapMethodInvocation_init = EspressoBootstrapMethodInvocation.requireDeclaredMethod(Names._init_, + Signatures._void_boolean_EspressoResolvedJavaMethod_String_JavaConstant_JavaConstant_array); - Services = knownKlass(Type.jdk_vm_ci_services_Services); - Services_openJVMCITo = Services.requireDeclaredMethod(Name.openJVMCITo, Signature._void_Module); + Services = knownKlass(Types.jdk_vm_ci_services_Services); + Services_openJVMCITo = Services.requireDeclaredMethod(Names.openJVMCITo, Signatures._void_Module); - UnresolvedJavaType = knownKlass(Type.jdk_vm_ci_meta_UnresolvedJavaType); - UnresolvedJavaType_init = UnresolvedJavaType.requireDeclaredMethod(Name._init_, Signature._void_String); - UnresolvedJavaType_name = UnresolvedJavaType.requireDeclaredField(Name.name, Type.java_lang_String); + UnresolvedJavaType = knownKlass(Types.jdk_vm_ci_meta_UnresolvedJavaType); + UnresolvedJavaType_init = UnresolvedJavaType.requireDeclaredMethod(Names._init_, Signatures._void_String); + UnresolvedJavaType_name = UnresolvedJavaType.requireDeclaredField(Names.name, Types.java_lang_String); - UnresolvedJavaField = knownKlass(Type.jdk_vm_ci_meta_UnresolvedJavaField); - UnresolvedJavaField_init = UnresolvedJavaField.requireDeclaredMethod(Name._init_, Signature._void_JavaType_String_JavaType); + UnresolvedJavaField = knownKlass(Types.jdk_vm_ci_meta_UnresolvedJavaField); + UnresolvedJavaField_init = UnresolvedJavaField.requireDeclaredMethod(Names._init_, Signatures._void_JavaType_String_JavaType); - LineNumberTable = knownKlass(Type.jdk_vm_ci_meta_LineNumberTable); - LineNumberTable_init = LineNumberTable.requireDeclaredMethod(Name._init_, Signature._void_int_array_int_array); + LineNumberTable = knownKlass(Types.jdk_vm_ci_meta_LineNumberTable); + LineNumberTable_init = LineNumberTable.requireDeclaredMethod(Names._init_, Signatures._void_int_array_int_array); - LocalVariableTable = knownKlass(Type.jdk_vm_ci_meta_LocalVariableTable); - LocalVariableTable_init = LocalVariableTable.requireDeclaredMethod(Name._init_, Signature._void_Local_array); + LocalVariableTable = knownKlass(Types.jdk_vm_ci_meta_LocalVariableTable); + LocalVariableTable_init = LocalVariableTable.requireDeclaredMethod(Names._init_, Signatures._void_Local_array); - Local = knownKlass(Type.jdk_vm_ci_meta_Local); - Local_init = Local.requireDeclaredMethod(Name._init_, Signature._void_String_JavaType_int_int_int); + Local = knownKlass(Types.jdk_vm_ci_meta_Local); + Local_init = Local.requireDeclaredMethod(Names._init_, Signatures._void_String_JavaType_int_int_int); - ExceptionHandler = knownKlass(Type.jdk_vm_ci_meta_ExceptionHandler); - ExceptionHandler_init = ExceptionHandler.requireDeclaredMethod(Name._init_, Signature._void_int_int_int_int_JavaType); + ExceptionHandler = knownKlass(Types.jdk_vm_ci_meta_ExceptionHandler); + ExceptionHandler_init = ExceptionHandler.requireDeclaredMethod(Names._init_, Signatures._void_int_int_int_int_JavaType); - JavaConstant = knownKlass(Type.jdk_vm_ci_meta_JavaConstant); - JavaConstant_NULL_POINTER = JavaConstant.requireDeclaredField(Name.NULL_POINTER, Type.jdk_vm_ci_meta_JavaConstant); - JavaConstant_ILLEGAL = JavaConstant.requireDeclaredField(Name.ILLEGAL, Type.jdk_vm_ci_meta_PrimitiveConstant); - JavaConstant_forInt = JavaConstant.requireDeclaredMethod(Name.forInt, Signature.PrimitiveConstant_int); - JavaConstant_forLong = JavaConstant.requireDeclaredMethod(Name.forLong, Signature.PrimitiveConstant_long); - JavaConstant_forFloat = JavaConstant.requireDeclaredMethod(Name.forFloat, Signature.PrimitiveConstant_float); - JavaConstant_forDouble = JavaConstant.requireDeclaredMethod(Name.forDouble, Signature.PrimitiveConstant_double); - JavaConstant_forPrimitive = JavaConstant.requireDeclaredMethod(Name.forPrimitive, Signature.PrimitiveConstant_char_long); + JavaConstant = knownKlass(Types.jdk_vm_ci_meta_JavaConstant); + JavaConstant_NULL_POINTER = JavaConstant.requireDeclaredField(Names.NULL_POINTER, Types.jdk_vm_ci_meta_JavaConstant); + JavaConstant_ILLEGAL = JavaConstant.requireDeclaredField(Names.ILLEGAL, Types.jdk_vm_ci_meta_PrimitiveConstant); + JavaConstant_forInt = JavaConstant.requireDeclaredMethod(Names.forInt, Signatures.PrimitiveConstant_int); + JavaConstant_forLong = JavaConstant.requireDeclaredMethod(Names.forLong, Signatures.PrimitiveConstant_long); + JavaConstant_forFloat = JavaConstant.requireDeclaredMethod(Names.forFloat, Signatures.PrimitiveConstant_float); + JavaConstant_forDouble = JavaConstant.requireDeclaredMethod(Names.forDouble, Signatures.PrimitiveConstant_double); + JavaConstant_forPrimitive = JavaConstant.requireDeclaredMethod(Names.forPrimitive, Signatures.PrimitiveConstant_char_long); - ObjectKlass IntrinsicMethod = knownKlass(Type.jdk_vm_ci_meta_MethodHandleAccessProvider$IntrinsicMethod); - IntrinsicMethod_INVOKE_BASIC = IntrinsicMethod.requireEnumConstant(Name.INVOKE_BASIC); - IntrinsicMethod_LINK_TO_VIRTUAL = IntrinsicMethod.requireEnumConstant(Name.LINK_TO_VIRTUAL); - IntrinsicMethod_LINK_TO_STATIC = IntrinsicMethod.requireEnumConstant(Name.LINK_TO_STATIC); - IntrinsicMethod_LINK_TO_SPECIAL = IntrinsicMethod.requireEnumConstant(Name.LINK_TO_SPECIAL); - IntrinsicMethod_LINK_TO_INTERFACE = IntrinsicMethod.requireEnumConstant(Name.LINK_TO_INTERFACE); - IntrinsicMethod_LINK_TO_NATIVE = IntrinsicMethod.lookupEnumConstant(Name.LINK_TO_NATIVE); + ObjectKlass IntrinsicMethod = knownKlass(Types.jdk_vm_ci_meta_MethodHandleAccessProvider$IntrinsicMethod); + IntrinsicMethod_INVOKE_BASIC = IntrinsicMethod.requireEnumConstant(Names.INVOKE_BASIC); + IntrinsicMethod_LINK_TO_VIRTUAL = IntrinsicMethod.requireEnumConstant(Names.LINK_TO_VIRTUAL); + IntrinsicMethod_LINK_TO_STATIC = IntrinsicMethod.requireEnumConstant(Names.LINK_TO_STATIC); + IntrinsicMethod_LINK_TO_SPECIAL = IntrinsicMethod.requireEnumConstant(Names.LINK_TO_SPECIAL); + IntrinsicMethod_LINK_TO_INTERFACE = IntrinsicMethod.requireEnumConstant(Names.LINK_TO_INTERFACE); + IntrinsicMethod_LINK_TO_NATIVE = IntrinsicMethod.lookupEnumConstant(Names.LINK_TO_NATIVE); // Compiler - DummyEspressoGraalJVMCICompiler = loadPlatformKlassOrNull(Type.jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler); + DummyEspressoGraalJVMCICompiler = loadPlatformKlassOrNull(Types.jdk_graal_compiler_espresso_DummyEspressoGraalJVMCICompiler); if (DummyEspressoGraalJVMCICompiler != null) { - DummyEspressoGraalJVMCICompiler_create = DummyEspressoGraalJVMCICompiler.requireDeclaredMethod(Name.create, Signature.DummyEspressoGraalJVMCICompiler_JVMCIRuntime); + DummyEspressoGraalJVMCICompiler_create = DummyEspressoGraalJVMCICompiler.requireDeclaredMethod(Names.create, Signatures.DummyEspressoGraalJVMCICompiler_JVMCIRuntime); } else { DummyEspressoGraalJVMCICompiler_create = null; } - GraalJVMCICompiler = loadPlatformKlassOrNull(Type.jdk_graal_compiler_api_runtime_GraalJVMCICompiler); + GraalJVMCICompiler = loadPlatformKlassOrNull(Types.jdk_graal_compiler_api_runtime_GraalJVMCICompiler); } public StaticObject boxInt(int value) { @@ -2610,8 +2613,8 @@ private ObjectKlass knownPlatformKlass(Symbol type) { private ObjectKlass knownKlass(Symbol type, StaticObject classLoader) { CompilerAsserts.neverPartOfCompilation(); - assert !Types.isArray(type); - assert !Types.isPrimitive(type); + assert !TypeSymbols.isArray(type); + assert !TypeSymbols.isPrimitive(type); try { ObjectKlass k = loadKlassOrNull(type, classLoader); if (k == null) { @@ -2751,12 +2754,12 @@ public Klass resolveSymbolOrNull(Symbol type, @JavaType(ClassLoader.class) if (k != null) { return k; } - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { Klass elemental = resolveSymbolOrNull(getTypes().getElementalType(type), classLoader, protectionDomain); if (elemental == null) { return null; } - return elemental.getArrayClass(Types.getArrayDimensions(type)); + return elemental.getArrayClass(TypeSymbols.getArrayDimensions(type)); } return loadKlassOrNull(type, classLoader, protectionDomain); } @@ -2886,7 +2889,7 @@ public Object toHostBoxed(Object object) { } public static boolean isSignaturePolymorphicHolderType(Symbol type) { - return type == Type.java_lang_invoke_MethodHandle || type == Type.java_lang_invoke_VarHandle; + return type == Types.java_lang_invoke_MethodHandle || type == Types.java_lang_invoke_VarHandle; } // region Guest Unboxing diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/AbstractInstrumentableBytecodeNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/AbstractInstrumentableBytecodeNode.java index 27f87c265420..e99cf99c7b91 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/AbstractInstrumentableBytecodeNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/AbstractInstrumentableBytecodeNode.java @@ -40,10 +40,11 @@ import com.oracle.truffle.espresso.EspressoScope; import com.oracle.truffle.espresso.classfile.attributes.Local; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.vm.continuation.UnwindContinuationException; @@ -109,7 +110,7 @@ private static Object getScopeSlowPath(MaterializedFrame frame, Method method, i if (hasReceiver) { // include 'this' and method arguments if not already included if (!slotToLocal.containsKey(startslot)) { - constructedLiveLocals.add(new Local(Name.thiz, method.getDeclaringKlass().getType(), null, 0, 0xffff, 0)); + constructedLiveLocals.add(new Local(Names.thiz, method.getDeclaringKlass().getType(), null, 0, 0xffff, 0)); } else { constructedLiveLocals.add(slotToLocal.get(startslot)); } @@ -119,7 +120,7 @@ private static Object getScopeSlowPath(MaterializedFrame frame, Method method, i Symbol[] parsedSignature = method.getParsedSignature(); // include method parameters if not already included for (int i = startslot; i < localCount; i++) { - Symbol paramType = hasReceiver ? Signatures.parameterType(parsedSignature, i - 1) : Signatures.parameterType(parsedSignature, i); + Symbol paramType = hasReceiver ? SignatureSymbols.parameterType(parsedSignature, i - 1) : SignatureSymbols.parameterType(parsedSignature, i); if (!slotToLocal.containsKey(i)) { Symbol localName = method.getLanguage().getNames().getOrCreate(ByteSequence.create("arg_" + i)); constructedLiveLocals.add(new Local(localName, paramType, null, 0, 0xffff, i)); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/BytecodeNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/BytecodeNode.java index 387989649bd9..9756a8648ec5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/BytecodeNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/BytecodeNode.java @@ -325,9 +325,9 @@ import com.oracle.truffle.espresso.classfile.constantpool.PoolConstant; import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.classfile.perf.DebugCounter; import com.oracle.truffle.espresso.constantpool.Resolution; import com.oracle.truffle.espresso.constantpool.ResolvedDynamicConstant; @@ -522,10 +522,10 @@ private void initArguments(VirtualFrame frame) { } Symbol[] methodSignature = getMethod().getParsedSignature(); - int argCount = Signatures.parameterCount(methodSignature); + int argCount = SignatureSymbols.parameterCount(methodSignature); CompilerAsserts.partialEvaluationConstant(argCount); for (int i = 0; i < argCount; ++i) { - Symbol argType = Signatures.parameterType(methodSignature, i); + Symbol argType = SignatureSymbols.parameterType(methodSignature, i); // @formatter:off switch (argType.byteAt(0)) { case 'Z' : setLocalInt(frame, curSlot, ((boolean) arguments[i + receiverSlot]) ? 1 : 0); break; @@ -1775,7 +1775,7 @@ private BaseQuickNode getBaseQuickNode(int curBCI, int top, int statementIndex, } private Object getReturnValueAsObject(VirtualFrame frame, int top) { - Symbol returnType = Signatures.returnType(getMethod().getParsedSignature()); + Symbol returnType = SignatureSymbols.returnType(getMethod().getParsedSignature()); // @formatter:off switch (returnType.byteAt(0)) { case 'Z' : return stackIntToBoolean(popInt(frame, top - 1)); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/EspressoFrame.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/EspressoFrame.java index da54b2b2afc0..7596439d9922 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/EspressoFrame.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/EspressoFrame.java @@ -30,10 +30,10 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.runtime.ReturnAddress; @@ -333,7 +333,7 @@ public static int startingStackOffset(int maxLocals) { public static StaticObject peekReceiver(VirtualFrame frame, int top, Method m) { assert !m.isStatic(); - int skipSlots = Signatures.slotsForParameters(m.getParsedSignature()); + int skipSlots = SignatureSymbols.slotsForParameters(m.getParsedSignature()); int slot = top - skipSlots - 1; assert slot >= 0; StaticObject result = peekObject(frame, slot); @@ -343,7 +343,7 @@ public static StaticObject peekReceiver(VirtualFrame frame, int top, Method m) { @ExplodeLoop public static Object[] popArguments(VirtualFrame frame, int top, boolean hasReceiver, final Symbol[] signature) { - int argCount = Signatures.parameterCount(signature); + int argCount = SignatureSymbols.parameterCount(signature); int extraParam = hasReceiver ? 1 : 0; final Object[] args = new Object[argCount + extraParam]; @@ -354,7 +354,7 @@ public static Object[] popArguments(VirtualFrame frame, int top, boolean hasRece int argAt = top - 1; for (int i = argCount - 1; i >= 0; --i) { - Symbol argType = Signatures.parameterType(signature, i); + Symbol argType = SignatureSymbols.parameterType(signature, i); // @formatter:off switch (argType.byteAt(0)) { case 'Z' : args[i + extraParam] = (popInt(frame, argAt) != 0); break; @@ -385,12 +385,12 @@ public static Object[] popArguments(VirtualFrame frame, int top, boolean hasRece @ExplodeLoop public static Object[] popBasicArgumentsWithArray(VirtualFrame frame, int top, final Symbol[] signature, boolean hasReceiver, Object[] args) { // Use basic types - CompilerAsserts.partialEvaluationConstant(Signatures.parameterCount(signature)); + CompilerAsserts.partialEvaluationConstant(SignatureSymbols.parameterCount(signature)); CompilerAsserts.partialEvaluationConstant(signature); int extraParam = hasReceiver ? 1 : 0; int argAt = top - 1; - for (int i = Signatures.parameterCount(signature) - 1; i >= 0; --i) { - Symbol argType = Signatures.parameterType(signature, i); + for (int i = SignatureSymbols.parameterCount(signature) - 1; i >= 0; --i) { + Symbol argType = SignatureSymbols.parameterType(signature, i); // @formatter:off switch (argType.byteAt(0)) { case 'Z' : // fall through @@ -504,7 +504,7 @@ public static int putType(VirtualFrame frame, int top, Object value, Symbol[] parsedSignature = getMethodVersion().getMethod().getParsedSignature(); - int paramCount = Signatures.parameterCount(parsedSignature); + int paramCount = SignatureSymbols.parameterCount(parsedSignature); Object[] nativeArgs = new Object[2 /* JNIEnv* + class or receiver */ + paramCount]; assert !InteropLibrary.getUncached().isNull(env.getNativePointer()); @@ -93,8 +94,8 @@ private Object[] preprocessArgs(JNIHandles handles, Object[] args) { int skipReceiver = getMethodVersion().isStatic() ? 0 : 1; for (int i = 0; i < paramCount; ++i) { - Symbol paramType = Signatures.parameterType(parsedSignature, i); - if (Types.isReference(paramType)) { + Symbol paramType = SignatureSymbols.parameterType(parsedSignature, i); + if (TypeSymbols.isReference(paramType)) { nativeArgs[i + 2] = toObjectHandle(handles, args[i + skipReceiver]); } else { nativeArgs[i + 2] = args[i + skipReceiver]; @@ -142,8 +143,8 @@ private void maybeThrowAndClearPendingException(EspressoLanguage language) { private Object processResult(JNIHandles handles, Object result) { // JNI exception handling. maybeThrowAndClearPendingException(EspressoLanguage.get(this)); - Symbol returnType = Signatures.returnType(getMethodVersion().getMethod().getParsedSignature()); - if (Types.isReference(returnType)) { + Symbol returnType = SignatureSymbols.returnType(getMethodVersion().getMethod().getParsedSignature()); + if (TypeSymbols.isReference(returnType)) { long addr; if (result instanceof Long) { addr = (Long) result; @@ -153,7 +154,7 @@ private Object processResult(JNIHandles handles, Object result) { } return handles.get(Math.toIntExact(addr)); } - assert !(returnType == Type._void) || result == StaticObject.NULL; + assert !(returnType == Types._void) || result == StaticObject.NULL; return result; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/SubstitutionScope.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/SubstitutionScope.java index a6ee9cb9043a..1078d738bd53 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/SubstitutionScope.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/SubstitutionScope.java @@ -34,7 +34,7 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.attributes.MethodParametersAttribute; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Method; @ExportLibrary(InteropLibrary.class) @@ -99,7 +99,7 @@ Object readMember(String member) throws UnknownIdentifierException { } private String[] fetchNames() { - MethodParametersAttribute methodParameters = (MethodParametersAttribute) method.getAttribute(Symbol.Name.MethodParameters); + MethodParametersAttribute methodParameters = (MethodParametersAttribute) method.getAttribute(Names.MethodParameters); if (methodParameters == null) { return new String[0]; @@ -122,7 +122,7 @@ private String[] fetchNames() { // For a 0 index, give an empty name. String name; if (entry.getNameIndex() != 0) { - name = method.getConstantPool().symbolAt(entry.getNameIndex(), "parameter name").toString(); + name = method.getConstantPool().symbolAtUnsafe(entry.getNameIndex(), "parameter name").toString(); } else { name = ""; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/commands/ReferenceProcessCache.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/commands/ReferenceProcessCache.java index f647b3bcab31..89fe21407cb7 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/commands/ReferenceProcessCache.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/commands/ReferenceProcessCache.java @@ -26,9 +26,12 @@ import java.util.List; import com.oracle.truffle.api.nodes.DirectCallNode; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -44,12 +47,12 @@ public final class ReferenceProcessCache extends EspressoNode { * (j.i.misc vs j.i.access). Since we cannot select a type according to the version, we try all * known names here. */ - private static final List> SHARED_SECRETS_TYPES = List.of(Type.jdk_internal_access_SharedSecrets, Type.sun_misc_SharedSecrets, - Type.jdk_internal_misc_SharedSecrets); - private static final List> JAVA_LANG_ACCESS_TYPES = List.of(Type.jdk_internal_access_JavaLangAccess, Type.sun_misc_JavaLangAccess, - Type.jdk_internal_misc_JavaLangAccess); - private static final List> RUN_FINALIZER_SIGNATURES = List.of(Signature._void_jdk_internal_access_JavaLangAccess, Signature._void_sun_misc_JavaLangAccess, - Signature._void_jdk_internal_misc_JavaLangAccess); + private static final List> SHARED_SECRETS_TYPES = List.of(Types.jdk_internal_access_SharedSecrets, Types.sun_misc_SharedSecrets, + Types.jdk_internal_misc_SharedSecrets); + private static final List> JAVA_LANG_ACCESS_TYPES = List.of(Types.jdk_internal_access_JavaLangAccess, Types.sun_misc_JavaLangAccess, + Types.jdk_internal_misc_JavaLangAccess); + private static final List> RUN_FINALIZER_SIGNATURES = List.of(Signatures._void_jdk_internal_access_JavaLangAccess, Signatures._void_sun_misc_JavaLangAccess, + Signatures._void_jdk_internal_misc_JavaLangAccess); private final EspressoContext context; private final DirectCallNode processPendingReferences; @@ -64,10 +67,10 @@ public ReferenceProcessCache(EspressoContext context) { Method processPendingReferenceMethod = findProcessPendingReferences(context); this.processPendingReferences = DirectCallNode.create(processPendingReferenceMethod.getCallTargetForceInit()); - Field queue = context.getMeta().java_lang_ref_Finalizer.lookupDeclaredField(Symbol.Name.queue, Type.java_lang_ref_ReferenceQueue); + Field queue = context.getMeta().java_lang_ref_Finalizer.lookupDeclaredField(Names.queue, Types.java_lang_ref_ReferenceQueue); this.finalizerQueue = queue.getObject(context.getMeta().java_lang_ref_Finalizer.tryInitializeAndGetStatics()); - Method poll = finalizerQueue.getKlass().lookupMethod(Symbol.Name.poll, Signature.Reference); + Method poll = finalizerQueue.getKlass().lookupMethod(Names.poll, Signatures.Reference); this.queuePoll = DirectCallNode.create(poll.getCallTargetForceInit()); Klass sharedSecrets = findSharedSecrets(context); @@ -126,7 +129,7 @@ private static Klass findSharedSecrets(EspressoContext context) { private static Field findJlaField(Klass sharedSecrets) { for (Symbol type : JAVA_LANG_ACCESS_TYPES) { - Field f = sharedSecrets.lookupField(Symbol.Name.javaLangAccess, type, Klass.LookupMode.STATIC_ONLY); + Field f = sharedSecrets.lookupField(Names.javaLangAccess, type, Klass.LookupMode.STATIC_ONLY); if (f != null) { return f; } @@ -136,7 +139,7 @@ private static Field findJlaField(Klass sharedSecrets) { private static Method findRunFinalizer(EspressoContext context) { for (Symbol signature : RUN_FINALIZER_SIGNATURES) { - Method m = context.getMeta().java_lang_ref_Finalizer.lookupMethod(Symbol.Name.runFinalizer, signature, Klass.LookupMode.INSTANCE_ONLY); + Method m = context.getMeta().java_lang_ref_Finalizer.lookupMethod(Names.runFinalizer, signature, Klass.LookupMode.INSTANCE_ONLY); if (m != null) { return m; } @@ -147,10 +150,10 @@ private static Method findRunFinalizer(EspressoContext context) { private static Method findProcessPendingReferences(EspressoContext context) { Method processPendingReferenceMethod; if (context.getJavaVersion().java8OrEarlier()) { - processPendingReferenceMethod = context.getMeta().java_lang_ref_Reference.lookupDeclaredMethod(Symbol.Name.tryHandlePending, Signature._boolean_boolean, + processPendingReferenceMethod = context.getMeta().java_lang_ref_Reference.lookupDeclaredMethod(Names.tryHandlePending, Signatures._boolean_boolean, Klass.LookupMode.STATIC_ONLY); } else { - processPendingReferenceMethod = context.getMeta().java_lang_ref_Reference.lookupDeclaredMethod(Symbol.Name.processPendingReferences, Signature._void, Klass.LookupMode.STATIC_ONLY); + processPendingReferenceMethod = context.getMeta().java_lang_ref_Reference.lookupDeclaredMethod(Names.processPendingReferences, Signatures._void, Klass.LookupMode.STATIC_ONLY); } if (processPendingReferenceMethod == null) { throw EspressoError.shouldNotReachHere("Could not find pending reference processing method."); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupFieldNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupFieldNode.java index 0d3de3ff8cd0..79b37cc0b8f4 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupFieldNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupFieldNode.java @@ -24,8 +24,8 @@ package com.oracle.truffle.espresso.nodes.interop; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.nodes.EspressoNode; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupNode.java index 709250d6c9a3..b6b02c5322ea 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/AbstractLookupNode.java @@ -31,9 +31,9 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.interop.ArityException; import com.oracle.truffle.api.interop.UnknownIdentifierException; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.nodes.EspressoNode; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/EspressoForeignProxyGenerator.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/EspressoForeignProxyGenerator.java index 56aaf03a9bfa..4dcd2108e614 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/EspressoForeignProxyGenerator.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/EspressoForeignProxyGenerator.java @@ -69,6 +69,8 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.JavaKind; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.ClassRegistry; @@ -133,7 +135,7 @@ public final class EspressoForeignProxyGenerator extends ClassWriter { */ private final Map> proxyMethods = new HashMap<>(); - private final Map, EspressoType> staticGenericReturnTypes = new HashMap<>(); + private final Map, EspressoType> staticGenericReturnTypes = new HashMap<>(); private final Map typeVariableGenericReturnTypes = new HashMap<>(); private final Map genericClassTypes; private int nextGenericIndex; @@ -197,11 +199,11 @@ public static class GeneratedProxyBytes { public final byte[] bytes; public final String name; private final ObjectKlass superklass; - private final Map, EspressoType> staticGenericReturnTypes; + private final Map, EspressoType> staticGenericReturnTypes; private final EspressoType[] genericTypeArray; private final Map typeVariableIdentifiers; - GeneratedProxyBytes(byte[] bytes, String name, ObjectKlass superKlass, Map, EspressoType> staticGenericReturnTypes, + GeneratedProxyBytes(byte[] bytes, String name, ObjectKlass superKlass, Map, EspressoType> staticGenericReturnTypes, EspressoType[] genericTypeArray, Map typeVariableIdentifiers) { this.bytes = bytes; this.name = name; @@ -219,7 +221,7 @@ public ObjectKlass getSuperklass() { return superklass; } - public Map, EspressoType> getStaticGenericReturnTypes() { + public Map, EspressoType> getStaticGenericReturnTypes() { return staticGenericReturnTypes; } } @@ -243,7 +245,7 @@ public static GeneratedProxyBytes getProxyKlassBytes(String metaName, ObjectKlas } } - private Map, EspressoType> getStaticGenericReturnTypes() { + private Map, EspressoType> getStaticGenericReturnTypes() { return staticGenericReturnTypes; } @@ -632,7 +634,7 @@ private void addProxyMethod(Method m, boolean isSuperKlassMethod) { Klass[] parameterTypes = m.resolveParameterKlasses(); EspressoType returnType = m.getGenericReturnType(); ObjectKlass[] exceptionTypes = m.getCheckedExceptions(); - Symbol signature = m.getRawSignature(); + Symbol signature = m.getRawSignature(); String sig = name + getParameterDescriptors(parameterTypes); List sigmethods = proxyMethods.get(sig); @@ -687,7 +689,7 @@ private int registerGenericReturnTypeForMethod(Method m) { private String registerStaticGenericReturnTypeForMethod(Method m) { String fieldName = GENERIC_TYPE_FIELD_PREFIX + nextStaticGenericTypeIndex(); - Symbol name = m.getContext().getNames().getOrCreate(fieldName); + Symbol name = m.getContext().getNames().getOrCreate(fieldName); staticGenericReturnTypes.put(name, m.getGenericReturnType()); visitField(ACC_PUBLIC | ACC_STATIC | ACC_FINAL, fieldName, TYPE_LITERAL_TYPE, null, null); return fieldName; @@ -828,13 +830,13 @@ private final class ProxyMethod { public EspressoType returnType; public Klass[] exceptionTypes; boolean isVarArgs; - Symbol signature; + Symbol signature; int typeLiteralIndex; String resolvedGenericTypeField; boolean isOptimizedMethod; private ProxyMethod(String methodName, Klass[] parameterTypes, - EspressoType returnType, Klass[] exceptionTypes, boolean isVarArgs, Symbol signature, boolean isOptimizedMethod, + EspressoType returnType, Klass[] exceptionTypes, boolean isVarArgs, Symbol signature, boolean isOptimizedMethod, int typeLiteralIndex, String resolvedGenericTypeField) { this.methodName = methodName; this.parameterTypes = parameterTypes; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupFieldNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupFieldNode.java index 06a1a031103a..9e4c8e1a87cb 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupFieldNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupFieldNode.java @@ -27,8 +27,8 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.GenerateUncached; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.nodes.EspressoNode; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupProxyKlassNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupProxyKlassNode.java index 3fe84c34dca7..a043bd85202b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupProxyKlassNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/LookupProxyKlassNode.java @@ -34,7 +34,10 @@ import com.oracle.truffle.api.interop.InvalidArrayIndexException; import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.api.library.CachedLibrary; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.EspressoClassLoadingException; import com.oracle.truffle.espresso.impl.EspressoType; @@ -102,7 +105,7 @@ WrappedProxyKlass doUncached(Object metaObject, String metaName, Klass targetTyp private static Klass lookupOrDefineInBindingsLoader(EspressoForeignProxyGenerator.GeneratedProxyBytes proxyBytes, EspressoContext context) { ClassRegistry registry = context.getRegistries().getClassRegistry(context.getBindingsLoader()); - Symbol proxyName = context.getTypes().fromClassGetName(proxyBytes.name); + Symbol proxyName = context.getTypes().fromClassGetName(proxyBytes.name); Klass proxyKlass = registry.findLoadedKlass(context.getClassLoadingEnv(), proxyName); if (proxyKlass != null) { @@ -124,11 +127,11 @@ private static Klass lookupOrDefineInBindingsLoader(EspressoForeignProxyGenerato } } - private static void injectStaticGenericTypes(Klass proxyKlass, Map, EspressoType> staticGenericReturnTypes) { - for (Map.Entry, EspressoType> entry : staticGenericReturnTypes.entrySet()) { - Symbol fieldName = entry.getKey(); + private static void injectStaticGenericTypes(Klass proxyKlass, Map, EspressoType> staticGenericReturnTypes) { + for (Map.Entry, EspressoType> entry : staticGenericReturnTypes.entrySet()) { + Symbol fieldName = entry.getKey(); EspressoType type = entry.getValue(); - Field field = proxyKlass.lookupDeclaredField(fieldName, Symbol.Type.com_oracle_truffle_espresso_polyglot_TypeLiteral); + Field field = proxyKlass.lookupDeclaredField(fieldName, Types.com_oracle_truffle_espresso_polyglot_TypeLiteral); assert field != null; field.setObject(proxyKlass.getStatics(), type.getGuestTypeLiteral()); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/PolyglotTypeMappings.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/PolyglotTypeMappings.java index 2be6fdd44bec..b2295a988822 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/PolyglotTypeMappings.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/interop/PolyglotTypeMappings.java @@ -40,7 +40,11 @@ import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.espresso.EspressoLanguage; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.EspressoType; import com.oracle.truffle.espresso.impl.Klass; @@ -99,8 +103,8 @@ public void resolve(EspressoContext context) { EconomicMap temp = EconomicMap.create(converters.size()); StaticObject bindingsLoader = context.getBindingsLoader(); - Symbol name = Symbol.Name.toGuest; - Symbol desc = Symbol.Signature.Object_Object; + Symbol name = Names.toGuest; + Symbol desc = Signatures.Object_Object; // load the GuestTypeConversion interface for type checking Klass conversionInterface = context.getMeta().loadKlassOrNull(context.getTypes().fromClassGetName(GUEST_TYPE_CONVERSION_INTERFACE), bindingsLoader, StaticObject.NULL); @@ -429,7 +433,7 @@ public static final class BuiltinExceptionTypeConverter implements InternalTypeC public BuiltinExceptionTypeConverter(ObjectKlass klass) { this.exceptionKlass = klass; - this.messageConstructor = klass.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void_String, Klass.LookupMode.INSTANCE_ONLY); + this.messageConstructor = klass.lookupDeclaredMethod(Names._init_, Signatures._void_String, Klass.LookupMode.INSTANCE_ONLY); } @Override diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHInvokeGenericNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHInvokeGenericNode.java index b134057450ba..1eb7fbfbe9d8 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHInvokeGenericNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHInvokeGenericNode.java @@ -27,9 +27,9 @@ import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.JavaKind; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.meta.Meta; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNativeNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNativeNode.java index fcf6c4df2d1a..d1ec5c2c20ef 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNativeNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNativeNode.java @@ -24,7 +24,7 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.Meta; @@ -41,7 +41,7 @@ public abstract class MHLinkToNativeNode extends MethodHandleIntrinsicNode { protected MHLinkToNativeNode(Method method, Field downcallStubAddress) { super(method); this.downcallStubAddress = downcallStubAddress; - this.argCount = Signatures.parameterCount(method.getParsedSignature()); + this.argCount = SignatureSymbols.parameterCount(method.getParsedSignature()); assert argCount >= 1; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNode.java index 93216b497cec..01c26d737e14 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/methodhandle/MHLinkToNode.java @@ -33,9 +33,10 @@ import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.nodes.IndirectCallNode; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -68,7 +69,7 @@ public abstract class MHLinkToNode extends MethodHandleIntrinsicNode { MHLinkToNode(Method method, MethodHandleIntrinsics.PolySigIntrinsics id) { super(method); - this.argCount = Signatures.parameterCount(method.getParsedSignature()); + this.argCount = SignatureSymbols.parameterCount(method.getParsedSignature()); this.hiddenVmtarget = method.getMeta().HIDDEN_VMTARGET; this.hasReceiver = id != MethodHandleIntrinsics.PolySigIntrinsics.LinkToStatic; this.linker = findLinker(id); @@ -123,7 +124,7 @@ static Object[] unbasic(Object[] args, Symbol[] targetSig, int from, int l res[start++] = args[from]; } for (int i = start; i < length; i++) { - Symbol t = Signatures.parameterType(targetSig, i - start); + Symbol t = SignatureSymbols.parameterType(targetSig, i - start); res[i] = InvokeDynamicCallSiteNode.unbasic(args[i + from], t); } return res; @@ -163,7 +164,7 @@ private static Linker findLinker(MethodHandleIntrinsics.PolySigIntrinsics id) { private Method.MethodVersion getTarget(Object[] args) { assert args.length >= 1; StaticObject memberName = (StaticObject) args[args.length - 1]; - assert (memberName.getKlass().getType() == Symbol.Type.java_lang_invoke_MemberName); + assert (memberName.getKlass().getType() == Types.java_lang_invoke_MemberName); return ((Method) hiddenVmtarget.getHiddenObject(memberName)).getMethodVersion(); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeDynamicCallSiteNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeDynamicCallSiteNode.java index 70450e382a6b..20fb35d9e665 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeDynamicCallSiteNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeDynamicCallSiteNode.java @@ -26,10 +26,11 @@ import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.Meta; import com.oracle.truffle.espresso.nodes.EspressoFrame; @@ -54,17 +55,17 @@ public InvokeDynamicCallSiteNode(StaticObject memberName, StaticObject appendix, Method target = (Method) meta.HIDDEN_VMTARGET.getHiddenObject(memberName); this.appendix = appendix; this.parsedSignature = parsedSignature; - this.returnType = Signatures.returnType(parsedSignature); - this.returnKind = Signatures.returnKind(parsedSignature); + this.returnType = SignatureSymbols.returnType(parsedSignature); + this.returnKind = SignatureSymbols.returnKind(parsedSignature); this.hasAppendix = !StaticObject.isNull(appendix); this.callNode = DirectCallNode.create(target.getCallTarget()); - this.resultAt = top - Signatures.slotsForParameters(parsedSignature); // no receiver - this.returnsPrimitiveType = Types.isPrimitive(returnType); + this.resultAt = top - SignatureSymbols.slotsForParameters(parsedSignature); // no receiver + this.returnsPrimitiveType = TypeSymbols.isPrimitive(returnType); } @Override public int execute(VirtualFrame frame, boolean isContinuationResume) { - int argCount = Signatures.parameterCount(parsedSignature); + int argCount = SignatureSymbols.parameterCount(parsedSignature); Object[] args = EspressoFrame.popBasicArgumentsWithArray(frame, top, parsedSignature, false, new Object[argCount + (hasAppendix ? 1 : 0)]); if (hasAppendix) { args[args.length - 1] = appendix; @@ -89,15 +90,15 @@ private int getResultAt() { // Transforms ints to sub-words public static Object unbasic(Object arg, Symbol t) { - if (t == Type._boolean) { + if (t == Types._boolean) { return ((int) arg != 0); - } else if (t == Type._short) { // Unbox to cast. + } else if (t == Types._short) { // Unbox to cast. int value = (int) arg; return (short) value; - } else if (t == Type._byte) { + } else if (t == Types._byte) { int value = (int) arg; return (byte) value; - } else if (t == Type._char) { + } else if (t == Types._char) { int value = (int) arg; return (char) value; } else { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeQuickNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeQuickNode.java index 9a79f3688a29..205fdc6dd845 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeQuickNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeQuickNode.java @@ -24,7 +24,7 @@ package com.oracle.truffle.espresso.nodes.quick.invoke; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.nodes.EspressoFrame; import com.oracle.truffle.espresso.nodes.quick.QuickNode; @@ -45,7 +45,7 @@ public abstract class InvokeQuickNode extends QuickNode { public InvokeQuickNode(Method m, int top, int callerBCI) { super(top, callerBCI); this.method = m.getMethodVersion(); - this.resultAt = top - (Signatures.slotsForParameters(m.getParsedSignature()) + (m.hasReceiver() ? 1 : 0)); + this.resultAt = top - (SignatureSymbols.slotsForParameters(m.getParsedSignature()) + (m.hasReceiver() ? 1 : 0)); this.stackEffect = (resultAt - top) + m.getReturnKind().getSlotCount(); this.returnsPrimitive = m.getReturnKind().isPrimitive(); } @@ -54,7 +54,7 @@ public InvokeQuickNode(Method.MethodVersion version, int top, int callerBCI) { super(top, callerBCI); this.method = version; Method m = version.getMethod(); - this.resultAt = top - (Signatures.slotsForParameters(m.getParsedSignature()) + (m.hasReceiver() ? 1 : 0)); + this.resultAt = top - (SignatureSymbols.slotsForParameters(m.getParsedSignature()) + (m.hasReceiver() ? 1 : 0)); this.stackEffect = (resultAt - top) + m.getReturnKind().getSlotCount(); this.returnsPrimitive = m.getReturnKind().isPrimitive(); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeStaticQuickNode.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeStaticQuickNode.java index 948cd51758ea..2302f24d425d 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeStaticQuickNode.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/nodes/quick/invoke/InvokeStaticQuickNode.java @@ -23,7 +23,7 @@ package com.oracle.truffle.espresso.nodes.quick.invoke; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.nodes.EspressoRootNode; import com.oracle.truffle.espresso.nodes.bytecodes.InvokeStatic; @@ -39,7 +39,7 @@ public InvokeStaticQuickNode(Method method, int top, int curBCI) { super(method, top, curBCI); assert method.isStatic(); this.isDoPrivilegedCall = method.getMeta().java_security_AccessController.equals(method.getDeclaringKlass()) && - Name.doPrivileged.equals(method.getName()); + Names.doPrivileged.equals(method.getName()); this.invokeStatic = insert(InvokeStaticNodeGen.create(method)); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/CachedParserKlassProvider.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/CachedParserKlassProvider.java index 948e42bbdd23..1723b6cdbfe8 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/CachedParserKlassProvider.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/CachedParserKlassProvider.java @@ -29,6 +29,7 @@ import com.oracle.truffle.api.TruffleLogger; import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ClassLoadingEnv; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.runtime.EspressoVerifier; @@ -36,7 +37,7 @@ public final class CachedParserKlassProvider extends AbstractCachedKlassProvider implements ParserKlassProvider { private final ParserKlassProvider fallbackProvider; - private final Map, ParserKlass> bootParserKlassCache = new ConcurrentHashMap<>(); + private final Map, ParserKlass> bootParserKlassCache = new ConcurrentHashMap<>(); private final Map appParserKlassCache = new ConcurrentHashMap<>(); public CachedParserKlassProvider(TruffleLogger logger, ParserKlassProvider fallbackProvider) { @@ -45,7 +46,7 @@ public CachedParserKlassProvider(TruffleLogger logger, ParserKlassProvider fallb } @Override - public ParserKlass getParserKlass(ClassLoadingEnv env, StaticObject loader, Symbol typeOrNull, byte[] bytes, ClassRegistry.ClassDefinitionInfo info) { + public ParserKlass getParserKlass(ClassLoadingEnv env, StaticObject loader, Symbol typeOrNull, byte[] bytes, ClassRegistry.ClassDefinitionInfo info) { if (env.shouldCacheClass(info, loader) && typeOrNull != null) { ParserKlassCacheKey key = null; ParserKlass parserKlass = null; @@ -92,17 +93,17 @@ public int getCachedParserKlassCount() { private static final class ParserKlassCacheKey { private final byte[] bytes; private final int hash; - private final Symbol type; + private final Symbol type; private final boolean verifiable; - ParserKlassCacheKey(byte[] bytes, Symbol type, boolean verifiable) { + ParserKlassCacheKey(byte[] bytes, Symbol type, boolean verifiable) { this.bytes = bytes; this.type = type; this.verifiable = verifiable; this.hash = computeHash(bytes, type, verifiable); } - private static int computeHash(byte[] bytes, Symbol typeOrNull, boolean verifiable) { + private static int computeHash(byte[] bytes, Symbol typeOrNull, boolean verifiable) { int result = Arrays.hashCode(bytes); result = 31 * result + typeOrNull.hashCode(); result = 31 * result + Boolean.hashCode(verifiable); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/DefaultParserKlassProvider.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/DefaultParserKlassProvider.java index 46470f54a98c..55a733287a61 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/DefaultParserKlassProvider.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/DefaultParserKlassProvider.java @@ -24,7 +24,7 @@ import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ClassLoadingEnv; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/EspressoLanguageCache.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/EspressoLanguageCache.java index 301b1237f193..86b0cb613f43 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/EspressoLanguageCache.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/EspressoLanguageCache.java @@ -27,6 +27,7 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ClassLoadingEnv; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.LinkedKlass; @@ -142,7 +143,7 @@ public void logCacheStatus() { }); } - public ParserKlass getOrCreateParserKlass(ClassLoadingEnv env, StaticObject classLoader, Symbol typeOrNull, byte[] bytes, ClassRegistry.ClassDefinitionInfo info) { + public ParserKlass getOrCreateParserKlass(ClassLoadingEnv env, StaticObject classLoader, Symbol typeOrNull, byte[] bytes, ClassRegistry.ClassDefinitionInfo info) { ensureFrozen(); return parserKlassProvider.getParserKlass(env, classLoader, typeOrNull, bytes, info); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/ParserKlassProvider.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/ParserKlassProvider.java index 243c3cd999c5..ba6cd3c7d7c3 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/ParserKlassProvider.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/preinit/ParserKlassProvider.java @@ -24,12 +24,14 @@ import com.oracle.truffle.espresso.classfile.ClassfileParser; import com.oracle.truffle.espresso.classfile.ClassfileStream; +import com.oracle.truffle.espresso.classfile.Constants; import com.oracle.truffle.espresso.classfile.ParserException; import com.oracle.truffle.espresso.classfile.ParserKlass; import com.oracle.truffle.espresso.classfile.ParsingContext; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.ValidationException; import com.oracle.truffle.espresso.impl.ClassLoadingEnv; import com.oracle.truffle.espresso.impl.ClassRegistry; @@ -50,7 +52,26 @@ static ParserKlass parseKlass(ClassRegistry.ClassDefinitionInfo info, ClassLoadi boolean loaderIsBootOrPlatform = env.loaderIsBootOrPlatform(loader); Meta meta = env.getMeta(); try { - return ClassfileParser.parse(env.getParsingContext(), new ClassfileStream(bytes, null), verifiable, loaderIsBootOrPlatform, typeOrNull, info.isHidden, info.forceAllowVMAnnotations); + ParsingContext parsingContext = env.getParsingContext(); + ParserKlass parserKlass = ClassfileParser.parse(parsingContext, new ClassfileStream(bytes, null), verifiable, loaderIsBootOrPlatform, typeOrNull, info.isHidden, + info.forceAllowVMAnnotations); + if (info.isHidden) { + Symbol requestedClassType = typeOrNull; + assert requestedClassType != null; + long hiddenKlassId = env.getNewKlassId(); + Symbol thisKlassName = parsingContext.getOrCreateName(TypeSymbols.hiddenClassName(requestedClassType, hiddenKlassId)); + Symbol thisKlassType = parsingContext.getOrCreateTypeFromName(thisKlassName); + var pool = parserKlass.getConstantPool().patchForHiddenClass(parserKlass.getThisKlassIndex(), thisKlassName); + var classFlags = parserKlass.getFlags() | Constants.ACC_IS_HIDDEN_CLASS; + return new ParserKlass(pool, classFlags, thisKlassName, thisKlassType, + parserKlass.getSuperKlass(), parserKlass.getSuperInterfaces(), + parserKlass.getMethods(), parserKlass.getFields(), + parserKlass.getAttributes(), + parserKlass.getThisKlassIndex(), parserKlass.getHiddenKlassId()); + } + + return parserKlass; + } catch (ValidationException | ParserException.ClassFormatError validationOrBadFormat) { throw meta.throwExceptionWithMessage(meta.java_lang_ClassFormatError, validationOrBadFormat.getMessage()); } catch (ParserException.UnsupportedClassVersionError unsupportedClassVersionError) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassInfo.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassInfo.java index 10c71ec2df1a..bb814d45ad00 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassInfo.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassInfo.java @@ -32,9 +32,9 @@ import com.oracle.truffle.espresso.classfile.ParserMethod; import com.oracle.truffle.espresso.classfile.attributes.EnclosingMethodAttribute; import com.oracle.truffle.espresso.classfile.constantpool.NameAndTypeConstant; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; @@ -126,7 +126,7 @@ public static HotSwapClassInfo create(Symbol name, byte[] bytes, StaticObj } public static HotSwapClassInfo create(ObjectKlass klass, Symbol name, byte[] bytes, StaticObject definingLoader, EspressoContext context, boolean isNewInnerTestKlass) { - Symbol type = context.getTypes().fromName(name); + Symbol type = context.getTypes().fromClassNameEntry(name); ParserKlass parserKlass = ParserKlassProvider.parseKlass(ClassRegistry.ClassDefinitionInfo.EMPTY, context.getClassLoadingEnv(), definingLoader, type, bytes); StringBuilder hierarchy = new StringBuilder(); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassRedefinition.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassRedefinition.java index 01fe379c7af1..5baa8f018aba 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassRedefinition.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ClassRedefinition.java @@ -55,8 +55,12 @@ import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; import com.oracle.truffle.espresso.classfile.constantpool.ImmutablePoolConstant; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.EspressoClassLoadingException; import com.oracle.truffle.espresso.impl.Field; @@ -206,13 +210,14 @@ public List detectClassChanges(HotSwapClassInfo[] classInfos) thro ClassChange classChange; DetectedChange detectedChange = new DetectedChange(); StaticObject loader = klass.getDefiningClassLoader(); - Types types = klass.getContext().getTypes(); - parserKlass = ParserKlassProvider.parseKlass(ClassRegistry.ClassDefinitionInfo.EMPTY, context.getClassLoadingEnv(), loader, types.fromName(hotSwapInfo.getName()), bytes); + TypeSymbols typeSymbols = klass.getContext().getTypes(); + parserKlass = ParserKlassProvider.parseKlass(ClassRegistry.ClassDefinitionInfo.EMPTY, context.getClassLoadingEnv(), loader, typeSymbols.fromClassNameEntry(hotSwapInfo.getName()), bytes); if (hotSwapInfo.isPatched()) { byte[] patched = hotSwapInfo.getPatchedBytes(); newParserKlass = parserKlass; // we detect changes against the patched bytecode - parserKlass = ParserKlassProvider.parseKlass(ClassRegistry.ClassDefinitionInfo.EMPTY, context.getClassLoadingEnv(), loader, types.fromName(hotSwapInfo.getNewName()), patched); + parserKlass = ParserKlassProvider.parseKlass(ClassRegistry.ClassDefinitionInfo.EMPTY, context.getClassLoadingEnv(), loader, typeSymbols.fromClassNameEntry(hotSwapInfo.getNewName()), + patched); } classChange = detectClassChanges(parserKlass, klass, detectedChange, newParserKlass); if (classChange == ClassChange.CLASS_HIERARCHY_CHANGED && detectedChange.getSuperKlass() != null) { @@ -267,7 +272,7 @@ public int redefineClass(ChangePacket packet, List invalidatedClass // if there is a currently loaded class under that name // we have to replace that in the class loader registry etc. // otherwise, don't eagerly define the new class - Symbol type = context.getTypes().fromName(classInfo.getName()); + Symbol type = context.getTypes().fromClassNameEntry(classInfo.getName()); ClassRegistry classRegistry = context.getRegistries().getClassRegistry(classInfo.getClassLoader()); Klass loadedKlass = classRegistry.findLoadedKlass(context.getClassLoadingEnv(), type); if (loadedKlass != null) { @@ -493,13 +498,13 @@ private static void detectInvalidEnumConstantChanges(ParserKlass newParserKlass, // detect invalid enum constant changes // currently, we only allow appending new enum constants Field[] oldEnumFields = oldKlass.getDeclaredFields(); - LinkedList> oldEnumConstants = new LinkedList<>(); + LinkedList> oldEnumConstants = new LinkedList<>(); for (Field oldEnumField : oldEnumFields) { if (oldEnumField.getType() == oldKlass.getType()) { oldEnumConstants.addLast(oldEnumField.getName()); } } - LinkedList> newEnumConstants = new LinkedList<>(); + LinkedList> newEnumConstants = new LinkedList<>(); ParserField[] newEnumFields = newParserKlass.getFields(); for (ParserField newEnumField : newEnumFields) { if (newEnumField.getType() == oldKlass.getType()) { @@ -519,12 +524,12 @@ private static void detectInvalidEnumConstantChanges(ParserKlass newParserKlass, } } - private static Klass getLoadedKlass(Symbol klassType, ObjectKlass oldKlass) throws RedefinitionNotSupportedException { + private static Klass getLoadedKlass(Symbol klassType, ObjectKlass oldKlass) throws RedefinitionNotSupportedException { Klass klass; klass = oldKlass.getContext().getRegistries().findLoadedClass(klassType, oldKlass.getDefiningClassLoader()); if (klass == null) { // new super interface must be loaded eagerly then - StaticObject resourceGuestString = oldKlass.getMeta().toGuestString(Types.binaryName(klassType)); + StaticObject resourceGuestString = oldKlass.getMeta().toGuestString(TypeSymbols.binaryName(klassType)); try { StaticObject loadedClass = (StaticObject) oldKlass.getMeta().java_lang_ClassLoader_loadClass.invokeDirectVirtual(oldKlass.getDefiningClassLoader(), resourceGuestString); klass = loadedClass.getMirrorKlass(); @@ -539,7 +544,7 @@ private static void checkForSpecialConstructor(DetectedChange collectedChanges, Method oldMethod, ParserMethod oldParserMethod, ParserMethod newMethod) { // mark constructors of nested anonymous inner classes // if they include an anonymous inner class type parameter - if (Symbol.Name._init_.equals(oldParserMethod.getName()) && Symbol.Signature._void != oldParserMethod.getSignature()) { + if (Names._init_.equals(oldParserMethod.getName()) && Signatures._void != oldParserMethod.getSignature()) { // only mark constructors that contain the outer anonymous inner class Matcher matcher = InnerClassRedefiner.ANON_INNER_CLASS_PATTERN.matcher(oldParserMethod.getSignature().toString()); if (matcher.matches()) { @@ -555,8 +560,8 @@ private static void checkForSpecialConstructor(DetectedChange collectedChanges, } private static boolean isObsolete(ParserMethod oldMethod, ParserMethod newMethod, ConstantPool oldPool, ConstantPool newPool) { - CodeAttribute oldCodeAttribute = (CodeAttribute) oldMethod.getAttribute(Symbol.Name.Code); - CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Symbol.Name.Code); + CodeAttribute oldCodeAttribute = (CodeAttribute) oldMethod.getAttribute(Names.Code); + CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Names.Code); if (oldCodeAttribute == null) { return newCodeAttribute != null; } else if (newCodeAttribute == null) { @@ -599,8 +604,8 @@ private static boolean isSame(BytecodeStream oldCode, ConstantPool oldPool, Byte private static ClassChange detectMethodChanges(ParserMethod oldMethod, ParserMethod newMethod) { // check code attribute - CodeAttribute oldCodeAttribute = (CodeAttribute) oldMethod.getAttribute(Symbol.Name.Code); - CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Symbol.Name.Code); + CodeAttribute oldCodeAttribute = (CodeAttribute) oldMethod.getAttribute(Names.Code); + CodeAttribute newCodeAttribute = (CodeAttribute) newMethod.getAttribute(Names.Code); if (oldCodeAttribute == null) { return newCodeAttribute != null ? ClassChange.METHOD_BODY_CHANGE : ClassChange.NO_CHANGE; @@ -666,7 +671,7 @@ private static boolean checkLocalVariableTable(LocalVariableTable table1, LocalV return false; } - private static boolean attrChanged(ParserMethod oldMethod, ParserMethod newMethod, Symbol name) { + private static boolean attrChanged(ParserMethod oldMethod, ParserMethod newMethod, Symbol name) { Attribute oldAttribute = oldMethod.getAttribute(name); Attribute newAttribute = newMethod.getAttribute(name); if ((oldAttribute == null || newAttribute == null)) { @@ -684,39 +689,39 @@ private static boolean isSameMethod(ParserMethod oldMethod, ParserMethod newMeth if (same) { // check method attributes that would constitute a higher-level // class redefinition than a method body change - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeVisibleTypeAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeVisibleTypeAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeInvisibleTypeAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeInvisibleTypeAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeVisibleAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeVisibleAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeInvisibleAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeInvisibleAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeInvisibleParameterAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeInvisibleParameterAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.RuntimeVisibleParameterAnnotations)) { + if (attrChanged(oldMethod, newMethod, Names.RuntimeVisibleParameterAnnotations)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.Exceptions)) { + if (attrChanged(oldMethod, newMethod, Names.Exceptions)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.Signature)) { + if (attrChanged(oldMethod, newMethod, Names.Signature)) { return false; } - if (attrChanged(oldMethod, newMethod, Symbol.Name.Exceptions)) { + if (attrChanged(oldMethod, newMethod, Names.Exceptions)) { return false; } } @@ -777,8 +782,8 @@ private void doRedefineClass(ChangePacket packet, List invalidatedC // 4. update the JDWP refType ID for the klass instance // 5. replace/record a classloader constraint for the new type and klass combination - Symbol newName = packet.info.getName(); - Symbol newType = context.getTypes().fromName(newName); + Symbol newName = packet.info.getName(); + Symbol newType = context.getTypes().fromClassNameEntry(newName); oldKlass.patchClassName(newName, newType); ClassRegistry classRegistry = context.getRegistries().getClassRegistry(packet.info.getClassLoader()); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/DetectedChange.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/DetectedChange.java index b00ff2fa365b..e4bbdbe5b24e 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/DetectedChange.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/DetectedChange.java @@ -32,7 +32,7 @@ import com.oracle.truffle.espresso.classfile.ParserField; import com.oracle.truffle.espresso.classfile.ParserMethod; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -91,7 +91,7 @@ public List getRemovedFields() { void addMethodBodyChange(Method oldMethod, ParserMethod newMethod) { changedMethodBodies.put(oldMethod, newMethod); - if (oldMethod.getName() == Symbol.Name._clinit_) { + if (oldMethod.getName() == Names._clinit_) { classInitializerChanged = true; } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/HotSwapClassInfo.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/HotSwapClassInfo.java index f4f354291689..6a7a1ec279b1 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/HotSwapClassInfo.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/HotSwapClassInfo.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Arrays; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; @@ -36,8 +37,8 @@ public final class HotSwapClassInfo extends ClassInfo { private byte[] bytes; private byte[] patchedBytes; private final StaticObject classLoader; - private final Symbol originalName; - private Symbol newName; + private final Symbol originalName; + private Symbol newName; // below fields constitute the "fingerprint" of the class relevant for matching private String classFingerprint; @@ -54,7 +55,7 @@ public final class HotSwapClassInfo extends ClassInfo { private HotSwapClassInfo outerClassInfo; private int nextNewClass = 1; - HotSwapClassInfo(ObjectKlass klass, Symbol originalName, StaticObject classLoader, String classFingerprint, String methodFingerprint, String fieldFingerprint, + HotSwapClassInfo(ObjectKlass klass, Symbol originalName, StaticObject classLoader, String classFingerprint, String methodFingerprint, String fieldFingerprint, String enclosingMethodFingerprint, ArrayList inners, byte[] bytes, boolean isEnumSwitchmapHelper, boolean isNewInnerTestKlass) { super(isEnumSwitchmapHelper, isNewInnerTestKlass); @@ -88,15 +89,15 @@ public void setKlass(ObjectKlass klass) { } @Override - public Symbol getName() { + public Symbol getName() { return originalName; } - public Symbol getNewName() { + public Symbol getNewName() { return newName != null ? newName : originalName; } - public void rename(Symbol name) { + public void rename(Symbol name) { this.newName = name; } @@ -114,7 +115,7 @@ public void addInnerClass(HotSwapClassInfo inner) { inner.setOuterClass(this); } - public boolean knowsInnerClass(Symbol innerName) { + public boolean knowsInnerClass(Symbol innerName) { for (ClassInfo innerClass : innerClasses) { if (innerName.equals(innerClass.getName())) { return true; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ImmutableClassInfo.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ImmutableClassInfo.java index a2ddd05662a6..9c69a32a6601 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ImmutableClassInfo.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/ImmutableClassInfo.java @@ -25,6 +25,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; @@ -32,7 +33,7 @@ // Represents ClassInfo instances that are cached in the global // cache for all classes having been involved in a redefinition public final class ImmutableClassInfo extends ClassInfo { - private final Symbol name; // key in global cache + private final Symbol name; // key in global cache private final WeakReference klass; private final StaticObject classLoader; private final byte[] bytes; @@ -45,7 +46,7 @@ public final class ImmutableClassInfo extends ClassInfo { private final ArrayList innerClasses; - ImmutableClassInfo(ObjectKlass klass, Symbol originalName, StaticObject classLoader, String classFingerprint, String methodFingerprint, String fieldFingerprint, + ImmutableClassInfo(ObjectKlass klass, Symbol originalName, StaticObject classLoader, String classFingerprint, String methodFingerprint, String fieldFingerprint, String enclosingMethodFingerprint, ArrayList inners, byte[] bytes, boolean isEnumSwitchmaphelper, boolean isInnerTestKlass) { super(isEnumSwitchmaphelper, isInnerTestKlass); this.klass = new WeakReference<>(klass); @@ -60,7 +61,7 @@ public final class ImmutableClassInfo extends ClassInfo { } @Override - public Symbol getName() { + public Symbol getName() { return name; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/InnerClassRedefiner.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/InnerClassRedefiner.java index b56f4c8743cd..ae6cf6a9cc73 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/InnerClassRedefiner.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/InnerClassRedefiner.java @@ -37,8 +37,9 @@ import java.util.regex.Pattern; import com.oracle.truffle.espresso.classfile.ParserException; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ClassRegistry; import com.oracle.truffle.espresso.impl.ConstantPoolPatcher; import com.oracle.truffle.espresso.impl.Klass; @@ -66,7 +67,7 @@ public final class InnerClassRedefiner { private final Map, ImmutableClassInfo>> innerClassInfoMap = new WeakHashMap<>(); // map from classloader to a map of Type to - private final Map, Set>> innerKlassCache = new WeakHashMap<>(); + private final Map, Set>> innerKlassCache = new WeakHashMap<>(); // list of class info for all top-level classed about to be redefined private final Map, HotSwapClassInfo> hotswapState = new HashMap<>(); @@ -334,7 +335,7 @@ public ImmutableClassInfo getGlobalClassInfo(Klass klass) { Set findLoadedInnerClasses(Klass klass) { // we use a cache to store inner/outer class mappings - Map, Set> classLoaderMap = innerKlassCache.get(klass.getDefiningClassLoader()); + Map, Set> classLoaderMap = innerKlassCache.get(klass.getDefiningClassLoader()); if (classLoaderMap == null) { classLoaderMap = new HashMap<>(); // register a listener on the registry to fill in @@ -356,7 +357,7 @@ public void onKlassDefined(ObjectKlass objectKlass) { if (matcher.matches()) { Symbol outerClassName = getOuterClassName(loadedKlass.getName()); if (outerClassName != null && outerClassName.length() > 0) { - Symbol outerType = context.getTypes().fromName(outerClassName); + Symbol outerType = context.getTypes().fromClassNameEntry(outerClassName); Set innerKlasses = classLoaderMap.get(outerType); if (innerKlasses == null) { innerKlasses = new HashSet<>(1); @@ -378,10 +379,10 @@ private void onKlassDefined(ObjectKlass klass) { Matcher matcher = ANON_INNER_CLASS_PATTERN.matcher(klass.getNameAsString()); if (matcher.matches()) { - Map, Set> classLoaderMap = innerKlassCache.get(klass.getDefiningClassLoader()); + Map, Set> classLoaderMap = innerKlassCache.get(klass.getDefiningClassLoader()); // found inner class, now hunt down the outer Symbol outerName = getOuterClassName(klass.getName()); - Symbol outerType = context.getTypes().fromName(outerName); + Symbol outerType = context.getTypes().fromClassNameEntry(outerName); Set innerKlasses = classLoaderMap.get(outerType); if (innerKlasses == null) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/enums/EnumRedefinitionPlugin.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/enums/EnumRedefinitionPlugin.java index 810cdb22845e..d816db2cb620 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/enums/EnumRedefinitionPlugin.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/enums/EnumRedefinitionPlugin.java @@ -26,6 +26,7 @@ import java.util.HashMap; import java.util.Map; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Method; @@ -73,7 +74,7 @@ public boolean onMethodEnter(MethodRef methodRef, MethodVariable[] variables) { MethodVariable nameVar = variables[1]; String enumName = objectKlass.getMeta().toHostString((StaticObject) nameVar.getValue()); - Symbol name = objectKlass.getContext().getNames().getOrCreate(enumName); + Symbol name = objectKlass.getContext().getNames().getOrCreate(enumName); Field field = objectKlass.lookupField(name, objectKlass.getType()); StaticObject existingEnumConstant = field.getObject(objectKlass.getStatics()); if (StaticObject.notNull(existingEnumConstant)) { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/impl/RedefinitionPluginHandler.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/impl/RedefinitionPluginHandler.java index a884589228e1..6ec3c022992e 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/impl/RedefinitionPluginHandler.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/redefinition/plugins/impl/RedefinitionPluginHandler.java @@ -33,6 +33,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.ObjectKlass; import com.oracle.truffle.espresso.jdwp.api.RedefineInfo; import com.oracle.truffle.espresso.redefinition.DefineKlassListener; @@ -48,7 +49,7 @@ public final class RedefinitionPluginHandler implements RedefineListener, Define // internal plugins are immediately activated during context // initialization, so no need for synchronization on this set private final Set internalPlugins = new HashSet<>(1); - private final Map, List> classLoadActions = new HashMap<>(); + private final Map, List> classLoadActions = new HashMap<>(); // The guest language HotSwap plugin handler passed // onto us if guest plugins are present at runtime. @@ -61,7 +62,7 @@ private RedefinitionPluginHandler(EspressoContext espressoContext) { @TruffleBoundary public void registerClassLoadAction(String className, ClassLoadAction action) { synchronized (classLoadActions) { - Symbol type = context.getTypes().fromClassGetName(className); + Symbol type = context.getTypes().fromClassGetName(className); List list = classLoadActions.get(type); if (list == null) { list = new ArrayList<>(); @@ -101,7 +102,7 @@ private void activatePlugin(InternalRedefinitionPlugin plugin) { @Override public void onKlassDefined(ObjectKlass klass) { synchronized (classLoadActions) { - Symbol type = klass.getType(); + Symbol type = klass.getType(); List loadActions = classLoadActions.get(type); if (loadActions != null) { // fire all registered load actions diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/Classpath.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/Classpath.java index a4914c394c32..c5dee733e4a3 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/Classpath.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/Classpath.java @@ -38,7 +38,7 @@ import com.oracle.truffle.espresso.classfile.ClasspathFile; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.substitutions.JImageExtensions; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoContext.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoContext.java index bbbcc9f3fadd..f08e86d36f51 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoContext.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoContext.java @@ -68,16 +68,18 @@ import com.oracle.truffle.espresso.blocking.BlockingSupport; import com.oracle.truffle.espresso.blocking.EspressoLock; import com.oracle.truffle.espresso.classfile.JavaVersion; -import com.oracle.truffle.espresso.classfile.descriptors.Names; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.NameSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.perf.DebugCloseable; import com.oracle.truffle.espresso.classfile.perf.DebugTimer; import com.oracle.truffle.espresso.classfile.perf.TimerCollection; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.ffi.NativeAccess; import com.oracle.truffle.espresso.ffi.NativeAccessCollector; import com.oracle.truffle.espresso.ffi.nfi.NFIIsolatedNativeAccess; @@ -443,19 +445,19 @@ private void spawnVM() throws ContextPatchingException { this.lazyCaches = new LazyContextCaches(this); try (DebugCloseable knownClassInit = KNOWN_CLASS_INIT.scope(espressoEnv.getTimers())) { - initializeKnownClass(Type.java_lang_Object); + initializeKnownClass(Types.java_lang_Object); for (Symbol type : Arrays.asList( - Type.java_lang_String, - Type.java_lang_System, - Type.java_lang_Class, // JDK-8069005 - Type.java_lang_ThreadGroup, - Type.java_lang_Thread)) { + Types.java_lang_String, + Types.java_lang_System, + Types.java_lang_Class, // JDK-8069005 + Types.java_lang_ThreadGroup, + Types.java_lang_Thread)) { initializeKnownClass(type); } } if (meta.jdk_internal_misc_UnsafeConstants != null) { - initializeKnownClass(Type.jdk_internal_misc_UnsafeConstants); + initializeKnownClass(Types.jdk_internal_misc_UnsafeConstants); UnsafeAccess.initializeGuestUnsafeConstants(meta); } @@ -464,8 +466,8 @@ private void spawnVM() throws ContextPatchingException { try (DebugCloseable knownClassInit = KNOWN_CLASS_INIT.scope(espressoEnv.getTimers())) { for (Symbol type : Arrays.asList( - Type.java_lang_reflect_Method, - Type.java_lang_ref_Finalizer)) { + Types.java_lang_reflect_Method, + Types.java_lang_ref_Finalizer)) { initializeKnownClass(type); } } @@ -480,10 +482,10 @@ private void spawnVM() throws ContextPatchingException { assert getJavaVersion().java9OrLater(); meta.java_lang_System_initPhase1.invokeDirectStatic(); for (Symbol type : Arrays.asList( - Type.java_lang_invoke_MethodHandle, - Type.java_lang_invoke_MemberName, - Type.java_lang_invoke_MethodHandleNatives)) { - // Type.java_lang_invoke_ResolvedMethodName is not used atm + Types.java_lang_invoke_MethodHandle, + Types.java_lang_invoke_MemberName, + Types.java_lang_invoke_MethodHandleNatives)) { + // Types.java_lang_invoke_ResolvedMethodName is not used atm initializeKnownClass(type); } int e = (int) meta.java_lang_System_initPhase2.invokeDirectStatic(false, logger.isLoggable(Level.FINE)); @@ -505,14 +507,14 @@ private void spawnVM() throws ContextPatchingException { try (DebugCloseable knownClassInit = KNOWN_CLASS_INIT.scope(espressoEnv.getTimers())) { // System exceptions. for (Symbol type : Arrays.asList( - Type.java_lang_OutOfMemoryError, - Type.java_lang_NullPointerException, - Type.java_lang_ClassCastException, - Type.java_lang_ArrayStoreException, - Type.java_lang_ArithmeticException, - Type.java_lang_StackOverflowError, - Type.java_lang_IllegalMonitorStateException, - Type.java_lang_IllegalArgumentException)) { + Types.java_lang_OutOfMemoryError, + Types.java_lang_NullPointerException, + Types.java_lang_ClassCastException, + Types.java_lang_ArrayStoreException, + Types.java_lang_ArithmeticException, + Types.java_lang_StackOverflowError, + Types.java_lang_IllegalMonitorStateException, + Types.java_lang_IllegalArgumentException)) { initializeKnownClass(type); } } @@ -528,8 +530,8 @@ private void spawnVM() throws ContextPatchingException { this.stackOverflow = EspressoException.wrap(stackOverflowErrorInstance, meta); this.outOfMemory = EspressoException.wrap(outOfMemoryErrorInstance, meta); - meta.java_lang_StackOverflowError.lookupDeclaredMethod(Name._init_, Signature._void_String).invokeDirectSpecial(stackOverflowErrorInstance, meta.toGuestString("VM StackOverFlow")); - meta.java_lang_OutOfMemoryError.lookupDeclaredMethod(Name._init_, Signature._void_String).invokeDirectSpecial(outOfMemoryErrorInstance, meta.toGuestString("VM OutOfMemory")); + meta.java_lang_StackOverflowError.lookupDeclaredMethod(Names._init_, Signatures._void_String).invokeDirectSpecial(stackOverflowErrorInstance, meta.toGuestString("VM StackOverFlow")); + meta.java_lang_OutOfMemoryError.lookupDeclaredMethod(Names._init_, Signatures._void_String).invokeDirectSpecial(outOfMemoryErrorInstance, meta.toGuestString("VM OutOfMemory")); // Create application (system) class loader. StaticObject systemClassLoader = null; @@ -623,8 +625,8 @@ private List> readClasslist(Path classlistFilePath) { List> classlist = Files.readAllLines(classlistFilePath) // .stream() // .filter(line -> !line.isBlank() && !line.startsWith("#") && !line.startsWith("@")) // - .map(Types::internalFromClassName) // - .map(t -> getTypes().getOrCreate(t)) // + .map(TypeSymbols::internalFromClassName) // + .map(t -> getTypes().getOrCreateValidType(t)) // .filter(Objects::nonNull) // .collect(Collectors.toList()); return classlist; @@ -638,11 +640,11 @@ private StaticObject createBindingsLoader(StaticObject systemClassLoader) { if (!getEspressoEnv().UseBindingsLoader) { return systemClassLoader; } - Klass k = getMeta().loadKlassOrNull(Type.java_net_URLClassLoader, StaticObject.NULL, StaticObject.NULL); + Klass k = getMeta().loadKlassOrNull(Types.java_net_URLClassLoader, StaticObject.NULL, StaticObject.NULL); if (k == null) { return systemClassLoader; } - Method init = k.lookupDeclaredMethod(Name._init_, Signature._void_URL_array_ClassLoader); + Method init = k.lookupDeclaredMethod(Names._init_, Signatures._void_URL_array_ClassLoader); if (init == null) { return systemClassLoader; } @@ -773,11 +775,11 @@ public boolean advancedRedefinitionEnabled() { return espressoEnv.JDWPOptions != null; } - public Types getTypes() { + public TypeSymbols getTypes() { return getLanguage().getTypes(); } - public Signatures getSignatures() { + public SignatureSymbols getSignatures() { return getLanguage().getSignatures(); } @@ -830,7 +832,7 @@ public void setBootstrapMeta(Meta meta) { this.meta = meta; } - public Names getNames() { + public NameSymbols getNames() { return getLanguage().getNames(); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoLinkResolver.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoLinkResolver.java index 0b569150546c..68049828c597 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoLinkResolver.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/EspressoLinkResolver.java @@ -23,7 +23,10 @@ package com.oracle.truffle.espresso.runtime; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -38,13 +41,13 @@ private EspressoLinkResolver() { } public static Field resolveFieldSymbolOrThrow(EspressoContext ctx, Klass accessingKlass, - Symbol name, Symbol type, Klass symbolicHolder, + Symbol name, Symbol type, Klass symbolicHolder, boolean accessCheck, boolean loadingConstraints) { return LinkResolver.resolveFieldSymbolOrThrow(ctx, accessingKlass, name, type, symbolicHolder, accessCheck, loadingConstraints); } public static Field resolveFieldSymbolOrNull(EspressoContext ctx, Klass accessingKlass, - Symbol name, Symbol type, Klass symbolicHolder, + Symbol name, Symbol type, Klass symbolicHolder, boolean accessCheck, boolean loadingConstraints) { return LinkResolver.resolveFieldSymbolOrNull(ctx, accessingKlass, name, type, symbolicHolder, accessCheck, loadingConstraints); } @@ -58,14 +61,14 @@ public static boolean checkFieldAccess(EspressoContext ctx, Field symbolicResolu } public static Method resolveMethodSymbol(EspressoContext ctx, Klass accessingKlass, - Symbol name, Symbol signature, Klass symbolicHolder, + Symbol name, Symbol signature, Klass symbolicHolder, boolean interfaceLookup, boolean accessCheck, boolean loadingConstraints) { return LinkResolver.resolveMethodSymbol(ctx, accessingKlass, name, signature, symbolicHolder, interfaceLookup, accessCheck, loadingConstraints); } public static Method resolveMethodSymbolOrNull(EspressoContext ctx, Klass accessingKlass, - Symbol name, Symbol signature, Klass symbolicHolder, + Symbol name, Symbol signature, Klass symbolicHolder, boolean interfaceLookup, boolean accessCheck, boolean loadingConstraints) { return LinkResolver.resolveMethodSymbolOrNull(ctx, accessingKlass, name, signature, symbolicHolder, interfaceLookup, accessCheck, loadingConstraints); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JDWPContextImpl.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JDWPContextImpl.java index fd7cd8ba7f63..f17eccbab006 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JDWPContextImpl.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JDWPContextImpl.java @@ -49,7 +49,10 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.blocking.EspressoLock; import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method.MethodVersion; @@ -225,7 +228,7 @@ public KlassRef[] findLoadedClass(String slashName) { } else { // object type String componentType = componentRawName.substring(1, componentRawName.length() - 1); - Symbol type = context.getTypes().fromClassGetName(componentType); + Symbol type = context.getTypes().fromClassGetName(componentType); KlassRef[] klassRefs = context.getRegistries().findLoadedClassAny(type); KlassRef[] result = new KlassRef[klassRefs.length]; for (int i = 0; i < klassRefs.length; i++) { @@ -235,7 +238,7 @@ public KlassRef[] findLoadedClass(String slashName) { } } else { // regular type - Symbol type = context.getTypes().fromClassGetName(slashName); + Symbol type = context.getTypes().fromClassGetName(slashName); return context.getRegistries().findLoadedClassAny(type); } } @@ -337,7 +340,7 @@ public KlassRef getRefType(Object object) { @Override public KlassRef getReflectedType(Object classObject) { if (classObject instanceof StaticObject staticObject) { - if (staticObject.getKlass().getType() == Symbol.Type.java_lang_Class) { + if (staticObject.getKlass().getType() == Types.java_lang_Class) { return (KlassRef) context.getMeta().HIDDEN_MIRROR_KLASS.getHiddenObject(staticObject); } } @@ -348,11 +351,11 @@ public KlassRef getReflectedType(Object classObject) { public KlassRef[] getNestedTypes(KlassRef klass) { if (klass instanceof ObjectKlass objectKlass) { ArrayList result = new ArrayList<>(); - List> nestedTypeNames = objectKlass.getNestedTypeNames(); + List> nestedTypeNames = objectKlass.getNestedTypeNames(); StaticObject classLoader = objectKlass.getDefiningClassLoader(); - for (Symbol nestedType : nestedTypeNames) { - Symbol type = context.getTypes().fromClassGetName(nestedType.toString()); + for (Symbol nestedType : nestedTypeNames) { + Symbol type = context.getTypes().fromClassGetName(nestedType.toString()); KlassRef loadedKlass = context.getRegistries().findLoadedClass(type, classLoader); if (loadedKlass != null && loadedKlass != klass) { result.add(loadedKlass); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JImageLibrary.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JImageLibrary.java index fdd45895bc15..34e51cbdf26e 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JImageLibrary.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JImageLibrary.java @@ -35,8 +35,9 @@ import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.ffi.NativeSignature; import com.oracle.truffle.espresso.ffi.NativeType; import com.oracle.truffle.espresso.ffi.nfi.NativeUtils; @@ -185,7 +186,7 @@ private long findLocation(TruffleObject jimage, TruffleObject sizePtr, ByteSeque return 0; } Symbol moduleName = pkgEntry.module().getName(); - if (moduleName == Name.java_base) { + if (moduleName == Names.java_base) { return (long) execute(findResource, jimage, javaBaseBuffer.pointer(), versionBuffer.pointer(), namePtr, sizePtr); } else { String nameAsString = moduleName == null ? "" : moduleName.toString(); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JavaJImageHelper.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JavaJImageHelper.java index 28b652eb712d..c9825a08d05b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JavaJImageHelper.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/JavaJImageHelper.java @@ -27,6 +27,7 @@ import java.nio.charset.StandardCharsets; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.PackageTable; import com.oracle.truffle.espresso.runtime.jimage.BasicImageReader; @@ -84,7 +85,7 @@ private ImageLocation findLocation(ByteSequence name) { } return reader.findLocation(ByteSequence.from(module), name); } else { - Symbol pkgSymbol = context.getNames().lookup(pkg); + Symbol pkgSymbol = context.getNames().lookup(pkg); if (pkgSymbol == null) { return null; } @@ -92,7 +93,7 @@ private ImageLocation findLocation(ByteSequence name) { if (pkgEntry == null) { return null; } - Symbol moduleName = pkgEntry.module().getName(); + Symbol moduleName = pkgEntry.module().getName(); ByteSequence moduleNameAsString = moduleName == null ? ByteSequence.EMPTY : moduleName; return reader.findLocation(moduleNameAsString, name); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/MethodHandleIntrinsics.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/MethodHandleIntrinsics.java index 48ab42e0cd29..913bb59e601c 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/MethodHandleIntrinsics.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/MethodHandleIntrinsics.java @@ -26,11 +26,13 @@ import java.util.concurrent.ConcurrentHashMap; import com.oracle.truffle.api.CompilerAsserts; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.EspressoError; @@ -105,23 +107,23 @@ public static PolySigIntrinsics getId(Symbol name, Klass declaringKlass) { if (!Meta.isSignaturePolymorphicHolderType(declaringKlass.getType())) { return PolySigIntrinsics.None; } - if (Type.java_lang_invoke_MethodHandle.equals(declaringKlass.getType())) { - if (name == Name.linkToStatic) { + if (Types.java_lang_invoke_MethodHandle.equals(declaringKlass.getType())) { + if (name == Names.linkToStatic) { return PolySigIntrinsics.LinkToStatic; } - if (name == Name.linkToVirtual) { + if (name == Names.linkToVirtual) { return PolySigIntrinsics.LinkToVirtual; } - if (name == Name.linkToSpecial) { + if (name == Names.linkToSpecial) { return PolySigIntrinsics.LinkToSpecial; } - if (name == Name.linkToInterface) { + if (name == Names.linkToInterface) { return PolySigIntrinsics.LinkToInterface; } - if (name == Name.linkToNative) { + if (name == Names.linkToNative) { return PolySigIntrinsics.LinkToNative; } - if (name == Name.invokeBasic) { + if (name == Names.invokeBasic) { return PolySigIntrinsics.InvokeBasic; } } @@ -188,7 +190,7 @@ public int hashCode() { @Override public String toString() { - return Types.binaryName(clazz) + "#" + methodName + signature; + return TypeSymbols.binaryName(clazz) + "#" + methodName + signature; } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/dispatch/staticobject/ThrowableInterop.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/dispatch/staticobject/ThrowableInterop.java index 2a73b68ea315..0da1db53c630 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/dispatch/staticobject/ThrowableInterop.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/dispatch/staticobject/ThrowableInterop.java @@ -28,7 +28,8 @@ import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.api.library.ExportLibrary; import com.oracle.truffle.api.library.ExportMessage; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.Meta; import com.oracle.truffle.espresso.runtime.dispatch.messages.GenerateInteropNodes; @@ -62,7 +63,7 @@ public static RuntimeException throwException(StaticObject object) { public static boolean hasExceptionCause(StaticObject object) { object.checkNotForeign(); Meta meta = object.getKlass().getMeta(); - Method resolvedMessageMethod = object.getKlass().lookupMethod(Symbol.Name.getCause, Symbol.Signature.Throwable); + Method resolvedMessageMethod = object.getKlass().lookupMethod(Names.getCause, Signatures.Throwable); if (resolvedMessageMethod == meta.java_lang_Throwable_getCause) { // not overridden, then we can trust the field value StaticObject guestCause = meta.java_lang_Throwable_cause.getObject(object); @@ -86,14 +87,14 @@ public static Object getExceptionCause(StaticObject object) throws UnsupportedMe if (!hasExceptionCause(object)) { throw UnsupportedMessageException.create(); } - return object.getKlass().lookupMethod(Symbol.Name.getCause, Symbol.Signature.Throwable).invokeDirect(object); + return object.getKlass().lookupMethod(Names.getCause, Signatures.Throwable).invokeDirect(object); } @ExportMessage public static boolean hasExceptionMessage(StaticObject object) { object.checkNotForeign(); Meta meta = object.getKlass().getMeta(); - Method resolvedMessageMethod = object.getKlass().lookupMethod(Symbol.Name.getMessage, Symbol.Signature.String); + Method resolvedMessageMethod = object.getKlass().lookupMethod(Names.getMessage, Signatures.String); if (resolvedMessageMethod == meta.java_lang_Throwable_getMessage) { // not overridden, then we can trust the field value return StaticObject.notNull(meta.java_lang_Throwable_detailMessage.getObject(object)); @@ -115,6 +116,6 @@ public static Object getExceptionMessage(StaticObject object) throws Unsupported if (!hasExceptionMessage(object)) { throw UnsupportedMessageException.create(); } - return object.getKlass().lookupMethod(Symbol.Name.getMessage, Symbol.Signature.String).invokeDirect(object); + return object.getKlass().lookupMethod(Names.getMessage, Signatures.String).invokeDirect(object); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/jimage/ImageStringsReader.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/jimage/ImageStringsReader.java index 68c6c1f59991..9f1a19f4abef 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/jimage/ImageStringsReader.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/jimage/ImageStringsReader.java @@ -28,7 +28,7 @@ import java.util.Objects; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUtf8; +import com.oracle.truffle.espresso.classfile.descriptors.ModifiedUTF8; import com.oracle.truffle.espresso.classfile.descriptors.Validation; public class ImageStringsReader { @@ -98,7 +98,7 @@ static ByteBuffer rawStringFromByteBuffer(ByteBuffer buffer, int startOffset) { static String stringFromByteBuffer(ByteBuffer buffer, int startOffset) { ByteBuffer raw = rawStringFromByteBuffer(buffer, startOffset); try { - return ModifiedUtf8.toJavaString(raw); + return ModifiedUTF8.toJavaString(raw); } catch (IOException e) { throw new InternalError(e); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/staticobject/StaticObject.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/staticobject/StaticObject.java index 98c05b08f774..7b8d22b721ce 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/staticobject/StaticObject.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/staticobject/StaticObject.java @@ -34,7 +34,7 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.blocking.BlockingSupport; import com.oracle.truffle.espresso.blocking.EspressoLock; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.EspressoType; import com.oracle.truffle.espresso.impl.Field; @@ -201,7 +201,7 @@ public final Klass getMirrorKlass() { } public final boolean isMirrorKlass() { - return getKlass().getType() == Type.java_lang_Class && !isStaticStorage(); + return getKlass().getType() == Types.java_lang_Class && !isStaticStorage(); } /** diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Substitutions.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Substitutions.java index 1eadf947a181..50b555bd580d 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Substitutions.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Substitutions.java @@ -37,12 +37,12 @@ import com.oracle.truffle.api.interop.InteropLibrary; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.espresso.EspressoLanguage; -import com.oracle.truffle.espresso.classfile.descriptors.StaticSymbols; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols; import com.oracle.truffle.espresso.impl.ClassLoadingEnv; import com.oracle.truffle.espresso.impl.ContextAccessImpl; import com.oracle.truffle.espresso.impl.Method; @@ -192,7 +192,7 @@ public int hashCode() { @Override public String toString() { - return Types.binaryName(clazz) + "#" + methodName + signature; + return TypeSymbols.binaryName(clazz) + "#" + methodName + signature; } } @@ -201,17 +201,17 @@ private static void registerStaticSubstitution(JavaSubstitution.Factory substitu List> parameterTypes = new ArrayList<>(); for (int i = substitutorFactory.hasReceiver() ? 1 : 0; i < substitutorFactory.parameterTypes().length; i++) { String type = substitutorFactory.parameterTypes()[i]; - parameterTypes.add(StaticSymbols.putType(type)); + parameterTypes.add(EspressoSymbols.SYMBOLS.putType(type)); } - Symbol returnType = StaticSymbols.putType(substitutorFactory.returnType()); - Symbol signature = StaticSymbols.putSignature(returnType, parameterTypes.toArray(Symbol.EMPTY_ARRAY)); + Symbol returnType = EspressoSymbols.SYMBOLS.putType(substitutorFactory.returnType()); + Symbol signature = EspressoSymbols.SYMBOLS.putSignature(returnType, parameterTypes.toArray(Symbol.EMPTY_ARRAY)); String[] classNames = substitutorFactory.substitutionClassNames(); String[] methodNames = substitutorFactory.getMethodNames(); for (int i = 0; i < classNames.length; i++) { assert classNames[i].startsWith("Target_"); - Symbol classType = StaticSymbols.putType("L" + classNames[i].substring("Target_".length()).replace('_', '/') + ";"); - Symbol methodName = StaticSymbols.putName(methodNames[i]); + Symbol classType = EspressoSymbols.SYMBOLS.putType("L" + classNames[i].substring("Target_".length()).replace('_', '/') + ";"); + Symbol methodName = EspressoSymbols.SYMBOLS.putName(methodNames[i]); registerStaticSubstitution(classType, methodName, signature, substitutorFactory, true); } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime.java index c6eec1ad15cd..17fcb0c32e54 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_EspressoJVMCIRuntime.java @@ -39,7 +39,7 @@ import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.constantpool.Resolution; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -118,10 +118,10 @@ static StaticObject lookupType(String type, ObjectKlass accessingKlass, boolean static StaticObject lookupNonPrimitiveType(ByteSequence typeDescriptor, ObjectKlass accessingKlass, boolean resolve, DirectCallNode objectTypeConstructor, DirectCallNode arrayTypeConstructor, DirectCallNode forBasicType, InitCheck initCheck, DirectCallNode unresolvedTypeConstructor, EspressoContext context, Meta meta) { - Symbol symbol = meta.getTypes().lookupType(typeDescriptor); + Symbol symbol = meta.getTypes().lookupValidType(typeDescriptor); if (symbol == null) { if (resolve) { - symbol = meta.getTypes().getOrCreate(typeDescriptor); + symbol = meta.getTypes().getOrCreateValidType(typeDescriptor); } if (symbol == null) { return toJVMCIUnresolvedType(typeDescriptor, unresolvedTypeConstructor, context, meta); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool.java index be4f336e58e4..2264b6bdec12 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoConstantPool.java @@ -65,12 +65,12 @@ import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; import com.oracle.truffle.espresso.classfile.constantpool.StringConstant; import com.oracle.truffle.espresso.classfile.constantpool.Utf8Constant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.constantpool.CallSiteLink; import com.oracle.truffle.espresso.constantpool.Resolution; import com.oracle.truffle.espresso.constantpool.ResolvedDynamicConstant; @@ -213,11 +213,11 @@ private static Field tryResolveField(FieldRefConstant.Indexes fieldRef, Klass sy LOGGER.finer(() -> "ECP.lookupType found " + klass); return toJVMCIObjectType(klass, meta); } else { - return toJVMCIUnresolvedType(Types.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(constantPool)), meta); + return toJVMCIUnresolvedType(TypeSymbols.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(constantPool)), meta); } } if (poolConstant instanceof Utf8Constant utf8Constant) { - return toJVMCIUnresolvedType(Types.nameToType(utf8Constant.unsafeSymbolValue()), meta); + return toJVMCIUnresolvedType(TypeSymbols.nameToType(utf8Constant.unsafeSymbolValue()), meta); } throw meta.throwIllegalArgumentExceptionBoundary(); } @@ -378,7 +378,7 @@ private static Method tryResolveMethod(MethodRefConstant.Indexes methodRef, Klas LOGGER.finer(() -> "ECP.lookupReferencedType found " + klass); return toJVMCIObjectType(klass, meta); } else { - return toJVMCIUnresolvedType(Types.nameToType(classConstant.getName(constantPool)), meta); + return toJVMCIUnresolvedType(TypeSymbols.nameToType(classConstant.getName(constantPool)), meta); } } break; @@ -398,7 +398,7 @@ private static Method tryResolveMethod(MethodRefConstant.Indexes methodRef, Klas return toJVMCIObjectType(holderKlass, meta); } else { Symbol holderName = memberRef.getHolderKlassName(constantPool); - return toJVMCIUnresolvedType(Types.nameToType(holderName), meta); + return toJVMCIUnresolvedType(TypeSymbols.nameToType(holderName), meta); } } break; @@ -518,7 +518,7 @@ public static boolean loadReferencedType0(StaticObject self, int cpi, int opcode } else if (resolve) { throw EspressoError.shouldNotReachHere(); } else { - return toJVMCIUnresolvedType(Types.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(constantPool)), meta); + return toJVMCIUnresolvedType(TypeSymbols.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(constantPool)), meta); } } if (poolConstant instanceof StringConstant) { @@ -661,11 +661,11 @@ private static CallSiteLink getCallSiteLink(StaticObject self, int index, Meta m Symbol name = bsmConstant.getName(constantPool); StaticObject type; if (isIndy) { - Symbol invokeSignature = Signatures.check(bsmConstant.getDescriptor(constantPool)); + Symbol invokeSignature = SignatureSymbols.fromDescriptor(bsmConstant.getDescriptor(constantPool)); Symbol[] parsedInvokeSignature = meta.getSignatures().parsed(invokeSignature); type = Resolution.signatureToMethodType(parsedInvokeSignature, cpHolderKlass, meta.getContext().getJavaVersion().java8OrEarlier(), meta); } else { - Symbol typeSymbol = Types.fromSymbol(bsmConstant.getDescriptor(constantPool)); + Symbol typeSymbol = TypeSymbols.fromSymbol(bsmConstant.getDescriptor(constantPool)); Klass klass = meta.resolveSymbolOrFail(typeSymbol, cpHolderKlass.getDefiningClassLoader(), cpHolderKlass.protectionDomain()); type = klass.mirror(); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType.java index 5d4a92d6f037..114c18ad6a17 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedInstanceType.java @@ -22,6 +22,7 @@ */ package com.oracle.truffle.espresso.substitutions; +import static com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import static com.oracle.truffle.espresso.substitutions.Target_com_oracle_truffle_espresso_jvmci_meta_EspressoMetaAccessProvider.toJVMCIInstanceType; import static com.oracle.truffle.espresso.substitutions.Target_jdk_vm_ci_runtime_JVMCI.checkJVMCIAvailable; @@ -31,7 +32,7 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -126,10 +127,10 @@ static StaticObject toJVMCIField(Field f, StaticObject maybeHolder, ObjectKlass private static StaticObject toJVMCIMethods(Method[] methods, boolean constructors, StaticObject holder, DirectCallNode methodConstructor, EspressoContext context, Meta meta) { int count = 0; for (Method m : methods) { - if (Symbol.Name._clinit_.equals(m.getName())) { + if (Names._clinit_.equals(m.getName())) { continue; } - if (Symbol.Name._init_.equals(m.getName()) == constructors) { + if (Names._init_.equals(m.getName()) == constructors) { count++; } @@ -138,10 +139,10 @@ private static StaticObject toJVMCIMethods(Method[] methods, boolean constructor StaticObject[] underlying = result.unwrap(context.getLanguage()); int i = 0; for (Method m : methods) { - if (Symbol.Name._clinit_.equals(m.getName())) { + if (Names._clinit_.equals(m.getName())) { continue; } - if (Symbol.Name._init_.equals(m.getName()) == constructors) { + if (Names._init_.equals(m.getName()) == constructors) { StaticObject jvmciMirror = toJVMCIMethod(m, holder, methodConstructor, context, meta); underlying[i++] = jvmciMirror; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField.java index fce7c222257f..3e2b1c6a0412 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaField.java @@ -22,6 +22,7 @@ */ package com.oracle.truffle.espresso.substitutions; +import static com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import static com.oracle.truffle.espresso.jvmci.JVMCIUtils.LOGGER; import static com.oracle.truffle.espresso.jvmci.JVMCIUtils.findType; import static com.oracle.truffle.espresso.substitutions.Target_com_oracle_truffle_espresso_jvmci_meta_EspressoMetaAccessProvider.toJVMCIType; @@ -32,7 +33,6 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.DirectCallNode; import com.oracle.truffle.espresso.EspressoLanguage; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.meta.Meta; @@ -143,6 +143,6 @@ public static boolean hasAnnotations(StaticObject self, @Inject EspressoContext assert context.getLanguage().isInternalJVMCIEnabled(); Meta meta = context.getMeta(); Field field = (Field) meta.jvmci.HIDDEN_FIELD_MIRROR.getHiddenObject(self); - return field.getAttribute(Symbol.Name.RuntimeVisibleAnnotations) != null; + return field.getAttribute(Names.RuntimeVisibleAnnotations) != null; } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod.java index 7da4705dc58a..69e92a3b0c55 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_jvmci_meta_EspressoResolvedJavaMethod.java @@ -43,8 +43,8 @@ import com.oracle.truffle.espresso.classfile.constantpool.ClassConstant; import com.oracle.truffle.espresso.classfile.constantpool.Resolvable; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.impl.ObjectKlass; @@ -188,7 +188,7 @@ static StaticObject doDefault(StaticObject self, ObjectKlass catchKlass = (ObjectKlass) ((Resolvable.ResolvedConstant) classConstant).value(); catchType = toJVMCIInstanceType(catchKlass, objectTypeConstructor, context, meta); } else { - ByteSequence type = Types.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(method.getConstantPool())); + ByteSequence type = TypeSymbols.nameToType(((ClassConstant.ImmutableClassConstant) classConstant).getName(method.getConstantPool())); catchType = toJVMCIUnresolvedType(type, unresolvedTypeConstructor, context, meta); } } @@ -383,6 +383,6 @@ public static boolean hasAnnotations(StaticObject self, @Inject EspressoContext assert context.getLanguage().isInternalJVMCIEnabled(); Meta meta = context.getMeta(); Method method = (Method) meta.jvmci.HIDDEN_METHOD_MIRROR.getHiddenObject(self); - return method.getAttribute(Symbol.Name.RuntimeVisibleAnnotations) != null; + return method.getAttribute(Names.RuntimeVisibleAnnotations) != null; } } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_polyglot_TypeLiteral.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_polyglot_TypeLiteral.java index 5ad19f2e3662..e6c366fe5b1a 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_polyglot_TypeLiteral.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_com_oracle_truffle_espresso_polyglot_TypeLiteral.java @@ -29,7 +29,8 @@ import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.InlinedBranchProfile; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.EspressoType; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -121,14 +122,14 @@ private EspressoType extractEspressoType(StaticObject type, EspressoContext cont } private static Klass rawType(StaticObject type) { - Method method = type.getKlass().lookupDeclaredMethod(Symbol.Name.getRawType, Symbol.Signature.Class, Klass.LookupMode.INSTANCE_ONLY); + Method method = type.getKlass().lookupDeclaredMethod(Names.getRawType, Signatures.Class, Klass.LookupMode.INSTANCE_ONLY); assert method != null; StaticObject rawGuestClass = (StaticObject) method.invokeDirectVirtual(type); return rawGuestClass.getMirrorKlass(); } private EspressoType[] typeArguments(StaticObject type, EspressoContext context) { - Method method = type.getKlass().lookupDeclaredMethod(Symbol.Name.getActualTypeArguments, Symbol.Signature.Type_array, Klass.LookupMode.INSTANCE_ONLY); + Method method = type.getKlass().lookupDeclaredMethod(Names.getActualTypeArguments, Signatures.Type_array, Klass.LookupMode.INSTANCE_ONLY); assert method != null; StaticObject typesArray = (StaticObject) method.invokeDirectVirtual(type); StaticObject[] types = typesArray.unwrap(context.getLanguage()); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_invoke_MethodHandleNatives.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_invoke_MethodHandleNatives.java index 1b2789fef1b7..94c893855792 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_invoke_MethodHandleNatives.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_invoke_MethodHandleNatives.java @@ -58,11 +58,13 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -76,7 +78,6 @@ import com.oracle.truffle.espresso.runtime.MethodHandleIntrinsics.PolySigIntrinsics; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.shared.resolver.CallSiteType; -import com.oracle.truffle.espresso.shared.resolver.FieldAccessType; import com.oracle.truffle.espresso.shared.resolver.ResolvedCall; @EspressoSubstitutions @@ -92,15 +93,15 @@ public final class Target_java_lang_invoke_MethodHandleNatives { @Inject Meta meta, @Inject EspressoLanguage language) { Klass targetKlass = ref.getKlass(); - if (targetKlass.getType() == Type.java_lang_reflect_Method) { + if (targetKlass.getType() == Types.java_lang_reflect_Method) { // Actual planting Method target = Method.getHostReflectiveMethodRoot(ref, meta); plantResolvedMethod(self, target, target.getRefKind(), meta); - } else if (targetKlass.getType() == Type.java_lang_reflect_Field) { + } else if (targetKlass.getType() == Types.java_lang_reflect_Field) { // Actual planting Field field = Field.getReflectiveFieldRoot(ref, meta); plantResolvedField(self, field, getRefKind(meta.java_lang_invoke_MemberName_flags.getInt(self)), meta, language); - } else if (targetKlass.getType() == Type.java_lang_reflect_Constructor) { + } else if (targetKlass.getType() == Types.java_lang_reflect_Constructor) { Method target = Method.getHostReflectiveConstructorRoot(ref, meta); plantResolvedMethod(self, target, target.getRefKind(), meta); } else { @@ -168,7 +169,7 @@ public final class Target_java_lang_invoke_MethodHandleNatives { meta.java_lang_invoke_MemberName_name.setObject(self, meta.toGuestString(f.getName())); } if (!haveType) { - if (Types.isPrimitive(f.getType())) { + if (TypeSymbols.isPrimitive(f.getType())) { Klass k = meta.resolvePrimitive(f.getType()); meta.java_lang_invoke_MemberName_type.setObject(self, k.mirror()); } else { @@ -420,7 +421,7 @@ private static StaticObject resolve(StaticObject memberName, @JavaType(Class.cla } if (Constants.flagHas(flags, MN_IS_CONSTRUCTOR)) { - if (name != Name._init_) { + if (name != Names._init_) { throw meta.throwException(meta.java_lang_LinkageError); } // Ignores refKind @@ -490,7 +491,7 @@ private static Symbol lookupName(Meta meta, String name, ObjectKlass excep @TruffleBoundary private static Symbol lookupType(Meta meta, ByteSequence desc) { - Symbol t = meta.getLanguage().getTypes().lookupType(desc); + Symbol t = meta.getLanguage().getTypes().lookupValidType(desc); if (t == null) { throw meta.throwException(meta.java_lang_NoSuchFieldException); } @@ -501,7 +502,7 @@ private static Symbol lookupType(Meta meta, ByteSequence desc) { private static Symbol lookupSignature(Meta meta, ByteSequence desc, PolySigIntrinsics iid) { Symbol signature; if (iid != None) { - signature = meta.getSignatures().symbolifyValidSignature(desc); + signature = meta.getSignatures().getOrCreateValidSignature(desc); } else { signature = meta.getSignatures().lookupValidSignature(desc); } @@ -667,14 +668,14 @@ public static CallSiteType callSiteFromOpCode(int opcode) { public static CallSiteType callSiteFromRefKind(int refKind) { switch (refKind) { - case com.oracle.truffle.espresso.classfile.Constants.REF_invokeVirtual: + case REF_invokeVirtual: return CallSiteType.Virtual; - case com.oracle.truffle.espresso.classfile.Constants.REF_invokeStatic: + case REF_invokeStatic: return CallSiteType.Static; - case com.oracle.truffle.espresso.classfile.Constants.REF_invokeSpecial: // fallthrough - case com.oracle.truffle.espresso.classfile.Constants.REF_newInvokeSpecial: + case REF_invokeSpecial: // fallthrough + case REF_newInvokeSpecial: return CallSiteType.Special; - case com.oracle.truffle.espresso.classfile.Constants.REF_invokeInterface: + case REF_invokeInterface: return CallSiteType.Interface; default: CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -682,25 +683,6 @@ public static CallSiteType callSiteFromRefKind(int refKind) { } } - public static FieldAccessType fieldAccessFromOpCode(int opcode) { - return FieldAccessType.fromOpCode(opcode); - } - - public static FieldAccessType fieldAccessFromRefKind(int refKind) { - switch (refKind) { - case com.oracle.truffle.espresso.classfile.Constants.REF_getField: - return FieldAccessType.GetInstance; - case com.oracle.truffle.espresso.classfile.Constants.REF_getStatic: - return FieldAccessType.GetStatic; - case com.oracle.truffle.espresso.classfile.Constants.REF_putField: - return FieldAccessType.PutInstance; - case com.oracle.truffle.espresso.classfile.Constants.REF_putStatic: - return FieldAccessType.PutStatic; - default: - CompilerDirectives.transferToInterpreterAndInvalidate(); - throw EspressoError.shouldNotReachHere("refkind: " + refKind); - } - } } /** diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_reflect_Array.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_reflect_Array.java index 14fe60aaf697..0233842c003a 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_reflect_Array.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_reflect_Array.java @@ -32,7 +32,7 @@ import com.oracle.truffle.api.interop.UnsupportedMessageException; import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.espresso.EspressoLanguage; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.meta.EspressoError; @@ -87,7 +87,7 @@ static StaticObject newArrayImpl(@JavaType(Class.class) StaticObject componentTy throw meta.throwNullPointerException(); } Klass component = componentType.getMirrorKlass(meta); - if (component == meta._void || Types.getArrayDimensions(component.getType()) >= 255) { + if (component == meta._void || TypeSymbols.getArrayDimensions(component.getType()) >= 255) { throw meta.throwException(meta.java_lang_IllegalArgumentException); } AllocationChecks.checkCanAllocateArray(meta, length); @@ -135,7 +135,7 @@ static StaticObject newArrayImpl(@JavaType(Class.class) StaticObject componentTy final int[] dimensions = dimensionsArray.unwrap(language); int finalDimensions = dimensions.length; if (component.isArray()) { - finalDimensions += Types.getArrayDimensions(component.getType()); + finalDimensions += TypeSymbols.getArrayDimensions(component.getType()); } if (dimensions.length == 0 || finalDimensions > 255) { throw meta.throwException(meta.java_lang_IllegalArgumentException); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_module_ModuleLoaderMap_Modules.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_module_ModuleLoaderMap_Modules.java index 615ab5a2c811..abd06534df34 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_module_ModuleLoaderMap_Modules.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_module_ModuleLoaderMap_Modules.java @@ -31,9 +31,10 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.nodes.DirectCallNode; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.meta.Meta; import com.oracle.truffle.espresso.runtime.EspressoContext; @@ -61,20 +62,20 @@ public static void clinit( /* * Spoof the statically stored boot module set. */ - spoofModules(Name.bootModules, meta, bootExtensions); + spoofModules(Names.bootModules, meta, bootExtensions); } ModuleExtension[] platformExtensions = ModuleExtension.getPlatformExtensions(context); if (platformExtensions.length > 0) { /* * Spoof the statically stored platform module set. */ - spoofModules(Name.platformModules, meta, platformExtensions); + spoofModules(Names.platformModules, meta, platformExtensions); } } @TruffleBoundary private static void spoofModules(Symbol fieldName, Meta meta, ModuleExtension[] toAdd) { - Field field = meta.jdk_internal_module_ModuleLoaderMap_Modules.lookupDeclaredField(fieldName, Type.java_util_Set); + Field field = meta.jdk_internal_module_ModuleLoaderMap_Modules.lookupDeclaredField(fieldName, Types.java_util_Set); StaticObject staticStorage = meta.jdk_internal_module_ModuleLoaderMap_Modules.tryInitializeAndGetStatics(); @JavaType(Set.class) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_misc_Unsafe.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_misc_Unsafe.java index 765e8050ebd2..88227157a6a7 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_misc_Unsafe.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_misc_Unsafe.java @@ -47,8 +47,8 @@ import com.oracle.truffle.espresso.blocking.GuestInterruptedException; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.JavaVersion; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; import com.oracle.truffle.espresso.ffi.Buffer; import com.oracle.truffle.espresso.ffi.RawPointer; import com.oracle.truffle.espresso.impl.ArrayKlass; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_reflect_NativeMethodAccessorImpl.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_reflect_NativeMethodAccessorImpl.java index 3c55d3a4ccae..d50d545870f5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_reflect_NativeMethodAccessorImpl.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_sun_reflect_NativeMethodAccessorImpl.java @@ -31,10 +31,10 @@ import com.oracle.truffle.api.interop.UnsupportedTypeException; import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Field; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; @@ -265,7 +265,7 @@ abstract static class Invoke0 extends SubstitutionNode { Method reflectedMethod = Method.getHostReflectiveMethodRoot(guestMethod, meta); Klass klass = meta.java_lang_reflect_Method_clazz.getObject(guestMethod).getMirrorKlass(meta); - if (klass == meta.java_lang_invoke_MethodHandle && (reflectedMethod.getName() == Name.invoke || reflectedMethod.getName() == Name.invokeExact)) { + if ((klass == meta.java_lang_invoke_MethodHandle) && ((reflectedMethod.getName() == Names.invoke) || (reflectedMethod.getName() == Names.invokeExact))) { StaticObject cause = Meta.initExceptionWithMessage(meta.java_lang_UnsupportedOperationException, "Cannot reflectively invoke MethodHandle.{invoke,invokeExact}"); StaticObject invocationTargetException = Meta.initExceptionWithCause(meta.java_lang_reflect_InvocationTargetException, cause); throw meta.throwException(invocationTargetException); @@ -366,7 +366,7 @@ private static Object[] makeArgs(ResolvedCall resolvedCall final Symbol[] signature = resolvedCall.getResolvedMethod().getParsedSignature(); // Check number of arguments. - if (Signatures.parameterCount(signature) != argsLen) { + if (SignatureSymbols.parameterCount(signature) != argsLen) { throw meta.throwExceptionWithMessage(meta.java_lang_IllegalArgumentException, "wrong number of arguments!"); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java index 06b66b4c4488..5bff049298c5 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java @@ -36,7 +36,8 @@ import com.oracle.truffle.api.TruffleLogger; import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.blocking.EspressoLock; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; import com.oracle.truffle.espresso.impl.ContextAccessImpl; import com.oracle.truffle.espresso.impl.SuppressFBWarnings; import com.oracle.truffle.espresso.meta.Meta; @@ -345,13 +346,13 @@ public void createMainThread(Meta meta) { private void createMainThreadGroup(Meta meta) { assert mainThreadGroup == null; StaticObject systemThreadGroup = meta.java_lang_ThreadGroup.allocateInstance(getContext()); - meta.java_lang_ThreadGroup.lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void) // private + meta.java_lang_ThreadGroup.lookupDeclaredMethod(Names._init_, Signatures._void) // private // ThreadGroup() .invokeDirectSpecial(systemThreadGroup); mainThreadGroup = meta.java_lang_ThreadGroup.allocateInstance(getContext()); meta.java_lang_ThreadGroup // public ThreadGroup(ThreadGroup parent, String name) - .lookupDeclaredMethod(Symbol.Name._init_, Symbol.Signature._void_ThreadGroup_String) // + .lookupDeclaredMethod(Names._init_, Signatures._void_ThreadGroup_String) // .invokeDirectSpecial(mainThreadGroup, /* parent */ systemThreadGroup, /* name */ meta.toGuestString("main")); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/InterpreterToVM.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/InterpreterToVM.java index 6abe4ab36d50..07fa35b3b8ec 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/InterpreterToVM.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/InterpreterToVM.java @@ -40,7 +40,7 @@ import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.blocking.EspressoLock; import com.oracle.truffle.espresso.blocking.GuestInterruptedException; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.ArrayKlass; import com.oracle.truffle.espresso.impl.ContextAccessImpl; import com.oracle.truffle.espresso.impl.Field; @@ -689,7 +689,7 @@ public boolean include(Method m) { return false; } if (!afterFillInStackTrace) { - if (Name.fillInStackTrace.equals(m.getName()) || Name.fillInStackTrace0.equals(m.getName())) { + if (Names.fillInStackTrace.equals(m.getName()) || Names.fillInStackTrace0.equals(m.getName())) { return false; } else { afterFillInStackTrace = true; @@ -697,7 +697,7 @@ public boolean include(Method m) { } if (!afterThrowableInit) { assert afterFillInStackTrace; - if (Name._init_.equals(m.getName()) && m.getMeta().java_lang_Throwable.isAssignableFrom(m.getDeclaringKlass())) { + if (Names._init_.equals(m.getName()) && m.getMeta().java_lang_Throwable.isAssignableFrom(m.getDeclaringKlass())) { return false; } else { afterThrowableInit = true; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/Management.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/Management.java index a2a17cff9d85..3f19ebacaa85 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/Management.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/Management.java @@ -55,7 +55,8 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.espresso.EspressoLanguage; import com.oracle.truffle.espresso.classfile.JavaKind; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.ffi.NativeSignature; import com.oracle.truffle.espresso.ffi.NativeType; import com.oracle.truffle.espresso.ffi.Pointer; @@ -339,17 +340,17 @@ private void fillThreadInfos(StaticObject[] threads, StaticObject infoArray, int throw meta.throwExceptionWithMessage(meta.java_lang_IllegalArgumentException, "The length of the given ThreadInfo array does not match the length of the given array of thread IDs"); } - Method init = meta.java_lang_management_ThreadInfo.lookupDeclaredMethod(Symbol.Name._init_, getSignatures().makeRaw( - /* returns */Symbol.Type._void, - /* t */ Symbol.Type.java_lang_Thread, - /* state */ Symbol.Type._int, - /* lockObj */ Symbol.Type.java_lang_Object, - /* lockOwner */Symbol.Type.java_lang_Thread, - /* blockedCount */Symbol.Type._long, - /* blockedTime */Symbol.Type._long, - /* waitedCount */Symbol.Type._long, - /* waitedTime */Symbol.Type._long, - /* StackTraceElement[] */ Symbol.Type.java_lang_StackTraceElement_array)); + Method init = meta.java_lang_management_ThreadInfo.lookupDeclaredMethod(Names._init_, getSignatures().makeRaw( + /* returns */Types._void, + /* t */ Types.java_lang_Thread, + /* state */ Types._int, + /* lockObj */ Types.java_lang_Object, + /* lockOwner */Types.java_lang_Thread, + /* blockedCount */Types._long, + /* blockedTime */Types._long, + /* waitedCount */Types._long, + /* waitedTime */Types._long, + /* StackTraceElement[] */ Types.java_lang_StackTraceElement_array)); for (int i = 0; i < threads.length; i++) { StaticObject thread = threads[i]; @@ -417,7 +418,7 @@ private void fillThreadInfos(StaticObject[] threads, StaticObject infoArray, int private Klass getMemoryPoolMXBeanKlass() { if (memoryPoolMXBeanKlass == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - memoryPoolMXBeanKlass = getMeta().resolveSymbolOrFail(Symbol.Type.java_lang_management_MemoryPoolMXBean, StaticObject.NULL, StaticObject.NULL); + memoryPoolMXBeanKlass = getMeta().resolveSymbolOrFail(Types.java_lang_management_MemoryPoolMXBean, StaticObject.NULL, StaticObject.NULL); } return memoryPoolMXBeanKlass; } @@ -485,7 +486,7 @@ public StaticObject apply(int i) { private Klass getMemoryManagerMXBeanKlass() { if (memoryManagerMXBeanKlass == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - memoryManagerMXBeanKlass = getMeta().resolveSymbolOrFail(Symbol.Type.java_lang_management_MemoryManagerMXBean, StaticObject.NULL, StaticObject.NULL); + memoryManagerMXBeanKlass = getMeta().resolveSymbolOrFail(Types.java_lang_management_MemoryManagerMXBean, StaticObject.NULL, StaticObject.NULL); } return memoryManagerMXBeanKlass; } @@ -556,8 +557,8 @@ public StaticObject apply(int i) { private Method getMemoryUsageInit() { if (memoryUsageInit == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - memoryUsageInit = getMeta().java_lang_management_MemoryUsage.lookupDeclaredMethod(Symbol.Name._init_, - getSignatures().makeRaw(Symbol.Type._void, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long, Symbol.Type._long)); + memoryUsageInit = getMeta().java_lang_management_MemoryUsage.lookupDeclaredMethod(Names._init_, + getSignatures().makeRaw(Types._void, Types._long, Types._long, Types._long, Types._long)); } return memoryUsageInit; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/ModulesHelperVM.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/ModulesHelperVM.java index 4c891d68f732..463516fc9c87 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/ModulesHelperVM.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/ModulesHelperVM.java @@ -25,6 +25,7 @@ import static com.oracle.truffle.espresso.meta.EspressoError.cat; +import com.oracle.truffle.espresso.classfile.descriptors.Name; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; import com.oracle.truffle.espresso.impl.ModuleTable; import com.oracle.truffle.espresso.impl.PackageTable; @@ -44,7 +45,7 @@ private static ModuleTable.ModuleEntry getModuleEntry(@JavaType(internalName = " return (ModuleTable.ModuleEntry) meta.HIDDEN_MODULE_ENTRY.getHiddenObject(module); } - private static PackageTable.PackageEntry getPackageEntry(ModuleTable.ModuleEntry fromModuleEntry, Symbol nameSymbol, Meta meta) { + private static PackageTable.PackageEntry getPackageEntry(ModuleTable.ModuleEntry fromModuleEntry, Symbol nameSymbol, Meta meta) { return fromModuleEntry.registry(meta).packages().lookup(nameSymbol); } @@ -83,7 +84,7 @@ public static ModuleTable.ModuleEntry extractFromModuleEntry(@JavaType(internalN public static PackageTable.PackageEntry extractPackageEntry(String pkg, ModuleTable.ModuleEntry fromModuleEntry, Meta meta, SubstitutionProfiler profiler) { PackageTable.PackageEntry packageEntry = null; - Symbol nameSymbol = meta.getContext().getNames().lookup(pkg); + Symbol nameSymbol = meta.getContext().getNames().lookup(pkg); if (nameSymbol != null) { packageEntry = getPackageEntry(fromModuleEntry, nameSymbol, meta); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/StackWalk.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/StackWalk.java index 2d4ff68ec033..ed941ee790c0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/StackWalk.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/StackWalk.java @@ -30,9 +30,11 @@ import com.oracle.truffle.api.Truffle; import com.oracle.truffle.api.frame.FrameInstance; import com.oracle.truffle.api.frame.FrameInstanceVisitor; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.impl.Klass; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.EspressoError; @@ -86,7 +88,7 @@ private static boolean synchronizedConstants(Meta meta) { } private static int getConstantField(Klass stackStreamFactory, StaticObject statics, String name, Meta meta) { - return stackStreamFactory.lookupDeclaredField(meta.getNames().getOrCreate(name), Symbol.Type._int).getInt(statics); + return stackStreamFactory.lookupDeclaredField(meta.getNames().getOrCreate(name), Types._int).getInt(statics); } public StackWalk() { @@ -252,12 +254,12 @@ private boolean isFromStackWalkingAPI(Method m) { private boolean isCallStackWalk(Method m) { return m.getDeclaringKlass() == meta.java_lang_StackStreamFactory_AbstractStackWalker && - Name.callStackWalk.equals(m.getName()) && + Names.callStackWalk.equals(m.getName()) && getCallStackWalkSignature().equals(m.getRawSignature()); } private Symbol getCallStackWalkSignature() { - return meta.getJavaVersion().java19OrLater() ? Signature.Object_long_int_ContinuationScope_Continuation_int_int_Object_array : Signature.Object_long_int_int_int_Object_array; + return meta.getJavaVersion().java19OrLater() ? Signatures.Object_long_int_ContinuationScope_Continuation_int_int_Object_array : Signatures.Object_long_int_int_int_Object_array; } @SuppressWarnings("fallthrough") diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/VM.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/VM.java index 33e4b96b18d8..3463b0cd6cc1 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/VM.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/VM.java @@ -98,14 +98,17 @@ import com.oracle.truffle.espresso.classfile.attributes.SignatureAttribute; import com.oracle.truffle.espresso.classfile.constantpool.NameAndTypeConstant; import com.oracle.truffle.espresso.classfile.descriptors.ByteSequence; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Validation; import com.oracle.truffle.espresso.classfile.tables.EntryTable; import com.oracle.truffle.espresso.constantpool.RuntimeConstantPool; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Signatures; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.ffi.NativeSignature; import com.oracle.truffle.espresso.ffi.NativeType; import com.oracle.truffle.espresso.ffi.Pointer; @@ -953,6 +956,7 @@ public boolean JVM_IsPrimitiveClass(@JavaType(Class.class) StaticObject self) { return self.getMirrorKlass(getMeta()).isPrimitive(); } + @TruffleBoundary @VmImpl(isJni = true) public @JavaType(java.lang.reflect.Field[].class) StaticObject JVM_GetClassDeclaredFields(@JavaType(Class.class) StaticObject self, boolean publicOnly) { // TODO(peterssen): From Hostpot: 4496456 We need to filter out @@ -979,6 +983,7 @@ public StaticObject apply(int i) { } // TODO(tg): inject constructor calltarget. + @TruffleBoundary @VmImpl(isJni = true) public @JavaType(Constructor[].class) StaticObject JVM_GetClassDeclaredConstructors(@JavaType(Class.class) StaticObject self, boolean publicOnly) { Meta meta = getMeta(); @@ -986,7 +991,7 @@ public StaticObject apply(int i) { Klass klass = self.getMirrorKlass(getMeta()); klass.ensureLinked(); for (Method m : klass.getDeclaredConstructors()) { - if (Name._init_.equals(m.getName()) && (!publicOnly || m.isPublic())) { + if (Names._init_.equals(m.getName()) && (!publicOnly || m.isPublic())) { collectedMethods.add(m); } } @@ -1003,6 +1008,7 @@ public StaticObject apply(int i) { } // TODO(tg): inject constructor calltarget. + @TruffleBoundary @VmImpl(isJni = true) public @JavaType(java.lang.reflect.Method[].class) StaticObject JVM_GetClassDeclaredMethods(@JavaType(Class.class) StaticObject self, boolean publicOnly) { Meta meta = getMeta(); @@ -1012,7 +1018,7 @@ public StaticObject apply(int i) { for (Method m : klass.getDeclaredMethods()) { if ((!publicOnly || m.isPublic()) && // Filter out and from reflection. - !Name._init_.equals(m.getName()) && !Name._clinit_.equals(m.getName())) { + !Names._init_.equals(m.getName()) && !Names._clinit_.equals(m.getName())) { collectedMethods.add(m); } } @@ -1027,6 +1033,7 @@ public StaticObject apply(int i) { } + @TruffleBoundary @VmImpl(isJni = true) public @JavaType(Class[].class) StaticObject JVM_GetDeclaredClasses(@JavaType(Class.class) StaticObject self) { Meta meta = getMeta(); @@ -1142,7 +1149,7 @@ private static Klass computeEnclosingClass(ObjectKlass klass) { if (entry.innerNameIndex == 0) { break; } else { - Symbol innerName = pool.symbolAt(entry.innerNameIndex); + Symbol innerName = pool.symbolAtUnsafe(entry.innerNameIndex); return getMeta().toGuestString(innerName); } } @@ -1155,9 +1162,9 @@ private static Klass computeEnclosingClass(ObjectKlass klass) { public @JavaType(String.class) StaticObject JVM_GetClassSignature(@JavaType(Class.class) StaticObject self) { if (self.getMirrorKlass(getMeta()) instanceof ObjectKlass) { ObjectKlass klass = (ObjectKlass) self.getMirrorKlass(getMeta()); - SignatureAttribute signature = (SignatureAttribute) klass.getAttribute(Name.Signature); + SignatureAttribute signature = (SignatureAttribute) klass.getAttribute(Names.Signature); if (signature != null) { - String sig = klass.getConstantPool().symbolAt(signature.getSignatureIndex(), "signature").toString(); + String sig = klass.getConstantPool().symbolAtUnsafe(signature.getSignatureIndex(), "signature").toString(); return getMeta().toGuestString(sig); } } @@ -1168,7 +1175,7 @@ private static Klass computeEnclosingClass(ObjectKlass klass) { public @JavaType(byte[].class) StaticObject JVM_GetClassAnnotations(@JavaType(Class.class) StaticObject self) { Klass klass = self.getMirrorKlass(getMeta()); if (klass instanceof ObjectKlass) { - Attribute annotations = ((ObjectKlass) klass).getAttribute(Name.RuntimeVisibleAnnotations); + Attribute annotations = ((ObjectKlass) klass).getAttribute(Names.RuntimeVisibleAnnotations); if (annotations != null) { return StaticObject.wrap(annotations.getData(), getMeta()); } @@ -1180,7 +1187,7 @@ private static Klass computeEnclosingClass(ObjectKlass klass) { public @JavaType(byte[].class) StaticObject JVM_GetClassTypeAnnotations(@JavaType(Class.class) StaticObject self) { Klass klass = self.getMirrorKlass(getMeta()); if (klass instanceof ObjectKlass) { - Attribute annotations = ((ObjectKlass) klass).getAttribute(Name.RuntimeVisibleTypeAnnotations); + Attribute annotations = ((ObjectKlass) klass).getAttribute(Names.RuntimeVisibleTypeAnnotations); if (annotations != null) { return StaticObject.wrap(annotations.getData(), getMeta()); } @@ -1248,8 +1255,8 @@ public static StaticObject toGuestComponent(RecordAttribute.RecordComponentInfo assert meta.getJavaVersion().java16OrLater(); RuntimeConstantPool pool = klass.getConstantPool(); StaticObject component = meta.java_lang_reflect_RecordComponent.allocateInstance(meta.getContext()); - Symbol nameSymbol = pool.symbolAt(recordInfo.getNameIndex()); - Symbol typeSymbol = pool.symbolAt(recordInfo.getDescriptorIndex()); + Symbol nameSymbol = pool.symbolAtUnsafe(recordInfo.getNameIndex()); + Symbol typeSymbol = pool.symbolAtUnsafe(recordInfo.getDescriptorIndex()); Symbol signature = meta.getSignatures().makeRaw(typeSymbol); meta.java_lang_reflect_RecordComponent_clazz.setObject(component, klass.mirror()); meta.java_lang_reflect_RecordComponent_name.setObject(component, meta.toGuestString(nameSymbol)); @@ -1263,11 +1270,11 @@ public static StaticObject toGuestComponent(RecordAttribute.RecordComponentInfo // Find and set generic signature SignatureAttribute genericSignatureAttribute = (SignatureAttribute) recordInfo.getAttribute(SignatureAttribute.NAME); meta.java_lang_reflect_RecordComponent_signature.setObject(component, - genericSignatureAttribute != null ? meta.toGuestString(pool.symbolAt(genericSignatureAttribute.getSignatureIndex())) : StaticObject.NULL); + genericSignatureAttribute != null ? meta.toGuestString(pool.symbolAtUnsafe(genericSignatureAttribute.getSignatureIndex())) : StaticObject.NULL); // Find and set annotations - doAnnotation(recordInfo, component, Name.RuntimeVisibleAnnotations, meta.java_lang_reflect_RecordComponent_annotations, meta); - doAnnotation(recordInfo, component, Name.RuntimeVisibleTypeAnnotations, meta.java_lang_reflect_RecordComponent_typeAnnotations, meta); + doAnnotation(recordInfo, component, Names.RuntimeVisibleAnnotations, meta.java_lang_reflect_RecordComponent_annotations, meta); + doAnnotation(recordInfo, component, Names.RuntimeVisibleTypeAnnotations, meta.java_lang_reflect_RecordComponent_typeAnnotations, meta); return component; } @@ -1850,7 +1857,7 @@ public float JVM_ConstantPoolGetFloatAt(@SuppressWarnings("unused") @JavaType(Ob int index, @Inject Meta meta, @Inject SubstitutionProfiler profiler) { checkTag(jcpool.getMirrorKlass(getMeta()).getConstantPool(), index, ConstantPool.Tag.UTF8, meta, profiler); - return getMeta().toGuestString(jcpool.getMirrorKlass(getMeta()).getConstantPool().symbolAt(index).toString()); + return getMeta().toGuestString(jcpool.getMirrorKlass(getMeta()).getConstantPool().symbolAtUnsafe(index).toString()); } @VmImpl(isJni = true) @@ -1987,9 +1994,23 @@ private Symbol namePtrToInternal(TruffleObject namePtr) { return JVM_DefineClass(namePtr, loader, bufPtr, len, pd); } + @TruffleBoundary @VmImpl(isJni = true) public @JavaType(Class.class) StaticObject JVM_FindLoadedClass(@JavaType(ClassLoader.class) StaticObject loader, @JavaType(String.class) StaticObject name) { - Symbol type = getTypes().fromClassGetName(getMeta().toHostString(name)); + if (StaticObject.isNull(name)) { + return StaticObject.NULL; + } + String classGetName = getMeta().toHostString(name); + String internalName = TypeSymbols.internalFromClassName(classGetName); + ByteSequence internalNameBytes = ByteSequence.create(internalName); + /* + * Possible optimization: Check if the elemental type (beware of arrays) symbol exists, + * otherwise, the type is not loaded. + */ + Symbol type = getTypes().getOrCreateValidType(internalNameBytes); + if (type == null) { + return StaticObject.NULL; + } // HotSpot skips reflection (DelegatingClassLoader) class loaders. Klass klass = getRegistries().findLoadedClass(type, nonReflectionClassLoader(loader)); if (klass == null) { @@ -2017,7 +2038,7 @@ private Symbol namePtrToInternal(TruffleObject namePtr) { } Symbol type = getTypes().fromClassGetName(internalName); - if (Types.isPrimitive(type)) { + if (TypeSymbols.isPrimitive(type)) { return StaticObject.NULL; } Klass klass = getMeta().resolveSymbolOrNull(type, StaticObject.NULL, StaticObject.NULL); @@ -2036,7 +2057,7 @@ private Symbol namePtrToInternal(TruffleObject namePtr) { Meta meta = getMeta(); Symbol type = namePtrToInternal(namePtr); Klass result; - if (Types.isPrimitive(type)) { + if (TypeSymbols.isPrimitive(type)) { result = null; } else { StaticObject protectionDomain; @@ -2451,7 +2472,7 @@ private PropertiesMap buildPropertiesMap() { @TruffleBoundary public @JavaType(Properties.class) StaticObject JVM_InitProperties(@JavaType(Properties.class) StaticObject properties) { Map props = buildPropertiesMap().map; - Method setProperty = properties.getKlass().lookupMethod(Name.setProperty, Signature.Object_String_String); + Method setProperty = properties.getKlass().lookupMethod(Names.setProperty, Signatures.Object_String_String); for (Map.Entry entry : props.entrySet()) { setProperty.invokeWithConversions(properties, entry.getKey(), entry.getValue()); } @@ -2555,7 +2576,7 @@ public int JVM_GetArrayLength(@JavaType(Object.class) StaticObject array, @Injec public @JavaType(internalName = "Ljava/lang/AssertionStatusDirectives;") StaticObject JVM_AssertionStatusDirectives(@SuppressWarnings("unused") @JavaType(Class.class) StaticObject unused) { Meta meta = getMeta(); StaticObject instance = meta.java_lang_AssertionStatusDirectives.allocateInstance(getContext()); - meta.java_lang_AssertionStatusDirectives.lookupMethod(Name._init_, Signature._void).invokeDirectSpecial(instance); + meta.java_lang_AssertionStatusDirectives.lookupMethod(Names._init_, Signatures._void).invokeDirectSpecial(instance); meta.java_lang_AssertionStatusDirectives_classes.set(instance, meta.java_lang_String.allocateReferenceArray(0)); meta.java_lang_AssertionStatusDirectives_classEnabled.set(instance, meta._boolean.allocatePrimitiveArray(0)); meta.java_lang_AssertionStatusDirectives_packages.set(instance, meta.java_lang_String.allocateReferenceArray(0)); @@ -2602,7 +2623,7 @@ private boolean isTrustedLoader(StaticObject loader) { private static boolean isIgnoredBySecurityStackWalk(Method m, Meta meta) { Klass holderKlass = m.getDeclaringKlass(); - if (holderKlass == meta.java_lang_reflect_Method && m.getName() == Name.invoke) { + if (holderKlass == meta.java_lang_reflect_Method && m.getName() == Names.invoke) { return true; } if (meta.sun_reflect_MethodAccessorImpl.isAssignableFrom(holderKlass)) { @@ -2925,7 +2946,7 @@ private static long getFrameId(FrameInstance frame, EspressoContext espressoCont acc = createDummyACC(); } } - Method run = action.getKlass().lookupMethod(Name.run, Signature.Object); + Method run = action.getKlass().lookupMethod(Names.run, Signatures.Object); if (run == null || !run.isPublic() || run.isStatic()) { profiler.profile(1); throw meta.throwException(meta.java_lang_InternalError); @@ -2981,7 +3002,7 @@ public StaticObject visitFrame(FrameInstance frameInstance) { StaticObject stackContext = null; StaticObject domainKlass = null; if (m.getDeclaringKlass() == getMeta().java_security_AccessController && - m.getName() == Name.executePrivileged) { + m.getName() == Names.executePrivileged) { isPrivileged[0] = true; Frame frame = frameInstance.getFrame(FrameInstance.FrameAccess.READ_ONLY); // 2nd argument: `AccessControlContext context` @@ -3073,11 +3094,11 @@ public StaticObject visitFrame(FrameInstance frameInstance) { StaticObject loader = holder.getDefiningClassLoader(); // if (loader != NULL && !SystemDictionary::is_ext_class_loader(loader)) if (getJavaVersion().java8OrEarlier()) { - if (StaticObject.notNull(loader) && !Type.sun_misc_Launcher$ExtClassLoader.equals(loader.getKlass().getType())) { + if (StaticObject.notNull(loader) && !Types.sun_misc_Launcher$ExtClassLoader.equals(loader.getKlass().getType())) { return loader; } } else { - if (StaticObject.notNull(loader) && !Type.jdk_internal_loader_ClassLoaders$PlatformClassLoader.equals(loader.getKlass().getType())) { + if (StaticObject.notNull(loader) && !Types.jdk_internal_loader_ClassLoaders$PlatformClassLoader.equals(loader.getKlass().getType())) { return loader; } } @@ -3226,7 +3247,7 @@ public Integer visitFrame(FrameInstance frameInstance) { @Inject Meta meta, @Inject SubstitutionProfiler profiler) { assert meta.java_lang_reflect_Executable.isAssignableFrom(executable.getKlass()); - StaticObject parameterTypes = (StaticObject) executable.getKlass().lookupMethod(Name.getParameterTypes, Signature.Class_array).invokeDirect(executable); + StaticObject parameterTypes = (StaticObject) executable.getKlass().lookupMethod(Names.getParameterTypes, Signatures.Class_array).invokeDirect(executable); int numParams = parameterTypes.length(language); if (numParams == 0) { return StaticObject.NULL; @@ -3242,7 +3263,7 @@ public Integer visitFrame(FrameInstance frameInstance) { throw EspressoError.shouldNotReachHere(); } - MethodParametersAttribute methodParameters = (MethodParametersAttribute) method.getAttribute(Name.MethodParameters); + MethodParametersAttribute methodParameters = (MethodParametersAttribute) method.getAttribute(Names.MethodParameters); if (methodParameters == null) { return StaticObject.NULL; @@ -3268,11 +3289,11 @@ public Integer visitFrame(FrameInstance frameInstance) { // TODO(peterssen): Cache guest j.l.reflect.Parameter constructor. // Calling the constructor is just for validation, manually setting the fields would // be faster. - Method parameterInit = meta.java_lang_reflect_Parameter.lookupDeclaredMethod(Name._init_, getSignatures().makeRaw(Type._void, - /* name */ Type.java_lang_String, - /* modifiers */ Type._int, - /* executable */ Type.java_lang_reflect_Executable, - /* index */ Type._int)); + Method parameterInit = meta.java_lang_reflect_Parameter.lookupDeclaredMethod(Names._init_, getSignatures().makeRaw(Types._void, + /* name */ Types.java_lang_String, + /* modifiers */ Types._int, + /* executable */ Types.java_lang_reflect_Executable, + /* index */ Types._int)); // Use attribute's number of parameters. return meta.java_lang_reflect_Parameter.allocateReferenceArray(methodParameters.getEntries().length, new IntFunction() { @@ -3283,7 +3304,7 @@ public StaticObject apply(int index) { // For a 0 index, give an empty name. StaticObject guestName; if (entry.getNameIndex() != 0) { - guestName = meta.toGuestString(method.getConstantPool().symbolAt(entry.getNameIndex(), "parameter name").toString()); + guestName = meta.toGuestString(method.getConstantPool().symbolAtUnsafe(entry.getNameIndex(), "parameter name").toString()); } else { guestName = getJavaVersion().java9OrLater() ? StaticObject.NULL : meta.toGuestString(""); } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/continuation/HostFrameRecord.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/continuation/HostFrameRecord.java index bfa3befddf12..2bc0f97494e0 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/continuation/HostFrameRecord.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/continuation/HostFrameRecord.java @@ -35,11 +35,11 @@ import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; import com.oracle.truffle.espresso.classfile.constantpool.MethodRefConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.Meta; import com.oracle.truffle.espresso.nodes.EspressoFrame; @@ -141,7 +141,7 @@ public boolean verify(Meta meta, boolean single) { // Compatible method reference guarantee(next.methodVersion.getName() == name && next.methodVersion.getRawSignature() == signature, "Wrong method on the recorded frames", meta); // Loading constraints are respected - Symbol returnType = Signatures.returnType(next.methodVersion.getMethod().getParsedSignature()); + Symbol returnType = SignatureSymbols.returnType(next.methodVersion.getMethod().getParsedSignature()); EspressoContext context = meta.getContext(); context.getRegistries().checkLoadingConstraint(returnType, methodVersion.getDeclaringKlass().getDefiningClassLoader(), diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/Analysis.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/Analysis.java index fb294d58c657..bdd9fe829781 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/Analysis.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/Analysis.java @@ -235,11 +235,11 @@ import com.oracle.truffle.espresso.classfile.bytecode.BytecodeStream; import com.oracle.truffle.espresso.classfile.bytecode.BytecodeSwitch; import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; +import com.oracle.truffle.espresso.classfile.descriptors.Type; import com.oracle.truffle.espresso.impl.LanguageAccess; import com.oracle.truffle.espresso.impl.Method; @@ -624,11 +624,11 @@ private void processInstr(int bci, int nextBci) { case INVOKEINTERFACE: case INVOKEDYNAMIC: { Symbol[] parsed = getInvokeSignature(bci, opcode); - stack.pop(Signatures.slotsForParameters(parsed)); + stack.pop(SignatureSymbols.slotsForParameters(parsed)); if (!(opcode == INVOKESTATIC || opcode == INVOKEDYNAMIC)) { stack.pop(); // receiver } - stack.push(bci, StackType.forType(Signatures.returnType(parsed))); + stack.push(bci, StackType.forType(SignatureSymbols.returnType(parsed))); break; } diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/ExtendedNPEMessage.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/ExtendedNPEMessage.java index 1ab7f9b8e6ab..26283e563bda 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/ExtendedNPEMessage.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/ExtendedNPEMessage.java @@ -23,7 +23,7 @@ package com.oracle.truffle.espresso.vm.npe; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Types; import com.oracle.truffle.espresso.runtime.EspressoContext; import com.oracle.truffle.espresso.runtime.staticobject.StaticObject; import com.oracle.truffle.espresso.vm.VM; @@ -50,7 +50,7 @@ public static String getNPEMessage(StaticObject throwable) { return null; } // If this NPE was created via reflection, we have no real NPE. - if (top.getMethod().getDeclaringKlass().getType() == Symbol.Type.jdk_internal_reflect_NativeConstructorAccessorImpl) { + if (top.getMethod().getDeclaringKlass().getType() == Types.jdk_internal_reflect_NativeConstructorAccessorImpl) { return null; } try { diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/MessageBuildHelper.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/MessageBuildHelper.java index 715f2dff0d4f..886cd7d6d8f1 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/MessageBuildHelper.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/MessageBuildHelper.java @@ -77,12 +77,13 @@ import com.oracle.truffle.espresso.classfile.bytecode.Bytecodes; import com.oracle.truffle.espresso.classfile.constantpool.FieldRefConstant; import com.oracle.truffle.espresso.classfile.constantpool.MethodRefConstant; -import com.oracle.truffle.espresso.classfile.descriptors.Signatures; +import com.oracle.truffle.espresso.classfile.descriptors.Name; +import com.oracle.truffle.espresso.classfile.descriptors.Signature; +import com.oracle.truffle.espresso.classfile.descriptors.SignatureSymbols; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Name; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Signature; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; +import com.oracle.truffle.espresso.descriptors.EspressoSymbols.Names; import com.oracle.truffle.espresso.impl.Method; import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.meta.MetaUtil; @@ -309,10 +310,10 @@ private static void appendClassName(StringBuilder sb, String className) { sb.append(n); } - private static void appendSignature(Signatures signatures, StringBuilder sb, Symbol signature) { - Symbol[] sig = signatures.parsed(signature); + private static void appendSignature(SignatureSymbols signatureSymbols, StringBuilder sb, Symbol signature) { + Symbol[] sig = signatureSymbols.parsed(signature); boolean first = true; - for (int i = 0; i < Signatures.parameterCount(sig); i++) { + for (int i = 0; i < SignatureSymbols.parameterCount(sig); i++) { Symbol type = sig[i]; if (!first) { sb.append(", "); @@ -350,9 +351,9 @@ private static void appendLocalVar(Analysis analysis, StringBuilder sb, int bci, int currentSlot = m.isStatic() ? 0 : 1; int paramIndex = 1; Symbol[] sig = m.getParsedSignature(); - for (int i = 0; i < Signatures.parameterCount(sig); i++) { - Symbol type = Signatures.parameterType(sig, i); - int slots = Types.slotCount(type); + for (int i = 0; i < SignatureSymbols.parameterCount(sig); i++) { + Symbol type = SignatureSymbols.parameterType(sig, i); + int slots = TypeSymbols.slotCount(type); if ((slot >= currentSlot) && (slot < currentSlot + slots)) { sb.append(""); return; @@ -395,7 +396,7 @@ static int getSlot(Analysis analysis, int bci) { case DASTORE: return 3; case PUTFIELD: - return Types.slotCount(analysis.getFieldType(bci)); + return TypeSymbols.slotCount(analysis.getFieldType(bci)); case INVOKEVIRTUAL: case INVOKESPECIAL: case INVOKEINTERFACE: @@ -403,10 +404,10 @@ static int getSlot(Analysis analysis, int bci) { // Assume the call of a constructor can never cause a NullPointerException // (which is true in Java). This is mainly used to avoid generating wrong // messages for NullPointerExceptions created explicitly by new in Java code. - if (name == Name._init_) { + if (name == Names._init_) { return EXPLICIT_NPE; } else { - return Signatures.slotsForParameters(analysis.getInvokeSignature(bci, opcode)); + return SignatureSymbols.slotsForParameters(analysis.getInvokeSignature(bci, opcode)); } } return INVALID_BYTECODE; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/StackType.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/StackType.java index c38982ed8b01..5e980bf65a15 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/StackType.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/vm/npe/StackType.java @@ -139,8 +139,8 @@ import com.oracle.truffle.espresso.classfile.ConstantPool; import com.oracle.truffle.espresso.classfile.JavaKind; import com.oracle.truffle.espresso.classfile.descriptors.Symbol; -import com.oracle.truffle.espresso.classfile.descriptors.Symbol.Type; -import com.oracle.truffle.espresso.classfile.descriptors.Types; +import com.oracle.truffle.espresso.classfile.descriptors.Type; +import com.oracle.truffle.espresso.classfile.descriptors.TypeSymbols; import com.oracle.truffle.espresso.meta.EspressoError; enum StackType { @@ -169,10 +169,10 @@ int slots() { } static StackType forType(Symbol type) { - if (Types.isArray(type)) { + if (TypeSymbols.isArray(type)) { return ARRAY; } - return forJavaKind(Types.getJavaKind(type)); + return forJavaKind(TypeSymbols.getJavaKind(type)); } private static StackType forJavaKind(JavaKind javaKind) {