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

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed)

Created:
8 years, 3 months ago by srdjan
Modified:
8 years, 3 months ago
Reviewers:
siva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This assumption (verified with Todd and Gilad) simplifies the implementation of lazy deoptimization considerably. Add flag --deoptimize-alot, which will lazily deoptimize all live optimized frames. Currently only the presence of deoptimization information is checked. Add kDeoptAfter deoptimization point, which is the continuation for lazy deoptimization, after a call. Rename kDeopt to kDeoptBefore. Removed a tests case that called into a native without properly setting up a Dart frame (Ok-d by Siva). Native functions are not optimizable. TODO: Split deoptimization information from DeoptimizationStubs. Check for redundant PcDescriptor information (what can be merged, especially at calls). Committed: https://code.google.com/p/dart/source/detail?r=11642

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 18

Patch Set 7 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+196 lines, -171 lines) Patch
M runtime/vm/code_descriptors.h View 1 2 3 4 5 6 4 chunks +16 lines, -6 lines 0 comments Download
M runtime/vm/code_descriptors.cc View 1 2 3 4 5 6 1 chunk +6 lines, -6 lines 0 comments Download
M runtime/vm/code_generator.h View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M runtime/vm/code_generator.cc View 1 2 3 4 5 6 4 chunks +31 lines, -1 line 0 comments Download
M runtime/vm/deopt_instructions.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_compiler.cc View 1 2 3 4 5 6 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.h View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 1 2 3 4 5 6 4 chunks +34 lines, -12 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.h View 1 2 3 4 5 6 1 chunk +6 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_compiler_x64.cc View 1 2 3 4 5 6 4 chunks +34 lines, -12 lines 0 comments Download
M runtime/vm/intermediate_language.h View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 2 chunks +6 lines, -6 lines 0 comments Download
M runtime/vm/intermediate_language_ia32.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/intermediate_language_x64.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/native_entry.h View 1 2 3 4 5 6 3 chunks +3 lines, -0 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 5 6 3 chunks +11 lines, -7 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 5 6 4 chunks +28 lines, -12 lines 0 comments Download
M runtime/vm/object_test.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/stub_code_ia32_test.cc View 1 2 3 4 5 6 1 chunk +0 lines, -49 lines 0 comments Download
M runtime/vm/stub_code_x64_test.cc View 1 2 3 4 5 6 1 chunk +0 lines, -49 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
srdjan
8 years, 3 months ago (2012-08-29 20:59:04 UTC) #1
siva
LGTM once question regarding access to GetDeoptBeforePcAtDeoptId on unoptimized code is addressed. https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_descriptors.cc File runtime/vm/code_descriptors.cc ...
8 years, 3 months ago (2012-08-30 01:37:30 UTC) #2
srdjan
8 years, 3 months ago (2012-08-30 17:16:16 UTC) #3
https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_des...
File runtime/vm/code_descriptors.cc (right):

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_des...
runtime/vm/code_descriptors.cc:36: data.token_index = deopt_reason;
On 2012/08/30 01:37:30, asiva wrote:
> overloading token_index field as deopt_reason can be a bit confusing when
> reading code.
> 
> I am wondering if it would make the code more readable if we called the field
> data and added accessor functions
> SetTokenIndex(intptr_t value);
> intptr_t TokenIndex();
> SetDeoptReason(intptr_t value);
> intptr_t DeoptReason();
> 
> and used these accessor functions.


Done.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
File runtime/vm/code_generator.cc (right):

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:30: "Deoptimizes all live frames at runtime and
native entries.");
On 2012/08/30 01:37:30, asiva wrote:
> Deoptimizes all live frames when we are about to return to dart code from
> runtime and native entries?

Done, removed reference to runtime.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:1404: StackFrame* frame = iterator.NextFrame();
On 2012/08/30 01:37:30, asiva wrote:
> Code& optimized_code = Code::Handle();
> Function& function = Function::Handle();
> Code& unoptimized_code = Code::Handle();

Done.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:1406: const Code& optimized_code =
Code::Handle(frame->LookupDartCode());
On 2012/08/30 01:37:30, asiva wrote:
> optimized_code = frame->LookupDartCode();

Done.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:1412: const Function& function =
Function::Handle(optimized_code.function());
On 2012/08/30 01:37:30, asiva wrote:
> function = optimized_code.function();
> unoptimized_code = function.unoptimzied_code();

Done.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:1417: ASSERT(continue_at_pc != 0);
On 2012/08/30 01:37:30, asiva wrote:
> Maybe also assert that
> continue_at_pc > unoptimized_code.EntryPoint() &&
> continue_at_pc < (unoptimized_code.EntryPoint() + unoptimized_code.Size())

This check belongs in GetDeoptAfterPcAtDeoptId. Adding it there.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/code_gen...
runtime/vm/code_generator.cc:1591: uword continue_at_pc =
unoptimized_code.GetDeoptBeforePcAtDeoptId(deopt_id);
On 2012/08/30 01:37:30, asiva wrote:
> I am a little confused I thought unoptimized_code should only have DeoptAfter
> entries?

DeoptBefore an DeoptAfter are continuation points in unoptimized code. Added
more asserts that we can add them only to unoptimized code.
DeoptIndex can be added only to optimized code.

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/deopt_in...
File runtime/vm/deopt_instructions.cc (right):

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/deopt_in...
runtime/vm/deopt_instructions.cc:104:
code.GetDeoptBeforePcAtDeoptId(deopt_id_as_smi.Value());
On 2012/08/30 01:37:30, asiva wrote:
> Ditto question about unoptimized code having a DeoptBefore entry?

Ditto answer

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/native_e...
File runtime/vm/native_entry.h (right):

https://chromiumcodereview.appspot.com/10885039/diff/7026/runtime/vm/native_e...
runtime/vm/native_entry.h:37: extern void DeoptimizeAll();                      
                          \
On 2012/08/30 01:37:30, asiva wrote:
> why not include "code_generator.h" in this file instead of this extern void
> DeoptimizeAll declaration.

Done.

Powered by Google App Engine
This is Rietveld 408576698