Skip to content

Issue 5910 dyna freeze #6283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
202b8dc
adapt to snapshot
nikomatsakis Apr 17, 2013
b5a7e8b
desnapshot
nikomatsakis Apr 22, 2013
a896440
new borrow checker (mass squash)
nikomatsakis Mar 15, 2013
aa48a17
dataflow: fix flow of information through pattern variants
nikomatsakis Apr 30, 2013
7a0c1ea
correct used_mut annotations for args, inherited case
nikomatsakis Apr 30, 2013
545d51c
rustc: remove modes
nikomatsakis Apr 30, 2013
70b9ad1
rustc: work around issue with default-method-simple, fix some rebase
nikomatsakis Apr 30, 2013
418f991
allover: numerous unused muts etc
nikomatsakis Apr 30, 2013
dc21dae
borrowck: fix critical bug prevent us from ever using write guards :)
nikomatsakis Apr 30, 2013
f236b85
remove some unused mut decls
nikomatsakis Apr 30, 2013
5ab33a2
correct incorrect handling of overloaded operators, exposing various …
nikomatsakis May 1, 2013
d96c65a
keep old sort for stage0
nikomatsakis May 1, 2013
8486110
rustc: print out filename/line-number when a borrow fails
nikomatsakis May 1, 2013
4af2d90
add an option to debug borrows (RUST_DEBUG_BORROW) so you can
nikomatsakis May 1, 2013
3159335
avoid broken += operator, bogus use of const
nikomatsakis May 1, 2013
38f93f2
wip---work on making rooting work properly
nikomatsakis May 1, 2013
14bf5c4
rustc: adjust total number of lang items
nikomatsakis May 2, 2013
ef6b24d
rustc: fix the fact that trans_lvalue rooted twice
nikomatsakis May 2, 2013
d231c42
core: add more debugging printouts to borrowing
nikomatsakis May 2, 2013
6210de9
lang: fix code for maintaining borrow list
nikomatsakis May 2, 2013
fbaf839
rustc: more fix for trans_lvalue rooted twice
nikomatsakis May 2, 2013
5f88634
syntax: fix up dynamic borrow errors in libsyntax
nikomatsakis May 2, 2013
88ec89d
fix numerous dynamic borrow failures
nikomatsakis May 2, 2013
4999d44
trans: fix borrow violation
nikomatsakis May 2, 2013
cc62680
free the borrow list propertly instead of crashing
nikomatsakis May 2, 2013
9bded76
move @mut into scope_info
nikomatsakis May 3, 2013
3402435
Change borrow debugging so it is disabled by -O
nikomatsakis May 3, 2013
e7d9693
Correct mismatch between the way that pattern ids and expression ids …
nikomatsakis May 3, 2013
f3a6ea2
lang: um, actually set locking bits! this code got lost.
nikomatsakis May 3, 2013
be08c3e
rustc: add rooting, write-guards to slices etc
nikomatsakis May 3, 2013
0ff8200
factor code for write guards into its own module; add neglected resol…
nikomatsakis May 4, 2013
bf2d3c7
improve DEBUG_BORROW printouts
nikomatsakis May 4, 2013
ccf2f7b
make asm_comments something that you opt in to
nikomatsakis May 4, 2013
989d008
separate out write_guard code into its own module
nikomatsakis May 4, 2013
6806900
disable lang debug for perf
nikomatsakis May 5, 2013
0b0b801
add warning for #6248 and remove instances of it
nikomatsakis May 5, 2013
6cb273e
Address all FIXMEs from #5562
nikomatsakis May 5, 2013
4300d4d
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 5, 2013
7b36e34
Fix two more write guard failures
nikomatsakis May 6, 2013
4dc62df
do not run regionck if there have been type errors
nikomatsakis May 6, 2013
e235f6c
remove some unused mut decls and vars
nikomatsakis May 6, 2013
2ea52a3
refinement to technique used to not run regionck
nikomatsakis May 6, 2013
6c0c3a4
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 6, 2013
84f7ecc
Adust arena test: can no longer allocate recursively
nikomatsakis May 6, 2013
c50a9d5
Use rust_try_get_task for compat with new rt, and strenghten assumpti…
nikomatsakis May 6, 2013
0ef4e86
Replace NOTE with FIXME
nikomatsakis May 6, 2013
2e4790c
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 6, 2013
8b32bde
add rust_take_task_borrow_list and rust_set_task_borrow_list to rustr…
nikomatsakis May 7, 2013
ce45f39
Remove debug_mem since @graydon said it conflicted with GC changes
nikomatsakis May 7, 2013
cd164cf
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 7, 2013
39a1190
appease the tidy gods with respect to a FIXME
nikomatsakis May 7, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
core: add more debugging printouts to borrowing
  • Loading branch information
