ruby-internal 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +59 -0
- data/LGPL +515 -0
- data/LICENSE +9 -0
- data/README +31 -0
- data/Rakefile +20 -0
- data/TODO +9 -0
- data/example/README +5 -0
- data/example/simple_client.rb +12 -0
- data/example/simple_server.rb +11 -0
- data/example/triangle_client.rb +7 -0
- data/example/triangle_server.rb +24 -0
- data/ext/cached/ruby-1.8.0/internal/binding/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.0/internal/module/classpath.c +27 -0
- data/ext/cached/ruby-1.8.0/internal/module/classpath.h +14 -0
- data/ext/cached/ruby-1.8.0/internal/node/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.0/internal/node/node_type_descrip.c +155 -0
- data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.c +5741 -0
- data/ext/cached/ruby-1.8.0/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.0/internal/proc/block.h +37 -0
- data/ext/cached/ruby-1.8.0/internal/tag/tag.h +15 -0
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.0/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.0/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.1/internal/binding/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.1/internal/module/classpath.c +27 -0
- data/ext/cached/ruby-1.8.1/internal/module/classpath.h +14 -0
- data/ext/cached/ruby-1.8.1/internal/node/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.1/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.1/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.1/internal/proc/block.h +31 -0
- data/ext/cached/ruby-1.8.1/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.1/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.1/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.2/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/method/method.h +19 -0
- data/ext/cached/ruby-1.8.2/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.2/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.2/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.2/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.2/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.2/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.2/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.2/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.2/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.3/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.3/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.3/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.3/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.3/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.3/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.3/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.3/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.3/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.3/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.4/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.4/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.4/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.4/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.4/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.c +5733 -0
- data/ext/cached/ruby-1.8.4/internal/node/nodeinfo.h +69 -0
- data/ext/cached/ruby-1.8.4/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.4/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.4/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.4/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.5/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.5/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.5/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.5/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.5/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.5/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.5/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.5/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.5/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.5/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.6/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.6/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.6/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.6/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.6/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.6/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.6/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.6/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.6/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.6/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.8.7/internal/binding/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.8.7/internal/module/classpath.c +45 -0
- data/ext/cached/ruby-1.8.7/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.8.7/internal/node/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.8.7/internal/node/node_type_descrip.c +154 -0
- data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.c +5732 -0
- data/ext/cached/ruby-1.8.7/internal/node/nodeinfo.h +67 -0
- data/ext/cached/ruby-1.8.7/internal/proc/block.h +32 -0
- data/ext/cached/ruby-1.8.7/internal/tag/tag.h +16 -0
- data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.c +39 -0
- data/ext/cached/ruby-1.8.7/internal/vm/instruction/insns_info.h +21 -0
- data/ext/cached/ruby-1.8.7/internal/vm/iseq/insns_info.inc +12 -0
- data/ext/cached/ruby-1.9.0/internal/binding/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.9.0/internal/module/classpath.c +42 -0
- data/ext/cached/ruby-1.9.0/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.9.0/internal/node/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.9.0/internal/node/node_type_descrip.c +149 -0
- data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.c +5579 -0
- data/ext/cached/ruby-1.9.0/internal/node/nodeinfo.h +70 -0
- data/ext/cached/ruby-1.9.0/internal/proc/block.h +12 -0
- data/ext/cached/ruby-1.9.0/internal/tag/tag.h +6 -0
- data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.c +5936 -0
- data/ext/cached/ruby-1.9.0/internal/vm/instruction/insns_info.h +891 -0
- data/ext/cached/ruby-1.9.0/internal/vm/iseq/insns_info.inc +700 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/debug.h +36 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/dln.h +41 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/encdb.h +147 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/eval_intern.h +221 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/gc.h +75 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/id.h +83 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/iseq.h +94 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/node.h +516 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/parse.h +303 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regenc.h +207 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regint.h +842 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/regparse.h +351 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_pthread.h +24 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/thread_win32.h +33 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/transcode_data.h +99 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/transdb.h +67 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/version.h +57 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_core.h +663 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_exec.h +187 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_insnhelper.h +191 -0
- data/ext/cached/ruby-1.9.0/internal/yarv-headers/vm_opts.h +51 -0
- data/ext/cached/ruby-1.9.1/internal/binding/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/method/method.h +20 -0
- data/ext/cached/ruby-1.9.1/internal/module/classpath.c +42 -0
- data/ext/cached/ruby-1.9.1/internal/module/classpath.h +17 -0
- data/ext/cached/ruby-1.9.1/internal/node/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/node/global_entry.h +10 -0
- data/ext/cached/ruby-1.9.1/internal/node/node_type_descrip.c +149 -0
- data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.c +5579 -0
- data/ext/cached/ruby-1.9.1/internal/node/nodeinfo.h +70 -0
- data/ext/cached/ruby-1.9.1/internal/proc/block.h +12 -0
- data/ext/cached/ruby-1.9.1/internal/tag/tag.h +6 -0
- data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.c +5936 -0
- data/ext/cached/ruby-1.9.1/internal/vm/instruction/insns_info.h +891 -0
- data/ext/cached/ruby-1.9.1/internal/vm/iseq/insns_info.inc +700 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/debug.h +36 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/dln.h +41 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/encdb.h +147 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/eval_intern.h +209 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/gc.h +75 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/id.h +184 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/iseq.h +94 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/node.h +516 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/parse.h +303 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regenc.h +207 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regint.h +842 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/regparse.h +351 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/revision.h +1 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_pthread.h +24 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/thread_win32.h +33 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/transcode_data.h +99 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/transdb.h +85 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/version.h +60 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_core.h +655 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_exec.h +187 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_insnhelper.h +194 -0
- data/ext/cached/ruby-1.9.1/internal/yarv-headers/vm_opts.h +51 -0
- data/ext/internal/binding/binding.c +45 -0
- data/ext/internal/binding/block.h.rpp +44 -0
- data/ext/internal/binding/extconf.rb +6 -0
- data/ext/internal/method/extconf.rb +8 -0
- data/ext/internal/method/method.c +269 -0
- data/ext/internal/method/method.h.rpp +58 -0
- data/ext/internal/module/classpath.c.rpp +29 -0
- data/ext/internal/module/classpath.h.rpp +36 -0
- data/ext/internal/module/extconf.rb +11 -0
- data/ext/internal/module/module.c +797 -0
- data/ext/internal/module/module.h +7 -0
- data/ext/internal/node/block.h.rpp +44 -0
- data/ext/internal/node/builtins.h +41 -0
- data/ext/internal/node/extconf.rb +66 -0
- data/ext/internal/node/global_entry.h.rpp +26 -0
- data/ext/internal/node/node.c +1147 -0
- data/ext/internal/node/node_type_descrip.c.rpp +72 -0
- data/ext/internal/node/node_type_descrip.h +17 -0
- data/ext/internal/node/node_type_descrip.rb +39 -0
- data/ext/internal/node/nodeinfo.c.rpp +587 -0
- data/ext/internal/node/nodeinfo.h.rpp +30 -0
- data/ext/internal/node/nodes.rb +78 -0
- data/ext/internal/node/read_node_h.rb +34 -0
- data/ext/internal/node/ruby_internal_node.h +31 -0
- data/ext/internal/noex/extconf.rb +6 -0
- data/ext/internal/noex/noex.c +44 -0
- data/ext/internal/object/extconf.rb +4 -0
- data/ext/internal/object/object.c +75 -0
- data/ext/internal/proc/block.h.rpp +44 -0
- data/ext/internal/proc/extconf.rb +9 -0
- data/ext/internal/proc/proc.c +331 -0
- data/ext/internal/tag/extconf.rb +3 -0
- data/ext/internal/tag/tag.c +17 -0
- data/ext/internal/tag/tag.h.rpp +22 -0
- data/ext/internal/thread/extconf.rb +3 -0
- data/ext/internal/thread/thread.c +107 -0
- data/ext/internal/vm/constants/constants.c +33 -0
- data/ext/internal/vm/constants/extconf.rb +3 -0
- data/ext/internal/vm/control_frame/control_frame.c +185 -0
- data/ext/internal/vm/control_frame/control_frame.h +18 -0
- data/ext/internal/vm/control_frame/extconf.rb +3 -0
- data/ext/internal/vm/extconf.rb +3 -0
- data/ext/internal/vm/inline_cache/extconf.rb +6 -0
- data/ext/internal/vm/inline_cache/inline_cache.c +79 -0
- data/ext/internal/vm/instruction/extconf.rb +6 -0
- data/ext/internal/vm/instruction/insns_info.c.rpp +213 -0
- data/ext/internal/vm/instruction/insns_info.h.rpp +53 -0
- data/ext/internal/vm/instruction/instruction.c +78 -0
- data/ext/internal/vm/instruction/instruction.h +10 -0
- data/ext/internal/vm/iseq/extconf.rb +7 -0
- data/ext/internal/vm/iseq/insns_info.inc.rpp +30 -0
- data/ext/internal/vm/iseq/internal_iseq.h +9 -0
- data/ext/internal/vm/iseq/iseq.c +555 -0
- data/ext/internal/vm/vm.c +55 -0
- data/ext/mkmf-ruby-internal.rb +111 -0
- data/ext/ruby_source_dir.rb +24 -0
- data/ext/rubypp.rb +97 -0
- data/generate_rdoc.rb +33 -0
- data/lib/internal/binding.rb +1 -0
- data/lib/internal/classtree.rb +55 -0
- data/lib/internal/debug.rb +16 -0
- data/lib/internal/method.rb +1 -0
- data/lib/internal/method/as_code.rb +33 -0
- data/lib/internal/method/as_expression.rb +34 -0
- data/lib/internal/method/signature.rb +442 -0
- data/lib/internal/module.rb +1 -0
- data/lib/internal/module/as_code.rb +45 -0
- data/lib/internal/node.rb +3 -0
- data/lib/internal/node/as_code.rb +233 -0
- data/lib/internal/node/as_expression.rb +619 -0
- data/lib/internal/node/dump.rb +53 -0
- data/lib/internal/node/pp.rb +72 -0
- data/lib/internal/node/to_a.rb +52 -0
- data/lib/internal/noex.rb +1 -0
- data/lib/internal/obfusc.rb +57 -0
- data/lib/internal/object.rb +1 -0
- data/lib/internal/object/as_code.rb +10 -0
- data/lib/internal/proc.rb +1 -0
- data/lib/internal/proc/as_code.rb +21 -0
- data/lib/internal/proc/as_expression.rb +14 -0
- data/lib/internal/proc/signature.rb +184 -0
- data/lib/internal/tag.rb +1 -0
- data/lib/internal/thread.rb +1 -0
- data/lib/internal/vm.rb +1 -0
- data/lib/internal/vm/bytedecoder.rb +866 -0
- data/lib/internal/vm/constants.rb +1 -0
- data/lib/internal/vm/control_frame.rb +1 -0
- data/lib/internal/vm/inline_cache.rb +1 -0
- data/lib/internal/vm/instruction.rb +1 -0
- data/lib/internal/vm/iseq.rb +1 -0
- data/lib/internal/vm/iseq/as_code.rb +27 -0
- data/lib/internal/vm/iseq/as_expression.rb +26 -0
- data/metaconfig +19 -0
- data/post-config.rb +1 -0
- data/post-install.rb +4 -0
- data/post-setup.rb +7 -0
- data/pre-config.rb +96 -0
- data/pre-install.rb +13 -0
- data/pre-setup.rb +8 -0
- data/run_tests.rb +26 -0
- data/setup.rb +1599 -0
- data/test/expression_samples.rb +160 -0
- data/test/node_samples.rb +122 -0
- data/test/test_as_code.rb +261 -0
- data/test/test_as_expression.rb +229 -0
- data/test/test_dump_class.rb +187 -0
- data/test/test_dump_method.rb +144 -0
- data/test/test_dump_proc.rb +118 -0
- data/test/test_helpers.rb +61 -0
- data/test/test_method.rb +72 -0
- data/test/test_methodsig.rb +267 -0
- data/test/test_module.rb +49 -0
- data/test/test_node.rb +77 -0
- data/test/test_proc.rb +47 -0
- metadata +377 -0
@@ -0,0 +1,187 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
vm.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 16:56:59 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_VM_H
|
13
|
+
#define RUBY_VM_H
|
14
|
+
|
15
|
+
typedef long OFFSET;
|
16
|
+
typedef unsigned long lindex_t;
|
17
|
+
typedef unsigned long dindex_t;
|
18
|
+
typedef rb_num_t GENTRY;
|
19
|
+
typedef rb_iseq_t *ISEQ;
|
20
|
+
|
21
|
+
#ifdef COLLECT_USAGE_ANALYSIS
|
22
|
+
#define USAGE_ANALYSIS_INSN(insn) vm_analysis_insn(insn)
|
23
|
+
#define USAGE_ANALYSIS_OPERAND(insn, n, op) vm_analysis_operand(insn, n, (VALUE)op)
|
24
|
+
#define USAGE_ANALYSIS_REGISTER(reg, s) vm_analysis_register(reg, s)
|
25
|
+
#else
|
26
|
+
#define USAGE_ANALYSIS_INSN(insn) /* none */
|
27
|
+
#define USAGE_ANALYSIS_OPERAND(insn, n, op) /* none */
|
28
|
+
#define USAGE_ANALYSIS_REGISTER(reg, s) /* none */
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifdef __GCC__
|
32
|
+
/* TODO: machine dependent prefetch instruction */
|
33
|
+
#define PREFETCH(pc)
|
34
|
+
#else
|
35
|
+
#define PREFETCH(pc)
|
36
|
+
#endif
|
37
|
+
|
38
|
+
#if VMDEBUG > 0
|
39
|
+
#define debugs printf
|
40
|
+
#define DEBUG_ENTER_INSN(insn) \
|
41
|
+
debug_print_pre(th, GET_CFP());
|
42
|
+
|
43
|
+
#if OPT_STACK_CACHING
|
44
|
+
#define SC_REGS() , reg_a, reg_b
|
45
|
+
#else
|
46
|
+
#define SC_REGS()
|
47
|
+
#endif
|
48
|
+
|
49
|
+
#define DEBUG_END_INSN() \
|
50
|
+
debug_print_post(th, GET_CFP() SC_REGS());
|
51
|
+
|
52
|
+
#else
|
53
|
+
|
54
|
+
#define debugs
|
55
|
+
#define DEBUG_ENTER_INSN(insn)
|
56
|
+
#define DEBUG_END_INSN()
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#define throwdebug if(0)printf
|
60
|
+
/* #define throwdebug printf */
|
61
|
+
|
62
|
+
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
|
63
|
+
|
64
|
+
|
65
|
+
/************************************************/
|
66
|
+
#if DISPATCH_XXX
|
67
|
+
error !
|
68
|
+
/************************************************/
|
69
|
+
#elif OPT_CALL_THREADED_CODE
|
70
|
+
|
71
|
+
#define LABEL(x) insn_func_##x
|
72
|
+
#define ELABEL(x)
|
73
|
+
#define LABEL_PTR(x) &LABEL(x)
|
74
|
+
|
75
|
+
#define INSN_ENTRY(insn) \
|
76
|
+
static rb_control_frame_t * \
|
77
|
+
FUNC_FASTCALL(LABEL(insn))(rb_thread_t *th, rb_control_frame_t *reg_cfp) {
|
78
|
+
|
79
|
+
#define END_INSN(insn) return reg_cfp;}
|
80
|
+
|
81
|
+
#define NEXT_INSN() return reg_cfp;
|
82
|
+
|
83
|
+
/************************************************/
|
84
|
+
#elif OPT_TOKEN_THREADED_CODE || OPT_DIRECT_THREADED_CODE
|
85
|
+
/* threaded code with gcc */
|
86
|
+
|
87
|
+
#define LABEL(x) INSN_LABEL_##x
|
88
|
+
#define ELABEL(x) INSN_ELABEL_##x
|
89
|
+
#define LABEL_PTR(x) &&LABEL(x)
|
90
|
+
|
91
|
+
#define INSN_ENTRY_SIG(insn)
|
92
|
+
|
93
|
+
|
94
|
+
#define INSN_DISPATCH_SIG(insn)
|
95
|
+
|
96
|
+
#define INSN_ENTRY(insn) \
|
97
|
+
LABEL(insn): \
|
98
|
+
INSN_ENTRY_SIG(insn); \
|
99
|
+
|
100
|
+
/* dispather */
|
101
|
+
#if __GNUC__ && (__i386__ || __x86_64__) && __GNUC__ == 3
|
102
|
+
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
103
|
+
asm volatile("jmp *%0;\t# -- inseted by vm.h\t[length = 2]" : : "r" (addr))
|
104
|
+
|
105
|
+
#else
|
106
|
+
#define DISPATCH_ARCH_DEPEND_WAY(addr) \
|
107
|
+
/* do nothing */
|
108
|
+
|
109
|
+
#endif
|
110
|
+
|
111
|
+
|
112
|
+
/**********************************/
|
113
|
+
#if OPT_DIRECT_THREADED_CODE
|
114
|
+
|
115
|
+
/* for GCC 3.4.x */
|
116
|
+
#define TC_DISPATCH(insn) \
|
117
|
+
INSN_DISPATCH_SIG(insn); \
|
118
|
+
goto *GET_CURRENT_INSN(); \
|
119
|
+
;
|
120
|
+
|
121
|
+
#else
|
122
|
+
/* token threade code */
|
123
|
+
|
124
|
+
#define TC_DISPATCH(insn) \
|
125
|
+
DISPATCH_ARCH_DEPEND_WAY(insns_address_table[GET_CURRENT_INSN()]); \
|
126
|
+
INSN_DISPATCH_SIG(insn); \
|
127
|
+
goto *insns_address_table[GET_CURRENT_INSN()]; \
|
128
|
+
rb_bug("tc error");
|
129
|
+
|
130
|
+
|
131
|
+
#endif /* DISPATCH_DIRECT_THREADED_CODE */
|
132
|
+
|
133
|
+
#define END_INSN(insn) \
|
134
|
+
DEBUG_END_INSN(); \
|
135
|
+
TC_DISPATCH(insn); \
|
136
|
+
|
137
|
+
#define INSN_DISPATCH() \
|
138
|
+
TC_DISPATCH(__START__) \
|
139
|
+
{
|
140
|
+
|
141
|
+
#define END_INSNS_DISPATCH() \
|
142
|
+
rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
|
143
|
+
} /* end of while loop */ \
|
144
|
+
|
145
|
+
#define NEXT_INSN() TC_DISPATCH(__NEXT_INSN__)
|
146
|
+
|
147
|
+
/************************************************/
|
148
|
+
#else /* no threaded code */
|
149
|
+
/* most common method */
|
150
|
+
|
151
|
+
#define INSN_ENTRY(insn) \
|
152
|
+
case BIN(insn):
|
153
|
+
|
154
|
+
#define END_INSN(insn) \
|
155
|
+
DEBUG_END_INSN(); \
|
156
|
+
break;
|
157
|
+
|
158
|
+
|
159
|
+
#define INSN_DISPATCH() \
|
160
|
+
while(1){ \
|
161
|
+
switch(GET_CURRENT_INSN()){
|
162
|
+
|
163
|
+
#define END_INSNS_DISPATCH() \
|
164
|
+
default: \
|
165
|
+
SDR(); \
|
166
|
+
rb_bug("unknown insn: %ld", GET_CURRENT_INSN()); \
|
167
|
+
} /* end of switch */ \
|
168
|
+
} /* end of while loop */ \
|
169
|
+
|
170
|
+
#define NEXT_INSN() goto first
|
171
|
+
|
172
|
+
#endif
|
173
|
+
|
174
|
+
#define VM_SP_CNT(th, sp) ((sp) - (th)->stack)
|
175
|
+
|
176
|
+
#if OPT_CALL_THREADED_CODE
|
177
|
+
#define THROW_EXCEPTION(exc) do { \
|
178
|
+
th->errinfo = (VALUE)(exc); \
|
179
|
+
return 0; \
|
180
|
+
} while (0)
|
181
|
+
#else
|
182
|
+
#define THROW_EXCEPTION(exc) return (VALUE)(exc)
|
183
|
+
#endif
|
184
|
+
|
185
|
+
#define SCREG(r) (reg_##r)
|
186
|
+
|
187
|
+
#endif /* RUBY_VM_H */
|
@@ -0,0 +1,191 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
insnhelper.h - helper macros to implement each instructions
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 15:50:34 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_INSNHELPER_H
|
13
|
+
#define RUBY_INSNHELPER_H
|
14
|
+
|
15
|
+
/**
|
16
|
+
* VM Debug Level
|
17
|
+
*
|
18
|
+
* debug level:
|
19
|
+
* 0: no debug output
|
20
|
+
* 1: show instruction name
|
21
|
+
* 2: show stack frame when control stack frame is changed
|
22
|
+
* 3: show stack status
|
23
|
+
* 4: show register
|
24
|
+
* 5:
|
25
|
+
* 10: gc check
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef VMDEBUG
|
29
|
+
#define VMDEBUG 0
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#if 0
|
33
|
+
#undef VMDEBUG
|
34
|
+
#define VMDEBUG 3
|
35
|
+
#endif
|
36
|
+
|
37
|
+
/* VM state version */
|
38
|
+
|
39
|
+
extern VALUE ruby_vm_global_state_version;
|
40
|
+
extern VALUE ruby_vm_redefined_flag;
|
41
|
+
|
42
|
+
#define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
|
43
|
+
#define INC_VM_STATE_VERSION() \
|
44
|
+
(ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
|
45
|
+
|
46
|
+
#define BOP_PLUS 0x01
|
47
|
+
#define BOP_MINUS 0x02
|
48
|
+
#define BOP_MULT 0x04
|
49
|
+
#define BOP_DIV 0x08
|
50
|
+
#define BOP_MOD 0x10
|
51
|
+
#define BOP_EQ 0x20
|
52
|
+
#define BOP_LT 0x40
|
53
|
+
#define BOP_LE 0x80
|
54
|
+
#define BOP_LTLT 0x100
|
55
|
+
#define BOP_AREF 0x200
|
56
|
+
#define BOP_ASET 0x400
|
57
|
+
#define BOP_LENGTH 0x800
|
58
|
+
#define BOP_SUCC 0x1000
|
59
|
+
#define BOP_GT 0x2000
|
60
|
+
#define BOP_GE 0x4000
|
61
|
+
#define BOP_NOT 0x8000
|
62
|
+
#define BOP_NEQ 0x10000
|
63
|
+
|
64
|
+
/**********************************************************/
|
65
|
+
/* deal with stack */
|
66
|
+
/**********************************************************/
|
67
|
+
|
68
|
+
#define PUSH(x) (SET_SV(x), INC_SP(1))
|
69
|
+
#define TOPN(n) (*(GET_SP()-(n)-1))
|
70
|
+
#define POPN(n) (DEC_SP(n))
|
71
|
+
#define POP() (DEC_SP(1))
|
72
|
+
#define STACK_ADDR_FROM_TOP(n) (GET_SP()-(n))
|
73
|
+
|
74
|
+
#define GET_TOS() (tos) /* dummy */
|
75
|
+
|
76
|
+
/**********************************************************/
|
77
|
+
/* deal with registers */
|
78
|
+
/**********************************************************/
|
79
|
+
|
80
|
+
#define REG_CFP (reg_cfp)
|
81
|
+
#define REG_PC (REG_CFP->pc)
|
82
|
+
#define REG_SP (REG_CFP->sp)
|
83
|
+
#define REG_LFP (REG_CFP->lfp)
|
84
|
+
#define REG_DFP (REG_CFP->dfp)
|
85
|
+
|
86
|
+
#define RESTORE_REGS() do { \
|
87
|
+
REG_CFP = th->cfp; \
|
88
|
+
} while (0)
|
89
|
+
|
90
|
+
#define REG_A reg_a
|
91
|
+
#define REG_B reg_b
|
92
|
+
|
93
|
+
#ifdef COLLECT_USAGE_ANALYSIS
|
94
|
+
#define USAGE_ANALYSIS_REGISTER_HELPER(a, b, v) \
|
95
|
+
(USAGE_ANALYSIS_REGISTER(a, b), (v))
|
96
|
+
#else
|
97
|
+
#define USAGE_ANALYSIS_REGISTER_HELPER(a, b, v) (v)
|
98
|
+
#endif
|
99
|
+
|
100
|
+
/* PC */
|
101
|
+
#define GET_PC() (USAGE_ANALYSIS_REGISTER_HELPER(0, 0, REG_PC))
|
102
|
+
#define SET_PC(x) (REG_PC = (USAGE_ANALYSIS_REGISTER_HELPER(0, 1, x)))
|
103
|
+
#define GET_CURRENT_INSN() (*GET_PC())
|
104
|
+
#define GET_OPERAND(n) (GET_PC()[(n)])
|
105
|
+
#define ADD_PC(n) (SET_PC(REG_PC + (n)))
|
106
|
+
|
107
|
+
#define GET_PC_COUNT() (REG_PC - GET_ISEQ()->iseq_encoded)
|
108
|
+
#define JUMP(dst) (REG_PC += (dst))
|
109
|
+
|
110
|
+
/* FP */
|
111
|
+
#define GET_CFP() (USAGE_ANALYSIS_REGISTER_HELPER(2, 0, REG_CFP))
|
112
|
+
#define GET_LFP() (USAGE_ANALYSIS_REGISTER_HELPER(3, 0, REG_LFP))
|
113
|
+
#define SET_LFP(x) (REG_LFP = (USAGE_ANALYSIS_REGISTER_HELPER(3, 1, (x))))
|
114
|
+
#define GET_DFP() (USAGE_ANALYSIS_REGISTER_HELPER(4, 0, REG_DFP))
|
115
|
+
#define SET_DFP(x) (REG_DFP = (USAGE_ANALYSIS_REGISTER_HELPER(4, 1, (x))))
|
116
|
+
|
117
|
+
/* SP */
|
118
|
+
#define GET_SP() (USAGE_ANALYSIS_REGISTER_HELPER(1, 0, REG_SP))
|
119
|
+
#define SET_SP(x) (REG_SP = (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))
|
120
|
+
#define INC_SP(x) (REG_SP += (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))
|
121
|
+
#define DEC_SP(x) (REG_SP -= (USAGE_ANALYSIS_REGISTER_HELPER(1, 1, (x))))
|
122
|
+
#define SET_SV(x) (*GET_SP() = (x))
|
123
|
+
/* set current stack value as x */
|
124
|
+
|
125
|
+
#define GET_SP_COUNT() (REG_SP - th->stack)
|
126
|
+
|
127
|
+
/* instruction sequence C struct */
|
128
|
+
#define GET_ISEQ() (GET_CFP()->iseq)
|
129
|
+
|
130
|
+
/**********************************************************/
|
131
|
+
/* deal with variables */
|
132
|
+
/**********************************************************/
|
133
|
+
|
134
|
+
#define GET_PREV_DFP(dfp) ((VALUE *)((dfp)[0] & ~0x03))
|
135
|
+
|
136
|
+
#define GET_GLOBAL(entry) rb_gvar_get((struct global_entry*)entry)
|
137
|
+
#define SET_GLOBAL(entry, val) rb_gvar_set((struct global_entry*)entry, val)
|
138
|
+
|
139
|
+
#define GET_CONST_INLINE_CACHE(dst) ((IC) * (GET_PC() + (dst) + 1))
|
140
|
+
|
141
|
+
/**********************************************************/
|
142
|
+
/* deal with values */
|
143
|
+
/**********************************************************/
|
144
|
+
|
145
|
+
#define GET_SELF() (USAGE_ANALYSIS_REGISTER_HELPER(5, 0, GET_CFP()->self))
|
146
|
+
|
147
|
+
/**********************************************************/
|
148
|
+
/* deal with control flow 2: method/iterator */
|
149
|
+
/**********************************************************/
|
150
|
+
|
151
|
+
#define COPY_CREF(c1, c2) do { \
|
152
|
+
NODE *__tmp_c2 = (c2); \
|
153
|
+
c1->nd_clss = __tmp_c2->nd_clss; \
|
154
|
+
c1->nd_visi = __tmp_c2->nd_visi; \
|
155
|
+
c1->nd_next = __tmp_c2->nd_next; \
|
156
|
+
} while (0)
|
157
|
+
|
158
|
+
#define CALL_METHOD(num, blockptr, flag, id, mn, recv, klass) do { \
|
159
|
+
VALUE v = vm_call_method(th, GET_CFP(), num, blockptr, flag, id, mn, recv, klass); \
|
160
|
+
if (v == Qundef) { \
|
161
|
+
RESTORE_REGS(); \
|
162
|
+
NEXT_INSN(); \
|
163
|
+
} \
|
164
|
+
else { \
|
165
|
+
val = v; \
|
166
|
+
} \
|
167
|
+
} while (0)
|
168
|
+
|
169
|
+
#define GET_BLOCK_PTR() \
|
170
|
+
((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0])))
|
171
|
+
|
172
|
+
/**********************************************************/
|
173
|
+
/* deal with control flow 3: exception */
|
174
|
+
/**********************************************************/
|
175
|
+
|
176
|
+
|
177
|
+
/**********************************************************/
|
178
|
+
/* others */
|
179
|
+
/**********************************************************/
|
180
|
+
|
181
|
+
/* optimize insn */
|
182
|
+
#define FIXNUM_2_P(a, b) ((a) & (b) & 1)
|
183
|
+
#define BASIC_OP_UNREDEFINED_P(op) (LIKELY((ruby_vm_redefined_flag & (op)) == 0))
|
184
|
+
#define HEAP_CLASS_OF(obj) RBASIC(obj)->klass
|
185
|
+
|
186
|
+
#define CALL_SIMPLE_METHOD(num, id, recv) do { \
|
187
|
+
VALUE klass = CLASS_OF(recv); \
|
188
|
+
CALL_METHOD(num, 0, 0, id, rb_method_node(klass, id), recv, CLASS_OF(recv)); \
|
189
|
+
} while (0)
|
190
|
+
|
191
|
+
#endif /* RUBY_INSNHELPER_H */
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/*-*-c-*-*/
|
2
|
+
/**********************************************************************
|
3
|
+
|
4
|
+
vm_opts.h - VM optimize option
|
5
|
+
|
6
|
+
$Author: ko1 $
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
|
13
|
+
#ifndef RUBY_VM_OPTS_H
|
14
|
+
#define RUBY_VM_OPTS_H
|
15
|
+
|
16
|
+
/* Compile options.
|
17
|
+
* You can change these options at runtime by VM::CompileOption.
|
18
|
+
* Following definitions are default values.
|
19
|
+
*/
|
20
|
+
|
21
|
+
#define OPT_TRACE_INSTRUCTION 1
|
22
|
+
#define OPT_TAILCALL_OPTIMIZATION 0
|
23
|
+
#define OPT_PEEPHOLE_OPTIMIZATION 1
|
24
|
+
#define OPT_SPECIALISED_INSTRUCTION 1
|
25
|
+
#define OPT_INLINE_CONST_CACHE 1
|
26
|
+
|
27
|
+
|
28
|
+
/* Build Options.
|
29
|
+
* You can't change these options at runtime.
|
30
|
+
*/
|
31
|
+
|
32
|
+
/* C compiler depend */
|
33
|
+
#define OPT_DIRECT_THREADED_CODE 1
|
34
|
+
#define OPT_TOKEN_THREADED_CODE 0
|
35
|
+
#define OPT_CALL_THREADED_CODE 0
|
36
|
+
|
37
|
+
/* VM running option */
|
38
|
+
#define OPT_CHECKED_RUN 1
|
39
|
+
#define OPT_INLINE_METHOD_CACHE 1
|
40
|
+
#define OPT_BLOCKINLINING 0
|
41
|
+
|
42
|
+
/* architecture independent, affects generated code */
|
43
|
+
#define OPT_OPERANDS_UNIFICATION 0
|
44
|
+
#define OPT_INSTRUCTIONS_UNIFICATION 0
|
45
|
+
#define OPT_UNIFY_ALL_COMBINATION 0
|
46
|
+
#define OPT_STACK_CACHING 0
|
47
|
+
|
48
|
+
/* misc */
|
49
|
+
#define SUPPORT_JOKE 0
|
50
|
+
|
51
|
+
#endif /* RUBY_VM_OPTS_H */
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#ifndef ruby_internal_method__h_
|
2
|
+
#define ruby_internal_method__h_
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
|
6
|
+
#include "internal/node/ruby_internal_node.h"
|
7
|
+
|
8
|
+
struct METHOD {
|
9
|
+
VALUE oclass; /* class that holds the method */
|
10
|
+
VALUE rclass; /* class of the receiver */
|
11
|
+
VALUE recv;
|
12
|
+
ID id, oid;
|
13
|
+
NODE *body;
|
14
|
+
};
|
15
|
+
|
16
|
+
#define METHOD_OCLASS(m) m->oclass
|
17
|
+
#define METHOD_RCLASS(m) m->rclass
|
18
|
+
|
19
|
+
#endif
|
20
|
+
|