Commit graph

22 commits

Author SHA1 Message Date
Martin Kinkelin
967947eb84 Emulate @weak functions on Windows and don't emit COMDATs for ELF anymore
Emulation for @weak global variables is still left out but should be
analogous.

The test adaptations are mostly a revert of 3893840f. The testcase has
shown that @weak hasn't worked properly for ELF (linker apparently
prefers the version in the 1st object file, independent of whether it's
weak or not), because the functions are emitted in COMDATs.
clang emits COMDATs for templates and inline functions only, not for
regular functions.
2020-05-16 20:42:57 +02:00
Martin Kinkelin
e52199469f Upgrade front-end & libs to v2.087.0-beta.1 2019-06-21 15:39:45 +02:00
Martin Kinkelin
4a23399236 Aim for consistent #includes (order + dir prefix)
I surely missed a few.
2018-10-20 16:19:46 +02:00
Martin Kinkelin
7776c4081b Upgrade frontend & libs to v2.083.0-beta.1 2018-10-20 16:19:46 +02:00
Martin
e337cec78a Slightly refactor RTTIBuilder 2018-04-04 19:59:10 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
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).
2018-04-04 19:59:10 +02:00
Martin
081b681776 Forward-declare runtime functions lazily
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.
2018-04-04 19:59:10 +02:00
Martin
213de9b2f7 Merge branch 'master' into merge-2.077
Conflicts:
	runtime/druntime
2017-11-26 18:26:32 +01:00
Martin Kinkelin
bc620a26f3
Emit ModuleInfos as COMDATs again (#2409)
Reverts this functional change introduced by
ldc-developers/ldc@3f38f971. I overlooked this because
`setLinkage({<linkage>, false}, <symbol>` does NOT clear the COMDAT if
previously set.
2017-11-14 10:21:30 +01:00
Martin
cace7d72de Fix ModuleInfo forwarder functions - allow non-extern(D) callees
The unittests now with 2.077 seem to respect an outer `extern(C)` while
`extern(D)` was previously enforced.

Fixes failing unittests on 32-bit x86 (e.g., `rt.switch_`) due to LLVM
'optimizing' calls with different calling convention than the callee
definition's to an LLVM trap (in the module's unittest forwarder
function).
2017-11-09 23:33:07 +01:00
kinke
c1f921e583
Merge pull request #2365 from kinke/betterC
-betterC
2017-10-31 16:58:45 +01:00
Martin
95915a8ab8 Fix and refactor Objective-C state
Tie the state to an LLVM module/object file instead of having a global
one. And finalize it once per LLVM module instead of once per D module
(previously, as part of ModuleInfo generation).

Fixes issue #2388.
2017-10-26 20:28:53 +02:00
Martin
3f38f9715a Get rid of special 'typeid(...)' LL types for TypeInfos
Use the real LL type representing the TypeInfo (sub)class directly and
from the beginning, i.e., already for the declaration, instead of
building an extra LL struct type (firstly opaque, then finalized when
defining the TypeInfo via RTTIBuilder).

To get this to work in all cases, the dummy TypeInfo for opaque structs
is now a complete TypeInfo_Struct, with all 11/13 fields zero-
initialized. Previously, it was a special TypeInfo (no extra
TypeInfo_Struct fields) with TypeInfo_Struct vtable, something which DMD
also emits.

Also refactor the RTTIBuilder finalize() interface - e.g., don't set the
linkage there (had to be reverted for ModuleInfos) and only take the
global variable to be defined. Cast the field initializers if required,
e.g., null pointers to appropriately typed function pointers for
TypeInfo_Struct etc.
2017-10-25 00:38:05 +02:00
Johan Engelen
e34ac614f6 Move the call to the D-style code-coverage constructor (registration of code coverage for the current module) to the "ictor" constructors that are not included in cycle detection. (#2382)
Resolves issue #2177.
2017-10-25 00:14:28 +02:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +02:00
Martin
0b28925e9a Win32: Remove extra leading underscore from D symbol mangling
This is compatible with DMD.
2017-10-07 14:06:17 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Martin
dca21939e1 Merge 2.072.2 front-end
The part needing most attention was ddmd.root.ctfloat, ddmd.target (incl.
gen/target.cpp) and ddmd.builtin. The front-end is now prepared for
elaborate compile-time floating-point types to allow for proper cross-
compilation.

This version still uses the host's `real` type for compile-time reals,
except for MSVC hosts, which still use 64-bit doubles (when compiled with
DMD host compiler too).

Some other changes:

* semantic*() of Statements extracted from statement.d to statementsem.d
* mangle() -> mangleToBuffer()
* Identifier::string -> toChars()
* Token::float80value => floatvalue
* Dsymbol::isAggregateMember() => isMember()
* BoolExp is no more
* ddmd.root.ctfloat: LDC-specific CTFE builtins
2017-01-29 15:48:03 +01:00
Ivan Butygin
a26bfc1223 Refactor code to hide direct IrFunction->func usage and add convenient functions (#1911) 2017-01-17 22:40:32 +01:00
David Nadlinger
e7c95dbd53 gen: Separate ModuleInfo struct emission code [nfc]
gen/module{.h, .cpp} currently is a big kitchen sink for various things
related to emitting modules. This hopefully makes the distinction between
generating the ModuleInfo data and the code to register it with druntime
clearer.
2016-08-18 16:27:34 +02:00