Skip to content

Commit 923fee9

Browse files
committed
---
yaml --- r: 138956 b: refs/heads/try2 c: ece0986 h: refs/heads/master v: v3
1 parent dd58783 commit 923fee9

Some content is hidden

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

41 files changed

+879
-215
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 1e1efbf2c355c4ddb1356abe535d79525bad72ba
8+
refs/heads/try2: ece098667d8ac56f537caa04810d3d1a8097e81f
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/RELEASES.txt

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,85 @@
1-
Version 0.6 (?)
1+
Version 0.6 (March 2013)
22
---------------------------
33

4+
* ~??? changes, numerous bugfixes
5+
6+
* TODO:
7+
* Ord/Cmp
8+
* Lifetime changes
9+
* Implicit self
10+
* Remove `static` keyword
11+
* Static method syntax
12+
* `as Trait`
13+
* `copy` removed?
14+
15+
* Syntax changes
16+
* The self type parameter in traits is now spelled `Self`
17+
* Replaced the `Durable` trait with the `'static` lifetime
18+
* The old closure type syntax with the trailing sigil has been
19+
removed in favor of the more consistent leading sigil
20+
* `super` is a keyword, and may be prefixed to paths
21+
* Trait bounds are separated with `+` instead of whitespace
22+
* Traits are implemented with `impl Trait for Type`
23+
instead of `impl Type: Trait`
24+
* The `export` keyword has finally been removed
25+
* The `move` keyword has been removed (linear types move by default)
26+
* The interior mutability qualifier on vectors, `[mut T]`, has been
27+
removed. Use `&mut [T]`, etc.
28+
* `mut` is no longer valid in `~mut T`. Use inherited mutability
29+
* `fail` is no longer a keyword. Use `fail!()`
30+
* `assert` is no longer a keyword. Use `assert!()`
31+
* `log` is no longer a keyword. use `debug!`, etc.
32+
* 1-tuples may be represented as `(T,)`
33+
* Struct fields may no longer be `mut`. Use inherited mutability,
34+
`@mut T`, `core::mut` or `core::cell`
35+
* `extern mod { ... }` is no longer valid syntax for foreign
36+
function modules. Use extern blocks: `extern { ... }`
37+
* Newtype enums removed. Used tuple-structs.
38+
* Trait implementations no longer support visibility modifiers
39+
40+
* Semantic changes
41+
* Linear types move by default, eliminating the `move` keyword
42+
* All foreign functions are considered unsafe
43+
* &mut is now unaliasable
44+
* Writes to borrowed @mut pointers are prevented dynamically
45+
* () has size 0
46+
* The name of the main function can be customized using #[main]
47+
* The default type of an inferred closure is &fn instead of @fn
48+
* Name resolution continues to be tweaked
49+
* Method visibility is inherited from the implementation declaration
50+
51+
* Other language changes
52+
* Structural records have been removed
53+
* Many more types can be used in constants, including enums
54+
`static lifetime pointers and vectors
55+
* Pattern matching over vectors improved and expanded
56+
* Typechecking of closure types has been overhauled to
57+
improve inference and eliminate unsoundness
58+
459
* Libraries
5-
* `core::send_map` renamed to `core::hashmap`
60+
* Lots of effort to organize the container API's around `core::container`
61+
* `core::send_map` renamed to `core::hashmap`
62+
* Added big integers to `std::bigint`
63+
* Removed `core::oldcomm` module
64+
* Added pipe-based `core::comm` module
65+
* Reimplemented `std::treemap`
66+
* Numeric traits have been reorganized under `core::num`
67+
* `core::dvec` removed. Use `@mut ~[T]` or other language types
68+
* `vec::slice` finally returns a slice
69+
* `debug!` and friends don't require a format string, e.g. `debug!(Foo)`
70+
71+
* Tools
72+
* Replaced the 'cargo' package manager with 'rustpkg'
73+
* Added all-purpose 'rust' tool
74+
* `rustc --test` now supports a benchmarks with the `#[bench]` attribute
75+
* rustc now attempts to offer spelling suggestions
76+
77+
* Misc
78+
* Improved support for ARM and Android
79+
* Preliminary MIPS backend
80+
* Improved foreign function ABI implementation for x86, x86_64
81+
* Various and memory usage improvements
82+
* Rust code may be embedded in foreign code under limited circumstances
683

784
Version 0.5 (December 2012)
885
---------------------------

