Commit Graph

1144 Commits

Author SHA1 Message Date
klutzy
e41a81b1ee Set main_name "WinMain" on Win64 2013-08-26 22:15:26 +09:00
Jed Davis
5f536efa9f Don't truncate discriminants to host uint for C_uint's sake. 2013-08-24 20:16:40 -07:00
Jed Davis
8ef8dd9ceb Make enum discriminants u64 instead of the host uint. 2013-08-24 20:16:40 -07:00
bors
8bf65a156c auto merge of #8719 : msullivan/rust/cleanup, r=catamorphism
r?
2013-08-24 01:11:28 -07:00
Daniel Micay
180e235d3d fix performance regression from invalid IR
Monomorphize's normalization results in a 2% decrease in non-optimized
code size for libstd, so there's a negligible cost to removing it. This
also fixes several visit glue bugs because normalize wasn't considering
the differences in visit glue between types.

Closes #8720
2013-08-23 19:23:54 -04:00
Michael Sullivan
7bee0501ca Use the proper monomorphized ty::t for llvm alias hints. Closes #7260. 2013-08-23 10:27:38 -07:00
bors
f8c4f0ea9c auto merge of #8684 : michaelwoerister/rust/stepping_and_scope_fixes, r=jdm
This PR contains some code cleanup and the fix for issue #8670.
~~I am not sure about issue #8442 (could not reproduce it). @jdm, could check after this is merged and possibly close the issue then?~~ (closed now)

Some interesting facts: With this commit, it should be possible to compile libstd with `-Zdebug-info` (it does not work yet with `-Zextra-debug-info` but we are getting there). Switching debug info on increases the compile time for libstd by about 2 seconds.

@catamorphism I get one failing test in rustpkg:
`package_script_with_default_build` says: `task <unnamed> failed at 'Couldn't copy file', /home/mw/rust/src/librustpkg/tests.rs:689`
Would you have any idea what that is about? Seems be something wrong on my machine...

Cheers,
Michael

Fixes #8670
2013-08-23 07:46:19 -07:00
Michael Sullivan
97d2b44f87 Substitute into the impl method rather than the trait method when emitting vtables. Closes #8601. 2013-08-22 10:52:11 -07:00
bors
4e3dbf959a auto merge of #8666 : nikomatsakis/rust/issue-3678-extern-fn-types, r=pcwalton
Change the type of crust fns like this one:

    extern fn foo() { ... }

from `*u8` to `extern "C" fn()`.

r? @pcwalton (or whomever)
2013-08-22 07:01:27 -07:00
Michael Woerister
0e8a64073c debuginfo: Improved handling of function preludes. 2013-08-22 10:58:01 +02:00
Michael Woerister
8c09e2b790 debuginfo: Big cleanup refactoring and support for foreign_item_fn. 2013-08-22 10:58:01 +02:00
bors
9feaf1d023 auto merge of #8594 : bytewiseand/rust/static-fn-ptr, r=pcwalton
Fixes #8588
2013-08-21 15:51:34 -07:00
bors
18144b12b1 auto merge of #8546 : jld/rust/discrim-symbol-rm, r=pcwalton
Given that bootstrapping and running the testsuite works without
exporting discriminant values as global constants, I conclude that
they're unused and can be removed.
2013-08-21 12:51:40 -07:00
Niko Matsakis
82a9abbf62 Change type of extern fns from *u8 to extern "ABI" fn
cc #3678
2013-08-21 10:50:37 -04:00
Niko Matsakis
94a084a4b4 Fix crash(!) by using the *Rust fn type* not the extern fn type
cc #3678
2013-08-21 10:50:32 -04:00
bors
d4d856b129 auto merge of #8582 : thestinger/rust/container, r=thestinger
5f3a637 r=huonw
934a5eb r=thestinger
0f6e90a r=cmr
2013-08-21 01:01:47 -07:00
bors
48dded95c6 auto merge of #8580 : bytewiseand/rust/tuple-struct-ctor-ptr, r=alexcrichton
Fixes #5315
2013-08-20 23:11:50 -07:00
Daniel Micay
46fc549fa9 rm obsolete integer to_str{,_radix} free functions 2013-08-20 22:05:03 -04:00
bors
293660d443 auto merge of #8519 : msullivan/rust/objects, r=catamorphism
r?
2013-08-20 13:32:00 -07:00
bors
a8c3fe45c6 auto merge of #8328 : alexcrichton/rust/llvm-head, r=brson
The first commit message is pretty good, but whomever reviews this should probably also at least glance at the changes I made in LLVM. I basically reorganized our pending patch queue to be a bit more organized and clearer in what needs to go where. After this, our queue would be:

