diff src/cpu/x86/vm/assembler_x86_64.cpp @ 124:b130b98db9cf

6689060: Escape Analysis does not work with Compressed Oops Summary: 64-bits VM crashes with -XX:+AggresiveOpts (Escape Analysis + Compressed Oops) Reviewed-by: never, sgoldman
author kvn
date Wed, 23 Apr 2008 11:20:36 -0700
parents fb75a7673531
children c436414a719e 6d172e3548cb 37f87013dfd8
line wrap: on
line diff
--- a/src/cpu/x86/vm/assembler_x86_64.cpp	Thu Apr 17 07:16:03 2008 -0700
+++ b/src/cpu/x86/vm/assembler_x86_64.cpp	Wed Apr 23 11:20:36 2008 -0700
@@ -4150,7 +4150,7 @@
   if (oop_result->is_valid()) {
     movq(oop_result, Address(r15_thread, JavaThread::vm_result_offset()));
     movptr(Address(r15_thread, JavaThread::vm_result_offset()), NULL_WORD);
-    verify_oop(oop_result);
+    verify_oop(oop_result, "broken oop in call_VM_base");
   }
 }
 
@@ -4689,6 +4689,10 @@
   popq(r12);
 }
 
+#ifndef PRODUCT
+extern "C" void findpc(intptr_t x);
+#endif
+
 void MacroAssembler::debug(char* msg, int64_t pc, int64_t regs[]) {
   // In order to get locks to work, we need to fake a in_VM state
   if (ShowMessageBoxOnError ) {
@@ -4707,6 +4711,11 @@
     if (os::message_box(msg, "Execution stopped, print registers?")) {
       ttyLocker ttyl;
       tty->print_cr("rip = 0x%016lx", pc);
+#ifndef PRODUCT
+      tty->cr();
+      findpc(pc);
+      tty->cr();
+#endif
       tty->print_cr("rax = 0x%016lx", regs[15]);
       tty->print_cr("rbx = 0x%016lx", regs[12]);
       tty->print_cr("rcx = 0x%016lx", regs[14]);
@@ -5187,7 +5196,7 @@
   bind(ok);
   popq(rscratch1);
 #endif
-  verify_oop(r);
+  verify_oop(r, "broken oop in encode_heap_oop");
   testq(r, r);
   cmovq(Assembler::equal, r, r12_heapbase);
   subq(r, r12_heapbase);
@@ -5203,11 +5212,28 @@
   stop("null oop passed to encode_heap_oop_not_null");
   bind(ok);
 #endif
-  verify_oop(r);
+  verify_oop(r, "broken oop in encode_heap_oop_not_null");
   subq(r, r12_heapbase);
   shrq(r, LogMinObjAlignmentInBytes);
 }
 
+void MacroAssembler::encode_heap_oop_not_null(Register dst, Register src) {
+  assert (UseCompressedOops, "should be compressed");
+#ifdef ASSERT
+  Label ok;
+  testq(src, src);
+  jcc(Assembler::notEqual, ok);
+  stop("null oop passed to encode_heap_oop_not_null2");
+  bind(ok);
+#endif
+  verify_oop(src, "broken oop in encode_heap_oop_not_null2");
+  if (dst != src) {
+    movq(dst, src);
+  }
+  subq(dst, r12_heapbase);
+  shrq(dst, LogMinObjAlignmentInBytes);
+}
+
 void  MacroAssembler::decode_heap_oop(Register r) {
   assert (UseCompressedOops, "should be compressed");
 #ifdef ASSERT
@@ -5232,7 +5258,7 @@
    leaq(r, Address(r12_heapbase, r, Address::times_8, 0));
 #endif
   bind(done);
-  verify_oop(r);
+  verify_oop(r, "broken oop in decode_heap_oop");
 }
 
 void  MacroAssembler::decode_heap_oop_not_null(Register r) {
@@ -5243,6 +5269,14 @@
   leaq(r, Address(r12_heapbase, r, Address::times_8, 0));
 }
 
+void  MacroAssembler::decode_heap_oop_not_null(Register dst, Register src) {
+  assert (UseCompressedOops, "should only be used for compressed headers");
+  // Cannot assert, unverified entry point counts instructions (see .ad file)
+  // vtableStubs also counts instructions in pd_code_size_limit.
+  assert(Address::times_8 == LogMinObjAlignmentInBytes, "decode alg wrong");
+  leaq(dst, Address(r12_heapbase, src, Address::times_8, 0));
+}
+
 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) {
   switch (cond) {
     // Note some conditions are synonyms for others