Skip to content

Commit bfb834d

Browse files
committed
---
yaml --- r: 139784 b: refs/heads/try2 c: 4beebc4 h: refs/heads/master v: v3
1 parent 934ef13 commit bfb834d

File tree

12 files changed

+267
-34
lines changed

12 files changed

+267
-34
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: 59e69aa0e79302887abcb4b6bf3613c84b48e5d7
8+
refs/heads/try2: 4beebc427c4688fa61492478a6ef70af1625fbc3
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libcore/libc.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,10 +863,20 @@ pub mod consts {
863863
pub static F_TEST : int = 3;
864864
pub static F_TLOCK : int = 2;
865865
pub static F_ULOCK : int = 0;
866+
pub static SIGHUP : int = 1;
867+
pub static SIGINT : int = 2;
868+
pub static SIGQUIT : int = 3;
869+
pub static SIGILL : int = 4;
870+
pub static SIGABRT : int = 6;
871+
pub static SIGFPE : int = 8;
866872
pub static SIGKILL : int = 9;
873+
pub static SIGSEGV : int = 11;
874+
pub static SIGPIPE : int = 13;
875+
pub static SIGALRM : int = 14;
867876
pub static SIGTERM : int = 15;
868877
}
869878
pub mod posix01 {
879+
pub static SIGTRAP : int = 5;
870880
}
871881
pub mod posix08 {
872882
}
@@ -932,10 +942,20 @@ pub mod consts {
932942
pub static F_TEST : int = 3;
933943
pub static F_TLOCK : int = 2;
934944
pub static F_ULOCK : int = 0;
945+
pub static SIGHUP : int = 1;
946+
pub static SIGINT : int = 2;
947+
pub static SIGQUIT : int = 3;
948+
pub static SIGILL : int = 4;
949+
pub static SIGABRT : int = 6;
950+
pub static SIGFPE : int = 8;
935951
pub static SIGKILL : int = 9;
952+
pub static SIGSEGV : int = 11;
953+
pub static SIGPIPE : int = 13;
954+
pub static SIGALRM : int = 14;
936955
pub static SIGTERM : int = 15;
937956
}
938957
pub mod posix01 {
958+
pub static SIGTRAP : int = 5;
939959
}
940960
pub mod posix08 {
941961
}
@@ -1002,10 +1022,20 @@ pub mod consts {
10021022
pub static F_TEST : int = 3;
10031023
pub static F_TLOCK : int = 2;
10041024
pub static F_ULOCK : int = 0;
1025+
pub static SIGHUP : int = 1;
1026+
pub static SIGINT : int = 2;
1027+
pub static SIGQUIT : int = 3;
1028+
pub static SIGILL : int = 4;
1029+
pub static SIGABRT : int = 6;
1030+
pub static SIGFPE : int = 8;
10051031
pub static SIGKILL : int = 9;
1032+
pub static SIGSEGV : int = 11;
1033+
pub static SIGPIPE : int = 13;
1034+
pub static SIGALRM : int = 14;
10061035
pub static SIGTERM : int = 15;
10071036
}
10081037
pub mod posix01 {
1038+
pub static SIGTRAP : int = 5;
10091039
}
10101040
pub mod posix08 {
10111041
}

branches/try2/src/libcore/reflect.rs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Runtime type reflection
1515
*/
1616

1717
use intrinsic::{TyDesc, TyVisitor};
18+
#[cfg(not(stage0))] use intrinsic::Opaque;
1819
use libc::c_void;
1920
use sys;
2021
use vec;
@@ -393,6 +394,7 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
393394
true
394395
}
395396

397+
#[cfg(stage0)]
396398
fn visit_enter_enum(&self, n_variants: uint, sz: uint, align: uint)
397399
-> bool {
398400
self.align(align);
@@ -402,25 +404,47 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
402404
true
403405
}
404406

407+
#[cfg(not(stage0))]
408+
fn visit_enter_enum(&self, n_variants: uint,
409+
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
410+
sz: uint, align: uint)
411+
-> bool {
412+
self.align(align);
413+
if ! self.inner.visit_enter_enum(n_variants, get_disr, sz, align) {
414+
return false;
415+
}
416+
true
417+
}
418+
405419
fn visit_enter_enum_variant(&self, variant: uint,
406420
disr_val: int,
407421
n_fields: uint,
408422
name: &str) -> bool {
409-
self.inner.push_ptr();
423+
self.inner.push_ptr(); // NOTE remove after next snapshot
410424
if ! self.inner.visit_enter_enum_variant(variant, disr_val,
411425
n_fields, name) {
412426
return false;
413427
}
414428
true
415429
}
416430

431+
#[cfg(stage0)]
417432
fn visit_enum_variant_field(&self, i: uint, inner: *TyDesc) -> bool {
418433
unsafe { self.align((*inner).align); }
419434
if ! self.inner.visit_enum_variant_field(i, inner) { return false; }
420435
unsafe { self.bump((*inner).size); }
421436
true
422437
}
423438

