Add tests for pool blocking in nested ExactAssemblyScope
On top of adding tests, this patch adds a new top-level
MacroAssembler::ArePoolsBlocked() API method. This is useful for testing
that the pools are actually blocked or not, and that nesting does not
accidentally unblock them.
Change-Id: If3845c6686ef45ddf1d28b8876ffd349731cdd9d
diff --git a/test/test-code-generation-scopes.cc b/test/test-code-generation-scopes.cc
index 3b312e9..2a05544 100644
--- a/test/test-code-generation-scopes.cc
+++ b/test/test-code-generation-scopes.cc
@@ -621,18 +621,28 @@
aarch32::MacroAssembler masm;
// By default macro instructions are allowed.
+ VIXL_CHECK(!masm.ArePoolsBlocked());
+ VIXL_ASSERT(!masm.AllowAssembler());
VIXL_ASSERT(masm.AllowMacroInstructions());
{
ExactAssemblyScope scope1(&masm, 2 * aarch32::kA32InstructionSizeInBytes);
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
__ nop();
{
ExactAssemblyScope scope2(&masm, 1 * aarch32::kA32InstructionSizeInBytes);
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
__ nop();
}
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
}
+ VIXL_CHECK(!masm.ArePoolsBlocked());
+ VIXL_ASSERT(!masm.AllowAssembler());
VIXL_ASSERT(masm.AllowMacroInstructions());
{
@@ -651,18 +661,28 @@
aarch64::MacroAssembler masm;
// By default macro instructions are allowed.
+ VIXL_CHECK(!masm.ArePoolsBlocked());
+ VIXL_ASSERT(!masm.AllowAssembler());
VIXL_ASSERT(masm.AllowMacroInstructions());
{
ExactAssemblyScope scope1(&masm, 2 * aarch64::kInstructionSize);
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
__ nop();
{
ExactAssemblyScope scope2(&masm, 1 * aarch64::kInstructionSize);
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
__ nop();
}
+ VIXL_CHECK(masm.ArePoolsBlocked());
+ VIXL_ASSERT(masm.AllowAssembler());
VIXL_ASSERT(!masm.AllowMacroInstructions());
}
+ VIXL_CHECK(!masm.ArePoolsBlocked());
+ VIXL_ASSERT(!masm.AllowAssembler());
VIXL_ASSERT(masm.AllowMacroInstructions());
{