Commit graph

13 commits

Author SHA1 Message Date
Rainer
7d6fff7bcf Fix issue #17503 - Associative Arrays improperly register a GC-allocated TypeInfo for element cleanup
- let the compiler generate type info for the AA Entry and add it to TypeInfo_AssociativeArray
- strip modifiers for index and next in TypeInfo_AssociativeArray to make it agnostic to changes by the glue layer
2025-02-17 22:02:57 +01:00
Dennis
c0c1b0ab12
Use __FILE__, __LINE__ for templated tracegc hooks (#20882) 2025-02-17 11:53:16 +01:00
Iain Buclaw
7afce7f466 Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-11-20 10:03:05 +01:00
Teodor Dutu
055accfbe6
Translate _d_newarray{mTX, miTX, Op} to a single template (#15819)
- Move code for `_d_newarraymTX` to `core.internal.array.construction`
- Remove `_d_newarraymiTX` and `_d_newarraymOp`
- Add unittests for `_d_newarraymTX`
- Move lowering to `_d_newarraymTX` to the semantic phase
- Inline the lowering when inlining `NewExp`s
- Add changelog entry about the new hook

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-11-17 09:57:30 +02:00
Steven Schveighoffer
084eed696e
Fix static AA initialization (#15744)
* Fix static associative array initialization to always use hashOf at
runtime. We do this by storing the hash function in the Impl instead of
using the passed-in TypeInfo for the key.
2023-11-02 18:41:35 +08:00
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
Iain Buclaw
cd1bbd4733 Fix broken tests caused by merge conflicts 2023-07-15 14:21:45 +00:00
Iain Buclaw
4dccb4aa5d Merge remote-tracking branch 'upstream/stable' into merge_stable 2023-07-15 13:45:11 +00:00
Vladimir Panteleev
aef22a7b22
Fix Issue 23890 - "Warning: cannot inline function" in core.lifetime (#15186)
* Fix Issue 23890 - "Warning: cannot inline function" in core.lifetime

* druntime/test/profile: Divorce test from exact Druntime source numbers

Allow lines to move around in core/lifetime without affecting this test.
2023-07-06 12:20:15 +03:00
Teodor Dutu
159a8801a0
Translate _d_newitem{U,T,iT} to a single template (#14664)
This makes the following changes:
- Replace `_d_newitem{U,T,iT}` with a template `_d_newitemT` that
allocates memory for the new `struct` and performs the required
initialisation
- Move lowering call to `_d_newitemT` from e2ir.d to expressionsem.d
- Add `lowering` field to `NewExp` that contains the lowered call and
use it in e2ir.d
- Remove `_d_newitem{,i}T` from rt.lifetime

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-05-12 11:29:10 +03:00
Iain Buclaw
bee392689d Fix tests broken by divergent changes in stable 2023-03-01 19:02:48 +00:00
Teodor Dutu
276ef2145b
Translate _d_newclass to a template (#14837)
This makes the following changes:
- Add template `_d_newclassT` to `druntime.src.core.lifetime.d`
- Replace lowering of `new C()` to `_d_newclassT!C()`
- Add `lowering` member to `NewExp`. This field stores the above
lowering to be used by e2ir.d
- Keep the old `_d_newclass` hook because it's used by
`TypeInfo_Class.create()`
- Add dummy `_d_newclassT` hook to tests that redefine the `object`
module
- Remove `new MinHeap!(TestType)()` from `fail308.d`. Otherwise the
errror was changed and printed the local path to druntime
- Move `err` to global scope in rt.sections.d to avoid the frontend
lowering
- Account for the `GC.malloc()` called by the template hook in the
`-profile=gc` tests

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

Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
2023-01-27 10:02:10 +02:00
Iain Buclaw
69ab16a7e8 Merge dlang/druntime repository into dlang/dmd 2022-07-09 18:53:15 +02:00