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

525 Коммитов

Автор SHA1 Сообщение Дата
Joseph Tremoulet 129bd3f2a6 Merge pull request #371 from JosephTremoulet/ZeroRemainder
Add zero-divisor check for remainder
2015-03-31 11:24:15 -04:00
Andy Ayers ecbe2e8d8b Merge pull request #375 from AndyAyersMS/BabyRoslynFixes
Fix two issues found when running Roslyn.
2015-03-30 23:43:15 -07:00
Eugene Rozenfeld fc37dbc5f4 Merge pull request #377 from erozenfeld/StructReturns
Throw NYI for methods that return structs.
2015-03-30 23:22:51 -07:00
Eugene Rozenfeld 84902b40e1 Throw NYI for methods that return structs.
We don't handle methods that return structs correctly yet so we need to throw NYI.
Failure to do so resulted in a runtime failure when trying to build "Baby Roslyn".
LLVM assumes that the first parameter to methods returning structs is a pointer to the return buffer.

This reduces our percentages somewhat:
All tests:
129 tests, 38679 methods, 34482 good, 4197 bad (89% good)
goes down to
129 tests, 38163 methods, 33708 good, 4455 bad (88% good)
HelloWorld:
1 tests, 328 methods, 294 good, 34 bad (89% good)
goes down to
1 tests, 325 methods, 289 good, 36 bad (88% good)

@pagavlin is working on struct params/returns so we should get these back soon.
2015-03-30 21:37:25 -07:00
Andy Ayers 1820ffc814 Fix two issues found when running Roslyn.
`loadAtAddress` of a struct type was always passing true for `IsField` when it is also used for array accesses. This caused failures for arrays of structs. Fix is to look at the ResolvedToken to determine whether the access is a field or not.

`conditionalDerefAddress` had a bug introduced when I refactored it. Since the method that hits this fails later in the reader the IR validation error hasn't yet surfaced. But Roslyn has methods where this bug causes validation errors.
2015-03-30 18:37:02 -07:00
Pat Gavlin 165bc978aa Merge pull request #370 from pgavlin/FixCastOp
Fix GenIR::castOp for isinst [valuetype].
2015-03-30 17:01:27 -07:00
Pat Gavlin f8cd7efcb5 Fix GenIR::castOp for {isinst,castclass} [valuetype].
GenIR::castOp incorrectly assumed that the target type of a cast
operation (i.e. castclass or isinst) must be a reference type.
According to ECMA-335, it is legal for the target type to be a value
type: under such a circumstance, the target type is interpreted to be
the boxed version of that value type.

I had hoped to simply use ICorStaticInfo::getTypeForBox to calculate
the boxed type (as in makeBoxDstOperand), but as it turns out, this
confusingly-named method only handles normalization of Nullable<T>.
If the argument to this method is not an instantiation of Nullable<T>,
it simply hands the argument back unchanged. As a result, I had to
write a helper to calculate the boxed type.
2015-03-30 15:22:39 -07:00
Andy Ayers 6c57a6c559 Merge pull request #363 from AndyAyersMS/DoxygenFixes
Fix doxygen errors. Mainly typos, not leaving a space before [out], etc.
2015-03-30 12:31:58 -07:00
Joseph Tremoulet 27863ed2ae Add zero-divisor check for remainder
Integer remainder throws DivideByZeroException on zero divisor, just like
integer divide.
2015-03-30 14:36:47 -04:00
rhadley 2b2deb085f Remove checked in CoreCLR headers
Remove CLR headers and add dependency on a prebuild CoreCLR. Most of the headers in the
include\clr subdirectory are removed and now are picked up from a prebuilt coreclr so that
keeping in sync is clearer.

