eclipse-omr / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
949 stars 396 forks source link

Assertion failure in JitBuilder thunk test on AArch64 #7096

Open knn-k opened 1 year ago

knn-k commented 1 year ago

A JitBuilder test fails on AArch64 macOS as shown below.

https://ci.eclipse.org/omr/job/PullRequest-osx_aarch64/107/consoleText :

[2023-08-22T22:56:22.855Z] test 9
[2023-08-22T22:56:22.855Z]       Start  9: thunk_example_as_test
[2023-08-22T22:56:22.855Z] 
[2023-08-22T22:56:22.855Z] 9: Test command: /Users/omr/workspace/Build/build/jitbuilder/release/thunk
[2023-08-22T22:56:22.855Z] 9: Working Directory: /Users/omr/workspace/Build/build/jitbuilder/release
[2023-08-22T22:56:22.855Z] 9: Test timeout computed to be: 10000000
[2023-08-22T22:56:22.855Z] 9: Assertion failed at /Users/omr/workspace/Build/compiler/aarch64/codegen/OMRCodeGenerator.cpp:355: false
[2023-08-22T22:56:22.855Z] 9:   using system linkage for unrecognized convention 1
[2023-08-22T22:56:22.855Z] 9: compiling /Users/omr/workspace/Build/compiler/ilgen/OMRThunkBuilder.cpp:51:1b at level: warm
[2023-08-22T22:56:22.855Z] 9: 
[2023-08-22T22:56:22.855Z]  9/31 Test  #9: thunk_example_as_test .............SIGTRAP***Exception:   0.12 sec
knn-k commented 1 year ago

The test was added recently by PR #7091.

knn-k commented 1 year ago

I can reproduce the assertion failure on AArch64 Linux. TR_Private (1) is passed to OMR::CodeGenerator::getLinkage().

$ ./jitbuilder/release/thunk
Step 1: initialize JIT
Step 2: create TypeDictionary instance
Step 3: test primitive thunk returning void
Assertion failed at /home/openj9/omr/compiler/aarch64/codegen/OMRCodeGenerator.cpp:352: false
    using system linkage for unrecognized convention 1
compiling /home/openj9/omr/compiler/ilgen/OMRThunkBuilder.cpp:51:1b at level: warm
#1  0x0000aaaaaaeed59c in OMR::CodeGenerator::getLinkage(TR_LinkageConventions) ()
#2  0x0000aaaaaaedddb0 in OMR::CodeGenerator::simulateNodeEvaluation(TR::Node*, OMR::CodeGenerator::TR_RegisterPressureState*, OMR::CodeGenerator::TR_RegisterPressureSummary*) ()
#3  0x0000aaaaaaedd850 in OMR::CodeGenerator::simulateTreeEvaluation(TR::Node*, OMR::CodeGenerator::TR_RegisterPressureState*, OMR::CodeGenerator::TR_RegisterPressureSummary*) ()
#4  0x0000aaaaaaede10c in OMR::CodeGenerator::simulateNodeEvaluation(TR::Node*, OMR::CodeGenerator::TR_RegisterPressureState*, OMR::CodeGenerator::TR_RegisterPressureSummary*) ()
#5  0x0000aaaaaaedd850 in OMR::CodeGenerator::simulateTreeEvaluation(TR::Node*, OMR::CodeGenerator::TR_RegisterPressureState*, OMR::CodeGenerator::TR_RegisterPressureSummary*) ()
#6  0x0000aaaaaaedc440 in OMR::CodeGenerator::simulateBlockEvaluation(TR::Block*, OMR::CodeGenerator::TR_RegisterPressureState*, OMR::CodeGenerator::TR_RegisterPressureSummary*)
    ()
#7  0x0000aaaaaaed8ae0 in OMR::CodeGenerator::pickRegister(TR::RegisterCandidate*, TR::Block**, TR_BitVector&, short&, TR_LinkHead<TR::RegisterCandidate>*) ()
#8  0x0000aaaaaae98558 in OMR::ARM64::CodeGenerator::pickRegister(TR::RegisterCandidate*, TR::Block**, TR_BitVector&, short&, TR_LinkHead<TR::RegisterCandidate>*) ()
#9  0x0000aaaaaafe95f0 in OMR::RegisterCandidates::assign(TR::Block**, int, int&, int&) ()
#10 0x0000aaaaab0a3ca8 in TR_GlobalRegisterAllocator::perform() ()
#11 0x0000aaaaaafdac54 in OMR::Optimizer::performOptimization(OptimizationStrategy const*, int, int, int) ()
#12 0x0000aaaaaafd9708 in OMR::Optimizer::performOptimization(OptimizationStrategy const*, int, int, int) ()
#13 0x0000aaaaaafd7cf0 in OMR::Optimizer::optimize() ()
#14 0x0000aaaaaaf27948 in OMR::Compilation::performOptimizations() ()
#15 0x0000aaaaaaf272c4 in OMR::Compilation::compile() ()
#16 0x0000aaaaaaf45768 in compileMethodFromDetails(OMR_VMThread*, TR::IlGeneratorMethodDetails&, TR_Hotness, int&) ()
#17 0x0000aaaaaae05990 in OMR::MethodBuilder::Compile(void**) ()
#18 0x0000aaaaaaec3bf8 in internal_compileMethodBuilder(TR::MethodBuilder*, void**) ()
#19 0x0000aaaaaadeb840 in compileMethodBuilder(OMR::JitBuilder::MethodBuilder*, void**) ()
#20 0x0000aaaaaade9e8c in main ()
knn-k commented 1 year ago

The thunk test has been moved to OMR_JITBUILDER_TEST_EXTENDED.

We need to implement TR::ARM64SystemLinkage::buildIndirectDispatch() to run the test even if the JitBuilder explicitly uses the TR_System linkage.