Commit graph

185 commits

Author SHA1 Message Date
David Nadlinger
94b111c971 Merge pull request #1570 from kinke/runtime_check
Check existing runtime function declarations for matching type
2016-08-15 14:55:18 +02:00
Martin
a5e5bd1716 Keep _d_newclass() semantics, re-introduce _d_allocclass() instead
And use that one in DtoNewClass(), keeping 3rd party code from breaking.
2016-08-15 13:19:11 +02:00
Martin
7151302a06 Check existing runtime function declarations for matching type
This fixes issue #958 by checking the function type of an existing
function declaration with the same runtime function name inside the
codegen'd module.
This should normally be an existing forward declaration from a previous
runtime call, but the user is free to declare (and even implement) it
too.

The LOC for the error is empty as the provided `loc` may likely be from
a template instantiation from another module.
2016-06-20 00:09:42 +02:00
Johan Engelen
04b89e642c Windows: Move the prepending of 0x1 to C++ mangled functions from frontend to the backend.
Windows x64 ABI: remove unnecessary \01 from mangled symbol name.

This removes the 0x1 byte from `.mangleof` accessible from user code.
Resolves issue #1519

Also let mangleForLLVM take a std::string, to enable C++11's moves.
2016-05-30 10:18:39 +02:00
Johan Engelen
7657e5f7d8 Move ArrayParam helper type to llvmhelpers.h to make it available for use elsewhere. 2016-04-18 09:50:19 +02:00
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00
Martin
5693942e6e Merge branch 'ltsmaster'
Conflicts:
	gen/runtime.cpp
	runtime/druntime
	runtime/phobos
	tests/d2/dmd-testsuite
2016-03-27 19:51:44 +02:00
Kai Nacke
34ac5c5f3a Add 'cold' and 'noreturn' attributes to _d_assert et.al.
These functions are only called at most once: in case of a failure.
They always raise an exception and never return normally. Marking
them as 'cold' and 'noreturn' may help the (not yet added) IRCE pass.

