Commit Graph

415 Commits

Author SHA1 Message Date
Niko Matsakis
f1a46914c4 add a new debugging aid--tracing 2012-05-18 19:07:19 -07:00
Eric Holk
0eed37da29 Using const vector slices for more vec functions. 2012-05-18 16:55:42 -07:00
Niko Matsakis
67ca37ac61 workaround a horribly obscure resolve bug 2012-05-18 14:32:37 -07:00
Niko Matsakis
a559329692 test that we preserve boxes in patterns---still one bug 2012-05-18 14:32:37 -07:00
Niko Matsakis
5be8bf1de7 use -Z to distinguish internal debugging options 2012-05-18 10:38:18 -07:00
Tim Chevalier
cf2fc2c34e Annotate or fix FIXMEs in LLVM bindings and metadata code
Fixed up a few FIXMEs in lib/llvm to use more descriptive data
types. Covered FIXMEs in metadata::{creader, csearch, decoder} and
one in encoder.
2012-05-17 20:39:17 -07:00
Brian Anderson
322b20d14d rustc: Break another dependency between metadata and resolve 2012-05-16 22:28:17 -07:00
Brian Anderson
6a41eb0192 rustc: Break a dependency between metadata and resolve 2012-05-16 21:50:34 -07:00
Graydon Hoare
9752523f3a Include intrinsic module in all crates, emit visit glue, fn intrinsic::visit_ty. Not yet working. 2012-05-16 18:24:00 -07:00
Tim Chevalier
e2d18c9a8a Remove an assertion from trans::base::iter_structural_ty
I had put in an assertion that if the ty is a class, it doesn't have a dtor,
but that doesn't make sense, since this gets used to make take glue and
not just drop glue.
2012-05-15 20:35:57 -07:00
Tim Chevalier
fa5cc5bcd0 Generate drop glue correctly for classes with destructors 2012-05-15 18:00:41 -07:00
Niko Matsakis
adb61e3e99 get preservation of boxes working, at least in simple cases 2012-05-15 13:38:16 -07:00
Niko Matsakis
4c7be32606 add node_ids to blocks 2012-05-15 11:49:11 -07:00
Niko Matsakis
e139793313 purge unused loop_cont field 2012-05-15 11:49:11 -07:00
Lindsey Kuper
b8880e3254 Remove be keyword.
Closes #2227.
2012-05-15 10:41:14 -07:00
Brian Anderson
452fc46ffc rustc: Break some of metadata's dependencies on session 2012-05-14 20:41:33 -07:00
Brian Anderson
0f49928c2d rustc: Break metadata's dependency on link 2012-05-14 19:04:32 -07:00
Brian Anderson
fce6a474b1 rustc: Eliminate metadata's dependency on astencode 2012-05-14 19:04:32 -07:00
Brian Anderson
5c864e9de0 rustc: Eliminate encoder's dependency on astencode 2012-05-14 19:04:32 -07:00
Graydon Hoare
e12b16cde7 Instantiate per-type iface-based visit_glue when intrinsic ifaces present. 2012-05-14 17:57:48 -07:00
Graydon Hoare
d899c3a579 More work on reflection, now calls iface visitors back as well. 2012-05-14 15:49:10 -07:00
Tim Chevalier
5428a22b95 First cut at dtors for classes
Classes with dtors should compile now. Haven't yet tested
whether they actually run correctly.

Beginnings of support for #2295, though that won't be done until
there's more test cases and resources are removed.
2012-05-14 14:26:10 -07:00
Brian Anderson
a2572fe77e rustc: Eliminate metadata's dependency on trans 2012-05-13 17:08:35 -07:00
Graydon Hoare
2585384c97 First working monomorphic type-reflection. 2012-05-11 13:10:07 -07:00
Niko Matsakis
b4d1f1b2c1 replace mutbl pass with borrowck 2012-05-10 21:14:43 -07:00
Graydon Hoare
c23d6a50d7 Preliminary groundwork for intrinsic module, reflection interface. 2012-05-10 17:18:04 -07:00
Paul Stansifer
13c924c049 Remove do { ... } while ... from the language. 2012-05-10 15:09:33 -07:00
Niko Matsakis
50a3dd40ae implement new borrow ck (disabled by default) 2012-05-09 17:00:19 -07:00
Niko Matsakis
5e7229b72c reduce self type to a special type parameter 2012-05-09 07:11:59 -07:00
Brian Anderson
b99038c2bf rustc: Put all boxes into addrspace 1 2012-05-07 15:24:32 -07:00
Niko Matsakis
50ec6bd2c3 new cap clause syntax 2012-05-04 12:33:08 -07:00
Tim Chevalier
8affc78e8a Turn constants in back::abi into uints, and propagate types
This means GEPi now takes a list of uints. Apologies in advance
if this is hard to rebase against, but it gets rid of many a cast :-)

