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

Issue 14682020: Optimize functions containing try-catch. (Closed)

Created:
7 years, 7 months ago by Florian Schneider
Modified:
7 years, 7 months ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Optimize functions containing try-catch. This is a first step towards fully optimizing try-catch-finally. At a catch entry, all local variables and parameters are expected at a fixed stack location. There is a list of initial definitions at the catch entry block, similar to the initial definitions at graph entry. Inside every try-block there is a special prologue code before each call (instruction that may throw) inside the try-block. This prologue is similar to a parallel move instruction: It moves all locals+parameters to the locations expected by the catch-entry block. The stack frame is extended with the corresponding number of fixed slots right below the normal spill slots. Every function containing try-catch has additional compiler- generated local variables to pass the context, the exception and the stack trace. Variable liveness analysis is adapted to treat locals inside try{} blocks specially: Every call has an implicit LoadLocal of every local variable. This CL uses a safe approximiation of liveness which can be optimized further. Current restrictions which are planned for future CLs: * No inlining inside try-blocks. * No inlining of functions containing try-catch. * No try-finally yet. R=kmillikin@google.com Committed: https://code.google.com/p/dart/source/detail?r=22615

Patch Set 1 #

Patch Set 2 : rebased, all tests pass #

Patch Set 3 : x64 port, fixed bug with safepoints #

Patch Set 4 : updated unit tests #

Patch Set 5 : fixed checked mode tests failure #

Total comments: 7

Patch Set 6 : addressed Srdjan's comments #

Total comments: 64

Patch Set 7 : addressed comments, rebased #

Patch Set 8 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1057 lines, -82 lines) Patch
M runtime/vm/assembler_ia32.h View 1 2 3 4 5 6 7 1 chunk +8 lines, -0 lines 0 comments Download
M runtime/vm/assembler_x64.h View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
M runtime/vm/compiler.cc View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph.cc View 1 2 3 4 5 6 7 6 chunks +56 lines, -6 lines 0 comments Download
M runtime/vm/flow_graph_allocator.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_allocator.cc View 1 2 3 4 5 6 7 8 chunks +97 lines, -45 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 3 4 5 6 7 1 chunk +5 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler.h View 1 2 3 4 5 6 7 3 chunks +7 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 1 2 3 4 5 6 7 2 chunks +76 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 2 3 4 5 6 7 2 chunks +75 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_inliner.cc View 1 2 3 4 5 6 7 1 chunk +7 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.h View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 5 6 7 8 chunks +118 lines, -14 lines 0 comments Download
M runtime/vm/flow_graph_type_propagator.cc View 1 2 3 4 5 6 7 1 chunk +6 lines, -2 lines 0 comments Download
M runtime/vm/il_printer.cc View 1 2 3 4 5 6 7 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 5 6 7 101 chunks +231 lines, -2 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 7 2 chunks +12 lines, -1 line 0 comments Download
M tests/language/try_catch2_test.dart View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M tests/language/try_catch3_test.dart View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download
M tests/language/try_catch4_test.dart View 1 2 3 4 5 6 7 2 chunks +7 lines, -1 line 0 comments Download
M tests/language/try_catch5_test.dart View 1 2 3 4 5 6 7 1 chunk +4 lines, -2 lines 0 comments Download
A tests/language/try_catch_optimized1_test.dart View 1 2 3 1 chunk +299 lines, -0 lines 0 comments Download
M tests/language/try_catch_test.dart View 1 2 3 4 5 6 7 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 7 (0 generated)
Florian Schneider
7 years, 7 months ago (2013-05-07 12:04:37 UTC) #1
srdjan
Instead of ifdef ARM/MIPS you could add a flag --bailout_on_try_catch and set it to false ...
7 years, 7 months ago (2013-05-07 17:34:05 UTC) #2
Florian Schneider
https://codereview.chromium.org/14682020/diff/29004/runtime/vm/flow_graph.cc File runtime/vm/flow_graph.cc (right): https://codereview.chromium.org/14682020/diff/29004/runtime/vm/flow_graph.cc#newcode12 runtime/vm/flow_graph.cc:12: #include "vm/il_printer.h" On 2013/05/07 17:34:05, srdjan wrote: > Remove. ...
7 years, 7 months ago (2013-05-08 08:57:47 UTC) #3
Kevin Millikin (Google)
I think the approach will work. I'm sure all the special handing is necessary, but ...
7 years, 7 months ago (2013-05-08 11:42:00 UTC) #4
Florian Schneider
https://codereview.chromium.org/14682020/diff/40001/runtime/vm/flow_graph.cc File runtime/vm/flow_graph.cc (right): https://codereview.chromium.org/14682020/diff/40001/runtime/vm/flow_graph.cc#newcode336 runtime/vm/flow_graph.cc:336: // All locals are assigned inside try-catch. On 2013/05/08 ...
7 years, 7 months ago (2013-05-08 17:10:55 UTC) #5
Kevin Millikin (Google)
Comments look much better. LGTM.
7 years, 7 months ago (2013-05-13 09:42:06 UTC) #6
Florian Schneider
7 years, 7 months ago (2013-05-13 10:33:44 UTC) #7
Message was sent while issue was closed.
Committed patchset #8 manually as r22615 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698