Frame layout change
This CL slightly changes the frame layout to remove an old unnecessary
slot, allow for the inclusion of compiler-generated temps and
unifies all variable offset calculation into a single function shared
by the compilers and the runtime system.
o Update the GetVRegOffset function in stack.cc to understand the
new layout.
o Remove compiler-private offset calculation code and route
everything through the shared GetVRegOffset in thread.cc.
o Remove "filler word" that existed immediately after the last
Dalvik local. This was there to address an initial concern that
I had about a single argument register being reused later as a
long. Now convinced that it won't happen.
o Extend the old "padding" region to include compiler-created temps
that can appear to the rest of the rest of the system as
Dalvik registers. The new temps will have Dalvik register numbers
of -2 and lower.
o Treat Method* for the current method as a special Dalvik register
denoted by reg number -1.
Change-Id: I5b5f3aef9c6a01d3a647ced6ec06981ed228c785
diff --git a/src/compiler/Ralloc.cc b/src/compiler/Ralloc.cc
index abc573e..5176edc 100644
--- a/src/compiler/Ralloc.cc
+++ b/src/compiler/Ralloc.cc
@@ -406,15 +406,12 @@
}
/* Figure out the frame size */
- static const int kStackAlignWords = kStackAlignment/sizeof(uint32_t);
- cUnit->numPadding = (kStackAlignWords -
- (cUnit->numCoreSpills + cUnit->numFPSpills + cUnit->numRegs +
- cUnit->numOuts + 2)) & (kStackAlignWords - 1);
- cUnit->frameSize = (cUnit->numCoreSpills + cUnit->numFPSpills +
- cUnit->numRegs + cUnit->numOuts +
- cUnit->numPadding + 2) * 4;
- cUnit->insOffset = cUnit->frameSize + 4;
- cUnit->regsOffset = (cUnit->numOuts + cUnit->numPadding + 1) * 4;
+ static const uint32_t kAlignMask = kStackAlignment - 1;
+ uint32_t size = (cUnit->numCoreSpills + cUnit->numFPSpills +
+ cUnit->numRegs + cUnit->numOuts + cUnit->numCompilerTemps +
+ 1 /* curMethod* */) * sizeof(uint32_t);
+ /* Align and set */
+ cUnit->frameSize = (size + kAlignMask) & ~(kAlignMask);
}
} // namespace art