Also modernized some for loops here and there.
2012-05-03 22:31:38 -07:00
Graydon Hoare
11a5d10bf2 Implement better shape code for evec, estr. 2012-05-03 13:09:02 -07:00
Brian Anderson
74096a79d8 rustc: Fix comment about ABI in trans::native 2012-05-03 12:07:43 -07:00
Brian Anderson
af263e43c2 rustc: Link to original Clay x86 classification code 2012-05-03 11:42:25 -07:00
Jyun-Yan You
bdebe92400 add forgotten index and fix array type 2012-05-03 09:43:00 -07:00
Brian Anderson
11354963b3 rustc: Hack around some FFI bustage. Unbreak servo 2012-05-02 18:35:29 -07:00
Brian Anderson
0be41ce02b rustc: Remove old align_of intrinsic 2012-04-27 15:40:43 -07:00
Brian Anderson
582c71731d rustc: Clean up some enum code 2012-04-27 11:24:43 -07:00
Brian Anderson
e4277472d2 core: Split sys::align_of into min_align_of, pref_align_of 2012-04-27 00:12:42 -07:00
Brian Anderson
f4f909b8b5 rustc: Add min_align_of, pref_align_of intrinsic, deprecate align_of 2012-04-27 00:12:39 -07:00
Brian Anderson
1c46ee34be rustc: Add llalign_of_min 2012-04-26 21:59:59 -07:00
Brian Anderson
43751e45d9 rustc: Rename llalign_of_real to llalign_of_pref
This alignment is the "preferred" alignment of a type, which is not
necessarily the alignment the compiler will use when packing the
type into structures - that is the "ABI" alignment (in LLVM terms).

On x86, 64-bit ints have 8-byte preferred alignment, but 4-byte
ABI alignment.
2012-04-26 21:44:29 -07:00
Niko Matsakis
825fd1808e lots of work to make iface/impls parameterized by regions
- paths can now take region parameters, replacing the dirty hack
  I was doing before of abusing vstores.  vstores are now a bit
  of a hack though.

- fix various small bugs:
  - we never checked that iface types were compatible when casting
    to an iface with `as`
  - we allowed nonsense like int<int>
  - and more! (actually that may be it)
2012-04-25 19:26:56 -07:00
Graydon Hoare
458d2ff067 Be a bit more cautious about marking things no-throw. 2012-04-25 18:53:54 -07:00
Graydon Hoare
90c1b4645f Set no-unwind on glue functions that don't drop resources. 2012-04-25 17:19:36 -07:00
Graydon Hoare
fa6c68a025 Set no-unwind attribute on all upcalls other than fail. 2012-04-25 17:19:36 -07:00
Brian Anderson
df0ef528b9 rustc: Use LLVM named structs for enum types 2012-04-25 15:49:25 -07:00
Marijn Haverbeke
9f99c3263b Rewrite exhaustiveness checker
Issue #2111
2012-04-25 09:15:17 +02:00
Brian Anderson
5a0c564817 Revert "rustc: Use LLVM named structs for enum types"
This reverts commit 6e909e387d.
2012-04-24 20:47:06 -07:00
Brian Anderson
6e909e387d rustc: Use LLVM named structs for enum types 2012-04-24 18:24:35 -07:00
Graydon Hoare
929c3dd710 Workarounds for bug #2280: add some temporaries for borrowing. 2012-04-24 15:19:01 -07:00
Brian Anderson
5437a045fc rustc: Remove a bitcast. Issue #2276 2012-04-24 14:00:50 -07:00
Tim Chevalier
f7641286b2 Allow classes to be cast to ifaces that are in the same crate
I had to xfail one existing test case (class-implements-int) because,
I think, of the same bug described in #2272.
2012-04-23 21:15:03 -07:00
Tim Chevalier
1c39fda0ea Rename option::get_or_default to get_default, for consistency 2012-04-23 20:52:50 -07:00
Tim Chevalier
7d05bea7b9 Fix bug with * patterns in trans_alt
enter_opt was handling the (*) case wrong and causing a bounds check
    failure. Fixed it (the test case is one of the extracted ones from
    the reference manual)
2012-04-23 15:50:51 -07:00
Marijn Haverbeke
68f8812511 Guard against infinitely expanding generic/inline functions
Closes #2220

