< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page
*** 2708,10 ***
--- 2708,11 ---
                                              Register cache,
                                              Register index) {
    const Register temp = rbx;
    assert_different_registers(cache, index, temp);
  
+   Label L_clinit_barrier_slow;
    Label resolved;
  
    Bytecodes::Code code = bytecode();
    switch (code) {
      case Bytecodes::_nofast_getfield: code = Bytecodes::_getfield; break;

*** 2728,17 ***
--- 2729,29 ---
    }
    __ cmpl(temp, code);  // have we resolved this bytecode?
    __ jcc(Assembler::equal, resolved);
  
    // resolve first time through
+   __ bind(L_clinit_barrier_slow);
    address entry = CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache);
    __ movl(temp, code);
    __ call_VM(noreg, entry, temp);
    // Update registers with resolved info
    __ load_field_entry(cache, index);
  
    __ bind(resolved);
+ 
+   // Class initialization barrier for static fields
+   if (VM_Version::supports_fast_class_init_checks() &&
+       (bytecode() == Bytecodes::_getstatic || bytecode() == Bytecodes::_putstatic)) {
+     const Register field_holder = temp;
+     const Register thread = LP64_ONLY(r15_thread) NOT_LP64(noreg);
+     assert(thread != noreg, "x86_32 not supported");
+ 
+     __ movptr(field_holder, Address(cache, in_bytes(ResolvedFieldEntry::field_holder_offset())));
+     __ clinit_barrier(field_holder, thread, nullptr /*L_fast_path*/, &L_clinit_barrier_slow);
+   }
  }
  
  void TemplateTable::load_resolved_field_entry(Register obj,
                                                Register cache,
                                                Register tos_state,
< prev index next >