LINK HTML Guard 3.3.4 Crack [TOP]ed
Download ===> https://cinurl.com/2sVkjS
There are virtual pointers for direct and indirect base classes.Although primary non-virtual bases do not get secondary virtualpointers, they do not otherwise affect the ordering.Primary virtual bases require a secondary virtual pointer in the VTTbecause the derived class with which they will share a virtual pointeris determined by the most derived class in the hierarchy.Secondary virtual pointers may be required for base classes that donot require secondary VTTs. A virtual base with no virtual bases ofits own does not require a VTT, but does require a virtual pointerentry in the VTT.Virtual VTTs:For each proper virtual base classes ininheritance graph preorder, construct a sub-VTT as in (2) above.The virtual VTT addresses come last because they are only passedto the virtual base class constructors for the complete object.Each virtual table address in the VTT is the address to be assigned to therespective virtual pointer,i.e. the address past the end of the typeinfo pointer(the address of the first virtual function pointer, if there are any),not of the first vcall offset.It is required that the VTT for a complete class D be identical instructure to the sub-VTT for the same class D as a base of anotherclass E derived from it,so that the constructors for D can depend on that structure.Therefore, the various components of its VTT are present based on therules given, even if they point to theD complete object virtual table or its secondary virtual tables.That is, secondary VTTs are present for all bases with virtual bases(including the virtual bases themselves,which have their secondary VTTs in the virtual VTT section),and secondary virtual pointers are present for all bases with eithervirtual bases or virtual function declarations overridden along avirtual path.The only exception is that a primary non-virtual base class does notrequire a secondary virtual pointer.Parts (1) and (3) of a primary (not secondary, i.e. nested) VTT,that is the primary and secondary virtual pointers,are used for the final initialization of an object's virtual pointersbefore the full-object initialization and later use,and must therefore point to the main virtual table group for the class.Those bases which do not have secondary virtual pointers in the VTThave their virtual pointers explicitly initialized to the main virtualtable group by the constructors(see Subobject Construction and Destruction).The virtual pointers in the secondary VTTs and virtual VTTs are used forsubobject construction,and may always point to special construction virtual tables laid out asdescribed in the following subsections.However, it will sometimes be possible to use either the full-objectvirtual table for the base class,or its secondary virtual table for the full class being constructed.This ABI does not specify a choice,nor does it specify names for the construction virtual tables,so the constructors must use the VTT rather than assuming that aparticular construction virtual table exists.For example, suppose we have the following hierarchy: class A1 { int i; }; class A2 { int i; virtual void f(); }; class V1 : public A1, public A2 { int i; };// A2 is primary base of V1, A1 is non-polymorphic class B1 { int i; }; class B2 { int i; }; class V2 : public B1, public B2, public virtual V1 { int i; };// V2 has no primary base, V1 is secondary base class V3 {virtual void g(); }; class C1 : public virtual V1 { int i; };// C1 has no primary base, V1 is secondary base class C2 : public virtual V3, public virtual V2 { int i; };// C2 has V3 primary (nearly-empty virtual) base, V2 is secondary base class X1 { int i; }; class C3 : public X1 { int i; }; class D : public C1, public C2, public C3 { int i; };// C1 is primary base, C2 is secondary base, C3 is non-polymorphicThen the VTT for D would appear in the following order,where indenting indicates the sub-VTT structure,and asterisks (*) indicate that construction virtual tables instead ofcomplete object virtual tables are required. // 1. Primary virtual pointer: [0] D has virtual bases (complete object vptr) // 2. Secondary VTTs: [1] C1 * (has virtual base) [2] V1-in-C1 in D (secondary vptr) [3] C2 * (has virtual bases) [4] V3-in-C2 in D (primary vptr) [5] V2-in-C2 in D (secondary vptr) [6] V1-in-C2 in D (secondary vptr) // 3. Secondary virtual pointers: // (no C1-in-D -- primary base) [7] V1-in-D (V1 is virtual) [8] C2-in-D (preorder; has virtual bases) [9] V3-in-D (V3 is virtual) [10] V2-in-D (V2 is virtual) // (For complete object D VTT, these all can point to the // secondary vtables in the D vtable, the V3-in-D entry // will be the same as the C2-in-D entry, as that is the active // V3 virtual base in the complete object D. In the sub-VTT for // D in a class derived from D, some might be construction // virtual tables.) // 4. Virtual VTTs: // (V1 has no virtual bases). [11] V2 * (V2 has virtual bases) [12] V1-in-V2 in D * (secondary vptr, V1 is virtual) (A2 is primary base of V1) // (V3 has no virtual bases)If A2 is a virtual base of V1,the VTT will contain more elements(exercise left to the astute reader). 2.6.3 Construction Virtual Table Layout The construction virtual tables for a complete object are emitted in the same object file as the virtual table.So the virtual table structures for a complete object of class C include,in no particular order:the main virtual table group for C,i.e. the virtual table to which the primary virtual pointer(at offset 0) points,along with its proper base class virtual tablesin order of allocation,including virtual base class virtual tables;any construction virtual tables required for non-virtual and virtual bases;andthe VTT array for C, providing location information for the above.The VTT array is referenced via its own mangled external name,and the construction virtual tables are accessed via the VTT array,so the latter do not have external names. 2.6.4 Construction Virtual Table entries The construction virtual table group for aproper base class subobject B (of derived class D)does not have the same entries in the sameorder as the main virtual table group for a complete object B,as described in Virtual Table Layout above.Some of the base class subobjects may not need construction virtual tables,which will therefore not be present in the construction virtual table group,even though the subobject virtual tables are present in the main virtualtable groupfor the complete object.The values of some construction virtual table entries will differfrom the corresponding entries in either the main virtual tablegroup for B or the virtual table group for B-in-D,primarily because the virtual bases of B will be at different relativeoffsets in a D object than in a standalone B object,as follows:Virtual base class offsets reflect the positions of the virtual baseclasses in the full D object.Similarly, vcall offsets reflect the relative positions of theoverridden and overriding classes within the complete object D.The offset-to-top fields refer to B(and B's in particular will therefore be zero).The RTTI pointers point to B's RTTI.Only functions in B and its base classes are considered for virtualfunction resolution. 2.7 Array Operator new Cookies When operator new is used to create a new array,a cookie is usually stored to remember the allocated length(number of array elements)so that it can be deallocated correctly.Specifically: No cookie is required if the array element type T has a trivial destructor (12.4 [class.dtor]) and the usual (array) deallocation function (3.7.3.2 [basic.stc.dynamic.deallocation]) function does not take two arguments. (Note: if the usual array deallocation function takes two arguments, then it is a member function whose second argument is of type size_t. The standard guarantees (12.5 [class.free]) that this function will be passed the number of bytes allocated with the previous array new expression.) No cookie is required if the new operator being used is ::operator new[](size_t, void*). Otherwise, this ABI requires a cookie, setup as follows: The cookie will have size sizeof(size_t). Let align be the maximum alignment of size_t and an element of the array to be allocated. Let padding be the maximum of sizeof(size_t) and align bytes. The space allocated for the array will be the space required by the array itself plus padding bytes. The alignment of the space allocated for the array will be align bytes. The array data will begin at an offset of align bytes from the space allocated for the array. The cookie will be stored in the sizeof(size_t) bytes immediately preceding the array data. These rules have the following consequences: The array elements and the cookie are all aligned naturally. Padding will be required if sizeof(size_t) is smaller than the array element alignment, and if present will precede the cookie. Given the above, the following is pseudocode for processingnew(ARGS) T[n]: if T has a trivial destructor (C++ standard, 12.4/3) padding = 0 else if we're using ::operator new[](size_t, void*) padding = 0 else padding = max(sizeof(size_t), alignof(T)) p = operator new[](n * sizeof(T) + padding, ARGS) p1 = (T*) ( (char *)p + padding ) if padding > 0 *( (size_t *)p1 - 1) = n for i = [0, n) create a T, using the default constructor, at p1[i] return p1 2.8 Initialization Guard Variables If a function-scope static variable or a static data member with vaguelinkage (i.e., a static data member of a class template) isdynamically initialized, then there is an associated guard variablewhich is used to guarantee that construction occurs only once. The guard variable's name is mangledbased on the mangling of the guarded object name. Thus, forfunction-scope static variables, if multiple instances of the functionbody are emitted (e.g., due to inlining), each function uses the sameguard variable to ensure that the function-scope static is initializedonly once. Similarly, if a static data member is instantiated inmultiple object files, the initialization code in each object filewill use the same guard variable to ensure that the static data memberis initialized only once.The size of the guard variable is 64 bits.The first byte (i.e. the byte at the address of the full variable)shall contain the value 0 prior to initialization ofthe associated variable, and 1 after initialization is complete.Usage of the other bytes of the guard variable is implementation-defined.See Section 3.3.3for the API for references to this guard variable. 2.9 Run-Time Type Information (RTTI) 2.9.1 General The C++ programming language definition implies that information abouttypes be available at run time for three distinct purposes: to support the typeid operator, to match an exception handler with a thrown object, and to implement the dynamic_cast operator.(c) only requires type information about dynamic class types,but (a) and (b) may apply to other types as well;for example, when a pointer to an int is thrown,it can be caught by a handler that catches "int const*".It is intended that two type_info pointers point to equivalent typedescriptions if and only if the pointers are equal.An implementation must satisfy this constraint,e.g. by using symbol preemption, COMDAT sections, or other mechanisms.Note that the full structure described by an RTTI descriptor mayinclude incomplete types not required by the Standard to be completed,although not in contexts where it would cause ambiguity.Therefore, any cross-references within the RTTI to types not known tobe complete must be weak symbol references. 2.9.2 Place of Emission It is desirable to minimize the number of places where aparticular bit of RTTI is emitted.For dynamic class types,a similar problem occurs for virtual function tables,and hence the RTTI descriptor should be emittedwith the primary virtual table for that type.For other types, they must be emitted at the locationwhere their use is implied:the object file containing the typeid, throw or catch.Basic type information (e.g. for "int", "bool", etc.)will be kept in the run-time support library.Specifically, the run-time support libraryshould contain type_info objects for the typesX, X* and X const*,for every X in: void, std::nullptr_t,bool, wchar_t, char, unsigned char, signed char,short, unsigned short, int, unsigned int, long, unsigned long, long long,unsigned long long, float, double, long double, char8_t, char16_t, char32_t,and the IEEE 754r decimal and half-precision floating point types.Each of the type_info objects for X shall have typeabi::__fundamental_type_info (or a type derived therefrom),whereas the objects corresponding to X* and X const* shall have typeabi::__pointer_type_info (or a type derived therefrom).(Note that various other type_info objects for class types may residein the run-time support library by virtue of the preceding rules,e.g. that of std::bad_alloc.) 2.9.3 The typeid OperatorThe typeid operator produces a reference to a std::type_info structurewith the following public interface (18.5.1): namespace std { class type_info { public:virtual ~type_info();bool operator==(const type_info &) const;bool operator!=(const type_info &) const;bool before(const type_info &) const;const char* name() const; private:type_info (const type_info& rhs);type_info& operator= (const type_info& rhs); }; }After linking and loading,only one std::type_info structure is accessible via the external namedefined by this ABI for any particular complete type symbol(see Vague Linkage).Therefore,except for direct or indirect pointers to incomplete types,the equality and inequality operators can bewritten as address comparisonswhen operating on those type_info objects:two type_info structures describe the same typeif and only if they are the same structure (at the same address).However, in the case of pointer types,directly or indirectly pointing to incomplete class types,a more complex comparison is required,described below with the RTTI layout of pointer types.The name() member function returns the address of anNTBS, unique to the type, containingthe mangled name of the type.The mangled name of the NTBS is alsodefined by the ABI to allow consistent reference to it, andthe Vague Linkage section specifies how toproduce a unique copy.In a flat address space(such as that of the Itanium architecture),the operator==, operator!=, and before()members are easily implemented in terms ofan address comparison of the name NTBS.This implies that the type information must keep a description of the public,unambiguous inheritance relationship of a type, as well as the constand volatile qualifications applied to types. 2.9.4 RTTI Layout The class definitions below are to be interpreted as implying a memorylayout following the class layout rules for the host ABI.They specify data members only,except for the Standard-specified member functions of thestd::type_info class given below,and do not imply anything about the member functions of these classes.Virtual member functions of these classes may only be used within thetarget systems' respective runtime libraries.The data members must be laid out exactly as specified.Every virtual table shall contain one entry describing the offset from avirtual pointer for that virtual table to the origin of the objectcontaining that virtual pointer(or equivalently: to the virtual pointer for the primary virtual table).This entry is directly useful to implement dynamic_cast,but is also needed for the other truly dynamic casts.This entry is located two words ahead of the locationpointed to by the virtual pointer (i.e., entry "-2").This entry is present in all virtual tables,even for classes having virtual bases but no virtual functions.Every virtual table shall contain one entry that is a pointer to an objectderived from std::type_info.This entry is located at the word preceding the locationpointed to by the virtual pointer (i.e., entry "-1").The entry is allocated in all virtual tables;for classes having virtual bases but no virtual functions,the entry is zero.We add one pointer to thestd::type_info class in addition to the virtual tablepointer implied by its virtual destructor: class type_info { ... // See section 2.9.3private: const char *__type_name; }; The class will contain a virtual pointer before the explicit members. __type_name is a pointer to a NTBS representing the mangled name of the type.The possible derived types are: abi::__fundamental_type_info abi::__array_type_info abi::__function_type_info abi::__enum_type_info abi::__class_type_info abi::__si_class_type_info abi::__vmi_class_type_info abi::__pbase_type_info abi::__pointer_type_info abi::__pointer_to_member_type_info abi::__fundamental_type_info adds no data membersto std::type_info;abi::__array_type_info andabi::__function_type_info do not add datamembers to std::type_info(these types are only produced by the typeid operator;they decay in other contexts). abi::__enum_type_info does not add data members either.Three different types are used to represent user type information:abi::__class_type_info is used for class types having no bases,and is also a base type for the other two class type representations. class __class_type_info : public std::type_info {}This RTTI class mayalso be used for incomplete class types when referenced by a pointer RTTI,in which case it must be prevented from preemptingthe RTTI for the complete class type,for instance by emitting it as a static object (without external linkage).Two abi::__class_type_info objects can always be compared,for equality (i.e. of the types represented) or ordering,by comparison of their name NTBS addresses.In addition, complete class RTTI objectsmay also be compared for equalityby comparison of their type_info addresses.For classes containing only a single, public, non-virtual baseat offset zero (i.e. the derived class is dynamic iff the base is),class abi::__si_class_type_info is used.It adds to abi::__class_type_info a single member pointing to the type_info structure for the base type,declared "__class_type_info const *__base_type". class __si_class_type_info : public __class_type_info {public: const __class_type_info *__base_type; };For classes with bases that do not satisfy the__si_class_type_info constraints,abi::__vmi_class_type_info is used.It is derived from abi::__class_type_info: class __vmi_class_type_info : public __class_type_info {public: unsigned int __flags; unsigned int __base_count; __base_class_type_info __base_info[1]; enum __flags_masks { __non_diamond_repeat_mask = 0x1, __diamond_shaped_mask = 0x2 }; }; __flags is a word with flags describing details about the class structure, which may be referenced by using the __flags_masks enumeration. 0x01: class has non-diamond repeated inheritance 0x02: class is diamond shaped These flags refer to both direct and indirect bases. The type of the __flags field is defined by each psABI, but must be at least 16 bits. For the 64-bit Itanium ABI, it will be unsigned int (32 bits). __base_count is a word with the number of direct proper base class descriptions that follow. The type of the __base_count field is defined by each psABI. For the 64-bit Itanium ABI, it will be unsigned int (32 bits). __base_info[] is an array of base class descriptions -- one for every direct proper base. Each description is of the type: struct abi::__base_class_type_info {public: const __class_type_info *__base_type; long __offset_flags; enum __offset_flags_masks { __virtual_mask = 0x1, __public_mask = 0x2, __offset_shift = 8 }; }; The __base_type member points to the RTTI for the base type. All but the lower 8 bits of __offset_flags are a signed offset. For a non-virtual base, this is the offset in the object of the base subobject. For a virtual base, this is the offset in the virtual table of the virtual base offset for the virtual base referenced (negative). The low-order byte of __offset_flags contains flags, as given by the masks from the enumeration __offset_flags_masks: 0x1: Base class is virtual 0x2: Base class is public Note that the resulting structure is variable-length,with the actual size depending on the number of trailing base classdescriptions.abi::__pbase_type_info is a base for both pointer types andpointer-to-member types.It adds two data members: class __pbase_type_info : public std::type_info {public: unsigned int __flags; const std::type_info *__pointee; enum __masks { __const_mask = 0x1, __volatile_mask = 0x2, __restrict_mask = 0x4, __incomplete_mask = 0x8, __incomplete_class_mask = 0x10, __transaction_safe_mask = 0x20 __noexcept_mask = 0x40 }; }; __flags is a flag word describing the cv-qualification and other attributes of the type pointed to (e.g., "int volatile*" should have the "volatile" bit set in that word). For pointer to function and pointer-to-member-function types, __flags is also used to indicate a "qualification" of sorts for the pointed-to (member) function type. That is the case for __transaction_safe_mask and __noexcept_mask where __pointee is a pointer to the "unqualified" version of the function type (e.g., one without the exception specification in the case of __noexcept_mask). __pointee is a pointer to the std::type_info derivation for the unqualified type being pointed to.Note that the __flagsbits should not be foldedinto the pointer to allow future definition of additional flags.It contains the following bits,and may be referenced using the flags defined in the__masks enum: 0x1: __pointee type has const qualifier 0x2: __pointee type has volatile qualifier 0x4: __pointee type has restrict qualifier 0x8: __pointee type is incomplete 0x10: class containing __pointee is incomplete (in pointer to member) 0x20: __pointee type is function type without the transaction-safe indication 0x40: __pointee type is function type without the exception specificationWhen the abi::__pbase_type_info is for a director indirect pointer to an incomplete class type,the incomplete target type flag is set.When it is for a direct or indirect pointer to a member ofan incomplete class type,the incomplete class type flag is set.In addition, it and all of the intermediateabi::__pointer_type_info structs in the chaindown to the abi::__class_type_info for theincomplete class type must be prevented from resolving to thecorresponding type_info structs for the complete class type,possibly by making them local static objects.Finally, a dummy class RTTI is generated for the incomplete typethat will not resolve to the final complete class RTTI(because the latter need not exist),possibly by making it a local static object.Two abi::__pbase_type_info objects can always be comparedfor equality (i.e. of the types represented) or orderingby comparison of their name NTBS addresses.In addition,unless either or both have either of the incomplete flags set,equality can be tested by comparing the type_info addresses.abi::__pointer_type_info is derived fromabi::__pbase_type_info with no additional data members.The abi::__pointer_to_member_type_info type adds one fieldto abi::__pbase_type_info: class __pointer_to_member_type_info : public __pbase_type_info {public: const abi::__class_type_info *__context; }; __context is a pointer to an abi::__class_type_info corresponding to the class type containing the member pointed to (e.g., the "A" in "int A::*")Note that this ABI requires elsewhere that a virtual table be emitted for adynamic type in the object where the first non-inline virtual functionmember is defined, if any, or everywhere referenced if none.Therefore, an implementation should include at least onenon-inline virtual function member and define it in the library,to avoid having user code inadvertently preempt the virtual table.Since the Standard requires a virtual destructor,and it will rarely be called,it is a good candidate for this role. 2.9.5 std::type_info::name() The null-terminated byte string returned by this routine isthe mangled name of the type. 2.9.6 The dynamic_cast Operator Although dynamic_cast can work on pointers and references,from the point of view of representation we need only to worryabout polymorphic class types.Also, some kinds of dynamic_cast operations are handled at compile timeand do not need any RTTI.There are then three kinds of truly dynamic cast operations: dynamic_cast, which returns a pointer to the complete lvalue, dynamic_cast operation from a proper base class to a derived class, and dynamic_cast across the hierarchy which can be seen as a cast tothe complete lvalue and back to a sibling base.The most common kind of dynamic_cast is base-to-derived in a singlyinherited hierarchy. 2.9.7 The dynamic_cast Algorithm Dynamic casts to "void cv*" are inserted inline at compile time.So are dynamic casts of null pointers and dynamic casts that are reallystatic.This leaves the following test to be implemented in the run-timelibrary for truly dynamic casts of the form "dynamic_cast(v)":(see [expr.dynamic_cast] 5.2.7/8)If, in the most derived object pointed (referred) to by v, v points(refers) to a public base class subobject of a T object[note: this can be checked at compile time],and if only one object of type T is derivedfrom the subobject pointed (referred) to by v,the result is a pointer (an lvalue referring) to that T object.Otherwise, if v points (refers) to a public base class subobjectof the most derived object,and the type of the most derived object has anunambiguous public base class of type T,the result is a pointer(an lvalue referring)to the T subobject of the most derived object. Otherwise, the run-time check fails.The first check corresponds to a "base-to-derived cast" and the secondto a "cross cast".These tests are implemented by abi::__dynamic_cast: extern "C" void* __dynamic_cast ( const void *sub, const abi::__class_type_info *src, const abi::__class_type_info *dst, std::ptrdiff_t src2dst_offset); /* sub: source address to be adjusted; nonnull, and since the * source object is polymorphic, *(void**)sub is a virtual pointer. * src: static type of the source object. * dst: destination type (the "T" in "dynamic_cast(v)"). * src2dst_offset: a static hint about the location of the * source subobject with respect to the complete object; * special negative values are: * -1: no hint * -2: src is not a public base of dst * -3: src is a multiple public base type but never a * virtual base type * otherwise, the src type is a unique public nonvirtual * base type of dst at offset src2dst_offset from the * origin of dst. */Rationale: A simple dynamic_cast algorithm that is efficient in the common case of base-to-most-derived cast case is preferable to more sophisticated ideas that handle deep-base-to-in-between-derived casts more efficiently at a slight cost to the common case. Hence, an earlier scheme of providing a hash-table into the list of base classes (as is done e.g. in the HP aC++ compiler) was dropped. For similar reasons, we only keep direct base information about a class type. Indirect base information can be found by chasing type_info pointers (and care should be taken to determine ambiguous base class types). The GNU egcs development team has implemented an idea of this ABI group to accelerate dynamic_cast operations by a-posteriori checking a "likely outcome". This is the purpose of the src2dst_offset hint. An implementation is free to always pass -1 (no hint), or to always ignore the hint in __dynamic_cast. 2.9.8 The Exception Handler Matching Algorithm Since the RTTI related exception handling routines are "personality specific",no interfaces need to be specified in this document(beyond the layout of the RTTI data). Chapter 3: Code Emission and APIs This chapter describes how to define and call functions.It also specifies the APIs of a variety of runtime utility routinesrequired to be part of the support library of an ABI-conformingimplementation for use by compiled code.In addition, reference is made to the separate description ofexception handling in this ABI,which defines a large number of runtime utility routine APIs.3.1 FunctionsIn general, the calling conventions and rules for defining C++functions in this ABI follow those specified for functions ofthe corresponding type in the base C ABI. The corresponding typeis mostly determined by translating C++ constructs to theirobvious C analogues. This section specifies the behavior ofof features without analogues in C, as well as some exceptionsand extra rules required by C++-specific semantics.3.1.1 Function DefinitionsFor the most part, non-static member functions, including constructorsand destructors, are defined as if they were ordinary functions exceptfor the addition of the implicit parameters to the prototype asdescribed in the section on parameters.The rules for member functionpointers may require aligning the first instruction of ordinarynon-static member functions (i.e. not constructors or destructors)to a higher value than the platform would normally require.3.1.2 Parameters3.1.2.1 this ParametersNon-static member functions, including constructors and destructors,take an implicit this parameter of pointer type. It ispassed as if it were the first parameter in the function prototype,except as modified for non-trivialreturn values.3.1.2.2 VTT ParametersBase-subobject constructors and destructors for classes with virtualbases take an implicit VTTparameter of pointer type. It is passed as if it were the secondparameter in the function prototype, immediately following thethis parameter, except as modified fornon-trivial return values.3.1.2.3 Non-Trivial ParametersIf a parameter type is a class type that isnon-trivial for the purposes of calls, thecaller must allocate space for a temporary and pass that temporary byreference. Specifically: Space is allocated by the caller in the usual manner for a temporary, typically on the stack. The caller evaluates the argument in the space provided. The function is called, passing the address of the temporary as the appropriate argument. In the callee, the address passed is used as the address of the parameter variable. If the type has a non-trivial destructor, the caller calls that destructor after control returns to it (including when the caller throws an exception). If necessary (e.g. if the temporary was allocated on the heap), the caller deallocates space after return and destruction.A C-style variadic argument of a type that is non-trivial for thepurposes of calls is passed the same way: the address of the temporaryis passed using the normal variadic mechanism, and va_arg inthe callee retrieves the address and treats it as a reference to thetemporary.3.1.2.4 Parameters of Special Class TypeAn argument of classstd::decimal::decimal32,std::decimal::decimal64, orstd::decimal::decimal128 as defined in TR 24733is passed the same as the corresponding native decimalfloating-point scalar type.3.1.2.5 Reference ParametersReference parameters are handled by passing a pointer to the objectbound to the reference.3.1.2.6 Empty ParametersArguments of empty class types that are not non-trivial for the purposesof calls are passed no differently from ordinary classes.On Itanium, the NaT bit must be set on all registers that are associatedwith the argument.3.1.3 Return Values3.1.3.1 Non-trivial Return ValuesIf the return type is a class type that isnon-trivial for the purposes of calls,the caller passes an address as an implicit parameter.The callee then constructs the return value into this address.If the return type has a non-trivial destructor, the caller is responsiblefor destroying the temporary when control is returned to it normally.If an exception is thrown out of the callee after the return value isconstructed but before control returns to the caller, e.g. by athrowing destructor, it is the callee's responsibility to destroy thereturn value before propagating the exception to the caller. Thus,in general, the caller is responsible for destroying the return valueafter, and only after, the callee returns control to the caller normally.The address passed need not be of temporary memory; copy elision maycause it to point anywhere, including to global or heap-allocated memory.C ABIs usually provide treatment for "indirect" return values, e.g. whenreturning a large aggregate that cannot fit in registers. In some cases,this treatment may not be suitable for non-trivial C++ return values, suchas if the convention requires implicit copying or does not permit thereturn value to be constructed at an arbitrary address. If the treatmentexists and is suitable, it is used for non-trivial return values.Otherwise, the pointer is passed as if it were the first parameter inthe function prototype, preceding all other parameters, including thethis and VTT parameters.3.1.3.2 Return Values of Special Class TypeA return value of classstd::decimal::decimal32,std::decimal::decimal64, orstd::decimal::decimal128 as defined in TR 24733 isreturned the same as the corresponding native decimal floating-pointscalar type.3.1.3.3 Reference Return ValuesA return value of reference type is returned as a pointer to the objectbound to the reference.3.1.3.4 Empty Return ValuesA return value of an empty class type that is not non-trivial forthe purposes of calls will be returned as though it were thefollowing C type:struct { char c; };On Itanium, the NaT bit must not be set for any register associated withthis return value.3.1.3.5 Constructor Return ValuesConstructors return void results.Some platforms are known to modify this rule to specify that constructorsreturn a pointer to this. This may permit more efficientcode generation in the caller.3.1.3.6 Destructor Return ValuesDestructors return void results.Some platforms are known to modify this rule to specify that destructorsreturn a pointer to this. This may permit more efficientcode generation in the caller. This modified rule does not apply todeleting destructors. It also does not apply when making a virtual callto a complete-object destructor, so thatthis-adjustment thunksdo not need to adjust the return value after the call.3.2 Virtual Calls 3.2.1 General This section sketches the calling convention for virtual functions,based on the above virtual table layout.See also the ABI examplesdocument for motivating examples and potential implementations.We explain, at a high level,what information must be present in the virtual table for a class Awhich declares a virtual function f in order that,given an pointer of type A*,the caller can call the virtual function f.This section does not specify exactly where that information is located(see above),nor does it specify how to convert a pointer to a classderived from A to an A*,if that is required.When this section uses the term function pointer it is understoodthat this term may refer either to a traditional function pointer(i.e., a pointer to a GP/address pair) or a GP/address pair itself.Which of these alternatives is actually usedis specified elsewhere in the ABI,but is independent of the description in this section.Throughout this section,we assume that A is the class for which we are creating a virtual table,B is the most derived class in the hierarchy,and C is the class that contains C::f,the unique final overrider for A::f.This section specifies the contents of the f entry in the A-in-B virtualtable.(If A is primary base in the hierarchy,then the A-in-B virtual table will be sharedwith the derived class virtual table --but the contents of the A portion of that virtual tablewill still be as specified here.)In all cases, the non-adjusting entry point for a virtualfunction expects the `this' pointer to point to an instance of theclass in which the virtual function is defined.In other words, the non-adjusting entry point for C::f will expectthat its `this' pointer points to a C object. 3.2.2 Virtual Table Components For each virtual function declared in a class C,we add an entry to its virtual table if one is not already there(i.e. if it is not overriding a function in its primary base).In particular, a declaration which overrides a function inherited froma secondary base gets a new slot in the primary virtual table.We do this to avoid useless adjustments when calling a virtualfunction through a pointer to the most derived class.The content of this entry for class A is a function pointer,as determined by one of the following cases.Recall that we are dealing with a hierarchy where B is most derived,A is a direct (or indirect) base of B defining f,and C contains the unique final overrider C::f of A::f. A = C(In this case, we are creating either the primary virtual table for A,or the A-in-B secondary virtual table.)The virtual table contains a function pointer pointing to thenon-adjusting entry point for A::f. A != CIn this case, we are creating the A-in-B secondary virtual table.The virtual table contains a pointer to an entry point that performs theadjustment from an A* to a C*,and then transfers control to the non-adjusting entry point for C::f.There are some exceptions to this determination of function pointers:If the member function is deleted, no specific requirement is madefor the corresponding virtual table entry. It may point to__cxa_deleted_virtual (see 3.2.7 Deleted Virtual Function API)or to a wrapper function for __cxa_deleted_virtual (e.g., to adapt the calling convention).It may also simply be null in such cases.Similarly, if C::f is a pure virtual function, no specific requirement is madefor the corresponding virtual table entry. It may point to__cxa_pure_virtual (see 3.2.6 Pure Virtual Function API)or to a wrapper function for __cxa_pure_virtual (e.g., to adapt the calling convention).It may also simply be null in such cases.When a class is used as a virtual base,we add a vcall offset slot to the beginning of its virtual table for each ofthe virtual functions it provides,whether in its primary or secondary virtual tables.Derived classes which override these functions may use the slots todetermine the adjustment necessary. 3.2.3 Callee For each direct or indirect base A of C that is not a morally virtualbase of C,the compiler must emit, in the same object file as the code for C::f,an A-adjusting entry point for C::f.This entry point will expect that its this pointerpoints to an A*,and will convert it to a C*(which merely requires adding a constant offset)before transferring control to the non-adjusting entry point for C::f.For each direct or indirect virtual base V of C such that V declares f,the compiler must emit, in the same object file as the code for C::f,a V-adjusting entry point for C::f.This entry point will expect that its this pointerpoints to the unique virtual V subobject of C.(Note that there may in general be multiple V subobjects of C,but that only one of them will be virtual.)This entry point must load the vcall offset corresponding to f locatedin the virtual table for V obtained via its this pointer,extract the vcall offset corresponding to f located in that virtual table,and add this offset to the this pointer.(Note that, as specified in the data layout document,when V is used as a virtual base,its virtual table contains vcall offsets for every virtual functiondeclared in V or any of its bases.)Then,this entry point must transfer control to the non-adjusting entry point.For each morally virtual base M of Csuch that M is not a virtual base(and therefore must be a subobject of a virtual base V),and such that M declares f,the compiler must emit,in the same object file as the code for C::f,an M-adjusting entry point for C::f.This entry point will expect that its this pointerpoints to an M*,and will convert it to a V* (a fixed offset),where V is the nearest virtual base to Malong the inheritance path from C to M.Then, it will convert the V* to a C* by using the vcall offsetstored in the V's virtual table. 3.2.4 Caller When calling a virtual function f,through a pointer of static type B*,the callerSelects a (possibly improper) subobject A of B such that A declares f. (In general, A may be the same as B.) (Note that A need not define f; it may contain either a definition of f, or a declaration of f as a pure virtual function.)Converts the B* to point to this subobject. (Call the resulting pointer `a'.)Uses the virtual table pointer contained in the A subobject to locate the function pointer through which to perform the call.Calls through this function pointer, passing `a' as the this pointer.(Note that in general it will be optimal to select the class whichcontained the final overrider (i.e., C)as the class to which the B* should be converted.This class is always a satisfactory choice,since it is known to contain a definition of f.In addition, if the dynamic type of the object is B,then C::f will be the function ultimately selected by the call,which means that C's virtual table willcontain a pointer to the non-adjusting entry point,meaning that no additional adjustments to the thispointer will be required.However, there may be cases in which choosing a different basesubobject could be superior.For example, if there is an alternate base D which also declares f,and a pointer to the D subobject is already available,then it may be better to use the D subobject ratherthan converting the B* to a C*,in order to avoid the cost of the conversion.) 3.2.5 Implementation Note that the ABI only specifies the multiple entry pointsfor a virtual function and its associated thunks;how those entry points are provided is unspecified.An existing compiler which uses thunks with a different means ofadjusting the virtual table pointerscan be made compliant with this ABI by only adding the vcall offsets --the thunks need not use them.A more efficient implementation would be to emit all of the thunksimmediately before the non-adjusting entry point to the function.Another might emit a new copy of the function for each entry point;this is a quality of implementation issue.See further discussion of implementation in theABI examples document. 3.2.6 Pure Virtual Function API An implementation shall provide a standard entry point that a compilermay reference in virtual tables to indicate a pure virtual function.Its interface is: extern "C" void __cxa_pure_virtual ();This routine will only be called if the user calls a non-overriddenpure virtual function, which has undefined behavior according to theC++ Standard.Therefore, this ABI does not specify its behavior,but it is expected that it will terminate the program,possibly with an error message. 2b1af7f3a8