Add the ifdefs to use hardfloat if required for generate_slow_signature_handler

Mingliang Yi mingliang.yi at linaro.org
Mon Feb 15 14:44:42 UTC 2016


Afert merged the patch:
http://hg.openjdk.java.net/aarch32-port/jdk8u/hotspot/rev/dc9b82a9fbc7 ,I
run the following test:

/******* test begin *******/

import java.awt.*;

import java.awt.image.BufferedImage;

public class JoinMiterTest {

  public static void main(String[] args) throws Exception {

    BufferedImage image = new BufferedImage(200, 200,

    BufferedImage.TYPE_INT_RGB);

    Graphics2D g = image.createGraphics();

    g.fill(new Rectangle(image.getWidth(), image.getHeight()));

    }

}

/******* test end *******/



It stopped with"Segment fault". The problem comes from the function
AbstractInterpreterGenerator::generate_slow_signature_handler:

/******* trouble code begin *******/

for (int i = 0; i < Argument::n_float_register_parameters_c; i++) {

    const FloatRegister r = as_FloatRegister(i);

    Label d, done;

    __ tbnz(c_rarg3, i, d);

    __ vldr_f32(r, Address(sp, (6 + 2 * i) * wordSize));

    __ b(done);

    __ bind(d);

    __ vldr_f64(r, Address(sp, (6 + 2 * i) * wordSize));

    __ bind(done);

  }

/******* trouble code end *******/



Here, n_float_register_parameters_c = 8,and when i = 7,it would generate
the instruction ldrd  lr , [sp , #80], which will change the value of PC,
and cause the problem of "Segment fault".

generate_slow_signature_handler downward call stack is as below:

#0  SlowSignatureHandler::pass_long

#1  SlowSignatureHandler::pass_double

#2  NativeSignatureIterator::do_double

#3  SignatureIterator::parse_type

#4  SignatureIterator::iterate_parameters

#5  SignatureIterator::iterate_parameters

#6  NativeSignatureIterator::iterate

#7  InterpreterRuntime::slow_signature_handler

#8  AbstractInterpreterGenerator::generate_slow_signature_handler



The problem comes from #1 pass_double, the mentioned patch changes
“pass_double() { pass_double(); }” to “pass_double() { pass_long(); }”.
Pass_double writes fp_args to the fp location stack , pass_long writes
int_args to the int location stack, but later, the trouble code in #8
AbstractInterpreterGenerator::generate_slow_signature_handler will always
read from the fp loacation stack. I add the ifdefs to use hardfloat if
required.


/******* patch begin *******/

--- a/src/cpu/aarch32/vm/interpreter_aarch32.cpp Wed Jan 27 11:38:31 2016
+0000

+++ b/src/cpu/aarch32/vm/interpreter_aarch32.cpp     Tue Feb 02 12:07:57
2016 +0800

@@ -90,6 +90,7 @@

   // Restore LR

   __ ldr(lr, sp);

+  #ifdef HARD_FLOAT_CC

   // Do FP first so we can use c_rarg3 as temp

   __ ldr(c_rarg3, Address(sp, wordSize)); // float/double identifiers

@@ -105,6 +106,7 @@

     __ vldr_f64(r, Address(sp, (6 + 2 * i) * wordSize));

     __ bind(done);

   }

+  #endif //HARD_FLOAT_CC

   // c_rarg0 contains the result from the call of

   // InterpreterRuntime::slow_signature_handler so we don't touch it

/******* patch end *******/


More information about the aarch32-port-dev mailing list