Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Switch to protojit.dll #40

Merged
merged 1 commit into from
Oct 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 64 additions & 59 deletions src/JitInterface/src/CorInfoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ unsafe partial class CorInfoImpl
[UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)]
delegate byte* _findNameOfToken(IntPtr _this, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity);
[UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)]
[return: MarshalAs(UnmanagedType.I1)]delegate bool _getSystemVAmd64PassStructInRegisterDescriptor(IntPtr _this, CORINFO_CLASS_STRUCT_* structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr);
[UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)]
delegate int _getIntConfigValue(IntPtr _this, String name, int defaultValue);
[UnmanagedFunctionPointerAttribute(CallingConvention.ThisCall)]
delegate short* _getStringConfigValue(IntPtr _this, String name);
Expand Down Expand Up @@ -339,8 +341,8 @@ unsafe partial class CorInfoImpl

protected IntPtr CreateUnmanagedInstance()
{
IntPtr * vtable = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 162);
Object[] keepalive = new Object[162];
IntPtr * vtable = (IntPtr *)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 163);
Object[] keepalive = new Object[163];

_keepalive = keepalive;

Expand Down Expand Up @@ -659,177 +661,180 @@ protected IntPtr CreateUnmanagedInstance()
var d104 = new _findNameOfToken(findNameOfToken);
vtable[104] = Marshal.GetFunctionPointerForDelegate(d104);
keepalive[104] = d104;
var d105 = new _getIntConfigValue(getIntConfigValue);
var d105 = new _getSystemVAmd64PassStructInRegisterDescriptor(getSystemVAmd64PassStructInRegisterDescriptor);
vtable[105] = Marshal.GetFunctionPointerForDelegate(d105);
keepalive[105] = d105;
var d106 = new _getStringConfigValue(getStringConfigValue);
var d106 = new _getIntConfigValue(getIntConfigValue);
vtable[106] = Marshal.GetFunctionPointerForDelegate(d106);
keepalive[106] = d106;
var d107 = new _freeStringConfigValue(freeStringConfigValue);
var d107 = new _getStringConfigValue(getStringConfigValue);
vtable[107] = Marshal.GetFunctionPointerForDelegate(d107);
keepalive[107] = d107;
var d108 = new _getThreadTLSIndex(getThreadTLSIndex);
var d108 = new _freeStringConfigValue(freeStringConfigValue);
vtable[108] = Marshal.GetFunctionPointerForDelegate(d108);
keepalive[108] = d108;
var d109 = new _getInlinedCallFrameVptr(getInlinedCallFrameVptr);
var d109 = new _getThreadTLSIndex(getThreadTLSIndex);
vtable[109] = Marshal.GetFunctionPointerForDelegate(d109);
keepalive[109] = d109;
var d110 = new _getAddrOfCaptureThreadGlobal(getAddrOfCaptureThreadGlobal);
var d110 = new _getInlinedCallFrameVptr(getInlinedCallFrameVptr);
vtable[110] = Marshal.GetFunctionPointerForDelegate(d110);
keepalive[110] = d110;
var d111 = new _getAddrModuleDomainID(getAddrModuleDomainID);
var d111 = new _getAddrOfCaptureThreadGlobal(getAddrOfCaptureThreadGlobal);
vtable[111] = Marshal.GetFunctionPointerForDelegate(d111);
keepalive[111] = d111;
var d112 = new _getHelperFtn(getHelperFtn);
var d112 = new _getAddrModuleDomainID(getAddrModuleDomainID);
vtable[112] = Marshal.GetFunctionPointerForDelegate(d112);
keepalive[112] = d112;
var d113 = new _getFunctionEntryPoint(getFunctionEntryPoint);
var d113 = new _getHelperFtn(getHelperFtn);
vtable[113] = Marshal.GetFunctionPointerForDelegate(d113);
keepalive[113] = d113;
var d114 = new _getFunctionFixedEntryPoint(getFunctionFixedEntryPoint);
var d114 = new _getFunctionEntryPoint(getFunctionEntryPoint);
vtable[114] = Marshal.GetFunctionPointerForDelegate(d114);
keepalive[114] = d114;
var d115 = new _getMethodSync(getMethodSync);
var d115 = new _getFunctionFixedEntryPoint(getFunctionFixedEntryPoint);
vtable[115] = Marshal.GetFunctionPointerForDelegate(d115);
keepalive[115] = d115;
var d116 = new _getLazyStringLiteralHelper(getLazyStringLiteralHelper);
var d116 = new _getMethodSync(getMethodSync);
vtable[116] = Marshal.GetFunctionPointerForDelegate(d116);
keepalive[116] = d116;
var d117 = new _embedModuleHandle(embedModuleHandle);
var d117 = new _getLazyStringLiteralHelper(getLazyStringLiteralHelper);
vtable[117] = Marshal.GetFunctionPointerForDelegate(d117);
keepalive[117] = d117;
var d118 = new _embedClassHandle(embedClassHandle);
var d118 = new _embedModuleHandle(embedModuleHandle);
vtable[118] = Marshal.GetFunctionPointerForDelegate(d118);
keepalive[118] = d118;
var d119 = new _embedMethodHandle(embedMethodHandle);
var d119 = new _embedClassHandle(embedClassHandle);
vtable[119] = Marshal.GetFunctionPointerForDelegate(d119);
keepalive[119] = d119;
var d120 = new _embedFieldHandle(embedFieldHandle);
var d120 = new _embedMethodHandle(embedMethodHandle);
vtable[120] = Marshal.GetFunctionPointerForDelegate(d120);
keepalive[120] = d120;
var d121 = new _embedGenericHandle(embedGenericHandle);
var d121 = new _embedFieldHandle(embedFieldHandle);
vtable[121] = Marshal.GetFunctionPointerForDelegate(d121);
keepalive[121] = d121;
var d122 = new _getLocationOfThisType(getLocationOfThisType);
var d122 = new _embedGenericHandle(embedGenericHandle);
vtable[122] = Marshal.GetFunctionPointerForDelegate(d122);
keepalive[122] = d122;
var d123 = new _getPInvokeUnmanagedTarget(getPInvokeUnmanagedTarget);
var d123 = new _getLocationOfThisType(getLocationOfThisType);
vtable[123] = Marshal.GetFunctionPointerForDelegate(d123);
keepalive[123] = d123;
var d124 = new _getAddressOfPInvokeFixup(getAddressOfPInvokeFixup);
var d124 = new _getPInvokeUnmanagedTarget(getPInvokeUnmanagedTarget);
vtable[124] = Marshal.GetFunctionPointerForDelegate(d124);
keepalive[124] = d124;
var d125 = new _GetCookieForPInvokeCalliSig(GetCookieForPInvokeCalliSig);
var d125 = new _getAddressOfPInvokeFixup(getAddressOfPInvokeFixup);
vtable[125] = Marshal.GetFunctionPointerForDelegate(d125);
keepalive[125] = d125;
var d126 = new _canGetCookieForPInvokeCalliSig(canGetCookieForPInvokeCalliSig);
var d126 = new _GetCookieForPInvokeCalliSig(GetCookieForPInvokeCalliSig);
vtable[126] = Marshal.GetFunctionPointerForDelegate(d126);
keepalive[126] = d126;
var d127 = new _getJustMyCodeHandle(getJustMyCodeHandle);
var d127 = new _canGetCookieForPInvokeCalliSig(canGetCookieForPInvokeCalliSig);
vtable[127] = Marshal.GetFunctionPointerForDelegate(d127);
keepalive[127] = d127;
var d128 = new _GetProfilingHandle(GetProfilingHandle);
var d128 = new _getJustMyCodeHandle(getJustMyCodeHandle);
vtable[128] = Marshal.GetFunctionPointerForDelegate(d128);
keepalive[128] = d128;
var d129 = new _getCallInfo(getCallInfo);
var d129 = new _GetProfilingHandle(GetProfilingHandle);
vtable[129] = Marshal.GetFunctionPointerForDelegate(d129);
keepalive[129] = d129;
var d130 = new _canAccessFamily(canAccessFamily);
var d130 = new _getCallInfo(getCallInfo);
vtable[130] = Marshal.GetFunctionPointerForDelegate(d130);
keepalive[130] = d130;
var d131 = new _isRIDClassDomainID(isRIDClassDomainID);
var d131 = new _canAccessFamily(canAccessFamily);
vtable[131] = Marshal.GetFunctionPointerForDelegate(d131);
keepalive[131] = d131;
var d132 = new _getClassDomainID(getClassDomainID);
var d132 = new _isRIDClassDomainID(isRIDClassDomainID);
vtable[132] = Marshal.GetFunctionPointerForDelegate(d132);
keepalive[132] = d132;
var d133 = new _getFieldAddress(getFieldAddress);
var d133 = new _getClassDomainID(getClassDomainID);
vtable[133] = Marshal.GetFunctionPointerForDelegate(d133);
keepalive[133] = d133;
var d134 = new _getVarArgsHandle(getVarArgsHandle);
var d134 = new _getFieldAddress(getFieldAddress);
vtable[134] = Marshal.GetFunctionPointerForDelegate(d134);
keepalive[134] = d134;
var d135 = new _canGetVarArgsHandle(canGetVarArgsHandle);
var d135 = new _getVarArgsHandle(getVarArgsHandle);
vtable[135] = Marshal.GetFunctionPointerForDelegate(d135);
keepalive[135] = d135;
var d136 = new _constructStringLiteral(constructStringLiteral);
var d136 = new _canGetVarArgsHandle(canGetVarArgsHandle);
vtable[136] = Marshal.GetFunctionPointerForDelegate(d136);
keepalive[136] = d136;
var d137 = new _emptyStringLiteral(emptyStringLiteral);
var d137 = new _constructStringLiteral(constructStringLiteral);
vtable[137] = Marshal.GetFunctionPointerForDelegate(d137);
keepalive[137] = d137;
var d138 = new _getFieldThreadLocalStoreID(getFieldThreadLocalStoreID);
var d138 = new _emptyStringLiteral(emptyStringLiteral);
vtable[138] = Marshal.GetFunctionPointerForDelegate(d138);
keepalive[138] = d138;
var d139 = new _setOverride(setOverride);
var d139 = new _getFieldThreadLocalStoreID(getFieldThreadLocalStoreID);
vtable[139] = Marshal.GetFunctionPointerForDelegate(d139);
keepalive[139] = d139;
var d140 = new _addActiveDependency(addActiveDependency);
var d140 = new _setOverride(setOverride);
vtable[140] = Marshal.GetFunctionPointerForDelegate(d140);
keepalive[140] = d140;
var d141 = new _GetDelegateCtor(GetDelegateCtor);
var d141 = new _addActiveDependency(addActiveDependency);
vtable[141] = Marshal.GetFunctionPointerForDelegate(d141);
keepalive[141] = d141;
var d142 = new _MethodCompileComplete(MethodCompileComplete);
var d142 = new _GetDelegateCtor(GetDelegateCtor);
vtable[142] = Marshal.GetFunctionPointerForDelegate(d142);
keepalive[142] = d142;
var d143 = new _getTailCallCopyArgsThunk(getTailCallCopyArgsThunk);
var d143 = new _MethodCompileComplete(MethodCompileComplete);
vtable[143] = Marshal.GetFunctionPointerForDelegate(d143);
keepalive[143] = d143;
var d144 = new _getMemoryManager(getMemoryManager);
var d144 = new _getTailCallCopyArgsThunk(getTailCallCopyArgsThunk);
vtable[144] = Marshal.GetFunctionPointerForDelegate(d144);
keepalive[144] = d144;
var d145 = new _allocMem(allocMem);
var d145 = new _getMemoryManager(getMemoryManager);
vtable[145] = Marshal.GetFunctionPointerForDelegate(d145);
keepalive[145] = d145;
var d146 = new _reserveUnwindInfo(reserveUnwindInfo);
var d146 = new _allocMem(allocMem);
vtable[146] = Marshal.GetFunctionPointerForDelegate(d146);
keepalive[146] = d146;
var d147 = new _allocUnwindInfo(allocUnwindInfo);
var d147 = new _reserveUnwindInfo(reserveUnwindInfo);
vtable[147] = Marshal.GetFunctionPointerForDelegate(d147);
keepalive[147] = d147;
var d148 = new _allocGCInfo(allocGCInfo);
var d148 = new _allocUnwindInfo(allocUnwindInfo);
vtable[148] = Marshal.GetFunctionPointerForDelegate(d148);
keepalive[148] = d148;
var d149 = new _yieldExecution(yieldExecution);
var d149 = new _allocGCInfo(allocGCInfo);
vtable[149] = Marshal.GetFunctionPointerForDelegate(d149);
keepalive[149] = d149;
var d150 = new _setEHcount(setEHcount);
var d150 = new _yieldExecution(yieldExecution);
vtable[150] = Marshal.GetFunctionPointerForDelegate(d150);
keepalive[150] = d150;
var d151 = new _setEHinfo(setEHinfo);
var d151 = new _setEHcount(setEHcount);
vtable[151] = Marshal.GetFunctionPointerForDelegate(d151);
keepalive[151] = d151;
var d152 = new _logMsg(logMsg);
var d152 = new _setEHinfo(setEHinfo);
vtable[152] = Marshal.GetFunctionPointerForDelegate(d152);
keepalive[152] = d152;
var d153 = new _doAssert(doAssert);
var d153 = new _logMsg(logMsg);
vtable[153] = Marshal.GetFunctionPointerForDelegate(d153);
keepalive[153] = d153;
var d154 = new _reportFatalError(reportFatalError);
var d154 = new _doAssert(doAssert);
vtable[154] = Marshal.GetFunctionPointerForDelegate(d154);
keepalive[154] = d154;
var d155 = new _allocBBProfileBuffer(allocBBProfileBuffer);
var d155 = new _reportFatalError(reportFatalError);
vtable[155] = Marshal.GetFunctionPointerForDelegate(d155);
keepalive[155] = d155;
var d156 = new _getBBProfileData(getBBProfileData);
var d156 = new _allocBBProfileBuffer(allocBBProfileBuffer);
vtable[156] = Marshal.GetFunctionPointerForDelegate(d156);
keepalive[156] = d156;
var d157 = new _recordCallSite(recordCallSite);
var d157 = new _getBBProfileData(getBBProfileData);
vtable[157] = Marshal.GetFunctionPointerForDelegate(d157);
keepalive[157] = d157;
var d158 = new _recordRelocation(recordRelocation);
var d158 = new _recordCallSite(recordCallSite);
vtable[158] = Marshal.GetFunctionPointerForDelegate(d158);
keepalive[158] = d158;
var d159 = new _getRelocTypeHint(getRelocTypeHint);
var d159 = new _recordRelocation(recordRelocation);
vtable[159] = Marshal.GetFunctionPointerForDelegate(d159);
keepalive[159] = d159;
var d160 = new _getModuleNativeEntryPointRange(getModuleNativeEntryPointRange);
var d160 = new _getRelocTypeHint(getRelocTypeHint);
vtable[160] = Marshal.GetFunctionPointerForDelegate(d160);
keepalive[160] = d160;
var d161 = new _getExpectedTargetArchitecture(getExpectedTargetArchitecture);
var d161 = new _getModuleNativeEntryPointRange(getModuleNativeEntryPointRange);
vtable[161] = Marshal.GetFunctionPointerForDelegate(d161);
keepalive[161] = d161;
var d162 = new _getExpectedTargetArchitecture(getExpectedTargetArchitecture);
vtable[162] = Marshal.GetFunctionPointerForDelegate(d162);
keepalive[162] = d162;

