mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:58:29 +00:00
[vm][ffi] Add function name to FFI Trampolines.
This change will append the name of the associated function to the name of FFI trampolines. Previously the name of all FFI trampolines was "FfiTrampoline", which made them difficult to keep track of when there was more than one trampoline (i.e. more than one FFI function). TEST=Existing Change-Id: I7b5efa25dc9064d5615309331e2cfeaa01e4c9f6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242100 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Clement Skau <cskau@google.com>
This commit is contained in:
parent
a5a7b4c801
commit
44a4cfc2d7
|
@ -16,10 +16,13 @@ namespace ffi {
|
|||
// TODO(dartbug.com/36607): Cache the trampolines.
|
||||
FunctionPtr TrampolineFunction(const FunctionType& dart_signature,
|
||||
const FunctionType& c_signature,
|
||||
bool is_leaf) {
|
||||
bool is_leaf,
|
||||
const String& function_name) {
|
||||
Thread* thread = Thread::Current();
|
||||
Zone* zone = thread->zone();
|
||||
String& name = String::Handle(zone, Symbols::New(thread, "FfiTrampoline"));
|
||||
String& name =
|
||||
String::Handle(zone, Symbols::NewFormatted(thread, "FfiTrampoline_%s",
|
||||
function_name.ToCString()));
|
||||
const Library& lib = Library::Handle(zone, Library::FfiLibrary());
|
||||
const Class& owner_class = Class::Handle(zone, lib.toplevel_class());
|
||||
FunctionType& signature = FunctionType::Handle(zone, FunctionType::New());
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace ffi {
|
|||
|
||||
FunctionPtr TrampolineFunction(const FunctionType& dart_signature,
|
||||
const FunctionType& c_signature,
|
||||
bool is_leaf);
|
||||
bool is_leaf,
|
||||
const String& function_name);
|
||||
|
||||
} // namespace ffi
|
||||
|
||||
|
|
|
@ -1028,8 +1028,10 @@ Fragment BaseFlowGraphBuilder::BuildFfiAsFunctionInternalCall(
|
|||
Report::LongJump(language_error);
|
||||
}
|
||||
|
||||
const auto& name =
|
||||
String::Handle(parsed_function_->function().UserVisibleName());
|
||||
const Function& target = Function::ZoneHandle(
|
||||
compiler::ffi::TrampolineFunction(dart_type, native_type, is_leaf));
|
||||
compiler::ffi::TrampolineFunction(dart_type, native_type, is_leaf, name));
|
||||
|
||||
Fragment code;
|
||||
// Store the pointer in the context, we cannot load the untagged address
|
||||
|
|
Loading…
Reference in a new issue