Commit Graph

3463 Commits

Author SHA1 Message Date
David Nadlinger
33e590932d Merge pull request #560 from klickverbot/assoc-literal
Return  undef instead of null on toConstElem failure.
2013-12-27 10:27:29 -08:00
David Nadlinger
3ec084da59 Return undef instead of null on toConstElem failure.
This fixes a segfault with associative array literals of
arrays of associative array literals, which occured because
of arrayLiteralToConst not handling null values properly.
Ensuring that null pointers are handled correctly in all
toConstElem callers is much more error-prone than just
returning an LLVM undef, an error is emitted anyway.

The root of the problem is actually in the kludgly
implementation of AssocArrayLiteral::toElem, we should
revisit this at some point.
2013-12-27 18:35:50 +01:00
David Nadlinger
6a17b38d83 Merge branch 'master' into merge-2.064. 2013-12-26 15:29:58 +01:00
David Nadlinger
467651fc49 Merge pull request #559 from klickverbot/disable-internalizing-nested-functions
Disable internalizing of nested functions.
2013-12-26 06:27:39 -08:00
David Nadlinger
8c0ad88ec3 Merge pull request #557 from klickverbot/assoc-array-const
Handle differing LLVM types for AA literals.
2013-12-26 06:27:28 -08:00
David Nadlinger
333d538a23 Handle differing LLVM types for AA literals.
This unsfortunately more or less duplicates the code we have for
emitting ArrayLiteralExps, but with the different iteration
strategies, having a single implementation would wind up
even messier.

Unfortunately, no regression test case yet, as I found this deep
inside vibe.d.
2013-12-26 13:39:59 +01:00
David Nadlinger
be185263ba Disable internalizing of nested functions.
This works around linking problems such as rejectedsoftware/vibe.d#338,
caused by the frontend appending template instances to the wrong
module.

GitHub: Fixes #558.
2013-12-26 13:24:41 +01:00
David Nadlinger
bcbb13318a Added test for GitHub #556. 2013-12-26 12:39:52 +01:00
David Nadlinger
68f8e38f51 Merge branch 'master' into merge-2.064. 2013-12-26 12:37:03 +01:00
David Nadlinger
a1ca0def88 Merge pull request #556 from klickverbot/padding-fix
Respect type alignment when choosing zero fill types.
2013-12-26 03:36:17 -08:00
David Nadlinger
f85d2a5a0a Respect type alignment when choosing padding fields.
Fixes ABI mismatch when e.g. padding a 28 byte union from a
20 byte member, where previously, an i64 would be emitted,
yielding a 32 byte LLVM struct size on ulong.alignof == 8
platforms.

Test case will follow on the 2.064 branch.
2013-12-26 12:35:19 +01:00
David Nadlinger
27ecc11915 Remove unused prototype. 2013-12-26 07:05:21 +01:00
Kai Nacke
c231ae0ad0 Merge remote-tracking branch 'origin/master' into merge-2.064
Conflicts:
	gen/arrays.cpp
2013-12-19 21:27:53 +01:00
Kai Nacke
acb1bb161a Fix a problem with the new array bounds check code. 2013-12-19 20:35:54 +01:00
Kai Nacke
5b14263d67 Add CMAKE_DL_LIBS to link command. 2013-12-19 20:35:25 +01:00
Kai Nacke
5f520fccf9 Cache result of DtoFunctionType. 2013-12-19 19:45:16 +01:00
Kai Nacke
62137ca489 ldmd2 requires -lpthread and -lcurses, too.
This is a change to the LLVM CMake files from LLVM 3.5.
2013-12-19 19:16:08 +01:00
Kai Nacke
14ae04c573 Check for terminfo libary.
This fixes another link error on my ARM device.
2013-12-18 22:47:11 +01:00
Kai Nacke
c4cd972a6f Use logic of LLVM to detect pthread library.
But still need to check if LLVM uses pthreads.
2013-12-18 22:25:13 +01:00
Kai Nacke
e82bd4614c Check for pthreads library.
This fixes a link error on my ARM devices.
2013-12-18 21:36:00 +01:00
Kai Nacke
e7fdbafe2d Fix generation of position-independent code.
The new module discovery scheme requires the following section order:

.minfo_beg
.minfo
.minfo_end

This works for non-PIC code because the segments have the same attributes.
However, if -relocation-model=pic is passed to ldc2 then the .minfo section
becomes writeable and the sequence of sections is changed.

The quick fix is to mark the data always as writeable. Then all sections are
always writeable.

I think a better solution would be to base this in the used relocation model.
But this information is currently only available in the driver.

