src/share/vm/c1/c1_LIR.cpp

changeset 2138
d5d065957597
parent 2036
126ea7725993
child 2146
3a294e483abc
equal deleted inserted replaced
2137:f353275af40e 2138:d5d065957597
343 343
344 344
345 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass, 345 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr result, LIR_Opr object, ciKlass* klass,
346 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, 346 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3,
347 bool fast_check, CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, 347 bool fast_check, CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch,
348 CodeStub* stub, 348 CodeStub* stub)
349 ciMethod* profiled_method, 349
350 int profiled_bci)
351 : LIR_Op(code, result, NULL) 350 : LIR_Op(code, result, NULL)
352 , _object(object) 351 , _object(object)
353 , _array(LIR_OprFact::illegalOpr) 352 , _array(LIR_OprFact::illegalOpr)
354 , _klass(klass) 353 , _klass(klass)
355 , _tmp1(tmp1) 354 , _tmp1(tmp1)
357 , _tmp3(tmp3) 356 , _tmp3(tmp3)
358 , _fast_check(fast_check) 357 , _fast_check(fast_check)
359 , _stub(stub) 358 , _stub(stub)
360 , _info_for_patch(info_for_patch) 359 , _info_for_patch(info_for_patch)
361 , _info_for_exception(info_for_exception) 360 , _info_for_exception(info_for_exception)
362 , _profiled_method(profiled_method) 361 , _profiled_method(NULL)
363 , _profiled_bci(profiled_bci) { 362 , _profiled_bci(-1)
363 , _should_profile(false)
364 {
364 if (code == lir_checkcast) { 365 if (code == lir_checkcast) {
365 assert(info_for_exception != NULL, "checkcast throws exceptions"); 366 assert(info_for_exception != NULL, "checkcast throws exceptions");
366 } else if (code == lir_instanceof) { 367 } else if (code == lir_instanceof) {
367 assert(info_for_exception == NULL, "instanceof throws no exceptions"); 368 assert(info_for_exception == NULL, "instanceof throws no exceptions");
368 } else { 369 } else {
370 } 371 }
371 } 372 }
372 373
373 374
374 375
375 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception, ciMethod* profiled_method, int profiled_bci) 376 LIR_OpTypeCheck::LIR_OpTypeCheck(LIR_Code code, LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception)
376 : LIR_Op(code, LIR_OprFact::illegalOpr, NULL) 377 : LIR_Op(code, LIR_OprFact::illegalOpr, NULL)
377 , _object(object) 378 , _object(object)
378 , _array(array) 379 , _array(array)
379 , _klass(NULL) 380 , _klass(NULL)
380 , _tmp1(tmp1) 381 , _tmp1(tmp1)
382 , _tmp3(tmp3) 383 , _tmp3(tmp3)
383 , _fast_check(false) 384 , _fast_check(false)
384 , _stub(NULL) 385 , _stub(NULL)
385 , _info_for_patch(NULL) 386 , _info_for_patch(NULL)
386 , _info_for_exception(info_for_exception) 387 , _info_for_exception(info_for_exception)
387 , _profiled_method(profiled_method) 388 , _profiled_method(NULL)
388 , _profiled_bci(profiled_bci) { 389 , _profiled_bci(-1)
390 , _should_profile(false)
391 {
389 if (code == lir_store_check) { 392 if (code == lir_store_check) {
390 _stub = new ArrayStoreExceptionStub(info_for_exception); 393 _stub = new ArrayStoreExceptionStub(info_for_exception);
391 assert(info_for_exception != NULL, "store_check throws exceptions"); 394 assert(info_for_exception != NULL, "store_check throws exceptions");
392 } else { 395 } else {
393 ShouldNotReachHere(); 396 ShouldNotReachHere();
493 case lir_leal: // input and result always valid, info always invalid 496 case lir_leal: // input and result always valid, info always invalid
494 case lir_neg: // input and result always valid, info always invalid 497 case lir_neg: // input and result always valid, info always invalid
495 case lir_monaddr: // input and result always valid, info always invalid 498 case lir_monaddr: // input and result always valid, info always invalid
496 case lir_null_check: // input and info always valid, result always invalid 499 case lir_null_check: // input and info always valid, result always invalid
497 case lir_move: // input and result always valid, may have info 500 case lir_move: // input and result always valid, may have info
501 case lir_pack64: // input and result always valid
502 case lir_unpack64: // input and result always valid
498 case lir_prefetchr: // input always valid, result and info always invalid 503 case lir_prefetchr: // input always valid, result and info always invalid
499 case lir_prefetchw: // input always valid, result and info always invalid 504 case lir_prefetchw: // input always valid, result and info always invalid
500 { 505 {
501 assert(op->as_Op1() != NULL, "must be"); 506 assert(op->as_Op1() != NULL, "must be");
502 LIR_Op1* op1 = (LIR_Op1*)op; 507 LIR_Op1* op1 = (LIR_Op1*)op;
901 if (opProfileCall->_recv->is_valid()) do_temp(opProfileCall->_recv); 906 if (opProfileCall->_recv->is_valid()) do_temp(opProfileCall->_recv);
902 assert(opProfileCall->_mdo->is_valid(), "used"); do_temp(opProfileCall->_mdo); 907 assert(opProfileCall->_mdo->is_valid(), "used"); do_temp(opProfileCall->_mdo);
903 assert(opProfileCall->_tmp1->is_valid(), "used"); do_temp(opProfileCall->_tmp1); 908 assert(opProfileCall->_tmp1->is_valid(), "used"); do_temp(opProfileCall->_tmp1);
904 break; 909 break;
905 } 910 }
906
907 default: 911 default:
908 ShouldNotReachHere(); 912 ShouldNotReachHere();
909 } 913 }
910 } 914 }
911 915
1013 masm->emit_alloc_array(this); 1017 masm->emit_alloc_array(this);
1014 masm->emit_code_stub(stub()); 1018 masm->emit_code_stub(stub());
1015 } 1019 }
1016 1020
1017 void LIR_OpTypeCheck::emit_code(LIR_Assembler* masm) { 1021 void LIR_OpTypeCheck::emit_code(LIR_Assembler* masm) {
1018 masm->emit_opTypeCheck(this); 1022 if (code() == lir_checkcast) {
1023 masm->emit_checkcast(this);
1024 } else {
1025 masm->emit_opTypeCheck(this);
1026 }
1019 if (stub()) { 1027 if (stub()) {
1020 masm->emit_code_stub(stub()); 1028 masm->emit_code_stub(stub());
1021 } 1029 }
1022 } 1030 }
1023 1031
1039 1047
1040 void LIR_OpDelay::emit_code(LIR_Assembler* masm) { 1048 void LIR_OpDelay::emit_code(LIR_Assembler* masm) {
1041 masm->emit_delay(this); 1049 masm->emit_delay(this);
1042 } 1050 }
1043 1051
1044
1045 void LIR_OpProfileCall::emit_code(LIR_Assembler* masm) { 1052 void LIR_OpProfileCall::emit_code(LIR_Assembler* masm) {
1046 masm->emit_profile_call(this); 1053 masm->emit_profile_call(this);
1047 } 1054 }
1048
1049 1055
1050 // LIR_List 1056 // LIR_List
1051 LIR_List::LIR_List(Compilation* compilation, BlockBegin* block) 1057 LIR_List::LIR_List(Compilation* compilation, BlockBegin* block)
1052 : _operations(8) 1058 : _operations(8)
1053 , _compilation(compilation) 1059 , _compilation(compilation)
1362 1368
1363 void LIR_List::checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass, 1369 void LIR_List::checkcast (LIR_Opr result, LIR_Opr object, ciKlass* klass,
1364 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, 1370 LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check,
1365 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub, 1371 CodeEmitInfo* info_for_exception, CodeEmitInfo* info_for_patch, CodeStub* stub,
1366 ciMethod* profiled_method, int profiled_bci) { 1372 ciMethod* profiled_method, int profiled_bci) {
1367 append(new LIR_OpTypeCheck(lir_checkcast, result, object, klass, 1373 LIR_OpTypeCheck* c = new LIR_OpTypeCheck(lir_checkcast, result, object, klass,
1368 tmp1, tmp2, tmp3, fast_check, info_for_exception, info_for_patch, stub, 1374 tmp1, tmp2, tmp3, fast_check, info_for_exception, info_for_patch, stub);
1369 profiled_method, profiled_bci)); 1375 if (profiled_method != NULL) {
1370 } 1376 c->set_profiled_method(profiled_method);
1371 1377 c->set_profiled_bci(profiled_bci);
1378 c->set_should_profile(true);
1379 }
1380 append(c);
1381 }
1372 1382
1373 void LIR_List::instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch) { 1383 void LIR_List::instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch) {
1374 append(new LIR_OpTypeCheck(lir_instanceof, result, object, klass, tmp1, tmp2, tmp3, fast_check, NULL, info_for_patch, NULL, NULL, 0)); 1384 append(new LIR_OpTypeCheck(lir_instanceof, result, object, klass, tmp1, tmp2, tmp3, fast_check, NULL, info_for_patch, NULL));
1375 } 1385 }
1376 1386
1377 1387
1378 void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception) { 1388 void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, CodeEmitInfo* info_for_exception) {
1379 append(new LIR_OpTypeCheck(lir_store_check, object, array, tmp1, tmp2, tmp3, info_for_exception, NULL, 0)); 1389 append(new LIR_OpTypeCheck(lir_store_check, object, array, tmp1, tmp2, tmp3, info_for_exception));
1380 } 1390 }
1381 1391
1382 1392
1383 void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value, 1393 void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
1384 LIR_Opr t1, LIR_Opr t2, LIR_Opr result) { 1394 LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {
1609 case lir_throw: s = "throw"; break; 1619 case lir_throw: s = "throw"; break;
1610 case lir_unwind: s = "unwind"; break; 1620 case lir_unwind: s = "unwind"; break;
1611 case lir_convert: s = "convert"; break; 1621 case lir_convert: s = "convert"; break;
1612 case lir_alloc_object: s = "alloc_obj"; break; 1622 case lir_alloc_object: s = "alloc_obj"; break;
1613 case lir_monaddr: s = "mon_addr"; break; 1623 case lir_monaddr: s = "mon_addr"; break;
1624 case lir_pack64: s = "pack64"; break;
1625 case lir_unpack64: s = "unpack64"; break;
1614 // LIR_Op2 1626 // LIR_Op2
1615 case lir_cmp: s = "cmp"; break; 1627 case lir_cmp: s = "cmp"; break;
1616 case lir_cmp_l2i: s = "cmp_l2i"; break; 1628 case lir_cmp_l2i: s = "cmp_l2i"; break;
1617 case lir_ucmp_fd2i: s = "ucomp_fd2i"; break; 1629 case lir_ucmp_fd2i: s = "ucomp_fd2i"; break;
1618 case lir_cmp_fd2i: s = "comp_fd2i"; break; 1630 case lir_cmp_fd2i: s = "comp_fd2i"; break;
1662 case lir_cas_long: s = "cas_long"; break; 1674 case lir_cas_long: s = "cas_long"; break;
1663 case lir_cas_obj: s = "cas_obj"; break; 1675 case lir_cas_obj: s = "cas_obj"; break;
1664 case lir_cas_int: s = "cas_int"; break; 1676 case lir_cas_int: s = "cas_int"; break;
1665 // LIR_OpProfileCall 1677 // LIR_OpProfileCall
1666 case lir_profile_call: s = "profile_call"; break; 1678 case lir_profile_call: s = "profile_call"; break;
1667
1668 case lir_none: ShouldNotReachHere();break; 1679 case lir_none: ShouldNotReachHere();break;
1669 default: s = "illegal_op"; break; 1680 default: s = "illegal_op"; break;
1670 } 1681 }
1671 return s; 1682 return s;
1672 } 1683 }
1920 mdo()->print(out); out->print(" "); 1931 mdo()->print(out); out->print(" ");
1921 recv()->print(out); out->print(" "); 1932 recv()->print(out); out->print(" ");
1922 tmp1()->print(out); out->print(" "); 1933 tmp1()->print(out); out->print(" ");
1923 } 1934 }
1924 1935
1925
1926 #endif // PRODUCT 1936 #endif // PRODUCT
1927 1937
1928 // Implementation of LIR_InsertionBuffer 1938 // Implementation of LIR_InsertionBuffer
1929 1939
1930 void LIR_InsertionBuffer::append(int index, LIR_Op* op) { 1940 void LIR_InsertionBuffer::append(int index, LIR_Op* op) {

mercurial