Index: runtime/vm/compiler.cc |
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc |
index f3d879a8c90bf2a28d645b2b1974441517858ac5..ae493de1f389011dc9f60fdfda4478fc8ad4d7eb 100644 |
--- a/runtime/vm/compiler.cc |
+++ b/runtime/vm/compiler.cc |
@@ -412,11 +412,15 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, |
bool done = false; |
// volatile because the variable may be clobbered by a longjmp. |
volatile bool use_far_branches = false; |
+ volatile bool use_speculative_inlining = true; |
+ GrowableArray<intptr_t> inlining_black_list; |
+ |
while (!done) { |
const intptr_t prev_deopt_id = thread->deopt_id(); |
thread->set_deopt_id(0); |
LongJumpScope jump; |
- if (setjmp(*jump.Set()) == 0) { |
+ intptr_t val = setjmp(*jump.Set()); |
srdjan
2015/11/17 17:35:23
const intptr_t val =
srdjan
2015/11/17 17:35:23
Add Comment that val may contain deopt_id of the f
Florian Schneider
2015/11/17 19:38:56
Done.
Florian Schneider
2015/11/17 19:38:56
Done.
|
+ if (val == 0) { |
FlowGraph* flow_graph = NULL; |
// Class hierarchy analysis is registered with the isolate in the |
@@ -500,9 +504,17 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, |
caller_inline_id.Add(-1); |
CSTAT_TIMER_SCOPE(thread, graphoptimizer_timer); |
- FlowGraphOptimizer optimizer(flow_graph); |
+ FlowGraphOptimizer optimizer(flow_graph, |
+ use_speculative_inlining, |
+ &inlining_black_list); |
if (Compiler::always_optimize()) { |
optimizer.PopulateWithICData(); |
+ |
+ optimizer.ApplyClassIds(); |
Florian Schneider
2015/11/17 12:39:25
Adding an early pass of specializing based on gues
|
+ DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
+ |
+ FlowGraphTypePropagator::Propagate(flow_graph); |
+ DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
} |
optimizer.ApplyICData(); |
DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
@@ -870,6 +882,21 @@ static bool CompileParsedFunctionHelper(CompilationPipeline* pipeline, |
done = false; |
ASSERT(!use_far_branches); |
use_far_branches = true; |
+ } else if (error.raw() == Object::speculative_inlining_error().raw()) { |
+ done = false; |
+ ASSERT(use_speculative_inlining); |
+ for (intptr_t i = 0; i < inlining_black_list.length(); ++i) { |
+ ASSERT(inlining_black_list[i] != val); |
+ } |
srdjan
2015/11/17 17:35:23
The loop above should be tun in DEBUG mode only. A
Florian Schneider
2015/11/17 19:38:56
Done.
|
+ inlining_black_list.Add(val); |
+ const intptr_t kMaxAttempts = 1; |
+ if (inlining_black_list.length() >= kMaxAttempts) { |
srdjan
2015/11/17 17:35:23
Use flag instead of kMaxAttempt.
Florian Schneider
2015/11/17 19:38:56
Done.
|
+ use_speculative_inlining = false; |
+ if (FLAG_trace_compiler) { |
+ THR_Print("Disabled speculative inlining after %" Pd " attempts.\n", |
+ inlining_black_list.length()); |
+ } |
+ } |
} else { |
// If the error isn't due to an out of range branch offset, we don't |
// try again (done = true), and indicate that we did not finish |