Fix AssemblerMIPS64Test.LongBalc() running out of memory.
Pre-allocate the necessary buffer because the reallocation
strategy doesn't work well for a test of this size.
Test: m test-art-host-gtest-assembler_mips64_test
Change-Id: I16bc75f0ae83a62e5f3ed2cd8228dd40f0eb9524
diff --git a/compiler/utils/mips64/assembler_mips64_test.cc b/compiler/utils/mips64/assembler_mips64_test.cc
index 31d3e4c..f62822d 100644
--- a/compiler/utils/mips64/assembler_mips64_test.cc
+++ b/compiler/utils/mips64/assembler_mips64_test.cc
@@ -605,15 +605,18 @@
}
TEST_F(AssemblerMIPS64Test, LongBalc) {
+ constexpr uint32_t kNopCount1 = (1u << 25) + 1;
+ constexpr uint32_t kNopCount2 = (1u << 25) + 1;
+ constexpr uint32_t kRequiredCapacity = (kNopCount1 + kNopCount2 + 6u) * 4u;
+ ASSERT_LT(__ GetBuffer()->Capacity(), kRequiredCapacity);
+ __ GetBuffer()->ExtendCapacity(kRequiredCapacity);
mips64::Mips64Label label1, label2;
__ Balc(&label1);
- constexpr uint32_t kNopCount1 = (1u << 25) + 1;
for (uint32_t i = 0; i != kNopCount1; ++i) {
__ Nop();
}
__ Bind(&label1);
__ Balc(&label2);
- constexpr uint32_t kNopCount2 = (1u << 25) + 1;
for (uint32_t i = 0; i != kNopCount2; ++i) {
__ Nop();
}