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

Issue 9169102: Add Dart_PropagateError. (Closed)

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

Description

Add Dart_PropagateError. This function can be used in native functions to properly pass all errors up the stack. Set the long jump base in the Compiler instead of outside of the compiler. A bunch of errors that used to be propagated through the sticky_error are now propagated through return values. This includes all of the DartEntry and DartLibraryCall functions. In particular, we no longer use the long jump to cross dart frames. Instead errors are propagated across dart frames using the same mechanism that we use for unhandled exceptions. I've added assertions to make sure that we only use the long jump when it is "safe". Committed: https://code.google.com/p/dart/source/detail?r=3815

Patch Set 1 #

Patch Set 2 : Cleanups Prereview #

Patch Set 3 : Removed some unneeded includes #

Total comments: 48

Patch Set 4 : '' #

Total comments: 1

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+952 lines, -696 lines) Patch
M runtime/include/dart_api.h View 1 2 3 4 1 chunk +24 lines, -0 lines 0 comments Download
M runtime/lib/isolate.cc View 1 2 3 4 5 6 chunks +21 lines, -18 lines 0 comments Download
M runtime/vm/ast.cc View 1 2 3 4 1 chunk +11 lines, -9 lines 0 comments Download
M runtime/vm/bootstrap.h View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/bootstrap.cc View 1 2 3 4 1 chunk +6 lines, -3 lines 0 comments Download
M runtime/vm/bootstrap_nocorelib.cc View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/code_generator.cc View 1 2 3 4 5 9 chunks +41 lines, -25 lines 0 comments Download
M runtime/vm/code_generator_ia32.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/code_generator_ia32_test.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/code_generator_x64.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/code_generator_x64_test.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M runtime/vm/compiler.h View 1 2 3 4 1 chunk +16 lines, -5 lines 0 comments Download
M runtime/vm/compiler.cc View 1 2 3 4 3 chunks +230 lines, -177 lines 0 comments Download
M runtime/vm/cpu.h View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/cpu_arm.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/vm/cpu_ia32.cc View 1 2 3 4 4 chunks +9 lines, -9 lines 0 comments Download
M runtime/vm/cpu_x64.cc View 1 2 3 4 3 chunks +8 lines, -8 lines 0 comments Download
M runtime/vm/dart.h View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/dart.cc View 1 2 3 4 4 chunks +6 lines, -3 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 3 4 5 22 chunks +142 lines, -265 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 3 4 1 chunk +62 lines, -0 lines 0 comments Download
M runtime/vm/dart_entry.h View 1 2 3 4 2 chunks +22 lines, -22 lines 0 comments Download
M runtime/vm/dart_entry.cc View 1 2 3 4 11 chunks +31 lines, -19 lines 0 comments Download
M runtime/vm/dart_entry_test.cc View 1 2 3 4 2 chunks +72 lines, -0 lines 0 comments Download
M runtime/vm/debugger.h View 1 2 3 4 2 chunks +6 lines, -3 lines 0 comments Download
M runtime/vm/debugger.cc View 1 2 3 4 4 chunks +13 lines, -6 lines 0 comments Download
M runtime/vm/debugger_api_impl.cc View 1 2 3 4 3 chunks +18 lines, -24 lines 0 comments Download
M runtime/vm/exceptions.h View 1 2 3 4 5 2 chunks +7 lines, -3 lines 0 comments Download
M runtime/vm/exceptions.cc View 1 2 3 4 5 3 chunks +62 lines, -7 lines 0 comments Download
M runtime/vm/isolate.h View 1 2 3 4 2 chunks +3 lines, -3 lines 0 comments Download
M runtime/vm/isolate.cc View 1 2 3 4 2 chunks +5 lines, -4 lines 0 comments Download
M runtime/vm/longjump.h View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M runtime/vm/longjump.cc View 1 2 3 4 5 1 chunk +11 lines, -0 lines 0 comments Download
M runtime/vm/object.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M runtime/vm/object.cc View 1 2 3 4 5 chunks +16 lines, -6 lines 0 comments Download
M runtime/vm/object_store.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/object_store.cc View 1 2 3 4 2 chunks +16 lines, -14 lines 0 comments Download
M runtime/vm/parser.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M runtime/vm/parser.cc View 1 2 3 4 8 chunks +53 lines, -21 lines 0 comments Download
M runtime/vm/stack_frame.cc View 1 2 3 4 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/unit_test.h View 1 2 3 4 2 chunks +10 lines, -4 lines 0 comments Download
M runtime/vm/unit_test.cc View 1 2 3 4 1 chunk +4 lines, -24 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
turnidge
Here's another change for you to review. Lower priority than the native ports review I ...
8 years, 11 months ago (2012-01-27 01:20:14 UTC) #1
siva
http://codereview.chromium.org/9169102/diff/11003/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/9169102/diff/11003/runtime/include/dart_api.h#newcode153 runtime/include/dart_api.h:153: * If the error handle represents an unhandled exception, ...
8 years, 10 months ago (2012-01-31 00:52:34 UTC) #2
turnidge
Hi Siva, Ready for another look. Todd http://codereview.chromium.org/9169102/diff/11003/runtime/include/dart_api.h File runtime/include/dart_api.h (right): http://codereview.chromium.org/9169102/diff/11003/runtime/include/dart_api.h#newcode153 runtime/include/dart_api.h:153: * If ...
8 years, 10 months ago (2012-01-31 21:56:31 UTC) #3
siva
8 years, 10 months ago (2012-02-01 19:09:38 UTC) #4
LGTM

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/code_generator.cc
File runtime/vm/code_generator.cc (right):

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/code_generator.c...
runtime/vm/code_generator.cc:434: const Error& error =
Error::Handle(Compiler::CompileFunction(function));
On 2012/01/31 21:56:31, turnidge wrote:
> On 2012/01/31 00:52:34, asiva wrote:
> > Would it make sense to have a version of CompileFunction which calls
> > Exceptions::PropagateError(error) if an error has occurred?
> > 
> > That way this boiler plate error check code does not have to be repeated
every
> > time.
> 
> I sort of find the current version less magical.  The caller has to make a
> conscious choice about how to handle the error rather than deciding to call
the
> "void" CompileFunction in a strange context and not considering how to handle
> the error.
> 
> Is it okay to leave it like this for now and change it later if it is
> problematic?

