From 57eb0f58419e0e6773f69cf6e0c78e5fed0464cd Mon Sep 17 00:00:00 2001 From: Alexey Frunze Date: Fri, 29 Jul 2016 22:04:46 -0700 Subject: MIPS32: Fill branch delay slots Test: booted MIPS32 in QEMU Test: test-art-host-gtest Test: test-art-target-gtest Test: test-art-target-run-test-optimizing on CI20 Change-Id: I727e80753395ab99fff004cb5d2e0a06409150d7 --- compiler/utils/assembler.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'compiler/utils/assembler.h') diff --git a/compiler/utils/assembler.h b/compiler/utils/assembler.h index 8981776314..b616057e79 100644 --- a/compiler/utils/assembler.h +++ b/compiler/utils/assembler.h @@ -362,6 +362,16 @@ class Assembler : public DeletableArenaObject { // Size of generated code virtual size_t CodeSize() const { return buffer_.Size(); } virtual const uint8_t* CodeBufferBaseAddress() const { return buffer_.contents(); } + // CodePosition() is a non-const method similar to CodeSize(), which is used to + // record positions within the code buffer for the purpose of signal handling + // (stack overflow checks and implicit null checks may trigger signals and the + // signal handlers expect them right before the recorded positions). + // On most architectures CodePosition() should be equivalent to CodeSize(), but + // the MIPS assembler needs to be aware of this recording, so it doesn't put + // the instructions that can trigger signals into branch delay slots. Handling + // signals from instructions in delay slots is a bit problematic and should be + // avoided. + virtual size_t CodePosition() { return CodeSize(); } // Copy instructions out of assembly buffer into the given region of memory virtual void FinalizeInstructions(const MemoryRegion& region) { -- cgit v1.2.3-59-g8ed1b