1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-03 15:18:10 +00:00

More work on compiler. Still has memory leak?

This commit is contained in:
Calvin Rose
2017-05-05 16:52:05 -04:00
parent 6ca5a76286
commit f817610d4a
5 changed files with 234 additions and 62 deletions

View File

@@ -35,8 +35,8 @@ struct GstCompiler {
const char *error;
jmp_buf onError;
GstScope *tail;
GstArray *env;
GstBuffer *buffer;
void *trackers;
};
/* Initialize the Compiler */
@@ -54,4 +54,7 @@ void gst_compiler_usemodule(GstCompiler *c, const char *modulename);
/* Compile a function that evaluates the given form. */
GstFunction *gst_compiler_compile(GstCompiler *c, GstValue form);
/* Load the library */
void gst_compile_load(Gst *vm);
#endif /* end of include guard: COMPILE_H_9VXF71HY */

View File

@@ -41,6 +41,11 @@
#define gst_struct_capacity(t) (gst_struct_length(t) * 4)
#define gst_struct_hash(t) (gst_struct_raw(t)[1])
/* Userdata utils */
#define gst_udata_header(u) ((GstUserdataHeader *)(u) - 1)
#define gst_udata_type(u) (gst_udata_header(u)->type)
#define gst_udata_size(u) (gst_udata_header(u)->size)
/* Memcpy for moving memory */
#ifndef gst_memcpy
#include <string.h>
@@ -260,7 +265,7 @@ struct GstFunction {
/* Defines a type for userdata */
struct GstUserType {
const char *id;
const char *name;
GstValue (*serialize)(Gst *vm, void *data, uint32_t len);
GstValue (*deserialize)(Gst *vm, GstValue in);
void (*finalize)(Gst *vm, void *data, uint32_t len);