This changes should include all corelib code and also should compile fine.
Still there is some cleanup need to be done like defining the right conditional
compilation variables, sync up the changes here with the porting code source
* Make the cctor context structure part of the NonGCStaticsNode
* Change the way how
HasStaticConstructor/GetStaticConstructor/IsStaticConstructor work per
CR feedback
* Introduce the concept of well known entrypoints
* Get the ReadyToRunHelper to call the actual managed cctor runner
Note that this requires an updated test mscorlib where the CctorHelper
class is uncommented and MemoryBarrier is implemented to do nothing.
Note the calli intrinsic is not implemented yet, so this won't actually
call the cctor anyway.
Similarly to .NET Native, the non-GC static region of a type should be prefixed
by a small structure ("static class construction context") that has a pointer
to the class constructor and a field indicating whether the class constructor
already executed.
This change includes the required JitInterface implementation that decides
whether a class constructor check should be injected by the JIT and a change
in the AsmWriter that emits the extra block and helper call implementation.
I'm sending it for review now, but don't expect to merge it as I want to
wait for David's change. Note that we currently don't set/check the bit indicating
whether the class constructor ran because I don't want to spend time figuring
out how to do it in AT&T assembly syntax.
While this is in review and while David's change is not merged, I'll be looking
into how to hook this up into the managed class constructor runner. CoreLib in
.NET Native has a (commented out) simple version of the runner from the .NET
Native bringup days we could likely successfully use once I implement the
necessary MCG intrinsic.
The concept of Call intrinsic is used in the .NET Native compiler when
C# code needs to perform an indirect call to an address. Since calli is
not exposed in the language, the C# code calls a special method that
will be transformed by the compiler to perform a calli.
The method has shape T Call<T>(IntPtr address, X arg0,... Z argN). The
generated method body loads arguments arg0...argN and performs a calli
to the address given in the first argument.
- Abstraction for symbols
- Abstraction for individual contents of the object file
- Abstraction for generation of assembly stubs
- Nodes for EETypes, non-gc statics, ready to run helpers, method code
- Abstraction for careful expansion of virtual methods
- New asmwriter based on object nodes from dependency graph
- Refactor code generator based compilation to use new graph. (Old logic is still in place for the Cpp code generator, and for ease of merging in changes as they occur. Once this change is merged, I'll work to get rid of the old asm emission path, and work with Jan to change over Cpp emission)
- Dependency graph can be logged to a dgml file and viewed in visual studio.
- New assembly emitter helper library for use by stubs
- Make ReadyToRunHelper class hash table friendly, and use in node table for lookup.
- Add node naming function GetName to force all non-abstract nodes to implement it
- Add concept of ObjectNodes which aren't actually emitted in the end. Use to only emit 1 eetype even if both constructed and non-constructed ones are in the graph.
- Target specific items are (mostly) in a target specific directory
DependencyAnalysisFramework changes
- Make the OnMarked override take a context parameter
- Simplify ISymbolNode
- Replace methods that fail to compile with call to DebugBreak
- Implement a couple of more methods on JIT-EE interface
- Add stubs for some not-yet-implemented intrinsics and PInvokes
- Add missing forwarders for IsVirtual and IsNewSlot to generic method specializations
- Extend workaround for infinite recursion in virtual method resolution
- Fill implementation of several runtime helpers
Get static string literal loads to work
Allocate reloc fixup pointers in the image for the JIT indirection to work.
Emit strings as compressed int lengths and characters in the data section.
Use Windows APIs to convert these UTF8 encoded strings to UTF16.
Patch the pointers at runtime initialization with GCHandles to static strings and set it in the fixup locations.