本文整理汇总了C++中ZeroStack::teardown方法的典型用法代码示例。如果您正苦于以下问题:C++ ZeroStack::teardown方法的具体用法?C++ ZeroStack::teardown怎么用?C++ ZeroStack::teardown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZeroStack
的用法示例。
在下文中一共展示了ZeroStack::teardown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: call_stub
// The call stub is used to call Java from C
static void call_stub(
JavaCallWrapper *call_wrapper,
intptr_t* result,
BasicType result_type,
methodOop method,
address entry_point,
intptr_t* parameters,
int parameter_words,
TRAPS) {
JavaThread *thread = (JavaThread *) THREAD;
ZeroStack *stack = thread->zero_stack();
// Make sure we have no pending exceptions
assert(!HAS_PENDING_EXCEPTION, "call_stub called with pending exception");
// Set up the stack if necessary
bool stack_needs_teardown = false;
if (stack->needs_setup()) {
size_t zero_stack_size = stack->suggest_size(thread);
stack->setup(alloca(zero_stack_size), zero_stack_size);
stack_needs_teardown = true;
}
// Allocate and initialize our frame
EntryFrame *frame =
EntryFrame::build(parameters, parameter_words, call_wrapper, THREAD);
if (!HAS_PENDING_EXCEPTION) {
// Push the frame
thread->push_zero_frame(frame);
// Make the call
Interpreter::invoke_method(method, entry_point, THREAD);
// Store the result
if (!HAS_PENDING_EXCEPTION) {
switch (result_type) {
case T_INT:
*(jint *) result = *(jint *) stack->sp();
break;
case T_LONG:
*(jlong *) result = *(jlong *) stack->sp();
break;
case T_FLOAT:
*(jfloat *) result = *(jfloat *) stack->sp();
break;
case T_DOUBLE:
*(jdouble *) result = *(jdouble *) stack->sp();
break;
case T_OBJECT:
*(oop *) result = *(oop *) stack->sp();
break;
default:
ShouldNotReachHere();
}
}
// Unwind the frame
thread->pop_zero_frame();
}
// Tear down the stack if necessary
if (stack_needs_teardown)
stack->teardown();
}