-
Notifications
You must be signed in to change notification settings - Fork 6k
Revert "Wrap the user entrypoint function in a zone with native exception callback. (#7512)" #7522
Conversation
…tion callback. (flutter#7512)" This reverts commit 25559ed. Reason for revert: broken in AOT mode. @pragma('vm:entry-point') placed on a function only instructs the compiler to retain the function itself, but does not tell compiler to generate and retain tear-off for this function. In this PR _runMainZoned was marked as an entry-point but C++ code was trying to tear it off and use a closure, instead of invoking it directly, which is not supported.
mkustermann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no current way of specifying that a global function is used as a tear-off from embedder, we should probably file an issue and address this?
|
@mkustermann I thought about that but I am not sure if we actually want that. If you need to tear-off a function you can always write code that does that in pure Dart. |
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
d470fc6 Roll src/third_party/skia 31972f889641..57263c2e0ccd (3 commits) (flutter/engine#7529) 4acfced Ensure the ResourceContext is not ripped out from under dart (flutter/engine#7528) 270e9a7 Roll src/third_party/skia a4e46804946c..31972f889641 (8 commits) (flutter/engine#7526) e984372 Roll src/third_party/skia 33b4b4908b7a..a4e46804946c (1 commits) (flutter/engine#7524) 4c135c2 Revert "Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512)" (flutter/engine#7522) 0a080a1 Roll src/third_party/dart 700254996f..da09945643 (14 commits) da09945643 Update dartfix pubspec before publishing b81c1b2095 Parse spread collections in map literals 1b0d93366d Add list literal spread collection fasta test cases 6c2ea4936a Clean up several deprecation hints 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode." 9cdce03e16 [dart2js] Improve null receiver guard removal near JS code c3599a9d8c Revert "[vm, isolate] Fix length truncation in message snapshots." 95e10c336f Revert "[vm] Assert callback state for all Dart_Set*ReturnValue." 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode. 4b22195ea1 [vm, isolate] Fix length truncation in message snapshots. a353b1172a [vm, compiler] Remove TAG_IC_DATA, which has since been subsumed by RebindRule. ca12afec50 [vm] Assert callback state for all Dart_Set*ReturnValue. 2028006a25 [Observatory] Updated Dart icon to new colour scheme 84273b9f36 Improvements for flow analysis. fff5377 Roll src/third_party/skia 25b9f192ed8c..33b4b4908b7a (1 commits) (flutter/engine#7520) a58cc39 Roll src/third_party/skia 1ce80fb351a2..25b9f192ed8c (5 commits) (flutter/engine#7517) 52e0e9d Roll src/third_party/skia 081e6f375497..1ce80fb351a2 (12 commits) (flutter/engine#7514) 25559ed Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512) 1b0d09b Roll src/third_party/dart f701e11756..700254996f (5 commits) 700254996f [ Observatory / Dartium ] Updated observatory documentation and tests to remove references to Dartium. 78abb98ee7 [vm/bytecode] Fix AST removal for package-split kernel files with bytecode 0075b58bb8 CHANGELOG entry for DEPRECATED_MEMBER_USE split a5f102a7d1 Analyzer: first pass at reporting unchecked nullable value usage. a10ddca1b1 [ VM / Service ] Allow for `profile_period` flag to be set via the service protocol e7ade51 Remove unused headers (flutter/engine#7511) 369b4db Roll src/third_party/skia 1374c85fbf53..081e6f375497 (6 commits) (flutter/engine#7510) 366d44e Roll src/third_party/dart 9b5eabdaca..f701e11756 (10 commits) f701e11756 [ VM / Debugger ] Fix issue where a 'Step' command issued when there's no stack caused a crash. c5bfccc6fb Make downloading the LSP spec a flag and commit the version parsed locally dbeec3bbf3 Fix formatting in generated LSP file header bfe15d87d8 Fix LSP exceptions serializing ResponseErrors with Uris 7984dc4fcc Prepare to publish analyzer version 0.34.2. 4b1b2f9176 Switch LSP formatter to not fetch resolved ASTs that aren't used 5ce5d697da Implement LSP code folding b47524d5b0 Ensure all unhandled exceptions are recorded on the server 8ba2de2344 Sort context for conflicting inherited members 215f6620e7 [Kernel] Signal errors on static fields in constant contexts
* Roll engine to d470fc6 d470fc6 Roll src/third_party/skia 31972f889641..57263c2e0ccd (3 commits) (flutter/engine#7529) 4acfced Ensure the ResourceContext is not ripped out from under dart (flutter/engine#7528) 270e9a7 Roll src/third_party/skia a4e46804946c..31972f889641 (8 commits) (flutter/engine#7526) e984372 Roll src/third_party/skia 33b4b4908b7a..a4e46804946c (1 commits) (flutter/engine#7524) 4c135c2 Revert "Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512)" (flutter/engine#7522) 0a080a1 Roll src/third_party/dart 700254996f..da09945643 (14 commits) da09945643 Update dartfix pubspec before publishing b81c1b2095 Parse spread collections in map literals 1b0d93366d Add list literal spread collection fasta test cases 6c2ea4936a Clean up several deprecation hints 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode." 9cdce03e16 [dart2js] Improve null receiver guard removal near JS code c3599a9d8c Revert "[vm, isolate] Fix length truncation in message snapshots." 95e10c336f Revert "[vm] Assert callback state for all Dart_Set*ReturnValue." 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode. 4b22195ea1 [vm, isolate] Fix length truncation in message snapshots. a353b1172a [vm, compiler] Remove TAG_IC_DATA, which has since been subsumed by RebindRule. ca12afec50 [vm] Assert callback state for all Dart_Set*ReturnValue. 2028006a25 [Observatory] Updated Dart icon to new colour scheme 84273b9f36 Improvements for flow analysis. fff5377 Roll src/third_party/skia 25b9f192ed8c..33b4b4908b7a (1 commits) (flutter/engine#7520) a58cc39 Roll src/third_party/skia 1ce80fb351a2..25b9f192ed8c (5 commits) (flutter/engine#7517) 52e0e9d Roll src/third_party/skia 081e6f375497..1ce80fb351a2 (12 commits) (flutter/engine#7514) 25559ed Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512) 1b0d09b Roll src/third_party/dart f701e11756..700254996f (5 commits) 700254996f [ Observatory / Dartium ] Updated observatory documentation and tests to remove references to Dartium. 78abb98ee7 [vm/bytecode] Fix AST removal for package-split kernel files with bytecode 0075b58bb8 CHANGELOG entry for DEPRECATED_MEMBER_USE split a5f102a7d1 Analyzer: first pass at reporting unchecked nullable value usage. a10ddca1b1 [ VM / Service ] Allow for `profile_period` flag to be set via the service protocol e7ade51 Remove unused headers (flutter/engine#7511) 369b4db Roll src/third_party/skia 1374c85fbf53..081e6f375497 (6 commits) (flutter/engine#7510) 366d44e Roll src/third_party/dart 9b5eabdaca..f701e11756 (10 commits) f701e11756 [ VM / Debugger ] Fix issue where a 'Step' command issued when there's no stack caused a crash. c5bfccc6fb Make downloading the LSP spec a flag and commit the version parsed locally dbeec3bbf3 Fix formatting in generated LSP file header bfe15d87d8 Fix LSP exceptions serializing ResponseErrors with Uris 7984dc4fcc Prepare to publish analyzer version 0.34.2. 4b1b2f9176 Switch LSP formatter to not fetch resolved ASTs that aren't used 5ce5d697da Implement LSP code folding b47524d5b0 Ensure all unhandled exceptions are recorded on the server 8ba2de2344 Sort context for conflicting inherited members 215f6620e7 [Kernel] Signal errors on static fields in constant contexts
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
…ve exception callback. (flutter#7512)" (flutter/engine#7522)
|
I am not sure how I can achieve the effect of this patch without being able to closurize at least one method marked with I was able to work around this by adding a method (also marked Something else I don't understand about this limitation is how the closurization of the user entrypoint function currently works. That is not even marked with @a-siva is considering committing the hack I described to dart-lang/sdk. Other alternatives could also be to add another pragma that allows native code to clourize entrypoints. Or, just generate the code for all entrypoints. After all, they are probably not that many in there and this behavior is different from JIT mode operation and hard to catch at compile time. Also CC @jason-simmons who was debugging this with us. |
|
I agree with @mkustermann's comment above about having a mechanism for doing a tear-off of a global function from the embedder. |
|
@chinmaygarde For convenience we could provide
We could check the impact of this solution. /cc @sjindel-google |
Thanks for clearing that up. Does this also mean that the support for running custom entrypoints in arbitrary libraries also currently broken for AOT? If so, I'll file a bug for that. I believe that code path is only used for AOT and some targets in Fuchsia. There are all presumably in the JIT mode. |
Does this support tear-off the main method or does it use |
|
At least with the Flutter Embedder in Android, we just hit the issue that @chinmaygarde mentioned in the comment above. Adding a new entry point to a Flutter app as: Resulted in a crash with /DartVM: ../../third_party/dart/runtime/vm/object.cc: 7146: error: unreachable code @mkustermann helped me track down the point where the embedder tries to tear-off this function which fails in AoT mode because there's no implicit closure function created by the compiler. flutter/engine/dart_isolate.cc I'd be great to get dart-lang/sdk#35720 so Flutter apps can define entry points without hitting this cryptic error. |
|
@dballesteros7: How did you discover the "@pragma("vm:entry-point")" annotation? Did you read the documentation in |
|
We asked internally on how to prevent a function from being tree-shaken by AOT and were pointed to that annotation. I haven't read the documentation. |
* Roll engine to d470fc6 d470fc6 Roll src/third_party/skia 31972f889641..57263c2e0ccd (3 commits) (flutter/engine#7529) 4acfced Ensure the ResourceContext is not ripped out from under dart (flutter/engine#7528) 270e9a7 Roll src/third_party/skia a4e46804946c..31972f889641 (8 commits) (flutter/engine#7526) e984372 Roll src/third_party/skia 33b4b4908b7a..a4e46804946c (1 commits) (flutter/engine#7524) 4c135c2 Revert "Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512)" (flutter/engine#7522) 0a080a1 Roll src/third_party/dart 700254996f..da09945643 (14 commits) da09945643 Update dartfix pubspec before publishing b81c1b2095 Parse spread collections in map literals 1b0d93366d Add list literal spread collection fasta test cases 6c2ea4936a Clean up several deprecation hints 07f95e7761 Revert "[vm] Enable timeline on Fuchsia even in product mode." 9cdce03e16 [dart2js] Improve null receiver guard removal near JS code c3599a9d8c Revert "[vm, isolate] Fix length truncation in message snapshots." 95e10c336f Revert "[vm] Assert callback state for all Dart_Set*ReturnValue." 3f7b371f2c [vm] Enable timeline on Fuchsia even in product mode. 4b22195ea1 [vm, isolate] Fix length truncation in message snapshots. a353b1172a [vm, compiler] Remove TAG_IC_DATA, which has since been subsumed by RebindRule. ca12afec50 [vm] Assert callback state for all Dart_Set*ReturnValue. 2028006a25 [Observatory] Updated Dart icon to new colour scheme 84273b9f36 Improvements for flow analysis. fff5377 Roll src/third_party/skia 25b9f192ed8c..33b4b4908b7a (1 commits) (flutter/engine#7520) a58cc39 Roll src/third_party/skia 1ce80fb351a2..25b9f192ed8c (5 commits) (flutter/engine#7517) 52e0e9d Roll src/third_party/skia 081e6f375497..1ce80fb351a2 (12 commits) (flutter/engine#7514) 25559ed Wrap the user entrypoint function in a zone with native exception callback. (flutter/engine#7512) 1b0d09b Roll src/third_party/dart f701e11756..700254996f (5 commits) 700254996f [ Observatory / Dartium ] Updated observatory documentation and tests to remove references to Dartium. 78abb98ee7 [vm/bytecode] Fix AST removal for package-split kernel files with bytecode 0075b58bb8 CHANGELOG entry for DEPRECATED_MEMBER_USE split a5f102a7d1 Analyzer: first pass at reporting unchecked nullable value usage. a10ddca1b1 [ VM / Service ] Allow for `profile_period` flag to be set via the service protocol e7ade51 Remove unused headers (flutter/engine#7511) 369b4db Roll src/third_party/skia 1374c85fbf53..081e6f375497 (6 commits) (flutter/engine#7510) 366d44e Roll src/third_party/dart 9b5eabdaca..f701e11756 (10 commits) f701e11756 [ VM / Debugger ] Fix issue where a 'Step' command issued when there's no stack caused a crash. c5bfccc6fb Make downloading the LSP spec a flag and commit the version parsed locally dbeec3bbf3 Fix formatting in generated LSP file header bfe15d87d8 Fix LSP exceptions serializing ResponseErrors with Uris 7984dc4fcc Prepare to publish analyzer version 0.34.2. 4b1b2f9176 Switch LSP formatter to not fetch resolved ASTs that aren't used 5ce5d697da Implement LSP code folding b47524d5b0 Ensure all unhandled exceptions are recorded on the server 8ba2de2344 Sort context for conflicting inherited members 215f6620e7 [Kernel] Signal errors on static fields in constant contexts
@chinmaygarde This has been implemented now in dart-lang/sdk@ae7bf9e. The default is to allow closurization of the procedure. |
|
In addition, I'm working on using the more fine-grained annotation for existing entry-points in Flutter and Dart SDK to reduce the regression. |
This reverts commit 25559ed.
Reason for revert: broken in AOT mode.
@pragma('vm:entry-point') placed on a function only instructs
the compiler to retain the function itself, but does not tell
compiler to generate and retain tear-off for this function.
In this PR _runMainZoned was marked as an entry-point but C++
code was trying to tear it off and use a closure, instead of
invoking it directly, which is not supported.