Passing nullability rather than forcing kLegacy helps slightly reduce the number
of Types in the VM and in snapshots.
This allows to remove the kludge about declaration type of Null being kNullable.
Also pass nullability when creating a simple type may help.
Note that CFE is still producing super types and some interface types that are
non-nullable, even with nnbd features disabled. But this should get fixed and
further reduce the number of types in the snapshot.
Change-Id: I397f00902026ee5bc91d36328f4156427702efdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124480
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
VM creates Script objects with kKernelTag only, so this CL cleans up
all uses of script tags and Script::kind() along with code
which is no longer reachable.
Change-Id: Ia765e7757264aa614e18eddd16d21937f855c129
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123889
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
There are could be conflicts in inferred types attributes between
function and its closures, so attributes for closures should be
written separately.
Change-Id: Iae395d73fdc2dfcb6b55137176f198f02e9b079b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121907
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In order to support obfuscation, string constants are decoupled
from public names in bytecode (names are obfuscated, but string
constants aren't). List of protected names is written in a separate
section in bytecode component.
Obfuscator is extended to support getter and setter
names coming from bytecode.
Change-Id: I8e8d820d1a8b97e32e8ad1b064b827bdb017430b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121261
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Consume the extension flag setting for functions and the extension flag and is late
flags for fields when reading kernel file and set bit in Function/Field objects.
Change-Id: I661d30d53e817d968151d2b95474a6daf918de13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118000
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
AOT transformations add vm.direct-call.metadata with devirtualization
information to AST nodes.
Bytecode generator should take this information into account when
generating bytecode in case of AOT. Bytecode format is extended with
CheckReceiverForNull and UncheckedDirectCall instructions, and
DirectCallViaDynamicForwarder constant pool entry in order to represent
devirtualized calls.
Change-Id: I697432ddd0b58d2d0413715132ba5e90eb606ec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/119201
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
* Clear bytecode for all functions including closures and field
initializers, so their object pools are not preventing constant
objects from being reclaimed by GC.
* Bytecode reader should use dynamic invocation forwarders in AOT too.
* Fix assertion in RegisterTypeArgumentsUse (type arguments in
generic closure functions could come from _prependTypeArguments call).
Change-Id: I2154c87f30720607288ec12012a6d0ec1db618dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118365
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This change fixes the following problems:
* In precompiler, all PcDescriptor entries which do not have
try_index are ignored, so try_index should be always set when building
PcDescriptors for bytecode try-blocks.
* Precompiler should use more general binary_declaration_offset()
instead of kernel_offset() as a hashcode for a Field.
* Querying of PrecodueAttributesMetadata should not try to use
kernel AST if function/field is declared in bytecode.
Also, added printing of operands for LoadUntagged IL instruction to
simplify debugging, and excluded precompiler.{h,cc} from
DART_PRECOMPILED_RUNTIME.
Change-Id: I563b81a0b31b5b268709b1b7b0c3bea4e76813d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118120
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In bytecode we have enough information to "finalize" type parameters
immediately while reading bytecode. Finalization of a type parameter is
just calculating its index in type arguments vector.
Change-Id: I6f47821b6ddb44441b3ca8c682262a38c454eeb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117773
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Lazy lookup of source and line starts for scripts loaded from bytecode
(implemented in https://dart-review.googlesource.com/c/sdk/+/112680)
relied on source == Symbols::Empty() as an indication that lazy lookup is
needed. However, when Script object is written into app-jit snapshot,
its source is set to null which disables lazy lookup.
This change introduces 'LazyLookupSourceAndLineStarts' flag in Script
objects to avoid relying on value of 'source'.
Fixes service/valid_source_locations_test with bytecode in app-jit mode.
Change-Id: I38174a13d745a1ad9fecad466df745b1df527878
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117214
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Introduced a new code path to load declaration of a referenced class when
loading bytecode, if referenced class is from the same binary. In such case
it's possible to reuse current BytecodeReaderHelper.
Also, AlternativeReadingScope is simplified to save/restore only reader
offset (which is needed in most cases), while saving/restoring data is
still available in AlternativeReadingScopeWithNewData.
This change fixes stack overflow while reading deep class hierarchies in the
tests co19_2/Language/Types/Interface_Types/subtype_t27 and
co19_2/Language/Types/Interface_Types/subtype_t28 with bytecode in
vm-kernel-linux-debug-ia32 configuration.
Change-Id: Iffb1678286c6926926fab465f70251992d451241
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117204
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Remove this unnecessary field. Both ExceptionHandlerList and ExceptionHandlers not use token position. TokenPosition passed from CatchBlockEntryInstr() is always NoSource.
Change-Id: I3857ff3d1f9217f565c2d159fa980350ebd4bc47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117040
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
Before this change, there were 2 ways of getting target of dynamic invocation
forwarder: Function::GetTargetOfDynamicInvocationForwarder() which looks up
using the name, and Function::ForwardingTarget() which returns a target saved
when dynamic invocation forwarder was created.
Apparently we should use Function::ForwardingTarget() when compiling dynamic
invocation forwarder, as we might find a different function after hot reload.
It was the last use of GetTargetOfDynamicInvocationForwarder(), so cleaned it up.
Fixes language_2/flatten_test/01 with bytecode in hot reload mode.
Change-Id: Ibe3117c16509fe5d94fcdd1a2a2b12f2049efad2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117014
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This fixes service/pause_on_unhandled_async_exceptions_test in compiled bytecode
mode, but not yet in interpreted bytecode mode.
Improve debugger verbosity.
Change-Id: I89e32179b0a3f043716d5117f958bf6a0de3ccac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116483
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
VM no longer relies on distinct ICData entries in constant pool, and
it no longer creates actual ICData objects.
This change introduces new DynamicCall constant pool entry which is
* de-duplicated;
* stores arguments descriptor inline instead of allocating a separate
constant pool entry and referencing it by index;
* reserves extra slot in constant pool (like other call constants), so
we can eventually remove creation of extra UnlinkedCall objects.
Change-Id: I8d21954803ca5be5b6fc8335b700e8a9086245cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116120
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Generated rethrow statements do not require a 'DebugCheck', but explicit rethrow
statements do, so that user breakpoints can be set on rethrow.
Add a IsDebuggable flag on bytecode closures and set it properly.
Remove unused code in a service test.
Add verbosity to debugger.
Change-Id: Ia436cbe62e38cfaec6f9fdf7f8cc2ee5607228e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/115602
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
* Set parent for TypeParameters created in createExpressionEvaluationComponent.
* Resolve references from bytecode to an expression evaluation class
using real class. Expression evaluation class could be referenced
from type parameters.
* Avoid registering expression evaluation classes in hierarchy. They
shouldn't be discovered through direct subclasses or implementors,
as expression evaluation classes don't have cids.
* Add :function_type_arguments_var local variable to bytecode local
variables info, so expression evaluation can find function type
arguments which are in scope.
Change-Id: I515431a989b4d02af4ecf90579931dd59d3acadd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/114182
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Collect token positions of field declared in bytecode.
Improve debugger debugging: Disassemble both bytecode and code when applicable.
Change-Id: I56188cf24ef4bfe8a93cce11c2f4505152abdd02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112680
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This is needed for function subtype checks and mimics the behavior of
kernel AST reader (TypeTranslator::LoadAndSetupTypeParameters).
Fixes the following tests in bytecode mode:
co19_2/Language/Generics/typedef_A04_t06
co19_2/Language/Generics/typedef_A04_t07
Change-Id: I70fc86e811e77b2adc31d7bfce9ba55c5838666f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112144
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>