本文整理汇总了C++中BasicObjectLock::lock方法的典型用法代码示例。如果您正苦于以下问题:C++ BasicObjectLock::lock方法的具体用法?C++ BasicObjectLock::lock怎么用?C++ BasicObjectLock::lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicObjectLock
的用法示例。
在下文中一共展示了BasicObjectLock::lock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fr
GrowableArray<MonitorInfo*>* interpretedVFrame::monitors() const {
GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(5);
for (BasicObjectLock* current = (fr().previous_monitor_in_interpreter_frame(fr().interpreter_frame_monitor_begin()));
current >= fr().interpreter_frame_monitor_end();
current = fr().previous_monitor_in_interpreter_frame(current)) {
result->push(new MonitorInfo(current->obj(), current->lock(), false, false));
}
return result;
}
示例2: fill_in
void vframeArrayElement::fill_in(compiledVFrame* vf) {
// Copy the information from the compiled vframe to the
// interpreter frame we will be creating to replace vf
_method = vf->method();
_bci = vf->raw_bci();
_reexecute = vf->should_reexecute();
int index;
// Get the monitors off-stack
GrowableArray<MonitorInfo*>* list = vf->monitors();
if (list->is_empty()) {
_monitors = NULL;
} else {
// Allocate monitor chunk
_monitors = new MonitorChunk(list->length());
vf->thread()->add_monitor_chunk(_monitors);
// Migrate the BasicLocks from the stack to the monitor chunk
for (index = 0; index < list->length(); index++) {
MonitorInfo* monitor = list->at(index);
assert(!monitor->owner_is_scalar_replaced(), "object should be reallocated already");
assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
BasicObjectLock* dest = _monitors->at(index);
dest->set_obj(monitor->owner());
monitor->lock()->move_to(monitor->owner(), dest->lock());
}
}
// Convert the vframe locals and expressions to off stack
// values. Because we will not gc all oops can be converted to
// intptr_t (i.e. a stack slot) and we are fine. This is
// good since we are inside a HandleMark and the oops in our
// collection would go away between packing them here and
// unpacking them in unpack_on_stack.
// First the locals go off-stack
// FIXME this seems silly it creates a StackValueCollection
// in order to get the size to then copy them and
// convert the types to intptr_t size slots. Seems like it
// could do it in place... Still uses less memory than the
// old way though
StackValueCollection *locs = vf->locals();
_locals = new StackValueCollection(locs->size());
for(index = 0; index < locs->size(); index++) {
StackValue* value = locs->at(index);
switch(value->type()) {
case T_OBJECT:
assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
// preserve object type
_locals->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT ));
break;
case T_CONFLICT:
// A dead local. Will be initialized to null/zero.
_locals->add( new StackValue());
break;
case T_INT:
_locals->add( new StackValue(value->get_int()));
break;
default:
ShouldNotReachHere();
}
}
// Now the expressions off-stack
// Same silliness as above
StackValueCollection *exprs = vf->expressions();
_expressions = new StackValueCollection(exprs->size());
for(index = 0; index < exprs->size(); index++) {
StackValue* value = exprs->at(index);
switch(value->type()) {
case T_OBJECT:
assert(!value->obj_is_scalar_replaced(), "object should be reallocated already");
// preserve object type
_expressions->add( new StackValue((intptr_t) (value->get_obj()()), T_OBJECT ));
break;
case T_CONFLICT:
// A dead stack element. Will be initialized to null/zero.
// This can occur when the compiler emits a state in which stack
// elements are known to be dead (because of an imminent exception).
_expressions->add( new StackValue());
break;
case T_INT:
_expressions->add( new StackValue(value->get_int()));
break;
default:
ShouldNotReachHere();
}
}
}
示例3: unpack_on_stack
//.........这里部分代码省略.........
#else
// TBD: Need to implement ForceEarlyReturn for CC_INTERP (ia64)
#endif
} else {
// Possibly override the previous pc computation of the top (youngest) frame
switch (exec_mode) {
case Deoptimization::Unpack_deopt:
// use what we've got
break;
case Deoptimization::Unpack_exception:
// exception is pending
pc = SharedRuntime::raw_exception_handler_for_return_address(thread, pc);
// [phh] We're going to end up in some handler or other, so it doesn't
// matter what mdp we point to. See exception_handler_for_exception()
// in interpreterRuntime.cpp.
break;
case Deoptimization::Unpack_uncommon_trap:
case Deoptimization::Unpack_reexecute:
// redo last byte code
pc = Interpreter::deopt_entry(vtos, 0);
use_next_mdp = false;
break;
default:
ShouldNotReachHere();
}
}
}
// Setup the interpreter frame
assert(method() != NULL, "method must exist");
int temps = expressions()->size();
int locks = monitors() == NULL ? 0 : monitors()->number_of_monitors();
Interpreter::layout_activation(method(),
temps + callee_parameters,
popframe_preserved_args_size_in_words,
locks,
caller_actual_parameters,
callee_parameters,
callee_locals,
caller,
iframe(),
is_top_frame,
is_bottom_frame);
// Update the pc in the frame object and overwrite the temporary pc
// we placed in the skeletal frame now that we finally know the
// exact interpreter address we should use.
_frame.patch_pc(thread, pc);
assert (!method()->is_synchronized() || locks > 0, "synchronized methods must have monitors");
BasicObjectLock* top = iframe()->interpreter_frame_monitor_begin();
for (int index = 0; index < locks; index++) {
top = iframe()->previous_monitor_in_interpreter_frame(top);
BasicObjectLock* src = _monitors->at(index);
top->set_obj(src->obj());
src->lock()->move_to(src->obj(), top->lock());
}
if (ProfileInterpreter) {
iframe()->interpreter_frame_set_mdx(0); // clear out the mdp.
}
iframe()->interpreter_frame_set_bcx((intptr_t)bcp); // cannot use bcp because frame is not initialized yet