439+
#[cfg(not(stage0))]
440+
fn visit_enum_variant_field(&self, i: uint, offset: uint, inner: *TyDesc) -> bool {
441+
self.inner.push_ptr();
442+
self.bump(offset);
443+
if ! self.inner.visit_enum_variant_field(i, offset, inner) { return false; }
444+
self.inner.pop_ptr();
445+
true
446+
}
447+
424448
fn visit_leave_enum_variant(&self, variant: uint,
425449
disr_val: int,
426450
n_fields: uint,
@@ -429,10 +453,11 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
429453
n_fields, name) {
430454
return false;
431455
}
432-
self.inner.pop_ptr();
456+
self.inner.pop_ptr(); // NOTE remove after next snapshot
433457
true
434458
}
435459

460+
#[cfg(stage0)]
436461
fn visit_leave_enum(&self, n_variants: uint, sz: uint, align: uint)
437462
-> bool {
438463
if ! self.inner.visit_leave_enum(n_variants, sz, align) {
@@ -442,6 +467,17 @@ impl<V:TyVisitor + MovePtr> TyVisitor for MovePtrAdaptor<V> {
442467
true
443468
}
444469

470+
#[cfg(not(stage0))]
471+
fn visit_leave_enum(&self, n_variants: uint,
472+
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
473+
sz: uint, align: uint) -> bool {
474+
if ! self.inner.visit_leave_enum(n_variants, get_disr, sz, align) {
475+
return false;
476+
}
477+
self.bump(sz);
478+
true
479+
}
480+
445481
fn visit_trait(&self) -> bool {
446482
self.align_to::<@TyVisitor>();
447483
if ! self.inner.visit_trait() { return false; }

branches/try2/src/libcore/repr.rs

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use cast::transmute;
1818
use char;
1919
use intrinsic;
2020
use intrinsic::{TyDesc, TyVisitor, visit_tydesc};
21+
#[cfg(not(stage0))] use intrinsic::Opaque;
2122
use io::{Writer, WriterUtil};
2223
use libc::c_void;
2324
use managed;
@@ -137,12 +138,20 @@ impl Repr for char {
137138

138139
// New implementation using reflect::MovePtr
139140

141+
#[cfg(stage0)]
140142
enum VariantState {
141143
Degenerate,
142144
TagMatch,
143145
TagMismatch,
144146
}
145147

148+
#[cfg(not(stage0))]
149+
enum VariantState {
150+
SearchingFor(int),
151+
Matched,
152+
AlreadyFound
153+
}
154+
146155
pub struct ReprVisitor {
147156
mut ptr: *c_void,
148157
mut ptr_stk: ~[*c_void],
@@ -181,14 +190,14 @@ pub impl ReprVisitor {
181190
true
182191
}
183192

184-
#[inline(always)]
193+
#[cfg(stage0)] #[inline(always)]
185194
fn bump(&self, sz: uint) {
186195
do self.move_ptr() |p| {
187196
((p as uint) + sz) as *c_void
188197
};
189198
}
190199

191-
#[inline(always)]
200+
#[cfg(stage0)] #[inline(always)]
192201
fn bump_past<T>(&self) {
193202
self.bump(sys::size_of::<T>());
194203
}
@@ -458,6 +467,7 @@ impl TyVisitor for ReprVisitor {
458467
true
459468
}
460469

470+
#[cfg(stage0)]
461471
fn visit_enter_enum(&self, n_variants: uint,
462472
_sz: uint, _align: uint) -> bool {
463473
if n_variants == 1 {
@@ -468,6 +478,16 @@ impl TyVisitor for ReprVisitor {
468478
true
469479
}
470480

481+
#[cfg(not(stage0))]
482+
fn visit_enter_enum(&self, n_variants: uint,
483+
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
484+
_sz: uint, _align: uint) -> bool {
485+
let disr = unsafe { get_disr(transmute(self.ptr)) };
486+
self.var_stk.push(SearchingFor(disr));
487+
true
488+
}
489+
490+
#[cfg(stage0)]
471491
fn visit_enter_enum_variant(&self, _variant: uint,
472492
disr_val: int,
473493
n_fields: uint,
@@ -500,6 +520,36 @@ impl TyVisitor for ReprVisitor {
500520
true
501521
}
502522

523+
#[cfg(not(stage0))]
524+
fn visit_enter_enum_variant(&self, _variant: uint,
525+
disr_val: int,
526+
n_fields: uint,
527+
name: &str) -> bool {
528+
let mut write = false;
529+
match self.var_stk.pop() {
530+
SearchingFor(sought) => {
531+
if disr_val == sought {
532+
self.var_stk.push(Matched);
533+
write = true;
534+
} else {
535+
self.var_stk.push(SearchingFor(sought));
536+
}
537+
}
538+
Matched | AlreadyFound => {
539+
self.var_stk.push(AlreadyFound);
540+
}
541+
}
542+
543+
if write {
544+
self.writer.write_str(name);
545+
if n_fields > 0 {
546+
self.writer.write_char('(');
547+
}
548+
}
549+
true
550+
}
551+
552+
#[cfg(stage0)]
503553
fn visit_enum_variant_field(&self, i: uint, inner: *TyDesc) -> bool {
504554
match self.var_stk[vec::uniq_len(&const self.var_stk) - 1] {
505555
Degenerate | TagMatch => {
@@ -515,6 +565,23 @@ impl TyVisitor for ReprVisitor {
515565
true
516566
}
517567

568+
#[cfg(not(stage0))]
569+
fn visit_enum_variant_field(&self, i: uint, _offset: uint, inner: *TyDesc) -> bool {
570+
match self.var_stk[vec::uniq_len(&const self.var_stk) - 1] {
571+
Matched => {
572+
if i != 0 {
573+
self.writer.write_str(", ");
574+
}
575+
if ! self.visit_inner(inner) {
576+
return false;
577+
}
578+
}
579+
_ => ()
580+
}
581+
true
582+
}
583+
584+
#[cfg(stage0)]
518585
fn visit_leave_enum_variant(&self, _variant: uint,
519586
_disr_val: int,
520587
n_fields: uint,
@@ -530,12 +597,39 @@ impl TyVisitor for ReprVisitor {
530597
true
531598
}
532599

600+
#[cfg(not(stage0))]
601+
fn visit_leave_enum_variant(&self, _variant: uint,
602+
_disr_val: int,
603+
n_fields: uint,
604+
_name: &str) -> bool {
605+
match self.var_stk[vec::uniq_len(&const self.var_stk) - 1] {
606+
Matched => {
607+
if n_fields > 0 {
608+
self.writer.write_char(')');
609+
}
610+
}
611+
_ => ()
612+
}
613+
true
614+
}
615+
616+
#[cfg(stage0)]
533617
fn visit_leave_enum(&self, _n_variants: uint,
534618
_sz: uint, _align: uint) -> bool {
535619
self.var_stk.pop();
536620
true
537621
}
538622

623+
#[cfg(not(stage0))]
624+
fn visit_leave_enum(&self, _n_variants: uint,
625+
_get_disr: extern unsafe fn(ptr: *Opaque) -> int,
626+
_sz: uint, _align: uint) -> bool {
627+
match self.var_stk.pop() {
628+
SearchingFor(*) => fail!(~"enum value matched no variant"),
629+
_ => true
630+
}
631+
}
632+
539633
fn visit_enter_fn(&self, _purity: uint, _proto: uint,
540634
_n_inputs: uint, _retstyle: uint) -> bool { true }
541635
fn visit_fn_input(&self, _i: uint, _mode: uint, _inner: *TyDesc) -> bool {

branches/try2/src/librustc/front/intrinsic.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ pub mod intrinsic {
2828
// Remaining fields not listed
2929
}
3030

31+
pub enum Opaque { }
32+
3133
pub trait TyVisitor {
3234
fn visit_bot(&self) -> bool;
3335
fn visit_nil(&self) -> bool;
@@ -91,17 +93,19 @@ pub mod intrinsic {
9193
sz: uint, align: uint) -> bool;
9294

9395
fn visit_enter_enum(&self, n_variants: uint,
96+
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
9497
sz: uint, align: uint) -> bool;
9598
fn visit_enter_enum_variant(&self, variant: uint,
9699
disr_val: int,
97100
n_fields: uint,
98101
name: &str) -> bool;
99-
fn visit_enum_variant_field(&self, i: uint, inner: *TyDesc) -> bool;
102+
fn visit_enum_variant_field(&self, i: uint, offset: uint, inner: *TyDesc) -> bool;
100103
fn visit_leave_enum_variant(&self, variant: uint,
101104
disr_val: int,
102105
n_fields: uint,
103106
name: &str) -> bool;
104107
fn visit_leave_enum(&self, n_variants: uint,
108+
get_disr: extern unsafe fn(ptr: *Opaque) -> int,
105109
sz: uint, align: uint) -> bool;
106110

107111
fn visit_enter_fn(&self, purity: uint, proto: uint,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
256256
cls[i] = sse_int_class;
257257
} else if is_sse(cls[i]) {
258258
i += 1;
259-
while cls[i] == sseup_class { i += 1u; }
259+
while i != e && cls[i] == sseup_class { i += 1u; }
260260
} else if cls[i] == x87_class {
261261
i += 1;
262-
while cls[i] == x87up_class { i += 1u; }
262+
while i != e && cls[i] == x87up_class { i += 1u; }
263263
} else {
264264
i += 1;
265265
}

0 commit comments

Comments
 (0)