Commit graph

213 commits

Author SHA1 Message Date
David Nadlinger
8e92db150c arrays: Fix crash with void arrays 2015-07-30 00:40:43 +02:00
David Nadlinger
e6d0029f66 arrays: Do not invoke dtor/postblit on garbage when constructing array literal 2015-07-28 04:21:05 +02:00
David Nadlinger
d2135d4ade Fix more duplicate static array postblit calls 2015-07-28 02:12:45 +02:00
Martin
daee7955d5 arrays: Fix distinction between full and element-wise assignment
If both lhs and rhs are static/dynamic arrays, simply compare
the LL types produced by DtoArrayPtr(). If they mach, use full
array assignment, otherwise treat the rhs as compatible element
(e.g., T for T[n], T[n][], T[n][m], or even T[a][b] for
T[a][b][c][] :D).
2015-07-28 01:09:46 +02:00
David Nadlinger
eb96b8ab44 arrays: Disalllow void array block assignment 2015-07-27 21:05:30 +02:00
David Nadlinger
63337b278a arrays: TOKblit assignments never invoke postblit 2015-07-27 21:04:45 +02:00
David Nadlinger
b5e9e556d5 arrays: Fix static array of non-pod structs 2015-07-27 20:15:44 +02:00
David Nadlinger
5bdf482b8a arrays: Do not emit _d_array_slice_copy for static array assignment 2015-07-27 19:36:56 +02:00
David Nadlinger
d2f3717c4d arrays: Fix assigning T[n] to T[n][m]. 2015-07-27 18:50:50 +02:00
David Nadlinger
f1530b2a41 arrays: Do not emit _d_array_slice_copy for construction 2015-07-27 18:50:05 +02:00
David Nadlinger
19fd4938be Fix static array null assignment/default initialization 2015-07-26 19:34:45 +02:00
David Nadlinger
901f015ce4 arrays.cpp: Move some var decls into the inner scope 2015-07-26 19:28:33 +02:00
David Nadlinger
7c40e12a40 arrays.cpp: Move copySlice to avoid forward decl 2015-07-26 19:28:01 +02:00
David Nadlinger
68c0df413e Fix initialization of bool arrays 2015-07-26 17:52:23 +02:00
Martin
9d5560601a WIP: fix array construction/assignment wrt. RAII 2015-07-22 01:41:17 +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
544af80417 Fix an unused variable warning 2015-04-12 20:17:57 +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
ced658da92 Merge branch 'master' into merge-2.067 2015-04-05 03:29:30 +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
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
Kai Nacke
fe9c769ce1 Fix yet another missed bitcast 2015-03-23 21:16:35 +01:00
kai
b9a41ecba7 Use llvm::SmallVector instead of std::vector.
A quick statistic collection revealed that during
druntime/phobos compilation no more then 7 arrays are
concatenated. Pre-allocation of 16 elements should be
good for most cases.
2015-03-22 13:49:11 +01:00
kai
bd0dc3b9d5 Add slices in reverse order 2015-03-21 20:23:20 +01:00
kai
05b501dc83 Add bitcast before loading value. 2015-03-21 19:42:58 +01:00
kai
9ef4c8f421 Implement _d_arraycatnTX and remove _d_arraycatnT.
With this commit, the first simple applications can be linked and run!
2015-03-21 17:37:51 +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
kai
a2748cd2fd Merge current development state of 2.067
First merge of current development stream. Asm blocks are known to be broken.

