diff options
author | Gaurav Khanna <gkhanna@microsoft.com> | 2015-12-17 02:32:35 +0300 |
---|---|---|
committer | Gaurav Khanna <gkhanna@microsoft.com> | 2015-12-17 04:13:43 +0300 |
commit | 2dbbf1417160d50325e099baa9187b87e65dd00c (patch) | |
tree | a062920a7f9ab3ead37eb90d1f51167fd8dcb77f /src/Native | |
parent | 6cf6977b884f47d004972910af4a39e07be2df53 (diff) |
Fix HelloWorld RyuJIT OverflowException
Since Generics context is not yet supported, we were not setting the contextHandle in getCallInfo JITEE interface implementation. Thus, when JIT would get the calling details, it would get a bogus value for contextHandle and later pass on that values to other calls to the JITEE interface. In this case, initClass was being passed the bogus value that it attempted to operate upon assuming its a valid generics context and resulted in OverflowException.
This fix is to compute the contextHandle as expected.
Diffstat (limited to 'src/Native')
-rw-r--r-- | src/Native/Bootstrap/main.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/Native/Bootstrap/main.cpp b/src/Native/Bootstrap/main.cpp index 673d11f98..29afcc217 100644 --- a/src/Native/Bootstrap/main.cpp +++ b/src/Native/Bootstrap/main.cpp @@ -123,12 +123,34 @@ extern "C" void* __ldelema_ref(System::Array * pArray, unsigned idx, MethodTable return &(((Object **)(pArray->GetArrayData()))[idx]); } +void PrintStringObject(System::String *pStringToPrint) +{ + // Get the number of characters in managed string (stored as UTF16) + int32_t length = *((int32_t*)((char*)(pStringToPrint)+sizeof(intptr_t))); + + // Get the pointer to the start of the character array + uint16_t *pString = (uint16_t*)((char*)(pStringToPrint)+sizeof(intptr_t) + sizeof(int32_t)); + + // Loop to display the string + int32_t index = 0; + while (index < length) + { + putwchar(*pString); + pString++; + index++; + } +} extern "C" void __not_yet_implemented(System::String * pMethodName, System::String * pMessage) { printf("ILCompiler failed generating code for this method; execution cannot continue.\n"); printf("This is likely because of a feature that is not yet implemented in the compiler.\n"); - wprintf(L"Method: %ls\n", (wchar_t*)((char*)(pMethodName)+12)); - wprintf(L"Reason: %ls\n", (wchar_t*)((char*)(pMessage)+12)); + printf("Method: "); + PrintStringObject(pMethodName); + printf("\n\n"); + printf("Reason: "); + PrintStringObject(pMessage); + printf("\n"); + exit(-1); } |