Commit graph

16 commits

Author SHA1 Message Date
David Nadlinger
ffb88adf93 Removed another (benign?) instance of storing an i1 as i8 2015-09-14 12:53:02 +02:00
David Nadlinger
613781b13f Fix alignment of interface info in class with align(1) members
GitHub: Fix #1058.
2015-09-02 19:14:14 +03:00
David Nadlinger
63ca3c7eb4 Always zero struct padding as required by TDPL
We already generated the memsets for zeroing the padding,
but because we relied on the native LLVM type allignment
where possible instead of generating explicit padding
values, LLVM did not always copy those bytes around (e.g.
when spilling/reloading registers).
2015-08-10 20:49:30 +02:00
Kai Nacke
cf1d792582 Use a byte array for padding of unions/structs.
The previous approach was to add i64, i32, i16, i8 members depending
on alignment and required space. This seems to cause several problems.
Solution is to use a byte array. This makes to code more compact, too.

Fixes issue #989.
2015-07-12 12:52:14 +02:00
David Nadlinger
c65faeabaf Fix struct alignment padding type selection
GitHub: Fixes #944.
2015-05-29 01:11:58 +02:00
kai
ed6e0a4ac7 LLVM 3.7: Fix IrTypeAggr() constructor. 2015-03-06 21:24:49 +01:00
kai
0449b26744 Fix for issue #841.
The `union` is not created as packed type. This seems to create problems with the default initializer:

    struct Foo
    {
        static union Bar
        {
            bool b;
            ulong l;
        }

        Bar bar;
    }

    static this()
    {
        Foo foo = Foo();
    }

creates an error. If you change the order inside the union

        static union Bar
        {
            ulong l;
            bool b;
        }

then the code works.

Also cleans up the creation of the additonal zeroes for the initializer.
2015-02-28 18:52:56 +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
kai
1c18d5825e Fix for issue #809.
If there are gagged errors then `fatal()` is called in `irtypeaggr.cpp/AggrTypeBuilder::addAggregate()`.
In this case `fatal()` should only be called is there is no error gagging and an overlapping initialization
has been detected.
2014-12-16 21:09:01 +01:00
Alexey Prokhin
9314fc1c1c Fix issue 726: Wrong alignment for struct fields on x86_64/amd64 2014-10-11 18:12:11 +04:00
Alexey Prokhin
0b180be099 [cleanup] Merge common code in IrTypeStruct::get() and IrTypeClass::addBaseClassData() 2014-10-11 17:58:18 +04:00
David Nadlinger
bff766b379 Track member field index in IrTypeAggr, not IrField.
This fixes a regression introduced in caa2f15c8a. The IrDsymbol
metadata is obviously reset in between modules, while IrTypes
are not. Thus, we can never set symbol metadata when resolving
types, as the symbol data will be wrong in all modules following
the one where the type was first resolved.

GitHub: Fixes #739.
2014-10-11 03:28:49 +02:00
David Nadlinger
9700d84132 Initialize IrTypeAggr members in order to silence warning. 2013-06-17 02:38:38 +02:00
David Nadlinger
a0ffaf56bf Do not codegen aggregate types from within debug info generation.
This avoids problems where we would codegen children of an
"inner" template instantiation (i.e. a member of a non-template
aggregate in another module) because we have no way to know the
outer (declare-only) entity exists in the respective
mustDefineSymbol invocation.

An example for this are the std.typecons.RefCounted internals of
std.file.DirIterator, as used from std.datetime and other modules.
This is not only inefficient, but also causes linking issues due
to attribute inference for these functions not having run yet
(and consequently the mangled name being different from the
actual definition).
2013-06-16 19:33:04 +02:00
David Nadlinger
9a016a1002 Refactor struct initializers codegen.
This not only reduces code duplication, but the unification
also enables code a la StructLiteralExp to handle classes
(for CTFE class constant support in 2.063).
2013-06-12 20:16:05 +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