Граф коммитов

36 Коммитов

Автор SHA1 Сообщение Дата
mewmew 4881807a07 Improve documentation, as described below.
* 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
   ----------
2015-04-14 12:30:49 +02:00
rhadley 9a965f5bc2 Updated architecture diagrams
As part of the building up the announcement materials I updated the documents.  So adding them to the checked in docs.
2015-04-13 13:08:11 -07:00
Eugene Rozenfeld 72d20e97a7 Process the flow graph in the order of MSIL offsets.
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.
2015-04-09 21:30:55 -07:00
Eugene Rozenfeld f252ee8842 Handle mismatching types when merging operand stacks.
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.
2015-04-03 10:20:34 -07:00
Joseph Tremoulet 3b3d6ff7a0 Insert divide-by-zero checks
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
2015-03-26 16:22:07 -04:00
Joseph Tremoulet 43a1787fc3 Implement .ovf forms of conv instruction
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
2015-03-26 14:01:57 -04:00
Eugene Rozenfeld fd8d3f97cd Document describing llilc reader.
Closes #224.
2015-03-25 14:44:59 -07:00
Joseph Tremoulet eceeaa188c Implement overflow forms of binary arithmetic
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
2015-03-23 16:26:07 -04:00
Joseph Tremoulet 3545637a57 Mark array bound/type checks completed
These were implemented in 63a2f1f and 2e1f163.
2015-03-23 16:10:31 -04:00
Joseph Tremoulet 5f6af8ff2a Implement finally continuation selection for leave
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
2015-03-20 22:26:41 -04:00
Mukul Sabharwal 1961f6edcf Merge pull request #314 from mjsabby/master
Make interior/vs exterior pointer doc clearer
2015-03-16 18:14:05 -07:00
rhadley f6332f37f7 Updates for grammar/punctuation.
Incorporate feed back from Rich to clean up some issues.
2015-03-16 14:40:41 -07:00
rhadley c8b2c63e00 Add managed language semantics section
Talks about managed language optimizations, GC statepoint insertion, and
particular CLR exceptions.
2015-03-16 12:50:50 -07:00
rhadley 96339ea1bf Fix spellings 2015-03-13 13:13:54 -07:00
rhadley 9dd41a51ac Add introduction paragraph for AOT architecture diagram. 2015-03-13 13:02:34 -07:00
rhadley a2b9ee47cf Update GC component section.
Updates for GC.  Some additional reordering and rewording.
2015-03-13 12:48:04 -07:00
Mukul Sabharwal 02ae8fbfea Make interior/vs exterior pointer doc clearer 2015-03-13 10:48:40 -07:00
rhadley a5aeb8ef36 Add LLILC architecture document
Adds an architcture document and block diagrams for both the JIT and AOT architecture.  I've added
some beginning thoughts on the arch but would like some review/comment from owners in the particular areas.
2015-03-12 16:48:44 -07:00
rhadley c18029ae63 Add more under LLVM arch subsection. 2015-03-11 16:56:33 -07:00
rhadley 5ca1779a96 Addition of architecture diagrams
Adds diagrams as well as some new text for an arch document.
2015-03-11 16:42:23 -07:00
Joseph Tremoulet 97a32874bd Implement explicit null checks for loads/stores
Generate explicit compare+branch+throw sequences to check for null
derefrence on loads and stores.  LLVM IR does not support annotating
loads/stores as exception-bearing, and additionally this approach may
simplify runtime porting to other targets since we'll generate explicit
machine code for these tests and the runtime won't need to mess with
machine traps.  The llilc-jit-eh.md document contains more information
about the approach/rationale.

Introduce a mock configuration flag, UseExplicitNullChecks, on the Reader
object (this leaves the old codepaths accessible to facilitate future
experiments).
Extend the existing makeStore wrapper around LLVMBuilder::CreateStore, and
add a similar makeLoad wrapper around LLVMBuilder::CreateLoad.  These
wrappers take an AddressMayBeNull parameter, and generate the null check
when the address may be null and UseExplicitNullChecks is true (which it
always is).
Transitively propagate the AddressMayBeNull parameter up through any
callers that are sometimes invoked to generate loads/stores for
known-non-null pointers and sometimes for maybe-null pointers.
For each method that now takes an AddressMayBeNull parameter, default that
parameter to true and add a -NonNull sibling method that passes false;
this makes the callsites more readable.

