本文整理汇总了C++中StackValue类的典型用法代码示例。如果您正苦于以下问题:C++ StackValue类的具体用法?C++ StackValue怎么用?C++ StackValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StackValue类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: method
void interpretedVFrame::set_locals(StackValueCollection* values) const {
if (values == NULL || values->size() == 0) return;
int length = method()->max_locals();
if (method()->is_native()) {
// If the method is native, max_locals is not telling the truth.
// maxlocals then equals the size of parameters
length = method()->size_of_parameters();
}
assert(length == values->size(), "Mismatch between actual stack format and supplied data");
// handle locals
for (int i = 0; i < length; i++) {
// Find stack location
intptr_t *addr = locals_addr_at(i);
// Depending on oop/int put it in the right package
StackValue *sv = values->at(i);
assert(sv != NULL, "sanity check");
if (sv->type() == T_OBJECT) {
*(oop *) addr = (sv->get_obj())();
} else { // integer
*addr = sv->get_int();
}
}
}
示例2: JS_ASSERT
void
FrameInfo::popRegsAndSync(uint32_t uses)
{
// x86 has only 3 Value registers. Only support 2 regs here for now,
// so that there's always a scratch Value register for reg -> reg
// moves.
JS_ASSERT(uses > 0);
JS_ASSERT(uses <= 2);
JS_ASSERT(uses <= stackDepth());
syncStack(uses);
switch (uses) {
case 1:
popValue(R0);
break;
case 2: {
// If the second value is in R1, move it to R2 so that it's not
// clobbered by the first popValue.
StackValue *val = peek(-2);
if (val->kind() == StackValue::Register && val->reg() == R1) {
masm.moveValue(R1, R2);
val->setRegister(R2);
}
popValue(R1);
popValue(R0);
break;
}
default:
MOZ_ASSUME_UNREACHABLE("Invalid uses");
}
}
示例3: locals
void javaVFrame::print_lock_info(int frame_count) {
ResourceMark rm;
// If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
if (frame_count == 0 && method()->name() == vmSymbols::wait_name() &&
instanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) {
StackValueCollection* locs = locals();
if (!locs->is_empty()) {
StackValue* sv = locs->at(0);
if (sv->type() == T_OBJECT) {
Handle o = locs->at(0)->get_obj();
if (o.not_null()) {
instanceKlass* ik = instanceKlass::cast(o->klass());
tty->print_cr("\t- waiting on <" INTPTR_FORMAT "> (a %s)", o(), ik->external_name());
}
}
}
}
// Print out all monitors that we have locked or are trying to lock
GrowableArray<MonitorInfo*>* mons = monitors();
if (!mons->is_empty()) {
bool found_first_monitor = false;
for (int index = (mons->length()-1); index >= 0; index--) {
MonitorInfo* monitor = mons->at(index);
if (monitor->owner() != NULL) {
//
// First, assume we have the monitor locked. If we haven't found an
// owned monitor before and this is the first frame, then we need to
// see if the thread is blocked.
//
const char *lock_state = "locked"; // assume we have the monitor locked
if (!found_first_monitor && frame_count == 0) {
switch (thread()->thread_state()) {
case _thread_blocked:
case _thread_blocked_trans:
lock_state = "waiting to lock";
break;
}
}
found_first_monitor = true;
instanceKlass* ik = instanceKlass::cast(monitor->owner()->klass());
tty->print_cr("\t- %s <" INTPTR_FORMAT "> (a %s)", lock_state, monitor->owner(), ik->external_name());
}
}
}
}
示例4: peek
void
FrameInfo::popValue(ValueOperand dest)
{
StackValue *val = peek(-1);
switch (val->kind()) {
case StackValue::Constant:
masm.moveValue(val->constant(), dest);
break;
case StackValue::LocalSlot:
masm.loadValue(addressOfLocal(val->localSlot()), dest);
break;
case StackValue::ArgSlot:
masm.loadValue(addressOfArg(val->argSlot()), dest);
break;
case StackValue::ThisSlot:
masm.loadValue(addressOfThis(), dest);
break;
case StackValue::Stack:
masm.popValue(dest);
break;
case StackValue::Register:
masm.moveValue(val->reg(), dest);
break;
default:
MOZ_ASSUME_UNREACHABLE("Invalid kind");
}
// masm.popValue already adjusted the stack pointer, don't do it twice.
pop(DontAdjustStack);
}
示例5: method
void interpretedVFrame::set_locals(StackValueCollection* values) const {
if (values == NULL || values->size() == 0) return;
int length = method()->max_locals();
if (method()->is_native()) {
// If the method is native, max_locals is not telling the truth.
// maxlocals then equals the size of parameters
length = method()->size_of_parameters();
}
assert(length == values->size(), "Mismatch between actual stack format and supplied data");
// Get oopmap describing oops and int for current bci
InterpreterOopMap oop_mask;
if (TraceDeoptimization && Verbose) {
methodHandle m_h(thread(), method());
OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask);
} else {
method()->mask_for(bci(), &oop_mask);
}
// handle locals
for (int i = 0; i < length; i++) {
// Find stack location
intptr_t *addr = locals_addr_at(i);
// Depending on oop/int put it in the right package
StackValue *sv = values->at(i);
assert(sv != NULL, "sanity check");
if (oop_mask.is_oop(i)) { // oop value
*(oop *) addr = (sv->get_obj())();
} else { // integer
*addr = sv->get_int();
}
}
}
示例6: MonitorChunk
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();
}
}
}
示例7: method
//.........这里部分代码省略.........
_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
if (ProfileInterpreter) {
methodDataOop mdo = method()->method_data();
if (mdo != NULL) {
int bci = iframe()->interpreter_frame_bci();
if (use_next_mdp) ++bci;
address mdp = mdo->bci_to_dp(bci);
iframe()->interpreter_frame_set_mdp(mdp);
}
}
// Unpack expression stack
// If this is an intermediate frame (i.e. not top frame) then this
// only unpacks the part of the expression stack not used by callee
// as parameters. The callee parameters are unpacked as part of the
// callee locals.
int i;
for(i = 0; i < expressions()->size(); i++) {
StackValue *value = expressions()->at(i);
intptr_t* addr = iframe()->interpreter_frame_expression_stack_at(i);
switch(value->type()) {
case T_INT:
*addr = value->get_int();
break;
case T_OBJECT:
*addr = value->get_int(T_OBJECT);
break;
case T_CONFLICT:
// A dead stack slot. Initialize to null in case it is an oop.
*addr = NULL_WORD;
break;
default:
ShouldNotReachHere();
}
}
// Unpack the locals
for(i = 0; i < locals()->size(); i++) {
StackValue *value = locals()->at(i);
intptr_t* addr = iframe()->interpreter_frame_local_at(i);
switch(value->type()) {
case T_INT:
*addr = value->get_int();
break;
case T_OBJECT:
*addr = value->get_int(T_OBJECT);
break;
case T_CONFLICT:
// A dead location. If it is an oop then we need a NULL to prevent GC from following it
*addr = NULL_WORD;