diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-20 06:05:08 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-20 06:05:08 +0000 |
commit | 8754f619d51a67fc4df255c189c8ff744433dd6e (patch) | |
tree | d12e93d26985d01ba5b8d4a4d0aced083ad62378 | |
parent | 12652453b2fc6498a95a491fc0aa5fc059fe9fff (diff) | |
download | ruby-8754f619d51a67fc4df255c189c8ff744433dd6e.tar.gz |
parse.y (parser_initialize): avoid redundant zero-ing
TypedData_Make_Struct already initializes fields to zero by default,
so there's no need to waste code re-zeroing them.
Size reduction on 32-bit x86:
text data bss dec hex filename
187231 2372 80 189683 2e4f3 parse.o.before
186939 2372 80 189391 2e3cf parse.o
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | parse.y | 36 |
2 files changed, 6 insertions, 34 deletions
@@ -1,3 +1,7 @@ +Mon Jul 20 15:04:30 2015 Eric Wong <e@80x24.org> + + * parse.y (parser_initialize): avoid redundant zero-ing + Mon Jul 20 12:12:05 2015 Eric Wong <e@80x24.org> * parse.y (struct parser_params): pack: 88 => 256 bytes on 64-bit @@ -10547,46 +10547,14 @@ internal_id_gen(struct parser_params *parser) static void parser_initialize(struct parser_params *parser) { - parser->eofp = 0; - - parser->parser_lex_strterm = 0; - parser->parser_cond_stack = 0; - parser->parser_cmdarg_stack = 0; - parser->parser_paren_nest = 0; - parser->parser_lpar_beg = 0; - parser->parser_brace_nest = 0; - parser->parser_in_single = 0; - parser->parser_in_def = 0; - parser->parser_in_defined = 0; - parser->parser_in_kwarg = 0; - parser->parser_compile_for_eval = 0; - parser->parser_tokenbuf = NULL; - parser->parser_tokidx = 0; - parser->parser_toksiz = 0; - parser->parser_heredoc_end = 0; + /* note: we rely on TypedData_Make_Struct to set most fields to 0 */ parser->parser_command_start = TRUE; - parser->parser_deferred_nodes = 0; - parser->parser_lex_pbeg = 0; - parser->parser_lex_p = 0; - parser->parser_lex_pend = 0; - parser->parser_lvtbl = 0; - parser->parser_ruby__end__seen = 0; - parser->parser_ruby_sourcefile = 0; parser->parser_ruby_sourcefile_string = Qnil; - parser->cur_arg = 0; -#ifndef RIPPER - parser->parser_eval_tree_begin = 0; - parser->parser_eval_tree = 0; -#else +#ifdef RIPPER parser->delayed = Qnil; - parser->result = Qnil; parser->parsing_thread = Qnil; parser->toplevel_p = TRUE; - parser->error_p = FALSE; -#endif -#ifdef YYMALLOC - parser->heap = NULL; #endif parser->enc = rb_utf8_encoding(); } |