added STIX_STACK_SETRETTORCV()

This commit is contained in:
hyunghwan.chung 2016-08-13 06:46:14 +00:00
parent 41d1bb56a0
commit 00b11b74cd
4 changed files with 56 additions and 36 deletions

View File

@ -85,17 +85,17 @@ LIBADD_MOD_COMMON = -lstix
pkgmodexecdir = $(libdir) pkgmodexecdir = $(libdir)
pkgmodexec_LTLIBRARIES = libstix-snd.la #libstix-con.la pkgmodexec_LTLIBRARIES = libstix-snd.la libstix-con.la
libstix_snd_la_SOURCES = mod-snd.c mod-snd.h libstix_snd_la_SOURCES = mod-snd.c mod-snd.h
libstix_snd_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON) libstix_snd_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON)
libstix_snd_la_LDFLAGS = $(LDFLAGS_MOD_COMMON) libstix_snd_la_LDFLAGS = $(LDFLAGS_MOD_COMMON)
libstix_snd_la_LIBADD = $(LIBADD_MOD_COMMON) libstix_snd_la_LIBADD = $(LIBADD_MOD_COMMON)
#libstix_con_la_SOURCES = mod-con.c mod-con.h libstix_con_la_SOURCES = mod-con.c mod-con.h
#libstix_con_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON) libstix_con_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON)
#libstix_con_la_LDFLAGS = $(LDFLAGS_MOD_COMMON) libstix_con_la_LDFLAGS = $(LDFLAGS_MOD_COMMON)
#libstix_con_la_LIBADD = $(LIBADD_MOD_COMMON) libstix_con_la_LIBADD = $(LIBADD_MOD_COMMON)
endif endif

View File

