Skip to content

Commit b4fa7b9

Browse files
committed
---
yaml --- r: 5179 b: refs/heads/master c: a10a6da h: refs/heads/master i: 5177: 38ec4ea 5175: 979643d v: v3
1 parent e6061b8 commit b4fa7b9

File tree

322 files changed

+7235
-7982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+7235
-7982
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: e9f9ec69724a0e65d930091f0fc9f512cf69a72b
2+
refs/heads/master: a10a6daba30e35b88ee41ffad1eda8243159659a

trunk/AUTHORS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Brendan Eich <[email protected]>
1111
Brian Anderson <[email protected]>
1212
Chris Double <[email protected]>
1313
Dave Herman <[email protected]>
14-
Eric Holk <eholk@mozilla.com>
14+
Eric Holk <eric.holk@gmail.com>
1515
Erick Tryzelaar <[email protected]>
1616
Jason Orendorff <[email protected]>
1717
Jeff Balogh <[email protected]>

trunk/Makefile.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,15 @@ SREQ$(1) = stage$(1)/rustc$(X) \
186186
$$(MKFILES)
187187
endif
188188

189+
ifeq ($(1),0)
190+
# Don't run the the stage0 compiler under valgrind - that ship has sailed
191+
CFG_VALGRIND_COMPILE$(1) =
192+
else
193+
CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
194+
endif
195+
189196
STAGE$(1) := $$(Q)$$(call CFG_RUN_TARG,stage$(1), \
190-
$$(CFG_VALGRIND_COMPILE) stage$(1)/rustc$$(X) \
197+
$$(CFG_VALGRIND_COMPILE$(1)) stage$(1)/rustc$$(X) \
191198
$$(CFG_RUSTC_FLAGS))
192199
endef
193200

trunk/doc/rust.texi

Lines changed: 83 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ The keywords are:
642642
@tab @code{syntax}
643643
@tab @code{mutable}
644644
@tab @code{native}
645+
@tab @code{unchecked}
645646
@item @code{mod}
646647
@tab @code{import}
647648
@tab @code{export}
@@ -679,7 +680,7 @@ The keywords are:
679680
@tab @code{with}
680681
@item @code{fn}
681682
@tab @code{iter}
682-
@tab @code{pred}
683+
@tab @code{pure}
683684
@tab @code{obj}
684685
@tab @code{resource}
685686
@item @code{if}
@@ -1252,15 +1253,6 @@ immediately destructed (if acyclic) or else collected using a general
12521253
(cycle-aware) garbage-collector local to each task. Garbage collection within
12531254
a local heap does not interrupt execution of other tasks.
12541255

1255-
Immutable boxes are @dfn{shared}, and can be multiply-referenced by many
1256-
different tasks. Like any other immutable type, they can pass over channels,
1257-
and live as long as the last task referencing them within a given domain. When
1258-
unreferenced, they are destroyed immediately (due to reference-counting) and
1259-
returned to the heap memory allocator. Destruction of an immutable box also
1260-
executes within the context of the task that drops the last reference to a
1261-
shared heap allocation, so executing a long-running destructor does not
1262-
interrupt execution of other tasks.
1263-
12641256

