diff src/share/vm/opto/compile.cpp @ 3853:11211f7cb5a0

7079317: Incorrect branch's destination block in PrintoOptoAssembly output Summary: save/restore label and block in scratch_emit_size() Reviewed-by: never
author kvn
date Tue, 16 Aug 2011 11:53:57 -0700
parents 3d42f82cd811
children c124e2e7463e
line wrap: on
line diff
--- a/src/share/vm/opto/compile.cpp	Tue Aug 16 04:14:05 2011 -0700
+++ b/src/share/vm/opto/compile.cpp	Tue Aug 16 11:53:57 2011 -0700
@@ -519,15 +519,18 @@
   // Do the emission.
 
   Label fakeL; // Fake label for branch instructions.
-  bool is_branch = n->is_Branch() && n->as_Mach()->ideal_Opcode() != Op_Jump;
+  Label*   saveL = NULL;
+  uint save_bnum = 0;
+  bool is_branch = n->is_MachBranch();
   if (is_branch) {
     MacroAssembler masm(&buf);
     masm.bind(fakeL);
-    n->as_Mach()->label_set(&fakeL, 0);
+    n->as_MachBranch()->save_label(&saveL, &save_bnum);
+    n->as_MachBranch()->label_set(&fakeL, 0);
   }
   n->emit(buf, this->regalloc());
-  if (is_branch) // Clear the reference to fake label.
-    n->as_Mach()->label_set(NULL, 0);
+  if (is_branch) // Restore label.
+    n->as_MachBranch()->label_set(saveL, save_bnum);
 
   // End scratch_emit_size section.
   set_in_scratch_emit_size(false);