about summary refs log tree commit diff
path: root/src/comp/middle/tstate/bitvectors.rs
AgeCommit message (Collapse)AuthorLines
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-2/+2
2011-11-17remove compile-command from local variable blocksNiko Matsakis-1/+0
2011-11-10Cleanup unused importsHaitao Li-2/+2
2011-10-20Make fn denote a bare function. Convert fn to fn@ as neededBrian Anderson-1/+1
2011-09-28Don't descend into functions from relax_precond_blockMarijn Haverbeke-1/+2
Closes #913
2011-09-15Forbid assignment to by-reference bindingsMarijn Haverbeke-1/+1
Issue #918
2011-09-12Factor imports mindlessly.Graydon Hoare-21/+7
2011-09-12Reformat for new mode syntax, step 1Marijn Haverbeke-35/+33
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
2011-09-02Reformat. Issue #855Brian Anderson-6/+6
2011-08-27Convert rustc::driver::session to istrs. Issue #855Brian Anderson-6/+6
2011-08-20ReformatBrian Anderson-11/+11
This changes the indexing syntax from .() to [], the vector syntax from ~[] to [] and the extension syntax from #fmt() to #fmt[]
2011-08-18Remove or _-prefix all unused function argumentsMarijn Haverbeke-2/+2
This should make the compilation process a bit less noisy.
2011-08-16Port the compiler to the expr foo::<T> syntax.Erick Tryzelaar-1/+1
2011-08-16Port the compiler to the typaram foo<T> syntax.Erick Tryzelaar-4/+4
2011-08-16Rename std::ivec to std::vecBrian Anderson-8/+8
2011-08-15The wonky for...in... whitespace was bothering me. Sorry!Lindsey Kuper-1/+1
2011-08-09Port the compiler to the ivec type [T] syntax.Erick Tryzelaar-3/+3
2011-08-05Initialize all constraints to FalseTim Chevalier-0/+5
Previously, typestate was initializing the init constraint for a declared-but-not-initialized variable (like x in "let x;") to False, but other constraints to Don't-know. This led to over-lenient results when a variable was used before declaration (see the included test case). Now, everything gets initialized to False in the prestate/poststate- finding phase, and Don't-know should only be used in pre/postconditions. This aspect of the algorithm really needs formalization (just on paper), but for now, this closes #700
2011-07-31Change bitvectors::relax_precond_block to use visit instead of walkTim Chevalier-24/+28
2011-07-29Refactor typestate code involving stmt_declsTim Chevalier-0/+10
To handle multiple-LHS declarations with initializers properly, I changed seq_states to take a list of expressions paired with optional names, not just a list of expressions. Then, the same logic that handles ordered lists of subexpressions everywhere else can handle multi- declarations.
2011-07-27Fix damage done by the pretty-printerMarijn Haverbeke-3/+1
2011-07-27Reformat for new syntaxMarijn Haverbeke-117/+99
2011-07-26Remove all uses of tuples from the compiler and stdlibMarijn Haverbeke-1/+1
2011-07-25Rename the block type to be blk also. Sorry.Michael Sullivan-2/+2
2011-07-21Instantiate function preconditions inside the function bodyTim Chevalier-0/+4
so that if we have a function like: f(...) : p(x) { ... } p(x) is true inside the body of f. Closes #694.
2011-07-19Beginnings of support for constrained typesTim Chevalier-42/+20
Programs with constrained types now parse and typecheck, but typestate doesn't check them specially, so the one relevant test case so far is XFAILed. Also rewrote all of the constraint-related data structures in the process (again), for some reason. I got rid of a superfluous data structure in the context that was mapping front-end constraints to resolved constraints, instead handling constraints in the same way in which everything else gets resolved.
2011-07-13Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.Graydon Hoare-3/+3
2011-07-12rustc: Remove a few scattered uses of exterior vectors from typestatePatrick Walton-6/+1
2011-07-08Minor refactoringTim Chevalier-1/+5
2011-07-06rustc: Make AST paths use interior vectorsPatrick Walton-1/+1
2011-07-06rustc: Remove unused or seldom-used imports from ↵Patrick Walton-2/+1
middle::tstate::{bitvectors, ck}
2011-07-06rustc: Move middle::tstate::auxiliary and middle::tstate::bitvectors over to ↵Patrick Walton-12/+12
interior vectors
2011-07-06rustc: Make the various constraint-related types in middle::ty use interior ↵Patrick Walton-1/+9
vectors
2011-07-06rustc: Revert the conversion to interior vectors due to heap corruptionPatrick Walton-21/+14
2011-07-06rustc: Make AST paths use interior vectorsPatrick Walton-1/+1
2011-07-06rustc: Remove unused or seldom-used imports from ↵Patrick Walton-2/+1
middle::tstate::{bitvectors, ck}
2011-07-06rustc: Move middle::tstate::auxiliary and middle::tstate::bitvectors over to ↵Patrick Walton-12/+12
interior vectors
2011-07-06rustc: Make the various constraint-related types in middle::ty use interior ↵Patrick Walton-1/+9
vectors
2011-07-05Move everything syntax-related to syntax/, break deps on rest of compilerMarijn Haverbeke-1/+2
src/comp/syntax is currently just a sub-module of rustc, but it will, in the near future, be its own crate. This includes: - The AST data structure - The parser - The pretty-printer - Visit, walk, and fold - The syntax extension system - Some utility stuff that should be in the stdlib* *) Stdlib extensions currently require a snapshot before they can be used, and the win build is very broken right now. This is temporary and will be cleaned up when one of those problems goes away. A lot of code was moved by this patch, mostly towards a more organized layout. Some package paths did get longer, and I guess the new layout will take some getting used to. Sorry about that! Please try not to re-introduce any dependencies in syntax/ on any of the other src/comp/ subdirs.
2011-06-27Tests for while loops that may invalidate constraintsTim Chevalier-16/+20
Wrote some small test cases that use while loops and moves, to make sure the poststate for the loop body gets propagated into the new prestate and deinitialization gets reflected. Along with that, rewrite the code for intersecting states. I still find it dodgy, but I guess I'll continue trying to add more tests. Also, I'll probably feel better about it once I start formalizing the algorithm.
2011-06-24Invalidate constraints correctly after an assignment expressionTim Chevalier-0/+35
Modified typestate to throw away any constraints mentioning a variable on the LHS of an assignment, recv, assign_op, or on either side of a swap. Some code cleanup as well.
2011-06-24Remove uses of variable name 'res' from rustcMarijn Haverbeke-7/+7
This in preparation of making 'res' a keyword for defining resources. Please don't introduce too many new ones in the meantime...
2011-06-22Compute typestate properly for moveTim Chevalier-42/+66
typestate now drops constraints correctly in the post-state of a move expression or a declaration whose op is a move. It doesn't yet drop constraints mentioning variables that get updated. To do this, I had to change typestate to use trit-vectors instead of bit-vectors, because for every constraint, there are three possible values: known-to-be-false (e.g. after x <- y, init(y) is known-to-be-false), known-to-be-true, and unknown. Before, we conflated known-to-be-false with unknown. But move requires them to be treated differently. Consider: (program a) (a1) x = 1; (a2) y <- x; (a3) log x; (program b) (b1) x = 1; (b2) y <- z; (b3) log x; With only two values, the postcondition of statement a2 for constraint init(x) is the same as that of b2: 0. But in (a2)'s postcondition, init(x) *must* be false, but in (b2)'s condition, it's just whatever it was in the postcondition of the preceding statement.
2011-06-20Get rid of def_ids and anns in AST nodes, use single node_idMarijn Haverbeke-14/+16
This reduces some redundancy in the AST data structures and cruft in the code that works with them. To get a def_id from a node_id, apply ast::local_def, which adds the local crate_num to the given node_id. Most code only deals with crate-local node_ids, and won't have to create def_ids at all.
2011-06-17Restructure the "checking" pass in typestateTim Chevalier-0/+45
I noticed that typestate was being lazier than it should be, because it was only checking typestate for statements and top-level expression (that is, the expression in a stmt_expr, but not any subexpressions). So I rewrote the checks in tstate/ck.rs to use walk, which exposed a few bugs in typestate that I fixed. Also added some more test cases for if-check.
2011-06-15Reformat source tree (minus a couple tests that are still grumpy).Graydon Hoare-74/+56
2011-06-13Refactor some typestate-related data structuresTim Chevalier-22/+21
2011-06-10Reject programs with unsatisfied predicate constraintsTim Chevalier-2/+2
Generate appropriate constraints for calls to functions with preconditions, and reject calls where those constraints don't hold true in the prestate. ...by which I mean that it works for one test case :-)
2011-06-10Fix unsafe uses of mutable referencesMarijn Haverbeke-1/+1
2011-06-09Start to check expr_check and expr_call constraints in typestateTim Chevalier-1/+0
Start writing the cases for expr_check and expr_call to take predicates into account, but this isn't working yet.