This fixes the failure in test case runnable/eh2.d
2013-12-18 16:54:49 +01: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
74630ed7f1 Simplify LLVM passes.
Use a typedef to minimize difference between LLVM 3.1 and Â3.2+.
Use IRBuilder method CreateMemCpy.
2013-12-16 15:00:00 +01:00
Kai Nacke
2188ef9e56 Merge branch 'master' into merge-2.064 2013-12-16 09:08:11 +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
Kai Nacke
d4f8092dde Support LLVM 3.5.
LLVM 3.5 adds a new required component lto.
2013-12-13 07:41:22 +01:00
Kai Nacke
038855e4a0 Deprecate -noruntime switch (which has now no function). 2013-12-12 20:02:45 +01:00
Kai Nacke
bea0b597ae Add -nogc switch.
This is a replacement for the -noruntime switch. With the new DSO implementation
every module generates runtime calls. The main motivation for the -noruntime switch
is to avoid implicit GC calls. Therefore a dedicated -nogc switch is introduced.
2013-12-10 18:33:49 +01:00
Kai Nacke
d25d28f914 Extend error message if -noruntime is used.
The name of the implicit called runtime function gives a hint about
what goes wrong.
2013-12-08 20:24:08 +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
669319b924 Fix DMD Issue 8360 - Destruction of uninitialized temporary struct with assert 2013-12-08 20:40:14 +04:00
Kai Nacke
43acc1f9c8 Check if basic types are read from object.di before usage.
If object.di was not read or is incomplete then basic types may be missing.
This results in a crash if they are used during runtime initialization.
This fixes #551.
2013-12-08 17:30:02 +01:00
Kai Nacke
a2d7c9f3ed Only define version Android if compiling for this environment.
Android is a variant of Linux. In order to simplify the version coding,
only version Android is defined (version linux and version Posix are not).
2013-12-08 15:29:10 +01:00
Kai Nacke
0628a1f9f3 Exclude threadasm.S from build if CMake version is less than 2.8.5.
Assembler support was rewritten in CMake 2.8.5. The new functionality
is required to assemble the file, otherwise a bunch of error messages
is generated. The solution is to exclude the file from the build.
This is only a problem for non-x86 platforms (PPC, Mips).

General advise is to use at least CMake 2.8.5. This fixes #464.
2013-12-08 15:24:42 +01:00
Alexey Prokhin
ffe26e4ccc Fix DMD Issue 11238 - Codegen error when this is a ref parameter to the method 2013-12-08 14:56:40 +04:00
Alexey Prokhin
89573a731a Fix DMD Issue 10451 - Array of pointers to opaque struct gives forward reference errors. 2013-12-08 14:43:45 +04:00
Alexey Prokhin
9e724b3f9a Implement ClassReferenceExp::toElem 2013-12-08 14:37:16 +04:00
Alexey Prokhin
dcf005213b Implement cast to void 2013-12-08 14:37:15 +04: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
Alexey Prokhin
5a181d9312 Update struct type info generation to reflect changes in dmd frontend 2013-12-08 14:36:59 +04:00
Alexey Prokhin
d235e4cc28 Fix DMD Issue 10425 - Link error with templates.
Merged dmdfe changes in typeinf.c
2013-12-08 13:17:49 +04:00
Kai Nacke
2fa997e6ad Fix wrong #if 2013-12-06 09:20:22 +01:00
Kai Nacke
4faa8d85b7 Merge branch 'master' into merge-2.064
Conflicts:
	runtime/phobos
2013-12-05 13:15:41 +01:00
Kai Nacke
7bd1d4900c Do not allow failures for LLVM 3.4 on Travis-CI.
LLVM 3.4rc2 has been released. As the last issue is fixed, we now start to
support LLVM 3.4.
Adds also a build for LLVM 3.5 (which is allowed to fail).
2013-12-05 12:07:56 +01:00
Kai Nacke
1f983f7c6a Cherry-pick phobos commit to make std.math unit test IEEE 754 compliant 2013-12-05 11:11:37 +01:00
Kai Nacke
c0673fee71 Merge branch 'master' into merge-2.064 2013-12-05 08:41:05 +01:00
Kai Nacke
76199638c1 Fix null pointer derefence in LLVM 3.5 2013-12-05 08:40:04 +01:00
Kai Nacke
9c590a1b88 Merge branch 'master' into merge-2.064 2013-12-03 18:10:29 +01:00
Kai Nacke
cc22116993 Add Android version identifier 2013-12-03 16:47:22 +01:00