ARM: fix java.lang.Math.log10

Andrew Haley aph at redhat.com
Mon Jan 16 10:41:37 PST 2012


In JCK testing we discovered that java.lang.Math.log10 causes a crash.

In HotSpot there is a special table of method kinds, and it was
updated to include java.dyn.MethodHandles::invoke.  Unfortunately,
this entry was added in the middle of the list, rather than at the
end, so the java.lang.Math.* entries all move up by one.
java.lang.Math.log10 was at the end of the table, and it fell off.
:-)

Fixed thusly.

Andrew.


2012-01-16  Andrew Haley  <aph at redhat.com>

	* openjdk/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S (asm_method_table):
	Add entry for java.dyn.MethodHandles::invoke.
	(asm_generate_method_entry): Replace constant 14 with calculation
	based on the size of asm_method_table.
	Add some comments.

diff -r 2bbcc83417ae -r f57f03c70b52 arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S
--- a/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Mon Jan 16 13:25:01 2012 -0500
+++ b/arm_port/hotspot/src/cpu/zero/vm/cppInterpreter_arm.S	Mon Jan 16 13:28:17 2012 -0500
@@ -782,28 +782,33 @@
 	cmp	r2, #0
 	bne	1f

-	cmp	r3, #14
+	cmp	r3, #((3f-2f)/4) // i.e. sizeof asm_method_table
 	adrcc	ip, asm_method_table
 	ldrcc	r0, [ip, r3, lsl #2]
 #endif // PRODUCT
 1:
 	bx	lr
+
+// This table must be kept in sync with AbstractInterpreter::MethodKind
 asm_method_table:
-	.word	normal_entry
-	.word	normal_entry_synchronized
-	.word	native_entry
-	.word	native_entry_synchronized
-	.word	empty_entry
-	.word	accessor_entry
-	.word	normal_entry		@ abstract entry
-	.word	normal_entry		@ java_lang_math_sin
-	.word	normal_entry		@ java_lang_math_cos
-	.word	normal_entry		@ java_lang_math_tan
-	.word	normal_entry		@ java_lang_math_abs
-	.word	normal_entry		@ java_lang_math_sqrt
-	.word	normal_entry		@ java_lang_math_log
-	.word	normal_entry		@ java_lang_math_log10
-
+2:
+        .word   normal_entry                    // method needs locals initialization
+        .word   normal_entry_synchronized       // method needs locals initialization & is synchronized
+        .word   native_entry                    // native method
+        .word   native_entry_synchronized       // native method & is synchronized
+        .word   empty_entry                     // empty method (code: _return)
+        .word   accessor_entry                  // accessor method (code: _aload_0, _getfield, _(a|i)return)
+        .word   normal_entry                    // abstract method (throws an AbstractMethodException)
+        .word   vm_fatal_error                  // java.dyn.MethodHandles::invoke
+        .word   normal_entry                    // implementation of java.lang.Math.sin   (x)
+        .word   normal_entry                    // implementation of java.lang.Math.cos   (x)
+        .word   normal_entry                    // implementation of java.lang.Math.tan   (x)
+        .word   normal_entry                    // implementation of java.lang.Math.abs   (x)
+        .word   normal_entry                    // implementation of java.lang.Math.sqrt  (x)
+        .word   normal_entry                    // implementation of java.lang.Math.log   (x)
+        .word   normal_entry                    // implementation of java.lang.Math.log10 (x)
+3:
+	
 	ALIGN_CODE
 native_entry_synchronized:
 	b	fast_native_entry_synchronized




More information about the distro-pkg-dev mailing list