@ -133,16 +133,28 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" \
"$(DESTDIR)$(pkgincludedir)" "$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(pkglib_LTLIBRARIES) $(pkgmodexec_LTLIBRARIES) LTLIBRARIES = $(pkglib_LTLIBRARIES) $(pkgmodexec_LTLIBRARIES)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
@ENABLE_STATIC_MODULE_FALSE@libstix_con_la_DEPENDENCIES = \
@ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1)
am__libstix_con_la_SOURCES_DIST = mod-con.c mod-con.h
@ENABLE_STATIC_MODULE_FALSE@am_libstix_con_la_OBJECTS = \
@ENABLE_STATIC_MODULE_FALSE@ libstix_con_la-mod-con.lo
libstix_con_la_OBJECTS = $(am_libstix_con_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libstix_con_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libstix_con_la_LDFLAGS) $(LDFLAGS) -o \
$@
@ENABLE_STATIC_MODULE_FALSE@am_libstix_con_la_rpath = -rpath \
@ENABLE_STATIC_MODULE_FALSE@ $(pkgmodexecdir)
@ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_DEPENDENCIES = \ @ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_DEPENDENCIES = \
@ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1) @ENABLE_STATIC_MODULE_FALSE@ $(am__DEPENDENCIES_1)
am__libstix_snd_la_SOURCES_DIST = mod-snd.c mod-snd.h am__libstix_snd_la_SOURCES_DIST = mod-snd.c mod-snd.h
@ENABLE_STATIC_MODULE_FALSE@am_libstix_snd_la_OBJECTS = \ @ENABLE_STATIC_MODULE_FALSE@am_libstix_snd_la_OBJECTS = \
@ENABLE_STATIC_MODULE_FALSE@ libstix_snd_la-mod-snd.lo @ENABLE_STATIC_MODULE_FALSE@ libstix_snd_la-mod-snd.lo
libstix_snd_la_OBJECTS = $(am_libstix_snd_la_OBJECTS) libstix_snd_la_OBJECTS = $(am_libstix_snd_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libstix_snd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ libstix_snd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libstix_snd_la_LDFLAGS) $(LDFLAGS) -o \ $(AM_CFLAGS) $(CFLAGS) $(libstix_snd_la_LDFLAGS) $(LDFLAGS) -o \
@ -202,10 +214,11 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 = am__v_CCLD_1 =
SOURCES = $(libstix_snd_la_SOURCES) $(libstix_la_SOURCES) \ SOURCES = $(libstix_con_la_SOURCES) $(libstix_snd_la_SOURCES) \
$(stix_SOURCES)
DIST_SOURCES = $(am__libstix_snd_la_SOURCES_DIST) \
$(libstix_la_SOURCES) $(stix_SOURCES) $(libstix_la_SOURCES) $(stix_SOURCES)
DIST_SOURCES = $(am__libstix_con_la_SOURCES_DIST) \
$(am__libstix_snd_la_SOURCES_DIST) $(libstix_la_SOURCES) \
$(stix_SOURCES)
am__can_run_installinfo = \ am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \ case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \ n|no|NO) false;; \
@ -460,11 +473,15 @@ stix_LDADD = $(LIBADD_LIB_COMMON) -lstix #-ldyncall_s
@ENABLE_STATIC_MODULE_FALSE@LDFLAGS_MOD_COMMON = $(LDFLAGS_LIB_COMMON) @ENABLE_STATIC_MODULE_FALSE@LDFLAGS_MOD_COMMON = $(LDFLAGS_LIB_COMMON)
@ENABLE_STATIC_MODULE_FALSE@LIBADD_MOD_COMMON = -lstix @ENABLE_STATIC_MODULE_FALSE@LIBADD_MOD_COMMON = -lstix
@ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir) @ENABLE_STATIC_MODULE_FALSE@pkgmodexecdir = $(libdir)
@ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = libstix-snd.la #libstix-con.la @ENABLE_STATIC_MODULE_FALSE@pkgmodexec_LTLIBRARIES = libstix-snd.la libstix-con.la
@ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_SOURCES = mod-snd.c mod-snd.h @ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_SOURCES = mod-snd.c mod-snd.h
@ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON) @ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON)
@ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_LDFLAGS = $(LDFLAGS_MOD_COMMON) @ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_LDFLAGS = $(LDFLAGS_MOD_COMMON)
@ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_LIBADD = $(LIBADD_MOD_COMMON) @ENABLE_STATIC_MODULE_FALSE@libstix_snd_la_LIBADD = $(LIBADD_MOD_COMMON)
@ENABLE_STATIC_MODULE_FALSE@libstix_con_la_SOURCES = mod-con.c mod-con.h
@ENABLE_STATIC_MODULE_FALSE@libstix_con_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON)
@ENABLE_STATIC_MODULE_FALSE@libstix_con_la_LDFLAGS = $(LDFLAGS_MOD_COMMON)
@ENABLE_STATIC_MODULE_FALSE@libstix_con_la_LIBADD = $(LIBADD_MOD_COMMON)
all: stix-cfg.h all: stix-cfg.h
$(MAKE) $(AM_MAKEFLAGS) all-am $(MAKE) $(AM_MAKEFLAGS) all-am
@ -586,6 +603,9 @@ clean-pkgmodexecLTLIBRARIES:
rm -f $${locs}; \ rm -f $${locs}; \
} }
libstix-con.la: $(libstix_con_la_OBJECTS) $(libstix_con_la_DEPENDENCIES) $(EXTRA_libstix_con_la_DEPENDENCIES)
$(AM_V_CCLD)$(libstix_con_la_LINK) $(am_libstix_con_la_rpath) $(libstix_con_la_OBJECTS) $(libstix_con_la_LIBADD) $(LIBS)
libstix-snd.la: $(libstix_snd_la_OBJECTS) $(libstix_snd_la_DEPENDENCIES) $(EXTRA_libstix_snd_la_DEPENDENCIES) libstix-snd.la: $(libstix_snd_la_OBJECTS) $(libstix_snd_la_DEPENDENCIES) $(EXTRA_libstix_snd_la_DEPENDENCIES)
$(AM_V_CCLD)$(libstix_snd_la_LINK) $(am_libstix_snd_la_rpath) $(libstix_snd_la_OBJECTS) $(libstix_snd_la_LIBADD) $(LIBS) $(AM_V_CCLD)$(libstix_snd_la_LINK) $(am_libstix_snd_la_rpath) $(libstix_snd_la_OBJECTS) $(libstix_snd_la_LIBADD) $(LIBS)
@ -651,6 +671,7 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_con_la-mod-con.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-bigint.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-bigint.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-comp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-comp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libstix_la-debug.Plo@am__quote@
@ -695,6 +716,13 @@ distclean-compile:
@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@)$(LTCOMPILE) -c -o $@ $< @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
libstix_con_la-mod-con.lo: mod-con.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstix_con_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstix_con_la-mod-con.lo -MD -MP -MF $(DEPDIR)/libstix_con_la-mod-con.Tpo -c -o libstix_con_la-mod-con.lo `test -f 'mod-con.c' || echo '$(srcdir)/'`mod-con.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstix_con_la-mod-con.Tpo $(DEPDIR)/libstix_con_la-mod-con.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mod-con.c' object='libstix_con_la-mod-con.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) $(libstix_con_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libstix_con_la-mod-con.lo `test -f 'mod-con.c' || echo '$(srcdir)/'`mod-con.c
libstix_snd_la-mod-snd.lo: mod-snd.c libstix_snd_la-mod-snd.lo: mod-snd.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstix_snd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstix_snd_la-mod-snd.lo -MD -MP -MF $(DEPDIR)/libstix_snd_la-mod-snd.Tpo -c -o libstix_snd_la-mod-snd.lo `test -f 'mod-snd.c' || echo '$(srcdir)/'`mod-snd.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libstix_snd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libstix_snd_la-mod-snd.lo -MD -MP -MF $(DEPDIR)/libstix_snd_la-mod-snd.Tpo -c -o libstix_snd_la-mod-snd.lo `test -f 'mod-snd.c' || echo '$(srcdir)/'`mod-snd.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstix_snd_la-mod-snd.Tpo $(DEPDIR)/libstix_snd_la-mod-snd.Plo @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libstix_snd_la-mod-snd.Tpo $(DEPDIR)/libstix_snd_la-mod-snd.Plo
@ -1080,11 +1108,6 @@ uninstall-am: uninstall-binPROGRAMS uninstall-pkgincludeHEADERS \
uninstall-pkglibLTLIBRARIES uninstall-pkgmodexecLTLIBRARIES uninstall-pkglibLTLIBRARIES uninstall-pkgmodexecLTLIBRARIES
#libstix_con_la_SOURCES = mod-con.c mod-con.h
#libstix_con_la_CPPFLAGS = $(CPPFLAGS_MOD_COMMON)
#libstix_con_la_LDFLAGS = $(LDFLAGS_MOD_COMMON)
#libstix_con_la_LIBADD = $(LIBADD_MOD_COMMON)
install-data-hook: install-data-hook:
@echo "#ifndef _STIX_CFG_H_" > "$(DESTDIR)$(pkgincludedir)/stix-cfg.h" @echo "#ifndef _STIX_CFG_H_" > "$(DESTDIR)$(pkgincludedir)/stix-cfg.h"
@echo "#define _STIX_CFG_H_" >> "$(DESTDIR)$(pkgincludedir)/stix-cfg.h" @echo "#define _STIX_CFG_H_" >> "$(DESTDIR)$(pkgincludedir)/stix-cfg.h"

View File

@ -1163,7 +1163,7 @@ static int prim_dump (stix_t* stix, stix_ooi_t nargs)
stix_logbfmt (stix, 0, "ARGUMENT %zd: %O\n", i, STIX_STACK_GET(stix, stix->sp - i)); stix_logbfmt (stix, 0, "ARGUMENT %zd: %O\n", i, STIX_STACK_GET(stix, stix->sp - i));
} }
STIX_STACK_POPS (stix, nargs); /* leave the receiver as a return value */ STIX_STACK_SETRETTORCV (stix, nargs); /* ^self */
return 1; /* success */ return 1; /* success */
} }
@ -1268,7 +1268,7 @@ static int prim_log (stix_t* stix, stix_ooi_t nargs)
} }
} }
STIX_STACK_POPS (stix, nargs); /* delete arguments, keep self */ STIX_STACK_SETRETTORCV (stix, nargs); /* ^self */
return 1; return 1;
} }
@ -1283,8 +1283,7 @@ static int prim_identical (stix_t* stix, stix_ooi_t nargs)
b = (rcv == arg)? stix->_true: stix->_false; b = (rcv == arg)? stix->_true: stix->_false;
STIX_STACK_POP (stix); STIX_STACK_SETRET (stix, nargs, b);
STIX_STACK_SETTOP (stix, b);
return 1; return 1;
} }
@ -1299,8 +1298,7 @@ static int prim_not_identical (stix_t* stix, stix_ooi_t nargs)
b = (rcv != arg)? stix->_true: stix->_false; b = (rcv != arg)? stix->_true: stix->_false;
STIX_STACK_POP (stix); STIX_STACK_SETRET (stix, nargs, b);
STIX_STACK_SETTOP (stix, b);
return 1; return 1;
} }
@ -1309,9 +1307,11 @@ static int prim_class (stix_t* stix, stix_ooi_t nargs)
stix_oop_t rcv, c; stix_oop_t rcv, c;
STIX_ASSERT (nargs == 0); STIX_ASSERT (nargs == 0);
rcv = STIX_STACK_GETRCV(stix, nargs); rcv = STIX_STACK_GETRCV(stix, nargs);
c = STIX_CLASSOF(stix, rcv); c = STIX_CLASSOF(stix, rcv);
STIX_STACK_SETTOP (stix, c);
STIX_STACK_SETRET (stix, nargs, c);
return 1; /* success */ return 1; /* success */
} }
@ -1331,8 +1331,7 @@ static int prim_basic_new (stix_t* stix, stix_ooi_t nargs)
obj = stix_instantiate (stix, rcv, STIX_NULL, 0); obj = stix_instantiate (stix, rcv, STIX_NULL, 0);
if (!obj) return -1; if (!obj) return -1;
/* emulate 'pop receiver' and 'push result' */ STIX_STACK_SETRET (stix, nargs, obj);
STIX_STACK_SETTOP (stix, obj);
return 1; /* success */ return 1; /* success */
} }
@ -1957,8 +1956,7 @@ static int prim_processor_add_timed_semaphore (stix_t* stix, stix_ooi_t nargs)
/* /*
Is this more desired??? Is this more desired???
STIX_STACK_POPS (stix, nargs); STIX_STACK_SETRET (stix, nargs, stix->_false);
STIX_STACK_SETTOP (stix, stix->_false);
return 1; return 1;
*/ */
} }
@ -1984,7 +1982,7 @@ static int prim_processor_add_timed_semaphore (stix_t* stix, stix_ooi_t nargs)
if (add_to_sem_heap (stix, sem) <= -1) return -1; if (add_to_sem_heap (stix, sem) <= -1) return -1;
STIX_STACK_POPS (stix, nargs); /* remove all arguments, ^self */ STIX_STACK_SETRETTORCV (stix, nargs); /* ^self */
return 1; return 1;
} }
@ -2014,7 +2012,7 @@ static int prim_processor_remove_semaphore (stix_t* stix, stix_ooi_t nargs)
STIX_ASSERT(sem->heap_index == STIX_SMOOI_TO_OOP(-1)); STIX_ASSERT(sem->heap_index == STIX_SMOOI_TO_OOP(-1));
} }
STIX_STACK_POPS (stix, nargs); /* keep the receiver in the stack. ^self */ STIX_STACK_SETRETTORCV (stix, nargs); /* ^self */
return 1; return 1;
} }
@ -2667,9 +2665,8 @@ STIX_DEBUG0 (stix, "wrong function name...\n");
return 0; return 0;
} }
STIX_STACK_POPS (stix, 2);
/* TODO: how to hold an address? as an integer???? or a byte array? */ /* TODO: how to hold an address? as an integer???? or a byte array? */
STIX_STACK_SETTOP (stix, STIX_SMOOI_TO_OOP(sym)); STIX_STACK_SETRET (stix, nargs, STIX_SMOOI_TO_OOP(sym));
return 1; return 1;
} }
@ -3109,9 +3106,9 @@ static int send_message (stix_t* stix, stix_oop_char_t selector, int to_super, s
} }
else else
{ {
/* manipulate the stack as if 'receier doesNotUnderstand: select' /* manipulate the stack as if 'receier doesNotUnderstand: selector'
* has been called. */ * has been called. */
/* TODO: if i manipulate the stack this way here, the stack track for the last call is kind of lost. /* TODO: if i manipulate the stack this way here, the stack trace for the last call is kind of lost.
* how can i preserve it gracefully? */ * how can i preserve it gracefully? */
STIX_STACK_POPS (stix, nargs); STIX_STACK_POPS (stix, nargs);
nargs = 1; nargs = 1;

View File

@ -908,7 +908,7 @@ struct stix_t
/* you can't access arguments and receiver after this macro. /* you can't access arguments and receiver after this macro.
* also you must not call this macro more than once */ * also you must not call this macro more than once */
#define STIX_STACK_SETRET(stix,nargs,retv) (STIX_STACK_POPS(stix, nargs), STIX_STACK_SETTOP(stix, retv)) #define STIX_STACK_SETRET(stix,nargs,retv) (STIX_STACK_POPS(stix, nargs), STIX_STACK_SETTOP(stix, retv))
#define STIX_STACK_SETRETTORCV(stix,nargs) (STIX_STACK_POPS(stix, nargs))
/* ========================================================================= /* =========================================================================
* STIX VM LOGGING * STIX VM LOGGING
* ========================================================================= */ * ========================================================================= */