Ignore:
Timestamp:
May 1, 2017, 9:32:08 PM (8 years ago)
Author:
[email protected]
Message:

[aarch64][Linux] m_allowScratchRegister assert hit in MacroAssemblerARM64 under B3::Air::CCallSpecial::generate()
https://bugs.webkit.org/show_bug.cgi?id=170672

Reviewed by Filip Pizlo.

In Air::CCallSpecial::admitsStack() we reject admitting the callee argument on
the stack for ARM64 because that can lead to disallowed usage of the scratch
register in MacroAssemblerARM64 when generating a call with an address Arg
in Air::CCallSpecial::generate().

The testLinearScanWithCalleeOnStack test is added to testb3. It reproduces the
original issue by force-spilling everything on the stack and enforcing the use
of the linear scan register allocation by using an optimization level of 1.

  • b3/air/AirCCallSpecial.cpp:

(JSC::B3::Air::CCallSpecial::admitsStack):

  • b3/testb3.cpp:

(JSC::B3::testLinearScanWithCalleeOnStack):
(JSC::B3::run):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/b3/testb3.cpp

    r215908 r216058  
    1042610426
    1042710427    CHECK(compileAndRun<float>(proc) == functionWithHellaFloatArguments(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26));
     10428}
     10429
     10430void testLinearScanWithCalleeOnStack()
     10431{
     10432    // This tests proper CCall generation when compiling with a lower optimization
     10433    // level and operating with a callee argument that's spilt on the stack.
     10434    // On ARM64, this caused an assert in MacroAssemblerARM64 because of disallowed
     10435    // use of the scratch register.
     10436    // https://bugs.webkit.org/show_bug.cgi?id=170672
     10437
     10438    Procedure proc;
     10439    BasicBlock* root = proc.addBlock();
     10440
     10441    root->appendNewControlValue(
     10442        proc, Return, Origin(),
     10443        root->appendNew<CCallValue>(
     10444            proc, Int32, Origin(),
     10445            root->appendNew<ConstPtrValue>(proc, Origin(), bitwise_cast<void*>(simpleFunction)),
     10446            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0),
     10447            root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1)));
     10448
     10449    // Force the linear scan algorithm to spill everything.
     10450    auto original = Options::airLinearScanSpillsEverything();
     10451    Options::airLinearScanSpillsEverything() = true;
     10452
     10453    // Compiling with 1 as the optimization level enforces the use of linear scan
     10454    // for register allocation.
     10455    auto code = compileProc(proc, 1);
     10456    CHECK_EQ(invoke<int>(*code, 41, 1), 42);
     10457
     10458    Options::airLinearScanSpillsEverything() = original;
    1042810459}
    1042910460
     
    1631916350    RUN_BINARY(testCallSimpleFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
    1632016351    RUN(testCallFunctionWithHellaFloatArguments());
     16352
     16353    RUN(testLinearScanWithCalleeOnStack());
    1632116354
    1632216355    RUN(testChillDiv(4, 2, 2));
Note: See TracChangeset for help on using the changeset viewer.