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

Commit

Permalink
Update RyuJIT (#4314)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalStrehovsky authored and jkotas committed Aug 13, 2017
1 parent fc4a9c2 commit abb4eef
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dependencies.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RyuJITVersion>2.1.0-preview2-25509-03</RyuJITVersion>
<RyuJITVersion>2.1.0-preview2-25613-02</RyuJITVersion>
<ObjectWriterVersion>1.0.19-prerelease-00001</ObjectWriterVersion>
<CoreFXVersion>4.5.0-preview2-25510-01</CoreFXVersion>
<MicrosoftNETCoreNativeVersion>2.0.0-beta-25021-03</MicrosoftNETCoreNativeVersion>
Expand Down
6 changes: 3 additions & 3 deletions src/JitInterface/src/CorInfoBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ unsafe partial class CorInfoImpl
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
delegate CORINFO_MODULE_STRUCT_* __getMethodModule(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method);
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
delegate void __getMethodVTableOffset(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection);
delegate void __getMethodVTableOffset(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection, [MarshalAs(UnmanagedType.U1)] ref bool isRelative);
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
delegate CORINFO_METHOD_STRUCT_* __resolveVirtualMethod(IntPtr _this, IntPtr* ppException, CORINFO_METHOD_STRUCT_* virtualMethod, CORINFO_CLASS_STRUCT_* implementingClass, CORINFO_CONTEXT_STRUCT* ownerType);
[UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)]
Expand Down Expand Up @@ -491,12 +491,12 @@ static void _getEHinfo(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_ST
}
}

