hotspot/src/share/vm/opto/memnode.cpp
changeset 46619 a3919f5e8d2b
parent 46589 f1c04490ded1
child 46625 edefffab74e2
equal deleted inserted replaced
46618:d503911aa948 46619:a3919f5e8d2b
  3558   int old_subword = 0, old_long = 0, new_int = 0, new_long = 0;
  3558   int old_subword = 0, old_long = 0, new_int = 0, new_long = 0;
  3559 
  3559 
  3560   intptr_t ti_limit = (TrackedInitializationLimit * HeapWordSize);
  3560   intptr_t ti_limit = (TrackedInitializationLimit * HeapWordSize);
  3561   intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, ti_limit);
  3561   intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, ti_limit);
  3562   size_limit = MIN2(size_limit, ti_limit);
  3562   size_limit = MIN2(size_limit, ti_limit);
  3563   size_limit = align_size_up(size_limit, BytesPerLong);
  3563   size_limit = align_up(size_limit, BytesPerLong);
  3564   int num_tiles = size_limit / BytesPerLong;
  3564   int num_tiles = size_limit / BytesPerLong;
  3565 
  3565 
  3566   // allocate space for the tile map:
  3566   // allocate space for the tile map:
  3567   const int small_len = DEBUG_ONLY(true ? 3 :) 30; // keep stack frames small
  3567   const int small_len = DEBUG_ONLY(true ? 3 :) 30; // keep stack frames small
  3568   jlong  tiles_buf[small_len];
  3568   jlong  tiles_buf[small_len];
  3789       return st_off;            // we found a complete word init
  3789       return st_off;            // we found a complete word init
  3790     }
  3790     }
  3791 
  3791 
  3792     // update the map:
  3792     // update the map:
  3793 
  3793 
  3794     intptr_t this_int_off = align_size_down(st_off, BytesPerInt);
  3794     intptr_t this_int_off = align_down(st_off, BytesPerInt);
  3795     if (this_int_off != int_map_off) {
  3795     if (this_int_off != int_map_off) {
  3796       // reset the map:
  3796       // reset the map:
  3797       int_map = 0;
  3797       int_map = 0;
  3798       int_map_off = this_int_off;
  3798       int_map_off = this_int_off;
  3799     }
  3799     }
  3803     if ((int_map & FULL_MAP) == FULL_MAP) {
  3803     if ((int_map & FULL_MAP) == FULL_MAP) {
  3804       return this_int_off;      // we found a complete word init
  3804       return this_int_off;      // we found a complete word init
  3805     }
  3805     }
  3806 
  3806 
  3807     // Did this store hit or cross the word boundary?
  3807     // Did this store hit or cross the word boundary?
  3808     intptr_t next_int_off = align_size_down(st_off + st_size, BytesPerInt);
  3808     intptr_t next_int_off = align_down(st_off + st_size, BytesPerInt);
  3809     if (next_int_off == this_int_off + BytesPerInt) {
  3809     if (next_int_off == this_int_off + BytesPerInt) {
  3810       // We passed the current int, without fully initializing it.
  3810       // We passed the current int, without fully initializing it.
  3811       int_map_off = next_int_off;
  3811       int_map_off = next_int_off;
  3812       int_map >>= BytesPerInt;
  3812       int_map >>= BytesPerInt;
  3813     } else if (next_int_off > this_int_off + BytesPerInt) {
  3813     } else if (next_int_off > this_int_off + BytesPerInt) {
  3893         //   z's_done      12  16  16  16    12  16    12
  3893         //   z's_done      12  16  16  16    12  16    12
  3894         //   z's_needed    12  16  16  16    16  16    16
  3894         //   z's_needed    12  16  16  16    16  16    16
  3895         //   zsize          0   0   0   0     4   0     4
  3895         //   zsize          0   0   0   0     4   0     4
  3896         if (next_full_store < 0) {
  3896         if (next_full_store < 0) {
  3897           // Conservative tack:  Zero to end of current word.
  3897           // Conservative tack:  Zero to end of current word.
  3898           zeroes_needed = align_size_up(zeroes_needed, BytesPerInt);
  3898           zeroes_needed = align_up(zeroes_needed, BytesPerInt);
  3899         } else {
  3899         } else {
  3900           // Zero to beginning of next fully initialized word.
  3900           // Zero to beginning of next fully initialized word.
  3901           // Or, don't zero at all, if we are already in that word.
  3901           // Or, don't zero at all, if we are already in that word.
  3902           assert(next_full_store >= zeroes_needed, "must go forward");
  3902           assert(next_full_store >= zeroes_needed, "must go forward");
  3903           assert((next_full_store & (BytesPerInt-1)) == 0, "even boundary");
  3903           assert((next_full_store & (BytesPerInt-1)) == 0, "even boundary");
  3906       }
  3906       }
  3907 
  3907 
  3908       if (zeroes_needed > zeroes_done) {
  3908       if (zeroes_needed > zeroes_done) {
  3909         intptr_t zsize = zeroes_needed - zeroes_done;
  3909         intptr_t zsize = zeroes_needed - zeroes_done;
  3910         // Do some incremental zeroing on rawmem, in parallel with inits.
  3910         // Do some incremental zeroing on rawmem, in parallel with inits.
  3911         zeroes_done = align_size_down(zeroes_done, BytesPerInt);
  3911         zeroes_done = align_down(zeroes_done, BytesPerInt);
  3912         rawmem = ClearArrayNode::clear_memory(rawctl, rawmem, rawptr,
  3912         rawmem = ClearArrayNode::clear_memory(rawctl, rawmem, rawptr,
  3913                                               zeroes_done, zeroes_needed,
  3913                                               zeroes_done, zeroes_needed,
  3914                                               phase);
  3914                                               phase);
  3915         zeroes_done = zeroes_needed;
  3915         zeroes_done = zeroes_needed;
  3916         if (zsize > InitArrayShortSize && ++big_init_gaps > 2)
  3916         if (zsize > InitArrayShortSize && ++big_init_gaps > 2)
  3939         (int)val->basic_type() < (int)T_OBJECT) {
  3939         (int)val->basic_type() < (int)T_OBJECT) {
  3940       assert(st_off >= last_tile_end, "tiles do not overlap");
  3940       assert(st_off >= last_tile_end, "tiles do not overlap");
  3941       assert(st_off >= last_init_end, "tiles do not overwrite inits");
  3941       assert(st_off >= last_init_end, "tiles do not overwrite inits");
  3942       last_tile_end = MAX2(last_tile_end, next_init_off);
  3942       last_tile_end = MAX2(last_tile_end, next_init_off);
  3943     } else {
  3943     } else {
  3944       intptr_t st_tile_end = align_size_up(next_init_off, BytesPerLong);
  3944       intptr_t st_tile_end = align_up(next_init_off, BytesPerLong);
  3945       assert(st_tile_end >= last_tile_end, "inits stay with tiles");
  3945       assert(st_tile_end >= last_tile_end, "inits stay with tiles");
  3946       assert(st_off      >= last_init_end, "inits do not overlap");
  3946       assert(st_off      >= last_init_end, "inits do not overlap");
  3947       last_init_end = next_init_off;  // it's a non-tile
  3947       last_init_end = next_init_off;  // it's a non-tile
  3948     }
  3948     }
  3949     #endif //ASSERT
  3949     #endif //ASSERT
  3952   remove_extra_zeroes();        // clear out all the zmems left over
  3952   remove_extra_zeroes();        // clear out all the zmems left over
  3953   add_req(inits);
  3953   add_req(inits);
  3954 
  3954 
  3955   if (!(UseTLAB && ZeroTLAB)) {
  3955   if (!(UseTLAB && ZeroTLAB)) {
  3956     // If anything remains to be zeroed, zero it all now.
  3956     // If anything remains to be zeroed, zero it all now.
  3957     zeroes_done = align_size_down(zeroes_done, BytesPerInt);
  3957     zeroes_done = align_down(zeroes_done, BytesPerInt);
  3958     // if it is the last unused 4 bytes of an instance, forget about it
  3958     // if it is the last unused 4 bytes of an instance, forget about it
  3959     intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
  3959     intptr_t size_limit = phase->find_intptr_t_con(size_in_bytes, max_jint);
  3960     if (zeroes_done + BytesPerLong >= size_limit) {
  3960     if (zeroes_done + BytesPerLong >= size_limit) {
  3961       AllocateNode* alloc = allocation();
  3961       AllocateNode* alloc = allocation();
  3962       assert(alloc != NULL, "must be present");
  3962       assert(alloc != NULL, "must be present");