[aarch64-port-dev ] Wrong memory transfer size in TemplateInterpreterGenerator::generate_throw_exception
Andrew Haley
aph at redhat.com
Sat Dec 14 10:37:17 PST 2013
On 12/14/2013 06:17 PM, D.Sturm wrote:
> In TemplateInterpreterGenerator::generate_throw_exception there's the
> following code:
>
> __ ldr(r3, Address(rthread, JavaThread::popframe_condition_offset()));
> __ orr(r3, r3, JavaThread::popframe_processing_bit);
> __ str(r3, Address(rthread, JavaThread::popframe_condition_offset()));
>
> but _popframe_condition is an int (defined in thread.hpp) and only
> guaranteed to be aligned on a 4-byte boundary. This leads to problems if
> the field is not accidentally aligned to 8-byte, since the offset is too
> large to be loaded unscaled.
>
> The fix should be to replace the instructions with the word-sized version,
> if I don't completely misunderstand the problem.
Ah yes, you are exactly right. Fixed thusly.
Andrew.
# HG changeset patch
# User aph
# Date 1387045846 0
# Node ID 8bc26b9dbb30ed5831a61c48b21037d5aad3e53b
# Parent 9e5ecee291687997e85b12da16166cfb0839b89f
_popframe_condition is an int, not a word
diff -r 9e5ecee29168 -r 8bc26b9dbb30 src/cpu/aarch64/vm/interp_masm_aarch64.cpp
--- a/src/cpu/aarch64/vm/interp_masm_aarch64.cpp Sat Dec 14 18:29:27 2013 +0000
+++ b/src/cpu/aarch64/vm/interp_masm_aarch64.cpp Sat Dec 14 18:30:46 2013 +0000
@@ -58,10 +58,10 @@
// don't want to reenter.
// This method is only called just after the call into the vm in
// call_VM_base, so the arg registers are available.
- ldr(rscratch1, Address(rthread, JavaThread::popframe_condition_offset()));
- tst(rscratch1, JavaThread::popframe_pending_bit);
+ ldrw(rscratch1, Address(rthread, JavaThread::popframe_condition_offset()));
+ tstw(rscratch1, JavaThread::popframe_pending_bit);
br(Assembler::EQ, L);
- tst(rscratch1, JavaThread::popframe_processing_bit);
+ tstw(rscratch1, JavaThread::popframe_processing_bit);
br(Assembler::NE, L);
// Call Interpreter::remove_activation_preserving_args_entry() to get the
// address of the same-named entrypoint in the generated interpreter code.
diff -r 9e5ecee29168 -r 8bc26b9dbb30 src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp
--- a/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp Sat Dec 14 18:29:27 2013 +0000
+++ b/src/cpu/aarch64/vm/templateInterpreter_aarch64.cpp Sat Dec 14 18:30:46 2013 +0000
@@ -1618,9 +1618,9 @@
// indicating that we are currently handling popframe, so that
// call_VMs that may happen later do not trigger new popframe
// handling cycles.
- __ ldr(r3, Address(rthread, JavaThread::popframe_condition_offset()));
+ __ ldrw(r3, Address(rthread, JavaThread::popframe_condition_offset()));
__ orr(r3, r3, JavaThread::popframe_processing_bit);
- __ str(r3, Address(rthread, JavaThread::popframe_condition_offset()));
+ __ strw(r3, Address(rthread, JavaThread::popframe_condition_offset()));
{
// Check to see whether we are returning to a deoptimized frame.
@@ -1712,7 +1712,7 @@
}
// Clear the popframe condition flag
- __ str(zr, Address(rthread, JavaThread::popframe_condition_offset()));
+ __ strw(zr, Address(rthread, JavaThread::popframe_condition_offset()));
assert(JavaThread::popframe_inactive == 0, "fix popframe_inactive");
#if INCLUDE_JVMTI
More information about the aarch64-port-dev
mailing list