Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a kernel snapshot to be compiled #47322

Closed
nex3 opened this issue Sep 29, 2021 · 4 comments
Closed

Allow a kernel snapshot to be compiled #47322

nex3 opened this issue Sep 29, 2021 · 4 comments
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. customer-dart-sass type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented Sep 29, 2021

Currently, if I try to run dart compile with a kernel snapshot as an input, it crashes with a bunch of errors like the following:

test.dart.snapshot:1:1: Error: Unable to decode bytes as UTF-8.
����E2102c6ce7a��������!A��
^

Since the normal dart runner itself can take a kernel snapshot, I'd expect dart compile to be able to as well. This would be useful for distributing installers that run dart compile exe on the local user's workstation on a single snapshot file, as a way of avoiding code signing issues and working around the lack of cross-compilation (#28617).

@nex3 nex3 added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-enhancement A request for a change that isn't a bug customer-dart-sass area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. labels Sep 29, 2021
@a-siva
Copy link
Contributor

a-siva commented Sep 29, 2021

removing area-vm as this support can be provided purely from the dart-cli tool.

@a-siva a-siva removed the area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. label Sep 29, 2021
@bsutton
Copy link

bsutton commented Nov 26, 2021

I would also like to see this feature supported.

I'm trying to implement incremental compilation in the dcli package for users that need an exe to test with Sudo or remote deployments. This feature would speed up development iterations for users of dcli.

@bkonyi
Copy link
Contributor

bkonyi commented Nov 30, 2021

@nex3 I don't think this will work for your use case as there's no stable ABI between the VM and kernel, so the user invoking dart compile will need to have exactly the same SDK version that was used to generate the kernel file. There's no plan to create a stable ABI and providing a way to compile from kernel probably doesn't add much value if the kernel already needs to be generated by the current SDK.

The right way to solve this distribution issue is for us to support cross-compilation, but I have no update on the progress on that front.

@bsutton we don't currently have support for AOT compilation from incremental kernel files, and such support would likely lead to little to no performance improvements as the global analysis done during the initial compilation would need to be completely invalidated to take into account changes to the program structure.

I'm going to close this issue as I don't think this feature is worth adding at this point as it will only work in very limited scenarios.

@bkonyi bkonyi closed this as completed Nov 30, 2021
@nex3
Copy link
Member Author

nex3 commented Nov 30, 2021

It's pretty easy to ensure that users get the same version of the SDK that was used to compile a kernel file. We already ensure that SDK versions are consistent in order to guarantee that the code runs against the same version of Dart it was tested against (different Dart versions have enough breaking changes between them that this is an unfortunate necessity).

Other than this one case, the dart executable provides the invariant that anything that can be run can also be compiled. Even if you don't think the use-case is particularly valuable, maintaining invariants like that is very helpful to making tooling easy for users to reason about and work with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart-cli Use area-dart-cli for issues related to the 'dart' command like tool. customer-dart-sass type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants