ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.26k stars 118 forks source link

Replace IKVM.Reflection.Emit system with System.Reflection.Metadata.Ecma335 #59

Open wasabii opened 2 years ago

wasabii commented 2 years ago

The IKVM.Reflection.Emit code is used to generate IL. This should be replaceable with System.Reflection.Metadata.Ecma335 without too much trouble. Would reduce the amount of IKVM code fairly significantly.

wasabii commented 2 years ago

My thinking is currently here:

Split the compiler code out into a separate project: IKVM.Compiler. Build a set of interfaces that need to be provided to the compiler, much as Workspace exists for Roslyn. These interfaces will deal with classloading (for a given class name, find the class file contents). And assembly resolution.

The static compiler (importer) can provide these interfaces in a way that doesn't depend on Runtime at all. A simple assembly resolver based on the command line args, and a class resolver based on the same.

The dynamic compiler can provide other versions, which DO consult the appropriate classloader.