< prev index next >

src/share/vm/code/nmethod.cpp

Print this page




2344 // called with a frame corresponding to a Java invoke
2345 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
2346 #ifndef SHARK
2347   if (method() != NULL && !method()->is_native()) {
2348     address pc = fr.pc();
2349     SimpleScopeDesc ssd(this, pc);
2350     Bytecode_invoke call(ssd.method(), ssd.bci());
2351     bool has_receiver = call.has_receiver();
2352     bool has_appendix = call.has_appendix();
2353     Symbol* signature = call.signature();
2354 
2355     // The method attached by JIT-compilers should be used, if present.
2356     // Bytecode can be inaccurate in such case.
2357     Method* callee = attached_method_before_pc(pc);
2358     if (callee != NULL) {
2359       has_receiver = !(callee->access_flags().is_static());
2360       has_appendix = false;
2361       signature = callee->signature();
2362     }
2363 


























2364     fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
2365   }
2366 #endif // !SHARK
2367 }
2368 
2369 inline bool includes(void* p, void* from, void* to) {
2370   return from <= p && p < to;
2371 }
2372 
2373 
2374 void nmethod::copy_scopes_pcs(PcDesc* pcs, int count) {
2375   assert(count >= 2, "must be sentinel values, at least");
2376 
2377 #ifdef ASSERT
2378   // must be sorted and unique; we do a binary search in find_pc_desc()
2379   int prev_offset = pcs[0].pc_offset();
2380   assert(prev_offset == PcDesc::lower_offset_limit,
2381          "must start with a sentinel");
2382   for (int i = 1; i < count; i++) {
2383     int this_offset = pcs[i].pc_offset();




2344 // called with a frame corresponding to a Java invoke
2345 void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
2346 #ifndef SHARK
2347   if (method() != NULL && !method()->is_native()) {
2348     address pc = fr.pc();
2349     SimpleScopeDesc ssd(this, pc);
2350     Bytecode_invoke call(ssd.method(), ssd.bci());
2351     bool has_receiver = call.has_receiver();
2352     bool has_appendix = call.has_appendix();
2353     Symbol* signature = call.signature();
2354 
2355     // The method attached by JIT-compilers should be used, if present.
2356     // Bytecode can be inaccurate in such case.
2357     Method* callee = attached_method_before_pc(pc);
2358     if (callee != NULL) {
2359       has_receiver = !(callee->access_flags().is_static());
2360       has_appendix = false;
2361       signature = callee->signature();
2362     }
2363 
2364     // If value types are passed as fields, use the extended signature
2365     // which contains the types of all (oop) fields of the value type.
2366     if (ValueTypePassFieldsAsArgs) {
2367       // Check if callee signature contains a value type argument
2368       // TODO if invokedirect is going to be removed we need another way to figure out that the receiver is a value type
2369       bool has_value_argument = call.is_invokedirect();
2370       const int len = signature->utf8_length();
2371       for (int i = 0; i < len && !has_value_argument; ++i) {
2372         if (signature->byte_at(i) == 'Q') {
2373           has_value_argument = true;
2374         }
2375       }
2376       if (has_value_argument) {
2377         // Get the extended signature from the callee's adapter
2378         // TODO what about methods that do not have an adapter (for example, abstract methods)?
2379         Thread* THREAD = Thread::current();
2380         methodHandle dest_method = call.static_target(THREAD);
2381         assert(!HAS_PENDING_EXCEPTION, "should not have pending exception");
2382         callee = dest_method();
2383         assert(callee != NULL, "failed to resolve callee");
2384         signature = callee->adapter()->get_sig_extended();
2385         assert(signature != NULL, "signature is null");
2386         has_receiver = false; // The signature contains the receiver type
2387       }
2388     }
2389 
2390     fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
2391   }
2392 #endif // !SHARK
2393 }
2394 
2395 inline bool includes(void* p, void* from, void* to) {
2396   return from <= p && p < to;
2397 }
2398 
2399 
2400 void nmethod::copy_scopes_pcs(PcDesc* pcs, int count) {
2401   assert(count >= 2, "must be sentinel values, at least");
2402 
2403 #ifdef ASSERT
2404   // must be sorted and unique; we do a binary search in find_pc_desc()
2405   int prev_offset = pcs[0].pc_offset();
2406   assert(prev_offset == PcDesc::lower_offset_limit,
2407          "must start with a sentinel");
2408   for (int i = 1; i < count; i++) {
2409     int this_offset = pcs[i].pc_offset();


< prev index next >