From 7291e2f10a7812807c558f04527142496e750241 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 23 Sep 2015 18:34:37 -0700 Subject: Handle direct call ReadyToRun helpers Add missing check in the JIT to generate correct code for direct call ReadyToRun helpers. I have run into this bug while experimenting with ReadyToRun optimizations. It is not observable bug today because of crossgen happens to always emit ReadyToRun helpers as indirect calls. --- src/jit/codegenxarch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index 1f590abe02..7099de3ae2 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -5097,7 +5097,7 @@ void CodeGen::genCallInstruction(GenTreePtr node) #if defined(_TARGET_AMD64_) && defined(FEATURE_READYTORUN_COMPILER) else if (call->gtEntryPoint.addr != nullptr) { - genEmitCall(emitter::EC_FUNC_TOKEN_INDIR, + genEmitCall((call->gtEntryPoint.accessType == IAT_VALUE) ? emitter::EC_FUNC_TOKEN : emitter::EC_FUNC_TOKEN_INDIR, methHnd, INDEBUG_LDISASM_COMMA(sigInfo) (void*) call->gtEntryPoint.addr, -- cgit v1.2.3 From f87429893fa7d4ea24c4631cc1c229a05b3be9cc Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 23 Sep 2015 22:07:45 -0700 Subject: Delete incorrect AMD64 ifdef ReadyToRun case of getCallInstruction was incorrectly ifdefed out for AMD64. Delete the incorrect ifdef and make other adjustment to make the code compile for X86 as well. --- src/jit/codegenxarch.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index 7099de3ae2..076ba7c262 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -5094,13 +5094,16 @@ void CodeGen::genCallInstruction(GenTreePtr node) genConsumeReg(target)); } } -#if defined(_TARGET_AMD64_) && defined(FEATURE_READYTORUN_COMPILER) +#ifdef FEATURE_READYTORUN_COMPILER else if (call->gtEntryPoint.addr != nullptr) { genEmitCall((call->gtEntryPoint.accessType == IAT_VALUE) ? emitter::EC_FUNC_TOKEN : emitter::EC_FUNC_TOKEN_INDIR, methHnd, INDEBUG_LDISASM_COMMA(sigInfo) (void*) call->gtEntryPoint.addr, +#ifdef _TARGET_X86_ + stackArgBytes, +#endif // _TARGET_X86_ retSize, ilOffset); } -- cgit v1.2.3