Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dart::compiler::ffi::NativeCompoundType Class Referenceabstract

#include <native_type.h>

Inheritance diagram for dart::compiler::ffi::NativeCompoundType:
dart::compiler::ffi::NativeType dart::ZoneAllocated dart::compiler::ffi::NativeStructType dart::compiler::ffi::NativeUnionType

Public Member Functions

const NativeTypesmembers () const
 
virtual bool IsCompound () const
 
virtual intptr_t SizeInBytes () const
 
virtual intptr_t AlignmentInBytesField () const
 
virtual intptr_t AlignmentInBytesStack (bool is_vararg=false) const
 
virtual bool Equals (const NativeType &other) const
 
virtual void PrintTo (BaseTextBuffer *f, bool multi_line=false, bool verbose=true) const
 
virtual bool ContainsOnlyFloats (Range range) const =0
 
intptr_t NumberOfWordSizeChunksOnlyFloat () const
 
intptr_t NumberOfWordSizeChunksNotOnlyFloat () const
 
virtual bool ContainsUnalignedMembers (intptr_t offset=0) const =0
 
bool ContainsHomogeneousFloats () const
 
virtual intptr_t NumPrimitiveMembersRecursive () const =0
 
virtual const NativePrimitiveTypeFirstPrimitiveMember () const
 
virtual intptr_t PrimitivePairMembers (const NativePrimitiveType **first, const NativePrimitiveType **second, intptr_t offset_in_members=0) const
 
- Public Member Functions inherited from dart::compiler::ffi::NativeType
virtual bool IsPrimitive () const
 
const NativePrimitiveTypeAsPrimitive () const
 
virtual bool IsArray () const
 
const NativeArrayTypeAsArray () const
 
const NativeCompoundTypeAsCompound () const
 
virtual bool IsStruct () const
 
const NativeStructTypeAsStruct () const
 
virtual bool IsInt () const
 
virtual bool IsFloat () const
 
virtual bool IsVoid () const
 
virtual bool IsSigned () const
 
virtual bool IsExpressibleAsRepresentation () const
 
virtual Representation AsRepresentation () const
 
Representation AsRepresentationOverApprox (Zone *zone_) const
 
virtual NativeTypeSplit (Zone *zone, intptr_t index) const
 
const NativeTypeWidenTo4Bytes (Zone *zone) const
 
const NativeTypeWidenTo8Bytes (Zone *zone) const
 
const NativeTypeExtend (Zone *zone, ExtensionStrategy extension) const
 
const char * ToCString (Zone *zone, bool multi_line=false, bool verbose=true) const
 
const char * ToCString () const
 
virtual ~NativeType ()
 
- 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)
 

Protected Member Functions

 NativeCompoundType (const NativeTypes &members, intptr_t size, intptr_t alignment_field, intptr_t alignment_stack)
 
virtual void PrintCompoundType (BaseTextBuffer *f) const =0
 
virtual void PrintMemberOffset (BaseTextBuffer *f, intptr_t member_index) const
 
- Protected Member Functions inherited from dart::compiler::ffi::NativeType
 NativeType ()
 

Protected Attributes

const NativeTypesmembers_
 
const intptr_t size_
 
const intptr_t alignment_field_
 
const intptr_t alignment_stack_
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::compiler::ffi::NativeType
static const NativeTypeFromAbstractType (Zone *zone, const AbstractType &type, const char **error)
 
static const NativeTypeFromTypedDataClassId (Zone *zone, classid_t class_id)
 
static NativePrimitiveTypeFromRepresentation (Zone *zone, Representation rep)
 

Detailed Description

Definition at line 319 of file native_type.h.

Constructor & Destructor Documentation

◆ NativeCompoundType()

dart::compiler::ffi::NativeCompoundType::NativeCompoundType ( const NativeTypes members,
intptr_t  size,
intptr_t  alignment_field,
intptr_t  alignment_stack 
)
inlineprotected

Definition at line 366 of file native_type.h.

370 : members_(members),
371 size_(size),
372 alignment_field_(alignment_field),
373 alignment_stack_(alignment_stack) {}
const NativeTypes & members() const

Member Function Documentation

◆ AlignmentInBytesField()

virtual intptr_t dart::compiler::ffi::NativeCompoundType::AlignmentInBytesField ( ) const
inlinevirtual