Remaining headers are used to support packing in the PAL.  Follow on
work will remove these dependencies.
2015-03-30 09:54:23 -07:00
Mukul Sabharwal 7248d87508 Merge pull request #362 from mjsabby/master
Implement convertToHelperArgumentType and AddressOfValue
2015-03-27 22:40:35 -07:00
Mukul Sabharwal 40830c3254 Impl of convertToHelperArgumentType, AddressOfValue 2015-03-27 19:44:23 -07:00
Eugene Rozenfeld 0cc48a6b3d Merge pull request #365 from erozenfeld/PInvokeNYI
Throw NYI for PInvoke calls.
2015-03-26 23:14:24 -07:00
Joseph Tremoulet 922cfd76fc Merge pull request #360 from JosephTremoulet/DivideByZero
Insert divide-by-zero checks
2015-03-26 19:20:09 -04:00
Eugene Rozenfeld 5dd8b85c93 Throw NYI for PInvoke calls.
We need to throw NYI for PInvoke calls until #282 is implemented.
Not doing so caused a crash when building mini-Roslyn.

Remove //TODO that's covered by NYIs.

This sets our numbers back somewhat:

HelloWorld:
before: 1 tests, 323 methods, 293 good, 30 bad (90% good)
after: 1 tests, 323 methods, 282 good, 41 bad (87% good)

All tests:
before: 129 tests, 37905 methods, 33800 good, 4105 bad (89% good)
after: 129 tests, 37905 methods, 32741 good, 5164 bad (86% good)

Closes #364.
2015-03-26 15:46:51 -07:00
Andy Ayers fb8bd4e5f1 Fix doxygen errors. Mainly typos, not leaving a space before [out], etc.
One enum member was misnamed so I fixed it.

Also added punctuation to several cases where it was missing.

Closes #347.
2015-03-26 14:31:30 -07:00
Andy Ayers 5bf19b252f Merge pull request #359 from AndyAyersMS/Unbox
Implement the simple case of unbox.
2015-03-26 14:01:10 -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
Andy Ayers e985ddc2e5 Implement the simple case of unbox.
Fixes part of #45.

Leave the nullable case NYI since we don't have a test case for it yet.
2015-03-26 13:02:32 -07:00
Andy Ayers 2a514caffc Merge pull request #356 from AndyAyersMS/ConditionalDeref
Implement conditionalDerefAddress.
2015-03-26 12:06:58 -07:00
Andy Ayers 94f2fadbf6 Implement conditionalDerefAddress.
This method checks the low bit of address, and if set, clears it and dereferences. Otherwise it just returns the unmodified address.

This generates plausible looking code but the method that contains it also has a convertHandle, so the codegen hasn't been tested at runtime yet.

As part of this I refactored the existing conditional expansion code somewhat. No diffs in IR other than changing the failure reason for one method.

Closes #356.
2015-03-26 11:04:29 -07:00
Joseph Tremoulet e22eaa1763 Merge pull request #357 from JosephTremoulet/conv.ovf
Implement .ovf forms of conv instruction
2015-03-26 14:04:23 -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 51adef89d8 Merge pull request #354 from erozenfeld/ReaderDoc
Document describing llilc reader.
2015-03-25 14:47:51 -07:00
Eugene Rozenfeld fd8d3f97cd Document describing llilc reader.
Closes #224.
2015-03-25 14:44:59 -07:00
Andy Ayers 64641a5412 Merge pull request #355 from AndyAyersMS/VerifError
Fix an LLVM verification error.
2015-03-24 23:18:03 -07:00
Andy Ayers d68f6326f1 Fix an LLVM verification error.
The code for keeping this alive as a the generic context wasn't careful enough with insertion points. So the store to make a copy of the unmodified this was ending up in the wrong place.

