This CL fixes number of fixed parameters in EntryOptional bytecode
and adds generation of CheckFunctionTypeArgs bytecode.
Change-Id: I3f9ccc86cb622291b2c58b5a4dbf47bb614380f2
Reviewed-on: https://dart-review.googlesource.com/62963
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Bytecode for 'assert' statement includes source positions, which are
different on Linux and Windows due to different newline characters.
This causes bytecode generator tests to fail on Windows, as expected
output includes source positions calculated on Linux.
To avoid these failures, new flag 'omitSourcePositions' is added
to bytecode generator and used in the bytecode generator test.
Change-Id: I296c9a70fa5f389b30a8982152513fdd57447c08
Reviewed-on: https://dart-review.googlesource.com/62880
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Argument type checks could use receiver to get instantiator type
arguments. Receiver could be captured and allocated in a context.
So initial context should be allocated before doing argument type
checks.
This CL also removes useless storing of uninitialized (null) context into
'parent' when allocating initial context.
Change-Id: Iec41f1bd474ba8cfccc360b96b3461fe760edddb
Reviewed-on: https://dart-review.googlesource.com/62706
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In addition:
* Use InstanceCall1 instead of InstanceCall2 for now as InstanceCall2
requires ICData objects with 2 checked arguments.
* Remove try-catch around bytecode generation as all operations are
supported and silent fallback is no longer needed.
Change-Id: Iead5a4997450cc47ef3bb3221647e733b7a72b62
Reviewed-on: https://dart-review.googlesource.com/62443
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
* Argument count corrected when calling generic instance method
(type arguments should be counted in a total arguments count in
InstanceCall1 instruction).
* Argument count corrected in ArgDesc when calling Map._fromLiteral
factory constructor.
* Type parameters of a factory constructor are treated as class type
parameters to ensure that instantiator type arguments are pushed.
This is needed as VM converts type parameters of factory constructors
into the class type parameters (they are distinct in kernel).
* Implicit parameter for passing type arguments to factory constructors
is now handled separately from function type arguments.
It is used as instantiator type arguments for instantiating types.
Unlike function type arguments, this parameter can be captured.
Change-Id: I25086a0df9cebca0b01e837e1c81b7f18b2d2270
Reviewed-on: https://dart-review.googlesource.com/61115
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This includes argument type checks and implicit type checks inserted
by front-end.
Also, lookup of getter functions is fixed for StaticICData constant
pool entry to include non-static getters (StaticICData is used for
all kinds of direct calls including super calls).
Change-Id: Ic265ea6a7fca2bfcc9a96e4ede268ec8e693ff41
Reviewed-on: https://dart-review.googlesource.com/60822
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
VM requires to pass null type arguments to factory constructors of
non-generic classes. This includes native implementation of native
factory constructors.
Bytecode generation for bodies of native factory constructors is fixed
to push this extra argument for NativeCall.
Change-Id: I741a783c6964da88ecd0bfd1d2ec4aa3b1868708
Reviewed-on: https://dart-review.googlesource.com/60200
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Implicit argument for type arguments vector is not counted
in the number of arguments in ArgumentsDescriptor when calling
generic functions, but VM requires it to be counted
when calling factory constructors.
Bytecode generator is adjusted to cope with this discrepancy.
Change-Id: Id041563dfc68491b87593bcb6dff5cae64bfedc6
Reviewed-on: https://dart-review.googlesource.com/58961
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
This CL contains 2 optimizations:
* instantiator type arguments are reused if possible;
* instantiator and function type arguments are not loaded if they are
not needed for a particular type being instantiated.
Change-Id: Id1f6e5385051044b3b9f78cef884a917e65e801d
Reviewed-on: https://dart-review.googlesource.com/58680
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Library reference is added for private names in order to resolve them correctly.
Invocation kind byte supersedes VM-specific name mangling and makes
ConstantICData more uniform with ConstantStaticICData.
Change-Id: I66542356209d98b3d0cf0e6b8eb19bda052c6b7e
Reviewed-on: https://dart-review.googlesource.com/57485
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This CL adds experimental option --drop-ast to the gen_kernel tool in
order to remove AST bodies of members with bytecode.
Change-Id: Ib5f02eb189ec1ccd9fa77159c175fc3774998ce5
Reviewed-on: https://dart-review.googlesource.com/55262
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
While generating bytecode, avoid flattening of type arguments used for
instance allocations (and thus avoid creating new types when substituting
type parameters). This is a workaround to limitation of kernel metadata
which is unable to serialize references to nodes (such as DartType)
not reachable from root Component.
Change-Id: I52c5e21873d0159d389895dc570a9e7283f2a6ff
Reviewed-on: https://dart-review.googlesource.com/52643
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
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>