diff src/cpu/x86/vm/sharedRuntime_x86_64.cpp @ 2059:9508a52cbd32

Add deoptimization blob support.
author Thomas Wuerthinger <wuerthinger@ssw.jku.at>
date Wed, 19 Jan 2011 15:48:15 +0100
parents f95d63e2154a
children d25d4ca69222
line wrap: on
line diff
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Jan 18 10:19:59 2011 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Jan 19 15:48:15 2011 +0100
@@ -2655,6 +2655,40 @@
   __ bind(no_pending_exception);
 #endif
 
+  // (tw) Start of C1X uncommon trap code.
+  __ jmp(cont);
+
+  int uncommon_trap_offset = __ pc() - start;
+
+  // Warning: Duplicate code
+
+  // Save everything in sight.
+  map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
+
+  // Normal deoptimization
+
+
+  // fetch_unroll_info needs to call last_java_frame()
+  __ set_last_Java_frame(noreg, noreg, NULL);
+
+  __ movl(c_rarg1, (int32_t)Deoptimization::Unpack_reexecute);
+  __ movl(r14, c_rarg1); // save into r14 for later call to unpack_frames
+  __ mov(c_rarg0, r15_thread);
+  __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap)));
+
+  // Need to have an oopmap that tells fetch_unroll_info where to
+  // find any register it might need.
+
+  oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
+
+  __ reset_last_Java_frame(false, false);
+
+  Label after_fetch_unroll_info_call;
+  __ jmp(after_fetch_unroll_info_call);
+
+
+  // (tw) End of C1X uncommon trap code.
+
   __ bind(cont);
 
   // Call C code.  Need thread and this frame, but NOT official VM entry
@@ -2684,6 +2718,8 @@
 
   __ reset_last_Java_frame(false, false);
 
+  __ bind(after_fetch_unroll_info_call);
+
   // Load UnrollBlock* into rdi
   __ mov(rdi, rax);
 
@@ -2845,6 +2881,7 @@
 
   _deopt_blob = DeoptimizationBlob::create(&buffer, oop_maps, 0, exception_offset, reexecute_offset, frame_size_in_words);
   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
+  _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
 }
 
 #ifdef COMPILER2