Null checks are always emitted as an exact equality comparison against 0.
For operations such as ldfld/stfld/ldlen, the check is performed against
the base pointer (before adding the field offset), which will catch any
null object references.
This test may not exactly match the Windows machine trap behavior when
unsafe code is involved (though it does conform to the ECMA spec); in
particular, ldind/ldfld/stind/stfld with a managed pointer base that is
nonzero but in the guard page would raise a NullReferenceException from
the machine trap but will not be caught by the checks inserted here.
This is a deliberate decision made after consultation with the CoreCLR
team; the approach does guarantee that null dereferences from verifiable
code will raise NullReferenceException (verifiable code cannot produce a
nonzero managed pointer pointing into the guard page), and if unsafe code
is used to construct not-quite-zero addresses which are subsequently
dereferenced, it is acceptable for such dereferences to
FailFast/SegFault/CoreDump/etc rather than raise NullReferenceException.

I've verified that there are no diffs if I recompile with the
UseExplicitNullChecks flag set to false.

Closes #203
Resolves #204
Closes #63
2015-03-06 19:17:41 -08:00
Joseph Tremoulet 30a4a971e1 Add bullets for array checks
Bounds checks and store checks are implicit exceptions for which explicit
checks need to be inserted.
2015-03-06 17:24:56 -08:00
Richard L. Ford 7344af0752 Document ReaderStack class (in reader.h)
This change documents the ReaderStack class in reader.h.

In addition to providing this documentation I've eliminated
unnecessary complexity in the ReaderStack iteration
interface. Previously they were using a pointer to an incomplete C++
class, ReaderStackIterator, as their iterator state but the client was
just using the space of such pointers to hold an index into the stack
(hence requiring a lot of casting and making the assumption that a
size_t will fit in a pointer--which is likely to always be true but is
nevertheless somewhat of a hack).

Instead I've made ReaderStackIterator a typedef to size_t and pass
such values as references in the API. I believe the result is a lot
cleaner.

Closes #143.
2015-03-03 09:22:48 -08:00
Richard L. Ford 101a14d788 Add build target for running Doxygen
In more detail:
Modified LLILC's CMakeLists.txt to
 1. Add an LLILC_ENABLE_DOXYGEN option (ON by default)
 2. configure a Doxygen configuration file.
 3. Add a custom target, doxygen-llilc, to run doxygen.

In addition a file, Documentation/index.dox, is added that has the main page
 for the LLILC Doxygen output.

To use you need to do the following:
 1. Install Doxygen
 2. Install Graphviz, ensuring that dot is on your path.
 3. In your LLVM source directory, edit the CMakeLists.txt file so that LLVM_ENABLE_DOXYGEN is ON, or alternately when you run cmake give it an option to enable it.
 4. After you configure LLVM you can open the LLVM.sln file, right click on doxygen-llilc, and select "build". You do not need to build LLVM before doing this.
2015-02-23 15:34:48 -08:00
Pat Gavlin eb1fadee6c Replace LLVM-MSILC and friends with LLILC throughout the codebase. 2015-02-19 20:56:30 -08:00
Joseph Tremoulet 3cecf89f98 Rename EH document to reflect new name
Change the name of the document file itself
2015-02-19 23:11:57 -05:00
Joseph Tremoulet 7eec6351f0 Add status item for convert.ovf
This was missing from the original list.
2015-02-19 23:10:49 -05:00
Joseph Tremoulet 42a7fe60fa Update EH document to use new project name
Update all in-document references from MSILC to LLILC
2015-02-19 23:08:10 -05:00
Joseph Tremoulet 02d6b07afb Flesh out EH bring-up plan
Replace the 'TBD' placeholder with the planned staging sequence.
2015-02-19 12:57:02 -05:00
Joseph Tremoulet 58cffd8ac0 Merge pull request #58 from JosephTremoulet/LineWrap
Wrap long lines
2015-02-18 17:01:43 -05:00
Andy Ayers d96aa41f92 Updates based on review feedback 2015-02-18 13:00:18 -08:00
Joseph Tremoulet 4cc856e01a Wrap long lines
Update formatting to improve console readability.
2015-02-18 14:00:37 -05:00
Joseph Tremoulet 746b83ed1d Fix a couple formatting issues 2015-02-17 21:19:17 -05:00
Joseph Tremoulet c63b9e669f Add llvm-msilc jit exception handling document
Initial revision of doc describing status/plan for compiling exception
handling constructs.

Closes #14.
2015-02-17 20:36:18 -05:00
Andy Ayers 6a95d81b9f Update based on review feedback. Also removed some tabs. 2015-02-17 11:01:00 -08:00
Andy Ayers 7c30f9e674 Initial draft of the GC framing document. 2015-02-16 18:07:59 -08:00