← Back to index
|
Original Bugzilla link
Bug 17938 – Detect immutable variadic arguments
Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-26T08:59:12Z
Last change time
2024-12-13T18:55:03Z
Keywords
performance
Assigned to
No Owner
Creator
anonymous4
See also
https://issues.dlang.org/show_bug.cgi?id=18094
Moved to GitHub: dmd#19332 →
Comments
Comment #0
by dfj1esp02 — 2017-10-26T08:59:12Z
--- void f(in string[] a...); void g() { f("a","b","c"); } void h() { static immutable string[3] b=["a","b","c"]; f(b); } --- void example.g(): push %rbp mov %rsp,%rbp sub $0x40,%rsp mov %rbx,-0x38(%rbp) mov $0x0,%ecx mov $0x1,%eax mov %rax,-0x30(%rbp) mov %rcx,-0x28(%rbp) mov $0x0,%edx mov $0x1,%ebx mov %rbx,-0x20(%rbp) mov %rdx,-0x18(%rbp) mov $0x0,%ecx mov $0x1,%esi mov %rsi,-0x10(%rbp) mov %rcx,-0x8(%rbp) lea -0x30(%rbp),%rdx mov $0x3,%edi mov %rdx,%rsi xor %eax,%eax callq 55 <void example.g()+0x55> mov -0x38(%rbp),%rbx leaveq retq void example.h(): push %rbp mov %rsp,%rbp mov $0x0,%edx mov $0x3,%edi mov %rdx,%rsi xor %eax,%eax callq 18 <void example.h()+0x18> pop %rbp retq --- The calls are equivalent, but function h looks more efficient and has less code generated. Function g amounts to 24 instructions and 91 bytes, h - to 9 instructions and 32 bytes.
Comment #1
by robert.schadek — 2024-12-13T18:55:03Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19332
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB