aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 00:20:28 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-23 00:20:28 +0000
commit8cd252ac6f3fd2d2eb3524880bf45767490bed70 (patch)
treef7ab9657e81a7ea8b79696c2f0f1e0f9ca184d13
parentf398d750ea3450762c0ba10c5dea4522d4676360 (diff)
downloadruby-8cd252ac6f3fd2d2eb3524880bf45767490bed70.tar.gz
* common.mk: clean up
- remove blockinlining.$(OBJEXT) to built - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h) - make VM_CORE_H_INCLUDES variable (vm_core.h) - simplify rules. - make depends rule to output depend status using gcc -MM. * include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h. * include/ruby.h: ditto. * load.c: add inclusion explicitly. * enumerator.c, object.c, parse.y, thread.c, vm_dump.c: remove useless inclusion. * eval_intern.h: cleanup inclusion. * vm_core.h: rb_thread_t should be defined in this file. * vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c. * vm.h, vm_exec.h: rename vm.h to vm_exec.h. * insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h. * vm.c, vm_insnhelper.c, vm_insnhelper.h: - rename vm_eval() to vm_exec_core(). - rename vm_eval_body() to vm_exec(). - cleanup include order. * vm_method.c: fix comment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog35
-rw-r--r--common.mk316
-rw-r--r--enumerator.c1
-rw-r--r--eval_intern.h10
-rw-r--r--include/ruby.h4
-rw-r--r--include/ruby/vm.h (renamed from include/ruby/mvm.h)6
-rw-r--r--load.c3
-rw-r--r--object.c1
-rw-r--r--parse.y1
-rw-r--r--thread.c1
-rw-r--r--vm.c73
-rw-r--r--vm_core.h6
-rw-r--r--vm_dump.c5
-rw-r--r--vm_eval.c12
-rw-r--r--vm_exec.c (renamed from vm_evalbody.c)28
-rw-r--r--vm_exec.h (renamed from vm.h)70
-rw-r--r--vm_insnhelper.c32
-rw-r--r--vm_insnhelper.h (renamed from insnhelper.h)53
-rw-r--r--vm_method.c3
19 files changed, 284 insertions, 376 deletions
diff --git a/ChangeLog b/ChangeLog
index b6f00ccfe6..e2ecd26af7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+Tue Sep 23 09:20:00 2008 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: clean up
+ - remove blockinlining.$(OBJEXT) to built
+ - make ENCODING_H_INCLDUES variable (include/ruby/encoding.h)
+ - make VM_CORE_H_INCLUDES variable (vm_core.h)
+ - simplify rules.
+ - make depends rule to output depend status using gcc -MM.
+
+ * include/ruby/mvm.h, include/ruby/vm.h: rename mvm.h to vm.h.
+
+ * include/ruby.h: ditto.
+
+ * load.c: add inclusion explicitly.
+
+ * enumerator.c, object.c, parse.y, thread.c, vm_dump.c:
+ remove useless inclusion.
+
+ * eval_intern.h: cleanup inclusion.
+
+ * vm_core.h: rb_thread_t should be defined in this file.
+
+ * vm_evalbody.c, vm_exec.c: rename vm_evalbody.c to vm_exec.c.
+
+ * vm.h, vm_exec.h: rename vm.h to vm_exec.h.
+
+ * insnhelper.h, vm_insnhelper.h: rename insnhelper.h to vm_insnhelper.h.
+
+ * vm.c, vm_insnhelper.c, vm_insnhelper.h:
+ - rename vm_eval() to vm_exec_core().
+ - rename vm_eval_body() to vm_exec().
+ - cleanup include order.
+
+ * vm_method.c: fix comment.
+
Tue Sep 23 09:01:15 2008 Yusuke Endoh <mame@tsg.ne.jp>
* lib/pathname.rb (each_filename): return Enumerator if no block
diff --git a/common.mk b/common.mk
index 81653aec51..0d9e4d4eda 100644
--- a/common.mk
+++ b/common.mk
@@ -71,7 +71,6 @@ COMMONOBJS = array.$(OBJEXT) \
util.$(OBJEXT) \
variable.$(OBJEXT) \
version.$(OBJEXT) \
- blockinlining.$(OBJEXT) \
compile.$(OBJEXT) \
debug.$(OBJEXT) \
iseq.$(OBJEXT) \
@@ -435,232 +434,133 @@ win32.$(OBJEXT): {$(VPATH)}win32.c
###
-RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \
- {$(VPATH)}intern.h {$(VPATH)}missing.h
-ID_H_INCLUDES = {$(VPATH)}id.h {$(VPATH)}parse.h
-
-array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}util.h
-bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
-class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}id.h \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.h \
- {$(VPATH)}parse.y
-compar.$(OBJEXT): {$(VPATH)}compar.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
-complex.$(OBJEXT): {$(VPATH)}complex.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}mvm.h
-dir.$(OBJEXT): {$(VPATH)}dir.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}util.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
-dln.$(OBJEXT): {$(VPATH)}dln.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}dln.h
+RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \
+ {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h
+ENCODING_H_INCLDUES= {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
+ID_H_INCLUDES = {$(VPATH)}id.h {$(VPATH)}parse.h
+VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}vm_opts.h \
+ {$(VPATH)}vm.h {$(VPATH)}thread_$(THREAD_MODEL).h \
+ {$(VPATH)}node.h $(ID_H_INCLUDES)
+
+array.$(OBJEXT): {$(VPATH)}array.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
+bignum.$(OBJEXT): {$(VPATH)}bignum.c $(RUBY_H_INCLUDES)
+class.$(OBJEXT): {$(VPATH)}class.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES)
+compar.$(OBJEXT): {$(VPATH)}compar.c $(RUBY_H_INCLUDES)
+complex.$(OBJEXT): {$(VPATH)}complex.c $(RUBY_H_INCLUDES)
+dir.$(OBJEXT): {$(VPATH)}dir.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLDUES)
+dln.$(OBJEXT): {$(VPATH)}dln.c {$(VPATH)}dln.h $(RUBY_H_INCLUDES)
dmydln.$(OBJEXT): {$(VPATH)}dmydln.c dln.$(OBJEXT)
dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
-dmyencoding.$(OBJEXT): {$(VPATH)}dmyencoding.c {$(VPATH)}encoding.c \
- $(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}encoding.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}regenc.h {$(VPATH)}util.h
+dmyencoding.$(OBJEXT): {$(VPATH)}dmyencoding.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}regenc.h {$(VPATH)}util.h $(ENCODING_H_INCLDUES)
encoding.$(OBJEXT): {$(VPATH)}encoding.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}regenc.h {$(VPATH)}util.h
-enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
+ $(ENCODING_H_INCLDUES) {$(VPATH)}regenc.h {$(VPATH)}util.h
+enum.$(OBJEXT): {$(VPATH)}enum.c $(RUBY_H_INCLUDES) \
{$(VPATH)}node.h {$(VPATH)}util.h
enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}debug.h {$(VPATH)}node.h
-error.$(OBJEXT): {$(VPATH)}error.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}vm_core.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
+ {$(VPATH)}node.h
+error.$(OBJEXT): {$(VPATH)}error.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES)
eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}eval_intern.h \
- $(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
- {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}dln.h {$(VPATH)}eval_error.c {$(VPATH)}eval_safe.c \
- {$(VPATH)}eval_jump.c {$(VPATH)}mvm.h {$(VPATH)}parse.y
+ $(RUBY_H_INCLUDES) {$(VPATH)}util.h $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}eval_error.c {$(VPATH)}eval_safe.c {$(VPATH)}eval_jump.c
load.$(OBJEXT): {$(VPATH)}load.c {$(VPATH)}eval_intern.h \
- $(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
- {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}dln.h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}io.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}util.h {$(VPATH)}dln.h
-gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}re.h {$(VPATH)}regex.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}io.h {$(VPATH)}encoding.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h \
- $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}gc.h \
- {$(VPATH)}eval_intern.h {$(VPATH)}util.h {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y {$(VPATH)}dln.h
-hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) $(ID_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}util.h \
- {$(VPATH)}eval_intern.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}mvm.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}parse.y \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h
-inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
-io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}io.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}util.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h {$(VPATH)}id.h \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}node.h \
- {$(VPATH)}parse.h {$(VPATH)}parse.y
-main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}mvm.h
-marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}io.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}util.h
-math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
-numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
-object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}util.h {$(VPATH)}debug.h {$(VPATH)}node.h
-pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
+ {$(VPATH)}util.h $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES)
+file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
+ $(ENCODING_H_INCLDUES) {$(VPATH)}util.h {$(VPATH)}dln.h
+gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}re.h {$(VPATH)}regex.h \
+ $(ENCODING_H_INCLDUES) $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h
+hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ {$(VPATH)}eval_intern.h $(VM_CORE_H_INCLUDES)
+inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES)
+io.$(OBJEXT): {$(VPATH)}io.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
+ {$(VPATH)}util.h $(VM_CORE_H_INCLUDES) $(ENCODING_H_INCLDUES)
+main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}vm.h
+marshal.$(OBJEXT): {$(VPATH)}marshal.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}io.h $(ENCODING_H_INCLDUES) {$(VPATH)}util.h
+math.$(OBJEXT): {$(VPATH)}math.c $(RUBY_H_INCLUDES)
+numeric.$(OBJEXT): {$(VPATH)}numeric.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLDUES)
+object.$(OBJEXT): {$(VPATH)}object.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
+pack.$(OBJEXT): {$(VPATH)}pack.c $(RUBY_H_INCLUDES)
parse.$(OBJEXT): {$(VPATH)}parse.c {$(VPATH)}parse.y $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}encoding.h \
- {$(VPATH)}oniguruma.h $(ID_H_INCLUDES) {$(VPATH)}regenc.h \
+ {$(VPATH)}node.h $(ENCODING_H_INCLDUES) $(ID_H_INCLUDES) {$(VPATH)}regenc.h \
{$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c {$(VPATH)}keywords \
- {$(VPATH)}debug.h {$(VPATH)}id.c
-proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h \
- $(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
- {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}dln.h {$(VPATH)}gc.h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}vm_core.h {$(VPATH)}util.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}io.h {$(VPATH)}encoding.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}mvm.h {$(VPATH)}parse.y {$(VPATH)}dln.h
-random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
-range.$(OBJEXT): {$(VPATH)}range.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
-rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}mvm.h
-re.$(OBJEXT): {$(VPATH)}re.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}re.h {$(VPATH)}regex.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}encoding.h {$(VPATH)}util.h {$(VPATH)}regint.h \
- {$(VPATH)}regenc.h
-regcomp.$(OBJEXT): {$(VPATH)}regcomp.c {$(VPATH)}regparse.h \
- {$(VPATH)}regint.h {$(VPATH)}config.h {$(VPATH)}defines.h \
- {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
-regenc.$(OBJEXT): {$(VPATH)}regenc.c {$(VPATH)}regint.h \
- {$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
+ {$(VPATH)}id.c
+proc.$(OBJEXT): {$(VPATH)}proc.c {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
+ $(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES)
+process.$(OBJEXT): {$(VPATH)}process.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}util.h {$(VPATH)}io.h $(ENCODING_H_INCLDUES) \
+ {$(VPATH)}dln.h $(VM_CORE_H_INCLUDES)
+random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES)
+range.$(OBJEXT): {$(VPATH)}range.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLDUES)
+rational.$(OBJEXT): {$(VPATH)}rational.c $(RUBY_H_INCLUDES)
+re.$(OBJEXT): {$(VPATH)}re.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}re.h {$(VPATH)}regex.h $(ENCODING_H_INCLDUES) \
+ {$(VPATH)}util.h {$(VPATH)}regint.h {$(VPATH)}regenc.h
+regcomp.$(OBJEXT): {$(VPATH)}regcomp.c {$(VPATH)}regparse.h {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
+regenc.$(OBJEXT): {$(VPATH)}regenc.c {$(VPATH)}regint.h {$(VPATH)}regenc.h \
+ $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
regerror.$(OBJEXT): {$(VPATH)}regerror.c {$(VPATH)}regint.h \
- {$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
+ {$(VPATH)}regenc.h $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
regexec.$(OBJEXT): {$(VPATH)}regexec.c {$(VPATH)}regint.h \
- {$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
+ {$(VPATH)}regenc.h $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
regparse.$(OBJEXT): {$(VPATH)}regparse.c {$(VPATH)}regparse.h \
- {$(VPATH)}regint.h {$(VPATH)}config.h {$(VPATH)}defines.h \
- {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
+ {$(VPATH)}regint.h {$(VPATH)}regenc.h $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
regsyntax.$(OBJEXT): {$(VPATH)}regsyntax.c {$(VPATH)}regint.h \
- {$(VPATH)}config.h {$(VPATH)}defines.h {$(VPATH)}regenc.h \
- {$(VPATH)}oniguruma.h {$(VPATH)}st.h {$(VPATH)}ruby.h \
- {$(VPATH)}missing.h {$(VPATH)}intern.h
-ruby.$(OBJEXT): {$(VPATH)}ruby.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h {$(VPATH)}vm_opts.h \
- $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h \
- {$(VPATH)}mvm.h {$(VPATH)}parse.y
-signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}re.h {$(VPATH)}regex.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}encoding.h {$(VPATH)}vsnprintf.c
+ {$(VPATH)}regenc.h $(ENCODING_H_INCLDUES) $(RUBY_H_INCLUDES)
+ruby.$(OBJEXT): {$(VPATH)}ruby.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
+ $(ENCODING_H_INCLDUES) {$(VPATH)}eval_intern.h \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}dln.h
+signal.$(OBJEXT): {$(VPATH)}signal.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES)
+sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
+ {$(VPATH)}regex.h {$(VPATH)}vsnprintf.c $(ENCODING_H_INCLDUES)
st.$(OBJEXT): {$(VPATH)}st.c {$(VPATH)}config.h {$(VPATH)}defines.h \
{$(VPATH)}st.h
-strftime.$(OBJEXT): {$(VPATH)}strftime.c {$(VPATH)}config.h \
- {$(VPATH)}ruby.h {$(VPATH)}defines.h {$(VPATH)}missing.h \
- {$(VPATH)}intern.h {$(VPATH)}st.h
-string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}re.h {$(VPATH)}regex.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}encoding.h
-struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h
+strftime.$(OBJEXT): {$(VPATH)}strftime.c $(RUBY_H_INCLDUES)
+string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) \
+ {$(VPATH)}re.h {$(VPATH)}regex.h $(ENCODING_H_INCLDUES)
+struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES)
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
- $(RUBY_H_INCLUDES) {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h \
- {$(VPATH)}vm_core.h {$(VPATH)}debug.h \
- {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}dln.h {$(VPATH)}vm.h {$(VPATH)}gc.h \
- {$(VPATH)}thread_$(THREAD_MODEL).c {$(VPATH)}mvm.h {$(VPATH)}parse.y
+ $(RUBY_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES)
transcode.$(OBJEXT): {$(VPATH)}transcode.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}transcode_data.h
-cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}vm_core.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}gc.h \
- {$(VPATH)}eval_intern.h {$(VPATH)}util.h {$(VPATH)}dln.h {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y
-time.$(OBJEXT): {$(VPATH)}time.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h
-util.$(OBJEXT): {$(VPATH)}util.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}util.h
+ $(ENCODING_H_INCLDUES) {$(VPATH)}transcode_data.h
+cont.$(OBJEXT): {$(VPATH)}cont.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}gc.h {$(VPATH)}eval_intern.h
+time.$(OBJEXT): {$(VPATH)}time.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLDUES)
+util.$(OBJEXT): {$(VPATH)}util.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h
variable.$(OBJEXT): {$(VPATH)}variable.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}util.h
-version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
+ {$(VPATH)}node.h {$(VPATH)}util.h
+version.$(OBJEXT): {$(VPATH)}version.c $(RUBY_H_INCLUDES) \
{$(VPATH)}version.h $(srcdir)/revision.h
-compile.$(OBJEXT): {$(VPATH)}compile.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}compile.h \
- {$(VPATH)}insns.inc {$(VPATH)}insns_info.inc {$(VPATH)}optinsn.inc \
- {$(VPATH)}mvm.h {$(VPATH)}parse.y
-iseq.$(OBJEXT): {$(VPATH)}iseq.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}gc.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}insns.inc \
- {$(VPATH)}insns_info.inc {$(VPATH)}node_name.inc {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y
-vm.$(OBJEXT): {$(VPATH)}vm.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h \
- {$(VPATH)}gc.h {$(VPATH)}insnhelper.h {$(VPATH)}eval_intern.h \
- {$(VPATH)}util.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}dln.h {$(VPATH)}vm.h \
- {$(VPATH)}vm_insnhelper.c {$(VPATH)}insns.inc {$(VPATH)}vm_evalbody.c \
- {$(VPATH)}vmtc.inc {$(VPATH)}vm.inc {$(VPATH)}insns.def \
- {$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y
-vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}vm.h {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y
-debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h {$(VPATH)}debug.h \
- {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) {$(VPATH)}thread_$(THREAD_MODEL).h \
- {$(VPATH)}util.h {$(VPATH)}eval_intern.h {$(VPATH)}mvm.h \
- {$(VPATH)}parse.y {$(VPATH)}dln.h
-blockinlining.$(OBJEXT): {$(VPATH)}blockinlining.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}node.h {$(VPATH)}vm_core.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h $(ID_H_INCLUDES)
+compile.$(OBJEXT): {$(VPATH)}compile.c {$(VPATH)}compile.h \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}insns.inc {$(VPATH)}insns_info.inc {$(VPATH)}optinsn.inc
+iseq.$(OBJEXT): {$(VPATH)}iseq.c {$(VPATH)}gc.h \
+ $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}insns.inc {$(VPATH)}insns_info.inc {$(VPATH)}node_name.inc
+vm.$(OBJEXT): {$(VPATH)}vm.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLDUES) \
+ {$(VPATH)}gc.h {$(VPATH)}eval_intern.h $(VM_CORE_H_INCLUDES) \
+ {$(VPATH)}vm_method.c {$(VPATH)}vm_eval.c \
+ {$(VPATH)}vm_insnhelper.c {$(VPATH)}vm_insnhelper.h \
+ {$(VPATH)}vm_exec.c {$(VPATH)}vm_exec.h \
+ {$(VPATH)}insns.def {$(VPATH)}vmtc.inc {$(VPATH)}vm.inc {$(VPATH)}insns.inc
+vm_dump.$(OBJEXT): {$(VPATH)}vm_dump.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES)
+debug.$(OBJEXT): {$(VPATH)}debug.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLDUES) \
+ $(VM_CORE_H_INCLUDES) {$(VPATH)}eval_intern.h
+id.$(OBJEXT): {$(VPATH)}id.c $(RUBY_H_INCLUDES) $(ID_H_INCLUDES)
miniprelude.$(OBJEXT): {$(VPATH)}miniprelude.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-prelude.$(OBJEXT): {$(VPATH)}prelude.c $(RUBY_H_INCLUDES) {$(VPATH)}st.h \
- {$(VPATH)}vm_core.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
-golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}vm_core.h {$(VPATH)}node.h \
- {$(VPATH)}debug.h {$(VPATH)}vm_opts.h $(ID_H_INCLUDES) \
- {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}mvm.h {$(VPATH)}parse.y
+ $(VM_CORE_H_INCLUDES)
+prelude.$(OBJEXT): {$(VPATH)}prelude.c $(RUBY_H_INCLUDES) \
+ $(VM_CORE_H_INCLUDES)
+golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c $(RUBY_H_INCLUDES)\
+ $(VM_CORE_H_INCLUDES)
goruby.$(OBJEXT): {$(VPATH)}goruby.c {$(VPATH)}main.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}st.h {$(VPATH)}mvm.h
+ {$(VPATH)}vm.h
ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
{$(VPATH)}defines.h {$(VPATH)}oniguruma.h
@@ -812,6 +712,12 @@ up:
@$(VCS) up "$(srcdir)"
-@$(MAKE) $(MFLAGS) REVISION_FORCE=PHONY "$(srcdir)/revision.h"
+depends: PHONY
+ gcc $(XCFLAGS) -MM $(srcdir)/*.c > depends.txt
+
+vm_test.o: vm_test.c $(RUBY_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
+ vm_exec.c vm_insnhelper.c vm_insnhelper.h
+
help: PHONY
@echo " Makefile of Ruby"
@echo ""
diff --git a/enumerator.c b/enumerator.c
index f7fbd7218c..60b2a55cb8 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -13,7 +13,6 @@
************************************************/
#include "ruby/ruby.h"
-#include "debug.h"
/*
* Document-class: Enumerator
diff --git a/eval_intern.h b/eval_intern.h
index 5878e4a2e1..dbfcb66300 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -2,6 +2,8 @@
#ifndef RUBY_EVAL_INTERN_H
#define RUBY_EVAL_INTERN_H
+#include "vm_core.h"
+
#define PASS_PASSED_BLOCK_TH(th) do { \
(th)->passed_block = GC_GUARDED_PTR_REF((rb_block_t *)(th)->cfp->lfp[0]); \
(th)->cfp->flag |= VM_FRAME_FLAG_PASSED; \
@@ -12,11 +14,6 @@
PASS_PASSED_BLOCK_TH(__th__); \
} while (0)
-#include "ruby/ruby.h"
-#include "ruby/node.h"
-#include "ruby/util.h"
-#include "vm_core.h"
-
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@ -30,9 +27,6 @@
#include <stdio.h>
#include <setjmp.h>
-#include "ruby/st.h"
-#include "dln.h"
-
#ifdef __APPLE__
#include <crt_externs.h>
#endif
diff --git a/include/ruby.h b/include/ruby.h
index 2cb3fbf9f7..9fe6eb3c7f 100644
--- a/include/ruby.h
+++ b/include/ruby.h
@@ -31,9 +31,5 @@
#endif
#include "ruby/ruby.h"
-#if RUBY_VM
-#include "ruby/mvm.h"
-#endif
-extern void ruby_set_debug_option(const char *);
#endif /* RUBY_H */
diff --git a/include/ruby/mvm.h b/include/ruby/vm.h
index 24b8cb3fb4..cac13b51cb 100644
--- a/include/ruby/mvm.h
+++ b/include/ruby/vm.h
@@ -1,6 +1,6 @@
/**********************************************************************
- ruby/mvm.h -
+ ruby/vm.h -
$Author$
created at: Sat May 31 15:17:36 2008
@@ -13,9 +13,5 @@
#define RUBY_MVM_H 1
typedef struct rb_vm_struct rb_vm_t;
-typedef struct rb_thread_struct rb_thread_t;
-
-VALUE *ruby_vm_verbose_ptr(rb_vm_t *);
-VALUE *ruby_vm_debug_ptr(rb_vm_t *);
#endif /* RUBY_MVM_H */
diff --git a/load.c b/load.c
index 08238a1c9d..94837f3c6f 100644
--- a/load.c
+++ b/load.c
@@ -2,6 +2,9 @@
* load methods from eval.c
*/
+#include "ruby/ruby.h"
+#include "ruby/util.h"
+#include "dln.h"
#include "eval_intern.h"
VALUE ruby_dln_librefs;
diff --git a/object.c b/object.c
index 560092d07b..4f2fcb6def 100644
--- a/object.c
+++ b/object.c
@@ -14,7 +14,6 @@
#include "ruby/ruby.h"
#include "ruby/st.h"
#include "ruby/util.h"
-#include "debug.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
diff --git a/parse.y b/parse.y
index 485a3979f7..b11f56593c 100644
--- a/parse.y
+++ b/parse.y
@@ -8725,7 +8725,6 @@ local_tbl_gen(struct parser_params *parser)
return buf;
}
-#include "debug.h"
static int
arg_var_gen(struct parser_params *parser, ID id)
{
diff --git a/thread.c b/thread.c
index 2f02cc3ca0..9b0a91ee7b 100644
--- a/thread.c
+++ b/thread.c
@@ -45,7 +45,6 @@
/* for model 2 */
#include "eval_intern.h"
-#include "vm.h"
#include "gc.h"
#ifndef USE_NATIVE_THREAD_PRIORITY
diff --git a/vm.c b/vm.c
index 7841b43396..634924779d 100644
--- a/vm.c
+++ b/vm.c
@@ -12,10 +12,17 @@
#include "ruby/node.h"
#include "ruby/st.h"
#include "ruby/encoding.h"
+
#include "gc.h"
+#include "vm_core.h"
+#include "eval_intern.h"
-#include "insnhelper.h"
+#include "vm_insnhelper.h"
#include "vm_insnhelper.c"
+#include "vm_exec.h"
+#include "vm_exec.c"
+
+#include "vm_method.c"
#include "vm_eval.c"
#define BUFSIZE 0x100
@@ -27,6 +34,8 @@ VALUE rb_cEnv;
VALUE rb_mRubyVMFrozenCore;
VALUE ruby_vm_global_state_version = 1;
+VALUE ruby_vm_redefined_flag = 0;
+
rb_thread_t *ruby_current_thread = 0;
rb_vm_t *ruby_current_vm = 0;
@@ -34,14 +43,6 @@ void vm_analysis_operand(int insn, int n, VALUE op);
void vm_analysis_register(int reg, int isset);
void vm_analysis_insn(int insn);
-#if OPT_STACK_CACHING
-static VALUE finish_insn_seq[1] = { BIN(finish_SC_ax_ax) };
-#elif OPT_CALL_THREADED_CODE
-static VALUE const finish_insn_seq[1] = { 0 };
-#else
-static VALUE finish_insn_seq[1] = { BIN(finish) };
-#endif
-
void
rb_vm_change_state(void)
{
@@ -132,6 +133,18 @@ vm_get_ruby_level_caller_cfp(rb_thread_t *th, rb_control_frame_t *cfp)
/* Env */
+/*
+ env{
+ env[0] // special (block or prev env)
+ env[1] // env object
+ env[2] // prev env val
+ };
+ */
+
+#define ENV_IN_HEAP_P(th, env) \
+ (!((th)->stack < (env) && (env) < ((th)->stack + (th)->stack_size)))
+#define ENV_VAL(env) ((env)[1])
+
static void
env_free(void * const ptr)
{
@@ -471,7 +484,7 @@ invoke_block_from_c(rb_thread_t *th, const rb_block_t *block,
th->cfp->dfp[-1] = (VALUE)cref;
}
- return vm_eval_body(th);
+ return vm_exec(th);
}
else {
return vm_yield_with_cfunc(th, block, self, argc, argv, blockptr);
@@ -743,37 +756,6 @@ debug_cref(NODE *cref)
}
#endif
-static NODE *
-vm_cref_push(rb_thread_t *th, VALUE klass, int noex)
-{
- rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th, th->cfp);
- NODE *cref = NEW_BLOCK(klass);
- cref->nd_file = 0;
- cref->nd_visi = noex;
-
- if (cfp) {
- cref->nd_next = vm_get_cref(cfp->iseq, cfp->lfp, cfp->dfp);
- }
-
- return cref;
-}
-
-static inline VALUE
-vm_get_cbase(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
-{
- NODE *cref = vm_get_cref(iseq, lfp, dfp);
- VALUE klass = Qundef;
-
- while (cref) {
- if ((klass = cref->nd_clss) != 0) {
- break;
- }
- cref = cref->nd_next;
- }
-
- return klass;
-}
-
VALUE
rb_vm_cbase(void)
{
@@ -887,7 +869,6 @@ rb_iter_break(void)
/* optimization: redefine management */
-VALUE ruby_vm_redefined_flag = 0;
static st_table *vm_opt_method_table = 0;
static void
@@ -944,8 +925,6 @@ vm_init_redefined_flag(void)
/* evaluator body */
-#include "vm_evalbody.c"
-
/* finish
VMe (h1) finish
VM finish F1 F2
@@ -1048,7 +1027,7 @@ vm_init_redefined_flag(void)
static VALUE
-vm_eval_body(rb_thread_t *th)
+vm_exec(rb_thread_t *th)
{
int state;
VALUE result, err;
@@ -1059,7 +1038,7 @@ vm_eval_body(rb_thread_t *th)
_tag.retval = Qnil;
if ((state = EXEC_TAG()) == 0) {
vm_loop_start:
- result = vm_eval(th, initial);
+ result = vm_exec_core(th, initial);
if ((state = th->state) != 0) {
err = result;
th->state = 0;
@@ -1264,7 +1243,7 @@ rb_iseq_eval(VALUE iseqval)
if (!rb_const_defined(rb_cObject, rb_intern("TOPLEVEL_BINDING"))) {
rb_define_global_const("TOPLEVEL_BINDING", rb_binding_new());
}
- val = vm_eval_body(th);
+ val = vm_exec(th);
tmp = iseqval; /* prohibit tail call optimization */
return val;
}
diff --git a/vm_core.h b/vm_core.h
index 130f6c2b28..9476284081 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -17,7 +17,7 @@
#include <setjmp.h>
#include "ruby/ruby.h"
-#include "ruby/mvm.h"
+#include "ruby/vm.h"
#include "ruby/st.h"
#include "ruby/node.h"
@@ -402,7 +402,7 @@ struct rb_unblock_callback {
struct rb_mutex_struct;
-struct rb_thread_struct
+typedef struct rb_thread_struct
{
VALUE self;
rb_vm_t *vm;
@@ -501,7 +501,7 @@ struct rb_thread_struct
/* misc */
int method_missing_reason;
int abort_on_exception;
-};
+} rb_thread_t;
/* iseq.c */
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
diff --git a/vm_dump.c b/vm_dump.c
index 9d31037fc2..485d7558ce 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -11,12 +11,13 @@
#include "ruby/ruby.h"
#include "ruby/node.h"
-
#include "vm_core.h"
-#include "vm.h"
#define MAX_POSBUF 128
+#define VM_CFP_CNT(th, cfp) \
+ ((rb_control_frame_t *)(th->stack + th->stack_size) - (rb_control_frame_t *)(cfp))
+
static void
control_frame_dump(rb_thread_t *th, rb_control_frame_t *cfp)
{
diff --git a/vm_eval.c b/vm_eval.c
index 96a189ae85..de6d0e88cf 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -11,19 +11,13 @@
**********************************************************************/
-#include "ruby/ruby.h"
-#include "ruby/node.h"
-#include "ruby/st.h"
-
-#include "vm_method.c"
-
static inline VALUE method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status);
static inline VALUE rb_vm_set_finish_env(rb_thread_t * th);
static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *argv, const NODE *cref);
static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
static inline VALUE vm_backtrace(rb_thread_t *th, int lev);
static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex);
-static VALUE vm_eval_body(rb_thread_t *th);
+static VALUE vm_exec(rb_thread_t *th);
static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref);
static inline VALUE
@@ -58,7 +52,7 @@ vm_call0(rb_thread_t * th, VALUE klass, VALUE recv, VALUE id, ID oid,
}
vm_setup_method(th, reg_cfp, argc, blockptr, 0, iseqval, recv, klass);
- val = vm_eval_body(th);
+ val = vm_exec(th);
break;
}
case NODE_CFUNC: {
@@ -740,7 +734,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *cref, const char
/* kick */
CHECK_STACK_OVERFLOW(th->cfp, iseq->stack_max);
- result = vm_eval_body(th);
+ result = vm_exec(th);
}
POP_TAG();
th->mild_compile_error = mild_compile_error;
diff --git a/vm_evalbody.c b/vm_exec.c
index 65f2964180..392fde0cf7 100644
--- a/vm_evalbody.c
+++ b/vm_exec.c
@@ -25,9 +25,17 @@
#endif
/* #define DECL_SC_REG(r, reg) VALUE reg_##r */
+#if OPT_STACK_CACHING
+static VALUE finish_insn_seq[1] = { BIN(finish_SC_ax_ax) };
+#elif OPT_CALL_THREADED_CODE
+static VALUE const finish_insn_seq[1] = { 0 };
+#else
+static VALUE finish_insn_seq[1] = { BIN(finish) };
+#endif
+
#if !OPT_CALL_THREADED_CODE
static VALUE
-vm_eval(rb_thread_t *th, VALUE initial)
+vm_exec_core(rb_thread_t *th, VALUE initial)
{
#if OPT_STACK_CACHING
@@ -104,19 +112,25 @@ vm_eval(rb_thread_t *th, VALUE initial)
goto first;
}
+const void **
+vm_get_insns_address_table(void)
+{
+ return (const void **)vm_exec_core(0, 0);
+}
+
#else
#include "vm.inc"
#include "vmtc.inc"
const void *const *
-get_insns_address_table()
+vm_get_insns_address_table(void)
{
return insns_address_table;
}
-VALUE
-vm_eval(rb_thread_t *th, VALUE initial)
+static VALUE
+vm_exec_core(rb_thread_t *th, VALUE initial)
{
register rb_control_frame_t *reg_cfp = th->cfp;
VALUE ret;
@@ -140,9 +154,3 @@ vm_eval(rb_thread_t *th, VALUE initial)
return ret;
}
#endif
-
-const void **
-vm_get_insns_address_table(void)
-{
- return (const void **)vm_eval(0, 0);
-}
diff --git a/vm.h b/vm_exec.h
index c485cae80b..9868b21348 100644
--- a/vm.h
+++ b/vm_exec.h
@@ -18,34 +18,6 @@ typedef unsigned long dindex_t;
typedef rb_num_t GENTRY;
typedef rb_iseq_t *ISEQ;
-extern VALUE rb_cEnv;
-extern VALUE ruby_vm_global_state_version;
-extern VALUE ruby_vm_redefined_flag;
-
-
-/**
- * VM Debug Level
- *
- * debug level:
- * 0: no debug output
- * 1: show instruction name
- * 2: show stack frame when control stack frame is changed
- * 3: show stack status
- * 4: show register
- * 5:
- * 10: gc check
- */
-
-
-#ifndef VMDEBUG
-#define VMDEBUG 0
-#endif
-
-#if 0
-#undef VMDEBUG
-#define VMDEBUG 3
-#endif
-
#ifdef COLLECT_USAGE_ANALYSIS
#define USAGE_ANALYSIS_INSN(insn) vm_analysis_insn(insn)
#define USAGE_ANALYSIS_OPERAND(insn, n, op) vm_analysis_operand(insn, n, (VALUE)op)
@@ -199,26 +171,8 @@ default: \
#endif
-
-/************************************************/
-/************************************************/
-
-#define VM_CFP_CNT(th, cfp) \
- ((rb_control_frame_t *)(th->stack + th->stack_size) - (rb_control_frame_t *)(cfp))
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
-/*
- env{
- env[0] // special (block or prev env)
- env[1] // env object
- env[2] // prev env val
- };
- */
-
-#define ENV_IN_HEAP_P(th, env) \
- (!((th)->stack < (env) && (env) < ((th)->stack + (th)->stack_size)))
-#define ENV_VAL(env) ((env)[1])
-
#if OPT_CALL_THREADED_CODE
#define THROW_EXCEPTION(exc) do { \
th->errinfo = (VALUE)(exc); \
@@ -230,28 +184,4 @@ default: \
#define SCREG(r) (reg_##r)
-/* VM state version */
-
-#define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
-#define INC_VM_STATE_VERSION() \
- (ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
-
-#define BOP_PLUS 0x01
-#define BOP_MINUS 0x02
-#define BOP_MULT 0x04
-#define BOP_DIV 0x08
-#define BOP_MOD 0x10
-#define BOP_EQ 0x20
-#define BOP_LT 0x40
-#define BOP_LE 0x80
-#define BOP_LTLT 0x100
-#define BOP_AREF 0x200
-#define BOP_ASET 0x400
-#define BOP_LENGTH 0x800
-#define BOP_SUCC 0x1000
-#define BOP_GT 0x2000
-#define BOP_GE 0x4000
-#define BOP_NOT 0x8000
-#define BOP_NEQ 0x10000
-
#endif /* RUBY_VM_H */
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index c9397f8ecf..553883c035 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -10,12 +10,10 @@
/* finish iseq array */
#include "insns.inc"
-
#include <math.h>
/* control stack frame */
-
#ifndef INLINE
#define INLINE inline
#endif
@@ -967,6 +965,36 @@ vm_get_cref(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
return cref;
}
+static NODE *
+vm_cref_push(rb_thread_t *th, VALUE klass, int noex)
+{
+ rb_control_frame_t *cfp = vm_get_ruby_level_caller_cfp(th, th->cfp);
+ NODE *cref = NEW_BLOCK(klass);
+ cref->nd_file = 0;
+ cref->nd_visi = noex;
+
+ if (cfp) {
+ cref->nd_next = vm_get_cref(cfp->iseq, cfp->lfp, cfp->dfp);
+ }
+
+ return cref;
+}
+
+static inline VALUE
+vm_get_cbase(const rb_iseq_t *iseq, const VALUE *lfp, const VALUE *dfp)
+{
+ NODE *cref = vm_get_cref(iseq, lfp, dfp);
+ VALUE klass = Qundef;
+
+ while (cref) {
+ if ((klass = cref->nd_clss) != 0) {
+ break;
+ }
+ cref = cref->nd_next;
+ }
+
+ return klass;
+}
static inline void
vm_check_if_namespace(VALUE klass)
diff --git a/insnhelper.h b/vm_insnhelper.h
index a862f2672e..6e931e1622 100644
--- a/insnhelper.h
+++ b/vm_insnhelper.h
@@ -12,11 +12,54 @@
#ifndef RUBY_INSNHELPER_H
#define RUBY_INSNHELPER_H
-#include "ruby/ruby.h"
-#include "ruby/node.h"
-#include "eval_intern.h"
-#include "vm_core.h"
-#include "vm.h"
+/**
+ * VM Debug Level
+ *
+ * debug level:
+ * 0: no debug output
+ * 1: show instruction name
+ * 2: show stack frame when control stack frame is changed
+ * 3: show stack status
+ * 4: show register
+ * 5:
+ * 10: gc check
+ */
+
+#ifndef VMDEBUG
+#define VMDEBUG 0
+#endif
+
+#if 0
+#undef VMDEBUG
+#define VMDEBUG 3
+#endif
+
+/* VM state version */
+
+extern VALUE ruby_vm_global_state_version;
+extern VALUE ruby_vm_redefined_flag;
+
+#define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
+#define INC_VM_STATE_VERSION() \
+ (ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
+
+#define BOP_PLUS 0x01
+#define BOP_MINUS 0x02
+#define BOP_MULT 0x04
+#define BOP_DIV 0x08
+#define BOP_MOD 0x10
+#define BOP_EQ 0x20
+#define BOP_LT 0x40
+#define BOP_LE 0x80
+#define BOP_LTLT 0x100
+#define BOP_AREF 0x200
+#define BOP_ASET 0x400
+#define BOP_LENGTH 0x800
+#define BOP_SUCC 0x1000
+#define BOP_GT 0x2000
+#define BOP_GE 0x4000
+#define BOP_NOT 0x8000
+#define BOP_NEQ 0x10000
/**********************************************************/
/* deal with stack */
diff --git a/vm_method.c b/vm_method.c
index b0f69afd04..53369f431d 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1,6 +1,5 @@
-/* -*-c-*- */
/*
- * This file is included by vm_eval.c
+ * This file is included by vm.h
*/
#define CACHE_SIZE 0x800