From f3d61ce0c9267e053b0c19ce6254b68d1dd85862 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Tue, 1 Dec 2020 15:04:30 +0000 Subject: [PATCH] defined MOO_GC_TYPE_DEFAULT --- moo/lib/moo.h | 7 ++++++- moo/lib/std.c | 2 +- moo/wasm/main.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/moo/lib/moo.h b/moo/lib/moo.h index 2f7f99f..086897b 100644 --- a/moo/lib/moo.h +++ b/moo/lib/moo.h @@ -219,7 +219,12 @@ struct moo_gchdr_t enum moo_gc_type_t { MOO_GC_TYPE_SEMISPACE, - MOO_GC_TYPE_MARK_SWEEP +#if defined(MOO_ENABLE_GC_MARK_SWEEP) + MOO_GC_TYPE_MARK_SWEEP, + MOO_GC_TYPE_DEFAULT = MOO_GC_TYPE_MARK_SWEEP +#else + MOO_GC_TYPE_DEFAULT = MOO_GC_TYPE_SEMISPACE +#endif }; typedef enum moo_gc_type_t moo_gc_type_t; diff --git a/moo/lib/std.c b/moo/lib/std.c index c757c31..1e637b4 100644 --- a/moo/lib/std.c +++ b/moo/lib/std.c @@ -4207,7 +4207,7 @@ moo_t* moo_openstd (moo_oow_t xtnsize, const moo_cfgstd_t* cfg, moo_errinf_t* er vmprim.vm_getsig = vm_getsig; vmprim.vm_setsig = vm_setsig; - moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, ((cfg && cfg->cmgr)? cfg->cmgr: moo_get_utf8_cmgr()), &vmprim, cfg->gc_type, errinfo); + moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, ((cfg && cfg->cmgr)? cfg->cmgr: moo_get_utf8_cmgr()), &vmprim, (cfg? cfg->gc_type: MOO_GC_TYPE_DEFAULT), errinfo); if (MOO_UNLIKELY(!moo)) return MOO_NULL; /* adjust the object size by the sizeof xtn_t so that moo_getxtn() returns the right pointer. */ diff --git a/moo/wasm/main.c b/moo/wasm/main.c index 4415b2d..7d05a6a 100644 --- a/moo/wasm/main.c +++ b/moo/wasm/main.c @@ -79,7 +79,7 @@ EMSCRIPTEN_KEEPALIVE int open_moo (void) vmprim.vm_muxwait = vm_muxwait; vmprim.vm_sleep = vm_sleep; - moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, ((cfg && cfg->cmgr)? cfg->cmgr: moo_get_utf8_cmgr()), &vmprim, errinfo); + moo = moo_open(&sys_mmgr, MOO_SIZEOF(xtn_t) + xtnsize, ((cfg && cfg->cmgr)? cfg->cmgr: moo_get_utf8_cmgr()), &vmprim, (cfg? cfg->gc_type: MOO_GC_TYPE_DEFAULT), errinfo); if (!moo) return MOO_NULL; /* adjust the object size by the sizeof xtn_t so that qse_getxtn() returns the right pointer. */