21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CI_CIMETHOD_HPP
26 #define SHARE_VM_CI_CIMETHOD_HPP
27
28 #include "ci/ciFlags.hpp"
29 #include "ci/ciInstanceKlass.hpp"
30 #include "ci/ciObject.hpp"
31 #include "ci/ciSignature.hpp"
32 #include "compiler/methodLiveness.hpp"
33 #include "prims/methodHandles.hpp"
34 #include "utilities/bitMap.hpp"
35
36 class ciMethodBlocks;
37 class MethodLiveness;
38 class BitMap;
39 class Arena;
40 class BCEscapeAnalyzer;
41
42
43 // ciMethod
44 //
45 // This class represents a methodOop in the HotSpot virtual
46 // machine.
47 class ciMethod : public ciObject {
48 friend class CompileBroker;
49 CI_PACKAGE_ACCESS
50 friend class ciEnv;
51 friend class ciExceptionHandlerStream;
52 friend class ciBytecodeStream;
53 friend class ciMethodHandle;
54
55 private:
56 // General method information.
57 ciFlags _flags;
58 ciSymbol* _name;
59 ciInstanceKlass* _holder;
60 ciSignature* _signature;
61 ciMethodData* _method_data;
98
99 oop loader() const { return _holder->loader(); }
100
101 const char* type_string() { return "ciMethod"; }
102
103 void print_impl(outputStream* st);
104
105 void load_code();
106
107 void check_is_loaded() const { assert(is_loaded(), "not loaded"); }
108
109 bool ensure_method_data(methodHandle h_m);
110
111 void code_at_put(int bci, Bytecodes::Code code) {
112 Bytecodes::check(code);
113 assert(0 <= bci && bci < code_size(), "valid bci");
114 address bcp = _code + bci;
115 *bcp = code;
116 }
117
118 public:
119 // Basic method information.
120 ciFlags flags() const { check_is_loaded(); return _flags; }
121 ciSymbol* name() const { return _name; }
122 ciInstanceKlass* holder() const { return _holder; }
123 ciMethodData* method_data();
124 ciMethodData* method_data_or_null();
125
126 // Signature information.
127 ciSignature* signature() const { return _signature; }
128 ciType* return_type() const { return _signature->return_type(); }
129 int arg_size_no_receiver() const { return _signature->size(); }
130 // Can only be used on loaded ciMethods
131 int arg_size() const {
132 check_is_loaded();
133 return _signature->size() + (_flags.is_static() ? 0 : 1);
134 }
135 // Report the number of elements on stack when invoking this method.
136 // This is different than the regular arg_size because invokdynamic
137 // has an implicit receiver.
278 // Other flags
279 bool is_empty_method() const;
280 bool is_vanilla_constructor() const;
281 bool is_final_method() const { return is_final() || holder()->is_final(); }
282 bool has_loops () const;
283 bool has_jsrs () const;
284 bool is_accessor () const;
285 bool is_initializer () const;
286 bool can_be_statically_bound() const { return _can_be_statically_bound; }
287
288 // Print the bytecodes of this method.
289 void print_codes_on(outputStream* st);
290 void print_codes() {
291 print_codes_on(tty);
292 }
293 void print_codes_on(int from, int to, outputStream* st);
294
295 // Print the name of this method in various incarnations.
296 void print_name(outputStream* st = tty);
297 void print_short_name(outputStream* st = tty);
298 };
299
300 #endif // SHARE_VM_CI_CIMETHOD_HPP
|
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_CI_CIMETHOD_HPP
26 #define SHARE_VM_CI_CIMETHOD_HPP
27
28 #include "ci/ciFlags.hpp"
29 #include "ci/ciInstanceKlass.hpp"
30 #include "ci/ciObject.hpp"
31 #include "ci/ciSignature.hpp"
32 #include "compiler/methodLiveness.hpp"
33 #include "prims/methodHandles.hpp"
34 #include "utilities/bitMap.hpp"
35
36 class ciMethodBlocks;
37 class MethodLiveness;
38 class BitMap;
39 class Arena;
40 class BCEscapeAnalyzer;
41 class ProfileData;
42
43 // ciMethod
44 //
45 // This class represents a methodOop in the HotSpot virtual
46 // machine.
47 class ciMethod : public ciObject {
48 friend class CompileBroker;
49 CI_PACKAGE_ACCESS
50 friend class ciEnv;
51 friend class ciExceptionHandlerStream;
52 friend class ciBytecodeStream;
53 friend class ciMethodHandle;
54
55 private:
56 // General method information.
57 ciFlags _flags;
58 ciSymbol* _name;
59 ciInstanceKlass* _holder;
60 ciSignature* _signature;
61 ciMethodData* _method_data;
98
99 oop loader() const { return _holder->loader(); }
100
101 const char* type_string() { return "ciMethod"; }
102
103 void print_impl(outputStream* st);
104
105 void load_code();
106
107 void check_is_loaded() const { assert(is_loaded(), "not loaded"); }
108
109 bool ensure_method_data(methodHandle h_m);
110
111 void code_at_put(int bci, Bytecodes::Code code) {
112 Bytecodes::check(code);
113 assert(0 <= bci && bci < code_size(), "valid bci");
114 address bcp = _code + bci;
115 *bcp = code;
116 }
117
118 #ifdef COMPILER1
119 // C1 profile based inlining support
120 void profile_force_mark_hot(int bci);
121 bool profile_is_hot_helper(ProfileData* data, int bci, bool& warm, bool full);
122 #endif
123
124 public:
125 // Basic method information.
126 ciFlags flags() const { check_is_loaded(); return _flags; }
127 ciSymbol* name() const { return _name; }
128 ciInstanceKlass* holder() const { return _holder; }
129 ciMethodData* method_data();
130 ciMethodData* method_data_or_null();
131
132 // Signature information.
133 ciSignature* signature() const { return _signature; }
134 ciType* return_type() const { return _signature->return_type(); }
135 int arg_size_no_receiver() const { return _signature->size(); }
136 // Can only be used on loaded ciMethods
137 int arg_size() const {
138 check_is_loaded();
139 return _signature->size() + (_flags.is_static() ? 0 : 1);
140 }
141 // Report the number of elements on stack when invoking this method.
142 // This is different than the regular arg_size because invokdynamic
143 // has an implicit receiver.
284 // Other flags
285 bool is_empty_method() const;
286 bool is_vanilla_constructor() const;
287 bool is_final_method() const { return is_final() || holder()->is_final(); }
288 bool has_loops () const;
289 bool has_jsrs () const;
290 bool is_accessor () const;
291 bool is_initializer () const;
292 bool can_be_statically_bound() const { return _can_be_statically_bound; }
293
294 // Print the bytecodes of this method.
295 void print_codes_on(outputStream* st);
296 void print_codes() {
297 print_codes_on(tty);
298 }
299 void print_codes_on(int from, int to, outputStream* st);
300
301 // Print the name of this method in various incarnations.
302 void print_name(outputStream* st = tty);
303 void print_short_name(outputStream* st = tty);
304
305 #ifdef COMPILER1
306 // C1 profile based inlining support
307
308 // return true if either the call site was already marked hot or
309 // from profile data gathered so far, we find it is hot
310 bool profile_is_hot(int bci, bool& warm);
311 // return klass if call site is hot and only a single receiver class
312 // was seen for this call site.
313 ciInstanceKlass* profile_single_hot_receiver(int bci);
314 #endif
315 };
316
317 #endif // SHARE_VM_CI_CIMETHOD_HPP
|