Commit graph

660 commits

Author SHA1 Message Date
David Nadlinger
f3a79f1215 llvm::StringMap is available in 3.1 just fine? 2015-08-16 22:59:41 +02:00
David Nadlinger
5064909c32 Fix handling of reals where padding is built into the LLVM type
This fixes structs with members of structs with real fields. Did not
fail the test suite unless building with assertions before, but
crashed building real-world applications (and obviously led to wrong
struct layouts).
2015-08-10 20:49:30 +02:00
David Nadlinger
d9cd4ed22c Fix/simplify struct literal AddrExp toElem code 2015-07-28 04:27:57 +02:00
David Nadlinger
ad2546c6b0 toir/AssignExp: Align logic with DMD source to make maintenance/verification easier 2015-07-27 21:03:55 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +02:00
Martin
6fefec5a07 Don't destruct a temporary if its constructor throws. 2015-07-19 01:01:04 +02:00
Martin
b9c77c266a Restore toElemDtor() functionality. 2015-07-18 17:17:26 +02:00
Martin
cf52b53888 Move temporaries-related state from ToElemVisitor to FuncGen. 2015-07-18 13:34:26 +02:00
Martin
2304b52acb First attempt to simplify and fix destruction of temporaries in toElem(). 2015-07-18 13:34:26 +02:00
Martin
2444ae0988 First attempt to fix NewExp::argprefix.
The front-end uses a single bool variable as gate for all destructors
(by replacing each dtor expression by `gate || dtor()`).
This flag is set at the end of the argprefix chain of CommaExp.
So when no exception occurs in argprefix, the dtors aren't invoked in
the inserted finally block.
Right after the finally block we have the call to NewExp's ctor, which
will take care of destructing its parameters.
2015-07-18 13:34:26 +02:00
Martin
9f1e6f1a2e Prepare for more flexible toElemDtor().
We'd like to evaluate expression NewExp::argprefix and only destruct
it if an exception interrupts its evaluation.
2015-07-18 13:34:26 +02:00
Martin
1672b5d82d Codegen for NewExp::argprefix. 2015-07-18 13:34:25 +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
David Nadlinger
d5b8713ca3 Merge pull request #968 from klickverbot/cpp-rtti
Do not try to use RTTI for C++ classes
2015-06-07 14:08:50 -04:00
Kai Nacke
f49d32f5f6 Merge branch 'master' into merge-2.067 2015-05-31 19:01:54 +02:00
Kai Nacke
0a8dd80850 Do not search for destructors inside assert expression if assertions are turned off.
Otherwise there is the possibility that temporaries are found and we try to call
the destructor on them.
This fixes issue #953.
2015-05-31 17:51:52 +02:00
David Nadlinger
b10f110066 Do not try to use RTTI for C++ classes
Casts are just bitcasts, and do not try to invoke
class invariants on asserts.

@yebblies mentioned he would extend the DMD test suite
accordingly.
2015-05-31 09:34:14 +02:00
Kai Nacke
23303140fe Merge branch 'master' into merge-2.067 2015-05-22 21:44:33 +02:00
Kai Nacke
8d0fada2c2 LLVM 3.7: The signature of CreateCall() has changed.
The method now takes an array with the argument values.
2015-05-22 21:25:14 +02:00
Martin
6c645649ed Enable passing binAssign expressions as ref/out arguments.
Fixes runnable/testassign.d.
2015-04-24 00:40:01 +02:00
Kai Nacke
1385c17efc Merge branch 'master' into merge-2.067 2015-04-15 21:46:16 +02:00
Dmitri Makarov
efa96d69d8 Cache global variables for string literals. 2015-04-15 09:56:02 +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
Kai Nacke
ced658da92 Merge branch 'master' into merge-2.067 2015-04-05 03:29:30 +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
Kai Nacke
a4924c50e1 LLVM 3.7: llvm::ConstantExpr::getElementPtr() wants element type.
This is the same change like the one on the GEP instruction.
2015-04-04 01:37:14 +02:00
David Nadlinger
9e17ae9fea Merge pull request #877 from kinke/deleteArray
Don't try to invoke non-existent dtors when deleting dynamic arrays.
2015-03-29 19:32:36 +02:00
Martin
f8c9c72795 Don't try to invoke non-existent dtors when deleting dynamic arrays.
Runtime function _d_delarray_t() expects the TypeInfo_Struct argument
to be null if the struct has no dtor.

