changeset 7849:b8e2e616c1e9

8047383: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init> Summary: Do not rematerialize constant table loads in PhaseAggressiveCoalesce::insert_copies() Reviewed-by: kvn
author iveresov
date Thu, 23 Oct 2014 09:41:59 -1000
parents e244cb6bdedf
children c49cd31b6da6
files src/share/vm/opto/coalesce.cpp
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/coalesce.cpp	Tue Oct 28 13:30:40 2014 -0700
+++ b/src/share/vm/opto/coalesce.cpp	Thu Oct 23 09:41:59 2014 -1000
@@ -281,9 +281,11 @@
             Block *pred = _phc._cfg.get_block_for_node(b->pred(j));
             Node *copy;
             assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach");
-            // Rematerialize constants instead of copying them
-            if( m->is_Mach() && m->as_Mach()->is_Con() &&
-                m->as_Mach()->rematerialize() ) {
+            // Rematerialize constants instead of copying them.
+            // We do this only for immediate constants, we avoid constant table loads
+            // because that will unsafely extend the live range of the constant table base.
+            if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() &&
+                m->as_Mach()->rematerialize()) {
               copy = m->clone();
               // Insert the copy in the predecessor basic block
               pred->add_inst(copy);
@@ -317,8 +319,8 @@
             assert(!m->is_Con() || m->is_Mach(), "all Con must be Mach");
             // At this point it is unsafe to extend live ranges (6550579).
             // Rematerialize only constants as we do for Phi above.
-            if(m->is_Mach() && m->as_Mach()->is_Con() &&
-               m->as_Mach()->rematerialize()) {
+            if (m->is_Mach() && m->as_Mach()->is_Con() && !m->as_Mach()->is_MachConstant() &&
+                m->as_Mach()->rematerialize()) {
               copy = m->clone();
               // Insert the copy in the basic block, just before us
               b->insert_node(copy, l++);