简体   繁体   English

如何获得DART代码的向下编译版本

[英]How to get compiled down version of dart code

Is there a way to get compiled down version of a dart code for a particular target? 有没有办法为特定目标获取DART代码的向下编译版本? Say the following code compiled for Dart VM. 说以下为Dart VM编译的代码。

I'm new to Dart and quite often come across high level abstract code and wonder how it is translated in VM. 我是Dart的新手,经常遇到高级抽象代码,想知道如何在VM中翻译它。

names.forEach(print);

Dart is not compiled to something like Java-bytecode or DotNet IL. Dart无法编译为Java字节码或DotNet IL之类的东西。

Dart is compiled to machine code by the VM either ahead of time (AoT) or just in time (JiT) VM将Dart提前(AoT)或及时(JiT)编译为机器代码

https://mrale.ph/dartvm/ https://mrale.ph/dartvm/

The name "Dart VM" is historical. 名称“ Dart VM”是历史名称。 Dart VM is a virtual machine in a sense that it provides an execution environment for a high-level programming language, however it does not imply that Dart is always interpreted or JIT-compiled, when executing on Dart VM. 从某种意义上说,Dart VM是一种虚拟机,它为高级编程语言提供了执行环境,但是,这并不意味着在Dart VM上执行时,Dart总是被解释或JIT编译。 For example, Dart code can be compiled into machine code using Dart VM AOT pipeline and then executed within a stripped version of the Dart VM, called precompiled runtime, which does not contain any compiler components and is incapable of loading Dart source code dynamically. 例如,可以使用Dart VM AOT管道将Dart代码编译为机器代码,然后在称为预编译运行时的Dart VM剥离版本中执行,该版本不包含任何编译器组件并且不能动态加载Dart源代码。

Dart 2 uses Kernel AST though generated by the common front-end (CFE) Dart 2虽然使用了通用前端(CFE)生成,但仍使用内核AST

There is some abstraction happening from the Dart language though 虽然Dart语言发生了一些抽象

https://github.com/dart-lang/sdk/blob/master/pkg/kernel/README.md https://github.com/dart-lang/sdk/blob/master/pkg/kernel/README.md

Dart Kernel is a small high-level language derived from Dart. Dart Kernel是Dart衍生的一种小型高级语言。 It is designed for use as an intermediate format for whole-program analysis and transformations, and to be consumed by codegen and execution backends. 它被设计用作整个程序分析和转换的中间格式,并由代码生成和执行后端使用。

The kernel language has an in-memory representation in Dart and can be serialized as binary or text. 内核语言在Dart中具有内存中表示形式,可以序列化为二进制或文本形式。

Both the kernel language and its implementations are unstable and are under development. 内核语言及其实现都不稳定,并且正在开发中。

See also https://github.com/dart-lang/sdk/blob/master/pkg/kernel/binary.md 另请参见https://github.com/dart-lang/sdk/blob/master/pkg/kernel/binary.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM