Files
sdk/pkg/dart2bytecode/testcases/ffi.dart.expect
T
Alexander Markov 6195ea86bc [vm] Remove irregular type arguments parameter from factories
In the VM, factory constructors always had an extra "type arguments"
parameter, even if class is not generic. Factory constructor bodies
were using class type parameters instead of function type parameters.

This results in extra code when calling non-generic factories
which is slightly inefficient in terms of code size and performance.
Also, it creates an additional complexity throughout the system as
factories should be special cased in many places.

This change removes artificial "type arguments" parameter, treating
factory constructors basically as static methods. This matches
kernel AST representation.

TEST=ci

Change-Id: I957583cb2ce9a3c408699880a04036e06b01dd31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501762
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-05-12 06:11:15 -07:00

170 lines
5.0 KiB
Plaintext

Bytecode
Dynamic Module Entry Point: DART_SDK/pkg/dart2bytecode/testcases/ffi.dart::main
Library 'DART_SDK/pkg/dart2bytecode/testcases/ffi.dart'
name '#lib'
script 'DART_SDK/pkg/dart2bytecode/testcases/ffi.dart'
uses dart:ffi
Class '', script = 'DART_SDK/pkg/dart2bytecode/testcases/ffi.dart'
Function 'testVoidNoArg', static, reflectable, debuggable
parameters [] (required: 0)
return-type dynamic
Bytecode {
Entry 6
CheckStack 0
PushConstant CP#0
PushConstant CP#1
DirectCall CP#2, 2
PopLocal r2
AllocateContext 0, 1
PopLocal r0
Push r0
Push r2
StoreContextVar 0, 0
AllocateClosure CP#7
StoreLocal r5
Push r5
Push r0
StoreClosureElement 0
PopLocal r4
Push r4
Push r0
LoadContextParent
PopLocal r0
PopLocal r3
Push r3
StoreLocal r4
Push r4
UncheckedClosureCall CP#9, 1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef < dart:ffi::NativeFunction < FunctionType () -> dart:ffi::Void > >
[1] = ObjectRef const 3735928559
[2] = DirectCall 'dart:ffi::Pointer::fromAddress (constructor)', ArgDesc num-args 1, num-type-args 1, names []
[3] = Reserved
[4] = ClosureFunction 0
[5] = FfiCall
[6] = EndClosureFunctionScope
[7] = AllocateClosure 0, num-elements: 1, flags: 0
[8] = Reserved
[9] = ObjectRef ArgDesc num-args 1, num-type-args 0, names []
}
Closure DART_SDK/pkg/dart2bytecode/testcases/ffi.dart::testVoidNoArg::'#ffiClosure0' annotations const List<dynamic> [const dart:core::pragma {dart:core::pragma::name (field): 'vm:ffi:call-closure', dart:core::pragma::options (field): const dart:ffi::_FfiCall < FunctionType () -> dart:ffi::Void > {dart:ffi::_FfiCall::isLeaf (field): const false}}]
() -> void
ClosureCode {
Entry 2
Push FP[-5]
LoadClosureElement 0
PopLocal r0
CheckStack 0
Push r0
LoadContextVar 0, 0
FfiCall CP#5
ReturnTOS
}
Function 'testIntInt', static, reflectable, debuggable
parameters [] (required: 0)
return-type dynamic
Bytecode {
Entry 6
CheckStack 0
PushConstant CP#0
PushConstant CP#1
DirectCall CP#2, 2
PopLocal r2
AllocateContext 0, 1
PopLocal r0
Push r0
Push r2
StoreContextVar 0, 0
AllocateClosure CP#10
StoreLocal r5
Push r5
Push r0
StoreClosureElement 0
PopLocal r4
Push r4
Push r0
LoadContextParent
PopLocal r0
PopLocal r3
Push r3
StoreLocal r4
PushInt 42
Push r4
UncheckedClosureCall CP#12, 2
ReturnTOS
}
ConstantPool {
[0] = ObjectRef < dart:ffi::NativeFunction < FunctionType (dart:ffi::Int64) -> dart:ffi::Int32 > >
[1] = ObjectRef const 3735928559
[2] = DirectCall 'dart:ffi::Pointer::fromAddress (constructor)', ArgDesc num-args 1, num-type-args 1, names []
[3] = Reserved
[4] = ClosureFunction 0
[5] = Type dart:core::int
[6] = ObjectRef 'arg1'
[7] = SubtypeTestCache
[8] = FfiCall
[9] = EndClosureFunctionScope
[10] = AllocateClosure 0, num-elements: 1, flags: 0
[11] = Reserved
[12] = ObjectRef ArgDesc num-args 2, num-type-args 0, names []
}
Closure DART_SDK/pkg/dart2bytecode/testcases/ffi.dart::testIntInt::'#ffiClosure1' annotations const List<dynamic> [const dart:core::pragma {dart:core::pragma::name (field): 'vm:ffi:call-closure', dart:core::pragma::options (field): const dart:ffi::_FfiCall < FunctionType (dart:ffi::Int64) -> dart:ffi::Int32 > {dart:ffi::_FfiCall::isLeaf (field): const false}}]
(dart:core::int arg1) -> dart:core::int
ClosureCode {
Entry 2
Push FP[-6]
LoadClosureElement 0
PopLocal r0
CheckStack 0
JumpIfUnchecked L1
Push FP[-5]
PushConstant CP#5
PushNull
PushNull
PushConstant CP#6
AssertAssignable 1, CP#7
Drop1
L1:
PushNull
Drop1
Push FP[-5]
Push r0
LoadContextVar 0, 0
FfiCall CP#8
ReturnTOS
}
Function 'main', static, reflectable, debuggable
parameters [] (required: 0)
return-type void
Bytecode {
Entry 0
CheckStack 0
DirectCall CP#0, 0
Drop1
DirectCall CP#2, 0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = DirectCall 'DART_SDK/pkg/dart2bytecode/testcases/ffi.dart::testVoidNoArg', ArgDesc num-args 0, num-type-args 0, names []
[1] = Reserved
[2] = DirectCall 'DART_SDK/pkg/dart2bytecode/testcases/ffi.dart::testIntInt', ArgDesc num-args 0, num-type-args 0, names []
[3] = Reserved
}