unsafe fn mark_all_gray_reachable(&mut self) {
      // NOTE: Unlike `mark_dtable_reachable_rec` this function does not actually recur.
      // This is to prevent scripters from trivially causing a stack overflow.
      while let Some(value) = self.gray_stack.pop() {
         match value.kind() {
            ValueKind::Nil | ValueKind::Boolean | ValueKind::Number => (),
            ValueKind::String => {
               let raw = value.get_raw_string_unchecked();
               raw.mark_reachable();
            }
            ValueKind::Function => {
               let raw = value.get_raw_function_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let closure = raw.get();
                  for upvalue in &closure.captures {
                     self.gray_stack.push(upvalue.get());
                  }
               }
            }
            ValueKind::List => {
               let raw = value.get_raw_list_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let elements = raw.get().as_slice();
                  for &element in elements {
                     self.gray_stack.push(element);
                  }
               }
            }
            ValueKind::Struct => {
               let raw = value.get_raw_struct_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let struct_v = raw.get();
                  let dtable = *raw.get().dtable.get();
                  self.mark_dtable_reachable_rec(dtable);
                  for field in struct_v.fields() {
                     self.gray_stack.push(field);
                  }
               }
            }
            // TODO: Allow user data to specify its own references.
            ValueKind::UserData => {
               let raw = value.get_raw_user_data_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
               }
               let dtable = raw.get().dtable_gcraw();
               self.mark_dtable_reachable_rec(dtable);
            }
         }
      }
   }
/// Recursively marks all values on the gray stack reachable, beginning with the bottom-most
/// value.
Recursively marks all values on the gray stack reachable, beginning with the bottom-most
value.
Recursively marks all values on the gray stack reachable beginning with the bottom - most value .
unsafe fn mark_all_gray_reachable(&mut self) {
      // NOTE: Unlike `mark_dtable_reachable_rec` this function does not actually recur.
      // This is to prevent scripters from trivially causing a stack overflow.
      while let Some(value) = self.gray_stack.pop() {
         match value.kind() {
            ValueKind::Nil | ValueKind::Boolean | ValueKind::Number => (),
            ValueKind::String => {
               let raw = value.get_raw_string_unchecked();
               raw.mark_reachable();
            }
            ValueKind::Function => {
               let raw = value.get_raw_function_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let closure = raw.get();
                  for upvalue in &closure.captures {
                     self.gray_stack.push(upvalue.get());
                  }
               }
            }
            ValueKind::List => {
               let raw = value.get_raw_list_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let elements = raw.get().as_slice();
                  for &element in elements {
                     self.gray_stack.push(element);
                  }
               }
            }
            ValueKind::Struct => {
               let raw = value.get_raw_struct_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
                  let struct_v = raw.get();
                  let dtable = *raw.get().dtable.get();
                  self.mark_dtable_reachable_rec(dtable);
                  for field in struct_v.fields() {
                     self.gray_stack.push(field);
                  }
               }
            }
            // TODO: Allow user data to specify its own references.
            ValueKind::UserData => {
               let raw = value.get_raw_user_data_unchecked();
               if !raw.get_mem().reachable.get() {
                  raw.mark_reachable();
               }
               let dtable = raw.get().dtable_gcraw();
               self.mark_dtable_reachable_rec(dtable);
            }
         }
      }
   }
unsafe fn mark_all_gray_reachable ( & mut self ) { // NOTE: Unlike `mark_dtable_reachable_rec` this function does not actually recur. // This is to prevent scripters from trivially causing a stack overflow. while let Some ( value ) = self . gray_stack . pop ( ) { match value . kind ( ) { ValueKind :: Nil | ValueKind :: Boolean | ValueKind :: Number => ( ) , ValueKind :: String => { let raw = value . get_raw_string_unchecked ( ) ; raw . mark_reachable ( ) ; } ValueKind :: Function => { let raw = value . get_raw_function_unchecked ( ) ; if ! raw . get_mem ( ) . reachable . get ( ) { raw . mark_reachable ( ) ; let closure = raw . get ( ) ; for upvalue in & closure . captures { self . gray_stack . push ( upvalue . get ( ) ) ; } } } ValueKind :: List => { let raw = value . get_raw_list_unchecked ( ) ; if ! raw . get_mem ( ) . reachable . get ( ) { raw . mark_reachable ( ) ; let elements = raw . get ( ) . as_slice ( ) ; for & element in elements { self . gray_stack . push ( element ) ; } } } ValueKind :: Struct => { let raw = value . get_raw_struct_unchecked ( ) ; if ! raw . get_mem ( ) . reachable . get ( ) { raw . mark_reachable ( ) ; let struct_v = raw . get ( ) ; let dtable = * raw . get ( ) . dtable . get ( ) ; self . mark_dtable_reachable_rec ( dtable ) ; for field in struct_v . fields ( ) { self . gray_stack . push ( field ) ; } } } // TODO: Allow user data to specify its own references. ValueKind :: UserData => { let raw = value . get_raw_user_data_unchecked ( ) ; if ! raw . get_mem ( ) . reachable . get ( ) { raw . mark_reachable ( ) ; } let dtable = raw . get ( ) . dtable_gcraw ( ) ; self . mark_dtable_reachable_rec ( dtable ) ; } } } }
Recursively marks all values on the gray stack reachable, beginning with the bottom-most
value.
Recursively marks all values on the gray stack reachable beginning with the bottom - most value .
&mut self