Comments (10)
Is it expected that the allocation of bits as integer bits and fractional bits would be defined by the target, or should that also be included in the mangling? I'm assuming this is determined by the target.
I don't like either of the suggested approaches. The most obvious available space for a mangling here is encodings beginning with D
. So how about:
<builtin-type> ::= [
DS
]DA
<builtin-type> #[_Sat] T _Accum
<builtin-type> ::= [DS
]DR
<builtin-type> #[_Sat] T _Fract
For example:
signed short _Accum -> DAs
_Sat unsigned long _Accum -> DSDAm
_Sat unsigned short _Fract -> DSDRt
This anticipates DS
being permitted in other places, and/or other overflow qualifiers being added eventually; for instance, a _Sat int
type is meaningful and might be useful, as might a _Wrap
qualifier. If we don't want to plan for that, then DA_
and DR_
would work as encodings for _Sat T _Accum
and _Sat T _Fract
, respectively.
from cxx-abi.
The integer and fractional bits are determined by the target.
Does the <builtin-type>
in the expansion imply that builtin types other than signed/unsigned short/long
are allowed to be mangled with _Sat
and _Accum/_Fract
? We only intend to add the types given above and will not be adding other types like _Sat int _Fract
. We throw errors during the Sema stage on finding types like these.
The _Sat
qualifier won't also be used with other types and can only be used with _Fract
and _Accum
, so would the grammar then change to
<builtin-type> ::= DA <builtin-type> # T _Accum
<builtin-type> ::= DR <builtin-type> # T _Fract
<builtin-type> ::= DA_ <builtin-type> # _Sat T _Accum
<builtin-type> ::= DR_ <builtin-type> # _Sat T _Fract
from cxx-abi.
Does the in the expansion imply that builtin types other than signed/unsigned short/long are allowed to be mangled with _Sat and _Accum/_Fract?
It's just a shorthand to avoid needing to explicitly list the six options.
We only intend to add the types given above and will not be adding other types like _Sat int _Fract.
The idea would be that _Sat signed _Fract
is mangled as DSDRi
(that is, it gets the mangling that would have been used for _Sat int _Fract
if such a type existed).
The _Sat qualifier won't also be used with other types and can only be used with _Fract and _Accum
You have no way to know that. An implementation could very reasonably choose to allow it in other places as an extension.
from cxx-abi.
I see, so it's better to have mangle rules that cover different syntactic type combinations even if the type is invalid? (ie. _Sat float _Accum
can still have a corresponding mangle even though it is currently an invalid type)
from cxx-abi.
I don't see any particular problem with there being combinations of mangling productions that don't correspond to any valid source program (that's actually really common, eg _Z1fA3_Ri
). But I think it'd also be fine to describe the rule as:
<builtin-type> ::= [
DS
]DA
<fixed-point-size> #[_Sat] T _Accum
<builtin-type> ::= [DS
]DR
<fixed-point-size> #[_Sat] T _Fract
<fixed-point-size> ::=s
#short
<fixed-point-size> ::=t
#unsigned short
<fixed-point-size> ::=i
# plain
<fixed-point-size> ::=j
#unsigned
<fixed-point-size> ::=l
#long
<fixed-point-size> ::=m
#unsigned long
[Note: I moved the DS
to the start -- I think that makes more sense, as it's more like a type qualifier in some sense. I've also retroactively made that change to my prior comments.]
But I don't want to get bogged down with how we specify the rule. The thing to focus on right now is what rule we use. Does the one in this comment seem OK to you?
from cxx-abi.
Those rules look fine to me. Thanks! Is there anything else I would need to do to see this in a future ABI?
from cxx-abi.
Could you open a PR for this and make sure it's linked here?
from cxx-abi.
Sorry for the delay. I have #161 ready. I'm not familiar with github PRs though to know how to reference this issue with that PR.
from cxx-abi.
Friendly ping on this. How does this PR look to you?
from cxx-abi.
This was merged in #161
from cxx-abi.
Related Issues (20)
- "Deducing this" mangling HOT 14
- Should std::rethrow_exception be covered by the EH ABI? HOT 2
- Emergency EH buffer is overspecified HOT 6
- Where is the most recent ABI document? HOT 1
- Add `[[trivial_abi]]` attribute
- Lambda POD for the purposes of layout? HOT 2
- Mangling the name of an externally visible lambda in a static data member of a class HOT 1
- Proposal: Include an optional specification for mangling names that reference anonymous symbols HOT 4
- Is it possible to form a pointer-to-data-member with offset -1 using explicit derived-to-base conversions without UB? HOT 3
- unnecessary `E`s after <expression> and mangling collisions between <expression> and <number> HOT 1
- need mangling for lambdas appearing in unevaluated operands within a class body HOT 3
- What does "forbidding the use of function templates" mean? HOT 2
- [C++20] [Modules] Do we need the concept of `key function` for class defined in module purview? HOT 25
- Missing HTML encoding in 2.3.1 Data Member Pointers HOT 2
- Proposal: document or somehow notice __cxa_init_primary_exception HOT 3
- Mangling for C++ pack indexing HOT 1
- Function and function pointer types with vendor calling conventions HOT 2
- Ambiguity in mangling grammar around type qualifiers HOT 8
- Question about section 2.9.4 HOT 4
- Questions About Non-POD Types Data Layout HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cxx-abi.