1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* common.mk (node_name.inc): auto-generate node name list.

* iseq.c (ruby_node_name): ditto.

* tool/node_name.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-06 04:09:56 +00:00
parent ee8f40b5a6
commit a9ba30ee86
4 changed files with 18 additions and 233 deletions

View file

@ -1,10 +1,16 @@
Mon Aug 6 13:00:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
Mon Aug 6 13:09:55 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (INSNS): not chdir to srcdir.
* common.mk (node_name.inc): auto-generate node name list.
* iseq.c (ruby_node_name): ditto.
* lib/vm/instruction.rb (RubyVM::SourceCodeGenerator): --destdir
option.
* tool/node_name.rb: ditto.
Sun Aug 5 11:51:39 2007 Kouhei Sutou <kou@cozmixng.org>
* lib/rss, sample/rss, test/rss:

View file

@ -560,7 +560,8 @@ iseq.$(OBJEXT): {$(VPATH)}iseq.c {$(VPATH)}vm_core.h {$(VPATH)}id.h {$(VPATH)}de
{$(VPATH)}ruby.h {$(VPATH)}defines.h {$(VPATH)}missing.h \
{$(VPATH)}intern.h {$(VPATH)}st.h {$(VPATH)}signal.h \
{$(VPATH)}gc.h {$(VPATH)}vm_opts.h {$(VPATH)}config.h {$(VPATH)}node.h \
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}insns_info.inc
{$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}insns_info.inc \
{$(VPATH)}node_name.inc
vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}vm.h {$(VPATH)}vm_core.h {$(VPATH)}id.h \
{$(VPATH)}debug.h {$(VPATH)}ruby.h {$(VPATH)}config.h \
{$(VPATH)}node.h {$(VPATH)}util.h {$(VPATH)}signal.h {$(VPATH)}dln.h \
@ -611,7 +612,10 @@ vmtc.inc: $(srcdir)/template/vmtc.inc.tmpl
vm.inc: $(srcdir)/template/vm.inc.tmpl
incs: $(INSNS)
incs: $(INSNS) node_name.inc
node_name.inc: {$(VPATH)}node.h
$(BASERUBY) -n $(srcdir)/tool/node_name.rb $< > $@
docs:
$(BASERUBY) -I$(srcdir) $(srcdir)/tool/makedocs.rb $(INSNS2VMOPT)

231
iseq.c
View file

