tidepool_codegen/
context.rs1use std::mem;
2
3#[repr(C, align(16))]
8pub struct VMContext {
9 pub alloc_ptr: *mut u8,
11 pub alloc_limit: *const u8,
13 pub gc_trigger: extern "C" fn(*mut VMContext),
15}
16
17impl VMContext {
18 pub fn new(
20 nursery_start: *mut u8,
21 nursery_end: *const u8,
22 gc_trigger: extern "C" fn(*mut VMContext),
23 ) -> Self {
24 Self {
25 alloc_ptr: nursery_start,
26 alloc_limit: nursery_end,
27 gc_trigger,
28 }
29 }
30}
31
32const _: () = {
34 assert!(mem::offset_of!(VMContext, alloc_ptr) == 0);
35 assert!(mem::offset_of!(VMContext, alloc_limit) == 8);
36 assert!(mem::offset_of!(VMContext, gc_trigger) == 16);
37 assert!(mem::align_of::<VMContext>() == 16);
38};