< prev index next >

src/hotspot/cpu/x86/x86.ad

Print this page
@@ -1310,11 +1310,11 @@
  
    // Note that the code buffer's insts_mark is always relative to insts.
    // That's why we must use the macroassembler to generate a handler.
    C2_MacroAssembler _masm(&cbuf);
    address base = __ start_a_stub(size_exception_handler());
-   if (base == NULL) {
+   if (base == nullptr) {
      ciEnv::current()->record_failure("CodeCache is full");
      return 0;  // CodeBuffer::expand failed
    }
    int offset = __ offset();
    __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point()));

@@ -1328,11 +1328,11 @@
  
    // Note that the code buffer's insts_mark is always relative to insts.
    // That's why we must use the macroassembler to generate a handler.
    C2_MacroAssembler _masm(&cbuf);
    address base = __ start_a_stub(size_deopt_handler());
-   if (base == NULL) {
+   if (base == nullptr) {
      ciEnv::current()->record_failure("CodeCache is full");
      return 0;  // CodeBuffer::expand failed
    }
    int offset = __ offset();
  

@@ -2184,11 +2184,11 @@
        case Op_VecY: return new vecYOper();
        case Op_VecZ: return new vecZOper();
      }
    }
    ShouldNotReachHere();
-   return NULL;
+   return nullptr;
  }
  
  bool Matcher::is_reg2reg_move(MachNode* m) {
    switch (m->rule()) {
      case MoveVec2Leg_rule:

@@ -2353,11 +2353,11 @@
    Node* _op1_node;
    Node* _mop_node;
    int _con_op;
  
    static int match_next(Node* n, int next_op, int next_op_idx) {
-     if (n->in(1) == NULL || n->in(2) == NULL) {
+     if (n->in(1) == nullptr || n->in(2) == nullptr) {
        return -1;
      }
  
      if (next_op_idx == -1) { // n is commutative, try rotations
        if (n->in(1)->Opcode() == next_op) {

@@ -2420,11 +2420,11 @@
    }
  };
  
  static bool is_bmi_pattern(Node* n, Node* m) {
    assert(UseBMI1Instructions, "sanity");
-   if (n != NULL && m != NULL) {
+   if (n != nullptr && m != nullptr) {
      if (m->Opcode() == Op_LoadI) {
        FusedPatternMatcher<TypeInt> bmii(n, m, Op_ConI);
        return bmii.match(Op_AndI, -1, Op_SubI,  1,  0)  ||
               bmii.match(Op_AndI, -1, Op_AddI, -1, -1)  ||
               bmii.match(Op_XorI, -1, Op_AddI, -1, -1);

@@ -2786,10 +2786,44 @@
        __ jccb(Assembler::equal, L);
        // Die if stack mismatch
        __ int3();
        __ bind(L);
      }
+     if (tf()->returns_inline_type_as_fields() && !_method->is_method_handle_intrinsic()) {
+       C2_MacroAssembler _masm(&cbuf);
+       // The last return value is not set by the callee but used to pass IsInit information to compiled code.
+       // Search for the corresponding projection, get the register and emit code that initialized it.
+       uint con = (tf()->range_cc()->cnt() - 1);
+       for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
+         ProjNode* proj = fast_out(i)->as_Proj();
+         if (proj->_con == con) {
+           // Set IsInit if rax is non-null (a non-null value is returned buffered or scalarized)
+           OptoReg::Name optoReg = ra_->get_reg_first(proj);
+           VMReg reg = OptoReg::as_VMReg(optoReg, ra_->_framesize, OptoReg::reg2stack(ra_->_matcher._new_SP));
+           Register toReg = reg->is_reg() ? reg->as_Register() : rscratch1;
+           __ testq(rax, rax);
+           __ setb(Assembler::notZero, toReg);
+           __ movzbl(toReg, toReg);
+           if (reg->is_stack()) {
+             int st_off = reg->reg2stack() * VMRegImpl::stack_slot_size;
+             __ movq(Address(rsp, st_off), toReg);
+           }
+           break;
+         }
+       }
+       if (return_value_is_used()) {
+         // An inline type is returned as fields in multiple registers.
+         // Rax either contains an oop if the inline type is buffered or a pointer
+         // to the corresponding InlineKlass with the lowest bit set to 1. Zero rax
+         // if the lowest bit is set to allow C2 to use the oop after null checking.
+         // rax &= (rax & 1) - 1
+         __ movptr(rscratch1, rax);
+         __ andptr(rscratch1, 0x1);
+         __ subptr(rscratch1, 0x1);
+         __ andptr(rax, rscratch1);
+       }
+     }
    %}
  
  %}
  
  // Operands for bound floating pointer register arguments

@@ -7456,11 +7490,11 @@
  #endif // _LP64
  
  // --------------------------------- VectorMaskCmp --------------------------------------
  
  instruct vcmpFD(legVec dst, legVec src1, legVec src2, immI8 cond) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL &&
+   predicate(n->bottom_type()->isa_vectmask() == nullptr &&
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) >=  8 && // src1
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
              is_floating_point_type(Matcher::vector_element_basic_type(n->in(1)->in(1)))); // src1 T_FLOAT, T_DOUBLE
    match(Set dst (VectorMaskCmp (Binary src1 src2) cond));
    format %{ "vector_compare $dst,$src1,$src2,$cond\t!" %}

@@ -7476,11 +7510,11 @@
    ins_pipe( pipe_slow );
  %}
  
  instruct evcmpFD64(vec dst, vec src1, vec src2, immI8 cond, kReg ktmp) %{
    predicate(Matcher::vector_length_in_bytes(n->in(1)->in(1)) == 64 && // src1
-             n->bottom_type()->isa_vectmask() == NULL &&
+             n->bottom_type()->isa_vectmask() == nullptr &&
              is_floating_point_type(Matcher::vector_element_basic_type(n->in(1)->in(1)))); // src1 T_FLOAT, T_DOUBLE
    match(Set dst (VectorMaskCmp (Binary src1 src2) cond));
    effect(TEMP ktmp);
    format %{ "vector_compare $dst,$src1,$src2,$cond" %}
    ins_encode %{

@@ -7516,11 +7550,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vcmp_direct(legVec dst, legVec src1, legVec src2, immI8 cond) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL &&
+   predicate(n->bottom_type()->isa_vectmask() == nullptr &&
              !Matcher::is_unsigned_booltest_pred(n->in(2)->get_int()) &&
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) >=  4 && // src1
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
              is_integral_type(Matcher::vector_element_basic_type(n->in(1)->in(1))) &&
              (n->in(2)->get_int() == BoolTest::eq ||

@@ -7536,11 +7570,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vcmp_negate(legVec dst, legVec src1, legVec src2, immI8 cond, legVec xtmp) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL &&
+   predicate(n->bottom_type()->isa_vectmask() == nullptr &&
              !Matcher::is_unsigned_booltest_pred(n->in(2)->get_int()) &&
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) >=  4 && // src1
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
              is_integral_type(Matcher::vector_element_basic_type(n->in(1)->in(1))) &&
              (n->in(2)->get_int() == BoolTest::ne ||

@@ -7557,11 +7591,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vcmpu(legVec dst, legVec src1, legVec src2, immI8 cond, legVec xtmp) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL &&
+   predicate(n->bottom_type()->isa_vectmask() == nullptr &&
              Matcher::is_unsigned_booltest_pred(n->in(2)->get_int()) &&
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) >=  4 && // src1
              Matcher::vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
              is_integral_type(Matcher::vector_element_basic_type(n->in(1)->in(1)))); // src1
    match(Set dst (VectorMaskCmp (Binary src1 src2) cond));

@@ -7584,11 +7618,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vcmp64(vec dst, vec src1, vec src2, immI8 cond, kReg ktmp) %{
-   predicate((n->bottom_type()->isa_vectmask() == NULL &&
+   predicate((n->bottom_type()->isa_vectmask() == nullptr &&
               Matcher::vector_length_in_bytes(n->in(1)->in(1)) == 64) && // src1
               is_integral_type(Matcher::vector_element_basic_type(n->in(1)->in(1)))); // src1
    match(Set dst (VectorMaskCmp (Binary src1 src2) cond));
    effect(TEMP ktmp);
    format %{ "vector_compare $dst,$src1,$src2,$cond" %}

@@ -7800,11 +7834,11 @@
    ins_pipe( pipe_slow );
  %}
  
  instruct vblendvpI(legVec dst, legVec src1, legVec src2, legVec mask) %{
    predicate(UseAVX > 0 &&
-             n->in(2)->bottom_type()->isa_vectmask() == NULL &&
+             n->in(2)->bottom_type()->isa_vectmask() == nullptr &&
              Matcher::vector_length_in_bytes(n) <= 32 &&
              is_integral_type(Matcher::vector_element_basic_type(n)));
    match(Set dst (VectorBlend (Binary src1 src2) mask));
    format %{ "vector_blend  $dst,$src1,$src2,$mask\t!" %}
    ins_encode %{

@@ -7814,11 +7848,11 @@
    ins_pipe( pipe_slow );
  %}
  
  instruct vblendvpFD(legVec dst, legVec src1, legVec src2, legVec mask) %{
    predicate(UseAVX > 0 &&
-             n->in(2)->bottom_type()->isa_vectmask() == NULL &&
+             n->in(2)->bottom_type()->isa_vectmask() == nullptr &&
              Matcher::vector_length_in_bytes(n) <= 32 &&
              !is_integral_type(Matcher::vector_element_basic_type(n)));
    match(Set dst (VectorBlend (Binary src1 src2) mask));
    format %{ "vector_blend  $dst,$src1,$src2,$mask\t!" %}
    ins_encode %{

@@ -7828,11 +7862,11 @@
    ins_pipe( pipe_slow );
  %}
  
  instruct evblendvp64(vec dst, vec src1, vec src2, vec mask, kReg ktmp) %{
    predicate(Matcher::vector_length_in_bytes(n) == 64 &&
-             n->in(2)->bottom_type()->isa_vectmask() == NULL);
+             n->in(2)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorBlend (Binary src1 src2) mask));
    format %{ "vector_blend  $dst,$src1,$src2,$mask\t! using k2 as TEMP" %}
    effect(TEMP ktmp);
    ins_encode %{
       int vlen_enc = Assembler::AVX_512bit;

@@ -8045,11 +8079,11 @@
  #endif
  
  //------------------------------------- LoadMask --------------------------------------------
  
  instruct loadMask(legVec dst, legVec src) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL && !VM_Version::supports_avx512vlbw());
+   predicate(n->bottom_type()->isa_vectmask() == nullptr && !VM_Version::supports_avx512vlbw());
    match(Set dst (VectorLoadMask src));
    effect(TEMP dst);
    format %{ "vector_loadmask_byte $dst, $src\n\t" %}
    ins_encode %{
      int vlen_in_bytes = Matcher::vector_length_in_bytes(this);

@@ -8085,11 +8119,11 @@
  %}
  
  //------------------------------------- StoreMask --------------------------------------------
  
  instruct vstoreMask1B(vec dst, vec src, immI_1 size) %{
-   predicate(Matcher::vector_length(n) < 64 && n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(Matcher::vector_length(n) < 64 && n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorStoreMask src size));
    format %{ "vector_store_mask $dst, $src \t! elem size is $size byte[s]" %}
    ins_encode %{
      int vlen = Matcher::vector_length(this);
      if (vlen <= 16 && UseAVX <= 2) {

@@ -8103,11 +8137,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vstoreMask2B(vec dst, vec src, vec xtmp, immI_2 size) %{
-   predicate(Matcher::vector_length(n) <= 16 && n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(Matcher::vector_length(n) <= 16 && n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorStoreMask src size));
    effect(TEMP_DEF dst, TEMP xtmp);
    format %{ "vector_store_mask $dst, $src \t! elem size is $size byte[s]" %}
    ins_encode %{
      int vlen_enc = Assembler::AVX_128bit;

@@ -8126,11 +8160,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vstoreMask4B(vec dst, vec src, vec xtmp, immI_4 size) %{
-   predicate(UseAVX <= 2 && Matcher::vector_length(n) <= 8 && n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(UseAVX <= 2 && Matcher::vector_length(n) <= 8 && n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorStoreMask src size));
    format %{ "vector_store_mask $dst, $src \t! elem size is $size byte[s]" %}
    effect(TEMP_DEF dst, TEMP xtmp);
    ins_encode %{
      int vlen_enc = Assembler::AVX_128bit;

@@ -8186,11 +8220,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vstoreMask4B_evex_novectmask(vec dst, vec src, immI_4 size) %{
-   predicate(UseAVX > 2 && n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(UseAVX > 2 && n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorStoreMask src size));
    format %{ "vector_store_mask $dst, $src \t! elem size is $size byte[s]" %}
    ins_encode %{
      int src_vlen_enc = vector_length_encoding(this, $src);
      int dst_vlen_enc = vector_length_encoding(this);

@@ -8202,11 +8236,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vstoreMask8B_evex_novectmask(vec dst, vec src, immI_8 size) %{
-   predicate(UseAVX > 2 && n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(UseAVX > 2 && n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorStoreMask src size));
    format %{ "vector_store_mask $dst, $src \t! elem size is $size byte[s]" %}
    ins_encode %{
      int src_vlen_enc = vector_length_encoding(this, $src);
      int dst_vlen_enc = vector_length_encoding(this);

@@ -9024,11 +9058,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_tolong_bool(rRegL dst, vec mask, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskToLong mask));
    format %{ "vector_tolong_bool $dst, $mask \t! using $xtmp as TEMP" %}
    effect(TEMP_DEF dst, TEMP xtmp, KILL cr);
    ins_encode %{
      int opcode = this->ideal_Opcode();

@@ -9040,11 +9074,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_tolong_avx(rRegL dst, vec mask, immI size, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskToLong (VectorStoreMask mask size)));
    format %{ "vector_tolong_avx $dst, $mask \t! using $xtmp as TEMP" %}
    effect(TEMP_DEF dst, TEMP xtmp, KILL cr);
    ins_encode %{
      int opcode = this->ideal_Opcode();

@@ -9073,11 +9107,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_truecount_bool(rRegI dst, vec mask, rRegL tmp, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskTrueCount mask));
    effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, KILL cr);
    format %{ "vector_truecount_bool $dst, $mask \t! using $tmp, $xtmp as TEMP" %}
    ins_encode %{
      int opcode = this->ideal_Opcode();

@@ -9089,11 +9123,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_truecount_avx(rRegI dst, vec mask, immI size, rRegL tmp, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskTrueCount (VectorStoreMask mask size)));
    effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, KILL cr);
    format %{ "vector_truecount_avx $dst, $mask \t! using $tmp, $xtmp as TEMP" %}
    ins_encode %{
      int opcode = this->ideal_Opcode();

@@ -9123,11 +9157,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_first_or_last_true_bool(rRegI dst, vec mask, rRegL tmp, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskFirstTrue mask));
    match(Set dst (VectorMaskLastTrue mask));
    effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, KILL cr);
    format %{ "vector_mask_first_or_last_true_bool $dst, $mask \t! using $tmp, $xtmp as TEMP" %}
    ins_encode %{

@@ -9140,11 +9174,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct vmask_first_or_last_true_avx(rRegI dst, vec mask, immI size, rRegL tmp, vec xtmp, rFlagsReg cr) %{
-   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == NULL);
+   predicate(n->in(1)->in(1)->bottom_type()->isa_vectmask() == nullptr);
    match(Set dst (VectorMaskFirstTrue (VectorStoreMask mask size)));
    match(Set dst (VectorMaskLastTrue (VectorStoreMask mask size)));
    effect(TEMP_DEF dst, TEMP tmp, TEMP xtmp, KILL cr);
    format %{ "vector_mask_first_or_last_true_avx $dst, $mask \t! using $tmp, $xtmp as TEMP" %}
    ins_encode %{

@@ -9977,11 +10011,11 @@
    %}
    ins_pipe( pipe_slow );
  %}
  
  instruct long_to_maskLE8_avx(vec dst, rRegL src, rRegL rtmp1, rRegL rtmp2, vec xtmp) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL && Matcher::vector_length(n) <= 8);
+   predicate(n->bottom_type()->isa_vectmask() == nullptr && Matcher::vector_length(n) <= 8);
    match(Set dst (VectorLongToMask src));
    effect(TEMP dst, TEMP rtmp1, TEMP rtmp2, TEMP xtmp);
    format %{ "long_to_mask_avx $dst, $src\t! using $rtmp1, $rtmp2, $xtmp as TEMP" %}
    ins_encode %{
      int mask_len = Matcher::vector_length(this);

@@ -9992,11 +10026,11 @@
    ins_pipe( pipe_slow );
  %}
  
  
  instruct long_to_maskGT8_avx(vec dst, rRegL src, rRegL rtmp1, rRegL rtmp2, vec xtmp1, rFlagsReg cr) %{
-   predicate(n->bottom_type()->isa_vectmask() == NULL && Matcher::vector_length(n) > 8);
+   predicate(n->bottom_type()->isa_vectmask() == nullptr && Matcher::vector_length(n) > 8);
    match(Set dst (VectorLongToMask src));
    effect(TEMP dst, TEMP rtmp1, TEMP rtmp2, TEMP xtmp1, KILL cr);
    format %{ "long_to_mask_avx $dst, $src\t! using $rtmp1, $rtmp2, $xtmp1, as TEMP" %}
    ins_encode %{
      int mask_len = Matcher::vector_length(this);
< prev index next >