Files
sdk/pkg/dart2bytecode/bin/kernel_service.dart
T
Alexander Markov 05c2f3b0b1 [vm,dyn_modules] Hook interpreter to the standalone VM
When dynamic modules are enabled, standalone VM can now run bytecode
binaries directly. Also, if --interpreter flag is specified, Dart
source is compiled to bytecode and interpreter is used to run it.

This will allow us to test VM service capabilities including
debugging and hot reload against the interpreter.

TEST=manual

Change-Id: Ibb5a67f4844485c4ed90b8a7568dc42fa552fcac
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-06-24 05:59:21 -07:00

42 lines
1.5 KiB
Dart

// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:typed_data' show Uint8List;
import 'package:dart2bytecode/bytecode_generator.dart' show generateBytecode;
import 'package:dart2bytecode/options.dart' show BytecodeOptions;
import 'package:kernel/ast.dart' show Component, Library;
import 'package:kernel/binary/ast_to_binary.dart' show BytesSink;
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
import 'package:kernel/core_types.dart' show CoreTypes;
import 'package:kernel/target/targets.dart' show Target;
import '../../vm/bin/kernel_service.dart' as kernel_service;
Uint8List _generateBytecode(
Component component,
List<Library> libraries,
CoreTypes coreTypes,
ClassHierarchy hierarchy,
Target target,
bool enableAsserts,
) {
final byteSink = new BytesSink();
generateBytecode(component, byteSink,
libraries: libraries,
coreTypes: coreTypes,
hierarchy: hierarchy,
target: target,
options: BytecodeOptions(
enableAsserts: enableAsserts, emitSourcePositions: true));
return byteSink.builder.takeBytes();
}
// Wire up bytecode generator to the kernel service to avoid
// circular dependency between package:vm and package:dart2bytecode.
main([args]) {
kernel_service.bytecodeGenerator = _generateBytecode;
return kernel_service.main(args);
}