From ab0381f0829e01c7008be41d2a0e37d99a5dbdd8 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Tue, 13 Aug 2024 14:16:26 -0500 Subject: [PATCH] Upgrade to IKVM.ByteCode 9. --- IKVM.deps.targets | 2 +- src/IKVM.Runtime/AttributeHelper.cs | 18 ++++++----------- .../ClassFile.ConstantPoolItemClass.cs | 2 +- .../ClassFile.ConstantPoolItemDouble.cs | 2 +- .../ClassFile.ConstantPoolItemFieldref.cs | 2 +- .../ClassFile.ConstantPoolItemFloat.cs | 2 +- .../ClassFile.ConstantPoolItemInteger.cs | 2 +- ...File.ConstantPoolItemInterfaceMethodref.cs | 2 +- ...ClassFile.ConstantPoolItemInvokeDynamic.cs | 2 +- .../ClassFile.ConstantPoolItemLong.cs | 2 +- .../ClassFile.ConstantPoolItemMethodHandle.cs | 2 +- .../ClassFile.ConstantPoolItemMethodType.cs | 2 +- .../ClassFile.ConstantPoolItemMethodref.cs | 2 +- .../ClassFile.ConstantPoolItemNameAndType.cs | 2 +- .../ClassFile.ConstantPoolItemString.cs | 2 +- src/IKVM.Runtime/ClassFile.Field.cs | 8 ++++---- src/IKVM.Runtime/ClassFile.FieldOrMethod.cs | 2 +- src/IKVM.Runtime/ClassFile.Method.Code.cs | 6 +++--- src/IKVM.Runtime/ClassFile.Method.cs | 12 +++++------ src/IKVM.Runtime/ClassFile.cs | 20 +++++++++---------- src/IKVM.Runtime/JNI/JNIEnv.cs | 2 +- src/IKVM.Runtime/JNI/JavaVM.cs | 2 +- .../Java/Externs/java/lang/ClassLoader.cs | 8 ++++---- .../Java/Externs/sun/misc/Unsafe.cs | 6 +++--- .../RuntimeByteCodeJavaType.FinishContext.cs | 7 ++----- .../RuntimeByteCodeJavaType.Metadata.cs | 4 ++-- src/IKVM.Runtime/RuntimeContext.cs | 1 + .../CompilerClassLoader.cs | 7 +++---- .../IkvmImporterInternal.cs | 6 +++--- src/IKVM.Util/IKVM.Util.csproj | 2 +- 30 files changed, 65 insertions(+), 74 deletions(-) diff --git a/IKVM.deps.targets b/IKVM.deps.targets index c02968190a..58729fa982 100644 --- a/IKVM.deps.targets +++ b/IKVM.deps.targets @@ -1,7 +1,7 @@ - + diff --git a/src/IKVM.Runtime/AttributeHelper.cs b/src/IKVM.Runtime/AttributeHelper.cs index a9006a19ed..a8da1548c4 100644 --- a/src/IKVM.Runtime/AttributeHelper.cs +++ b/src/IKVM.Runtime/AttributeHelper.cs @@ -23,26 +23,20 @@ Jeroen Frijters */ using System; using System.Collections.Generic; - -using IKVM.Attributes; - -using System.Runtime.CompilerServices; +using System.ComponentModel; using System.Diagnostics; +using System.Runtime.CompilerServices; -using IKVM.ByteCode.Reading; - -using System.ComponentModel; +using IKVM.Attributes; +using IKVM.ByteCode.Buffers; +using IKVM.ByteCode.Decoding; +using IKVM.ByteCode.Encoding; #if IMPORTER || EXPORTER using IKVM.Reflection; using IKVM.Reflection.Emit; using Type = IKVM.Reflection.Type; -using IKVM.ByteCode.Writing; -using IKVM.ByteCode.Buffers; - - - #else using System.Reflection; using System.Reflection.Emit; diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs index 59220118b0..06c0e92ab1 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs @@ -23,7 +23,7 @@ Jeroen Frijters */ using System; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs index 941bffcc39..97c86ccaa6 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs @@ -24,7 +24,7 @@ Jeroen Frijters using System; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs index 920cba26c3..4ff50358ce 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs @@ -25,7 +25,7 @@ Jeroen Frijters using System; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFloat.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFloat.cs index 06a10af11c..f7d6b0f323 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemFloat.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemFloat.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInteger.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInteger.cs index f905f5f44b..a3c44a75ba 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInteger.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInteger.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs index 14556c893f..aea2883701 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInterfaceMethodref.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs index 020fea7ae5..35ad95e918 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemInvokeDynamic.cs @@ -24,7 +24,7 @@ Jeroen Frijters using System; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemLong.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemLong.cs index 0824c54c9a..7aabd4172c 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemLong.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemLong.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs index d374ca30bd..6a0fb79437 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs @@ -25,7 +25,7 @@ Jeroen Frijters using System; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs index edc5edc061..b17327c9e6 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodref.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodref.cs index 028c072569..a65004c274 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodref.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodref.cs @@ -22,7 +22,7 @@ Jeroen Frijters */ using IKVM.Attributes; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; using IKVM.Runtime; namespace IKVM.Runtime diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemNameAndType.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemNameAndType.cs index e283345641..49d5e91e18 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemNameAndType.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemNameAndType.cs @@ -23,7 +23,7 @@ Jeroen Frijters */ using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.ConstantPoolItemString.cs b/src/IKVM.Runtime/ClassFile.ConstantPoolItemString.cs index af8c4cb491..f8e8ca6cf3 100644 --- a/src/IKVM.Runtime/ClassFile.ConstantPoolItemString.cs +++ b/src/IKVM.Runtime/ClassFile.ConstantPoolItemString.cs @@ -23,7 +23,7 @@ Jeroen Frijters */ using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.Field.cs b/src/IKVM.Runtime/ClassFile.Field.cs index 8de3d79a9d..fb6dc3ab99 100644 --- a/src/IKVM.Runtime/ClassFile.Field.cs +++ b/src/IKVM.Runtime/ClassFile.Field.cs @@ -25,7 +25,7 @@ Jeroen Frijters using IKVM.Attributes; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { @@ -46,7 +46,7 @@ internal sealed class Field : FieldOrMethod /// /// /// - internal Field(ClassFile classFile, string[] utf8_cp, IKVM.ByteCode.Reading.Field field) : + internal Field(ClassFile classFile, string[] utf8_cp, IKVM.ByteCode.Decoding.Field field) : base(classFile, utf8_cp, field.AccessFlags, field.Name, field.Descriptor) { if ((IsPrivate && IsPublic) || (IsPrivate && IsProtected) || (IsPublic && IsProtected) || (IsFinal && IsVolatile) || (classFile.IsInterface && (!IsPublic || !IsStatic || !IsFinal || IsTransient))) @@ -105,7 +105,7 @@ internal Field(ClassFile classFile, string[] utf8_cp, IKVM.ByteCode.Reading.Fiel if (classFile.MajorVersion < 49) goto default; - var _signature = (IKVM.ByteCode.Reading.SignatureAttribute)attribute; + var _signature = (IKVM.ByteCode.Decoding.SignatureAttribute)attribute; signature = classFile.GetConstantPoolUtf8String(utf8_cp, _signature.Signature); break; case AttributeName.RuntimeVisibleAnnotations: @@ -139,7 +139,7 @@ internal Field(ClassFile classFile, string[] utf8_cp, IKVM.ByteCode.Reading.Fiel if (classFile.MajorVersion < 52) goto default; - var _runtimeVisibleTypeAnnotations = (IKVM.ByteCode.Reading.RuntimeVisibleTypeAnnotationsAttribute)attribute; + var _runtimeVisibleTypeAnnotations = (IKVM.ByteCode.Decoding.RuntimeVisibleTypeAnnotationsAttribute)attribute; classFile.CreateUtf8ConstantPoolItems(utf8_cp); runtimeVisibleTypeAnnotations = _runtimeVisibleTypeAnnotations.TypeAnnotations; break; diff --git a/src/IKVM.Runtime/ClassFile.FieldOrMethod.cs b/src/IKVM.Runtime/ClassFile.FieldOrMethod.cs index 6d6e75733b..9f91bbe353 100644 --- a/src/IKVM.Runtime/ClassFile.FieldOrMethod.cs +++ b/src/IKVM.Runtime/ClassFile.FieldOrMethod.cs @@ -25,7 +25,7 @@ Jeroen Frijters using IKVM.Attributes; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/ClassFile.Method.Code.cs b/src/IKVM.Runtime/ClassFile.Method.Code.cs index 1dad999dd8..1ef6606c44 100644 --- a/src/IKVM.Runtime/ClassFile.Method.Code.cs +++ b/src/IKVM.Runtime/ClassFile.Method.Code.cs @@ -26,7 +26,7 @@ Jeroen Frijters using System.Collections.Generic; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { @@ -165,7 +165,7 @@ internal void Read(ClassFile classFile, string[] utf8_cp, Method method, CodeAtt switch (classFile.GetConstantPoolUtf8String(utf8_cp, _attribute.Name)) { case AttributeName.LineNumberTable: - var lnt = (IKVM.ByteCode.Reading.LineNumberTableAttribute)_attribute; + var lnt = (IKVM.ByteCode.Decoding.LineNumberTableAttribute)_attribute; if ((options & ClassFileParseOptions.LineNumberTable) != 0) { lineNumberTable = new LineNumberTableEntry[lnt.LineNumbers.Count]; @@ -180,7 +180,7 @@ internal void Read(ClassFile classFile, string[] utf8_cp, Method method, CodeAtt } break; case AttributeName.LocalVariableTable: - var lvt = (IKVM.ByteCode.Reading.LocalVariableTableAttribute)_attribute; + var lvt = (IKVM.ByteCode.Decoding.LocalVariableTableAttribute)_attribute; if ((options & ClassFileParseOptions.LocalVariableTable) != 0) { localVariableTable = new LocalVariableTableEntry[lvt.LocalVariables.Count]; diff --git a/src/IKVM.Runtime/ClassFile.Method.cs b/src/IKVM.Runtime/ClassFile.Method.cs index 7101a7620a..140e0b1d3b 100644 --- a/src/IKVM.Runtime/ClassFile.Method.cs +++ b/src/IKVM.Runtime/ClassFile.Method.cs @@ -23,7 +23,7 @@ Jeroen Frijters */ using IKVM.Attributes; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; #if IMPORTER using IKVM.Tools.Importer; @@ -51,7 +51,7 @@ internal sealed partial class Method : FieldOrMethod /// /// /// - internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions options, IKVM.ByteCode.Reading.Method reader) : + internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions options, IKVM.ByteCode.Decoding.Method reader) : base(classFile, utf8_cp, reader.AccessFlags, reader.Name, reader.Descriptor) { // vmspec 4.6 says that all flags, except ACC_STRICT are ignored on @@ -110,7 +110,7 @@ internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions opt if (classFile.MajorVersion < 49) goto default; - var signatureAttribute = (IKVM.ByteCode.Reading.SignatureAttribute)attribute; + var signatureAttribute = (IKVM.ByteCode.Decoding.SignatureAttribute)attribute; signature = classFile.GetConstantPoolUtf8String(utf8_cp, signatureAttribute.Signature); break; case AttributeName.RuntimeVisibleAnnotations: @@ -163,7 +163,7 @@ internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions opt if (classFile.MajorVersion < 49) goto default; - var annotationDefaultAttribute = (IKVM.ByteCode.Reading.AnnotationDefaultAttribute)attribute; + var annotationDefaultAttribute = (IKVM.ByteCode.Decoding.AnnotationDefaultAttribute)attribute; low ??= new LowFreqData(); low.annotationDefault = ReadAnnotationElementValue(annotationDefaultAttribute.DefaultValue, classFile, utf8_cp); @@ -224,7 +224,7 @@ internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions opt if (parameters != null) throw new ClassFormatError("{0} (Duplicate MethodParameters attribute)", classFile.Name); - var methodParametersAttribute = (IKVM.ByteCode.Reading.MethodParametersAttribute)attribute; + var methodParametersAttribute = (IKVM.ByteCode.Decoding.MethodParametersAttribute)attribute; parameters = ReadMethodParameters(methodParametersAttribute.Parameters, utf8_cp); break; @@ -232,7 +232,7 @@ internal Method(ClassFile classFile, string[] utf8_cp, ClassFileParseOptions opt if (classFile.MajorVersion < 52) goto default; - var runtimeVisibleTypeAnnotationsAttribute = (IKVM.ByteCode.Reading.RuntimeVisibleTypeAnnotationsAttribute)attribute; + var runtimeVisibleTypeAnnotationsAttribute = (IKVM.ByteCode.Decoding.RuntimeVisibleTypeAnnotationsAttribute)attribute; classFile.CreateUtf8ConstantPoolItems(utf8_cp); runtimeVisibleTypeAnnotations = runtimeVisibleTypeAnnotationsAttribute.TypeAnnotations; break; diff --git a/src/IKVM.Runtime/ClassFile.cs b/src/IKVM.Runtime/ClassFile.cs index aa73d648e9..c96720f3ec 100644 --- a/src/IKVM.Runtime/ClassFile.cs +++ b/src/IKVM.Runtime/ClassFile.cs @@ -27,7 +27,7 @@ Jeroen Frijters using IKVM.Attributes; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; namespace IKVM.Runtime { @@ -45,7 +45,7 @@ sealed partial class ClassFile : IDisposable const ushort FLAG_MODULE_INITIALIZER = 0x8000; readonly RuntimeContext context; - readonly IKVM.ByteCode.Reading.ClassFile clazz; + readonly IKVM.ByteCode.Decoding.ClassFile clazz; readonly ConstantPoolItem[] constantpool; readonly string[] utf8_cp; @@ -82,7 +82,7 @@ internal static string GetClassName(byte[] bytes, int offset, int length, out bo { try { - using var clazz = IKVM.ByteCode.Reading.ClassFile.Read(bytes.AsMemory(offset, length)); + using var clazz = IKVM.ByteCode.Decoding.ClassFile.Read(bytes.AsMemory(offset, length)); return GetClassName(clazz, out isstub); } catch (UnsupportedClassVersionException e) @@ -103,7 +103,7 @@ internal static string GetClassName(byte[] bytes, int offset, int length, out bo /// /// /// - static string GetClassName(IKVM.ByteCode.Reading.ClassFile reader, out bool isstub) + static string GetClassName(IKVM.ByteCode.Decoding.ClassFile reader, out bool isstub) { if (reader.Version < new ClassFormatVersion(45, 3) || reader.Version > 52) throw new UnsupportedClassVersionError(reader.Version); @@ -126,7 +126,7 @@ static string GetClassName(IKVM.ByteCode.Reading.ClassFile reader, out bool isst /// /// /// - internal ClassFile(RuntimeContext context, IKVM.ByteCode.Reading.ClassFile clazz, string inputClassName, ClassFileParseOptions options, object[] constantPoolPatches) + internal ClassFile(RuntimeContext context, IKVM.ByteCode.Decoding.ClassFile clazz, string inputClassName, ClassFileParseOptions options, object[] constantPoolPatches) { this.context = context ?? throw new ArgumentNullException(nameof(context)); this.clazz = clazz ?? throw new ArgumentNullException(nameof(clazz)); @@ -306,7 +306,7 @@ internal ClassFile(RuntimeContext context, IKVM.ByteCode.Reading.ClassFile clazz flags |= FLAG_MASK_DEPRECATED; break; case AttributeName.SourceFile: - var sourceFileAttribute = (IKVM.ByteCode.Reading.SourceFileAttribute)attribute; + var sourceFileAttribute = (IKVM.ByteCode.Decoding.SourceFileAttribute)attribute; sourceFile = GetConstantPoolUtf8String(utf8_cp, sourceFileAttribute.SourceFile); break; case AttributeName.InnerClasses: @@ -348,14 +348,14 @@ internal ClassFile(RuntimeContext context, IKVM.ByteCode.Reading.ClassFile clazz if (clazz.Version < 49) goto default; - var signatureAttribute = (IKVM.ByteCode.Reading.SignatureAttribute)attribute; + var signatureAttribute = (IKVM.ByteCode.Decoding.SignatureAttribute)attribute; signature = GetConstantPoolUtf8String(utf8_cp, signatureAttribute.Signature); break; case AttributeName.EnclosingMethod: if (clazz.Version < 49) goto default; - var enclosingMethodAttribute = (IKVM.ByteCode.Reading.EnclosingMethodAttribute)attribute; + var enclosingMethodAttribute = (IKVM.ByteCode.Decoding.EnclosingMethodAttribute)attribute; var classHandle = enclosingMethodAttribute.Class; var methodHandle = enclosingMethodAttribute.Method; ValidateConstantPoolItemClass(inputClassName, classHandle); @@ -418,7 +418,7 @@ internal ClassFile(RuntimeContext context, IKVM.ByteCode.Reading.ClassFile clazz if (clazz.Version < 52) goto default; - var _runtimeVisibleTypeAnnotations = (IKVM.ByteCode.Reading.RuntimeVisibleTypeAnnotationsAttribute)attribute; + var _runtimeVisibleTypeAnnotations = (IKVM.ByteCode.Decoding.RuntimeVisibleTypeAnnotationsAttribute)attribute; CreateUtf8ConstantPoolItems(utf8_cp); runtimeVisibleTypeAnnotations = _runtimeVisibleTypeAnnotations.TypeAnnotations; break; @@ -612,7 +612,7 @@ static object[][] ReadAnnotations(AnnotationTable reader, ClassFile classFile, s return annotations; } - static object[] ReadAnnotation(IKVM.ByteCode.Reading.Annotation annotation, ClassFile classFile, string[] utf8_cp) + static object[] ReadAnnotation(IKVM.ByteCode.Decoding.Annotation annotation, ClassFile classFile, string[] utf8_cp) { var l = new object[2 + annotation.Elements.Count * 2]; l[0] = IKVM.Attributes.AnnotationDefaultAttribute.TAG_ANNOTATION; diff --git a/src/IKVM.Runtime/JNI/JNIEnv.cs b/src/IKVM.Runtime/JNI/JNIEnv.cs index 9fedb25c4e..9a339b68ec 100644 --- a/src/IKVM.Runtime/JNI/JNIEnv.cs +++ b/src/IKVM.Runtime/JNI/JNIEnv.cs @@ -30,7 +30,7 @@ Jeroen Frijters using System.Runtime.InteropServices; using System.Runtime.Serialization; -using IKVM.ByteCode.Encoding; +using IKVM.ByteCode.Text; using IKVM.Runtime.Extensions; namespace IKVM.Runtime.JNI diff --git a/src/IKVM.Runtime/JNI/JavaVM.cs b/src/IKVM.Runtime/JNI/JavaVM.cs index 280060c1d9..79a7c736c9 100644 --- a/src/IKVM.Runtime/JNI/JavaVM.cs +++ b/src/IKVM.Runtime/JNI/JavaVM.cs @@ -24,7 +24,7 @@ Jeroen Frijters using System; using System.Runtime.InteropServices; -using IKVM.ByteCode.Encoding; +using IKVM.ByteCode.Text; using IKVM.Runtime.Extensions; namespace IKVM.Runtime.JNI diff --git a/src/IKVM.Runtime/Java/Externs/java/lang/ClassLoader.cs b/src/IKVM.Runtime/Java/Externs/java/lang/ClassLoader.cs index 08b81191cf..22c39fa46d 100644 --- a/src/IKVM.Runtime/Java/Externs/java/lang/ClassLoader.cs +++ b/src/IKVM.Runtime/Java/Externs/java/lang/ClassLoader.cs @@ -27,7 +27,7 @@ Jeroen Frijters using System.Runtime.InteropServices; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Encoding; using IKVM.Runtime; using sun.nio.ch; @@ -119,11 +119,11 @@ public static void registerNatives() /// /// /// - static IKVM.ByteCode.Reading.ClassFile ReadClass(byte[] buffer) + static IKVM.ByteCode.Decoding.ClassFile ReadClass(byte[] buffer) { try { - return IKVM.ByteCode.Reading.ClassFile.Read(buffer); + return IKVM.ByteCode.Decoding.ClassFile.Read(buffer); } catch (InvalidClassMagicException) { @@ -144,7 +144,7 @@ static IKVM.ByteCode.Reading.ClassFile ReadClass(byte[] buffer) /// /// /// - static global::java.lang.Class DefineClass(global::java.lang.ClassLoader self, string name, IKVM.ByteCode.Reading.ClassFile clazz, global::java.security.ProtectionDomain pd, string source) + static global::java.lang.Class DefineClass(global::java.lang.ClassLoader self, string name, IKVM.ByteCode.Decoding.ClassFile clazz, global::java.security.ProtectionDomain pd, string source) { try { diff --git a/src/IKVM.Runtime/Java/Externs/sun/misc/Unsafe.cs b/src/IKVM.Runtime/Java/Externs/sun/misc/Unsafe.cs index 3c269a14ec..76799123dc 100644 --- a/src/IKVM.Runtime/Java/Externs/sun/misc/Unsafe.cs +++ b/src/IKVM.Runtime/Java/Externs/sun/misc/Unsafe.cs @@ -9,7 +9,7 @@ using System.Threading; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Encoding; using IKVM.Runtime; namespace IKVM.Java.Externs.sun.misc @@ -1697,11 +1697,11 @@ public static int pageSize(object self) /// /// /// - static IKVM.ByteCode.Reading.ClassFile ReadClass(byte[] buffer) + static IKVM.ByteCode.Encoding.ClassFile ReadClass(byte[] buffer) { try { - return IKVM.ByteCode.Reading.ClassFile.Read(buffer); + return IKVM.ByteCode.Encoding.ClassFile.Read(buffer); } catch (InvalidClassMagicException) { diff --git a/src/IKVM.Runtime/RuntimeByteCodeJavaType.FinishContext.cs b/src/IKVM.Runtime/RuntimeByteCodeJavaType.FinishContext.cs index 5008c887fb..4b8c105073 100644 --- a/src/IKVM.Runtime/RuntimeByteCodeJavaType.FinishContext.cs +++ b/src/IKVM.Runtime/RuntimeByteCodeJavaType.FinishContext.cs @@ -25,12 +25,9 @@ Jeroen Frijters using System.Collections.Generic; using System.Diagnostics; -using IKVM.ByteCode.Reading; using IKVM.Attributes; using IKVM.ByteCode; -using System.ComponentModel; - - +using IKVM.ByteCode.Decoding; #if IMPORTER using IKVM.Reflection; @@ -843,7 +840,7 @@ static void MarkConstantPoolUsage(ClassFile classFile, ref readonly TypeAnnotati } } - static void MarkConstantPoolUsageForAnnotation(ref readonly IKVM.ByteCode.Reading.Annotation annotation, bool[] inUse) + static void MarkConstantPoolUsageForAnnotation(ref readonly IKVM.ByteCode.Decoding.Annotation annotation, bool[] inUse) { inUse[annotation.Type.Slot] = true; diff --git a/src/IKVM.Runtime/RuntimeByteCodeJavaType.Metadata.cs b/src/IKVM.Runtime/RuntimeByteCodeJavaType.Metadata.cs index 4f4a56d71d..7a9f4745e5 100644 --- a/src/IKVM.Runtime/RuntimeByteCodeJavaType.Metadata.cs +++ b/src/IKVM.Runtime/RuntimeByteCodeJavaType.Metadata.cs @@ -22,8 +22,8 @@ Jeroen Frijters */ using IKVM.ByteCode.Buffers; -using IKVM.ByteCode.Reading; -using IKVM.ByteCode.Writing; +using IKVM.ByteCode.Decoding; +using IKVM.ByteCode.Encoding; namespace IKVM.Runtime { diff --git a/src/IKVM.Runtime/RuntimeContext.cs b/src/IKVM.Runtime/RuntimeContext.cs index ed9e4fe051..e2ef4cdc49 100644 --- a/src/IKVM.Runtime/RuntimeContext.cs +++ b/src/IKVM.Runtime/RuntimeContext.cs @@ -197,6 +197,7 @@ T GetOrCreateSingleton(ref T value, Func create) /// /// Gets the associated with this instance of the runtime. /// + /// public CompilerFactory CompilerFactory => GetOrCreateSingleton(ref compilerFactory, () => new CompilerFactory(this, bootstrap)); /// diff --git a/src/IKVM.Tools.Importer/CompilerClassLoader.cs b/src/IKVM.Tools.Importer/CompilerClassLoader.cs index 1fc3bb4e40..b03d8b4388 100644 --- a/src/IKVM.Tools.Importer/CompilerClassLoader.cs +++ b/src/IKVM.Tools.Importer/CompilerClassLoader.cs @@ -35,7 +35,6 @@ Jeroen Frijters using IKVM.Attributes; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; using IKVM.Reflection; using IKVM.Reflection.Emit; using IKVM.Runtime; @@ -289,7 +288,7 @@ RuntimeJavaType GetTypeWrapperCompilerHook(string name) try { - f = new IKVM.Runtime.ClassFile(Context, IKVM.ByteCode.Reading.ClassFile.Read(itemRef.GetData()), name, ClassFileParseOptions, null); + f = new IKVM.Runtime.ClassFile(Context, IKVM.ByteCode.Decoding.ClassFile.Read(itemRef.GetData()), name, ClassFileParseOptions, null); } catch (UnsupportedClassVersionException e) { @@ -2654,7 +2653,7 @@ static int CreateCompiler(RuntimeContext context, StaticCompiler compiler, Compi { try { - var f = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Reading.ClassFile.Read(assemblyType.GetData()), null, ClassFileParseOptions.None, null); + var f = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Decoding.ClassFile.Read(assemblyType.GetData()), null, ClassFileParseOptions.None, null); // NOTE the "assembly" type in the unnamed package is a magic type // that acts as the placeholder for assembly attributes @@ -2685,7 +2684,7 @@ static int CreateCompiler(RuntimeContext context, StaticCompiler compiler, Compi { try { - var f = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Reading.ClassFile.Read(h[className].GetData()), null, ClassFileParseOptions.None, null); + var f = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Decoding.ClassFile.Read(h[className].GetData()), null, ClassFileParseOptions.None, null); if (f.Name == className) { foreach (var m in f.Methods) diff --git a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs index b611fd7769..96da26085b 100644 --- a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs +++ b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs @@ -29,7 +29,7 @@ Jeroen Frijters using System.Threading; using IKVM.ByteCode; -using IKVM.ByteCode.Reading; +using IKVM.ByteCode.Decoding; using IKVM.Reflection; using IKVM.Reflection.Emit; using IKVM.Runtime; @@ -1176,7 +1176,7 @@ static bool EmitStubWarning(RuntimeContext context, StaticCompiler compiler, Com try { - cf = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Reading.ClassFile.Read(buf), "", ClassFileParseOptions.None, null); + cf = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Decoding.ClassFile.Read(buf), "", ClassFileParseOptions.None, null); } catch (ClassFormatError) { @@ -1424,7 +1424,7 @@ static void ProcessAttributeAnnotationsClass(RuntimeContext context, ref object[ try { using var file = File.OpenRead(filename); - var cf = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Reading.ClassFile.Read(file), null, ClassFileParseOptions.None, null); + var cf = new IKVM.Runtime.ClassFile(context, IKVM.ByteCode.Decoding.ClassFile.Read(file), null, ClassFileParseOptions.None, null); ArrayAppend(ref annotations, cf.Annotations); } catch (Exception x) diff --git a/src/IKVM.Util/IKVM.Util.csproj b/src/IKVM.Util/IKVM.Util.csproj index bbdb1fec80..5573b55d47 100644 --- a/src/IKVM.Util/IKVM.Util.csproj +++ b/src/IKVM.Util/IKVM.Util.csproj @@ -8,7 +8,7 @@ - +