diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-12-16 13:41:42 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-12-16 13:41:42 +0000 |
| commit | 006d465c265246fa84e7926f2f0d3fe0ac19b2e2 (patch) | |
| tree | a4778584645d4886fa38c1c6f2c2f5eb65d832e4 /runtime/src | |
| parent | 20377ab1d402ccc75ecc6af0354a1d726be3d4cd (diff) | |
Make strings GC objects
Diffstat (limited to 'runtime/src')
| -rw-r--r-- | runtime/src/gc.h | 8 | ||||
| -rw-r--r-- | runtime/src/strings.c | 2 | ||||
| -rw-r--r-- | runtime/src/strings.h | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/runtime/src/gc.h b/runtime/src/gc.h new file mode 100644 index 00000000..d7f5f9af --- /dev/null +++ b/runtime/src/gc.h @@ -0,0 +1,8 @@ +#ifndef SHED_GC_H +#define SHED_GC_H + +struct ShedGcObjectHeader { + struct ShedGcObjectHeader* next; +}; + +#endif diff --git a/runtime/src/strings.c b/runtime/src/strings.c index c19bb3bd..9fd545f0 100644 --- a/runtime/src/strings.c +++ b/runtime/src/strings.c @@ -2,7 +2,7 @@ #include "./strings.h" ShedString shed__runtime__string_alloc(ShedStringLength length) { - return shed__runtime__alloc(sizeof(ShedStringLength) + length); + return shed__runtime__alloc(sizeof(struct ShedString) + length); } ShedString shed__runtime__string_add(ShedString left, ShedString right) { diff --git a/runtime/src/strings.h b/runtime/src/strings.h index 3e964c71..d299a098 100644 --- a/runtime/src/strings.h +++ b/runtime/src/strings.h @@ -4,10 +4,12 @@ #include <stdint.h> #include "./patio/patio.h" +#include "./gc.h" typedef PatioInt ShedStringLength; struct ShedString { + struct ShedGcObjectHeader gc_object_header; ShedStringLength length; uint8_t data[]; }; |
