ac7ca17652
To enable bytecode generation, toggle kEnableKernelBytecode flag at the beginning of pkg/vm/lib/bytecode/gen_bytecode.dart. This will also enable generation of bytecode in platform dill files. Also, bytecode generation can be enabled using --gen-bytecode option of pkg/vm/tool/gen_kernel. In kernel binaries, the generated bytecode and constant pool are placed into 'vm.bytecode' metadata attached to members. pkg/vm/tool/dump_kernel tool can be used to disassemble bytecode and print constant pool. Differences between generated bytecode and original DBC are described in pkg/vm/lib/bytecode/dbc.dart. Format of constant pool is described in pkg/vm/lib/bytecode/constant_pool.dart. Currently, only a small subset of Dart language is supported. Bytecode generator will not emit vm.bytecode metadata for a member if its body has an unsupported operation. Change-Id: I27d9a361dc779ea115e5676508ee757c1754e05d Reviewed-on: https://dart-review.googlesource.com/49600 Reviewed-by: Samir Jindel <sjindel@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Reviewed-by: Zach Anderson <zra@google.com> Reviewed-by: Régis Crelier <regis@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com>
25 lines
528 B
Plaintext
25 lines
528 B
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack
|
|
PushConstant CP#0
|
|
PushConstant CP#2
|
|
IndirectStaticCall 1, CP#1
|
|
Drop1
|
|
PushConstant CP#3
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = String 'Hello, Dart Bytecode!'
|
|
[1] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
|
|
[3] = Null
|
|
}
|
|
]static method main() → dynamic {
|
|
core::print("Hello, Dart Bytecode!");
|
|
}
|