IntPtr instance = Marshal.AllocCoTaskMem(sizeof(IntPtr));
*(IntPtr**)instance = vtable;
Expand Down
3 changes: 3 additions & 0 deletions src/JitInterface/src/CorInfoHelpFunc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,9 @@ which is the right helper to use to allocate an object of a given type. */
CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress.
CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode.

CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException
CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException

CORINFO_HELP_COUNT,
}
}
4 changes: 3 additions & 1 deletion src/JitInterface/src/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public CorInfoImpl(Compilation compilation)

_comp = CreateUnmanagedInstance();

string clrjitPath = AppContext.BaseDirectory + "\\clrjit.dll";
string clrjitPath = AppContext.BaseDirectory + "\\protojit.dll";
IntPtr jit = LoadLibraryEx(clrjitPath, new IntPtr(0), 0x1300);

IntPtr proc = GetProcAddress(jit, "getJit");
Expand Down Expand Up @@ -1019,6 +1019,8 @@ uint getMethodHash(IntPtr _this, CORINFO_METHOD_STRUCT_* ftn)

byte* findNameOfToken(IntPtr _this, CORINFO_MODULE_STRUCT_* moduleHandle, mdToken token, byte* szFQName, UIntPtr FQNameCapacity)
{ throw new NotImplementedException(); }
bool getSystemVAmd64PassStructInRegisterDescriptor(IntPtr _this, CORINFO_CLASS_STRUCT_* structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{ throw new NotImplementedException(); }
int getIntConfigValue(IntPtr _this, String name, int defaultValue)
{ throw new NotImplementedException(); }
short* getStringConfigValue(IntPtr _this, String name)
Expand Down
6 changes: 6 additions & 0 deletions src/JitInterface/src/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ public enum CORINFO_CALLINFO_FLAGS
CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information.
CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks.
CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN
CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper
}

// Bit-twiddling of contexts assumes word-alignment of method handles and type handles
Expand Down Expand Up @@ -555,6 +556,7 @@ public enum CORINFO_ACCESS_FLAGS
CORINFO_ACCESS_SET = 0x0200, // Field set (stfld)
CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda)
CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray
CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper
CORINFO_ACCESS_INLINECHECK = 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining.
}

Expand Down Expand Up @@ -746,6 +748,7 @@ public enum CorJitAllocMemFlag
{
CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN = 0x00000000, // The code will be use the normal alignment
CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN = 0x00000001, // The code will be 16-byte aligned
CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN = 0x00000002, // The read-only data will be 16-byte aligned
}

public enum CorJitFuncKind
Expand Down Expand Up @@ -1087,6 +1090,9 @@ public unsafe struct CORINFO_FIELD_INFO

};

public struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
{
};

// DEBUGGER DATQA
public enum BoundaryTypes
Expand Down
Loading