本文整理汇总了C++中ZeroStack::push方法的典型用法代码示例。如果您正苦于以下问题:C++ ZeroStack::push方法的具体用法?C++ ZeroStack::push怎么用?C++ ZeroStack::push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZeroStack
的用法示例。
在下文中一共展示了ZeroStack::push方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
EntryFrame *EntryFrame::build(const intptr_t* parameters,
int parameter_words,
JavaCallWrapper* call_wrapper,
TRAPS) {
ZeroStack *stack = ((JavaThread *) THREAD)->zero_stack();
stack->overflow_check(header_words + parameter_words, CHECK_NULL);
stack->push(0); // next_frame, filled in later
intptr_t *fp = stack->sp();
assert(fp - stack->sp() == next_frame_off, "should be");
stack->push(ENTRY_FRAME);
assert(fp - stack->sp() == frame_type_off, "should be");
stack->push((intptr_t) call_wrapper);
assert(fp - stack->sp() == call_wrapper_off, "should be");
for (int i = 0; i < parameter_words; i++)
stack->push(parameters[i]);
return (EntryFrame *) fp;
}
示例2: main_loop
//.........这里部分代码省略.........
while (true) {
// We can set up the frame anchor with everything we want at
// this point as we are thread_in_Java and no safepoints can
// occur until we go to vm mode. We do have to clear flags
// on return from vm but that is it.
thread->set_last_Java_frame();
// Call the interpreter
if (JvmtiExport::can_post_interpreter_events())
BytecodeInterpreter::runWithChecks(istate);
else
BytecodeInterpreter::run(istate);
fixup_after_potential_safepoint();
// Clear the frame anchor
thread->reset_last_Java_frame();
// Examine the message from the interpreter to decide what to do
if (istate->msg() == BytecodeInterpreter::call_method) {
methodOop callee = istate->callee();
// Trim back the stack to put the parameters at the top
stack->set_sp(istate->stack() + 1);
// Make the call
Interpreter::invoke_method(callee, istate->callee_entry_point(), THREAD);
fixup_after_potential_safepoint();
// Convert the result
istate->set_stack(stack->sp() - 1);
// Restore the stack
stack->set_sp(istate->stack_limit() + 1);
// Resume the interpreter
istate->set_msg(BytecodeInterpreter::method_resume);
}
else if (istate->msg() == BytecodeInterpreter::more_monitors) {
int monitor_words = frame::interpreter_frame_monitor_size();
// Allocate the space
stack->overflow_check(monitor_words, THREAD);
if (HAS_PENDING_EXCEPTION)
break;
stack->alloc(monitor_words * wordSize);
// Move the expression stack contents
for (intptr_t *p = istate->stack() + 1; p < istate->stack_base(); p++)
*(p - monitor_words) = *p;
// Move the expression stack pointers
istate->set_stack_limit(istate->stack_limit() - monitor_words);
istate->set_stack(istate->stack() - monitor_words);
istate->set_stack_base(istate->stack_base() - monitor_words);
// Zero the new monitor so the interpreter can find it.
((BasicObjectLock *) istate->stack_base())->set_obj(NULL);
// Resume the interpreter
istate->set_msg(BytecodeInterpreter::got_monitors);
}
else if (istate->msg() == BytecodeInterpreter::return_from_method) {
// Copy the result into the caller's frame
result_slots = type2size[result_type_of(method)];
assert(result_slots >= 0 && result_slots <= 2, "what?");
result = istate->stack() + result_slots;
break;
}
else if (istate->msg() == BytecodeInterpreter::throwing_exception) {
assert(HAS_PENDING_EXCEPTION, "should do");
break;
}
else if (istate->msg() == BytecodeInterpreter::do_osr) {
// Unwind the current frame
thread->pop_zero_frame();
// Remove any extension of the previous frame
int extra_locals = method->max_locals() - method->size_of_parameters();
stack->set_sp(stack->sp() + extra_locals);
// Jump into the OSR method
Interpreter::invoke_osr(
method, istate->osr_entry(), istate->osr_buf(), THREAD);
return;
}
else {
ShouldNotReachHere();
}
}
// Unwind the current frame
thread->pop_zero_frame();
// Pop our local variables
stack->set_sp(stack->sp() + method->max_locals());
// Push our result
for (int i = 0; i < result_slots; i++)
stack->push(result[-i]);
}
示例3: 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();
//.........这里部分代码省略.........