|
|
Created:
3 years, 7 months ago by zhivkag Modified:
3 years, 7 months ago CC:
reviews_dartlang.org Target Ref:
refs/heads/master Visibility:
Public. |
DescriptionModify new instance allocation
A fresh new instance should be allocated after the evaluation of the
argument list for the constructor.
This change modifies the ConstructorInvocation application continuation
to allocate a new object and introduces :
* continuation applications for Redirecting and Super constructor
invocations, applied on evaluated arguments for Redirecting and Super
constructors respectively
* expression continuation for instance initialization, applied to the
new instance
BUG=
R=dmitryas@google.com
Committed: https://github.com/dart-lang/sdk/commit/4030e2de6cf533bc973cab227752e6eebb107abb
Patch Set 1 #
Messages
Total messages: 10 (6 generated)
Description was changed from ========== Allocate new object after evaluation of arguments for new BUG= ========== to ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ==========
zhivkag@google.com changed reviewers: + dmitryas@google.com, kmillikin@google.com
LGTM. I have a couple of general comments though, and I'm putting them here just in case. (1) In case of redirecting constructor, should we first evaluate the arguments of the constructor we're redirected to and only then allocate the fresh instance, or not? It's also interesting to see how it works with chains of redirecting constructors. (2) 'ObjectInitializationContinuation' extends 'ExpressionContinuation'. I'd rather have it as a Configuration, not Continuation. The reason is that if we have a Continuation, we're treating the operation of allocation of the new instance as an expression that 'returns' its value to 'ObjectInitializationContinuation'. I'm not sure we want those 'implicit expressions' in our abstract machine. Also, new instances of 'ObjectInitializationContinuation' are immediately packed into a 'ContinuationConfiguration' instances, and I think that it means that we actually want a Configuration after all. Also, (2) is a part of a greater discussion about constructors. Namely, should constructor bodies extend 'ExpressionContinuation', so that they get the instance being initialized as a value via 'call()' invocation. As with constructors, I think in (2) 'this' may be retrieved from the environment, and we don't create 'implicit expressions' that may hinder the understanding of the language semantics to the reader of the interpreter code.
Description was changed from ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ========== to ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ==========
Description was changed from ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ========== to ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ==========
Description was changed from ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ========== to ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ==========
Thanks! On 2017/05/17 13:13:16, Dmitry Stefantsov wrote: > LGTM. > > I have a couple of general comments though, and I'm putting them here just in > case. > > (1) In case of redirecting constructor, should we first evaluate the arguments > of the constructor we're redirected to and only then allocate the fresh > instance, or not? It's also interesting to see how it works with chains of > redirecting constructors. This is implemented according to my understanding of sections 10.6 for Constructors and 16.12 for Instance creation from the Dart language spec, it may differ in Kernel. This is how it works in this CL: - A fresh instance i is allocated when a constructor Q is run with keyword *new*, just after the evaluation of actual arguments (and some checks). - Then the constructor Q is executed to initialize the fresh instance i. If Q redirects to some constructor G, then execution of Q to initialize i proceeds by: - Evaluating the argument list for G - Then executing G to initialize the fresh instance i with respect to the bindings resulting from the evaluation of the argument list. The same rule would apply if G is also redirecting. > > (2) 'ObjectInitializationContinuation' extends 'ExpressionContinuation'. I'd > rather have it as a Configuration, not Continuation. The reason is that if we > have a Continuation, we're treating the operation of allocation of the new > instance as an expression that 'returns' its value to > 'ObjectInitializationContinuation'. I'm not sure we want those 'implicit > expressions' in our abstract machine. Also, new instances of > 'ObjectInitializationContinuation' are immediately packed into a > 'ContinuationConfiguration' instances, and I think that it means that we > actually want a Configuration after all. > > Also, (2) is a part of a greater discussion about constructors. Namely, should > constructor bodies extend 'ExpressionContinuation', so that they get the > instance being initialized as a value via 'call()' invocation. Indeed, this could be a StatementConfiguration or a Configuration, depending on what we decide to do for constructors. > > As with constructors, I think in (2) 'this' may be retrieved from the > environment, and we don't create 'implicit expressions' that may hinder the > understanding of the language semantics to the reader of the interpreter code.
Description was changed from ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= ========== to ========== Modify new instance allocation A fresh new instance should be allocated after the evaluation of the argument list for the constructor. This change modifies the ConstructorInvocation application continuation to allocate a new object and introduces : * continuation applications for Redirecting and Super constructor invocations, applied on evaluated arguments for Redirecting and Super constructors respectively * expression continuation for instance initialization, applied to the new instance BUG= R=dmitryas@google.com Committed: https://github.com/dart-lang/sdk/commit/4030e2de6cf533bc973cab227752e6eebb107abb ==========
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as 4030e2de6cf533bc973cab227752e6eebb107abb (presubmit successful). |