Implements dart::compiler::ffi::NativeType.

Definition at line 326 of file native_type.h.

326{ return alignment_field_; }

◆ AlignmentInBytesStack()

virtual intptr_t dart::compiler::ffi::NativeCompoundType::AlignmentInBytesStack ( bool  is_vararg = false) const
inlinevirtual

Implements dart::compiler::ffi::NativeType.

Reimplemented in dart::compiler::ffi::NativeStructType.

Definition at line 327 of file native_type.h.

327 {
328 return alignment_stack_;
329 }

◆ ContainsHomogeneousFloats()

bool dart::compiler::ffi::NativeCompoundType::ContainsHomogeneousFloats ( ) const

Definition at line 1071 of file native_type.cc.

1071 {
1073}
static bool ContainsHomogeneousFloatsInternal(const NativeTypes &types)

◆ ContainsOnlyFloats()

virtual bool dart::compiler::ffi::NativeCompoundType::ContainsOnlyFloats ( Range  range) const
pure virtual

◆ ContainsUnalignedMembers()

virtual bool dart::compiler::ffi::NativeCompoundType::ContainsUnalignedMembers ( intptr_t  offset = 0) const
pure virtual

◆ Equals()

bool dart::compiler::ffi::NativeCompoundType::Equals ( const NativeType other) const
virtual

Reimplemented from dart::compiler::ffi::NativeType.

Definition at line 358 of file native_type.cc.

358 {
359 if (!other.IsCompound()) {
360 return false;
361 }
362 const auto& other_compound = other.AsCompound();
363 const auto& other_members = other_compound.members_;
364 if (other_members.length() != members_.length()) {
365 return false;
366 }
367 for (intptr_t i = 0; i < members_.length(); i++) {
368 if (!members_[i]->Equals(*other_members[i])) {
369 return false;
370 }
371 }
372 return true;
373}
intptr_t length() const
virtual bool Equals(const NativeType &other) const

◆ FirstPrimitiveMember()

const NativePrimitiveType & dart::compiler::ffi::NativeCompoundType::FirstPrimitiveMember ( ) const
virtual

Implements dart::compiler::ffi::NativeType.

Definition at line 844 of file native_type.cc.

844 {
846 for (intptr_t i = 0; i < members().length(); i++) {
847 if (members_[i]->NumPrimitiveMembersRecursive() >= 1) {
848 return members_[i]->FirstPrimitiveMember();
849 }
850 }
852}
virtual intptr_t NumPrimitiveMembersRecursive() const =0
#define ASSERT(E)
#define UNREACHABLE_THIS()
Definition native_type.h:25

◆ IsCompound()

virtual bool dart::compiler::ffi::NativeCompoundType::IsCompound ( ) const
inlinevirtual

Reimplemented from dart::compiler::ffi::NativeType.

Definition at line 323 of file native_type.h.

323{ return true; }

◆ members()

const NativeTypes & dart::compiler::ffi::NativeCompoundType::members ( ) const
inline

Definition at line 321 of file native_type.h.

321{ return members_; }

◆ NumberOfWordSizeChunksNotOnlyFloat()

intptr_t dart::compiler::ffi::NativeCompoundType::NumberOfWordSizeChunksNotOnlyFloat ( ) const

Definition at line 995 of file native_type.cc.

995 {
996 const intptr_t total_chunks =
997 Utils::RoundUp(SizeInBytes(), compiler::target::kWordSize) /
998 compiler::target::kWordSize;
999 return total_chunks - NumberOfWordSizeChunksOnlyFloat();
1000}
static constexpr T RoundUp(T x, uintptr_t alignment, uintptr_t offset=0)
Definition utils.h:105
virtual intptr_t SizeInBytes() const

◆ NumberOfWordSizeChunksOnlyFloat()

intptr_t dart::compiler::ffi::NativeCompoundType::NumberOfWordSizeChunksOnlyFloat ( ) const

Definition at line 978 of file native_type.cc.

