summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-08-09 22:05:32 -0700
committerIan Rogers <irogers@google.com>2013-08-09 22:23:50 -0700
commit1809a72a66d245ae598582d658b93a24ac3bf01e (patch)
treef864ff869185b2873637ca70584c66fd6a1e899d /runtime/stack.h
parenta9a50926963b5093fb851ed966d201f3e95f72d3 (diff)
downloadart-1809a72a66d245ae598582d658b93a24ac3bf01e.zip
art-1809a72a66d245ae598582d658b93a24ac3bf01e.tar.gz
art-1809a72a66d245ae598582d658b93a24ac3bf01e.tar.bz2
Uleb128 compression of vmap and mapping table.
Bug 9437697. Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h72
1 files changed, 0 insertions, 72 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index de93846..388e401 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -571,78 +571,6 @@ class StackVisitor {
Context* const context_;
};
-class VmapTable {
- public:
- explicit VmapTable(const uint16_t* table) : table_(table) {
- }
-
- uint16_t operator[](size_t i) const {
- return table_[i + 1];
- }
-
- size_t size() const {
- return table_[0];
- }
-
- // Is the dex register 'vreg' in the context or on the stack? Should not be called when the
- // 'kind' is unknown or constant.
- bool IsInContext(size_t vreg, uint32_t& vmap_offset, VRegKind kind) const {
- DCHECK(kind == kReferenceVReg || kind == kIntVReg || kind == kFloatVReg ||
- kind == kLongLoVReg || kind == kLongHiVReg || kind == kDoubleLoVReg ||
- kind == kDoubleHiVReg || kind == kImpreciseConstant);
- vmap_offset = 0xEBAD0FF5;
- // TODO: take advantage of the registers being ordered
- // TODO: we treat kImpreciseConstant as an integer below, need to ensure that such values
- // are never promoted to floating point registers.
- bool is_float = (kind == kFloatVReg) || (kind == kDoubleLoVReg) || (kind == kDoubleHiVReg);
- bool in_floats = false;
- for (size_t i = 0; i < size(); ++i) {
- // Stop if we find what we are are looking for.
- if ((table_[i + 1] == vreg) && (in_floats == is_float)) {
- vmap_offset = i;
- return true;
- }
- // 0xffff is the marker for LR (return PC on x86), following it are spilled float registers.
- if (table_[i + 1] == 0xffff) {
- in_floats = true;
- }
- }
- return false;
- }
-
- // Compute the register number that corresponds to the entry in the vmap (vmap_offset, computed
- // by IsInContext above). If the kind is floating point then the result will be a floating point
- // register number, otherwise it will be an integer register number.
- uint32_t ComputeRegister(uint32_t spill_mask, uint32_t vmap_offset, VRegKind kind) const {
- // Compute the register we need to load from the context.
- DCHECK(kind == kReferenceVReg || kind == kIntVReg || kind == kFloatVReg ||
- kind == kLongLoVReg || kind == kLongHiVReg || kind == kDoubleLoVReg ||
- kind == kDoubleHiVReg || kind == kImpreciseConstant);
- // TODO: we treat kImpreciseConstant as an integer below, need to ensure that such values
- // are never promoted to floating point registers.
- bool is_float = (kind == kFloatVReg) || (kind == kDoubleLoVReg) || (kind == kDoubleHiVReg);
- uint32_t matches = 0;
- if (is_float) {
- while (table_[matches] != 0xffff) {
- matches++;
- }
- }
- CHECK_LT(vmap_offset - matches, static_cast<uint32_t>(__builtin_popcount(spill_mask)));
- uint32_t spill_shifts = 0;
- while (matches != (vmap_offset + 1)) {
- DCHECK_NE(spill_mask, 0u);
- matches += spill_mask & 1; // Add 1 if the low bit is set
- spill_mask >>= 1;
- spill_shifts++;
- }
- spill_shifts--; // wind back one as we want the last match
- return spill_shifts;
- }
-
- private:
- const uint16_t* table_;
-};
-
} // namespace art
#endif // ART_RUNTIME_STACK_H_