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,85 @@
|
|
1
|
+
rb_declare_transcoder("", "amp_escape", "escape");
|
2
|
+
rb_declare_transcoder("", "xml_text_escape", "escape");
|
3
|
+
rb_declare_transcoder("", "xml_attr_content_escape", "escape");
|
4
|
+
rb_declare_transcoder("", "xml_attr_quote", "escape");
|
5
|
+
rb_declare_transcoder("ISO-2022-JP", "stateless-ISO-2022-JP", "iso2022");
|
6
|
+
rb_declare_transcoder("stateless-ISO-2022-JP", "ISO-2022-JP", "iso2022");
|
7
|
+
rb_declare_transcoder("stateless-ISO-2022-JP", "EUC-JP", "iso2022");
|
8
|
+
rb_declare_transcoder("EUC-JP", "stateless-ISO-2022-JP", "iso2022");
|
9
|
+
rb_declare_transcoder("EUC-JP", "Shift_JIS", "japanese");
|
10
|
+
rb_declare_transcoder("Shift_JIS", "EUC-JP", "japanese");
|
11
|
+
rb_declare_transcoder("EUC-JP", "UTF-8", "japanese_euc");
|
12
|
+
rb_declare_transcoder("eucJP-ms", "UTF-8", "japanese_euc");
|
13
|
+
rb_declare_transcoder("CP51932", "UTF-8", "japanese_euc");
|
14
|
+
rb_declare_transcoder("UTF-8", "EUC-JP", "japanese_euc");
|
15
|
+
rb_declare_transcoder("UTF-8", "eucJP-ms", "japanese_euc");
|
16
|
+
rb_declare_transcoder("UTF-8", "CP51932", "japanese_euc");
|
17
|
+
rb_declare_transcoder("Shift_JIS", "UTF-8", "japanese_sjis");
|
18
|
+
rb_declare_transcoder("Windows-31J", "UTF-8", "japanese_sjis");
|
19
|
+
rb_declare_transcoder("UTF-8", "Shift_JIS", "japanese_sjis");
|
20
|
+
rb_declare_transcoder("UTF-8", "Windows-31J", "japanese_sjis");
|
21
|
+
rb_declare_transcoder("UTF-8", "EUC-KR", "korean");
|
22
|
+
rb_declare_transcoder("EUC-KR", "UTF-8", "korean");
|
23
|
+
rb_declare_transcoder("UTF-8", "CP949", "korean");
|
24
|
+
rb_declare_transcoder("CP949", "UTF-8", "korean");
|
25
|
+
rb_declare_transcoder("", "universal_newline", "newline");
|
26
|
+
rb_declare_transcoder("", "crlf_newline", "newline");
|
27
|
+
rb_declare_transcoder("", "cr_newline", "newline");
|
28
|
+
rb_declare_transcoder("US-ASCII", "UTF-8", "single_byte");
|
29
|
+
rb_declare_transcoder("UTF-8", "US-ASCII", "single_byte");
|
30
|
+
rb_declare_transcoder("ASCII-8BIT", "UTF-8", "single_byte");
|
31
|
+
rb_declare_transcoder("UTF-8", "ASCII-8BIT", "single_byte");
|
32
|
+
rb_declare_transcoder("ISO-8859-1", "UTF-8", "single_byte");
|
33
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-1", "single_byte");
|
34
|
+
rb_declare_transcoder("ISO-8859-2", "UTF-8", "single_byte");
|
35
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-2", "single_byte");
|
36
|
+
rb_declare_transcoder("ISO-8859-3", "UTF-8", "single_byte");
|
37
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-3", "single_byte");
|
38
|
+
rb_declare_transcoder("ISO-8859-4", "UTF-8", "single_byte");
|
39
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-4", "single_byte");
|
40
|
+
rb_declare_transcoder("ISO-8859-5", "UTF-8", "single_byte");
|
41
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-5", "single_byte");
|
42
|
+
rb_declare_transcoder("ISO-8859-6", "UTF-8", "single_byte");
|
43
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-6", "single_byte");
|
44
|
+
rb_declare_transcoder("ISO-8859-7", "UTF-8", "single_byte");
|
45
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-7", "single_byte");
|
46
|
+
rb_declare_transcoder("ISO-8859-8", "UTF-8", "single_byte");
|
47
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-8", "single_byte");
|
48
|
+
rb_declare_transcoder("ISO-8859-9", "UTF-8", "single_byte");
|
49
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-9", "single_byte");
|
50
|
+
rb_declare_transcoder("ISO-8859-10", "UTF-8", "single_byte");
|
51
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-10", "single_byte");
|
52
|
+
rb_declare_transcoder("ISO-8859-11", "UTF-8", "single_byte");
|
53
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-11", "single_byte");
|
54
|
+
rb_declare_transcoder("ISO-8859-13", "UTF-8", "single_byte");
|
55
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-13", "single_byte");
|
56
|
+
rb_declare_transcoder("ISO-8859-14", "UTF-8", "single_byte");
|
57
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-14", "single_byte");
|
58
|
+
rb_declare_transcoder("ISO-8859-15", "UTF-8", "single_byte");
|
59
|
+
rb_declare_transcoder("UTF-8", "ISO-8859-15", "single_byte");
|
60
|
+
rb_declare_transcoder("WINDOWS-874", "UTF-8", "single_byte");
|
61
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-874", "single_byte");
|
62
|
+
rb_declare_transcoder("WINDOWS-1250", "UTF-8", "single_byte");
|
63
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1250", "single_byte");
|
64
|
+
rb_declare_transcoder("WINDOWS-1251", "UTF-8", "single_byte");
|
65
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1251", "single_byte");
|
66
|
+
rb_declare_transcoder("WINDOWS-1252", "UTF-8", "single_byte");
|
67
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1252", "single_byte");
|
68
|
+
rb_declare_transcoder("WINDOWS-1253", "UTF-8", "single_byte");
|
69
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1253", "single_byte");
|
70
|
+
rb_declare_transcoder("WINDOWS-1254", "UTF-8", "single_byte");
|
71
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1254", "single_byte");
|
72
|
+
rb_declare_transcoder("WINDOWS-1255", "UTF-8", "single_byte");
|
73
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1255", "single_byte");
|
74
|
+
rb_declare_transcoder("WINDOWS-1256", "UTF-8", "single_byte");
|
75
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1256", "single_byte");
|
76
|
+
rb_declare_transcoder("WINDOWS-1257", "UTF-8", "single_byte");
|
77
|
+
rb_declare_transcoder("UTF-8", "WINDOWS-1257", "single_byte");
|
78
|
+
rb_declare_transcoder("UTF-16BE", "UTF-8", "utf_16_32");
|
79
|
+
rb_declare_transcoder("UTF-8", "UTF-16BE", "utf_16_32");
|
80
|
+
rb_declare_transcoder("UTF-16LE", "UTF-8", "utf_16_32");
|
81
|
+
rb_declare_transcoder("UTF-8", "UTF-16LE", "utf_16_32");
|
82
|
+
rb_declare_transcoder("UTF-32BE", "UTF-8", "utf_16_32");
|
83
|
+
rb_declare_transcoder("UTF-8", "UTF-32BE", "utf_16_32");
|
84
|
+
rb_declare_transcoder("UTF-32LE", "UTF-8", "utf_16_32");
|
85
|
+
rb_declare_transcoder("UTF-8", "UTF-32LE", "utf_16_32");
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#define RUBY_VERSION "1.9.1"
|
2
|
+
#define RUBY_RELEASE_DATE "2008-10-28"
|
3
|
+
#define RUBY_VERSION_CODE 191
|
4
|
+
#define RUBY_RELEASE_CODE 20081028
|
5
|
+
#define RUBY_PATCHLEVEL 0
|
6
|
+
|
7
|
+
#define RUBY_VERSION_MAJOR 1
|
8
|
+
#define RUBY_VERSION_MINOR 9
|
9
|
+
#define RUBY_VERSION_TEENY 1
|
10
|
+
#define RUBY_RELEASE_YEAR 2008
|
11
|
+
#define RUBY_RELEASE_MONTH 10
|
12
|
+
#define RUBY_RELEASE_DAY 28
|
13
|
+
|
14
|
+
#ifdef RUBY_EXTERN
|
15
|
+
RUBY_EXTERN const char ruby_version[];
|
16
|
+
RUBY_EXTERN const char ruby_release_date[];
|
17
|
+
RUBY_EXTERN const char ruby_platform[];
|
18
|
+
RUBY_EXTERN const int ruby_patchlevel;
|
19
|
+
RUBY_EXTERN const char ruby_description[];
|
20
|
+
RUBY_EXTERN const char ruby_copyright[];
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#define RUBY_AUTHOR "Yukihiro Matsumoto"
|
24
|
+
#define RUBY_BIRTH_YEAR 1993
|
25
|
+
#define RUBY_BIRTH_MONTH 2
|
26
|
+
#define RUBY_BIRTH_DAY 24
|
27
|
+
|
28
|
+
#ifndef RUBY_REVISION
|
29
|
+
#include "revision.h"
|
30
|
+
#endif
|
31
|
+
#ifndef RUBY_REVISION
|
32
|
+
#define RUBY_REVISION 0
|
33
|
+
#endif
|
34
|
+
|
35
|
+
#if RUBY_PATCHLEVEL
|
36
|
+
#define RUBY_PATCHLEVEL_STR " patchlevel "STRINGIZE(RUBY_PATCHLEVEL)
|
37
|
+
#else
|
38
|
+
#define RUBY_PATCHLEVEL_STR ""
|
39
|
+
#endif
|
40
|
+
#if RUBY_REVISION
|
41
|
+
#ifdef RUBY_BRANCH_NAME
|
42
|
+
#define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "STRINGIZE(RUBY_REVISION)
|
43
|
+
#else
|
44
|
+
#define RUBY_REVISION_STR " revision "STRINGIZE(RUBY_REVISION)
|
45
|
+
#endif
|
46
|
+
#else
|
47
|
+
#define RUBY_REVISION_STR ""
|
48
|
+
#endif
|
49
|
+
|
50
|
+
# define RUBY_DESCRIPTION \
|
51
|
+
"ruby "RUBY_VERSION \
|
52
|
+
" ("RUBY_RELEASE_DATE \
|
53
|
+
RUBY_PATCHLEVEL_STR \
|
54
|
+
RUBY_REVISION_STR") " \
|
55
|
+
"["RUBY_PLATFORM"]"
|
56
|
+
# define RUBY_COPYRIGHT \
|
57
|
+
"ruby - Copyright (C) " \
|
58
|
+
STRINGIZE(RUBY_BIRTH_YEAR)"-" \
|
59
|
+
STRINGIZE(RUBY_RELEASE_YEAR)" " \
|
60
|
+
RUBY_AUTHOR
|
@@ -0,0 +1,655 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
vm_core.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 19:41:38 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_VM_CORE_H
|
13
|
+
#define RUBY_VM_CORE_H
|
14
|
+
|
15
|
+
#define RUBY_VM_THREAD_MODEL 2
|
16
|
+
|
17
|
+
#include "ruby/ruby.h"
|
18
|
+
#include "ruby/st.h"
|
19
|
+
|
20
|
+
#include "node.h"
|
21
|
+
#include "debug.h"
|
22
|
+
#include "vm_opts.h"
|
23
|
+
#include "id.h"
|
24
|
+
|
25
|
+
#if defined(_WIN32)
|
26
|
+
#include "thread_win32.h"
|
27
|
+
#elif defined(HAVE_PTHREAD_H)
|
28
|
+
#include "thread_pthread.h"
|
29
|
+
#else
|
30
|
+
#error "unsupported thread type"
|
31
|
+
#endif
|
32
|
+
|
33
|
+
#include <setjmp.h>
|
34
|
+
#include <signal.h>
|
35
|
+
|
36
|
+
#ifndef NSIG
|
37
|
+
# define NSIG (_SIGMAX + 1) /* For QNX */
|
38
|
+
#endif
|
39
|
+
|
40
|
+
#define RUBY_NSIG NSIG
|
41
|
+
|
42
|
+
#ifdef HAVE_STDARG_PROTOTYPES
|
43
|
+
#include <stdarg.h>
|
44
|
+
#define va_init_list(a,b) va_start(a,b)
|
45
|
+
#else
|
46
|
+
#include <varargs.h>
|
47
|
+
#define va_init_list(a,b) va_start(a)
|
48
|
+
#endif
|
49
|
+
|
50
|
+
/*****************/
|
51
|
+
/* configuration */
|
52
|
+
/*****************/
|
53
|
+
|
54
|
+
/* gcc ver. check */
|
55
|
+
#if defined(__GNUC__) && __GNUC__ >= 2
|
56
|
+
|
57
|
+
#if OPT_TOKEN_THREADED_CODE
|
58
|
+
#if OPT_DIRECT_THREADED_CODE
|
59
|
+
#undef OPT_DIRECT_THREADED_CODE
|
60
|
+
#endif
|
61
|
+
#endif
|
62
|
+
|
63
|
+
#else /* defined(__GNUC__) && __GNUC__ >= 2 */
|
64
|
+
|
65
|
+
/* disable threaded code options */
|
66
|
+
#if OPT_DIRECT_THREADED_CODE
|
67
|
+
#undef OPT_DIRECT_THREADED_CODE
|
68
|
+
#endif
|
69
|
+
#if OPT_TOKEN_THREADED_CODE
|
70
|
+
#undef OPT_TOKEN_THREADED_CODE
|
71
|
+
#endif
|
72
|
+
#endif
|
73
|
+
|
74
|
+
/* call threaded code */
|
75
|
+
#if OPT_CALL_THREADED_CODE
|
76
|
+
#if OPT_DIRECT_THREADED_CODE
|
77
|
+
#undef OPT_DIRECT_THREADED_CODE
|
78
|
+
#endif /* OPT_DIRECT_THREADED_CODE */
|
79
|
+
#if OPT_STACK_CACHING
|
80
|
+
#undef OPT_STACK_CACHING
|
81
|
+
#endif /* OPT_STACK_CACHING */
|
82
|
+
#endif /* OPT_CALL_THREADED_CODE */
|
83
|
+
|
84
|
+
/* likely */
|
85
|
+
#if __GNUC__ >= 3
|
86
|
+
#define LIKELY(x) (__builtin_expect((x), 1))
|
87
|
+
#define UNLIKELY(x) (__builtin_expect((x), 0))
|
88
|
+
#else /* __GNUC__ >= 3 */
|
89
|
+
#define LIKELY(x) (x)
|
90
|
+
#define UNLIKELY(x) (x)
|
91
|
+
#endif /* __GNUC__ >= 3 */
|
92
|
+
|
93
|
+
typedef unsigned long rb_num_t;
|
94
|
+
|
95
|
+
struct iseq_compile_data_ensure_node_stack;
|
96
|
+
|
97
|
+
typedef struct rb_compile_option_struct {
|
98
|
+
int inline_const_cache;
|
99
|
+
int peephole_optimization;
|
100
|
+
int tailcall_optimization;
|
101
|
+
int specialized_instruction;
|
102
|
+
int operands_unification;
|
103
|
+
int instructions_unification;
|
104
|
+
int stack_caching;
|
105
|
+
int trace_instruction;
|
106
|
+
int debug_level;
|
107
|
+
} rb_compile_option_t;
|
108
|
+
|
109
|
+
#if 1
|
110
|
+
#define GetCoreDataFromValue(obj, type, ptr) do { \
|
111
|
+
ptr = (type*)DATA_PTR(obj); \
|
112
|
+
} while (0)
|
113
|
+
#else
|
114
|
+
#define GetCoreDataFromValue(obj, type, ptr) Data_Get_Struct(obj, type, ptr)
|
115
|
+
#endif
|
116
|
+
|
117
|
+
#define GetISeqPtr(obj, ptr) \
|
118
|
+
GetCoreDataFromValue(obj, rb_iseq_t, ptr)
|
119
|
+
|
120
|
+
struct rb_iseq_struct;
|
121
|
+
|
122
|
+
struct rb_iseq_struct {
|
123
|
+
/***************/
|
124
|
+
/* static data */
|
125
|
+
/***************/
|
126
|
+
|
127
|
+
VALUE type; /* instruction sequence type */
|
128
|
+
VALUE name; /* String: iseq name */
|
129
|
+
VALUE filename; /* file information where this sequence from */
|
130
|
+
VALUE *iseq; /* iseq (insn number and openrads) */
|
131
|
+
VALUE *iseq_encoded; /* encoded iseq */
|
132
|
+
unsigned long iseq_size;
|
133
|
+
VALUE mark_ary; /* Array: includes operands which should be GC marked */
|
134
|
+
VALUE coverage; /* coverage array */
|
135
|
+
|
136
|
+
/* insn info, must be freed */
|
137
|
+
struct iseq_insn_info_entry *insn_info_table;
|
138
|
+
unsigned long insn_info_size;
|
139
|
+
|
140
|
+
ID *local_table; /* must free */
|
141
|
+
int local_table_size;
|
142
|
+
|
143
|
+
/* method, class frame: sizeof(vars) + 1, block frame: sizeof(vars) */
|
144
|
+
int local_size;
|
145
|
+
|
146
|
+
/**
|
147
|
+
* argument information
|
148
|
+
*
|
149
|
+
* def m(a1, a2, ..., aM, # mandatory
|
150
|
+
* b1=(...), b2=(...), ..., bN=(...), # optinal
|
151
|
+
* *c, # rest
|
152
|
+
* d1, d2, ..., dO, # post
|
153
|
+
* &e) # block
|
154
|
+
* =>
|
155
|
+
*
|
156
|
+
* argc = M
|
157
|
+
* arg_rest = M+N+1 // or -1 if no rest arg
|
158
|
+
* arg_opts = N
|
159
|
+
* arg_opts_tbl = [ (N entries) ]
|
160
|
+
* arg_post_len = O // 0 if no post arguments
|
161
|
+
* arg_post_start = M+N+2
|
162
|
+
* arg_block = M+N + 1 + O + 1 // -1 if no block arg
|
163
|
+
* arg_simple = 0 if not simple arguments.
|
164
|
+
* = 1 if no opt, rest, post, block.
|
165
|
+
* = 2 if ambiguos block parameter ({|a|}).
|
166
|
+
* arg_size = argument size.
|
167
|
+
*/
|
168
|
+
|
169
|
+
int argc;
|
170
|
+
int arg_simple;
|
171
|
+
int arg_rest;
|
172
|
+
int arg_block;
|
173
|
+
int arg_opts;
|
174
|
+
int arg_post_len;
|
175
|
+
int arg_post_start;
|
176
|
+
int arg_size;
|
177
|
+
VALUE *arg_opt_table;
|
178
|
+
|
179
|
+
int stack_max; /* for stack overflow check */
|
180
|
+
|
181
|
+
/* catch table */
|
182
|
+
struct iseq_catch_table_entry *catch_table;
|
183
|
+
int catch_table_size;
|
184
|
+
|
185
|
+
/* for child iseq */
|
186
|
+
struct rb_iseq_struct *parent_iseq;
|
187
|
+
struct rb_iseq_struct *local_iseq;
|
188
|
+
|
189
|
+
/****************/
|
190
|
+
/* dynamic data */
|
191
|
+
/****************/
|
192
|
+
|
193
|
+
VALUE self;
|
194
|
+
VALUE orig; /* non-NULL if its data have origin */
|
195
|
+
|
196
|
+
/* block inlining */
|
197
|
+
/*
|
198
|
+
* NODE *node;
|
199
|
+
* void *special_block_builder;
|
200
|
+
* void *cached_special_block_builder;
|
201
|
+
* VALUE cached_special_block;
|
202
|
+
*/
|
203
|
+
|
204
|
+
/* klass/module nest information stack (cref) */
|
205
|
+
NODE *cref_stack;
|
206
|
+
VALUE klass;
|
207
|
+
|
208
|
+
/* misc */
|
209
|
+
ID defined_method_id; /* for define_method */
|
210
|
+
|
211
|
+
/* used at compile time */
|
212
|
+
struct iseq_compile_data *compile_data;
|
213
|
+
};
|
214
|
+
|
215
|
+
enum ruby_special_exceptions {
|
216
|
+
ruby_error_reenter,
|
217
|
+
ruby_error_nomemory,
|
218
|
+
ruby_error_sysstack,
|
219
|
+
ruby_special_error_count
|
220
|
+
};
|
221
|
+
|
222
|
+
typedef struct rb_iseq_struct rb_iseq_t;
|
223
|
+
|
224
|
+
#define GetVMPtr(obj, ptr) \
|
225
|
+
GetCoreDataFromValue(obj, rb_vm_t, ptr)
|
226
|
+
|
227
|
+
typedef struct rb_vm_struct {
|
228
|
+
VALUE self;
|
229
|
+
|
230
|
+
rb_thread_lock_t global_vm_lock;
|
231
|
+
|
232
|
+
struct rb_thread_struct *main_thread;
|
233
|
+
struct rb_thread_struct *running_thread;
|
234
|
+
|
235
|
+
st_table *living_threads;
|
236
|
+
VALUE thgroup_default;
|
237
|
+
|
238
|
+
int running;
|
239
|
+
int thread_abort_on_exception;
|
240
|
+
unsigned long trace_flag;
|
241
|
+
volatile int sleeper;
|
242
|
+
|
243
|
+
/* object management */
|
244
|
+
VALUE mark_object_ary;
|
245
|
+
|
246
|
+
VALUE special_exceptions[ruby_special_error_count];
|
247
|
+
|
248
|
+
/* load */
|
249
|
+
VALUE top_self;
|
250
|
+
VALUE load_path;
|
251
|
+
VALUE loaded_features;
|
252
|
+
struct st_table *loading_table;
|
253
|
+
|
254
|
+
/* signal */
|
255
|
+
struct {
|
256
|
+
VALUE cmd;
|
257
|
+
int safe;
|
258
|
+
} trap_list[RUBY_NSIG];
|
259
|
+
|
260
|
+
/* hook */
|
261
|
+
rb_event_hook_t *event_hooks;
|
262
|
+
|
263
|
+
int src_encoding_index;
|
264
|
+
|
265
|
+
VALUE verbose, debug, progname;
|
266
|
+
VALUE coverages;
|
267
|
+
|
268
|
+
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
|
269
|
+
struct rb_objspace *objspace;
|
270
|
+
#endif
|
271
|
+
} rb_vm_t;
|
272
|
+
|
273
|
+
typedef struct {
|
274
|
+
VALUE *pc; /* cfp[0] */
|
275
|
+
VALUE *sp; /* cfp[1] */
|
276
|
+
VALUE *bp; /* cfp[2] */
|
277
|
+
rb_iseq_t *iseq; /* cfp[3] */
|
278
|
+
VALUE flag; /* cfp[4] */
|
279
|
+
VALUE self; /* cfp[5] / block[0] */
|
280
|
+
VALUE *lfp; /* cfp[6] / block[1] */
|
281
|
+
VALUE *dfp; /* cfp[7] / block[2] */
|
282
|
+
rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
|
283
|
+
VALUE proc; /* cfp[9] / block[4] */
|
284
|
+
ID method_id; /* cfp[10] saved in special case */
|
285
|
+
VALUE method_class; /* cfp[11] saved in special case */
|
286
|
+
} rb_control_frame_t;
|
287
|
+
|
288
|
+
typedef struct rb_block_struct {
|
289
|
+
VALUE self; /* share with method frame if it's only block */
|
290
|
+
VALUE *lfp; /* share with method frame if it's only block */
|
291
|
+
VALUE *dfp; /* share with method frame if it's only block */
|
292
|
+
rb_iseq_t *iseq;
|
293
|
+
VALUE proc;
|
294
|
+
} rb_block_t;
|
295
|
+
|
296
|
+
#define GetThreadPtr(obj, ptr) \
|
297
|
+
GetCoreDataFromValue(obj, rb_thread_t, ptr)
|
298
|
+
|
299
|
+
enum rb_thread_status {
|
300
|
+
THREAD_TO_KILL,
|
301
|
+
THREAD_RUNNABLE,
|
302
|
+
THREAD_STOPPED,
|
303
|
+
THREAD_STOPPED_FOREVER,
|
304
|
+
THREAD_KILLED
|
305
|
+
};
|
306
|
+
|
307
|
+
typedef RUBY_JMP_BUF rb_jmpbuf_t;
|
308
|
+
|
309
|
+
struct rb_vm_tag {
|
310
|
+
rb_jmpbuf_t buf;
|
311
|
+
VALUE tag;
|
312
|
+
VALUE retval;
|
313
|
+
struct rb_vm_tag *prev;
|
314
|
+
};
|
315
|
+
|
316
|
+
struct rb_vm_trap_tag {
|
317
|
+
struct rb_vm_trap_tag *prev;
|
318
|
+
};
|
319
|
+
|
320
|
+
#define RUBY_VM_VALUE_CACHE_SIZE 0x1000
|
321
|
+
#define USE_VALUE_CACHE 0
|
322
|
+
|
323
|
+
struct rb_unblock_callback {
|
324
|
+
rb_unblock_function_t *func;
|
325
|
+
void *arg;
|
326
|
+
};
|
327
|
+
|
328
|
+
struct rb_mutex_struct;
|
329
|
+
|
330
|
+
typedef struct rb_thread_struct
|
331
|
+
{
|
332
|
+
VALUE self;
|
333
|
+
rb_vm_t *vm;
|
334
|
+
|
335
|
+
/* execution information */
|
336
|
+
VALUE *stack; /* must free, must mark */
|
337
|
+
unsigned long stack_size;
|
338
|
+
rb_control_frame_t *cfp;
|
339
|
+
int safe_level;
|
340
|
+
int raised_flag;
|
341
|
+
VALUE last_status; /* $? */
|
342
|
+
|
343
|
+
/* passing state */
|
344
|
+
int state;
|
345
|
+
|
346
|
+
/* for rb_iterate */
|
347
|
+
rb_block_t *passed_block;
|
348
|
+
|
349
|
+
/* for load(true) */
|
350
|
+
VALUE top_self;
|
351
|
+
VALUE top_wrapper;
|
352
|
+
|
353
|
+
/* eval env */
|
354
|
+
rb_block_t *base_block;
|
355
|
+
|
356
|
+
VALUE *local_lfp;
|
357
|
+
VALUE local_svar;
|
358
|
+
|
359
|
+
/* thread control */
|
360
|
+
rb_thread_id_t thread_id;
|
361
|
+
enum rb_thread_status status;
|
362
|
+
int priority;
|
363
|
+
int slice;
|
364
|
+
|
365
|
+
native_thread_data_t native_thread_data;
|
366
|
+
|
367
|
+
VALUE thgroup;
|
368
|
+
VALUE value;
|
369
|
+
|
370
|
+
VALUE errinfo;
|
371
|
+
VALUE thrown_errinfo;
|
372
|
+
int exec_signal;
|
373
|
+
|
374
|
+
int interrupt_flag;
|
375
|
+
rb_thread_lock_t interrupt_lock;
|
376
|
+
struct rb_unblock_callback unblock;
|
377
|
+
VALUE locking_mutex;
|
378
|
+
struct rb_mutex_struct *keeping_mutexes;
|
379
|
+
int transition_for_lock;
|
380
|
+
|
381
|
+
struct rb_vm_tag *tag;
|
382
|
+
struct rb_vm_trap_tag *trap_tag;
|
383
|
+
|
384
|
+
int parse_in_eval;
|
385
|
+
int mild_compile_error;
|
386
|
+
|
387
|
+
/* storage */
|
388
|
+
st_table *local_storage;
|
389
|
+
#if USE_VALUE_CACHE
|
390
|
+
VALUE value_cache[RUBY_VM_VALUE_CACHE_SIZE + 1];
|
391
|
+
VALUE *value_cache_ptr;
|
392
|
+
#endif
|
393
|
+
|
394
|
+
struct rb_thread_struct *join_list_next;
|
395
|
+
struct rb_thread_struct *join_list_head;
|
396
|
+
|
397
|
+
VALUE first_proc;
|
398
|
+
VALUE first_args;
|
399
|
+
VALUE (*first_func)(ANYARGS);
|
400
|
+
|
401
|
+
/* for GC */
|
402
|
+
VALUE *machine_stack_start;
|
403
|
+
VALUE *machine_stack_end;
|
404
|
+
size_t machine_stack_maxsize;
|
405
|
+
#ifdef __ia64
|
406
|
+
VALUE *machine_register_stack_start;
|
407
|
+
VALUE *machine_register_stack_end;
|
408
|
+
size_t machine_register_stack_maxsize;
|
409
|
+
#endif
|
410
|
+
jmp_buf machine_regs;
|
411
|
+
int mark_stack_len;
|
412
|
+
|
413
|
+
/* statistics data for profiler */
|
414
|
+
VALUE stat_insn_usage;
|
415
|
+
|
416
|
+
/* tracer */
|
417
|
+
rb_event_hook_t *event_hooks;
|
418
|
+
rb_event_flag_t event_flags;
|
419
|
+
int tracing;
|
420
|
+
|
421
|
+
/* fiber */
|
422
|
+
VALUE fiber;
|
423
|
+
VALUE root_fiber;
|
424
|
+
rb_jmpbuf_t root_jmpbuf;
|
425
|
+
|
426
|
+
/* misc */
|
427
|
+
int method_missing_reason;
|
428
|
+
int abort_on_exception;
|
429
|
+
} rb_thread_t;
|
430
|
+
|
431
|
+
/* iseq.c */
|
432
|
+
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
|
433
|
+
VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent);
|
434
|
+
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
|
435
|
+
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
|
436
|
+
VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
|
437
|
+
VALUE ruby_iseq_disasm(VALUE self);
|
438
|
+
VALUE ruby_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
|
439
|
+
const char *ruby_node_name(int node);
|
440
|
+
int rb_iseq_first_lineno(rb_iseq_t *iseq);
|
441
|
+
|
442
|
+
RUBY_EXTERN VALUE rb_cISeq;
|
443
|
+
RUBY_EXTERN VALUE rb_cRubyVM;
|
444
|
+
RUBY_EXTERN VALUE rb_cEnv;
|
445
|
+
RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
|
446
|
+
|
447
|
+
/* each thread has this size stack : 128KB */
|
448
|
+
#define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
|
449
|
+
|
450
|
+
struct global_entry {
|
451
|
+
struct global_variable *var;
|
452
|
+
ID id;
|
453
|
+
};
|
454
|
+
|
455
|
+
#define GetProcPtr(obj, ptr) \
|
456
|
+
GetCoreDataFromValue(obj, rb_proc_t, ptr)
|
457
|
+
|
458
|
+
typedef struct {
|
459
|
+
rb_block_t block;
|
460
|
+
|
461
|
+
VALUE envval; /* for GC mark */
|
462
|
+
VALUE blockprocval;
|
463
|
+
int safe_level;
|
464
|
+
int is_from_method;
|
465
|
+
int is_lambda;
|
466
|
+
} rb_proc_t;
|
467
|
+
|
468
|
+
#define GetEnvPtr(obj, ptr) \
|
469
|
+
GetCoreDataFromValue(obj, rb_env_t, ptr)
|
470
|
+
|
471
|
+
typedef struct {
|
472
|
+
VALUE *env;
|
473
|
+
int env_size;
|
474
|
+
int local_size;
|
475
|
+
VALUE prev_envval; /* for GC mark */
|
476
|
+
rb_block_t block;
|
477
|
+
} rb_env_t;
|
478
|
+
|
479
|
+
#define GetBindingPtr(obj, ptr) \
|
480
|
+
GetCoreDataFromValue(obj, rb_binding_t, ptr)
|
481
|
+
|
482
|
+
typedef struct {
|
483
|
+
VALUE env;
|
484
|
+
} rb_binding_t;
|
485
|
+
|
486
|
+
|
487
|
+
/* used by compile time and send insn */
|
488
|
+
#define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
|
489
|
+
#define VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)
|
490
|
+
#define VM_CALL_FCALL_BIT (0x01 << 3)
|
491
|
+
#define VM_CALL_VCALL_BIT (0x01 << 4)
|
492
|
+
#define VM_CALL_TAILCALL_BIT (0x01 << 5)
|
493
|
+
#define VM_CALL_TAILRECURSION_BIT (0x01 << 6)
|
494
|
+
#define VM_CALL_SUPER_BIT (0x01 << 7)
|
495
|
+
#define VM_CALL_SEND_BIT (0x01 << 8)
|
496
|
+
|
497
|
+
#define VM_SPECIAL_OBJECT_VMCORE 0x01
|
498
|
+
#define VM_SPECIAL_OBJECT_CBASE 0x02
|
499
|
+
|
500
|
+
#define VM_FRAME_MAGIC_METHOD 0x11
|
501
|
+
#define VM_FRAME_MAGIC_BLOCK 0x21
|
502
|
+
#define VM_FRAME_MAGIC_CLASS 0x31
|
503
|
+
#define VM_FRAME_MAGIC_TOP 0x41
|
504
|
+
#define VM_FRAME_MAGIC_FINISH 0x51
|
505
|
+
#define VM_FRAME_MAGIC_CFUNC 0x61
|
506
|
+
#define VM_FRAME_MAGIC_PROC 0x71
|
507
|
+
#define VM_FRAME_MAGIC_IFUNC 0x81
|
508
|
+
#define VM_FRAME_MAGIC_EVAL 0x91
|
509
|
+
#define VM_FRAME_MAGIC_LAMBDA 0xa1
|
510
|
+
#define VM_FRAME_MAGIC_MASK_BITS 8
|
511
|
+
#define VM_FRAME_MAGIC_MASK (~(~0<<VM_FRAME_MAGIC_MASK_BITS))
|
512
|
+
|
513
|
+
#define VM_FRAME_TYPE(cfp) ((cfp)->flag & VM_FRAME_MAGIC_MASK)
|
514
|
+
|
515
|
+
/* other frame flag */
|
516
|
+
#define VM_FRAME_FLAG_PASSED 0x0100
|
517
|
+
|
518
|
+
|
519
|
+
#define RUBYVM_CFUNC_FRAME_P(cfp) \
|
520
|
+
(VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
|
521
|
+
|
522
|
+
|
523
|
+
/* inline (method|const) cache */
|
524
|
+
#define NEW_INLINE_CACHE_ENTRY() NEW_WHILE(Qundef, 0, 0)
|
525
|
+
#define ic_class u1.value
|
526
|
+
#define ic_method u2.node
|
527
|
+
#define ic_value u2.value
|
528
|
+
#define ic_vmstat u3.cnt
|
529
|
+
typedef NODE *IC;
|
530
|
+
|
531
|
+
void rb_vm_change_state(void);
|
532
|
+
|
533
|
+
typedef VALUE CDHASH;
|
534
|
+
|
535
|
+
#ifndef FUNC_FASTCALL
|
536
|
+
#define FUNC_FASTCALL(x) x
|
537
|
+
#endif
|
538
|
+
|
539
|
+
typedef rb_control_frame_t *
|
540
|
+
(FUNC_FASTCALL(*rb_insn_func_t))(rb_thread_t *, rb_control_frame_t *);
|
541
|
+
|
542
|
+
#define GC_GUARDED_PTR(p) ((VALUE)((VALUE)(p) | 0x01))
|
543
|
+
#define GC_GUARDED_PTR_REF(p) ((void *)(((VALUE)p) & ~0x03))
|
544
|
+
#define GC_GUARDED_PTR_P(p) (((VALUE)p) & 0x01)
|
545
|
+
|
546
|
+
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp) (cfp+1)
|
547
|
+
#define RUBY_VM_NEXT_CONTROL_FRAME(cfp) (cfp-1)
|
548
|
+
#define RUBY_VM_END_CONTROL_FRAME(th) \
|
549
|
+
((rb_control_frame_t *)((th)->stack + (th)->stack_size))
|
550
|
+
#define RUBY_VM_VALID_CONTROL_FRAME_P(cfp, ecfp) \
|
551
|
+
((void *)(ecfp) > (void *)(cfp))
|
552
|
+
#define RUBY_VM_CONTROL_FRAME_STACK_OVERFLOW_P(th, cfp) \
|
553
|
+
(!RUBY_VM_VALID_CONTROL_FRAME_P((cfp), RUBY_VM_END_CONTROL_FRAME(th)))
|
554
|
+
|
555
|
+
#define RUBY_VM_IFUNC_P(ptr) (BUILTIN_TYPE(ptr) == T_NODE)
|
556
|
+
#define RUBY_VM_NORMAL_ISEQ_P(ptr) \
|
557
|
+
(ptr && !RUBY_VM_IFUNC_P(ptr))
|
558
|
+
|
559
|
+
#define RUBY_VM_CLASS_SPECIAL_P(ptr) (((VALUE)(ptr)) & 0x02)
|
560
|
+
|
561
|
+
#define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
|
562
|
+
#define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
|
563
|
+
((rb_control_frame_t *)((VALUE *)(b) - 5))
|
564
|
+
|
565
|
+
/* VM related object allocate functions */
|
566
|
+
VALUE rb_thread_alloc(VALUE klass);
|
567
|
+
VALUE rb_proc_alloc(VALUE klass);
|
568
|
+
|
569
|
+
/* for debug */
|
570
|
+
extern void vm_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
|
571
|
+
#define SDR() vm_stack_dump_raw(GET_THREAD(), GET_THREAD()->cfp)
|
572
|
+
#define SDR2(cfp) vm_stack_dump_raw(GET_THREAD(), (cfp))
|
573
|
+
void rb_vm_bugreport(void);
|
574
|
+
|
575
|
+
|
576
|
+
/* functions about thread/vm execution */
|
577
|
+
|
578
|
+
VALUE rb_iseq_eval(VALUE iseqval);
|
579
|
+
void rb_enable_interrupt(void);
|
580
|
+
void rb_disable_interrupt(void);
|
581
|
+
int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
|
582
|
+
|
583
|
+
VALUE vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
|
584
|
+
int argc, const VALUE *argv, rb_block_t *blockptr);
|
585
|
+
VALUE vm_make_proc(rb_thread_t *th, rb_control_frame_t *cfp, const rb_block_t *block, VALUE klass);
|
586
|
+
VALUE vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
|
587
|
+
|
588
|
+
NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
|
589
|
+
|
590
|
+
#define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
|
591
|
+
|
592
|
+
/* for thread */
|
593
|
+
|
594
|
+
#if RUBY_VM_THREAD_MODEL == 2
|
595
|
+
RUBY_EXTERN rb_thread_t *ruby_current_thread;
|
596
|
+
extern rb_vm_t *ruby_current_vm;
|
597
|
+
|
598
|
+
#define GET_VM() ruby_current_vm
|
599
|
+
#define GET_THREAD() ruby_current_thread
|
600
|
+
#define rb_thread_set_current_raw(th) (void)(ruby_current_thread = (th))
|
601
|
+
#define rb_thread_set_current(th) do { \
|
602
|
+
rb_thread_set_current_raw(th); \
|
603
|
+
th->vm->running_thread = th; \
|
604
|
+
} while (0)
|
605
|
+
|
606
|
+
#else
|
607
|
+
#error "unsupported thread model"
|
608
|
+
#endif
|
609
|
+
|
610
|
+
#define RUBY_VM_SET_INTERRUPT(th) ((th)->interrupt_flag |= 0x02)
|
611
|
+
#define RUBY_VM_SET_TIMER_INTERRUPT(th) ((th)->interrupt_flag |= 0x01)
|
612
|
+
#define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
|
613
|
+
#define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
|
614
|
+
|
615
|
+
void rb_thread_execute_interrupts(rb_thread_t *);
|
616
|
+
|
617
|
+
#define RUBY_VM_CHECK_INTS_TH(th) do { \
|
618
|
+
if (UNLIKELY(th->interrupt_flag)) { \
|
619
|
+
rb_thread_execute_interrupts(th); \
|
620
|
+
} \
|
621
|
+
} while (0)
|
622
|
+
|
623
|
+
#define RUBY_VM_CHECK_INTS() \
|
624
|
+
RUBY_VM_CHECK_INTS_TH(GET_THREAD())
|
625
|
+
|
626
|
+
/* tracer */
|
627
|
+
static inline void
|
628
|
+
exec_event_hooks(rb_event_hook_t *hook, rb_event_flag_t flag, VALUE self, ID id, VALUE klass)
|
629
|
+
{
|
630
|
+
if (self == rb_mRubyVMFrozenCore) return;
|
631
|
+
while (hook) {
|
632
|
+
if (flag & hook->flag) {
|
633
|
+
(*hook->func)(flag, hook->data, self, id, klass);
|
634
|
+
}
|
635
|
+
hook = hook->next;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
|
639
|
+
#define EXEC_EVENT_HOOK(th, flag, self, id, klass) do { \
|
640
|
+
rb_event_flag_t wait_event__ = th->event_flags; \
|
641
|
+
if (UNLIKELY(wait_event__)) { \
|
642
|
+
if (wait_event__ & (flag | RUBY_EVENT_VM)) { \
|
643
|
+
VALUE self__ = (self), klass__ = (klass); \
|
644
|
+
ID id__ = (id); \
|
645
|
+
if (wait_event__ & flag) { \
|
646
|
+
exec_event_hooks(th->event_hooks, flag, self__, id__, klass__); \
|
647
|
+
} \
|
648
|
+
if (wait_event__ & RUBY_EVENT_VM) { \
|
649
|
+
exec_event_hooks(th->vm->event_hooks, flag, self__, id__, klass__); \
|
650
|
+
} \
|
651
|
+
} \
|
652
|
+
} \
|
653
|
+
} while (0)
|
654
|
+
|
655
|
+
#endif /* RUBY_VM_CORE_H */
|