Commit graph

221 commits

Author SHA1 Message Date
Martin
e1394fad5f Build vtable type lazily 2016-11-19 15:29:19 +01: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
Johan Engelen
463e53b9ac Apply DDMD PR #5885 (f5f9150ea57cce5fabb43c79ff1b187d34d37044).
This fixes incorrect overriding of class methods and gets rid of many C++ warnings.
2016-07-25 15:25:01 +02:00
Martin
de9149f1b6 Remove getLVal() from DValue and add DtoL/RVal() overloads 2016-06-13 22:30:16 +02:00
Martin
e3e2f4b2e9 DValue: Remove method getType()
Use the existing public field directly instead.

It's shorter and different than LLValue's getType() (making it easier
to discriminate DValues and LLValues for experienced LDC devs imho).
2016-06-13 22:30:13 +02:00
Martin
039560bd83 Introduce DtoRVal/DtoLVal convenience functions
No functional changes intended.
2016-06-13 22:30:13 +02:00
Johan Engelen
3426b7d9ec Merge pull request #1455 from JohanEngelen/cpp11
C++11 a few loops [NFC]
2016-05-09 19:44:23 +02:00
Johan Engelen
c77c16ef59 C++11 a few loops [NFC] 2016-04-24 14:45:06 +02:00
Rainer Schuetze
1f5d689526 fix vtbl generation for interfaces (bad caching caused wrong thunks to be used)
fix interface casting
2016-04-18 08:22:31 +02: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
Johan Engelen
70a6e73188 Cleanup runtime fwd decls and use ABI functiontype rewriting 2015-11-22 01:27:26 +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
05d45350aa clang-tidy: Add readability-else-after-return 2015-11-02 11:30:40 +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
2d959ea540 Make use of C++11 range-based for
Should be available now that support for LLVM < 3.5 has been dropped.
2015-11-01 14:49:04 +01: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
553cc3705c Clarify ClassInfo/ModuleInfo size mismatch error messages
GitHub: Fix #1067.
2015-09-10 10:09:49 +02:00
David Nadlinger
6215acc15a Merge pull request #1030 from klickverbot/cfg-rewrite
EH/cleanup codegen rewrite
2015-08-20 15:30:15 +02:00
David Nadlinger
4bcae9731a The big catch/finally rework, part 2
Now with *almost* working EH codegen. Does not compile Phobos yet
because we run into the "instruction does not dominate all uses"
issue when an r-value result of toElemDtor is used and we need to
run cleanups in between. Should easily be fixed by promoting those
values to allocas.

Most of the changes outside of ir/irfunction.{h, cpp} are just
because CreateCallOrInvoke moved locations. I took the
opportunity to also make use of the different arg count
overloads where possible.
2015-08-19 19:56:39 +02:00
Martin
5d71dc38df Fix issue 1024: allow classes to be cast to typeof(null)
... and always return null in that case.
2015-08-16 21:43:24 +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
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
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
70218e1fd2 Revert "Don't initialize a new class instance a 2nd time after _d_newclass()." 2015-04-26 00:53:11 +02:00
Kai Nacke
17dddf7c54 Merge pull request #917 from kinke/disabledctor
Don't set default ctor in ClassInfo if it's @disabled.
2015-04-25 23:50:06 +02:00
Martin
ff3a994e09 Don't set default ctor in ClassInfo if it's @disabled. 2015-04-25 19:59:25 +02:00
Martin
f75dcff6a4 Don't initialize a new class instance a 2nd time after _d_newclass(). 2015-04-25 18:50:05 +02:00
Martin
c7e77f9bde Set flag hasDtor for ClassInfos, if appropriate. 2015-04-22 23:07:31 +02: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 Nacke
56713ecea4 Add enum for ClassInfoFlags.
Commit provided by Trass3r.
2014-11-11 00:47:47 +01: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
2071cf4b3d [cleanup] Merge DtoIndex{Struct, Class}. 2014-10-11 03:28:48 +02:00
David Nadlinger
bb1ad7e324 Clean up linkage handling.
Since the change to the symbol emission strategy, a lot of the
previous attempts to derive the linkage for a symbol from its
AST node has been superfluous. This cleans up all the related
code, as it is really not doing much anymore.

The code to opportunistically internalize symbols is now gone
entirely. It was commented out anyway due to problems with
making it work reliably in the face of the not-so-stable
structure of the AST we get from the frontend (regarding the
modules certain symbols end up in). But in any case internal
linkage woudl also be troublesome for cross-module inlining,
so I gave up on making this work for the time being.

The only (minor) change in the emitted code should be in
.offTi generation, which is untested and disabled by default
anyway (GENERATE_OFFTI).
2014-10-08 20:55:19 +02:00
Alexey Prokhin
66a392a5c2 Rename Type::irtype to ctype for consistency with dmd and gdc 2014-10-05 16:55:12 +04:00
Alexey Prokhin
caa2f15c8a Remove VarDeclaration::aggrIndex 2014-10-05 16:08:52 +04:00
Andreas Hollandt
6db62ee8a9 remove all the "tmp" IR names 2014-10-02 14:36:51 +02:00
Kai Nacke
382ad184d8 Merge branch 'master' into merge-2.066
Conflicts:
	dmd2/builtin.c
	gen/classes.cpp
	gen/functions.cpp
	gen/llvmhelpers.cpp
	gen/statements.cpp
	gen/toir.cpp
	runtime/druntime
	runtime/phobos
2014-09-13 23:11:54 +02:00
Alexey Prokhin
32b1d4cc55 Reduce size of IrDsymbol even more
resolved/defined/declared/initialized are turned into flags.
2014-09-12 14:43:54 +04:00
Alexey Prokhin
18f33b1815 Make IrDsymbol to be a typesafe union to reduce memory usage 2014-09-12 14:43:49 +04:00
Alexey Prokhin
d9189acbc4 Move toElem/toConstElem to visitors 2014-08-27 16:22:02 +04:00
Alexey Prokhin
abfb684bb5 Remove additional ldc alignment of structs 2014-08-22 16:01:34 +04:00
David Nadlinger
2c30cdb2d1 [trivial] Adapt whitespace style. 2014-07-14 02:36:32 +02:00
David Nadlinger
ce5750c4b4 Fix initialization of C++ class instances.
Fixes 'runnable/cppa' on x86.
2014-07-14 02:36:27 +02: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
Alexey Prokhin
6e8e466f5f Fix virtual table and type info for c++ classes 2014-06-26 21:34:38 +04: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
fe39da53e3 Merge of 2.065.0-b3.
The new visitor class is used for IR generation. This removes some modifications from DMD source.
2014-02-10 08:47:25 +01:00