64 Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord)); 65 _data = NULL; 66 _data_size = 0; 67 _extra_data_size = 0; 68 _current_mileage = 0; 69 _invocation_counter = 0; 70 _backedge_counter = 0; 71 _state = empty_state; 72 _saw_free_extra_data = false; 73 // Set an initial hint. Don't use set_hint_di() because 74 // first_di() may be out of bounds if data_size is 0. 75 _hint_di = first_di(); 76 // Initialize the escape information (to "don't know."); 77 _eflags = _arg_local = _arg_stack = _arg_returned = 0; 78 _parameters = NULL; 79 } 80 81 void ciMethodData::load_extra_data() { 82 MethodData* mdo = get_MethodData(); 83 84 MutexLocker(mdo->extra_data_lock()); 85 86 // speculative trap entries also hold a pointer to a Method so need to be translated 87 DataLayout* dp_src = mdo->extra_data_base(); 88 DataLayout* end_src = mdo->args_data_limit(); 89 DataLayout* dp_dst = extra_data_base(); 90 for (;; dp_src = MethodData::next_extra(dp_src), dp_dst = MethodData::next_extra(dp_dst)) { 91 assert(dp_src < end_src, "moved past end of extra data"); 92 assert(((intptr_t)dp_dst) - ((intptr_t)extra_data_base()) == ((intptr_t)dp_src) - ((intptr_t)mdo->extra_data_base()), "source and destination don't match"); 93 94 // New traps in the MDO may have been added since we copied the 95 // data (concurrent deoptimizations before we acquired 96 // extra_data_lock above) or can be removed (a safepoint may occur 97 // in the translate_from call below) as we translate the copy: 98 // update the copy as we go. 99 int tag = dp_src->tag(); 100 if (tag != DataLayout::arg_info_data_tag) { 101 memcpy(dp_dst, dp_src, ((intptr_t)MethodData::next_extra(dp_src)) - ((intptr_t)dp_src)); 102 } 103 104 switch(tag) { 105 case DataLayout::speculative_trap_data_tag: { 106 ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst); 107 SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src); 108 109 data_dst->translate_from(data_src); 110 111 #ifdef ASSERT 112 SpeculativeTrapData* data_src2 = new SpeculativeTrapData(dp_src); 113 assert(data_src2->method() == data_src->method() && data_src2->bci() == data_src->bci(), "entries changed while translating"); 114 #endif 115 116 break; 117 } 118 case DataLayout::bit_data_tag: 119 break; 120 case DataLayout::no_tag: 121 case DataLayout::arg_info_data_tag: 122 // An empty slot or ArgInfoData entry marks the end of the trap data 123 return; 124 default: 125 fatal("bad tag = %d", dp_dst->tag()); 126 } 127 } 128 } 129 130 void ciMethodData::load_data() { 131 MethodData* mdo = get_MethodData(); 132 if (mdo == NULL) { 133 return; 134 } 135 136 // To do: don't copy the data if it is not "ripe" -- require a minimum # 137 // of invocations. 138 139 // Snapshot the data -- actually, take an approximate snapshot of 140 // the data. Any concurrently executing threads may be changing the 141 // data as we copy it. 142 Copy::disjoint_words((HeapWord*) mdo, 143 (HeapWord*) &_orig, 144 sizeof(_orig) / HeapWordSize); 145 Arena* arena = CURRENT_ENV->arena(); | 64 Copy::zero_to_words((HeapWord*) &_orig, sizeof(_orig) / sizeof(HeapWord)); 65 _data = NULL; 66 _data_size = 0; 67 _extra_data_size = 0; 68 _current_mileage = 0; 69 _invocation_counter = 0; 70 _backedge_counter = 0; 71 _state = empty_state; 72 _saw_free_extra_data = false; 73 // Set an initial hint. Don't use set_hint_di() because 74 // first_di() may be out of bounds if data_size is 0. 75 _hint_di = first_di(); 76 // Initialize the escape information (to "don't know."); 77 _eflags = _arg_local = _arg_stack = _arg_returned = 0; 78 _parameters = NULL; 79 } 80 81 void ciMethodData::load_extra_data() { 82 MethodData* mdo = get_MethodData(); 83 84 MutexLocker ml(mdo->extra_data_lock()); 85 86 // speculative trap entries also hold a pointer to a Method so need to be translated 87 DataLayout* dp_src = mdo->extra_data_base(); 88 DataLayout* end_src = mdo->args_data_limit(); 89 DataLayout* dp_dst = extra_data_base(); 90 for (;; dp_src = MethodData::next_extra(dp_src), dp_dst = MethodData::next_extra(dp_dst)) { 91 assert(dp_src < end_src, "moved past end of extra data"); 92 assert(((intptr_t)dp_dst) - ((intptr_t)extra_data_base()) == ((intptr_t)dp_src) - ((intptr_t)mdo->extra_data_base()), "source and destination don't match"); 93 94 // New traps in the MDO may have been added since we copied the 95 // data (concurrent deoptimizations before we acquired 96 // extra_data_lock above) or can be removed (a safepoint may occur 97 // in the translate_from call below) as we translate the copy: 98 // update the copy as we go. 99 int tag = dp_src->tag(); 100 if (tag != DataLayout::arg_info_data_tag) { 101 memcpy(dp_dst, dp_src, ((intptr_t)MethodData::next_extra(dp_src)) - ((intptr_t)dp_src)); 102 } 103 104 switch(tag) { 105 case DataLayout::speculative_trap_data_tag: { 106 ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst); 107 SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src); 108 109 data_dst->translate_from(data_src); 110 111 #ifdef ASSERT 112 SpeculativeTrapData* data_src2 = new SpeculativeTrapData(dp_src); 113 assert(data_src2->method() == data_src->method() && data_src2->bci() == data_src->bci(), "entries changed while translating"); 114 #endif 115 116 break; 117 } 118 case DataLayout::bit_data_tag: 119 break; 120 case DataLayout::no_tag: 121 case DataLayout::arg_info_data_tag: 122 // An empty slot or ArgInfoData entry marks the end of the trap data 123 { 124 return; // Need a block to avoid SS compiler bug 125 } 126 default: 127 fatal("bad tag = %d", tag); 128 } 129 } 130 } 131 132 void ciMethodData::load_data() { 133 MethodData* mdo = get_MethodData(); 134 if (mdo == NULL) { 135 return; 136 } 137 138 // To do: don't copy the data if it is not "ripe" -- require a minimum # 139 // of invocations. 140 141 // Snapshot the data -- actually, take an approximate snapshot of 142 // the data. Any concurrently executing threads may be changing the 143 // data as we copy it. 144 Copy::disjoint_words((HeapWord*) mdo, 145 (HeapWord*) &_orig, 146 sizeof(_orig) / HeapWordSize); 147 Arena* arena = CURRENT_ENV->arena(); |