Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::compiler::ffi::NativeCallingConvention Class Reference

#include <native_calling_convention.h>

Inheritance diagram for dart::compiler::ffi::NativeCallingConvention:
dart::ZoneAllocated

Public Member Functions

const NativeLocationsargument_locations () const
 
const NativeLocationreturn_location () const
 
bool contains_varargs () const
 
intptr_t StackTopInBytes () const
 
void PrintTo (BaseTextBuffer *f, bool multi_line=false) const
 
void PrintToMultiLine (BaseTextBuffer *f) const
 
const char * ToCString (Zone *zone, bool multi_line=false) const
 
const char * ToCString (bool multi_line=false) const
 
- Public Member Functions inherited from dart::ZoneAllocated
 ZoneAllocated ()
 
void * operator new (size_t size)
 
void * operator new (size_t size, Zone *zone)
 
void operator delete (void *pointer)
 

Static Public Member Functions

static const NativeCallingConventionFromSignature (Zone *zone, const NativeFunctionType &signature)
 

Detailed Description

Definition at line 29 of file native_calling_convention.h.

Member Function Documentation

◆ argument_locations()

const NativeLocations & dart::compiler::ffi::NativeCallingConvention::argument_locations ( ) const
inline

Definition at line 35 of file native_calling_convention.h.

35 {
36 return argument_locations_;
37 }

◆ contains_varargs()

bool dart::compiler::ffi::NativeCallingConvention::contains_varargs ( ) const
inline

Definition at line 39 of file native_calling_convention.h.

39{ return contains_varargs_; }

◆ FromSignature()

const NativeCallingConvention & dart::compiler::ffi::NativeCallingConvention::FromSignature ( Zone zone,
const NativeFunctionType signature 
)
static

Definition at line 980 of file native_calling_convention.cc.

982 {
983 const bool contains_varargs = signature.variadic_arguments_index() !=
985 // With struct return values, a possible pointer to a return value can
986 // occupy an argument position. Hence, allocate return value first.
987 const auto& return_location =
988 ResultLocation(zone, signature.return_type(), contains_varargs);
989 const auto& argument_locations =
990 ArgumentLocations(zone, signature.argument_types(), return_location,
991 signature.variadic_arguments_index());
992 return *new (zone) NativeCallingConvention(argument_locations,
994}
static constexpr intptr_t kNoVariadicArguments
Definition: native_type.h:486
static const NativeLocation & ResultLocation(Zone *zone, const NativeType &payload_type, bool has_varargs)
static NativeLocations & ArgumentLocations(Zone *zone, const ZoneGrowableArray< const NativeType * > &arg_reps, const NativeLocation &return_location, intptr_t var_args_index)

◆ PrintTo()

void dart::compiler::ffi::NativeCallingConvention::PrintTo ( BaseTextBuffer f,
bool  multi_line = false 
) const

Definition at line 1011 of file native_calling_convention.cc.

1012 {
1013 if (!multi_line) {
1014 f->AddString("(");
1015 }
1016 for (intptr_t i = 0; i < argument_locations_.length(); i++) {
1017 if (i > 0) {
1018 if (multi_line) {
1019 f->AddString("\n");
1020 } else {
1021 f->AddString(", ");
1022 }
1023 }
1024 argument_locations_[i]->PrintTo(f);
1025 }
1026 if (multi_line) {
1027 f->AddString("\n=>\n");
1028 } else {
1029 f->AddString(") => ");
1030 }
1031 return_location_.PrintTo(f);
1032 if (multi_line) {
1033 f->AddString("\n");
1034 }
1035}
intptr_t length() const
virtual void PrintTo(BaseTextBuffer *f) const

◆ PrintToMultiLine()

void dart::compiler::ffi::NativeCallingConvention::PrintToMultiLine ( BaseTextBuffer f) const

◆ return_location()

const NativeLocation & dart::compiler::ffi::NativeCallingConvention::return_location ( ) const
inline

Definition at line 38 of file native_calling_convention.h.

38{ return return_location_; }

◆ StackTopInBytes()

intptr_t dart::compiler::ffi::NativeCallingConvention::StackTopInBytes ( ) const

Definition at line 996 of file native_calling_convention.cc.

996 {
997 const intptr_t num_arguments = argument_locations_.length();
998 intptr_t max_height_in_bytes = 0;
999 for (intptr_t i = 0; i < num_arguments; i++) {
1000 max_height_in_bytes = Utils::Maximum(
1001 max_height_in_bytes, argument_locations_[i]->StackTopInBytes());
1002 }
1003 if (return_location_.IsPointerToMemory()) {
1004 const auto& ret_loc = return_location_.AsPointerToMemory();
1005 max_height_in_bytes =
1006 Utils::Maximum(max_height_in_bytes, ret_loc.StackTopInBytes());
1007 }
1008 return Utils::RoundUp(max_height_in_bytes, compiler::target::kWordSize);
1009}
static constexpr T Maximum(T x, T y)
Definition: utils.h:41
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition: utils.h:120
virtual bool IsPointerToMemory() const
const PointerToMemoryLocation & AsPointerToMemory() const
static constexpr intptr_t kWordSize
Definition: runtime_api.h:274

◆ ToCString() [1/2]

const char * dart::compiler::ffi::NativeCallingConvention::ToCString ( bool  multi_line = false) const

Definition at line 1045 of file native_calling_convention.cc.

1045 {
1046 return ToCString(Thread::Current()->zone(), multi_line);
1047}
static Thread * Current()
Definition: thread.h:362
const char * ToCString(Zone *zone, bool multi_line=false) const

◆ ToCString() [2/2]

const char * dart::compiler::ffi::NativeCallingConvention::ToCString ( Zone zone,
bool  multi_line = false 
) const

Definition at line 1037 of file native_calling_convention.cc.

1038 {
1039 ZoneTextBuffer textBuffer(zone);
1040 PrintTo(&textBuffer, multi_line);
1041 return textBuffer.buffer();
1042}
void PrintTo(BaseTextBuffer *f, bool multi_line=false) const

The documentation for this class was generated from the following files: