This commit is contained in:
2026-05-14 12:22:03 -06:00
parent ff6bddffb3
commit dc785ed8f3
9 changed files with 195 additions and 30 deletions

View File

@@ -1,6 +1,6 @@
{ stdenv
, callPackage
, bdwgc ? callPackage ./bdwgc.nix {}
, bdwgc ? callPackage ../bdwgc.nix {}
}:
stdenv.mkDerivation {

View File

@@ -1,5 +1,11 @@
#include <stdio.h>
#include "gyehoek.h"
int blah () {
puts ("aaa");
SCM scm_write (SCM x) {
if (SCM_IMP (x)) {
printf ("#<immediate %ld>\n", SCM_UNPACK (x));
} else {
printf ("#<heap object %ld>\n", SCM_UNPACK(x));
}
return SCM_PACK(NULL);
}

23
runtime/gyehoek.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef GYEHOEK_H
#define GYEHOEK_H
#include <stdint.h>
typedef uintptr_t scm_t_bits;
typedef union SCM { struct { scm_t_bits n; } n; } SCM;
#define SCM_UNPACK(x) ((x).n.n)
#define SCM_PACK(x) ((SCM) { { (scm_t_bits) (x) } })
#define SCM_IMP(x) (6 & SCM_UNPACK (x))
#define SCM_NIMP(x) (!SCM_IMP (x))
#define SCM_HEAP_OBJECT_P(x) (SCM_NIMP (x))
SCM scm_write (SCM);
#endif /* GYEHOEK_H */