static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection)
static void _getMethodVTableOffset(IntPtr thisHandle, IntPtr* ppException, CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection, [MarshalAs(UnmanagedType.U1)] ref bool isRelative)
{
var _this = GetThis(thisHandle);
try
{
_this.getMethodVTableOffset(method, ref offsetOfIndirection, ref offsetAfterIndirection);
_this.getMethodVTableOffset(method, ref offsetOfIndirection, ref offsetAfterIndirection, ref isRelative);
}
catch (Exception ex)
{
Expand Down
4 changes: 3 additions & 1 deletion src/JitInterface/src/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,11 +803,12 @@ private void getEHinfo(CORINFO_METHOD_STRUCT_* ftn, uint EHnumber, ref CORINFO_E
private CORINFO_MODULE_STRUCT_* getMethodModule(CORINFO_METHOD_STRUCT_* method)
{ throw new NotImplementedException("getMethodModule"); }

private void getMethodVTableOffset(CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection)
private void getMethodVTableOffset(CORINFO_METHOD_STRUCT_* method, ref uint offsetOfIndirection, ref uint offsetAfterIndirection, ref bool isRelative)
{
MethodDesc methodDesc = HandleToObject(method);
int pointerSize = _compilation.TypeSystemContext.Target.PointerSize;
offsetOfIndirection = (uint)CORINFO_VIRTUALCALL_NO_CHUNK.Value;
isRelative = false;

// Normalize to the slot defining method. We don't have slot information for the overrides.
methodDesc = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(methodDesc);
Expand Down Expand Up @@ -912,6 +913,7 @@ private void ComputeLookup(CORINFO_CONTEXT_STRUCT* pContextMethod, object entity
lookup.runtimeLookup.testForFixup = false; // TODO: this will be needed in true multifile
lookup.runtimeLookup.testForNull = false;
lookup.runtimeLookup.indirectFirstOffset = false;
lookup.runtimeLookup.indirectSecondOffset = false;
lookup.lookupKind.runtimeLookupFlags = 0;
lookup.lookupKind.runtimeLookupArgs = null;
}
Expand Down
5 changes: 5 additions & 0 deletions src/JitInterface/src/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ public unsafe struct CORINFO_RUNTIME_LOOKUP

public byte _indirectFirstOffset;
public bool indirectFirstOffset { get { return _indirectFirstOffset != 0; } set { _indirectFirstOffset = value ? (byte)1 : (byte)0; } }

public byte _indirectSecondOffset;
public bool indirectSecondOffset { get { return _indirectSecondOffset != 0; } set { _indirectSecondOffset = value ? (byte)1 : (byte)0; } }

}

// Result of calling embedGenericHandle
Expand Down Expand Up @@ -1478,6 +1482,7 @@ public enum CorJitFlag : uint
CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
CORJIT_FLAG_NO_INLINING = 42, // JIT should not inline any called method into this method
}

public struct CORJIT_FLAGS
Expand Down
2 changes: 1 addition & 1 deletion src/JitInterface/src/ThunkGenerator/ThunkInput.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ FUNCTIONS
void getEHinfo( CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE* clause );
CORINFO_CLASS_HANDLE getMethodClass( CORINFO_METHOD_HANDLE method );
CORINFO_MODULE_HANDLE getMethodModule( CORINFO_METHOD_HANDLE method );
void getMethodVTableOffset( CORINFO_METHOD_HANDLE method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection );
void getMethodVTableOffset( CORINFO_METHOD_HANDLE method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative);
CORINFO_METHOD_HANDLE resolveVirtualMethod( CORINFO_METHOD_HANDLE virtualMethod, CORINFO_CLASS_HANDLE implementingClass, CORINFO_CONTEXT_HANDLE ownerType);
void expandRawHandleIntrinsic(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_GENERICHANDLE_RESULT * pResult);
CorInfoIntrinsics getIntrinsicID( CORINFO_METHOD_HANDLE method , bool * pMustExpand);
Expand Down
20 changes: 14 additions & 6 deletions src/JitInterface/src/ThunkGenerator/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ TODO: Talk about initializing strutures before use
#define SELECTANY extern __declspec(selectany)
#endif

SELECTANY const GUID JITEEVersionIdentifier = { /* 28eb875f-b6a9-4a04-9ba7-69ba59deed46 */
0x28eb875f,
0xb6a9,
0x4a04,
{ 0x9b, 0xa7, 0x69, 0xba, 0x59, 0xde, 0xed, 0x46 }
SELECTANY const GUID JITEEVersionIdentifier = { /* 5a1cfc89-a84a-4642-b01d-ead88e60c1ee */
0x5a1cfc89,
0xa84a,
0x4642,
{ 0xb0, 0x1d, 0xea, 0xd8, 0x8e, 0x60, 0xc1, 0xee }
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1332,6 +1332,13 @@ struct CORINFO_RUNTIME_LOOKUP
// 1 means that value stored at first offset (offsets[0]) from pointer is offset1, and the next pointer is
// stored at pointer+offsets[0]+offset1.
bool indirectFirstOffset;

// If set, second offset is indirect.
// 0 means that value stored at second offset (offsets[1]) from pointer is next pointer, to which the next offset
// (offsets[2]) is added and so on.
// 1 means that value stored at second offset (offsets[1]) from pointer is offset2, and the next pointer is
// stored at pointer+offsets[1]+offset2.
bool indirectSecondOffset;
} ;

// Result of calling embedGenericHandle
Expand Down Expand Up @@ -2062,7 +2069,8 @@ class ICorStaticInfo
virtual void getMethodVTableOffset (
CORINFO_METHOD_HANDLE method, /* IN */
unsigned* offsetOfIndirection, /* OUT */
unsigned* offsetAfterIndirection /* OUT */
unsigned* offsetAfterIndirection, /* OUT */
bool* isRelative /* OUT */
) = 0;

// Find the virtual method in implementingClass that overrides virtualMethod,
Expand Down
4 changes: 3 additions & 1 deletion src/JitInterface/src/ThunkGenerator/corjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,10 @@ class CORJIT_FLAGS
#if defined(_TARGET_ARM_)
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 41, // JIT should generate PC-relative address computations instead of EE relocation records
#else // !defined(_TARGET_ARM_)
CORJIT_FLAG_UNUSED11 = 41
CORJIT_FLAG_UNUSED11 = 41,
#endif // !defined(_TARGET_ARM_)

CORJIT_FLAG_NO_INLINING = 42 // JIT should not inline any called method into this method
};

CORJIT_FLAGS()
Expand Down
6 changes: 3 additions & 3 deletions src/Native/jitinterface/jitinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct JitInterfaceCallbacks
void (__stdcall * getEHinfo)(void * thisHandle, CorInfoException** ppException, void* ftn, unsigned EHnumber, void* clause);
void* (__stdcall * getMethodClass)(void * thisHandle, CorInfoException** ppException, void* method);
void* (__stdcall * getMethodModule)(void * thisHandle, CorInfoException** ppException, void* method);
void (__stdcall * getMethodVTableOffset)(void * thisHandle, CorInfoException** ppException, void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection);
void (__stdcall * getMethodVTableOffset)(void * thisHandle, CorInfoException** ppException, void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative);
void* (__stdcall * resolveVirtualMethod)(void * thisHandle, CorInfoException** ppException, void* virtualMethod, void* implementingClass, void* ownerType);
void (__stdcall * expandRawHandleIntrinsic)(void * thisHandle, CorInfoException** ppException, void* pResolvedToken, void* pResult);
int (__stdcall * getIntrinsicID)(void * thisHandle, CorInfoException** ppException, void* method, bool* pMustExpand);
Expand Down Expand Up @@ -283,10 +283,10 @@ class JitInterfaceWrapper
return _ret;
}

virtual void getMethodVTableOffset(void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection)
virtual void getMethodVTableOffset(void* method, unsigned* offsetOfIndirection, unsigned* offsetAfterIndirection, bool* isRelative)
{
CorInfoException* pException = nullptr;
_callbacks->getMethodVTableOffset(_thisHandle, &pException, method, offsetOfIndirection, offsetAfterIndirection);
_callbacks->getMethodVTableOffset(_thisHandle, &pException, method, offsetOfIndirection, offsetAfterIndirection, isRelative);
if (pException != nullptr)
throw pException;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Native/jitinterface/jitwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class CORJIT_FLAGS
unsigned __int64 corJitFlags;
};

static const GUID JITEEVersionIdentifier = { /* 28eb875f-b6a9-4a04-9ba7-69ba59deed46 */
0x28eb875f,
0xb6a9,
0x4a04,
{ 0x9b, 0xa7, 0x69, 0xba, 0x59, 0xde, 0xed, 0x46 }
static const GUID JITEEVersionIdentifier = { /* 5a1cfc89-a84a-4642-b01d-ead88e60c1ee */
0x5a1cfc89,
0xa84a,
0x4642,
{ 0xb0, 0x1d, 0xea, 0xd8, 0x8e, 0x60, 0xc1, 0xee }
};

class Jit
Expand Down

0 comments on commit abb4eef

Please sign in to comment.