Sure.

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/code_generator.c...
runtime/vm/code_generator.cc:454: }
On 2012/01/31 21:56:31, turnidge wrote:
> On 2012/01/31 00:52:34, asiva wrote:
> > ASSERT(result.IsNull());
> 
> Why should the result be null?


You are right the result does not have to be NULL, I was thinking of the compile
case where it either succeeds or fails, but this is used more for checking the
result of a dart function invocation which can return some other result object

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/exceptions.cc
File runtime/vm/exceptions.cc (right):

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/exceptions.cc#ne...
runtime/vm/exceptions.cc:150: CPU::JumpToErrorHandler(handler_pc, handler_sp,
handler_fp, error);
On 2012/01/31 21:56:31, turnidge wrote:
> It might be helpful to have a stack trace in these cases, yes.  That's a nice
> idea.
> 
> Can I plan on changing this later?  I plan on doing more work around
> isolate-death and having a death-stack-trace could be part of that work.
> 
> For this CL, the semantics of an Error are the same as they were before --
skip
> dart frames and do not run finally blocks.  If we wanted to start running
> finally blocks on compilation errors, would it involve spec changes?
> 
> On 2012/01/31 00:52:34, asiva wrote:
> > Will we get a stack trace for these error cases, probably not but it might
be
> > useful.
> > 
> > I am beginning to wonder whether we should treat compile error as exceptions
> > similar to unhandled exceptions.
> 


Yes I agree we should plan on any enhancements to error reporting in another CL
not this one,

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/longjump.cc
File runtime/vm/longjump.cc (right):

http://codereview.chromium.org/9169102/diff/11003/runtime/vm/longjump.cc#newc...
runtime/vm/longjump.cc:28: jumpbuf_addr < isolate->top_exit_frame_info());
On 2012/01/31 21:56:31, turnidge wrote:
> On 2012/01/31 00:52:34, asiva wrote:
> > This code seems to assume that the stack always grows from high to low, it
is
> > probably true for the targets we port to but it still feels weird.
> 
> I also make this assumption in the stack overflow handler in
code_generator.cc.
> 
> Do you want me to document this?

Maybe a comment stating that this code assumes the stack grows from high t low
would be fine.

http://codereview.chromium.org/9169102/diff/17001/runtime/vm/exceptions.cc
File runtime/vm/exceptions.cc (right):

http://codereview.chromium.org/9169102/diff/17001/runtime/vm/exceptions.cc#ne...
runtime/vm/exceptions.cc:133: void Exceptions::PropagateError(const Error&
error) {
Not for this CL but maybe changing the signature of this to
Exceptions::PropagateError(const Object& obj);
might simplify the invocation points which always
do a
Error& error = Error::Handle();
error ^ result.raw();
PropogateError(error);

Powered by Google App Engine
This is Rietveld 408576698