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(); }
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); }
ValueStack* ValueStack::pop_scope(bool should_eliminate_stores, int bci) { assert(_scope->caller() != NULL, "scope must have caller"); IRScope* scope = _scope->caller(); int max_stack = max_stack_size() - _scope->method()->max_stack(); assert(max_stack >= 0, "stack underflow"); ValueStack* res = new ValueStack(scope, scope->method()->max_locals(), max_stack); // Preserves stack and monitors. Restores local and store state from caller scope. res->_stack.appendAll(&_stack); res->_locks.appendAll(&_locks); ValueStack* caller = caller_state(); if (caller != NULL) { for (int i = 0; i < caller->_locals.length(); i++) { res->_locals.at_put(i, caller->_locals.at(i)); res->_stores.at_put(i, caller->_stores.at(i)); } assert(res->_locals.length() == res->scope()->method()->max_locals(), "just checking"); assert(res->_stores.length() == res->scope()->method()->max_locals(), "just checking"); } assert(res->_stack.size() <= res->max_stack_size(), "stack overflow"); if (EliminateStores && should_eliminate_stores) eliminate_stores(bci); return res; }