Skip to content

Commit f3d7655

Browse files
committed
---
yaml --- r: 6383 b: refs/heads/master c: 0e21df4 h: refs/heads/master i: 6381: ce065cf 6379: 7a10412 6375: 13a625e 6367: e993b89 v: v3
1 parent 13fe116 commit f3d7655

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8cf3ca3b55dbab193903a00eb427156365e44c67
2+
refs/heads/master: 0e21df46106ba80c43295d5f7ca57121baa1ac1e

trunk/src/comp/middle/kind.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ import syntax::{visit, ast_util};
33
import syntax::ast::*;
44
import syntax::codemap::span;
55

6+
// Kind analysis pass. There are three kinds:
7+
//
8+
// sendable: scalar types, and unique types containing only sendable types
9+
// copyable: boxes, objects, closures, and uniques containing copyable types
10+
// noncopyable: resources, or unique types containing resources
11+
//
12+
// This pass ensures that type parameters are only instantiated with types
13+
// whose kinds are equal or less general than the way the type parameter was
14+
// annotated (with the `send` or `copy` keyword).
15+
//
16+
// It also verifies that noncopyable kinds are not copied. Sendability is not
17+
// applied, since none of our language primitives send. Instead, the sending
18+
// primitives in the stdlib are explicitly annotated to only take sendable
19+
// types.
20+
621
fn kind_to_str(k: kind) -> str {
722
alt k {
823
kind_sendable. { "sendable" }

trunk/src/comp/middle/last_use.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ import syntax::ast::*;
33
import std::list::{list, nil, cons, tail};
44
import std::{vec, list, option};
55

6+
// Last use analysis pass.
7+
//
8+
// Finds the last read of each value stored in a local variable or
9+
// callee-owned argument (arguments with by-move or by-copy passing
10+
// style). This is a limited form of liveness analysis, peformed
11+
// (perhaps foolishly) directly on the AST.
12+
//
13+
// The algorithm walks the AST, keeping a set of (def, last_use)
14+
// pairs. When the function is exited, or the local is overwritten,
15+
// the current set of last uses is marked with 'true' in a table.
16+
// Other branches may later overwrite them with 'false' again, since
17+
// they may find a use coming after them. (Marking an expression as a
18+
// last use is only done if it has not already been marked with
19+
// 'false'.)
20+
//
21+
// Some complexity is added to deal with joining control flow branches
22+
// (by `break` or conditionals), and for handling loops.
23+
624
// Marks expr_paths that are last uses.
725
type last_uses = std::map::hashmap<node_id, ()>;
826

0 commit comments

Comments
 (0)