Age | Commit message (Collapse) | Author |
|
* Add source line debug metadata. Works with javascript output.
* Add names of arguments and locals when they're stored on the stack (and thus easily visible in the debugger)
* Add debugging information to documentation
|
|
Use LLVM arguments and returns where possible (no GC references) instead of passing them on the shadow stack. The argument optimization saves 3% optimized (5% compressed). The return change adds about 0.5% to the uncompressed file, but saves about 6% compressed. They both save size in debug. This also greatly simplifies debugging and reading code. Also includes a fix to the class constructor runner where it was calling cctors with the wrong signature and some test fixes.
|
|
enabled. (#6180)
|
|
* Handle multidimensional array instantiation (#5421)
newobj instruction on multidimensional array is now processed with
ArrayHelpers.NewObjArray. Enabled instantiating multidimensional arrays.
* Add testing for multidimensional array instantiation.
Only nullity and lengths are checked due to get & set not working on
multidimensional arrays.
|
|
separate the sorting APIs into their own interfaces, independent of having symbols. Reasons:
1) There are some dependency nodes that need sorting, and are not necessarily symbol nodes (today they implement the SortableDependencyNode, which now with these changes will also implement the ISortableNode interface)
2) Avoid places where we have the messy 2 ClassCode and 2 CompareToImpl implementations, where one pair tail-calls the other (really the main reason behind this refactoring)
With these changes, the ClassCode and CompareToImpl are now part of the ISortableNode, The ISortableSymbolNode is now simply a merging of ISortableNode and ISymbolNode, to be used in places where we deal with both concepts.
SortableDependencyNode provides default/abstract virtuals to the interface methods, and are overridden in derived classes.
[tfs-changeset: 1707646]
|
|
1. Incoporating offsetFromSymbolName in offset calculations
2. Sorting node emission so sizes are computed before trying to emit them
|
|
Optimize structs by making them be structs or scalars in llvm instead of arrays.
Store locals that don't have GC pointers on the local stack instead of the shadow stack. Only saves a few % of release build size, but saves 15% in debug builds and makes debugging significantly easier.
|
|
Fix double cast
push floats and doubles to stack as double
add some more tests around float/double comparisons
|
|
|
|
WASM (#5784)
fix dup instruction result to no longer reference the original memory
added additional dup test cases
|
|
Interface dispatch
|
|
1. Don't add a vtable offset to interface slot numbers
2. Ensure values are loaded before applying conv to them to avoid loading too wide of a value (found when interface dispatch loads a uint16 and then converts to IntPtr)
|
|
Code to call InitializeModules on startup and associated bug fixes and workarounds. Handles mismatched struct calling conventions between LLVM and Clang and works around the dup opcode incorrectly reloading values. Enables StartupCodeMain and fix associated bugs in pinvokes. Implements main return codes
|
|
When I did the `System.Reflection.Pointer` support for reflection invoke and delegate `DynamicInvoke`, I found these two thunks do pretty much the same thing. They got implemented separately because I was just porting Project N IL2IL code, but there's no reason why we need two.
With this change, Delegate.DynamicInvoke will just call into the shared helper that is also used for reflection invoke.
This is a bigger diff due to bunch of mechanical changes:
* The set of generated helpers had to be moved to a place from where both delegate and reflection infrastructure can see it. A type system context dot file did the trick. (Contributes to #3873.)
* The generated assembly got moved to the type system context so that the thunks can stay homed in it.
* Fix to CppCodegen name mangling so that these can be still referenced in CppCodegen.
|
|
* Implement static constructor triggering. Also includes several bug fixes found in the process:
* Don't make the ClassConstructorRunner depend on module intialization
* Moves non-GC statics and thread statics from globals to the type's data regions. GC statics can't be moved until we can call InitializeModules on startup.
* Devirtualizing interface calls to structs in order to be able to compile the class constructor runner.
* Add a prolog block before Block0 to allow branching to Block0, which happens in retail builds
* Correct use of unreachable in traps and at the end of finally blocks to fix more retail build problems
* Stop reusing spill slots when a spilled value is spilled again. This avoids cases where the spills feeding into a block don't use the same slot
* Enable thunks for NativeCallable methods and call RhpReversePInvoke for them
* Fix alignment for cases where a small type is followed by a larger one
* Workaround for Emscripten atomics bug
|
|
include:
1) New node type for the sealed vtables
2) Logic in EETypeNode to emit the proper sealed vtable related bits, and not emit sealed newslot methods in the regular vtable
3) Changes in the algorithm that computes the virtual method slot to handle sealed vtable entries
4) Avoid creation of interface dispatch maps for special array types (mdarrays and arrays of pointers)
Current size gains we get with the shared library is about 3% for amd64 ret on ProjectX. Average app size reduction is about 5%
[tfs-changeset: 1690448]
|
|
* Implement intrinsic call to InitializeArray.
RuntimeHelpers.InitializeArray is implemented as a call to LLVM
intrinsic llvm.memcpy.p0i8.p0i8.i32, which copies from generated global
constant to provided target array.
Currently the base size of the array object is hardcoded to 8, since no
EEType is provided in the intrinsic call.
Fix #5345.
Add testing code for InitializeArray in HelloWasm.
Roslyn generates RuntimeHelpers.InitializeArray for arrays of integral
types with initializer of length greater or equal than 3. Here we use
this feature to generate a call to RuntimeHelpers.InitializeArray for
test.
Catagorize array argument types in InitializeArray
Differently handle vectors, multidimensional arrays and object typed
arrays in InitializeArray intrinsic.
|
|
|
|
Trying to debug ILCompiler in Visual Studio was failing with missing assemblies. The problem was caused by recently added libLLVMdep.depproj reference that made NuGet delete certain files from the output tools directory. The fix is to move the .depproj reference to a different part of the build next to other similar .depproj reference where it won't be confusing NuGet.
|
|
* Implement break opcode as llvm.debugtrap.
In Emscripten, `llvm.debugtrap` is implemented as a round-trip call to
`debugger;` statement JavaScript which will invoke debugger in browsers;
and in LLVM it's implemented as `unreachable` instruction of WASM. This
should be a better match than `llvm.trap` on `break` opcode semantics.
Fix #4511
Set IsDebuggerPresent to TRUE in case of WASM. Although
`Debugger._isDebuggerAttached` is not set, this modify itself will allow
`Debugger.Break` to work.
Add test in HelloWasm for `Debugger.Break`.
|
|
Switch rid to generic linux in most places and stop pretending that we are on ubuntu-14.04. ubuntu-14.04 is left just at the two places that still need it.
|
|
32bit (#5342)
|
|
* Enable wasm building on OSX.
Upgrade libLLVM to 4.0.0 and LLVMSharp to 5.0.0
LLVM upgrade: Fix 'Use still stuck around after Def is destroyed' of the deleted basic blocks
Add wasm support in runtest.sh
Remove HelloWasm.csproj reference to .ilproj on non-windows OS because of dependency on ilasm
Fix LinkNative target to execute correct commands for Unix wasm builds.
Added support for building on Ubuntu 16.04.3
Update documentation on how to build WebAssembly.
|
|
* Implement castclass & isinst for wasm (#4510)
Implement castclass and isinst opcodes in ILToWebAssemblyImporter by
doing related function calls to methods in System.Runtime.TypeCast.
Fix #4510
Add castclass & isinst test in HelloWasm.
This includes three types of casting:
* castclass/isinst to classes.
* castclass/isinst to interfaces.
* castclass/isinst to array types.
For now, the second and third part of test is failing due to runtime
implementation problems which should be further digged into.
|
|
* Implements localloc and fixes other issues required to make Int32.ToString work (which relies on stack allocation, Spans and various value type special cases). Includes:
* Allocating localloc buffers on the C++ stack since they're guaranteed not to have GC references and LLVM might be able to optimize them a bit better
* Handling newobj for value types by allocating them in a spill slot
* Implementing the ByReference.get_Value intrinsic
* Fixing various shadow stack management bugs around calls. In particular, return values are now spilled to avoid the next call overwriting them.
* A few new tests
|
|
implemented array instructions, implemented internal calling convention, switched to managed runtime calls, Refactored call to not require stack operations, finished work to map pinvokes into the same generated methods/signatures
|
|
* force alignment for all stack allocations
made alignment less wasteful
more closely match the alignment logic for fields
|
|
* Implement WebAssembly delegates and fix other minor codegen issues.
|
|
* Implement cpobj opcode for wasm
Implements the ILToWebAssembly.ImportCpObj method using an LLVM load and
store.
Adds a test for for wasm cpobj to the HelloWasm test using an IL
project.
|
|
* Changes to hook up the portable runtime and bootstrapper. Includes implementing allocation using RhpNewFast as well as some floating point codegen fixes required to make the new code compile.
Removes usage of buggy dladdr API in WebAssembly, fixes order of conditional branch expressions, which fixes printing when C# optimizations are enabled, adds debug and release flags to emcc, updates WebAssembly documentation to reflect the new build flavor and linking steps. Adds thunks for RuntimeExport methods to fix linker errors for missing runtime exports.
|
|
* Implemented tail-ret sequence verification.
* Added test cases for tail-ret sequence.
* Fixed ILImporter not calling EndImportingInstruction when returning from switch.
* Added ReportMethodEndInsideInstruction to ILImporter.
* Changed ReportMethodEndInsideInstruction to be reported inside FindJumpTargets.
* Added additional tail-ret tests.
* Changed tail-ret verification to be done in ImportCall.
* Changed ReportMethodEndInsideInstruction to be reported for all il stream read operations.
|
|
* Added real support for Unbox stubs to WebAssembly
|
|
|
|
* enabled thread static fields, changed vtable dispatch to not be dependent on EETypeNode, added typed node factory
|
|
- Add ordinal import mechanism to ready to run header
- Add concept of various different types of export to nodes (Now nodes can be exported by symbol name or by ordinal)
- Abstraction of how nodes from exported modules are imported (ImportedNodeProvider)
- Import/Export table nodes (MrtProcessedImportAddressTable, MrtProcessedExportAddressTable)
- Runtime decodable jump stubs
- Tweaks to floating dictionary computation to behave correctly when no floating section is present, and to tolerate floating sections without version numbers
- Not integrated with the open source version of the compiler, but the basic nodes and necessary infra are present
Also
- Allow a TypeSystemContext to specify the module in which the Canon types are logically located
- Overrideable apis for the CompilerTypeSystemContext to allow customization of the set of methods logically present on Enums and Delegates
- New apis on CompilationModuleGroup to allow more granular policy to be specified about what is to be compiled
- Adjust GetName helper for MethodSignature to produce names that are more unique
- Fix bug in floating generic dictionary implementation where it assumed that the floating section was present in all dictionaries
- ARM64 indirect jump generation (with a assert to be disabled when it is debugged)
[tfs-changeset: 1682436]
|
|
* Added support for calling methods via virtual slots
|
|
|
|
implemented newobj for WASM using malloc
|
|
This reverts commit 3b9a7fc3fc60fdca245f431bfa40672f087a53d5.
|
|
implemented newobj using malloc, added evaluation stack spillage and cut down on unneeded llvm casts
|
|
* Determinism test harness
Add a /determinism mode to runtest.cmd that will invoke ILC twice with different random determinism seeds. This causes graph expansion to be randomized based on seed (though deterministic for a given seed).
* Add Utf8String.CompareTo
Implementation taken from S.P.CoreLib. All the loop unrolling optimizations were excluded; we re-implement them if this function becomes a perf bottleneck.
* Define the mechanisms for determinism
To ensure deterministic output, all nodes that are emitted to the binary are sorted after compilation when retrieving the final marked nodes list. The overall approach is to sort nodes of the same type together (ie, all EETypeNodes come before NonGcStaticsNodes). Within nodes of the same type, a comparison function uses a CompilerComparer to compare the key identifying data of a node. For example, an EETypeNode is defined by a TypeDesc. The CompilerComparer provides a stable comparison function for comparing various type system primitives. Some nodes need to be emitted in an early and specific order for compiler correctness; this is provided by partitioning all sorted nodes into two phases: the first phase containined specifically ordered nodes, and a second phase for all other nodes whose ordering in the output binary doesn't matter.
Add SortableDependencyNode abstract class which provides the sortability layer on top of a DependencyNodeCore. Both ObjectNode and EmbeddedObjectNode derive from SortableDependencyNode to provide sortability across all nodes that are emitted to the output binary.
Introduce `ISortableSymbolNode` to provide sortability for nodes that are currently referred to in the compiler via the ISymbolNode interface. Such nodes are actually `ObjectNode` or `EmbeddedObjectNode` instances that we've lost type information for. Instances that implement `ISortableSymbolNode` redirect to the matching SortableDependencyNode methods.
Add `EmbeddedDataContainerNode` as a base class of `ArrayOfEmbeddedDataNode` to allow comparison of different instantiations.
Refactor the interface dispatch map index calculation so it's done when the dispatch map is emitted at the end of compilation. Previously it was done when the indirection cell in the dispatch map array got marked. This mechanism is incompatible with generating stable dispatch map indices. The arrays of embedded nodes now stabilize IDs as they emit their final data. This introduces an output ordering dependency - OptionalEETypeNodes must be emitted after the dispatch map since they encode dispatch map indices. Manually enforce this with C++ code generation, since it doesn't emit the real dispatch map structure and builds its own.
Modify InterfaceDispatchMapNode to use the type name in name mangling instead of an index into the dispatch map table.
Modify ObjectDumper to also amit a sha256 hash of each node's data. This dump is used to diff the map files and prove determinism.
* Fill out ordering functions for all nodes
Most of these are not very interesting. Here's the overall approach:
- Every different type of node needs a unique ClassCode. These were generated using Math.Random.
- The various metadata / native layout nodes plus arrays of EmbeddedObjectNodes get placed in the Ordered phase with specific ordering of each.
- All other nodes go in the Unordered phase
- To order nodes of the same type, the data that represents the key for the node in NodeFactory is compared. Ie, for an EEType, that would be its defining TypeDesc, whereas a FrozenStringNode is defined by the string it represents).
- The marked nodes list also contains raw DependencyNodeCore<T> nodes, which aren't emitted. Those are all shuffled after the emitted nodes and not sorted amongst themselves. That hasn't proven to be a problem with determinism and saves a bunch of hopefully unnecessary comparisons.
|
|
* Implement switch opcode Fix #4519
|
|
|
|
|
|
support (#4729)
Added support for ldsfld/stsfld/ldsflda/ldflda including general value type support, throw on invalid branches to the first basicblock in a routine and ensure type sameness for icmp
|
|
* Fix instance method parameter management and a couple of codegen issues that showed up when more methods started compiling. Includes implementing ldfld for instance fields (progress toward #4530) and the leave opcode. This is enough to make the String.Length getter work.
|
|
|
|
* Implement neg (float/integer) and not IL instructions. Fixes #4524 and #4525
* Neg and not basic tests added to HelloWasm.
Name parameter updated in LLVM build methods to reflect the operation being built.
Use PushExpression method instead of direct push to stack.
* Implement throw opcode. Fix for #4528
* Unreachable removed and trap call refactored in throw import method.
|
|
* Implement shift opcodes
* Fix HelloWasm test.
* FIx HelloWasm test program.
|
|
(#4725)
* Implement neg (float/integer) and not IL instructions. Fixes #4524 and #4525
* Neg and not basic tests added to HelloWasm.
Name parameter updated in LLVM build methods to reflect the operation being built.
Use PushExpression method instead of direct push to stack.
|