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

Issue 54713003: VM: Fix initialization of statics in presence of exceptions. (Closed)

Created:
7 years, 1 month ago by fschneider
Modified:
7 years, 1 month ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

VM: Fix initialization of statics in presence of exceptions. In a static- or top-level variable v var v = expr static v = expr If the initializer expression expr throws, the VM throws a CyclicInitializationError when loading v afterwards, even though this has nothing to do with cyclic initialization. I'm changing the way implicit static getters and static initializers are compiled. Static initializers are invoked from static getters. They look as follows: get:v { if (field.value === transition_sentinel) { field.value = null; throw new CyclicInitializationError(); } if (field.value === sentinel) { field.value = transition_sentinel; init:v(); } return field.value; } init:v { try { field.value = expr; } catch { if (field.value === transition_sentinel) { field.value = null; } rethrow; } } BUG=http://dartbug.com/5802 TEST=language/lazy_static3_test, language/throwing_lazy_variable_test, co19/Language/12_Expressions/30_Identifier_Reference_A08_t02 R=hausner@google.com Committed: https://code.google.com/p/dart/source/detail?r=29797

Patch Set 1 #

Patch Set 2 : #

Total comments: 1

Patch Set 3 : rebased #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -65 lines) Patch
M runtime/vm/class_finalizer.cc View 1 2 3 1 chunk +5 lines, -11 lines 0 comments Download
M runtime/vm/flow_graph_builder.cc View 1 2 3 1 chunk +5 lines, -6 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 chunks +22 lines, -7 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 3 9 chunks +105 lines, -31 lines 0 comments Download
M tests/co19/co19-co19.status View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M tests/co19/co19-dart2dart.status View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M tests/co19/co19-runtime.status View 1 2 3 1 chunk +0 lines, -1 line 0 comments Download
M tests/language/language.status View 1 2 3 2 chunks +0 lines, -2 lines 0 comments Download
M tests/language/language_dart2js.status View 1 2 3 2 chunks +0 lines, -2 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Florian Schneider
7 years, 1 month ago (2013-10-31 17:37:57 UTC) #1
hausner
LGTM, with caveat. Thanks for fixing the bug. As I pointed out in your previous ...
7 years, 1 month ago (2013-10-31 21:56:44 UTC) #2
Florian Schneider
On 2013/10/31 21:56:44, hausner wrote: > LGTM, with caveat. > > Thanks for fixing the ...
7 years, 1 month ago (2013-11-01 12:23:06 UTC) #3
Florian Schneider
On 2013/10/31 21:56:44, hausner wrote: > LGTM, with caveat. > > Thanks for fixing the ...
7 years, 1 month ago (2013-11-01 12:23:08 UTC) #4
Florian Schneider
https://codereview.chromium.org/54713003/diff/100001/runtime/vm/class_finalizer.cc File runtime/vm/class_finalizer.cc (right): https://codereview.chromium.org/54713003/diff/100001/runtime/vm/class_finalizer.cc#newcode1225 runtime/vm/class_finalizer.cc:1225: Function::NewStaticInitializer(field)); This addresses your comment to my previous CL: ...
7 years, 1 month ago (2013-11-01 12:43:48 UTC) #5
fschneider
7 years, 1 month ago (2013-11-04 10:09:01 UTC) #6
Message was sent while issue was closed.
Committed patchset #4 manually as r29797 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698