#pragma once #include #include #include #include "tools.h" #if DEBUG static const long unsigned int CANARY_VALUE = 0xCAFEBABACAFEBABA; #endif struct gcpointer_t; struct gc_object_header; struct gc_object_header { #if DEBUG void* canary_start; #endif size_t size; gcpointer_t* root_chain; gcpointer_t* type_chain; gc_object_header* forward; bool is_forwarded; #if DEBUG void* canary_end; #endif }; void ctor(gc_object_header* const this, size_t size); void copy_ctor(gc_object_header* const this, const gc_object_header* const other); static inline gc_object_header* placement_ctor(void* address, size_t size) { gc_object_header* const this = (gc_object_header* const) address; ctor(this, size); return this; } static inline gc_object_header* placement_copy_ctor(void* address, const gc_object_header* const other) { gc_object_header* const this = (gc_object_header* const) address; copy_ctor(this, other); return this; }