Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2015-12-01 10:12:23 +0300
committerJan Kotas <jkotas@microsoft.com>2015-12-22 02:57:17 +0300
commit0fd800466452d74c011f602c79bca1c8b318ed18 (patch)
treeaae76724c51da726baa946621a0ca8e3988842fd /src/Native
parentd4023eecf7fcc7306802f3d0363ea96837579217 (diff)
Remove CoreRT TODOs in Buffer.CopyBlock and Array.Copy
- Respect explicit layout and emit proper EEType flags in CppCodeGen - required for "Hello world" with TODOs removed - Reduce dependencies of autogenerated files for CppCodeGen
Diffstat (limited to 'src/Native')
-rw-r--r--src/Native/Bootstrap/common.h2
-rw-r--r--src/Native/Bootstrap/main.cpp62
-rw-r--r--src/Native/Runtime/gcenv.h5
3 files changed, 11 insertions, 58 deletions
diff --git a/src/Native/Bootstrap/common.h b/src/Native/Bootstrap/common.h
index bfd889675..a21805be1 100644
--- a/src/Native/Bootstrap/common.h
+++ b/src/Native/Bootstrap/common.h
@@ -111,7 +111,7 @@ inline bool IS_ALIGNED(T* val, UIntNative alignment)
#define RAW_MIN_OBJECT_SIZE (3*sizeof(void*))
-#define AlignBaseSize(s) ((s < RAW_MIN_OBJECT_SIZE) ? RAW_MIN_OBJECT_SIZE : ((s + (sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1))))
+#define AlignBaseSize(s) ((s < RAW_MIN_OBJECT_SIZE) ? RAW_MIN_OBJECT_SIZE : ((s + (sizeof(void*)-1) & ~(sizeof(void*)-1))))
#define ARRAY_BASE (2*sizeof(void*))
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp
index 67e069b09..7caef21af 100644
--- a/src/Native/Bootstrap/main.cpp
+++ b/src/Native/Bootstrap/main.cpp
@@ -3,10 +3,9 @@
#include "common.h"
-#include "gcenv.h"
-
-#include "gc.h"
-#include "objecthandle.h"
+#include "sal.h"
+#include "gcenv.structs.h"
+#include "gcenv.base.h"
#include <stdlib.h>
@@ -18,6 +17,9 @@ extern "C" void RhpReversePInvoke2(ReversePInvokeFrame* pRevFrame);
extern "C" void RhpReversePInvokeReturn(ReversePInvokeFrame* pRevFrame);
extern "C" int32_t RhpEnableConservativeStackReporting();
extern "C" void RhpRegisterSimpleModule(SimpleModuleHeader* pModule);
+extern "C" void * RhHandleAlloc(void * pObject, int handleType);
+extern "C" void * RhTypeCast_IsInstanceOfClass(void * pObject, MethodTable * pMT);
+extern "C" void * RhTypeCast_CheckCast(void * pObject, MethodTable * pMT);
#define DLL_PROCESS_ATTACH 1
extern "C" BOOL WINAPI RtuDllMain(HANDLE hPalInstance, DWORD dwReason, void* pvReserved);
@@ -187,55 +189,17 @@ OBJECTHANDLE __load_static_string_literal(const uint8_t* utf8, int32_t utf8Len,
uint16_t * buffer = (uint16_t *)((char*)pString + sizeof(intptr_t) + sizeof(int32_t));
if (strLen > 0)
UTF8ToWideChar((char*)utf8, utf8Len, buffer, strLen);
- return CreateGlobalHandle(ObjectToOBJECTREF(pString));
+ return (OBJECTHANDLE)RhHandleAlloc(pString, 2 /* Normal */);
}
-// TODO: Rewrite in C#
-
extern "C" Object * __castclass_class(void * p, MethodTable * pTargetMT)
{
- Object * o = (Object *)p;
-
- if (o == NULL)
- return o;
-
- MethodTable * pMT = o->RawGetMethodTable();
-
- do {
- if (pMT == pTargetMT)
- return o;
-
- if (pMT->IsArray())
- break;
-
- pMT = pMT->GetParent();
- } while (pMT);
-
- // TODO: Handle corner cases, throw proper exception
- throw "__castclass_class";
+ return (Object *)RhTypeCast_CheckCast(p, pTargetMT);
}
extern "C" Object * __isinst_class(void * p, MethodTable * pTargetMT)
{
- Object * o = (Object *)p;
-
- if (o == NULL)
- return o;
-
- MethodTable * pMT = o->RawGetMethodTable();
-
- do {
- if (pMT == pTargetMT)
- return o;
-
- if (pMT->IsArray())
- break;
-
- pMT = pMT->GetParent();
- } while (pMT);
-
- // TODO: Handle corner cases
- return NULL;
+ return (Object *)RhTypeCast_IsInstanceOfClass(p, pTargetMT);
}
__declspec(noreturn)
@@ -273,12 +237,6 @@ Object * __get_commandline_args(int argc, char * argv[])
return (Object *)args;
}
-extern "C" void Buffer_BlockCopy(class System::Array * src, int srcOfs, class System::Array * dst, int dstOfs, int count)
-{
- // TODO: Argument validation
- memmove((uint8_t*)dst + 2 * sizeof(void*) + dstOfs, (uint8_t*)src + 2 * sizeof(void*) + srcOfs, count);
-}
-
extern "C" void RhGetCurrentThreadStackTrace()
{
throw "RhGetCurrentThreadStackTrace";
@@ -439,7 +397,7 @@ int __statics_fixup()
for (void** currentBlock = &__GCStaticRegionStart; currentBlock < &__GCStaticRegionEnd; currentBlock++)
{
Object* gcBlock = __allocate_object((MethodTable*)*currentBlock);
- *currentBlock = CreateGlobalHandle(ObjectToOBJECTREF(gcBlock));
+ *currentBlock = RhHandleAlloc(gcBlock, 2 /* Normal */);
}
return 0;
diff --git a/src/Native/Runtime/gcenv.h b/src/Native/Runtime/gcenv.h
index 8833a9452..673371587 100644
--- a/src/Native/Runtime/gcenv.h
+++ b/src/Native/Runtime/gcenv.h
@@ -101,11 +101,6 @@ public:
bool RequiresAlign8() { return ((EEType*)this)->RequiresAlign8(); }
bool IsValueType() { return ((EEType*)this)->get_IsValueType(); }
UInt32_BOOL SanityCheck() { return ((EEType*)this)->Validate(); }
- // TODO: remove this method after the __isinst_class is gone
- MethodTable* GetParent()
- {
- return (MethodTable*)((EEType*)this)->get_BaseType();
- }
};
class EEConfig