branches/try2/src/etc/local_stage0.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ cp ${PREFIX}/lib/rustc/${TARG_DIR}/${LIBDIR}/* ${TARG_DIR}/stage0/${LIBDIR}/
4646
cp ${PREFIX}/lib/librust*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
4747
cp ${PREFIX}/lib/libcore*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
4848
cp ${PREFIX}/lib/libstd*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/
49+
cp ${PREFIX}/lib/libsyntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIBDIR}/

branches/try2/src/libcore/option.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ let unwrapped_msg = match msg {
4242
*/
4343

4444
use cmp::{Eq,Ord};
45+
use ops::Add;
4546
use kinds::Copy;
4647
use util;
4748
use num::Zero;
@@ -85,6 +86,18 @@ impl<T:Ord> Ord for Option<T> {
8586
}
8687
}
8788

89+
impl<T: Copy + Add<T,T>> Add<Option<T>, Option<T>> for Option<T> {
90+
#[inline(always)]
91+
pure fn add(&self, other: &Option<T>) -> Option<T> {
92+
match (*self, *other) {
93+
(None, None) => None,
94+
(_, None) => *self,
95+
(None, _) => *other,
96+
(Some(ref lhs), Some(ref rhs)) => Some(*lhs + *rhs)
97+
}
98+
}
99+
}
100+
88101
#[inline(always)]
89102
pub pure fn get<T:Copy>(opt: Option<T>) -> T {
90103
/*!

branches/try2/src/libcore/rt/context.rs

Lines changed: 63 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,42 @@ extern {
6565
fn swap_registers(out_regs: *mut Registers, in_regs: *Registers);
6666
}
6767

68-
// Definitions of these registers are in rt/arch/x86_64/regs.h
68+
#[cfg(target_arch = "x86")]
69+
struct Registers {
70+
eax: u32, ebx: u32, ecx: u32, edx: u32,
71+
ebp: u32, esi: u32, edi: u32, esp: u32,
72+
cs: u16, ds: u16, ss: u16, es: u16, fs: u16, gs: u16,
73+
eflags: u32, eip: u32
74+
}
75+
76+
#[cfg(target_arch = "x86")]
77+
fn new_regs() -> ~Registers {
78+
~Registers {
79+
eax: 0, ebx: 0, ecx: 0, edx: 0,
80+
ebp: 0, esi: 0, edi: 0, esp: 0,
81+
cs: 0, ds: 0, ss: 0, es: 0, fs: 0, gs: 0,
82+
eflags: 0, eip: 0
83+
}
84+
}
85+
86+
#[cfg(target_arch = "x86")]
87+
fn initialize_call_frame(regs: &mut Registers,
88+
fptr: *c_void, arg: *c_void, sp: *mut uint) {
89+
90+
let sp = align_down(sp);
91+
let sp = mut_offset(sp, -4); // XXX: -4 words? Needs this be done at all?
92+
93+
unsafe { *sp = arg as uint; }
94+
let sp = mut_offset(sp, -1);
95+
unsafe { *sp = 0; } // The final return address
96+
97+
regs.esp = sp as u32;
98+
regs.eip = fptr as u32;
99+
100+
// Last base pointer on the stack is 0
101+
regs.ebp = 0;
102+
}
103+
69104
#[cfg(target_arch = "x86_64")]
70105
type Registers = [uint * 22];
71106

@@ -101,40 +136,42 @@ fn initialize_call_frame(regs: &mut Registers,
101136
regs[RUSTRT_RBP] = 0;
102137
}
103138

104-
#[cfg(target_arch = "x86")]
105-
struct Registers {
106-
eax: u32, ebx: u32, ecx: u32, edx: u32,
107-
ebp: u32, esi: u32, edi: u32, esp: u32,
108-
cs: u16, ds: u16, ss: u16, es: u16, fs: u16, gs: u16,
109-
eflags: u32, eip: u32
110-
}
139+
#[cfg(target_arch = "arm")]
140+
type Registers = [uint * 32];
111141

112-
#[cfg(target_arch = "x86")]
113-
fn new_regs() -> ~Registers {
114-
~Registers {
115-
eax: 0, ebx: 0, ecx: 0, edx: 0,
116-
ebp: 0, esi: 0, edi: 0, esp: 0,
117-
cs: 0, ds: 0, ss: 0, es: 0, fs: 0, gs: 0,
118-
eflags: 0, eip: 0
119-
}
120-
}
142+
#[cfg(target_arch = "arm")]
143+
fn new_regs() -> ~Registers { ~[0, .. 32] }
121144

122-
#[cfg(target_arch = "x86")]
145+
#[cfg(target_arch = "arm")]
123146
fn initialize_call_frame(regs: &mut Registers,
124147
fptr: *c_void, arg: *c_void, sp: *mut uint) {
148+
let sp = mut_offset(sp, -1);
125149

126-
let sp = align_down(sp);
127-
let sp = mut_offset(sp, -4); // XXX: -4 words? Needs this be done at all?
150+
// The final return address. 0 indicates the bottom of the stack
151+
unsafe { *sp = 0; }
128152

129-
unsafe { *sp = arg as uint; }
153+
regs[0] = arg as uint; // r0
154+
regs[13] = sp as uint; // #53 sp, r13
155+
regs[14] = fptr as uint; // #60 pc, r15 --> lr
156+
}
157+
158+
#[cfg(target_arch = "mips")]
159+
type Registers = [uint * 32];
160+
161+
#[cfg(target_arch = "mips")]
162+
fn new_regs() -> ~Registers { ~[0, .. 32] }
163+
164+
#[cfg(target_arch = "mips")]
165+
fn initialize_call_frame(regs: &mut Registers,
166+
fptr: *c_void, arg: *c_void, sp: *mut uint) {
130167
let sp = mut_offset(sp, -1);
131-
unsafe { *sp = 0; } // The final return address
132168

133-
regs.esp = sp as u32;
134-
regs.eip = fptr as u32;
169+
// The final return address. 0 indicates the bottom of the stack
170+
unsafe { *sp = 0; }
135171

136-
// Last base pointer on the stack is 0
137-
regs.ebp = 0;
172+
regs[4] = arg as uint;
173+
regs[29] = sp as uint;
174+
regs[31] = fptr as uint;
138175
}
139176

140177
fn align_down(sp: *mut uint) -> *mut uint {

branches/try2/src/libcore/rt/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// XXX: Missing some implementation for other architectures
12-
#[cfg(target_os = "linux")];
13-
#[cfg(target_os = "mac")];
14-
#[cfg(target_os = "win32")];
15-
1611
// Some basic logging
1712
macro_rules! rtdebug (
1813
($( $arg:expr),+) => ( {

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ pub enum Metadata {
188188
MD_tbaa_struct = 5
189189
}
190190

191+
// Inline Asm Dialect
192+
pub enum AsmDialect {
193+
AD_ATT = 0,
194+
AD_Intel = 1
195+
}
196+
191197
// Opaque pointer types
192198
pub enum Module_opaque {}
193199
pub type ModuleRef = *Module_opaque;
@@ -217,9 +223,9 @@ pub enum SectionIterator_opaque {}
217223
pub type SectionIteratorRef = *SectionIterator_opaque;
218224

219225
pub mod llvm {
220-
use super::{AtomicBinOp, AtomicOrdering, BasicBlockRef, Bool, BuilderRef};
221-
use super::{ContextRef, MemoryBufferRef, ModuleRef, ObjectFileRef};
222-
use super::{Opcode, PassManagerRef, PassManagerBuilderRef};
226+
use super::{AsmDialect, AtomicBinOp, AtomicOrdering, BasicBlockRef};
227+
use super::{Bool, BuilderRef, ContextRef, MemoryBufferRef, ModuleRef};
228+
use super::{ObjectFileRef, Opcode, PassManagerRef, PassManagerBuilderRef};
223229
use super::{SectionIteratorRef, TargetDataRef, TypeKind, TypeRef, UseRef};
224230
use super::{ValueRef};
225231

@@ -1433,6 +1439,12 @@ pub mod llvm {
14331439

14341440
/** Enables LLVM debug output. */
14351441
pub unsafe fn LLVMSetDebug(Enabled: c_int);
1442+
1443+
/** Prepares inline assembly. */
1444+
pub unsafe fn LLVMInlineAsm(Ty: TypeRef, AsmString: *c_char,
1445+
Constraints: *c_char, SideEffects: Bool,
1446+
AlignStack: Bool, Dialect: AsmDialect)
1447+
-> ValueRef;
14361448
}
14371449
}
14381450

