Skip to content

Commit 0e25915

Browse files
committed
---
yaml --- r: 60574 b: refs/heads/auto c: d86a32b h: refs/heads/master v: v3
1 parent 912f113 commit 0e25915

File tree

4 files changed

+8
-55
lines changed

4 files changed

+8
-55
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: adaae45c3e15f95b052648f3511a1097155296b9
17+
refs/heads/auto: d86a32bbb2ff79232bf3edc0f475062f45b6ea90
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libcore/ptr.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use cast;
1414
use libc;
1515
use libc::{c_void, size_t};
16-
use option::{Option, Some, None};
1716
use sys;
1817

1918
#[cfg(not(test))] use cmp::{Eq, Ord};
@@ -210,7 +209,6 @@ pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
210209
pub trait Ptr<T> {
211210
fn is_null(&const self) -> bool;
212211
fn is_not_null(&const self) -> bool;
213-
unsafe fn to_option(&const self) -> Option<&T>;
214212
fn offset(&self, count: uint) -> Self;
215213
}
216214

@@ -224,23 +222,6 @@ impl<T> Ptr<T> for *T {
224222
#[inline(always)]
225223
fn is_not_null(&const self) -> bool { is_not_null(*self) }
226224

227-
///
228-
/// Returns `None` if the pointer is null, or else returns the value wrapped
229-
/// in `Some`.
230-
///
231-
/// # Safety Notes
232-
///
233-
/// While this method is useful for null-safety, it is important to note
234-
/// that this is still an unsafe operation because the returned value could
235-
/// be pointing to invalid memory.
236-
///
237-
#[inline(always)]
238-
unsafe fn to_option(&const self) -> Option<&T> {
239-
if self.is_null() { None } else {
240-
Some(cast::transmute(*self))
241-
}
242-
}
243-
244225
/// Calculates the offset from a pointer.
245226
#[inline(always)]
246227
fn offset(&self, count: uint) -> *T { offset(*self, count) }
@@ -256,23 +237,6 @@ impl<T> Ptr<T> for *mut T {
256237
#[inline(always)]
257238
fn is_not_null(&const self) -> bool { is_not_null(*self) }
258239

259-
///
260-
/// Returns `None` if the pointer is null, or else returns the value wrapped
261-
/// in `Some`.
262-
///
263-
/// # Safety Notes
264-
///
265-
/// While this method is useful for null-safety, it is important to note
266-
/// that this is still an unsafe operation because the returned value could
267-
/// be pointing to invalid memory.
268-
///
269-
#[inline(always)]
270-
unsafe fn to_option(&const self) -> Option<&T> {
271-
if self.is_null() { None } else {
272-
Some(cast::transmute(*self))
273-
}
274-
}
275-
276240
/// Calculates the offset from a mutable pointer.
277241
#[inline(always)]
278242
fn offset(&self, count: uint) -> *mut T { mut_offset(*self, count) }
@@ -459,21 +423,6 @@ pub mod ptr_tests {
459423
assert!(mq.is_not_null());
460424
}
461425

462-
#[test]
463-
fn test_to_option() {
464-
let p: *int = null();
465-
// FIXME (#6641): Usage of unsafe methods in safe code doesn't cause an error.
466-
assert_eq!(p.to_option(), None);
467-
468-
let q: *int = &2;
469-
assert_eq!(q.to_option().unwrap(), &2); // FIXME (#6641)
470-
471-
let p: *mut int = mut_null();
472-
assert_eq!(p.to_option(), None); // FIXME (#6641)
473-
474-
let q: *mut int = &mut 2;
475-
assert_eq!(q.to_option().unwrap(), &2); // FIXME (#6641)
476-
}
477426

478427
#[test]
479428
fn test_ptr_array_each_with_len() {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ fn new_regs() -> ~Registers { ~([0, .. 32]) }
183183

184184
#[cfg(target_arch = "mips")]
185185
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
186-
let sp = mut_offset(sp, -1);
186+
let sp = align_down(sp);
187+
// sp of mips o32 is 8-byte aligned
188+
let sp = mut_offset(sp, -2);
187189

188190
// The final return address. 0 indicates the bottom of the stack
189191
unsafe { *sp = 0; }

branches/auto/src/rt/arch/mips/context.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ void context::call(void *f, void *arg, void *stack)
3434

3535
// set up the stack
3636
uint32_t *sp = (uint32_t *)stack;
37-
//sp = align_down(sp);
37+
sp = align_down(sp);
3838
// The final return address. 0 indicates the bottom of the stack
39-
*--sp = 0;
39+
// sp of mips o32 is 8-byte aligned
40+
sp -= 2;
41+
*sp = 0;
4042

4143
regs.data[4] = (uint32_t)arg;
4244
regs.data[29] = (uint32_t)sp;

0 commit comments

Comments
 (0)