Skip to content

Commit

Permalink
Upgrade to IKVM.ByteCode 9.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Aug 13, 2024
1 parent c928ccb commit ab0381f
Show file tree
Hide file tree
Showing 30 changed files with 65 additions and 74 deletions.
2 changes: 1 addition & 1 deletion IKVM.deps.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<ItemGroup>
<PackageReference Include="IKVM.ByteCode" Version="8.12.0" />
<PackageReference Include="IKVM.ByteCode" Version="8.13.0-dev.3" />
</ItemGroup>

<Choose>
Expand Down
18 changes: 6 additions & 12 deletions src/IKVM.Runtime/AttributeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Jeroen Frijters
*/
using System;

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemDouble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Jeroen Frijters

using System;

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemFieldref.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Jeroen Frijters
using System;

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemInteger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Jeroen Frijters
using System;

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemLong.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Jeroen Frijters
using System;

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/
using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemMethodref.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Jeroen Frijters
*/
using IKVM.Attributes;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;
using IKVM.Runtime;

namespace IKVM.Runtime
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemNameAndType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.ConstantPoolItemString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Jeroen Frijters
*/

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
8 changes: 4 additions & 4 deletions src/IKVM.Runtime/ClassFile.Field.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Jeroen Frijters

using IKVM.Attributes;
using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand All @@ -46,7 +46,7 @@ internal sealed class Field : FieldOrMethod
/// <param name="utf8_cp"></param>
/// <param name="field"></param>
/// <exception cref="ClassFormatError"></exception>
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)))
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/ClassFile.FieldOrMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Jeroen Frijters

using IKVM.Attributes;
using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down
6 changes: 3 additions & 3 deletions src/IKVM.Runtime/ClassFile.Method.Code.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Jeroen Frijters
using System.Collections.Generic;

using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand Down
12 changes: 6 additions & 6 deletions src/IKVM.Runtime/ClassFile.Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -51,7 +51,7 @@ internal sealed partial class Method : FieldOrMethod
/// <param name="options"></param>
/// <param name="reader"></param>
/// <exception cref="ClassFormatError"></exception>
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 <clinit>
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -224,15 +224,15 @@ 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;
case AttributeName.RuntimeVisibleTypeAnnotations:
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;
Expand Down
20 changes: 10 additions & 10 deletions src/IKVM.Runtime/ClassFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Jeroen Frijters

using IKVM.Attributes;
using IKVM.ByteCode;
using IKVM.ByteCode.Reading;
using IKVM.ByteCode.Decoding;

namespace IKVM.Runtime
{
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -103,7 +103,7 @@ internal static string GetClassName(byte[] bytes, int offset, int length, out bo
/// <returns></returns>
/// <exception cref="UnsupportedClassVersionError"></exception>
/// <exception cref="ClassFormatError"></exception>
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);
Expand All @@ -126,7 +126,7 @@ static string GetClassName(IKVM.ByteCode.Reading.ClassFile reader, out bool isst
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="UnsupportedClassVersionError"></exception>
/// <exception cref="ClassFormatError"></exception>
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));
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/JNI/JNIEnv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/IKVM.Runtime/JNI/JavaVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit ab0381f

Please sign in to comment.