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

525 Коммитов

Автор SHA1 Сообщение Дата
Joseph Tremoulet 5d328336f9 Factor out two IR maintenance helpers
Create helpers to split the block at the current insertion point and to
replace one instruction with another.  The logic to do this was inline in
insertConditionalPointBlock, but `invoke` insertion will need to do the
same things.
2015-04-09 08:26:52 -07:00
Joseph Tremoulet 4d0fb85fa7 Merge pull request #410 from JosephTremoulet/FixWarning
Use llvm_unreachable instead of assert(false)
2015-04-08 18:53:26 -04:00
Rich Lander 76449c4301 Correct name of OS X 2015-04-08 15:01:10 -07:00
Joseph Tremoulet d86eab7da1 Use llvm_unreachable instead of assert(false)
This avoids
  warning C4715: 'ABIInfo::get' : not all control paths return a value
2015-04-08 14:01:16 -07:00
Swaroop Sridhar 6e405dcfa8 Merge pull request #409 from swaroop-sridhar/call
Call JIT_GCPoll() runtime helper from gc.safepoint_poll()
2015-04-08 13:59:09 -07:00
Joseph Tremoulet 7701ab14a9 Add normalization for phi arguments
These don't match the normal 'i64 nnnnn' pattern because the type is given
just once for the phi and each argument appears as '[ nnnn, %pred ]'.
2015-04-08 13:18:29 -07:00
Swaroop Sridhar 4058c27ed9 Call JIT_GCPoll() runtime helper from gc.safepoint_poll()
gc.safepoint_poll() helper required by Safepoint placement pass was an
empty function. This change fixes this to call the correct runtime helper
to perform the CLR GC Poll.

The current strategy is to use an unconditional call to the GCPoll helper.
Inlining the GCPoll helper is future work.

Issue #32
2015-04-07 20:40:33 -07:00
Joseph Tremoulet f3c1fba4ae Merge pull request #405 from JosephTremoulet/FixNullRefHelper
Use correct helper to throw NullReferenceException
2015-04-07 20:32:26 -04:00
Pat Gavlin e1219f98d3 Merge pull request #394 from pgavlin/ABIInfo
Add an ABI abstraction for computing function signatures.
2015-04-07 15:34:20 -07:00
Pat Gavlin c05c973916 Add an ABI abstraction for computing function signatures.
LLVM's support for calling conventions does not handle aggregate
parameters or return values in a way that is consistent with the
rules for a particular calling convention. Instead of applying
whatever rules are particular to a given calling convention, it
simply recursively decomposes aggregates into a linear sequence
of arguments of non-aggregate type. It is the frontend's
responsibility, then, to emit calls such that the backend will
lower them appropriately for the target calling convention.

Practically speaking, this means that the frontend must do the
work to determine how each argument to a function--aggregate or
otherwise--should be passed (e.g. directly/indirectly, as an
expanded series of arguments, etc.) when generating calls and
function symbols. To this end, this change adds abstractions
to encapsulate ABI information and compute argument and result
passing information for a function signature (i.e. a calling
convention, result type, and argument types). These abstractions
are then used to emit function calls, home method arguments, and
return method results in a way that is compatible with the
backend.
2015-04-07 15:05:18 -07:00
Swaroop Sridhar a2ce25f986 Merge pull request #396 from swaroop-sridhar/state
Insert Statepoint intrinsics for Precise GC
2015-04-07 15:01:34 -07:00
Eugene Rozenfeld 6afa158d1e Merge pull request #403 from erozenfeld/StoreElementFix
Fix bug in GenIR::storeElem.
2015-04-07 14:13:10 -07:00
Joseph Tremoulet c2727a4b5e Use correct helper to throw NullReferenceException
Now that the helper to throw NullRefrenceException is available in the
runtime, use that for null-checks.

Closes #285
2015-04-07 13:38:53 -07:00
Eugene Rozenfeld 946ad1bf93 Fix bug in GenIR::storeElem.
When storing an element of struct type we call rdrCallWriteBarrierHelper.
We were passing array address instead of element address as the first argument.
This resulted in bad codegen when compiling Roslyn.

Change the return type of genArrayElemAddress from Value * to IRNode * and
eliminate a few casts.

Remove some unnecessary semicolons and fix a comment typo.
2015-04-07 12:54:24 -07:00
Bengu Li 7ac7238d24 Merge pull request #399 from libengu/UpdateFilter
Update python filter
2015-04-07 12:11:18 -07:00
Andy Ayers 98d5f9d6bb Merge pull request #401 from AndyAyersMS/Security
Add support for methods with security objects.
2015-04-07 11:36:47 -07:00
Bengu Li d539027cfa Update python filter
Update python filter with the following changes. These chagnes are needed to
 allow applying filter easily from runtest.py.
 1. Add ApplyAll to apply filter recursively on a directory.
 2. Wrap the original functionality into ApplyOne.
 3. Make script applyfilter main function to use ApplyOne to make it compatbile with before
 4. Command line parsing added.
