< prev index next >

src/hotspot/share/classfile/javaClasses.cpp

Print this page

        

@@ -3664,10 +3664,21 @@
 int java_lang_ref_Reference::next_offset;
 int java_lang_ref_Reference::discovered_offset;
 int java_lang_ref_Reference::number_of_fake_oop_fields;
 int java_lang_ref_SoftReference::timestamp_offset;
 int java_lang_ref_SoftReference::static_clock_offset;
+int java_lang_Continuation::target_offset;
+int java_lang_Continuation::stack_offset;
+int java_lang_Continuation::parent_offset;
+int java_lang_Continuation::parentSP_offset;
+int java_lang_Continuation::parentFP_offset;
+int java_lang_Continuation::lastFP_offset;
+int java_lang_Continuation::lastSP_offset;
+int java_lang_Continuation::reg0_offset;
+int java_lang_Continuation::reg1_offset;
+int java_lang_Continuation::reg2_offset;
+Method* java_lang_Continuation::stack_method;
 int java_lang_ClassLoader::parent_offset;
 int java_lang_System::static_in_offset;
 int java_lang_System::static_out_offset;
 int java_lang_System::static_err_offset;
 int java_lang_System::static_security_offset;

@@ -3782,10 +3793,44 @@
 void java_lang_AssertionStatusDirectives::set_deflt(oop o, bool val) {
   o->bool_field_put(deflt_offset, val);
 }
 
 
+// Support for java.lang.Continuation
+
+Method* java_lang_Continuation::get_stack_method() {
+  CallInfo callinfo;
+  Klass* recvrKlass = SystemDictionary::Continuation_klass(); // SystemDictionary::resolve_or_null(vmSymbols::java_lang_Continuation(), NULL); // 
+  LinkInfo link_info(recvrKlass, vmSymbols::getStack_name(), vmSymbols::continuationGetStack_signature());
+  LinkResolver::resolve_special_call(callinfo, Handle(), link_info, Thread::current());
+  methodHandle method = callinfo.selected_method();
+  assert(method.not_null(), "should have thrown exception");
+  return method();
+}
+
+void java_lang_Continuation::compute_offsets() {
+  // Klass* k = SystemDictionary::Continuation_klass();
+  // compute_offset(target_offset,   k, vmSymbols::target_name(),   vmSymbols::runnable_signature());
+  // compute_offset(parent_offset,   k, vmSymbols::parent_name(),   vmSymbols::continuation_signature());
+  // compute_offset(stack_offset,    k, vmSymbols::stack_name(),    vmSymbols::int_array_signature());
+  // compute_offset(parentSP_offset, k, vmSymbols::parentSP_name(), vmSymbols::long_signature());
+  // compute_offset(parentFP_offset, k, vmSymbols::parentFP_name(), vmSymbols::long_signature());
+  // compute_offset(lastFP_offset,   k, vmSymbols::lastFP_name(),   vmSymbols::int_signature());
+  // compute_offset(lastSP_offset,   k, vmSymbols::lastSP_name(),   vmSymbols::int_signature());
+  // compute_offset(reg0_offset,     k, vmSymbols::reg0_name(),     vmSymbols::long_signature());
+  // compute_offset(reg1_offset,     k, vmSymbols::reg1_name(),     vmSymbols::long_signature());
+  // compute_offset(reg2_offset,     k, vmSymbols::reg2_name(),     vmSymbols::long_signature());
+
+  java_lang_Continuation::stack_method = java_lang_Continuation::get_stack_method();
+}
+
+bool java_lang_Continuation::on_local_stack(oop ref, address adr) {
+  arrayOop s = stack(ref);
+  void* base = s->base(T_INT);
+  return adr >= base && (char*)adr < ((char*)base + (s->length() * 4));
+}
+
 // Support for intrinsification of java.nio.Buffer.checkIndex
 int java_nio_Buffer::limit_offset() {
   return _limit_offset;
 }
 

@@ -3839,10 +3884,22 @@
   // java_lang_ref_SoftReference Class
   java_lang_ref_SoftReference::timestamp_offset = align_up((java_lang_ref_SoftReference::hc_timestamp_offset * x + header), BytesPerLong);
   // Don't multiply static fields because they are always in wordSize units
   java_lang_ref_SoftReference::static_clock_offset = java_lang_ref_SoftReference::hc_static_clock_offset * x;
 
+  // java_lang_Continuation Class
+  java_lang_Continuation::target_offset   = java_lang_Continuation::hc_target_offset   * x + header;
+  java_lang_Continuation::parent_offset   = java_lang_Continuation::hc_parent_offset   * x + header;
+  java_lang_Continuation::parentSP_offset = java_lang_Continuation::hc_parentSP_offset * x + header;
+  java_lang_Continuation::parentFP_offset = java_lang_Continuation::hc_parentFP_offset * x + header;
+  java_lang_Continuation::stack_offset    = java_lang_Continuation::hc_stack_offset    * x + header;
+  java_lang_Continuation::lastFP_offset   = java_lang_Continuation::hc_lastFP_offset   * x + header;
+  java_lang_Continuation::lastSP_offset   = java_lang_Continuation::hc_lastSP_offset   * x + header;
+  java_lang_Continuation::reg0_offset     = java_lang_Continuation::hc_reg0_offset     * x + header;
+  java_lang_Continuation::reg1_offset     = java_lang_Continuation::hc_reg1_offset     * x + header;
+  java_lang_Continuation::reg2_offset     = java_lang_Continuation::hc_reg2_offset     * x + header;
+
   // java_lang_ClassLoader
   java_lang_ClassLoader::parent_offset = java_lang_ClassLoader::hc_parent_offset * x + header;
 
   // java_lang_System
   java_lang_System::static_in_offset  = java_lang_System::hc_static_in_offset  * x;

@@ -3898,10 +3955,12 @@
   java_lang_reflect_Parameter::compute_offsets();
   java_lang_Module::compute_offsets();
   java_lang_StackFrameInfo::compute_offsets();
   java_lang_LiveStackFrameInfo::compute_offsets();
 
+  java_lang_Continuation::compute_offsets();
+
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
 }
 
 #ifndef PRODUCT

@@ -4065,10 +4124,23 @@
   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, queue, "Ljava/lang/ref/ReferenceQueue;");
   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, next, "Ljava/lang/ref/Reference;");
   // Fake field
   //CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, discovered, "Ljava/lang/ref/Reference;");
 
+  // java.lang.Continuation
+
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, target,   "Ljava/lang/Runnable;");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, stack,    "[I");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parent,   "Ljava/lang/Continuation;");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parentSP, "J");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, parentFP, "J");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, lastFP,   "I");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, lastSP,   "I");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg0,     "J");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg1,     "J");
+  CHECK_OFFSET("java/lang/Continuation", java_lang_Continuation, reg2,     "J");
+
   // java.lang.ref.SoftReference
 
   CHECK_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, timestamp, "J");
   CHECK_STATIC_OFFSET("java/lang/ref/SoftReference", java_lang_ref_SoftReference, clock, "J");
 
< prev index next >