112 } else {
113 // Have to use a conservative value in this case.
114 _can_be_statically_bound = false;
115 }
116
117 // Adjust the definition of this condition to be more useful:
118 // %%% take these conditions into account in vtable generation
119 if (!_can_be_statically_bound && h_m()->is_private())
120 _can_be_statically_bound = true;
121 if (_can_be_statically_bound && h_m()->is_abstract())
122 _can_be_statically_bound = false;
123
124 // generating _signature may allow GC and therefore move m.
125 // These fields are always filled in.
126 _name = env->get_symbol(h_m()->name());
127 _holder = env->get_instance_klass(h_m()->method_holder());
128 ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
129 constantPoolHandle cpool = h_m()->constants();
130 _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
131 _method_data = NULL;
132 // Take a snapshot of these values, so they will be commensurate with the MDO.
133 if (ProfileInterpreter || TieredCompilation) {
134 int invcnt = h_m()->interpreter_invocation_count();
135 // if the value overflowed report it as max int
136 _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ;
137 _interpreter_throwout_count = h_m()->interpreter_throwout_count();
138 } else {
139 _interpreter_invocation_count = 0;
140 _interpreter_throwout_count = 0;
141 }
142 if (_interpreter_invocation_count == 0)
143 _interpreter_invocation_count = 1;
144 _instructions_size = -1;
145 #ifdef ASSERT
146 if (ReplayCompiles) {
147 ciReplay::initialize(this);
148 }
149 #endif
150 }
151
1259 VM_ENTRY_MARK;
1260 {
1261 EXCEPTION_MARK;
1262 HandleMark hm(THREAD);
1263 constantPoolHandle pool (THREAD, get_Method()->constants());
1264 methodHandle spec_method;
1265 KlassHandle spec_klass;
1266 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1267 LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
1268 if (HAS_PENDING_EXCEPTION) {
1269 CLEAR_PENDING_EXCEPTION;
1270 return false;
1271 } else {
1272 return (spec_method->is_static() == is_static);
1273 }
1274 }
1275 return false;
1276 }
1277
1278 // ------------------------------------------------------------------
1279 // ciMethod::print_codes
1280 //
1281 // Print the bytecodes for this method.
1282 void ciMethod::print_codes_on(outputStream* st) {
1283 check_is_loaded();
1284 GUARDED_VM_ENTRY(get_Method()->print_codes_on(st);)
1285 }
1286
1287
1288 #define FETCH_FLAG_FROM_VM(flag_accessor) { \
1289 check_is_loaded(); \
1290 VM_ENTRY_MARK; \
1291 return get_Method()->flag_accessor(); \
1292 }
1293
1294 bool ciMethod::is_empty_method() const { FETCH_FLAG_FROM_VM(is_empty_method); }
1295 bool ciMethod::is_vanilla_constructor() const { FETCH_FLAG_FROM_VM(is_vanilla_constructor); }
1296 bool ciMethod::has_loops () const { FETCH_FLAG_FROM_VM(has_loops); }
1297 bool ciMethod::has_jsrs () const { FETCH_FLAG_FROM_VM(has_jsrs); }
1298 bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); }
|
112 } else {
113 // Have to use a conservative value in this case.
114 _can_be_statically_bound = false;
115 }
116
117 // Adjust the definition of this condition to be more useful:
118 // %%% take these conditions into account in vtable generation
119 if (!_can_be_statically_bound && h_m()->is_private())
120 _can_be_statically_bound = true;
121 if (_can_be_statically_bound && h_m()->is_abstract())
122 _can_be_statically_bound = false;
123
124 // generating _signature may allow GC and therefore move m.
125 // These fields are always filled in.
126 _name = env->get_symbol(h_m()->name());
127 _holder = env->get_instance_klass(h_m()->method_holder());
128 ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
129 constantPoolHandle cpool = h_m()->constants();
130 _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
131 _method_data = NULL;
132 _nmethod_age = h_m()->nmethod_age();
133 // Take a snapshot of these values, so they will be commensurate with the MDO.
134 if (ProfileInterpreter || TieredCompilation) {
135 int invcnt = h_m()->interpreter_invocation_count();
136 // if the value overflowed report it as max int
137 _interpreter_invocation_count = invcnt < 0 ? max_jint : invcnt ;
138 _interpreter_throwout_count = h_m()->interpreter_throwout_count();
139 } else {
140 _interpreter_invocation_count = 0;
141 _interpreter_throwout_count = 0;
142 }
143 if (_interpreter_invocation_count == 0)
144 _interpreter_invocation_count = 1;
145 _instructions_size = -1;
146 #ifdef ASSERT
147 if (ReplayCompiles) {
148 ciReplay::initialize(this);
149 }
150 #endif
151 }
152
1260 VM_ENTRY_MARK;
1261 {
1262 EXCEPTION_MARK;
1263 HandleMark hm(THREAD);
1264 constantPoolHandle pool (THREAD, get_Method()->constants());
1265 methodHandle spec_method;
1266 KlassHandle spec_klass;
1267 Bytecodes::Code code = (is_static ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual);
1268 LinkResolver::resolve_method_statically(spec_method, spec_klass, code, pool, refinfo_index, THREAD);
1269 if (HAS_PENDING_EXCEPTION) {
1270 CLEAR_PENDING_EXCEPTION;
1271 return false;
1272 } else {
1273 return (spec_method->is_static() == is_static);
1274 }
1275 }
1276 return false;
1277 }
1278
1279 // ------------------------------------------------------------------
1280 // ciMethod::profile_aging
1281 //
1282 // Should the method be compiled with an age counter?
1283 bool ciMethod::profile_aging() const {
1284 return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
1285 !MethodCounters::is_nmethod_age_unset(nmethod_age()));
1286 }
1287 // ------------------------------------------------------------------
1288 // ciMethod::print_codes
1289 //
1290 // Print the bytecodes for this method.
1291 void ciMethod::print_codes_on(outputStream* st) {
1292 check_is_loaded();
1293 GUARDED_VM_ENTRY(get_Method()->print_codes_on(st);)
1294 }
1295
1296
1297 #define FETCH_FLAG_FROM_VM(flag_accessor) { \
1298 check_is_loaded(); \
1299 VM_ENTRY_MARK; \
1300 return get_Method()->flag_accessor(); \
1301 }
1302
1303 bool ciMethod::is_empty_method() const { FETCH_FLAG_FROM_VM(is_empty_method); }
1304 bool ciMethod::is_vanilla_constructor() const { FETCH_FLAG_FROM_VM(is_vanilla_constructor); }
1305 bool ciMethod::has_loops () const { FETCH_FLAG_FROM_VM(has_loops); }
1306 bool ciMethod::has_jsrs () const { FETCH_FLAG_FROM_VM(has_jsrs); }
1307 bool ciMethod::is_accessor () const { FETCH_FLAG_FROM_VM(is_accessor); }
|