This fixes runnable/hospital.d, which deletes a dynamic array of class
handles. But in this case, we only delete the memory allocated for the
handles and don't destruct the actual class instances!
For hospital.d, it doesn't matter as the class has no dtor.
But I doubt that's intended behavior...
2015-03-29 17:55:47 +02:00
Kai Nacke
5bd431b7fd Fix MSVC build.
These changes seems to be required for MSVC 2013.
2015-03-29 17:54:09 +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
Martin
bf55d7b431 Descend to nested lvalue for assign, binAssign and address-of expressions.
Thereby enabling nested assign/binAssign expressions in left-hand-sides
of assign/binAssign expressions as well as taking the address of assign/
binAssign expressions.
2015-03-28 16:34:12 +01:00
Martin
9ecc483b14 Don't care about mismatching types in conditional expressions.
Ignore LL type mismatches between the overall expression and its
2 nested true/false expressions.
2015-03-24 00:34:28 +01:00
Kai Nacke
2ad804c16b Implement core.bitop.volatileLoad() and core.bitop.volatileStore()
The implementation introduces 2 new intrinsics: ldc.bitop.vld and ldc.bitop.vst.
2015-03-22 00:11:43 +01:00
kai
95806fd7cd Merge branch 'master' into merge-2.067
Conflicts:
	runtime/druntime
2015-03-15 20:35:44 +01:00
kai
30df48f360 LLVM 3.7: llvm::GetElementPtrInst::Create() now has an additional type parameter. 2015-03-15 18:07:11 +01:00
Kai Nacke
886c2eab06 Merge branch 'master' into merge-2.067
Conflicts:
	runtime/druntime
2015-03-01 15:03:31 +01:00
Kai Nacke
9ec79ded40 Merge pull request #768 from kinke/vararg2
Varargs fix & ABI refactoring
2015-02-24 23:26:45 +01:00
kai
c39c7e9c35 Update to DMD v2.067.0-b2
Includes all tagged with v2.067.0-b2. Does not includes latest druntime changes from ldc (head) branch.

This is known to be broken. I only merged the frontend stuff but did not try to compile something...
2015-02-24 22:16:17 +01:00
kai
e455b90456 Merge branch 'master' into merge-2.067
Conflicts:
	dmd2/template.c
	runtime/druntime
	runtime/phobos
2015-02-24 07:23:58 +01:00
kai
136fe8dd03 Fix some more warnings.
Replace format modifier %zu (for size_t) with %llu and a cast to unsigned long long.
2015-02-23 23:12:41 +01:00
Martin
c19550ad39 Fix va_arg intrinsic. 2015-02-23 22:52:11 +01:00
Martin
aa38fe06ec Refactoring: move ABI-specific variadic stuff to TargetABI type. 2015-02-23 22:52:11 +01:00
Martin
e5deefb1dd Re-implement __va_list struct allocation for System V AMD64 varargs ABI. 2015-02-23 22:52:11 +01:00
Martin
9839cfb889 Experimental varargs fix 2015-02-23 22:52:10 +01:00
David Nadlinger
8436f079c3 Merge pull request #798 from klickverbot/tuple-sarray
Fix initialization of TupleExps with static array members.
2014-12-26 22:54:43 +01:00
kai
024b14cd7f Fix some warnings.
These are easy to solve and reduce the noise in the Travis build.
2014-12-26 15:59:23 +01:00
Alexey Prokhin
b7a361f467 Fix issue #795 — Struct dtor called twice under some circumstances 2014-11-20 16:19:11 +03:00
David Nadlinger
d6e54bef97 Fix initialization of TupleExps with static array members.
Just as for structs, `DVarValue::getRVal()` doesn't dereference the
address for these.

GitHub: Fixes #797.
2014-11-16 21:28:14 +01:00