Test case disabled until a memory-leak issue is resolved.
2012-04-23 16:44:52 +02:00
Marijn Haverbeke
9053f54498 Move map iface over to more for-friendly iteration methods 2012-04-23 15:18:19 +02:00
Marijn Haverbeke
dfdca5d538 Fix broken determination of external method type param count
Closes #2185
2012-04-23 09:25:14 +02:00
Brian Anderson
734494a04d rustc: Cache constant C strings. Closes #2264 2012-04-21 14:26:13 -07:00
Graydon Hoare
90f82e171d Get borrowing working on fixed evecs. 2012-04-20 12:11:55 -07:00
Tim Chevalier
37b0549730 Add new syntax for patterns that match the head constructor only
Adds a new kind of pattern C(*) where C is a constructor that may
have any number of fields. This pattern matches any value
constructed with C, without binding names for any of the fields.

Closes #1701.
2012-04-20 00:56:46 -07:00
Niko Matsakis
3c995fb8f3 make nominal types optionally parameterized by a self region.
Issue #2201.
2012-04-19 21:01:11 -07:00
Graydon Hoare
f641dce852 Get evec slices and unique-evec slice-borrowing working. 2012-04-19 16:51:37 -07:00
Tim Chevalier
b0074c5a92 Disallow rebinding / matching against consts in alts
As per Issue #1193. Closes #1193.

I had to rename a few variables ("info" and "epsilon") to avoid
clashing with in-scope constants, which is responsible for all the
changes other than resolve and issue-1193.rs.
2012-04-19 16:21:15 -07:00
Graydon Hoare
1e51196f33 Get fixed-size evecs working. 2012-04-19 15:52:50 -07:00
Graydon Hoare
956bc773c6 Fix [] on str to exclude the trailing null. 2012-04-18 17:50:58 -07:00
Marijn Haverbeke
fda7bb6721 Fix oversight in type_use.rs
Closes #2053
2012-04-18 17:21:39 +02:00
Marijn Haverbeke
054a312a33 Stop duplicating non-generic resource destructors
Closes #2177
2012-04-18 17:21:39 +02:00
Marijn Haverbeke
a0fa099469 Add a needs_drop intrinsic
Closes #2055
2012-04-18 13:15:02 +02:00
Marijn Haverbeke
35b8f87b89 Fix use of wrong block context in return-from-loop code
Closes #2142
2012-04-18 13:00:18 +02:00
Graydon Hoare
70a9ce626d Implement slice-borrowing on estr-uniq and str values. 2012-04-17 15:15:20 -07:00
Niko Matsakis
4c26d70a0a new debug flag, new test 2012-04-17 12:02:36 -07:00
Graydon Hoare
82727b926f Get explicit unique estrs working. 2012-04-16 16:17:51 -07:00
Brian Anderson
4f576275be syntax: Cleanup attr module. Closes #1545 2012-04-15 01:43:38 -07:00
Niko Matsakis
cc16165e40 implement evec/estr subtyping/lub/glb/etc 2012-04-14 18:48:58 -07:00
Niko Matsakis
247db704a9 integrate simple notion of borrowing into trans 2012-04-13 21:06:57 -07:00
Tim Chevalier
5c12cd72f4 Allow classes to implement ifaces
Introduce syntax like:

iface animal { ... }
class cat implements animal { ... }

to allow classes to implement ifaces. Casting classes to ifaces
is *not* yet supported. ifaces that a class implements are not
yet included in metadata.

