Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: runtime/vm/intermediate_language.h

Issue 16693006: Initial implementation of on-stack replacement (OSR). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up for review. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language.h
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index e3bd33d773b36a5d4d04f77cd7769f251cf1f695..cb14c84f8855887ec661e194ed6cd34061e6bf8c 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -23,6 +23,7 @@ class ControlInstruction;
class Definition;
class Environment;
class FlowGraph;
+class FlowGraphBuilder;
class FlowGraphCompiler;
class FlowGraphVisitor;
class Instruction;
@@ -868,7 +869,7 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
private:
friend class Definition; // Needed for InsertBefore, InsertAfter.
- // Classes that set deopt_id_.
+ // Classes that set or read deopt_id_.
friend class UnboxIntegerInstr;
friend class UnboxDoubleInstr;
friend class UnboxFloat32x4Instr;
@@ -921,6 +922,7 @@ FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
friend class SmiToDoubleInstr;
friend class DoubleToIntegerInstr;
friend class BranchSimplifier;
+ friend class BlockEntryInstr;
virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
@@ -1143,6 +1145,13 @@ class BlockEntryInstr : public Instruction {
intptr_t variable_count,
intptr_t fixed_parameter_count);
+ // Perform a depth first search to prune code not reachable from an OSR
+ // entry point.
+ bool PruneUnreachable(FlowGraphBuilder* builder,
+ GraphEntryInstr* graph_entry,
+ intptr_t osr_id,
+ BitVector* block_marks);
+
virtual intptr_t InputCount() const { return 0; }
virtual Value* InputAt(intptr_t i) const {
UNREACHABLE();
@@ -1281,7 +1290,8 @@ class BackwardInstructionIterator : public ValueObject {
class GraphEntryInstr : public BlockEntryInstr {
public:
GraphEntryInstr(const ParsedFunction& parsed_function,
- TargetEntryInstr* normal_entry);
+ TargetEntryInstr* normal_entry,
+ intptr_t osr_id);
DECLARE_INSTRUCTION(GraphEntry)
@@ -1302,6 +1312,8 @@ class GraphEntryInstr : public BlockEntryInstr {
}
ConstantInstr* constant_null();
+ bool IsCompiledForOsr() const { return osr_id_ != Isolate::kNoDeoptId; }
+
intptr_t spill_slot_count() const { return spill_slot_count_; }
void set_spill_slot_count(intptr_t count) {
ASSERT(count >= 0);
@@ -1336,6 +1348,7 @@ class GraphEntryInstr : public BlockEntryInstr {
TargetEntryInstr* normal_entry_;
GrowableArray<CatchBlockEntryInstr*> catch_entries_;
GrowableArray<Definition*> initial_definitions_;
+ const intptr_t osr_id_;
intptr_t spill_slot_count_;
intptr_t fixed_slot_count_; // For try-catch in optimized code.
@@ -5903,10 +5916,11 @@ class UnarySmiOpInstr : public TemplateDefinition<1> {
class CheckStackOverflowInstr : public TemplateInstruction<0> {
public:
- explicit CheckStackOverflowInstr(intptr_t token_pos)
- : token_pos_(token_pos) {}
+ CheckStackOverflowInstr(intptr_t token_pos, bool is_loop)
+ : token_pos_(token_pos), is_loop_(is_loop) {}
intptr_t token_pos() const { return token_pos_; }
+ bool is_loop() const { return is_loop_; }
srdjan 2013/06/11 17:12:02 Maybe call it 'in_loop' instead?
Kevin Millikin (Google) 2013/06/14 10:10:42 Done.
DECLARE_INSTRUCTION(CheckStackOverflow)
@@ -5918,8 +5932,11 @@ class CheckStackOverflowInstr : public TemplateInstruction<0> {
virtual bool MayThrow() const { return false; }
+ virtual void PrintOperandsTo(BufferFormatter* f) const;
+
private:
const intptr_t token_pos_;
+ const bool is_loop_;
DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr);
};

Powered by Google App Engine
This is Rietveld 408576698