Global data initialization is provided by special section types in the
MachO format whose contents are a list of function pointers to
initialize. Add ObjWriter support for these sections through the
existing CustomSectionAttributes enum.
The issue in CoreFX that lead to us needing to run tests in code page 65001 is long since fixed. So remove the chcp from our test scripts and docs.
Closes#12.
The changes makes the following improvements to the
LLILC debugging facilities:
1. A make_sln.py script is added which can be used to create
a Visual Studio 2015 solution that can be used to debug
a managed application using LLILC. Optionally the
script can invoke Visual Studio on the created solution.
The handles setting up all the required environment
variables for making LLILC the alternate JIT.
2. A --windbg-and-args option was added to the
llilc_run.py script to enable debugging the
application being run using windbg.
3. In order to ensure that empty values for
LLILC configuration variables are equivalent to
unspecified environment variables, the
code that LLILC uses to check some configuration
variables was refactored to require that
the feature is only enabled if the variable
is both non-null and non-empty.
4. The Debugging.md documentation was updated
to describe these features.
5. The llilc_run.py and make_sln.py were modified so they
run successfully on either Python 2.7 or Python 3.4.
Modify LLILC options processing by adding the
following options:
* COMPlus_ALtJitExclude is a MethodSet. LLILC will only
attempt to compile methods which are in the COMPlus_AltJit
set, but not in the COMPlus_ALtJitExclude set.
* COMPlus_ALtJitBreakAtJitStart is a MethodSet. This is used
when running LLILC under the control of a debugger.
It causes a "break" message to be written for
matching methods when the method is about to be
jitted. The method is written from the
LLILCJit::compileMethod method in file
llilc\lib\Jit\LLILCJit.cpp. The user must put
a breakpoint on the statement the write
out the message in order to actually get a
break.
* COMPlus_ALtJitMSILDump is a MethodSet. The MSIL for
methods in the set is dumped before JITTING the
method.
* COMPlus_ALtJitLLVMDump is a MethodSet. The LLVM IR for
methods in the set is dumped just after LLILC has
finished reading the MSIL and converting it to LLVM IR.
* COMPlus_ALtJitCodeRangeDump is a MethodSet. For methods
in the set, the starting and ending address of the method's
code, and the code size, is printed after the method has
been JITTED. This can be useful in identifying which
method contains a given address.
In addition:
1. Delete LLILCJitContext::outputDebugMethodName and
LLILCJitContext::outputSkippingMethodName and replace
with simpler output using Context.MethodName.
2. ReaderBase::printMSIL(uint8_t, uint32_t, uint32_t) is made
static so it can be called from outside ReaderBase.
When it calls parseILOpcode, it passes nullptr as the
Reader parameter.
3. parseILOpcode was modified so that if its Reader parameter
is null, it uses dbPrint for error messages rather than
terminating with a fatal error. This is friendlier as
this only happens when called from printMSIL and we would
like printMSIL to be robust as it is called from the
debugger.
4. Provide printMSIL facility even for release mode.
This fixes a build error for release mode.
ReaderBase::printMSIL was being called but not being
defined in release mode. I believe, at least during
this bring-up period, that we want this facility
even for release mode, so I removed some conditional
compilation directives so that dumping of MSIL is
available in any mode.
5. Added Documentation/Debugging.md file to
document how to debug LLILC. More will be added to
this file, but we have already added documentation
of the environment variables used by LLILC
(but not yet those used when LLILC is NGENing).
This updates the GC document to conform with LLVM terminology for GC
transitions and adds a document describing how such transitions are
supported for CoreCLR in LLILC and LLVM.
Bulk move with minimal editing (just wrapping lines and fixing up links)
to get our documentation in a place where changes can be made via pull
request and it will be versioned with the code.
Resolves#612.
Resolves#622.
The plan is to build on the model proposed in
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/85783 - in
particular, EH edges will no longer target `landingpad`, but rather will
target `catchblock`/`cleanupblock` instructions that can guarantee
preserving the structure of dispatch code (which ultimately will be
perfomed by the runtime) during optimization.
This will simplify some aspects of funclet management, and also gets LLILC
on top of the newer jitting framework that active development is focused
on.
ORC jits are created by composing `layers`. LLILC's functionality is
covered by two "off-the-shelf" layers: the IRCompileLayer (using the
SimpleComplier utility) for compiling IR to machine code, and the
ObjectLinkingLayer for resolving fixups and relocations and interfacing
with the EEMemoryManager to load the machine code into appropriate memory.
Closes#610
Implement arrayGet, arraySet, and arrayAddress to expand 2D and 3D
array accesses inline; allow runtime helper to do the expansions
for arrays of other dimensions.
Fix getTypedAddress to deal with ldind.ref with a nativeint arg.
(This was a new test failure after unblocking methods with md array
accesses).
Remove NYI for intrinsics in GenIR::genCall since only a fixed set
of intrinsics is expected to be expanded there; the rest should be
turned into runtime helper calls. Note that ReaderBase::rdrCall also
looks at intrinsics.
Add printMSIL() to dump msil for the current method.
- Update section on implicit null checks wrt the null check folding RFC.
- Mark reader catch support in EH branch implemented. This was added in
e2bba9a
This adds a place for us to keep milestones that will take a PR.
These milestones will be linked to out of the wiki for reference. For
additions open a github issue to start a conversation then PR an edit
that has the new milestone. When milestones are acheived strike through the txt.
The LLVM plan is actually that filter invocations must be included in the
possible side-effects of calls that may throw exceptions. That plan
should work for LLILC as well.
* Fix broken fragment identifiers.
* Use relative links when possible.
* Remove unused {#mainpage} from index.md
* Use consistent formatting for subheaders; e.g.
Use:
## Subheader
Instead of:
Subheader
----------
This is necessary to compute PHI types before processing their blocks.
ECMA-335 guarantees empty operand stacks on MSIL offset back edges.
Update the reader document.
Remove tail block if it's unreached.
This fixes all current verification errors in Roslyn build.
When merging operand stacks the types of the corresponding values may be
different. The CLI spec allows merging of nativeint and int32 (resulting in nativeint),
float and double (resulting in double), and GC pointers (resulting in the closest
common supertype).
In order to be able to use JitInfo->mergeClasses (that handles finding closest common
supertype) we need to be able to map back from llvm types to class handles. I added
ReverseClassTypeMap for that.
Since our processing of basic blocks depends on the types of values on the stack we
need to complete stack merging and finalize PHI instructions before processing
join blocks. To do that I changes the order of flow graph processing from depth-first
preorder to reverse postorder.
Closes#373.
Generate an explicit compare+branch+conditional-throw before each integer
divide.
Add a mock configuration flag UseExplicitZeroDivideChecks alongside
UseExplicitNullChecks to facilitate future experiments on what code
size/shape would look like with checks implicit in divide operations.
Closes#64
For integer cases, add explicit inline tests immediately prior to
conversion that branch to a block that throws OverflowException if the
source is out-of-bounds.
For floating-point cases, invoke the appropriate runtime helper (with
possibly an up-conversion from float to double first and possibly an
integer narrowing after).
Resolves#48
Map these to the appropriate LLVM intrinsics that detect overflow and
compute results together.
Also annotate the invalid type/opcode combinations in the operator map
(floats don't have bitwise operations or unsigned or overflow variants).
Closes#65
For each finally, generate a continuation selector variable, and end the
finally with a switch that jumps to a continuation based on the selector.
For each leave instruction, set the selector variables appropriately for
each finally handler being exited before jumping to the innermost finally.
These explicit sequences match what Clang generates for gotos across
cleanups and what the WinEHPrepare funclet extractor will expect to see.
The 'default' case for each switch targets a block with just an
Unreachable in it (again following Clang's example).
The instructions to set the selector variables are generated and inserted
in the IR during first-pass flow-graph building. I've added a map to the
reader objects tracking where selector stores have been inserted at which
MSIL offsets, updated fgNodeGetEndInsertIRNode to consult the map, and
updated a few places that were manually grabbing a block's terminator to
instead call fgNodeGetEndInsertIRNode, so that 2nd pass IR insertion can
use the correct insertion point when it adds IR to these blocks.
The switch instruction itself (and selector load feeding it) is generated
when processing the first leave across a particular finally, and inserted
when processing the first endfinally for that finally. Since a finally
region can have an arbitrary number of endfinally instructions, endfinally
becomes a branch that targets a block that holds the switch, so that all
endfinally instructions for a given finally can branch to the shared
switch.
Resolves#260