2015-04-07 10:44:06 -07:00
Swaroop Sridhar 59f4982919 Set GC-strategy on LLVM function based on JitContext
Set the GC strategy on the generated function to "statepoint-example"
only if the JitContext specifies using precise GC.

Also fixed format-spacing
Rename safepoint_poll creation method to createSafepointPoll()
2015-04-06 18:23:23 -07:00
Andy Ayers 29aba3187d Add support for methods with security objects.
Allocate a local to hold the security object. Zero initialize it and then pass it's address to the prolog helper.

Ultimately we'll need to ensure this slot stays alive and also report it in the GC info.
2015-04-06 17:53:00 -07:00
Michelle McDaniel abb6cac919 Merge pull request #400 from adiaaida/fiReaderIR
Change calls to CreateStructGEP to new signature
2015-04-06 16:51:26 -07:00
Michelle McDaniel 1ae9c3aaad Change calls to CreateStructGEP to new signature
LLVM changed the signature of CreateStructGEP that the FI brings in, so
we need to update our calls to match the new signature.
2015-04-06 16:39:00 -07:00
Swaroop Sridhar e71f0eb6f5 Statepoints: Don't report base-pointers explicitly.
For interior pointers, the CLR Runtime doesn't require the base-pointer
to be additionally reported explicitly. Therefore, this change turns off
base-pointer tracking and reporting at a statepoint.

This change also solves an issue with alloca sequence, where we make a
unmanaged to managed pointer cast.

For example, for ldloca, we generate

  %loc1 = alloca i8
  %1 = addrspacecast i8* %loc1 to i8 addrspace(1)*

With Base-pointer tracking the set of live poionters after these instructions
would be {%1, %loc} which is clearly wrong because %loc1 is an
unmanaged pointer i8*.

Without base-pointer tracking, the live set is correctly computed as {%loc1}
2015-04-06 14:36:19 -07:00
Swaroop Sridhar 81d00a0454 Introduce Statepoint GC
This change implementats the insertion and lowering of GC-Statepoints
into the code generated by LLILC.

When not using Conservative GC (COMPLUS_GCCONSERVATICE != 1), the Jit
1)Runs PlaceSafePoints and RewriteStatepointsForGC passes before the
  code generation phases
2) Annotates the generated functions with gc “statepoint example”
3) Emits the special @gc.safepoint_poll() helper function into the module
   along with the function being Jitted. This helper is required by
   the PlaceSafePoints phase.

Testing:

This is a work in progress, there are some failures in
RewriteStatepointsForGC due to incorrect live-sets.

LLILC Issue: #32
2015-04-06 14:36:15 -07:00
Andy Ayers 82f6d967d7 Merge pull request #398 from AndyAyersMS/Volatile
Use normal lowering for volatile stores.
2015-04-06 12:52:55 -07:00
Andy Ayers dfcfffbe95 Use normal lowering for volatile stores.
There's a JitConfig setting JitLockWrite that should force the jit to emit lock prefixed stores for volatiles, but RyuJit doesn't look at this. So we'll also ignore it for now. Issue #278 will remain open to track implementing the option, if we decide to do so.

Instead just allow volatile stores to lower normally (with IsVolatile true in LLVM IR).
2015-04-06 11:12:16 -07:00
Eugene Rozenfeld 0e7900d087 Merge pull request #397 from erozenfeld/convertHandle
Implement convertHandle and getTypeFromHandle.
2015-04-04 23:02:12 -07:00
Eugene Rozenfeld 05c6b17615 Implement convertHandle and getTypeFromHandle.
This unblocks ldtoken (today) and refanytype (in the future) instructions.

Closes #374.
2015-04-03 17:38:22 -07:00
Eugene Rozenfeld 53ce2ab793 Merge pull request #390 from erozenfeld/PhiTypeMismatch
Handle mismatching types when merging operand stacks.
2015-04-03 11:45:58 -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
Andy Ayers c0f8f27a03 Merge pull request #388 from AndyAyersMS/RoslynFixes2
More fixes from Roslyn.
2015-04-02 19:03:20 -07:00
Andy Ayers aa1d50b0b8 More fixes from Roslyn.
Delete the LLVM EE when we're done jitting a method. This gets back most of the memory we allocate and brings our leaking down to a much more tolerable level.

Type the result of ldvirtfn as native int so that subsequent processing handles it the same as other function addresses.

Trim type array in the varargs constructor call path so the LLVM function type builder is not confused.

Add extra paranoia around ldlen and strlen since we see cases where the referent type is not an array or string. For now bail out if we hit one of these.