DMD:      0c9f437bc24015707130ba42dc434d9cd58282fb
druntime: 86d49cfb3670904603df0cfdfe44c6fff565c0fc
Phobos:   a8ca4f7964becac680af0eadbde05aa7d10fc338
2014-11-15 18:53:23 +01:00
Andreas Hollandt
afcd0aad41 add a few IR names 2014-10-02 14:36:51 +02:00
Andreas Hollandt
6db62ee8a9 remove all the "tmp" IR names 2014-10-02 14:36:51 +02:00
Alexey Prokhin
d9189acbc4 Move toElem/toConstElem to visitors 2014-08-27 16:22:02 +04:00
Alexey Prokhin
76f3fd02bd Call _d_arraybounds for bounds checking instead of _d_array_bounds.
It expects file name as a first argument instead of pointer to Module.
2014-08-22 16:01:35 +04:00
Alexey Prokhin
50f729d415 Use _d_newarrayU instead of _d_newarrayvT 2014-08-22 16:01:34 +04:00
kai
45fca1f3b5 Add line number to error message of -nogc switch.
This was suggested by bearophile in the news group.
It also changes all Loc objects to be passed by reference.
2014-07-04 07:15:05 +02:00
kai
2b6dbb03f4 Add IF_LOG to more logging statements.
Evaluating arguments which call toChars() or toPrettyChars() are much more expensive then checking Logger::enabled().
2014-06-26 06:54:38 +02:00
Kai Nacke
dd3cc5f682 Fix for issue #553.
This version uses the skipboundscheck member variable.
2013-12-16 17:32:01 +01:00
Kai Nacke
bac536a29c Fix for issue #553.
Check if a static array is accessed with a known index. In this case the
bounds check can be omitted.
2013-12-16 08:14:58 +01:00
David Nadlinger
787c147986 Use Module::members -> Dsymbol::codegen to define symbols.
This commit fundamentally changes the way symbol emission in
LDC works: Previously, whenever a declaration was used in some
way, the compiler would check whether it actually needs to be
defined in the currently processed module, based only on the
symbol itself. This lack of contextual information proved to
be a major problem in correctly handling emission of templates
(see e.g. #454).

Now, the DtoResolve…() family of functions and similar only
ever declare the symbols, and definition is handled by doing
a single pass over Module::members for the root module. This
is the same strategy that DMD uses as well, which should
also reduce the maintainance burden down the road (which is
important as during the last few releases, there was pretty
much always a symbol emission related problem slowing us
down).

Our old approach might have been a bit better tuned w.r.t.
avoiding emission of unneeded template instances, but 2.064
will bring improvements here (DMD: FuncDeclaration::toObjFile).
Barring such issues, the change shoud also marginally improve
compile times because of declarations no longer being emitted
when they are not needed.

In the future, we should also consider refactoring the code
so that it no longer directly accesses Dsymbol::ir but uses
wrapper functions that ensure that the appropriate
DtoResolve…() function has been called.

GitHub: Fixes #454.
2013-10-13 19:18:24 +02:00
David Nadlinger
49835a3ce2 Fix assertion error when building Phobos with debug builds.
Turns out that Expression::isConst() actually is much too
pessemistic as it e.g. never regards struct literals as
const.

We should get this fixed to avoid unnecessary heap
allocations for array initialization.
2013-10-13 00:58:56 +02:00
David Nadlinger
47e212178e Emit array literals as unnamed_addr.
There is really no reason not to.
2013-10-09 04:34:32 +02:00
David Nadlinger
26e3cc8a40 Never emit long array literals as inline constant.
Also cleaned up rest of the code a bit.

The LLVM 3.1 problem was already fixed before by not doing
anything on zero-element arrays anyway.
2013-10-09 04:27:41 +02:00
David Nadlinger
60cdf58168 Combine ArrayLiteralExp::toConstElem and initializeArrayLiteral implementations. 2013-10-09 04:07:46 +02:00
David Nadlinger
44f60199ad Factored actual literal building code out of ArrayLiteralExp::toElem. 2013-10-09 01:51:45 +02:00
kai
3c800d2380 Fix for issue #461 2013-09-01 23:09:06 +02:00
kai
80a65e34f3 Use memset to initialize arrays with constant byte value.
This extends the existing code for null values.
2013-08-18 21:58:07 +02:00
kai
fa40b29160 Fix for issue #419.
The vector type was not handled in `DtoConstArrayInitializer()`.
2013-07-01 07:30:27 +02:00
David Nadlinger
235bb94878 Make -release only disable bounds checking in non-@safe code. 2013-06-17 13:31:21 +02:00
David Nadlinger
2cebe6408c Divided ir/irtypestruct.* in general aggregate and struct specific part.
This is just to improve clarity, as it was rather non-obvious
what of the code also applied to classes before.

IrTypeAggr::createInitializerConstant would currently belong in
IrTypeStruct, but this will be refactored anyway.
2013-06-12 17:17:09 +02:00
David Nadlinger
848dee32d4 Store bools as i8.
I really hope we can refactor this to use a less leaky
abstraction later – it should at least be possible to merge
voidToI8 and i1ToI8.
2013-06-07 03:20:54 +02:00