@@ -231,66 +231,64 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
231231 // the stack.
232232 let mut reached_sentinel = ptr:: is_null ( sentinel) ;
233233 for stackwalk:: walk_stack |frame| {
234- unsafe {
235- let pc = last_ret;
236- let Segment { segment : next_segment, boundary : boundary} =
237- find_segment_for_frame ( frame. fp , segment) ;
238- segment = next_segment;
239- // Each stack segment is bounded by a morestack frame. The
240- // morestack frame includes two return addresses, one for
241- // morestack itself, at the normal offset from the frame
242- // pointer, and then a second return address for the
243- // function prologue (which called morestack after
244- // determining that it had hit the end of the stack).
245- // Since morestack itself takes two parameters, the offset
246- // for this second return address is 3 greater than the
247- // return address for morestack.
248- let ret_offset = if boundary { 4 } else { 1 } ;
249- last_ret = * ptr:: offset ( frame. fp , ret_offset) as * Word ;
250-
251- if ptr:: is_null ( pc) {
252- loop ;
253- }
234+ let pc = last_ret;
235+ let Segment { segment : next_segment, boundary : boundary} =
236+ find_segment_for_frame ( frame. fp , segment) ;
237+ segment = next_segment;
238+ // Each stack segment is bounded by a morestack frame. The
239+ // morestack frame includes two return addresses, one for
240+ // morestack itself, at the normal offset from the frame
241+ // pointer, and then a second return address for the
242+ // function prologue (which called morestack after
243+ // determining that it had hit the end of the stack).
244+ // Since morestack itself takes two parameters, the offset
245+ // for this second return address is 3 greater than the
246+ // return address for morestack.
247+ let ret_offset = if boundary { 4 } else { 1 } ;
248+ last_ret = * ptr:: offset ( frame. fp , ret_offset) as * Word ;
249+
250+ if ptr:: is_null ( pc) {
251+ loop ;
252+ }
254253
255- let mut delay_reached_sentinel = reached_sentinel;
256- let sp = is_safe_point ( pc) ;
257- match sp {
258- Some ( sp_info) => {
259- for walk_safe_point( frame. fp, sp_info) |root, tydesc| {
260- // Skip roots until we see the sentinel.
261- if !reached_sentinel {
262- if root == sentinel {
263- delay_reached_sentinel = true ;
264- }
265- loop ;
254+ let mut delay_reached_sentinel = reached_sentinel;
255+ let sp = is_safe_point ( pc) ;
256+ match sp {
257+ Some ( sp_info) => {
258+ for walk_safe_point( frame. fp, sp_info) |root, tydesc| {
259+ // Skip roots until we see the sentinel.
260+ if !reached_sentinel {
261+ if root == sentinel {
262+ delay_reached_sentinel = true ;
266263 }
264+ loop ;
265+ }
267266
268- // Skip null pointers, which can occur when a
269- // unique pointer has already been freed.
270- if ptr:: is_null ( * root) {
271- loop ;
272- }
267+ // Skip null pointers, which can occur when a
268+ // unique pointer has already been freed.
269+ if ptr:: is_null ( * root) {
270+ loop ;
271+ }
273272
274- if ptr:: is_null ( tydesc) {
275- // Root is a generic box.
276- let refcount = * * root;
277- if mem | task_local_heap != 0 && refcount != -1 {
278- if !visitor ( root, tydesc) { return ; }
279- } else if mem | exchange_heap != 0 && refcount == -1 {
280- if !visitor ( root, tydesc) { return ; }
281- }
282- } else {
283- // Root is a non-immediate.
284- if mem | stack != 0 {
285- if !visitor ( root, tydesc) { return ; }
286- }
273+ if ptr:: is_null ( tydesc) {
274+ // Root is a generic box.
275+ let refcount = * * root;
276+ if mem | task_local_heap != 0 && refcount != -1 {
277+ if !visitor ( root, tydesc) { return ; }
278+ } else if mem | exchange_heap != 0 && refcount == -1 {
279+ if !visitor ( root, tydesc) { return ; }
280+ }
281+ } else {
282+ // Root is a non-immediate.
283+ if mem | stack != 0 {
284+ if !visitor ( root, tydesc) { return ; }
287285 }
288286 }
289- }
290- None => ( )
291287 }
292- reached_sentinel = delay_reached_sentinel;
288+ }
289+ None => ( )
293290 }
291+ reached_sentinel = delay_reached_sentinel;
294292 }
295293}
296294
0 commit comments