adding a new memory manager
This commit is contained in:
parent
04e61303bb
commit
675886c703
@ -61,6 +61,7 @@ libmoo_la_SOURCES = \
|
|||||||
moo-rbt.h \
|
moo-rbt.h \
|
||||||
moo-utl.h \
|
moo-utl.h \
|
||||||
moo-prv.h \
|
moo-prv.h \
|
||||||
|
moo-xma.h \
|
||||||
pack1.h \
|
pack1.h \
|
||||||
unpack.h \
|
unpack.h \
|
||||||
bigint.c \
|
bigint.c \
|
||||||
@ -88,7 +89,8 @@ libmoo_la_SOURCES = \
|
|||||||
uch-prop.h \
|
uch-prop.h \
|
||||||
utf8.c \
|
utf8.c \
|
||||||
utf16.c \
|
utf16.c \
|
||||||
utl.c
|
utl.c \
|
||||||
|
xma.c
|
||||||
libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
|
libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
|
||||||
libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
|
libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
|
||||||
libmoo_la_LIBADD = $(LIBADD_LIB_COMMON)
|
libmoo_la_LIBADD = $(LIBADD_LIB_COMMON)
|
||||||
|
@ -159,7 +159,8 @@ am_libmoo_la_OBJECTS = libmoo_la-bigint.lo libmoo_la-chr.lo \
|
|||||||
libmoo_la-mb8.lo libmoo_la-moo.lo libmoo_la-number.lo \
|
libmoo_la-mb8.lo libmoo_la-moo.lo libmoo_la-number.lo \
|
||||||
libmoo_la-obj.lo libmoo_la-pf-basic.lo libmoo_la-pf-sys.lo \
|
libmoo_la-obj.lo libmoo_la-pf-basic.lo libmoo_la-pf-sys.lo \
|
||||||
libmoo_la-pf-utf8.lo libmoo_la-rbt.lo libmoo_la-sym.lo \
|
libmoo_la-pf-utf8.lo libmoo_la-rbt.lo libmoo_la-sym.lo \
|
||||||
libmoo_la-utf8.lo libmoo_la-utf16.lo libmoo_la-utl.lo
|
libmoo_la-utf8.lo libmoo_la-utf16.lo libmoo_la-utl.lo \
|
||||||
|
libmoo_la-xma.lo
|
||||||
libmoo_la_OBJECTS = $(am_libmoo_la_OBJECTS)
|
libmoo_la_OBJECTS = $(am_libmoo_la_OBJECTS)
|
||||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||||
@ -210,7 +211,8 @@ am__depfiles_remade = ./$(DEPDIR)/libmoo_la-bigint.Plo \
|
|||||||
./$(DEPDIR)/libmoo_la-pf-utf8.Plo \
|
./$(DEPDIR)/libmoo_la-pf-utf8.Plo \
|
||||||
./$(DEPDIR)/libmoo_la-rbt.Plo ./$(DEPDIR)/libmoo_la-sym.Plo \
|
./$(DEPDIR)/libmoo_la-rbt.Plo ./$(DEPDIR)/libmoo_la-sym.Plo \
|
||||||
./$(DEPDIR)/libmoo_la-utf16.Plo ./$(DEPDIR)/libmoo_la-utf8.Plo \
|
./$(DEPDIR)/libmoo_la-utf16.Plo ./$(DEPDIR)/libmoo_la-utf8.Plo \
|
||||||
./$(DEPDIR)/libmoo_la-utl.Plo ./$(DEPDIR)/libmoox_la-opt.Plo \
|
./$(DEPDIR)/libmoo_la-utl.Plo ./$(DEPDIR)/libmoo_la-xma.Plo \
|
||||||
|
./$(DEPDIR)/libmoox_la-opt.Plo \
|
||||||
./$(DEPDIR)/libmoox_la-poll-msw.Plo \
|
./$(DEPDIR)/libmoox_la-poll-msw.Plo \
|
||||||
./$(DEPDIR)/libmoox_la-std.Plo
|
./$(DEPDIR)/libmoox_la-std.Plo
|
||||||
am__mv = mv -f
|
am__mv = mv -f
|
||||||
@ -325,6 +327,18 @@ MANIFEST_TOOL = @MANIFEST_TOOL@
|
|||||||
MKDIR_P = @MKDIR_P@
|
MKDIR_P = @MKDIR_P@
|
||||||
MOO_PROJECT_AUTHOR = @MOO_PROJECT_AUTHOR@
|
MOO_PROJECT_AUTHOR = @MOO_PROJECT_AUTHOR@
|
||||||
MOO_PROJECT_URL = @MOO_PROJECT_URL@
|
MOO_PROJECT_URL = @MOO_PROJECT_URL@
|
||||||
|
MOO_SIZEOF_CHAR = @MOO_SIZEOF_CHAR@
|
||||||
|
MOO_SIZEOF_DOUBLE = @MOO_SIZEOF_DOUBLE@
|
||||||
|
MOO_SIZEOF_FLOAT = @MOO_SIZEOF_FLOAT@
|
||||||
|
MOO_SIZEOF_INT = @MOO_SIZEOF_INT@
|
||||||
|
MOO_SIZEOF_LONG = @MOO_SIZEOF_LONG@
|
||||||
|
MOO_SIZEOF_LONG_DOUBLE = @MOO_SIZEOF_LONG_DOUBLE@
|
||||||
|
MOO_SIZEOF_LONG_LONG = @MOO_SIZEOF_LONG_LONG@
|
||||||
|
MOO_SIZEOF_OFF64_T = @MOO_SIZEOF_OFF64_T@
|
||||||
|
MOO_SIZEOF_OFF_T = @MOO_SIZEOF_OFF_T@
|
||||||
|
MOO_SIZEOF_SHORT = @MOO_SIZEOF_SHORT@
|
||||||
|
MOO_SIZEOF_VOID_P = @MOO_SIZEOF_VOID_P@
|
||||||
|
MOO_SIZEOF_WCHAR_T = @MOO_SIZEOF_WCHAR_T@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
NMEDIT = @NMEDIT@
|
NMEDIT = @NMEDIT@
|
||||||
OBJDUMP = @OBJDUMP@
|
OBJDUMP = @OBJDUMP@
|
||||||
@ -401,6 +415,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
@ -453,6 +468,7 @@ libmoo_la_SOURCES = \
|
|||||||
moo-rbt.h \
|
moo-rbt.h \
|
||||||
moo-utl.h \
|
moo-utl.h \
|
||||||
moo-prv.h \
|
moo-prv.h \
|
||||||
|
moo-xma.h \
|
||||||
pack1.h \
|
pack1.h \
|
||||||
unpack.h \
|
unpack.h \
|
||||||
bigint.c \
|
bigint.c \
|
||||||
@ -480,7 +496,8 @@ libmoo_la_SOURCES = \
|
|||||||
uch-prop.h \
|
uch-prop.h \
|
||||||
utf8.c \
|
utf8.c \
|
||||||
utf16.c \
|
utf16.c \
|
||||||
utl.c
|
utl.c \
|
||||||
|
xma.c
|
||||||
|
|
||||||
libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
|
libmoo_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
|
||||||
libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
|
libmoo_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
|
||||||
@ -622,6 +639,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utf16.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utf16.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utf8.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utf8.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utl.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-utl.Plo@am__quote@ # am--include-marker
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoo_la-xma.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-opt.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-opt.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-poll-msw.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-poll-msw.Plo@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-std.Plo@am__quote@ # am--include-marker
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmoox_la-std.Plo@am__quote@ # am--include-marker
|
||||||
@ -817,6 +835,13 @@ libmoo_la-utl.lo: utl.c
|
|||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_la-utl.lo `test -f 'utl.c' || echo '$(srcdir)/'`utl.c
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_la-utl.lo `test -f 'utl.c' || echo '$(srcdir)/'`utl.c
|
||||||
|
|
||||||
|
libmoo_la-xma.lo: xma.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmoo_la-xma.lo -MD -MP -MF $(DEPDIR)/libmoo_la-xma.Tpo -c -o libmoo_la-xma.lo `test -f 'xma.c' || echo '$(srcdir)/'`xma.c
|
||||||
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmoo_la-xma.Tpo $(DEPDIR)/libmoo_la-xma.Plo
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xma.c' object='libmoo_la-xma.lo' libtool=yes @AMDEPBACKSLASH@
|
||||||
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libmoo_la-xma.lo `test -f 'xma.c' || echo '$(srcdir)/'`xma.c
|
||||||
|
|
||||||
libmoox_la-opt.lo: opt.c
|
libmoox_la-opt.lo: opt.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoox_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmoox_la-opt.lo -MD -MP -MF $(DEPDIR)/libmoox_la-opt.Tpo -c -o libmoox_la-opt.lo `test -f 'opt.c' || echo '$(srcdir)/'`opt.c
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmoox_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libmoox_la-opt.lo -MD -MP -MF $(DEPDIR)/libmoox_la-opt.Tpo -c -o libmoox_la-opt.lo `test -f 'opt.c' || echo '$(srcdir)/'`opt.c
|
||||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmoox_la-opt.Tpo $(DEPDIR)/libmoox_la-opt.Plo
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmoox_la-opt.Tpo $(DEPDIR)/libmoox_la-opt.Plo
|
||||||
@ -1016,6 +1041,7 @@ distclean: distclean-am
|
|||||||
-rm -f ./$(DEPDIR)/libmoo_la-utf16.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utf16.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoo_la-utf8.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utf8.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoo_la-utl.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utl.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/libmoo_la-xma.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-opt.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-opt.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-poll-msw.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-poll-msw.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-std.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-std.Plo
|
||||||
@ -1088,6 +1114,7 @@ maintainer-clean: maintainer-clean-am
|
|||||||
-rm -f ./$(DEPDIR)/libmoo_la-utf16.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utf16.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoo_la-utf8.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utf8.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoo_la-utl.Plo
|
-rm -f ./$(DEPDIR)/libmoo_la-utl.Plo
|
||||||
|
-rm -f ./$(DEPDIR)/libmoo_la-xma.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-opt.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-opt.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-poll-msw.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-poll-msw.Plo
|
||||||
-rm -f ./$(DEPDIR)/libmoox_la-std.Plo
|
-rm -f ./$(DEPDIR)/libmoox_la-std.Plo
|
||||||
|
@ -134,9 +134,11 @@ int moo_init (moo_t* moo, moo_mmgr_t* mmgr, moo_cmgr_t* cmgr, const moo_vmprim_t
|
|||||||
moo->log.ptr = moo_allocmem(moo, (moo->log.capa + 1) * MOO_SIZEOF(*moo->log.ptr));
|
moo->log.ptr = moo_allocmem(moo, (moo->log.capa + 1) * MOO_SIZEOF(*moo->log.ptr));
|
||||||
if (MOO_UNLIKELY(!moo->log.ptr)) goto oops;
|
if (MOO_UNLIKELY(!moo->log.ptr)) goto oops;
|
||||||
|
|
||||||
|
#if defined(MOO_ENABLE_GC_MARK_SWEEP)
|
||||||
moo->gci.stack.capa = MOO_ALIGN_POW2(1, 1024); /* TODO: is this a good initial size? */
|
moo->gci.stack.capa = MOO_ALIGN_POW2(1, 1024); /* TODO: is this a good initial size? */
|
||||||
moo->gci.stack.ptr = moo_allocmem(moo, (moo->gci.stack.capa + 1) * MOO_SIZEOF(*moo->gci.stack.ptr));
|
moo->gci.stack.ptr = moo_allocmem(moo, (moo->gci.stack.capa + 1) * MOO_SIZEOF(*moo->gci.stack.ptr));
|
||||||
if (MOO_UNLIKELY(!moo->gci.stack.ptr)) goto oops;
|
if (MOO_UNLIKELY(!moo->gci.stack.ptr)) goto oops;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (moo_rbt_init(&moo->modtab, moo, MOO_SIZEOF(moo_ooch_t), 1) <= -1) goto oops;
|
if (moo_rbt_init(&moo->modtab, moo, MOO_SIZEOF(moo_ooch_t), 1) <= -1) goto oops;
|
||||||
modtab_inited = 1;
|
modtab_inited = 1;
|
||||||
@ -157,11 +159,13 @@ int moo_init (moo_t* moo, moo_mmgr_t* mmgr, moo_cmgr_t* cmgr, const moo_vmprim_t
|
|||||||
|
|
||||||
oops:
|
oops:
|
||||||
if (modtab_inited) moo_rbt_fini (&moo->modtab);
|
if (modtab_inited) moo_rbt_fini (&moo->modtab);
|
||||||
|
#if defined(MOO_ENABLE_GC_MARK_SWEEP)
|
||||||
if (moo->gci.stack.ptr)
|
if (moo->gci.stack.ptr)
|
||||||
{
|
{
|
||||||
moo_freemem (moo, moo->gci.stack.ptr);
|
moo_freemem (moo, moo->gci.stack.ptr);
|
||||||
moo->gci.stack.capa = 0;
|
moo->gci.stack.capa = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (moo->log.ptr)
|
if (moo->log.ptr)
|
||||||
{
|
{
|
||||||
moo_freemem (moo, moo->log.ptr);
|
moo_freemem (moo, moo->log.ptr);
|
||||||
|
@ -4210,7 +4210,7 @@ moo_t* moo_openstd (moo_oow_t xtnsize, const moo_cfgstd_t* cfg, moo_errinf_t* er
|
|||||||
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, errinfo);
|
||||||
if (!moo) return MOO_NULL;
|
if (!moo) return MOO_NULL;
|
||||||
|
|
||||||
/* adjust the object size by the sizeof xtn_t so that qse_getxtn() returns the right pointer. */
|
/* adjust the object size by the sizeof xtn_t so that moo_getxtn() returns the right pointer. */
|
||||||
moo->_instsize += MOO_SIZEOF(xtn_t);
|
moo->_instsize += MOO_SIZEOF(xtn_t);
|
||||||
|
|
||||||
xtn = GET_XTN(moo);
|
xtn = GET_XTN(moo);
|
||||||
|
Loading…
Reference in New Issue
Block a user