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,75 @@
|
|
1
|
+
|
2
|
+
#ifndef RUBY_GC_H
|
3
|
+
#define RUBY_GC_H 1
|
4
|
+
|
5
|
+
#if defined(__i386) && defined(__GNUC__)
|
6
|
+
#define SET_MACHINE_STACK_END(p) __asm__("mov %%esp, %0" : "=r" (*p))
|
7
|
+
#else
|
8
|
+
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
|
9
|
+
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
|
10
|
+
#define USE_CONSERVATIVE_STACK_END
|
11
|
+
#endif
|
12
|
+
|
13
|
+
/* for GC debug */
|
14
|
+
|
15
|
+
#ifndef RUBY_MARK_FREE_DEBUG
|
16
|
+
#define RUBY_MARK_FREE_DEBUG 0
|
17
|
+
#endif
|
18
|
+
|
19
|
+
#if RUBY_MARK_FREE_DEBUG
|
20
|
+
extern int ruby_gc_debug_indent;
|
21
|
+
|
22
|
+
static void
|
23
|
+
rb_gc_debug_indent(void)
|
24
|
+
{
|
25
|
+
printf("%*s", ruby_gc_debug_indent, "");
|
26
|
+
}
|
27
|
+
|
28
|
+
static void
|
29
|
+
rb_gc_debug_body(char *mode, char *msg, int st, void *ptr)
|
30
|
+
{
|
31
|
+
if (st == 0) {
|
32
|
+
ruby_gc_debug_indent--;
|
33
|
+
}
|
34
|
+
rb_gc_debug_indent();
|
35
|
+
printf("%s: %s %s (%p)\n", mode, st ? "->" : "<-", msg, ptr);
|
36
|
+
|
37
|
+
if (st) {
|
38
|
+
ruby_gc_debug_indent++;
|
39
|
+
}
|
40
|
+
|
41
|
+
fflush(stdout);
|
42
|
+
}
|
43
|
+
|
44
|
+
#define RUBY_MARK_ENTER(msg) rb_gc_debug_body("mark", msg, 1, ptr)
|
45
|
+
#define RUBY_MARK_LEAVE(msg) rb_gc_debug_body("mark", msg, 0, ptr)
|
46
|
+
#define RUBY_FREE_ENTER(msg) rb_gc_debug_body("free", msg, 1, ptr)
|
47
|
+
#define RUBY_FREE_LEAVE(msg) rb_gc_debug_body("free", msg, 0, ptr)
|
48
|
+
#define RUBY_GC_INFO rb_gc_debug_indent(); printf
|
49
|
+
|
50
|
+
#else
|
51
|
+
#define RUBY_MARK_ENTER(msg)
|
52
|
+
#define RUBY_MARK_LEAVE(msg)
|
53
|
+
#define RUBY_FREE_ENTER(msg)
|
54
|
+
#define RUBY_FREE_LEAVE(msg)
|
55
|
+
#define RUBY_GC_INFO if(0)printf
|
56
|
+
#endif
|
57
|
+
|
58
|
+
#define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
|
59
|
+
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);}
|
60
|
+
|
61
|
+
#if STACK_GROW_DIRECTION > 0
|
62
|
+
# define STACK_UPPER(x, a, b) a
|
63
|
+
#elif STACK_GROW_DIRECTION < 0
|
64
|
+
# define STACK_UPPER(x, a, b) b
|
65
|
+
#else
|
66
|
+
RUBY_EXTERN int ruby_stack_grow_direction;
|
67
|
+
int ruby_get_stack_grow_direction(VALUE *addr);
|
68
|
+
# define stack_growup_p(x) ( \
|
69
|
+
(ruby_stack_grow_direction ? \
|
70
|
+
ruby_stack_grow_direction : \
|
71
|
+
ruby_get_stack_grow_direction(x)) > 0)
|
72
|
+
# define STACK_UPPER(x, a, b) (stack_growup_p(x) ? a : b)
|
73
|
+
#endif
|
74
|
+
|
75
|
+
#endif /* RUBY_GC_H */
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
id.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: Thu Jul 12 04:38:07 2007
|
7
|
+
|
8
|
+
Copyright (C) 2007 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_ID_H
|
13
|
+
#define RUBY_ID_H
|
14
|
+
|
15
|
+
#define ID_SCOPE_SHIFT 3
|
16
|
+
#define ID_SCOPE_MASK 0x07
|
17
|
+
#define ID_LOCAL 0x00
|
18
|
+
#define ID_INSTANCE 0x01
|
19
|
+
#define ID_GLOBAL 0x03
|
20
|
+
#define ID_ATTRSET 0x04
|
21
|
+
#define ID_CONST 0x05
|
22
|
+
#define ID_CLASS 0x06
|
23
|
+
#define ID_JUNK 0x07
|
24
|
+
#define ID_INTERNAL ID_JUNK
|
25
|
+
|
26
|
+
#include "parse.h"
|
27
|
+
|
28
|
+
#define symIFUNC ID2SYM(idIFUNC)
|
29
|
+
#define symCFUNC ID2SYM(idCFUNC)
|
30
|
+
|
31
|
+
enum ruby_method_ids {
|
32
|
+
idPLUS = '+',
|
33
|
+
idMINUS = '-',
|
34
|
+
idMULT = '*',
|
35
|
+
idDIV = '/',
|
36
|
+
idMOD = '%',
|
37
|
+
idLT = '<',
|
38
|
+
idLTLT = tLSHFT,
|
39
|
+
idLE = tLEQ,
|
40
|
+
idGT = '>',
|
41
|
+
idGE = tGEQ,
|
42
|
+
idEq = tEQ,
|
43
|
+
idEqq = tEQQ,
|
44
|
+
idNeq = tNEQ,
|
45
|
+
idNot = '!',
|
46
|
+
idBackquote = '`',
|
47
|
+
idEqTilde = tMATCH,
|
48
|
+
idAREF = tAREF,
|
49
|
+
idASET = tASET,
|
50
|
+
idLAST_TOKEN = tLAST_TOKEN >> ID_SCOPE_SHIFT,
|
51
|
+
tIntern,
|
52
|
+
tMethodMissing,
|
53
|
+
tLength,
|
54
|
+
tGets,
|
55
|
+
tSucc,
|
56
|
+
tEach,
|
57
|
+
tLambda,
|
58
|
+
tSend,
|
59
|
+
t__send__,
|
60
|
+
tInitialize,
|
61
|
+
#if SUPPORT_JOKE
|
62
|
+
tBitblt,
|
63
|
+
tAnswer,
|
64
|
+
#endif
|
65
|
+
tLAST_ID
|
66
|
+
};
|
67
|
+
|
68
|
+
#define idIntern ((tIntern<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
69
|
+
#define idMethodMissing ((tMethodMissing<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
70
|
+
#define idLength ((tLength<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
71
|
+
#define idGets ((tGets<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
72
|
+
#define idSucc ((tSucc<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
73
|
+
#define idEach ((tEach<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
74
|
+
#define idLambda ((tLambda<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
75
|
+
#define idSend ((tSend<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
76
|
+
#define id__send__ ((t__send__<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
77
|
+
#define idInitialize ((tInitialize<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
78
|
+
#if SUPPORT_JOKE
|
79
|
+
#define idBitblt ((tBitblt<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
80
|
+
#define idAnswer ((tAnswer<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
81
|
+
#endif
|
82
|
+
|
83
|
+
#endif /* RUBY_ID_H */
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
iseq.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: 04/01/01 23:36:57 JST
|
7
|
+
|
8
|
+
Copyright (C) 2004-2008 Koichi Sasada
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_COMPILE_H
|
13
|
+
#define RUBY_COMPILE_H
|
14
|
+
|
15
|
+
VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt);
|
16
|
+
|
17
|
+
#define ISEQ_TYPE_TOP INT2FIX(1)
|
18
|
+
#define ISEQ_TYPE_METHOD INT2FIX(2)
|
19
|
+
#define ISEQ_TYPE_BLOCK INT2FIX(3)
|
20
|
+
#define ISEQ_TYPE_CLASS INT2FIX(4)
|
21
|
+
#define ISEQ_TYPE_RESCUE INT2FIX(5)
|
22
|
+
#define ISEQ_TYPE_ENSURE INT2FIX(6)
|
23
|
+
#define ISEQ_TYPE_EVAL INT2FIX(7)
|
24
|
+
#define ISEQ_TYPE_DEFINED_GUARD INT2FIX(8)
|
25
|
+
|
26
|
+
#define CATCH_TYPE_RESCUE INT2FIX(1)
|
27
|
+
#define CATCH_TYPE_ENSURE INT2FIX(2)
|
28
|
+
#define CATCH_TYPE_RETRY INT2FIX(3)
|
29
|
+
#define CATCH_TYPE_BREAK INT2FIX(4)
|
30
|
+
#define CATCH_TYPE_REDO INT2FIX(5)
|
31
|
+
#define CATCH_TYPE_NEXT INT2FIX(6)
|
32
|
+
|
33
|
+
struct iseq_insn_info_entry {
|
34
|
+
unsigned short position;
|
35
|
+
unsigned short line_no;
|
36
|
+
unsigned short sp;
|
37
|
+
};
|
38
|
+
|
39
|
+
struct iseq_catch_table_entry {
|
40
|
+
VALUE type;
|
41
|
+
VALUE iseq;
|
42
|
+
unsigned long start;
|
43
|
+
unsigned long end;
|
44
|
+
unsigned long cont;
|
45
|
+
unsigned long sp;
|
46
|
+
};
|
47
|
+
|
48
|
+
#define INITIAL_ISEQ_COMPILE_DATA_STORAGE_BUFF_SIZE (512)
|
49
|
+
|
50
|
+
struct iseq_compile_data_storage {
|
51
|
+
struct iseq_compile_data_storage *next;
|
52
|
+
unsigned long pos;
|
53
|
+
unsigned long size;
|
54
|
+
char *buff;
|
55
|
+
};
|
56
|
+
|
57
|
+
struct iseq_compile_data {
|
58
|
+
/* GC is needed */
|
59
|
+
VALUE err_info;
|
60
|
+
VALUE mark_ary;
|
61
|
+
VALUE catch_table_ary; /* Array */
|
62
|
+
|
63
|
+
/* GC is not needed */
|
64
|
+
struct iseq_label_data *start_label;
|
65
|
+
struct iseq_label_data *end_label;
|
66
|
+
struct iseq_label_data *redo_label;
|
67
|
+
VALUE current_block;
|
68
|
+
VALUE loopval_popped; /* used by NODE_BREAK */
|
69
|
+
VALUE ensure_node;
|
70
|
+
VALUE for_iseq;
|
71
|
+
struct iseq_compile_data_ensure_node_stack *ensure_node_stack;
|
72
|
+
int cached_const;
|
73
|
+
struct iseq_compile_data_storage *storage_head;
|
74
|
+
struct iseq_compile_data_storage *storage_current;
|
75
|
+
int last_line;
|
76
|
+
int flip_cnt;
|
77
|
+
int label_no;
|
78
|
+
int node_level;
|
79
|
+
const rb_compile_option_t *option;
|
80
|
+
};
|
81
|
+
|
82
|
+
/* defined? */
|
83
|
+
#define DEFINED_IVAR INT2FIX(1)
|
84
|
+
#define DEFINED_IVAR2 INT2FIX(2)
|
85
|
+
#define DEFINED_GVAR INT2FIX(3)
|
86
|
+
#define DEFINED_CVAR INT2FIX(4)
|
87
|
+
#define DEFINED_CONST INT2FIX(5)
|
88
|
+
#define DEFINED_METHOD INT2FIX(6)
|
89
|
+
#define DEFINED_YIELD INT2FIX(7)
|
90
|
+
#define DEFINED_REF INT2FIX(8)
|
91
|
+
#define DEFINED_ZSUPER INT2FIX(9)
|
92
|
+
#define DEFINED_FUNC INT2FIX(10)
|
93
|
+
|
94
|
+
#endif /* RUBY_COMPILE_H */
|
@@ -0,0 +1,516 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
node.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
created at: Fri May 28 15:14:02 JST 1993
|
7
|
+
|
8
|
+
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
9
|
+
|
10
|
+
**********************************************************************/
|
11
|
+
|
12
|
+
#ifndef RUBY_NODE_H
|
13
|
+
#define RUBY_NODE_H 1
|
14
|
+
|
15
|
+
#if defined(__cplusplus)
|
16
|
+
extern "C" {
|
17
|
+
#if 0
|
18
|
+
} /* satisfy cc-mode */
|
19
|
+
#endif
|
20
|
+
#endif
|
21
|
+
|
22
|
+
enum node_type {
|
23
|
+
NODE_METHOD,
|
24
|
+
#define NODE_METHOD NODE_METHOD
|
25
|
+
NODE_FBODY,
|
26
|
+
#define NODE_FBODY NODE_FBODY
|
27
|
+
NODE_CFUNC,
|
28
|
+
#define NODE_CFUNC NODE_CFUNC
|
29
|
+
NODE_SCOPE,
|
30
|
+
#define NODE_SCOPE NODE_SCOPE
|
31
|
+
NODE_BLOCK,
|
32
|
+
#define NODE_BLOCK NODE_BLOCK
|
33
|
+
NODE_IF,
|
34
|
+
#define NODE_IF NODE_IF
|
35
|
+
NODE_CASE,
|
36
|
+
#define NODE_CASE NODE_CASE
|
37
|
+
NODE_WHEN,
|
38
|
+
#define NODE_WHEN NODE_WHEN
|
39
|
+
NODE_OPT_N,
|
40
|
+
#define NODE_OPT_N NODE_OPT_N
|
41
|
+
NODE_WHILE,
|
42
|
+
#define NODE_WHILE NODE_WHILE
|
43
|
+
NODE_UNTIL,
|
44
|
+
#define NODE_UNTIL NODE_UNTIL
|
45
|
+
NODE_ITER,
|
46
|
+
#define NODE_ITER NODE_ITER
|
47
|
+
NODE_FOR,
|
48
|
+
#define NODE_FOR NODE_FOR
|
49
|
+
NODE_BREAK,
|
50
|
+
#define NODE_BREAK NODE_BREAK
|
51
|
+
NODE_NEXT,
|
52
|
+
#define NODE_NEXT NODE_NEXT
|
53
|
+
NODE_REDO,
|
54
|
+
#define NODE_REDO NODE_REDO
|
55
|
+
NODE_RETRY,
|
56
|
+
#define NODE_RETRY NODE_RETRY
|
57
|
+
NODE_BEGIN,
|
58
|
+
#define NODE_BEGIN NODE_BEGIN
|
59
|
+
NODE_RESCUE,
|
60
|
+
#define NODE_RESCUE NODE_RESCUE
|
61
|
+
NODE_RESBODY,
|
62
|
+
#define NODE_RESBODY NODE_RESBODY
|
63
|
+
NODE_ENSURE,
|
64
|
+
#define NODE_ENSURE NODE_ENSURE
|
65
|
+
NODE_AND,
|
66
|
+
#define NODE_AND NODE_AND
|
67
|
+
NODE_OR,
|
68
|
+
#define NODE_OR NODE_OR
|
69
|
+
NODE_MASGN,
|
70
|
+
#define NODE_MASGN NODE_MASGN
|
71
|
+
NODE_LASGN,
|
72
|
+
#define NODE_LASGN NODE_LASGN
|
73
|
+
NODE_DASGN,
|
74
|
+
#define NODE_DASGN NODE_DASGN
|
75
|
+
NODE_DASGN_CURR,
|
76
|
+
#define NODE_DASGN_CURR NODE_DASGN_CURR
|
77
|
+
NODE_GASGN,
|
78
|
+
#define NODE_GASGN NODE_GASGN
|
79
|
+
NODE_IASGN,
|
80
|
+
#define NODE_IASGN NODE_IASGN
|
81
|
+
NODE_IASGN2,
|
82
|
+
#define NODE_IASGN2 NODE_IASGN2
|
83
|
+
NODE_CDECL,
|
84
|
+
#define NODE_CDECL NODE_CDECL
|
85
|
+
NODE_CVASGN,
|
86
|
+
#define NODE_CVASGN NODE_CVASGN
|
87
|
+
NODE_CVDECL,
|
88
|
+
#define NODE_CVDECL NODE_CVDECL
|
89
|
+
NODE_OP_ASGN1,
|
90
|
+
#define NODE_OP_ASGN1 NODE_OP_ASGN1
|
91
|
+
NODE_OP_ASGN2,
|
92
|
+
#define NODE_OP_ASGN2 NODE_OP_ASGN2
|
93
|
+
NODE_OP_ASGN_AND,
|
94
|
+
#define NODE_OP_ASGN_AND NODE_OP_ASGN_AND
|
95
|
+
NODE_OP_ASGN_OR,
|
96
|
+
#define NODE_OP_ASGN_OR NODE_OP_ASGN_OR
|
97
|
+
NODE_CALL,
|
98
|
+
#define NODE_CALL NODE_CALL
|
99
|
+
NODE_FCALL,
|
100
|
+
#define NODE_FCALL NODE_FCALL
|
101
|
+
NODE_VCALL,
|
102
|
+
#define NODE_VCALL NODE_VCALL
|
103
|
+
NODE_SUPER,
|
104
|
+
#define NODE_SUPER NODE_SUPER
|
105
|
+
NODE_ZSUPER,
|
106
|
+
#define NODE_ZSUPER NODE_ZSUPER
|
107
|
+
NODE_ARRAY,
|
108
|
+
#define NODE_ARRAY NODE_ARRAY
|
109
|
+
NODE_ZARRAY,
|
110
|
+
#define NODE_ZARRAY NODE_ZARRAY
|
111
|
+
NODE_VALUES,
|
112
|
+
#define NODE_VALUES NODE_VALUES
|
113
|
+
NODE_HASH,
|
114
|
+
#define NODE_HASH NODE_HASH
|
115
|
+
NODE_RETURN,
|
116
|
+
#define NODE_RETURN NODE_RETURN
|
117
|
+
NODE_YIELD,
|
118
|
+
#define NODE_YIELD NODE_YIELD
|
119
|
+
NODE_LVAR,
|
120
|
+
#define NODE_LVAR NODE_LVAR
|
121
|
+
NODE_DVAR,
|
122
|
+
#define NODE_DVAR NODE_DVAR
|
123
|
+
NODE_GVAR,
|
124
|
+
#define NODE_GVAR NODE_GVAR
|
125
|
+
NODE_IVAR,
|
126
|
+
#define NODE_IVAR NODE_IVAR
|
127
|
+
NODE_CONST,
|
128
|
+
#define NODE_CONST NODE_CONST
|
129
|
+
NODE_CVAR,
|
130
|
+
#define NODE_CVAR NODE_CVAR
|
131
|
+
NODE_NTH_REF,
|
132
|
+
#define NODE_NTH_REF NODE_NTH_REF
|
133
|
+
NODE_BACK_REF,
|
134
|
+
#define NODE_BACK_REF NODE_BACK_REF
|
135
|
+
NODE_MATCH,
|
136
|
+
#define NODE_MATCH NODE_MATCH
|
137
|
+
NODE_MATCH2,
|
138
|
+
#define NODE_MATCH2 NODE_MATCH2
|
139
|
+
NODE_MATCH3,
|
140
|
+
#define NODE_MATCH3 NODE_MATCH3
|
141
|
+
NODE_LIT,
|
142
|
+
#define NODE_LIT NODE_LIT
|
143
|
+
NODE_STR,
|
144
|
+
#define NODE_STR NODE_STR
|
145
|
+
NODE_DSTR,
|
146
|
+
#define NODE_DSTR NODE_DSTR
|
147
|
+
NODE_XSTR,
|
148
|
+
#define NODE_XSTR NODE_XSTR
|
149
|
+
NODE_DXSTR,
|
150
|
+
#define NODE_DXSTR NODE_DXSTR
|
151
|
+
NODE_EVSTR,
|
152
|
+
#define NODE_EVSTR NODE_EVSTR
|
153
|
+
NODE_DREGX,
|
154
|
+
#define NODE_DREGX NODE_DREGX
|
155
|
+
NODE_DREGX_ONCE,
|
156
|
+
#define NODE_DREGX_ONCE NODE_DREGX_ONCE
|
157
|
+
NODE_ARGS,
|
158
|
+
#define NODE_ARGS NODE_ARGS
|
159
|
+
NODE_ARGS_AUX,
|
160
|
+
#define NODE_ARGS_AUX NODE_ARGS_AUX
|
161
|
+
NODE_OPT_ARG,
|
162
|
+
#define NODE_OPT_ARG NODE_OPT_ARG
|
163
|
+
NODE_POSTARG,
|
164
|
+
#define NODE_POSTARG NODE_POSTARG
|
165
|
+
NODE_ARGSCAT,
|
166
|
+
#define NODE_ARGSCAT NODE_ARGSCAT
|
167
|
+
NODE_ARGSPUSH,
|
168
|
+
#define NODE_ARGSPUSH NODE_ARGSPUSH
|
169
|
+
NODE_SPLAT,
|
170
|
+
#define NODE_SPLAT NODE_SPLAT
|
171
|
+
NODE_TO_ARY,
|
172
|
+
#define NODE_TO_ARY NODE_TO_ARY
|
173
|
+
NODE_BLOCK_ARG,
|
174
|
+
#define NODE_BLOCK_ARG NODE_BLOCK_ARG
|
175
|
+
NODE_BLOCK_PASS,
|
176
|
+
#define NODE_BLOCK_PASS NODE_BLOCK_PASS
|
177
|
+
NODE_DEFN,
|
178
|
+
#define NODE_DEFN NODE_DEFN
|
179
|
+
NODE_DEFS,
|
180
|
+
#define NODE_DEFS NODE_DEFS
|
181
|
+
NODE_ALIAS,
|
182
|
+
#define NODE_ALIAS NODE_ALIAS
|
183
|
+
NODE_VALIAS,
|
184
|
+
#define NODE_VALIAS NODE_VALIAS
|
185
|
+
NODE_UNDEF,
|
186
|
+
#define NODE_UNDEF NODE_UNDEF
|
187
|
+
NODE_CLASS,
|
188
|
+
#define NODE_CLASS NODE_CLASS
|
189
|
+
NODE_MODULE,
|
190
|
+
#define NODE_MODULE NODE_MODULE
|
191
|
+
NODE_SCLASS,
|
192
|
+
#define NODE_SCLASS NODE_SCLASS
|
193
|
+
NODE_COLON2,
|
194
|
+
#define NODE_COLON2 NODE_COLON2
|
195
|
+
NODE_COLON3,
|
196
|
+
#define NODE_COLON3 NODE_COLON3
|
197
|
+
NODE_DOT2,
|
198
|
+
#define NODE_DOT2 NODE_DOT2
|
199
|
+
NODE_DOT3,
|
200
|
+
#define NODE_DOT3 NODE_DOT3
|
201
|
+
NODE_FLIP2,
|
202
|
+
#define NODE_FLIP2 NODE_FLIP2
|
203
|
+
NODE_FLIP3,
|
204
|
+
#define NODE_FLIP3 NODE_FLIP3
|
205
|
+
NODE_ATTRSET,
|
206
|
+
#define NODE_ATTRSET NODE_ATTRSET
|
207
|
+
NODE_SELF,
|
208
|
+
#define NODE_SELF NODE_SELF
|
209
|
+
NODE_NIL,
|
210
|
+
#define NODE_NIL NODE_NIL
|
211
|
+
NODE_TRUE,
|
212
|
+
#define NODE_TRUE NODE_TRUE
|
213
|
+
NODE_FALSE,
|
214
|
+
#define NODE_FALSE NODE_FALSE
|
215
|
+
NODE_ERRINFO,
|
216
|
+
#define NODE_ERRINFO NODE_ERRINFO
|
217
|
+
NODE_DEFINED,
|
218
|
+
#define NODE_DEFINED NODE_DEFINED
|
219
|
+
NODE_POSTEXE,
|
220
|
+
#define NODE_POSTEXE NODE_POSTEXE
|
221
|
+
NODE_ALLOCA,
|
222
|
+
#define NODE_ALLOCA NODE_ALLOCA
|
223
|
+
NODE_BMETHOD,
|
224
|
+
#define NODE_BMETHOD NODE_BMETHOD
|
225
|
+
NODE_MEMO,
|
226
|
+
#define NODE_MEMO NODE_MEMO
|
227
|
+
NODE_IFUNC,
|
228
|
+
#define NODE_IFUNC NODE_IFUNC
|
229
|
+
NODE_DSYM,
|
230
|
+
#define NODE_DSYM NODE_DSYM
|
231
|
+
NODE_ATTRASGN,
|
232
|
+
#define NODE_ATTRASGN NODE_ATTRASGN
|
233
|
+
NODE_PRELUDE,
|
234
|
+
#define NODE_PRELUDE NODE_PRELUDE
|
235
|
+
NODE_LAMBDA,
|
236
|
+
#define NODE_LAMBDA NODE_LAMBDA
|
237
|
+
NODE_OPTBLOCK,
|
238
|
+
#define NODE_OPTBLOCK NODE_OPTBLOCK
|
239
|
+
NODE_LAST
|
240
|
+
#define NODE_LAST NODE_LAST
|
241
|
+
};
|
242
|
+
|
243
|
+
typedef struct RNode {
|
244
|
+
unsigned long flags;
|
245
|
+
char *nd_file;
|
246
|
+
union {
|
247
|
+
struct RNode *node;
|
248
|
+
ID id;
|
249
|
+
VALUE value;
|
250
|
+
VALUE (*cfunc)(ANYARGS);
|
251
|
+
ID *tbl;
|
252
|
+
} u1;
|
253
|
+
union {
|
254
|
+
struct RNode *node;
|
255
|
+
ID id;
|
256
|
+
long argc;
|
257
|
+
VALUE value;
|
258
|
+
} u2;
|
259
|
+
union {
|
260
|
+
struct RNode *node;
|
261
|
+
ID id;
|
262
|
+
long state;
|
263
|
+
struct global_entry *entry;
|
264
|
+
long cnt;
|
265
|
+
VALUE value;
|
266
|
+
} u3;
|
267
|
+
} NODE;
|
268
|
+
|
269
|
+
#define RNODE(obj) (R_CAST(RNode)(obj))
|
270
|
+
|
271
|
+
/* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_FL_NEWLINE */
|
272
|
+
#define NODE_FL_NEWLINE (((VALUE)1)<<7)
|
273
|
+
|
274
|
+
#define NODE_TYPESHIFT 8
|
275
|
+
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
|
276
|
+
|
277
|
+
#define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
|
278
|
+
#define nd_set_type(n,t) \
|
279
|
+
RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|(((t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
|
280
|
+
|
281
|
+
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
|
282
|
+
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
|
283
|
+
#define nd_line(n) ((VALUE)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
|
284
|
+
#define nd_set_line(n,l) \
|
285
|
+
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))
|
286
|
+
|
287
|
+
#define nd_head u1.node
|
288
|
+
#define nd_alen u2.argc
|
289
|
+
#define nd_next u3.node
|
290
|
+
|
291
|
+
#define nd_cond u1.node
|
292
|
+
#define nd_body u2.node
|
293
|
+
#define nd_else u3.node
|
294
|
+
|
295
|
+
#define nd_orig u3.value
|
296
|
+
|
297
|
+
#define nd_resq u2.node
|
298
|
+
#define nd_ensr u3.node
|
299
|
+
|
300
|
+
#define nd_1st u1.node
|
301
|
+
#define nd_2nd u2.node
|
302
|
+
|
303
|
+
#define nd_stts u1.node
|
304
|
+
|
305
|
+
#define nd_entry u3.entry
|
306
|
+
#define nd_vid u1.id
|
307
|
+
#define nd_cflag u2.id
|
308
|
+
#define nd_cval u3.value
|
309
|
+
|
310
|
+
#define nd_oid u1.id
|
311
|
+
#define nd_cnt u3.cnt
|
312
|
+
#define nd_tbl u1.tbl
|
313
|
+
|
314
|
+
#define nd_var u1.node
|
315
|
+
#define nd_iter u3.node
|
316
|
+
|
317
|
+
#define nd_value u2.node
|
318
|
+
#define nd_aid u3.id
|
319
|
+
|
320
|
+
#define nd_lit u1.value
|
321
|
+
|
322
|
+
#define nd_frml u2.argc
|
323
|
+
#define nd_rest u1.id
|
324
|
+
#define nd_opt u1.node
|
325
|
+
#define nd_pid u1.id
|
326
|
+
#define nd_plen u2.argc
|
327
|
+
|
328
|
+
#define nd_recv u1.node
|
329
|
+
#define nd_mid u2.id
|
330
|
+
#define nd_args u3.node
|
331
|
+
|
332
|
+
#define nd_noex u3.id
|
333
|
+
#define nd_defn u3.node
|
334
|
+
|
335
|
+
#define nd_cfnc u1.cfunc
|
336
|
+
#define nd_argc u2.argc
|
337
|
+
|
338
|
+
#define nd_cpath u1.node
|
339
|
+
#define nd_super u3.node
|
340
|
+
|
341
|
+
#define nd_modl u1.id
|
342
|
+
#define nd_clss u1.value
|
343
|
+
|
344
|
+
#define nd_beg u1.node
|
345
|
+
#define nd_end u2.node
|
346
|
+
#define nd_state u3.state
|
347
|
+
#define nd_rval u2.value
|
348
|
+
|
349
|
+
#define nd_nth u2.argc
|
350
|
+
|
351
|
+
#define nd_tag u1.id
|
352
|
+
#define nd_tval u2.value
|
353
|
+
|
354
|
+
#define nd_visi u2.argc
|
355
|
+
|
356
|
+
#define NEW_NODE(t,a0,a1,a2) rb_node_newnode((t),(VALUE)(a0),(VALUE)(a1),(VALUE)(a2))
|
357
|
+
|
358
|
+
#define NEW_METHOD(n,x,v) NEW_NODE(NODE_METHOD,x,n,v)
|
359
|
+
#define NEW_FBODY(n,i) NEW_NODE(NODE_FBODY,i,n,0)
|
360
|
+
#define NEW_DEFN(i,a,d,p) NEW_NODE(NODE_DEFN,0,i,NEW_SCOPE(a,d))
|
361
|
+
#define NEW_DEFS(r,i,a,d) NEW_NODE(NODE_DEFS,r,i,NEW_SCOPE(a,d))
|
362
|
+
#define NEW_CFUNC(f,c) NEW_NODE(NODE_CFUNC,f,c,0)
|
363
|
+
#define NEW_IFUNC(f,c) NEW_NODE(NODE_IFUNC,f,c,0)
|
364
|
+
#define NEW_SCOPE(a,b) NEW_NODE(NODE_SCOPE,local_tbl(),b,a)
|
365
|
+
#define NEW_BLOCK(a) NEW_NODE(NODE_BLOCK,a,0,0)
|
366
|
+
#define NEW_IF(c,t,e) NEW_NODE(NODE_IF,c,t,e)
|
367
|
+
#define NEW_UNLESS(c,t,e) NEW_IF(c,e,t)
|
368
|
+
#define NEW_CASE(h,b) NEW_NODE(NODE_CASE,h,b,0)
|
369
|
+
#define NEW_WHEN(c,t,e) NEW_NODE(NODE_WHEN,c,t,e)
|
370
|
+
#define NEW_OPT_N(b) NEW_NODE(NODE_OPT_N,0,b,0)
|
371
|
+
#define NEW_WHILE(c,b,n) NEW_NODE(NODE_WHILE,c,b,n)
|
372
|
+
#define NEW_UNTIL(c,b,n) NEW_NODE(NODE_UNTIL,c,b,n)
|
373
|
+
#define NEW_FOR(v,i,b) NEW_NODE(NODE_FOR,v,b,i)
|
374
|
+
#define NEW_ITER(a,b) NEW_NODE(NODE_ITER,0,NEW_SCOPE(a,b),0)
|
375
|
+
#define NEW_LAMBDA(a) NEW_NODE(NODE_LAMBDA,a,0,0)
|
376
|
+
#define NEW_BREAK(s) NEW_NODE(NODE_BREAK,s,0,0)
|
377
|
+
#define NEW_NEXT(s) NEW_NODE(NODE_NEXT,s,0,0)
|
378
|
+
#define NEW_REDO() NEW_NODE(NODE_REDO,0,0,0)
|
379
|
+
#define NEW_RETRY() NEW_NODE(NODE_RETRY,0,0,0)
|
380
|
+
#define NEW_BEGIN(b) NEW_NODE(NODE_BEGIN,0,b,0)
|
381
|
+
#define NEW_RESCUE(b,res,e) NEW_NODE(NODE_RESCUE,b,res,e)
|
382
|
+
#define NEW_RESBODY(a,ex,n) NEW_NODE(NODE_RESBODY,n,ex,a)
|
383
|
+
#define NEW_ENSURE(b,en) NEW_NODE(NODE_ENSURE,b,0,en)
|
384
|
+
#define NEW_RETURN(s) NEW_NODE(NODE_RETURN,s,0,0)
|
385
|
+
#define NEW_YIELD(a,s) NEW_NODE(NODE_YIELD,a,0,s)
|
386
|
+
#define NEW_LIST(a) NEW_ARRAY(a)
|
387
|
+
#define NEW_ARRAY(a) NEW_NODE(NODE_ARRAY,a,1,0)
|
388
|
+
#define NEW_ZARRAY() NEW_NODE(NODE_ZARRAY,0,0,0)
|
389
|
+
#define NEW_HASH(a) NEW_NODE(NODE_HASH,a,0,0)
|
390
|
+
#define NEW_MASGN(l,r) NEW_NODE(NODE_MASGN,l,0,r)
|
391
|
+
#define NEW_GASGN(v,val) NEW_NODE(NODE_GASGN,v,val,rb_global_entry(v))
|
392
|
+
#define NEW_LASGN(v,val) NEW_NODE(NODE_LASGN,v,val,0)
|
393
|
+
#define NEW_DASGN(v,val) NEW_NODE(NODE_DASGN,v,val,0)
|
394
|
+
#define NEW_DASGN_CURR(v,val) NEW_NODE(NODE_DASGN_CURR,v,val,0)
|
395
|
+
#define NEW_IASGN(v,val) NEW_NODE(NODE_IASGN,v,val,0)
|
396
|
+
#define NEW_IASGN2(v,val) NEW_NODE(NODE_IASGN2,v,val,0)
|
397
|
+
#define NEW_CDECL(v,val,path) NEW_NODE(NODE_CDECL,v,val,path)
|
398
|
+
#define NEW_CVASGN(v,val) NEW_NODE(NODE_CVASGN,v,val,0)
|
399
|
+
#define NEW_CVDECL(v,val) NEW_NODE(NODE_CVDECL,v,val,0)
|
400
|
+
#define NEW_OP_ASGN1(p,id,a) NEW_NODE(NODE_OP_ASGN1,p,id,a)
|
401
|
+
#define NEW_OP_ASGN2(r,i,o,val) NEW_NODE(NODE_OP_ASGN2,r,val,NEW_OP_ASGN22(i,o))
|
402
|
+
#define NEW_OP_ASGN22(i,o) NEW_NODE(NODE_OP_ASGN2,i,o,rb_id_attrset(i))
|
403
|
+
#define NEW_OP_ASGN_OR(i,val) NEW_NODE(NODE_OP_ASGN_OR,i,val,0)
|
404
|
+
#define NEW_OP_ASGN_AND(i,val) NEW_NODE(NODE_OP_ASGN_AND,i,val,0)
|
405
|
+
#define NEW_GVAR(v) NEW_NODE(NODE_GVAR,v,0,rb_global_entry(v))
|
406
|
+
#define NEW_LVAR(v) NEW_NODE(NODE_LVAR,v,0,0)
|
407
|
+
#define NEW_DVAR(v) NEW_NODE(NODE_DVAR,v,0,0)
|
408
|
+
#define NEW_IVAR(v) NEW_NODE(NODE_IVAR,v,0,0)
|
409
|
+
#define NEW_CONST(v) NEW_NODE(NODE_CONST,v,0,0)
|
410
|
+
#define NEW_CVAR(v) NEW_NODE(NODE_CVAR,v,0,0)
|
411
|
+
#define NEW_NTH_REF(n) NEW_NODE(NODE_NTH_REF,0,n,0)
|
412
|
+
#define NEW_BACK_REF(n) NEW_NODE(NODE_BACK_REF,0,n,0)
|
413
|
+
#define NEW_MATCH(c) NEW_NODE(NODE_MATCH,c,0,0)
|
414
|
+
#define NEW_MATCH2(n1,n2) NEW_NODE(NODE_MATCH2,n1,n2,0)
|
415
|
+
#define NEW_MATCH3(r,n2) NEW_NODE(NODE_MATCH3,r,n2,0)
|
416
|
+
#define NEW_LIT(l) NEW_NODE(NODE_LIT,l,0,0)
|
417
|
+
#define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
|
418
|
+
#define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,1,0)
|
419
|
+
#define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
|
420
|
+
#define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
|
421
|
+
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
|
422
|
+
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
|
423
|
+
#define NEW_CALL(r,m,a) NEW_NODE(NODE_CALL,r,m,a)
|
424
|
+
#define NEW_FCALL(m,a) NEW_NODE(NODE_FCALL,0,m,a)
|
425
|
+
#define NEW_VCALL(m) NEW_NODE(NODE_VCALL,0,m,0)
|
426
|
+
#define NEW_SUPER(a) NEW_NODE(NODE_SUPER,0,0,a)
|
427
|
+
#define NEW_ZSUPER() NEW_NODE(NODE_ZSUPER,0,0,0)
|
428
|
+
#define NEW_ARGS(m,o) NEW_NODE(NODE_ARGS,o,m,0)
|
429
|
+
#define NEW_ARGS_AUX(r,b) NEW_NODE(NODE_ARGS_AUX,r,b,0)
|
430
|
+
#define NEW_OPT_ARG(i,v) NEW_NODE(NODE_OPT_ARG,i,v,0)
|
431
|
+
#define NEW_POSTARG(i,v) NEW_NODE(NODE_POSTARG,i,v,0)
|
432
|
+
#define NEW_ARGSCAT(a,b) NEW_NODE(NODE_ARGSCAT,a,b,0)
|
433
|
+
#define NEW_ARGSPUSH(a,b) NEW_NODE(NODE_ARGSPUSH,a,b,0)
|
434
|
+
#define NEW_SPLAT(a) NEW_NODE(NODE_SPLAT,a,0,0)
|
435
|
+
#define NEW_TO_ARY(a) NEW_NODE(NODE_TO_ARY,a,0,0)
|
436
|
+
#define NEW_BLOCK_ARG(v) NEW_NODE(NODE_BLOCK_ARG,v,0,local_cnt(v))
|
437
|
+
#define NEW_BLOCK_PASS(b) NEW_NODE(NODE_BLOCK_PASS,0,b,0)
|
438
|
+
#define NEW_ALIAS(n,o) NEW_NODE(NODE_ALIAS,n,o,0)
|
439
|
+
#define NEW_VALIAS(n,o) NEW_NODE(NODE_VALIAS,n,o,0)
|
440
|
+
#define NEW_UNDEF(i) NEW_NODE(NODE_UNDEF,0,i,0)
|
441
|
+
#define NEW_CLASS(n,b,s) NEW_NODE(NODE_CLASS,n,NEW_SCOPE(0,b),(s))
|
442
|
+
#define NEW_SCLASS(r,b) NEW_NODE(NODE_SCLASS,r,NEW_SCOPE(0,b),0)
|
443
|
+
#define NEW_MODULE(n,b) NEW_NODE(NODE_MODULE,n,NEW_SCOPE(0,b),0)
|
444
|
+
#define NEW_COLON2(c,i) NEW_NODE(NODE_COLON2,c,i,0)
|
445
|
+
#define NEW_COLON3(i) NEW_NODE(NODE_COLON3,0,i,0)
|
446
|
+
#define NEW_DOT2(b,e) NEW_NODE(NODE_DOT2,b,e,0)
|
447
|
+
#define NEW_DOT3(b,e) NEW_NODE(NODE_DOT3,b,e,0)
|
448
|
+
#define NEW_ATTRSET(a) NEW_NODE(NODE_ATTRSET,a,0,0)
|
449
|
+
#define NEW_SELF() NEW_NODE(NODE_SELF,0,0,0)
|
450
|
+
#define NEW_NIL() NEW_NODE(NODE_NIL,0,0,0)
|
451
|
+
#define NEW_TRUE() NEW_NODE(NODE_TRUE,0,0,0)
|
452
|
+
#define NEW_FALSE() NEW_NODE(NODE_FALSE,0,0,0)
|
453
|
+
#define NEW_ERRINFO() NEW_NODE(NODE_ERRINFO,0,0,0)
|
454
|
+
#define NEW_DEFINED(e) NEW_NODE(NODE_DEFINED,e,0,0)
|
455
|
+
#define NEW_PREEXE(b) NEW_SCOPE(b)
|
456
|
+
#define NEW_POSTEXE(b) NEW_NODE(NODE_POSTEXE,0,b,0)
|
457
|
+
#define NEW_BMETHOD(b) NEW_NODE(NODE_BMETHOD,0,0,b)
|
458
|
+
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
|
459
|
+
#define NEW_PRELUDE(p,b) NEW_NODE(NODE_PRELUDE,p,b,0)
|
460
|
+
#define NEW_OPTBLOCK(a) NEW_NODE(NODE_OPTBLOCK,a,0,0)
|
461
|
+
|
462
|
+
#define NOEX_PUBLIC 0x00
|
463
|
+
#define NOEX_NOSUPER 0x01
|
464
|
+
#define NOEX_PRIVATE 0x02
|
465
|
+
#define NOEX_PROTECTED 0x04
|
466
|
+
#define NOEX_MASK 0x06 /* 0110 */
|
467
|
+
#define NOEX_BASIC 0x08
|
468
|
+
|
469
|
+
#define NOEX_UNDEF NOEX_NOSUPER
|
470
|
+
|
471
|
+
#define NOEX_MODFUNC 0x10
|
472
|
+
#define NOEX_SUPER 0x20
|
473
|
+
#define NOEX_VCALL 0x40
|
474
|
+
|
475
|
+
#define NOEX_SAFE(n) (((n) >> 8) & 0x0F)
|
476
|
+
#define NOEX_WITH(n, s) ((s << 8) | (n) | (ruby_running ? 0 : NOEX_BASIC))
|
477
|
+
#define NOEX_WITH_SAFE(n) NOEX_WITH(n, rb_safe_level())
|
478
|
+
|
479
|
+
#define CALL_PUBLIC 0
|
480
|
+
#define CALL_FCALL 1
|
481
|
+
#define CALL_VCALL 2
|
482
|
+
#define CALL_SUPER 3
|
483
|
+
|
484
|
+
#define RUBY_VM_METHOD_NODE NODE_METHOD
|
485
|
+
|
486
|
+
VALUE rb_parser_new(void);
|
487
|
+
VALUE rb_parser_end_seen_p(VALUE);
|
488
|
+
VALUE rb_parser_encoding(VALUE);
|
489
|
+
|
490
|
+
NODE *rb_parser_compile_cstr(volatile VALUE, const char*, const char*, int, int);
|
491
|
+
NODE *rb_parser_compile_string(volatile VALUE, const char*, VALUE, int);
|
492
|
+
NODE *rb_parser_compile_file(volatile VALUE, const char*, VALUE, int);
|
493
|
+
|
494
|
+
NODE *rb_compile_cstr(const char*, const char*, int, int);
|
495
|
+
NODE *rb_compile_string(const char*, VALUE, int);
|
496
|
+
NODE *rb_compile_file(const char*, VALUE, int);
|
497
|
+
|
498
|
+
void rb_add_method(VALUE, ID, NODE *, int);
|
499
|
+
NODE *rb_node_newnode(enum node_type,VALUE,VALUE,VALUE);
|
500
|
+
|
501
|
+
NODE* rb_method_node(VALUE klass, ID id);
|
502
|
+
int rb_node_arity(NODE* node);
|
503
|
+
|
504
|
+
struct global_entry *rb_global_entry(ID);
|
505
|
+
VALUE rb_gvar_get(struct global_entry *);
|
506
|
+
VALUE rb_gvar_set(struct global_entry *, VALUE);
|
507
|
+
VALUE rb_gvar_defined(struct global_entry *);
|
508
|
+
|
509
|
+
#if defined(__cplusplus)
|
510
|
+
#if 0
|
511
|
+
{ /* satisfy cc-mode */
|
512
|
+
#endif
|
513
|
+
} /* extern "C" { */
|
514
|
+
#endif
|
515
|
+
|
516
|
+
#endif /* RUBY_NODE_H */
|