Comments (2)
I just checked the SystemV ABI spec, and this section stood out to me:
The classification of aggregate (structures and arrays) and union types works as fol-
lows:
...
4. Each field of an object is classified recursively so that always two fields 18 are con-
sidered. The resulting class is calculated according to the classes of the fields in the
eightbyte:
...
5. Then a post merger cleanup is done:
(a) If one of the classes is MEMORY, the whole argument is passed in memory
It sounds to me like Zig is not following step 5, while the other compilers are.
from zig.
Clang LLVM IR:
; Function Attrs: noinline nounwind optnone sspstrong uwtable
define dso_local void @my_func(i64 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, ptr noundef byval(%struct.Foo) align 8 %5) #0 {
...
%12 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
%13 = load i64, ptr %12, align 8
%14 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
%15 = load i64, ptr %14, align 8
call void @use_f(i64 %13, i64 %15)
ret void
}
Zig LLVM IR:
; Function Attrs: nounwind uwtable
define dso_local void @my_func(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5, i64 %6) #0 {
%8 = alloca %a.Foo, align 8
...
call void @use_f(i64 %12, i64 %14)
ret void
}
Zig should not split structs into fields after a certain amount of fields.
from zig.
Related Issues (20)
- ArrayList segfault when appending large value HOT 1
- Array of zero-sized type causes LLVM crash HOT 2
- Cannot build for iOS on macOS Sonoma. HOT 3
- Compiler segfault HOT 4
- allow multi/diffrent .zig file extensions HOT 2
- Linker: Incorrect Thread Local Variable symbol resolution HOT 1
- missing 'defined here' notes on equality compile error HOT 3
- There are too many ring buffer implementations in the standard library HOT 1
- `usingnamespace opaque{};` now errors ("type [...] has no namespace")
- std.fs: deleteTree in dir with open file hangs in loop HOT 2
- NetBSD build failure - more bitrot to sort out?
- std.math.big.int.Managed.bitAnd(-0xffffffffffffffff, 0x10000000000000000) == 0
- `zig run`: Empty string arguments aren't forwarded on Windows HOT 1
- Helgrind annotations not being properly generated
- Check Zstandard implementation against changes to the spec
- Zstandard decompression should reuse the window buffer between frames when possible
- Zstandard decompression performance
- autodoc follow-up enhancements and bug fixes HOT 2
- std.os.linux.mount return type is `usize`, but can only return 0 or -1 according to man HOT 1
- rename `math.log` -> `math.logb`
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 zig.