Skip to content

Commit

Permalink
actually remove commented-out code
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-emrich committed Nov 7, 2023
1 parent 02be161 commit b6db26d
Showing 1 changed file with 0 additions and 56 deletions.
56 changes: 0 additions & 56 deletions crates/runtime/src/continuation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,62 +88,6 @@ pub fn drop_cont_obj(contobj: *mut ContinuationObject) {
unsafe { Vec::from_raw_parts(payloads.data, payloads.length, payloads.capacity) };
}

// /// TODO
// pub fn allocate_payload_buffer(instance: &mut Instance, element_count: usize) -> *mut u128 {
// // In the current design, we allocate a `Vec<u128>` and store a pointer to
// // it in the `VMContext` payloads pointer slot. We then return the pointer
// // to the `Vec`'s data, not to the `Vec` itself.
// // This is mostly for debugging purposes, since the `Vec` stores its size.
// // Alternatively, we may allocate the buffer ourselves here and store the
// // pointer directly in the `VMContext`. This would avoid one level of
// // pointer indirection.

// let payload_ptr =
// unsafe { instance.get_typed_continuations_payloads_ptr_mut() as *mut *mut Vec<u128> };

// // FIXME(frank-emrich) This doesn't work, yet, because we don't zero-initialize the
// // payload pointer field in the VMContext, meaning that it may initially contain garbage.
// // Ensure that there isn't an active payload buffer. If there was, we didn't clean up propertly
// // assert!(unsafe { (*payload_ptr).is_null() });

// let mut vec = Box::new(Vec::<u128>::with_capacity(element_count));

// let vec_data = (*vec).as_mut_ptr();
// unsafe {
// *payload_ptr = Box::into_raw(vec);
// }
// return vec_data;
// }

// /// TODO
// pub fn deallocate_payload_buffer(instance: &mut Instance, element_count: usize) {
// let payload_ptr =
// unsafe { instance.get_typed_continuations_payloads_ptr_mut() as *mut *mut Vec<u128> };

// let vec = unsafe { Box::from_raw(*payload_ptr) };

// // If these don't match something went wrong.
// assert_eq!(vec.capacity(), element_count);

// unsafe { *payload_ptr = ptr::null_mut() };

// // payload buffer destroyed when `vec` goes out of scope
// }

// /// TODO
// pub fn get_payload_buffer(instance: &mut Instance, element_count: usize) -> *mut u128 {
// let payload_ptr =
// unsafe { instance.get_typed_continuations_payloads_ptr_mut() as *mut *mut Vec<u128> };

// let vec = unsafe { (*payload_ptr).as_mut().unwrap() };

// // If these don't match something went wrong.
// assert_eq!(vec.capacity(), element_count);

// let vec_data = vec.as_mut_ptr();
// return vec_data;
// }

/// TODO
#[inline(always)]
pub fn cont_new(
Expand Down

0 comments on commit b6db26d

Please sign in to comment.