Also adds the missing 'uwtable' attribute for x86_64 and clang-format
the file.
2016-03-27 14:53:57 +02:00
Dan Olson
00e6472931 Fix bad assert conditional
I guess I should test with LLVM asserts on :-(
2016-03-24 00:22:49 -07:00
Dan Olson
5b090baef3 Objective-C runtime cleanups
Only create runtime calls when Objective-C is supported.
2016-03-23 23:33:26 -07:00
Rainer Schuetze
3adf19c50d _d_enter_catch can throw, so it might have to be invoked 2016-03-13 17:27:55 +01:00
Rainer Schuetze
83368904d1 - add classinfo argument to _d_eh_enter_catch 2016-03-13 17:27:54 +01:00
Rainer Schuetze
2a86b7250a replace _d_skipCleanup var with callbacks _d_enter_cleanup, _d_leave_cleanup 2016-03-13 17:27:54 +01:00
Rainer Schuetze
aad27069ca MSVC/x86 EH support using __CxxFrameHandler3 personality 2016-03-13 17:27:51 +01:00
Dan Olson
98a608e925 First proof -of-concept for objc support
This at least shows a path forward.  Pretty much a kludge to at this
point, but passes the tests.
2016-03-02 00:30:58 -08:00
Johan Engelen
acdcc4a8c1 Merge branch 'master' into merge-2.069 2016-02-13 20:12:17 +01:00
Johan Engelen
29ce4012af dmd2 --> ddmd. Merge (almost all of) our changes to dmd source into the new D source of dmd 2.069.2.
Also adds the CMake infrastructure to compile and link the D source files.

The build is partially broken:
- A few files in Phobos and druntime do not build
- MSVC build is broken because of unresolved symbols involving reals
2016-01-28 19:03:58 +01:00
David Nadlinger
2b7349b968 buildRuntimeModule: Always create _d_dso_registry forward decl
The added overhead for Windows et al. is utterly insignificant
compared to all the other typically unused declarations that
will be created by this, and copy/pasting the long condition
(see d072bdf) is error-prone. The alternative would have been
to factor the check out into a predicate function.
2016-01-24 16:44:53 +01:00
Kai Nacke
d072bdf7b6 Do not use global.params.is<OS>
This PR replaces the few uses of global.params.is<OS> with
global.params.targetTriple.isOS<OS>(). This avoids adding a new
boolean for each supported OS.
It also defines all xBSD-type OS as using the dso-registry.
2016-01-12 09:15:05 +01:00
Kai Nacke
062fef3677 FreeBSD: generate calls to _d_dso_registry (as expected by druntime).
This fixes issue #1119.
2016-01-09 21:10:11 +01:00
Martin
b9f7d2b499 Normalize signatures of EH runtime functions 2015-12-04 15:07:47 +01:00
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +01:00
Martin
417e3d242d Slightly extend AttrSet (attributes set) for improved usability 2015-11-21 15:08:16 +01:00
Martin
2dfa5e8569 Some more cosmetic fixes
Found by searching for lines > 80 chars.
2015-11-05 19:12:32 +01:00
David Nadlinger
c9c854f664 eh: Do not use GC for _d_exception records 2015-11-03 00:53:34 +02:00
David Nadlinger
9df487edff gen/ir: clang-tidy the world 2015-11-02 11:30:40 +02:00
David Nadlinger
44b0f7b615 driver/gen/ir: clang-format the world
This uses the LLVM style, which makes sense for sharing code
with other LLVM projects. The DMD code we use will soon all
be in D anyway.
2015-11-02 00:28:01 +02:00
Martin
90197d6c72 Simplify working with LLVM attributes 2015-11-01 16:19:27 +01:00
Martin
60d676e2a1 Drop support for LLVM < 3.5
This allows to clean up the code a little.
2015-10-30 22:24:05 +01:00
David Nadlinger
bd47ea49e6 Merge branch 'master' into merge-2.068 2015-09-24 17:57:25 +02:00
David Nadlinger
f4f55abf27 Use thunks instead of calling _d_toObject for D interfaces
This allows us avoid the problems stemming from the 64 kiB
size limit hack in _d_toObject.

GitHub: Fix #1065.
2015-09-13 20:27:00 +02:00
David Nadlinger
5687866721 _aaGetX -> _aaGetY 2015-08-29 03:09:18 +02:00
David Nadlinger
f0658ea8d1 Remove some no longer used runtime functions 2015-08-29 03:09:17 +02:00
David Nadlinger
ef431836b0 Remove _ad{Eq, Cmp} defines from back when we supported both D1/D2 (NFC) 2015-08-22 19:01:02 +02:00
David Nadlinger
8ed9826de1 Exception chaining reimplementation for correct and lean IR
Now we no longer require separate landing pads for collisions
in user code. This leads to less cruft being generated and opens
the door towards folding the successful and exceptional paths
through finally blocks into one.

This commit breaks Win64; ldc.deh2 will also need updating.
2015-08-13 18:24:06 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +02:00
Martin
4b6bd7ab52 Merge branch 'master' into merge-2.067 2015-07-18 16:02:51 +02:00
Kai Nacke
4cf4690ab0 Use C calling convention for variadic functions on x86.
0.15.1 used stdcall convention everywhere. But the ABI change in 0.15.2
requires use of the C calling convention for variadic calls on x86
because the stdcall convention does not support vararg functions.

Solution is to check the llvm::FunctionType if the function has varargs.
This commit also makes the C calling convention the global default
because according to the LLVM documentation the fastcc convention used
for D linkage does not support varargs.

This fixes issue #1000.
2015-07-15 21:34:00 +02:00
Kai Nacke
d1e764cec1 Backport of "Avoid using llvm::Linker" to master.
See pull request #974 for the original code.
2015-06-27 22:08:44 +02:00
David Nadlinger
0922254dd1 Directly emit IR into same llvm::Module instead of using Linker
GitHub: Fixes #970.
2015-06-14 21:36:35 +02:00
kai
eadefdc676 The runtime functions for multi-dim arrays have changed.
_d_newarraymT and _d_newarraymiT are now named _d_newarraymTX and
_d_newarraymiTX. There is also a change in the signature: instead
of a variable length argumentlist the functions now require an array
of dimensions.

This should fix test runnable/test28.d
2015-04-12 19:59:18 +02:00
Kai Nacke
ac7f8c70f8 Merge branch 'master' into merge-2.067
Conflicts:
	dmd2/mars.h
	driver/ldmd.cpp
	gen/module.cpp
2015-04-08 22:23:50 +02:00
Johan Engelen
505f18ca2a Add coverage analysis ("-cov=...") to ldc2 2015-04-07 22:11:02 +02:00
Martin
6c333f5761 Allocate structs on the heap via runtime function _d_newitem.
This is required for the GC to be able to call their dtors, if need
be (by appending a TypeInfo pointer after the actual struct in case
the struct has a dtor).

_d_newitemT() / _d_newitemiT() also perform the initialization, so
we don't need to take care of that in toir.cpp anymore.
2015-04-04 21:00:05 +02:00
Martin
7d0d2a1d26 Call _d_delstruct() runtime function when deleting struct pointers.
As long as the struct has a dtor, otherwise continue forwarding
to _d_delmemory().
2015-03-29 04:54:31 +02:00
Kai Nacke
ae4344714c Fix bad signature in call to _d_arraysetctor / _d_arraysetassign.
The count parameter is int, not size_t.
2015-03-24 20:06:55 +01:00
Martin
6d080a6ed2 Fix the signatures of all forward declared runtime functions. 2015-03-22 19:56:46 +01:00
Martin
a4a10336fc Remove duplicate declaration of runtime function _d_assert_msg().
It's already declared 3 blocks up.
2015-03-22 18:23:55 +01:00
Martin
e8f782bb34 Use void* for associative arrays when forward-declaring runtime functions.
Instead of a pointer to an empty struct.
2015-03-22 17:08:38 +01:00
kai
f02981ca56 Fix signature of _aaKeys in gen/runtime.cpp 2015-03-22 13:51:55 +01:00