30 #include "ci/ciMethodBlocks.hpp"
31 #include "ci/ciMethodData.hpp"
32 #include "ci/ciStreams.hpp"
33 #include "ci/ciSymbol.hpp"
34 #include "ci/ciReplay.hpp"
35 #include "ci/ciUtilities.inline.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "compiler/abstractCompiler.hpp"
38 #include "compiler/methodLiveness.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "interpreter/linkResolver.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "memory/allocation.inline.hpp"
43 #include "memory/resourceArea.hpp"
44 #include "oops/generateOopMap.hpp"
45 #include "oops/method.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "prims/nativeLookup.hpp"
48 #include "runtime/deoptimization.hpp"
49 #include "runtime/handles.inline.hpp"
50 #include "utilities/bitMap.inline.hpp"
51 #include "utilities/xmlstream.hpp"
52 #ifdef COMPILER2
53 #include "ci/bcEscapeAnalyzer.hpp"
54 #include "ci/ciTypeFlow.hpp"
55 #include "oops/method.hpp"
56 #endif
57
58 // ciMethod
59 //
60 // This class represents a Method* in the HotSpot virtual
61 // machine.
62
63
64 // ------------------------------------------------------------------
65 // ciMethod::ciMethod
66 //
67 // Loaded method.
68 ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
69 ciMetadata(h_m()),
1403 name()->print_symbol_on(st);
1404 st->print(" holder=");
1405 holder()->print_name_on(st);
1406 st->print(" signature=");
1407 signature()->as_symbol()->print_symbol_on(st);
1408 if (is_loaded()) {
1409 st->print(" loaded=true");
1410 st->print(" arg_size=%d", arg_size());
1411 st->print(" flags=");
1412 flags().print_member_flags(st);
1413 } else {
1414 st->print(" loaded=false");
1415 }
1416 }
1417
1418 // ------------------------------------------------------------------
1419
1420 static BasicType erase_to_word_type(BasicType bt) {
1421 if (is_subword_type(bt)) return T_INT;
1422 if (bt == T_ARRAY) return T_OBJECT;
1423 return bt;
1424 }
1425
1426 static bool basic_types_match(ciType* t1, ciType* t2) {
1427 if (t1 == t2) return true;
1428 return erase_to_word_type(t1->basic_type()) == erase_to_word_type(t2->basic_type());
1429 }
1430
1431 bool ciMethod::is_consistent_info(ciMethod* declared_method, ciMethod* resolved_method) {
1432 bool invoke_through_mh_intrinsic = declared_method->is_method_handle_intrinsic() &&
1433 !resolved_method->is_method_handle_intrinsic();
1434
1435 if (!invoke_through_mh_intrinsic) {
1436 // Method name & descriptor should stay the same.
1437 // Signatures may reference unloaded types and thus they may be not strictly equal.
1438 ciSymbol* declared_signature = declared_method->signature()->as_symbol();
1439 ciSymbol* resolved_signature = resolved_method->signature()->as_symbol();
1440
1441 return (declared_method->name()->equals(resolved_method->name())) &&
1442 (declared_signature->equals(resolved_signature));
1490 default:
1491 break;
1492 }
1493 assert(target_sig->count() - rbase == linker_sig->count() - sbase - has_appendix, "argument count mismatch");
1494 int arg_count = target_sig->count() - rbase;
1495 for (int i = 0; i < arg_count; i++) {
1496 if (!basic_types_match(linker_sig->type_at(sbase + i), target_sig->type_at(rbase + i))) {
1497 return false;
1498 }
1499 }
1500 // Only check the return type if the symbolic info has non-void return type.
1501 // I.e. the return value of the resolved method can be dropped.
1502 if (!linker->return_type()->is_void() &&
1503 !basic_types_match(linker->return_type(), target->return_type())) {
1504 return false;
1505 }
1506 return true; // no mismatch found
1507 }
1508
1509 // ------------------------------------------------------------------
|
30 #include "ci/ciMethodBlocks.hpp"
31 #include "ci/ciMethodData.hpp"
32 #include "ci/ciStreams.hpp"
33 #include "ci/ciSymbol.hpp"
34 #include "ci/ciReplay.hpp"
35 #include "ci/ciUtilities.inline.hpp"
36 #include "classfile/systemDictionary.hpp"
37 #include "compiler/abstractCompiler.hpp"
38 #include "compiler/methodLiveness.hpp"
39 #include "interpreter/interpreter.hpp"
40 #include "interpreter/linkResolver.hpp"
41 #include "interpreter/oopMapCache.hpp"
42 #include "memory/allocation.inline.hpp"
43 #include "memory/resourceArea.hpp"
44 #include "oops/generateOopMap.hpp"
45 #include "oops/method.inline.hpp"
46 #include "oops/oop.inline.hpp"
47 #include "prims/nativeLookup.hpp"
48 #include "runtime/deoptimization.hpp"
49 #include "runtime/handles.inline.hpp"
50 #include "runtime/sharedRuntime.hpp"
51 #include "utilities/bitMap.inline.hpp"
52 #include "utilities/xmlstream.hpp"
53 #ifdef COMPILER2
54 #include "ci/bcEscapeAnalyzer.hpp"
55 #include "ci/ciTypeFlow.hpp"
56 #include "oops/method.hpp"
57 #endif
58
59 // ciMethod
60 //
61 // This class represents a Method* in the HotSpot virtual
62 // machine.
63
64
65 // ------------------------------------------------------------------
66 // ciMethod::ciMethod
67 //
68 // Loaded method.
69 ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
70 ciMetadata(h_m()),
1404 name()->print_symbol_on(st);
1405 st->print(" holder=");
1406 holder()->print_name_on(st);
1407 st->print(" signature=");
1408 signature()->as_symbol()->print_symbol_on(st);
1409 if (is_loaded()) {
1410 st->print(" loaded=true");
1411 st->print(" arg_size=%d", arg_size());
1412 st->print(" flags=");
1413 flags().print_member_flags(st);
1414 } else {
1415 st->print(" loaded=false");
1416 }
1417 }
1418
1419 // ------------------------------------------------------------------
1420
1421 static BasicType erase_to_word_type(BasicType bt) {
1422 if (is_subword_type(bt)) return T_INT;
1423 if (bt == T_ARRAY) return T_OBJECT;
1424 if (bt == T_VALUETYPE) return T_OBJECT;
1425 return bt;
1426 }
1427
1428 static bool basic_types_match(ciType* t1, ciType* t2) {
1429 if (t1 == t2) return true;
1430 return erase_to_word_type(t1->basic_type()) == erase_to_word_type(t2->basic_type());
1431 }
1432
1433 bool ciMethod::is_consistent_info(ciMethod* declared_method, ciMethod* resolved_method) {
1434 bool invoke_through_mh_intrinsic = declared_method->is_method_handle_intrinsic() &&
1435 !resolved_method->is_method_handle_intrinsic();
1436
1437 if (!invoke_through_mh_intrinsic) {
1438 // Method name & descriptor should stay the same.
1439 // Signatures may reference unloaded types and thus they may be not strictly equal.
1440 ciSymbol* declared_signature = declared_method->signature()->as_symbol();
1441 ciSymbol* resolved_signature = resolved_method->signature()->as_symbol();
1442
1443 return (declared_method->name()->equals(resolved_method->name())) &&
1444 (declared_signature->equals(resolved_signature));
1492 default:
1493 break;
1494 }
1495 assert(target_sig->count() - rbase == linker_sig->count() - sbase - has_appendix, "argument count mismatch");
1496 int arg_count = target_sig->count() - rbase;
1497 for (int i = 0; i < arg_count; i++) {
1498 if (!basic_types_match(linker_sig->type_at(sbase + i), target_sig->type_at(rbase + i))) {
1499 return false;
1500 }
1501 }
1502 // Only check the return type if the symbolic info has non-void return type.
1503 // I.e. the return value of the resolved method can be dropped.
1504 if (!linker->return_type()->is_void() &&
1505 !basic_types_match(linker->return_type(), target->return_type())) {
1506 return false;
1507 }
1508 return true; // no mismatch found
1509 }
1510
1511 // ------------------------------------------------------------------
1512
1513 bool ciMethod::has_scalarized_args() const {
1514 VM_ENTRY_MARK;
1515 return get_Method()->has_scalarized_args();
1516 }
1517
1518 const GrowableArray<SigEntry>* ciMethod::get_sig_cc() {
1519 VM_ENTRY_MARK;
1520 if (get_Method()->adapter() == NULL) {
1521 return NULL;
1522 }
1523 return get_Method()->adapter()->get_sig_cc();
1524 }
|