fixed a compiler bug that omitted the RETURN_FROM_BLOCK instruction when an empty block is encountered.

added more code for supporting the process stack
This commit is contained in:
hyunghwan.chung
2016-02-12 16:23:26 +00:00
parent 3d937334d8
commit f32e58f4b3
44 changed files with 3932 additions and 2025 deletions

View File

@ -25,7 +25,6 @@ endif
pkgincludedir = $(includedir)
pkglibdir = $(libdir)
pkgbindir = $(bindir)
pkginclude_HEADERS = \
stix-cfg.h \
@ -56,11 +55,11 @@ libstix_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
libstix_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libstix_la_LIBADD = $(LIBADD_LIB_COMMON)
pkgbin_PROGRAMS = stix
bin_PROGRAMS = stix
stix_SOURCES = main.c
stix_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
stix_LDFLAGS = $(LDFLAGS_LIB_COMMON)
stix_LDADD = $(LIBADD_LIB_COMMON) -lstix -ldyncall_s
stix_LDADD = $(LIBADD_LIB_COMMON) -lstix #-ldyncall_s
if ENABLE_STATIC_MODULE

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -18,23 +17,51 @@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
@ -56,10 +83,11 @@ host_triplet = @host@
# to the first number in -version-info above
@WIN32_TRUE@am__append_1 = -DSTIX_DEFAULT_MODPREFIX=\"libstix-\" -DSTIX_DEFAULT_MODPOSTFIX=\"-1\"
@WIN32_FALSE@am__append_2 = -DSTIX_DEFAULT_MODPREFIX=\"$(libdir)/libstix-\" -DSTIX_DEFAULT_MODPOSTFIX=\"\"
pkgbin_PROGRAMS = stix$(EXEEXT)
bin_PROGRAMS = stix$(EXEEXT)
subdir = lib
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/stix-cfg.h.in
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(srcdir)/stix-cfg.h.in $(top_srcdir)/ac/depcomp \
$(pkginclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_check_sign.m4 \
@ -102,7 +130,7 @@ am__uninstall_files_from_dir = { \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkglibdir)" \
"$(DESTDIR)$(pkgmodexecdir)" "$(DESTDIR)$(pkgbindir)" \
"$(DESTDIR)$(pkgmodexecdir)" "$(DESTDIR)$(bindir)" \
"$(DESTDIR)$(pkgincludedir)"
LTLIBRARIES = $(pkglib_LTLIBRARIES) $(pkgmodexec_LTLIBRARIES)
am__DEPENDENCIES_1 =
@ -115,6 +143,7 @@ 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 \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(AM_CFLAGS) $(CFLAGS) $(libstix_snd_la_LDFLAGS) $(LDFLAGS) -o \
@ -133,13 +162,25 @@ libstix_la_OBJECTS = $(am_libstix_la_OBJECTS)
libstix_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libstix_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(pkgbin_PROGRAMS)
PROGRAMS = $(bin_PROGRAMS)
am_stix_OBJECTS = stix-main.$(OBJEXT)
stix_OBJECTS = $(am_stix_OBJECTS)
stix_DEPENDENCIES = $(am__DEPENDENCIES_2)
stix_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(stix_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
@ -152,20 +193,16 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(libstix_snd_la_SOURCES) $(libstix_la_SOURCES) \
$(stix_SOURCES)
DIST_SOURCES = $(am__libstix_snd_la_SOURCES_DIST) \
@ -176,6 +213,24 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(pkginclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)stix-cfg.h.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -362,7 +417,6 @@ CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON) $(LTDLINCL) \
$(am__append_1) $(am__append_2)
LDFLAGS_LIB_COMMON = $(LDFLAGS_ALL_COMMON) -version-info 1:0:0 -no-undefined
LIBADD_LIB_COMMON = $(LIBM) $(LIBLTDL)
pkgbindir = $(bindir)
pkginclude_HEADERS = \
stix-cfg.h \
stix-cmn.h \
@ -395,7 +449,7 @@ libstix_la_LIBADD = $(LIBADD_LIB_COMMON)
stix_SOURCES = main.c
stix_CPPFLAGS = $(CPPFLAGS_LIB_COMMON)
stix_LDFLAGS = $(LDFLAGS_LIB_COMMON)
stix_LDADD = $(LIBADD_LIB_COMMON) -lstix -ldyncall_s
stix_LDADD = $(LIBADD_LIB_COMMON) -lstix #-ldyncall_s
##################################################
# STATIC MODULES BUILT INTO MAIN LIBRARY
@ -453,8 +507,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
stix-cfg.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/stix-cfg.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@ -466,6 +520,7 @@ $(srcdir)/stix-cfg.h.in: $(am__configure_deps)
distclean-hdr:
-rm -f stix-cfg.h stamp-h1
install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
@ -492,12 +547,15 @@ uninstall-pkglibLTLIBRARIES:
clean-pkglibLTLIBRARIES:
-test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
@list='$(pkglib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@list='$(pkglib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
install-pkgmodexecLTLIBRARIES: $(pkgmodexec_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(pkgmodexec_LTLIBRARIES)'; test -n "$(pkgmodexecdir)" || list=; \
@ -524,29 +582,35 @@ uninstall-pkgmodexecLTLIBRARIES:
clean-pkgmodexecLTLIBRARIES:
-test -z "$(pkgmodexec_LTLIBRARIES)" || rm -f $(pkgmodexec_LTLIBRARIES)
@list='$(pkgmodexec_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@list='$(pkgmodexec_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
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)
libstix.la: $(libstix_la_OBJECTS) $(libstix_la_DEPENDENCIES) $(EXTRA_libstix_la_DEPENDENCIES)
$(AM_V_CCLD)$(libstix_la_LINK) -rpath $(pkglibdir) $(libstix_la_OBJECTS) $(libstix_la_LIBADD) $(LIBS)
install-pkgbinPROGRAMS: $(pkgbin_PROGRAMS)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(pkgbin_PROGRAMS)'; test -n "$(pkgbindir)" || list=; \
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(pkgbindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(pkgbindir)" || exit 1; \
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
fi; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
while read p p1; do if test -f $$p \
|| test -f $$p1 \
; then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
sed -e 'p;s,.*/,,;n;h' \
-e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
@ -557,29 +621,31 @@ install-pkgbinPROGRAMS: $(pkgbin_PROGRAMS)
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkgbindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkgbindir)$$dir" || exit $$?; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-pkgbinPROGRAMS:
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(pkgbin_PROGRAMS)'; test -n "$(pkgbindir)" || list=; \
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
-e 's/$$/$(EXEEXT)/' \
`; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgbindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgbindir)" && rm -f $$files
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-pkgbinPROGRAMS:
@list='$(pkgbin_PROGRAMS)'; test -n "$$list" || exit 0; \
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
stix$(EXEEXT): $(stix_OBJECTS) $(stix_DEPENDENCIES) $(EXTRA_stix_DEPENDENCIES)
@rm -f stix$(EXEEXT)
$(AM_V_CCLD)$(stix_LINK) $(stix_OBJECTS) $(stix_LDADD) $(LIBS)
@ -609,22 +675,25 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stix-main.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
@ -782,26 +851,15 @@ uninstall-pkgincludeHEADERS:
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
TAGS: $(HEADERS) $(SOURCES) stix-cfg.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) stix-cfg.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@ -813,15 +871,11 @@ TAGS: $(HEADERS) $(SOURCES) stix-cfg.h.in $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) stix-cfg.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) stix-cfg.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@ -830,6 +884,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -868,7 +937,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) stix-cfg.h
installdirs:
for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgmodexecdir)" "$(DESTDIR)$(pkgbindir)" "$(DESTDIR)$(pkgincludedir)"; do \
for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(pkgmodexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@ -903,7 +972,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-pkgbinPROGRAMS \
clean-am: clean-binPROGRAMS clean-generic clean-libtool \
clean-pkglibLTLIBRARIES clean-pkgmodexecLTLIBRARIES \
mostlyclean-am
@ -925,14 +994,14 @@ info: info-am
info-am:
install-data-am: install-pkgbinPROGRAMS install-pkgincludeHEADERS
install-data-am: install-pkgincludeHEADERS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-pkglibLTLIBRARIES \
install-exec-am: install-binPROGRAMS install-pkglibLTLIBRARIES \
install-pkgmodexecLTLIBRARIES
install-html: install-html-am
@ -973,29 +1042,30 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-pkgbinPROGRAMS uninstall-pkgincludeHEADERS \
uninstall-am: uninstall-binPROGRAMS uninstall-pkgincludeHEADERS \
uninstall-pkglibLTLIBRARIES uninstall-pkgmodexecLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
.MAKE: all install-am install-data-am install-strip uninstall-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-pkgbinPROGRAMS clean-pkglibLTLIBRARIES \
clean-pkgmodexecLTLIBRARIES ctags distclean distclean-compile \
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool \
clean-pkglibLTLIBRARIES clean-pkgmodexecLTLIBRARIES \
cscopelist-am ctags ctags-am distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgbinPROGRAMS install-pkgincludeHEADERS \
install install-am install-binPROGRAMS install-data \
install-data-am install-data-hook install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgincludeHEADERS \
install-pkglibLTLIBRARIES install-pkgmodexecLTLIBRARIES \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-hook \
uninstall-pkgbinPROGRAMS uninstall-pkgincludeHEADERS \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-hook uninstall-pkgincludeHEADERS \
uninstall-pkglibLTLIBRARIES uninstall-pkgmodexecLTLIBRARIES

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -146,6 +146,19 @@ enum voca_id_t
};
typedef enum voca_id_t voca_id_t;
#if defined(STIX_DEBUG_COMP_001)
# define DBGOUT_COMP_0(fmt) printf(fmt "\n")
# define DBGOUT_COMP_1(fmt,a1) printf(fmt "\n",a1)
# define DBGOUT_COMP_2(fmt,a1,a2) printf(fmt "\n", a1, a2)
# define DBGOUT_COMP_3(fmt,a1,a2,a3) printf(fmt "\n", a1, a2, a3)
#else
# define DBGOUT_COMP_0(fmt)
# define DBGOUT_COMP_1(fmt,a1)
# define DBGOUT_COMP_2(fmt,a1,a2)
# define DBGOUT_COMP_3(fmt,a1,a2,a3)
#endif
static int compile_block_statement (stix_t* stix);
static int compile_method_statement (stix_t* stix);
static int compile_method_expression (stix_t* stix, int pop);
@ -1780,37 +1793,36 @@ static int emit_push_smint_literal (stix_t* stix, stix_ooi_t i)
switch (i)
{
case -1:
printf ("\tpush negone\n");
DBGOUT_COMP_0("\tpush negone");
return emit_byte_instruction (stix, BCODE_PUSH_NEGONE);
case 0:
printf ("\tpush zero\n");
DBGOUT_COMP_0("\tpush zero");
return emit_byte_instruction (stix, BCODE_PUSH_ZERO);
case 1:
printf ("\tpush one\n");
DBGOUT_COMP_0("\tpush one");
return emit_byte_instruction (stix, BCODE_PUSH_ONE);
case 2:
printf ("\tpush two\n");
DBGOUT_COMP_0("\tpush two");
return emit_byte_instruction (stix, BCODE_PUSH_TWO);
}
if (i >= 0 && i <= MAX_CODE_PARAM)
{
printf ("\tpush intlit %d\n", (int)i);
DBGOUT_COMP_1("\tpush intlit %d", (int)i);
return emit_single_param_instruction(stix, BCODE_PUSH_INTLIT, i);
}
else if (i < 0 && i >= -(stix_ooi_t)MAX_CODE_PARAM)
{
printf ("\tpush negintlit %d\n", (int)i);
DBGOUT_COMP_1("\tpush negintlit %d", (int)i);
return emit_single_param_instruction(stix, BCODE_PUSH_NEGINTLIT, -i);
}
if (add_literal(stix, STIX_SMOOI_TO_OOP(i), &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush litral_0 %d\n", (int)index);
DBGOUT_COMP_1("\tpush litral_0 %d", (int)index);
return 0;
}
@ -3035,20 +3047,20 @@ static int compile_block_expression (stix_t* stix)
if (store_tmpr_count_for_block (stix, stix->c->mth.tmpr_count) <= -1) return -1;
#if defined(STIX_USE_MAKE_BLOCK)
printf ("\tmake_block nargs %d ntmprs %d\n", (int)block_arg_count, (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
DBGOUT_COMP_2 ("\tmake_block nargs %d ntmprs %d", (int)block_arg_count, (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
if (emit_double_param_instruction(stix, BCODE_MAKE_BLOCK, block_arg_count, stix->c->mth.tmpr_count/*block_tmpr_count*/) <= -1) return -1;
#else
printf ("\tpush_context\n");
printf ("\tpush smint nargs=%d\n", (int)block_arg_count);
printf ("\tpush smint ntmprs=%d\n", (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
printf ("\tsend_block_copy\n");
DBGOUT_COMP_0("\tpush_context");
DBGOUT_COMP_1("\tpush smint nargs=%d", (int)block_arg_count);
DBGOUT_COMP_1("\tpush smint ntmprs=%d", (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
DBGOUT_COMP_0("\tsend_block_copy");
if (emit_byte_instruction(stix, BCODE_PUSH_CONTEXT) <= -1 ||
emit_push_smint_literal(stix, block_arg_count) <= -1 ||
emit_push_smint_literal(stix, stix->c->mth.tmpr_count/*block_tmpr_count*/) <= -1 ||
emit_byte_instruction(stix, BCODE_SEND_BLOCK_COPY) <= -1) return -1;
#endif
printf ("\tjump\n");
DBGOUT_COMP_0 ("\tjump_forward_0");
/* insert dummy instructions before replacing them with a jump instruction */
jump_inst_pos = stix->c->mth.code.len;
/* specifying MAX_CODE_JUMP causes emit_single_param_instruction() to
@ -3059,6 +3071,7 @@ printf ("\tjump\n");
if (stix->c->tok.type == STIX_IOTOK_RBRACK)
{
/* the block is empty */
DBGOUT_COMP_0("\tpush_nil");
if (emit_byte_instruction (stix, BCODE_PUSH_NIL) <= -1) return -1;
}
else
@ -3072,6 +3085,7 @@ printf ("\tjump\n");
{
GET_TOKEN (stix);
if (stix->c->tok.type == STIX_IOTOK_RBRACK) break;
DBGOUT_COMP_0("\tpop_stacktop");
if (emit_byte_instruction(stix, BCODE_POP_STACKTOP) <= -1) return -1;
}
else
@ -3080,11 +3094,12 @@ printf ("\tjump\n");
return -1;
}
}
printf ("\treturn_from_block\n");
if (emit_byte_instruction(stix, BCODE_RETURN_FROM_BLOCK) <= -1) return -1;
}
DBGOUT_COMP_0("\treturn_from_block");
if (emit_byte_instruction(stix, BCODE_RETURN_FROM_BLOCK) <= -1) return -1;
block_code_size = stix->c->mth.code.len - jump_inst_pos - (STIX_BCODE_LONG_PARAM_SIZE + 1);
if (block_code_size > MAX_CODE_JUMP * 2)
{
@ -3097,7 +3112,7 @@ printf ("\treturn_from_block\n");
if (block_code_size > MAX_CODE_JUMP)
{
printf ("\tfixed jump to jump2\n");
DBGOUT_COMP_0("\tfixed jump_forward to jump2_forward");
stix->c->mth.code.ptr[jump_inst_pos] = BCODE_JUMP2_FORWARD;
jump_offset = block_code_size - MAX_CODE_JUMP;
}
@ -3106,7 +3121,7 @@ printf ("\tfixed jump to jump2\n");
jump_offset = block_code_size;
}
printf ("\tfixed jump offset to %u\n", (unsigned int)jump_offset);
DBGOUT_COMP_1("\tfixed jump offset to %u", (unsigned int)jump_offset);
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
stix->c->mth.code.ptr[jump_inst_pos + 1] = jump_offset >> 8;
@ -3331,7 +3346,7 @@ static int compile_byte_array_literal (stix_t* stix)
if (read_byte_array_literal(stix, &lit) <= -1 ||
add_literal(stix, lit, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush_literal byte_array\n");
DBGOUT_COMP_0("\tpush_literal byte_array");
GET_TOKEN (stix);
return 0;
@ -3367,7 +3382,7 @@ static int compile_array_literal (stix_t* stix)
if (read_array_literal(stix, &lit) <= -1 ||
add_literal(stix, lit, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush_literal array\n");
DBGOUT_COMP_0("\tpush_literal array");
GET_TOKEN (stix);
return 0;
@ -3408,7 +3423,7 @@ static int compile_expression_primary (stix_t* stix, const stix_oocs_t* ident, c
{
if (var.pos >= stix->c->mth.blk_tmprcnt[i - 1])
{
printf ("\tpush ctxtempvar %d %d\n", (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
DBGOUT_COMP_2("\tpush ctxtempvar %d %d", (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
if (emit_double_param_instruction(stix, BCODE_PUSH_CTXTEMPVAR_0, stix->c->mth.blk_depth - i, var.pos - stix->c->mth.blk_tmprcnt[i - 1]) <= -1) return -1;
goto temporary_done;
}
@ -3417,7 +3432,7 @@ printf ("\tpush ctxtempvar %d %d\n", (int)(stix->c->mth.blk_depth - i), (int)(va
#endif
if (emit_single_param_instruction(stix, BCODE_PUSH_TEMPVAR_0, var.pos) <= -1) return -1;
printf ("\tpush tempvar %d\n", (int)var.pos);
DBGOUT_COMP_1("\tpush tempvar %d", (int)var.pos);
temporary_done:
break;
}
@ -3425,13 +3440,13 @@ printf ("\tpush tempvar %d\n", (int)var.pos);
case VAR_INSTANCE:
case VAR_CLASSINST:
if (emit_single_param_instruction(stix, BCODE_PUSH_INSTVAR_0, var.pos) <= -1) return -1;
printf ("\tpush instvar %d\n", (int)var.pos);
DBGOUT_COMP_1("\tpush instvar %d", (int)var.pos);
break;
case VAR_CLASS:
if (add_literal(stix, (stix_oop_t)var.cls, &index) <= -1 ||
emit_double_param_instruction(stix, BCODE_PUSH_OBJVAR_0, var.pos, index) <= -1) return -1;
printf ("\tpush objvar %d %d\n", (int)var.pos, (int)index);
DBGOUT_COMP_2("\tpush objvar %d %d", (int)var.pos, (int)index);
break;
case VAR_GLOBAL:
@ -3446,7 +3461,7 @@ printf ("\tpush objvar %d %d\n", (int)var.pos, (int)index);
*/
if (add_literal(stix, (stix_oop_t)var.gbl, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_OBJECT_0, index) <= -1) return -1;
printf ("\tpush object %d\n", (int)index);
DBGOUT_COMP_1("\tpush object %d", (int)index);
break;
default:
@ -3469,38 +3484,38 @@ printf ("\tpush object %d\n", (int)index);
goto handle_ident;
case STIX_IOTOK_SELF:
printf ("\tpush receiver...\n");
DBGOUT_COMP_0("\tpush receiver");
if (emit_byte_instruction(stix, BCODE_PUSH_RECEIVER) <= -1) return -1;
GET_TOKEN (stix);
break;
case STIX_IOTOK_SUPER:
printf ("\tpush receiver(super)...\n");
DBGOUT_COMP_0("\tpush receiver(super)");
if (emit_byte_instruction(stix, BCODE_PUSH_RECEIVER) <= -1) return -1;
GET_TOKEN (stix);
*to_super = 1;
break;
case STIX_IOTOK_NIL:
printf ("\tpush nil...\n");
DBGOUT_COMP_0("\tpush nil");
if (emit_byte_instruction(stix, BCODE_PUSH_NIL) <= -1) return -1;
GET_TOKEN (stix);
break;
case STIX_IOTOK_TRUE:
printf ("\tpush true...\n");
DBGOUT_COMP_0("\tpush true");
if (emit_byte_instruction(stix, BCODE_PUSH_TRUE) <= -1) return -1;
GET_TOKEN (stix);
break;
case STIX_IOTOK_FALSE:
printf ("\tpush false...\n");
DBGOUT_COMP_0("\tpush false");
if (emit_byte_instruction(stix, BCODE_PUSH_FALSE) <= -1) return -1;
GET_TOKEN (stix);
break;
case STIX_IOTOK_THIS_CONTEXT:
printf ("\tpush context...\n");
DBGOUT_COMP_0("\tpush context");
if (emit_byte_instruction(stix, BCODE_PUSH_CONTEXT) <= -1) return -1;
GET_TOKEN (stix);
break;
@ -3509,21 +3524,21 @@ printf ("\tpush context...\n");
STIX_ASSERT (stix->c->tok.name.len == 1);
if (add_character_literal(stix, stix->c->tok.name.ptr[0], &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush character literal %d\n", (int)index);
DBGOUT_COMP_1("\tpush character literal %d", (int)index);
GET_TOKEN (stix);
break;
case STIX_IOTOK_STRLIT:
if (add_string_literal(stix, &stix->c->tok.name, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush string literal %d\n", (int)index);
DBGOUT_COMP_1("\tpush string literal %d", (int)index);
GET_TOKEN (stix);
break;
case STIX_IOTOK_SYMLIT:
if (add_symbol_literal(stix, &stix->c->tok.name, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush symbol literal %d\n", (int)index);
DBGOUT_COMP_1("\tpush symbol literal %d", (int)index);
GET_TOKEN (stix);
break;
@ -3545,7 +3560,7 @@ printf ("\tpush symbol literal %d\n", (int)index);
{
if (add_literal(stix, tmp, &index) <= -1 ||
emit_single_param_instruction(stix, BCODE_PUSH_LITERAL_0, index) <= -1) return -1;
printf ("\tpush_literal_0 %d\n", (int)index);
DBGOUT_COMP_1("\tpush_literal_0 %d", (int)index);
}
GET_TOKEN (stix);
@ -3822,7 +3837,7 @@ static int compile_message_expression (stix_t* stix, int to_super)
if (stix->c->tok.type == STIX_IOTOK_SEMICOLON)
{
printf ("\tdup_stacktop for cascading\n");
DBGOUT_COMP_0("\tdup_stacktop for cascading");
stix->c->mth.code.ptr[noop_pos] = BCODE_DUP_STACKTOP;
if (emit_byte_instruction(stix, BCODE_POP_STACKTOP) <= -1) return -1;
GET_TOKEN(stix);
@ -3946,7 +3961,7 @@ printf ("\n");
{
if (var.pos >= stix->c->mth.blk_tmprcnt[i - 1])
{
printf ("\t%s_into_ctxtempvar %d %d\n", (pop? "pop":"store"), (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
DBGOUT_COMP_3("\t%s_into_ctxtempvar %d %d", (pop? "pop":"store"), (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
if (emit_double_param_instruction(stix, (pop? BCODE_POP_INTO_CTXTEMPVAR_0: BCODE_STORE_INTO_CTXTEMPVAR_0), stix->c->mth.blk_depth - i, var.pos - stix->c->mth.blk_tmprcnt[i - 1]) <= -1) return -1;
goto temporary_done;
}
@ -3954,7 +3969,7 @@ printf ("\t%s_into_ctxtempvar %d %d\n", (pop? "pop":"store"), (int)(stix->c->mth
}
#endif
printf ("\t%s_into_tempvar %d\n", (pop? "pop":"store"), (int)var.pos);
DBGOUT_COMP_2("\t%s_into_tempvar %d", (pop? "pop":"store"), (int)var.pos);
if (emit_single_param_instruction (stix, (pop? BCODE_POP_INTO_TEMPVAR_0: BCODE_STORE_INTO_TEMPVAR_0), var.pos) <= -1) goto oops;
temporary_done:
@ -3964,7 +3979,7 @@ printf ("\t%s_into_tempvar %d\n", (pop? "pop":"store"), (int)var.pos);
case VAR_INSTANCE:
case VAR_CLASSINST:
printf ("\t%s_into_instvar %d\n", (pop? "pop":"store"), (int)var.pos);
DBGOUT_COMP_2("\t%s_into_instvar %d", (pop? "pop":"store"), (int)var.pos);
if (emit_single_param_instruction (stix, (pop? BCODE_POP_INTO_INSTVAR_0: BCODE_STORE_INTO_INSTVAR_0), var.pos) <= -1) goto oops;
ret = pop;
break;
@ -3972,14 +3987,14 @@ printf ("\t%s_into_instvar %d\n", (pop? "pop":"store"), (int)var.pos);
case VAR_CLASS:
if (add_literal (stix, (stix_oop_t)var.cls, &index) <= -1 ||
emit_double_param_instruction (stix, (pop? BCODE_POP_INTO_OBJVAR_0: BCODE_STORE_INTO_OBJVAR_0), var.pos, index) <= -1) goto oops;
printf ("\t%s_into_objvar %d %d\n", (pop? "pop":"store"), (int)var.pos, (int)index);
DBGOUT_COMP_3("\t%s_into_objvar %d %d", (pop? "pop":"store"), (int)var.pos, (int)index);
ret = pop;
break;
case VAR_GLOBAL:
if (add_literal(stix, (stix_oop_t)var.gbl, &index) <= -1 ||
emit_single_param_instruction(stix, (pop? BCODE_POP_INTO_OBJECT_0: BCODE_STORE_INTO_OBJECT_0), index) <= -1) return -1;
printf ("\t%s_into_object %d\n", (pop? "pop":"store"), (int)index);
DBGOUT_COMP_2("\t%s_into_object %d", (pop? "pop":"store"), (int)index);
ret = pop;
break;
@ -4021,7 +4036,7 @@ static int compile_block_statement (stix_t* stix)
/* handle the return statement */
GET_TOKEN (stix);
if (compile_method_expression(stix, 0) <= -1) return -1;
printf ("\treturn_stacktop\n");
DBGOUT_COMP_0("\treturn_stacktop");
return emit_byte_instruction (stix, BCODE_RETURN_STACKTOP);
}
else
@ -4042,7 +4057,7 @@ static int compile_method_statement (stix_t* stix)
/* handle the return statement */
GET_TOKEN (stix);
if (compile_method_expression(stix, 0) <= -1) return -1;
printf ("\treturn_stacktop\n");
DBGOUT_COMP_0("\treturn_stacktop");
return emit_byte_instruction (stix, BCODE_RETURN_STACKTOP);
}
else
@ -4059,8 +4074,13 @@ printf ("\treturn_stacktop\n");
if (n <= -1) return -1;
/* if n is 1, no stack popping is required */
if (n == 0) printf ("\tpop_stacktop\n");
return (n == 0)? emit_byte_instruction (stix, BCODE_POP_STACKTOP): 0;
if (n == 0)
{
DBGOUT_COMP_0("\tpop_stacktop");
return emit_byte_instruction (stix, BCODE_POP_STACKTOP);
}
return 0;
}
}

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -33,7 +33,11 @@
/* TODO: context's stack overflow check in various part of this file */
/* TOOD: determine the right stack size */
#define CONTEXT_STACK_SIZE 96
#if defined(STIX_USE_PROCSTK)
# define CONTEXT_STACK_SIZE 0
#else
# define CONTEXT_STACK_SIZE 96
#endif
#define LOAD_IP(stix, v_ctx) ((stix)->ip = STIX_OOP_TO_SMOOI((v_ctx)->ip))
#define STORE_IP(stix, v_ctx) ((v_ctx)->ip = STIX_SMOOI_TO_OOP((stix)->ip))
@ -44,53 +48,79 @@
#define LOAD_ACTIVE_IP(stix) LOAD_IP(stix, (stix)->active_context)
#define STORE_ACTIVE_IP(stix) STORE_IP(stix, (stix)->active_context)
#define LOAD_ACTIVE_SP(stix) LOAD_SP(stix, (stix)->active_context)
#define STORE_ACTIVE_SP(stix) STORE_SP(stix, (stix)->active_context)
#if defined(STIX_USE_PROCSTK)
#define LOAD_ACTIVE_SP(stix) LOAD_SP(stix, (stix)->processor->active)
#define STORE_ACTIVE_SP(stix) STORE_SP(stix, (stix)->processor->active)
#define ACTIVE_STACK_PUSH(stix,v) \
do { \
(stix)->sp = (stix)->sp + 1; \
(stix)->processor->active->slot[(stix)->sp] = v; \
} while (0)
#define ACTIVE_STACK_PUSH(stix,v) \
do { \
(stix)->sp = (stix)->sp + 1; \
(stix)->active_context->slot[(stix)->sp] = v; \
} while (0)
#define ACTIVE_STACK_GET(stix,v_sp) ((stix)->processor->active->slot[v_sp])
#define ACTIVE_STACK_SET(stix,v_sp,v_obj) ((stix)->processor->active->slot[v_sp] = v_obj)
#else
#define LOAD_ACTIVE_SP(stix) LOAD_SP(stix, (stix)->active_context)
#define STORE_ACTIVE_SP(stix) STORE_SP(stix, (stix)->active_context)
#define ACTIVE_STACK_PUSH(stix,v) \
do { \
(stix)->sp = (stix)->sp + 1; \
(stix)->active_context->slot[(stix)->sp] = v; \
} while (0)
#define ACTIVE_STACK_GET(stix,v_sp) ((stix)->active_context->slot[v_sp])
#define ACTIVE_STACK_SET(stix,v_sp,v_obj) ((stix)->active_context->slot[v_sp] = v_obj)
#endif
#define ACTIVE_STACK_GETTOP(stix) ACTIVE_STACK_GET(stix, (stix)->sp)
#define ACTIVE_STACK_SETTOP(stix,v_obj) ACTIVE_STACK_SET(stix, (stix)->sp, v_obj)
#define ACTIVE_STACK_POP(stix) ((stix)->sp = (stix)->sp - 1)
#define ACTIVE_STACK_UNPOP(stix) ((stix)->sp = (stix)->sp + 1)
#define ACTIVE_STACK_POPS(stix,count) ((stix)->sp = (stix)->sp - (count))
#define ACTIVE_STACK_GET(stix,v_sp) ((stix)->active_context->slot[v_sp])
#define ACTIVE_STACK_SET(stix,v_sp,v_obj) ((stix)->active_context->slot[v_sp] = v_obj)
#define ACTIVE_STACK_GETTOP(stix) ACTIVE_STACK_GET(stix, (stix)->sp)
#define ACTIVE_STACK_SETTOP(stix,v_obj) ACTIVE_STACK_SET(stix, (stix)->sp, v_obj)
#define ACTIVE_STACK_ISEMPTY(stix) ((stix)->sp <= -1)
#define SWITCH_ACTIVE_CONTEXT(stix,v_ctx) \
do \
{ \
STORE_ACTIVE_IP (stix); \
STORE_ACTIVE_SP (stix); \
(stix)->active_context = (v_ctx); \
(stix)->active_method = (stix_oop_method_t)(stix)->active_context->origin->method_or_nargs; \
SET_ACTIVE_METHOD_CODE(stix); \
LOAD_ACTIVE_IP (stix); \
LOAD_ACTIVE_SP (stix); \
} while (0) \
#if defined(STIX_USE_PROCSTK)
#define SWITCH_ACTIVE_CONTEXT(stix,v_ctx) \
do \
{ \
STORE_ACTIVE_IP (stix); \
(stix)->active_context = (v_ctx); \
(stix)->active_method = (stix_oop_method_t)(stix)->active_context->origin->method_or_nargs; \
SET_ACTIVE_METHOD_CODE(stix); \
LOAD_ACTIVE_IP (stix); \
} while (0)
#else
#define SWITCH_ACTIVE_CONTEXT(stix,v_ctx) \
do \
{ \
STORE_ACTIVE_IP (stix); \
STORE_ACTIVE_SP (stix); \
(stix)->active_context = (v_ctx); \
(stix)->active_method = (stix_oop_method_t)(stix)->active_context->origin->method_or_nargs; \
SET_ACTIVE_METHOD_CODE(stix); \
LOAD_ACTIVE_IP (stix); \
LOAD_ACTIVE_SP (stix); \
} while (0)
#endif
#define FETCH_BYTE_CODE(stix) ((stix)->active_code[(stix)->ip++])
#define FETCH_BYTE_CODE_TO(stix, v_ooi) (v_ooi = FETCH_BYTE_CODE(stix))
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
#define FETCH_PARAM_CODE_TO(stix, v_ooi) \
do { \
v_ooi = FETCH_BYTE_CODE(stix); \
v_ooi = (v_ooi << 8) | FETCH_BYTE_CODE(stix); \
} while (0)
# define FETCH_PARAM_CODE_TO(stix, v_ooi) \
do { \
v_ooi = FETCH_BYTE_CODE(stix); \
v_ooi = (v_ooi << 8) | FETCH_BYTE_CODE(stix); \
} while (0)
#else
#define FETCH_PARAM_CODE_TO(stix, v_ooi) (v_ooi = FETCH_BYTE_CODE(stix))
# define FETCH_PARAM_CODE_TO(stix, v_ooi) (v_ooi = FETCH_BYTE_CODE(stix))
#endif
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
# define DBGOUT_EXEC_0(fmt) printf(fmt "\n")
# define DBGOUT_EXEC_1(fmt,a1) printf(fmt "\n",a1)
# define DBGOUT_EXEC_2(fmt,a1,a2) printf(fmt "\n", a1, a2)
@ -115,6 +145,9 @@ static stix_oop_process_t make_process (stix_t* stix, stix_oop_context_t c)
proc->initial_context = c;
proc->sp = STIX_SMOOI_TO_OOP(-1);
#if defined(STIX_DEBUG_PROCESSOR)
printf ("PROCESS %p SIZE => %ld\n", proc, (long int)STIX_OBJ_GET_SIZE(proc));
#endif
return proc;
}
@ -126,16 +159,32 @@ static void switch_process (stix_t* stix, stix_oop_process_t proc)
printf ("ACTUAL PROCESS SWITCHING BF...%d %p\n", (int)stix->ip, stix->active_context);
#endif
/* store the active context to the active process */
STIX_ASSERT ((stix_oop_t)stix->processor->active != stix->_nil);
stix->processor->active->active_context = stix->active_context;
#if defined(STIX_USE_PROCSTK)
STORE_ACTIVE_SP(stix);
#else
/* nothing special */
#endif
/* store the active context to the active process */
STIX_ASSERT ((stix_oop_t)stix->processor->active != stix->_nil);
stix->processor->active->active_context = stix->active_context;
/* switch the active process */
/*TODO: set the state to RUNNING */
stix->processor->active = proc;
#if defined(STIX_USE_PROCSTK)
LOAD_ACTIVE_SP(stix);
#else
/* nothing special */
#endif
/* switch the active context */
SWITCH_ACTIVE_CONTEXT (stix, proc->active_context);
#if defined(STIX_DEBUG_PROCESSOR)
printf ("ACTUAL PROCESS SWITCHING AF...%d %p\n", (int)stix->ip, stix->active_context);
#endif
/*TODO: set the state to RUNNING */
stix->processor->active = proc;
}
}
@ -174,11 +223,13 @@ static STIX_INLINE int register_new_process (stix_t* stix, stix_oop_process_t pr
{
/* the process schedule has no process.
* it is the first process */
STIX_ASSERT (stix->processor->active == stix->nil_process);
stix->processor->head = proc;
stix->processor->tail = proc;
stix->processor->tally = STIX_SMOOI_TO_OOP(1);
stix->processor->tally = STIX_SMOOI_TO_OOP(1);
#if defined(STIX_DEBUG_PROCESSOR)
printf ("ADD NEW PROCESS X - %d\n", (int)1);
printf ("ADDED FIRST NEW PROCESS - %d\n", (int)1);
#endif
}
else if (tally >= STIX_SMOOI_MAX)
@ -196,7 +247,7 @@ printf ("TOO MANY PROCESS\n");
stix->processor->head = proc;
stix->processor->tally = STIX_SMOOI_TO_OOP(tally + 1);
#if defined(STIX_DEBUG_PROCESSOR)
printf ("ADD NEW PROCESS Y - %d\n", (int)tally + 1);
printf ("ADDED NEW PROCESS - %d\n", (int)tally + 1);
#endif
}
@ -222,35 +273,27 @@ static int schedule_process (stix_t* stix, stix_oop_process_t proc)
return 0;
}
#if 0
static stix_oop_process_t start_new_process (stix_t* stix, stix_oop_context_t c)
{
stix_oop_process_t proc;
proc = make_process (stix, c);
if (!proc) return STIX_NULL;
if (schedule_process (stix, proc) <= -1) return STIX_NULL;
return proc;
}
#endif
static stix_oop_process_t start_initial_process (stix_t* stix, stix_oop_context_t c)
{
stix_oop_process_t proc;
/* there must be no active process when this function is called */
STIX_ASSERT (stix->processor->tally == STIX_SMOOI_TO_OOP(0));
STIX_ASSERT (stix->processor->active == stix->nil_process);
proc = make_process (stix, c);
if (!proc) return STIX_NULL;
if (register_new_process (stix, proc) <= -1) return STIX_NULL;
/*TODO: set the state to RUNNING */
stix->processor->active = proc;
/* do somthing that schedule_process() would do with less overhead */
STIX_ASSERT ((stix_oop_t)proc->active_context != stix->_nil);
STIX_ASSERT (proc->active_context == proc->initial_context);
SWITCH_ACTIVE_CONTEXT (stix, proc->active_context);
/*TODO: set the state to RUNNING */
stix->processor->active = proc;
return proc;
}
@ -287,11 +330,15 @@ static STIX_INLINE int activate_new_method (stix_t* stix, stix_oop_method_t mth)
STIX_ASSERT (ntmprs >= 0);
STIX_ASSERT (nargs <= ntmprs);
#if defined(STIX_USE_PROCSTK)
/* nothing special */
#else
STIX_ASSERT (stix->sp >= 0);
STIX_ASSERT (stix->sp >= nargs);
#endif
stix_pushtmp (stix, (stix_oop_t*)&mth);
ctx = (stix_oop_context_t)stix_instantiate (stix, stix->_method_context, STIX_NULL, CONTEXT_STACK_SIZE);
ctx = (stix_oop_context_t)stix_instantiate (stix, stix->_method_context, STIX_NULL, ntmprs + CONTEXT_STACK_SIZE);
stix_poptmp (stix);
if (!ctx) return -1;
@ -359,53 +406,13 @@ static STIX_INLINE int activate_new_method (stix_t* stix, stix_oop_method_t mth)
STIX_ASSERT (stix->sp >= -1);
/* swtich the active context */
/* switch the active context */
SWITCH_ACTIVE_CONTEXT (stix, ctx);
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("<<ENTERING>> SP=%d\n", (int)stix->sp);
#endif
return 0;
#if 0
reuse_context:
/* force the class to become a method context */
ctx->_class = stix->_method_context;
ctx->receiver_or_source = ACTIVE_STACK_GET(stix, stix->sp - nargs);
#if defined(STIX_DEBUG_EXEC)
printf ("####### REUSING CONTEXT INSTEAD OF <<ENTERING>> WITH RECEIVER ");
print_object (stix, ctx->receiver_or_source);
printf ("\n");
#endif
for (i = 0; i < nargs; i++)
{
ctx->slot[i] = ACTIVE_STACK_GET (stix, stix->sp - nargs + i + 1);
#if defined(STIX_DEBUG_EXEC)
printf ("REUSING ARGUMENT %d - ", (int)i);
print_object (stix, ctx->slot[i]);
printf ("\n");
#endif
}
for (; i <= stix->sp; i++) ctx->slot[i] = stix->_nil;
/* keep the sender
ctx->sender =
*/
ctx->ntmprs = STIX_SMOOI_TO_OOP(ntmprs);
ctx->method_or_nargs = (stix_oop_t)mth;
ctx->home = stix->_nil;
ctx->origin = ctx;
/* let SWITCH_ACTIVE_CONTEXT() fill 'ctx->ip' and 'ctx->sp' by putting
* the values to stix->ip and stix->sp */
stix->ip = 0;
stix->sp = ntmprs - 1;
SWITCH_ACTIVE_CONTEXT (stix, ctx);
return 0;
#endif
}
static stix_oop_method_t find_method (stix_t* stix, stix_oop_t receiver, const stix_oocs_t* message, int super)
@ -417,7 +424,7 @@ static stix_oop_method_t find_method (stix_t* stix, stix_oop_t receiver, const s
int dic_no;
/* TODO: implement method lookup cache */
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_002)
printf ("==== FINDING METHOD FOR %p [", receiver);
print_oocs (message);
printf ("] in ");
@ -429,7 +436,7 @@ printf ("] in ");
/* receiver is a class object */
c = receiver;
dic_no = STIX_CLASS_MTHDIC_CLASS;
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_002)
printf ("class method dictioanry of ");
print_object(stix, (stix_oop_t)((stix_oop_class_t)c)->name);
printf ("\n");
@ -439,7 +446,7 @@ printf ("\n");
{
c = (stix_oop_t)cls;
dic_no = STIX_CLASS_MTHDIC_INSTANCE;
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_002)
printf ("instance method dictioanry of ");
print_object(stix, (stix_oop_t)((stix_oop_class_t)c)->name);
printf ("\n");
@ -478,7 +485,7 @@ not_found:
return STIX_NULL;
}
static int activate_initial_context (stix_t* stix, const stix_oocs_t* objname, const stix_oocs_t* mthname)
static int start_initial_process_and_context (stix_t* stix, const stix_oocs_t* objname, const stix_oocs_t* mthname)
{
/* the initial context is a fake context. if objname is 'Stix' and
* mthname is 'main', this function emulates message sending 'Stix main'.
@ -521,6 +528,8 @@ TODO: overcome this problem
stix->ip = 0;
stix->sp = -1;
ctx->ip = STIX_SMOOI_TO_OOP(0); /* point to the beginning */
ctx->sp = STIX_SMOOI_TO_OOP(-1); /* pointer to -1 below the bottom */
ctx->origin = ctx; /* point to self */
ctx->method_or_nargs = (stix_oop_t)mth; /* fake. help SWITCH_ACTIVE_CONTEXT() not fail*/
@ -530,21 +539,35 @@ TODO: overcome this problem
* the main execution loop for breaking out of the loop */
STIX_ASSERT (stix->active_context == STIX_NULL);
/* i can't use SWITCH_ACTIVE_CONTEXT() macro as there is no active
* context before switching. let's force set active_context to ctx
* directly. */
STIX_ASSERT (stix->active_method == STIX_NULL);
/* stix_gc() uses stix->processor when stix->active_context
* is not NULL. at this poinst, stix->processor should point to
* an instance of ProcessScheduler. */
STIX_ASSERT ((stix_oop_t)stix->processor != stix->_nil);
STIX_ASSERT (stix->processor->tally == STIX_SMOOI_TO_OOP(0));
/* start_initial_process() calls the SWITCH_ACTIVE_CONTEXT() macro.
* the macro assumes a non-null value in stix->active_context.
* let's force set active_context to ctx directly. */
stix->active_context = ctx;
ACTIVE_STACK_PUSH (stix, ass->value); /* push the receiver */
STORE_ACTIVE_IP (stix); /* stix->active_context->ip = STIX_SMOOI_TO_OOP(stix->ip) */
STORE_ACTIVE_SP (stix); /* stix->active_context->sp = STIX_SMOOI_TO_OOP(stix->sp) */
stix_pushtmp (stix, (stix_oop_t*)&ctx);
stix_pushtmp (stix, (stix_oop_t*)&mth);
/* call start_initial_process() instead of start_new_process() */
stix_pushtmp (stix, (stix_oop_t*)&ass);
proc = start_initial_process (stix, ctx);
stix_poptmp (stix);
stix_poptmps (stix, 3);
if (!proc) return -1;
ACTIVE_STACK_PUSH (stix, ass->value); /* push the receiver */
STORE_ACTIVE_SP (stix); /* stix->active_context->sp = STIX_SMOOI_TO_OOP(stix->sp) */
STIX_ASSERT (stix->processor->active == proc);
STIX_ASSERT (stix->processor->active->initial_context == ctx);
STIX_ASSERT (stix->processor->active->active_context == ctx);
STIX_ASSERT (stix->active_context == ctx);
/* emulate the message sending */
return activate_new_method (stix, mth);
}
@ -907,7 +930,6 @@ static int __block_value (stix_t* stix, stix_ooi_t nargs, stix_ooi_t num_first_a
stix_ooi_t local_ntmprs, i;
stix_ooi_t actual_arg_count;
actual_arg_count = (num_first_arg_elems > 0)? num_first_arg_elems: nargs;
/* TODO: find a better way to support a reentrant block context. */
@ -924,7 +946,7 @@ static int __block_value (stix_t* stix, stix_ooi_t nargs, stix_ooi_t num_first_a
if (STIX_CLASSOF(stix, org_blkctx) != stix->_block_context)
{
/* the receiver must be a block context */
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("PRIMITVE VALUE RECEIVER IS NOT A BLOCK CONTEXT\n");
#endif
return 0;
@ -938,7 +960,7 @@ printf ("PRIMITVE VALUE RECEIVER IS NOT A BLOCK CONTEXT\n");
* For example, [thisContext value] value.
*/
STIX_ASSERT (STIX_OBJ_GET_SIZE(org_blkctx) > STIX_CONTEXT_NAMED_INSTVARS);
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("PRIM REVALUING AN BLOCKCONTEXT\n");
#endif
return 0;
@ -948,15 +970,22 @@ printf ("PRIM REVALUING AN BLOCKCONTEXT\n");
if (STIX_OOP_TO_SMOOI(org_blkctx->method_or_nargs) != actual_arg_count /* nargs */)
{
/* the number of argument doesn't match */
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
/* TODO: better handling of primitive failure */
printf ("PRIM BlockContext value FAIL - NARGS MISMATCH\n");
#endif
return 0;
}
/* the number of temporaries stored in the block context
* accumulates the number of temporaries starting from the origin.
* simple calculation is needed to find the number of local temporaries */
local_ntmprs = STIX_OOP_TO_SMOOI(org_blkctx->ntmprs) -
STIX_OOP_TO_SMOOI(((stix_oop_context_t)org_blkctx->home)->ntmprs);
STIX_ASSERT (local_ntmprs >= actual_arg_count);
/* create a new block context to clone org_blkctx */
blkctx = (stix_oop_context_t) stix_instantiate (stix, stix->_block_context, STIX_NULL, CONTEXT_STACK_SIZE);
blkctx = (stix_oop_context_t) stix_instantiate (stix, stix->_block_context, STIX_NULL, local_ntmprs + CONTEXT_STACK_SIZE);
if (!blkctx) return -1;
/* get org_blkctx again to be GC-safe for stix_instantiate() above */
@ -976,9 +1005,6 @@ printf ("PRIM BlockContext value FAIL - NARGS MISMATCH\n");
blkctx->receiver_or_source = (stix_oop_t)org_blkctx;
blkctx->home = org_blkctx->home;
blkctx->origin = org_blkctx->origin;
#if defined(STIX_DEBUG_EXEC)
printf ("~~~~~~~~~~ BLOCK VALUING %p TO NEW BLOCK %p\n", org_blkctx, blkctx);
#endif
#endif
/* TODO: check the stack size of a block context to see if it's large enough to hold arguments */
@ -1005,18 +1031,9 @@ printf ("~~~~~~~~~~ BLOCK VALUING %p TO NEW BLOCK %p\n", org_blkctx, blkctx);
}
}
ACTIVE_STACK_POPS (stix, nargs + 1); /* pop arguments and receiver */
STIX_ASSERT (blkctx->home != stix->_nil);
/* the number of temporaries stored in the block context
* accumulates the number of temporaries starting from the origin.
* simple calculation is needed to find the number of local temporaries */
local_ntmprs = STIX_OOP_TO_SMOOI(blkctx->ntmprs) -
STIX_OOP_TO_SMOOI(((stix_oop_context_t)blkctx->home)->ntmprs);
STIX_ASSERT (local_ntmprs >= nargs);
blkctx->sp = STIX_SMOOI_TO_OOP(local_ntmprs);
blkctx->sp = STIX_SMOOI_TO_OOP(local_ntmprs - 1);
blkctx->sender = (stix_oop_t)stix->active_context;
*pblkctx = blkctx;
@ -1031,8 +1048,8 @@ static int prim_block_value (stix_t* stix, stix_ooi_t nargs)
x = __block_value (stix, nargs, 0, &blkctx);
if (x <= 0) return x; /* hard failure and soft failure */
#if defined(STIX_DEBUG_EXEC)
printf ("<<ENTERING BLOCK>>\n");
#if defined(STIX_DEBUG_EXEC_001)
printf ("<<ENTERING BLOCK>> SP=%ld\n", (long int)stix->sp);
#endif
SWITCH_ACTIVE_CONTEXT (stix, (stix_oop_context_t)blkctx);
return 1;
@ -2007,7 +2024,8 @@ static int send_message (stix_t* stix, stix_oop_char_t selector, int to_super, s
STIX_ASSERT (STIX_CLASSOF(stix, selector) == stix->_symbol);
receiver = ACTIVE_STACK_GET(stix, stix->sp - nargs);
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf (" RECEIVER = ");
print_object(stix, receiver);
printf ("\n");
@ -2687,7 +2705,7 @@ printf ("\n");
/* get the selector from the literal frame */
selector = (stix_oop_char_t)stix->active_method->slot[b2];
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("SEND_MESSAGE%s TO RECEIVER AT STACKPOS=%d NARGS=%d SELECTOR=", (((bcode >> 2) & 1)? "_TO_SUPER": ""), (int)(stix->sp - b1), (int)b1);
print_object (stix, (stix_oop_t)selector);
fflush (stdout);
@ -2784,7 +2802,7 @@ fflush (stdout);
return_value = stix->active_context->origin->receiver_or_source;
handle_return:
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("<<LEAVING>> SP=%d\n", (int)stix->sp);
#endif
@ -2847,10 +2865,16 @@ printf ("TERMINATING XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n");
/* the sending context of the intial context has been set to nil.
* use this fact to tell an initial context from a normal context. */
STIX_ASSERT (stix->active_context->receiver_or_source == stix->_nil);
#if defined(STIX_DEBUG_EXEC)
#if defined(STIX_DEBUG_EXEC_001)
printf ("<<<RETURNIGN TO THE INITIAL CONTEXT>>>\n");
#endif
printf ("TERMINATING SP.... %ld\n", (long int)stix->sp);
#if defined(STIX_USE_PROCSTK)
/* nothing special */
#else
STIX_ASSERT (stix->sp == 0);
#endif
goto done;
}
}
@ -2864,15 +2888,28 @@ printf ("<<<RETURNIGN TO THE INITIAL CONTEXT>>>\n");
if (stix->active_context == stix->processor->active->initial_context)
{
/* TODO: terminate the process */
/* TODO: terminate the process. can this happen? */
printf ("TERMINATE A PROCESS............\n");
/* **************************************** */
}
else
{
return_value = ACTIVE_STACK_GETTOP(stix);
#if defined(STIX_DEBUG_EXEC_001)
printf ("<<LEAVING BLOCK>>\n");
#endif
#if defined(STIX_USE_PROCSTK)
/* the process stack is shared. the return value
* doesn't need to get moved. */
SWITCH_ACTIVE_CONTEXT (stix, (stix_oop_context_t)stix->active_context->sender);
ACTIVE_STACK_PUSH (stix, return_value);
#else
/* NOTE: GC must not performed between here and */
return_value = ACTIVE_STACK_GETTOP(stix);
ACTIVE_STACK_POP (stix); /* pop off the return value */
SWITCH_ACTIVE_CONTEXT (stix, (stix_oop_context_t)stix->active_context->sender);
ACTIVE_STACK_PUSH (stix, return_value); /* push it to the sender */
/* NOTE: here. if so, return_value will point to a garbage. */
#endif
}
break;
@ -3048,7 +3085,11 @@ oops:
int stix_invoke (stix_t* stix, const stix_oocs_t* objname, const stix_oocs_t* mthname)
{
if (activate_initial_context (stix, objname, mthname) <= -1) return -1;
if (start_initial_process_and_context (stix, objname, mthname) <= -1) return -1;
return stix_execute (stix);
/* TODO: reset stix->active_context & stix->active_method to STIX_NULL
*
* TODO: remove the process. set processor->tally to zero. processor->active to nil_process...
*/
}

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -186,8 +186,7 @@ stix_oop_t stix_moveoop (stix_t* stix, stix_oop_t oop)
static stix_uint8_t* scan_new_heap (stix_t* stix, stix_uint8_t* ptr)
{
/*while (ptr < stix->newheap->ptr)*/
while (STIX_LTPTR(stix_uint8_t, ptr, stix->newheap->ptr))
while (ptr < stix->newheap->ptr)
{
stix_oow_t i;
stix_oow_t nbytes_aligned;
@ -225,11 +224,21 @@ static stix_uint8_t* scan_new_heap (stix_t* stix, stix_uint8_t* ptr)
if ((stix->_method_context && STIX_OBJ_GET_CLASS(oop) == stix->_method_context) ||
(stix->_block_context && STIX_OBJ_GET_CLASS(oop) == stix->_block_context))
{
/* the stack in the context object doesn't need to be
/* the stack in a context object doesn't need to be
* scanned in full. the slots above the stack pointer
* are garbages. */
size = STIX_CONTEXT_NAMED_INSTVARS +
STIX_OOP_TO_SMOOI(((stix_oop_context_t)oop)->sp) + 1;
STIX_ASSERT (size <= STIX_OBJ_GET_SIZE(oop));
}
else if (stix->_process && STIX_OBJ_GET_CLASS(oop) == stix->_process)
{
/* the stack in a process object doesn't need to be
* scanned in full. the slots above the stack pointer
* are garbages. */
size = STIX_PROCESS_NAMED_INSTVARS +
STIX_OOP_TO_SMOOI(((stix_oop_process_t)oop)->sp) + 1;
STIX_ASSERT (size <= STIX_OBJ_GET_SIZE(oop));
}
else
{
@ -244,8 +253,7 @@ static stix_uint8_t* scan_new_heap (stix_t* stix, stix_uint8_t* ptr)
}
}
/*ptr = ptr + STIX_SIZEOF(stix_obj_t) + nbytes_aligned;*/
ptr = STIX_INCPTR (stix_uint8_t, ptr, STIX_SIZEOF(stix_obj_t) + nbytes_aligned);
ptr = ptr + STIX_SIZEOF(stix_obj_t) + nbytes_aligned;
}
/* return the pointer to the beginning of the free space in the heap */
@ -268,14 +276,24 @@ void stix_gc (stix_t* stix)
if (stix->active_context)
{
/* store the stack pointer to the actual active context */
/* TODO: verify if this is correct */
#if defined(STIX_USE_PROCSTK)
/*STIX_ASSERT ((stix_oop_t)stix->processor != stix->_nil);
if ((stix_oop_t)stix->processor->active != stix->_nil)*/
stix->processor->active->sp = STIX_SMOOI_TO_OOP(stix->sp);
#else
/* store the stack pointer to the active context */
stix->active_context->sp = STIX_SMOOI_TO_OOP(stix->sp);
#endif
/* store the instruction pointer to the active context */
stix->active_context->ip = STIX_SMOOI_TO_OOP(stix->ip);
}
/*printf ("STARTING GC curheap base %p ptr %p newheap base %p ptr %p\n",
stix->curheap->base, stix->curheap->ptr, stix->newheap->base, stix->newheap->ptr);*/
#if defined(STIX_DEBUG_GC_002)
printf ("STARTING GC curheap base %p ptr %p newheap base %p ptr %p\n",
stix->curheap->base, stix->curheap->ptr, stix->newheap->base, stix->newheap->ptr);
#endif
/* TODO: allocate common objects like _nil and the root dictionary
* in the permanant heap. minimize moving around */
old_nil = stix->_nil;
@ -315,14 +333,17 @@ void stix_gc (stix_t* stix)
stix->sysdic = (stix_oop_set_t) stix_moveoop (stix, (stix_oop_t)stix->sysdic);
stix->processor = (stix_oop_process_scheduler_t) stix_moveoop (stix, (stix_oop_t)stix->processor);
stix->nil_process = (stix_oop_process_t) stix_moveoop (stix, (stix_oop_t)stix->nil_process);
for (i = 0; i < stix->tmp_count; i++)
{
*stix->tmp_stack[i] = stix_moveoop (stix, *stix->tmp_stack[i]);
}
stix->active_context = (stix_oop_context_t)stix_moveoop (stix, (stix_oop_t)stix->active_context);
stix->active_method = (stix_oop_method_t)stix_moveoop (stix, (stix_oop_t)stix->active_method);
if (stix->active_context)
stix->active_context = (stix_oop_context_t)stix_moveoop (stix, (stix_oop_t)stix->active_context);
if (stix->active_method)
stix->active_method = (stix_oop_method_t)stix_moveoop (stix, (stix_oop_t)stix->active_method);
for (cb = stix->cblist; cb; cb = cb->next)
{

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -42,11 +42,11 @@ stix_heap_t* stix_makeheap (stix_t* stix, stix_oow_t size)
heap->base = (stix_uint8_t*)(heap + 1);
/* adjust the initial allocation pointer to a multiple of the oop size */
heap->ptr = (stix_uint8_t*)STIX_ALIGN(((stix_uintptr_t)heap->base), STIX_SIZEOF(stix_oop_t));
heap->limit = STIX_INCPTR(stix_uint8_t, heap->base, size); /*heap->base + size;*/
heap->limit = heap->base + size;
STIX_ASSERT (heap->ptr >= heap->base);
STIX_ASSERT (STIX_GTPTR(stix_uint8_t, heap->limit, heap->base)); /* heap->limit >= heap->base */
STIX_ASSERT (STIX_SUBPTR(stix_uint8_t, heap->limit, heap->base) == size);
STIX_ASSERT (heap->limit >= heap->base );
STIX_ASSERT (heap->limit - heap->base == size);
/* if size is too small, heap->ptr may go past heap->limit even at
* this moment depending on the alignment of heap->base. subsequent
@ -65,10 +65,9 @@ void* stix_allocheapmem (stix_t* stix, stix_heap_t* heap, stix_oow_t size)
{
stix_uint8_t* ptr;
//printf ("heap ptr %p %p %lld %lld\n", heap->ptr, heap->limit, (long long int)size, (long long int)(heap->limit - heap->ptr));
/* check the heap size limit */
/*if (heap->ptr >= heap->limit || heap->limit - heap->ptr < size)*/
if (STIX_GEPTR(stix_uint8_t, heap->ptr, heap->limit) ||
STIX_SUBPTR(stix_uint8_t, heap->limit, heap->ptr) < size)
if (heap->ptr >= heap->limit || heap->limit - heap->ptr < size)
{
stix->errnum = STIX_EOOMEM;
return STIX_NULL;
@ -76,7 +75,7 @@ void* stix_allocheapmem (stix_t* stix, stix_heap_t* heap, stix_oow_t size)
/* allocation is as simple as moving the heap pointer */
ptr = heap->ptr;
heap->ptr = STIX_INCPTR (stix_uint8_t, heap->ptr, size); /*heap->ptr += size;*/
heap->ptr += size;
return ptr;
}

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -197,12 +197,21 @@ static int ignite_2 (stix_t* stix)
if (!tmp) return -1;
stix->sysdic = (stix_oop_set_t)tmp;
/* Create a nil process used to simplify nil check in GC.
* only accessible by VM. not exported via the global dictionary. */
tmp = (stix_oop_t)stix_instantiate (stix, stix->_process, STIX_NULL, 0);
if (!tmp) return -1;
stix->nil_process = (stix_oop_process_t)tmp;
stix->nil_process->sp = STIX_SMOOI_TO_OOP(-1);
/* Create a process scheduler */
tmp = (stix_oop_t)stix_instantiate (stix, stix->_process_scheduler, STIX_NULL, 0);
if (!tmp) return -1;
stix->processor = (stix_oop_process_scheduler_t)tmp;
/* initialize the tally field to 0, keep other fields as nils */
stix->processor->tally = STIX_SMOOI_TO_OOP(0);
stix->processor->active = stix->nil_process;
/* Export the system dictionary via the first class variable of the Stix class */
((stix_oop_class_t)stix->_apex)->slot[0] = (stix_oop_t)stix->sysdic;

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -434,7 +434,7 @@ int main (int argc, char* argv[])
lt_dlinit ();
#endif
stix = stix_open (&sys_mmgr, STIX_SIZEOF(xtn_t), 512000lu, &vmprim, STIX_NULL);
stix = stix_open (&sys_mmgr, STIX_SIZEOF(xtn_t), 2048000lu, &vmprim, STIX_NULL);
if (!stix)
{
printf ("cannot open stix\n");
@ -449,7 +449,7 @@ int main (int argc, char* argv[])
stix_setoption (stix, STIX_SYMTAB_SIZE, &tab_size);
tab_size = 5000;
stix_setoption (stix, STIX_SYSDIC_SIZE, &tab_size);
tab_size = 5000;
tab_size = 60;
stix_setoption (stix, STIX_PROCSTK_SIZE, &tab_size);
}

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -15,6 +15,30 @@
/* Define to 1 if you have the `acosq' function. */
#undef HAVE_ACOSQ
/* Define to 1 if you have the `argz_add' function. */
#undef HAVE_ARGZ_ADD
/* Define to 1 if you have the `argz_append' function. */
#undef HAVE_ARGZ_APPEND
/* Define to 1 if you have the `argz_count' function. */
#undef HAVE_ARGZ_COUNT
/* Define to 1 if you have the `argz_create_sep' function. */
#undef HAVE_ARGZ_CREATE_SEP
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define to 1 if you have the `argz_insert' function. */
#undef HAVE_ARGZ_INSERT
/* Define to 1 if you have the `argz_next' function. */
#undef HAVE_ARGZ_NEXT
/* Define to 1 if you have the `argz_stringify' function. */
#undef HAVE_ARGZ_STRINGIFY
/* Define to 1 if you have the `asin' function. */
#undef HAVE_ASIN
@ -69,6 +93,9 @@
/* Define to 1 if you have the `ceilq' function. */
#undef HAVE_CEILQ
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
/* Define to 1 if you have the `connect' function. */
#undef HAVE_CONNECT
@ -102,6 +129,13 @@
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
/* Define if c++ supports namespace std. */
#undef HAVE_CXX_NAMESPACE_STD
/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if
you don't. */
#undef HAVE_DECL_CYGWIN_CONV_PATH
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
@ -115,6 +149,24 @@
/* Define to 1 if `d_fd' is a member of `DIR'. */
#undef HAVE_DIR_D_FD
/* Define if you have the GNU dld library. */
#undef HAVE_DLD
/* Define to 1 if you have the <dld.h> header file. */
#undef HAVE_DLD_H
/* Define to 1 if you have the `dlerror' function. */
#undef HAVE_DLERROR
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H
/* Define if you have the _dyld_func_lookup function. */
#undef HAVE_DYLD
/* Define to 1 if you have the `ENGINE_cleanup' function. */
#undef HAVE_ENGINE_CLEANUP
@ -130,6 +182,9 @@
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if the system has the type `error_t'. */
#undef HAVE_ERROR_T
/* Define to 1 if you have the <execinfo.h> header file. */
#undef HAVE_EXECINFO_H
@ -253,6 +308,12 @@
/* Define to 1 if you have the `kqueue1' function. */
#undef HAVE_KQUEUE1
/* Define if you have the libdl library or equivalent. */
#undef HAVE_LIBDL
/* Define if libdlloader will be built on this platform */
#undef HAVE_LIBDLLOADER
/* Define to 1 if you have the `ltdl' library (-lltdl). */
#undef HAVE_LIBLTDL
@ -301,9 +362,15 @@
/* Define to 1 if you have the `lstat64' function. */
#undef HAVE_LSTAT64
/* Define this if a modern libltdl is already installed */
#undef HAVE_LTDL
/* Define to 1 if you have the `lutimes' function. */
#undef HAVE_LUTIMES
/* Define to 1 if you have the <mach-o/dyld.h> header file. */
#undef HAVE_MACH_O_DYLD_H
/* Define to 1 if you have the `makecontext' function. */
#undef HAVE_MAKECONTEXT
@ -337,6 +404,9 @@
/* Define to 1 if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define to 1 if you have the `opendir' function. */
#undef HAVE_OPENDIR
/* Define to 1 if you have the <openssl/engine.h> header file. */
#undef HAVE_OPENSSL_ENGINE_H
@ -364,12 +434,18 @@
/* Define to 1 if you have the `prctl' function. */
#undef HAVE_PRCTL
/* Define if libtool can extract symbol lists from object files. */
#undef HAVE_PRELOADED_SYMBOLS
/* Define to 1 if you have the <quadmath.h> header file. */
#undef HAVE_QUADMATH_H
/* Define to 1 if you have the `quadmath_snprintf' function. */
#undef HAVE_QUADMATH_SNPRINTF
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
/* Define to 1 if you have the `readdir64' function. */
#undef HAVE_READDIR64
@ -409,6 +485,9 @@
/* Define to 1 if you have the `settimeofday' function. */
#undef HAVE_SETTIMEOFDAY
/* Define if you have the shl_load function. */
#undef HAVE_SHL_LOAD
/* Define to 1 if you have the <signal.h> header file. */
#undef HAVE_SIGNAL_H
@ -478,6 +557,12 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the `strtoflt128' function. */
#undef HAVE_STRTOFLT128
@ -530,6 +615,9 @@
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/dl.h> header file. */
#undef HAVE_SYS_DL_H
/* Define to 1 if you have the <sys/epoll.h> header file. */
#undef HAVE_SYS_EPOLL_H
@ -675,6 +763,9 @@
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* This value is set to 1 to indicate that the system argz facility works */
#undef HAVE_WORKING_ARGZ
/* Define to 1 if you have the `_vsnprintf' function. */
#undef HAVE__VSNPRINTF
@ -696,6 +787,41 @@
/* __va_copy is available */
#undef HAVE___VA_COPY
/* Define if the OS needs help to load dependent libraries for dlopen(). */
#undef LTDL_DLOPEN_DEPLIBS
/* Define to the system default library search path. */
#undef LT_DLSEARCH_PATH
/* The archive extension */
#undef LT_LIBEXT
/* The archive prefix */
#undef LT_LIBPREFIX
/* Define to the extension used for runtime loadable modules, say, ".so". */
#undef LT_MODULE_EXT
/* Define to the name of the environment variable that determines the run-time
module search path. */
#undef LT_MODULE_PATH_VAR
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Define to the shared library suffix, say, ".dylib". */
#undef LT_SHARED_EXT
/* Define if dlsym() requires a leading underscore in symbol names. */
#undef NEED_USCORE
/* The size of `MB_LEN_MAX', as computed by valueof. */
#undef NUMVALOF_MB_LEN_MAX
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
@ -909,6 +1035,12 @@
/* sizeof(__int8) */
#undef STIX_SIZEOF___INT8
/* Define if socklen_t is signed */
#undef STIX_SOCKLEN_T_IS_SIGNED
/* Version number of package */
#undef VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
@ -920,3 +1052,9 @@
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define so that glibc/gnulib argp.h does not typedef error_t. */
#undef __error_t_defined
/* Define to a type to use for `error_t' if it is not otherwise available. */
#undef error_t

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) s2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -374,34 +374,6 @@ typedef stix_ucs_t stix_oocs_t;
/*#define STIX_BITS_MAX(type,nbits) ((((type)1) << (nbits)) - 1)*/
#define STIX_BITS_MAX(type,nbits) ((~(type)0) >> (STIX_SIZEOF(type) * 8 - (nbits)))
/* =========================================================================
* POINTER MANIPULATION MACROS
* ========================================================================= */
/*
#if defined(__MSDOS__)
# define STIX_INCPTR(type,base,inc) (((type __huge*)base) + (inc))
# define STIX_DECPTR(type,base,inc) (((type __huge*)base) - (inc))
# define STIX_GTPTR(type,ptr1,ptr2) (((type __huge*)ptr1) > ((type __huge*)ptr2))
# define STIX_GEPTR(type,ptr1,ptr2) (((type __huge*)ptr1) >= ((type __huge*)ptr2))
# define STIX_LTPTR(type,ptr1,ptr2) (((type __huge*)ptr1) < ((type __huge*)ptr2))
# define STIX_LEPTR(type,ptr1,ptr2) (((type __huge*)ptr1) <= ((type __huge*)ptr2))
# define STIX_EQPTR(type,ptr1,ptr2) (((type __huge*)ptr1) == ((type __huge*)ptr2))
# define STIX_SUBPTR(type,ptr1,ptr2) (((type __huge*)ptr1) - ((type __huge*)ptr2))
#else
*/
# define STIX_INCPTR(type,base,inc) (((type*)base) + (inc))
# define STIX_DECPTR(type,base,inc) (((type*)base) - (inc))
# define STIX_GTPTR(type,ptr1,ptr2) (((type*)ptr1) > ((type*)ptr2))
# define STIX_GEPTR(type,ptr1,ptr2) (((type*)ptr1) >= ((type*)ptr2))
# define STIX_LTPTR(type,ptr1,ptr2) (((type*)ptr1) < ((type*)ptr2))
# define STIX_LEPTR(type,ptr1,ptr2) (((type*)ptr1) <= ((type*)ptr2))
# define STIX_EQPTR(type,ptr1,ptr2) (((type*)ptr1) == ((type*)ptr2))
# define STIX_SUBPTR(type,ptr1,ptr2) (((type*)ptr1) - ((type*)ptr2))
/*
#endif
*/
/* =========================================================================
* MMGR
* ========================================================================= */

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -49,12 +49,19 @@
* object instead of putting in in a separate byte array. */
#define STIX_USE_OBJECT_TRAILER
/* define this to use the stack allocated inside process stack */
#define STIX_USE_PROCSTK
/* this is for gc debugging */
/*#define STIX_DEBUG_PROCESSOR*/
#define STIX_DEBUG_GC_001
/*#define STIX_DEBUG_EXEC*/
/*#define STIX_DEBUG_GC_002*/
#define STIX_DEBUG_COMP_001
/*#define STIX_DEBUG_EXEC_001*/
/*#define STIX_DEBUG_EXEC_002*/
#define STIX_PROFILE_EXEC
/* limit the maximum object size such that:
* 1. an index to an object field can be represented in a small integer.
* 2. the maximum number of bits including bit-shifts can be represented

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -542,12 +542,10 @@ struct stix_process_t
STIX_OBJ_HEADER;
stix_oop_context_t initial_context;
stix_oop_context_t active_context;
stix_oop_t state;
stix_oop_t state; /* SmallInteger */
stix_oop_process_t prev;
stix_oop_process_t next;
/* stack pointer. SmallInteger */
stix_oop_t sp;
stix_oop_t sp; /* stack pointer. SmallInteger */
/* == variable indexed part == */
stix_oop_t slot[1]; /* process stack */
@ -749,6 +747,7 @@ struct stix_t
stix_oop_set_t symtab; /* system-wide symbol table. instance of SymbolSet */
stix_oop_set_t sysdic; /* system dictionary. instance of SystemDictionary */
stix_oop_process_scheduler_t processor; /* instance of ProcessScheduler */
stix_oop_process_t nil_process; /* instance of Process */
stix_oop_t* tmp_stack[256]; /* stack for temporaries */
stix_oow_t tmp_count;

View File

@ -1,7 +1,7 @@
/*
* $Id$
*
Copyright (c) 2014-2015 Chung, Hyung-Hwan. All rights reserved.
Copyright (c) 2014-2016 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions