vile / scheme / native_abi.h
27 lines · 27 sloc · 1.0 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1#ifndef VILE_NATIVE_ABI_H
2#define VILE_NATIVE_ABI_H
3#include <stdint.h>
4typedef struct VileNativeValue {int64_t x;int64_t k;} VileNativeValue;
5/* The importer and generated code access the same private pool objects. */
6typedef struct VileNativePair {
7 int64_t car;
8 struct VileNativePair *cdr;
9} VileNativePair;
10_Static_assert(sizeof(VileNativePair)==16,"native private pair layout");
11/* Original handles stay in the invocation's C stack frame, visible to a
12 * conservative collector even while generated code has overwritten a cell. */
13typedef struct VileNativeVectorWrite {
14 void *vector;
15 int64_t index;
16 uint64_t original[2];
17} VileNativeVectorWrite;
18typedef struct VileNativeVectorJournal {
19 VileNativeVectorWrite *entries;
20 int64_t count,capacity;
21} VileNativeVectorJournal;
22typedef struct VileNativeHostApi {
23 void *context;
24 void (*vector)(void*,VileNativeVectorJournal*,int64_t,VileNativeValue*,int64_t,VileNativeValue*);
25 void (*finish)(void*,VileNativeVectorJournal*,VileNativeValue*);
26} VileNativeHostApi;
27#endif
28