David Nadlinger
ee50259dfd
C ABI: Do not pass empty structs as parameters at all
...
This is most visible on x86 (32-bit), where the stack
alignment is off otherwise.
This change is quite messy because many places assumed
that there was always exactly one LLVM parameter per
TypeFunction::parameters entry.
2015-08-22 23:41:56 +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
Kai Nacke
15b1ee1576
DebugInfo: Output the underlying delegate for lazy parameters.
...
This fixes issue #959 .
2015-06-04 15:09:29 +02:00
kai
b3e239a527
Fix generation of DWARF debug information in LLVM 3.6.
...
The creation of complex expressions (e.g. address calculations) was extended in LLVM 3.6.
2014-10-12 12:40:31 +02: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
Alexey Prokhin
18f33b1815
Make IrDsymbol to be a typesafe union to reduce memory usage
2014-09-12 14:43:49 +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
David Nadlinger
b40969b660
Re-introduce glue layer closure building error.
...
This reverts part of b15ffe2ef0
,
and fixes 'fail_compilation/fail10666'.
2014-06-04 14:34:28 +02:00
kai
b15ffe2ef0
Merge branch 'master' into merge-2.064
...
Conflicts:
gen/nested.cpp
2014-06-02 06:41:23 +02:00
Christian Kamm
522585aa6d
Fix dmd test template2962 by removing nestedVars.
...
nestedVars was always a copy of closureVars. There was no point to it
existing.
2014-05-29 16:49:43 +02:00
Alexey Prokhin
a6973a39b7
Temporary variables cannot be referenced inside a closure
2014-01-12 15:44:17 +04:00
kai
6287a4d422
Replace ArrayIter<> with Array<>::iterator.
...
Just use the new iterator instead of the old Java-like class.
Also removes a dead iterator and replaces an iterator with a
pointer in some place.
2014-01-11 14:48:41 +01:00
Kai Nacke
bdc1f44088
Merge remote-tracking branch 'origin/master' into merge-2.064
...
Conflicts:
gen/runtime.cpp
runtime/CMakeLists.txt
2013-12-08 19:29:10 +01:00
Kai Nacke
aeba90b9f9
Fix a clang warning
2013-12-08 18:59:17 +01:00
Alexey Prokhin
5a10a23cef
Remove redundant FuncDeclaration::nestedVars.
...
The change not only makes the code cleaner but also fixes compilation of multiple files at once.
Previously, fd->nestedVars may have been filled twice if fd was a template function instantiated in two modules simultaneously.
2013-12-08 14:37:15 +04:00
David Nadlinger
265d3ee069
Do not try to emit nested functions with unanalyzed parents.
...
GitHub: Fixes #497 .
2013-10-13 21:37:53 +02:00
David Nadlinger
243146199f
Function literals start again at nesting depth zero.
...
GitHub: Fixes #447 .
2013-09-12 13:47:54 +02:00
David Nadlinger
e5463f77b7
FuncDeclaration::nestedVars should only be filled in DtoCreateNestedContextType.
2013-09-12 13:46:45 +02:00
David Nadlinger
14bc59f31a
Nested context creation code beautification.
2013-09-12 10:14:17 +02:00
kai
c28c7fb134
Introduce a debug info builder.
...
Moves all code from todebug into a new class.
Also caches the compilation unit in order to fix a LLVM 3.4 compile error.
2013-07-29 00:04:08 +02:00
David Nadlinger
9c0514a9b1
Correctly load context for nested class members with own nested context.
...
Fixes DMD testcase 'xtest46'.
2013-06-14 15:49:15 +02:00
David Nadlinger
292caa1438
Merge the 2.063 frontend.
2013-06-12 20:16:37 +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
kai
1e4a8fffc2
Remove DMDV1 and DMDV2.
2013-03-06 10:20:24 +01:00
David Nadlinger
0a96aea868
Sort includes according to style guidelines:
...
1. Main include corresponding to .cpp file, if any.
2. DMD and LDC includes.
3. LLVM includes.
4. System includes.
Also updated a few include guards to match the default format.
2013-02-07 21:20:55 +01:00
David Nadlinger
7a4c378788
Correctly set 'outer' reference of nested inner classes.
...
Fixes DMD testcase 'test11'.
2013-01-04 16:48:10 +01:00
David Nadlinger
0508acf10b
Cleanup: Remove redundant piece of code.
...
This case is already handled in DtoCreateNestedContextType.
2013-01-04 07:31:18 +01:00
David Nadlinger
0cd78dd579
Cleanup: Clang warning fixes.
...
No warnings left on a '-Wall' build except for a single tautological
compare in gen/asm-x86-32.h, which indeed seems like a bug.
2012-12-20 01:00:55 +01:00
David Nadlinger
db59b30eda
Slight rewrite to make intent cleaner.
...
No functionality change intended, although it might make the last
commit unnecessary.
2012-12-19 20:38:54 +01:00
David Nadlinger
080d0cef0f
Debug log formatting fix.
2012-12-19 19:49:03 +01:00
David Nadlinger
9458911839
Added LLVM-style license headers to all our files.
2012-12-16 17:19:14 +01:00
David Nadlinger
45a3060da7
Prettied up nested context debug output.
...
The assertion is currently triggered when building the Tango/D1 unit tests.
2012-11-08 21:44:14 +01:00
David Nadlinger
ece5176aa9
D1: Fix Tango build.
...
'this' for methods nested in structs is now internally passed as a
pointer, even if struct this is by value in D1.
2012-10-21 01:11:04 +02:00
David Nadlinger
051cd7302e
Fixed two issues with nested functions as template alias parameters.
...
Fixes #131 (GitHub).
2012-10-07 03:06:07 +02:00
David Nadlinger
c9e2fc34d1
Cleanup.
...
If ad would be null, the code above would have already crashed.
2012-10-06 20:40:14 +02:00
David Nadlinger
2d54a02295
Use null instead of undef for unneeded nested context pointers.
2012-10-06 13:07:17 +02:00
David Nadlinger
d4eafe53e0
Removed obsolete nested context styles.
...
NChybrid was the only one that didn't instantly trigger a "not
implemented" assertion on any code using nested function for a long
time, and removing the cruft greatly improves code readability
(maintainability is a moot point anyway given its current state).
2012-09-07 03:51:33 +02:00
David Nadlinger
ee4285f934
Properly handle DMD-internal "reference variables".
...
Previously, we just had a hack to make ref foreach statements work.
This commit enables them to work in other cases as well, like the
implicit __result variable for functions with out-contracts (which
is such a magic ref variable for ref-returning functions).
Fixes DMD testcase 'testcontracts'.
2012-09-07 03:51:33 +02:00
kai
2dbee75523
Prefer C++-style casts.
...
This is based on Item 2 of "More Effective C++". In general, the C++ cast operators are more expressive and easy to find,
e.g. by grep. Using const_cast also shuts up some compiler warnings.
2012-08-02 19:55:29 +02:00
David Nadlinger
cef19fb225
Fix #125 – Nested class context pointer invalid (D1).
...
Patch originally by Alexey Prokhin, thanks.
2012-06-24 16:18:47 +02:00
David Nadlinger
67f12fe8b5
Fixed DSource #330 – Many-at-a-time nested context crash (D1).
2012-06-24 11:30:32 +02:00
David Nadlinger
61e61e47f0
Fix #125 - fix generation of nested context chains.
...
Just declaring the type of the parent is obviously not enoguh, we need to have run this very code for determining level and context type (if the parent is also nested, that is).
2012-06-23 17:05:59 +02:00
Alexey Prokhin
15a903580b
Partial fix for #69 — LDC1 from master fails to build Tango.
...
Fixed regression that has been introduced in commit 9889067
.
2012-01-29 12:32:13 +04:00
Alexey Prokhin
9889067420
Fixed #53 — Assertion !isaStruct(t)
2012-01-10 19:46:32 +04:00
Alexey Prokhin
91f4e5d015
Added emission of dwarf lexical blocks.
...
Also, dropped support for DISABLE_DEBUG_INFO definition.
2011-12-04 15:34:35 +04:00
Alexey Prokhin
b8721a8515
Emit debug info for variables that are used in nested functions
2011-12-03 23:45:58 +04:00
Alexey Prokhin
629f13929e
WIP: port to llvm 3.0
2011-10-25 15:43:39 +04:00
David Nadlinger
9864129fb8
Merge branch 'master' into merge-2.054
...
Conflicts:
gen/statements.cpp (returning void from main() was fixed on both branches)
2011-08-17 16:09:28 +02:00
David Nadlinger
3f448afa37
Another nested context crash fix.
...
The test case that would previously crash:
a.d
---
module a;
@property bool empty(T)(in T[] a) {
return !a.length;
}
void find(alias pred,R1)(R1 haystack) {
simpleMindedFind!pred(haystack);
}
void simpleMindedFind(alias pred, R1)(R1 haystack) {
bool haystackTooShort() {
return haystack.empty;
}
}
---
b.d
---
module b;
import c;
void getTimeZone() {
indexOf();
}
---
c.d
---
module c;
import a;
void indexOf()() {
find!({})("");
}
---
2011-08-17 02:33:33 +02:00