9f49b47823
This is a major revamp of bytecode metadata format. Now bytecode has its own serialization mechanisms. This CL adds 'bytecode component' metadata, which contains bytecode object table and string table. All references from bytecode (constant pools) to libraries, classes, members, types and strings now have a new format. References to frequently used objects are represented as indices in object table, while rarely used objects are written inline. This allows VM to cache frequently used objects while reading bytecode. Representation of strings is aligned with VM - string characters are stored in separate pools of one-byte and two-byte strings. This allows VM to avoid UTF-8 decoding and extra copying. Closure declarations are now explicit. Type parameters no longer require enslosing scopes when reading/writing them. Benchmarks: GenKernelKernelReadAllBytecode (Intel Core i5) +29.84% GenKernelKernelReadAllBytecode (Intel Xeon) +28.74% Change-Id: I4b80009733a8f8c038264af74f97c4e094b9e311 Reviewed-on: https://dart-review.googlesource.com/c/85469 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Régis Crelier <regis@google.com> Reviewed-by: Zach Anderson <zra@google.com>
70 lines
1.8 KiB
Plaintext
70 lines
1.8 KiB
Plaintext
library #lib;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
JumpIfNoAsserts L1
|
|
Push FP[-5]
|
|
AssertBoolean 0
|
|
JumpIfTrue L1
|
|
PushInt 0
|
|
PushInt 0
|
|
PushNull
|
|
PushConstant CP#1
|
|
IndirectStaticCall 3, CP#0
|
|
Drop1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ArgDesc num-args 3, num-type-args 0, names []
|
|
[1] = StaticICData target 'dart:core::_AssertionError::_throwNew', arg-desc CP#0
|
|
}
|
|
]static method test1(core::bool condition) → void {
|
|
assert(condition);
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
JumpIfNoAsserts L1
|
|
Push FP[-6]
|
|
InstanceCall 1, CP#1
|
|
AssertBoolean 0
|
|
JumpIfTrue L1
|
|
PushInt 0
|
|
PushInt 0
|
|
Push FP[-5]
|
|
InstanceCall 1, CP#2
|
|
PushConstant CP#4
|
|
IndirectStaticCall 3, CP#3
|
|
Drop1
|
|
L1:
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
[0] = ArgDesc num-args 1, num-type-args 0, names []
|
|
[1] = ICData dynamic target-name 'call', arg-desc CP#0
|
|
[2] = ICData dynamic target-name 'call', arg-desc CP#0
|
|
[3] = ArgDesc num-args 3, num-type-args 0, names []
|
|
[4] = StaticICData target 'dart:core::_AssertionError::_throwNew', arg-desc CP#3
|
|
}
|
|
]static method test2(() → core::bool condition, () → core::String message) → void {
|
|
assert([@vm.call-site-attributes.metadata=receiverType:() → dart.core::bool] condition.call(), [@vm.call-site-attributes.metadata=receiverType:() → dart.core::String] message.call());
|
|
}
|
|
[@vm.bytecode=
|
|
Bytecode {
|
|
Entry 0
|
|
CheckStack 0
|
|
PushNull
|
|
ReturnTOS
|
|
}
|
|
ConstantPool {
|
|
}
|
|
]static method main() → dynamic {}
|