Граф коммитов

1149 Коммитов

Автор SHA1 Сообщение Дата
normal 6358bae370 struct parse_params: trivial packing
* parse.y (struct parse_params): shrink to 320 to 304 bytes on 64-bit

Some elements may be removed/resized as well, but not as important
as reducing more-frequently allocated structures.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:47:20 +00:00
normal 48a2b96d2b introduce ZALLOC{,_N} to replace ALLOC{,_N}+MEMZERO use
Using calloc where possible reduces code and binary sizes.

* include/ruby/ruby.h (ZALLOC, ZALLOC_N): implement
  (Data_Make_Struct, TypedData_Make_Struct):
  ZALLOC replaces ALLOC+memset
* compile.c (iseq_seq_sequence): ZALLOC_N replaces ALLOC_N+MEMZERO
* cont.c (fiber_t_alloc): ZALLOC replaces ALLOC+MEMZERO
* io.c (rb_io_reopen): ditto
* iseq.c (prepare_iseq_build): ditto
* parse.y (new_args_tail_gen, parser_new, ripper_s_allocate): ditto
* re.c (match_alloc): ditto
* variable.c (rb_const_set): ditto
* ext/socket/raddrinfo.c (get_addrinfo): ditto
* ext/strscan/strscan.c (strscan_s_allocate): ditto
* gc.c (rb_objspace_alloc): calloc replaces malloc+MEMZERO

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-25 21:34:35 +00:00
nobu be7c04e197 parse.y: dynamic const assign_error in ripper
* parse.y (mlhs_node): dynamic constant assignment in massign
  should cause assign_error, like as single assign and backref
  assignment in massign.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24 15:28:14 +00:00
nobu 418c46f284 parse.y: move common code
* parse.y (arg, primary): move common code shared with ripper.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24 15:28:01 +00:00
nobu 4cd0471178 parse.y: remove garbage
* parse.y (assoc): remove garbage semicolon added by r35489.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-24 08:22:17 +00:00
nobu 25a2e870d4 parse.y: separate from parse_ident
* parse.y (tokadd_ident, tokenize_ident): extract from
  parse_ident().

* parse.y (parse_gvar, parse_atmark): move tokenization from
  parse_ident().

* parse.y (parse_ident): now deals with non-sigil names only.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:44 +00:00
nobu 27e1b24776 parse.y: parse_atmark
* parse.y (parse_atmark): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:38 +00:00
nobu db155640b7 parse.y: parse_ident
* parse.y (parse_ident): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:34 +00:00
nobu 5faf8f07e9 parse.y: parse_gvar
* parse.y (parse_gvar): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:31 +00:00
nobu d41b3e8874 parse.y: parse_percent
* parse.y (parse_percent): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:27 +00:00
nobu c42029f34a parse.y: parse_qmark
* parse.y (parse_qmark): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:24 +00:00
nobu 9e09b370c1 parse.y: parse_rational
* parse.y (parse_rational): extract from parse_numeric().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:21 +00:00
nobu 5000ed38f4 parse.y: parse_numeric
* parse.y (parse_numeric): extract from parser_yylex().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:13 +00:00
nobu 88d4f46f5e parse.y: negate_lit
* parse.y (negate_lit): alter only literal object itself, not NODE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-17 04:30:04 +00:00
nobu d33d22c7a0 parse.y: rename Init_parser
* parse.y (rb_init_parse): rename to get rid of name clash with
  json/parser at statically linking.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-11 13:52:47 +00:00
nobu 94ce481263 symbol.c, symbol.h: split from parse.y
* symbol.c, symbol.h: Symbol class implementation and internals,
  split from parse.y.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 08:07:32 +00:00
nobu d299250afa parse.y: adjust argument types
* parse.y (symbols_i): adjust argument types for st_foreach()
  using st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 07:31:42 +00:00