* Add the `no-split-stack` attribute
* Add the `fixedstacksegment` attribute
* Add split-stacks for arm android
* Add split-stacks for arm linux
* Add split stacks for mips

Then there's a patch which I added to get rust to build at all on LLVM-head, and I'm not quite sure why it's there, but nothing seems to be crashing for now! (famous last words).

Otherwise, I just updated code to reflect the changes I made in LLVM with the only major change being the advent of the new `no_split_stack` attribute. This is work towards #1226, but someone more familiar with the code should probably actually assign the attribute to the appropriate functions.

Also as a bonus, I've verified that this closes #5774
2013-08-20 11:31:59 -07:00
Alex Crichton
7f91e7740d Fix LLVM compilation issues and use the new attrs
This implements #[no_split_stack] and also changes #[fast_ffi] to using the new
"fixedstacksegment" string attribute instead of integer attribute.
2013-08-20 08:33:52 -07:00
Jed Davis
46672d2b06 Remove discriminant symbols.
Given that bootstrapping and running the testsuite works without
exporting discriminant values as global constants, I conclude that
they're unused and can be removed.
2013-08-19 11:34:43 -07:00
Michael Sullivan
6a6d3b600f Make supertrait methods callable on object types.
This requires changes to method search and to codegen. We now emit a
vtable for objects that includes methods from all supertraits.
Closes #4100.

Also, actually populate the cache for vtables, and also key it by type
so that it actually works.
2013-08-19 11:08:07 -07:00
bors
2246d56e71 auto merge of #8619 : pnkfelix/rust/fsk-visitor-vpar-defaults-step3, r=nmatsakis
Follow up to #8539 (step 2 of 5).

(See  #8527, which was step 1 of 5, for the full outline.)

Part of #7081.
2013-08-19 09:12:03 -07:00
Niko Matsakis
0479d946c8 Add externfn macro and correctly label fixed_stack_segments 2013-08-19 07:13:15 -04:00
Niko Matsakis
303f650ecf Issue #3678: Remove wrappers and call foreign functions directly 2013-08-19 07:13:15 -04:00
Andreas Martens
a1066130c0 Fix ICE when calling static and static function pointers
Fixes #8588
2013-08-18 20:21:23 +02:00
bors
6a88415ed8 auto merge of #8544 : dim-an/rust/fix-match-pipes, r=pcwalton
Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).

Closes #6338.
2013-08-17 20:12:02 -07:00
bors
679102109f auto merge of #8554 : michaelwoerister/rust/generics, r=brson
This pull request includes support for generic functions and self arguments in methods, and combinations thereof. This also encompasses any kind of trait methods, regular and static, with and without default implementation. The implementation is backed up by a felt ton of test cases `:)`

This is a very important step towards being able to compile larger programs with debug info, since practically any generic function caused an ICE before.

One point worth discussing is that activating debug info now automatically (and silently) sets the `no_monomorphic_collapse` flag. Otherwise debug info would show wrong type names in all but one instance of the monomorphized function.

Another thing to note is that the handling of generic types does not strictly follow the DWARF specification. That is, variables with type `T` (where `T=int`) are described as having type `int` and not as having type `T`. In other words, we are losing information whether a variable has been declared with a type parameter as its type. In practice this should not make much of difference though since the concrete type is mostly what one is interested in. I'll post an issue later so this won't be forgotten.

Also included are a number of bug fixes:
* Closes #1758
* Closes #8513
* Closes #8443
* Fixes handling of field names in tuple structs
* Fixes and re-enables test case for option-like enums that relied on undefined behavior before
* Closes #1339 (should have been closed a while ago)

Cheers,
Michael
2013-08-17 15:22:04 -07:00
Andreas Martens
c4b4cb36c8 Fix segfault when calling tuple struct constructor as extern fn
Fixes #5315
2013-08-17 22:42:31 +02:00
Michael Woerister
5abb7c3a67 debuginfo: Test cases for [generic][default][static] methods and functions:
* closure-in-generic-function
* generic-functions-nested
* generic-method-on-generic-struct
* generic-trait-generic-static-default-method
* method-on-generic-struct
* self-in-generic-default-method
* trait-generic-static-default-method