The syntax is subject to change, and may go away completely if we
decide to use duck typing to relate classes with ifaces (see
http://smallcultfollowing.com/babysteps/blog/2012/04/10/declared-vs-duckish-typing/ )
2012-04-11 16:20:01 -07:00
Graydon Hoare
f34eae8802 Translate slice-strings and make fixed-strings carry their null. 2012-04-11 12:07:19 -07:00
Graydon Hoare
7a3b290245 Add vstore/evec/estr to compiler. 2012-04-11 11:08:40 -07:00
Tim Chevalier
fd26743bed Generic classes and generic class methods work cross-crate
Classes can have ty params now. So can methods inside classes.
That was probably true before, but now it should still work if you
call methods in a class that's defined in a different crate. Yay!
2012-04-10 11:01:36 -07:00
Niko Matsakis
24e921f7d4 make anything used in a resource body always reachable
(they appear to be uncond. inlined)

Fixes #2170.
2012-04-09 16:36:59 -07:00
Haitao Li
46e4aaa0be rustc: External fns declared as fns not global variables
Issue #2167
2012-04-09 14:38:53 +08:00
Haitao Li
460b92a37f rustc: Declare rust_start as a function
Issue #2167
2012-04-09 12:02:16 +08:00
Brian Anderson
19b7a7d803 Revert "Mangle exported names using node IDs rather than types"
This reverts commit c83d61de93.
2012-04-07 17:29:06 -07:00
Haitao Li
2f42b14b4f Use version and hash in crate_map name
Related issue #2137
2012-04-07 22:11:23 +08:00
Tim Chevalier
9d274ec5f2 Re-rename option functions
get_with_default (nee from_maybe) => get_default
with_option (nee maybe) => map_default
with_option_do (nee may) => iter

As per discussion of 21be1379d5
2012-04-06 12:20:13 -07:00
Marijn Haverbeke
fc202ca034 Remove support for old-style for
Closes #1619
2012-04-06 20:38:23 +02:00
Marijn Haverbeke
c902eafa14 Convert old-style for loops to new-style
Most could use the each method, but because of the hack used to
disambiguate old- and new-style loops, some had to use vec::each.

(This hack will go away soon.)

Issue #1619
2012-04-06 20:38:23 +02:00
Tim Chevalier
c83d61de93 Mangle exported names using node IDs rather than types
Use node IDs rather than types to ensure exported names are unique.
duplicate symbol. Closes #2074.
2012-04-05 18:22:53 -07:00
Niko Matsakis
c0d61795de wip: refactor repr of regions
- we now distinguish bound/free parameters (see region-param
  test case for why this is necessary)
- we also track bounds on region variables
- also, restructure fold_ty() to have multiple variants without
  duplication instead of one overloaded folder.  This also allows
  for using block functions.
2012-04-04 19:41:23 -07:00
Brian Anderson
38ed2ea096 rustc: Allow consts to refer to other consts 2012-04-04 15:03:39 -07:00
Erick Tryzelaar
4871f11439 std: change timeval to ns resolution timespec
This lets us use the more precise clock_gettime on posix
machines.
2012-04-03 22:43:08 -07:00
Erick Tryzelaar
7aae7320db std: change time::timeval to be {sec: i64, usec: i32}.
It's possible to have negative times if expressing time before 1970, so
we should use signed types. Other platforms can return times at a higher
resolution, so we should use 64 bits.
2012-04-03 22:43:08 -07:00
Tim Chevalier
1f892dcb01 Monomorphize class constructors, support generic classes and class methods
Allow class methods to have type parameters (this is a change from the
original classes proposal).

Add test cases for classes with type parameters, and classes with methods
that have their own type parameters.
2012-04-03 16:23:50 -07:00
Marijn Haverbeke
f65e26eeee Output type sizes in reinterpret_cast error message
Closes #2095
2012-04-03 16:37:54 +02:00
Graydon Hoare
28a0e9c999 Construct new strings through upcalls. 2012-04-02 17:38:06 -07:00
Tim Chevalier
21be1379d5 Rename some core::option functions
from_maybe => get_with_default
maybe => with_option
may => with_option_do

I know these names are kind of ridiculous, but it's the best I could think of.
Feel free to bikeshed. Closes #2081
2012-04-02 16:12:49 -07:00
Graydon Hoare
987bc23629 Remove redundant **tydesc gepi/load pair in call_tydesc_glue_full. 2012-04-02 15:26:12 -07:00
Brian Anderson
0904f25507 rustc: Convert some error logs to debug 2012-03-30 17:31:40 -07:00
Brian Anderson
7f9ed39040 rustc: Only invoke when there are cleanups 2012-03-29 16:43:18 -07:00
Brian Anderson
8780db2e0b rustc: Delete some unused invoke code 2012-03-29 16:43:18 -07:00
Brian Anderson
b420f46f03 rustc: Don't generate landing pad cleanups for boxy things 2012-03-29 16:43:18 -07:00
Brian Anderson
0e87039348 rustc: Remove the rustsyntax::attr wrapper in front 2012-03-29 14:42:31 -07:00
Tim Chevalier
c7082ce8e8 Require "self" as base expression for intra-class method or field references
All field or method references within a class must begin with "self." now.
A bare reference to a field or method in the same class will no longer
typecheck.
2012-03-29 12:22:01 -07:00
Patrick Walton
2663018792 rustc: Fix an infinite loop during size calculations for recursive region pointer types 2012-03-29 08:41:25 -07:00
Tim Chevalier
f7bbe537c1 Allow explicit self-calls within classes
Allow writing self.f() within a class that has a method f. In a future
commit, this syntax will be required. For now, you can write either
self.f() or f().

I added a "privacy" field to all methods (whether class methods or not),
which allowed me to refactor the AST somewhat (getting rid of the
class_item type; now there's just class_member).
2012-03-28 20:30:07 -07:00
Marijn Haverbeke
90cf9e0d6f Make sure type_use.rs doesn't get lost in recursive enums
Closes #2059
2012-03-28 10:35:16 +02:00
Tim Chevalier
edb747ceed Enforce mutability declarations in classes; correct shapes for classes
1. Enforce mutability declarations on class fields. Don't allow any
mutation of class fields not declared as mutable (except inside the
constructor).

2. Handle classes correctly in shape (treat classes like records).
2012-03-27 22:11:58 -07:00
Marijn Haverbeke
73d6df32cd Emergency safe-ref-checker maintenance
It still has some big problems, but at least it more or less
understands block arguments now.

Closes #1925
2012-03-27 17:22:57 +02:00
Marijn Haverbeke
b5a4fa9456 Move some code over to iterator-for to see how it performs. 2012-03-27 15:46:33 +02:00
Marijn Haverbeke
064f82d68d Support returning from loop blocks
The code is somewhat invasive, but it seems hard to do this in a
clean way, since the design itself involves a bunch of 'action
at a distance'.

Issue #1819
2012-03-27 12:33:13 +02:00
Marijn Haverbeke
f6e3738b9c Support an alternate for syntax that calls a higher-order function
The last argument of the call must be a block, and the type of this
argument must a function returning bool. `break` and `cont` are
supported in the body of the block, and return `false` or `true` from
the function. When the end of the function is reached, `true` is
implicitly returned.

    for vec::all([1, 2, 3]) {|elt|
        if elt == 2 { break; }
        log(error, elt);
    }

Issue #1619
2012-03-27 09:27:31 +02:00
Graydon Hoare
6e6798c4e1 Bulk-edit mutable -> mut. 2012-03-26 18:35:18 -07:00
Brian Anderson
a477aaba08 rustc: Move eval_const_expr to its own mod 2012-03-26 17:16:26 -07:00
Tim Chevalier
c282810ab0 Enforce privacy declarations for class fields and methods 2012-03-26 10:00:33 -07:00
Marijn Haverbeke
87e097a853 Disallow ret inside of block functions
Also adds proper checking for cont/break being inside a loop.

Closes #1854
Issue #1619
2012-03-26 12:45:47 +02:00
Marijn Haverbeke
e4c141a331 Fix bug in generation of non-generic resource dtors
Issue #1944
2012-03-26 11:31:17 +02:00
Tim Chevalier
aae14e352a Allow methods to call other methods in the same class 2012-03-23 23:10:45 -07:00
Tim Chevalier
40443768b1 Fix breakage 2012-03-23 20:53:38 -07:00
Tim Chevalier
8bbd78075f Handle self correctly when translating classes
This change uses the same code for handling the "self" reference for
classes as is already used for impls/ifaces. This allows removing the
extra maybe_self_id argument (which was just for classes) to trans_closure
that I added before. I also rewrote the translation for class ctors so
that it doesn't generate new AST nodes (instead translating directly).

Also changed visit so that it visits class ctors correctly with visit_fn,
and changed typestate to not do return-checking when visiting a class ctor.
2012-03-23 20:37:50 -07:00
Patrick Walton
713b3585c6 rustc: Remove // */ sequence from trans/base.rs; it breaks vi syntax highlighting 2012-03-23 18:21:23 -07:00
Marijn Haverbeke
84019aa0dc Keep an explicit map of things that have to be spilled
This prevents us from spilling locals more than once.

Closes #2040
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
1b81c5112a Remove last vestiges of old-style intrinsics
Closes #2048
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
a84b56bc70 Remove more needless context threading in trans 2012-03-23 14:45:47 +01:00
Marijn Haverbeke
52d618a99a Revert removal of intrinsics
Oops. We can't do this yet until the next snapshot.
2012-03-23 12:51:20 +01:00
Marijn Haverbeke
562afef216 Rename builtin back to intrinsic
As per Graydon's request

Issue #1981
2012-03-23 12:21:56 +01:00
Marijn Haverbeke
f5024692d4 Remove support for the old-style intrinsics
Closes #2042
Closes #1981
2012-03-23 12:21:55 +01:00
Marijn Haverbeke
cdb93d70a1 Fix bug in function-instance reuse
You can't safely reuse functions that pass a T by move, since they might
zero it out, which will not end well when it doesn't know its precise
size.
2012-03-23 10:49:47 +01:00
Marijn Haverbeke
16ca6e8d7f Change vector append to no longer rely on an intrinsic
Issue #1981
2012-03-23 10:49:47 +01:00
Marijn Haverbeke
0545e4a920 Support [rust_stack] annotation on native functions (crudely) 2012-03-23 10:49:47 +01:00
Marijn Haverbeke
ea2e379e4f Implement built-in native modules as an alternative to intrinsics
Issue #1981
2012-03-23 10:49:47 +01:00
Graydon Hoare
b224bcf6e1 Add an LLVM-instruction-counting mode to trans.
Pipe to xdu to see a trans call graph of generated insns.
2012-03-22 13:44:20 -07:00
Niko Matsakis
b653a18416 add mut decls to rustc and make them mandatory 2012-03-21 21:04:14 -07:00
Brian Anderson
75ee4633eb rustc: Long lines 2012-03-21 16:10:39 -07:00
Josh Matthews
8142438938 Avoid mangling names differently in debug builds to work around a build error. Fix up file name and path debug information, and build one compilation unit for a crate instead of one per source file. 2012-03-21 18:56:36 -04:00
Tim Chevalier
30c272cb3a methods work
Cross-crate method calls don't work yet. Added
run-pass/class-method-cross-crate to test that, but it's xfailed

References to fields within methods don't work yet. Added
run-pass/class-methods to test that, but it's also xfailed
2012-03-21 13:53:21 -07:00
Niko Matsakis
cfcbec3cc3 Implement an initial version of placement new. 2012-03-20 20:39:40 -07:00
Tim Chevalier
b06dc884e5 Class methods WIP
In particular, use the ast::method type to represent a class method,
and try to reuse as much iface code as possible. (This makes sense now
since I'll be allowing polymorphic class methods.)
2012-03-20 17:07:07 -07:00
Brian Anderson
b181ea415e core: Rename unsafe::leak to unsafe::forget. Closes #2031 2012-03-20 15:20:37 -07:00
Graydon Hoare
56828d49fd Remove unused "flav" parameter from function registration paths. 2012-03-20 15:16:12 -07:00
Graydon Hoare
d282481c12 Fix naughty mangling-breakage from stringifying a node ID. Close #1344. 2012-03-20 15:16:12 -07:00
Graydon Hoare
8e911cbd65 Work on fixing name mangling. 2012-03-20 15:16:12 -07:00
Jyun-Yan You
d3712a287d make native and crust functions conform to x86-64 ABI 2012-03-20 11:59:24 -07:00
Marijn Haverbeke
928364b98b Only make symbols external when they are actually externally accessible
Closes #2030
2012-03-20 13:19:33 +01:00
Marijn Haverbeke
ade1207ba3 Move external-reachability checker to trans
Preparation for a fix for issue #2020
2012-03-20 12:28:46 +01:00
Graydon Hoare
869b2d7064 Send string concatenation to specialized upcall, shave 17s off librustc compile time. 2012-03-19 14:29:39 -07:00
Brian Anderson
13bcc73625 core: Rename vec::position_elt to position_elem 2012-03-18 17:40:49 -07:00
Tim Chevalier
e3a1c5c96a Encode both private and public class fields in metadata
This is necessary to calculate the correct offsets for field references.

Simple cross-crate class tests (still with fields only) now pass.
2012-03-16 20:36:07 -07:00
Josh Matthews
d958123d8a Don't break -g in the presence of monomorphization. 2012-03-16 20:19:52 -04:00
Tim Chevalier
1680ccce1e Classes WIP
Cross-crate metadata for classes works well enough that programs with
classes in other crates compile successfully, but output wrong results.
Checking in work so far to avoid merge hassles. (Tests are xfailed.)
2012-03-16 15:28:05 -07:00
Marijn Haverbeke
25c2be0ff4 Forbid boxed ifaces with self types or generic methods in bounded params
They are a soundness hole.

Closes #1994
2012-03-16 15:39:07 +01:00
Marijn Haverbeke
22bef74b55 Remove shared tydescs
All tydescs are static now, there's no need to worry about
marshalling them between threads anymore.
2012-03-16 15:38:42 +01:00
Marijn Haverbeke
15a325f267 Support binding of methods off boxed iface values
Closes #435
2012-03-16 12:58:26 +01:00
Marijn Haverbeke
2e3f1096bb Fix bug in vtable builder
Closes #1947 , which I completely misdiagnosed.
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
24ed441a05 Reuse monomorphized functions more aggressively
Adds a trans::type_use pass that, given a function body, detects how
dependant that function is on properties of its type parameters.
2012-03-15 15:08:31 +01:00
Marijn Haverbeke
3ab9978b9b Remove support for dynamically-sized types from translation code 2012-03-15 15:08:31 +01:00
Marijn Haverbeke
a4d75a4ed1 Remove GEP_tup_like 2012-03-15 15:08:31 +01:00
Marijn Haverbeke
c3a93ecd3f Remove dynastack code from compiler 2012-03-15 15:08:30 +01:00
Marijn Haverbeke
bc8a43a776 Remove lltyparams field in trans::common::fn_ctxt 2012-03-15 15:08:30 +01:00
Marijn Haverbeke
332329f161 Don't pass an undef retptr to generic intrinsics
It leads to segfaults
2012-03-15 10:22:46 +01:00
Marijn Haverbeke
b6ad34bef4 Properly recognize external intrinsics 2012-03-15 10:22:46 +01:00
Marijn Haverbeke
e4cbd43c43 Huge kludge to get intrinsics' type parameters passed 2012-03-15 09:41:21 +01:00
Marijn Haverbeke
9aa78e34e4 Never pass tydesc to functions
My assumption that native generics needed them was wrong, so tydescs
can be eliminated from function signatures completely.
2012-03-15 09:40:52 +01:00
Marijn Haverbeke
47f35c9d34 Properly replace iface tps with impl tps in static method calls
Un-xfail iface-generic.rs
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
fe90c189f4 Only write metadata for items that actually appear in the root AST
Not for imported ASTs from inlined items.
2012-03-15 09:32:53 +01:00
Marijn Haverbeke
2c8c50d6cb Make sure enum and resource constructors are inlined properly 2012-03-15 09:32:53 +01:00
Marijn Haverbeke
4650e8bcf4 Make sure resource destructors are properly monomorphized 2012-03-15 09:32:53 +01:00
Marijn Haverbeke
8f84d4c8b6 Remove a large part of the tydesc-passing code 2012-03-15 09:31:34 +01:00
Marijn Haverbeke
83c9f58534 Rename dict to vtable throughout the compiler
The difference went away.
2012-03-15 09:28:50 +01:00
Marijn Haverbeke
4511f936b1 Hugely simplify iface handling
With the assumption of monomorphization
2012-03-15 09:26:54 +01:00
Marijn Haverbeke
168398bb3d Stop generating generic versions of generic functions
Monomorphic instances are generated on demand.
2012-03-15 09:00:21 +01:00
Marijn Haverbeke
5e647d799e Fix assumption that monomorphized method's impls are crate-local 2012-03-15 08:59:29 +01:00
Marijn Haverbeke
75e6fb4feb Fix monomorphization of resource constructors 2012-03-15 08:59:29 +01:00
Marijn Haverbeke
0e5da379dd Turn on monomorphization by default 2012-03-15 08:59:29 +01:00
Brian Anderson
2a293ed8b8 Convert *u8 native string users to *c_char 2012-03-14 18:20:14 -07:00
Brian Anderson
9e480708a2 core:: Eliminate str::sbuf. Replace with *u8 2012-03-14 18:19:08 -07:00
Brian Anderson
3864d6d845 std: Rename the hashmap constructors to conform to new standards
Instead of using the new_ prefix just name them after their type
2012-03-14 18:19:08 -07:00
Patrick Walton
273c5e5f11 rustc: Lift the @ from the type definition of crate_ctxt into its uses
This will make it easier to convert crate_ctxt into a region pointer, since
there are functions that return crate contexts. There would be no way to type
these functions if crate_ctxt had to be an inferred region pointer.
2012-03-14 17:31:16 -07:00
Patrick Walton
1e0e089185 rustc: Fix a couple of bugs that prevented taking addresses of rvalues 2012-03-14 16:50:20 -07:00
Patrick Walton
0cd72d24dc rustc: Autoderef through region pointers 2012-03-14 16:13:05 -07:00
Marijn Haverbeke
de79caa97e Add crude support for casts in constant expressions
Only casts to integral and float types are supported

Closes #1975
2012-03-14 18:05:28 +01:00
Brian Anderson
aeb445b2ea rustc: Don't make the while loop body's basic block a child of the condition
As a child of the condition, when the body encounters a ret or break it
incorrectly re-runs the cleanups of the condition.
2012-03-13 17:27:17 -07:00
Brian Anderson
b968c8e6cd Name types after their modules instead of 't' 2012-03-13 15:14:17 -07:00
Brian Anderson
cd72b1f848 Overhaul constructor naming in libs 2012-03-13 11:07:22 -07:00
Marijn Haverbeke
e54cde5215 Use type size/alignment of target, rather than host, in debuginfo 2012-03-13 16:20:31 +01:00
Marijn Haverbeke
463cf837eb rustc: Teach trans::alt.rs about exhaustive alts
Closes #1971
2012-03-13 16:20:31 +01:00
Graydon Hoare
6f5853f5a1 Libc/os/run/rand/io reorganization. Close #1373. Close #1638.
- Move io, run and rand to core.
 - Remove incorrect ctypes module (use libc).
 - Remove os-specific modules for os and fs.
 - Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Patrick Walton
dd610a151b rustc: Add node IDs to AST types so we can associate them with region environments 2012-03-12 17:34:37 -07:00
Patrick Walton
59a56ad043 Revert "rustc: Add node IDs to AST types so we can associate them with region environments"
This reverts commit 96e1bbd4a0.
2012-03-12 16:33:55 -07:00
Patrick Walton
96e1bbd4a0 rustc: Add node IDs to AST types so we can associate them with region environments 2012-03-12 16:28:15 -07:00
Tim Chevalier
35400e13ad Use loop instead of while(true) in libraries and compiler itself
And remove spurious fails/unreachable() calls.
2012-03-10 20:34:17 -08:00
Brian Anderson
e4bb2d707f core: Rename vec::tail_n to vec::tailn to match other fns 2012-03-10 00:44:13 -08:00
Tim Chevalier
321fd80219 Add an infinite loop construct
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Patrick Walton
ddeaea2287 rustc: Change the address-of operator to an explicit production so that we can parse the mutability 2012-03-08 16:34:36 -08:00
Patrick Walton
0722786664 rustc: Add some missing cases in various folds for reference types and some broken trans code for the address-of operator 2012-03-08 15:55:28 -08:00
Tim Chevalier
d048a00cf3 Change util::unreachable to core::unreachable
Closes #1931
2012-03-08 14:30:01 -08:00
Patrick Walton
0e17cdb627 rustc: Add regions to the type system 2012-03-08 14:05:56 -08:00
Marijn Haverbeke
c71306b0db Explicitly store self_ids use for self locals in methods
This makes it possible to move them between crates without confusion,
and to instantiate them at a point where the monomorphizing
substitutions are known.

Issue #1944
2012-03-08 21:17:32 +01:00
Marijn Haverbeke
fd465f91a8 Drop collect_items pass, create decls on demand
This solves a problem with inlined functions that have inner functions.
2012-03-08 21:17:32 +01:00
Patrick Walton
ec8380f9b1 rustc: Add the safe address-of operator to the AST 2012-03-08 12:04:02 -08:00
Niko Matsakis
2bfed908e3 Fix #1941: inlining of items that themselves contain nested items
The fix is to drop nested items from the encoded AST.  Nested items may
themselves be inlined, but that is an independent question.
2012-03-07 18:06:29 -08:00
Patrick Walton
c9375fed8d stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980 Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
This reverts commit f0250a23d3.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3 stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Marijn Haverbeke
7b81cd8930 Fix #1503 in a saner way
Closes #1933
2012-03-07 09:19:29 +01:00
Niko Matsakis
712dd23541 make inline enabled by default 2012-03-06 09:01:40 -08:00
Marijn Haverbeke
19508c7d53 Make trans pass responsible for pulling in inlined functions
This makes the logic for finding the inlinable items much easier --
they are simply pulled in lazily when encountered.
2012-03-06 14:00:21 +01:00
Brian Anderson
77ed09728b rustc: Use std::util::unreachable 2012-03-05 18:16:25 -08:00
Brian Anderson
0ee96de4ee rustc: Lower case error messages 2012-03-05 17:05:20 -08:00
Niko Matsakis
0416a946b7 give user control of whether we use inline hint or inline always
supply inline hints for resource ctors/dtors
2012-03-05 16:47:51 -08:00
Niko Matsakis
cc2ebfc105 set LLVM inline hint for all #[inline] methods, whether CC or local 2012-03-05 16:47:51 -08:00
Brian Anderson
15df3950ad rustc: Remove remaining non-inbounds GEPs 2012-03-05 15:12:36 -08:00
Tim Chevalier
e2fa6f03f5 Translate simple classes
Programs using classes with fields only (no methods) compile and run,
    as long as nothing refers to a class in a different crate (todo).

    Also changed the AST representation of classes to have a separate
    record for constructor info (instead of inlining the fields in the
    item_class node), and fixed up spans and pretty-printing for
    classes.
2012-03-04 12:43:17 -08:00
Graydon Hoare
87c14f1e3d Move src/comp to src/rustc 2012-03-02 18:46:13 -08:00