Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/sharedRuntime.cpp @ 1749:b4099f5786da
Merge
author | never |
---|---|
date | Wed, 25 Aug 2010 10:31:45 -0700 |
parents | 3e8fbc61cee8 |
children | d257356e35f0 |
comparison
equal
deleted
inserted
replaced
1745:ebfb7c68865e | 1749:b4099f5786da |
---|---|
453 | 453 |
454 bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc); | 454 bool at_poll_return = ((nmethod*)cb)->is_at_poll_return(pc); |
455 if (at_poll_return) { | 455 if (at_poll_return) { |
456 assert(SharedRuntime::polling_page_return_handler_blob() != NULL, | 456 assert(SharedRuntime::polling_page_return_handler_blob() != NULL, |
457 "polling page return stub not created yet"); | 457 "polling page return stub not created yet"); |
458 stub = SharedRuntime::polling_page_return_handler_blob()->instructions_begin(); | 458 stub = SharedRuntime::polling_page_return_handler_blob()->entry_point(); |
459 } else { | 459 } else { |
460 assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL, | 460 assert(SharedRuntime::polling_page_safepoint_handler_blob() != NULL, |
461 "polling page safepoint stub not created yet"); | 461 "polling page safepoint stub not created yet"); |
462 stub = SharedRuntime::polling_page_safepoint_handler_blob()->instructions_begin(); | 462 stub = SharedRuntime::polling_page_safepoint_handler_blob()->entry_point(); |
463 } | 463 } |
464 #ifndef PRODUCT | 464 #ifndef PRODUCT |
465 if( TraceSafepoint ) { | 465 if( TraceSafepoint ) { |
466 char buf[256]; | 466 char buf[256]; |
467 jio_snprintf(buf, sizeof(buf), | 467 jio_snprintf(buf, sizeof(buf), |
572 } | 572 } |
573 } while (!top_frame_only && handler_bci < 0 && sd != NULL); | 573 } while (!top_frame_only && handler_bci < 0 && sd != NULL); |
574 } | 574 } |
575 | 575 |
576 // found handling method => lookup exception handler | 576 // found handling method => lookup exception handler |
577 int catch_pco = ret_pc - nm->instructions_begin(); | 577 int catch_pco = ret_pc - nm->code_begin(); |
578 | 578 |
579 ExceptionHandlerTable table(nm); | 579 ExceptionHandlerTable table(nm); |
580 HandlerTableEntry *t = table.entry_for(catch_pco, handler_bci, scope_depth); | 580 HandlerTableEntry *t = table.entry_for(catch_pco, handler_bci, scope_depth); |
581 if (t == NULL && (nm->is_compiled_by_c1() || handler_bci != -1)) { | 581 if (t == NULL && (nm->is_compiled_by_c1() || handler_bci != -1)) { |
582 // Allow abbreviated catch tables. The idea is to allow a method | 582 // Allow abbreviated catch tables. The idea is to allow a method |
605 nm->print_code(); | 605 nm->print_code(); |
606 guarantee(false, "missing exception handler"); | 606 guarantee(false, "missing exception handler"); |
607 return NULL; | 607 return NULL; |
608 } | 608 } |
609 | 609 |
610 return nm->instructions_begin() + t->pco(); | 610 return nm->code_begin() + t->pco(); |
611 } | 611 } |
612 | 612 |
613 JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread)) | 613 JRT_ENTRY(void, SharedRuntime::throw_AbstractMethodError(JavaThread* thread)) |
614 // These errors occur only at call sites | 614 // These errors occur only at call sites |
615 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_AbstractMethodError()); | 615 throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_AbstractMethodError()); |
2250 address ic_miss = SharedRuntime::get_ic_miss_stub(); | 2250 address ic_miss = SharedRuntime::get_ic_miss_stub(); |
2251 assert(ic_miss != NULL, "must have handler"); | 2251 assert(ic_miss != NULL, "must have handler"); |
2252 | 2252 |
2253 ResourceMark rm; | 2253 ResourceMark rm; |
2254 | 2254 |
2255 NOT_PRODUCT(int code_size); | 2255 NOT_PRODUCT(int insts_size); |
2256 AdapterBlob* B = NULL; | 2256 AdapterBlob* B = NULL; |
2257 AdapterHandlerEntry* entry = NULL; | 2257 AdapterHandlerEntry* entry = NULL; |
2258 AdapterFingerPrint* fingerprint = NULL; | 2258 AdapterFingerPrint* fingerprint = NULL; |
2259 { | 2259 { |
2260 MutexLocker mu(AdapterHandlerLibrary_lock); | 2260 MutexLocker mu(AdapterHandlerLibrary_lock); |
2303 | 2303 |
2304 // Create I2C & C2I handlers | 2304 // Create I2C & C2I handlers |
2305 | 2305 |
2306 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache | 2306 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache |
2307 if (buf != NULL) { | 2307 if (buf != NULL) { |
2308 CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size()); | 2308 CodeBuffer buffer(buf); |
2309 short buffer_locs[20]; | 2309 short buffer_locs[20]; |
2310 buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs, | 2310 buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs, |
2311 sizeof(buffer_locs)/sizeof(relocInfo)); | 2311 sizeof(buffer_locs)/sizeof(relocInfo)); |
2312 MacroAssembler _masm(&buffer); | 2312 MacroAssembler _masm(&buffer); |
2313 | 2313 |
2319 fingerprint); | 2319 fingerprint); |
2320 | 2320 |
2321 #ifdef ASSERT | 2321 #ifdef ASSERT |
2322 if (VerifyAdapterSharing) { | 2322 if (VerifyAdapterSharing) { |
2323 if (shared_entry != NULL) { | 2323 if (shared_entry != NULL) { |
2324 assert(shared_entry->compare_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt), | 2324 assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt), |
2325 "code must match"); | 2325 "code must match"); |
2326 // Release the one just created and return the original | 2326 // Release the one just created and return the original |
2327 _adapters->free_entry(entry); | 2327 _adapters->free_entry(entry); |
2328 return shared_entry; | 2328 return shared_entry; |
2329 } else { | 2329 } else { |
2330 entry->save_code(buf->instructions_begin(), buffer.code_size(), total_args_passed, sig_bt); | 2330 entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt); |
2331 } | 2331 } |
2332 } | 2332 } |
2333 #endif | 2333 #endif |
2334 | 2334 |
2335 B = AdapterBlob::create(&buffer); | 2335 B = AdapterBlob::create(&buffer); |
2336 NOT_PRODUCT(code_size = buffer.code_size()); | 2336 NOT_PRODUCT(insts_size = buffer.insts_size()); |
2337 } | 2337 } |
2338 if (B == NULL) { | 2338 if (B == NULL) { |
2339 // CodeCache is full, disable compilation | 2339 // CodeCache is full, disable compilation |
2340 // Ought to log this but compile log is only per compile thread | 2340 // Ought to log this but compile log is only per compile thread |
2341 // and we're some non descript Java thread. | 2341 // and we're some non descript Java thread. |
2342 MutexUnlocker mu(AdapterHandlerLibrary_lock); | 2342 MutexUnlocker mu(AdapterHandlerLibrary_lock); |
2343 CompileBroker::handle_full_code_cache(); | 2343 CompileBroker::handle_full_code_cache(); |
2344 return NULL; // Out of CodeCache space | 2344 return NULL; // Out of CodeCache space |
2345 } | 2345 } |
2346 entry->relocate(B->instructions_begin()); | 2346 entry->relocate(B->content_begin()); |
2347 #ifndef PRODUCT | 2347 #ifndef PRODUCT |
2348 // debugging suppport | 2348 // debugging suppport |
2349 if (PrintAdapterHandlers) { | 2349 if (PrintAdapterHandlers) { |
2350 tty->cr(); | 2350 tty->cr(); |
2351 tty->print_cr("i2c argument handler #%d for: %s %s (fingerprint = %s, %d bytes generated)", | 2351 tty->print_cr("i2c argument handler #%d for: %s %s (fingerprint = %s, %d bytes generated)", |
2352 _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"), | 2352 _adapters->number_of_entries(), (method->is_static() ? "static" : "receiver"), |
2353 method->signature()->as_C_string(), fingerprint->as_string(), code_size ); | 2353 method->signature()->as_C_string(), fingerprint->as_string(), insts_size ); |
2354 tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry()); | 2354 tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry()); |
2355 Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + code_size); | 2355 Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + insts_size); |
2356 } | 2356 } |
2357 #endif | 2357 #endif |
2358 | 2358 |
2359 _adapters->add(entry); | 2359 _adapters->add(entry); |
2360 } | 2360 } |
2364 jio_snprintf(blob_id, | 2364 jio_snprintf(blob_id, |
2365 sizeof(blob_id), | 2365 sizeof(blob_id), |
2366 "%s(%s)@" PTR_FORMAT, | 2366 "%s(%s)@" PTR_FORMAT, |
2367 B->name(), | 2367 B->name(), |
2368 fingerprint->as_string(), | 2368 fingerprint->as_string(), |
2369 B->instructions_begin()); | 2369 B->content_begin()); |
2370 Forte::register_stub(blob_id, B->instructions_begin(), B->instructions_end()); | 2370 Forte::register_stub(blob_id, B->content_begin(), B->content_end()); |
2371 | 2371 |
2372 if (JvmtiExport::should_post_dynamic_code_generated()) { | 2372 if (JvmtiExport::should_post_dynamic_code_generated()) { |
2373 JvmtiExport::post_dynamic_code_generated(blob_id, | 2373 JvmtiExport::post_dynamic_code_generated(blob_id, B->content_begin(), B->content_end()); |
2374 B->instructions_begin(), | |
2375 B->instructions_end()); | |
2376 } | 2374 } |
2377 } | 2375 } |
2378 return entry; | 2376 return entry; |
2379 } | 2377 } |
2380 | 2378 |
2454 | 2452 |
2455 ResourceMark rm; | 2453 ResourceMark rm; |
2456 | 2454 |
2457 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache | 2455 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache |
2458 if (buf != NULL) { | 2456 if (buf != NULL) { |
2459 CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size()); | 2457 CodeBuffer buffer(buf); |
2460 double locs_buf[20]; | 2458 double locs_buf[20]; |
2461 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); | 2459 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); |
2462 MacroAssembler _masm(&buffer); | 2460 MacroAssembler _masm(&buffer); |
2463 | 2461 |
2464 // Fill in the signature array, for the calling-convention call. | 2462 // Fill in the signature array, for the calling-convention call. |
2538 | 2536 |
2539 ResourceMark rm; | 2537 ResourceMark rm; |
2540 | 2538 |
2541 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache | 2539 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache |
2542 if (buf != NULL) { | 2540 if (buf != NULL) { |
2543 CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size()); | 2541 CodeBuffer buffer(buf); |
2544 // Need a few relocation entries | 2542 // Need a few relocation entries |
2545 double locs_buf[20]; | 2543 double locs_buf[20]; |
2546 buffer.insts()->initialize_shared_locs( | 2544 buffer.insts()->initialize_shared_locs( |
2547 (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); | 2545 (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); |
2548 MacroAssembler _masm(&buffer); | 2546 MacroAssembler _masm(&buffer); |