Allow more vregs in native GC map.
Allow upto 65536 (2**13 * 8) vregs in a reference bitmap as this occurs
in CTS tests. Achieve this by squeezing the numbers of bits used to say
how large in bytes the native PC offset is down to 3 from 8.
Change-Id: Ib0f1df7a492b771e01b0bd79d6648d46b60b5f78
diff --git a/src/compiler/codegen/CodegenUtil.cc b/src/compiler/codegen/CodegenUtil.cc
index fa5c66f..4e39ffc 100644
--- a/src/compiler/codegen/CodegenUtil.cc
+++ b/src/compiler/codegen/CodegenUtil.cc
@@ -780,10 +780,11 @@
}
// Resize table and set up header.
table->resize((EntryWidth() * entries) + sizeof(uint32_t));
- CHECK_LT(native_offset_width_, 1U << 8);
- (*table)[0] = native_offset_width_;
- CHECK_LT(references_width_, 1U << 8);
- (*table)[1] = references_width_;
+ CHECK_LT(native_offset_width_, 1U << 3);
+ (*table)[0] = native_offset_width_ & 7;
+ CHECK_LT(references_width_, 1U << 13);
+ (*table)[0] |= (references_width_ << 3) & 0xFF;
+ (*table)[1] = (references_width_ >> 5) & 0xFF;
CHECK_LT(entries, 1U << 16);
(*table)[2] = entries & 0xFF;
(*table)[3] = (entries >> 8) & 0xFF;
diff --git a/src/gc_map.h b/src/gc_map.h
index 50e63d6..7becda5 100644
--- a/src/gc_map.h
+++ b/src/gc_map.h
@@ -70,7 +70,7 @@
// The number of bytes used to encode registers.
size_t RegWidth() const {
- return data_[1];
+ return ((size_t)data_[0] | ((size_t)data_[1] << 8)) >> 3;
}
private:
@@ -81,7 +81,7 @@
// Number of bytes used to encode a native offset.
size_t NativeOffsetWidth() const {
- return data_[0];
+ return data_[0] & 7;
}
// The width of an entry in the table.