nikomatsakis committed May 2, 2013
commit d231c427e655b7164571a1a712563ba5fd2e4a3c
23 changes: 18 additions & 5 deletions src/libcore/unstable/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ pub mod rustrt {

#[rust_stack]
fn rust_set_task_borrow_list(task: *rust_task, map: *c_void);

fn rust_dbg_breakpoint();
}
}

Expand Down Expand Up @@ -88,6 +90,8 @@ fn swap_task_borrow_list(f: &fn(~[BorrowRecord]) -> ~[BorrowRecord]) {
}

pub fn fail_borrowed(box: *mut BoxRepr, file: *c_char, line: size_t) {
debug_ptr("fail_borrowed: ", box);

if !::rt::env::get().debug_borrows {
let msg = "borrowed";
do str::as_buf(msg) |msg_p, _| {
Expand Down Expand Up @@ -130,15 +134,15 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
static ENABLE_DEBUG_PTR: bool = false;

#[inline]
pub fn debug_ptr<T>(tag: &'static str, p: *T) {
pub fn debug_ptr<T>(tag: &'static str, p: *const T) {
//! A useful debugging function that prints a pointer + tag + newline
//! without allocating memory.

if ENABLE_DEBUG_PTR && ::rt::env::get().debug_mem {
debug_ptr_slow(tag, p);
}

fn debug_ptr_slow<T>(tag: &'static str, p: *T) {
fn debug_ptr_slow<T>(tag: &'static str, p: *const T) {
use io;
let dbg = STDERR_FILENO as io::fd_t;
let letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8',
Expand Down Expand Up @@ -209,14 +213,17 @@ fn add_borrow_to_task_list(a: *mut BoxRepr, file: *c_char, line: size_t) {
#[inline(always)]
pub unsafe fn borrow_as_imm(a: *u8, file: *c_char, line: size_t) -> uint {
let a: *mut BoxRepr = transmute(a);

let ref_count = (*a).header.ref_count;

debug_ptr("borrow_as_imm (ptr): ", a);
debug_ptr("borrow_as_imm (ref): ", ref_count as *());

if (ref_count & MUT_BIT) != 0 {
fail_borrowed(a, file, line);
} else {
(*a).header.ref_count |= FROZEN_BIT;
if ::rt::env::get().debug_borrows {
add_borrow_to_list(a, file, line);
add_borrow_to_task_list(a, file, line);
}
}
ref_count
Expand All @@ -228,13 +235,16 @@ pub unsafe fn borrow_as_imm(a: *u8, file: *c_char, line: size_t) -> uint {
pub unsafe fn borrow_as_mut(a: *u8, file: *c_char, line: size_t) -> uint {
let a: *mut BoxRepr = transmute(a);

debug_ptr("borrow_as_mut (ptr): ", a);
debug_ptr("borrow_as_mut (line): ", line as *());

let ref_count = (*a).header.ref_count;
if (ref_count & (MUT_BIT|FROZEN_BIT)) != 0 {
fail_borrowed(a, file, line);
} else {
(*a).header.ref_count |= (MUT_BIT|FROZEN_BIT);
if ::rt::env::get().debug_borrows {
add_borrow_to_list(a, file, line);
add_borrow_to_task_list(a, file, line);
}
}
ref_count
Expand All @@ -261,6 +271,9 @@ pub unsafe fn return_to_mut(a: *u8, old_ref_count: uint) {
if !a.is_null() {
let a: *mut BoxRepr = transmute(a);

debug_ptr("return_to_mut (ptr): ", a);
debug_ptr("return_to_mut (ref): ", old_ref_count as *());

let ref_count = (*a).header.ref_count & !ALL_BITS;
let old_bits = old_ref_count & ALL_BITS;
(*a).header.ref_count = ref_count | old_bits;
Expand Down