Also, fixed an 'unused variable' warning in debuginfo.rs
2013-08-16 22:30:43 +02:00
Michael Woerister
0e7808c2e0 debuginfo: Support for combinations of Self type and type parameters. 2013-08-16 22:30:43 +02:00
Michael Woerister
c1734cef33 debuginfo: Implemented support for Self type parameter in trait methods with default implementation. 2013-08-16 22:30:43 +02:00
Michael Woerister
689929c51a debuginfo: Added support for self parameter in methods. 2013-08-16 22:30:42 +02:00
Michael Woerister
44557e7a33 debuginfo: Fixed crash occuring for parameterless closures. 2013-08-16 22:30:42 +02:00
Michael Woerister
5c9d7c2072 debuginfo: Added test cases for generic structs and enums.
Also, always set no_monomorphic_collapse flags if debuginfo is generated.
2013-08-16 22:30:42 +02:00
Michael Woerister
6c49c2df76 debuginfo: Properly handle monomorphization of generic functions. 2013-08-16 22:30:42 +02:00
Michael Woerister
907633b1bf debuginfo: Generate template type parameters for generic functions.
Conflicts:
	src/librustc/lib/llvm.rs
	src/librustc/middle/trans/debuginfo.rs
	src/rustllvm/RustWrapper.cpp
	src/rustllvm/rustllvm.def.in
2013-08-16 22:27:38 +02:00
Brian Anderson
9c71f4f1e0 Remove the annihilate lang item 2013-08-16 13:24:24 -07:00
bors
680eb71564 auto merge of #8532 : kballard/rust/cstr-cleanup, r=erickt
Implement interior null checking in `.to_c_str()`, among other changes.
2013-08-16 06:02:14 -07:00
Dmitry Ermolov
f4b88547ad Pointers to bound variables are stored after all patterns are matched.
Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).

Closes #6338.
2013-08-16 02:07:21 +04:00
Dmitry Ermolov
6d95765cd2 Cleanup: remove useless parameter 2013-08-16 01:01:13 +04:00
Kevin Ballard
5ca4cdc7b8 Remove inappropriate .to_c_str() in C_cstr()
LLVMConstStringInContext() doesn't need a null-terminated string. It
takes a length instead. Using .to_c_str() here triggers an ICE whenever
the string literal embeds a null, as in "\x00".
2013-08-15 01:33:10 -07:00
Kevin Ballard
03ef71e262 Add ToCStr method .with_c_str()
.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.

Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-15 01:33:10 -07:00
bors
7f58552cce auto merge of #8483 : luqmana/rust/rexprs, r=catamorphism
Fixes #8152.
2013-08-15 00:29:11 -07:00
Felix S. Klock II
7328f4cc12 port type_use.rs from oldvisit to <V:Visitor> trait. 2013-08-15 04:09:19 +02:00
Felix S. Klock II
23ce08a4cd port callee.rs from oldvisit to <V:Visitor> trait API. 2013-08-15 04:09:19 +02:00
Felix S. Klock II
ac5825057f Ported trans/base.rs from oldvisit to <V:Visitor> trait API. 2013-08-15 04:09:19 +02:00
bors
0a677bcf6e auto merge of #8462 : thestinger/rust/loop-cleanup, r=cmr
I missed some of this in e7bb33aed8. Hopefully it's all gone now :).
2013-08-14 10:35:12 -07:00
bors
433fbe8fcf auto merge of #8329 : michaelwoerister/rust/lexical_scopes_alt, r=graydon
This pull request re-implements handling of visibility scopes and source code positions in debug info. It should now be very stable and properly handle

+ variable shadowing
+ expanded code (macros and the new for-loop de-sugaring, for example)
+ variables in the middle of nested scopes
+ bindings declared in the head of match statement arms. 

all of which did not work at all or did not work reliably before. Those interested in a more detailed description of the problems at hand, I kindly refer to http://michaelwoerister.github.io/2013/08/03/visibility-scopes.html

Why doesn't the `populate_scope_map()` function use `syntax::visit`?
Because it would not improve this particular AST walker (see: 69dc790849 (commitcomment-3781426))

Cheers,
Michael
2013-08-13 16:53:14 -07:00