本文整理汇总了C++中CodeBlob::is_nmethod方法的典型用法代码示例。如果您正苦于以下问题:C++ CodeBlob::is_nmethod方法的具体用法?C++ CodeBlob::is_nmethod怎么用?C++ CodeBlob::is_nmethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeBlob
的用法示例。
在下文中一共展示了CodeBlob::is_nmethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: is_call_to_compiled
bool CompiledIC::is_call_to_compiled() const {
assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
// Use unsafe, since an inline cache might point to a zombie method. However, the zombie
// method is guaranteed to still exist, since we only remove methods after all inline caches
// has been cleaned up
CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
bool is_monomorphic = (cb != NULL && cb->is_nmethod());
// Check that the cached_oop is a klass for non-optimized monomorphic calls
// This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used
// for calling directly to vep without using the inline cache (i.e., cached_oop == NULL)
#ifdef ASSERT
#ifdef TIERED
CodeBlob* caller = CodeCache::find_blob_unsafe(instruction_address());
bool is_c1_method = caller->is_compiled_by_c1();
#else
#ifdef COMPILER1
bool is_c1_method = true;
#else
bool is_c1_method = false;
#endif // COMPILER1
#endif // TIERED
assert( is_c1_method ||
!is_monomorphic ||
is_optimized() ||
(cached_oop() != NULL && cached_oop()->is_klass()), "sanity check");
#endif // ASSERT
return is_monomorphic;
}
示例2: new_vframe
vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) {
// Interpreter frame
if (f->is_interpreted_frame()) {
return new interpretedVFrame(f, reg_map, thread);
}
#ifndef CORE
// Compiled frame
CodeBlob* cb = CodeCache::find_blob(f->pc());
if (cb != NULL) {
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
// Compiled method (native stub or Java code)
ScopeDesc* scope = nm->scope_desc_at(f->pc(), reg_map->is_pc_at_call(f->id()));
return new compiledVFrame(f, reg_map, thread, scope);
}
if (f->is_glue_frame()) {
// This is a conversion frame. Skip this frame and try again.
RegisterMap temp_map = *reg_map;
frame s = f->sender(&temp_map);
return new_vframe(&s, &temp_map, thread);
}
}
// Deoptimized frame
if (f->is_deoptimized_frame()) {
return new deoptimizedVFrame(f, reg_map, thread);
}
#endif
// External frame
return new externalVFrame(f, reg_map, thread);
}
示例3: new_vframe
vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThread* thread) {
// Interpreter frame
if (f->is_interpreted_frame()) {
return new interpretedVFrame(f, reg_map, thread);
}
// Compiled frame
CodeBlob* cb = f->cb();
if (cb != NULL) {
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
return new compiledVFrame(f, reg_map, thread, nm);
}
if (f->is_runtime_frame()) {
// Skip this frame and try again.
RegisterMap temp_map = *reg_map;
frame s = f->sender(&temp_map);
return new_vframe(&s, &temp_map, thread);
}
}
// External frame
return new externalVFrame(f, reg_map, thread);
}
示例4: first_nmethod
nmethod* CodeCache::first_nmethod() {
assert_locked_or_safepoint(CodeCache_lock);
CodeBlob* cb = first();
while (cb != NULL && !cb->is_nmethod()) {
cb = next(cb);
}
return (nmethod*)cb;
}
示例5: c
extern "C" void printnm(intptr_t p) {
char buffer[256];
sprintf(buffer, "printnm: " INTPTR_FORMAT, p);
Command c(buffer);
CodeBlob* cb = CodeCache::find_blob((address) p);
if (cb->is_nmethod()) {
nmethod* nm = (nmethod*)cb;
nm->print_nmethod(true);
}
}
示例6: internal_set_ic_destination
void CompiledIC::internal_set_ic_destination(address entry_point, bool is_icstub, void* cache, bool is_icholder) {
assert(entry_point != NULL, "must set legal entry point");
assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
assert (!is_optimized() || cache == NULL, "an optimized virtual call does not have a cached metadata");
assert (cache == NULL || cache != (Metadata*)badOopVal, "invalid metadata");
assert(!is_icholder || is_icholder_entry(entry_point), "must be");
// Don't use ic_destination for this test since that forwards
// through ICBuffer instead of returning the actual current state of
// the CompiledIC.
if (is_icholder_entry(_ic_call->destination())) {
// When patching for the ICStub case the cached value isn't
// overwritten until the ICStub copied into the CompiledIC during
// the next safepoint. Make sure that the CompiledICHolder* is
// marked for release at this point since it won't be identifiable
// once the entry point is overwritten.
InlineCacheBuffer::queue_for_release((CompiledICHolder*)_value->data());
}
if (TraceCompiledIC) {
tty->print(" ");
print_compiled_ic();
tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
if (!is_optimized()) {
tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
}
if (is_icstub) {
tty->print(" (icstub)");
}
tty->cr();
}
{
MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
#ifdef ASSERT
CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
#endif
_ic_call->set_destination_mt_safe(entry_point);
}
if (is_optimized() || is_icstub) {
// Optimized call sites don't have a cache value and ICStub call
// sites only change the entry point. Changing the value in that
// case could lead to MT safety issues.
assert(cache == NULL, "must be null");
return;
}
if (cache == NULL) cache = (void*)Universe::non_oop_word();
_value->set_data((intptr_t)cache);
}
示例7: checkByteBuffer
inline static bool checkByteBuffer(address pc, address* stub) {
// BugId 4454115: A read from a MappedByteBuffer can fault
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
nmethod* nm = cb->is_nmethod() ? (nmethod*)cb : NULL;
if (nm != NULL && nm->has_unsafe_access()) {
*stub = StubRoutines::handler_for_unsafe_access();
return true;
}
return false;
}
示例8: fill_from_frame
bool vframeStream::fill_from_frame() {
// Interpreted frame
if (_frame.is_interpreted_frame()) {
fill_from_interpreter_frame();
return true;
}
// Compiled frame
#ifndef CORE
CodeBlob* code = CodeCache::find_blob(_frame.pc());
if (code != NULL && code->is_nmethod()) {
nmethod* nm = (nmethod*)code;
if (nm->is_native_method()) {
// Do not rely on scopeDesc since the pc might be unprecise due to the _last_native_pc trick.
fill_from_compiled_native_frame(nm);
} else {
bool at_call = _reg_map.is_pc_at_call(_frame.id());
PcDesc* pc_desc = nm->pc_desc_at(_frame.pc(), at_call);
#ifdef ASSERT
if (pc_desc == NULL) {
tty->print_cr("Error in fill_from_frame: pc_desc for " INTPTR_FORMAT " not found", _frame.pc());
nm->print();
nm->method()->print_codes();
nm->print_code();
nm->print_pcs();
}
#endif
assert(pc_desc != NULL, "scopeDesc must exist");
fill_from_compiled_frame(nm, pc_desc->scope_decode_offset());
}
return true;
}
#endif
// End of stack?
if (_frame.is_first_frame() || (_stop_at_java_call_stub && _frame.is_entry_frame())) {
_mode = at_end_mode;
return true;
}
// Deoptimized frame
#ifndef CORE
if (_frame.is_deoptimized_frame()) {
fill_from_deoptimized_frame(_thread->vframe_array_for(&_frame), vframeArray::first_index());
return true;
}
#endif
return false;
}
示例9: set_to_clean
void CompiledStaticCall::set_to_clean() {
assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
// Reset call site
MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
#ifdef ASSERT
CodeBlob* cb = CodeCache::find_blob_unsafe(this);
assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
#endif
set_destination_mt_safe(SharedRuntime::get_resolve_static_call_stub());
// Do not reset stub here: It is too expensive to call find_stub.
// Instead, rely on caller (nmethod::clear_inline_caches) to clear
// both the call and its stub.
}
示例10: set_ic_destination
void CompiledIC::set_ic_destination(address entry_point) {
assert(entry_point != NULL, "must set legal entry point");
assert(CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
if (TraceCompiledIC) {
tty->print(" ");
print_compiled_ic();
tty->print_cr(" changing destination to " INTPTR_FORMAT, entry_point);
}
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
#ifdef ASSERT
CodeBlob* cb = CodeCache::find_blob_unsafe(_ic_call);
assert(cb != NULL && cb->is_nmethod(), "must be nmethod");
#endif
_ic_call->set_destination_mt_safe(entry_point);
}
示例11: pd_ps
void pd_ps(frame f) {
intptr_t* sp = f.sp();
intptr_t* prev_sp = sp - 1;
intptr_t *pc = NULL;
intptr_t *next_pc = NULL;
int count = 0;
tty->print("register window backtrace from %#x:\n", sp);
while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
pc = next_pc;
next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
tty->print("[%d] sp=%#x pc=", count, sp);
findpc((intptr_t)pc);
if (WizardMode && Verbose) {
// print register window contents also
tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
sp[0+0],sp[0+1],sp[0+2],sp[0+3],
sp[0+4],sp[0+5],sp[0+6],sp[0+7]);
tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
sp[8+0],sp[8+1],sp[8+2],sp[8+3],
sp[8+4],sp[8+5],sp[8+6],sp[8+7]);
// (and print stack frame contents too??)
CodeBlob *b = CodeCache::find_blob((address) pc);
if (b != NULL) {
if (b->is_nmethod()) {
methodOop m = ((nmethod*)b)->method();
int nlocals = m->max_locals();
int nparams = m->size_of_parameters();
tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);
}
}
}
prev_sp = sp;
sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];
sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);
count += 1;
}
if (sp != NULL)
tty->print("[%d] sp=%#x [bogus sp!]", count, sp);
}
示例12: is_call_to_compiled
bool CompiledIC::is_call_to_compiled() const {
assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "");
// Use unsafe, since an inline cache might point to a zombie method. However, the zombie
// method is guaranteed to still exist, since we only remove methods after all inline caches
// has been cleaned up
CodeBlob* cb = CodeCache::find_blob_unsafe(ic_destination());
bool is_monomorphic = (cb != NULL && cb->is_nmethod());
// Check that the cached_value is a klass for non-optimized monomorphic calls
// This assertion is invalid for compiler1: a call that does not look optimized (no static stub) can be used
// for calling directly to vep without using the inline cache (i.e., cached_value == NULL).
// For JVMCI this occurs because CHA is only used to improve inlining so call sites which could be optimized
// virtuals because there are no currently loaded subclasses of a type are left as virtual call sites.
#ifdef ASSERT
CodeBlob* caller = CodeCache::find_blob_unsafe(instruction_address());
bool is_c1_or_jvmci_method = caller->is_compiled_by_c1() || caller->is_compiled_by_jvmci();
assert( is_c1_or_jvmci_method ||
!is_monomorphic ||
is_optimized() ||
!caller->is_alive() ||
(cached_metadata() != NULL && cached_metadata()->is_klass()), "sanity check");
#endif // ASSERT
return is_monomorphic;
}
示例13: find
static void find(intptr_t x, bool print_pc) {
address addr = (address)x;
CodeBlob* b = CodeCache::find_blob_unsafe(addr);
if (b != NULL) {
if (b->is_buffer_blob()) {
// the interpreter is generated into a buffer blob
InterpreterCodelet* i = Interpreter::codelet_containing(addr);
if (i != NULL) {
i->print();
return;
}
if (Interpreter::contains(addr)) {
tty->print_cr(INTPTR_FORMAT " is pointing into interpreter code (not bytecode specific)", addr);
return;
}
//
if (AdapterHandlerLibrary::contains(b)) {
AdapterHandlerLibrary::print_handler(b);
}
// the stubroutines are generated into a buffer blob
StubCodeDesc* d = StubCodeDesc::desc_for(addr);
if (d != NULL) {
d->print();
if (print_pc) tty->cr();
return;
}
if (StubRoutines::contains(addr)) {
tty->print_cr(INTPTR_FORMAT " is pointing to an (unnamed) stub routine", addr);
return;
}
// the InlineCacheBuffer is using stubs generated into a buffer blob
if (InlineCacheBuffer::contains(addr)) {
tty->print_cr(INTPTR_FORMAT " is pointing into InlineCacheBuffer", addr);
return;
}
VtableStub* v = VtableStubs::stub_containing(addr);
if (v != NULL) {
v->print();
return;
}
}
if (print_pc && b->is_nmethod()) {
ResourceMark rm;
tty->print("%#p: Compiled ", addr);
((nmethod*)b)->method()->print_value_on(tty);
tty->print(" = (CodeBlob*)" INTPTR_FORMAT, b);
tty->cr();
return;
}
if ( b->is_nmethod()) {
if (b->is_zombie()) {
tty->print_cr(INTPTR_FORMAT " is zombie nmethod", b);
} else if (b->is_not_entrant()) {
tty->print_cr(INTPTR_FORMAT " is non-entrant nmethod", b);
}
}
b->print();
return;
}
if (Universe::heap()->is_in(addr)) {
HeapWord* p = Universe::heap()->block_start(addr);
bool print = false;
// If we couldn't find it it just may mean that heap wasn't parseable
// See if we were just given an oop directly
if (p != NULL && Universe::heap()->block_is_obj(p)) {
print = true;
} else if (p == NULL && ((oopDesc*)addr)->is_oop()) {
p = (HeapWord*) addr;
print = true;
}
if (print) {
oop(p)->print();
if (p != (HeapWord*)x && oop(p)->is_constMethod() &&
constMethodOop(p)->contains(addr)) {
Thread *thread = Thread::current();
HandleMark hm(thread);
methodHandle mh (thread, constMethodOop(p)->method());
if (!mh->is_native()) {
tty->print_cr("bci_from(%p) = %d; print_codes():",
addr, mh->bci_from(address(x)));
mh->print_codes();
}
}
return;
}
} else if (Universe::heap()->is_in_reserved(addr)) {
tty->print_cr(INTPTR_FORMAT " is an unallocated location in the heap", addr);
return;
}
if (JNIHandles::is_global_handle((jobject) addr)) {
tty->print_cr(INTPTR_FORMAT " is a global jni handle", addr);
return;
}
if (JNIHandles::is_weak_global_handle((jobject) addr)) {
tty->print_cr(INTPTR_FORMAT " is a weak global jni handle", addr);
return;
}
//.........这里部分代码省略.........
示例14: pd_ps
void pd_ps(frame f) {
intptr_t* sp = f.sp();
intptr_t* prev_sp = sp - 1;
intptr_t *pc = NULL;
intptr_t *next_pc = NULL;
int count = 0;
tty->print("register window backtrace from %#x:\n", sp);
while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
pc = next_pc;
next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
tty->print("[%d] sp=%#x pc=", count, sp);
findpc((intptr_t)pc);
if (WizardMode && Verbose) {
// print register window contents also
tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
sp[0+0],sp[0+1],sp[0+2],sp[0+3],
sp[0+4],sp[0+5],sp[0+6],sp[0+7]);
tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
sp[8+0],sp[8+1],sp[8+2],sp[8+3],
sp[8+4],sp[8+5],sp[8+6],sp[8+7]);
// (and print stack frame contents too??)
#ifndef CORE
CodeBlob *b = CodeCache::find_blob((address) pc);
if (b != NULL) {
if (b->is_nmethod()) {
#ifdef COMPILER1
methodOop m = ((nmethod*)b)->method();
int nlocals = m->max_locals();
int nparams = m->size_of_parameters();
tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);
jint *fp = (jint *)sp[FP->sp_offset_in_saved_window()];
// print params
tty->print_cr("params:");
for (int p=nparams-1; p>=0; p--) {
tty->print_cr(" %8x:[fp+%3d]: %#x",fp+23+p,23+p,*(fp+23+p));
}
// print locals
tty->print_cr("locals:",nlocals);
for (int l=0; l<nlocals; l++) {
tty->print_cr(" %8x:[fp-%3d]: %#x",fp-(l+1),l+1,*(fp-(l+1)));
}
// print oops???
// print monitors???
// print spills???
#endif
} else if (b->is_java_method()) {
tty->print_cr("interpreted java method");
} else if (b->is_native_method()) {
tty->print_cr("native method");
} else if (b->is_osr_method()) {
tty->print_cr("osr method");
}
}
#endif // NOT CORE
}
prev_sp = sp;
sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];
sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);
count += 1;
}
if (sp != NULL)
tty->print("[%d] sp=%#x [bogus sp!]", count, sp);
}
示例15: find_nmethod
nmethod* CodeCache::find_nmethod(void* start) {
CodeBlob *cb = find_blob(start);
assert(cb == NULL || cb->is_nmethod(), "did not find an nmethod");
return (nmethod*)cb;
}