< 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();
  

@@ -2187,11 +2187,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:

@@ -2356,11 +2356,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) {

@@ -2423,11 +2423,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);

@@ -2789,10 +2789,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

@@ -7459,11 +7493,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!" %}

@@ -7479,11 +7513,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 %{

@@ -7519,11 +7553,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 ||

@@ -7539,11 +7573,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 ||

@@ -7560,11 +7594,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));

@@ -7587,11 +7621,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" %}

@@ -7803,11 +7837,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 %{

@@ -7817,11 +7851,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 %{

@@ -7831,11 +7865,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;

@@ -8048,11 +8082,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);

@@ -8088,11 +8122,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) {

@@ -8106,11 +8140,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;

@@ -8129,11 +8163,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;

@@ -8189,11 +8223,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);

@@ -8205,11 +8239,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);

@@ -9027,11 +9061,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();

@@ -9043,11 +9077,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();

@@ -9076,11 +9110,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();

@@ -9092,11 +9126,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();

@@ -9126,11 +9160,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 %{

@@ -9143,11 +9177,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 %{

@@ -9980,11 +10014,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);

@@ -9995,11 +10029,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 >