That's just begging for trouble with -lowmem, as they contain roots to
(potentially GC-managed) D arrays.
After a rather superficial grep-check for `new ` in the *.{cpp,h} files,
these should be about all occurrences of frontend stuff previously
allocated on the C++ heap.
As *the* way to access the IrType associated with a Type via its `ctype`
field. Most importantly, it makes sure all access is redirected to the
*unqualified* type's `ctype`, which allows to get rid of the 'multiple
types' workaround for aggregates in DtoType(). Those were e.g. hit for
`shared struct SpinLock`, where the struct's type includes the `shared`
modifier...
I.e., *define* templated symbols in each referencing compilation unit
when using discardable linkonce_odr linkage, analogous to C++.
This makes each compilation unit self-sufficient wrt. templated symbols,
which also means increased opportunity for inlining and less need for
LTO. There should be no more undefined symbol issues caused by buggy
template culling.
The biggest advantage is that the optimizer can discard unused
linkonce_odr symbols early instead of optimizing and forwarding to the
assembler. So this is especially useful with -O to decrease compilation
times and can at least in some scenarios greatly outweigh the
(potentially very much) higher number of symbols defined by the glue
layer.
Libraries compiled with -linkonce-templates can generally not be linked
against dependent code compiled without -linkonce-templates; the other
way around works.
To fix ABI incompatibilities between the previous struct and `void*`
used by the hardcoded compiler prototypes, e.g., for WebAssembly, which
uses the default UnknownTargetABI, which uses LLVM byval for all structs
and static arrays.
Invoke _d_newThrowable for exception allocation & initialization, and
increase the reference count in LDC-specific _d_throw_exception for MSVC
targets. Fixes runnable/test19317.d.
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
Thereby deferring requirements wrt. object.d declarations (Object,
Throwable, TypeInfo, TypeInfo_Class, TypeInfo_Struct...) and paving the
way for a minimal druntime.
This also greatly reduces the `-vv` output for tiny code samples, e.g.,
reduced test cases.
This fixes the 32-bit std.file unittests on Linux with enabled
optimizations. Quoting the SysV ABI docs:
> This is the only routine in the unwind library which is expected to be
> called directly by generated code: it will be called at the end of a
> landing pad in a "landing-pad" model.
The remaining LDC-specific ARM EABI wrapper (_d_eh_resume_unwind()) is
implemented in assembly (ldc/eh_asm.S), preserving registers apparently.