From 1809a72a66d245ae598582d658b93a24ac3bf01e Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 9 Aug 2013 22:05:32 -0700 Subject: Uleb128 compression of vmap and mapping table. Bug 9437697. Change-Id: I30bcb97d12cd8b46d3b2cdcbdd358f08fbb9947a --- runtime/stack.h | 72 --------------------------------------------------------- 1 file changed, 72 deletions(-) (limited to 'runtime/stack.h') 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(__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_ -- cgit v1.1