The commit itself should be fine, but the more aggressive
inlining being done on the GC code (due to the gcbits functions
being in available in gc.gcx) seems to have uncovered a
misoptimization bug in LLVM (at least in 3.2) on x86, leading to
various unit tests failing in relase mode.
This reverts part of commit f02e4b1925.
A "statementsToo" flag was added to DMD, which disables inlining
of pretty much any functions that actually return a value – set it
to false for our purposes.
The other parts of the diff are just cosmetic.
This reverts commit c4adbedcc, which would have fixed the
problem at its roots, but caused strange template function
attribute inference failures in D-YAML, presumably due to
the different order of semantic3 execution on the templates.
On a PowerPC target the datatype real is mapped to PPC 128bit doubledouble type.
Please note that this yet does not work if you cross compile from a different
architecture.
The previous solution was problematic because the change was language-
visble via the isUnsigned trait. Now, pointers are simply explicitly
checked for in the relevant places. (Note that there might be cases in
the diff where a direct isunsigned() call would have been appropriate –
I only checked for instances where the type clearly cannot be a pointer,
but chose to go the safe route in replicating existing behavior
otherwise).
Fixes DMD testcase 'traits'.
This simplifies the code in module.cpp a bit. But it is also the base to implement a pragma to place an arbitrary function in llvm.global_ctors and llvm.global_dtors.
See the comment in DtoCallFunction for an explanation of what is
going on.
The struct zero initialization code was also refactored out to
AssignExp::toElem and modified so that it is only triggered
on integer->struct assignments, not for any types where the
modifier-stripped types don't match up. This would have lead to
silently wrong code in the cases where the assert would have been
triggered otherwise.
Fixes the Phobos testsuite build.
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).
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'.
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.
On OS X, there is an actual significance to the distinction, which before lead e.g. to exception throwing in the below example being broken:
---
import core.exception;
void main() {
asm {
jmp Lfoo;
Lfoo:
;
}
throw cast(OutOfMemoryError)cast(void*)OutOfMemoryError.classinfo.init;
assert(0);
}
---
1) The last parameter of getGetElementPtr() has type bool. In some instances, a 2 is used as parameter. This is converted to true.
2) Several loops use int instead of unsigned. This causes warning about signed/unsigned mismatch.
Curiously, only Visual C++ complains about this. Nevertheless I think that the warnings should be fixed.