@ -853,236 +853,7 @@ const char *
ruby_node_name(int node)
{
switch (node) {
/*
# generated by this script.
src = 'include/ruby/node.h'
f = open(File.expand_path(src))
line = f.gets while /enum node_type \{/ !~ line
while line = f.gets
break if /(NODE_.+),/ !~ line
node = $1
puts " case #{node}:"
puts "\treturn \"#{node}\";"
end
*/
case NODE_METHOD:
return "NODE_METHOD";
case NODE_FBODY:
return "NODE_FBODY";
case NODE_CFUNC:
return "NODE_CFUNC";
case NODE_SCOPE:
return "NODE_SCOPE";
case NODE_BLOCK:
return "NODE_BLOCK";
case NODE_IF:
return "NODE_IF";
case NODE_CASE:
return "NODE_CASE";
case NODE_WHEN:
return "NODE_WHEN";
case NODE_OPT_N:
return "NODE_OPT_N";
case NODE_WHILE:
return "NODE_WHILE";
case NODE_UNTIL:
return "NODE_UNTIL";
case NODE_ITER:
return "NODE_ITER";
case NODE_FOR:
return "NODE_FOR";
case NODE_BREAK:
return "NODE_BREAK";
case NODE_NEXT:
return "NODE_NEXT";
case NODE_REDO:
return "NODE_REDO";
case NODE_RETRY:
return "NODE_RETRY";
case NODE_BEGIN:
return "NODE_BEGIN";
case NODE_RESCUE:
return "NODE_RESCUE";
case NODE_RESBODY:
return "NODE_RESBODY";
case NODE_ENSURE:
return "NODE_ENSURE";
case NODE_AND:
return "NODE_AND";
case NODE_OR:
return "NODE_OR";
case NODE_NOT:
return "NODE_NOT";
case NODE_MASGN:
return "NODE_MASGN";
case NODE_LASGN:
return "NODE_LASGN";
case NODE_DASGN:
return "NODE_DASGN";
case NODE_DASGN_CURR:
return "NODE_DASGN_CURR";
case NODE_GASGN:
return "NODE_GASGN";
case NODE_IASGN:
return "NODE_IASGN";
case NODE_IASGN2:
return "NODE_IASGN2";
case NODE_CDECL:
return "NODE_CDECL";
case NODE_CVASGN:
return "NODE_CVASGN";
case NODE_CVDECL:
return "NODE_CVDECL";
case NODE_OP_ASGN1:
return "NODE_OP_ASGN1";
case NODE_OP_ASGN2:
return "NODE_OP_ASGN2";
case NODE_OP_ASGN_AND:
return "NODE_OP_ASGN_AND";
case NODE_OP_ASGN_OR:
return "NODE_OP_ASGN_OR";
case NODE_CALL:
return "NODE_CALL";
case NODE_FCALL:
return "NODE_FCALL";
case NODE_VCALL:
return "NODE_VCALL";
case NODE_SUPER:
return "NODE_SUPER";
case NODE_ZSUPER:
return "NODE_ZSUPER";
case NODE_ARRAY:
return "NODE_ARRAY";
case NODE_ZARRAY:
return "NODE_ZARRAY";
case NODE_VALUES:
return "NODE_VALUES";
case NODE_HASH:
return "NODE_HASH";
case NODE_RETURN:
return "NODE_RETURN";
case NODE_YIELD:
return "NODE_YIELD";
case NODE_LVAR:
return "NODE_LVAR";
case NODE_DVAR:
return "NODE_DVAR";
case NODE_GVAR:
return "NODE_GVAR";
case NODE_IVAR:
return "NODE_IVAR";
case NODE_CONST:
return "NODE_CONST";
case NODE_CVAR:
return "NODE_CVAR";
case NODE_NTH_REF:
return "NODE_NTH_REF";
case NODE_BACK_REF:
return "NODE_BACK_REF";
case NODE_MATCH:
return "NODE_MATCH";
case NODE_MATCH2:
return "NODE_MATCH2";
case NODE_MATCH3:
return "NODE_MATCH3";
case NODE_LIT:
return "NODE_LIT";
case NODE_STR:
return "NODE_STR";
case NODE_DSTR:
return "NODE_DSTR";
case NODE_XSTR:
return "NODE_XSTR";
case NODE_DXSTR:
return "NODE_DXSTR";
case NODE_EVSTR:
return "NODE_EVSTR";
case NODE_DREGX:
return "NODE_DREGX";
case NODE_DREGX_ONCE:
return "NODE_DREGX_ONCE";
case NODE_ARGS:
return "NODE_ARGS";
case NODE_ARGS_AUX:
return "NODE_ARGS_AUX";
case NODE_OPT_ARG:
return "NODE_OPT_ARG";
case NODE_POSTARG:
return "NODE_POSTARG";
case NODE_ARGSCAT:
return "NODE_ARGSCAT";
case NODE_ARGSPUSH:
return "NODE_ARGSPUSH";
case NODE_SPLAT:
return "NODE_SPLAT";
case NODE_TO_ARY:
return "NODE_TO_ARY";
case NODE_BLOCK_ARG:
return "NODE_BLOCK_ARG";
case NODE_BLOCK_PASS:
return "NODE_BLOCK_PASS";
case NODE_DEFN:
return "NODE_DEFN";
case NODE_DEFS:
return "NODE_DEFS";
case NODE_ALIAS:
return "NODE_ALIAS";
case NODE_VALIAS:
return "NODE_VALIAS";
case NODE_UNDEF:
return "NODE_UNDEF";
case NODE_CLASS:
return "NODE_CLASS";
case NODE_MODULE:
return "NODE_MODULE";
case NODE_SCLASS:
return "NODE_SCLASS";
case NODE_COLON2:
return "NODE_COLON2";
case NODE_COLON3:
return "NODE_COLON3";
case NODE_DOT2:
return "NODE_DOT2";
case NODE_DOT3:
return "NODE_DOT3";
case NODE_FLIP2:
return "NODE_FLIP2";
case NODE_FLIP3:
return "NODE_FLIP3";
case NODE_ATTRSET:
return "NODE_ATTRSET";
case NODE_SELF:
return "NODE_SELF";
case NODE_NIL:
return "NODE_NIL";
case NODE_TRUE:
return "NODE_TRUE";
case NODE_FALSE:
return "NODE_FALSE";
case NODE_ERRINFO:
return "NODE_ERRINFO";
case NODE_DEFINED:
return "NODE_DEFINED";
case NODE_POSTEXE:
return "NODE_POSTEXE";
case NODE_ALLOCA:
return "NODE_ALLOCA";
case NODE_BMETHOD:
return "NODE_BMETHOD";
case NODE_MEMO:
return "NODE_MEMO";
case NODE_IFUNC:
return "NODE_IFUNC";
case NODE_DSYM:
return "NODE_DSYM";
case NODE_ATTRASGN:
return "NODE_ATTRASGN";
case NODE_PRELUDE:
return "NODE_PRELUDE";
case NODE_LAMBDA:
return "NODE_LAMBDA";
case NODE_OPTBLOCK:
return "NODE_OPTBLOCK";
#include "node_name.inc"
default:
rb_bug("unknown node (%d)", node);
return 0;

4
tool/node_name.rb Executable file
View file

@ -0,0 +1,4 @@
#! ./miniruby -n
if ~/enum node_type \{/..~/^\};/
~/(NODE_.+),/ and puts(" case #{$1}:\n\treturn \"#{$1}\";")
end