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

Mac RyuJIT triggers OverflowException for Release mode ILC #499

Closed
gkhanna79 opened this issue Dec 8, 2015 · 2 comments
Closed

Mac RyuJIT triggers OverflowException for Release mode ILC #499

gkhanna79 opened this issue Dec 8, 2015 · 2 comments
Assignees
Milestone

Comments

@gkhanna79
Copy link
Member

Trying to compile output of "dotnet init" (a helloWorld app) using Mac RyuJIT triggers an OverflowException when running against release build of ILC, while the same thing works against Debug build. Also, this scenario works for either builds on Windows or Ubuntu.

Below is the callstack in lldb at the point the exception is thrown, followed by the managed callstack at the very end.

@kyulee1 @russellhadley Can you please look into this asap as this is blocking bringup of RyuJIt based compilation on Mac? It maybe associated with #41.

(lldb) thread backtrace

  • thread Add GC source files #1: tid = 0x6ce24f, 0x00007fff90c4eb99 libc++abi.dylib`__cxa_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    • frame #0: 0x00007fff90c4eb99 libc++abi.dylib__cxa_throw frame #1: 0x000000010201eb3e libcoreclr.dylibSEHRaiseException(CorUnix::CPalThread_, EXCEPTION_POINTERS, int) + 94
      frame Add basic build scripts #2: 0x000000010201ed92 libcoreclr.dylibRaiseException + 594 frame #3: 0x00000001021621ef libcoreclr.dylibRaiseTheExceptionInternalOnly(Object_, int, int) + 783
      frame Improve .gitignore #4: 0x0000000102162bc5 libcoreclr.dylibUnwindAndContinueRethrowHelperAfterCatch(Frame_, Exception_) + 165 frame #5: 0x00000001022f791d libcoreclr.dylibJIT_Overflow() + 157
      frame CoreLib doesn't implement Environment.GetEnvironmentVariable and friends #6: 0x000000011e21b8f4
      frame Add type system source files #7: 0x000000011e21b859
      frame Add type system source files #8: 0x000000011e21f084
      frame Add initial corert build scripts #9: 0x000000011e21ef4e
      frame Add ILToNative source files #10: 0x000000011e21ee9e
      frame Add JitInterface sources #11: 0x000000010237569b libcoreclr.dylibUMThunkStub + 273 frame #12: 0x000000011f0df536 ryujit.dylibCompiler::impCheckCanInline(GenTree_, CORINFO_METHOD_STRUCT__, unsigned int, CORINFO_METHOD_STRUCT__, InlineCandidateInfo**)::$3::operator()(Compiler::impCheckCanInline(GenTree*, CORINFO_METHOD_STRUCT_, unsigned int, CORINFO_METHOD_STRUCT__, InlineCandidateInfo**)::JITParam) const + 710
      frame Initial population of CoreRT Runtime files. #13: 0x000000011f0df052 ryujit.dylibCompiler::impCheckCanInline(GenTree_, CORINFO_METHOD_STRUCT__, unsigned int, CORINFO_METHOD_STRUCT__, InlineCandidateInfo**) + 450 frame #14: 0x000000011f0c0524 ryujit.dylibCompiler::impMarkInlineCandidate(GenTree*, CORINFO_METHOD_STRUCT
      ) + 980
      frame Set AllowUnsafeBlocks irrespective of build configuration #15: 0x000000011f0bef5e ryujit.dylibCompiler::impImportCall(opcode_t, CORINFO_RESOLVED_TOKEN_, CORINFO_RESOLVED_TOKEN_, GenTree_, int, CORINFO_CALL_INFO_, unsigned int) + 10142 frame #16: 0x000000011f0d0192 ryujit.dylibCompiler::impImportBlockCode(BasicBlock
      ) + 51618
      frame Add support for non-GC static fields #17: 0x000000011f0dc458 ryujit.dylibCompiler::impImportBlock(BasicBlock_)::$_1::operator()(FilterVerificationExceptionsParam_) const + 88 frame #18: 0x000000011f0db1d6 ryujit.dylibCompiler::impImportBlock(BasicBlock*) + 438
      frame Unify caching pattern between EcmaMethod and EcmaField #19: 0x000000011f0ddbdb ryujit.dylibCompiler::impImport(BasicBlock*) + 1211 frame #20: 0x000000011f03f797 ryujit.dylibCompiler::fgImport() + 39
      frame Wire up CppCodeGen into ILToNative #21: 0x000000011f00e635 ryujit.dylibCompiler::compCompile(void**, unsigned int_, unsigned int) + 501 frame #22: 0x000000011f0112fc ryujit.dylibCompiler::compCompileHelper(CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, CorInfoInstantiationVerification) + 2956
      frame Make ThreadSafeFlags public #23: 0x000000011f00fe49 ryujit.dylibCompiler::compCompile(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO*, void**, unsigned int_, unsigned int)::$_0::operator()(Compiler::compCompile(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int)::__JITParam_) const + 105 frame #24: 0x000000011f00fcfd ryujit.dylibCompiler::compCompile(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int) + 2205
      frame Make build.cmd more like the build.cmd in CoreCLR repo #25: 0x000000011f0149d4 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*)::$_3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*) const::__JITParam*) const::'lambda'(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*) const::$_3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*) const::__JITParam*) const::__JITParam*)::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*) const::$_3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*) const::__JITParam*) const::__JITParam*) const + 420 frame #26: 0x000000011f012873 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_)::$3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_)::JITParam) const + 99
      frame Enhance virtual function resolution logic to be roughly correct. #27: 0x000000011f0125c3 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int, void_) + 595 frame #28: 0x000000011f01e506 ryujit.dylibCILJit::compileMethod(ICorJitInfo
      , CORINFO_METHOD_INFO_, unsigned int, unsigned char__, unsigned int_) + 278
      frame Fix build break #29: 0x000000011d471144
      frame Add field layout tests #30: 0x000000011e2197b1
      frame Improve name mangling #31: 0x000000011e21661c
      frame Name mangling robustness #32: 0x000000011e204716
      frame Add tests for static field layout #33: 0x000000011e2046a9
      frame Static/instance field layout tests for non x64 architectures #34: 0x000000011d439252
      frame Initial hookup of GC code to MRT code #35: 0x000000011d43686b
      frame Get Array1 to work #36: 0x00000001023748da libcoreclr.dylibFastCallFinalizeWorker_End + 124 frame #37: 0x000000010228fe15 libcoreclr.dylibMethodDescCallSite::CallTargetWorker(unsigned long const_) + 917
      frame Fix project GUID in the ProjectReference from ILToNative #38: 0x00000001021087de libcoreclr.dylibRunMain(MethodDesc_, short, int_, PtrArray__) + 670 frame #39: 0x0000000102108964 libcoreclr.dylibAssembly::ExecuteMainMethod(PtrArray__) + 212
      frame Switch to protojit.dll #40: 0x00000001021402c5 libcoreclr.dylibCorHost2::ExecuteAssembly(unsigned int, char16_t const_, int, char16_t const**, unsigned int_) + 389 frame #41: 0x0000000102082da0 libcoreclr.dylibcoreclr_execute_assembly + 288
      frame Dependency Analysis Framework #42: 0x0000000100001c53 corerunExecuteManagedAssembly(char const_, char const_, char const_, int, char const**) + 1075 frame #43: 0x00000001000025ab coreruncorerun(int, char const**) + 395
      frame Add support for GC static fields #44: 0x00007fff95f1b5ad libdyld.dylibstart + 1 frame #45: 0x00007fff95f1b5ad libdyld.dylibstart + 1
      (lldb) c
      Process 30721 resuming
      Process 30721 stopped
  • thread Add GC source files #1: tid = 0x6ce24f, 0x00007fff90c4eb99 libc++abi.dylib__cxa_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00007fff90c4eb99 libc++abi.dylib__cxa_throw
    libc++abi.dylib`__cxa_throw:
    -> 0x7fff90c4eb99 <+0>: pushq %rbp
    0x7fff90c4eb9a <+1>: movq %rsp, %rbp
    0x7fff90c4eb9d <+4>: pushq %r15
    0x7fff90c4eb9f <+6>: pushq %r14
    (lldb) thread backtrace
  • thread Add GC source files #1: tid = 0x6ce24f, 0x00007fff90c4eb99 libc++abi.dylib`__cxa_throw, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    • frame #0: 0x00007fff90c4eb99 libc++abi.dylib__cxa_throw frame #1: 0x00000001022c753f libcoreclr.dylibThrowExceptionHelper + 95
      frame Add basic build scripts #2: 0x0000000102375501 libcoreclr.dylibStartUnwindingNativeFrames + 67 frame #3: 0x000000010237569b libcoreclr.dylibUMThunkStub + 273
      frame Improve .gitignore #4: 0x000000011f0df536 ryujit.dylibCompiler::impCheckCanInline(GenTree*, CORINFO_METHOD_STRUCT_*, unsigned int, CORINFO_METHOD_STRUCT_*, InlineCandidateInfo**)::$_3::operator()(Compiler::impCheckCanInline(GenTree*, CORINFO_METHOD_STRUCT_*, unsigned int, CORINFO_METHOD_STRUCT_*, InlineCandidateInfo**)::__JITParam*) const + 710 frame #5: 0x000000011f0df052 ryujit.dylibCompiler::impCheckCanInline(GenTree_, CORINFO_METHOD_STRUCT__, unsigned int, CORINFO_METHOD_STRUCT__, InlineCandidateInfo__) + 450
      frame CoreLib doesn't implement Environment.GetEnvironmentVariable and friends #6: 0x000000011f0c0524 ryujit.dylibCompiler::impMarkInlineCandidate(GenTree_, CORINFO_METHOD_STRUCT__) + 980 frame #7: 0x000000011f0bef5e ryujit.dylibCompiler::impImportCall(opcode_t, CORINFO_RESOLVED_TOKEN_, CORINFO_RESOLVED_TOKEN_, GenTree_, int, CORINFO_CALL_INFO_, unsigned int) + 10142
      frame Add type system source files #8: 0x000000011f0d0192 ryujit.dylibCompiler::impImportBlockCode(BasicBlock_) + 51618 frame #9: 0x000000011f0dc458 ryujit.dylibCompiler::impImportBlock(BasicBlock*)::$1::operator()(FilterVerificationExceptionsParam*) const + 88
      frame Add ILToNative source files #10: 0x000000011f0db1d6 ryujit.dylibCompiler::impImportBlock(BasicBlock_) + 438 frame #11: 0x000000011f0ddbdb ryujit.dylibCompiler::impImport(BasicBlock
      ) + 1211
      frame Make simple test work #12: 0x000000011f03f797 ryujit.dylibCompiler::fgImport() + 39 frame #13: 0x000000011f00e635 ryujit.dylibCompiler::compCompile(void**, unsigned int_, unsigned int) + 501
      frame Implement simple casting #14: 0x000000011f0112fc ryujit.dylibCompiler::compCompileHelper(CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, CorInfoInstantiationVerification) + 2956 frame #15: 0x000000011f00fe49 ryujit.dylibCompiler::compCompile(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int)::$0::operator()(Compiler::compCompile(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int)::JITParam) const + 105
      frame Fix build warnings around NuGet dependencies #16: 0x000000011f00fcfd ryujit.dylibCompiler::compCompile(CORINFO_METHOD_STRUCT__, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int) + 2205 frame #17: 0x000000011f0149d4 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT
      _, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int, void_)::$3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void__, unsigned int_, unsigned int, void_) const::JITParam) const::'lambda'(jitNativeCode(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_) const::$3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_) const::JITParam) const::JITParam)::operator()(jitNativeCode(CORINFO_METHOD_STRUCT, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_) const::$3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_, CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_) const::JITParam) const::JITParam) const + 420
      frame Delete project.lock.json and add it to .gitignore instead #18: 0x000000011f012873 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*)::$_3::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, unsigned int, void*)::__JITParam*) const + 99 frame #19: 0x000000011f0125c3 ryujit.dylibjitNativeCode(CORINFO_METHOD_STRUCT
      , CORINFO_MODULE_STRUCT__, ICorJitInfo_, CORINFO_METHOD_INFO_, void**, unsigned int_, unsigned int, void_) + 595
      frame Move thread safe flag manipulation into a helper #20: 0x000000011f01e506 ryujit.dylibCILJit::compileMethod(ICorJitInfo_, CORINFO_METHOD_INFO_, unsigned int, unsigned char**, unsigned int_) + 278 frame #21: 0x000000011d471144 frame #22: 0x000000011e2197b1 frame #23: 0x000000011e21661c frame #24: 0x000000011e204716 frame #25: 0x000000011e2046a9 frame #26: 0x000000011d439252 frame #27: 0x000000011d43686b frame #28: 0x00000001023748da libcoreclr.dylibFastCallFinalizeWorker_End + 124
      frame Fix build break #29: 0x000000010228fe15 libcoreclr.dylibMethodDescCallSite::CallTargetWorker(unsigned long const_) + 917 frame #30: 0x00000001021087de libcoreclr.dylibRunMain(MethodDesc*, short, int*, PtrArray**) + 670
      frame Improve name mangling #31: 0x0000000102108964 libcoreclr.dylibAssembly::ExecuteMainMethod(PtrArray**) + 212 frame #32: 0x00000001021402c5 libcoreclr.dylibCorHost2::ExecuteAssembly(unsigned int, char16_t const*, int, char16_t const**, unsigned int_) + 389
      frame Add tests for static field layout #33: 0x0000000102082da0 libcoreclr.dylibcoreclr_execute_assembly + 288 frame #34: 0x0000000100001c53 corerunExecuteManagedAssembly(char const_, char const_, char const_, int, char const**) + 1075
      frame Initial hookup of GC code to MRT code #35: 0x00000001000025ab coreruncorerun(int, char const**) + 395 frame #36: 0x00007fff95f1b5ad libdyld.dylibstart + 1
      frame Factor out the type system into a separate assembly #37: 0x00007fff95f1b5ad libdyld.dylib`start + 1
      (lldb) c
      Process 30721 resuming

Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow.
at Internal.JitInterface.CorInfoImpl.HandleToObject(IntPtr handle)
at Internal.JitInterface.CorInfoImpl.HandleToObject(CORINFO_METHOD_STRUCT_* method)
at Internal.JitInterface.CorInfoImpl.typeFromContext(CORINFO_CONTEXT_STRUCT* contextStruct)
at Internal.JitInterface.CorInfoImpl.initClass(IntPtr this, CORINFO_FIELD_STRUCT* field, CORINFO_METHOD_STRUCT_* method, CORINFO_CONTEXT_STRUCT* context, Boolean speculative)
Process 30721 exited with status = 6 (0x00000006)

@kangaroo
Copy link
Contributor

kangaroo commented Dec 8, 2015

@gkhanna79 For future reference, you can mark up backtraces with ``` to make them much more readable.

@gkhanna79
Copy link
Member Author

Fixed with #544

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants