本文整理汇总了C++中methodOop::is_native方法的典型用法代码示例。如果您正苦于以下问题:C++ methodOop::is_native方法的具体用法?C++ methodOop::is_native怎么用?C++ methodOop::is_native使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类methodOop
的用法示例。
在下文中一共展示了methodOop::is_native方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: native_entry
int CppInterpreter::native_entry(methodOop method, intptr_t UNUSED, TRAPS) {
// Make sure method is native and not abstract
assert(method->is_native() && !method->is_abstract(), "should be");
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
// Allocate and initialize our frame
InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
thread->push_zero_frame(frame);
interpreterState istate = frame->interpreter_state();
intptr_t *locals = istate->locals();
// Update the invocation counter
if ((UseCompiler || CountCompiledCalls) && !method->is_synchronized()) {
InvocationCounter *counter = method->invocation_counter();
counter->increment();
if (counter->reached_InvocationLimit()) {
CALL_VM_NOCHECK(
InterpreterRuntime::frequency_counter_overflow(thread, NULL));
if (HAS_PENDING_EXCEPTION)
goto unwind_and_return;
}
}
// Lock if necessary
BasicObjectLock *monitor;
monitor = NULL;
if (method->is_synchronized()) {
monitor = (BasicObjectLock*) istate->stack_base();
oop lockee = monitor->obj();
markOop disp = lockee->mark()->set_unlocked();
monitor->lock()->set_displaced_header(disp);
if (Atomic::cmpxchg_ptr(monitor, lockee->mark_addr(), disp) != disp) {
if (thread->is_lock_owned((address) disp->clear_lock_bits())) {
monitor->lock()->set_displaced_header(NULL);
}
else {
CALL_VM_NOCHECK(InterpreterRuntime::monitorenter(thread, monitor));
if (HAS_PENDING_EXCEPTION)
goto unwind_and_return;
}
}
}
// Get the signature handler
InterpreterRuntime::SignatureHandler *handler; {
address handlerAddr = method->signature_handler();
if (handlerAddr == NULL) {
CALL_VM_NOCHECK(InterpreterRuntime::prepare_native_call(thread, method));
if (HAS_PENDING_EXCEPTION)
goto unlock_unwind_and_return;
handlerAddr = method->signature_handler();
assert(handlerAddr != NULL, "eh?");
}
if (handlerAddr == (address) InterpreterRuntime::slow_signature_handler) {
CALL_VM_NOCHECK(handlerAddr =
InterpreterRuntime::slow_signature_handler(thread, method, NULL,NULL));
if (HAS_PENDING_EXCEPTION)
goto unlock_unwind_and_return;
}
handler = \
InterpreterRuntime::SignatureHandler::from_handlerAddr(handlerAddr);
}
// Get the native function entry point
address function;
function = method->native_function();
assert(function != NULL, "should be set if signature handler is");
// Build the argument list
stack->overflow_check(handler->argument_count() * 2, THREAD);
if (HAS_PENDING_EXCEPTION)
goto unlock_unwind_and_return;
void **arguments;
void *mirror; {
arguments =
(void **) stack->alloc(handler->argument_count() * sizeof(void **));
void **dst = arguments;
void *env = thread->jni_environment();
*(dst++) = &env;
if (method->is_static()) {
istate->set_oop_temp(
method->constants()->pool_holder()->java_mirror());
mirror = istate->oop_temp_addr();
*(dst++) = &mirror;
}
intptr_t *src = locals;
for (int i = dst - arguments; i < handler->argument_count(); i++) {
ffi_type *type = handler->argument_type(i);
if (type == &ffi_type_pointer) {
if (*src) {
stack->push((intptr_t) src);
*(dst++) = stack->sp();
//.........这里部分代码省略.........
示例2: print_xml_on
void vframe::print_xml_on(JavaThread *thread, xmlBuffer *xb) const {
ResourceMark rm;
frame fr = get_frame();
const char *frame_style = "UNKNOWN";
CodeBlob*cb=CodeCache::find_blob(fr.pc());
if( fr.is_interpreted_frame() )
frame_style = "INTERPRETER";
else if( cb && cb->is_native_method() )
frame_style = "NATIVE";
else if( cb && cb->is_c1_method() )
frame_style = "COMPILER1";
else if( cb && cb->is_c2_method() )
frame_style = "COMPILER2";
// Frame header
xb->name_value_item("frame_style",frame_style);
// Java Locals
if (!fr.is_java_frame())
return; // no more printing to be done
const methodOop moop = method();
if (moop->is_native())
return; // no more printing to be done
const int max_locals = moop->max_locals();
if(fr.is_compiled_frame()){
for( int i=0; i<max_locals; i++ ) {
xmlElement je(xb, "java_element");
{ xmlElement n(xb, "name", xmlElement::delayed_LF);
bool out_of_scope = true;
const char* name = moop->localvariable_name(i, bci(), out_of_scope);
if( name ) xb->print("%s%s%s", out_of_scope ? "{": "", name, out_of_scope ? "}": "");
else xb->print("JL%-2d", i);
}
DebugScopeValue::Name vreg = _ds->get_local(i);
if( !DebugScopeValue::is_valid(vreg) ) {
xb->name_value_item("type","invalid");
xb->name_ptr_item("value",0);
} else {
intptr_t *data_ptr = fr.reg_to_addr(DebugScopeValue::to_vreg(vreg));
const int rel_pc = cb->rel_pc(fr.pc());
const bool isoop = cb->oop_maps()->is_oop( rel_pc, VReg::as_VOopReg(DebugScopeValue::to_vreg(vreg)) );
if( isoop ) {
xb->name_value_item("type", "oop");
oop o = ((objectRef*)data_ptr)->as_oop();
o->print_xml_on(xb, true);
} else {
xb->name_value_item("type", "normal");
xb->name_ptr_item("value", (void*)*data_ptr);
}
}
}
}else if(fr.is_interpreted_frame()){
for( int i = 0; i < max_locals; i++ ) {
frame::InterpreterStackSlotType tag = fr.tag_at_address(fr.interpreter_frame_local_addr(i));
if (tag == frame::double_slot_primitive_type)
i++;//skip the tag slot
xmlElement je(xb, "java_element");
{ xmlElement n(xb, "name", xmlElement::delayed_LF);
bool out_of_scope = true;
const char* name = moop->localvariable_name(i, bci(), out_of_scope);
if (name != NULL) {
xb->print("%s%s%s", out_of_scope ? "{": "", name, out_of_scope ? "}": "");
} else {
xb->print("JL%-2d", i);
}
}
intptr_t local_value = fr.interpreter_frame_local_at(i);
switch (tag) {
case frame::single_slot_primitive_type: {
xb->name_value_item("type", "single_slot_primitive_type");
xb->name_ptr_item("value", (void*)local_value);
break;
}
case frame::double_slot_primitive_type: {
xb->name_value_item("type", "double_slot_primitive_type");
xb->name_ptr_item("value", (void*)local_value);
break;
}
case frame::single_slot_ref_type: {
xb->name_value_item("type", "oop");
oop o = objectRef((uint64_t)local_value).as_oop();
o->print_xml_on(xb, true);
break;
}
default: ShouldNotReachHere(); break;
}
}
}
}