mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ee7f8d4805
Divide big array (or hash) literals into several blocks and concatetene them. There was a problem that a big array (hash) literal causes SystemStackError exception (stack overflow) because VM push all contents of the literal onto VM stack to make an array (or hash). To solve this issue, we make several arrays (hashes) and concatenate them to make a big array (hash) object. ?? * compile.c (iseq_compile_each, setup_args): use modified compile_array. * vm.c (m_core_hash_from_ary, m_core_hash_merge_ary, m_core_hash_merge_ptr): added for above change. * id.c (Init_id), parse.y: add core method ids. * bootstraptest/test_literal.rb: add simple tests. * bootstraptest/test_eval.rb: remove rescue clause to catch SystemStackError exception. * test/ruby/test_literal.rb: add tests to check no stack overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
54 lines
1.9 KiB
C
54 lines
1.9 KiB
C
/**********************************************************************
|
|
|
|
id.c -
|
|
|
|
$Author$
|
|
created at: Thu Jul 12 04:37:51 2007
|
|
|
|
Copyright (C) 2004-2007 Koichi Sasada
|
|
|
|
**********************************************************************/
|
|
|
|
#include "ruby/ruby.h"
|
|
|
|
#include "id.h"
|
|
|
|
static void
|
|
Init_id(void)
|
|
{
|
|
#undef rb_intern
|
|
#define rb_intern(str) rb_intern_const(str)
|
|
rb_encoding *enc = rb_usascii_encoding();
|
|
|
|
REGISTER_SYMID(idNULL, "");
|
|
REGISTER_SYMID(idIFUNC, "<IFUNC>");
|
|
REGISTER_SYMID(idCFUNC, "<CFUNC>");
|
|
REGISTER_SYMID(idRespond_to, "respond_to?");
|
|
|
|
REGISTER_SYMID(id_core_set_method_alias, "core#set_method_alias");
|
|
REGISTER_SYMID(id_core_set_variable_alias, "core#set_variable_alias");
|
|
REGISTER_SYMID(id_core_undef_method, "core#undef_method");
|
|
REGISTER_SYMID(id_core_define_method, "core#define_method");
|
|
REGISTER_SYMID(id_core_define_singleton_method, "core#define_singleton_method");
|
|
REGISTER_SYMID(id_core_set_postexe, "core#set_postexe");
|
|
REGISTER_SYMID(id_core_hash_from_ary, "core#hash_from_ary");
|
|
REGISTER_SYMID(id_core_hash_merge_ary, "core#hash_merge_ary");
|
|
REGISTER_SYMID(id_core_hash_merge_ptr, "core#hash_merge_ptr");
|
|
|
|
REGISTER_SYMID(idEach, "each");
|
|
REGISTER_SYMID(idLength, "length");
|
|
REGISTER_SYMID(idSize, "size");
|
|
REGISTER_SYMID(idLambda, "lambda");
|
|
REGISTER_SYMID(idIntern, "intern");
|
|
REGISTER_SYMID(idGets, "gets");
|
|
REGISTER_SYMID(idSucc, "succ");
|
|
REGISTER_SYMID(idMethodMissing, "method_missing");
|
|
#if SUPPORT_JOKE
|
|
REGISTER_SYMID(idBitblt, "bitblt");
|
|
REGISTER_SYMID(idAnswer, "the_answer_to_life_the_universe_and_everything");
|
|
#endif
|
|
REGISTER_SYMID(idSend, "send");
|
|
REGISTER_SYMID(id__send__, "__send__");
|
|
REGISTER_SYMID(idInitialize, "initialize");
|
|
REGISTER_SYMID(idUScore, "_");
|
|
}
|