978 {
979 // O(n^2) implementation, but only invoked for small structs.
980 ASSERT(SizeInBytes() <= 16);
981 const auto this_range = Range::StartAndEnd(0, SizeInBytes());
982 const intptr_t size = SizeInBytes();
983 intptr_t float_only_chunks = 0;
984 for (intptr_t offset = 0; offset < size;
985 offset += compiler::target::kWordSize) {
986 const auto chunk_range =
987 Range::StartAndLength(offset, compiler::target::kWordSize);
988 if (ContainsOnlyFloats(chunk_range.Intersect(this_range))) {
989 float_only_chunks++;
990 }
991 }
992 return float_only_chunks;
993}
virtual bool ContainsOnlyFloats(Range range) const =0
static Range StartAndLength(intptr_t start_inclusive, intptr_t length)
Definition range.h:28
static Range StartAndEnd(intptr_t start_inclusive, intptr_t end_exclusive)
Definition range.h:35
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259
Point offset

◆ NumPrimitiveMembersRecursive()

virtual intptr_t dart::compiler::ffi::NativeCompoundType::NumPrimitiveMembersRecursive ( ) const
pure virtual

◆ PrimitivePairMembers()

intptr_t dart::compiler::ffi::NativeCompoundType::PrimitivePairMembers ( const NativePrimitiveType **  first,
const NativePrimitiveType **  second,
intptr_t  offset_in_members = 0 
) const
virtual

Implements dart::compiler::ffi::NativeType.

Definition at line 874 of file native_type.cc.

877 {
878 for (intptr_t i = 0; i < members().length(); i++) {
879 offset_in_members =
880 members_[i]->PrimitivePairMembers(first, second, offset_in_members);
881 }
882 return offset_in_members;
883}

◆ PrintCompoundType()

virtual void dart::compiler::ffi::NativeCompoundType::PrintCompoundType ( BaseTextBuffer f) const
protectedpure virtual

◆ PrintMemberOffset()

virtual void dart::compiler::ffi::NativeCompoundType::PrintMemberOffset ( BaseTextBuffer f,
intptr_t  member_index 
) const
inlineprotectedvirtual

Reimplemented in dart::compiler::ffi::NativeStructType.

Definition at line 381 of file native_type.h.

382 {}

◆ PrintTo()

void dart::compiler::ffi::NativeCompoundType::PrintTo ( BaseTextBuffer f,
bool  multi_line = false,
bool  verbose = true 
) const
virtual

Reimplemented from dart::compiler::ffi::NativeType.

Definition at line 743 of file native_type.cc.

745 {
747 f->AddString("(");
748 f->Printf("size: %" Pd "", SizeInBytes());
749 if (verbose) {
750 f->Printf(", field alignment: %" Pd ", ", AlignmentInBytesField());
751 f->Printf("stack alignment: %" Pd ", ", AlignmentInBytesStack());
752 f->AddString("members: {");
753 if (multi_line) {
754 f->AddString("\n ");
755 }
756 for (intptr_t i = 0; i < members_.length(); i++) {
757 if (i > 0) {
758 if (multi_line) {
759 f->AddString(",\n ");
760 } else {
761 f->AddString(", ");
762 }
763 }
764 PrintMemberOffset(f, i);
765 members_[i]->PrintTo(f);
766 }
767 if (multi_line) {
768 f->AddString("\n");
769 }
770 f->AddString("}");
771 }
772 f->AddString(")");
773 if (multi_line) {
774 f->AddString("\n");
775 }
776}
virtual intptr_t AlignmentInBytesStack(bool is_vararg=false) const
virtual void PrintMemberOffset(BaseTextBuffer *f, intptr_t member_index) const
virtual intptr_t AlignmentInBytesField() const
virtual void PrintCompoundType(BaseTextBuffer *f) const =0
#define Pd
Definition globals.h:408

◆ SizeInBytes()

virtual intptr_t dart::compiler::ffi::NativeCompoundType::SizeInBytes ( ) const
inlinevirtual

Implements dart::compiler::ffi::NativeType.

Definition at line 325 of file native_type.h.

325{ return size_; }

Member Data Documentation

◆ alignment_field_

const intptr_t dart::compiler::ffi::NativeCompoundType::alignment_field_
protected

Definition at line 377 of file native_type.h.

◆ alignment_stack_

const intptr_t dart::compiler::ffi::NativeCompoundType::alignment_stack_
protected

Definition at line 378 of file native_type.h.

◆ members_

const NativeTypes& dart::compiler::ffi::NativeCompoundType::members_
protected

Definition at line 375 of file native_type.h.

◆ size_

const intptr_t dart::compiler::ffi::NativeCompoundType::size_
protected

Definition at line 376 of file native_type.h.


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