130
131 address CompilerToVM::Data::SharedRuntime_ic_miss_stub;
132 address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub;
133 address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack;
134 address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap;
135
136 size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve;
137
138 CollectedHeap* CompilerToVM::Data::Universe_collectedHeap;
139 int CompilerToVM::Data::Universe_base_vtable_size;
140 address CompilerToVM::Data::Universe_narrow_oop_base;
141 int CompilerToVM::Data::Universe_narrow_oop_shift;
142 address CompilerToVM::Data::Universe_narrow_klass_base;
143 int CompilerToVM::Data::Universe_narrow_klass_shift;
144 void* CompilerToVM::Data::Universe_non_oop_bits;
145 uintptr_t CompilerToVM::Data::Universe_verify_oop_mask;
146 uintptr_t CompilerToVM::Data::Universe_verify_oop_bits;
147
148 bool CompilerToVM::Data::_supports_inline_contig_alloc;
149 HeapWord** CompilerToVM::Data::_heap_end_addr;
150 HeapWord** CompilerToVM::Data::_heap_top_addr;
151
152 jbyte* CompilerToVM::Data::cardtable_start_address;
153 int CompilerToVM::Data::cardtable_shift;
154
155 int CompilerToVM::Data::vm_page_size;
156
157 void CompilerToVM::Data::initialize() {
158 Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
159 Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset());
160
161 Method_extra_stack_entries = Method::extra_stack_entries();
162
163 SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub();
164 SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub();
165 SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack();
166 SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap();
167
168 ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve();
169
170 Universe_collectedHeap = Universe::heap();
171 Universe_base_vtable_size = Universe::base_vtable_size();
172 Universe_narrow_oop_base = Universe::narrow_oop_base();
173 Universe_narrow_oop_shift = Universe::narrow_oop_shift();
174 Universe_narrow_klass_base = Universe::narrow_klass_base();
175 Universe_narrow_klass_shift = Universe::narrow_klass_shift();
176 Universe_non_oop_bits = Universe::non_oop_word();
177 Universe_verify_oop_mask = Universe::verify_oop_mask();
178 Universe_verify_oop_bits = Universe::verify_oop_bits();
179
180 _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc();
181 _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
182 _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1;
183
184 BarrierSet* bs = Universe::heap()->barrier_set();
185 switch (bs->kind()) {
186 case BarrierSet::CardTableModRef:
187 case BarrierSet::CardTableForRS:
188 case BarrierSet::CardTableExtension:
189 case BarrierSet::G1SATBCT:
190 case BarrierSet::G1SATBCTLogging: {
191 jbyte* base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
192 assert(base != 0, "unexpected byte_map_base");
193 cardtable_start_address = base;
194 cardtable_shift = CardTableModRefBS::card_shift;
195 break;
196 }
197 case BarrierSet::ModRef:
198 cardtable_start_address = 0;
199 cardtable_shift = 0;
200 // No post barriers
201 break;
202 default:
203 ShouldNotReachHere();
204 break;
205 }
206
207 vm_page_size = os::vm_page_size();
208 }
209
210 /**
211 * We put all jvmciHotSpotVM values in an array so we can read them easily from Java.
1323 array->obj_at_put(i, locals->at(i)->get_obj()());
1324 }
1325 }
1326 C2V_END
1327
1328 C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
1329 if (bytes == NULL) {
1330 THROW(vmSymbols::java_lang_NullPointerException());
1331 }
1332 typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes);
1333
1334 // Check if offset and length are non negative.
1335 if (offset < 0 || length < 0) {
1336 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
1337 }
1338 // Check if the range is valid.
1339 if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) {
1340 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
1341 }
1342 while (length > 0) {
1343 jbyte* start = array->byte_at_addr(offset);
1344 tty->write((char*) start, MIN2(length, O_BUFLEN));
1345 length -= O_BUFLEN;
1346 offset += O_BUFLEN;
1347 }
1348 C2V_END
1349
1350 C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
1351 tty->flush();
1352 C2V_END
1353
1354 C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position))
1355 ResourceMark rm;
1356 MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data);
1357 ProfileData* profile_data = mdo->data_at(position);
1358 if (mdo->is_valid(profile_data)) {
1359 return profile_data->size_in_bytes();
1360 }
1361 DataLayout* data = mdo->extra_data_base();
1362 DataLayout* end = mdo->extra_data_limit();
1363 for (;; data = mdo->next_extra(data)) {
1475 {CC"reprofile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(reprofile)},
1476 {CC"invalidateInstalledCode", CC"("INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)},
1477 {CC"readUncompressedOop", CC"(J)"OBJECT, FN_PTR(readUncompressedOop)},
1478 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)},
1479 {CC"allocateCompileId", CC"("HS_RESOLVED_METHOD"I)I", FN_PTR(allocateCompileId)},
1480 {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)},
1481 {CC"hasCompiledCodeForOSR", CC"("HS_RESOLVED_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)},
1482 {CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)},
1483 {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
1484 {CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)},
1485 {CC"shouldDebugNonSafepoints", CC"()Z", FN_PTR(shouldDebugNonSafepoints)},
1486 {CC"writeDebugOutput", CC"([BII)V", FN_PTR(writeDebugOutput)},
1487 {CC"flushDebugOutput", CC"()V", FN_PTR(flushDebugOutput)},
1488 {CC"methodDataProfileDataSize", CC"(JI)I", FN_PTR(methodDataProfileDataSize)},
1489 {CC"interpreterFrameSize", CC"("BYTECODE_FRAME")I", FN_PTR(interpreterFrameSize)},
1490 };
1491
1492 int CompilerToVM::methods_count() {
1493 return sizeof(methods) / sizeof(JNINativeMethod);
1494 }
1495
|
130
131 address CompilerToVM::Data::SharedRuntime_ic_miss_stub;
132 address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub;
133 address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack;
134 address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap;
135
136 size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve;
137
138 CollectedHeap* CompilerToVM::Data::Universe_collectedHeap;
139 int CompilerToVM::Data::Universe_base_vtable_size;
140 address CompilerToVM::Data::Universe_narrow_oop_base;
141 int CompilerToVM::Data::Universe_narrow_oop_shift;
142 address CompilerToVM::Data::Universe_narrow_klass_base;
143 int CompilerToVM::Data::Universe_narrow_klass_shift;
144 void* CompilerToVM::Data::Universe_non_oop_bits;
145 uintptr_t CompilerToVM::Data::Universe_verify_oop_mask;
146 uintptr_t CompilerToVM::Data::Universe_verify_oop_bits;
147
148 bool CompilerToVM::Data::_supports_inline_contig_alloc;
149 HeapWord** CompilerToVM::Data::_heap_end_addr;
150 HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
151
152 volatile jbyte* CompilerToVM::Data::cardtable_start_address;
153 int CompilerToVM::Data::cardtable_shift;
154
155 int CompilerToVM::Data::vm_page_size;
156
157 void CompilerToVM::Data::initialize() {
158 Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
159 Klass_vtable_length_offset = in_bytes(Klass::vtable_length_offset());
160
161 Method_extra_stack_entries = Method::extra_stack_entries();
162
163 SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub();
164 SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub();
165 SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack();
166 SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap();
167
168 ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve();
169
170 Universe_collectedHeap = Universe::heap();
171 Universe_base_vtable_size = Universe::base_vtable_size();
172 Universe_narrow_oop_base = Universe::narrow_oop_base();
173 Universe_narrow_oop_shift = Universe::narrow_oop_shift();
174 Universe_narrow_klass_base = Universe::narrow_klass_base();
175 Universe_narrow_klass_shift = Universe::narrow_klass_shift();
176 Universe_non_oop_bits = Universe::non_oop_word();
177 Universe_verify_oop_mask = Universe::verify_oop_mask();
178 Universe_verify_oop_bits = Universe::verify_oop_bits();
179
180 _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc();
181 _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
182 _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord* volatile*) -1;
183
184 BarrierSet* bs = Universe::heap()->barrier_set();
185 switch (bs->kind()) {
186 case BarrierSet::CardTableModRef:
187 case BarrierSet::CardTableForRS:
188 case BarrierSet::CardTableExtension:
189 case BarrierSet::G1SATBCT:
190 case BarrierSet::G1SATBCTLogging: {
191 volatile jbyte* base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
192 assert(base != 0, "unexpected byte_map_base");
193 cardtable_start_address = base;
194 cardtable_shift = CardTableModRefBS::card_shift;
195 break;
196 }
197 case BarrierSet::ModRef:
198 cardtable_start_address = 0;
199 cardtable_shift = 0;
200 // No post barriers
201 break;
202 default:
203 ShouldNotReachHere();
204 break;
205 }
206
207 vm_page_size = os::vm_page_size();
208 }
209
210 /**
211 * We put all jvmciHotSpotVM values in an array so we can read them easily from Java.
1323 array->obj_at_put(i, locals->at(i)->get_obj()());
1324 }
1325 }
1326 C2V_END
1327
1328 C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
1329 if (bytes == NULL) {
1330 THROW(vmSymbols::java_lang_NullPointerException());
1331 }
1332 typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes);
1333
1334 // Check if offset and length are non negative.
1335 if (offset < 0 || length < 0) {
1336 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
1337 }
1338 // Check if the range is valid.
1339 if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) {
1340 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
1341 }
1342 while (length > 0) {
1343 volatile jbyte* start = array->byte_at_addr(offset);
1344 tty->write((char*) start, MIN2(length, O_BUFLEN));
1345 length -= O_BUFLEN;
1346 offset += O_BUFLEN;
1347 }
1348 C2V_END
1349
1350 C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
1351 tty->flush();
1352 C2V_END
1353
1354 C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position))
1355 ResourceMark rm;
1356 MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data);
1357 ProfileData* profile_data = mdo->data_at(position);
1358 if (mdo->is_valid(profile_data)) {
1359 return profile_data->size_in_bytes();
1360 }
1361 DataLayout* data = mdo->extra_data_base();
1362 DataLayout* end = mdo->extra_data_limit();
1363 for (;; data = mdo->next_extra(data)) {
1475 {CC"reprofile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(reprofile)},
1476 {CC"invalidateInstalledCode", CC"("INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)},
1477 {CC"readUncompressedOop", CC"(J)"OBJECT, FN_PTR(readUncompressedOop)},
1478 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)},
1479 {CC"allocateCompileId", CC"("HS_RESOLVED_METHOD"I)I", FN_PTR(allocateCompileId)},
1480 {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)},
1481 {CC"hasCompiledCodeForOSR", CC"("HS_RESOLVED_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)},
1482 {CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)},
1483 {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
1484 {CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)},
1485 {CC"shouldDebugNonSafepoints", CC"()Z", FN_PTR(shouldDebugNonSafepoints)},
1486 {CC"writeDebugOutput", CC"([BII)V", FN_PTR(writeDebugOutput)},
1487 {CC"flushDebugOutput", CC"()V", FN_PTR(flushDebugOutput)},
1488 {CC"methodDataProfileDataSize", CC"(JI)I", FN_PTR(methodDataProfileDataSize)},
1489 {CC"interpreterFrameSize", CC"("BYTECODE_FRAME")I", FN_PTR(interpreterFrameSize)},
1490 };
1491
1492 int CompilerToVM::methods_count() {
1493 return sizeof(methods) / sizeof(JNINativeMethod);
1494 }
|