changeset 2881:844ef6a4e570

PR1362: Fedora 19 / rawhide FTBFS SIGILL 2013-04-12 Andrew John Hughes <gnu.andrew@redhat.com> * NEWS: Add PR1362 from last commit and OJ3 identifier to earlier backport. * ChangeLog: Add missing entry for last commit. 2013-04-05 Chris Phillips <chphilli@redhat.com> * arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp: Fix failure in the register allocation logic, diagnosed by Andrew Haley to be an issue with PUSH/POP macro's and assumption of order of evaluation of arguments. The fix includes detection of the condition and bailing from the compilation if a similar failure is detected.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Wed, 17 Apr 2013 08:03:37 +0100
parents 1a2df02fa23d
children bff1ea798749
files ChangeLog NEWS arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp
diffstat 3 files changed, 45 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 16 20:25:56 2013 +0100
+++ b/ChangeLog	Wed Apr 17 08:03:37 2013 +0100
@@ -1,3 +1,20 @@
+2013-04-12  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* NEWS: Add PR1362 from last commit and
+	OJ3 identifier to earlier backport.
+	* ChangeLog: Add missing entry for last
+	commit.
+
+2013-04-05  Chris Phillips  <chphilli@redhat.com>
+
+	* arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp:
+	Fix failure in the register allocation logic,
+	diagnosed by Andrew Haley to be an issue with
+	PUSH/POP macro's and assumption of order of
+	evaluation of arguments.  The fix includes
+	detection of the condition and bailing from the
+	compilation if a similar failure is detected.
+
 2013-04-17  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	* patches/openjdk/6669869-Beans_isDesignTime_should_be_per-AppContext.patch:
--- a/NEWS	Tue Apr 16 20:25:56 2013 +0100
+++ b/NEWS	Wed Apr 17 08:03:37 2013 +0100
@@ -7,6 +7,7 @@
 GX  - http://bugs.gentoo.org/show_bug.cgi?id=X
 CAX - http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id=X
 LPX - https://bugs.launchpad.net/bugs/X 
+OJX - http://java.net/jira/browse/OPENJDK6-X
 
 CVE-XXXX-YYYY: http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=XXXX-YYYY
 
@@ -56,7 +57,8 @@
   - S7064279: Introspector.getBeanInfo() should release some resources in timely manner
   - S8004302: javax/xml/soap/Test7013971.java fails since jdk6u39b01
 * Bug fixes
-  - Fix get_stack_bounds memory leak (alternate fix for S7197906)
+  - OJ3: Fix get_stack_bounds memory leak (alternate fix for S7197906)
+  - PR1362: Fedora 19 / rawhide FTBFS SIGILL
 
 New in release 1.11.9 (2013-03-04):
 
--- a/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp	Tue Apr 16 20:25:56 2013 +0100
+++ b/arm_port/hotspot/src/cpu/zero/vm/thumb2.cpp	Wed Apr 17 08:03:37 2013 +0100
@@ -1,5 +1,6 @@
 /*
  * Copyright 2009, 2010 Edward Nevill
+ * Copyright 2013 Red Hat
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -399,6 +400,8 @@
 
 static jmp_buf compiler_error_env;
 
+#define J_BogusImplementation() longjmp(compiler_error_env, COMPILER_RESULT_FAILED)
+
 #ifdef PRODUCT
 
 #define JASSERT(cond, msg)	0
@@ -3472,8 +3475,6 @@
 #define TOSM2(jstack)	((jstack)->stack[(jstack)->depth-3])
 #define TOSM3(jstack)	((jstack)->stack[(jstack)->depth-4])
 
-#define POP(jstack)		((jstack)->stack[--(jstack)->depth])
-#define PUSH(jstack, r)		((jstack)->stack[(jstack)->depth++] = (r))
 #define SWAP(jstack) do { \
 		      Reg r = (jstack)->stack[(jstack)->depth-1]; \
 		      (jstack)->stack[(jstack)->depth-1] = (jstack)->stack[(jstack)->depth-2]; \
@@ -3483,6 +3484,17 @@
 #define JSTACK_REG(jstack)		jstack_reg(jstack)
 #define JSTACK_PREFER(jstack, prefer)	jstack_prefer(jstack, prefer)
 
+int PUSH(Thumb2_Stack *jstack, unsigned reg) {
+  jstack->stack[jstack->depth] = reg;
+  jstack->depth++;
+  return reg;
+}
+
+int POP(Thumb2_Stack *jstack) {
+  jstack->depth--;
+  return jstack->stack[jstack->depth];
+}
+
 static const unsigned last_clear_bit[] = {
 	3,	//	0000
 	3,	//	0001
@@ -3499,11 +3511,13 @@
 	1,	//	1100
 	1,	//	1101
 	0,	//	1110
-	0,	//	1111
+	0,	//	1111 // No registers available...
 };
 
 #define LAST_CLEAR_BIT(mask) last_clear_bit[mask]
 
+unsigned long thumb2_register_allocation_failures = 0;
+
 unsigned jstack_reg(Thumb2_Stack *jstack)
 {
   unsigned *stack = jstack->stack;
@@ -3514,7 +3528,10 @@
 
   for (i = 0; i < depth; i++) mask |= 1 << stack[i];
   mask &= (1 << STACK_REGS) - 1;
-  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
+  if (mask >= (1 << STACK_REGS) - 1)  { // No free registers
+    thumb2_register_allocation_failures++;
+    J_BogusImplementation();
+  }
   r = LAST_CLEAR_BIT(mask);
   return r;
 }
@@ -3530,7 +3547,10 @@
   for (i = 0; i < depth; i++) mask |= 1 << stack[i];
   mask &= (1 << STACK_REGS) - 1;
   if ((prefer & ~mask) & 0x0f) mask |= (~prefer & ((1 << STACK_REGS) - 1));
-  JASSERT(mask != (1 << STACK_REGS) - 1, "No free reg in push");
+  if (mask >= (1 << STACK_REGS) - 1)  { // No free registers
+    thumb2_register_allocation_failures++;
+    J_BogusImplementation();
+  }
   r = LAST_CLEAR_BIT(mask);
   return r;
 }