Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1/c1_Runtime1.cpp @ 8860:46f6f063b272
7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by: never, kvn, twisti
Contributed-by: thomaswue <thomas.wuerthinger@oracle.com>
author | roland |
---|---|
date | Thu, 21 Mar 2013 09:27:54 +0100 |
parents | 070d523b96a7 |
children | b9a918201d47 92ef81e2f571 |
comparison
equal
deleted
inserted
replaced
8780:98f3af397705 | 8860:46f6f063b272 |
---|---|
1328 assert(mirror != NULL, "should null-check on mirror before calling"); | 1328 assert(mirror != NULL, "should null-check on mirror before calling"); |
1329 Klass* k = java_lang_Class::as_Klass(mirror); | 1329 Klass* k = java_lang_Class::as_Klass(mirror); |
1330 return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0; | 1330 return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0; |
1331 JRT_END | 1331 JRT_END |
1332 | 1332 |
1333 JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread)) | |
1334 ResourceMark rm; | |
1335 | |
1336 assert(!TieredCompilation, "incompatible with tiered compilation"); | |
1337 | |
1338 RegisterMap reg_map(thread, false); | |
1339 frame runtime_frame = thread->last_frame(); | |
1340 frame caller_frame = runtime_frame.sender(®_map); | |
1341 | |
1342 nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); | |
1343 assert (nm != NULL, "no more nmethod?"); | |
1344 nm->make_not_entrant(); | |
1345 | |
1346 methodHandle m(nm->method()); | |
1347 MethodData* mdo = m->method_data(); | |
1348 | |
1349 if (mdo == NULL && !HAS_PENDING_EXCEPTION) { | |
1350 // Build an MDO. Ignore errors like OutOfMemory; | |
1351 // that simply means we won't have an MDO to update. | |
1352 Method::build_interpreter_method_data(m, THREAD); | |
1353 if (HAS_PENDING_EXCEPTION) { | |
1354 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); | |
1355 CLEAR_PENDING_EXCEPTION; | |
1356 } | |
1357 mdo = m->method_data(); | |
1358 } | |
1359 | |
1360 if (mdo != NULL) { | |
1361 mdo->inc_trap_count(Deoptimization::Reason_none); | |
1362 } | |
1363 | |
1364 if (TracePredicateFailedTraps) { | |
1365 stringStream ss1, ss2; | |
1366 vframeStream vfst(thread); | |
1367 methodHandle inlinee = methodHandle(vfst.method()); | |
1368 inlinee->print_short_name(&ss1); | |
1369 m->print_short_name(&ss2); | |
1370 tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc()); | |
1371 } | |
1372 | |
1373 | |
1374 Deoptimization::deoptimize_frame(thread, caller_frame.id()); | |
1375 | |
1376 JRT_END | |
1333 | 1377 |
1334 #ifndef PRODUCT | 1378 #ifndef PRODUCT |
1335 void Runtime1::print_statistics() { | 1379 void Runtime1::print_statistics() { |
1336 tty->print_cr("C1 Runtime statistics:"); | 1380 tty->print_cr("C1 Runtime statistics:"); |
1337 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr); | 1381 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr); |