12651257
@node Ref.Mem.Own
12661258
@subsection Ref.Mem.Own
@@ -1396,25 +1388,23 @@ fn main() @{
13961388
@node Ref.Mem.Acct
13971389
@subsection Ref.Mem.Acct
13981390
@c * Ref.Mem.Acct:: Memory accounting model.
1399-
@cindex Domain
14001391
@cindex Accounting
14011392
@cindex Memory budget
14021393

1403-
Every task belongs to a domain, and that domain tracks the amount of memory
1404-
allocated and not yet released by tasks within it. @xref{Ref.Task.Dom}. Each
1405-
domain has a memory budget. The @dfn{budget} of a domain is the maximum amount
1406-
of memory that can be simultaneously allocated in the domain. If a task tries
1407-
to allocate memory within a domain with an exceeded budget, the task will
1408-
receive a signal.
1394+
Every task tracks the amount of memory allocated and not yet released. Each
1395+
task may have a memory budget. The @dfn{budget} of a task is the maximum
1396+
amount of memory that can be simultaneously allocated in the task. If a task
1397+
tries to allocate memory with an exceeded budget, the task will receive a
1398+
signal.
14091399

14101400
Within a task, accounting is strictly enforced: all memory allocated through
1411-
the runtime library, both user data, sub-domains and runtime-support
1412-
structures such as channel and signal queues, are charged to a task's domain.
1401+
the runtime library, both user data and runtime-support structures such as
1402+
channel and signal queues, are charged to a task.
14131403

1414-
When a communication channel crosses from one domain to another, any value
1404+
When a communication channel crosses from one task to another, any value
14151405
sent over the channel is guaranteed to have been @emph{detached} from the
1416-
domain's memory graph (singly referenced, and/or deep-copied), so its memory
1417-
cost is transferred to the receiving domain.
1406+
task's memory graph (singly referenced, and/or deep-copied), so its memory
1407+
cost is transferred to the receiving task.
14181408

14191409

14201410
@page
@@ -1439,7 +1429,6 @@ operating-system processes.
14391429
@menu
14401430
* Ref.Task.Comm:: Inter-task communication.
14411431
* Ref.Task.Life:: Task lifecycle and state transitions.
1442-
* Ref.Task.Dom:: Task domains.
14431432
* Ref.Task.Sched:: Task scheduling model.
14441433
* Ref.Task.Spawn:: Library interface for making new tasks.
14451434
* Ref.Task.Send:: Library interface for sending messages.
@@ -1492,12 +1481,12 @@ transmit side. A channel contains a message queue and asynchronously sending a
14921481
message merely inserts it into the sending channel's queue; message receipt is
14931482
the responsibility of the receiving task.
14941483

1495-
Queued messages in channels are charged to the domain of the @emph{sending}
1496-
task. If too many messages are queued for transmission from a single sending
1497-
task, without being received by a receiving task, the sending task may exceed
1498-
its memory budget, which causes a run-time signal. To help control this
1499-
possibility, a semi-synchronous send operation is possible, which blocks until
1500-
there is room in the existing queue before sending send.
1484+
Queued messages in channels are charged to the @emph{sending} task. If too
1485+
many messages are queued for transmission from a single sending task, without
1486+
being received by a receiving task, the sending task may exceed its memory
1487+
budget, which causes a run-time signal. To help control this possibility, a
1488+
semi-synchronous send operation is possible, which blocks until there is room
1489+
in the existing queue before sending send.
15011490

15021491
Messages are sent on channels and received on ports using standard library
15031492
functions.
@@ -1560,31 +1549,6 @@ A task in the @emph{dead} state cannot transition to other states; it exists
15601549
only to have its termination status inspected by other tasks, and/or to await
15611550
reclamation when the last reference to it drops.
15621551

1563-
@node Ref.Task.Dom
1564-
@subsection Ref.Task.Dom
1565-
@c * Ref.Task.Dom:: Task domains
1566-
1567-
@cindex Domain
1568-
@cindex Process
1569-
@cindex Thread
1570-
1571-
Every task belongs to a domain. A @dfn{domain} is a structure that owns tasks,
1572-
schedules tasks, tracks memory allocation within tasks and manages access to
1573-
runtime services on behalf of tasks.
1574-
1575-
Typically each domain runs on a separate operating-system @emph{thread}, or
1576-
within an isolated operating-system @emph{process}. An easy way to think of a
1577-
domain is as an abstraction over either an operating-system thread @emph{or} a
1578-
process.
1579-
1580-
The key feature of a domain is that it isolates memory references created by
1581-
the Rust tasks within it. No Rust task can refer directly to memory outside
1582-
its domain.
1583-
1584-
Tasks can own sub-domains, which in turn own their own tasks. Every domain
1585-
owns one @emph{root task}, which is the root of the tree of tasks owned by the
1586-
domain.
1587-
15881552
@node Ref.Task.Sched
15891553
@subsection Ref.Task.Sched
15901554
@c * Ref.Task.Sched:: Task scheduling model.
@@ -1593,11 +1557,9 @@ domain.
15931557
@cindex Preemption
15941558
@cindex Yielding control
15951559

1596-
Every task is @emph{scheduled} within its domain. @xref{Ref.Task.Dom}. The
1597-
currently scheduled task is given a finite @emph{time slice} in which to
1560+
The currently scheduled task is given a finite @emph{time slice} in which to
15981561
execute, after which it is @emph{descheduled} at a loop-edge or similar
1599-
preemption point, and another task within the domain is scheduled,
1600-
pseudo-randomly.
1562+
preemption point, and another task within is scheduled, pseudo-randomly.
16011563

16021564
An executing task can @code{yield} control at any time, which deschedules it
16031565
immediately. Entering any other non-executing state (blocked, dead) similarly
@@ -1616,7 +1578,7 @@ function. The passed function is referred to as the @dfn{entry function} for
16161578
the spawned task, and any captured environment is carries is moved from the
16171579
spawning task to the spawned task before the spawned task begins execution.
16181580

1619-
The result of a @code{spawn} call is a @code{std::task::task_id} value.
1581+
The result of a @code{spawn} call is a @code{std::task::task} value.
16201582

16211583
An example of a @code{spawn} call:
16221584
@example
@@ -1631,10 +1593,10 @@ fn helper(c: chan<u8>) @{
16311593
16321594
let p: port<u8>;
16331595
1634-
spawn(bind helper(p.mk_chan()));
1596+
spawn(bind helper(chan(p)));
16351597
// let task run, do other things.
16361598
// ...
1637-
let result = p.recv();
1599+
let result = recv(p);
16381600
16391601
@end example
16401602

@@ -1674,7 +1636,7 @@ An example of a @emph{receive}:
16741636
@example
16751637
import std::comm::*;
16761638
let p: port<str> = @dots{};
1677-
let s: str = p.recv();
1639+
let s: str = recv(p);
16781640
@end example
16791641

16801642

@@ -1931,7 +1893,7 @@ control).
19311893
Any pure boolean function is called a @emph{predicate}, and may be used
19321894
as part of the static typestate system. @xref{Ref.Typestate.Constr}. A
19331895
predicate declaration is identical to a function declaration, except that it
1934-
is declared with the keyword @code{pred} instead of @code{fn}. In addition,
1896+
is declared with the additional keyword @code{pure}. In addition,
19351897
the typechecker checks the body of a predicate with a restricted set of
19361898
typechecking rules. A predicate
19371899
@itemize
@@ -1942,11 +1904,65 @@ self-call expression; and
19421904

19431905
An example of a predicate:
19441906
@example
1945-
pred lt_42(int x) -> bool @{
1907+
pure fn lt_42(x: int) -> bool @{
19461908
ret (x < 42);
19471909
@}
19481910
@end example
19491911

1912+
A non-boolean function may also be declared with @code{pure fn}. This allows
1913+
predicates to call non-boolean functions as long as they are pure. For example:
1914+
@example
1915+
pure fn pure_length<@@T>(ls: &list<T>) -> uint @{ /* ... */ @}
1916+
1917+
pure fn nonempty_list<@@T>(ls: &list<T>) -> bool @{ pure_length(ls) > 0u @}
1918+
@end example
1919+
1920+
In this example, @code{nonempty_list} is a predicate---it can be used in a
1921+
typestate constraint---but the auxiliary function @code{pure_length}@ is
1922+
not.
1923+
1924+
@emph{ToDo:} should actually define referential transparency.
1925+
1926+
The effect checking rules previously enumerated are a restricted set of
1927+
typechecking rules meant to approximate the universe of observably
1928+
referentially transparent Rust procedures conservatively. Sometimes, these
1929+
rules are @emph{too} restrictive. Rust allows programmers to violate these
1930+
rules by writing predicates that the compiler cannot prove to be referentially
1931+
transparent, using an escape-hatch feature called ``unchecked blocks''. When
1932+
writing code that uses unchecked blocks, programmers should always be aware
1933+
that they have an obligation to show that the code @emph{behaves} referentially
1934+
transparently at all times, even if the compiler cannot @emph{prove}
1935+
automatically that the code is referentially transparent. In the presence of
1936+
unchecked blocks, the compiler provides no static guarantee that the code will
1937+
behave as expected at runtime. Rather, the programmer has an independent
1938+
obligation to verify the semantics of the predicates they write.
1939+
1940+
@emph{ToDo:} last two sentences are vague.
1941+
1942+
An example of a predicate that uses an unchecked block:
1943+
@example
1944+
fn pure_foldl<@@T, @@U>(ls: &list<T>, u: &U, f: &block(&T, &U) -> U) -> U @{
1945+
alt ls @{
1946+
nil. @{ u @}
1947+
cons(hd, tl) @{ f(hd, pure_foldl(*tl, f(hd, u), f)) @}
1948+
@}
1949+
@}
1950+
1951+
pure fn pure_length<@@T>(ls: &list<T>) -> uint @{
1952+
fn count<T>(_t: &T, u: &uint) -> uint @{ u + 1u @}
1953+
unchecked @{
1954+
pure_foldl(ls, 0u, count)
1955+
@}
1956+
@}
1957+
@end example
1958+
1959+
Despite its name, @code{pure_foldl} is a @code{fn}, not a @code{pure fn},
1960+
because there is no way in Rust to specify that the higher-order function
1961+
argument @code{f} is a pure function. So, to use @code{foldl} in a pure list
1962+
length function that a predicate could then use, we must use an
1963+
@code{unchecked} block wrapped around the call to @code{pure_foldl} in the
1964+
definition of @code{pure_length}.
1965+
19501966
@node Ref.Item.Iter
19511967
@subsection Ref.Item.Iter
19521968
@c * Ref.Item.Iter:: Items defining iterators.
@@ -2748,7 +2764,7 @@ A @dfn{constraint} is a predicate applied to specific slots.
27482764
For example, consider the following code:
27492765

27502766
@example
2751-
pred is_less_than(int a, int b) -> bool @{
2767+
pure fn is_less_than(int a, int b) -> bool @{
27522768
ret a < b;
27532769
@}
27542770
@@ -3525,7 +3541,7 @@ and statically comparing implied states and their
35253541
specifications. @xref{Ref.Typestate}.
35263542

35273543
@example
3528-
pred even(x: &int) -> bool @{
3544+
pure fn even(x: &int) -> bool @{
35293545
ret x & 1 == 0;
35303546
@}
35313547
@@ -3724,7 +3740,7 @@ signal queue associated with each task. Sending a signal to a task inserts the
37243740
signal into the task's signal queue and marks the task as having a pending
37253741
signal. At the next scheduling opportunity, the runtime processes signals in
37263742
the task's queue using its dispatch table. The signal queue memory is charged
3727-
to the task's domain; if the queue grows too big, the task will fail.
3743+
to the task; if the queue grows too big, the task will fail.
37283744

37293745
@c ############################################################
37303746
@c end main body of nodes

trunk/mk/platform.mk

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CFG_DSYMUTIL := true
99

1010
ifeq ($(CFG_OSTYPE), FreeBSD)
1111
CFG_LIB_NAME=lib$(1).so
12-
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -I/usr/local/include -O2
12+
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -I/usr/local/include
1313
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
1414
ifeq ($(CFG_CPUTYPE), x86_64)
1515
CFG_GCCISH_CFLAGS += -m32
@@ -22,7 +22,7 @@ endif
2222

2323
ifeq ($(CFG_OSTYPE), Linux)
2424
CFG_LIB_NAME=lib$(1).so
25-
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -O2
25+
CFG_GCCISH_CFLAGS += -fPIC -march=i686
2626
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -ldl -lpthread -lrt
2727
CFG_GCCISH_DEF_FLAG := -Wl,--export-dynamic,--dynamic-list=
2828
CFG_GCCISH_PRE_LIB_FLAGS := -Wl,-whole-archive
@@ -48,8 +48,8 @@ ifeq ($(CFG_OSTYPE), Darwin)
4848
# approaches welcome!
4949
#
5050
# NB: Currently GCC's optimizer breaks rustrt (task-comm-1 hangs) on Darwin.
51-
CFG_GCC_CFLAGS += -m32 -O2
52-
CFG_CLANG_CFLAGS += -m32 -O2
51+
CFG_GCC_CFLAGS += -m32
52+
CFG_CLANG_CFLAGS += -m32
5353
ifeq ($(CFG_CPUTYPE), x86_64)
5454
CFG_GCCISH_CFLAGS += -arch i386
5555
CFG_GCCISH_LINK_FLAGS += -arch i386
@@ -63,6 +63,13 @@ ifneq ($(findstring MINGW,$(CFG_OSTYPE)),)
6363
CFG_WINDOWSY := 1
6464
endif
6565

66+
ifdef CFG_DISABLE_OPTIMIZE_CXX
67+
$(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
68+
CFG_GCCISH_CFLAGS += -O0
69+
else
70+
CFG_GCCISH_CFLAGS += -O2
71+
endif
72+
6673
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
6774
$(if $(findstring stage0,$(1)), \
6875
stage0/lib, \
@@ -94,7 +101,7 @@ ifdef CFG_UNIXY
94101
CFG_VALGRIND += wine
95102
endif
96103

97-
CFG_GCCISH_CFLAGS := -fno-strict-aliasing -march=i586 -O2
104+
CFG_GCCISH_CFLAGS := -fno-strict-aliasing -march=i586
98105
CFG_GCCISH_PRE_LIB_FLAGS :=
99106
CFG_GCCISH_POST_LIB_FLAGS :=
100107
CFG_GCCISH_DEF_FLAG :=
@@ -130,7 +137,7 @@ ifdef CFG_WINDOWSY
130137
CFG_PATH_MUNGE := $(strip perl -i.bak -p \
131138
-e 's@\\(\S)@/\1@go;' \
132139
-e 's@^/([a-zA-Z])/@\1:/@o;')
133-
CFG_GCCISH_CFLAGS += -march=i686 -O2
140+
CFG_GCCISH_CFLAGS += -march=i686
134141
CFG_GCCISH_LINK_FLAGS += -shared -fPIC
135142
endif
136143

@@ -141,7 +148,7 @@ CFG_INFO := $(info cfg: using $(CFG_C_COMPILER))
141148
ifeq ($(CFG_C_COMPILER),clang)
142149
CC=clang
143150
CXX=clang++
144-
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -fno-exceptions -g
151+
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
145152
CFG_GCCISH_LINK_FLAGS += -g
146153
CFG_COMPILE_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) \
147154
$(CFG_CLANG_CFLAGS) -c -o $(1) $(2)
@@ -153,7 +160,7 @@ else
153160
ifeq ($(CFG_C_COMPILER),gcc)
154161
CC=gcc
155162
CXX=g++
156-
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -fno-exceptions -g
163+
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
157164
CFG_GCCISH_LINK_FLAGS += -g
158165
CFG_COMPILE_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) \
159166
$(CFG_GCC_CFLAGS) -c -o $(1) $(2)

trunk/mk/pp.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ else
99
$(wildcard $(S)src/fuzzer/*.rs)
1010

1111
PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
12-
"no-reformat\|xfail-pretty\|xfail-stage2")
12+
"no-reformat\|xfail-pretty\|xfail-test")
1313
endif
1414

1515
reformat: $(SREQ1)

0 commit comments

Comments
 (0)