Merge pull request #92 from jkotas/misc-fixes

Misc fixes
This commit is contained in:
Jan Kotas 2015-10-22 09:16:56 -07:00
Родитель d65860c6ad 1ac145954b
Коммит 27c55460b4
4 изменённых файлов: 65 добавлений и 4 удалений

Просмотреть файл

@ -30,6 +30,10 @@ namespace System.Diagnostics
{
if (!condition)
{
#if CORERT
// CORERT-TODO
unsafe { *(int *)0 = 0; }
#else
string stackTrace;
try
@ -43,6 +47,7 @@ namespace System.Diagnostics
WriteAssert(stackTrace, message, detailMessage);
s_logger.ShowAssertDialog(stackTrace, message, detailMessage);
#endif
}
}

Просмотреть файл

@ -47,7 +47,6 @@ namespace ILToNative.CppCodeGen
// TODO: For now, ensure that all types/methods referenced by temporary implementation in stubs.cpp are present
var stringType = _compilation.TypeSystemContext.GetWellKnownType(WellKnownType.String);
_compilation.AddMethod(stringType.GetMethod("get_Chars", null));
AddInstanceFields(stringType);
var stringArrayType = stringType.MakeArrayType();
@ -303,7 +302,7 @@ namespace ILToNative.CppCodeGen
importName = ecmaMethod.Name;
// TODO: hacky special-case
if (importName != "memmove") // memmove is already declared by the CRT headers
if (importName != "memmove" && importName != "malloc") // some methods are already declared by the CRT headers
{
builder.AppendLine(GetCppMethodDeclaration(method, false, importName));
}

Просмотреть файл

@ -1944,7 +1944,44 @@ namespace Internal.IL
void ImportUnbox(int token, ILOpcode opCode)
{
throw new NotImplementedException();
var type = ResolveTypeToken(token);
var obj = Pop();
if (opCode == ILOpcode.unbox)
{
PushTemp(StackValueKind.ByRef, type.MakeByRefType());
}
else
{
PushTemp(GetStackValueKind(type), type);
}
if (type.IsValueType)
{
// TODO: Unbox of nullable types
if (type.IsNullable)
throw new NotImplementedException();
if (opCode == ILOpcode.unbox_any)
{
string typeName = GetStackValueKindCPPTypeName(GetStackValueKind(type), type);
Append("*(");
Append(typeName);
Append("*)");
}
Append("((void **)");
Append(obj.Value.Name);
Append("+1)");
}
else
{
// TODO: Cast
Append(obj.Value.Name);
}
Finish();
}
void ImportRefAnyVal(int token)

Просмотреть файл

@ -287,11 +287,31 @@ extern "C" uint8_t RhIsValueType(MethodTable*)
throw 42;
}
extern "C" intptr_t RhHandleAllocDependent(Object*, Object*)
extern "C" uint8_t RhIsArray(MethodTable*)
{
throw 42;
}
extern "C" uint8_t RhTypeCast_AreTypesEquivalent(MethodTable*, MethodTable*)
{
throw 42;
}
extern "C" void RhGetCurrentThreadStackTrace()
{
throw 42;
}
extern "C" intptr_t RhHandleAlloc(Object * pObject, int type)
{
return (intptr_t)CreateTypedHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pObject, type);
}
extern "C" intptr_t RhHandleAllocDependent(Object* pPrimary, Object* pSecondary)
{
return (intptr_t)CreateDependentHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], pPrimary, pSecondary);
}
extern "C" void RhpUniversalTransition()
{
throw 42;