branches/try2/src/librustc/middle/check_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ pub fn check_expr(sess: Session,
9191
v: visit::vt<bool>) {
9292
if is_const {
9393
match e.node {
94-
expr_unary(box(_), _) | expr_unary(uniq(_), _) |
95-
expr_unary(deref, _) => {
94+
expr_unary(deref, _) => { }
95+
expr_unary(box(_), _) | expr_unary(uniq(_), _) => {
9696
sess.span_err(e.span,
9797
~"disallowed operator in constant expression");
9898
return;

branches/try2/src/librustc/middle/liveness.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,8 @@ fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
620620
expr_do_body(*) | expr_cast(*) | expr_unary(*) | expr_break(_) |
621621
expr_again(_) | expr_lit(_) | expr_ret(*) | expr_block(*) |
622622
expr_assign(*) | expr_swap(*) | expr_assign_op(*) | expr_mac(*) |
623-
expr_struct(*) | expr_repeat(*) | expr_paren(*) => {
623+
expr_struct(*) | expr_repeat(*) | expr_paren(*) |
624+
expr_inline_asm(*) => {
624625
visit::visit_expr(expr, self, vt);
625626
}
626627
}
@@ -1345,6 +1346,7 @@ pub impl Liveness {
13451346
self.propagate_through_expr(e, succ)
13461347
}
13471348
1349+
expr_inline_asm(*) |
13481350
expr_lit(*) => {
13491351
succ
13501352
}
@@ -1618,7 +1620,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
16181620
expr_cast(*) | expr_unary(*) | expr_ret(*) | expr_break(*) |
16191621
expr_again(*) | expr_lit(_) | expr_block(*) | expr_swap(*) |
16201622
expr_mac(*) | expr_addr_of(*) | expr_struct(*) | expr_repeat(*) |
1621-
expr_paren(*) => {
1623+
expr_paren(*) | expr_inline_asm(*) => {
16221624
visit::visit_expr(expr, self, vt);
16231625
}
16241626
}

branches/try2/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ pub impl mem_categorization_ctxt {
447447
ast::expr_while(*) | ast::expr_block(*) | ast::expr_loop(*) |
448448
ast::expr_match(*) | ast::expr_lit(*) | ast::expr_break(*) |
449449
ast::expr_mac(*) | ast::expr_again(*) | ast::expr_struct(*) |
450-
ast::expr_repeat(*) => {
450+
ast::expr_repeat(*) | ast::expr_inline_asm(*) => {
451451
return self.cat_rvalue(expr, expr_ty);
452452
}
453453
}

branches/try2/src/librustc/middle/moves.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,8 @@ pub impl VisitContext {
560560

561561
expr_break(*) |
562562
expr_again(*) |
563-
expr_lit(*) => {}
563+
expr_lit(*) |
564+
expr_inline_asm(*) => {}
564565

565566
expr_loop(ref blk, _) => {
566567
self.consume_block(blk, visitor);

branches/try2/src/librustc/middle/trans/build.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use lib::llvm::llvm;
12-
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering};
12+
use lib::llvm::{CallConv, TypeKind, AtomicBinOp, AtomicOrdering, AsmDialect};
1313
use lib::llvm::{Opcode, IntPredicate, RealPredicate, True, False};
1414
use lib::llvm::{ValueRef, TypeRef, BasicBlockRef, BuilderRef, ModuleRef};
1515
use lib;
@@ -18,7 +18,7 @@ use syntax::codemap::span;
1818

1919
use core::prelude::*;
2020
use core::cast;
21-
use core::libc::{c_uint, c_int, c_ulonglong};
21+
use core::libc::{c_uint, c_int, c_ulonglong, c_char};
2222
use core::libc;
2323
use core::option::Some;
2424
use core::ptr;
@@ -872,6 +872,25 @@ pub fn add_comment(bcx: block, text: &str) {
872872
}
873873
}
874874
875+
pub fn InlineAsmCall(cx: block, asm: *c_char, cons: *c_char,
876+
volatile: bool, alignstack: bool,
877+
dia: AsmDialect) -> ValueRef {
878+
unsafe {
879+
count_insn(cx, "inlineasm");
880+
881+
let volatile = if volatile { lib::llvm::True }
882+
else { lib::llvm::False };
883+
let alignstack = if alignstack { lib::llvm::True }
884+
else { lib::llvm::False };
885+
886+
let llfty = T_fn(~[], T_void());
887+
let v = llvm::LLVMInlineAsm(llfty, asm, cons, volatile,
888+
alignstack, dia);
889+
890+
Call(cx, v, ~[])
891+
}
892+
}
893+
875894
pub fn Call(cx: block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
876895
if cx.unreachable { return _UndefReturn(cx, Fn); }
877896
unsafe {

0 commit comments

Comments
 (0)