Commit Graph

2177 Commits

Author SHA1 Message Date
Patrick Walton
bc50a3ba44 rustc: Add a type unification cache 2011-04-20 15:26:55 -07:00
Patrick Walton
7596fcfba7 rustc: Define type hashing inductively 2011-04-20 14:34:17 -07:00
Patrick Walton
276a0f2de8 rustc: Precompute type hashes 2011-04-20 12:22:28 -07:00
Patrick Walton
cac7524c1a rustc: Remove all manual type construction outside ty.rs 2011-04-20 11:59:10 -07:00
Patrick Walton
38e842244c rustc: Remove all uses of plain_ty() and friends from outside of ty.rs 2011-04-20 11:23:36 -07:00
Patrick Walton
ac62488bb1 rustc: Introduce preferred type constructors, which will eventually precompute hashes and intern 2011-04-20 10:51:41 -07:00
Marijn Haverbeke
c49735d7c4 Remove last uses of fold from trans.rs 2011-04-20 17:43:37 +02:00
Graydon Hoare
c470cd2d66 Fix stage1 Makefile rules. 2011-04-20 15:24:04 +00:00
Marijn Haverbeke
757f1520d7 Change trans.collect_items to use walk, not fold 2011-04-20 17:23:45 +02:00
Marijn Haverbeke
4fe339d5ef Change collect_upvars from using fold to using walk 2011-04-20 12:35:34 +02:00
Marijn Haverbeke
fc6fbc1ed0 Integrate walk.rs 2011-04-20 12:35:07 +02:00
Graydon Hoare
9034a8fbd6 Fix #335, log context needs to be a scope to capture cleanups. 2011-04-20 04:55:55 +00:00
Graydon Hoare
2e6711fca5 Small fast-path hack to ty.hash_ty and eq_ty. 2011-04-19 18:46:54 -07:00
Patrick Walton
1080ac5349 rustc: Add a -noverify option 2011-04-19 18:31:27 -07:00
Graydon Hoare
d1b9ddc8d4 Add testcase for bootstrap blocker and fix for each result type to nil. 2011-04-19 16:53:12 -07:00
Patrick Walton
6651826677 rustc: Cache the results of type_of() 2011-04-19 16:41:08 -07:00
Patrick Walton
5475c0009c rustc: Use marijnh's stringifier for type hash and equality, since it's not sensitive to cnames 2011-04-19 16:41:08 -07:00
Graydon Hoare
928b25c9fb Un-XFAIL a few recently passing tests. 2011-04-19 15:41:45 -07:00
Patrick Walton
0ee997cee6 rustc: Make structured comparison glue instead of emitting it inline 2011-04-19 15:29:27 -07:00
Tim Chevalier
b7dd75c904 Handle nested items correctly in typestate_check
Summary says it all. Actually, only nested objects and functions
are handled, but that's better than before. The fold that I was using
before to traverse a crate wasn't working correctly, because annotations
have to reflect the number of local variables of the nearest enclosing
function (in turn, because annotations are represented as bit vectors).
The fold was traversing the AST in the wrong order, first filling in
the annotations correctly, but then re-traversing them with the bit
vector length for any outer nested functions, and so on.

Remedying this required writing a lot of tedious boilerplate code
because I scrapped the idea of using a fold altogether.

I also made typestate_check handle unary, field, alt, and fail.

Also, some miscellaneous changes:
* added annotations to blocks in typeck
* fix pprust so it can handle spawn
* added more logging functions in util.common
* fixed _vec.or
* added maybe and from_maybe in option
* removed fold_block field from ast_fold, since it was never used
2011-04-19 14:56:28 -07:00
Graydon Hoare
3d9cf15d0b Remove half-baked 'opacity' layer qualifier. 2011-04-19 14:00:04 -07:00
Graydon Hoare
b7d680b57d Remove mention of effect system from manual. 2011-04-19 13:39:57 -07:00
Graydon Hoare
d2bd07dcb0 Remove effect system from src. 2011-04-19 13:35:49 -07:00
Patrick Walton
d9d5eb82a7 rustc: Allow glue to be emitted even for scalar types; this is necessary to support compare glue 2011-04-19 11:25:40 -07:00
Patrick Walton
6599b310f7 rustc: Don't return "result" types from glue helper functions. This allows glue to fail. 2011-04-19 11:17:01 -07:00
Patrick Walton
37b5e91544 rustc: Assert that each basic block isn't terminated before adding instructions to it 2011-04-19 10:40:38 -07:00
Marijn Haverbeke
9287641c86 add rustboot-specific log upcalls to .def file 2011-04-19 18:12:49 +02:00
Marijn Haverbeke
880be6a940 Overhaul logging system in runtime
See https://github.com/graydon/rust/wiki/Logging-vision

The runtime logging categories are now treated in the same way as
modules in compiled code. Each domain now has a log_lvl that can be
used to restrict the logging from that domain (will be used to allow
logging to be restricted to a single domain).

Features dropped (can be brought back to life if there is interest):
  - Logger indentation
  - Multiple categories per log statement
  - I possibly broke some of the color code -- it confuses me
