diff --git a/.github/workflows/IKVM.yml b/.github/workflows/IKVM.yml
index 8abda51813..f44b1e07b2 100644
--- a/.github/workflows/IKVM.yml
+++ b/.github/workflows/IKVM.yml
@@ -22,89 +22,37 @@ env:
NATIVE_SDK_VERSION: "20240614.1"
jobs:
- build-openjdk:
- name: Build OpenJDK
+ build-jtreg:
+ name: Build OpenJDK Test Harness
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
submodules: recursive
- - name: Cache OpenJDK Build
- uses: actions/cache@v4
- with:
- path: openjdk/build/linux-x86_64-normal-server-release
- key: openjdk-build-linux-x86_64-normal-server-release--${{ runner.os }}--${{ hashFiles('openjdk/**', '!openjdk/build') }}-10
- - name: Check OpenJDK Build Stamp
- id: openjdk-build-stamp
- uses: andstor/file-existence-action@v3
- with:
- files: openjdk/build/linux-x86_64-normal-server-release/stamp
- - name: Fetch OpenJDK 7
- if: steps.openjdk-build-stamp.outputs.files_exists != 'true'
- run: |
- mkdir -p openjdk/build &&
- curl -o openjdk/build/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz "https://download.java.net/openjdk/jdk7u75/ri/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz" &&
- tar xzvf openjdk/build/openjdk-7u75-b13-linux-x64-18_dec_2014.tar.gz -C openjdk/build
- - name: Build OpenJDK
- if: steps.openjdk-build-stamp.outputs.files_exists != 'true'
- uses: docker://debian/eol:lenny
- with:
- args: >
- /bin/bash -c "
- echo 'deb http://archive.debian.org/debian/ lenny main' > /etc/apt/sources.list &&
- apt-get update &&
- apt-get install -y \
- build-essential \
- unzip \
- zip \
- curl \
- gcc-4.3 \
- g++-4.3 \
- libx11-dev \
- libxext-dev \
- libxrender-dev \
- libxtst-dev \
- libxt-dev \
- libxi-dev \
- libcups2-dev \
- libasound2-dev \
- libfreetype6-dev \
- libfontconfig1-dev &&
- cd openjdk &&
- JAVA_HOME=build/java-se-7u75-ri bash ./configure &&
- make DISABLE_HOTSPOT_OS_VERSION_CHECK=ok images &&
- touch build/linux-x86_64-normal-server-release/stamp"
- - name: Update OpenJDK Attributes
- run: |
- sudo chown -R `id -u`:`id -g` linux-x86_64-normal-server-release && \
- sudo chmod -R +rwx linux-x86_64-normal-server-release/images/j2sdk-image/bin
- working-directory: openjdk/build
- - name: Package OpenJDK
- run: zip -r /tmp/openjdk-build-linux-x86_64-normal-server-release.zip linux-x86_64-normal-server-release/*
- working-directory: openjdk/build
- - name: Upload OpenJDK
- uses: actions/upload-artifact@v4
- with:
- name: openjdk-build-linux-x86_64-normal-server-release
- path: /tmp/openjdk-build-linux-x86_64-normal-server-release.zip
- name: Cache OpenJDK Test Harness Build
uses: actions/cache@v4
with:
- path: jtreg/build
- key: jtreg-build--${{ runner.os }}--${{ hashFiles('jtreg/**', 'openjdk/build/linux-x86_64-normal-server-release/images/j2sdk-image', '!jtreg/build') }}-6
+ path: ext/jtreg/build
+ key: jtreg-build--${{ runner.os }}--${{ hashFiles('ext/jtreg/**') }}-8
- name: Check OpenJDK Test Harness Build Stamp
id: jtreg-build-stamp
uses: andstor/file-existence-action@v3
with:
- files: jtreg/build/stamp
+ files: ext/jtreg/build/stamp
+ - name: Install Java
+ run: |
+ sudo apt-get update && \
+ sudo apt-get install -y \
+ openjdk-8-jdk-headless && \
+ echo "JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64" >> $GITHUB_ENV
- name: Build OpenJDK Test Harness
if: steps.jtreg-build-stamp.outputs.files_exists != 'true'
- run: WGET_OPTS='-U Mozilla/5.0' bash make/build-all.sh `realpath ../openjdk/build/linux-x86_64-normal-server-release/images/j2sdk-image` && touch build/stamp
- working-directory: jtreg
+ run: WGET_OPTS='-U Mozilla/5.0' bash make/build-all.sh $JAVA_HOME && touch build/stamp
+ working-directory: ext/jtreg
- name: Package OpenJDK Test Harness
run: zip -r /tmp/jtreg-build.zip build
- working-directory: jtreg
+ working-directory: ext/jtreg
- name: Upload OpenJDK Test Harness
uses: actions/upload-artifact@v4
with:
@@ -113,7 +61,7 @@ jobs:
build-ikvm:
name: Build IKVM
needs:
- - build-openjdk
+ - build-jtreg
timeout-minutes: 720
runs-on: ubuntu-24.04
env:
@@ -181,6 +129,7 @@ jobs:
with:
crate: apple-codesign
version: latest
+ locked: false
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v1
with:
@@ -190,20 +139,13 @@ jobs:
with:
useConfigFile: true
configFilePath: GitVersion.yml
- - name: Download OpenJDK 8 Build
- uses: actions/download-artifact@v4
- with:
- name: openjdk-build-linux-x86_64-normal-server-release
- path: /tmp
- - name: Restore OpenJDK 8 Build
- run: mkdir -p openjdk/build && cd openjdk/build && unzip /tmp/openjdk-build-linux-x86_64-normal-server-release.zip && rm /tmp/openjdk-build-linux-x86_64-normal-server-release.zip
- name: Download JTReg Build
uses: actions/download-artifact@v4
with:
name: jtreg-build
path: /tmp
- name: Restore JTReg Build
- run: mkdir -p jtreg && cd jtreg && unzip /tmp/jtreg-build.zip && rm /tmp/jtreg-build.zip
+ run: mkdir -p ext/jtreg && cd ext/jtreg && unzip /tmp/jtreg-build.zip && rm /tmp/jtreg-build.zip
- name: Download Native SDKs
uses: robinraju/release-downloader@v1.9
with:
@@ -212,6 +154,12 @@ jobs:
fileName: "*.tar.gz"
out-file-path: ext/ikvm-native-sdk
extract: true
+ - name: Add NuGet Source (GitHub)
+ shell: pwsh
+ run: dotnet nuget add source --username USERNAME --password $env:GITHUB_TOKEN --store-password-in-clear-text --name ikvm $env:GITHUB_REPOS
+ env:
+ GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NuGet Restore
run: dotnet restore IKVM.sln
- name: Build Artifacts
@@ -282,16 +230,6 @@ jobs:
path: /tmp/jdk.tar.gz
- name: Delete JDK
run: rm /tmp/jdk.tar.gz
- - name: Package Tests (IKVM.ByteCode.Tests)
- run: tar czvf /tmp/tests--IKVM.ByteCode.Tests.tar.gz tests/IKVM.ByteCode.Tests
- working-directory: dist
- - name: Upload Tests (IKVM.ByteCode.Tests)
- uses: actions/upload-artifact@v4
- with:
- name: tests--IKVM.ByteCode.Tests
- path: /tmp/tests--IKVM.ByteCode.Tests.tar.gz
- - name: Delete Tests (IKVM.ByteCode.Tests)
- run: rm /tmp/tests--IKVM.ByteCode.Tests.tar.gz
- name: Package Tests (IKVM.Reflection.Tests)
run: tar czvf /tmp/tests--IKVM.Reflection.Tests.tar.gz tests/IKVM.Reflection.Tests
working-directory: dist
@@ -424,18 +362,23 @@ jobs:
run: |
$sys = @(
"win-x64",
- "linux-x64",
- "osx-x64"
+ "linux-x64"
)
+
+ if ($env:FULL_TEST -eq "true") {
+ $sys += @( "osx-x64", "osx-arm64" )
+ }
$tfm = @(
"net472",
- "net6.0",
"net8.0"
)
+ if ($env:FULL_TEST -eq "true") {
+ $tfm += @( "net6.0" )
+ }
+
$run = @(
- "IKVM.ByteCode.Tests",
"IKVM.Reflection.Tests",
"IKVM.Tests",
"IKVM.Java.Tests",
@@ -459,6 +402,10 @@ jobs:
"tfm" = "net472"
"sys" = "osx-x64"
},
+ @{
+ "tfm" = "net472"
+ "sys" = "osx-arm64"
+ },
@{
"run" = "IKVM.MSBuild.Tests"
"tfm" = "net472"
@@ -497,15 +444,6 @@ jobs:
}
)
- if ($env:FULL_TEST -ne "true") {
- foreach ($_ in (0..15)) {
- $exclude += @(@{
- "run" = "IKVM.OpenJDK.Tests?TestPartition=$_"
- "tfm" = "net8.0"
- })
- }
- }
-
$include = @(
@{
"run" = "IKVM.Tests"
@@ -671,7 +609,7 @@ jobs:
"--blame",
"--blame-crash",
"--blame-hang",
- "--blame-hang-timeout", "60m",
+ "--blame-hang-timeout", "120m",
"--blame-hang-dump-type", "full",
"-v:diag",
"--results-directory", "TestResults",
diff --git a/.gitmodules b/.gitmodules
index 01ae6b69aa..ff31f43f5a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,10 +1,10 @@
-[submodule "openjdk"]
- path = openjdk
+[submodule "ext/openjdk"]
+ path = ext/openjdk
url = https://github.com/ikvmnet/jdk8u.git
ignore = dirty
shallow = true
-[submodule "jtreg"]
- path = jtreg
+[submodule "ext/jtreg"]
+ path = ext/jtreg
url = https://github.com/ikvmnet/jtreg.git
ignore = dirty
shallow = true
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c8da98f490..4e4984489b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,8 +8,6 @@ Prerequisites for building the project:
* A clone of the IKVM repository which includes submodules (e.g. `git clone --recurse-submodules https://github.com/ikvmnet/ikvm.git`)
* Visual Studio configured for: .NET desktop development, Desktop development with C++ (including C++ Clang tools for Windows), Linux and Embedded Development with C++, and Windows SDK with the appropriate libraries for x86, AMD64 and ARM64 development.
* A JDK 8 installation. The `JAVA_HOME` environment variable needs to be point to the JDK 8 directory, or the version of `javac` available on the path needs to be from JDK 8 (You can download a suitable JDK from [Adoptium](https://adoptium.net/))
-* The OpenJDK JDK8u build result for Linux/x64. This build artifact cannot be built on Windows, or modern Linux hosts. Instead, it must be built on a host with GCC 4.3 available. (Debian Lenny is known to work acceptably, the CI/CD GitHub action can serve as a demonstration of this). The easiest way to acquire this artifact without building it yourself is to use one generated by the IKVM respository's [GitHub Actions](https://github.com/ikvm-revived/ikvm/actions). Click on a build result for a relevant branch (typically you'll want to use `develop`) and scroll down to the bottom of the list to locate `openjdk-build-linux-x86_64-normal-server-release`. Download this zip file from this link and unzip into
- `openjdk/build`.
* SDK Toolkits: These are located in the `ext/ikvm-native-sdk/` directory, and consist of a Windows SDK (windows), Linux SDK (linux) and Mac OS X SDK (macosx). The SDKs can be retrieved from the releases of the `ikvm-native-sdk` project.
* We use IKVM.Clang projects to build the native libraries. This project type supports inner builds for TargetMachine, much as .NET supports inner builds for TFMs.
* There is an IKVM.Clang Visual Studio extension for these projects to load properly in Visual Studio: https://marketplace.visualstudio.com/items?itemName=ikvm.clang
@@ -84,7 +82,7 @@ Increases in the major and minor version are accomplished manually by introducin
# Package Layout
-The main IKVM package is 'IKVM'. This package contains the IKVM.ByteCode, IKVM.Runtime, IKVM.Java assemblies, and the
+The main IKVM package is 'IKVM'. This package contains the IKVM.Runtime, IKVM.Java assemblies, and the
libikvm native library. This is the minimal set of files required to begin bootstrapping the JVM. However, the JVM
itself requires additional files which are present in the IKVM.Image package hierarchy.
diff --git a/Directory.Build.props b/Directory.Build.props
index 3e7a69a4b0..bde86f5e56 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -16,12 +16,12 @@
- $(MSBuildThisFileDirectory)openjdk\
+ $(MSBuildThisFileDirectory)ext\openjdk\
1
8
0
- 275
- b01
+ 422
+ b05
OpenJDK $(OpenJdkMinorVersion)u$(OpenJdkUpdateVersion) $(OpenJdkBuildNumber)
$(OpenJdkMajorVersion).$(OpenJdkMinorVersion).$(OpenJdkMicroVersion)_$(OpenJdkUpdateVersion)-$(OpenJdkBuildNumber)
Oracle
@@ -65,7 +65,7 @@
- 10.0
+ 12.0
$(NoWarn);1591;1573;CS8002;NU5100;NU5118;NU5128;MSB3245;NETSDK1023
true
true
@@ -103,10 +103,6 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/IKVM.deps.targets b/IKVM.deps.targets
index 1f8b2cd8bc..c343585479 100644
--- a/IKVM.deps.targets
+++ b/IKVM.deps.targets
@@ -1,5 +1,9 @@
+
+
+
+
@@ -7,7 +11,7 @@
-
+
@@ -27,13 +31,6 @@
-
-
-
-
-
-
-
diff --git a/IKVM.refs.targets b/IKVM.refs.targets
index b7f57fc247..35581bf4c8 100644
--- a/IKVM.refs.targets
+++ b/IKVM.refs.targets
@@ -4,12 +4,6 @@
$(TargetsForTfmSpecificContentInPackage);GetIkvmLibsTfmSpecificContent;GetIkvmLibsTfmSpecificDebugSymbols;GetIkvmJavaTfmSpecificContent;GetIkvmJavaTfmSpecificDebugSymbols
-
-
- true
-
-
-
true
@@ -33,14 +27,14 @@
IkvmJavaItem
win
-
+
false
False
all
IkvmJavaItem
linux
-
+
false
False
all
diff --git a/IKVM.sln b/IKVM.sln
index 904f12b2d1..42bf046667 100644
--- a/IKVM.sln
+++ b/IKVM.sln
@@ -153,8 +153,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Image.JDK.runtime.osx-
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Image.JRE.runtime.osx-x64", "src\IKVM.Image.JRE.runtime.osx-x64\IKVM.Image.JRE.runtime.osx-x64.csproj", "{FD39DA19-C81E-4752-B308-43594CC201BB}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.ByteCode", "src\IKVM.ByteCode\IKVM.ByteCode.csproj", "{032B77B4-199E-4077-841E-951BAD862050}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dist", "dist", "{F8B6B3D8-006C-4D8F-8883-EB48D9EB417F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dist-nuget", "src\dist-nuget\dist-nuget.csproj", "{6C106109-0131-4413-8D41-348256EADC7E}"
@@ -193,8 +191,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tools.Importer", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tools.Importer.Tests", "src\IKVM.Tools.Importer.Tests\IKVM.Tools.Importer.Tests.csproj", "{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.ByteCode.Tests", "src\IKVM.ByteCode.Tests\IKVM.ByteCode.Tests.csproj", "{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}"
-EndProject
Project("{6DE1C62B-E8D7-451A-8734-87EAEB46E35B}") = "libsunec", "src\libsunec\libsunec.clangproj", "{0714956B-BCE5-43DB-87A6-B58B57E0765B}"
EndProject
Project("{6DE1C62B-E8D7-451A-8734-87EAEB46E35B}") = "libsunmscapi", "src\libsunmscapi\libsunmscapi.clangproj", "{1658E7AC-0FC7-4527-A7CF-9E0FF752B368}"
@@ -339,6 +335,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dist-jdk", "src\dist-jdk\di
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dist-jre", "src\dist-jre\dist-jre.csproj", "{B4C83452-7979-4102-A205-7FD2EE914AEF}"
EndProject
+Project("{6DE1C62B-E8D7-451A-8734-87EAEB46E35B}") = "libj2gss", "src\libj2gss\libj2gss.clangproj", "{723F8D26-F3CB-430D-B142-4AB89DBF1298}"
+EndProject
+Project("{6DE1C62B-E8D7-451A-8734-87EAEB46E35B}") = "libsspi_bridge", "src\libsspi_bridge\libsspi_bridge.clangproj", "{461D3F93-30AD-481E-B3D3-476A3CE2BF7B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -569,10 +569,6 @@ Global
{FD39DA19-C81E-4752-B308-43594CC201BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD39DA19-C81E-4752-B308-43594CC201BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD39DA19-C81E-4752-B308-43594CC201BB}.Release|Any CPU.Build.0 = Release|Any CPU
- {032B77B4-199E-4077-841E-951BAD862050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {032B77B4-199E-4077-841E-951BAD862050}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {032B77B4-199E-4077-841E-951BAD862050}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {032B77B4-199E-4077-841E-951BAD862050}.Release|Any CPU.Build.0 = Release|Any CPU
{6C106109-0131-4413-8D41-348256EADC7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C106109-0131-4413-8D41-348256EADC7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C106109-0131-4413-8D41-348256EADC7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -645,10 +641,6 @@ Global
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Release|Any CPU.Build.0 = Release|Any CPU
- {60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.Build.0 = Release|Any CPU
{0714956B-BCE5-43DB-87A6-B58B57E0765B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0714956B-BCE5-43DB-87A6-B58B57E0765B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0714956B-BCE5-43DB-87A6-B58B57E0765B}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -909,6 +901,14 @@ Global
{B4C83452-7979-4102-A205-7FD2EE914AEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4C83452-7979-4102-A205-7FD2EE914AEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4C83452-7979-4102-A205-7FD2EE914AEF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {723F8D26-F3CB-430D-B142-4AB89DBF1298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {723F8D26-F3CB-430D-B142-4AB89DBF1298}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {723F8D26-F3CB-430D-B142-4AB89DBF1298}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {723F8D26-F3CB-430D-B142-4AB89DBF1298}.Release|Any CPU.Build.0 = Release|Any CPU
+ {461D3F93-30AD-481E-B3D3-476A3CE2BF7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {461D3F93-30AD-481E-B3D3-476A3CE2BF7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {461D3F93-30AD-481E-B3D3-476A3CE2BF7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {461D3F93-30AD-481E-B3D3-476A3CE2BF7B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ext/jtreg b/ext/jtreg
new file mode 160000
index 0000000000..1839513331
--- /dev/null
+++ b/ext/jtreg
@@ -0,0 +1 @@
+Subproject commit 1839513331c2992181ee45a88c2383f505911dcd
diff --git a/ext/openjdk b/ext/openjdk
new file mode 160000
index 0000000000..e904cb939c
--- /dev/null
+++ b/ext/openjdk
@@ -0,0 +1 @@
+Subproject commit e904cb939c7160f2551a41b1a344bdff4505e255
diff --git a/jtreg b/jtreg
deleted file mode 160000
index 623975ee94..0000000000
--- a/jtreg
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 623975ee940078af770443d58cc2fa98abcee74f
diff --git a/jtreg.props b/jtreg.props
index 6c43e41faf..f087c1ef65 100644
--- a/jtreg.props
+++ b/jtreg.props
@@ -1,6 +1,6 @@
- $(MSBuildThisFileDirectory)jtreg\
+ $(MSBuildThisFileDirectory)ext\jtreg\
diff --git a/nuget.config b/nuget.config
index be31e09e59..5c2190fefc 100644
--- a/nuget.config
+++ b/nuget.config
@@ -1,6 +1,5 @@
-
-
+
diff --git a/openjdk b/openjdk
deleted file mode 160000
index 2918bfe1a4..0000000000
--- a/openjdk
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2918bfe1a4ca241bbddbcecf5a25f09319813823
diff --git a/src/IKVM.ByteCode.Tests/0.class b/src/IKVM.ByteCode.Tests/0.class
deleted file mode 100644
index b5b6c8f2b5..0000000000
Binary files a/src/IKVM.ByteCode.Tests/0.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/ClassFormatVersionTests.cs b/src/IKVM.ByteCode.Tests/ClassFormatVersionTests.cs
deleted file mode 100644
index abf8c93637..0000000000
--- a/src/IKVM.ByteCode.Tests/ClassFormatVersionTests.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using FluentAssertions;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IKVM.ByteCode.Tests
-{
-
- [TestClass]
- public class ClassFormatVersionTests
- {
-
- [TestMethod]
- public void CompareToShouldBeZeroForEqual()
- {
- new ClassFormatVersion(1, 0).CompareTo(new ClassFormatVersion(1, 0)).Should().Be(0);
- }
-
- [TestMethod]
- public void CompareToShouldBeNegativeOneForGreaterMajor()
- {
- new ClassFormatVersion(1, 0).CompareTo(new ClassFormatVersion(2, 0)).Should().Be(-1);
- }
-
- [TestMethod]
- public void CompareToShouldBeNegativeOneForGreaterMinor()
- {
- new ClassFormatVersion(1, 0).CompareTo(new ClassFormatVersion(1, 1)).Should().Be(-1);
- }
-
- [TestMethod]
- public void CompareToShouldBeOneForGreaterMajor()
- {
- new ClassFormatVersion(2, 0).CompareTo(new ClassFormatVersion(1, 0)).Should().Be(1);
- }
-
- [TestMethod]
- public void CompareToShouldBeOneForGreaterMinor()
- {
- new ClassFormatVersion(1, 1).CompareTo(new ClassFormatVersion(1, 0)).Should().Be(1);
- }
-
- [TestMethod]
- public void ImplicitOperatorsShouldReturnCorrectValues()
- {
- (new ClassFormatVersion(1, 0) > new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(1, 0) < new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(1, 0) >= new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(1, 0) <= new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(1, 0) == new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(1, 0) != new ClassFormatVersion(1, 0)).Should().BeFalse();
-
- (new ClassFormatVersion(1, 1) > new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(1, 1) < new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(1, 1) >= new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(1, 1) <= new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(1, 1) == new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(1, 1) != new ClassFormatVersion(1, 0)).Should().BeTrue();
-
- (new ClassFormatVersion(2, 0) > new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(2, 0) < new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(2, 0) >= new ClassFormatVersion(1, 0)).Should().BeTrue();
- (new ClassFormatVersion(2, 0) <= new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(2, 0) == new ClassFormatVersion(1, 0)).Should().BeFalse();
- (new ClassFormatVersion(2, 0) != new ClassFormatVersion(1, 0)).Should().BeTrue();
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode.Tests/IKVM.ByteCode.Tests.csproj b/src/IKVM.ByteCode.Tests/IKVM.ByteCode.Tests.csproj
deleted file mode 100644
index 697e133d3d..0000000000
--- a/src/IKVM.ByteCode.Tests/IKVM.ByteCode.Tests.csproj
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
- net472;net6.0;net7.0;net8.0
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
- PreserveNewest
-
-
-
-
diff --git a/src/IKVM.ByteCode.Tests/Parsing/TypeAnnotationRecordTests.cs b/src/IKVM.ByteCode.Tests/Parsing/TypeAnnotationRecordTests.cs
deleted file mode 100644
index d9e21eb130..0000000000
--- a/src/IKVM.ByteCode.Tests/Parsing/TypeAnnotationRecordTests.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-
-using FluentAssertions;
-
-using IKVM.ByteCode.Parsing;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IKVM.ByteCode.Tests.Parsing
-{
-
- [TestClass]
- public class TypeAnnotationRecordTests
- {
-
- [TestMethod]
- public void CanRoundTripTypeAnnotation()
- {
- var a = new TypeAnnotationRecord(
- TypeAnnotationTargetType.Field,
- new TypeAnnotationEmptyTargetRecord(),
- new TypePathRecord(new TypePathItemRecord(TypePathKind.ArrayType, 0)),
- 1,
- new ElementValuePairRecord(2, new ElementValueRecord(ElementValueTag.Integer, new ElementValueConstantValueRecord(3))));
-
- var b1 = new byte[a.GetSize()];
- var w1 = new ClassFormatWriter(b1);
- if (a.TryWrite(ref w1) == false)
- throw new Exception();
-
- var r = new ClassFormatReader(b1);
- if (TypeAnnotationRecord.TryReadTypeAnnotation(ref r, out var b) == false)
- throw new Exception();
-
- var b2 = new byte[b.GetSize()];
- var w2 = new ClassFormatWriter(b2);
- if (b.TryWrite(ref w2) == false)
- throw new Exception();
-
- b1.Should().BeEquivalentTo(b2);
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode.Tests/Reading/ClassReaderTests.cs b/src/IKVM.ByteCode.Tests/Reading/ClassReaderTests.cs
deleted file mode 100644
index b91f436e11..0000000000
--- a/src/IKVM.ByteCode.Tests/Reading/ClassReaderTests.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-
-using FluentAssertions;
-
-using IKVM.ByteCode.Parsing;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IKVM.ByteCode.Reading.Tests
-{
-
- [TestClass]
- public class ClassReaderTests
- {
-
- [TestMethod]
- [ExpectedException(typeof(InvalidClassException))]
- public async Task ShouldThrowOnEmptyStream()
- {
- var stream = new MemoryStream();
- await ClassReader.ReadAsync(stream);
- }
-
- [TestMethod]
- [ExpectedException(typeof(InvalidClassMagicException))]
- public async Task ShouldThrowOnSmallStream()
- {
- var stream = new MemoryStream(new byte[10]);
- await ClassReader.ReadAsync(stream);
- }
-
- [TestMethod]
- [ExpectedException(typeof(InvalidClassMagicException))]
- public async Task ShouldThrowOnBadStream()
- {
- var stream = new MemoryStream(new byte[35]);
- await ClassReader.ReadAsync(stream);
- }
-
- [TestMethod]
- public void CanLoadClass()
- {
- var clazz = ClassReader.Read(Path.Combine(Path.GetDirectoryName(typeof(ClassReaderTests).Assembly.Location), "0.class"));
- clazz.Should().NotBeNull();
- clazz.This.Name.Value.Should().Be("0");
- clazz.Constants.ToList();
- clazz.Interfaces.ToList();
- clazz.Fields.Should().HaveCount(0);
- clazz.Fields.ToList();
- clazz.Methods.Should().HaveCount(2);
- clazz.Methods.ToList();
-
- clazz.Methods[0].Attributes.Code.Code.Should().NotBeNull();
- clazz.Methods[1].Attributes.Code.Code.Should().NotBeNull();
- }
-
- [TestMethod]
- public void CanLoadTestClassFiles()
- {
- var d = Path.Combine(Path.GetDirectoryName(typeof(ClassReaderTests).Assembly.Location), "resources");
- var l = Directory.GetFiles(d, "*.class", SearchOption.AllDirectories);
-
- foreach (var i in l)
- {
- var c = ClassReader.Read(i);
- c.This.Should().NotBeNull();
- c.Constants.ToList();
-
- foreach (var constant in c.Constants)
- TestConstant(constant);
-
- c.Interfaces.ToList();
- c.Interfaces.Should().OnlyHaveUniqueItems();
- c.Fields.ToList();
- c.Fields.Should().OnlyHaveUniqueItems();
- c.Methods.ToList();
- c.Methods.Should().OnlyHaveUniqueItems();
-
- foreach (var iface in c.Interfaces)
- iface.Class.Name.Value.Should().NotBeNull();
-
- foreach (var field in c.Fields)
- {
- field.Should().NotBeNull();
- field.Name.Value.Should().NotBeNull();
- field.Descriptor.Value.Should().NotBeNull();
- field.Attributes.ToList();
-
- foreach (var attribute in field.Attributes)
- TestAttribute(attribute);
- }
-
- foreach (var method in c.Methods)
- {
- method.Name.Should().NotBeNull();
- method.Descriptor.Should().NotBeNull();
- method.Attributes.ToList();
-
- foreach (var attribute in method.Attributes)
- TestAttribute(attribute);
- }
-
- c.Attributes.ToList();
- foreach (var attribute in c.Attributes)
- TestAttribute(attribute);
- }
- }
-
- void TestConstant(IConstantReader constant)
- {
- if (constant is Utf8ConstantReader utf8)
- TestConstant(utf8);
- if (constant is IntegerConstantReader integer)
- TestConstant(integer);
- if (constant is MethodHandleConstantReader methodHandle)
- TestConstant(methodHandle);
- }
-
- void TestConstant(Utf8ConstantReader utf8)
- {
- utf8.Value.Should().NotBeNull();
- }
-
- void TestConstant(IntegerConstantReader integer)
- {
- integer.Value.GetType().Should().Be(typeof(int));
- }
-
- void TestConstant(MethodHandleConstantReader methodHandle)
- {
- if (methodHandle.ReferenceKind is ReferenceKind.GetField or ReferenceKind.GetStatic or ReferenceKind.PutField or ReferenceKind.PutStatic)
- methodHandle.Reference.Should().BeOfType();
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeVirtual or ReferenceKind.NewInvokeSpecial)
- methodHandle.Reference.Should().BeOfType();
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeStatic or ReferenceKind.InvokeSpecial && methodHandle.DeclaringClass.Version < new ClassFormatVersion(52, 0))
- methodHandle.Reference.Should().BeOfType();
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeStatic or ReferenceKind.InvokeSpecial && methodHandle.DeclaringClass.Version >= new ClassFormatVersion(52, 0))
- methodHandle.Reference.Should().Match(i => i is MethodrefConstantReader || i is InterfaceMethodrefConstantReader);
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeInterface)
- methodHandle.Reference.Should().BeOfType();
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeVirtual or ReferenceKind.InvokeStatic or ReferenceKind.InvokeSpecial or ReferenceKind.InvokeInterface && methodHandle.Reference is MethodrefConstantReader methodRef)
- methodRef.NameAndType.Name.Value.Should().NotBe("").And.NotBe("");
- if (methodHandle.ReferenceKind is ReferenceKind.InvokeVirtual or ReferenceKind.InvokeStatic or ReferenceKind.InvokeSpecial or ReferenceKind.InvokeInterface && methodHandle.Reference is InterfaceMethodrefConstantReader interfaceMethodRef)
- interfaceMethodRef.Class.Name.Value.Should().NotBe("").And.NotBe("");
- }
-
- void TestAttribute(AttributeReader attribute)
- {
- if (attribute is RuntimeVisibleAnnotationsAttributeReader runtimeVisibleAnnotationsAttributeReader)
- TestAttribute(runtimeVisibleAnnotationsAttributeReader);
- if (attribute is RuntimeInvisibleAnnotationsAttributeReader runtimeInvisibleAnnotationsAttributeReader)
- TestAttribute(runtimeInvisibleAnnotationsAttributeReader);
- if (attribute is RuntimeVisibleTypeAnnotationsAttributeReader runtimeVisibleTypeAnnotationsAttributeReader)
- TestAttribute(runtimeVisibleTypeAnnotationsAttributeReader);
- if (attribute is RuntimeInvisibleTypeAnnotationsAttributeReader runtimeInvisibleTypeAnnotationsAttributeReader)
- TestAttribute(runtimeInvisibleTypeAnnotationsAttributeReader);
- }
-
- void TestAttribute(RuntimeVisibleAnnotationsAttributeReader attribute)
- {
- attribute.Info.Name.Value.Should().NotBeEmpty();
- TestAnnotations(attribute.Annotations);
- }
-
- void TestAttribute(RuntimeInvisibleAnnotationsAttributeReader attribute)
- {
- attribute.Info.Name.Value.Should().NotBeEmpty();
- TestAnnotations(attribute.Annotations);
- }
-
- void TestAttribute(RuntimeVisibleTypeAnnotationsAttributeReader attribute)
- {
- attribute.Info.Name.Value.Should().NotBeEmpty();
- TestAnnotations(attribute.Annotations);
- }
-
- void TestAttribute(RuntimeInvisibleTypeAnnotationsAttributeReader attribute)
- {
- attribute.Info.Name.Value.Should().NotBeEmpty();
- TestAnnotations(attribute.Annotations);
- }
-
- void TestAnnotations(IReadOnlyList annotations)
- {
- foreach (var annotation in annotations)
- TestAnnotation(annotation);
- }
-
- void TestAnnotations(IReadOnlyList annotations)
- {
- foreach (var annotation in annotations)
- TestAnnotation(annotation);
- }
-
- void TestAnnotation(AnnotationReader annotation)
- {
- annotation.Type.Value.Should().NotBeEmpty();
- TestElementValuePair(annotation.Elements);
- }
-
- void TestAnnotation(TypeAnnotationReader annotation)
- {
- annotation.Type.Value.Should().NotBeEmpty();
- TestElementValuePair(annotation.Elements);
- }
-
- void TestElementValuePair(ElementValueKeyReaderCollection elements)
- {
- elements.Count.Should().BeLessThan(256);
-
- foreach (var element in elements)
- TestElement(element.Key, element.Value);
- }
-
- void TestElement(string name, ElementValueReader value)
- {
- name.Should().NotBeEmpty();
- value.Should().NotBeNull();
-
- TestElementValue(value);
- }
-
- void TestElementValue(ElementValueReader value)
- {
- if (value is ElementValueConstantReader elementValueConstantReader)
- TestElementValue(elementValueConstantReader);
- if (value is ElementValueAnnotationReader elementAnnotationValueReader)
- TestElementValue(elementAnnotationValueReader);
- if (value is ElementValueArrayReader elementArrayValueReader)
- TestElementValue(elementArrayValueReader);
- if (value is ElementValueClassReader elementClassInfoValueReader)
- TestElementValue(elementClassInfoValueReader);
- }
-
- void TestElementValue(ElementValueConstantReader elementValueConstantReader)
- {
- Enum.GetName(typeof(ElementValueTag), elementValueConstantReader.Tag).Should().NotBeNullOrEmpty();
- elementValueConstantReader.Value.Should().NotBeNull();
- TestConstant(elementValueConstantReader.Value);
- }
-
- void TestElementValue(ElementValueClassReader elementClassInfoValueReader)
- {
- elementClassInfoValueReader.Class.Value.Should().NotBeEmpty();
- }
-
- void TestElementValue(ElementValueAnnotationReader elementAnnotationValueReader)
- {
- TestAnnotation(elementAnnotationValueReader.Annotation);
- }
-
- void TestElementValue(ElementValueArrayReader elementArrayValueReader)
- {
- foreach (var value in elementArrayValueReader.Values)
- TestElementValue(value);
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.class b/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.class
deleted file mode 100644
index e2af1771c0..0000000000
Binary files a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.cs b/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.cs
deleted file mode 100644
index 5e93337040..0000000000
--- a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System.IO;
-using System.Linq;
-
-using FluentAssertions;
-
-using IKVM.ByteCode.Reading;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IKVM.ByteCode.Tests.Reading
-{
-
- [TestClass]
- public class ConstantReaderTests
- {
-
- ClassReader ReadClass()
- {
- return ClassReader.Read(Path.Combine(Path.GetDirectoryName(typeof(ConstantReaderTests).Assembly.Location), "Reading", "ConstantReaderTests.class"));
- }
-
- [TestMethod]
- public void CanReadIntegerConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Value == 394892);
- }
-
- [TestMethod]
- public void CanReadLongConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Value == 34182132);
- }
-
- [TestMethod]
- public void CanReadFloatConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Value == 221.03f);
- }
-
- [TestMethod]
- public void CanReadDoubleConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Value == 2212133.1d);
- }
-
- [TestMethod]
- public void CanReadStringConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Value == "STRING");
- }
-
- [TestMethod]
- public void CanReadClassConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Name.Value == "java/lang/Object");
- }
-
- [TestMethod]
- public void CanReadMethodrefConstant()
- {
- var c = ReadClass();
- c.Constants.OfType().Should().Contain(i => i.Class.Name.Value == "java/lang/Object" && i.NameAndType.Name.Value == "" && i.NameAndType.Type.Value == "()V");
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.java b/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.java
deleted file mode 100644
index e0d8907c7a..0000000000
--- a/src/IKVM.ByteCode.Tests/Reading/ConstantReaderTests.java
+++ /dev/null
@@ -1,9 +0,0 @@
-final class ConstantReaderTests {
-
- static int i = 394892;
- static long j = 34182132;
- static float f = 221.03f;
- static double d = 2212133.1;
- static String o = "STRING";
-
-}
diff --git a/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs b/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs
deleted file mode 100644
index 1b297c7227..0000000000
--- a/src/IKVM.ByteCode.Tests/Text/MUTF8EncodingTests.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using System;
-using System.Linq;
-
-using FluentAssertions;
-
-using IKVM.ByteCode.Text;
-
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace IKVM.ByteCode.Tests.Text
-{
-
- [TestClass]
- public class MUTF8EncodingTests
- {
-
- string asciiChars = new string(Enumerable.Range(32, 126 - 32).Select(i => (char)i).ToArray());
-
- [TestMethod]
- public void CanRoundTripASCIICharactersForJDK_1_4()
- {
- var e = MUTF8Encoding.GetMUTF8(48);
- var b = e.GetBytes(asciiChars);
- var c = e.GetString(b);
- c.Should().Be(asciiChars);
- }
-
- [TestMethod]
- public void CanRoundTripASCIICharactersForJDK_1_0()
- {
- var e = MUTF8Encoding.GetMUTF8(46);
- var b = e.GetBytes(asciiChars);
- var c = e.GetString(b);
- c.Should().Be(asciiChars);
- }
-
- [TestMethod]
- public void CanEncodeNullByte()
- {
- var l = MUTF8Encoding.GetMUTF8(48).GetByteCount("\0");
- l.Should().Be(2);
- var b = MUTF8Encoding.GetMUTF8(48).GetBytes("\0");
- b.Should().HaveCount(2);
- b[0].Should().Be(0b11000000);
- b[1].Should().Be(0b10000000);
- }
-
- [TestMethod]
- public void CanDecodeNullByte()
- {
- var s = MUTF8Encoding.GetMUTF8(48).GetChars(new byte[] { 0b11000000, 0b10000000 });
- s.Should().HaveCount(1);
- s[0].Should().Be('\0');
- }
-
- [TestMethod]
- public void CanEncodeNull()
- {
- MUTF8Encoding.GetMUTF8(48).GetBytes("\0").Should().HaveCount(2);
- MUTF8Encoding.GetMUTF8(48).GetBytes("a\0").Should().HaveCount(3);
- MUTF8Encoding.GetMUTF8(48).GetBytes("a\0a").Should().HaveCount(4);
- MUTF8Encoding.GetMUTF8(48).GetBytes("\0\0").Should().HaveCount(4);
- MUTF8Encoding.GetMUTF8(48).GetBytes("a\0\0").Should().HaveCount(5);
- MUTF8Encoding.GetMUTF8(48).GetBytes("a\0\0a").Should().HaveCount(6);
- }
-
- [TestMethod]
- public void CanHandleEmptyString()
- {
- MUTF8Encoding.GetMUTF8(48).GetBytes("").Should().BeEmpty();
- MUTF8Encoding.GetMUTF8(48).GetString(Array.Empty()).Should().Be("");
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode.Tests/resources/CharSequence.class b/src/IKVM.ByteCode.Tests/resources/CharSequence.class
deleted file mode 100644
index 29734d2c09..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/CharSequence.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/ColorEditor.class b/src/IKVM.ByteCode.Tests/resources/ColorEditor.class
deleted file mode 100644
index 30132d7b9b..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/ColorEditor.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/Databinding$Builder.class b/src/IKVM.ByteCode.Tests/resources/Databinding$Builder.class
deleted file mode 100644
index 8e35c60e98..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/Databinding$Builder.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/Databinding.class b/src/IKVM.ByteCode.Tests/resources/Databinding.class
deleted file mode 100644
index 8d71ac405f..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/Databinding.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/DatabindingFactory.class b/src/IKVM.ByteCode.Tests/resources/DatabindingFactory.class
deleted file mode 100644
index 2af6a40b1f..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/DatabindingFactory.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/DatabindingMode.class b/src/IKVM.ByteCode.Tests/resources/DatabindingMode.class
deleted file mode 100644
index a7778f88f4..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/DatabindingMode.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature$Builder.class b/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature$Builder.class
deleted file mode 100644
index 8d486c4107..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature$Builder.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature.class b/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature.class
deleted file mode 100644
index 1d75b37720..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/DatabindingModeFeature.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/DefaultPackage.class b/src/IKVM.ByteCode.Tests/resources/DefaultPackage.class
deleted file mode 100644
index 0e6cce8c66..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/DefaultPackage.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/Serializable.class b/src/IKVM.ByteCode.Tests/resources/Serializable.class
deleted file mode 100644
index bde4e91583..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/Serializable.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/ThreadDeath.class b/src/IKVM.ByteCode.Tests/resources/ThreadDeath.class
deleted file mode 100644
index 9b59f5237f..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/ThreadDeath.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/ICA.class b/src/IKVM.ByteCode.Tests/resources/annotations/ICA.class
deleted file mode 100644
index bb479f5bc1..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/ICA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/IFA.class b/src/IKVM.ByteCode.Tests/resources/annotations/IFA.class
deleted file mode 100644
index c3cd37f5be..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/IFA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/IMA.class b/src/IKVM.ByteCode.Tests/resources/annotations/IMA.class
deleted file mode 100644
index cee7bd63f2..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/IMA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/IPA.class b/src/IKVM.ByteCode.Tests/resources/annotations/IPA.class
deleted file mode 100644
index 816a37cb94..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/IPA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/ITA.class b/src/IKVM.ByteCode.Tests/resources/annotations/ITA.class
deleted file mode 100644
index c05ccb2d97..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/ITA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/ITPA.class b/src/IKVM.ByteCode.Tests/resources/annotations/ITPA.class
deleted file mode 100644
index 3734e57f70..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/ITPA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/ITUA.class b/src/IKVM.ByteCode.Tests/resources/annotations/ITUA.class
deleted file mode 100644
index 374440360c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/ITUA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/IVA.class b/src/IKVM.ByteCode.Tests/resources/annotations/IVA.class
deleted file mode 100644
index e5de15cd48..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/IVA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VCA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VCA.class
deleted file mode 100644
index 9cdf532bfb..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VCA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VFA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VFA.class
deleted file mode 100644
index 59ffcf8d0d..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VFA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VMA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VMA.class
deleted file mode 100644
index 82c909bebf..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VMA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VPA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VPA.class
deleted file mode 100644
index d9e6e5ba1c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VPA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VTA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VTA.class
deleted file mode 100644
index 84c0a95772..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VTA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VTPA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VTPA.class
deleted file mode 100644
index 2d0b3b9281..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VTPA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VTUA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VTUA.class
deleted file mode 100644
index d532458a2f..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VTUA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/annotations/VVA.class b/src/IKVM.ByteCode.Tests/resources/annotations/VVA.class
deleted file mode 100644
index 378a3e73f8..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/annotations/VVA.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidBytecodeOffset.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidBytecodeOffset.clazz
deleted file mode 100644
index bc5286cc2a..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidBytecodeOffset.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidClassVersion.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidClassVersion.clazz
deleted file mode 100644
index 1ef8a0b116..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidClassVersion.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCodeLength.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCodeLength.clazz
deleted file mode 100644
index 8378e4f4ec..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCodeLength.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolIndex.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolIndex.clazz
deleted file mode 100644
index 52360e85ab..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolIndex.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolReference.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolReference.clazz
deleted file mode 100644
index f0a7874f3e..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidConstantPoolReference.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCpInfoTag.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCpInfoTag.clazz
deleted file mode 100644
index 650e8ac121..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidCpInfoTag.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidElementValue.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidElementValue.clazz
deleted file mode 100644
index c6cf72e044..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidElementValue.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidInsnTypeAnnotationTargetType.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidInsnTypeAnnotationTargetType.clazz
deleted file mode 100644
index 5cbb5ac5c7..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidInsnTypeAnnotationTargetType.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidOpcode.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidOpcode.clazz
deleted file mode 100644
index 3c94fceb23..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidOpcode.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidSourceDebugExtension.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidSourceDebugExtension.clazz
deleted file mode 100644
index f7df0e823c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidSourceDebugExtension.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidStackMapFrameType.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidStackMapFrameType.clazz
deleted file mode 100644
index 3adc7b76d7..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidStackMapFrameType.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidTypeAnnotationTargetType.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidTypeAnnotationTargetType.clazz
deleted file mode 100644
index 8859aa382c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidTypeAnnotationTargetType.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidVerificationTypeInfo.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidVerificationTypeInfo.clazz
deleted file mode 100644
index bea541c093..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidVerificationTypeInfo.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidWideOpcode.clazz b/src/IKVM.ByteCode.Tests/resources/invalid/InvalidWideOpcode.clazz
deleted file mode 100644
index 59d01081b7..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/invalid/InvalidWideOpcode.clazz and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk11/AllInstructions.class b/src/IKVM.ByteCode.Tests/resources/jdk11/AllInstructions.class
deleted file mode 100644
index 69aa44471c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk11/AllInstructions.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures$Nested.class b/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures$Nested.class
deleted file mode 100644
index 9d31e7bed0..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures$Nested.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures.class
deleted file mode 100644
index 3aa1138bf4..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk11/AllStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$EmptyRecord.class b/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$EmptyRecord.class
deleted file mode 100644
index e2f8cb3ce4..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$EmptyRecord.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$RecordSubType.class b/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$RecordSubType.class
deleted file mode 100644
index 61d0a18030..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk14/AllStructures$RecordSubType.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk15/AllStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk15/AllStructures.class
deleted file mode 100644
index 851fc92f30..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk15/AllStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/AllInstructions.class b/src/IKVM.ByteCode.Tests/resources/jdk3/AllInstructions.class
deleted file mode 100644
index 283d41a0d0..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/AllInstructions.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$1.class b/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$1.class
deleted file mode 100644
index c21668ed12..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$1.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$InnerClass.class b/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$InnerClass.class
deleted file mode 100644
index 930cad3270..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures$InnerClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures.class
deleted file mode 100644
index c5b7ba2c1c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/AllStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/ArtificialStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk3/ArtificialStructures.class
deleted file mode 100644
index 0ba4240b6d..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/ArtificialStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk3/LargeMethod.class b/src/IKVM.ByteCode.Tests/resources/jdk3/LargeMethod.class
deleted file mode 100644
index d2547710c4..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk3/LargeMethod.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllInstructions.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllInstructions.class
deleted file mode 100644
index f3d08c37c7..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllInstructions.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$1LocalClass.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$1LocalClass.class
deleted file mode 100644
index b6ac40da4c..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$1LocalClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$EnumClass.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$EnumClass.class
deleted file mode 100644
index 23540f193b..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$EnumClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$GenericInnerClass.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$GenericInnerClass.class
deleted file mode 100644
index 5291fe7892..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$GenericInnerClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InnerClass.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InnerClass.class
deleted file mode 100644
index baeb6c4ad3..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InnerClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InvisibleAnnotation.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InvisibleAnnotation.class
deleted file mode 100644
index 485df516a7..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures$InvisibleAnnotation.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures.class
deleted file mode 100644
index a7de553e83..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk5/AllStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/AllFrames.class b/src/IKVM.ByteCode.Tests/resources/jdk8/AllFrames.class
deleted file mode 100644
index 90d79b8c5b..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/AllFrames.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/AllInstructions.class b/src/IKVM.ByteCode.Tests/resources/jdk8/AllInstructions.class
deleted file mode 100644
index ecd224fb08..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/AllInstructions.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$1.class b/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$1.class
deleted file mode 100644
index 24a5d7e5dc..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$1.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$InnerClass.class b/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$InnerClass.class
deleted file mode 100644
index 2e05aa5dfa..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures$InnerClass.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures.class b/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures.class
deleted file mode 100644
index 3069f601b5..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/AllStructures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/Artificial$()$Structures.class b/src/IKVM.ByteCode.Tests/resources/jdk8/Artificial$()$Structures.class
deleted file mode 100644
index 1cc843ec6b..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/Artificial$()$Structures.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk8/LargeMethod.class b/src/IKVM.ByteCode.Tests/resources/jdk8/LargeMethod.class
deleted file mode 100644
index bace5c0c89..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk8/LargeMethod.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk9/module-info.class b/src/IKVM.ByteCode.Tests/resources/jdk9/module-info.class
deleted file mode 100644
index e7418e67bd..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk9/module-info.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/A.class b/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/A.class
deleted file mode 100644
index d33ea1d335..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/A.class and /dev/null differ
diff --git a/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/internal/AImpl.class b/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/internal/AImpl.class
deleted file mode 100644
index 51a374f6c8..0000000000
Binary files a/src/IKVM.ByteCode.Tests/resources/jdk9/pkg/internal/AImpl.class and /dev/null differ
diff --git a/src/IKVM.ByteCode/AccessFlag.cs b/src/IKVM.ByteCode/AccessFlag.cs
deleted file mode 100644
index 26697481cd..0000000000
--- a/src/IKVM.ByteCode/AccessFlag.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- [Flags]
- internal enum AccessFlag : ushort
- {
-
- ACC_PUBLIC = 0x0001,
- ACC_FINAL = 0x0010,
- ACC_SUPER = 0x0020,
- ACC_INTERFACE = 0x0200,
- ACC_ABSTRACT = 0x0400,
- ACC_SYNTHETIC = 0x1000,
- ACC_ANNOTATION = 0x2000,
- ACC_ENUM = 0x4000,
- ACC_MODULE = 0x8000,
-
- }
-
-
-}
diff --git a/src/IKVM.ByteCode/Buffers/RawBitConverter.cs b/src/IKVM.ByteCode/Buffers/RawBitConverter.cs
deleted file mode 100644
index 05699b8f5b..0000000000
--- a/src/IKVM.ByteCode/Buffers/RawBitConverter.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-using System.Runtime.CompilerServices;
-
-#if NETCOREAPP3_1
-using System.Runtime.Intrinsics;
-using System.Runtime.Intrinsics.X86;
-#endif
-
-namespace IKVM.ByteCode.Buffers
-{
-
- static class RawBitConverter
- {
-
-#if NETFRAMEWORK || NETCOREAPP3_1
-
- ///
- /// Converts the specified 32-bit signed integer to a single-precision floating point number.
- ///
- /// The number to convert.
- /// A single-precision floating point number whose bits are identical to .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe float Int32BitsToSingle(int value)
- {
-#if NETCOREAPP3_1
- // Workaround for https://github.com/dotnet/runtime/issues/11413
- if (Sse2.IsSupported)
- {
- Vector128 vec = Vector128.CreateScalarUnsafe(value).AsSingle();
- return vec.ToScalar();
- }
-#endif
-
- return *((float*)&value);
- }
-
- ///
- /// Converts the specified 32-bit signed integer to a single-precision floating point number.
- ///
- /// The number to convert.
- /// A single-precision floating point number whose bits are identical to .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe double Int64BitsToDouble(long value)
- {
-#if NETCOREAPP3_1
- // Workaround for https://github.com/dotnet/runtime/issues/11413
- if (Sse2.X64.IsSupported)
- {
- Vector128 vec = Vector128.CreateScalarUnsafe(value).AsDouble();
- return vec.ToScalar();
- }
-#endif
-
- return *((double*)&value);
- }
-
-#endif
-
-#if NETFRAMEWORK || NETCOREAPP3_1
-
- ///
- /// Converts the specified 32-bit unsigned integer to a single-precision floating point number.
- ///
- /// The number to convert.
- /// A single-precision floating point number whose bits are identical to .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe float UInt32BitsToSingle(uint value) => Int32BitsToSingle((int)value);
-
- ///
- /// Converts the specified 32-bit unsigned integer to a single-precision floating point number.
- ///
- /// The number to convert.
- /// A single-precision floating point number whose bits are identical to .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe double UInt64BitsToDouble(ulong value) => Int64BitsToDouble((long)value);
-
-#endif
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Buffers/SequenceReader.cs b/src/IKVM.ByteCode/Buffers/SequenceReader.cs
deleted file mode 100644
index c93fd648a8..0000000000
--- a/src/IKVM.ByteCode/Buffers/SequenceReader.cs
+++ /dev/null
@@ -1,505 +0,0 @@
-// Copyright (c) All contributors. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-/* Licensed to the .NET Foundation under one or more agreements.
- * The .NET Foundation licenses this file to you under the MIT license.
- * See the LICENSE file in the project root for more information. */
-
-using System;
-using System.Buffers;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-
-namespace IKVM.ByteCode.Buffers
-{
-
-#if NETFRAMEWORK
-
- public ref partial struct SequenceReader
- where T : unmanaged, IEquatable
- {
-
- ///
- /// A value indicating whether we're using (as opposed to .
- ///
- private bool usingSequence;
-
- ///
- /// Backing for the entire sequence when we're not using .
- ///
- private ReadOnlySequence sequence;
-
- ///
- /// The position at the start of the .
- ///
- private SequencePosition currentPosition;
-
- ///
- /// The position at the end of the .
- ///
- private SequencePosition nextPosition;
-
- ///
- /// Backing for the entire sequence when we're not using .
- ///
- private ReadOnlyMemory memory;
-
- ///
- /// A value indicating whether there is unread data remaining.
- ///
- private bool moreData;
-
- ///
- /// The total number of elements in the sequence.
- ///
- private long length;
-
- ///
- /// Initializes a new instance of the struct
- /// over the given .
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public SequenceReader(ReadOnlySequence sequence)
- {
- this.usingSequence = true;
- this.CurrentSpanIndex = 0;
- this.Consumed = 0;
- this.sequence = sequence;
- this.memory = default;
- this.currentPosition = sequence.Start;
- this.length = -1;
-
- ReadOnlySpan first = sequence.First.Span;
- this.nextPosition = sequence.GetPosition(first.Length);
- this.CurrentSpan = first;
- this.moreData = first.Length > 0;
-
- if (!this.moreData && !sequence.IsSingleSegment)
- {
- this.moreData = true;
- this.GetNextSpan();
- }
- }
-
- ///
- /// Initializes a new instance of the struct
- /// over the given .
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public SequenceReader(ReadOnlyMemory memory)
- {
- this.usingSequence = false;
- this.CurrentSpanIndex = 0;
- this.Consumed = 0;
- this.memory = memory;
- this.CurrentSpan = memory.Span;
- this.length = memory.Length;
- this.moreData = memory.Length > 0;
-
- this.currentPosition = default;
- this.nextPosition = default;
- this.sequence = default;
- }
-
- ///
- /// Gets a value indicating whether there is no more data in the .
- ///
- public bool End => !this.moreData;
-
- ///
- /// Gets the underlying for the reader.
- ///
- public ReadOnlySequence Sequence
- {
- get
- {
- if (this.sequence.IsEmpty && !this.memory.IsEmpty)
- {
- // We're in memory mode (instead of sequence mode).
- // Lazily fill in the sequence data.
- this.sequence = new ReadOnlySequence(this.memory);
- this.currentPosition = this.sequence.Start;
- this.nextPosition = this.sequence.End;
- }
-
- return this.sequence;
- }
- }
-
- ///
- /// Gets the current position in the .
- ///
- public SequencePosition Position
- => this.Sequence.GetPosition(this.CurrentSpanIndex, this.currentPosition);
-
- ///
- /// Gets the current segment in the as a span.
- ///
- public ReadOnlySpan CurrentSpan { get; private set; }
-
- ///
- /// Gets the index in the .
- ///
- public int CurrentSpanIndex { get; private set; }
-
- ///
- /// Gets the unread portion of the .
- ///
- public ReadOnlySpan UnreadSpan
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get => this.CurrentSpan.Slice(this.CurrentSpanIndex);
- }
-
- ///
- /// Gets the total number of 's processed by the reader.
- ///
- public long Consumed { get; private set; }
-
- ///
- /// Gets remaining 's in the reader's .
- ///
- public long Remaining => this.Length - this.Consumed;
-
- ///
- /// Gets count of in the reader's .
- ///
- public long Length
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- if (this.length < 0)
- {
- // Cache the length
- this.length = this.Sequence.Length;
- }
-
- return this.length;
- }
- }
-
- ///
- /// Peeks at the next value without advancing the reader.
- ///
- /// The next value or default if at the end.
- /// False if at the end of the reader.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public bool TryPeek(out T value)
- {
- if (this.moreData)
- {
- value = this.CurrentSpan[this.CurrentSpanIndex];
- return true;
- }
- else
- {
- value = default;
- return false;
- }
- }
-
- ///
- /// Read the next value and advance the reader.
- ///
- /// The next value or default if at the end.
- /// False if at the end of the reader.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public bool TryRead(out T value)
- {
- if (this.End)
- {
- value = default;
- return false;
- }
-
- value = this.CurrentSpan[this.CurrentSpanIndex];
- this.CurrentSpanIndex++;
- this.Consumed++;
-
- if (this.CurrentSpanIndex >= this.CurrentSpan.Length)
- {
- if (this.usingSequence)
- {
- this.GetNextSpan();
- }
- else
- {
- this.moreData = false;
- }
- }
-
- return true;
- }
-
- ///
- /// Move the reader back the specified number of items.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Rewind(long count)
- {
- if (count < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(count));
- }
-
- this.Consumed -= count;
-
- if (this.CurrentSpanIndex >= count)
- {
- this.CurrentSpanIndex -= (int)count;
- this.moreData = true;
- }
- else if (this.usingSequence)
- {
- // Current segment doesn't have enough data, scan backward through segments
- this.RetreatToPreviousSpan(this.Consumed);
- }
- else
- {
- throw new ArgumentOutOfRangeException("Rewind went past the start of the memory.");
- }
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- private void RetreatToPreviousSpan(long consumed)
- {
- Debug.Assert(this.usingSequence, "usingSequence");
- this.ResetReader();
- this.Advance(consumed);
- }
-
- private void ResetReader()
- {
- Debug.Assert(this.usingSequence, "usingSequence");
- this.CurrentSpanIndex = 0;
- this.Consumed = 0;
- this.currentPosition = this.Sequence.Start;
- this.nextPosition = this.currentPosition;
-
- if (this.Sequence.TryGet(ref this.nextPosition, out ReadOnlyMemory memory, advance: true))
- {
- this.moreData = true;
-
- if (memory.Length == 0)
- {
- this.CurrentSpan = default;
-
- // No data in the first span, move to one with data
- this.GetNextSpan();
- }
- else
- {
- this.CurrentSpan = memory.Span;
- }
- }
- else
- {
- // No data in any spans and at end of sequence
- this.moreData = false;
- this.CurrentSpan = default;
- }
- }
-
- ///
- /// Get the next segment with available data, if any.
- ///
- private void GetNextSpan()
- {
- Debug.Assert(this.usingSequence, "usingSequence");
- if (!this.Sequence.IsSingleSegment)
- {
- SequencePosition previousNextPosition = this.nextPosition;
- while (this.Sequence.TryGet(ref this.nextPosition, out ReadOnlyMemory memory, advance: true))
- {
- this.currentPosition = previousNextPosition;
- if (memory.Length > 0)
- {
- this.CurrentSpan = memory.Span;
- this.CurrentSpanIndex = 0;
- return;
- }
- else
- {
- this.CurrentSpan = default;
- this.CurrentSpanIndex = 0;
- previousNextPosition = this.nextPosition;
- }
- }
- }
-
- this.moreData = false;
- }
-
- ///
- /// Move the reader ahead the specified number of items.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Advance(long count)
- {
- const long TooBigOrNegative = unchecked((long)0xFFFFFFFF80000000);
- if ((count & TooBigOrNegative) == 0 && this.CurrentSpan.Length - this.CurrentSpanIndex > (int)count)
- {
- this.CurrentSpanIndex += (int)count;
- this.Consumed += count;
- }
- else if (this.usingSequence)
- {
- // Can't satisfy from the current span
- this.AdvanceToNextSpan(count);
- }
- else if (this.CurrentSpan.Length - this.CurrentSpanIndex == (int)count)
- {
- this.CurrentSpanIndex += (int)count;
- this.Consumed += count;
- this.moreData = false;
- }
- else
- {
- throw new ArgumentOutOfRangeException(nameof(count));
- }
- }
-
- ///
- /// Unchecked helper to avoid unnecessary checks where you know count is valid.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void AdvanceCurrentSpan(long count)
- {
- Debug.Assert(count >= 0, "count >= 0");
-
- this.Consumed += count;
- this.CurrentSpanIndex += (int)count;
- if (this.usingSequence && this.CurrentSpanIndex >= this.CurrentSpan.Length)
- {
- this.GetNextSpan();
- }
- }
-
- ///
- /// Only call this helper if you know that you are advancing in the current span
- /// with valid count and there is no need to fetch the next one.
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal void AdvanceWithinSpan(long count)
- {
- Debug.Assert(count >= 0, "count >= 0");
-
- this.Consumed += count;
- this.CurrentSpanIndex += (int)count;
-
- Debug.Assert(this.CurrentSpanIndex < this.CurrentSpan.Length, "this.CurrentSpanIndex < this.CurrentSpan.Length");
- }
-
- ///
- /// Move the reader ahead the specified number of items
- /// if there are enough elements remaining in the sequence.
- ///
- /// true if there were enough elements to advance; otherwise false.
- internal bool TryAdvance(long count)
- {
- if (this.Remaining < count)
- {
- return false;
- }
-
- this.Advance(count);
- return true;
- }
-
- private void AdvanceToNextSpan(long count)
- {
- Debug.Assert(this.usingSequence, "usingSequence");
- if (count < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(count));
- }
-
- this.Consumed += count;
- while (this.moreData)
- {
- int remaining = this.CurrentSpan.Length - this.CurrentSpanIndex;
-
- if (remaining > count)
- {
- this.CurrentSpanIndex += (int)count;
- count = 0;
- break;
- }
-
- // As there may not be any further segments we need to
- // push the current index to the end of the span.
- this.CurrentSpanIndex += remaining;
- count -= remaining;
- Debug.Assert(count >= 0, "count >= 0");
-
- this.GetNextSpan();
-
- if (count == 0)
- {
- break;
- }
- }
-
- if (count != 0)
- {
- // Not enough data left- adjust for where we actually ended and throw
- this.Consumed -= count;
- throw new ArgumentOutOfRangeException(nameof(count));
- }
- }
-
- ///
- /// Copies data from the current to the given span.
- ///
- /// Destination to copy to.
- /// True if there is enough data to copy to the .
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public bool TryCopyTo(Span destination)
- {
- ReadOnlySpan firstSpan = this.UnreadSpan;
- if (firstSpan.Length >= destination.Length)
- {
- firstSpan.Slice(0, destination.Length).CopyTo(destination);
- return true;
- }
-
- return this.TryCopyMultisegment(destination);
- }
-
- internal bool TryCopyMultisegment(Span destination)
- {
- if (this.Remaining < destination.Length)
- {
- return false;
- }
-
- ReadOnlySpan firstSpan = this.UnreadSpan;
- Debug.Assert(firstSpan.Length < destination.Length, "firstSpan.Length < destination.Length");
- firstSpan.CopyTo(destination);
- int copied = firstSpan.Length;
-
- SequencePosition next = this.nextPosition;
- while (this.Sequence.TryGet(ref next, out ReadOnlyMemory nextSegment, true))
- {
- if (nextSegment.Length > 0)
- {
- ReadOnlySpan nextSpan = nextSegment.Span;
- int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
- nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied));
- copied += toCopy;
- if (copied >= destination.Length)
- {
- break;
- }
- }
- }
-
- return true;
- }
-
- }
-
-#endif
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Buffers/SequenceReaderExtensions.cs b/src/IKVM.ByteCode/Buffers/SequenceReaderExtensions.cs
deleted file mode 100644
index e60681a68f..0000000000
--- a/src/IKVM.ByteCode/Buffers/SequenceReaderExtensions.cs
+++ /dev/null
@@ -1,284 +0,0 @@
-using System;
-using System.Buffers;
-using System.Buffers.Binary;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace IKVM.ByteCode.Buffers
-{
-
- static partial class SequenceReaderExtensions
- {
-
- ///
- /// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary
- /// structs- see remarks for full details.
- ///
- ///
- /// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of its members to
- /// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit
- /// overloads such as .
- ///
- ///
- /// True if successful. will be default if failed (due to lack of space).
- ///
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static unsafe bool TryRead(ref this SequenceReader reader, out T value)
- where T : unmanaged
- {
- var span = reader.UnreadSpan;
- if (span.Length < sizeof(T))
- return TryReadMultisegment(ref reader, out value);
-
- value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(span));
- reader.Advance(sizeof(T));
- return true;
- }
-
- static unsafe bool TryReadMultisegment(ref SequenceReader reader, out T value)
- where T : unmanaged
- {
- Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)");
-
- // Not enough data in the current segment, try to peek for the data we need.
- var buffer = default(T);
- var tempSpan = new Span(&buffer, sizeof(T));
-
- if (!reader.TryCopyTo(tempSpan))
- {
- value = default;
- return false;
- }
-
- value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(tempSpan));
- reader.Advance(sizeof(T));
- return true;
- }
-
- ///
- /// Reads an from the next position in the sequence.
- ///
- /// The reader to read from.
- /// Receives the value read.
- /// true if there was another byte in the sequence; false otherwise.
- public static bool TryRead(ref this SequenceReader reader, out sbyte value)
- {
- if (TryRead(ref reader, out byte byteValue))
- {
- value = unchecked((sbyte)byteValue);
- return true;
- }
-
- value = default;
- return false;
- }
-
-#if NETFRAMEWORK
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out short value)
- {
- if (!BitConverter.IsLittleEndian)
- {
- return reader.TryRead(out value);
- }
-
- return TryReadReverseEndianness(ref reader, out value);
- }
-
-#endif
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out ushort value)
- {
- if (reader.TryReadBigEndian(out short shortValue))
- {
- value = unchecked((ushort)shortValue);
- return true;
- }
-
- value = default;
- return false;
- }
-
- private static bool TryReadReverseEndianness(ref SequenceReader reader, out short value)
- {
- if (reader.TryRead(out value))
- {
- value = BinaryPrimitives.ReverseEndianness(value);
- return true;
- }
-
- return false;
- }
-
-#if NETFRAMEWORK
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out int value)
- {
- return BitConverter.IsLittleEndian ? TryReadReverseEndianness(ref reader, out value) : reader.TryRead(out value);
- }
-
-#endif
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out uint value)
- {
- if (reader.TryReadBigEndian(out int intValue))
- {
- value = unchecked((uint)intValue);
- return true;
- }
-
- value = default;
- return false;
- }
-
- static bool TryReadReverseEndianness(ref SequenceReader reader, out int value)
- {
- if (reader.TryRead(out value))
- {
- value = BinaryPrimitives.ReverseEndianness(value);
- return true;
- }
-
- return false;
- }
-
-#if NETFRAMEWORK
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out long value)
- {
- return BitConverter.IsLittleEndian ? TryReadReverseEndianness(ref reader, out value) : reader.TryRead(out value);
- }
-
-#endif
-
- ///
- /// Reads an as big endian.
- ///
- /// False if there wasn't enough data for an .
- public static bool TryReadBigEndian(ref this SequenceReader reader, out ulong value)
- {
- if (reader.TryReadBigEndian(out long longValue))
- {
- value = unchecked((ulong)longValue);
- return true;
- }
-
- value = default;
- return false;
- }
-
- static bool TryReadReverseEndianness(ref SequenceReader reader, out long value)
- {
- if (reader.TryRead(out value))
- {
- value = BinaryPrimitives.ReverseEndianness(value);
- return true;
- }
-
- return false;
- }
-
- ///
- /// Reads a as big endian.
- ///
- /// False if there wasn't enough data for a .
- public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out float value)
- {
- if (reader.TryReadBigEndian(out int intValue))
- {
- value = *(float*)&intValue;
- return true;
- }
-
- value = default;
- return false;
- }
-
- ///
- /// Reads a as big endian.
- ///
- /// False if there wasn't enough data for a .
- public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out double value)
- {
- if (reader.TryReadBigEndian(out long longValue))
- {
- value = *(double*)&longValue;
- return true;
- }
-
- value = default;
- return false;
- }
-
- ///
- /// Try to read data with given .
- ///
- /// Read count.
- /// The read data, if successfully read requested data.
- /// true if remaining items in current is enough for .
- public static bool TryReadExact(ref this SequenceReader reader, int count, out ReadOnlySequence sequence)
- {
- if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count));
-
- if (count > reader.Remaining)
- {
- sequence = default;
- return false;
- }
-
- sequence = reader.Sequence.Slice(reader.Position, count);
- if (count != 0)
- reader.Advance(count);
-
- return true;
- }
-
- ///
- /// Try to read data with given .
- ///
- /// Read count.
- /// The read data, if successfully read requested data.
- /// true if remaining items in current is enough for .
- public static bool TryReadExact(ref this SequenceReader reader, long count, out ReadOnlySequence sequence)
- {
- if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count));
-
- if (count > reader.Remaining)
- {
- sequence = default;
- return false;
- }
-
- sequence = reader.Sequence.Slice(reader.Position, count);
- if (count != 0)
- reader.Advance(count);
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Buffers/UnsafeMemoryManager.cs b/src/IKVM.ByteCode/Buffers/UnsafeMemoryManager.cs
deleted file mode 100644
index 45495f1436..0000000000
--- a/src/IKVM.ByteCode/Buffers/UnsafeMemoryManager.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using System;
-using System.Buffers;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace IKVM.ByteCode.Buffers
-{
-
- ///
- /// A over a raw pointer.
- ///
- sealed unsafe class UnmanagedMemoryManager : MemoryManager
- {
-
- readonly void* pointer;
- readonly int length;
-
- ///
- /// Create a new UnmanagedMemoryManager instance at the given pointer and size
- ///
- /// It is assumed that the span provided is already unmanaged or externally pinned
- public UnmanagedMemoryManager(Span span)
- {
- pointer = Unsafe.AsPointer(ref MemoryMarshal.GetReference(span));
- length = span.Length;
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public UnmanagedMemoryManager(byte* pointer, int length)
- {
- if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length));
-
- this.pointer = pointer;
- this.length = length;
- }
-
- ///
- public override Span GetSpan() => new(pointer, length);
-
- ///
- public override MemoryHandle Pin(int elementIndex = 0)
- {
- if (elementIndex < 0 || elementIndex >= length)
- throw new ArgumentOutOfRangeException(nameof(elementIndex));
-
- return new MemoryHandle(Unsafe.Add(pointer, elementIndex));
- }
-
- ///
- public override void Unpin()
- {
- }
-
- ///
- protected override void Dispose(bool disposing)
- {
-
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/ByteCodeException.cs b/src/IKVM.ByteCode/ByteCodeException.cs
deleted file mode 100644
index d63f635f7b..0000000000
--- a/src/IKVM.ByteCode/ByteCodeException.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-using System.Runtime.Serialization;
-
-namespace IKVM.ByteCode
-{
-
- ///
- /// Represents an error that occurred with manipulation of Java byte code or class formats.
- ///
- [Serializable]
- public class ByteCodeException : Exception
- {
-
- ///
- /// Initializes a new instance.
- ///
- internal ByteCodeException()
- {
-
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- internal ByteCodeException(string message) :
- base(message)
- {
-
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- internal ByteCodeException(Exception innerException) :
- base(innerException.Message, innerException)
- {
-
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal ByteCodeException(string message, Exception innerException) :
- base(message, innerException)
- {
-
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- protected ByteCodeException(SerializationInfo info, StreamingContext context) :
- base(info, context)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/ClassFormatVersion.cs b/src/IKVM.ByteCode/ClassFormatVersion.cs
deleted file mode 100644
index 33896b9e9d..0000000000
--- a/src/IKVM.ByteCode/ClassFormatVersion.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- ///
- /// Describes a Java Class file format version number, consisting of a major and minor pair.
- ///
- ///
- ///
- internal record struct ClassFormatVersion(int Major, int Minor) : IComparable
- {
-
- public static implicit operator ClassFormatVersion(int major)
- {
- return new ClassFormatVersion(major, 0);
- }
-
- public static implicit operator string(ClassFormatVersion version)
- {
- return version.ToString();
- }
-
- public static bool operator >(ClassFormatVersion a, ClassFormatVersion b)
- {
- return a.CompareTo(b) is 1;
- }
-
- public static bool operator <(ClassFormatVersion a, ClassFormatVersion b)
- {
- return a.CompareTo(b) is -1;
- }
-
- public static bool operator >=(ClassFormatVersion a, ClassFormatVersion b)
- {
- return a.CompareTo(b) is 0 or 1;
- }
-
- public static bool operator <=(ClassFormatVersion a, ClassFormatVersion b)
- {
- return a.CompareTo(b) is 0 or -1;
- }
-
- public int CompareTo(ClassFormatVersion other)
- {
- if (Major < other.Major)
- return -1;
- else if (Major > other.Major)
- return 1;
-
- if (Minor < other.Minor)
- return -1;
- else if (Minor > other.Minor)
- return 1;
-
- return 0;
- }
-
- public override string ToString()
- {
- return $"{Major}.{Minor}";
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Compiler/IsExternalInit.cs b/src/IKVM.ByteCode/Compiler/IsExternalInit.cs
deleted file mode 100644
index e251a1ef91..0000000000
--- a/src/IKVM.ByteCode/Compiler/IsExternalInit.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NETCOREAPP3_0 || NETCOREAPP3_1 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48
-
-using System.ComponentModel;
-
-// ReSharper disable once CheckNamespace
-namespace System.Runtime.CompilerServices
-{
- ///
- /// Reserved to be used by the compiler for tracking metadata.
- /// This class should not be used by developers in source code.
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- internal static class IsExternalInit
- {
- }
-}
-
-#endif
diff --git a/src/IKVM.ByteCode/IKVM.ByteCode.csproj b/src/IKVM.ByteCode/IKVM.ByteCode.csproj
deleted file mode 100644
index 5c4203f6ac..0000000000
--- a/src/IKVM.ByteCode/IKVM.ByteCode.csproj
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- net472;net6.0;net7.0;net8.0
- 11
- true
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/IKVM.ByteCode/InvalidClassException.cs b/src/IKVM.ByteCode/InvalidClassException.cs
deleted file mode 100644
index 75246f0684..0000000000
--- a/src/IKVM.ByteCode/InvalidClassException.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace IKVM.ByteCode
-{
-
- ///
- /// Describes an attempt to parse an unsupported class file.
- ///
- internal class InvalidClassException :
- ByteCodeException
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- internal InvalidClassException(string message) :
- base(message)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/InvalidClassMagicException.cs b/src/IKVM.ByteCode/InvalidClassMagicException.cs
deleted file mode 100644
index 8a8146980a..0000000000
--- a/src/IKVM.ByteCode/InvalidClassMagicException.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-namespace IKVM.ByteCode
-{
-
- ///
- /// Describes an attempt to parse an unsupported class magic value.
- ///
- internal sealed class InvalidClassMagicException :
- InvalidClassException
- {
-
- readonly uint magic;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- internal InvalidClassMagicException(uint magic) :
- base($"Invalid class magic value {magic}.")
- {
- this.magic = magic;
- }
-
- ///
- /// Gets the magic that was found in the class file.
- ///
- public uint Magic => magic;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/LICENSE.md b/src/IKVM.ByteCode/LICENSE.md
deleted file mode 100644
index 474cf1932b..0000000000
--- a/src/IKVM.ByteCode/LICENSE.md
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2024 Jerome Haltom, etc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/src/IKVM.ByteCode/ModuleExportsFlag.cs b/src/IKVM.ByteCode/ModuleExportsFlag.cs
deleted file mode 100644
index 791f2b0085..0000000000
--- a/src/IKVM.ByteCode/ModuleExportsFlag.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- [Flags]
- internal enum ModuleExportsFlag : ushort
- {
-
- Synthetic = 0x1000,
- Mandated = 0x8000,
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/ModuleFlag.cs b/src/IKVM.ByteCode/ModuleFlag.cs
deleted file mode 100644
index 711ea82db7..0000000000
--- a/src/IKVM.ByteCode/ModuleFlag.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- [Flags]
- internal enum ModuleFlag : ushort
- {
-
- Open = 0x0020,
- Synthetic = 0x1000,
- Mandated = 0x8000,
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/ModuleOpensFlag.cs b/src/IKVM.ByteCode/ModuleOpensFlag.cs
deleted file mode 100644
index ea6ade7d54..0000000000
--- a/src/IKVM.ByteCode/ModuleOpensFlag.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- [Flags]
- internal enum ModuleOpensFlag : ushort
- {
-
- Synthetic = 0x1000,
- Mandated = 0x8000,
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/ModuleRequiresFlag.cs b/src/IKVM.ByteCode/ModuleRequiresFlag.cs
deleted file mode 100644
index da6dc0457c..0000000000
--- a/src/IKVM.ByteCode/ModuleRequiresFlag.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode
-{
-
- [Flags]
- internal enum ModuleRequiresFlag : ushort
- {
-
- Transitive = 0x0020,
- StaticPhase = 0x0040,
- Synthetic = 0x1000,
- Mandated = 0x8000,
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/AnnotationDefaultAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/AnnotationDefaultAttributeRecord.cs
deleted file mode 100644
index a714c0a5be..0000000000
--- a/src/IKVM.ByteCode/Parsing/AnnotationDefaultAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record AnnotationDefaultAttributeRecord(ElementValueRecord DefaultValue) : AttributeRecord
- {
-
- public static bool TryReadAnnotationDefaultAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (ElementValueRecord.TryRead(ref reader, out var defaultValue) == false)
- return false;
-
- attribute = new AnnotationDefaultAttributeRecord(defaultValue);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/AnnotationRecord.cs b/src/IKVM.ByteCode/Parsing/AnnotationRecord.cs
deleted file mode 100644
index c7da556b50..0000000000
--- a/src/IKVM.ByteCode/Parsing/AnnotationRecord.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct AnnotationRecord(ushort TypeIndex, ElementValuePairRecord[] Elements)
- {
-
- public static bool TryReadAnnotation(ref ClassFormatReader reader, out AnnotationRecord annotation)
- {
- annotation = default;
-
- if (reader.TryReadU2(out ushort typeIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort pairCount) == false)
- return false;
-
- var elements = new ElementValuePairRecord[pairCount];
- for (int i = 0; i < pairCount; i++)
- {
- if (ElementValuePairRecord.TryRead(ref reader, out var element) == false)
- return false;
-
- elements[i] = element;
- }
-
- annotation = new AnnotationRecord(typeIndex, elements);
- return true;
- }
-
- public int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
- size += sizeof(ushort);
-
- foreach (var element in Elements)
- size += element.GetSize();
-
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(TypeIndex) == false)
- return false;
- if (writer.TryWriteU2((ushort)Elements.Length) == false)
- return false;
-
- foreach (var element in Elements)
- if (element.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/AppendStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/AppendStackMapFrameRecord.cs
deleted file mode 100644
index 255022276a..0000000000
--- a/src/IKVM.ByteCode/Parsing/AppendStackMapFrameRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record AppendStackMapFrameRecord(byte Tag, ushort OffsetDelta, VerificationTypeInfoRecord[] Locals) : StackMapFrameRecord(Tag)
- {
-
- public static bool TryReadAppendStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU2(out ushort offsetDelta) == false)
- return false;
-
- var locals = new VerificationTypeInfoRecord[tag - 251];
- for (int i = 0; i < tag - 251; i++)
- {
- if (VerificationTypeInfoRecord.TryReadVerificationTypeInfo(ref reader, out var local) == false)
- return false;
-
- locals[i] = local;
- }
-
- frame = new AppendStackMapFrameRecord(tag, offsetDelta, locals);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/AttributeInfoRecord.cs b/src/IKVM.ByteCode/Parsing/AttributeInfoRecord.cs
deleted file mode 100644
index a60786bd8b..0000000000
--- a/src/IKVM.ByteCode/Parsing/AttributeInfoRecord.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct AttributeInfoRecord(ushort NameIndex, byte[] Data)
- {
-
- ///
- /// Parses an attribute.
- ///
- ///
- ///
- public static bool TryReadAttribute(ref ClassFormatReader reader, out AttributeInfoRecord attribute)
- {
- attribute = default;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU4(out uint length) == false)
- return false;
- if (reader.TryReadManyU1(length, out var info) == false)
- return false;
-
- var infoBuffer = new byte[info.Length];
- info.CopyTo(infoBuffer);
-
- attribute = new AttributeInfoRecord(nameIndex, infoBuffer);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/AttributeRecord.cs b/src/IKVM.ByteCode/Parsing/AttributeRecord.cs
deleted file mode 100644
index bc302ef9a8..0000000000
--- a/src/IKVM.ByteCode/Parsing/AttributeRecord.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using System.Buffers;
-
-using IKVM.ByteCode.Reading;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record AttributeRecord
- {
-
- ///
- /// Attempts to read an attribute data record from the specified .
- ///
- ///
- ///
- ///
- public static bool TryRead(AttributeInfoReader info, out AttributeRecord attribute)
- {
- return TryRead(info.Name.Value, new ReadOnlySequence(info.Data), out attribute);
- }
-
- ///
- /// Attempts to read an attribute data record from the specified .
- ///
- ///
- ///
- ///
- ///
- public static bool TryRead(string name, ReadOnlySequence data, out AttributeRecord attribute)
- {
- var reader = new ClassFormatReader(data);
- if (TryReadAttribute(name, ref reader, out attribute) == false)
- return false;
-
- return true;
- }
-
- ///
- /// Attempts to read a class record starting at the current position.
- ///
- ///
- ///
- ///
- ///
- ///
- public static bool TryReadAttribute(string name, ref ClassFormatReader reader, out AttributeRecord attribute) => name switch
- {
- "ConstantValue" => ConstantValueAttributeRecord.TryReadConstantValueAttribute(ref reader, out attribute),
- "Code" => CodeAttributeRecord.TryReadCodeAttribute(ref reader, out attribute),
- "StackMapTable" => StackMapTableAttributeRecord.TryRead(ref reader, out attribute),
- "Exceptions" => ExceptionsAttributeRecord.TryReadExceptionsAttribute(ref reader, out attribute),
- "InnerClasses" => InnerClassesAttributeRecord.TryReadInnerClassesAttribute(ref reader, out attribute),
- "EnclosingMethod" => EnclosingMethodAttributeRecord.TryReadEnclosingMethodAttribute(ref reader, out attribute),
- "Synthetic" => SyntheticAttributeRecord.TryReadSyntheticAttribute(ref reader, out attribute),
- "Signature" => SignatureAttributeRecord.TryReadSignatureAttribute(ref reader, out attribute),
- "SourceFile" => SourceFileAttributeRecord.TryReadSourceFileAttribute(ref reader, out attribute),
- "SourceDebugExtension" => SourceDebugExtensionAttributeRecord.TryReadSourceDebugExtensionAttribute(ref reader, out attribute),
- "LineNumberTable" => LineNumberTableAttributeRecord.TryReadLineNumberTableAttribute(ref reader, out attribute),
- "LocalVariableTable" => LocalVariableTableAttributeRecord.TryReadLocalVariableTableAttribute(ref reader, out attribute),
- "LocalVariableTypeTable" => LocalVariableTypeTableAttributeRecord.TryReadLocalVariableTypeTableAttribute(ref reader, out attribute),
- "Deprecated" => DeprecatedAttributeRecord.TryReadDeprecatedAttribute(ref reader, out attribute),
- "RuntimeVisibleAnnotations" => RuntimeVisibleAnnotationsAttributeRecord.TryReadRuntimeVisibleAnnotationsAttribute(ref reader, out attribute),
- "RuntimeInvisibleAnnotations" => RuntimeInvisibleAnnotationsAttributeRecord.TryReadRuntimeInvisibleAnnotationsAttribute(ref reader, out attribute),
- "RuntimeVisibleParameterAnnotations" => RuntimeVisibleParameterAnnotationsAttributeRecord.TryReadRuntimeVisibleParameterAnnotationsAttribute(ref reader, out attribute),
- "RuntimeInvisibleParameterAnnotations" => RuntimeInvisibleParameterAnnotationsAttributeRecord.TryReadRuntimeInvisibleParameterAnnotationsAttribute(ref reader, out attribute),
- "RuntimeVisibleTypeAnnotations" => RuntimeVisibleTypeAnnotationsAttributeRecord.TryReadRuntimeVisibleTypeAnnotationsAttribute(ref reader, out attribute),
- "RuntimeInvisibleTypeAnnotations" => RuntimeInvisibleTypeAnnotationsAttributeRecord.TryReadRuntimeInvisibleTypeAnnotationsAttribute(ref reader, out attribute),
- "AnnotationDefault" => AnnotationDefaultAttributeRecord.TryReadAnnotationDefaultAttribute(ref reader, out attribute),
- "BootstrapMethods" => BootstrapMethodsAttributeRecord.TryReadBootstrapMethodsAttribute(ref reader, out attribute),
- "MethodParameters" => MethodParametersAttributeRecord.TryReadMethodParametersAttribute(ref reader, out attribute),
- "Module" => ModuleAttributeRecord.TryReadModuleAttribute(ref reader, out attribute),
- "ModulePackages" => ModulePackagesAttributeRecord.TryReadModulePackagesAttribute(ref reader, out attribute),
- "ModuleMainClass" => ModuleMainClassAttributeRecord.TryReadModuleMainClassAttribute(ref reader, out attribute),
- "NestHost" => NestHostAttributeRecord.TryReadNestHostAttribute(ref reader, out attribute),
- "NestMembers" => NestMembersAttributeRecord.TryReadNestMembersAttribute(ref reader, out attribute),
- "Record" => RecordAttributeRecord.TryReadRecordAttribute(ref reader, out attribute),
- "PermittedSubclasses" => PermittedSubclassesAttributeRecord.TryReadPermittedSubclassesAttribute(ref reader, out attribute),
- _ => UnknownAttributeRecord.TryReadCustomAttribute(ref reader, out attribute),
- };
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeMethodRecord.cs b/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeMethodRecord.cs
deleted file mode 100644
index b40529a97b..0000000000
--- a/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeMethodRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct BootstrapMethodsAttributeMethodRecord(ushort MethodRefIndex, ushort[] Arguments)
- {
-
- public static bool TryReadBootstrapMethod(ref ClassFormatReader reader, out BootstrapMethodsAttributeMethodRecord method)
- {
- method = default;
-
- if (reader.TryReadU2(out ushort methodRefIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort argumentCount) == false)
- return false;
-
- var arguments = new ushort[argumentCount];
- for (int i = 0; i < argumentCount; i++)
- {
- if (reader.TryReadU2(out ushort argumentIndex) == false)
- return false;
-
- arguments[i] = argumentIndex;
- }
-
- method = new BootstrapMethodsAttributeMethodRecord(methodRefIndex, arguments);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeRecord.cs
deleted file mode 100644
index 5fa5c4e554..0000000000
--- a/src/IKVM.ByteCode/Parsing/BootstrapMethodsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record BootstrapMethodsAttributeRecord(BootstrapMethodsAttributeMethodRecord[] Methods) : AttributeRecord
- {
-
- public static bool TryReadBootstrapMethodsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var methods = new BootstrapMethodsAttributeMethodRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (BootstrapMethodsAttributeMethodRecord.TryReadBootstrapMethod(ref reader, out var method) == false)
- return false;
-
- methods[i] = method;
- }
-
- attribute = new BootstrapMethodsAttributeRecord(methods);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ChopStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/ChopStackMapFrameRecord.cs
deleted file mode 100644
index cd7a52c5a6..0000000000
--- a/src/IKVM.ByteCode/Parsing/ChopStackMapFrameRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ChopStackMapFrameRecord(byte Tag, ushort OffsetDelta) : StackMapFrameRecord(Tag)
- {
-
- public static bool TryReadChopStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU2(out ushort offsetDelta) == false)
- return false;
-
- frame = new ChopStackMapFrameRecord(tag, offsetDelta);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ClassConstantRecord.cs b/src/IKVM.ByteCode/Parsing/ClassConstantRecord.cs
deleted file mode 100644
index 67502749e5..0000000000
--- a/src/IKVM.ByteCode/Parsing/ClassConstantRecord.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ClassConstantRecord(ushort NameIndex) : ConstantRecord
- {
-
- ///
- /// Parses a Class constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadClassConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
-
- constant = new ClassConstantRecord(nameIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ClassFormatReader.cs b/src/IKVM.ByteCode/Parsing/ClassFormatReader.cs
deleted file mode 100644
index 7e9247dc8d..0000000000
--- a/src/IKVM.ByteCode/Parsing/ClassFormatReader.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-using System;
-using System.Buffers;
-
-using IKVM.ByteCode.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- ///
- /// Provides common methods to read through memory of a Class file.
- ///
- internal ref struct ClassFormatReader
- {
-
- SequenceReader reader;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- public ClassFormatReader(ReadOnlyMemory buffer) :
- this(new ReadOnlySequence(buffer))
- {
-
- }
-
- ///
- /// Initializes a new instance.
- ///
- ///
- public ClassFormatReader(ReadOnlySequence sequence)
- {
- reader = new SequenceReader(sequence);
- }
-
- ///
- /// Gets the count of bytes in the reader.
- ///
- public readonly long Length => reader.Length;
-
- ///
- /// Gets the current position in the reader.
- ///
- public readonly SequencePosition Position => reader.Position;
-
- ///
- /// Attempts to read a value defined as a 'u1'.
- ///
- ///
- ///
- public bool TryReadU1(out byte u1)
- {
- return reader.TryRead(out u1);
- }
-
- ///
- /// Attempts to read a value defined as a 'u2'.
- ///
- ///
- ///
- public bool TryReadU2(out ushort u2)
- {
- return reader.TryReadBigEndian(out u2);
- }
-
- ///
- /// Attempts to read a value defined as a 'u4'.
- ///
- ///
- ///
- public bool TryReadU4(out uint u4)
- {
- return reader.TryReadBigEndian(out u4);
- }
-
- ///
- /// Attempts to read the exact given number of bytes.
- ///
- ///
- ///
- ///
- public bool TryReadManyU1(uint count, out ReadOnlySequence sequence)
- {
- return reader.TryReadExact(count, out sequence);
- }
-
- ///
- /// Attempts to read the exact given number of bytes.
- ///
- ///
- ///
- ///
- public bool TryReadManyU1(long count, out ReadOnlySequence sequence)
- {
- return reader.TryReadExact(count, out sequence);
- }
-
- ///
- /// Attempts to copy available data at the current position to the destination.
- ///
- ///
- ///
- public bool TryCopyTo(Span destination)
- {
- return reader.TryCopyTo(destination);
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ClassFormatWriter.cs b/src/IKVM.ByteCode/Parsing/ClassFormatWriter.cs
deleted file mode 100644
index eba9ddc1fe..0000000000
--- a/src/IKVM.ByteCode/Parsing/ClassFormatWriter.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.Buffers.Binary;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- ///
- /// Provides a forward-only writer of big-endian values.
- ///
- internal ref struct ClassFormatWriter
- {
-
- Span span;
- Span next;
- long size = 0;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- public ClassFormatWriter(Span span)
- {
- this.span = next = span;
- }
-
- ///
- /// Gets the span being written to.
- ///
- public Span Span => span;
-
- ///
- /// Gets the total number of written bytes.
- ///
- public long Size => size;
-
- ///
- /// Writes a value defined as a 'u1' in the class format specification.
- ///
- ///
- ///
- public bool TryWriteU1(byte value)
- {
- if (next.Length < sizeof(byte))
- return false;
-
- next[0] = value;
- next = next.Slice(sizeof(byte));
- size += sizeof(byte);
- return true;
- }
-
- ///
- /// Writes a value defined as a 'u2' in the class format specification.
- ///
- ///
- ///
- public bool TryWriteU2(ushort value)
- {
- if (next.Length < sizeof(ushort))
- return false;
-
- BinaryPrimitives.WriteUInt16BigEndian(next, value);
- next = next.Slice(sizeof(ushort));
- size += sizeof(ushort);
- return true;
- }
-
- ///
- /// Writes a value defined as a 'u4' in the class format specification.
- ///
- ///
- ///
- public bool TryWriteU4(uint value)
- {
- if (next.Length < sizeof(uint))
- return false;
-
- BinaryPrimitives.WriteUInt32BigEndian(next, value);
- next = next.Slice(sizeof(uint));
- size += sizeof(uint);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ClassRecord.cs b/src/IKVM.ByteCode/Parsing/ClassRecord.cs
deleted file mode 100644
index f5cae1370e..0000000000
--- a/src/IKVM.ByteCode/Parsing/ClassRecord.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ClassRecord(ushort MinorVersion, ushort MajorVersion, ConstantRecord[] Constants, AccessFlag AccessFlags, ushort ThisClassIndex, ushort SuperClassIndex, InterfaceRecord[] Interfaces, FieldRecord[] Fields, MethodRecord[] Methods, AttributeInfoRecord[] Attributes)
- {
-
- const uint MAGIC = 0xCAFEBABE;
-
- ///
- /// Attempts to read a class record starting at the current position.
- ///
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out ClassRecord clazz)
- {
- clazz = default;
-
- if (reader.TryReadU4(out uint magic) == false)
- return false;
- if (magic != MAGIC)
- throw new InvalidClassMagicException(magic);
-
- if (reader.TryReadU2(out ushort minorVersion) == false)
- return false;
- if (reader.TryReadU2(out ushort majorVersion) == false)
- return false;
-
- if (majorVersion > 63)
- throw new UnsupportedClassVersionException(new ClassFormatVersion(majorVersion, minorVersion));
-
- if (TryReadConstants(ref reader, out var constants) == false)
- return false;
-
- if (reader.TryReadU2(out ushort accessFlags) == false)
- return false;
-
- if (reader.TryReadU2(out ushort thisClass) == false)
- return false;
-
- if (reader.TryReadU2(out ushort superClass) == false)
- return false;
-
- if (TryReadInterfaces(ref reader, out var interfaces) == false)
- return false;
-
- if (TryReadFields(ref reader, out var fields) == false)
- return false;
-
- if (TryReadMethods(ref reader, out var methods) == false)
- return false;
-
- if (TryReadAttributes(ref reader, out var attributes) == false)
- return false;
-
- clazz = new ClassRecord(minorVersion, majorVersion, constants, (AccessFlag)accessFlags, thisClass, superClass, interfaces, fields, methods, attributes);
- return true;
- }
-
- ///
- /// Attempts to read the set of constants at the current position.
- ///
- ///
- ///
- ///
- static bool TryReadConstants(ref ClassFormatReader reader, out ConstantRecord[] constants)
- {
- constants = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- constants = new ConstantRecord[count];
- for (int i = 1; i < count; i++)
- {
- if (ConstantRecord.TryRead(ref reader, out var constant, out var skip) == false)
- return false;
-
- constants[i] = constant;
- i += skip;
- }
-
- return true;
- }
-
- ///
- /// Attempts to read the set of interfaces starting from the current position.
- ///
- ///
- ///
- ///
- static bool TryReadInterfaces(ref ClassFormatReader reader, out InterfaceRecord[] interfaces)
- {
- interfaces = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- interfaces = new InterfaceRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (InterfaceRecord.TryRead(ref reader, out InterfaceRecord iface) == false)
- return false;
-
- interfaces[i] = iface;
- }
-
- return true;
- }
-
- ///
- /// Attempts to read the set of fields starting from the current position.
- ///
- ///
- ///
- ///
- static bool TryReadFields(ref ClassFormatReader reader, out FieldRecord[] fields)
- {
- fields = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- fields = new FieldRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (FieldRecord.TryRead(ref reader, out FieldRecord field) == false)
- return false;
-
- fields[i] = field;
- }
-
- return true;
- }
-
- ///
- /// Attempts to read the set of methods starting from the current position.
- ///
- ///
- ///
- ///
- static bool TryReadMethods(ref ClassFormatReader reader, out MethodRecord[] methods)
- {
- methods = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- methods = new MethodRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (MethodRecord.TryRead(ref reader, out MethodRecord method) == false)
- return false;
-
- methods[i] = method;
- }
-
- return true;
- }
-
- ///
- /// Parses an attributes count followed by a sequence of attributes.
- ///
- ///
- ///
- internal static bool TryReadAttributes(ref ClassFormatReader reader, out AttributeInfoRecord[] attributes)
- {
- attributes = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- attributes = new AttributeInfoRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (AttributeInfoRecord.TryReadAttribute(ref reader, out var attribute) == false)
- return false;
-
- attributes[i] = attribute;
- }
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/CodeAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/CodeAttributeRecord.cs
deleted file mode 100644
index e8bd677a31..0000000000
--- a/src/IKVM.ByteCode/Parsing/CodeAttributeRecord.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record CodeAttributeRecord(ushort MaxStack, ushort MaxLocals, ReadOnlyMemory Code, ExceptionHandlerRecord[] ExceptionTable, AttributeInfoRecord[] Attributes) : AttributeRecord
- {
-
- public static bool TryReadCodeAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort maxStack) == false)
- return false;
- if (reader.TryReadU2(out ushort maxLocals) == false)
- return false;
- if (reader.TryReadU4(out uint codeLength) == false)
- return false;
- if (reader.TryReadManyU1(codeLength, out ReadOnlySequence code) == false)
- return false;
-
- var codeBuffer = new byte[code.Length];
- code.CopyTo(codeBuffer);
-
- if (reader.TryReadU2(out ushort exceptionTableLength) == false)
- return false;
-
- var exceptionTable = new ExceptionHandlerRecord[(int)exceptionTableLength];
- for (int i = 0; i < exceptionTableLength; i++)
- {
- if (reader.TryReadU2(out ushort startOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort endOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort handlerOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort catchTypeIndex) == false)
- return false;
-
- exceptionTable[i] = new ExceptionHandlerRecord(startOffset, endOffset, handlerOffset, catchTypeIndex);
- }
-
- if (ClassRecord.TryReadAttributes(ref reader, out var attributes) == false)
- return false;
-
- attribute = new CodeAttributeRecord(maxStack, maxLocals, codeBuffer, exceptionTable, attributes);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ConstantRecord.cs b/src/IKVM.ByteCode/Parsing/ConstantRecord.cs
deleted file mode 100644
index 3986e4cb61..0000000000
--- a/src/IKVM.ByteCode/Parsing/ConstantRecord.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- ///
- /// Base type for constant records.
- ///
- internal abstract record ConstantRecord
- {
-
- ///
- /// Attempts to read the constant at the current position. Returns the the number of index positions to skip.
- ///
- ///
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU1(out byte tag) == false)
- return false;
-
- return (ConstantTag)tag switch
- {
- ConstantTag.Utf8 => Utf8ConstantRecord.TryReadUtf8Constant(ref reader, out constant, out skip),
- ConstantTag.Integer => IntegerConstantRecord.TryReadIntegerConstant(ref reader, out constant, out skip),
- ConstantTag.Float => FloatConstantRecord.TryReadFloatConstant(ref reader, out constant, out skip),
- ConstantTag.Long => LongConstantRecord.TryReadLongConstant(ref reader, out constant, out skip),
- ConstantTag.Double => DoubleConstantRecord.TryReadDoubleConstant(ref reader, out constant, out skip),
- ConstantTag.Class => ClassConstantRecord.TryReadClassConstant(ref reader, out constant, out skip),
- ConstantTag.String => StringConstantRecord.TryReadStringConstant(ref reader, out constant, out skip),
- ConstantTag.Fieldref => FieldrefConstantRecord.TryReadFieldrefConstant(ref reader, out constant, out skip),
- ConstantTag.Methodref => MethodrefConstantRecord.TryReadMethodrefConstant(ref reader, out constant, out skip),
- ConstantTag.InterfaceMethodref => InterfaceMethodrefConstantRecord.TryReadInterfaceMethodrefConstant(ref reader, out constant, out skip),
- ConstantTag.NameAndType => NameAndTypeConstantRecord.TryReadNameAndTypeConstant(ref reader, out constant, out skip),
- ConstantTag.MethodHandle => MethodHandleConstantRecord.TryReadMethodHandleConstant(ref reader, out constant, out skip),
- ConstantTag.MethodType => MethodTypeConstantRecord.TryReadMethodTypeConstant(ref reader, out constant, out skip),
- ConstantTag.Dynamic => DynamicConstantRecord.TryReadDynamicConstant(ref reader, out constant, out skip),
- ConstantTag.InvokeDynamic => InvokeDynamicConstantRecord.TryReadInvokeDynamicConstant(ref reader, out constant, out skip),
- ConstantTag.Module => ModuleConstantRecord.TryReadModuleConstant(ref reader, out constant, out skip),
- ConstantTag.Package => PackageConstantRecord.TryReadPackageConstant(ref reader, out constant, out skip),
- _ => throw new ByteCodeException($"Encountered an unknown constant tag: '0x{tag:X}'."),
- };
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ConstantTag.cs b/src/IKVM.ByteCode/Parsing/ConstantTag.cs
deleted file mode 100644
index 94a712c1d3..0000000000
--- a/src/IKVM.ByteCode/Parsing/ConstantTag.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal enum ConstantTag : byte
- {
-
- Utf8 = 1,
- Integer = 3,
- Float = 4,
- Long = 5,
- Double = 6,
- Class = 7,
- String = 8,
- Fieldref = 9,
- Methodref = 10,
- InterfaceMethodref = 11,
- NameAndType = 12,
- MethodHandle = 15,
- MethodType = 16,
- Dynamic = 17,
- InvokeDynamic = 18,
- Module = 19,
- Package = 20,
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ConstantValueAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/ConstantValueAttributeRecord.cs
deleted file mode 100644
index 1859a13d23..0000000000
--- a/src/IKVM.ByteCode/Parsing/ConstantValueAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ConstantValueAttributeRecord(ushort ValueIndex) : AttributeRecord
- {
-
- public static bool TryReadConstantValueAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort valueIndex) == false)
- return false;
-
- attribute = new ConstantValueAttributeRecord(valueIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/DeprecatedAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/DeprecatedAttributeRecord.cs
deleted file mode 100644
index eb835d2106..0000000000
--- a/src/IKVM.ByteCode/Parsing/DeprecatedAttributeRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record DeprecatedAttributeRecord : AttributeRecord
- {
-
- public static bool TryReadDeprecatedAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = new DeprecatedAttributeRecord();
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/DoubleConstantRecord.cs b/src/IKVM.ByteCode/Parsing/DoubleConstantRecord.cs
deleted file mode 100644
index 420e4564eb..0000000000
--- a/src/IKVM.ByteCode/Parsing/DoubleConstantRecord.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record DoubleConstantRecord(double Value) : ConstantRecord
- {
-
- ///
- /// Parses a Double constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadDoubleConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 1;
-
- if (reader.TryReadU4(out uint a) == false)
- return false;
- if (reader.TryReadU4(out uint b) == false)
- return false;
-
-#if NETFRAMEWORK || NETCOREAPP3_1
- var v = RawBitConverter.UInt64BitsToDouble(((ulong)a << 32) | b);
-#else
- var v = BitConverter.UInt64BitsToDouble(((ulong)a << 32) | b);
-#endif
-
- constant = new DoubleConstantRecord(v);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/DoubleVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/DoubleVariableInfoRecord.cs
deleted file mode 100644
index 3363bcad60..0000000000
--- a/src/IKVM.ByteCode/Parsing/DoubleVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record DoubleVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new DoubleVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/DynamicConstantRecord.cs b/src/IKVM.ByteCode/Parsing/DynamicConstantRecord.cs
deleted file mode 100644
index c5e003142e..0000000000
--- a/src/IKVM.ByteCode/Parsing/DynamicConstantRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record DynamicConstantRecord(ushort BootstrapMethodAttributeIndex, ushort NameAndTypeIndex) : ConstantRecord
- {
-
- ///
- /// Parses a Dynamic constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadDynamicConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skipIndex)
- {
- constant = null;
- skipIndex = 0;
-
- if (reader.TryReadU2(out ushort bootstrapMethodAttrIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort nameAndTypeIndex) == false)
- return false;
-
- constant = new DynamicConstantRecord(bootstrapMethodAttrIndex, nameAndTypeIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueAnnotationValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueAnnotationValueRecord.cs
deleted file mode 100644
index 229f263559..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueAnnotationValueRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ElementValueAnnotationValueRecord(AnnotationRecord Annotation) : ElementValueValueRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueValueRecord value)
- {
- value = null;
-
- if (AnnotationRecord.TryReadAnnotation(ref reader, out var annotation) == false)
- return false;
-
- value = new ElementValueAnnotationValueRecord(annotation);
- return true;
- }
-
- public override int GetSize()
- {
- var size = 0;
- size += Annotation.GetSize();
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (Annotation.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueArrayValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueArrayValueRecord.cs
deleted file mode 100644
index d1c6b664c9..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueArrayValueRecord.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ElementValueArrayValueRecord(ElementValueRecord[] Values) : ElementValueValueRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueValueRecord value)
- {
- value = null;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
-
- var values = new ElementValueRecord[length];
- for (int i = 0; i < length; i++)
- {
- if (ElementValueRecord.TryRead(ref reader, out var j) == false)
- return false;
-
- values[i] = j;
- }
-
- value = new ElementValueArrayValueRecord(values);
- return true;
- }
-
- public override int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
-
- foreach (var value in Values)
- size += value.GetSize();
-
- return size;
- }
-
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2((ushort)Values.Length) == false)
- return false;
-
- foreach (var value in Values)
- if (value.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueClassValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueClassValueRecord.cs
deleted file mode 100644
index 8267ae8a46..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueClassValueRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ElementValueClassValueRecord(ushort ClassIndex) : ElementValueValueRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueValueRecord value)
- {
- value = null;
-
- if (reader.TryReadU2(out ushort classInfoIndex) == false)
- return false;
-
- value = new ElementValueClassValueRecord(classInfoIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(ClassIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueConstantValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueConstantValueRecord.cs
deleted file mode 100644
index 6d791c6d00..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueConstantValueRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ElementValueConstantValueRecord(ushort Index) : ElementValueValueRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueValueRecord value)
- {
- value = null;
-
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- value = new ElementValueConstantValueRecord(index);
- return true;
- }
-
- public override int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(Index) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueEnumConstantValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueEnumConstantValueRecord.cs
deleted file mode 100644
index 15b3717f24..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueEnumConstantValueRecord.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ElementValueEnumConstantValueRecord(ushort TypeNameIndex, ushort ConstantNameIndex) : ElementValueValueRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueValueRecord value)
- {
- value = null;
-
- if (reader.TryReadU2(out ushort typeNameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort constantNameIndex) == false)
- return false;
-
- value = new ElementValueEnumConstantValueRecord(typeNameIndex, constantNameIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
- size += sizeof(ushort);
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(TypeNameIndex) == false)
- return false;
- if (writer.TryWriteU2(ConstantNameIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValuePairRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValuePairRecord.cs
deleted file mode 100644
index f94ed0427a..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValuePairRecord.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ElementValuePairRecord(ushort NameIndex, ElementValueRecord Value)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValuePairRecord record)
- {
- record = default;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (ElementValueRecord.TryRead(ref reader, out var elementValue) == false)
- return false;
-
- record = new ElementValuePairRecord(nameIndex, elementValue);
- return true;
- }
-
- public int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
- size += Value.GetSize();
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(NameIndex) == false)
- return false;
- if (Value.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueRecord.cs
deleted file mode 100644
index 4014a0f920..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueRecord.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ElementValueRecord(ElementValueTag Tag, ElementValueValueRecord Value)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out ElementValueRecord record)
- {
- record = default;
-
- if (reader.TryReadU1(out byte tag) == false)
- return false;
- if (TryReadValue(ref reader, (ElementValueTag)tag, out var value) == false)
- return false;
-
- record = new ElementValueRecord((ElementValueTag)tag, value);
- return true;
- }
-
- static bool TryReadValue(ref ClassFormatReader reader, ElementValueTag tag, out ElementValueValueRecord value) => tag switch
- {
- ElementValueTag.Byte => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Char => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Double => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Float => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Integer => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Long => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Short => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Boolean => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.String => ElementValueConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Enum => ElementValueEnumConstantValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Class => ElementValueClassValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Annotation => ElementValueAnnotationValueRecord.TryRead(ref reader, out value),
- ElementValueTag.Array => ElementValueArrayValueRecord.TryRead(ref reader, out value),
- _ => throw new ByteCodeException($"Invalid element value tag: '{(char)tag}'."),
- };
-
- public int GetSize()
- {
- var size = 0;
- size += sizeof(byte);
- size += Value.GetSize();
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1((byte)Tag) == false)
- return false;
-
- if (Value.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueTag.cs b/src/IKVM.ByteCode/Parsing/ElementValueTag.cs
deleted file mode 100644
index 76e388b5e6..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueTag.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal enum ElementValueTag : byte
- {
-
- Byte = (byte)'B',
- Char = (byte)'C',
- Double = (byte)'D',
- Float = (byte)'F',
- Integer = (byte)'I',
- Long = (byte)'J',
- Short = (byte)'S',
- Boolean = (byte)'Z',
- String = (byte)'s',
- Enum = (byte)'e',
- Class = (byte)'c',
- Annotation = (byte)'@',
- Array = (byte)'[',
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ElementValueValueRecord.cs b/src/IKVM.ByteCode/Parsing/ElementValueValueRecord.cs
deleted file mode 100644
index e1d51b57c1..0000000000
--- a/src/IKVM.ByteCode/Parsing/ElementValueValueRecord.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record ElementValueValueRecord
- {
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public abstract int GetSize();
-
- ///
- /// Attempts to write the record to the .
- ///
- ///
- ///
- public abstract bool TryWrite(ref ClassFormatWriter writer);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/EnclosingMethodAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/EnclosingMethodAttributeRecord.cs
deleted file mode 100644
index 0d19202ea7..0000000000
--- a/src/IKVM.ByteCode/Parsing/EnclosingMethodAttributeRecord.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record EnclosingMethodAttributeRecord(ushort ClassIndex, ushort MethodIndex) : AttributeRecord
- {
-
- public static bool TryReadEnclosingMethodAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort methodIndex) == false)
- return false;
-
- attribute = new EnclosingMethodAttributeRecord(classIndex, methodIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ExceptionHandlerRecord.cs b/src/IKVM.ByteCode/Parsing/ExceptionHandlerRecord.cs
deleted file mode 100644
index e17b4ef97f..0000000000
--- a/src/IKVM.ByteCode/Parsing/ExceptionHandlerRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ExceptionHandlerRecord(ushort StartOffset, ushort EndOffset, ushort HandlerOffset, ushort CatchTypeIndex);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ExceptionsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/ExceptionsAttributeRecord.cs
deleted file mode 100644
index e000b4f5ec..0000000000
--- a/src/IKVM.ByteCode/Parsing/ExceptionsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ExceptionsAttributeRecord(ushort[] ExceptionsIndexes) : AttributeRecord
- {
-
- public static bool TryReadExceptionsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var entries = new ushort[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- entries[i] = index;
- }
-
- attribute = new ExceptionsAttributeRecord(entries);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/FieldRecord.cs b/src/IKVM.ByteCode/Parsing/FieldRecord.cs
deleted file mode 100644
index 5471982603..0000000000
--- a/src/IKVM.ByteCode/Parsing/FieldRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct FieldRecord(AccessFlag AccessFlags, ushort NameIndex, ushort DescriptorIndex, AttributeInfoRecord[] Attributes)
- {
-
- ///
- /// Parses a field.
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out FieldRecord field)
- {
- field = default;
-
- if (reader.TryReadU2(out ushort accessFlags) == false)
- return false;
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
- if (ClassRecord.TryReadAttributes(ref reader, out var attributes) == false)
- return false;
-
- field = new FieldRecord((AccessFlag)accessFlags, nameIndex, descriptorIndex, attributes);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/FieldrefConstantRecord.cs b/src/IKVM.ByteCode/Parsing/FieldrefConstantRecord.cs
deleted file mode 100644
index da7a9c03b6..0000000000
--- a/src/IKVM.ByteCode/Parsing/FieldrefConstantRecord.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record FieldrefConstantRecord(ushort ClassIndex, ushort NameAndTypeIndex) : RefConstantRecord(ClassIndex, NameAndTypeIndex)
- {
-
- ///
- /// Parses a Fieldref constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadFieldrefConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort nameAndTypeIndex) == false)
- return false;
-
- constant = new FieldrefConstantRecord(classIndex, nameAndTypeIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/FloatConstantRecord.cs b/src/IKVM.ByteCode/Parsing/FloatConstantRecord.cs
deleted file mode 100644
index 7078cff4ef..0000000000
--- a/src/IKVM.ByteCode/Parsing/FloatConstantRecord.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record FloatConstantRecord(float Value) : ConstantRecord
- {
-
- ///
- /// Parses a Float constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadFloatConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU4(out uint value) == false)
- return false;
-
-#if NETFRAMEWORK || NETCOREAPP3_1
- var v = RawBitConverter.UInt32BitsToSingle(value);
-#else
- var v = BitConverter.UInt32BitsToSingle(value);
-#endif
-
- constant = new FloatConstantRecord(v);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/FloatVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/FloatVariableInfoRecord.cs
deleted file mode 100644
index 538ab9bf7e..0000000000
--- a/src/IKVM.ByteCode/Parsing/FloatVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record FloatVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new FloatVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/FullStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/FullStackMapFrameRecord.cs
deleted file mode 100644
index 0a933c5247..0000000000
--- a/src/IKVM.ByteCode/Parsing/FullStackMapFrameRecord.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record FullStackMapFrameRecord(byte Tag, ushort OffsetDelta, VerificationTypeInfoRecord[] Locals, VerificationTypeInfoRecord[] Stack) : StackMapFrameRecord(Tag)
- {
-
- public static bool TryReadFullStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU2(out ushort offsetDelta) == false)
- return false;
-
- if (reader.TryReadU2(out ushort localsCount) == false)
- return false;
-
- var locals = new VerificationTypeInfoRecord[localsCount];
- for (int i = 0; i < localsCount; i++)
- if (VerificationTypeInfoRecord.TryReadVerificationTypeInfo(ref reader, out locals[i]) == false)
- return false;
-
- if (reader.TryReadU2(out ushort stackCount) == false)
- return false;
-
- var stack = new VerificationTypeInfoRecord[stackCount];
- for (int i = 0; i < stackCount; i++)
- if (VerificationTypeInfoRecord.TryReadVerificationTypeInfo(ref reader, out stack[i]) == false)
- return false;
-
- frame = new FullStackMapFrameRecord(tag, offsetDelta, locals, stack);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/InnerClassesAttributeItemRecord.cs b/src/IKVM.ByteCode/Parsing/InnerClassesAttributeItemRecord.cs
deleted file mode 100644
index 03d245a23e..0000000000
--- a/src/IKVM.ByteCode/Parsing/InnerClassesAttributeItemRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct InnerClassesAttributeItemRecord(ushort InnerClassIndex, ushort OuterClassIndex, ushort InnerNameIndex, AccessFlag InnerClassAccessFlags);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/InnerClassesAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/InnerClassesAttributeRecord.cs
deleted file mode 100644
index eec2f9ee6c..0000000000
--- a/src/IKVM.ByteCode/Parsing/InnerClassesAttributeRecord.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record InnerClassesAttributeRecord(InnerClassesAttributeItemRecord[] Items) : AttributeRecord
- {
-
- public static bool TryReadInnerClassesAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var items = new InnerClassesAttributeItemRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort innerClassInfoIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort outerClassInfoIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort innerNameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort innerClassAccessFlags) == false)
- return false;
-
- items[i] = new InnerClassesAttributeItemRecord(innerClassInfoIndex, outerClassInfoIndex, innerNameIndex, (AccessFlag)innerClassAccessFlags);
- }
-
- attribute = new InnerClassesAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/IntegerConstantRecord.cs b/src/IKVM.ByteCode/Parsing/IntegerConstantRecord.cs
deleted file mode 100644
index 1f07772f39..0000000000
--- a/src/IKVM.ByteCode/Parsing/IntegerConstantRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record IntegerConstantRecord(int Value) : ConstantRecord
- {
-
- ///
- /// Parses a Integer constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadIntegerConstant(ref ClassFormatReader reader, out ConstantRecord record, out int skip)
- {
- record = null;
- skip = 0;
-
- if (reader.TryReadU4(out uint value) == false)
- return false;
-
- var v = unchecked((int)value);
-
- record = new IntegerConstantRecord(v);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/IntegerVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/IntegerVariableInfoRecord.cs
deleted file mode 100644
index 978c79e69d..0000000000
--- a/src/IKVM.ByteCode/Parsing/IntegerVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record IntegerVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new IntegerVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/InterfaceMethodrefConstantRecord.cs b/src/IKVM.ByteCode/Parsing/InterfaceMethodrefConstantRecord.cs
deleted file mode 100644
index 8a4f8df66a..0000000000
--- a/src/IKVM.ByteCode/Parsing/InterfaceMethodrefConstantRecord.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record InterfaceMethodrefConstantRecord(ushort ClassIndex, ushort NameAndTypeIndex) : RefConstantRecord(ClassIndex, NameAndTypeIndex)
- {
-
- ///
- /// Parses a InterfaceMethodref constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadInterfaceMethodrefConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort nameAndTypeIndex) == false)
- return false;
-
- constant = new InterfaceMethodrefConstantRecord(classIndex, nameAndTypeIndex);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/InterfaceRecord.cs b/src/IKVM.ByteCode/Parsing/InterfaceRecord.cs
deleted file mode 100644
index 6044da7dd1..0000000000
--- a/src/IKVM.ByteCode/Parsing/InterfaceRecord.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct InterfaceRecord(ushort ClassIndex)
- {
-
- ///
- /// Parses an interface.
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out InterfaceRecord iface)
- {
- iface = default;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
-
- iface = new InterfaceRecord(classIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/InvokeDynamicConstantRecord.cs b/src/IKVM.ByteCode/Parsing/InvokeDynamicConstantRecord.cs
deleted file mode 100644
index fe82591c34..0000000000
--- a/src/IKVM.ByteCode/Parsing/InvokeDynamicConstantRecord.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record InvokeDynamicConstantRecord(ushort BootstrapMethodAttributeIndex, ushort NameAndTypeIndex) : ConstantRecord
- {
-
- ///
- /// Parses a InvokeDynamic constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadInvokeDynamicConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort bootstrapMethodAttrIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort nameAndTypeIndex) == false)
- return false;
-
- constant = new InvokeDynamicConstantRecord(bootstrapMethodAttrIndex, nameAndTypeIndex);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeItemRecord.cs b/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeItemRecord.cs
deleted file mode 100644
index cba1871c9f..0000000000
--- a/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeItemRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct LineNumberTableAttributeItemRecord(ushort CodeOffset, ushort LineNumber);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeRecord.cs
deleted file mode 100644
index b4ef48d0c0..0000000000
--- a/src/IKVM.ByteCode/Parsing/LineNumberTableAttributeRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record LineNumberTableAttributeRecord(LineNumberTableAttributeItemRecord[] Items) : AttributeRecord
- {
-
- public static bool TryReadLineNumberTableAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort itemCount) == false)
- return false;
-
- var items = new LineNumberTableAttributeItemRecord[itemCount];
- for (int i = 0; i < itemCount; i++)
- {
- if (reader.TryReadU2(out ushort codeOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort lineNumber) == false)
- return false;
-
- items[i] = new LineNumberTableAttributeItemRecord(codeOffset, lineNumber);
- }
-
- attribute = new LineNumberTableAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeItemRecord.cs b/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeItemRecord.cs
deleted file mode 100644
index 38ffc6a6ee..0000000000
--- a/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeItemRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct LocalVariableTableAttributeItemRecord(ushort CodeOffset, ushort CodeLength, ushort NameIndex, ushort DescriptorIndex, ushort Index);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeRecord.cs
deleted file mode 100644
index 3d0ab69e7e..0000000000
--- a/src/IKVM.ByteCode/Parsing/LocalVariableTableAttributeRecord.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record LocalVariableTableAttributeRecord(LocalVariableTableAttributeItemRecord[] Items) : AttributeRecord
- {
-
- public static bool TryReadLocalVariableTableAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
-
- var items = new LocalVariableTableAttributeItemRecord[length];
- for (int i = 0; i < length; i++)
- {
- if (reader.TryReadU2(out ushort codeOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort codeLength) == false)
- return false;
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- items[i] = new LocalVariableTableAttributeItemRecord(codeOffset, codeLength, nameIndex, descriptorIndex, index);
- }
-
- attribute = new LocalVariableTableAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeItemRecord.cs b/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeItemRecord.cs
deleted file mode 100644
index 7acdf2c994..0000000000
--- a/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeItemRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct LocalVariableTypeTableAttributeItemRecord(ushort CodeOffset, ushort CodeLength, ushort NameIndex, ushort SignatureIndex, ushort Index);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeRecord.cs
deleted file mode 100644
index c1c8108f7e..0000000000
--- a/src/IKVM.ByteCode/Parsing/LocalVariableTypeTableAttributeRecord.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record LocalVariableTypeTableAttributeRecord(LocalVariableTypeTableAttributeItemRecord[] Items) : AttributeRecord
- {
-
- public static bool TryReadLocalVariableTypeTableAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
-
- var items = new LocalVariableTypeTableAttributeItemRecord[length];
- for (int i = 0; i < length; i++)
- {
- if (reader.TryReadU2(out ushort codeOffset) == false)
- return false;
- if (reader.TryReadU2(out ushort codeLength) == false)
- return false;
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort signatureIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- items[i] = new LocalVariableTypeTableAttributeItemRecord(codeOffset, codeLength, nameIndex, signatureIndex, index);
- }
-
- attribute = new LocalVariableTypeTableAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LongConstantRecord.cs b/src/IKVM.ByteCode/Parsing/LongConstantRecord.cs
deleted file mode 100644
index f20548c10b..0000000000
--- a/src/IKVM.ByteCode/Parsing/LongConstantRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record LongConstantRecord(long Value) : ConstantRecord
- {
-
- ///
- /// Parses a Long constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadLongConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 1;
-
- if (reader.TryReadU4(out uint a) == false)
- return false;
- if (reader.TryReadU4(out uint b) == false)
- return false;
-
- constant = new LongConstantRecord((long)(((ulong)a << 32) | b));
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/LongVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/LongVariableInfoRecord.cs
deleted file mode 100644
index a37b596569..0000000000
--- a/src/IKVM.ByteCode/Parsing/LongVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record LongVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new LongVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodHandleConstantRecord.cs b/src/IKVM.ByteCode/Parsing/MethodHandleConstantRecord.cs
deleted file mode 100644
index 43e73a6ec3..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodHandleConstantRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record MethodHandleConstantRecord(ReferenceKind Kind, ushort Index) : ConstantRecord
- {
-
- ///
- /// Parses a MethodHandle constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadMethodHandleConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU1(out byte kind) == false)
- return false;
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- constant = new MethodHandleConstantRecord((ReferenceKind)kind, index);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodParametersAttributeParameterRecord.cs b/src/IKVM.ByteCode/Parsing/MethodParametersAttributeParameterRecord.cs
deleted file mode 100644
index 508b687cdd..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodParametersAttributeParameterRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct MethodParametersAttributeParameterRecord(ushort NameIndex, AccessFlag AccessFlags);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodParametersAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/MethodParametersAttributeRecord.cs
deleted file mode 100644
index 15e006ddef..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodParametersAttributeRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record MethodParametersAttributeRecord(MethodParametersAttributeParameterRecord[] Parameters) : AttributeRecord
- {
-
- public static bool TryReadMethodParametersAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU1(out byte count) == false)
- return false;
-
- var arguments = new MethodParametersAttributeParameterRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort accessFlags) == false)
- return false;
-
- arguments[i] = new MethodParametersAttributeParameterRecord(nameIndex, (AccessFlag)accessFlags);
- }
-
- attribute = new MethodParametersAttributeRecord(arguments);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodRecord.cs b/src/IKVM.ByteCode/Parsing/MethodRecord.cs
deleted file mode 100644
index 96bdb9d3b5..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct MethodRecord(AccessFlag AccessFlags, ushort NameIndex, ushort DescriptorIndex, AttributeInfoRecord[] Attributes)
- {
-
- ///
- /// Parses a method.
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out MethodRecord method)
- {
- method = default;
-
- if (reader.TryReadU2(out ushort accessFlags) == false)
- return false;
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
- if (ClassRecord.TryReadAttributes(ref reader, out var attributes) == false)
- return false;
-
- method = new MethodRecord((AccessFlag)accessFlags, nameIndex, descriptorIndex, attributes);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodTypeConstantRecord.cs b/src/IKVM.ByteCode/Parsing/MethodTypeConstantRecord.cs
deleted file mode 100644
index c8f2e38cc3..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodTypeConstantRecord.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record MethodTypeConstantRecord(ushort DescriptorIndex) : ConstantRecord
- {
-
- ///
- /// Parses a MethodType constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadMethodTypeConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
-
- constant = new MethodTypeConstantRecord(descriptorIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/MethodrefConstantRecord.cs b/src/IKVM.ByteCode/Parsing/MethodrefConstantRecord.cs
deleted file mode 100644
index 41d1e08d5c..0000000000
--- a/src/IKVM.ByteCode/Parsing/MethodrefConstantRecord.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record MethodrefConstantRecord(ushort ClassIndex, ushort NameAndTypeIndex) : RefConstantRecord(ClassIndex, NameAndTypeIndex)
- {
-
- ///
- /// Parses a Methodref constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadMethodrefConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort nameAndTypeIndex) == false)
- return false;
-
- constant = new MethodrefConstantRecord(classIndex, nameAndTypeIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleAttributeExportsRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleAttributeExportsRecord.cs
deleted file mode 100644
index 33f3803fd0..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleAttributeExportsRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ModuleAttributeExportsRecord(ushort Index, ModuleExportsFlag Flags, ushort[] Modules);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleAttributeOpensRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleAttributeOpensRecord.cs
deleted file mode 100644
index 0bafd0d9cf..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleAttributeOpensRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ModuleAttributeOpensRecord(ushort Index, ModuleOpensFlag Flags, ushort[] Modules);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleAttributeProvidesRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleAttributeProvidesRecord.cs
deleted file mode 100644
index b7bd3adb70..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleAttributeProvidesRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ModuleAttributeProvidesRecord(ushort Index, ushort[] Modules);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleAttributeRecord.cs
deleted file mode 100644
index 30689d1b84..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleAttributeRecord.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ModuleAttributeRecord(ushort NameIndex, ModuleFlag Flags, ushort VersionIndex, ModuleAttributeRequiresRecord[] Requires, ModuleAttributeExportsRecord[] Exports, ModuleAttributeOpensRecord[] Opens, ushort[] Uses, ModuleAttributeProvidesRecord[] Provides) : AttributeRecord
- {
-
- public static bool TryReadModuleAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort moduleNameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort moduleFlags) == false)
- return false;
- if (reader.TryReadU2(out ushort moduleVersionIndex) == false)
- return false;
-
- if (reader.TryReadU2(out ushort requiresCount) == false)
- return false;
-
- var requires = new ModuleAttributeRequiresRecord[requiresCount];
- for (int i = 0; i < requiresCount; i++)
- {
- if (reader.TryReadU2(out ushort requiresIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort requiresFlags) == false)
- return false;
- if (reader.TryReadU2(out ushort requiresVersionIndex) == false)
- return false;
-
- requires[i] = new ModuleAttributeRequiresRecord(requiresIndex, (ModuleRequiresFlag)requiresFlags, requiresVersionIndex);
- }
-
- if (reader.TryReadU2(out ushort exportsCount) == false)
- return false;
-
- var exports = new ModuleAttributeExportsRecord[exportsCount];
- for (int i = 0; i < exportsCount; i++)
- {
- if (reader.TryReadU2(out ushort exportsIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort exportsFlags) == false)
- return false;
-
- if (reader.TryReadU2(out ushort exportsModuleCount) == false)
- return false;
-
- var exportsModules = new ushort[exportsModuleCount];
- for (int j = 0; j < exportsModuleCount; j++)
- {
- if (reader.TryReadU2(out ushort exportsToModuleIndex) == false)
- return false;
-
- exportsModules[j] = exportsToModuleIndex;
- }
-
- exports[i] = new ModuleAttributeExportsRecord(exportsIndex, (ModuleExportsFlag)exportsFlags, exportsModules);
- }
-
- if (reader.TryReadU2(out ushort opensCount) == false)
- return false;
-
- var opens = new ModuleAttributeOpensRecord[opensCount];
- for (int i = 0; i < opensCount; i++)
- {
- if (reader.TryReadU2(out ushort opensIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort opensFlags) == false)
- return false;
-
- if (reader.TryReadU2(out ushort opensModulesCount) == false)
- return false;
-
- var opensModules = new ushort[opensModulesCount];
- for (int j = 0; j < opensModulesCount; j++)
- {
- if (reader.TryReadU2(out ushort opensModuleIndex) == false)
- return false;
-
- opensModules[j] = opensModuleIndex;
- }
-
- opens[i] = new ModuleAttributeOpensRecord(opensIndex, (ModuleOpensFlag)opensFlags, opensModules);
- }
-
- if (reader.TryReadU2(out ushort usesCount) == false)
- return false;
-
- var uses = new ushort[usesCount];
- for (int i = 0; i < usesCount; i++)
- {
- if (reader.TryReadU2(out ushort usesIndex) == false)
- return false;
-
- uses[i] = usesIndex;
- }
-
- if (reader.TryReadU2(out ushort providesCount) == false)
- return false;
-
- var provides = new ModuleAttributeProvidesRecord[providesCount];
- for (int i = 0; i < providesCount; i++)
- {
- if (reader.TryReadU2(out ushort providesIndex) == false)
- return false;
-
- if (reader.TryReadU2(out ushort providesModulesCount) == false)
- return false;
-
- var providesModules = new ushort[providesModulesCount];
- for (int j = 0; j < providesModulesCount; j++)
- {
- if (reader.TryReadU2(out ushort providesModuleIndex) == false)
- return false;
-
- providesModules[j] = providesModuleIndex;
- }
-
- provides[i] = new ModuleAttributeProvidesRecord(providesIndex, providesModules);
- }
-
- attribute = new ModuleAttributeRecord(moduleNameIndex, (ModuleFlag)moduleFlags, moduleVersionIndex, requires, exports, opens, uses, provides);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleAttributeRequiresRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleAttributeRequiresRecord.cs
deleted file mode 100644
index 5aa439ad2b..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleAttributeRequiresRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ModuleAttributeRequiresRecord(ushort Index, ModuleRequiresFlag Flag, ushort VersionIndex);
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/ModuleConstantRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleConstantRecord.cs
deleted file mode 100644
index 2a1651c5c3..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleConstantRecord.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ModuleConstantRecord(ushort NameIndex) : ConstantRecord
- {
-
- ///
- /// Parses a Module constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadModuleConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
-
- constant = new ModuleConstantRecord(nameIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModuleMainClassAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/ModuleMainClassAttributeRecord.cs
deleted file mode 100644
index 068ab4f8e9..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModuleMainClassAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ModuleMainClassAttributeRecord(ushort MainClassIndex) : AttributeRecord
- {
-
- public static bool TryReadModuleMainClassAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort mainClassIndex) == false)
- return false;
-
- attribute = new ModuleMainClassAttributeRecord(mainClassIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ModulePackagesAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/ModulePackagesAttributeRecord.cs
deleted file mode 100644
index 14ccf63703..0000000000
--- a/src/IKVM.ByteCode/Parsing/ModulePackagesAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ModulePackagesAttributeRecord(ushort[] Packages) : AttributeRecord
- {
-
- public static bool TryReadModulePackagesAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var packages = new ushort[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort packageIndex) == false)
- return false;
-
- packages[i] = packageIndex;
- }
-
- attribute = new ModulePackagesAttributeRecord(packages);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/NameAndTypeConstantRecord.cs b/src/IKVM.ByteCode/Parsing/NameAndTypeConstantRecord.cs
deleted file mode 100644
index 4a591055c1..0000000000
--- a/src/IKVM.ByteCode/Parsing/NameAndTypeConstantRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record NameAndTypeConstantRecord(ushort NameIndex, ushort DescriptorIndex) : ConstantRecord
- {
-
- ///
- /// Parses a NameAndType constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadNameAndTypeConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
-
- constant = new NameAndTypeConstantRecord(nameIndex, descriptorIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/NestHostAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/NestHostAttributeRecord.cs
deleted file mode 100644
index ff62be73c7..0000000000
--- a/src/IKVM.ByteCode/Parsing/NestHostAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record NestHostAttributeRecord(ushort HostClassIndex) : AttributeRecord
- {
-
- public static bool TryReadNestHostAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort hostClassIndex) == false)
- return false;
-
- attribute = new NestHostAttributeRecord(hostClassIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/NestMembersAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/NestMembersAttributeRecord.cs
deleted file mode 100644
index b004fa52ad..0000000000
--- a/src/IKVM.ByteCode/Parsing/NestMembersAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record NestMembersAttributeRecord(ushort[] ClassIndexes) : AttributeRecord
- {
-
- public static bool TryReadNestMembersAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var classes = new ushort[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
-
- classes[i] = classIndex;
- }
-
- attribute = new NestMembersAttributeRecord(classes);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/NullVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/NullVariableInfoRecord.cs
deleted file mode 100644
index 00c3b00c03..0000000000
--- a/src/IKVM.ByteCode/Parsing/NullVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record NullVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new NullVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ObjectVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/ObjectVariableInfoRecord.cs
deleted file mode 100644
index e8d5667ea7..0000000000
--- a/src/IKVM.ByteCode/Parsing/ObjectVariableInfoRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record ObjectVariableInfoRecord(ushort ClassIndex) : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = null;
-
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
-
- record = new ObjectVariableInfoRecord(classIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/PackageConstantRecord.cs b/src/IKVM.ByteCode/Parsing/PackageConstantRecord.cs
deleted file mode 100644
index e98d5f2d75..0000000000
--- a/src/IKVM.ByteCode/Parsing/PackageConstantRecord.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record PackageConstantRecord(ushort NameIndex) : ConstantRecord
- {
-
- ///
- /// Parses a Package constant in the constant pool.
- ///
- ///
- ///
- ///
- public static bool TryReadPackageConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
-
- constant = new PackageConstantRecord(nameIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/ParameterAnnotationRecord.cs b/src/IKVM.ByteCode/Parsing/ParameterAnnotationRecord.cs
deleted file mode 100644
index 6157f2bcde..0000000000
--- a/src/IKVM.ByteCode/Parsing/ParameterAnnotationRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct ParameterAnnotationRecord(AnnotationRecord[] Annotations)
- {
-
- public static bool TryReadParameterAnnotation(ref ClassFormatReader reader, out ParameterAnnotationRecord record)
- {
- record = default;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var annotations = new AnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (AnnotationRecord.TryReadAnnotation(ref reader, out var annotation) == false)
- return false;
-
- annotations[i] = annotation;
- }
-
- record = new ParameterAnnotationRecord(annotations);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/PermittedSubclassesAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/PermittedSubclassesAttributeRecord.cs
deleted file mode 100644
index b1bd98046d..0000000000
--- a/src/IKVM.ByteCode/Parsing/PermittedSubclassesAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record PermittedSubclassesAttributeRecord(ushort[] ClassIndexes) : AttributeRecord
- {
-
- public static bool TryReadPermittedSubclassesAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var classes = new ushort[count];
- for (int i = 0; i < count; i++)
- {
- if (reader.TryReadU2(out ushort classIndex) == false)
- return false;
-
- classes[i] = classIndex;
- }
-
- attribute = new PermittedSubclassesAttributeRecord(classes);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RecordAttributeComponentRecord.cs b/src/IKVM.ByteCode/Parsing/RecordAttributeComponentRecord.cs
deleted file mode 100644
index 1fb3ff2162..0000000000
--- a/src/IKVM.ByteCode/Parsing/RecordAttributeComponentRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct RecordAttributeComponentRecord(ushort NameIndex, ushort DescriptorIndex, AttributeInfoRecord[] Attributes);
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RecordAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RecordAttributeRecord.cs
deleted file mode 100644
index 192bc8ae94..0000000000
--- a/src/IKVM.ByteCode/Parsing/RecordAttributeRecord.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RecordAttributeRecord(RecordAttributeComponentRecord[] Components) : AttributeRecord
- {
-
- public static bool TryReadRecordAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort componentsCount) == false)
- return false;
-
- var components = new RecordAttributeComponentRecord[componentsCount];
- for (int i = 0; i < componentsCount; i++)
- {
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort descriptorIndex) == false)
- return false;
- if (ClassRecord.TryReadAttributes(ref reader, out var attributes) == false)
- return false;
-
- components[i] = new RecordAttributeComponentRecord(nameIndex, descriptorIndex, attributes);
- }
-
- attribute = new RecordAttributeRecord(components);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RefConstantRecord.cs b/src/IKVM.ByteCode/Parsing/RefConstantRecord.cs
deleted file mode 100644
index 1df9453358..0000000000
--- a/src/IKVM.ByteCode/Parsing/RefConstantRecord.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record RefConstantRecord(ushort ClassIndex, ushort NameAndTypeIndex) :
- ConstantRecord
- {
-
-
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeInvisibleAnnotationsAttributeRecord.cs
deleted file mode 100644
index 7354beb0f1..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeInvisibleAnnotationsAttributeRecord(AnnotationRecord[] Annotations) : AttributeRecord
- {
-
- public static bool TryReadRuntimeInvisibleAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var items = new AnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (AnnotationRecord.TryReadAnnotation(ref reader, out var annotation) == false)
- return false;
-
- items[i] = annotation;
- }
-
- attribute = new RuntimeInvisibleAnnotationsAttributeRecord(items);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleParameterAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeInvisibleParameterAnnotationsAttributeRecord.cs
deleted file mode 100644
index 77cac86d7e..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleParameterAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeInvisibleParameterAnnotationsAttributeRecord(ParameterAnnotationRecord[] Parameters) : AttributeRecord
- {
-
- public static bool TryReadRuntimeInvisibleParameterAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU1(out byte count) == false)
- return false;
-
- var parameters = new ParameterAnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (ParameterAnnotationRecord.TryReadParameterAnnotation(ref reader, out var parameter) == false)
- return false;
-
- parameters[i] = parameter;
- }
-
- attribute = new RuntimeInvisibleParameterAnnotationsAttributeRecord(parameters);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleTypeAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeInvisibleTypeAnnotationsAttributeRecord.cs
deleted file mode 100644
index 81cc47298f..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeInvisibleTypeAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeInvisibleTypeAnnotationsAttributeRecord(TypeAnnotationRecord[] Annotations) : AttributeRecord
- {
-
- public static bool TryReadRuntimeInvisibleTypeAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var annotations = new TypeAnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (TypeAnnotationRecord.TryReadTypeAnnotation(ref reader, out var annotation) == false)
- return false;
-
- annotations[i] = annotation;
- }
-
- attribute = new RuntimeInvisibleTypeAnnotationsAttributeRecord(annotations);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeVisibleAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeVisibleAnnotationsAttributeRecord.cs
deleted file mode 100644
index 7fb6dd7793..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeVisibleAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeVisibleAnnotationsAttributeRecord(AnnotationRecord[] Annotations) : AttributeRecord
- {
-
- public static bool TryReadRuntimeVisibleAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var items = new AnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (AnnotationRecord.TryReadAnnotation(ref reader, out var annotation) == false)
- return false;
-
- items[i] = annotation;
- }
-
- attribute = new RuntimeVisibleAnnotationsAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeVisibleParameterAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeVisibleParameterAnnotationsAttributeRecord.cs
deleted file mode 100644
index 5990ba25da..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeVisibleParameterAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeVisibleParameterAnnotationsAttributeRecord(ParameterAnnotationRecord[] Parameters) : AttributeRecord
- {
-
- public static bool TryReadRuntimeVisibleParameterAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU1(out byte count) == false)
- return false;
-
- var items = new ParameterAnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (ParameterAnnotationRecord.TryReadParameterAnnotation(ref reader, out var parameter) == false)
- return false;
-
- items[i] = parameter;
- }
-
- attribute = new RuntimeVisibleParameterAnnotationsAttributeRecord(items);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/RuntimeVisibleTypeAnnotationsAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/RuntimeVisibleTypeAnnotationsAttributeRecord.cs
deleted file mode 100644
index fde2094726..0000000000
--- a/src/IKVM.ByteCode/Parsing/RuntimeVisibleTypeAnnotationsAttributeRecord.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record RuntimeVisibleTypeAnnotationsAttributeRecord(TypeAnnotationRecord[] Annotations) : AttributeRecord
- {
-
- public static bool TryReadRuntimeVisibleTypeAnnotationsAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var annotations = new TypeAnnotationRecord[count];
- for (int i = 0; i < count; i++)
- {
- if (TypeAnnotationRecord.TryReadTypeAnnotation(ref reader, out var annotation) == false)
- return false;
-
- annotations[i] = annotation;
- }
-
- attribute = new RuntimeVisibleTypeAnnotationsAttributeRecord(annotations);
- return true;
- }
-
- ///
- /// Gets the number of bytes required to write the record.
- ///
- ///
- public int GetSize()
- {
- var size = 0;
- size += sizeof(ushort);
-
- foreach (var element in Annotations)
- size += element.GetSize();
-
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2((ushort)Annotations.Length) == false)
- return false;
-
- foreach (var record in Annotations)
- if (record.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/SameExtendedStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/SameExtendedStackMapFrameRecord.cs
deleted file mode 100644
index 00e8a0f50b..0000000000
--- a/src/IKVM.ByteCode/Parsing/SameExtendedStackMapFrameRecord.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record SameExtendedStackMapFrameRecord(byte Tag, ushort OffsetDelta) : StackMapFrameRecord(Tag)
- {
-
- public static bool TryReadSameExtendedStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU2(out ushort offsetDelta) == false)
- return false;
-
- frame = new SameExtendedStackMapFrameRecord(tag, offsetDelta);
- return true;
- }
-
- }
-
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SameLocalsOneExtendedStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/SameLocalsOneExtendedStackMapFrameRecord.cs
deleted file mode 100644
index 60009a85b9..0000000000
--- a/src/IKVM.ByteCode/Parsing/SameLocalsOneExtendedStackMapFrameRecord.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record SameLocalsOneExtendedStackMapFrameRecord(byte FrameType, ushort OffsetDelta, VerificationTypeInfoRecord Stack) : StackMapFrameRecord(FrameType)
- {
-
- public static bool TryReadSameLocalsOneStackItemExtendedStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU2(out ushort offsetDelta) == false)
- return false;
- if (VerificationTypeInfoRecord.TryReadVerificationTypeInfo(ref reader, out var verificationTypeInfo) == false)
- return false;
-
- frame = new SameLocalsOneExtendedStackMapFrameRecord(tag, offsetDelta, verificationTypeInfo);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SameLocalsOneStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/SameLocalsOneStackMapFrameRecord.cs
deleted file mode 100644
index 7ee6b0a890..0000000000
--- a/src/IKVM.ByteCode/Parsing/SameLocalsOneStackMapFrameRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record SameLocalsOneStackMapFrameRecord(byte FrameType, VerificationTypeInfoRecord Stack) : StackMapFrameRecord(FrameType)
- {
-
- public static bool TryReadSameLocalsOneStackItemStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (VerificationTypeInfoRecord.TryReadVerificationTypeInfo(ref reader, out var verificationTypeInfo) == false)
- return false;
-
- frame = new SameLocalsOneStackMapFrameRecord(tag, verificationTypeInfo);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SameStackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/SameStackMapFrameRecord.cs
deleted file mode 100644
index f5e61a2ec7..0000000000
--- a/src/IKVM.ByteCode/Parsing/SameStackMapFrameRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record SameStackMapFrameRecord(byte Tag) : StackMapFrameRecord(Tag)
- {
-
- public static bool TryReadSameStackMapFrame(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- frame = new SameStackMapFrameRecord(tag);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SignatureAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/SignatureAttributeRecord.cs
deleted file mode 100644
index 5416870050..0000000000
--- a/src/IKVM.ByteCode/Parsing/SignatureAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record SignatureAttributeRecord(ushort SignatureIndex) : AttributeRecord
- {
-
- public static bool TryReadSignatureAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort signatureIndex) == false)
- return false;
-
- attribute = new SignatureAttributeRecord(signatureIndex);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/SourceDebugExtensionAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/SourceDebugExtensionAttributeRecord.cs
deleted file mode 100644
index 34ffa8e832..0000000000
--- a/src/IKVM.ByteCode/Parsing/SourceDebugExtensionAttributeRecord.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record SourceDebugExtensionAttributeRecord(byte[] Data) : AttributeRecord
- {
-
- public static bool TryReadSourceDebugExtensionAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadManyU1(reader.Length, out ReadOnlySequence data) == false)
- return false;
-
- var dataBuffer = new byte[data.Length];
- data.CopyTo(dataBuffer);
-
- attribute = new SourceDebugExtensionAttributeRecord(dataBuffer);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SourceFileAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/SourceFileAttributeRecord.cs
deleted file mode 100644
index 22d3357814..0000000000
--- a/src/IKVM.ByteCode/Parsing/SourceFileAttributeRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record SourceFileAttributeRecord(ushort SourceFileIndex) : AttributeRecord
- {
-
- public static bool TryReadSourceFileAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort sourceFileIndex) == false)
- return false;
-
- attribute = new SourceFileAttributeRecord(sourceFileIndex);
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/StackMapFrameRecord.cs b/src/IKVM.ByteCode/Parsing/StackMapFrameRecord.cs
deleted file mode 100644
index dbc5cb6613..0000000000
--- a/src/IKVM.ByteCode/Parsing/StackMapFrameRecord.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record StackMapFrameRecord(byte FrameType)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out StackMapFrameRecord frame)
- {
- frame = null;
-
- if (reader.TryReadU1(out byte tag) == false)
- return false;
-
- if (TryRead(ref reader, tag, out frame) == false)
- return false;
-
- return true;
- }
-
- public static bool TryRead(ref ClassFormatReader reader, byte tag, out StackMapFrameRecord frame)
- {
- if (tag >= 0 && tag <= 63)
- return SameStackMapFrameRecord.TryReadSameStackMapFrame(ref reader, tag, out frame);
- else if (tag >= 64 && tag <= 127)
- return SameLocalsOneStackMapFrameRecord.TryReadSameLocalsOneStackItemStackMapFrame(ref reader, tag, out frame);
- else if (tag == 247)
- return SameLocalsOneExtendedStackMapFrameRecord.TryReadSameLocalsOneStackItemExtendedStackMapFrame(ref reader, tag, out frame);
- else if (tag >= 248 && tag <= 250)
- return ChopStackMapFrameRecord.TryReadChopStackMapFrame(ref reader, tag, out frame);
- else if (tag == 251)
- return SameExtendedStackMapFrameRecord.TryReadSameExtendedStackMapFrame(ref reader, tag, out frame);
- else if (tag >= 252 && tag <= 254)
- return AppendStackMapFrameRecord.TryReadAppendStackMapFrame(ref reader, tag, out frame);
- else if (tag == 255)
- return FullStackMapFrameRecord.TryReadFullStackMapFrame(ref reader, tag, out frame);
- else
- throw new ByteCodeException($"Invalid stack map frame tag value: '{tag}'.");
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/StackMapTableAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/StackMapTableAttributeRecord.cs
deleted file mode 100644
index 925e394091..0000000000
--- a/src/IKVM.ByteCode/Parsing/StackMapTableAttributeRecord.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record StackMapTableAttributeRecord(StackMapFrameRecord[] Frames) : AttributeRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = null;
-
- if (reader.TryReadU2(out ushort count) == false)
- return false;
-
- var frames = new StackMapFrameRecord[count];
- for (int i = 0; i < count; i++)
- if (StackMapFrameRecord.TryRead(ref reader, out frames[i]) == false)
- return false;
-
- attribute = new StackMapTableAttributeRecord(frames);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/StringConstantRecord.cs b/src/IKVM.ByteCode/Parsing/StringConstantRecord.cs
deleted file mode 100644
index 19330f9330..0000000000
--- a/src/IKVM.ByteCode/Parsing/StringConstantRecord.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record StringConstantRecord(ushort ValueIndex) : ConstantRecord
- {
-
- ///
- /// Parses a Class constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadStringConstant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort nameIndex) == false)
- return false;
-
- constant = new StringConstantRecord(nameIndex);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/SyntheticAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/SyntheticAttributeRecord.cs
deleted file mode 100644
index cc1846404d..0000000000
--- a/src/IKVM.ByteCode/Parsing/SyntheticAttributeRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record SyntheticAttributeRecord : AttributeRecord
- {
-
- public static bool TryReadSyntheticAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- attribute = new SyntheticAttributeRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TopVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/TopVariableInfoRecord.cs
deleted file mode 100644
index bcbecce5c2..0000000000
--- a/src/IKVM.ByteCode/Parsing/TopVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TopVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new TopVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypeAndNameConstantRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAndNameConstantRecord.cs
deleted file mode 100644
index c797079829..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAndNameConstantRecord.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAndNameConstantRecord(ushort NameIndex, ushort DescriptorIndex) : ConstantRecord;
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationCatchTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationCatchTargetRecord.cs
deleted file mode 100644
index 8b0210b532..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationCatchTargetRecord.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationCatchTargetRecord(ushort ExceptionTableIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort exceptionTableIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationCatchTargetRecord(exceptionTableIndex);
- return true;
- }
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(ExceptionTableIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationEmptyTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationEmptyTargetRecord.cs
deleted file mode 100644
index 99fe7fcff6..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationEmptyTargetRecord.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationEmptyTargetRecord : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = new TypeAnnotationEmptyTargetRecord();
- return true;
- }
-
- public override int GetSize()
- {
- return 0;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationFormalParameterTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationFormalParameterTargetRecord.cs
deleted file mode 100644
index 90c9e095e6..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationFormalParameterTargetRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationFormalParameterTargetRecord(byte ParameterIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU1(out byte parameterIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationFormalParameterTargetRecord(parameterIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(byte);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1(ParameterIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetItemRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetItemRecord.cs
deleted file mode 100644
index e76d10bafe..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetItemRecord.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct TypeAnnotationLocalVarTargetItemRecord(ushort Offset, ushort Length, ushort Index)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationLocalVarTargetItemRecord record)
- {
- record = default;
-
- if (reader.TryReadU2(out ushort offset) == false)
- return false;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
-
- if (reader.TryReadU2(out ushort index) == false)
- return false;
-
- record = new TypeAnnotationLocalVarTargetItemRecord(offset, length, index);
- return true;
- }
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- length += sizeof(ushort);
- length += sizeof(ushort);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(Offset) == false)
- return false;
- if (writer.TryWriteU2(Length) == false)
- return false;
- if (writer.TryWriteU2(Index) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetRecord.cs
deleted file mode 100644
index ef82fc5c03..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationLocalVarTargetRecord.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationLocalVarTargetRecord(TypeAnnotationLocalVarTargetItemRecord[] Items) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
-
- var items = new TypeAnnotationLocalVarTargetItemRecord[length];
- for (int i = 0; i < length; i++)
- if (TypeAnnotationLocalVarTargetItemRecord.TryRead(ref reader, out items[i]) == false)
- return false;
-
- targetInfo = new TypeAnnotationLocalVarTargetRecord(items);
- return true;
- }
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
-
- foreach (var item in Items)
- length += item.GetSize();
-
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2((ushort)Items.Length) == false)
- return false;
-
- foreach (var item in Items)
- if (item.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationOffsetTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationOffsetTargetRecord.cs
deleted file mode 100644
index 4babfae72c..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationOffsetTargetRecord.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationOffsetTargetRecord(ushort Offset) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort offset) == false)
- return false;
-
- targetInfo = new TypeAnnotationCatchTargetRecord(offset);
- return true;
- }
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(Offset) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterBoundTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterBoundTargetRecord.cs
deleted file mode 100644
index c11930bfb8..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterBoundTargetRecord.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationParameterBoundTargetRecord(byte ParameterIndex, byte BoundIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU1(out byte parameterIndex) == false)
- return false;
- if (reader.TryReadU1(out byte boundIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationParameterBoundTargetRecord(parameterIndex, boundIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(byte);
- length += sizeof(byte);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1(ParameterIndex) == false)
- return false;
- if (writer.TryWriteU1(BoundIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterTargetRecord.cs
deleted file mode 100644
index 37e31c886d..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationParameterTargetRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationParameterTargetRecord(byte ParameterIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU1(out byte parameterIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationParameterTargetRecord( parameterIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(byte);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1(ParameterIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationRecord.cs
deleted file mode 100644
index 01fa9b68e3..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationRecord.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct TypeAnnotationRecord(TypeAnnotationTargetType TargetType, TypeAnnotationTargetRecord Target, TypePathRecord TargetPath, ushort TypeIndex, params ElementValuePairRecord[] Elements)
- {
-
- public static bool TryReadTypeAnnotation(ref ClassFormatReader reader, out TypeAnnotationRecord annotation)
- {
- annotation = default;
-
- if (reader.TryReadU1(out byte targetType) == false)
- return false;
- if (TryReadTarget(ref reader, (TypeAnnotationTargetType)targetType, out var target) == false)
- return false;
- if (TypePathRecord.TryRead(ref reader, out var targetPath) == false)
- return false;
- if (reader.TryReadU2(out ushort typeIndex) == false)
- return false;
- if (reader.TryReadU2(out ushort pairCount) == false)
- return false;
-
- var elements = new ElementValuePairRecord[pairCount];
- for (int i = 0; i < pairCount; i++)
- if (ElementValuePairRecord.TryRead(ref reader, out elements[i]) == false)
- return false;
-
- annotation = new TypeAnnotationRecord((TypeAnnotationTargetType)targetType, target, targetPath, typeIndex, elements);
- return true;
- }
-
- public static bool TryReadTarget(ref ClassFormatReader reader, TypeAnnotationTargetType targetType, out TypeAnnotationTargetRecord targetInfo) => targetType switch
- {
- TypeAnnotationTargetType.ClassTypeParameter => TypeAnnotationParameterTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodTypeParameter => TypeAnnotationParameterTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ClassExtends => TypeAnnotationSuperTypeTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ClassTypeParameterBound => TypeAnnotationParameterBoundTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodTypeParameterBound => TypeAnnotationParameterBoundTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.Field => TypeAnnotationEmptyTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodReturn => TypeAnnotationEmptyTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodReceiver => TypeAnnotationEmptyTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodFormalParameter => TypeAnnotationFormalParameterTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.Throws => TypeAnnotationThrowsTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.LocalVariable => TypeAnnotationLocalVarTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ResourceVariable => TypeAnnotationLocalVarTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ExceptionParameter => TypeAnnotationCatchTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.InstanceOf => TypeAnnotationOffsetTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.New => TypeAnnotationOffsetTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ConstructorReference => TypeAnnotationOffsetTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodReference => TypeAnnotationOffsetTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.Cast => TypeAnnotationTypeArgumentTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ConstructorInvocationTypeArgument => TypeAnnotationTypeArgumentTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodInvocationTypeArgument => TypeAnnotationTypeArgumentTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.ConstructorReferenceTypeArgument => TypeAnnotationTypeArgumentTargetRecord.TryRead(ref reader, out targetInfo),
- TypeAnnotationTargetType.MethodReferenceTypeArgument => TypeAnnotationTypeArgumentTargetRecord.TryRead(ref reader, out targetInfo),
- _ => throw new ByteCodeException($"Invalid type annotation target type: '0x{targetType:X}'."),
- };
-
- ///
- /// Gets the number of bytes required to write the record.
- ///
- ///
- public int GetSize()
- {
- var size = 0;
- size += sizeof(byte);
- size += Target.GetSize();
- size += TargetPath.GetSize();
- size += sizeof(ushort);
- size += sizeof(ushort);
-
- for (int i = 0; i < Elements.Length; i++)
- size += Elements[i].GetSize();
-
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1((byte)TargetType) == false)
- return false;
- if (Target.TryWrite(ref writer) == false)
- return false;
- if (TargetPath.TryWrite(ref writer) == false)
- return false;
- if (writer.TryWriteU2(TypeIndex) == false)
- return false;
- if (writer.TryWriteU2((ushort)Elements.Length) == false)
- return false;
-
- foreach (var record in Elements)
- if (record.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationSuperTypeTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationSuperTypeTargetRecord.cs
deleted file mode 100644
index bfe06378a0..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationSuperTypeTargetRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationSuperTypeTargetRecord(ushort SuperTypeIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort superTypeIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationSuperTypeTargetRecord(superTypeIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(SuperTypeIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetRecord.cs
deleted file mode 100644
index 71df0c3a77..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetRecord.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record TypeAnnotationTargetRecord
- {
-
- ///
- /// Returns the size of the record when written.
- ///
- ///
- public abstract int GetSize();
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public abstract bool TryWrite(ref ClassFormatWriter writer);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetType.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetType.cs
deleted file mode 100644
index 4c9fbba312..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationTargetType.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal enum TypeAnnotationTargetType : byte
- {
-
- ClassTypeParameter = 0x00,
- MethodTypeParameter = 0x01,
- ClassExtends = 0x10,
- ClassTypeParameterBound = 0x11,
- MethodTypeParameterBound = 0x12,
- Field = 0x13,
- MethodReturn = 0x14,
- MethodReceiver = 0x15,
- MethodFormalParameter = 0x16,
- Throws = 0x17,
- LocalVariable = 0x40,
- ResourceVariable = 0x41,
- ExceptionParameter = 0x42,
- InstanceOf = 0x43,
- New = 0x44,
- ConstructorReference = 0x45,
- MethodReference = 0x46,
- Cast = 0x47,
- ConstructorInvocationTypeArgument = 0x48,
- MethodInvocationTypeArgument = 0x49,
- ConstructorReferenceTypeArgument = 0x4A,
- MethodReferenceTypeArgument = 0x4B,
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationThrowsTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationThrowsTargetRecord.cs
deleted file mode 100644
index cd5aa44d8f..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationThrowsTargetRecord.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationThrowsTargetRecord(ushort ThrowsTypeIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort throwsTypeIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationThrowsTargetRecord(throwsTypeIndex);
- return true;
- }
-
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(ThrowsTypeIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs b/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs
deleted file mode 100644
index bc0f3453b0..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypeAnnotationTypeArgumentTargetRecord.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record TypeAnnotationTypeArgumentTargetRecord(ushort Offset, byte TypeArgumentIndex) : TypeAnnotationTargetRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypeAnnotationTargetRecord targetInfo)
- {
- targetInfo = null;
-
- if (reader.TryReadU2(out ushort offset) == false)
- return false;
- if (reader.TryReadU1(out byte typeArgumentIndex) == false)
- return false;
-
- targetInfo = new TypeAnnotationTypeArgumentTargetRecord(offset, typeArgumentIndex);
- return true;
- }
-
- ///
- /// Gets the size of the record if written.
- ///
- ///
- public override int GetSize()
- {
- var length = 0;
- length += sizeof(ushort);
- length += sizeof(byte);
- return length;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public override bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU2(Offset) == false)
- return false;
- if (writer.TryWriteU1(TypeArgumentIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Parsing/TypePathItemRecord.cs b/src/IKVM.ByteCode/Parsing/TypePathItemRecord.cs
deleted file mode 100644
index f67f1baebe..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypePathItemRecord.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct TypePathItemRecord(TypePathKind Kind, byte ArgumentIndex)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypePathItemRecord record)
- {
- record = default;
-
- if (reader.TryReadU1(out byte kind) == false)
- return false;
- if (reader.TryReadU1(out byte argumentIndex) == false)
- return false;
-
- record = new TypePathItemRecord((TypePathKind)kind, argumentIndex);
- return true;
- }
-
- public int GetSize()
- {
- var size = 0;
- size += sizeof(byte);
- size += sizeof(byte);
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1((byte)Kind) == false)
- return false;
- if (writer.TryWriteU1(ArgumentIndex) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/TypePathRecord.cs b/src/IKVM.ByteCode/Parsing/TypePathRecord.cs
deleted file mode 100644
index b351bc464a..0000000000
--- a/src/IKVM.ByteCode/Parsing/TypePathRecord.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record struct TypePathRecord(params TypePathItemRecord[] Path)
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out TypePathRecord typePath)
- {
- typePath = default;
-
- if (reader.TryReadU1(out byte length) == false)
- return false;
-
- var path = new TypePathItemRecord[length];
- for (int i = 0; i < length; i++)
- {
- if (TypePathItemRecord.TryRead(ref reader, out var item) == false)
- return false;
-
- path[i] = item;
- }
-
- typePath = new TypePathRecord(path);
- return true;
- }
-
- public int GetSize()
- {
- var size = 0;
- size += sizeof(byte);
-
- foreach (var item in Path)
- size += item.GetSize();
-
- return size;
- }
-
- ///
- /// Attempts to write the record to the given .
- ///
- ///
- ///
- public bool TryWrite(ref ClassFormatWriter writer)
- {
- if (writer.TryWriteU1((byte)Path.Length) == false)
- return false;
-
- foreach (var item in Path)
- if (item.TryWrite(ref writer) == false)
- return false;
-
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/UninitializedThisVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/UninitializedThisVariableInfoRecord.cs
deleted file mode 100644
index 6b52843f36..0000000000
--- a/src/IKVM.ByteCode/Parsing/UninitializedThisVariableInfoRecord.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record UninitializedThisVariableInfoRecord : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = new UninitializedThisVariableInfoRecord();
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/UninitializedVariableInfoRecord.cs b/src/IKVM.ByteCode/Parsing/UninitializedVariableInfoRecord.cs
deleted file mode 100644
index 8a16e8df7c..0000000000
--- a/src/IKVM.ByteCode/Parsing/UninitializedVariableInfoRecord.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record UninitializedVariableInfoRecord(ushort Offset) : VerificationTypeInfoRecord
- {
-
- public static bool TryRead(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = null;
-
- if (reader.TryReadU2(out ushort offset) == false)
- return false;
-
- record = new UninitializedVariableInfoRecord(offset);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/UnknownAttributeRecord.cs b/src/IKVM.ByteCode/Parsing/UnknownAttributeRecord.cs
deleted file mode 100644
index 50d2949772..0000000000
--- a/src/IKVM.ByteCode/Parsing/UnknownAttributeRecord.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal sealed record UnknownAttributeRecord(byte[] Data) : AttributeRecord
- {
-
- public static bool TryReadCustomAttribute(ref ClassFormatReader reader, out AttributeRecord attribute)
- {
- var data = new byte[reader.Length];
- reader.TryCopyTo(data);
-
- attribute = new UnknownAttributeRecord(data);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/Utf8ConstantRecord.cs b/src/IKVM.ByteCode/Parsing/Utf8ConstantRecord.cs
deleted file mode 100644
index 548db6b53f..0000000000
--- a/src/IKVM.ByteCode/Parsing/Utf8ConstantRecord.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System.Buffers;
-
-namespace IKVM.ByteCode.Parsing
-{
-
- internal record class Utf8ConstantRecord(byte[] Value) : ConstantRecord
- {
-
- ///
- /// Parses a UTF8 constant in the constant pool.
- ///
- ///
- ///
- public static bool TryReadUtf8Constant(ref ClassFormatReader reader, out ConstantRecord constant, out int skip)
- {
- constant = null;
- skip = 0;
-
- if (reader.TryReadU2(out ushort length) == false)
- return false;
- if (reader.TryReadManyU1(length, out ReadOnlySequence value) == false)
- return false;
-
- var valueBuffer = new byte[value.Length];
- value.CopyTo(valueBuffer);
-
- constant = new Utf8ConstantRecord(valueBuffer);
- return true;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Parsing/VerificationTypeInfoRecord.cs b/src/IKVM.ByteCode/Parsing/VerificationTypeInfoRecord.cs
deleted file mode 100644
index 51a5e5c7c0..0000000000
--- a/src/IKVM.ByteCode/Parsing/VerificationTypeInfoRecord.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace IKVM.ByteCode.Parsing
-{
-
- internal abstract record VerificationTypeInfoRecord
- {
-
- public static bool TryReadVerificationTypeInfo(ref ClassFormatReader reader, out VerificationTypeInfoRecord record)
- {
- record = null;
-
- if (reader.TryReadU1(out byte tag) == false)
- return false;
-
- return tag switch
- {
- 0 => TopVariableInfoRecord.TryRead(ref reader, out record),
- 1 => IntegerVariableInfoRecord.TryRead(ref reader, out record),
- 2 => FloatVariableInfoRecord.TryRead(ref reader, out record),
- 3 => DoubleVariableInfoRecord.TryRead(ref reader, out record),
- 4 => LongVariableInfoRecord.TryRead(ref reader, out record),
- 5 => NullVariableInfoRecord.TryRead(ref reader, out record),
- 6 => UninitializedThisVariableInfoRecord.TryRead(ref reader, out record),
- 7 => ObjectVariableInfoRecord.TryRead(ref reader, out record),
- 8 => UninitializedVariableInfoRecord.TryRead(ref reader, out record),
- _ => throw new ByteCodeException($"Invalid verification info tag: '{tag}'."),
- };
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/README.md b/src/IKVM.ByteCode/README.md
deleted file mode 100644
index 22312bf091..0000000000
--- a/src/IKVM.ByteCode/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-# IKVM.ByteCode
-
-Provides a Java class file parser, reader and writer implementation used by the IKVM project.
-
-The project is organized into three related sections.
-
-## IKVM.ByteCode.Parsing
-
-Contains Record structures and classes that represent the raw values that might appear in a Java class file. These
-types are not blittable, but do contain a TryRead method and TryWrite method, targeting a ClassFormatReader and
-ClassFormatWriter respectively.
-
-## IVKM.ByteCode.Reading
-
-Contains Reader classes that wrap Record structures. The main top-level class is ClassReader. ClassReader operates on
-a ClassRecord. ClassReader exposes collections and properties which allow navigation through a parsed class file. An
-attempt is made to only initialize data from the underlying records on demand.
-
-The Readers allow you to navigate through the constant pool, resolve constant values, and navigate through the
-interfaces, fields, methods and attributes of the class.
diff --git a/src/IKVM.ByteCode/Reading/AnnotationDefaultAttributeReader.cs b/src/IKVM.ByteCode/Reading/AnnotationDefaultAttributeReader.cs
deleted file mode 100644
index fe036cbef3..0000000000
--- a/src/IKVM.ByteCode/Reading/AnnotationDefaultAttributeReader.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class AnnotationDefaultAttributeReader : AttributeReader
- {
-
- ElementValueReader defaultValue;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal AnnotationDefaultAttributeReader(ClassReader declaringClass, AttributeInfoReader info, AnnotationDefaultAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- public ElementValueReader DefaultValue => LazyGet(ref defaultValue, () => ElementValueReader.Resolve(DeclaringClass, Record.DefaultValue));
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/AnnotationReader.cs b/src/IKVM.ByteCode/Reading/AnnotationReader.cs
deleted file mode 100644
index 5a9b50c55a..0000000000
--- a/src/IKVM.ByteCode/Reading/AnnotationReader.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class AnnotationReader : ReaderBase
- {
-
- Utf8ConstantReader type;
- ElementValueKeyReaderCollection elements;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public AnnotationReader(ClassReader declaringClass, AnnotationRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the type of the annotation.
- ///
- public Utf8ConstantReader Type => LazyGet(ref type, () => DeclaringClass.Constants.Get(Record.TypeIndex));
-
- ///
- /// Gets the element values of the annotation.
- ///
- public ElementValueKeyReaderCollection Elements => LazyGet(ref elements, () => new ElementValueKeyReaderCollection(DeclaringClass, Record.Elements));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/AnnotationReaderCollection.cs b/src/IKVM.ByteCode/Reading/AnnotationReaderCollection.cs
deleted file mode 100644
index b132856a6e..0000000000
--- a/src/IKVM.ByteCode/Reading/AnnotationReaderCollection.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of annotation data.
- ///
- internal sealed class AnnotationReaderCollection : LazyReaderList
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public AnnotationReaderCollection(ClassReader declaringClass, AnnotationRecord[] records) :
- base(declaringClass, records)
- {
-
- }
-
- ///
- /// Creates a new reader.
- ///
- ///
- ///
- ///
- protected override AnnotationReader CreateReader(int index, AnnotationRecord record)
- {
- return new AnnotationReader(DeclaringClass, record);
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/AttributeInfoReader.cs b/src/IKVM.ByteCode/Reading/AttributeInfoReader.cs
deleted file mode 100644
index dc6403d415..0000000000
--- a/src/IKVM.ByteCode/Reading/AttributeInfoReader.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class AttributeInfoReader : ReaderBase
- {
-
- Utf8ConstantReader name;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal AttributeInfoReader(ClassReader declaringClass, AttributeInfoRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the name of the attribute.
- ///
- public Utf8ConstantReader Name => name ??= DeclaringClass.Constants.Get(Record.NameIndex);
-
- ///
- /// Gets the data of the attribute.
- ///
- public ReadOnlyMemory Data => Record.Data;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/AttributeReader.cs b/src/IKVM.ByteCode/Reading/AttributeReader.cs
deleted file mode 100644
index a87b5ecaaf..0000000000
--- a/src/IKVM.ByteCode/Reading/AttributeReader.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal abstract class AttributeReader : ReaderBase
- {
-
- readonly AttributeInfoReader info;
- readonly AttributeRecord record;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal AttributeReader(ClassReader declaringClass, AttributeInfoReader info, AttributeRecord record) :
- base(declaringClass)
- {
- this.info = info ?? throw new ArgumentNullException(nameof(info));
- this.record = record ?? throw new ArgumentNullException(nameof(record));
- }
-
- ///
- /// Gets the information about the attribute.
- ///
- public AttributeInfoReader Info => info;
-
- ///
- /// Gets the underlying record of the attribute.
- ///
- public AttributeRecord Record => record;
-
- }
-
- internal abstract class AttributeReader : AttributeReader
- where TRecord : AttributeRecord
- {
-
- readonly TRecord record;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal AttributeReader(ClassReader declaringClass, AttributeInfoReader info, TRecord record) :
- base(declaringClass, info, record)
- {
- this.record = record ?? throw new ArgumentNullException(nameof(record));
- }
-
- ///
- /// Gets the underlying data record of the attribute.
- ///
- public new TRecord Record => record;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/AttributeReaderCollection.cs b/src/IKVM.ByteCode/Reading/AttributeReaderCollection.cs
deleted file mode 100644
index f5356e78f9..0000000000
--- a/src/IKVM.ByteCode/Reading/AttributeReaderCollection.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of attribute data.
- ///
- internal sealed class AttributeReaderCollection : LazyReaderList
- {
-
- ConstantValueAttributeReader constantValueAttribute;
- CodeAttributeReader codeAttribute;
- StackMapTableAttributeReader stackMapTableAttribute;
- ExceptionsAttributeReader exceptionsAttribute;
- InnerClassesAttributeReader innerClassesAttribute;
- EnclosingMethodAttributeReader enclosingMethodAttribute;
- SyntheticAttributeReader syntheticAttribute;
- SignatureAttributeReader signatureAttribute;
- SourceFileAttributeReader sourceFileAttribute;
- SourceDebugExtensionAttributeReader sourceDebugExtensionAttribute;
- LineNumberTableAttributeReader lineNumberTableAttribute;
- LocalVariableTableAttributeReader localVariableTableAttribute;
- LocalVariableTypeTableAttributeReader localVariableTypeTableAttribute;
- DeprecatedAttributeReader deprecatedAttribute;
- RuntimeVisibleAnnotationsAttributeReader runtimeVisibleAnnotationsAttribute;
- RuntimeInvisibleAnnotationsAttributeReader runtimeInvisibleAnnotationsAttribute;
- RuntimeVisibleParameterAnnotationsAttributeReader runtimeVisibleParameterAnnotationsAttribute;
- RuntimeInvisibleParameterAnnotationsAttributeReader runtimeInvisibleParameterAnnotationsAttribute;
- RuntimeVisibleTypeAnnotationsAttributeReader runtimeVisibleTypeAnnotationsAttribute;
- RuntimeInvisibleTypeAnnotationsAttributeReader runtimeInvisibleTypeAnnotationsAttribute;
- AnnotationDefaultAttributeReader annotationDefaultAttribute;
- BootstrapMethodsAttributeReader bootstrapMethodsAttribute;
- MethodParametersAttributeReader methodParametersAttribute;
- ModuleAttributeReader moduleAttribute;
- ModulePackagesAttributeReader modulePackagesAttribute;
- ModuleMainClassAttributeReader moduleMainClassAttribute;
- NestHostAttributeReader nestHostAttribute;
- NestMembersAttributeReader nestMembersAttribute;
- RecordAttributeReader recordAttribute;
- PermittedSubclassesAttributeReader permittedSubclassesAttribute;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public AttributeReaderCollection(ClassReader declaringClass, AttributeInfoRecord[] records) :
- base(declaringClass, records)
- {
-
- }
-
- ///
- /// Creates a new reader.
- ///
- ///
- ///
- ///
- ///
- protected override AttributeReader CreateReader(int index, AttributeInfoRecord record)
- {
- var info = new AttributeInfoReader(DeclaringClass, record);
- if (AttributeRecord.TryRead(info, out var attribute) == false)
- throw new ByteCodeException("Unable to read attribute data.");
-
- return attribute switch
- {
- ConstantValueAttributeRecord d => new ConstantValueAttributeReader(DeclaringClass, info, d),
- CodeAttributeRecord d => new CodeAttributeReader(DeclaringClass, info, d),
- StackMapTableAttributeRecord d => new StackMapTableAttributeReader(DeclaringClass, info, d),
- ExceptionsAttributeRecord d => new ExceptionsAttributeReader(DeclaringClass, info, d),
- InnerClassesAttributeRecord d => new InnerClassesAttributeReader(DeclaringClass, info, d),
- EnclosingMethodAttributeRecord d => new EnclosingMethodAttributeReader(DeclaringClass, info, d),
- SyntheticAttributeRecord d => new SyntheticAttributeReader(DeclaringClass, info, d),
- SignatureAttributeRecord d => new SignatureAttributeReader(DeclaringClass, info, d),
- SourceFileAttributeRecord d => new SourceFileAttributeReader(DeclaringClass, info, d),
- SourceDebugExtensionAttributeRecord d => new SourceDebugExtensionAttributeReader(DeclaringClass, info, d),
- LineNumberTableAttributeRecord d => new LineNumberTableAttributeReader(DeclaringClass, info, d),
- LocalVariableTableAttributeRecord d => new LocalVariableTableAttributeReader(DeclaringClass, info, d),
- LocalVariableTypeTableAttributeRecord d => new LocalVariableTypeTableAttributeReader(DeclaringClass, info, d),
- DeprecatedAttributeRecord d => new DeprecatedAttributeReader(DeclaringClass, info, d),
- RuntimeVisibleAnnotationsAttributeRecord d => new RuntimeVisibleAnnotationsAttributeReader(DeclaringClass, info, d),
- RuntimeInvisibleAnnotationsAttributeRecord d => new RuntimeInvisibleAnnotationsAttributeReader(DeclaringClass, info, d),
- RuntimeVisibleParameterAnnotationsAttributeRecord d => new RuntimeVisibleParameterAnnotationsAttributeReader(DeclaringClass, info, d),
- RuntimeInvisibleParameterAnnotationsAttributeRecord d => new RuntimeInvisibleParameterAnnotationsAttributeReader(DeclaringClass, info, d),
- RuntimeVisibleTypeAnnotationsAttributeRecord d => new RuntimeVisibleTypeAnnotationsAttributeReader(DeclaringClass, info, d),
- RuntimeInvisibleTypeAnnotationsAttributeRecord d => new RuntimeInvisibleTypeAnnotationsAttributeReader(DeclaringClass, info, d),
- AnnotationDefaultAttributeRecord d => new AnnotationDefaultAttributeReader(DeclaringClass, info, d),
- BootstrapMethodsAttributeRecord d => new BootstrapMethodsAttributeReader(DeclaringClass, info, d),
- MethodParametersAttributeRecord d => new MethodParametersAttributeReader(DeclaringClass, info, d),
- ModuleAttributeRecord d => new ModuleAttributeReader(DeclaringClass, info, d),
- ModulePackagesAttributeRecord d => new ModulePackagesAttributeReader(DeclaringClass, info, d),
- ModuleMainClassAttributeRecord d => new ModuleMainClassAttributeReader(DeclaringClass, info, d),
- NestHostAttributeRecord d => new NestHostAttributeReader(DeclaringClass, info, d),
- NestMembersAttributeRecord d => new NestMembersAttributeReader(DeclaringClass, info, d),
- RecordAttributeRecord d => new RecordAttributeReader(DeclaringClass, info, d),
- PermittedSubclassesAttributeRecord d => new PermittedSubclassesAttributeReader(DeclaringClass, info, d),
- UnknownAttributeRecord d => new UnknownAttributeReader(DeclaringClass, info, d),
- _ => throw new ByteCodeException("Cannot resolve attribute data."),
- };
- }
-
- ///
- /// Gets the attribute with the specified name.
- ///
- ///
- ///
- public AttributeReader this[string name] => this.FirstOrDefault(i => i.Info.Name.Value == name) ?? throw new KeyNotFoundException();
-
- ///
- /// Returns true if an attribute with the specified name exists.
- ///
- ///
- ///
- public bool Contains(string name) => this.Any(i => i.Info.Name.Value == name);
-
- ///
- /// Attempts to get the attribute with the specified name.
- ///
- ///
- ///
- public bool TryGet(out TAttribute value)
- {
- value = this.OfType().FirstOrDefault();
- return value != null;
- }
-
- public ConstantValueAttributeReader ConstantValue => LazyGet(ref constantValueAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public CodeAttributeReader Code => LazyGet(ref codeAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public StackMapTableAttributeReader StackMapTable => LazyGet(ref stackMapTableAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public ExceptionsAttributeReader Exceptions => LazyGet(ref exceptionsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public InnerClassesAttributeReader InnerClasses => LazyGet(ref innerClassesAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public EnclosingMethodAttributeReader EnclosingMethod => LazyGet(ref enclosingMethodAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public SyntheticAttributeReader Synthetic => LazyGet(ref syntheticAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public SignatureAttributeReader Signature => LazyGet(ref signatureAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public SourceFileAttributeReader SourceFile => LazyGet(ref sourceFileAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public SourceDebugExtensionAttributeReader SourceDebugExtension => LazyGet(ref sourceDebugExtensionAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public LineNumberTableAttributeReader LineNumberTable => LazyGet(ref lineNumberTableAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public LocalVariableTableAttributeReader LocalVariableTable => LazyGet(ref localVariableTableAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public LocalVariableTypeTableAttributeReader LocalVariableTypeTable => LazyGet(ref localVariableTypeTableAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public DeprecatedAttributeReader Deprecated => LazyGet(ref deprecatedAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeVisibleAnnotationsAttributeReader RuntimeVisibleAnnotations => LazyGet(ref runtimeVisibleAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeInvisibleAnnotationsAttributeReader RuntimeInvisibleAnnotations => LazyGet(ref runtimeInvisibleAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeVisibleParameterAnnotationsAttributeReader RuntimeVisibleParameterAnnotations => LazyGet(ref runtimeVisibleParameterAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeInvisibleParameterAnnotationsAttributeReader RuntimeInvisibleParameterAnnotations => LazyGet(ref runtimeInvisibleParameterAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeVisibleTypeAnnotationsAttributeReader RuntimeVisibleTypeAnnotations => LazyGet(ref runtimeVisibleTypeAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RuntimeInvisibleTypeAnnotationsAttributeReader RuntimeInvisibleTypeAnnotations => LazyGet(ref runtimeInvisibleTypeAnnotationsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public AnnotationDefaultAttributeReader AnnotationDefault => LazyGet(ref annotationDefaultAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public BootstrapMethodsAttributeReader BootstrapMethods => LazyGet(ref bootstrapMethodsAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public MethodParametersAttributeReader MethodParameters => LazyGet(ref methodParametersAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public ModuleAttributeReader Module => LazyGet(ref moduleAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public ModulePackagesAttributeReader ModulePackages => LazyGet(ref modulePackagesAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public ModuleMainClassAttributeReader ModuleMainClass => LazyGet(ref moduleMainClassAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public NestHostAttributeReader NestHost => LazyGet(ref nestHostAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public NestMembersAttributeReader NestMembers => LazyGet(ref nestMembersAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public RecordAttributeReader Record => LazyGet(ref recordAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- public PermittedSubclassesAttributeReader PermittedSubclasses => LazyGet(ref permittedSubclassesAttribute, () => TryGet(out var attribute) ? attribute : null);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeMethodReader.cs b/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeMethodReader.cs
deleted file mode 100644
index 9d8be36f51..0000000000
--- a/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeMethodReader.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class BootstrapMethodsAttributeMethodReader : ReaderBase
- {
-
- MethodrefConstantReader methodref;
- IReadOnlyList arguments;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public BootstrapMethodsAttributeMethodReader(ClassReader declaringClass, BootstrapMethodsAttributeMethodRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the method being referenced.
- ///
- public MethodrefConstantReader Methodref => LazyGet(ref methodref, () => DeclaringClass.Constants.Get(Record.MethodRefIndex));
-
- ///
- /// Gets the arguments bound to the method reference.
- ///
- public IReadOnlyList Arguments => LazyGet(ref arguments, () => new DelegateLazyReaderList(DeclaringClass, Record.Arguments, (_, index) => DeclaringClass.Constants[index]));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeReader.cs b/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeReader.cs
deleted file mode 100644
index ee487fb355..0000000000
--- a/src/IKVM.ByteCode/Reading/BootstrapMethodsAttributeReader.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal class BootstrapMethodsAttributeReader : AttributeReader
- {
-
- IReadOnlyList methods;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal BootstrapMethodsAttributeReader(ClassReader declaringClass, AttributeInfoReader info, BootstrapMethodsAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- ///
- /// Gets the set of methods described by this bootstrap attribute.
- ///
- public IReadOnlyList Methods => LazyGet(ref methods, () => new DelegateLazyReaderList(DeclaringClass, Record.Methods, (_, record) => new BootstrapMethodsAttributeMethodReader(DeclaringClass, record)));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ClassConstantReader.cs b/src/IKVM.ByteCode/Reading/ClassConstantReader.cs
deleted file mode 100644
index de2ae10291..0000000000
--- a/src/IKVM.ByteCode/Reading/ClassConstantReader.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ClassConstantReader : ConstantReader
- {
-
- Utf8ConstantReader name;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public ClassConstantReader(ClassReader declaringClass, ushort index, ClassConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the name of the class.
- ///
- public Utf8ConstantReader Name => LazyGet(ref name, () => DeclaringClass.Constants.Get(Record.NameIndex));
-
- ///
- /// Returns whether or not this constant is loadable.
- ///
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(49, 0);
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/ClassReader.cs b/src/IKVM.ByteCode/Reading/ClassReader.cs
deleted file mode 100644
index b45b60600d..0000000000
--- a/src/IKVM.ByteCode/Reading/ClassReader.cs
+++ /dev/null
@@ -1,307 +0,0 @@
-using System;
-using System.Buffers;
-using System.IO;
-using System.IO.MemoryMappedFiles;
-using System.IO.Pipelines;
-using System.Threading;
-using System.Threading.Tasks;
-
-using IKVM.ByteCode.Buffers;
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Provides stateful operations for reading a class file.
- ///
- internal sealed class ClassReader : ReaderBase
- {
-
- const int MIN_CLASS_SIZE = 30;
-
- ///
- /// Attempts to read a class from the given memory position.
- ///
- ///
- ///
- ///
- ///
- public static unsafe bool TryRead(byte* pointer, int length, out ClassReader clazz)
- {
- using var mmap = new UnmanagedMemoryManager(pointer, length);
- return TryRead(mmap.Memory, out clazz);
- }
-
- ///
- /// Attempts to read a class from the given memory location.
- ///
- ///
- ///
- ///
- ///
- public static unsafe ClassReader Read(byte* pointer, int length)
- {
- return TryRead(pointer, length, out var clazz) ? clazz : throw new InvalidClassException("Failed to open ClassReader. Incomplete class data.");
- }
-
- ///
- /// Attempts to read a class from the given file.
- ///
- ///
- ///
- ///
- public static unsafe bool TryRead(string path, out ClassReader clazz)
- {
- using var mmap = MemoryMappedFile.CreateFromFile(path, FileMode.Open, null, 0, MemoryMappedFileAccess.Read);
- using var view = mmap.CreateViewAccessor(0, 0, MemoryMappedFileAccess.Read);
-
- try
- {
- byte* pntr = null;
- view.SafeMemoryMappedViewHandle.AcquirePointer(ref pntr);
- return TryRead(pntr, checked((int)view.SafeMemoryMappedViewHandle.ByteLength), out clazz);
- }
- finally
- {
- view.SafeMemoryMappedViewHandle.ReleasePointer();
- }
- }
-
- ///
- /// Attempts to read a class from the given file.
- ///
- ///
- ///
- ///
- ///
- public static unsafe ClassReader Read(string path)
- {
- return TryRead(path, out var clazz) ? clazz : throw new InvalidClassException("Failed to open ClassReader. Incomplete class data.");
- }
-
- ///
- /// Attempts to read a class from the given buffer.
- ///
- ///
- ///
- ///
- public static bool TryRead(ReadOnlyMemory buffer, out ClassReader clazz)
- {
- return TryRead(new ReadOnlySequence(buffer), out clazz);
- }
-
- ///
- /// Attempts to read a class from the given buffer.
- ///
- ///
- ///
- ///
- public static ClassReader Read(ReadOnlyMemory buffer)
- {
- return TryRead(buffer, out var clazz) ? clazz : throw new InvalidClassException("Failed to open ClassReader. Incomplete class data.");
- }
-
- ///
- /// Attempts to read a class from the given buffer.
- ///
- ///
- ///
- ///
- public static bool TryRead(in ReadOnlySequence buffer, out ClassReader clazz)
- {
- return TryRead(buffer, out clazz, out _, out _);
- }
-
- ///
- /// Attempts to read a class from the given buffer, returning information about the number of consumed and examined bytes.
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static bool TryRead(in ReadOnlySequence buffer, out ClassReader clazz, out SequencePosition consumed, out SequencePosition examined)
- {
- consumed = buffer.Start;
-
- var reader = new ClassFormatReader(buffer);
- if (TryRead(ref reader, out clazz) == false)
- {
- // examined up to the position of the reader, but consumed nothing
- examined = reader.Position;
- return false;
- }
- else
- {
- // examined up to the point of the reader, consumed the same
- consumed = reader.Position;
- examined = reader.Position;
- return true;
- }
- }
-
- ///
- /// Attempts to read a class from the given buffer.
- ///
- ///
- ///
- ///
- public static ClassReader Read(in ReadOnlySequence buffer)
- {
- return TryRead(buffer, out var clazz) ? clazz : throw new InvalidClassException("Failed to open ClassReader. Incomplete class data.");
- }
-
- ///
- /// Attempts to read a class from the given reader.
- ///
- ///
- ///
- ///
- ///
- public static bool TryRead(ref ClassFormatReader reader, out ClassReader clazz)
- {
- clazz = null;
-
- if (ClassRecord.TryRead(ref reader, out var record) == false)
- return false;
-
- clazz = new ClassReader(record);
- return true;
- }
-
- ///
- /// Reads the next class from the stream.
- ///
- ///
- public static async ValueTask ReadAsync(Stream stream, CancellationToken cancellationToken = default)
- {
- if (stream is null)
- throw new ArgumentNullException(nameof(stream));
-
- var reader = PipeReader.Create(stream, new StreamPipeReaderOptions(minimumReadSize: 1, leaveOpen: true));
-
- try
- {
- return await ReadAsync(reader, cancellationToken);
- }
- catch (Exception e)
- {
- await reader.CompleteAsync(e);
- throw;
- }
- finally
- {
- await reader.CompleteAsync();
- }
- }
-
- ///
- /// Reads the next class from the stream.
- ///
- ///
- public static ClassReader Read(Stream stream, CancellationToken cancellationToken = default)
- {
- return ReadAsync(stream, cancellationToken).AsTask().GetAwaiter().GetResult();
- }
-
- ///
- /// Reads the next class from the stream.
- ///
- ///
- public static async ValueTask ReadAsync(PipeReader reader, CancellationToken cancellationToken = default)
- {
- while (true)
- {
- var result = await reader.ReadAtLeastAsync(MIN_CLASS_SIZE, cancellationToken);
- if (result.IsCanceled)
- throw new OperationCanceledException();
-
- // attempt to read at least one class
- if (TryRead(result.Buffer, out var clazz, out var consumed, out var examined) == false)
- {
- reader.AdvanceTo(consumed, examined);
-
- // we couldn't read a full class, and the pipe is at the end
- if (result.IsCompleted)
- throw new InvalidClassException("End of stream reached before valid class.");
-
- continue;
- }
-
- reader.AdvanceTo(consumed, examined);
- return clazz;
- }
- }
-
- internal int MAX_STACK_ALLOC = 1024;
-
- ClassConstantReader @this;
- ClassConstantReader super;
- ConstantReaderCollection constants;
- InterfaceReaderCollection interfaces;
- FieldReaderCollection fields;
- MethodReaderCollection methods;
- AttributeReaderCollection attributes;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- internal ClassReader(ClassRecord record) :
- base(null, record)
- {
-
- }
-
- ///
- /// Gets the version of the class.
- ///
- public ClassFormatVersion Version => new ClassFormatVersion(Record.MajorVersion, Record.MinorVersion);
-
- ///
- /// Gets the set of constants declared by the class.
- ///
- public ConstantReaderCollection Constants => LazyGet(ref constants, () => new ConstantReaderCollection(this, Record.Constants));
-
- ///
- /// Gets the access flags of the class.
- ///
- public AccessFlag AccessFlags => Record.AccessFlags;
-
- ///
- /// Gets the name of the class.
- ///
- public ClassConstantReader This => LazyGet(ref @this, () => Constants.Get(Record.ThisClassIndex));
-
- ///
- /// Gets the name of the super class.
- ///
- public ClassConstantReader Super => LazyGet(ref super, () => Constants.Get(Record.SuperClassIndex));
-
- ///
- /// Gets the set of the interfaces implemented by this class.
- ///
- public InterfaceReaderCollection Interfaces => LazyGet(ref interfaces, () => new InterfaceReaderCollection(this, Record.Interfaces));
-
- ///
- /// Gets the set of fields declared by the class.
- ///
- public FieldReaderCollection Fields => LazyGet(ref fields, () => new FieldReaderCollection(this, Record.Fields));
-
- ///
- /// Gets the set of methods declared by the class.
- ///
- public MethodReaderCollection Methods => LazyGet(ref methods, () => new MethodReaderCollection(this, Record.Methods));
-
- ///
- /// Gets the dictionary of attributes declared by the class.
- ///
- public AttributeReaderCollection Attributes => LazyGet(ref attributes, () => new AttributeReaderCollection(this, Record.Attributes));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/CodeAttributeReader.cs b/src/IKVM.ByteCode/Reading/CodeAttributeReader.cs
deleted file mode 100644
index e311b7ff24..0000000000
--- a/src/IKVM.ByteCode/Reading/CodeAttributeReader.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class CodeAttributeReader : AttributeReader
- {
-
- AttributeReaderCollection attributes;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal CodeAttributeReader(ClassReader declaringClass, AttributeInfoReader info, CodeAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- public ushort MaxStack => Record.MaxStack;
-
- public ushort MaxLocals => Record.MaxLocals;
-
- ///
- /// Gets the byte code.
- ///
- public ReadOnlyMemory Code => Record.Code;
-
- public IReadOnlyList ExceptionTable => Record.ExceptionTable;
-
- ///
- /// Gets the set of attributes applied to this attribute.
- ///
- public AttributeReaderCollection Attributes => LazyGet(ref attributes, () => new AttributeReaderCollection(DeclaringClass, Record.Attributes));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ConstantReader.cs b/src/IKVM.ByteCode/Reading/ConstantReader.cs
deleted file mode 100644
index b3c17646a6..0000000000
--- a/src/IKVM.ByteCode/Reading/ConstantReader.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Provides static methods for reading constants.
- ///
- internal static class ConstantReader
- {
-
- ///
- /// Initializes a from a .
- ///
- ///
- ///
- ///
- ///
- ///
- internal static IConstantReader Read(ClassReader declaringClass, ushort index, ConstantRecord record) => record switch
- {
- Utf8ConstantRecord c => new Utf8ConstantReader(declaringClass, index, c),
- IntegerConstantRecord c => new IntegerConstantReader(declaringClass, index, c),
- FloatConstantRecord c => new FloatConstantReader(declaringClass, index, c),
- LongConstantRecord c => new LongConstantReader(declaringClass, index, c),
- DoubleConstantRecord c => new DoubleConstantReader(declaringClass, index, c),
- ClassConstantRecord c => new ClassConstantReader(declaringClass, index, c),
- StringConstantRecord c => new StringConstantReader(declaringClass, index, c),
- FieldrefConstantRecord c => new FieldrefConstantReader(declaringClass, index, c),
- MethodrefConstantRecord c => new MethodrefConstantReader(declaringClass, index, c),
- InterfaceMethodrefConstantRecord c => new InterfaceMethodrefConstantReader(declaringClass, index, c),
- NameAndTypeConstantRecord c => new NameAndTypeConstantReader(declaringClass, index, c),
- MethodHandleConstantRecord c => new MethodHandleConstantReader(declaringClass, index, c),
- MethodTypeConstantRecord c => new MethodTypeConstantReader(declaringClass, index, c),
- DynamicConstantRecord c => new DynamicConstantReader(declaringClass, index, c),
- InvokeDynamicConstantRecord c => new InvokeDynamicConstantReader(declaringClass, index, c),
- ModuleConstantRecord c => new ModuleConstantReader(declaringClass, index, c),
- PackageConstantRecord c => new PackageConstantReader(declaringClass, index, c),
- _ => throw new ByteCodeException($"Invalid constant type: {record.GetType().Name}"),
- };
-
- }
-
- ///
- /// Base type for constant readers.
- ///
- ///
- internal abstract class ConstantReader : ReaderBase, IConstantReader
- where TRecord : ConstantRecord
- {
-
- readonly ushort index;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- protected ConstantReader(ClassReader declaringClass, ushort index, TRecord record) :
- base(declaringClass, record)
- {
- this.index = index;
- }
-
- ///
- /// Gets the index of the constant.
- ///
- public ushort Index => index;
-
- ///
- /// Returns true if the constant is considered loadable according to the JVM specification.
- ///
- public virtual bool IsLoadable => false;
-
- ///
- /// Gets the underlying constant being read.
- ///
- TRecord IConstantReader.Record => Record;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ConstantReaderCollection.cs b/src/IKVM.ByteCode/Reading/ConstantReaderCollection.cs
deleted file mode 100644
index 94ab8206a5..0000000000
--- a/src/IKVM.ByteCode/Reading/ConstantReaderCollection.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of constants.
- ///
- internal sealed class ConstantReaderCollection : LazyReaderList
- {
-
- readonly ClassReader declaringClass;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal ConstantReaderCollection(ClassReader declaringClass, ConstantRecord[] records) :
- base(declaringClass, records, 0)
- {
- this.declaringClass = declaringClass ?? throw new ArgumentNullException(nameof(declaringClass));
- }
-
- ///
- /// Creates a new reader for the given record.
- ///
- ///
- ///
- ///
- protected override IConstantReader CreateReader(int index, ConstantRecord record)
- {
- return record is not null ? ConstantReader.Read(declaringClass, (ushort)index, record) : null;
- }
-
- ///
- /// Attempts to get the constant reader at the specified index.
- ///
- ///
- ///
- ///
- public TReader Get(int index)
- where TReader : class, IConstantReader
- {
- if (index == 0)
- return null;
-
- try
- {
- return this[index] as TReader ?? throw new ByteCodeException($"Invalid constant resolution. Reader at index {index} is not a {typeof(TReader).Name}.");
- }
- catch (ArgumentOutOfRangeException e)
- {
- throw new ByteCodeException($"Invalid constant resolution. Reader at index {index} is not valid.", e);
- }
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ConstantValueAttributeReader.cs b/src/IKVM.ByteCode/Reading/ConstantValueAttributeReader.cs
deleted file mode 100644
index 71f6d074a0..0000000000
--- a/src/IKVM.ByteCode/Reading/ConstantValueAttributeReader.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ConstantValueAttributeReader : AttributeReader
- {
-
- object value;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal ConstantValueAttributeReader(ClassReader declaringClass, AttributeInfoReader info, ConstantValueAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- public object Value => value ??= ResolveValue();
-
- object ResolveValue() => DeclaringClass.Constants.Get(Record.ValueIndex) switch
- {
- LongConstantReader l => l.Value,
- FloatConstantReader f => f.Value,
- DoubleConstantReader d => d.Value,
- IntegerConstantReader i => i.Value,
- StringConstantReader s => s.Value,
- _ => throw new ByteCodeException("Invalid constant type for constant attribute."),
- };
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/DelegateLazyReaderList.cs b/src/IKVM.ByteCode/Reading/DelegateLazyReaderList.cs
deleted file mode 100644
index 390811aa1d..0000000000
--- a/src/IKVM.ByteCode/Reading/DelegateLazyReaderList.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Concrete lazy list implementation that creates readers lazily based on a delegate.
- ///
- ///
- ///
- internal sealed class DelegateLazyReaderList : LazyReaderList
- where TReader : class
- {
-
- readonly Func create;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- ///
- public DelegateLazyReaderList(ClassReader declaringClass, TSource[] sources, Func create) :
- base(declaringClass, sources)
- {
- this.create = create ?? throw new ArgumentNullException(nameof(create));
- }
-
- ///
- /// Creates the new reader.
- ///
- ///
- ///
- ///
- protected override TReader CreateReader(int index, TSource source) => create(index, source);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/DeprecatedAttributeReader.cs b/src/IKVM.ByteCode/Reading/DeprecatedAttributeReader.cs
deleted file mode 100644
index e3c1d966d4..0000000000
--- a/src/IKVM.ByteCode/Reading/DeprecatedAttributeReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal class DeprecatedAttributeReader : AttributeReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal DeprecatedAttributeReader(ClassReader declaringClass, AttributeInfoReader info, DeprecatedAttributeRecord data) :
- base(declaringClass, info, data)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/DoubleConstantReader.cs b/src/IKVM.ByteCode/Reading/DoubleConstantReader.cs
deleted file mode 100644
index 78e4fbfb65..0000000000
--- a/src/IKVM.ByteCode/Reading/DoubleConstantReader.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class DoubleConstantReader : ConstantReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public DoubleConstantReader(ClassReader declaringClass, ushort index, DoubleConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the value of the constant.
- ///
- public double Value => Record.Value;
-
- ///
- /// Returns whether or not this constant is loadable.
- ///
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(45, 3);
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/DynamicConstantReader.cs b/src/IKVM.ByteCode/Reading/DynamicConstantReader.cs
deleted file mode 100644
index b0e9d83b5e..0000000000
--- a/src/IKVM.ByteCode/Reading/DynamicConstantReader.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class DynamicConstantReader : ConstantReader
- {
-
- NameAndTypeConstantReader nameAndType;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public DynamicConstantReader(ClassReader declaringClass, ushort index, DynamicConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- public ushort BootstrapMethodAttributeIndex => Record.BootstrapMethodAttributeIndex;
-
- public NameAndTypeConstantReader NameAndType => LazyGet(ref nameAndType, () => DeclaringClass.Constants.Get(Record.NameAndTypeIndex));
-
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(55, 0);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ElementValueAnnotationReader.cs b/src/IKVM.ByteCode/Reading/ElementValueAnnotationReader.cs
deleted file mode 100644
index f5987d5f47..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueAnnotationReader.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ElementValueAnnotationReader : ElementValueReader
- {
-
- AnnotationReader annotation;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueAnnotationReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the annotation included with this element value.
- ///
- public AnnotationReader Annotation => LazyGet(ref annotation, () => new AnnotationReader(DeclaringClass, ValueRecord.Annotation));
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/ElementValueArrayReader.cs b/src/IKVM.ByteCode/Reading/ElementValueArrayReader.cs
deleted file mode 100644
index ef7a28b56b..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueArrayReader.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ElementValueArrayReader : ElementValueReader
- {
-
- ElementValueReaderCollection values;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueArrayReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- public ElementValueReaderCollection Values => LazyGet(ref values, () => new ElementValueReaderCollection(DeclaringClass, ValueRecord.Values));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ElementValueClassReader.cs b/src/IKVM.ByteCode/Reading/ElementValueClassReader.cs
deleted file mode 100644
index 69a780d5da..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueClassReader.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ElementValueClassReader : ElementValueReader
- {
-
- Utf8ConstantReader clazz;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueClassReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the class included with this element value.
- ///
- public Utf8ConstantReader Class => LazyGet(ref clazz, () => DeclaringClass.Constants.Get(ValueRecord.ClassIndex));
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/ElementValueConstantReader.cs b/src/IKVM.ByteCode/Reading/ElementValueConstantReader.cs
deleted file mode 100644
index 1abc7f9c87..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueConstantReader.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ElementValueConstantReader : ElementValueReader
- {
-
- IConstantReader value;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueConstantReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the type of the element value.
- ///
- public ElementValueTag Tag => Record.Tag;
-
- ///
- /// Gets the constant value.
- ///
- public IConstantReader Value => LazyGet(ref value, ResolveValue);
-
- ///
- /// Gets the value of the constant element.
- ///
- ///
- ///
- IConstantReader ResolveValue() => Record.Tag switch
- {
- ElementValueTag.Byte => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Char => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Double => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Float => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Integer => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Long => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Short => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.Boolean => DeclaringClass.Constants.Get(ValueRecord.Index),
- ElementValueTag.String => DeclaringClass.Constants.Get(ValueRecord.Index),
- _ => throw new ByteCodeException($"Unknown element value constant tag '{Record.Tag}'.")
- };
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/ElementValueEnumConstantReader.cs b/src/IKVM.ByteCode/Reading/ElementValueEnumConstantReader.cs
deleted file mode 100644
index 46c3f9d31e..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueEnumConstantReader.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ElementValueEnumConstantReader : ElementValueReader
- {
-
- Utf8ConstantReader typeName;
- Utf8ConstantReader constantName;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueEnumConstantReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- public Utf8ConstantReader TypeName => LazyGet(ref typeName, () => DeclaringClass.Constants.Get(ValueRecord.TypeNameIndex));
-
- public Utf8ConstantReader ConstantName => LazyGet(ref constantName, () => DeclaringClass.Constants.Get(ValueRecord.ConstantNameIndex));
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/ElementValuePairReaderCollection.cs b/src/IKVM.ByteCode/Reading/ElementValuePairReaderCollection.cs
deleted file mode 100644
index 74b528ce5b..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValuePairReaderCollection.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of element value data.
- ///
- internal sealed class ElementValueKeyReaderCollection : LazyNamedReaderDictionary
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public ElementValueKeyReaderCollection(ClassReader declaringClass, ElementValuePairRecord[] records, int minIndex = 0) :
- base(declaringClass, records, minIndex)
- {
-
- }
-
- ///
- /// Creates a new reader for the given record at the specified index.
- ///
- ///
- ///
- ///
- protected override ElementValueReader CreateReader(int index, ElementValuePairRecord record)
- {
- return ElementValueReader.Resolve(DeclaringClass, record.Value);
- }
-
- ///
- /// Gets the key for the given record and the specified index.
- ///
- ///
- ///
- ///
- protected override string GetName(int index, ElementValuePairRecord record)
- {
- return DeclaringClass.Constants.Get(record.NameIndex).Value;
- }
-
- ///
- /// Gets an enumerator over the items in this collection.
- ///
- ///
- public new IEnumerator> GetEnumerator() => ((IEnumerable>)this).GetEnumerator();
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ElementValueReaderCollection.cs b/src/IKVM.ByteCode/Reading/ElementValueReaderCollection.cs
deleted file mode 100644
index 50423c6bc2..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueReaderCollection.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of attribute data.
- ///
- internal sealed class ElementValueReaderCollection : LazyReaderList
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public ElementValueReaderCollection(ClassReader delcaringClass, ElementValueRecord[] records) :
- base(delcaringClass, records)
- {
-
- }
-
- protected override ElementValueReader CreateReader(int index, ElementValueRecord record)
- {
- return ElementValueReader.Resolve(DeclaringClass, record);
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ElementValueValueReader.cs b/src/IKVM.ByteCode/Reading/ElementValueValueReader.cs
deleted file mode 100644
index eab07860dd..0000000000
--- a/src/IKVM.ByteCode/Reading/ElementValueValueReader.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal abstract class ElementValueReader : ReaderBase
- {
-
- ///
- /// Resolves the given element value record to a reader type.
- ///
- ///
- ///
- ///
- ///
- public static ElementValueReader Resolve(ClassReader declaringClass, ElementValueRecord record) => record.Value switch
- {
- ElementValueAnnotationValueRecord => new ElementValueAnnotationReader(declaringClass, record),
- ElementValueArrayValueRecord => new ElementValueArrayReader(declaringClass, record),
- ElementValueClassValueRecord => new ElementValueClassReader(declaringClass, record),
- ElementValueConstantValueRecord => new ElementValueConstantReader(declaringClass, record),
- ElementValueEnumConstantValueRecord => new ElementValueEnumConstantReader(declaringClass, record),
- _ => throw new ByteCodeException("Cannot resolve element value reader."),
- };
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- protected ElementValueReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- }
-
- internal abstract class ElementValueReader : ElementValueReader
- where TValueRecord : ElementValueValueRecord
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- protected ElementValueReader(ClassReader declaringClass, ElementValueRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the underlying value record.
- ///
- public TValueRecord ValueRecord => (TValueRecord)Record.Value;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/EnclosingMethodAttributeReader.cs b/src/IKVM.ByteCode/Reading/EnclosingMethodAttributeReader.cs
deleted file mode 100644
index 83f98567c5..0000000000
--- a/src/IKVM.ByteCode/Reading/EnclosingMethodAttributeReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class EnclosingMethodAttributeReader : AttributeReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal EnclosingMethodAttributeReader(ClassReader declaringClass, AttributeInfoReader info, EnclosingMethodAttributeRecord data) :
- base(declaringClass, info, data)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/ExceptionsAttributeReader.cs b/src/IKVM.ByteCode/Reading/ExceptionsAttributeReader.cs
deleted file mode 100644
index 5b115ba3fc..0000000000
--- a/src/IKVM.ByteCode/Reading/ExceptionsAttributeReader.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class ExceptionsAttributeReader : AttributeReader
- {
-
- DelegateLazyReaderList exceptions;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal ExceptionsAttributeReader(ClassReader declaringClass, AttributeInfoReader info, ExceptionsAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- ///
- /// Gets the names of the exceptions.
- ///
- public IReadOnlyList Exceptions => LazyGet(ref exceptions, () => new DelegateLazyReaderList(DeclaringClass, Record.ExceptionsIndexes, (_, index) => DeclaringClass.Constants.Get(index)));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/FieldOrMethodReader.cs b/src/IKVM.ByteCode/Reading/FieldOrMethodReader.cs
deleted file mode 100644
index 2edbe9e5bd..0000000000
--- a/src/IKVM.ByteCode/Reading/FieldOrMethodReader.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace IKVM.ByteCode.Reading
-{
-
- internal abstract class FieldOrMethodReader : ReaderBase
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- protected FieldOrMethodReader(ClassReader declaringClass, TRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the access flags of this field or method.
- ///
- public abstract AccessFlag AccessFlags { get; }
-
- ///
- /// Gets the name of this field or method.
- ///
- public abstract Utf8ConstantReader Name { get; }
-
- ///
- /// Gets the descriptor of this field or method.
- ///
- public abstract Utf8ConstantReader Descriptor { get; }
-
- ///
- /// Gets the attributes of this field or method.
- ///
- public abstract AttributeReaderCollection Attributes { get; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/FieldReader.cs b/src/IKVM.ByteCode/Reading/FieldReader.cs
deleted file mode 100644
index d86faf7b21..0000000000
--- a/src/IKVM.ByteCode/Reading/FieldReader.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal class FieldReader : FieldOrMethodReader
- {
-
- Utf8ConstantReader name;
- Utf8ConstantReader descriptor;
- AttributeReaderCollection attributes;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal FieldReader(ClassReader declaringClass, FieldRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the access flags of the field.
- ///
- public override AccessFlag AccessFlags => Record.AccessFlags;
-
- ///
- /// Gets the name of the field.
- ///
- public override Utf8ConstantReader Name => LazyGet(ref name, () => DeclaringClass.Constants.Get(Record.NameIndex));
-
- ///
- /// Gets the descriptor of the field.
- ///
- public override Utf8ConstantReader Descriptor => LazyGet(ref descriptor, () => DeclaringClass.Constants.Get(Record.DescriptorIndex));
-
- ///
- /// Gets the attributes of the field.
- ///
- public override AttributeReaderCollection Attributes => LazyGet(ref attributes, () => new AttributeReaderCollection(DeclaringClass, Record.Attributes));
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/FieldReaderCollection.cs b/src/IKVM.ByteCode/Reading/FieldReaderCollection.cs
deleted file mode 100644
index a257f86613..0000000000
--- a/src/IKVM.ByteCode/Reading/FieldReaderCollection.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of fields.
- ///
- internal sealed class FieldReaderCollection : LazyNamedReaderDictionary
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal FieldReaderCollection(ClassReader declaringClass, FieldRecord[] records) :
- base(declaringClass, records)
- {
-
- }
-
- ///
- /// Creates a new field reader.
- ///
- ///
- ///
- ///
- protected override FieldReader CreateReader(int index, FieldRecord record)
- {
- return new FieldReader(DeclaringClass, record);
- }
-
- ///
- /// Gets the key for the specified record.
- ///
- ///
- ///
- ///
- protected override string GetName(int index, FieldRecord record)
- {
- return DeclaringClass.Constants.Get(record.NameIndex).Value;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/FieldrefConstantReader.cs b/src/IKVM.ByteCode/Reading/FieldrefConstantReader.cs
deleted file mode 100644
index 689d36bc45..0000000000
--- a/src/IKVM.ByteCode/Reading/FieldrefConstantReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal class FieldrefConstantReader : RefConstantReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public FieldrefConstantReader(ClassReader declaringClass, ushort index, FieldrefConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/FloatConstantReader.cs b/src/IKVM.ByteCode/Reading/FloatConstantReader.cs
deleted file mode 100644
index 6cd95da0c5..0000000000
--- a/src/IKVM.ByteCode/Reading/FloatConstantReader.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class FloatConstantReader : ConstantReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public FloatConstantReader(ClassReader declaringClass, ushort index, FloatConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the value of the constant.
- ///
- public float Value => Record.Value;
-
- ///
- /// Returns true if this constant is loadable.
- ///
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(45, 3);
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/IConstantReader.cs b/src/IKVM.ByteCode/Reading/IConstantReader.cs
deleted file mode 100644
index d9f1b8b516..0000000000
--- a/src/IKVM.ByteCode/Reading/IConstantReader.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Interface supported by all of the constant readers.
- ///
- internal interface IConstantReader
- {
-
- ///
- /// Gets the index of this constant.
- ///
- ushort Index { get; }
-
- ///
- /// Returns true if this constant is loadable.
- ///
- bool IsLoadable { get; }
-
- }
-
- ///
- /// Interface supported by all of the constant readers.
- ///
- internal interface IConstantReader : IConstantReader
- where TRecord : ConstantRecord
- {
-
- ///
- /// Gets the record.
- ///
- TRecord Record { get; }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/IRefConstantReader.cs b/src/IKVM.ByteCode/Reading/IRefConstantReader.cs
deleted file mode 100644
index 1e97bffcef..0000000000
--- a/src/IKVM.ByteCode/Reading/IRefConstantReader.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Interface supported by all of the readers for Ref constants.
- ///
- internal interface IRefConstantReader : IConstantReader
- {
-
- ///
- /// Gets the class name of the reference.
- ///
- ClassConstantReader Class { get; }
-
- ///
- /// Gets the name and type reference.
- ///
- NameAndTypeConstantReader NameAndType { get; }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/InnerClassesAttributeItemReader.cs b/src/IKVM.ByteCode/Reading/InnerClassesAttributeItemReader.cs
deleted file mode 100644
index 393ac5bbe9..0000000000
--- a/src/IKVM.ByteCode/Reading/InnerClassesAttributeItemReader.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class InnerClassesAttributeItemReader : ReaderBase
- {
-
- ClassConstantReader innerClass;
- ClassConstantReader outerClass;
- Utf8ConstantReader innerName;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public InnerClassesAttributeItemReader(ClassReader declaringClass, InnerClassesAttributeItemRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the name of the inner class.
- ///
- public ClassConstantReader InnerClass => LazyGet(ref innerClass, () => DeclaringClass.Constants.Get(Record.InnerClassIndex));
-
- ///
- /// Gets the name of the outer class.
- ///
- public ClassConstantReader OuterClass => LazyGet(ref outerClass, () => DeclaringClass.Constants.Get(Record.OuterClassIndex));
-
- ///
- /// Gets the inner name.
- ///
- public Utf8ConstantReader InnerName => LazyGet(ref innerName, () => DeclaringClass.Constants.Get(Record.InnerNameIndex));
-
- ///
- /// Gets the access flags of the inner class.
- ///
- public AccessFlag InnerClassAccessFlags => Record.InnerClassAccessFlags;
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/InnerClassesAttributeReader.cs b/src/IKVM.ByteCode/Reading/InnerClassesAttributeReader.cs
deleted file mode 100644
index b26ebcff26..0000000000
--- a/src/IKVM.ByteCode/Reading/InnerClassesAttributeReader.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.Collections.Generic;
-
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class InnerClassesAttributeReader : AttributeReader
- {
-
- IReadOnlyList items;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public InnerClassesAttributeReader(ClassReader declaringClass, AttributeInfoReader info, InnerClassesAttributeRecord record) :
- base(declaringClass, info, record)
- {
-
- }
-
- ///
- /// Gets the items on the attribute.
- ///
- public IReadOnlyList Items => LazyGet(ref items, () => new DelegateLazyReaderList(DeclaringClass, Record.Items, (_, record) => new InnerClassesAttributeItemReader(DeclaringClass, record)));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/IntegerConstantReader.cs b/src/IKVM.ByteCode/Reading/IntegerConstantReader.cs
deleted file mode 100644
index a0c172008b..0000000000
--- a/src/IKVM.ByteCode/Reading/IntegerConstantReader.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class IntegerConstantReader : ConstantReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public IntegerConstantReader(ClassReader declaringClass, ushort index, IntegerConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the value of the constant.
- ///
- public int Value => Record.Value;
-
- ///
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(45, 3);
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/InterfaceMethodrefConstantReader.cs b/src/IKVM.ByteCode/Reading/InterfaceMethodrefConstantReader.cs
deleted file mode 100644
index c1a9d9fa9d..0000000000
--- a/src/IKVM.ByteCode/Reading/InterfaceMethodrefConstantReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class InterfaceMethodrefConstantReader : RefConstantReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public InterfaceMethodrefConstantReader(ClassReader declaringClass, ushort index, InterfaceMethodrefConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/InterfaceReader.cs b/src/IKVM.ByteCode/Reading/InterfaceReader.cs
deleted file mode 100644
index 05b01b1f76..0000000000
--- a/src/IKVM.ByteCode/Reading/InterfaceReader.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class InterfaceReader : ReaderBase
- {
-
- ClassConstantReader clazz;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal InterfaceReader(ClassReader declaringClass, InterfaceRecord record) :
- base(declaringClass, record)
- {
-
- }
-
- ///
- /// Gets the name of the interface.
- ///
- public ClassConstantReader Class => LazyGet(ref clazz, () => DeclaringClass.Constants.Get(Record.ClassIndex));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/InterfaceReaderCollection.cs b/src/IKVM.ByteCode/Reading/InterfaceReaderCollection.cs
deleted file mode 100644
index 023d3c3126..0000000000
--- a/src/IKVM.ByteCode/Reading/InterfaceReaderCollection.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Lazy init collection of method data.
- ///
- internal sealed class InterfaceReaderCollection : LazyNamedReaderDictionary
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- internal InterfaceReaderCollection(ClassReader declaringClass, InterfaceRecord[] records) :
- base(declaringClass, records)
- {
-
- }
-
- ///
- /// Creates a new interface reader.
- ///
- ///
- ///
- protected override InterfaceReader CreateReader(int index, InterfaceRecord record)
- {
- return new InterfaceReader(DeclaringClass, record);
- }
-
- ///
- /// Gets the name of the interface.
- ///
- ///
- ///
- ///
- protected override string GetName(int index, InterfaceRecord record)
- {
- return DeclaringClass.Constants.Get(record.ClassIndex).Name.Value;
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/InvokeDynamicConstantReader.cs b/src/IKVM.ByteCode/Reading/InvokeDynamicConstantReader.cs
deleted file mode 100644
index 6fb3584726..0000000000
--- a/src/IKVM.ByteCode/Reading/InvokeDynamicConstantReader.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class InvokeDynamicConstantReader : ConstantReader
- {
-
- NameAndTypeConstantReader nameAndType;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public InvokeDynamicConstantReader(ClassReader owner, ushort index, InvokeDynamicConstantRecord record) :
- base(owner, index, record)
- {
-
- }
-
- ///
- /// Gets the index into the BootstrapMethod table that is referenced by this constant.
- ///
- public ushort BootstrapMethodAttributeIndex => Record.BootstrapMethodAttributeIndex;
-
- ///
- /// Gets the name of the InvokeDynamic constant.
- ///
- public NameAndTypeConstantReader NameAndType => LazyGet(ref nameAndType, () => DeclaringClass.Constants.Get(Record.NameAndTypeIndex));
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LazyNamedReaderDictionary.cs b/src/IKVM.ByteCode/Reading/LazyNamedReaderDictionary.cs
deleted file mode 100644
index 17fb0dbe96..0000000000
--- a/src/IKVM.ByteCode/Reading/LazyNamedReaderDictionary.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Base implementation of a dictionary that generates reader instances on demand.
- ///
- ///
- ///
- internal abstract class LazyNamedReaderDictionary : IReadOnlyDictionary
- where TReader : class
- {
-
- readonly ClassReader declaringClass;
- readonly TRecord[] records;
- readonly int minIndex;
-
- TReader[] readers;
- string[] names;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public LazyNamedReaderDictionary(ClassReader declaringClass, TRecord[] records, int minIndex = 0)
- {
- this.declaringClass = declaringClass ?? throw new ArgumentNullException(nameof(declaringClass));
- this.records = records ?? throw new ArgumentNullException(nameof(records));
- this.minIndex = minIndex;
- }
-
- ///
- /// Gets the underlying records that make up the list.
- ///
- protected IReadOnlyList Records => records;
-
- ///
- /// Creates the appropriate reader.
- ///
- ///
- ///
- ///
- protected abstract TReader CreateReader(int index, TRecord record);
-
- ///
- /// Gets the name for the given record.
- ///
- ///
- ///
- ///
- protected abstract string GetName(int index, TRecord record);
-
- ///
- /// Resolves the specified reader at the given index.
- ///
- ///
- TReader ResolveReader(int index)
- {
- if (index < minIndex || index >= records.Length)
- throw new ArgumentOutOfRangeException(nameof(index));
-
- // initialize cache if not initialized
- if (readers == null)
- Interlocked.CompareExchange(ref readers, new TReader[records.Length], null);
-
- // consult cache
- if (readers[index] is TReader reader)
- return reader;
-
- // atomic set, only one winner
- Interlocked.CompareExchange(ref readers[index], CreateReader(index, records[index]), null);
- return readers[index];
- }
-
- ///
- /// Resolves the specified name at the given index.
- ///
- ///
- ///
- ///
- string ResolveName(int index)
- {
- if (index < minIndex || index >= records.Length)
- throw new ArgumentOutOfRangeException(nameof(index));
-
- // initialize cache if not initialized
- if (names == null)
- Interlocked.CompareExchange(ref names, new string[records.Length], null);
-
- // consult cache
- if (names[index] is string name)
- return name;
-
- // atomic set, only one winner
- Interlocked.CompareExchange(ref names[index], GetName(index, records[index]), null);
- return names[index];
- }
-
- ///
- /// Gets the class that declared this list.
- ///
- public ClassReader DeclaringClass => declaringClass;
-
- ///
- /// Gets the reader at the specified index.
- ///
- ///
- ///
- public TReader this[int index] => ResolveReader(index);
-
- ///
- /// Gets the reader with the specified name.
- ///
- ///
- ///
- public TReader this[string name] => Enumerable.Range(minIndex, records.Length).Where(i => ResolveName(i) == name).Select(ResolveReader).FirstOrDefault() ?? throw new KeyNotFoundException();
-
- ///
- /// Gets the count of readers.
- ///
- public int Count => records.Length;
-
- ///
- /// Attempts to get the value at the specified index, or returns the default value if out of range.
- ///
- ///
- ///
- ///
- public bool TryGet(int index, out TReader value)
- {
- value = default;
-
- if (index < minIndex || index >= records.Length)
- return false;
-
- value = this[index];
- return true;
- }
-
- ///
- /// Attempts to get the value at the specified index, or returns the default value if out of range.
- ///
- ///
- ///
- ///
- public bool TryGet(string name, out TReader value) => (value = Enumerable.Range(minIndex, records.Length).Where(i => ResolveName(i) == name).Select(ResolveReader).FirstOrDefault()) != null;
-
- ///
- /// Returns true if the collection contains a reader with the specified name.
- ///
- ///
- ///
- public bool Contains(string name) => Enumerable.Range(minIndex, records.Length).Any(i => ResolveName(i) == name);
-
- ///
- /// Gets an enumerator over each reader.
- ///
- ///
- public IEnumerator GetEnumerator() => Enumerable.Range(minIndex, records.Length).Select(i => this[i]).GetEnumerator();
-
- ///
- /// Gets an enumerator over each reader.
- ///
- ///
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
-
- ///
- /// Gets an enumerator over each reader.
- ///
- ///
- IEnumerator> IEnumerable>.GetEnumerator() => Enumerable.Range(minIndex, records.Length).Select(i => new KeyValuePair(ResolveName(i), ResolveReader(i))).GetEnumerator();
-
- ///
- /// Gets all of the available keys.
- ///
- IEnumerable IReadOnlyDictionary.Keys => Enumerable.Range(minIndex, records.Length).Select(ResolveName);
-
- ///
- /// Gets all of the available values.
- ///
- IEnumerable IReadOnlyDictionary.Values => Enumerable.Range(minIndex, records.Length).Select(ResolveReader);
-
- ///
- /// Attempts to retrieve the reader with the specified key.
- ///
- ///
- ///
- ///
- bool IReadOnlyDictionary.TryGetValue(string key, out TReader value) => TryGet(key, out value);
-
- ///
- /// Returns true if the collection contains the specified key.
- ///
- ///
- ///
- bool IReadOnlyDictionary.ContainsKey(string key) => Contains(key);
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LazyReaderList.cs b/src/IKVM.ByteCode/Reading/LazyReaderList.cs
deleted file mode 100644
index 2d66ecb31f..0000000000
--- a/src/IKVM.ByteCode/Reading/LazyReaderList.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading;
-
-namespace IKVM.ByteCode.Reading
-{
-
- ///
- /// Base implementation of a list that generates reader instances on demand.
- ///
- ///
- ///
- internal abstract class LazyReaderList : IReadOnlyList
- where TReader : class
- {
-
- readonly ClassReader declaringClass;
- readonly TRecord[] records;
- readonly uint minIndex;
-
- TReader[] readers;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- public LazyReaderList(ClassReader declaringClass, TRecord[] records, uint minIndex = 0)
- {
- this.declaringClass = declaringClass ?? throw new ArgumentNullException(nameof(declaringClass));
- this.records = records ?? throw new ArgumentNullException(nameof(records));
- this.minIndex = minIndex;
- }
-
- ///
- /// Gets the underlying records that make up the list.
- ///
- protected IReadOnlyList Records => records;
-
- ///
- /// Creates the appropriate reader.
- ///
- ///
- ///
- ///
- protected abstract TReader CreateReader(int index, TRecord record);
-
- ///
- /// Resolves the specified reader at the given index.
- ///
- ///
- TReader ResolveReader(int index)
- {
- if (index < minIndex || index >= records.Length)
- throw new ArgumentOutOfRangeException(nameof(index));
-
- // initialize cache if not initialized
- if (readers == null)
- Interlocked.CompareExchange(ref readers, new TReader[records.Length], null);
-
- // consult cache
- if (readers[index] is TReader reader)
- return reader;
-
- // atomic set, only one winner
- Interlocked.CompareExchange(ref readers[index], CreateReader(index, records[index]), null);
- return readers[index];
- }
-
- ///
- /// Gets the class that declared this list.
- ///
- public ClassReader DeclaringClass => declaringClass;
-
- ///
- /// Gets the reader at the specified index.
- ///
- ///
- ///
- public TReader this[int index] => ResolveReader(index);
-
- ///
- /// Gets the count of readers.
- ///
- public int Count => records.Length;
-
- ///
- /// Gets an enumerator over each reader.
- ///
- ///
- public IEnumerator GetEnumerator() => Enumerable.Range(0, records.Length).Select(i => this[i]).GetEnumerator();
-
- ///
- /// Gets an enumerator over each reader.
- ///
- ///
- IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LineNumberTableAttributeReader.cs b/src/IKVM.ByteCode/Reading/LineNumberTableAttributeReader.cs
deleted file mode 100644
index 35d5977a06..0000000000
--- a/src/IKVM.ByteCode/Reading/LineNumberTableAttributeReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class LineNumberTableAttributeReader : AttributeReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal LineNumberTableAttributeReader(ClassReader declaringClass, AttributeInfoReader info, LineNumberTableAttributeRecord data) :
- base(declaringClass, info, data)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LocalVariableTableAttributeReader.cs b/src/IKVM.ByteCode/Reading/LocalVariableTableAttributeReader.cs
deleted file mode 100644
index 24876f5b9a..0000000000
--- a/src/IKVM.ByteCode/Reading/LocalVariableTableAttributeReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class LocalVariableTableAttributeReader : AttributeReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal LocalVariableTableAttributeReader(ClassReader declaringClass, AttributeInfoReader info, LocalVariableTableAttributeRecord data) :
- base(declaringClass, info, data)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LocalVariableTypeTableAttributeReader.cs b/src/IKVM.ByteCode/Reading/LocalVariableTypeTableAttributeReader.cs
deleted file mode 100644
index 6b0794f772..0000000000
--- a/src/IKVM.ByteCode/Reading/LocalVariableTypeTableAttributeReader.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class LocalVariableTypeTableAttributeReader : AttributeReader
- {
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- internal LocalVariableTypeTableAttributeReader(ClassReader declaringClass, AttributeInfoReader info, LocalVariableTypeTableAttributeRecord data) :
- base(declaringClass, info, data)
- {
-
- }
-
- }
-
-}
diff --git a/src/IKVM.ByteCode/Reading/LongConstantReader.cs b/src/IKVM.ByteCode/Reading/LongConstantReader.cs
deleted file mode 100644
index 4cf3ee55fb..0000000000
--- a/src/IKVM.ByteCode/Reading/LongConstantReader.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class LongConstantReader : ConstantReader
- {
-
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public LongConstantReader(ClassReader declaringClass, ushort index, LongConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the value of the constant.
- ///
- public long Value => Record.Value;
-
- ///
- /// Returns true if this constant is loadable.
- ///
- public override bool IsLoadable => DeclaringClass.Version >= new ClassFormatVersion(45, 3);
-
- }
-
-}
\ No newline at end of file
diff --git a/src/IKVM.ByteCode/Reading/MethodHandleConstantReader.cs b/src/IKVM.ByteCode/Reading/MethodHandleConstantReader.cs
deleted file mode 100644
index 0c1d7bfe30..0000000000
--- a/src/IKVM.ByteCode/Reading/MethodHandleConstantReader.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using IKVM.ByteCode.Parsing;
-
-using static IKVM.ByteCode.Util;
-
-namespace IKVM.ByteCode.Reading
-{
-
- internal sealed class MethodHandleConstantReader : ConstantReader
- {
-
- IRefConstantReader reference;
-
- ///
- /// Initializes a new instance.
- ///
- ///
- ///
- ///
- public MethodHandleConstantReader(ClassReader declaringClass, ushort index, MethodHandleConstantRecord record) :
- base(declaringClass, index, record)
- {
-
- }
-
- ///
- /// Gets the kind of this reference.
- ///
- public ReferenceKind ReferenceKind => Record.Kind;
-
- ///
- /// Gets the constant refered to by this MethodHandle.
- ///
- public IRefConstantReader Reference => LazyGet(ref reference, () => DeclaringClass.Constants.Get(Record.Index));
-
- ///