dmd/compiler/test/runnable/profilegc_stdout.d
Teodor Dutu fcff1b51ba
Translate _d_newarray{U,iT,T} to a single template (#15299)
* druntime: Copy array allocation functions to `core.internal.array.utils`

This copies `__setArrayAllocLength()`, `__arrayAlloc()` and moves
`__arrayStart()` and `__arrayClearPad()` to
`core.internal.array.utils.d`. This is needed because `_d_newarrayT()`
calls these functions from `rt.lifetime.d`, but the file cannot be
imported from `core.internal.array.creation.d`.

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>

* Translate `_d_newarray{U,iT,T}` to a single template

This achieves the following:
- Convert `_d_newarray{U,iT,T}` to a single template `_d_newarrayT` that
handles arrays of elements that either have an init symbol or are
zero-initialised.
- Move compiler lowering to the semantic phase
- Store lowered expression in `NewExp.lowering`

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>

---------

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-10-24 10:44:55 +03:00

18 lines
320 B
D

/*
REQUIRED_ARGS: -profile=gc
RUN_OUTPUT:
---
bytes allocated, allocations, type, function, file:line
96 1 ubyte D main runnable/profilegc_stdout.d:17
---
*/
import core.runtime;
void main()
{
// test that stdout output works
profilegc_setlogfilename("");
ubyte[] arr = new ubyte[64];
}