Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

expose GC to slash-land

  • Loading branch information...
commit 8bf3263265adf55f0f32a97f356fff30b57cc35a 1 parent 2d0f307
Charlie Somerville charliesome authored
Showing with 19 additions and 1 deletion.
  1. +2 −1  Makefile
  2. +15 −0 src/lib/gc.c
  3. +2 −0  src/vm.c
3  Makefile
View
@@ -12,7 +12,8 @@ OBJS+=src/class.o src/error.o src/method.o src/object.o src/st.o src/string.o \
src/lib/lambda.o src/lib/enumerable.o src/lib/file.o src/init_exts.o \
src/lib/rand.o src/lib/dict.o src/lib/request.o src/lib/response.o \
src/lib/error_page.o src/lib/system.o src/lib/regexp.o src/gc.o \
- src/lib/range.o src/vm_exec.o src/compile.o src/lib/time.o src/unicode.o
+ src/lib/range.o src/vm_exec.o src/compile.o src/lib/time.o src/unicode.o \
+ src/lib/gc.o
SAPIS=$(shell ls -F sapi | grep "/" | sed -e 's/\///')
15 src/lib/gc.c
View
@@ -0,0 +1,15 @@
+#include <slash.h>
+
+static SLVAL
+GC_run(sl_vm_t* vm)
+{
+ sl_gc_run(vm->arena);
+ return vm->lib.nil;
+}
+
+void
+sl_init_gc(sl_vm_t* vm)
+{
+ SLVAL GC = sl_define_class(vm, "GC", vm->lib.Object);
+ sl_define_singleton_method(vm, GC, "run", 0, GC_run);
+}
2  src/vm.c
View
@@ -54,6 +54,7 @@ LIB(system);
LIB(regexp);
LIB(range);
LIB(time);
+LIB(gc);
void sl_init_exts(sl_vm_t* vm);
@@ -81,6 +82,7 @@ sl_init_libs(sl_vm_t* vm)
LIB_INIT(regexp);
LIB_INIT(range);
LIB_INIT(time);
+ LIB_INIT(gc);
sl_init_exts(vm);
}
Please sign in to comment.
Something went wrong with that request. Please try again.