2011-04-19 16:57:13 +02:00
Marijn Haverbeke
6511d471ba replace error logging with log_err in stdlib and rustc 2011-04-19 16:57:13 +02:00
Marijn Haverbeke
6d3a423094 add log_err to rustc 2011-04-19 16:57:13 +02:00
Marijn Haverbeke
9bfc8bf11e Add log_err to rustboot 2011-04-19 16:57:13 +02:00
Brian Anderson
7f90000ab6 Precision overrides 0-padding in #fmt 2011-04-18 22:53:26 -04:00
Brian Anderson
59d5267936 Rearrange ExtFmt.RT.pad to recover some horizontal space 2011-04-18 21:36:04 -04:00
Brian Anderson
869b28e393 Left-justification overrides 0-padding in #fmt 2011-04-18 21:36:04 -04:00
Brian Anderson
d4f1a48111 Support 0 flag in #fmt 2011-04-18 21:36:04 -04:00
Graydon Hoare
4763cd39ca Boilerplate city, for anyone who wants it. 2011-04-18 18:32:05 -07:00
Patrick Walton
5f2cfa7351 rustc: Add an operation field to compare glue with ==, <=, and < modes 2011-04-18 12:57:00 -07:00
Rafael Ávila de Espíndola
9657e5d2d3 Revert 9ab42038bb while I find what is
wrong on Windows.
2011-04-18 15:37:04 -04:00
Graydon Hoare
8a6590a75f Remove use of 'use' from type-params-in-for-each.rs, put out darwin fire. 2011-04-18 12:20:50 -07:00
Rafael Ávila de Espíndola
9ab42038bb Change the makefiles to use -c. 2011-04-18 15:00:17 -04:00
Lindsey Kuper
0c873993c9 'Type' renamed to 'type definition'.
This is basically so people don't confuse a Ref.Item.Type with a
Ref.Type.
2011-04-18 11:49:32 -07:00
Patrick Walton
abd78f2f04 rustc: Create stub glue for structural comparison 2011-04-18 11:14:38 -07:00
Marijn Haverbeke
ef62fae9db Add a proper check for rustboot
Uncomment log initialization.
2011-04-18 19:59:49 +02:00
Marijn Haverbeke
c40cf96656 Temporarily turn off logging initialization
Will be restored as soon as I find a way for the runtime
to figure out whether it is on rustboot or rustc.
2011-04-18 18:29:20 +02:00
Marijn Haverbeke
f6be25a870 Update foregoing patches to leave rust_crate alone.
Apparently it can't live in the main binary, since on non-Linux
platforms, dynamics libs won't find symbols in the binary. This
removes the crate_map pointer from rust_crate again, and instead
passes it as an extra argument to rust_start. Rustboot doesn't pass
this argument, but supposedly that's okay as long as we don't actually
use it on that platform.
2011-04-18 16:21:49 +02:00
Rafael Ávila de Espíndola
f12998e5d7 Add a -c option. 2011-04-18 10:02:52 -04:00
Marijn Haverbeke
148e6f7b00 Make log the log level configurable per module
This overloads the meaning of RUST_LOG to also allow
'module.submodule' or 'module.somethingelse=2' forms. The first turn
on all logging for a module (loglevel 3), the second sets its loglevel
to 2. Log levels are:

 0: Show only errors
 1: Errors and warnings
 2: Errors, warnings, and notes
 3: Everything, including debug logging

Right now, since we only have one 'log' operation, everything happens
at level 1 (warning), so the only meaningful thing that can be done
with the new RUST_LOG support is disable logging (=0) for some
modules.

TODOS:
 * Language support for logging at a specific level
 * Also add a log level field to tasks, query the current task as well
   as the current module before logging (log if one of them allows it)
 * Revise the C logging API to conform to this set-up (globals for
   per-module log level, query the task level before logging, stop
   using a global mask)

Implementation notes:

Crates now contain two extra data structures. A 'module map' that
contains names and pointers to the module-log-level globals for each
module in the crate that logs, and a 'crate map' that points at the
crate's module map, as well as at the crate maps of all external
crates it depends on. These are walked by the runtime (in
rust_crate.cpp) to set the currect log levels based on RUST_LOG.

These module log globals are allocated as-needed whenever a log
expression is encountered, and their location is hard-coded into the
logging code, which compares the current level to the log statement's
level, and skips over all logging code when it is lower.
2011-04-18 15:28:47 +02:00
Marijn Haverbeke
0bf75a203e collect crate meta info and ext crate names 2011-04-18 15:28:47 +02:00
Marijn Haverbeke
0984d1db2e move rust_crate structure into the actual crate code 2011-04-18 15:28:47 +02:00
Marijn Haverbeke
36c332a241 introduce local_ctxt in trans.rs to keep crate_ctxt global
This reduces crate_ctxt copying (which unfortunately did not
result in a noticeable speedup), and makes the role of that
type a bit more clear.
2011-04-18 15:28:47 +02:00