ko1 76a929a7fc * parse.y: change Symbol <-> ID relationship to avoid
exposing IDs from collectable symbols.
  [Bug #10014]
  Now, rb_check_id() returns 0 if corresponding symbol is
  pinned dynamic symbol.
  There is remaining intern_cstr_without_pindown(), it can return
  IDs from collectable symbols. We must be careful to use it
  (only used in parse.y).  I think it should be removed if
  it does not have impact for performance.
* parse.y:
  add:
  * STATIC_SYM2ID()
  * STATIC_ID2SYM()
  rename:
  * rb_pin_dynamic_symbol() -> dsymbol_pindown()
* internal.h:
  remove:
  * rb_check_id_without_pindown()
  * rb_sym2id_without_pindown()
  add:
  * rb_check_symbol()
  * rb_check_symbol_cstr()
* load.c: use rb_check_id() or rb_check_id_cstr().
* object.c: ditto.
* struct.c: ditto.
* thread.c: ditto.
* vm_method.c: ditto.
* string.c (sym_find): use only rb_check_symbol().
* sprintf.c (rb_str_format): use rb_check_symbol_cstr().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 06:14:41 +00:00
ko1 37f018fdf5 * parse.y (symbols_i): delete garbage symbols for Symbol.all_symbols.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-09 05:00:53 +00:00
nobu 65accad30a parse.y: expand is_asgn_or_id
* parse.y (new_op_assign_gen): expand is_asgn_or_id(), which call
  id_type() function multiple times now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-08 07:01:10 +00:00
ko1 fd7073f7aa * parse.y (dsymbol_alloc): set global_symbols.minor_marked to 0.
* parse.y (dsymbol_check): set RSYMBOL(sym)->fstr to 0
  because we should not touch fstr after that.
* parse.y (rb_gc_free_dsymbol): skip deleting str and sym
  from tables if fstr == 0.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-08 05:48:36 +00:00
ko1 8572ed5c0d * parse.y: remove global_symbols::pinned_dsym
(and ::pinned_dsym_minor_marked).
  Mark pinned dsymbols by rb_gc_register_mark_object() because
  they are immortal.
* prase.y (rb_gc_free_dsymbol): rename parameter name `ptr' to `sym'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07 05:36:25 +00:00
ko1 2c551e4715 * parse.y: need to use updated (re-created) symbols.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07 03:42:42 +00:00
ko1 a31219c91c * parse.y: do not use rb_gc_resurrect(), but create a new dynamic
symbol for garbage dynamic symbol.
* common.mk: use gc.h by parse.y.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-07 01:53:54 +00:00
nobu 5405eff901 parse.y: fix casts
* parse.y (reg_named_capture_assign_gen): remove needless cast.

* parse.y (must_be_dynamic_symbol, intern_cstr_without_pindown):
  get rid of type-punning cast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 17:27:08 +00:00
ko1 336f65eb57 * parse.y: rename symbols::sym_id to symbols::str_id.
This table is not {Symbol => ID} table, but
  {String => ID} table.
* parse.y (lookup_sym_id): also rename lookup_sym_id() to
  lookup_str_id() because key is not Symbol, but String.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 11:48:47 +00:00
ko1 a99a88d49d * parse.y (must_be_dynamic_symbol): fix missed-condition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 09:42:55 +00:00
ko1 cc462eed98 * parse.y (rb_pin_dynamic_symbol): should be `static' function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 09:39:14 +00:00
ko1 a227b16eba * parse.y (must_be_dynamic_symbol): refactoring.
* add `inline'.
  * use UNLIKELY().
  * check only DYNAMIC_SYM_P(), otherwise it is a bug.
  * lookup_id_str() is not needed in second condition.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 09:11:05 +00:00
nobu 27cafcfc89 parse.y: remove global_symbols.op_sym
* parse.y (global_symbols): remove op_sym, cache by fstring
  instead.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 07:30:11 +00:00
nobu 56ff2b50f3 parse.y: use rb_fstring_new
* parse.y (rb_id2str): use rb_fstring_new() instead of rb_fstring()
  with a new string instance.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 07:16:21 +00:00
nobu 5e294b7820 parse.y: pack op_tbl
* parse.y (op_tbl): pack limited size strings.  gcc/clang warn
  if initializer-string for char array is too long, but no option
  to err it now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 06:10:37 +00:00
ko1 3e8a898bfe * parse.y: remove unused code
srounded by `#if ENABLE_SELECTOR_NAMESPACE'



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-04 02:56:34 +00:00
nobu fd8b254705 node.h: remove NODE_PRIVATE_RECV
* compile.c (private_recv_p): check by node type, instead of a
  magic number.
* node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-06 13:19:31 +00:00
nobu 199f814f32 compile.c, parse.y: private op assign
* compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen):
  allow op assign to a private attribute.
  [ruby-core:62949] [Bug #9907]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-06 08:07:13 +00:00
nobu 118f0d1da5 parse.y: attr_receiver
* parse.y (aryset_gen): use `attr_receiver()`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-06 07:54:37 +00:00
nobu bb3f036336 node.h: NODE_PRIVATE_RECV
* node.h (NODE_PRIVATE_RECV): name a magic number, `self` as the
  receiver of a setter method call.

* compile.c (private_recv_p), parse.y (attr_receiver): use the
  named macro.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-06 06:05:19 +00:00
nobu 6ab08d2e8d configure.in, missing.h: jemalloc mangling
* configure.in (with-jemalloc): also check for header, for ABIs
  which JEMALLOC_MANGLE is needed, i.e., Mach-O and PE-COFF
  platforms.  [ruby-core:62939] [Feature #9113]
* include/ruby/missing.h: include alternative malloc header to
  replace memory management functions.
* dln.c, io.c, parse.y, st.c: undef malloc family before
  re-definition to suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-05 05:16:46 +00:00
nobu f2980e3e20 encoding.h: constify rb_encoding
* include/ruby/encoding.h: constify `rb_encoding` itself, not only
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-02 20:23:47 +00:00
nobu 046831094b constify rb_encoding and OnigEncoding
* include/ruby/encoding.h: constify `rb_encoding` arguments.
* include/ruby/oniguruma.h: constify `OnigEncoding` arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-01 22:06:11 +00:00
nobu 70d34c623a parse.y: no duplicate attrset ID
* parse.y (intern_str): dynamic attrset ID is registered by
  `rb_id_attrset()` already, so no further registration is needed.
  [ruby-core:62861]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-31 21:55:53 +00:00
normal fae18c95be remove empty rb_gc_mark_parser function
* parse.y (rb_gc_mark_parser): remove, empty since r8758
* internal.h: ditto, not usable from extensions since 2.0.0
* gc.c (gc_mark_roots): remove checkpoint for parser

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-29 19:49:22 +00:00
nobu fe780f2997 parse.y: refine error message
* parse.y (parser_number_literal_suffix): refine error message for
  extra dot and digits.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 14:06:48 +00:00
nobu b5cae3820b parse.y: no duplicated names
* parse.y (new_bv_gen): no duplicated names, if already added in
  shadowing_lvar().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 14:29:07 +00:00
nobu d750b62d66 parse.y: remove duplicated names
* parse.y (local_tbl_gen): remove local variables duplicated with
  arguments.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 14:28:48 +00:00
nobu 8a57bb7b4a parse.y: unused return values
* parse.y (arg_var_gen, local_var_gen): make void since the result
  values are not used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-06 14:28:38 +00:00
nobu b1520b7459 parse.y: fix wrong static symbol
* parse.y (next_id): no reason to set ID_STATIC_SYM here, as ID
  returned by rb_intern3 can be a dynamic symbol and the static
  symbol flag is set otherwise.  [Bug #9787]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 12:04:04 +00:00
nobu ff99fd4de1 parse.y: hide anonymous id
* parse.y (rb_id_attrset): should not reveal anonymous ID as an
  instance variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 03:20:21 +00:00
nobu d42e0ea844 parse.y: turn dynamically interned Symbol into an ID
* parse.y (rb_id_attrset): turn dynamically interned Symbol into
  an ID, since rb_str_dynamic_intern returns a Symbol but not an
  ID.  [ruby-core:62226] [Bug #9787]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-02 01:37:57 +00:00
nobu 0e7a25bd4e parse.y: abort at inappropriate symbol
* parse.y (must_be_dynamic_symbol): abort if inappropriate symbol
  is given, which should never happen.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01 13:52:36 +00:00