+ if self.target == Target.WINDOWS:
+ self.c_file_pfx = self.c_file_pfx + """#include <heapapi.h>
+static HANDLE process_heap = NULL;
+static inline void* init_heap() {
+ if (UNLIKELY(process_heap == NULL)) {
+ // Assume pointer writes wont tear, which is true where we need it.
+ process_heap = GetProcessHeap();
+ }
+}
+static inline void* MALLOC(size_t a, const char* _) {
+ init_heap();
+ return HeapAlloc(process_heap, HEAP_ZERO_MEMORY, a);
+}
+#define do_MALLOC(a, b, _c) MALLOC(a, b)
+#define FREE(p) if ((uint64_t)(p) > 4096) { init_heap(); HeapFree(process_heap, 0, p); }
+#define CHECK_ACCESS(p)
+#define CHECK_INNER_FIELD_ACCESS_OR_NULL(v)
+"""
+ elif not DEBUG or self.target != Target.LINUX: