C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: zxuiji <gb2985_at_[hidden]>
Date: Fri, 12 Jul 2024 19:22:46 +0100
1. The compiler is perfectly capable of putting in root calls where the
only thing you've done is say

namespace std { typedef std::stable::linked_list_string string; };

or

class std::string : std::string;

If it doesn't then it's not doing it's job. Neither of these have
redirection involved except when in debug mode and let's be real, you
really gonna ship a debug mode app instead of one optimised for the
machine? Didn't think so so enough with that bs.

2. I don't know about examples of classes that could use a stable ABI since
I avoid c++ like the plague (I favour pure C) but intmax_t is exactly such
an example for standard ABIs in general. Here's an example of how it
could've been used in standard functions without locking down it's size:

#ifdef ...
typedef __int128 intmax_t;
#define INTMAX_SYM(NAME) NAME##_128
__int128 foo_128( ... );
#else
typedef long long intmax_t;
#define INTMAX_SYM(NAME) NAME##_ll
#endif

long long foo_ll( ... );

__attribute__((force_inline)) inline intmax_t foo( ... ) { return
INTMAX_SYM(foo)( ... ); }
#ifdef COMPILE_STATIC_STD_ABI
extern __attribute__((force_inline)) inline intmax_t foo(...);
#endif

In both cases you get the full benefit of calling the ABI directly but also
the full benefit of an API that hides that difference for you. It's all
about HOW you implement the final layer, not whether the standard ABI
exists or not.

On Fri, 12 Jul 2024 at 18:56, Thiago Macieira via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Friday 12 July 2024 09:41:39 GMT-7 zxuiji via Std-Proposals wrote:
> > There's no reason
> > std::string could not inherit from say std::stable:: linked_list_string
> on
> > said mythical cpu.
>
> There is a reason: the lack of performance due to the indirection and/or
> out-
> of-line calls that are necessary to implement what you and Hans are
> proposing.
>
> > You would still get your performance gains without
> > sacrificing a standard ABI in the process.
>
> No, you wouldn't.
>
> I again request you come up with a prototype Stable Standard Library with
> a
> couple dozen classes so we can judge the performance, effort, and
> potential
> stability features. Find an example from the past 15 years of C++ Standard
> effort where a feature was rejected or heavily modified/constrained
> because of
> ABI, and show how that would apply in your library.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Principal Engineer - Intel DCAI Platform & System Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-07-12 18:15:47