本文整理汇总了C++中ValueStack类的典型用法代码示例。如果您正苦于以下问题:C++ ValueStack类的具体用法?C++ ValueStack怎么用?C++ ValueStack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ValueStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: clear_stores
void ValueStack::clear_stores() {
ValueStack* stack = this;
while (stack != NULL) {
for (int i = 0; i < stack->_stores.length(); i++) stack->_stores.at_put(i, NULL);
stack = stack->caller_state();
}
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:7,代码来源:c1_ValueStack.cpp
示例2: VarValue
void Scumm::v6::Scummv6StoreInstruction::processInst(Function&, ValueStack &stack, Engine*, CodeGenerator *codeGen) {
Scummv6CodeGenerator *cg = (Scummv6CodeGenerator *)codeGen;
switch (_opcode) {
case 0x42: // writeByteVar
case 0x43: // writeWordVar
{
ValuePtr p = new VarValue(cg->decodeVarName(static_cast<uint16>(_params[0]->getUnsigned())));
cg->writeAssignment(p, stack.pop());
}
break;
case 0x46: // byteArrayWrite
case 0x47: // wordArrayWrite
{
ValuePtr value = stack.pop();
ValueList idxs;
idxs.push_back(stack.pop());
ValuePtr p = new ArrayValue(cg->decodeArrayName(static_cast<uint16>(_params[0]->getUnsigned())), idxs);
cg->writeAssignment(p, value);
}
break;
case 0x4A: // byteArrayIndexedWrite
case 0x4B: // wordArrayIndexedWrite
{
ValuePtr value = stack.pop();
ValueList idxs;
idxs.push_front(stack.pop());
idxs.push_front(stack.pop());
ValuePtr p = new ArrayValue(cg->decodeArrayName(static_cast<uint16>(_params[0]->getUnsigned())), idxs);
cg->writeAssignment(p, value);
}
break;
}
}
开发者ID:mewbak,项目名称:SUDM,代码行数:33,代码来源:engine.cpp
示例3: eliminate_all_scope_stores
void ValueStack::eliminate_all_scope_stores(int bci) {
ValueStack* stack = this;
while (stack != NULL) {
stack->eliminate_stores(bci);
stack = stack->caller_state();
}
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:7,代码来源:c1_ValueStack.cpp
示例4: ArrayValue
void Scumm::v6::Scummv6ArrayOpInstruction::processInst(Function&, ValueStack &stack, Engine*, CodeGenerator *codeGen) {
Scummv6CodeGenerator *cg = (Scummv6CodeGenerator *)codeGen;
switch (_opcode) {
case 0xA4CD: // arrayOp_assignString
{
ValuePtr value = _params[1];
ValueList idxs;
idxs.push_front(stack.pop());
ValuePtr p = new ArrayValue(cg->decodeArrayName(static_cast<uint16>(_params[0]->getUnsigned())), idxs);
cg->writeAssignment(p, value);
}
break;
case 0xA4D0: // arrayOp_assignIntList
{
ValueList idxs;
idxs.push_front(stack.pop());
ValuePtr value = cg->createListValue();
ValuePtr p = new ArrayValue(cg->decodeArrayName(static_cast<uint16>(_params[0]->getUnsigned())), idxs);
cg->writeAssignment(p, value);
}
break;
case 0xA4D4: // arrayOp_assign2DimList
{
ValueList idxs;
idxs.push_front(stack.pop());
ValuePtr value = cg->createListValue();
idxs.push_front(stack.pop());
ValuePtr p = new ArrayValue(cg->decodeArrayName(static_cast<uint16>(_params[0]->getUnsigned())), idxs);
cg->writeAssignment(p, value);
}
break;
}
}
开发者ID:mewbak,项目名称:SUDM,代码行数:33,代码来源:engine.cpp
示例5: assert
ValueStack* ValueStack::push_scope(IRScope* scope) {
assert(scope->caller() == _scope, "scopes must have caller/callee relationship");
ValueStack* res = new ValueStack(scope,
scope->method()->max_locals(),
max_stack_size() + scope->method()->max_stack());
// Preserves stack and monitors.
res->_stack.appendAll(&_stack);
res->_locks.appendAll(&_locks);
assert(res->_stack.size() <= res->max_stack_size(), "stack overflow");
return res;
}
开发者ID:fatman2021,项目名称:myforthprocessor,代码行数:11,代码来源:c1_ValueStack.cpp
示例6: nth_oldest
// Index caller states in s, where 0 is the oldest, 1 its callee, etc.
// Return NULL if n is too large.
// Returns the caller_bci for the next-younger state, also.
static ValueStack* nth_oldest(ValueStack* s, int n, int& bci_result) {
ValueStack* t = s;
for (int i = 0; i < n; i++) {
if (t == NULL) break;
t = t->caller_state();
}
if (t == NULL) return NULL;
for (;;) {
ValueStack* tc = t->caller_state();
if (tc == NULL) return s;
t = tc;
bci_result = tc->bci();
s = s->caller_state();
}
}
开发者ID:sourcemirror,项目名称:jdk-9-hotspot,代码行数:18,代码来源:c1_LIRAssembler.cpp
示例7: UnaryOpValue
void Scumm::v6::Scummv6IncDecInstruction::processInst(Function&, ValueStack &stack, Engine*, CodeGenerator *codeGen) {
Scummv6CodeGenerator *cg = (Scummv6CodeGenerator *)codeGen;
switch (_opcode) {
case 0x4E: // byteVarInc
case 0x4F: // wordVarInc
case 0x56: // byteVarDec
case 0x57: // wordVarDec
{
std::stringstream s;
ValuePtr p = new UnaryOpValue(new VarValue(cg->decodeVarName(static_cast<uint16>(_params[0]->getUnsigned()))), _codeGenData, true);
s << p << ";";
cg->addOutputLine(s.str());
}
break;
case 0x52: // byteArrayInc
case 0x53: // wordArrayInc
case 0x5A: // byteArrayDec
case 0x5B: // wordArrayDec
{
std::stringstream s;
ValueList idxs;
idxs.push_front(stack.pop());
ValuePtr p = new UnaryOpValue(new ArrayValue(cg->decodeVarName(static_cast<uint16>(_params[0]->getUnsigned())), idxs), _codeGenData, true);
s << p << ";";
cg->addOutputLine(s.str());
}
break;
}
}
开发者ID:mewbak,项目名称:SUDM,代码行数:29,代码来源:engine.cpp
示例8: listVirtualStack
bool lua_details::listVirtualStack(lua_State* L, ValueStack& stack, size_t table_size_limit)
{
int size= lua_gettop(L);
stack.clear();
stack.reserve(size);
for (int idx= size - 1; idx > 0; --idx)
{
Value v(L, idx, 1, table_size_limit);
stack.push_back(v);
}
return true;
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:16,代码来源:OSGLuaUtils.cpp
示例9: print_begin
void CFGPrinterOutput::print_state(BlockBegin* block) {
print_begin("states");
InstructionPrinter ip(true, output());
ValueStack* state = block->state();
int index;
Value value;
if (state->stack_size() > 0) {
print_begin("stack");
print("size %d", state->stack_size());
for_each_stack_value(state, index, value) {
ip.print_phi(index, value, block);
print_operand(value);
output()->cr();
}
开发者ID:tetratec,项目名称:Runescape-Launcher,代码行数:18,代码来源:c1_CFGPrinter.cpp
示例10: print_begin
void CFGPrinterOutput::print_state(BlockBegin* block) {
print_begin("states");
InstructionPrinter ip(true, output());
ValueStack* state = block->state();
int index;
Value value;
for_each_state(state) {
print_begin("locals");
print("size %d", state->locals_size());
print("method \"%s\"", method_name(state->scope()->method()));
for_each_local_value(state, index, value) {
ip.print_phi(index, value, block);
print_operand(value);
output()->cr();
}
print_end("locals");
if (state->stack_size() > 0) {
print_begin("stack");
print("size %d", state->stack_size());
print("method \"%s\"", method_name(state->scope()->method()));
for_each_stack_value(state, index, value) {
ip.print_phi(index, value, block);
print_operand(value);
output()->cr();
}
开发者ID:4T-Shirt,项目名称:OpenJDK-Research,代码行数:31,代码来源:c1_CFGPrinter.cpp
示例11: debug_info
void LIR_Assembler::record_non_safepoint_debug_info() {
int pc_offset = _pending_non_safepoint_offset;
ValueStack* vstack = debug_info(_pending_non_safepoint);
int bci = vstack->bci();
DebugInformationRecorder* debug_info = compilation()->debug_info_recorder();
assert(debug_info->recording_non_safepoints(), "sanity");
debug_info->add_non_safepoint(pc_offset);
// Visit scopes from oldest to youngest.
for (int n = 0; ; n++) {
int s_bci = bci;
ValueStack* s = nth_oldest(vstack, n, s_bci);
if (s == NULL) break;
IRScope* scope = s->scope();
//Always pass false for reexecute since these ScopeDescs are never used for deopt
debug_info->describe_scope(pc_offset, scope->method(), s->bci(), false/*reexecute*/);
}
debug_info->end_non_safepoint(pc_offset);
}
开发者ID:GregBowyer,项目名称:Hotspot,代码行数:22,代码来源:c1_LIRAssembler.cpp
示例12: eval
Value expression::eval(Value &ret)
{
ValueStack valstack;
String str_oper;
str_oper="oper";
POSITION pos=m_postfix.get_top_position();
for(; pos; pos=m_postfix.get_next(pos)){
const char*s=m_postfix.get(pos);
if(s[0]=='%' || isalpha(s[0]) )
{
//ValueRef vref(getworld()->var_get(s));
valstack.add(getworld()->var_get(s));
}
else if (isdigit(s[0])){
valstack.add()=str_to_real(s);
}
else {
_oper* p;
if(s[0]=='\'')
p=getworld()->oper_get(s+1);
else
p=getworld()->oper_get(str_oper+s);
p->eval(valstack) ;
}
}
ret=valstack.get_last();
valstack.remove();
return ret;
}
开发者ID:tdrhq,项目名称:openmath,代码行数:39,代码来源:expression_working.cpp
示例13:
void Scumm::v6::Scummv6StackInstruction::processInst(Function&, ValueStack &stack, Engine*, CodeGenerator*) {
stack.pop();
}
开发者ID:mewbak,项目名称:SUDM,代码行数:3,代码来源:engine.cpp
示例14: output
void InstructionPrinter::do_BlockBegin(BlockBegin* x) {
// print block id
BlockEnd* end = x->end();
output()->print("B%d ", x->block_id());
// print flags
bool printed_flag = false;
if (x->is_set(BlockBegin::std_entry_flag)) {
if (!printed_flag) output()->print("(");
output()->print("S"); printed_flag = true;
}
if (x->is_set(BlockBegin::osr_entry_flag)) {
if (!printed_flag) output()->print("(");
output()->print("O"); printed_flag = true;
}
if (x->is_set(BlockBegin::exception_entry_flag)) {
if (!printed_flag) output()->print("(");
output()->print("E"); printed_flag = true;
}
if (x->is_set(BlockBegin::subroutine_entry_flag)) {
if (!printed_flag) output()->print("(");
output()->print("s"); printed_flag = true;
}
if (x->is_set(BlockBegin::parser_loop_header_flag)) {
if (!printed_flag) output()->print("(");
output()->print("LH"); printed_flag = true;
}
if (x->is_set(BlockBegin::backward_branch_target_flag)) {
if (!printed_flag) output()->print("(");
output()->print("b"); printed_flag = true;
}
if (x->is_set(BlockBegin::was_visited_flag)) {
if (!printed_flag) output()->print("(");
output()->print("V"); printed_flag = true;
}
if (printed_flag) output()->print(") ");
// print block bci range
output()->print("[%d, %d]",x->bci(),(end==NULL?InvocationEntryBci:end->bci()));
// print block successors
if (end != NULL && end->number_of_sux() > 0) {
output()->print(" ->");
for (int i = 0; i < end->number_of_sux(); i++) {
output()->print(" B%d", end->sux_at(i)->block_id());
}
}
// print exception handlers
if (x->number_of_exception_handlers() > 0) {
output()->print(" (xhandlers ");
for (int i = 0; i < x->number_of_exception_handlers(); i++) {
if (i > 0) output()->print(" ");
output()->print("B%d", x->exception_handler_at(i)->block_id());
}
output()->put(')');
}
// print dominator block
if (x->dominator() != NULL) {
output()->print(" dom B%d", x->dominator()->block_id());
}
// print predecessors and successors
if (x->successors()->length() > 0) {
output()->print(" sux:");
for (int i = 0; i < x->successors()->length(); i ++) {
output()->print(" B%d", x->successors()->at(i)->block_id());
}
}
if (x->number_of_preds() > 0) {
output()->print(" pred:");
for (int i = 0; i < x->number_of_preds(); i ++) {
output()->print(" B%d", x->pred_at(i)->block_id());
}
}
if (!_print_phis) {
return;
}
// print phi functions
bool has_phis_in_locals = false;
bool has_phis_on_stack = false;
if (x->end() && x->end()->state()) {
ValueStack* state = x->state();
int i = 0;
while (!has_phis_on_stack && i < state->stack_size()) {
Value v = state->stack_at_inc(i);
has_phis_on_stack = is_phi_of_block(v, x);
}
do {
for (i = 0; !has_phis_in_locals && i < state->locals_size();) {
Value v = state->local_at(i);
has_phis_in_locals = is_phi_of_block(v, x);
// also ignore illegal HiWords
if (v && !v->type()->is_illegal()) i += v->type()->size(); else i ++;
//.........这里部分代码省略.........
开发者ID:GregBowyer,项目名称:ManagedRuntimeInitiative,代码行数:101,代码来源:c1_InstructionPrinter.cpp
示例15: process_block
void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
TRACE_VALUE_NUMBERING(tty->print_cr("processing block B%d", block->block_id()));
Instruction* prev = block;
Instruction* cur = block->next();
while (cur != NULL) {
// determine if cur instruction is loop invariant
// only selected instruction types are processed here
bool cur_invariant = false;
if (cur->as_Constant() != NULL) {
cur_invariant = !cur->can_trap();
} else if (cur->as_ArithmeticOp() != NULL || cur->as_LogicOp() != NULL || cur->as_ShiftOp() != NULL) {
assert(cur->as_Op2() != NULL, "must be Op2");
Op2* op2 = (Op2*)cur;
cur_invariant = !op2->can_trap() && is_invariant(op2->x()) && is_invariant(op2->y());
} else if (cur->as_LoadField() != NULL) {
LoadField* lf = (LoadField*)cur;
// deoptimizes on NullPointerException
cur_invariant = !lf->needs_patching() && !lf->field()->is_volatile() && !_short_loop_optimizer->has_field_store(lf->field()->type()->basic_type()) && is_invariant(lf->obj()) && _insert_is_pred;
} else if (cur->as_ArrayLength() != NULL) {
ArrayLength *length = cur->as_ArrayLength();
cur_invariant = is_invariant(length->array());
} else if (cur->as_LoadIndexed() != NULL) {
LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed();
cur_invariant = !_short_loop_optimizer->has_indexed_store(as_BasicType(cur->type())) && is_invariant(li->array()) && is_invariant(li->index()) && _insert_is_pred;
}
if (cur_invariant) {
// perform value numbering and mark instruction as loop-invariant
_gvn->substitute(cur);
if (cur->as_Constant() == NULL) {
// ensure that code for non-constant instructions is always generated
cur->pin();
}
// remove cur instruction from loop block and append it to block before loop
Instruction* next = cur->next();
Instruction* in = _insertion_point->next();
_insertion_point = _insertion_point->set_next(cur);
cur->set_next(in);
// Deoptimize on exception
cur->set_flag(Instruction::DeoptimizeOnException, true);
// Clear exception handlers
cur->set_exception_handlers(NULL);
TRACE_VALUE_NUMBERING(tty->print_cr("Instruction %c%d is loop invariant", cur->type()->tchar(), cur->id()));
if (cur->state_before() != NULL) {
cur->set_state_before(_state->copy());
}
if (cur->exception_state() != NULL) {
cur->set_exception_state(_state->copy());
}
cur = prev->set_next(next);
} else {
prev = cur;
cur = cur->next();
}
}
}
开发者ID:dain,项目名称:graal,代码行数:68,代码来源:c1_ValueMap.cpp
注:本文中的ValueStack类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论