Closed Bug 906418 Opened 11 years ago Closed 9 years ago

IonMonkey: Decouple the stack state from graph traversal order of LIR blocks.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: wuwei, Assigned: wuwei)

References

Details

Attachments

(1 file, 1 obsolete file)

LIRGraph uses a vector (pushedArugmentSlots_) to save the current state of stack on graph level, which impedes LIR reordering optimization (bug 901221). One possible way to solve this problem is to allocate a vector for each LIR blocks which represents the stack stat at the entry of the block.
Blocks: 901221, 877872
Depends on: 877878
Attached patch WIP (obsolete) — Splinter Review
For early feedback.

This patch iterates LBlocks in RPO order. It pushes the pointer of LStackArgT and LStackArgV instructions into a vector in each LBlock, and pops them after LCallNative, LCallDOMNative, LCallGeneric, LCallKnown are iterated.
Attachment #792235 - Flags: feedback?(nicolas.b.pierron)
Comment on attachment 792235 [details] [diff] [review]
WIP

Review of attachment 792235 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/CodeGenerator.cpp
@@ +2644,5 @@
> +        pushedArgumentSlotsMirror.appendAll(pushedArgumentSlots_);
> +#endif
> +        pushedArgumentSlots_.clear();
> +        for (size_t i = 0; i < current->pushedArguments.length(); i++) {
> +            if (current->pushedArguments[i]->accept(this))

No, this is not the way to go.

Here you will push everything back, but the stack is already in a good shape when you jump to it, there is no need to adjust anything.  Only to refresh the memory of the code generator such as it can correctly handle the stack layout.

@@ +2648,5 @@
> +            if (current->pushedArguments[i]->accept(this))
> +                return false;
> +        }
> +#ifdef DEBUG
> +        JS_ASSERT(pushedArgumentSlotsMirror.length() == pushedArgumentSlots_.length());

This assertion does not hold, for the same reason it was failing on the Calls.

::: js/src/jit/IonAnalysis.cpp
@@ +1620,5 @@
> +        block->pushedArguments.appendAll(pushedArguments);
> +        size_t numPoped = 0;
> +        for (LInstructionIterator iter = block->begin(); iter != block->end(); iter++) {
> +            if (iter->isStackArgT() || iter->isStackArgV()) {
> +                pushedArguments.append(*iter);

The vector should be a vector of uint32_t as it is on the CodeGen, filled with:

  StackOffsetToSlot(StackOffsetOfPassedArg(lir->argslot()));

@@ +1621,5 @@
> +        size_t numPoped = 0;
> +        for (LInstructionIterator iter = block->begin(); iter != block->end(); iter++) {
> +            if (iter->isStackArgT() || iter->isStackArgV()) {
> +                pushedArguments.append(*iter);
> +            }

if there is only one line, we do not add brackets.

@@ +1623,5 @@
> +            if (iter->isStackArgT() || iter->isStackArgV()) {
> +                pushedArguments.append(*iter);
> +            }
> +            if (iter->isCallNative()) {
> +                numPoped = iter->toCallNative()->numStackArgs() + 1;

it sounds like you want to add a new virtual function names isJSCall, and use it that way:

  if (iter->isJSCall())
      numPoped = iter->mir()->toCall->numStackArgs();
Attachment #792235 - Flags: feedback?(nicolas.b.pierron)
Attached patch WIPSplinter Review
Fixed nits.
Attachment #792235 - Attachment is obsolete: true
Assignee: general → nobody
Assignee: nobody → lazyparser
This bug was a supplement feature for bug 877878, which is not necessary now. so wontfix.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: