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

1116 Коммитов

Автор SHA1 Сообщение Дата
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
nobu ad528e85c6 parse.y: show symbol name
* parse.y (must_be_dynamic_symbol): show the name if it is a
  static symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-01 10:53:18 +00:00
nobu 795a6b2374 parse.y: show name as possible
* parse.y (rb_id_attrset): show the name of broken ID if it is
  still registered.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 15:37:56 +00:00
nobu fba47c1397 parse.y: raise with numeric ID type
* parse.y (rb_id_attrset): all valid ID types are handled
  properly, raise with numeric ID type which may be broken for
  GCed static symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 15:25:46 +00:00
nobu 6b7ed6048e parse.y: use rb_id2str
* parse.y (rb_id_attrset): use rb_id2str to get rid of method call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 15:16:09 +00:00
nobu 60375cd6ba parse.y: use rb_str_ellipsize
* parse.y (next_id): use rb_str_ellipsize to preserve encoding and
  get rid of incomplete multibyte sequence.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 12:09:35 +00:00
nobu 48384bbab7 parse.y: pin down dynamic symbol only
* parse.y (rb_id_attrset): pin down dynamic symbol only. it is
  possibe that attrset ID can be registered as a static symbol
  after the corresponding attrget ID has been registered as a
  dynamic, and then the latter may be collected.
  [ruby-core:62226] [Bug #9787]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-30 08:06:51 +00:00
ktsj 0f51db6a1e * parse.y (symbols_i): like r45492, call rb_gc_resurrect().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-29 01:25:36 +00:00
nobu d182cd3053 parse.y: resurrect dynamic symbol and name
* parse.y (lookup_id_str): resurrect the dynamic symbol before
  accessing its content, and its name before returning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 04:24:56 +00:00
nobu a680ee9ffa parse.y: check for symbol
* parse.y (rb_sym2id, rb_sym2id_without_pindown): reject
  non-symbol values.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 03:08:49 +00:00
nobu 34c35bf107 parse.y: check for symbol
* parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
  non-symbol values, for the time being.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 02:21:38 +00:00
nobu 977a5147b4 parse.y: resurrect before pindown
* parse.y (rb_pin_dynamic_symbol): resurrect the dynamic symbol
  which may be unmarked already and swept at next time, before
  pindown.

* parse.y (dsym_node_gen): now rb_intern_str() resurrects dynamic
  symbols, via lookup_sym_id() and rb_pin_dynamic_symbol().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 02:04:33 +00:00
nobu 91c6d41ac3 parse.y: trivial optimization
* parse.y (rb_str_dynamic_intern): branch by same condition as
  rb_id2sym to reduce unnecessary branch.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-24 02:04:29 +00:00
naruse 2dca886a07 * parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-23 20:59:03 +00:00
nobu c501345218 parse.y: allow parenthesed do-block in cmdarg
* parse.y (primary): flush cmdarg flags inside left-paren in a
  command argument, to allow parenthesed do-block as an argument
  without arguments parentheses.  [ruby-core:61950] [Bug #9726]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19 06:38:31 +00:00
nobu 5b54488e78 parse.y: shared substring of source
* parse.y (lex_get_str): return shared sub-string of entire source
  string instead of a partial copy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-18 14:27:22 +00:00
ktsj f6686b5132 * parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol
is before sweeping.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-01 00:07:58 +00:00
ktsj e4879afe3e * parse.y (rb_str_dynamic_intern): [DOC] move rdoc from rb_str_intern.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-30 08:10:04 +00:00
nobu fd8f3cb987 parse.y: rb_id_attrget
* parse.y (rb_id_attrget): new function to convert setter ID to
  getter ID.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-28 12:36:26 +00:00
nobu d94dcf1e10 parse.y: type-punning cast
* parse.y (rb_gc_free_dsymbol): use intermediate st_data_t and get
  rid of type-punning cast.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-27 02:58:32 +00:00
nobu bb1d0d2807 parse.y: set encoding
* parse.y (rb_str_dynamic_intern): associate proper encoding with
  the result symbol.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 11:30:54 +00:00
nobu ef02cae507 parse.y: fix rb_str_symname_type call
* parse.y (rb_str_dynamic_intern): fix the second argument to
  rb_str_symname_type, which is a bit mask but not a boolean.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45434 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 06:43:02 +00:00
nobu 5620a51996 * parse.y (rb_str_dynamic_intern): fix commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 06:36:50 +00:00
nobu 33b8663f1b parse.y: guard dup string
* parse.y (rb_str_dynamic_intern): prevent a string which may be
  duplicated, from GC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 06:34:35 +00:00
nobu ad8ed59ab9 parse.y: dup iff needed
* parse.y (rb_str_dynamic_intern): dup the given string only if
  needed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 06:34:33 +00:00
nobu 9a848c5f4a parse.y: no dup US-ASCII string
* parse.y (rb_str_dynamic_intern): no needs to associate encoding
  if it is US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 06:34:31 +00:00
usa e70b61d010 * parse.y: inline must be static (for mswin).
fixed build error introduced at r45426.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 05:58:41 +00:00
nari b9ea135950 * internal.h (USE_SYMBOL_GC): enable Symbol GC by default (USE_SYMBOL_GC == 1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 05:39:22 +00:00
nari 17a6f9227a cast to int to silence clang compile error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 05:14:51 +00:00
nari 90b7073842 * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
See this ticket about Symbol GC.

* include/ruby/ruby.h:
  Declare few functions.
  * rb_sym2id: almost same as old SYM2ID but support dynamic symbols.
  * rb_id2sym: almost same as old ID2SYM but support dynamic symbols.
  * rb_sym2str: almost same as `rb_id2str(SYM2ID(sym))` but not
    pin down a dynamic symbol.
  Declare a new struct.
  * struct RSymbol: represents a dynamic symbol as object in
    Ruby's heaps.
  Add few macros.
  * STATIC_SYM_P: check a static symbol.
  * DYNAMIC_SYM_P: check a dynamic symbol.
  * RSYMBOL: cast to RSymbol

* gc.c: declare RSymbol. support T_SYMBOL.

* internal.h: Declare few functions.
  * rb_gc_free_dsymbol: free up a dynamic symbol. GC call this
    function at a sweep phase.
  * rb_str_dynamic_intern: convert a string to a dynamic symbol.
  * rb_check_id_without_pindown: not pinning function.
  * rb_sym2id_without_pindown: ditto.
  * rb_check_id_cstr_without_pindown: ditto.

* string.c (Init_String): String#intern and String#to_sym use
  rb_str_dynamic_intern.

* template/id.h.tmpl: use LSB of ID as a flag for determining a
  static symbol, so we shift left other ruby_id_types.

* string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
  avoid pinning.

* load.c: use xx_without_pindown function at creating temporary ID
  to avoid pinning.

* object.c: ditto.

* sprintf.c: ditto.

* struct.c: ditto.

* thread.c: ditto.

* variable.c: ditto.

* vm_method.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 04:57:47 +00:00
nobu dcd1e5e5c2 parse.y: required kwarg without parentheses
* parse.y (parser_yylex): only a newline after label should be
  significant.  [ruby-core:61658] [Bug #9669]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 14:57:18 +00:00
nobu d7442c32df parse.y: required kwarg without parentheses
* parse.y (lex_state_e, parser_params, f_arglist, parser_yylex):
  separate EXPR_LABELARG from EXPR_BEG and let newline significant,
  so that required keyword argument can place at the end of
  argument list without parentheses.  [ruby-core:61658] [Bug #9669]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 07:47:37 +00:00
nobu 0574b64694 parse.y: removing padding
* parse.y (parser_params): shrink struct size by removing padding
  on 64-bit platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45404 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 07:39:58 +00:00
nobu 0331e42be3 parse.y: freeze filename
* parse.y (ripper_initialize): filename can not be modified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-24 13:19:57 +00:00