Commit graph

225 commits

Author SHA1 Message Date
Martin
e337cec78a Slightly refactor RTTIBuilder 2018-04-04 19:59:10 +02:00
Martin
4c1154703e Improve LoC propagation for error messages in gen/runtime.cpp 2018-04-04 19:59:10 +02:00
Martin
bd623f028a Redirect access to remaining TypeInfo subtypes through gen/runtime 2018-04-04 19:59:10 +02:00
Martin
d8f60d2f5c Redirect access to object.d type declarations through gen/runtime
Not all type declarations yet (e.g., some TypeInfo subtypes are still
accessed directly), but those already wrapped as LazyType in the
gen/runtime.cpp module (with check and proper error msg in case object.d
doesn't contain a required declaration).
2018-04-04 19:59:10 +02:00
Martin
081b681776 Forward-declare runtime functions lazily
Thereby deferring requirements wrt. object.d declarations (Object,
Throwable, TypeInfo, TypeInfo_Class, TypeInfo_Struct...) and paving the
way for a minimal druntime.

This also greatly reduces the `-vv` output for tiny code samples, e.g.,
reduced test cases.
2018-04-04 19:59:10 +02:00
Martin Kinkelin
5e4d04faad
Call _Unwind_Resume() directly (except for ARM EABI) (#2642)
This fixes the 32-bit std.file unittests on Linux with enabled
optimizations. Quoting the SysV ABI docs:

> This is the only routine in the unwind library which is expected to be
> called directly by generated code: it will be called at the end of a
> landing pad in a "landing-pad" model.

The remaining LDC-specific ARM EABI wrapper (_d_eh_resume_unwind()) is
implemented in assembly (ldc/eh_asm.S), preserving registers apparently.
2018-04-04 19:58:06 +02:00
joakim-noah
04cd029bb9 Pull in Musl's assert function for betterC mode. (#2604) 2018-03-04 20:48:07 +01:00
Oleg Nykytenko
907dae171a Solaris: fix assert for betterC build. (#2566)
* Solaris: fix assert for betterC build.

* Added parens to avoid relying on operator precedence rules.
2018-02-09 16:07:07 +00:00
Martin
197e65efde Merge branch 'master' into merge-2.078
Conflicts:
	driver/main.cpp
	gen/cl_helpers.h
	gen/declarations.cpp
	runtime/druntime
	tests/d2/dmd-testsuite
2018-01-20 11:20:17 +01:00
Johan Engelen
f2d9ff3424
Add DMD-style function trace profiling. (#2477) 2018-01-14 22:22:59 +01:00
Martin
e1e5229f2a Clean up more unused runtime function declarations 2018-01-07 05:37:31 +01:00
Martin
f9575686e1 Get rid of obsolete runtime functions
For array comparisons (new) and the _adReverse family.
2018-01-07 05:03:37 +01:00
Martin
b83780538f Adapt to new string-switch lowering
Now all done in the front-end, no need for us to handle it manually
anymore. This also fixes tests/semantic/dcompute.d.
2018-01-07 01:43:12 +01:00
Johan Engelen
7e7de7a69e
Move instrumentation options into their own .h/.cpp files. (#2472) 2017-12-28 11:44:51 +01:00
Martin
dfe45715ba Enable catching C++ exceptions for non-MSVC targets 2017-11-26 18:41:01 +01:00
Martin
c378636fcf druntime: Use adapted upstream DWARF EH 2017-11-26 18:40:21 +01:00
Martin
b59849ab28 Android: Use proper C assert function signature 2017-11-19 18:56:21 +01:00
Martin
aa97794dc6 Annotate C assert function with nounwind attribute 2017-10-25 00:38:05 +02:00
Martin
30b858781b -betterC: Use C assert function
Instead of druntime's _d_assert[_msg], _d_arraybounds and
_d_switch_error.

Tested by dmd-testsuite's runnable/cassert and compilable/betterCarray.
2017-10-25 00:38:05 +02:00
Martin
c251170912 Rename DtoMangled... to getIRMangled... 2017-10-07 14:06:17 +02:00
Martin
192649326d Remove dead code 2017-10-07 14:06:17 +02:00
Martin
c9a3be1295 Let TargetABI fix up LLVM mangles for more special symbols
For ModuleInfos, ModuleRefs, InterfaceInfos, interface vtables & thunks.
2017-10-07 14:06:17 +02:00
Martin
0b28925e9a Win32: Remove extra leading underscore from D symbol mangling
This is compatible with DMD.
2017-10-07 14:06:17 +02:00
Martin
2616261fd2 Revise all LDC-specific errors/warnings/deprecs and insert backticks
For DMD's new syntax highlighting. I grepped in all .{h,cpp} files only.
2017-08-03 22:53:49 +02:00
Martin
1fb269f940 Drop support for LLVM < 3.7 2017-07-16 02:18:00 +02:00
Martin
5f0e83824b Update 2 hardcoded strings used in error messages 2017-06-17 19:49:54 +02:00
David Nadlinger
747f7a3dfa clang-format files touched in d01a91f7 [nfc]
Some housekeeping on files that recently saw large changes anyway.
2017-05-24 21:35:40 +01:00
Martin
d01a91f755 Allow multiple occurrences for almost all command-line flags
Except for `-sanitize` and `-cache-prune*`.
2017-05-23 20:53:57 +02:00
Johan Engelen
ba1ed88b55 Remove magic +1 constant for parameter indexing. (#2120)
Remove magic +1 constant for parameter indexing.

LLVM may change the indexing offset in the future. See http://llvm.org/viewvc/llvm-project?view=revision&revision=302060
2017-05-20 08:48:48 +02:00
Johan Engelen
64df1687a8 Fix LLVM 5.0 compilation. 2017-04-14 12:55:19 +02:00
Johan Engelen
9e394e4f99 Fix LLVM 5.0 build. (#2050)
llvm::AttributeSet was renamed to llvm::AttributeList
2017-03-29 22:26:17 +02:00
Johan Engelen
bd09cdc659 Optimize static array comparisons to a memcmp call for types for which this is valid.
Resolves #1632
2017-03-01 00:37:48 +01:00
Johan Engelen
d49acaca27 Fix -finstrument-functions. The wrong return address was used. 2017-01-08 22:30:38 +01:00
Rainer Schuetze
99d455226e fix build against LLVM master: llvm/Bitcode/ReaderWriter.h has been split and renamed 2016-11-13 11:05:53 +01:00
LemonBoy
596fc82254 Implement -finstrument-functions.
Closes #1839.
2016-11-06 23:17:04 +01:00
kinke
498cf6df8d Merge pull request #1833 from kinke/reenableRuntimeFunctionsCheck
Re-check existing runtime function declarations for matching type
2016-10-23 02:13:24 +02:00
David Nadlinger
c083a67e3e Mark _d_throw_exception as cold/noreturn
`noreturn` have been inferred already by the `unreachable` following
the call, but being explicit can't hurt.
2016-10-21 23:04:00 +01:00
Martin
d7b45f7c7d Revert "Revert "Check existing runtime function declarations for matching type""
This reverts commit 2de6538241.
2016-10-15 23:30:07 +02:00
David Nadlinger
bb2b648d8e Shared library support for OS X (#1705) 2016-10-15 16:17:39 +01:00
David Nadlinger
2de6538241 Revert "Check existing runtime function declarations for matching type" 2016-08-15 15:47:19 +02:00
David Nadlinger
94b111c971 Merge pull request #1570 from kinke/runtime_check
Check existing runtime function declarations for matching type
2016-08-15 14:55:18 +02: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
Martin
7151302a06 Check existing runtime function declarations for matching type
This fixes issue #958 by checking the function type of an existing
function declaration with the same runtime function name inside the
codegen'd module.
This should normally be an existing forward declaration from a previous
runtime call, but the user is free to declare (and even implement) it
too.

The LOC for the error is empty as the provided `loc` may likely be from
a template instantiation from another module.
2016-06-20 00:09:42 +02:00
Johan Engelen
04b89e642c Windows: Move the prepending of 0x1 to C++ mangled functions from frontend to the backend.
Windows x64 ABI: remove unnecessary \01 from mangled symbol name.

This removes the 0x1 byte from `.mangleof` accessible from user code.
Resolves issue #1519

Also let mangleForLLVM take a std::string, to enable C++11's moves.
2016-05-30 10:18:39 +02:00
Johan Engelen
7657e5f7d8 Move ArrayParam helper type to llvmhelpers.h to make it available for use elsewhere. 2016-04-18 09:50:19 +02:00
Dan Olson
cd216538f9 Merge branch 'master' into objc-wip 2016-04-08 22:38:39 -07:00
Martin
5693942e6e Merge branch 'ltsmaster'
Conflicts:
	gen/runtime.cpp
	runtime/druntime
	runtime/phobos
	tests/d2/dmd-testsuite
2016-03-27 19:51:44 +02:00
Kai Nacke
34ac5c5f3a Add 'cold' and 'noreturn' attributes to _d_assert et.al.
These functions are only called at most once: in case of a failure.
They always raise an exception and never return normally. Marking
them as 'cold' and 'noreturn' may help the (not yet added) IRCE pass.

Also adds the missing 'uwtable' attribute for x86_64 and clang-format
the file.
2016-03-27 14:53:57 +02:00
Dan Olson
00e6472931 Fix bad assert conditional
I guess I should test with LLVM asserts on :-(
2016-03-24 00:22:49 -07:00
Dan Olson
5b090baef3 Objective-C runtime cleanups
Only create runtime calls when Objective-C is supported.
2016-03-23 23:33:26 -07:00