Closes #352.
2015-03-24 23:13:28 -07:00
Andy Ayers add7c47d41 Merge pull request #349 from AndyAyersMS/CallIntrinsic
Defer special treatment for a few intrinsics.
2015-03-24 13:21:31 -07:00
Pat Gavlin 87ee4e6dce Merge pull request #345 from pgavlin/callconv
Support VSD calls and methods with a secret parameter.
2015-03-24 10:58:15 -07:00
Michelle McDaniel 77c7192d80 Merge pull request #348 from adiaaida/fiFix
Make CMake 2.8.12 default version
2015-03-24 10:53:00 -07:00
Michelle McDaniel 7e65a3c9c8 Make CMake 2.8.12 default version
LLVM changed to make CMake 2.8.12 to be the default, so we need to
follow suit.
2015-03-24 10:51:01 -07:00
Andy Ayers 04588cb48a Defer special treatment for a few intrinsics.
For some intrinsics the JIT can choose to just call the method. Do this for GetType and GetCurrentManagedThread.
2015-03-24 10:49:34 -07:00
Andy Ayers a8fbb6e92a Merge pull request #344 from AndyAyersMS/Doc7
Doxygen markup for ReaderCallTargetData
2015-03-24 09:51:09 -07:00
Pat Gavlin 3d5454b868 Support VSD calls and methods with a secret parameter.
- For VSD calls, pass the indirection cell as the first parameter and
  set the calling convention to CLR_VirtualDispatchStub, which will pass
  the first parameter in the appropriate register (EAX/R11 on X86/AMD64,
  respectively).
- For methods with a secret parameter, add a synthetic parameter to the
  end of the argument list and mark it with the "CLR_SecretParameter"
  attribute, which will be placed in the appropraite register (EAX/R10
  on X86/AMD64, respectively).
2015-03-24 09:49:21 -07:00
Andy Ayers db4b8bb9fb Updates based on review feedback. 2015-03-24 08:53:43 -07:00
Andy Ayers c18daa6df6 Doxygen markup for ReaderCallTargetData
Removed a few unused methods, commented the remaining.

Closes #144.
2015-03-23 17:14:08 -07:00
Joseph Tremoulet 7caf615303 Merge pull request #342 from JosephTremoulet/ArithmeticOverflow
Implement overflow forms of binary arithmetic
2015-03-23 19:51:00 -04:00
Michelle McDaniel ffa148d6de Merge pull request #343 from adiaaida/ccFormatArgs
Remove mutually exclusive group
2015-03-23 14:10:32 -07:00
Michelle McDaniel 25f2fc458f Remove mutually exclusive group
The line to add a mutually exclusive group caused ccformat to fail when
passing --help. That line was for when we passed base and noindex, which
were mutually exclusive and needs to be removed.
2015-03-23 14:06:04 -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
Andy Ayers bda0e951eb Merge pull request #337 from AndyAyersMS/KeepAlive
Ensure generic context is kept alive
2015-03-22 11:47:29 -07:00
Andy Ayers 41ebdae168 Ensure generic context is kept alive.
This gets us the next part of #40.

We use `llvm.frameescape` to indicate that the context-bearing local's address has escaped. This intrinsic requires that the function have a frame poniter, so disable FPO for these methods.

 We're still missing the ability to report the context back to the EE via the GC info. Opened Issue #336 for this.

Also fixed a bug in the static field address computation where we weren't capturing the updated helper call result.
2015-03-21 10:37:22 -07:00
Russell C Hadley 95b859a749 Merge pull request #339 from dotnet/ClassConstructorHelper
Add call to class constructor helper
2015-03-21 06:53:03 -07:00
Joseph Tremoulet 6dbef9311b Merge pull request #334 from JosephTremoulet/Continuations
Implement (non-exceptional) finally continuation selection
2015-03-21 09:01:59 -04:00
Eugene Rozenfeld 00f4f8d0d9 Merge pull request #338 from erozenfeld/HasTypeArg
Enable calls to methods that require type arg (instantiation information)
2015-03-20 23:58:12 -07: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
Eugene Rozenfeld 4d652e8a1b Change FirstArgNum and Index to be int32_t. 2015-03-20 18:54:54 -07:00
Eugene Rozenfeld d79b054d70 Change int to uint32_t or int32_t as appropriate in rdrCall. 2015-03-20 18:46:04 -07:00
Eugene Rozenfeld 692fbb0563 Change one more place back to ternary pattern and fix formatting. 2015-03-20 18:35:36 -07:00