diff options
author | Jan Kotas <jkotas@microsoft.com> | 2015-12-01 10:12:23 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2015-12-18 01:31:34 +0300 |
commit | 5323536d0b3dfbe8ea28b9adc1812677317d8392 (patch) | |
tree | 98f21149a5f11031f8367f92953eb0c8cf72073f /src/Native | |
parent | 48eb9926db083dadb98fc0e676449ffa3e9465a6 (diff) |
Native compilation of Runtime.Base
- For now - until we have the proper multifile compilation in place, link the Runtime.Base .cs files into System.Private.CoreLib. The proper factoring of Runtime.Base is still guaranteed by building Runtime.Base as separate .dll.
- Remove many stubbed out helpers since the proper implementation is comming from Runtime.Base now.
- Fix CppCodeGen to deal with same RuntimeImport being used with different signatures (e.g. RpNewArray is imported under two different signatures in System.Private.CoreLib)
Diffstat (limited to 'src/Native')
-rw-r--r-- | src/Native/Bootstrap/main.cpp | 108 | ||||
-rw-r--r-- | src/Native/Runtime/EHHelpers.cpp | 2 | ||||
-rw-r--r-- | src/Native/Runtime/portable.cpp | 101 |
3 files changed, 49 insertions, 162 deletions
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp index 29afcc217..ffa123cac 100644 --- a/src/Native/Bootstrap/main.cpp +++ b/src/Native/Bootstrap/main.cpp @@ -279,86 +279,39 @@ extern "C" void Buffer_BlockCopy(class System::Array * src, int srcOfs, class Sy memmove((uint8_t*)dst + 2 * sizeof(void*) + dstOfs, (uint8_t*)src + 2 * sizeof(void*) + srcOfs, count); } -extern "C" Object* RhMemberwiseClone(Object*) -{ - throw "RhMemberwiseClone"; -} - -extern "C" uint8_t RhGetCorElementType(MethodTable*) -{ - throw "RhGetCorElementType"; -} - -extern "C" MethodTable* RhGetRelatedParameterType(MethodTable*) -{ - throw "RhGetRelatedParameterType"; -} - -extern "C" uint16_t RhGetComponentSize(MethodTable*) -{ - throw "RhGetComponentSize"; -} - -extern "C" uint8_t RhHasReferenceFields(MethodTable*) -{ - throw "RhHasReferenceFields"; -} - -extern "C" uint8_t RhIsValueType(MethodTable*) -{ - throw "RhIsValueType"; -} - -extern "C" uint8_t RhIsArray(MethodTable*) -{ - throw "RhIsArray"; -} - -extern "C" int32_t RhGetEETypeHash(MethodTable*) -{ - throw "RhGetEETypeHash"; -} - -extern "C" uint8_t RhTypeCast_AreTypesEquivalent(MethodTable*, MethodTable*) +extern "C" void RhGetCurrentThreadStackTrace() { - throw "RhTypeCast_AreTypesEquivalent"; + throw "RhGetCurrentThreadStackTrace"; } -extern "C" uint8_t RhTypeCast_AreTypesAssignable(MethodTable*, MethodTable*) +extern "C" void RhpGetDispatchCellInfo() { - throw "RhTypeCast_AreTypesAssignable"; + throw "RhpGetDispatchCellInfo"; } - -extern "C" void RhGetCurrentThreadStackTrace() +extern "C" void RhpUpdateDispatchCellCache() { - throw "RhGetCurrentThreadStackTrace"; + throw "RhpUpdateDispatchCellCache"; } - -extern "C" intptr_t RhHandleAlloc(Object * pObject, int type) +extern "C" void RhpSearchDispatchCellCache() { - return (intptr_t)CreateTypedHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pObject, type); + throw "RhpSearchDispatchCellCache"; } - -extern "C" intptr_t RhHandleAllocDependent(Object* pPrimary, Object* pSecondary) +extern "C" void RhCollect() { - return (intptr_t)CreateDependentHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pPrimary, pSecondary); + throw "RhCollect"; } - -extern "C" void RhGetNonArrayBaseType() +extern "C" void RhpCallCatchFunclet() { - throw "RhGetNonArrayBaseType"; + throw "RhpCallCatchFunclet"; } - -extern "C" void RhGetEETypeClassification() +extern "C" void RhpCallFilterFunclet() { - throw "RhGetEETypeClassification"; + throw "RhpCallFilterFunclet"; } - -extern "C" void RhCollect() +extern "C" void RhpCallFinallyFunclet() { - throw "RhCollect"; + throw "RhpCallFinallyFunclet"; } - extern "C" void RhpUniversalTransition() { throw "RhpUniversalTransition"; @@ -367,38 +320,13 @@ extern "C" void RhpFailFastForPInvokeExceptionPreemp() { throw "RhpFailFastForPInvokeExceptionPreemp"; } -extern "C" void RhpFailFastForPInvokeExceptionCoop() -{ - throw "RhpFailFastForPInvokeExceptionCoop"; -} extern "C" void RhpThrowHwEx() { throw "RhpThrowHwEx"; } - -extern "C" void RhExceptionHandling_FailedAllocation() -{ - throw "RhExceptionHandling_FailedAllocation"; -} -extern "C" void RhIsNullable() -{ - throw "RhIsNullable"; -} -extern "C" void RhpCalculateStackTraceWorker() -{ - throw "RhpCalculateStackTraceWorker"; -} -extern "C" void RhThrowHwEx() -{ - throw "RhThrowHwEx"; -} -extern "C" void RhThrowEx() -{ - throw "RhThrowEx"; -} -extern "C" void RhRethrow() +extern "C" void RhpEtwExceptionThrown() { - throw "RhRethrow"; + throw "RhpEtwExceptionThrown"; } #ifndef CPPCODEGEN diff --git a/src/Native/Runtime/EHHelpers.cpp b/src/Native/Runtime/EHHelpers.cpp index 22ce0051a..9d260b683 100644 --- a/src/Native/Runtime/EHHelpers.cpp +++ b/src/Native/Runtime/EHHelpers.cpp @@ -239,7 +239,7 @@ struct DISPATCHER_CONTEXT }; EXTERN_C void __cdecl RhpFailFastForPInvokeExceptionPreemp(IntNative PInvokeCallsiteReturnAddr, - void* pExceptionRecord, void* pContextRecord); + void* pExceptionRecord, void* pContextRecord); EXTERN_C void REDHAWK_CALLCONV RhpFailFastForPInvokeExceptionCoop(IntNative PInvokeCallsiteReturnAddr, void* pExceptionRecord, void* pContextRecord); Int32 __stdcall RhpVectoredExceptionHandler(PEXCEPTION_POINTERS pExPtrs); diff --git a/src/Native/Runtime/portable.cpp b/src/Native/Runtime/portable.cpp index 86135e0c6..6e1656d20 100644 --- a/src/Native/Runtime/portable.cpp +++ b/src/Native/Runtime/portable.cpp @@ -71,10 +71,10 @@ COOP_PINVOKE_HELPER(void, RhpReversePInvokeReturn, (ReversePInvokeFrame* pFrame) // // Allocations // -// runtimeexports.cs -- @TODO: use C# implementation -COOP_PINVOKE_HELPER(Object *, RhNewObject, (EEType* pEEType)) +COOP_PINVOKE_HELPER(Object *, RhpNewFast, (EEType* pEEType)) { - ASSERT_MSG(!pEEType->RequiresAlign8(), "NYI"); + ASSERT(!pEEType->RequiresAlign8()); + ASSERT(!pEEType->HasFinalizer()); Thread * pCurThread = ThreadStore::GetCurrentThread(); alloc_context * acontext = pCurThread->GetAllocContext(); @@ -104,8 +104,33 @@ COOP_PINVOKE_HELPER(Object *, RhNewObject, (EEType* pEEType)) return pObject; } -// runtimeexports.cs -- @TODO: use C# implementation -COOP_PINVOKE_HELPER(Array *, RhNewArray, (EEType * pArrayEEType, int numElements)) + +#define GC_ALLOC_FINALIZE 0x1 // TODO: Defined in gc.h + +COOP_PINVOKE_HELPER(Object *, RhpNewFinalizable, (EEType* pEEType)) +{ + ASSERT(!pEEType->RequiresAlign8()); + ASSERT(pEEType->HasFinalizer()); + + Thread * pCurThread = ThreadStore::GetCurrentThread(); + Object * pObject; + + size_t size = pEEType->get_BaseSize(); + + pObject = (Object *)RedhawkGCInterface::Alloc(pCurThread, size, GC_ALLOC_FINALIZE, pEEType); + if (pObject == nullptr) + { + ASSERT_UNCONDITIONALLY("NYI"); // TODO: Throw OOM + } + pObject->set_EEType(pEEType); + + if (size >= RH_LARGE_OBJECT_SIZE) + RhpPublishObject(pObject, size); + + return pObject; +} + +COOP_PINVOKE_HELPER(Array *, RhpNewArray, (EEType * pArrayEEType, int numElements)) { ASSERT_MSG(!pArrayEEType->RequiresAlign8(), "NYI"); @@ -200,50 +225,17 @@ COOP_PINVOKE_HELPER(MDArray *, RhNewMDArray, (EEType * pArrayEEType, UInt32 rank return pObject; } -COOP_PINVOKE_HELPER(void, RhBox, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - -COOP_PINVOKE_HELPER(void, RhpNewFast, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - -COOP_PINVOKE_HELPER(void, RhpNewFinalizable, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - -COOP_PINVOKE_HELPER(void, RhpNewArray, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - COOP_PINVOKE_HELPER(void, RhpInitialDynamicInterfaceDispatch, ()) { ASSERT_UNCONDITIONALLY("NYI"); } - -// finalizer.cs -COOP_PINVOKE_HELPER(void, RhpSetHaveNewClasslibs, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - // finalizer.cs COOP_PINVOKE_HELPER(void, ProcessFinalizers, ()) { ASSERT_UNCONDITIONALLY("NYI"); } -// runtimeexports.cs -COOP_PINVOKE_HELPER(void, RhpReversePInvokeBadTransition, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - // // Return address hijacking // @@ -323,36 +315,3 @@ COOP_PINVOKE_HELPER(void, RhpCheckedAssignRef, (Object ** dst, Object * ref)) } #endif - -// -// type cast stuff from TypeCast.cs -// -COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfClass, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastClass, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfArray, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastArray, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_IsInstanceOfInterface, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_CheckCastInterface, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} -COOP_PINVOKE_HELPER(void, RhTypeCast_CheckVectorElemAddr, ()) -{ - ASSERT_UNCONDITIONALLY("NYI"); -} - |