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

645 Коммитов

Автор SHA1 Сообщение Дата
Anipik 450de75f4e non shared changes and disabling tests 2018-06-24 02:32:10 -07:00
Michal Strehovský f61d47a928
Merge pull request #5992 from dotnet/nmirror
Merge nmirror to master
2018-06-22 09:23:16 +02:00
Michal Strehovsky 2bcf67a5f1 Allow constructed byref-like types
We were not allowing these because we couldn't properly fill out the vtable (can't really make unboxing thunks to put in the vtable). We actually need the vtable, but only because the generic dictionary lives there and reflection might touch it.

[tfs-changeset: 1705047]
2018-06-21 15:21:18 -07:00
Adeel Mujahid 8d6690c4eb Rev netcoreapp2.0 to netcoreapp2.1 (#5974) 2018-06-20 17:06:28 -07:00
Andon Andonov 39f518734c
Fix CI-breaking change (#5900) 2018-06-05 13:37:36 -07:00
Michal Strehovský 1afa028a1f Make FinalizeTest run last (#5887)
#2695 got closed without any effort to validate things work. While this test has changed since the issue got filed, maybe we can still luck out and hit the issue in the CI (in which case I'll reopen the issue). If not, at least we'll get rid of the comment that references the closed issue.
2018-06-03 14:57:22 -07:00
Andon Andonov e9ad569123
Enable OSX and Linux CoreFX CI tests (#5864)
* Separate Issues on a per OS basis

* Add Linux exclusions

* Fix -p flag

* Add OSX exclusions for all-green

* Final Test Definitions

* Enable tests in runtest

* Unify OSX and Linux issues

* Update docs to reflect changes

* Remove Threading.Tasks.Tests and intermittent test failures

* Prune test list to include only System.Collections.Tests
2018-05-31 14:55:07 -07:00
Andon Andonov b3fdede4ff
Enable OSX and Linux CoreFX CI tests (#5860) 2018-05-29 09:58:50 -07:00
Andon Andonov e30bb91516
Usability improvements - Testing Documentation and scripts (#5836)
* Update testing documentation

* Add repro testing instructions

* Change incorrect instructions
2018-05-24 13:00:57 -07:00
Andon Andonov 83bd931f4e
Add additional support to CoreFX testing for CI (#5823)
* Add RSP file support

Incremental CI Improvements

Add JSON validation

* Define broad test exclusions

Remove duplicate test names

* Add OSX and Linux URLs

* Revert exit commands

* Change test log output directory and disable test execution printing

* Remove exclusions to test CI failure

* Disable simple and multimodule tests during CoreFX

* Revert "Remove exclusions to test CI failure"

This reverts commit 162a354365.

* Change exit code to test test result reporting

* Add exclusions

* Add removed exclusions

* Minor shell script fixes
2018-05-22 15:03:00 -07:00
Andon Andonov 5fca3b1c48
Staging Commit - Netci.groovy refactor and addition of a CoreFX CI job (#5817)
* Return success directly when calling runtests with /corefx flag enabled

* Rename normal scenario to coreclr and fix build failures
2018-05-18 10:52:42 -07:00
yowl 09437ab725 Double/Float casting and comparisons, push floats as 64bit to stack (#5813)
Fix double cast
push floats and doubles to stack as double
add some more tests around float/double comparisons
2018-05-17 13:45:36 -07:00
Michal Strehovský 12361f7a61 Add possibility to opt out of strict `Enum.GetValues` semantic
Fixes 39 System.Collections tests.
2018-05-11 18:18:50 +02:00
Jeff Greene 832b86f068 fix dup instruction result to no longer reference the original memory in WASM (#5784)
fix dup instruction result to no longer reference the original memory
 added additional dup test cases
2018-05-10 15:39:48 -07:00
Andon Andonov becb08ebde
Change x64 call to vcvarsall (#5763) 2018-05-01 17:25:35 -07:00
Michal Strehovský aa517a501c Devirtualize delegate creation to sealed virtuals (#5749)
These could be in sealed vtable slots.
2018-04-25 20:45:26 -07:00
Jeff Greene aad951a27e Enable Interface dispatch for WASM (#5748)
Interface dispatch
2018-04-25 17:46:50 -07:00
Jan Kotas 7b63138ee4
Fix struct marshaling bugs (#5707)
- Enable struct Marshal APIs for reference types
- Fix mismatched argument order for native to managed marshaling
- Fix sizes reported by Marshal.SizeOf APIs
- Delete some unnecessary wrappers and fixed a few typos

Fixes #5674 and #5217
2018-04-17 09:20:00 -07:00
Michal Strehovský 657a366640
Use canonical method IL in scanner's ImportCall (#5686)
Simulates what JitInterface operates on.
2018-04-12 22:10:19 +02:00
Andon Andonov 55cb81aff1 Fix test scripts (#5687)
Add an optional extended description…
2018-04-12 10:07:55 -07:00
Andon Andonov 88c56dbf1d Quality of Life improvements to CoreFX testing infra (#5651)
* QoL Improvements

* Test Cleanup

* Add OS detection to non-Windows tests
2018-04-09 14:53:18 -07:00
Morgan Brown a1d1dc873f
Initialize modules and run StartupCodeMain in wasm (#5621)
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
2018-04-06 19:35:17 -07:00
Michal Strehovský 74615b4e92
Get rid of compiler warning in StaticLibrary test (#5636)
Gets rid of `LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library [d:\git\rt\tests\src\Simple\StaticLibrary\StaticLibrary.csproj]`.
2018-03-28 20:41:15 +02:00
Andon Andonov 4fe753e766 Update CoreFX Test Binaries URL (#5628) 2018-03-27 10:50:51 -07:00
Michal Strehovský 539b297a3c
Merge pull request #5577 from dotnet/master
Merge master to nmirror
2018-03-19 19:09:35 +01:00
Michal Strehovsky 670505fafe Implement support for System.Reflection.Pointer in dynamic invocation scenarios
Since pointer types cannot be boxed, reflection invented a `System.Reflection.Pointer` type that can be used in places where an object reference is required. This implements support for the `Pointer` type in:
* Delegate.DynamicInvoke for Project N and CoreRT
* MethodBase.Invoke for Project N and CoreRT

The MethodBase change is most annoying because it requires us to do extra work due to not being able to instantiate generics over pointer types (the invoke thunks are otherwise generic). We need to unwrap the pointed to types and compensate for that in the thunk. This also means we now create instantiations over void (for void pointers), but meh.

Also fixes two bugs found on the way (so that I get the whole trifecta of IL2IL, NUTC, and binder work):

* Pointer type hashcodes were generated wrong by the binder for pointer types deeper than level 1
* The null to default(pointer) conversion didn't work (this also affected pointer typed field setters)

Fixes bug 457960.

[tfs-changeset: 1692475]
2018-03-19 00:53:25 -07:00
Jeremy Koritzinsky 31651b1066 Make Server GC component optional (#5565)
Make the Server GC an optional component by building two flavors of the runtime and selecting a specific one in the build via the `ServerGarbageCollection` MSBuild property. Don't build the Server GC flavor for Web Assembly.

Fixes #5182, Fixes #5306.
2018-03-19 08:43:52 +01:00
Andon Andonov bf6b0572c9
Enable CoreFX tests on CoreRT (#5329)
* Generate Test projects - Intermittent checkin

* Intermittent check-in running exe, tests need restoring

* Add Test utitilites project

* End-to-End test build Windows

* Change structure

* Fix RDXML and add reflectable types

* Add json parsing and xml logs

* End-to-end test run and display

* Helper project style changes

* Remove direct dll references add package dependencies

* Stylistic changes + deps

* Style fixup

* XML reader escape

* Dependency and comment cleanup

* Respond to PR feedback

* Intermittent checkin - Build helper projects

Shell scripts

* Building and working shell scripts

* End-to-end build and run

* Add error checking

* Style Fixup

* Address PR comments

* Revert line change

* Remove Net.Security.Tests

* OSX Changes

* Update URL; update dependencies

* Remove Collections.Immutable and update to long-lasting URL
2018-03-14 14:51:25 -07:00
Michal Strehovský 82cfd0f1b2
Fix interface dispatch with CppCodegen (#5533)
This got broken when sorting got introduced to stabilize the executable image. Instead of relying on implicit ordering of nodes, use order specified in the map.
2018-03-13 23:09:29 +01:00
Michal Strehovský ac0e783737
Fix empty dispatch map optimization and unnormalized vtables (#5531)
Since we currently allow unnormalized things in the dependency graph (see #5264), we need to ensure scanner produces a dependency graph that can be queried for unnormalized vtable slices.

This fixes a regression in a ASP.NET scenario. Also fixes #5508.
2018-03-13 08:10:38 +01:00
Jan Kotas 842f475917
Remove libuuid usage (#5521)
Related to https://github.com/dotnet/coreclr/pull/16643
2018-03-08 15:48:14 -08:00
Toni Solarin-Sodara 998d168987 Add tests for building native shared and static libraries (#5443)
* add preliminary Library test project (#4985)

* update library test and make it pass on Windows (#4985)

* rename Library test project to SharedLibrary (#4985)

* update sharedlib test, make it pass on darwin (#4985)

* update msbuild tag names (#4985)

* move native runner rsp file to native intermediate output path (#4985)

* add test for static library, make it pass on unix (#4985)

* update static library test, make it pass on Windows

* skip shared library test for linux (#4985)

* fix StaticLibrary linux build (#4985)

* update unix linker args when building StaticLibrary native binary (#4985)

* add copyright headers to all newly added source files (#4985)

* fix multimodule build errors for native library builds (#4985)

* add comment explaining owning module of native library startup method (#4985)

* set owning module of native library startup method to gen'd module (#4985)

* remove unneeded System.Linq import (#4985)
2018-03-07 07:09:22 -08:00
Morgan Brown 1911656238
Static constructors for WebAssembly (#5425)
* 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
2018-03-06 04:15:09 -08:00
Morgan Brown ce9cd701b1
Automatic WebAssembly test execution (#5492)
* Automatically execute WebAssembly tests on Windows by using emrun to launch a headless instance of Firefox (which doesn't interfere with any other Firefox usage). This should cut down on manual testing and help us move toward CI integration.
2018-03-05 16:50:28 -08:00
Blealtan beff0a43b2 Implement intrinsic call to RuntimeHelpers.InitializeArray for WASM (#5377)
* 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.
2018-02-27 19:30:54 -08:00
Jan Kotas 7d27b46388
Update buildtools (#5426) 2018-02-22 16:04:26 -08:00
Michal Strehovský 1c7f5604f6
Update CoreCLR tests (#5412)
Picks up the latest version of Pri0 tests (as of yesterday).

There was a massive cleanup of Pri0 tests on the CoreCLR side so we now run only about 2000 tests. Hopefully, they're more representative now. Most of what we picked as "Top200" was no longer part of the Pri0 suite, so I made a new one.

We might want to consider switching to Pri1 for the rolling builds.
2018-02-20 09:56:22 +01:00
Michal Strehovský 104cae1e7e
Fix build-and-run-test.cmd for VS 2017 (#5411)
We stopped supporting VS 2015 a while ago, but running CoreCLR tests didn't actually work without it because we forgot to update a place.
2018-02-19 18:31:04 +01:00
Blealtan eba7180dc2 Implement break opcode as llvm.debugtrap (#5344)
* 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`.
2018-02-06 20:27:11 -08:00
Jeff Greene e89bb7a087 Fixed ldind failure and properly zext unsigned types that are smaller than 32bit (#5342) 2018-02-03 17:53:26 -08:00
Christian Scheuer f19daaae78 Add support for building wasm on OSX and Ubuntu 16 (#5297)
* 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.
2018-02-03 16:47:18 -08:00
Blealtan 3470b34c12 Implement castclass & isinst for WebAssembly (#5325)
* 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.
2018-02-02 21:15:17 -08:00
Morgan Brown 6bc23d91d5
Implement localloc for WebAssembly (#5298)
* 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
2018-01-31 03:15:19 -08:00
Andon Andonov 637a3dc7d7 Update Unix external test instructions and add root test dir to test search (#5313) 2018-01-29 20:09:48 -08:00
Jeff Greene 74a131922d Implemented Array instructions for WebAssembly (#5172)
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
2018-01-28 20:03:39 -08:00
Michal Strehovský 6b1a2a9623
Rename AdditionalNativeLibrary to NativeLibrary (#5280)
And AdditionalNativeFramework to NativeFramework, as discussed in https://github.com/dotnet/corert/pull/5273#pullrequestreview-90536352.
2018-01-23 20:19:53 +01:00
Michal Strehovský 48183632f6 Make reflection tracking work with unnormalized VirtualMethodUse 2018-01-19 13:31:59 +01:00
Morgan Brown e32aeceee7
Implement WebAssembly delegates (#5143)
* Implement WebAssembly delegates and fix other minor codegen issues.
2018-01-13 04:48:48 -08:00
Michal Strehovský e00a6d9137 Update CoreCLR.issues.targets (#5233)
These two tests now succeed after David's a2f4510705.

The remaining two are testing another known corner case.
2018-01-10 08:34:04 -08:00
Michal Strehovský 42e586596d
Add handling of method parameter custom attributes (#5188)
We need to apply the same rules as elsewhere to make the attributes reflectable.
2018-01-03 18:32:39 +01:00
Michal Strehovský eff2c4584c
Update CoreCLR.issues.targets (#5187)
System.Runtime.CompilerServices.Unsafe is now an OOB library, same as Microsoft.CodeAnalysis that is blocking the test above.
2018-01-03 13:08:03 +01:00
Michal Strehovský a60adb8cda Update CoreCLR.issues.targets (#5184) 2018-01-02 07:51:12 -08:00
Wayde Reitsma 875551cf87 Implement cpobj opcode for wasm (#5151)
* 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.
2017-12-30 20:52:16 -07:00
Jan Kotas 39a8b6ac90
Fix RhGetCodeTarget for Unix x64 (#5168) 2017-12-29 19:08:36 -08:00
Michal Strehovský ab4222fba0 Ensure reflection has access to instance methods on byref-like types (#5165)
* Ensure reflection has access to instance methods on byref-like types

Adding the test uncovered a subtle issue. When rooting a virtual method for reflection, we should root the virtual method use of the slot defining method (not e.g. the `ToString` method on the byref-like type - we don't have virtual method use information for that).

* Disable part that doesn't work on Unix
2017-12-29 12:11:16 -08:00
Michal Strehovský 2a0ded50fd Add test coverage for the "reflection metadata from use" feature 2017-12-29 12:41:32 +01:00
Morgan Brown 843f6ab347
Link WebAssembly runtime (#5141)
* 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.
2017-12-27 03:49:39 -07:00
Michal Strehovský a7d9fbeb6c
Remove reference to WASM workaround (#5078) 2017-12-08 12:09:36 +01:00
Jeff Greene 8300e1f69f Added real support for Unbox stubs to WebAssembly (#5052)
* Added real support for Unbox stubs to WebAssembly
2017-12-08 02:44:13 -08:00
Morgan Brown 3d25db5b1c
Build runtime and libraries for WebAssembly (#4876)
* Fix issues building the runtime, corelib and type loader for WebAssembly

* Fix test infrastructure to allow running with the wasm flavor
2017-12-04 22:45:38 -08:00
Jeff Greene d80ed0826b enabled thread static fields in WebAssembly (#4999)
* enabled thread static fields, changed vtable dispatch to not be dependent on EETypeNode, added typed node factory
2017-11-30 00:19:32 -08:00
Michal Strehovský 741a88c0cb
Enable generation of stack trace data for simple tests (#5002) 2017-11-23 16:03:46 +01:00
Jeff Greene 4eada9a5ec Added support for calling methods via virtual slots in WASM (#4931)
* Added support for calling methods via virtual slots
2017-11-16 18:59:49 -08:00
Jan Kotas 35d86cb247 Fix CppCodeGen break with latest XCode (#4926)
Latest XCode errors on ordered comparison of pointer with integer

Also, fixed some unnecessary always-true comparisons that the C++ compiler emitted warnings for.
2017-11-14 13:13:22 +01:00
Jeff Greene 9a819d14db added support for box/unbox/unbox_any for WASM using malloc (#4731) 2017-11-06 00:23:49 -08:00
Jeff Greene ff7decc2fd implement newobj for WASM using malloc (#4872)
implemented newobj for WASM using malloc
2017-11-04 16:55:48 -07:00
Morgan Brown f760ef3415
Revert "implemented newobj for WASM using malloc (#4808)" (#4864)
This reverts commit 3b9a7fc3fc.
2017-11-03 02:18:19 -07:00
Jeff Greene 3b9a7fc3fc implemented newobj for WASM using malloc (#4808)
implemented newobj using malloc, added evaluation stack spillage and cut down on unneeded llvm casts
2017-10-31 17:41:14 -07:00
Simon Nattress 51ae3d9c5f Disable ETW events on Linux CoreCLR tests 2017-10-30 17:38:44 -07:00
Simon Nattress 5d7e4af8df
Stabilize object file images (#4818)
* 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.
2017-10-30 09:41:15 -07:00
Juan Antonio Cano 5aed5155ac Emit switch in wasm (#4769)
* Implement switch opcode Fix #4519
2017-10-23 13:17:08 -07:00
Jeff Greene e1f8363287 Added support for ldsfld/stsfld/ldsflda/ldflda including general value type 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
2017-10-20 16:22:16 -07:00
Faizur Rahman c6995b38cb Add support for marshalling struct with delegates (#4737) 2017-10-17 18:41:04 -07:00
Morgan Brown b9b6c5db47 WebAssembly instance method support (#4695)
* 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.
2017-10-17 13:27:08 -07:00
Jeremy Koritzinsky 18f3c7773c Implement Shift Opcodes for WebAssembly (#4721)
* Implement shift opcodes

* Fix HelloWasm test.

* FIx HelloWasm test program.
2017-10-14 21:12:29 -07:00
Juan Antonio Cano ea81a1844f Implement neg (float/integer) and not IL instructions. Fixes #4524 and #4525 (#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.
2017-10-14 17:19:24 -07:00
Jeff Greene c79eba2eed implemented ldobj/stobj in terms of ldind/stind (#4709) 2017-10-10 18:29:35 -07:00
Jeff Greene baeebd4f5f added support for stind in WASM (#4702) 2017-10-10 17:05:02 -07:00
Morgan Brown 8f423ff109 Add the -prelease switch to vswhere in build scripts to allow them to find prerelease versions of Visual Studio. This fixes building on a machine that only has C++ installed in a preview build of VS 2017. (#4696) 2017-10-09 22:20:25 -07:00
Jan Kotas 2e4be5436b Use Tls12 to download CoreCLR tests (#4682) 2017-10-06 04:40:15 -07:00
Jan Kotas d1223d2c92 Delete VS2015 support (#4660) 2017-10-03 19:12:19 -07:00
t-jekor 18eab60696 Enable CLR Thread Pool via a MSBuild flag (default enabled on Unix)
This PR completes, adds tests for, and enables the CLR Thread Pool on Unix. It also adds Windows implementations for the low level primitives used in the CLR Thread Pool.

The thread pool is enabled by setting the MSBuild property FeaturePortableThreadPool to true, which is the default on Unix.

Supersedes #4039.
Rebased and squashed replacement for original PR #4124.
2017-09-29 07:33:57 -07:00
Morgan Brown 6622ebe8d8 Fix strings for WebAssembly (#4592)
Changes that allow loading a printing a frozen string. Includes:

* Implement ldnull and ldind
* Fix brtrue and brfalse for pointers
* Fix the polarity of ceq and friends
* Change functions we can't compile into traps so that they don't break LLVM
* Put call arguments in the right order
* Miscellaneous stack canonicalization fixes (we'll have to revisit this in a more comprehensive way soon)
* Minor diagnosability improvements
2017-09-25 21:16:50 -07:00
Sergiy Kuryata fe8a3e7ed4 Enable Server GC (#4591)
This change adds support for Server GC.
To enable the Server GC for an application, the RH_UseServerGC environment variable (which is already supported by the runtime) should be set to 1.
2017-09-22 00:13:14 -07:00
Adeel 8059fcb69a Avoid linefeed in /proc/self/coredump_filter
On Alpine Linux, the default shell is ash. To build .NET Core, we
explicitly install bash.

If we run the following command:

```sh
echo 0x3F > /proc/self/coredump_filter
```

in bash, it raises the exception:

> echo: write error: Invalid argument

while with ask, it works fine.

Problem is that, when `echo` is run from `bash`, it adds a trailing
linefeed which kernel seems to reject.

Adding `-n` avoids adding the linefeed.

Original exception while building CoreRT:

```sh
chmod +x /corert/Tools/dotnetcli//dotnet
/corert/bin/Linux.x64.Debug/ILCompiler.DependencyAnalysisFramework.Tests/RunTests.sh: line 67: echo: write error: Invalid argument
/corert/Tools/dotnetcli//dotnet xunit.console.netcore.exe ILCompiler.DependencyAnalysisFramework.Tests.dll  -xml testResults.xml -notrait Benchmark=true -notrait category=nontests -notrait category=nonlinuxtests  -notrait category=OuterLoop -notrait category=failing
```
2017-09-21 03:58:45 +03:00
dotnet-bot 792a29f98a ProjectX: Add real element type and element count to preinitialized data for array fields
For static array fields, the real element type which can be a descendent of the declaring type must be added to the preinitilizeded data. The element count should also be there.

[tfs-changeset: 1674701]
2017-09-18 14:09:12 -07:00
Morgan Brown 699b5a08e9 Fix LLVM NuGet binary placement and clean up changes 2017-09-14 17:24:46 -07:00
Morgan Brown 2552e22abc Adds a WASM test and test infrastructure changes and fixes to support it. 2017-09-14 17:24:46 -07:00
Michal Strehovský 94bc6911da Update RyuJIT (#4407)
Picks up:

* dotnet/coreclr#13561
* dotnet/coreclr#13577


Fixes #3608.
2017-08-28 12:10:19 -07:00
Michal Strehovský 4c446d524a Generate portable PDBs by default for managed projects (#4362) 2017-08-22 16:36:31 -07:00
Yi Zhang (CLR) 1105f175e7 Preinitialized data support for value types (#4281) 2017-08-11 13:51:49 -07:00
Jeremy Koritzinsky 33467fd891 [Unix ThreadPool] Dedicated Wait Thread (#3807)
* Added a dedicated wait thread to the thread pool following similar design principles as CoreCLR

* Fixed project file

* Fix missing return.

* Use the RuntimeThread APIs instead of the Interop-level APIs to create the WaitThread.

* Moved callback execution and unregistering to the thread pool

* Encapsulated signaling the user provided wait handle to ensure it only happens once.

* Handle the blocking case by not queuing the unregistration of the wait on the threadpool when the handle is invalid and instead unregistering directly.

* Rename WaitThread to ClrThreadPool.WaitThread and remove Unix suffix since (in theory), we will be able to move this to work on Windows as well in the future.

* Cache WaitHandle array and timeout and only recreate when the list of RegisteredWaitHandles is changed

* Fixed ClrThreadPool class modifiers in ClrThreadPool.WaitThread.cs

* Fixed reference to WaitThread class

* Fixed reference to WaitThread class

* Re-architected WaitThread to use a partial section of the array of wait handles to wait on and queue all removals to happen on the wait thread itself.

* Fixed compile error in WaitAny

* Make ClrThreadPool.WaitThread non-static and add scaffolding code to ensure handles can be unregistered by the user from the right WaitThread

* Fixed possible indxing errors, prevented double remove requests, and renamed some methods to be more descriptive

* Add comments

* PR feedback

* PR feedback

* Add a lock around selecting a wait thread to register the wait handle on

* ClrThreadPool is no longer static in master

* Only process removals before calling WaitAny, not after

* Try-Finally in ProcessRemovals

* Remove safeToDisposeHandleEvent as per PR feedback

* Added try-finally in UnregisterWait

* Refactor SetEvent into WaitHandle so as to not have direct dependencies on the Unix Wait Subsystem

* waitHandles.Length -> numWaitHandles in WaitAnyCore

* Added try finally in PerformCallback and added a way to ensure Unregister only returns true once

* Refactored timeout to actually account for previous waits when calculating timeout

* Account for handles that timeout while doing other work than waiting

* Changed removals aglorithm to fill nulls in while removing instead of doing so in a later loop

* Create 1st Wait Thread lazily

* Refactor RegisteredWaitHandle. Made wait threads time out. Start wait
threads outside of global lock.

* Fix wait thread accessibility

* Fix registered wait initialization to match CoreCLR

* Removed the lock from RegisteredWait in favor of a CompareExchange flag

* Replaced CompareExchanges with volatile loads and Exchanges

* Fix asserts in WaitSubsystem

* Fix bounds in safe wait handle release

* Added Wait Thread tests.

* Added more wait thread tests and fixed code style.

* Remove resolved TODO.

* Uninterruptible waits on wait handles where supported. Internalize CanUnregister. Return true on first unregister call even if automatically unregistered eariler

* Fix typos

* Add basic recursive event to handle overlapping callbacks

* Fix repeating timer timeout

* Remove dependency on Environment.TickCount from RegisteredWait

* Fixed test

* Fix race conditions on callbacks + unregister based on PR feedback

* Only timeout on change event when there are no user waits

* Fix overload call

* Remove code used for initial debugging

* Double times used in test to allow for about 50 ms window for test timing instead of 25 ms

* Move RegisteredWait into RegisteredWaitHandle

* Unregister on wait thread before callback

* Add test and code to ensure events are not observed on wait thread after an unregistration, even if it is non-blocking.

* Fixed incorrect timeout class

* Expand time frame for failing test to 100ms from 50ms. Add another assert to ensure it's working correctly

* Use event setting for test instead of timeout.

* Cleaned up leftover variables in test

* Only use sync context when wait is uninterruptible

* Make IsBlocking setter private.

* Fixed blocking unregisters.

* PR Renames

* Remove unneeded _unregisterSignaled member.

* Add debug check of _numRequestedCallbacks.

* Add argument verification for top of range.

* Clean up tests per PR feedback.

* Add CheckedWait helper.

* Added dispose-after-unregister test.

* Added block comment stating the reasoning behind not having a blocking wait on removal in unregister.

* Added finalizer to RegisteredWaitHandle.

* Changed overlapping callback test to use events instead of sleeps in the job.

* Refactor timeout times in tests and add comment to ClrThreadPool constant.

* Move updating the user's supplied unregister event to be in the callback lock.

* Added lots of comments and fixed an accessibility modifier

* Clean up tests and argument validation. Lazily create event for blocking unregistration.

* Only grab sync context if wait is interruptible.

* Fixed comment.

* Unregister event will be signaled even if handle has already been unregistered

* Fix timeout checks.

* Added test and code to make it pass for blocking unregistering a handle after it has been removed from the list but is still executing a callback.

* Add an event to wait for the handle to be removed from the list. User code will not get control back until it is safe to dispose the handle.

* Refactor internal event handles

* Changed sleep times for test

* Implement cache for internally used AutoResetEvent

* Exceptions in unregister rollback RegisteredWaitHandle state.

* Change defaults of UserUnregisterWaitHandle and UserUnregisterWaitHandleValue to null and IntPtr.Zero respectively
2017-08-04 14:32:23 -07:00
Michal Strehovský 044dbc5b4d Fix ILASM warnings for PreInitDataTest (#4051)
Reordering inputs to ILASM silences these warnings:

```
1>PreInitData64.il(11): warning : Reference to undeclared extern
assembly 'mscorlib'. Attempting autodetect
[d:\git\rt\tests\src\Simple\PreInitData\PreInitData.ilproj]
1>PreInitData64.il(15): warning : Reference to undeclared extern
assembly 'System.Private.CoreLib'. Attempting autodetect
[d:\git\rt\tests\src\Simple\PreInitData\PreInitData.ilproj]
1>PreInitData64.il(15): warning : Failed to autodetect assembly
'System.Private.CoreLib'
[d:\git\rt\tests\src\Simple\PreInitData\PreInitData.ilproj]
```
2017-06-30 20:06:25 -07:00
Michal Strehovský a9e89026c8 Update CoreCLR.issues.targets (#4040)
Once we pick up test assets after dotnet/coreclr#12537 this test will be
passing - moving the test to the category of tests that are waiting for
test update.
2017-06-30 11:21:32 -07:00
Michal Strehovský b33350e4fe Fix `runtest.cmd /multimodule` (#3998)
CLI update moved outputs out of the Product directory. This should fix
the rolling build failure.
2017-06-27 17:39:31 -07:00
Jan Kotas 79f64c17f8 More CLI update follow up fixes (#3990)
* Fix TFS build break

* Pass CoreRT_BuildOS to tests

Fixes #3982
2017-06-27 08:16:10 -07:00
Jan Kotas 555bcbcb54 Update CoreRT build to use latest .NET CLI and build tools (#3916)
- Pick up latest .NET Core 2.0 CLI and buildtools
- Remove all project.json references and convert everything to msbuild projects
- Stick to vanilla .NET CLI project shape as much as possible. Minimize dependencies on buildtools special behaviors
2017-06-24 11:10:44 -07:00
Faizur Rahman 6ea23dec10 Merge pull request #3921 from shrah/null_check
Add null check for inline string marshalling
2017-06-20 16:09:53 -07:00
Faizur Rahman 9df11fa0ca Add null check for inline string marshalling 2017-06-19 15:42:48 -07:00
Sergiy Kuryata f613261b65 Fix interface handling in CorInfoImpl.resolveVirtualMethod (#3922)
Without this fix, the CoreRT compiler generated the following code for the
test that I am adding:

call    Interfaces!_NewHelper_Interfaces_BringUpTest_SomeClass
mov     rcx,rax
call
Interfaces!Interfaces_BringUpTest_SomeAbstractBaseClass__get_SomeValue

As you can see, it ends up calling an abstract method on the base class.

With this fix, the interface call is resolved correctly:

call    Interfaces!_NewHelper_Interfaces_BringUpTest_SomeClass
mov     rcx,rax
call    Interfaces!Interfaces_BringUpTest_SomeClass__get_SomeValue
2017-06-19 14:10:44 -07:00
Jan Kotas df324ea0d8 Merge remote-tracking branch 'upstream/nmirror' into nmirror-merge 2017-06-17 13:31:28 -07:00
Jan Kotas 65e7669e15 Delete ToolsVersion attribute from msbuild files
The latest project templates do not have it, and it is only good for generating warnings like the following in the detailed build log:

Project file contains ToolsVersion="4.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="14.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=293424.

[tfs-changeset: 1662024]
2017-06-17 13:12:18 -07:00
Faizur Rahman 5e3c01ae0f Merge pull request #3891 from shrah/lasterror
Make UnmanagedFunctionPointer SetLastError to work
2017-06-15 14:49:07 -07:00
Faizur Rahman 38933eda31 Make UnmanagedFunctionPointer SetLastError to work 2017-06-15 13:30:44 -07:00
Fadi Hanna 962401ec63 GVM dependency analysis performance fixes (#3872)
Refactor GVM algorithm for better performance
Fix GVM resolution bug on derived types
Fix bug with variance (https://github.com/dotnet/corert/issues/3454)
2017-06-14 18:28:04 -07:00
Yi Zhang (CLR) 27683e25c8 Support TypeHandleFixupAttribute and MethodAddrFixupAttribute (#3858)
The code adds TypeHandleFixup/MethodAddrFixup and abstraction for fixups. It is mostly straight-forward but testing is rather annoying:

The data blobs for fixups are pointer-size and therefore dependent on CPU architecture. I haven't found anything in ILAsm that is similar to ifdef so I have to conditionally include 32-bit or 64-bit copies. I suppose we'll need to deal with the fun that is indian-ness at some point.
Updating IL is quite annoying as I don't want to write test code in IL. I end up splitting the IL in two sections, and I compile the corresponding C# code into exe, ildasm it, and incrementally copy/paste the code that I want into the IL.
I need to use internal types such as FixupRuntimeTypeHandle / NativeCallable, so those need to be manually fixed up from my internal copy to the right reference System.Private.CoreLib
2017-06-14 08:36:50 -07:00
Michal Strehovský 9def0f337c Enable inlining of virtual method calls (#3773) 2017-06-12 18:38:47 -07:00
Michal Strehovský 69808728c3 Fix virtual method use reporting for canonical EETypes (#3842)
Canonical EETypes weren't reporting their virtual method dependencies,
hoping that by the time they want to emit the VTable, someone else
already reported them. Fixing that by moving virtual method reporting
from `ConstructedEETypeNode` down to `EETypeNode`. At this point it's
really obvious that the current object hierarchy (where `EETypeNode`
represents an unconstructed EEType that shouldn't care about virtuals,
but handles pretty much all of it anyway) doesn't work.

Fixes #3659.
2017-06-08 14:38:42 -07:00
Michal Strehovský b64113f0e6 Update CoreCLR.issues.targets (#3841) 2017-06-08 12:26:15 -07:00
Michal Strehovský 9315d52f61 Update CoreCLR.issues.targets (#3837)
* Throw the right exception for `newarr void`

Fixes #2280.

* Remove stale issues

Resolves #2349.
Resolves #2782.
2017-06-08 08:46:20 -07:00
Michal Strehovský 2ba7082503 Enable SIMD tests (#3835)
* Implement more SIMD intrinsics

RyuJIT needs to be able to throw a few more exceptions.

* Enable SIMD tests
2017-06-08 06:49:24 -07:00
Michal Strehovský 61eb6f74c8 Update CoreCLR.issues.targets (#3829)
This test used to fail on `CreateInstance<T>`, now it fails due to
ambiguous virtual methods.
2017-06-07 15:22:48 -07:00
sergey ignatov 83e4241f94 [armel tizen] Provided some stubs for unimplemented asm functions (#3826) 2017-06-07 14:34:40 -07:00
Michal Strehovský 95a87f8d1c Implement Activator.CreateInstance<T> intrinsic (#3821)
We previously didn't do an intrinsic expanstion for this and had to fall
back to slow and unreliable type loader. This implements a guaranteed
expansion of `CreateInstance<T>` using the infrastructure built for
`EETypePtrOf<T>`.

* Add `RuntimeHelpers.IsReference<T>` intrinsic that constantly expands
to 0 or 1 at compile time (this gets rid of the `default(T) == null`
workaround that requires special handling for `Nullable<T>`).
* Add `DefaultConstructorOf<T>` that expands to the default constructor
of `T` or a special marker method.
* Rewrite `CreateInstanceIntrinsic` using the new intrinsics.

Fixes #368.
2017-06-07 11:08:42 -07:00
Faizur Rahman c278936f3a Merge pull request #3762 from shrah/runtime_data
Generate runtime interop data for structs and delegates
2017-06-05 17:38:56 -07:00
Faizur Rahman 26d526fe02 Addressed Interop feedbacks 2017-06-05 16:57:21 -07:00
Michal Strehovský 8c90ac0648 Make virtual invoke map report dependency on virtual method slot (#3785)
* Make virtual invoke map report dependency on virtual method slot

Placing a virtual method in the map means that we'll need a slot for it.

I wasn't sure I liked this as a fix in the past, because it makes the
mapping table potentially bring unused methods into the compilation
(e.g. if the method has multiple overrides), but I convinced myself that
doing anything else would result in terrible user experience and
whatever external tool we'll use to determine reflection roots in the
future will need to apply the same rule.

* Fix release test failure
2017-06-02 20:38:03 -07:00
Faizur Rahman 2bea3fbfcb Disable Struct Marshalling tests for CPPCodeGen
Now that I make NativeStructType implement INonEmittableType interface
struct marshalling test is failing for CPPCodeGen. The issue here
is that in CPPCodeGen we add type reference for stack values. Since
NativeStructType is INonEmittableType they hitting assertion failures.
2017-06-02 20:00:14 -07:00
Jeremy Koritzinsky 61fac39116 Remove invalid asserts in the Unix WaitSubsystem WaitObject (#3782)
Fixes #3616.

The crash in #3616 was from a race condition in a small section of code between setting a `WaitHandle` and unregistering a timed out `Wait` call on that `WaitHandle` on a different thread. This section of code is not locked by the `WaitMonitor`. This assert failure happened when a `WaitHandle` was signaled twice while a `Wait` was in the process of timing out between the locked sections.

However, as per @kouvel, the asserts are invalid anyway since when a thread is waiting on multiple `WaitableObject`s (like in `WaitAll`), the thread's wait info will still be in the waiters list of all of the `WaitableObject`s until they all complete. So, we just remove the asserts that were firing since they will break anyway when more multithreaded tests are added.
2017-06-02 15:36:09 -07:00
Faizur Rahman f63296bcb4 Generate runtime interop data for structs and delegates
In order to make the Marshal APIs to work, this change generates runtime
interop data for the following cases:

. Delegates with UnmanagedFunctionPointerAttribute
. Structs with StructLayoutAttribute
. Generic parameters for Marshal generic API calls which are struct or
delegate
2017-05-31 16:40:38 -07:00
Michal Strehovský f0b23ea9aa Implement delegates to generic virtual methods (#3712)
Turns out I got most of this right in #3318. At that time I saw RyuJIT
crashing but didn't have a checked version of it handy. Turns out it was
just an eager assert that is easy to subdue.
2017-05-26 14:55:19 -07:00
Michal Strehovský e6c88a6a16 Enable reflection blocking (#3685)
Reflection blocking is a size on disk optimization that prevents
generating native metadata for things that are considered
private implementation details of the runtime.

Since CoreRT is compiled ahead of time, a lot of things that
would be needed by a full VM (method names, custom attributes, etc.)
are no longer necessary at runtime. Metadata is strictly only necessary
to support reflection at runtime.

The policy I'm implementing is to consider everything private in our
implementation assemblies to be reflection blocked.

What this entails:

* Adding support for computing reflection blocked state in the compiler
* Tweak to blocking policy to allow us to express blocking state of MethodImpls
* Uncomment blocking table mapping table scanning (this broke the PInvoke test for CppCodegen and we needed a workaround)
* Opt in private assemblies to reflection blocking
2017-05-24 22:21:32 -07:00
Yi Zhang (CLR) a806c3f2aa Add a test for PreInitData based on IL (#3667)
* Add PreInitData test and simple plumbing for ilproj
* make preinitdata.sh executable
* Add license header
2017-05-22 20:10:01 -07:00
Sergiy Kuryata f584f5be1b Implement a simple timer for Unix (#3620)
Implement a simple timer for Unix
2017-05-15 16:19:36 -07:00
Faizur Rahman a6ecb31cda Add Interop tests to Unix Top200 runs 2017-05-05 11:01:24 -07:00
Faizur Rahman 049a8f4ec7 Merge pull request #3523 from shrah/unix_coreclr_tests
Restore Non-Windows native build artifacts for CoreCLR test runs
2017-05-04 18:54:20 -07:00
Faizur Rahman 303839f025 Addressed feedbacks - use the pinned Linux and OSX builds for CoreCLR tests 2017-05-04 18:13:07 -07:00
Michal Strehovský 5446103f73 Update CoreCLR.issues.targets (#3525)
We need test updates from dotnet/coreclr#10295, but updating the entire
test suite is kind of expensive because it will need rebaselining.
2017-05-04 18:08:41 -07:00
Faizur Rahman 99c2007ee8 Restore Non-Windows native build artifacts for CoreCLR test runs
The drop we read the test artifacts from doesn't contain Unix native components
necessary for running interop tests. This change consumes another drop from
jenkins depending on whether we are in Linux or OSX.
2017-05-04 16:46:40 -07:00
Michal Strehovský 64977f5d07 Update CoreCLR.issues.targets (#3463)
Enable 200+ tests that are now passing.
2017-04-30 16:19:45 -07:00
Michal Strehovský 9bc39ee364 Update CoreCLR.issues.targets (#3455)
The GVM tests were blocked on enabling shared generics. We now have
them.
2017-04-29 18:16:58 -07:00
Michal Strehovský 2792a7f99f Update CoreCLR.issues.targets (#3462)
Baseline shared generics issues.
2017-04-29 10:43:04 -07:00
Michal Strehovský 0d406a0248 Enable shared generics by default for RyuJIT backend (#3451)
Adding proper tracking of virtual method reflection use in multifile
mode (#3437) was the last thing blocking this. Let's see if we can get
away with enabling this by default.
2017-04-28 18:15:22 -07:00
Faizur Rahman 9a54f4838a Addressed Feedbacks - add more null test scenarios 2017-04-28 17:03:46 -07:00
Faizur Rahman 2f01b93465 Implement AnsiCharArray and AnsiChar marshaller
This change contains the following:

* AnsiCharArray Marshaller
* AnsiCharMarshaller
* Couple of bug fixes for InlineArray and String builder marshaller
2017-04-28 11:19:06 -07:00
Michal Strehovský 93ee602435 Update CoreCLR.issues.targets (#3448)
* Start running tests that rely on NetStandard 2.0 APIs that we already
have in CoreRT
* Start running GC tests that now work.
2017-04-27 21:38:40 -07:00
Michal Strehovský c40a975cf3 Add full support for building with VS 2017 (#3436)
This is a followup to #2390 that fixes a few things:

* vs2017 no longer needs to be passed to build.cmd (it will be
autodetected)
* Building and running tests now works
* Documentation updates to point out running from Developer Command
prompt is needed.

Fixes #3394.
2017-04-26 17:36:41 -07:00
Faizur Rahman 0c49a7d9be Support ANSI marshalling semantics
It does the following:

* Enable support for correct ANSI marshalling semantics
   (https://github.com/dotnet/corert/issues/2476) by calling into PInvokeMarshal ANSI string marshalling helpers.
* Split Alloc and Transform for StringBuilder marshalling
* Added test case for [Out] StringBuilder marshalling
* Added null check in array marshaller.
2017-04-25 17:12:27 -07:00
Faizur Rahman a35f4e68b1 Implement Unicode and Ansi StringBuilder 2017-04-25 16:27:49 -07:00
Peter Sollich 36f5f8b0af Gc reporting for filter funclets (#3401)
I found the problem with filter funclets is that the untracked variables
get reported both by the filter funclet and the enclosing method.

While the compiler makes sure that the lifetimes of other variables get
appropriately split and marked as pinned, this is not the case for
untracked variables - here we simply need to suppress the reporting if
we are indeed in a filter funclet.

My fix simply figures out whether we are indeed in a filter, and if so,
passes an appropriate flag to EnumerateLiveSlots.

I suspect that UnixNativeCodeManager.cpp/.h will need a parallel fix,
but lets first discuss whether my fix for Windows is in fact correct.
2017-04-24 17:56:40 -07:00
Simon Nattress d3576c3865 Move two mis-filed Mangling dot files (#3406)
Move two name mangling dot files under the Common folder
Add a regression test for the NativeStructType naming
2017-04-21 16:28:03 -07:00
Faizur Rahman 0d1fffb114 Disable FunctionPtrTest CoreCLR Test (#3409)
Please see issue https://github.com/dotnet/corert/issues/3408
2017-04-21 16:27:13 -07:00
Faizur Rahman 3f4b2d1d8a Add marshalling support for returning function pointers from native side as Delegates 2017-04-14 11:07:09 -07:00
Michal Strehovský be5de3f0d0 Restore support for delegates to GVMs created from unshared code (#3318)
This used to work but it's now failing in the rolling build. It's easy
enough to restore enough of the functionality to get the tests passing
again.

The rest of the work (creating the delegate from shared code) is tracked
in #2796 (uncomment the commented out test line to hit a failure in the
JIT).
2017-04-13 11:48:37 -07:00
Michal Strehovský 1860d048f1 Make DelegateCtor R2R helper perform virtual resolution (#2928)
Update the compiler to be able to leverage the newly added RyuJIT capabilities around delegate constructions.

In the past, RyuJIT would only ask for the construction helper for the simplest cases (target method is not virtual, and no generic runtime lookup is needed). It would call the actual constructor method for everything else.

With updated RyuJIT, we can now use the helper in all cases (if the construction pattern is verifiable).

The change is bigger than I would like because:
* We needed to update `DelegateCreationInfo` to capture the fact that the target of the delegate can now be runtime determined
* There was an unimplemented feature around fat function pointers looked up from dictionaries (we couldn't express that the fat function pointer should point to the unboxing stub).
* `ShadowConcreteMethod` didn't work great with unboxing stubs. I just made a new node that is a "shadow unboxing stub".
* We needed to update both generic and nongeneric ready to run helpers to deal with the new delegate creation patterns.
* JitInterface change.
* Tests
2017-04-12 10:32:53 -07:00
Faizur Rahman fbaa006515 Merge pull request #3241 from shrah/coreclr_tests
Add support for directly run CoreCLR Interop tests in CoreRT
2017-04-07 12:38:49 -07:00
Faizur Rahman 3562f9f0f4 Add support for directly running CoreCLR Interop tests in CoreRT 2017-04-07 10:48:15 -07:00
Simon Nattress 94744f187c Merge pull request #3226 from dotnet/nmirror
Merge nmirror to master
2017-04-06 18:02:03 -07:00
Simon Nattress efdf7551e4 Merge branch 'master' into nmirror 2017-04-06 17:27:01 -07:00
Faizur Rahman 56616a7cd2 Fix array of non-blittable structs marshalling 2017-04-06 15:21:18 -07:00
Fadi Hanna 5a8e082d07 Fix #3211: Node ILCompiler.DependencyAnalysis.GCStaticsNode is not marked when ILCompiler.DependencyAnalysis.RyuJitNodeFactory is MarkingComplete (#3227) 2017-04-06 09:56:01 -07:00
Simon Nattress b4b7234c93 Fix CoreRT generics test in Release build
The dynamic invoke tests were failing because the JIT was inlining all the target methods leaving nothing to actually invoke through reflection. Mark all the methods we invoke (including the empty constructors) with `[MethodImpl(MethodImplOptions.NoInlining)]`.

[tfs-changeset: 1653296]
2017-04-05 16:56:57 -07:00
Simon Nattress c624af43e5 Dynamic Invoke Stubs
* Add CoreRT implementation for the dynamic invoke template table which maps invoke stub name / sig to the canonical method entrypoint
* CoreRT based compilers use 32bit relative addresses to the stub containing EEType and method entry points (.NET Native uses RVAs). Set the bit on the reloc to indicate a 32bit rel reloc.
* Fix a bug in generic method template map where generic methods on structs were getting IsUnboxingStub set incorrectly

[tfs-changeset: 1653288]
2017-04-05 16:09:39 -07:00
Faizur Rahman 62d3b079d9 Add Out and Ref support for AnsiString and UnicodeString 2017-04-04 20:03:08 -07:00
Faizur Rahman 8f3eee0fc9 ByValArray Marshaller
Marsahal fixed size arrays, ansi string, and unicode string.
2017-03-30 11:48:26 -07:00
Sergiy Kuryata 4da3782471 Add a simple thread pool implementation for Unix (#3114)
* Add a simple thread pool implementation for Unix

This change adds a very primitive (temporary) implementation of Thread
Pool to allow Tasks to be used on Unix until a proper implementation is
available.

For simplicity of the state management, the thread pool pre-creates all
thread pool workers (controlled by the MaxThreadCount const) on the first
request and then uses a semaphore to release threads as new requests come
in.

In addition, this change enables all test cases in the BasicThreading test.

* Fix some inconsistencies in RuntimeThread.StartThread method due to
differences between Windows and Unix.
2017-03-29 16:22:38 -07:00
Simon Nattress 143634ae9d Support GC Statics in type loader (#3120)
Support GC Statics in type loader

* Add support for CoreRT-style GC statics when creating new generic types from templates
* Pass new `BagElementKind.GCStaticEEType` through in the template layout so the type's statics can be heap-allocated
* Add managed accessors to the dynamic GC / non-GC data to EEType.cs
2017-03-29 14:10:34 -07:00
Fadi Hanna f2d77169ed Implementation of the VirtualInvokeMap table to enable Reflection invocation to virtual and generic virtual methods. (#3100)
Implementation supports both CoreRT and ProjectX models.
Fixed interface EEType generation to unconditionally produce a dictionary slot for generic interfaces (to support static interface methods, and enable correct Reflection virtual invoke slot computation on ProjectX).
2017-03-27 15:47:51 -07:00
Simon Nattress c52917e860 Run single test by folder name
Add support for running a single test via runtest.cmd /test <Test Name>.

Example usage:
```
runtest.cmd /test BasicThreading
runtest.sh -test BasicThreading
```
2017-03-24 16:41:19 -07:00
Michal Strehovský a11baf89ce Merge remote-tracking branch 'dotnet/nmirror' into nmirror-merge 2017-03-24 11:51:14 -07:00
Sergiy Kuryata 52d269eb6d Fix a race in thread shutdown on Unix (#3073)
* Fix a race in thread shutdown on Unix

The problem is that the _stopped event (that is used for signaling that
the thread has stopped) is allocated in the CreateThread() method after an
OS thread is created. As a result, the parent thread can be scheduled out
before it allocates an event and assigns it _stopped. At same time, the
newly created thread gets a chance to run, finishes its work promptly and
exits; while exiting, it tries to signal the _stopped event but it crashes
instead because the event has not been allocated yet. I believe the
problem with lifetime management of the _stopped event is due to the fact
that the original code relied on the value of _stopped in the HasStarted()
method to indicate whether a thread has been created/started or not. On
Windows, the HasStarted() method relied on the value of _osHandle for the
same purpose.

This change fixes this problem by:
1. Changing the HasStarted() method to use the explicit state of the tread
ThreadState.Unstarted (i.e. the _threadState field). This also makes
implementation of this method platform independent. The existing code
already sets the thread state to ThreadState.Unstarted (when an instance
of the RuntimeThread class is created) and clears the bit when the thread
starts executing managed code.
2. Changing RuntimeThread on Unix to allocate the stopped event before
thread creation to actually fix the race.

I have also partially enabled the BasicThreading test for Unix and added a
small regression test for the race condition. Full functionality of
BasicThreading will be enabled once we have ThreadPool supported on all
platforms.

* PR Feedback

* Fix issue with __cxa_thread_atexit in PAL. The change (https://github.com/dotnet/corert/pull/2531)
that introduced __cxa_thread_atexit in PAL did it incorrectly. The __cxa_thread_atexit function
should be called for each TLS object that needs its destructor to be executed at thread shutdown time.
The incorrect usage of __cxa_thread_atexit resulted in hangs in SuspendEE and random corruptions.
2017-03-24 11:37:17 -07:00
Simon Nattress 95f600019c Enabled type loader on CoreRT
* Enable template generation for generic types
* Dictionary slots generated for types / methods cause that type / method to get a type loader template
* Remove the template-specific list of slots and just use the owning type's dictionary layout
* Add not-supported entry for template slots that aren't implemented yet

[tfs-changeset: 1651962]
2017-03-24 10:59:52 -07:00
Michal Strehovský e2e557f878 Update CoreCLR.issues.targets (#3087)
My previous change errorneously marked these two tests as working
because I had a local hack in place that made TypeRefs to
`TypedReference` always resolve to CoreLib (makes testing possible
without fighting the build system too hard).

Turns out these two tests import `TypedReference` from System.Runtime.
Our System.Runtime doesn't have a forward for that yet.
2017-03-23 20:51:56 -07:00
Michal Strehovský 0b5f4f8114 Update CoreCLR.issues.targets (#3079)
TypedReference is now supported.
2017-03-23 13:47:53 -07:00
Michal Strehovský 3b53150c2a Fix typesystem injected methods in multimodule compilation 2017-03-17 12:22:08 -07:00
Faizur Rahman d0c433a0b5 Merge pull request #2976 from shrah/del
Closed Delegate marshalling
2017-03-16 15:13:50 -07:00
Fadi Hanna 3e6c52ddaa Enabling static fields access for Reflection (#2962)
1) Adding the StaticsInfoHashtable to track statics regions for compiled types.
2) Writing statics field data to the ReflectionFieldMapNode
3) Improving the IndirectionNode to allow it to point to an inner offset in a target symbol
4) CoreRT runtime support for static fields access
5) Collapsing of field entries in the ReflectionFieldMapNode based on canonicalization
2017-03-15 23:00:43 -07:00
Faizur Rahman 4e1e6299c7 Closed Delegate marshalling
Implement marshalling for close instance delegate. Also parse
UnmanagedFunctionPointer attribute.
2017-03-15 21:04:06 -07:00
Faizur Rahman 54e06de967 Merge pull request #2943 from shrah/struct
Struct Marshalling - initial implementation
2017-03-15 15:12:27 -07:00
Faizur Rahman 35c40e1d31 Handled the auto layout scenrio 2017-03-15 14:35:12 -07:00
Simon Nattress ee7612b8e9 Use multi-module in rolling Windows test runs (#2986)
* Run the known good ~5000 CoreCLR tests using multi-module compilation
for through-put wins. The whole suite takes under 2 hours locally, vs ~5
hours with single file mode. We should expect to see the rolling test
job reduce from its current 7 hours.

* Remove `MultiFileLeafCompilationModuleGroup` and always use
`MultiFileSharedCompilationModuleGroup` for multi-module builds. This
addresses several failing tests where pointer / array types were getting
ConstructedEETypeNodes generated due to ShouldProduceFullType returning
true incorrectly. Since it's technically possible for libraries to refer
to types in the entry-point assembly, we should always produce full
types in multi-module mode to be safe.
* Disable a GC test that fails under multi-module. The test verifies
that a couple allocated objects are moved to higher generations during
GC. This doesn't happen in multi-module, possible due to a different
pattern of allocations with more code running on the startup path and
unpredictable pinning behavior with conservative GC mode. This test had
better pass when we enable precise GC so I put it under that category.
2017-03-15 13:47:35 -07:00
Faizur Rahman 3e43940676 Struct Marshalling - initial implementation 2017-03-15 13:32:55 -07:00
Anton Lapounov 71f7b3bf0c Implement Thread for Unix (#2957)
Implement Thread for Unix:
* Use a callback from PalDetachThread to signal the thread as stopped.
* In BasicThreading test account that SafeHandle postpones disposing until the next garbage collection.
* Move reusable code from RuntimeThread.Windows.cs to RuntimeThread.cs.
* Rename *Core functions to *Internal to be close to CoreCLR implementation.
* Priority is ignored for now.

Fixes for Windows:
* Merge HasFinishedExecution and JoinInternal.
* Handle race condition between JoinInternal and SafeWaitHandle finalizer: SafeWaitHandle.DangerousAddRef may throw an ObjectDisposedException.
* Handle Interop.mincore.CreateThread returning the NULL handle.
2017-03-14 14:58:29 -07:00
Michal Strehovský 689c732e5d Update CoreCLR.issues.targets (#2960) 2017-03-13 13:35:21 -07:00
Aditya Mandaleeka 4e89af8d67 Merge pull request #2881 from adityamandaleeka/corert_dumps
[WIP] Enable dump generation/analysis/retention for tests on Unix
2017-03-10 17:09:46 -08:00
Aditya Mandaleeka 23d9ffbd64 Implement core dump generation/handling for CoreCLR tests. 2017-03-10 16:18:38 -08:00
Michal Strehovský e01b373647 Emit open instance delegate thunks (#2935) 2017-03-09 21:43:46 -08:00
Simon Nattress 0c3166dc13 Fix generics with TLS fields in multi-module
The previous commit to add multi-module support for thread statics
(https://github.com/dotnet/corert/commit/be92d719) has a small issue
causing a link failure if the generic type containing the thread-static
field was instantiated in multiple modules.

That commit changed from referring to the thread static base directly to
referring to the type thread static index, which is looked up on a list
reached through the type manager. This mechanism ensures that even
though we put a copy of the static base in multiple object files, we'll
unify because the thread static index nodes are COMDAT folded. The
ThreadStaticsNodes themselves can't be folded since they're embedded
objects in a list, so change the naming to make them unique across
modules.
2017-03-09 16:13:53 -08:00
Michal Strehovský 2a2a698372 Fix vtable stability issue with shared code (#2921)
Pull request #2096 made sure that lazily built vtables of `Foo<X>` and
`Foo<Y>` contain the same entries if their canonical forms are the same,
but didn't make sure the order of the entries is the same. This can lead
to bugs at runtime where the wrong slot is used to dispatch a virtual
method call. To make sure the vtables look the same, we need to also
sort the vtable.
2017-03-08 13:46:28 -08:00
Michal Strehovský ccf4be8116 Consider types loaded with LDTOKEN "constructed" (#2907)
In Project N NUTC compiler, these types are considered "visible by
reflection" and as such, all bets as to what the code is going to do
with it are off. Whole program analysis could potentially optimize which
ones really need to be considered constructed (e.g. we often take an
EEType only to compare it with some other EEType), but that's a possible
optimization for the future.
2017-03-06 14:28:49 -08:00
Sergiy Kuryata 7423e48369 Merge pull request #2880 from adityamandaleeka/update_runtest_from_coreclr
Port some changes to runtest from CoreCLR
2017-03-04 14:05:54 -08:00
Michal Strehovský 3b66085793 Fix casting arrays to non-variant interfaces (#2872)
The runtime has a special set of rules for casting array types. Array
can be cast to various non-variant generic interfaces without triggering
an exception. Note this does not violate type safety because the safety
is enforced at the array store operation level.

The fix is twofold:
* Dependency tracking: methods implementing generic interfaces on arrays
should be always considered used (same as we do for variant interfaces).
This has a pretty negative size on disk impact. The work to see if we
can do something about it without adversely affecting compilation
throughput is tracked in #1198.
* EEType emission - this is a separate issue, but related: generic
interface types that can potentially be implemented by an array need to
have the GenericVariance flag set (even if all the parameters turn out
to be non-variant). This is to make casting take a slower path at
runtime that can handle special array casts.
2017-03-03 17:00:23 -08:00
Yi Zhang (CLR) 3c837a0e8c Proper marshalling infrastructure to support by-ref arguments (#2889)
* Support by-ref parameters

* Add infrastructure for by-ref arg/local

* fix bugs

* make all tests pass

* add some comments

* add test

* address comments

* rename NativeType to NativeTypeKind
2017-03-03 14:09:10 -08:00
Alan Lawrence 8220265eaf Fix Globalization CompareInfo.Dummy.cs; conditionalize tests in KnownGood (#2882) 2017-03-03 06:56:12 -08:00
Aditya Mandaleeka 7c73b74bec Port some of the changes to runtest from CoreCLR. 2017-03-02 18:21:06 -08:00
Aditya Mandaleeka 37a0487736 Check that native binary exists before calling it. 2017-03-02 17:47:09 -08:00
Anton Lapounov feefb48a52 Thread class improvements (#2867)
* Support custom stack size (maxStackSize parameter).
* OOM hardening for new thread starting. Throw ThreadStartException in case of failure.
* Create a new thread suspended and set its priority before resuming it.
* In HasFinishedExecution method handle the case when an external thread died and its Thread object was resurrected.
* Add test cases for resurrected Thread objects and maxStackSize parameter.

Also fix a couple of issues copied from CLR/CoreCLR code:
* Better handle OS threads with intermediate priorities.
* Obtain the actual thread priority from the OS instead of using the cached value.
2017-03-02 21:34:31 +00:00
Aditya Mandaleeka d001ffb5c1 Fix a couple of things in the Unix corerun script (#2866)
* Fix word splitting problem in corerun script.

* Stop copying dlls for tests in Unix corerun script.
2017-03-02 11:34:38 -08:00
Michal Strehovský 6fc6098fe8 Fix delegate creation to shared generic method bodies (#2862)
The delegate creation code path wasn't updated for shared generics:

* We need to use canonical entrypoints and fat function pointers where appropriate
* This required adding infrastructure to track unboxing stubs from shared code.

More work will be needed around here to add support for creating delegates *from* shared code.
2017-03-02 11:04:23 -08:00
Yi Zhang (CLR) 4e481694de Address incorrect IL stub codegen for stind/ldind/stelem/ldelem instructions (#2860) 2017-03-01 15:01:55 -08:00
Fadi Hanna 729b5fd618 Fix for issue 2855: GVM dependency tracking with shared generics. (#2858) 2017-03-01 13:11:23 -08:00
Michal Strehovský 31e1ef00a0 Add type loader support for building ByRef types (#2846)
The CoreRT compiler and runtime have been able to handle this for a
while. The only thing missing (that required us to throw from a place)
was the type loader support.

This adds support for building ByRef types at runtime. I'm not
introducing a native layout representation though, so things like `T&`
won't compile still.
2017-02-28 14:36:11 -08:00
Michal Strehovský 9236677e08 Delete test for unused GVMs
This test outlived its usefulness.
2017-02-28 09:49:44 -08:00
Michal Strehovský 46a895f912 Unblock fat function pointer return buffer tests 2017-02-28 09:45:40 -08:00
Michal Strehovský 23b6467270 Add test for initThisClass from a generic method on a nongeneric type
This doesn't need a runtime lookup, but RyuJIT is asking for one.
2017-02-28 09:40:03 -08:00
Faizur Rahman 77394e5dbc Enable delegate marshalling in non-windows (#2825)
* Enable delegate marshalling in non-windows
* Avoid trashing argument register r8 in RhpCommonStub
2017-02-28 06:53:07 -08:00
Simon Nattress c6c28cdc45 Merge pull request #2844 from nattress/unix_tests_clean_bin
Clean test bin/ and obj/ before running Unix tests
2017-02-27 14:12:31 -08:00
Aditya Mandaleeka ecae005afb Fix uninitialized variable in runtest. (#2842) 2017-02-27 13:51:20 -08:00
Simon Nattress 0996ecb287 Clean test bin/ and obj/ before running Unix tests
Stale obj files were causing MSBuild to skip running ILC. This causes breaks when switching between single-file and multi-module compilation modes.
2017-02-27 13:40:49 -08:00
sergey ignatov 3e057ae6e2 [arm32 unix building] Passing target platform and os to IlcCompiler for cross compiling (#2793)
* Passing target platform&os to IlcCompiler
* Deleted /sys/devices/system/cpu/cache parsing
* Added empty version of InteropThunksHelpers for arm
2017-02-27 08:51:01 -08:00
Michal Strehovský e007adba35 Add test coverage for shared generics in the multimodule test (#2823)
This tests that we generate the same dictionaries in multimodule
scenarios. We currently don't.

This is just so that we don't have a clean precheckin run with shared
generics enabled (because without this change, we do).
2017-02-24 20:36:49 -08:00
Simon Nattress 573a673b04 Linux support for multi-module (#2807)
* Linux support for multi-module

* Alter build integration scripts to support different naming / tool invocations on Linux.
* Add GC / frame info for ELF to the same group as its associated method so it gets Comdat folded properly.
* Add -multimodule switch to runtest.sh to run tests against a shared pre-compiled framework library.
* Update ObjectWriter Nuget package which brings changes need to support Elf Comdat sections.
2017-02-24 19:02:18 -08:00
Anton Lapounov 319b7a9638 Initial RuntimeThread implementation for Windows (#2806)
Initial RuntimeThread implementation.
To do:
* Wait for foreground threads on main thread's exit.
* Support custom stack size (maxStackSize parameter).
* Do OOM/Win32 error hardening for thread starting.
* Handle thread resurrection (check _osHandle for validness).
* Add platform-specific StartCore, JoinCore, and HasFinishedExecution methods for Unix.
2017-02-25 00:11:03 +00:00
Jan Kotas 83afd158b9 Update build tools to latest (#2815)
* Update BuildToolsVersion to latest
* Cleanup CLSCompliant warnings
* Delete workaround that is no longer needed
* Download .NET Core 1.1
* Fix Roslyn props
* MSBuild.exe was renamed to MSBuild.dll
* Fix CoreCLR tests
* Rename netcoreapp12 -> netcoreapp20
* Fix UnitTests runs
* Fix RemoveEmptyFinalizers CodeAnalysis warnings
* Port init-tools.sh cleanup from CoreCLR
2017-02-24 15:36:08 -08:00
Faizur Rahman 5877f29e59 Addressed more feedbacks: Moved TryGetMarshallerForDelegate from TypeLoader to S.P.I 2017-02-23 16:01:08 -08:00
Faizur Rahman 61dbdc79b0 Delegate Marshalling
Initital support for delegate marshalling.

- Enabled only in full runtime
- Doesn't work in non-windows platforms
- Only supports open static delegates
2017-02-23 12:00:20 -08:00
Simon Nattress 2f23ab5181 Allow invalid binaries as input files to ILC (#2787)
Allow invalid binaries as input files to ILC

* Add a hopefully short-term hack which allows files specified as
inputs to ILC to be actually native binaries that we ignore and proceed
with compilation.  The CoreCLR drops we test against contain a mixture
of managed and native binaries in test folders in some cases.

* Add a quality of life switch to runtest.cmd (/CoreCLRSingleTest)
that allows specifying a single CoreCLR test to run by executable path.
This downloads the test blob and sets the correct environment variables
first.

* Fix regular CoreCLR tests caused by batch exploding if it had to deal
with "if not exist ("
2017-02-21 17:10:54 -08:00
Michal Strehovský 78dc8821e5 Enable shared generics test on Unixes (#2790) 2017-02-21 16:34:34 -08:00
Michal Strehovský 399954443e Update CoreCLR.issues.targets (#2784)
Baseline tests newly failing due to #2782.
2017-02-21 14:42:22 -08:00
Simon Nattress fb6a0de002 Upgrade shared EETypeNodes to ConstructedEETypeNode
In multi-module mode, if one obj file defines an EEType as necessary and
another defines it as constructed, they get arbitrarily Comdat folded.
If the incomplete EEType is chosen, we see problems with VTable
dispatch, GC AVs (due to lack of a GC desc). In multi-module mode, if a
type is shareable (a concrete generic instantiation, or a parameterized
type such as `String[]`) upgrade requests for the EETypeNode to
ConstructedEETypeNode.

This causes an increase in Framework.lib from 111MB to 121MB due  to
rooting more full types.

When running CoreCLR tests in multi-module mode, produce the shared framework library first and then prevent each test from generating it. I found that sometimes MSBuild gets confused and thinks it needs to re-generate the lib (despite the inputs and outputs being properly specified) so this makes sure we don't have multiple tests trying to produce the same set of files.
2017-02-21 10:25:03 -08:00
Faizur Rahman 8871ea084f Fix StringBuilder marshalling bug 2017-02-16 23:18:55 -08:00
Simon Nattress 48a76d0ca3 Merge pull request #2765 from nattress/coreclrmultimodule
Enable multi-module for CoreCLR tests
2017-02-16 22:05:25 -08:00
Simon Nattress a279eea038 Enable multi-module for CoreCLR tests
* Allows runtest.cmd /multimodule /coreclr
* Modify build integration targets to allow for tests with multiple
assemblies. We have two set of assembly inputs to ILC: @(ManagedLibrary)
which despite being an Item contains the main managed assembly to use as
the template name for the response file and output object file base
name. @(IlcCompileInput) is the list of assemblies that are inputs to
Ilc. This change allows us to compile all the app assemblies into a
single object file.
* Specify the inputs / outputs to the MSBuild task that builds the
framework assembly obj files. This removes a page of spam per test when
MSBuild skips over the already-built obj files.
* Currently 12 tests fail due to some EH issue that needs investigating.
2017-02-15 18:24:41 -08:00
Fadi Hanna 3c8f0b2f21 Enabling GVM target resolution (hookup work) (#2635)
Enabling GVM target resolution (hookup work)
2017-02-15 17:10:46 -08:00
Michal Strehovský 1356349d76 Implement RuntimeFieldHandle (#2760)
This enables "ldtoken *field*" IL instruction.
2017-02-15 14:15:38 -08:00
Michal Strehovský 3ecc7c0649 Merge pull request #2743 from MichalStrehovsky/calliTransform
This also fixes an NYI in CorInfoImpl around getting a fat function pointer from non-shared code I hit while writing tests.

This needs very unfortunate special casing when processing relocs since references to fat function pointer symbols need to set the second lowest bit to indicate the fact. I tried to make the FatFunctionPointer node define a symbol at the adjusted location but this hits an object writer limitation that it can't define a new symbol in the middle of a reloc.

Returning structs has problems (I will file an issue for those). The tests are commented out.
2017-02-14 10:07:03 -08:00
sergey ignatov df1b120dee Fixes for cross building corert tests for arm architectures on Linux (#2682) 2017-02-14 06:32:48 -08:00
Jan Kotas 7894f6951b Upgrade .NET Core NuGet packages to latest versions (#2667) 2017-02-14 06:11:49 -08:00
Michal Strehovský 4a1c01ea8b Stop emitting transformed calli instruction 2017-02-13 13:59:21 -08:00
Michal Strehovský e87057dd27 Update CoreCLR.issues.targets (#2732)
This regressed when I replaced the "intrinsic but doesn't work for
shared generics" version of `Activator.CreateInstance<T>` with the
"non-intrinsic but works with shared generics" version. There's a
workitem tracking the codegen work to make an intrinsic version in
RyuJIT, so I'm disabling the tests against that.
2017-02-10 18:16:38 -08:00
Koundinya Veluri 9c9fc5c376 Add wait subsystem for Unix (#2686)
- See comment at the top of WaitSubsystem.Unix.cs for details
- Refactored WaitHandle and derived classes, and RuntimeThread, to separate platform-specific functionality
- These changes have only been tested to the extent of public APIs currently available. They have not yet been tested with multiple threads, and several features such as sleep, interrupt, signal-and-wait, mutex abandoning, etc., have not yet been tested. More tests will be coming after Thread is made available in CoreRT.
2017-02-10 17:58:45 -08:00
Faizur Rahman 6ffbe7a5d7 Implement Non-Blittable Array Marshaller 2017-02-08 16:27:54 -08:00
Michal Strehovský 2c0a9884e7 Fix MDArray Address method for shared generics (#2646)
I admit this required special casing in places I don't like, but the
`Address` methods on multidimensional arrays are... well, special.

The problem with the `Address` method is that it needs to do an exact
type check in it's body - the array element type that is expected at the
callsite needs to match the runtime type of the array passed in. We need
this because of array covariance (`string[`]` is allowed to be cast to
`object[,]` and we need to disallow making a `ref object` to an array
element if the runtime type of the array is not exactly `object[,]`).

This changes mirrors how Address methods get compiled on CoreCLR. The
story begins at the callsite:

1. We tell the codegen in `getCallInfo` that `Address` is a method that
requires an instantiation argument (just like e.g. static methods on
shared generic types), but disallow inlining it so that we are forced to
generate a standalone body. Method's owning type becomes the
instantiation argument.
2. We make sure the dependency tracking doesn't track the `Address`
method as a runtime determined method. It's difficult to represent it in
the RuntimeDetermined infrastructure (for the simple reason that
RuntimeDetermined types need to be DefTypes). We can get away with it
because the `Address` method doesn't actually do generic lookups anyway.
3. When we get to compile the method body, we pull the old switcheroo
and replace the method with one that has the instantiation argument in
the signature (so that we can refer to the argument from IL). We then
use the hidden argument to do the type check within the method body.
2017-02-03 09:40:24 -08:00
Michal Strehovský 51c908dbc8 Skip shared generics test in multifile test runs (#2647)
I know it's not very systematic, but will go away when we enable shared
generics by default.
2017-02-02 16:26:03 -08:00
Simon Nattress eac5c5cb2b Don't add VTable for Finalize method in multi-module (#2621)
* Don't add VTable for Finalize method in multi-module

Finalize is not added to the VTable with the CoreRT runtime; instead it
is added after the VTable in conjunction with an EEType flag to save
VTable space. In multi-module library mode with eagerly built VTables,
skip the Finalize method (since it appears in the type system as a
virtual on `System.Object`).

Add a test to validate finalizers are run.

* Throw exception if code callvirts `Object.Finalize`
* Add `IsFinalize` to `MethodDesc`
2017-02-01 12:49:38 -08:00
fadimounir c21e8f5a91 Enabling some RuntimeMethodHandle tests 2017-01-31 11:14:32 -08:00
Michal Strehovský 8b593ab559 Fix Generics test (#2611)
The fact we could reflection enable two instantiations of a method
relied on pure luck on which invoke stub we choose to invoke the method.
If we chose the one for `object`, we could use it to invoke the method
instantiated over `string`. We ran out of luck in postcheckin.

I'm fixning the test to only have one generic method instantiation to
make it pass again to keep coverage for the other interesting cases.

Making this actually work depends on the "Use type loader to build
invoke stub dictionaries" workitem. Requires type loader.
2017-01-27 15:58:44 -08:00
Michal Strehovský 20f44aaba3 Update CoreCLR.issues.targets (#2609) 2017-01-27 12:38:18 -08:00
Michal Strehovský af5d9aec0d Add instantiating unboxing stubs (#2566)
To support calling canonical interface methods on generic valuetypes,
the compiler needs to generate unboxing+instantiating thunks that bridge
the difference between two calling conventions.

As a refresher:
* Instance methods on shared generic valuetypes expect two arguments
(aside from the arguments declared in the signature): a ByRef to the
first byte of the value of the valuetype (`this`), and a generic context
argument (EEType)
* Interface calls expect `this` to be a reference type (with the generic
context to be inferred from `this` by the callee)

Instantiating and unboxing stubs bridge this by extracting a managed
pointer out of a boxed valuetype, along with the EEType of the boxed
valuetype (to provide the generic context) before dispatching to the
instance method.

We compile them by:
* Pretending the unboxing stub is an instance method on a reference type
with the same layout as a boxed valuetype
* Having the unboxing stub load the `m_pEEType` field (to get generic
context) and a byref to the actual value (to get a `this` expected by
valuetype methods)
* Generating a call to the instance method on the valuetype through a
wrapper that has an explicit generic context parameter in it's
signature.
2017-01-27 12:03:08 -08:00
Michal Strehovský a3c04ce3c2 Make reflection invoke work for valuetype instance methods (#2596)
This is a bunch of things:

* Make the reflection dynamic invoke thunk use the transformed calli
intrinsic to do the call (to handle fat function pointers)
* Generic dictionary nodes are prefixed with the hash code, but I put
the padding in the wrong location. That's what I get for writing code
off memory without crosschecking with Project N binder...
* Make MethodCodeNode depend on it's unboxig stub. This is in the hacky
section with a big comment explaining why we need it for now. (Method
being compiled determines it's reflectability.)
* Emit a pointer to the unboxing stub in the reflection mapping table if
needed.
* Remove a another usage of GetRvaFromIndex from the type loader
* Add a test
2017-01-27 11:51:33 -08:00
Michal Strehovský e37eb55c7e Report CUSTOMLAYOUT and OVERLAPPING_FIELDS to RyuJIT (#2605)
Fixes #2362.
2017-01-27 03:16:03 -08:00
Simon Nattress 7dd838e150 Enable multi-module on Windows (#2586)
* Enable multi-module on Windows

Enable multi-module compilation for tests in CI through a new switch:
`runtest.cmd /multimodule`. This will compile the framework assemblies
into a single Framework.lib that tests are linked against.

* Adjust several dependency nodes in the compiler to tidy up sharing of
nodes / naming for uniqueness.
* Add handling in ObjectWriter for compiler generated types and their
methods to force sharing.
* Ifdef out runtime imports for StdCall which are implemented in
Native.Interop, a library that hasn't been ported to CoreRT yet.
* Remove metadata generation for type args to an instantiation. This was
breaking type unification because we were treating type args as type
defs, even when they are present in another module and we weren't
emitting the actual EEType, causing a null type handle at runtime.
* Alter build integration MSBuild authoring to produce the framework lib
in multi-module builds on demand. By default, the lib is emitted in the
app binary folder. For test runs there are overrides to control where
the framework objs and lib are placed so they can be shared
(`FrameworkLibPath` and `FrameworkObjPath`).
* Alter test harness to take `/multimodule` switch which links all
Ryujit applicable tests against Framework.lib.

* CR Feedback

* Remove TypeSystem.Ecma reference and use IAssemblyDesc instead
* Move check for CompilerGeneratedType to ObjectWriter and check the
module against the generated assembly when determining shareability

* Always generate static bases for library modules

Fixes issue https://github.com/dotnet/corert/issues/2568 where static
fields that aren't referenced anywhere in a module compiled as a library
won't get their static base generated in the image. This causes link
failures when an app is built against the library.

Added a test that is compiled as two separate modules and linked
together.

* CR Feedback II

Fix release Windows multi-module compilation. The __managed_code_a and _managed_code_z bookends were being collapsed into one by the linker. We then told the code manager there were 0 bytes of managed code and EH broke. Fixed to give each book-end symbol a unique value so the linker won't fold them.
2017-01-26 23:15:05 -08:00
Sergiy Kuryata 974c94b60c Merge pull request #2598 from MichalStrehovsky/logErrorCode
Log test exit code to stdout
2017-01-26 14:30:36 -08:00
Michal Strehovský ed815ffcca Delete Add1 and Formatting tests (#2597)
These tests provide little value at this point in the product
development and deleting them speeds up dev workflow by ~20-30 seconds.
2017-01-26 13:59:31 -08:00
Michal Strehovský 9a2fe3a1df Log test exit code to stdout
Might be helpful in rootcausing mysterious process exits.
2017-01-26 13:52:23 -08:00
Simon Nattress f2a054fd3d Merge pull request #2580 from nattress/groovymultimodule
Staging commit for upcoming multi-module CI change
2017-01-25 09:39:35 -08:00
Simon Nattress 54213f9bf1 Staging commit for upcoming multi-module CI change
My upcoming PR for multi-module testing support needs the CI authoring
done one PR early since netci.groovy is always pulled from HEAD (not the
changes in a pending PR).

Call `runtest.cmd` with the new `/multimodule` switch during Windows CI
runs. Currently the switch causes the test script to immediately return
with success.
2017-01-24 19:05:15 -08:00
Jan Kotas 4b10ccca96 Merge pull request #2578 from dotnet/nmirror
Merge nmirror to master
2017-01-24 18:29:07 -08:00
Jan Kotas 9271b7edd0 Change stackwalking to always use unadjusted IP
Handling of hardware exceptions had a hack to add +1 to the actual instruction IP. Windows x64 unwinder
is disassembling instructions at the IP passed in to detect method epilogs. If the bytes at IP + 1
happened to match the epilog pattern, the unwind is done as if we were in the middle of the epilog that
lead to spectacular crash.

This change is moving this adjustment to be done later for EH related things only, and not interfere
with stackwalking.

Fixes #2535

[tfs-changeset: 1645602]
2017-01-24 17:45:59 -08:00
Faizur Rahman d118bb2000 Select appropriate marshaller based on MarshalAs attribute
The change contains the following:

- Select marshaller based on MarshalAs attribute
- Indentify In/Out/Ref and have the infrastructure to marshal based on
them.
2017-01-24 15:20:37 -08:00
Simon Nattress a8e8302065 Merge pull request #2553 from nattress/coreclrtests_unix
Run CoreCLR tests on Unix
2017-01-20 15:29:06 -08:00
Faizur Rahman 9428dfa773 Fix PInvoke CPPCodegen
This change contains the following:

1. Fixed out SafeHandleMarshaller with CPP codegen as Sedar pointed out.
2. Also enable PInvoke test with CPP Codegen. The generic method
ThrowIfNotEquals doesn't work with CPPCodegen. So temporary created
overrides to address this.
2017-01-20 13:57:56 -08:00
Simon Nattress 14e3ad3e69 Emit correct log file name
Rename test results log to `testResults.xml` to be picked up by CI.
Place log file under bin/Logs so it’s in a standard place for this repo.
2017-01-20 13:44:53 -08:00
Simon Nattress f7061a317a Run CoreCLR tests on Unix
Add scripting for Linux / OSX to download the pre-compiled CoreCLR tests and run them.
Top200.unix.txt contains the set of top 200 tests run on Windows that also pass on Unix systems.
2017-01-20 11:52:26 -08:00
Simon Nattress d9459c0e69 Unix CoreCLR tests CI authoring
Author the CI netci.groovy changes along with a stubbed out `runtest.sh
-coreclr top200` implementation so that the actual PR containing the
test changes will run. This is needed to ensure we don’t break the
build since netci.groovy changes aren’t picked up in a PR (CI takes
netci.groovy from HEAD).
2017-01-19 14:57:19 -08:00
Michal Strehovský 7f4560bdec Fix handling of constrained method calls from shared generic code (#2527)
Don't track runtime determined dependencies if we're generating a call
to a constrained method.

The more complicated case is tracked in #2526.
2017-01-19 13:36:23 -08:00
Faizur Rahman ae6d335f72 Implement out SafeHandle marshaller 2017-01-18 22:50:39 -08:00
Simon Nattress 097568046b Allow tests to run in internal branches (#2539)
`dir.props` loads the parent folder `dirs.props`. This is used when
CoreRT is built as a part of another source tree. When building CoreRT
with its own build system, any MSBuild invocation needs to set
`RepoLocalBuild` to `true` to avoid dragging in an unexpected set of
MSBuild configuration. Update the the standard and CoreCLR test
harnesses to pass in `RepoLocalBuild=true` to MSBuild as a command-line
property.
2017-01-18 15:46:25 -08:00
Jan Kotas 4a25645832 Disable tests against issue 2535 (#2537) 2017-01-18 14:14:41 -08:00
Michal Strehovský d06f5d39a0 Update CoreCLR.issues.targets (#2522) 2017-01-17 15:03:38 -08:00
Michal Strehovský 896ed6bd6a Update CoreCLR.issues.targets (#2512)
The AboveStackLimit test was enabled with #2467, but it's still having
issuse (non-trivial marshalling this time).
2017-01-14 21:23:41 -08:00
Michal Strehovský 59133e10e2 Add support for thread static base dictionary lookups (#2479)
This adds support for generating helpers and dictionary entries to
support thread static base lookups for generic types in shared generic
context.

I slightly tweaked how dictionary slots get emitted because the "every
slot is an `ISymbolNode`" paradigm wasn't very flexible.
2017-01-12 10:00:07 -08:00
Jan Kotas f0d63cfe9a Fold issue 2463 into general "pay for play reflection" bucket (#2472) 2017-01-09 15:11:15 -08:00
Jan Kotas 56161fc92b Implement canSkipMethodVerification (#2467)
The JIT calls this when it hits internal limitations to decide whether to retry with optimizations off; or whether to stay on the safe side and give up in partial trust environments.

Fixes #2462
2017-01-09 10:13:54 -08:00
Faizur Rahman 058296779d Merge pull request #2452 from shrah/master
Implement SetLastError DllImport flag functionality
2017-01-07 23:26:25 -08:00
Faizur Rahman 1ed5178661 Implement SetLastError DllImport flag functionality
Call PInvokeMarshal.SaveLastWin32Error after the P/Invoke call to ensure
the last error is saved in thread local variable which can be later
accessed through PInvokeMarshal.GetLastWin32Error.

Additionally, I have rename ParameterAttributes to
ParameterMetadataAttributes to avoid the confusion with
System.Reflection.ParameterAttributes.

This change also makes sure PInvoke works on Unix and also get rids of
build warning on windows.
2017-01-07 22:56:38 -08:00
Jan Kotas 2fa81459e9 Prune list of failing CoreCLR tests (#2465) 2017-01-07 12:07:56 -08:00
Jan Kotas df6eaf00c8 Update test projects to NS1.6 to expose more public surface 2017-01-06 11:15:09 -08:00
Michal Strehovský 0ff64c1e90 Remove blocking of #2290 (#2449)
These tests are validated as fixed.
2017-01-05 17:02:38 -08:00
Faizur Rahman c5d1e15d63 PInvoke infrastructure change
This is the first iteration of PInvoke change which ensures right
infrastructure is in place for future PInvoke changes. It doesn't
add any new PInvoke features, but makes sure all the existing ones
are working. I have also added a testcase.
2017-01-05 11:40:09 -08:00
Jan Kotas 0c5c048813 Update list of failing CoreCLR tests (#2397)
Update list of failing CoreCLR tests
2016-12-20 07:29:52 -08:00
Jan Kotas 65846c0008 Unconditionally disable incremental linking on Windows (#2376)
The runtime is not compatible with jump stubs inserted by incremental linking, and it does not seem to be helping us much anyway.

Fixes #2348
2016-12-19 08:19:40 -08:00
Jan Kotas 301a7e28ef Add missing type checks to RyuJIT unbox helpers (#2378)
Fixes #2357
2016-12-18 22:37:33 -08:00
Simon Nattress 926f297d29 Compile BuildFrameworkNativeObjects test libraries in parallel (#2373)
MSBuild parallelizes at the project level (though there are third party
extensions that allow parallelism at the task level). Build each of the
framework assemblies by batching on `@(IlcReference)` with a custom
target that invokes the `<MSBuild>` task.

On a hyper-threaded i7-6700 it reduced `BuildFrameworkNativeObjects` run time from 67s to 17s.
2016-12-16 19:04:56 -08:00
Michal Strehovský 4058c4a857 Update CoreCLR.issues.targets (#2263)
This was rather annoying, but we should be able to get a clean run with KnownGood set of test. It still does take around 4 hours to run them on my quad core i7 so we probably don't want them to run in CI.
2016-12-16 16:23:22 -08:00
Simon Nattress d84f5310c8 Merge pull request #2317 from sergiy-k/threadstatics1
Implement basic support for thread static fields
2016-12-16 14:31:55 -08:00
Michal Strehovský 8246678763 Implement ldvirtftn in shared generic contexts (#2339)
* Static methods on generic types use the type's generic dictionary

Dependency analysis was incorrectly assuming these have their own
dictionary (they don't).

* Emit R2R generic helpers for ldvirtftn
2016-12-15 13:44:22 -08:00
Sergiy Kuryata c84bb4e535 Implement basic support for thread static fields
This change implements basic support for thread static fields. Most things
are already functional, performance could definitely be improved in the
future but it should be sufficient to get things off the ground.

This code passes CoreRT and Top200 CoreCLR tests on Windows. The
BasicThreading test in this change verifies that thread static fields work
for both non-generic and generic types in the single-threaded and
multi-thread environment (using Tasks).

One thing that does not work yet is multi-module compilation because the
driver creates a separate ReadyToRun helper for a type in every module
that accesses thread statics of the type. I am currently working on fixing
this.

The existing code has already implemented a good chuck of required
functionality so this simply builds on top of that.
Each module has a ThreadStatic region. Each entry in the region points to
an EEType that represents a GC map for the thread static fields of a given
type. The index of the entry in the region is the TLS index of the type.
The TypeManager indirection node of the module has been extended to
contain the index of the module in addition to a pointer to the type
manager (which is also used for initialization on first access).

The generated ReadyToRun helpers (that return thread static base for a
type) look like this:

__GetThreadStaticBase_System_Private_CoreLib_System_Threading_ManagedThreadId:
48 8D 0D BD E0 39 00 lea         rcx,[__typemanager_indirection
(07FF70D68AD58h)] <= module information (type manager, module index)
BA 03 00 00 00       mov         edx,3 <= TLS index of the type
E9 33 FB E4 FF       jmp
System_Private_CoreLib_Internal_Runtime_ThreadStatics__GetThreadStaticBaseForType
(07FF70D13C7D8h)
2016-12-08 20:26:15 -08:00
Chris Rummel eec701888e Enable pipebuild in CoreRT (#2299)
* Fix getting test root on Mac and Linux pipeline builds.

* Add clean scripts for CI to use.
CI is slightly different from a normal user scenario because
it will often be cleaning right after another build before
VBCSCompiler.exe is killed automatically.

* Add checked-in build definitions for pipebuild.
2016-12-06 13:08:02 -08:00
Jan Kotas eae9d0744e Skip duplicate EH clauses (#2288)
- Update RyuJIT to pick up the actual fix
- Remove TODO and add assert to verify there are no duplicate clauses

Fixes issue #2262
2016-12-02 11:29:42 -08:00
Petr Onderka 03c8c58503 Use invariant culture in test (#2289) 2016-11-30 15:50:03 -08:00
Jan Kotas 79ef1b7499 Update RyuJIT (#2276)
Fixes https://github.com/dotnet/corert/issues/2255
2016-11-29 09:24:03 -08:00
Michal Strehovský fdc18586e6 Implement Type.GetType expansion (#2247)
`Type.GetType` needs to be compiled specially since for inputs that are
not assembly-qualified, the method is expected to search the calling
assembly.

The way we do this is by introducing a concept of callsite-specific
intrinsics. The expansion of these intrinsics depends on the callsite
from which the intrinsic is called.

We make calls to `Type.GetType` expand to overload+assembly specific
`ILStubMethod` that thunks to a helper that consumes a "default assembly
argument" in addition to the regular arguments.
2016-11-28 13:58:08 -08:00
Michal Strehovský d0938f132e Clean up native artifacts on build failure (#2273) 2016-11-28 12:48:54 -08:00
Jan Kotas da458b25ee Store the relocation offset delta in the code stream (#2271)
RyuJIT depends on the relocation offset delta to be stored in the code stream because of it applies additional fixups to it.

Tweak the list of Top200 tests to include coverage for this issue.

Fixes #2254
2016-11-26 16:12:10 -08:00
Michal Strehovský cac5d0efe2 Implement Exception.get_StackTrace (#2240)
This relies on the existing logic that tries DIA first, and then falls
back to reflection metadata to find method names. If fallback fails, you
get RVAs. Conveniently, the DIA path doesn't even try to run.
2016-11-21 15:53:33 -08:00
Michal Strehovský 50043ed573 Make tests with managed/unmanaged dependencies work (#2236)
Some tests have more artifacts than just the test EXE.

* Pass all DLL files to ILC (technically, we only need managed DLLs, but
this shouldn't hurt)
* Copy all DLL files to the output directory (technically, we only need
native DLLs, but this shouldn't hurt)
2016-11-21 15:46:06 -08:00
Michal Strehovský 28e86fd6d1 Fix passing parameters to tests (#2233)
`shift` doesn't actually affect the `%*` so unfortunately we need to do
a bunch of weirdness to skip over the first two parameters.
2016-11-18 14:15:47 -08:00
Michal Strehovský a58b0ffaf3 Update CoreCLR.issues.targets (#2231) 2016-11-17 16:40:32 -08:00
Michal Strehovský 6563e9ce1c Implement reflection field get/set (#2225)
For now, it's for instance fields only. I decided to make a slight
change to the format to avoid a usless indirection through the external
reflerences table to get the field offset. We might want to port that to
Project N too...
2016-11-17 08:32:52 -08:00
Simon Nattress ddee7c8878 Allow GVMs to be present on types
In order to compile larger bodies of code (such as XUnit) without full
GVM support, emit a R2R helper at GVM callsites that fails fast at
runtime. I left the check for GVMs in-place in
`ConstructedEETypeNode.OutputVirtualSlots` to make sure we don't
actually put them in the VTable since they'll eventually be dispatched
via a lookup table.
2016-11-15 17:45:22 -08:00
Michal Strehovský 77d17f08ab Fix walking base hierarchy when computing dictionary slots (#2193)
When the generic ready to run lookup helper needs to know the generic
dictionary vtable slot, it passes the canonical type to the helper that
determines the slot. `GetNumberOfBaseSlots` needs to be able to deal
with this, and the fact that the slots might be lazily determined.

Converting to canon fixes this due to how we ensure canonically
equivalent types have the same vtable in #2096. The other option would
be to back out that change and completely revamp how we do lazy slots
for generic types.

I found this when I ran the reflection invoke test with shared generics
enabled.
2016-11-12 11:34:06 -08:00
Simon Nattress 2dbfe4b4d7 Fix CPP test warning on Windows (#2190)
We pass in /MTd flag to cl.exe when running tests but unconditionally
pass /MD for all compilations using the BuildIntegration targets. Pass a
more constrained property `UseDebugCrt` and select the appropriate
switch in the build targets.
2016-11-11 17:30:49 -08:00
Simon Nattress c49f5e60bb Add regression test 2016-11-11 16:20:08 -08:00
Simon Nattress 6ea22838a1 Output multi-module test .obj files to obj/[config]/native (#2171) 2016-11-08 17:35:18 -08:00
Michal Strehovský c9b075dea3 Enable reflection invoke (#2162)
This is basically three parts:

* Generate a mapping table of method entrypoints to their metadata.
* Generate invocation stubs to lay out `object[]` arguments passed to `MethodBase.Invoke` on the stack.
* A small test.

Only methods that were compiled are eligible to be added to the map.
2016-11-08 14:45:26 -08:00
Michal Strehovský 0bd288fca3 Call the slow helper from delegate .ctor method (#2131)
This lets us get at least some test coverage for delegate invocation in
shared generics mode before #2102 gets fixed.
2016-11-08 09:41:20 -08:00
Michal Strehovský ebfaf1d3d5 Disable shared generics test on OSX (#2164) 2016-11-08 08:11:33 -08:00
Simon Nattress a9ec5fdf2e Multi-module framework assembly compilation
Enable compiling all framework / SDK assemblies in multi-module library
mode

Add a work-around to compile System.Console as a library in PInvokeILEmitter.cs

System.Console has a p/invoke to GetLargestConsoleWindowSize which
returns a COORD struct containing two 16 byte ints.  The struct return
type prevents the JIT from emitting an inline p/invoke in the IL stub we
generate and instead it treats the external p/invoke target as a managed
call and tries to compile it.  Force p/invokes returning structs to use lazy p/invokes. These use Calli, which the JIT allows to always be inlined.

For p/invokes, set CorJitFlag.CORJIT_FLG_IL_STUB JIT flag, which is required to allow us to always inline p/invokes.

Address library module compilation failures due to unsuccessful type
loads by checking on EEType creation whether the type can be loaded
sufficiently to write out the EETypeNode. Code for this stolen from one of Michal's previous PRs :)

Eagerly create EETypeNodes in ReadyToRunHelperNode so the failure point
happens during the referencing method compilation, not later on when
emitting the graph

Check method signatures on library compilation method rooting

Methods whose signatures contain types that cannot be loaded (they are
in a separate, non-existent assembly for example) should be skipped
since we cannot even replace their IL body with a throw helper. The JIT
will fail trying to getClassAttribs on the argument types.

This check is done when rooting methods instead of in MethodCodeNode's
constructor because MethodCodeNodes are created during graph sweeping
for things like virtual method combined dependencies.

Add a test that verifies we can compile all framework assemblies to their own separate object files successfully.

Don't check base types for generic type defs
Only check static field layout for types with deferred cctors
Move CheckCanGenerateMethod into MultiFileCompilationModuleGroup and
scope its checks to just what the JIT requires (whether each type
contains GC Pointers).
Scope the type checking for static base ReadyToRunHelpers to just
`ComputeStaticFieldLayout
2016-11-04 18:56:48 -07:00
Michal Strehovský 1b11e76bd6 Enable vtable layout test (#2103) 2016-10-28 14:54:16 -07:00
Simon Nattress 68e6999b71 CoreCLR Test Subset Selection (#2089)
Provide a choice of different sets of the CoreCLR test tree to run:
- Top200 tests selected from the various areas of the test tree intended to give broad coverage quickly
- KnownGood tests; the set of tests validated as passing on CoreRT
- All CoreCLR tests (Many of which are known to fail)

Make /mode <ryujit|cpp> actually work with local tests (useful for getting test rsp or artifacts of Ryujit tests without the cpp mode blowing them away).

Clean up test documentation to reflect what the test harness does these days.

* Allow tests to be specified inclusively

Expand the test selection process to allow tests to be included instead
of just excluding from all found cmd files.
If at least one test is included via <IncludeList />, skip scanning the
test tree for *.cmd and only take explicitly included tests.  Exclusions
can still be applied to these tests and will override inclusions.
2016-10-28 14:54:03 -07:00
Michal Strehovský 4455a9e0d9 Add shared generics test to CI (#2098) 2016-10-28 04:40:25 -07:00
Jan Kotas 9a252d483e Pickup newer corefx bits (#2088)
* Pickup newer corefx bits
* Fix new line expected by the test. Console is using the correct new line character on Unix now.
2016-10-27 18:36:06 -07:00
Simon Nattress 70d3c355df Remove absolute path from test script 2016-10-17 20:27:13 -07:00
Simon Nattress d55d5dee5c Fix a couple absolute paths and remove CoreCLRTestLibrary
TestLibrary is available in test drops under
Common\Desktop.Coreclr.TestWrapper so use that and remove the
TestLibrary source from our branch.
2016-10-17 14:33:25 -07:00
Simon Nattress 6daef3b026 CoreRT scripting to run CoreCLR tests
The CoreCLR CI machine archives test binaries in a zip file to share
with other parts of the build. CoreCLRTestsURL.txt contains a specific
test drop from a built marked for permanent retention on the Jenkins CI
box.

Modify runtest.cmd to take /CoreCLR switch which will download the
CoreCLR tests, unzip them, and run them using CoreRT.
build-and-run-test.cmd is used as the test runner, and is used to
generate CoreRT binaries for the tests before executing them. CoreRT is
run via the MSBuild targets by placing a placeholder csproj next to the
test binary.  To save CI storage space, the native artifacts (which are
about 30-50MB per test) are cleaned after running the test.

Currently 130 simple JIT tests are selected to run using
Top100Tests.issues.targets
2016-10-13 18:43:27 -07:00
Simon Nattress 7a1c65e092 Port CoreCLR test execution scripting
About two thirds of this is needed to build XUnit wrappers in the CoreRT
branch so we can filter tests with exclusion files.
2016-10-13 18:38:33 -07:00
Jan Kotas 29ff4ec4e5 Work towards enabling Ubuntu 16.04 build (#2000) 2016-10-10 15:09:26 -07:00
David Wrighton 6870472d66 Add ConsoleLoggerParameters:ForceNoAlign to build.cmd script (#1936)
- Allows copy paste of long strings from cmd.exe window in useful ways by disabling the line truncation that msbuild.exe does by default
2016-09-28 10:33:48 -07:00
Jan Kotas 45a0b60f3e Update buildtools to 1.0.26-prerelease-00809-01 (#1922) 2016-09-26 18:17:51 -07:00