51 #ifdef COMPILER2
52 #include "ci/bcEscapeAnalyzer.hpp"
53 #include "ci/ciTypeFlow.hpp"
54 #include "oops/method.hpp"
55 #endif
56 #ifdef SHARK
57 #include "ci/ciTypeFlow.hpp"
58 #include "oops/method.hpp"
59 #endif
60
61 // ciMethod
62 //
63 // This class represents a Method* in the HotSpot virtual
64 // machine.
65
66
67 // ------------------------------------------------------------------
68 // ciMethod::ciMethod
69 //
70 // Loaded method.
71 ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
72 ciMetadata(h_m()),
73 _holder(holder)
74 {
75 assert(h_m() != NULL, "no null method");
76
77 if (LogTouchedMethods) {
78 h_m()->log_touched(Thread::current());
79 }
80 // These fields are always filled in in loaded methods.
81 _flags = ciFlags(h_m()->access_flags());
82
83 // Easy to compute, so fill them in now.
84 _max_stack = h_m()->max_stack();
85 _max_locals = h_m()->max_locals();
86 _code_size = h_m()->code_size();
87 _intrinsic_id = h_m()->intrinsic_id();
88 _handler_count = h_m()->exception_table_length();
89 _size_of_parameters = h_m()->size_of_parameters();
90 _uses_monitors = h_m()->access_flags().has_monitor_bytecodes();
91 _balanced_monitors = !_uses_monitors || h_m()->access_flags().is_monitor_matching();
962 bool ciMethod::is_object_initializer() const {
963 return name() == ciSymbol::object_initializer_name();
964 }
965
966 // ------------------------------------------------------------------
967 // ciMethod::has_member_arg
968 //
969 // Return true if the method is a linker intrinsic like _linkToVirtual.
970 // These are built by the JVM.
971 bool ciMethod::has_member_arg() const {
972 vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded
973 return (MethodHandles::is_signature_polymorphic(iid) &&
974 MethodHandles::has_member_arg(iid));
975 }
976
977 // ------------------------------------------------------------------
978 // ciMethod::ensure_method_data
979 //
980 // Generate new MethodData* objects at compile time.
981 // Return true if allocation was successful or no MDO is required.
982 bool ciMethod::ensure_method_data(methodHandle h_m) {
983 EXCEPTION_CONTEXT;
984 if (is_native() || is_abstract() || h_m()->is_accessor()) {
985 return true;
986 }
987 if (h_m()->method_data() == NULL) {
988 Method::build_interpreter_method_data(h_m, THREAD);
989 if (HAS_PENDING_EXCEPTION) {
990 CLEAR_PENDING_EXCEPTION;
991 }
992 }
993 if (h_m()->method_data() != NULL) {
994 _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());
995 _method_data->load_data();
996 return true;
997 } else {
998 _method_data = CURRENT_ENV->get_empty_methodData();
999 return false;
1000 }
1001 }
1002
|
51 #ifdef COMPILER2
52 #include "ci/bcEscapeAnalyzer.hpp"
53 #include "ci/ciTypeFlow.hpp"
54 #include "oops/method.hpp"
55 #endif
56 #ifdef SHARK
57 #include "ci/ciTypeFlow.hpp"
58 #include "oops/method.hpp"
59 #endif
60
61 // ciMethod
62 //
63 // This class represents a Method* in the HotSpot virtual
64 // machine.
65
66
67 // ------------------------------------------------------------------
68 // ciMethod::ciMethod
69 //
70 // Loaded method.
71 ciMethod::ciMethod(const methodHandle& h_m, ciInstanceKlass* holder) :
72 ciMetadata(h_m()),
73 _holder(holder)
74 {
75 assert(h_m() != NULL, "no null method");
76
77 if (LogTouchedMethods) {
78 h_m()->log_touched(Thread::current());
79 }
80 // These fields are always filled in in loaded methods.
81 _flags = ciFlags(h_m()->access_flags());
82
83 // Easy to compute, so fill them in now.
84 _max_stack = h_m()->max_stack();
85 _max_locals = h_m()->max_locals();
86 _code_size = h_m()->code_size();
87 _intrinsic_id = h_m()->intrinsic_id();
88 _handler_count = h_m()->exception_table_length();
89 _size_of_parameters = h_m()->size_of_parameters();
90 _uses_monitors = h_m()->access_flags().has_monitor_bytecodes();
91 _balanced_monitors = !_uses_monitors || h_m()->access_flags().is_monitor_matching();
962 bool ciMethod::is_object_initializer() const {
963 return name() == ciSymbol::object_initializer_name();
964 }
965
966 // ------------------------------------------------------------------
967 // ciMethod::has_member_arg
968 //
969 // Return true if the method is a linker intrinsic like _linkToVirtual.
970 // These are built by the JVM.
971 bool ciMethod::has_member_arg() const {
972 vmIntrinsics::ID iid = _intrinsic_id; // do not check if loaded
973 return (MethodHandles::is_signature_polymorphic(iid) &&
974 MethodHandles::has_member_arg(iid));
975 }
976
977 // ------------------------------------------------------------------
978 // ciMethod::ensure_method_data
979 //
980 // Generate new MethodData* objects at compile time.
981 // Return true if allocation was successful or no MDO is required.
982 bool ciMethod::ensure_method_data(const methodHandle& h_m) {
983 EXCEPTION_CONTEXT;
984 if (is_native() || is_abstract() || h_m()->is_accessor()) {
985 return true;
986 }
987 if (h_m()->method_data() == NULL) {
988 Method::build_interpreter_method_data(h_m, THREAD);
989 if (HAS_PENDING_EXCEPTION) {
990 CLEAR_PENDING_EXCEPTION;
991 }
992 }
993 if (h_m()->method_data() != NULL) {
994 _method_data = CURRENT_ENV->get_method_data(h_m()->method_data());
995 _method_data->load_data();
996 return true;
997 } else {
998 _method_data = CURRENT_ENV->get_empty_methodData();
999 return false;
1000 }
1001 }
1002
|