if we see an endfinally and can't locate the enclosing EH region, bail out with an NYI rather than AVing in the jit.
2015-04-02 11:33:04 -07:00
Michelle McDaniel 488707ec79 Merge pull request #387 from adiaaida/coreclrtestdir
Remove coreclr from path to test results
2015-04-01 15:23:36 -07:00
Michelle McDaniel 0f506a5b3d Remove coreclr from path to test results
CoreCLRTestAssets points to CoreCLRSource, which includes the bin
directory, not coreclr/bin. Remove coreclr from the path.
2015-04-01 14:54:22 -07:00
Pat Gavlin 8c48594b16 Merge pull request #384 from pgavlin/CallNormalization
Abstract the signature of the method being compiled.
2015-04-01 14:53:52 -07:00
Michelle McDaniel 1b9f666633 Merge pull request #386 from adiaaida/binariesToBin
Change binaries to bin in LLILCEnv
2015-04-01 13:14:40 -07:00
Michelle McDaniel a57bc64c16 Change binaries to bin in LLILCEnv
CoreCLR renamed the binaries directory to be bin. Our script should
reflect this change.
2015-04-01 12:59:13 -07:00
Pat Gavlin 510250c72c Abstract the signature of the method being compiled.
Add a type that encapsulates the method signature and other relevant
details about the method being compiled. This lets us bring some logic
down into ReaderBase from GenIR and eliminates some code that would
otherwise need to be kept in sync between ReaderBase and its subclasses.

This is another step on the road to value type return values and parameters.
2015-04-01 11:42:41 -07:00
Russell C Hadley 57086b80b6 Merge pull request #383 from russellhadley/RemoveCLRHeaders
Remove clr headers
2015-04-01 10:01:32 -07:00
rhadley 96f3f1676a Change 'binaries' to 'bin'
Recent change to build directory layout moves to 'bin'.  Update scripts
to reflect that.
2015-04-01 09:48:06 -07:00
Michelle McDaniel 839b6616a4 Merge pull request #385 from adiaaida/fiFix
Change the header included in EEMemoryMangager
2015-04-01 08:34:24 -07:00
Andy Ayers 639d608bf2 Merge pull request #382 from AndyAyersMS/JustMyCode
Add IsPointNode as a flow graph node property.
2015-04-01 08:29:15 -07:00
Michelle McDaniel 30a5159a9e Change the header included in EEMemoryMangager
LLVM changed which header RTDyldMemoryManger comes from, so we need to
update to bring the LLVM changes to our MS branch.
2015-04-01 08:20:46 -07:00
Andy Ayers 1df4a9a289 Keep track of the first MSIL block.
This addresses a couple of issues seen in the Roslyn bring-up.

In `readerPrePass`, split the current block after the parameter stores and local allocas and other
"run once on entry to the method" IR. The continuation block from this split is the block that corresponds
to MSIL offset 0 and is also the target of branches back to offset 0. Remember this block and
in `fgPrePhase` return it as the first block to use when expanding MSIL to IR.

Implement the just my code hook, which requires a conditional branch in this "entry IR" sequence.

Closes #272, closes #372.
2015-03-31 18:51:04 -07:00
Pat Gavlin 0ca400a934 Merge pull request #379 from pgavlin/CallNormalization
Refactor genCall to remove some post-processing that impedes value-type returns and parameters.
2015-03-31 16:09:32 -07:00
Pat Gavlin babd621eca Refactor call canonicalization.
- Move newobj canonicalization out of GenIR and into ReaderBase.
- Refactor rdrCall such that canonicalization occurs before genCall runs.
- Add ReaderCallSignature to encapsulate runtime call signatures.

Taken together, these changes allow ReaderBase to generate accurate
function types for call targets in rdrCall, thus enabling the removal of
a number of post-processing steps in genCall that impede value-type
returns and parameters.

There is also a small bugfix for createTemporary, which was attempting to
set the insertion point to an invalid location in the cast that the entry
block was entirely empty.
2015-03-31 15:37:39 -07:00
rhadley 333f9b2670 Filter out new failing test until we can debug.
ICastable is a new test (to us) and is failing.  Disable it until we can
investigate.  This enables the lab with the current set of tests with
the up todate CoreCLR.
2015-03-31 15:31:38 -07:00
rhadley b542e71300 Add CoreCLRSource, Runtime, and Test as global scope variables
This changes allows people that haven't been 'sourcing' the file before
to operate in the same way.  Just a convience until this script is
replaced in the near term.
2015-03-31 14:55:58 -07:00
rhadley 12db46ec62 Remove message line for CoreCLR path.
Debug output left over from bring up.  Removing it.
2015-03-31 14:43:33 -07:00
rhadley e03dc5fecf Merge branch 'master' of https://github.com/dotnet/llilc into RemoveCLRHeaders 2015-03-31 12:58:37 -07:00
rhadley bd4250938d Quick refactor to enable building from a CoreCLR enlistment
Modified pointers to CoreCLR binaries and tests assets to point at a
live CoreCLR enlistment.  Currently I can run 'runtest' with a CoreCLR
enlistment refered to by an environment variable 'CoreCLRSource' that
points at a 'coreclr' directory.
2015-03-31 12:56:28 -07:00