< prev index next >

src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp

Print this page
@@ -28,10 +28,11 @@
  #include "c1/c1_LIRAssembler.hpp"
  #include "c1/c1_MacroAssembler.hpp"
  #include "c1/c1_Runtime1.hpp"
  #include "classfile/javaClasses.hpp"
  #include "nativeInst_x86.hpp"
+ #include "oops/objArrayKlass.hpp"
  #include "runtime/sharedRuntime.hpp"
  #include "utilities/align.hpp"
  #include "utilities/macros.hpp"
  #include "vmreg_x86.inline.hpp"
  

@@ -168,10 +169,83 @@
    ce->add_call_info_here(_info);
    debug_only(__ should_not_reach_here());
  }
  
  
+ // Implementation of LoadFlattenedArrayStub
+ 
+ LoadFlattenedArrayStub::LoadFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr result, CodeEmitInfo* info) {
+   _array = array;
+   _index = index;
+   _result = result;
+   // Tell the register allocator that the runtime call will scratch rax.
+   _scratch_reg = FrameMap::rax_oop_opr;
+   _info = new CodeEmitInfo(info);
+ }
+ 
+ void LoadFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
+   assert(__ rsp_offset() == 0, "frame size should be fixed");
+   __ bind(_entry);
+   ce->store_parameter(_array->as_register(), 1);
+   ce->store_parameter(_index->as_register(), 0);
+   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::load_flat_array_id)));
+   ce->add_call_info_here(_info);
+   ce->verify_oop_map(_info);
+   if (_result->as_register() != rax) {
+     __ movptr(_result->as_register(), rax);
+   }
+   __ jmp(_continuation);
+ }
+ 
+ 
+ // Implementation of StoreFlattenedArrayStub
+ 
+ StoreFlattenedArrayStub::StoreFlattenedArrayStub(LIR_Opr array, LIR_Opr index, LIR_Opr value, CodeEmitInfo* info) {
+   _array = array;
+   _index = index;
+   _value = value;
+   // Tell the register allocator that the runtime call will scratch rax.
+   _scratch_reg = FrameMap::rax_oop_opr;
+   _info = new CodeEmitInfo(info);
+ }
+ 
+ 
+ void StoreFlattenedArrayStub::emit_code(LIR_Assembler* ce) {
+   assert(__ rsp_offset() == 0, "frame size should be fixed");
+   __ bind(_entry);
+   ce->store_parameter(_array->as_register(), 2);
+   ce->store_parameter(_index->as_register(), 1);
+   ce->store_parameter(_value->as_register(), 0);
+   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::store_flat_array_id)));
+   ce->add_call_info_here(_info);
+   ce->verify_oop_map(_info);
+   __ jmp(_continuation);
+ }
+ 
+ 
+ // Implementation of SubstitutabilityCheckStub
+ 
+ SubstitutabilityCheckStub::SubstitutabilityCheckStub(LIR_Opr left, LIR_Opr right, CodeEmitInfo* info) {
+   _left = left;
+   _right = right;
+   // Tell the register allocator that the runtime call will scratch rax.
+   _scratch_reg = FrameMap::rax_oop_opr;
+   _info = new CodeEmitInfo(info);
+ }
+ 
+ void SubstitutabilityCheckStub::emit_code(LIR_Assembler* ce) {
+   assert(__ rsp_offset() == 0, "frame size should be fixed");
+   __ bind(_entry);
+   ce->store_parameter(_left->as_register(), 1);
+   ce->store_parameter(_right->as_register(), 0);
+   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::substitutability_check_id)));
+   ce->add_call_info_here(_info);
+   ce->verify_oop_map(_info);
+   __ jmp(_continuation);
+ }
+ 
+ 
  // Implementation of NewInstanceStub
  
  NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
    _result = result;
    _klass = klass;

@@ -220,33 +294,48 @@
  }
  
  
  // Implementation of NewObjectArrayStub
  
- NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info) {
+ NewObjectArrayStub::NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result,
+                                        CodeEmitInfo* info, bool is_null_free) {
    _klass_reg = klass_reg;
    _result = result;
    _length = length;
    _info = new CodeEmitInfo(info);
+   _is_null_free = is_null_free;
  }
  
  
  void NewObjectArrayStub::emit_code(LIR_Assembler* ce) {
    assert(__ rsp_offset() == 0, "frame size should be fixed");
    __ bind(_entry);
    assert(_length->as_register() == rbx, "length must in rbx,");
    assert(_klass_reg->as_register() == rdx, "klass_reg must in rdx");
-   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
+   if (_is_null_free) {
+     __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_flat_array_id)));
+   } else {
+     __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::new_object_array_id)));
+   }
    ce->add_call_info_here(_info);
    ce->verify_oop_map(_info);
    assert(_result->as_register() == rax, "result must in rax,");
    __ jmp(_continuation);
  }
  
  void MonitorEnterStub::emit_code(LIR_Assembler* ce) {
    assert(__ rsp_offset() == 0, "frame size should be fixed");
    __ bind(_entry);
+   if (_throw_imse_stub != nullptr) {
+     // When we come here, _obj_reg has already been checked to be non-null.
+     const int is_value_mask = markWord::inline_type_pattern;
+     Register mark = _scratch_reg->as_register();
+     __ movptr(mark, Address(_obj_reg->as_register(), oopDesc::mark_offset_in_bytes()));
+     __ andptr(mark, is_value_mask);
+     __ cmpl(mark, is_value_mask);
+     __ jcc(Assembler::equal, *_throw_imse_stub->entry());
+   }
    ce->store_parameter(_obj_reg->as_register(),  1);
    ce->store_parameter(_lock_reg->as_register(), 0);
    Runtime1::StubID enter_id;
    if (ce->compilation()->has_fpu_code()) {
      enter_id = Runtime1::monitorenter_id;
< prev index next >