void Runtime1::generate_blob_for(StubID id) { assert(0 <= id && id < number_of_ids, "illegal stub id"); ResourceMark rm; // create code buffer for code storage CodeBuffer code(get_buffer_blob()->instructions_begin(), get_buffer_blob()->instructions_size()); setup_code_buffer(&code, 0); // create assembler for code generation StubAssembler* sasm = new StubAssembler(&code, name_for(id), id); // generate code for runtime stub OopMapSet* oop_maps; oop_maps = generate_code_for(id, sasm); assert(oop_maps == NULL || sasm->frame_size() != no_frame_size, "if stub has an oop map it must have a valid frame size"); #ifdef ASSERT // Make sure that stubs that need oopmaps have them switch (id) { // These stubs don't need to have an oopmap case dtrace_object_alloc_id: case g1_pre_barrier_slow_id: case g1_post_barrier_slow_id: case slow_subtype_check_id: case fpu2long_stub_id: case unwind_exception_id: #ifndef TIERED case counter_overflow_id: // Not generated outside the tiered world #endif #ifdef SPARC case handle_exception_nofpu_id: // Unused on sparc #endif break; // All other stubs should have oopmaps default: assert(oop_maps != NULL, "must have an oopmap"); } #endif // align so printing shows nop's instead of random code at the end (SimpleStubs are aligned) sasm->align(BytesPerWord); // make sure all code is in code buffer sasm->flush(); // create blob - distinguish a few special cases CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id), &code, CodeOffsets::frame_never_safe, sasm->frame_size(), oop_maps, sasm->must_gc_arguments()); // install blob assert(blob != NULL, "blob must exist"); _blobs[id] = blob; }
void BytecodePairHistogram::print(float cutoff) { ResourceMark rm; GrowableArray<HistoEntry*>* profile = sorted_array(_counters, number_of_pairs); // print profile int tot = total_count(profile); int abs_sum = 0; tty->cr(); //0123456789012345678901234567890123456789012345678901234567890123456789 tty->print_cr("Histogram of %d executed bytecode pairs:", tot); tty->cr(); tty->print_cr(" absolute relative codes 1st bytecode 2nd bytecode"); tty->print_cr("----------------------------------------------------------------------"); int i = profile->length(); while (i-- > 0) { HistoEntry* e = profile->at(i); int abs = e->count(); float rel = abs * 100.0F / tot; if (cutoff <= rel) { int c1 = e->index() % number_of_codes; int c2 = e->index() / number_of_codes; tty->print_cr("%10d %6.3f%% %02x %02x %-19s %s", abs, rel, c1, c2, name_for(c1), name_for(c2)); abs_sum += abs; } } tty->print_cr("----------------------------------------------------------------------"); float rel_sum = abs_sum * 100.0F / tot; tty->print_cr("%10d %6.3f%% (cutoff = %.3f%%)", abs_sum, rel_sum, cutoff); tty->cr(); }
void BytecodeHistogram::print(float cutoff) { ResourceMark rm; GrowableArray<HistoEntry*>* profile = sorted_array(_counters, Bytecodes::number_of_codes); // print profile int tot = total_count(profile); int abs_sum = 0; tty->cr(); //0123456789012345678901234567890123456789012345678901234567890123456789 tty->print_cr("Histogram of %d executed bytecodes:", tot); tty->cr(); tty->print_cr(" absolute relative code name"); tty->print_cr("----------------------------------------------------------------------"); int i = profile->length(); while (i-- > 0) { HistoEntry* e = profile->at(i); int abs = e->count(); float rel = abs * 100.0F / tot; if (cutoff <= rel) { tty->print_cr("%10d %7.2f%% %02x %s", abs, rel, e->index(), name_for(e->index())); abs_sum += abs; } } tty->print_cr("----------------------------------------------------------------------"); float rel_sum = abs_sum * 100.0F / tot; tty->print_cr("%10d %7.2f%% (cutoff = %.2f%%)", abs_sum, rel_sum, cutoff); tty->cr(); }
methodOop vmIntrinsics::method_for(vmIntrinsics::ID id) { if (id == _none) return NULL; Symbol* cname = vmSymbols::symbol_at(class_for(id)); Symbol* mname = vmSymbols::symbol_at(name_for(id)); Symbol* msig = vmSymbols::symbol_at(signature_for(id)); if (cname == NULL || mname == NULL || msig == NULL) return NULL; klassOop k = SystemDictionary::find_well_known_klass(cname); if (k == NULL) return NULL; return instanceKlass::cast(k)->find_method(mname, msig); }
void ConstantTag::print_definitions() { for (jubyte i=0; i<CONSTANT_POOL_TAG_LIMIT; i++) { tty->print("%-49s = %2d, 0x", name_for(i, true), i); if (i < 0x10) { tty->print("0"); } tty->print_cr("%x", i); if (i == JVM_CONSTANT_NameAndType) { tty->cr(); } } }
void set_name(customer_info::identifier const& id, std::string const& name) { boost::contract::check c = boost::contract::public_function(this) .precondition([&] { BOOST_CONTRACT_ASSERT(id_active(id)); // Already active. }) .postcondition([&] { BOOST_CONTRACT_ASSERT(name_for(id) == name); // Name set. }) ; // Find != end because of precondition (no defensive programming). customers_.find(id)->second.name_ = name; }
const char* Runtime1::name_for_address(address entry) { for (int id = 0; id < number_of_ids; id++) { if (entry == entry_for((StubID)id)) return name_for((StubID)id); } #define FUNCTION_CASE(a, f) \ if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f FUNCTION_CASE(entry, os::javaTimeMillis); FUNCTION_CASE(entry, os::javaTimeNanos); FUNCTION_CASE(entry, SharedRuntime::OSR_migration_end); FUNCTION_CASE(entry, SharedRuntime::d2f); FUNCTION_CASE(entry, SharedRuntime::d2i); FUNCTION_CASE(entry, SharedRuntime::d2l); FUNCTION_CASE(entry, SharedRuntime::dcos); FUNCTION_CASE(entry, SharedRuntime::dexp); FUNCTION_CASE(entry, SharedRuntime::dlog); FUNCTION_CASE(entry, SharedRuntime::dlog10); FUNCTION_CASE(entry, SharedRuntime::dpow); FUNCTION_CASE(entry, SharedRuntime::drem); FUNCTION_CASE(entry, SharedRuntime::dsin); FUNCTION_CASE(entry, SharedRuntime::dtan); FUNCTION_CASE(entry, SharedRuntime::f2i); FUNCTION_CASE(entry, SharedRuntime::f2l); FUNCTION_CASE(entry, SharedRuntime::frem); FUNCTION_CASE(entry, SharedRuntime::l2d); FUNCTION_CASE(entry, SharedRuntime::l2f); FUNCTION_CASE(entry, SharedRuntime::ldiv); FUNCTION_CASE(entry, SharedRuntime::lmul); FUNCTION_CASE(entry, SharedRuntime::lrem); FUNCTION_CASE(entry, SharedRuntime::lrem); FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry); FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit); FUNCTION_CASE(entry, trace_block_entry); #undef FUNCTION_CASE // Soft float adds more runtime names. return pd_name_for_address(entry); }
const char* vmIntrinsics::short_name_as_C_string(vmIntrinsics::ID id, char* buf, int buflen) { const char* str = name_at(id); #ifndef PRODUCT const char* kname = vmSymbols::name_for(class_for(id)); const char* mname = vmSymbols::name_for(name_for(id)); const char* sname = vmSymbols::name_for(signature_for(id)); const char* fname = ""; switch (flags_for(id)) { case F_Y: fname = "synchronized "; break; case F_RN: fname = "native "; break; case F_SN: fname = "native static "; break; case F_S: fname = "static "; break; case F_RNY:fname = "native synchronized "; break; } const char* kptr = strrchr(kname, '/'); if (kptr != NULL) kname = kptr + 1; int len = jio_snprintf(buf, buflen, "%s: %s%s.%s%s", str, fname, kname, mname, sname); if (len < buflen) str = buf; #endif //PRODUCT return str; }