rb_method_entry_t::flags to make one word spare space.
Add some macros to access these flags.
* vm_method.c: use these macros.
* internal.h: define IMEMO_FL_USHIFT and IMEMO_FL_USER[0-4]
for T_IMEMO local flags.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_intern.h: move definition of rb_scope_visibility_t
to method.h.
* method.h: change rb_cref_t::scope_visi from VALUE to
rb_scope_visibility_t.
[Bug #11219]
* vm.c (vm_cref_new): accept rb_method_visibility_t directly.
* vm_insnhelper.c (rb_vm_rewrite_cref): don't use 0,
but METHOD_VISI_UNDEF.
* vm_method.c (rb_scope_visibility_set): don't need to use cast.
* vm_method.c (rb_scope_module_func_set): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Special constants are all frozen since [Feature #8923] and cannot
support ivars. Remove some unused code we had for supporting them.
* variable.c (special_generic_ivar): remove flag
(givar_i, rb_mark_generic_ivar_tbl): remove functions
(rb_free_generic_ivar, rb_ivar_lookup, rb_ivar_delete,
generic_ivar_set, rb_ivar_set, rb_ivar_defined,
rb_copy_generic_ivar, rb_ivar_foreach, rb_ivar_count,
rb_obj_remove_instance_variable):
adjust for lack of ivar support in special constants
* test/ruby/test_variable.rb: test ivars for special consts
* internal.h: remove rb_mark_generic_ivar_tbl decl
* gc.c (gc_mark_roots): remove rb_mark_generic_ivar_tbl call
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`flag' contains several categories of attributes and it makes us
confusion (at least, I had confused).
* rb_method_visibility_t (flags::visi)
* NOEX_UNDEF -> METHOD_VISI_UNDEF = 0
* NOEX_PUBLIC -> METHOD_VISI_PUBLIC = 1
* NOEX_PRIVATE -> METHOD_VISI_PRIVATE = 2
* NOEX_PROTECTED -> METHOD_VISI_PROTECTED = 3
* NOEX_SAFE(flag)) -> safe (flags::safe, 2 bits)
* NOEX_BASIC -> basic (flags::basic, 1 bit)
* NOEX_MODFUNC -> rb_scope_visibility_t in CREF
* NOEX_SUPER -> MISSING_SUPER (enum missing_reason)
* NOEX_VCALL -> MISSING_VCALL (enum missing_reason)
* NOEX_RESPONDS -> BOUND_RESPONDS (macro)
Now, NOEX_NOREDEF is not supported (I'm not sure it is needed).
Background:
I did not know what "NOEX" stands for.
I asked Matz (who made this name) and his answer was "Nothing".
"At first, it meant NO EXport (private), but the original
meaning was gone."
This is why I remove the mysterious word "NOEX" from MRI.
* vm_core.h: introduce `enum missing_reason' to represent
method_missing (NoMethodError) reason.
* eval_intern.h: introduce rb_scope_visibility_t to represent
scope visibility.
It has 3 method visibilities (public/private/protected)
and `module_function`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Motivation and new data structure are described in [Bug #11203].
This patch also solve the following issues.
* [Bug #11200] Memory leak of method entries
* [Bug #11046] __callee__ returns incorrect method name in orphan
proc
* test/ruby/test_method.rb: add a test for [Bug #11046].
* vm_core.h: remvoe rb_control_frame_t::me. me is located at value
stack.
* vm_core.h, gc.c, vm_method.c: remove unlinked_method... codes
because method entries are simple VALUEs.
* method.h: Now, all method entries has own independent method
definititons. Strictly speaking, this change is not essential,
but for future changes.
* rb_method_entry_t::flag is move to rb_method_definition_t::flag.
* rb_method_definition_t::alias_count is now
rb_method_definition_t::alias_count_ptr, a pointer to the counter.
* vm_core.h, vm_insnhelper.c (rb_vm_frame_method_entry) added to
search the current method entry from value stack.
* vm_insnhelper.c (VM_CHECK_MODE): introduced to enable/disable
assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to internal class data structure.
* internal.h: ditto.
* hash.c (has_extra_methods): use added function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This recovers and improves performance of Marshal.dump/load on
Time objects compared to when we implemented generic ivars
entirely using st_table.
This also recovers some performance on other generic ivar objects,
but does not bring bring Marshal.dump/load performance up to
previous speeds.
benchmark results:
minimum results in each 10 measurements.
Execution time (sec)
name trunk geniv after
marshal_dump_flo 0.343 0.334 0.335
marshal_dump_load_geniv 0.487 0.527 0.495
marshal_dump_load_time 1.262 1.401 1.257
Speedup ratio: compare with the result of `trunk' (greater is better)
name geniv after
marshal_dump_flo 1.026 1.023
marshal_dump_load_geniv 0.925 0.985
marshal_dump_load_time 0.901 1.004
* include/ruby/intern.h (rb_generic_ivar_table): deprecate
* internal.h (rb_attr_delete): declare
* marshal.c (has_ivars): use rb_ivar_foreach
(w_ivar): ditto
(w_object): update for new interface
* time.c (time_mload): use rb_attr_delete
* variable.c (generic_ivar_delete): implement
(rb_ivar_delete): ditto
(rb_attr_delete): ditto
[ruby-core:69323] [Feature #11170]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* compile.c (iseq_compile_each): out of range NTH_REF is always
nil.
* parse.y (parse_numvar): check overflow of NTH_REF and range.
[ruby-core:69393] [Bug #11192]
* util.c (ruby_scan_digits): make public and add length parameter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* process.c: "spawn" opens files in the parent process.
(check_exec_redirect): Add an placeholder for fd in parameters
for fd_open.
(check_exec_fds_1): Delete fd_open condition.
(check_exec_fds): Don't call check_exec_fds_1 with fd_open.
(rb_execarg_parent_start): Open files specified as "spawn" options
and add "dup2" options.
(rb_execarg_parent_end): New function to close opened fds.
(run_exec_open): Removed.
(rb_execarg_run_options): Don't call run_exec_open.
(rb_spawn_internal): Call rb_execarg_parent_end.
* io.c (pipe_open): Call rb_execarg_parent_end.
* ext/pty/pty.c (establishShell): Call rb_execarg_parent_end.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (IFUNC_NEW): add argument for ID.
* vm_eval.c (rb_iterate): create ifunnc only when it is used.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_any_hash): use same hash values with Float#hash so
that -0.0 and +0.0 will be identical.
[ruby-core:68541] [Bug #10979]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and related functions from node.h to internal.h.
* variable.c: remove unused include pragma.
* common.mk: remove unused dependency.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
memo->v1 and memo->v2 is WB protected values.
So use MEMO_V1/V2_SET() macros to set these values.
memo->u3 is ambiguous (sometimes a VALUE, sometimes an integer
value), so use gc_mark_maybe() in gc.c to mark it.
Rename NEW_MEMO() to MEMO_NEW().
Move MEMO_FOR and NEW_MEMO_FOF macros from node.h.
Export a rb_imemo_new() function for ext/ripper.
* node.h: remove NODE_MEMO.
* enum.c: catch up these change.
* enumerator.c: ditto.
* load.c: ditto.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c (gc_mark_children): mark imemo_memo type.
* parse.y (new_args_gen): use T_IMEMO.
(I'm not sure it is working correctly...)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Add THROW_DATA_NEW().
* internal.h: move defnition of `struct THROW_DATA'
from vm_insnhelper.h to internal.h.
Rename `THROW_DATA' to `vm_throw_data'.
* eval_intern.h (THROW_DATA_P): move to internal.h.
THROW_DATA is no longer T_NODE, so check T_IMEMO.
* gc.c (gc_mark_children): mark THROW_DATA.
* vm.c: catch up these changes.
* vm_eval.c: ditto.
* vm_insnhelper.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h, vm_insnhelper.h: move definition `struct SVAR'
from vm_insnhelper.h to internal.h. And rename it to strcut vm_svar.
new imemo_type imemo_svar is added.
* gc.c (gc_mark_children): mark imemo_svar.
* node.c (rb_gc_mark_node): remove useless marking.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
T_IMEMO is Internal Memo type, internal use only.
T_IMEMO has same purpose of NODE_MEMO.
To insert T_IMEMO, type numbers are modified a little.
* internal.h: define struct RIMemo. Each RIMemo objects
has imemo_type. We can observe it by the imemo_type() function.
* gc.c (rb_imemo_new): added.
* node.h: remove NODE_CREF and NEW_CREF().
* node.c (rb_gc_mark_node): ditto.
* vm.c (vm_cref_new): use rb_imem_new().
* vm_eval.c: ditto.
* vm_eval.c (eval_string_with_cref):
* vm_eval.c (rb_type_str):
* vm_insnhelper.c: use RIMemo objects for CREF.
* ext/objspace/objspace.c: support T_IMEMO.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
It is easy to reproduce with such script:
module M; def bar; end; end
loop{
Class.new do
def foo; end
prepend M
end
}
* gc.c (obj_free): free T_ICLASS::m_tbl if it is created by prepend.
To recognize it, check RICLASS_IS_ORIGIN flag.
* gc.c (gc_mark_children): T_ICLASS objects only need to mark
T_ICLASS::m_tbl if RICLASS_IS_ORIGIN is set.
* gc.c (obj_memsize_of): count T_ICLASS if RICLASS_IS_ORIGIN is set.
* internal.h (RCLASS_SET_ORIGIN): add to set RCLASS_SET_ORIGIN.
TODO: The word `origin' seems not good name. We need to invent
another good name.
* class.c: use RCLASS_SET_ORIGIN().
* class.c (class_alloc): zero clear rb_classext_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_cref_t is data type of CREF. Now, the body is still NODE.
It is easy to understand what is CREF and what is pure NODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* CREF_CLASS(cref)
* CREF_NEXT(cref)
* CREF_VISI(cref)
* CREF_VISI_SET(cref, v)
* CREF_REFINEMENTS(cref)
* CREF_PUSHED_BY_EVAL(cref)
* CREF_PUSHED_BY_EVAL_SET(cref)
* CREF_OMOD_SHARED(cref)
* CREF_OMOD_SHARED_SET(cref)
* CREF_OMOD_SHARED_UNSET(cref)
This is process to change CREF data type from NODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
struct method_table_wrapper was introduced to avoid duplicate marking
for method tables.
For example, `module M1; def foo; end; end` make one method table
(mtbl) contains a method `foo`. M1 (T_MODULE) points mtbl.
Classes C1 and C2 includes M1, then two T_ICLASS objects are created
and they points mtbl too. In this case, three objects (one T_MODULE
and two T_ICLASS objects) points same mtbl. On marking phase, these
three objects mark same mtbl. To avoid such duplication, struct
method_table_wrapper was introduced.
However, created two T_ICLASS objects have same or shorter lifetime
than M1 (T_MODULE) object. So that we only need to mark mtbl from M1,
not from T_ICLASS objects. This patch tries marking only from M1.
Note that one `Module#prepend` call creates two T_ICLASS objects.
One for refering to a prepending Module object, same as
`Module#include`. We don't nedd to care this T_ICLASS.
One for moving original mtbl from a prepending class. We need to
mark such mtbl from this T_ICLASS object. To mark the mtbl,
we need to use `RCLASS_ORIGIN(klass)` on marking from a prepended
class `klass`.
* class.c: ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: ditto.
* include/ruby/ruby.h: define m_tbl directly. The definition of
struct RClass should be moved to (srcdir)/internal.h.
* method.h: remove decl of rb_free_m_tbl_wrapper().
* object.c: use RCLASS_M_TBL() directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c (rb_tmp_class_path): defer making temporary class
path string.
* variable.c (rb_search_class_path): search class path or return
Qnil or Qfalse if unnamed, not creating a temporary path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_sys_enc_warning): new function to show warning and
error message with the encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (w_object, marshal_dump): use indetity tables for
arbitrary VALUE keys, because of performance of FLONUM.
[Bug #10761]
* marshal.c (obj_alloc_by_klass, marshal_load): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
entry. [Bug #10623]
* hash.c (rb_hash_delete_entry): try delete and return Qundef if there
are no corresponding entry.
* internal.h: add rb_hash_delete_entry()'s declaration.
* symbol.c: use rb_hash_delete_entry().
* thread.c: use rb_hash_delete_entry().
* ext/-test-/hash/delete.c: use rb_hash_delete_entry().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (load_encoding): use rb_require_internal instead of
calling rb_require_safe with protection.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c (rb_mod_const_get, rb_mod_const_defined): ditto.
* variable.c (rb_const_missing, rb_mod_const_missing): call
const_missing without new ID to get rid of inadvertent ID
creation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h (is_{local,global,instance,attrset,const,class,junk}_sym):
fix ID type names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
From Ruby 2.2, keys of GC.stat are changed [Feature #9924].
To provide compatible layer, GC.stat add a default_proc
(if default_proc of given Hash object is not set).
At first use of this compatible layer of interpreter process,
show a warning message like that:
program: GC.stat[:total_allocated_object]
warning message: "warning: GC.stat keys were changed from Ruby
2.1. In this case, you refer to obsolete `total_allocated_object'
(new key is `total_allocated_objects').
Please check <https://bugs.ruby-lang.org/issues/9924>
for more information."
Pleaes correct my English message :)
* hash.c (rb_hash_set_default_proc): export (in internal).
* internal.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
keyword arguments/parameters and a splat argument.
[Feature #10440] (Details are described in this ticket)
Most of complex part is moved to vm_args.c.
Now, ISeq#to_a does not catch up new instruction format.
* vm_core.h: change iseq data structures.
* introduce rb_call_info_kw_arg_t to represent keyword arguments.
* add rb_call_info_t::kw_arg.
* rename rb_iseq_t::arg_post_len to rb_iseq_t::arg_post_num.
* rename rb_iseq_t::arg_keywords to arg_keyword_num.
* rename rb_iseq_t::arg_keyword to rb_iseq_t::arg_keyword_bits.
to represent keyword bitmap parameter index.
This bitmap parameter shows that which keyword parameters are given
or not given (0 for given).
It is refered by `checkkeyword' instruction described bellow.
* rename rb_iseq_t::arg_keyword_check to rb_iseq_t::arg_keyword_rest
to represent keyword rest parameter index.
* add rb_iseq_t::arg_keyword_default_values to represent default
keyword values.
* rename VM_CALL_ARGS_SKIP_SETUP to VM_CALL_ARGS_SIMPLE
to represent
(ci->flag & (SPLAT|BLOCKARG)) &&
ci->blockiseq == NULL &&
ci->kw_arg == NULL.
* vm_insnhelper.c, vm_args.c: rewrite with refactoring.
* rewrite splat argument code.
* rewrite keyword arguments/parameters code.
* merge method and block parameter fitting code into one code base.
* vm.c, vm_eval.c: catch up these changes.
* compile.c (new_callinfo): callinfo requires kw_arg parameter.
* compile.c (compile_array_): check the last argument Hash object or
not. If Hash object and all keys are Symbol literals, they are
compiled to keyword arguments.
* insns.def (checkkeyword): add new instruction.
This instruction check the availability of corresponding keyword.
For example, a method "def foo k1: 'v1'; end" is cimpiled to the
following instructions.
0000 checkkeyword 2, 0 # check k1 is given.
0003 branchif 9 # if given, jump to address #9
0005 putstring "v1"
0007 setlocal_OP__WC__0 3 # k1 = 'v1'
0009 trace 8
0011 putnil
0012 trace 16
0014 leave
* insns.def (opt_send_simple): removed and add new instruction
"opt_send_without_block".
* parse.y (new_args_tail_gen): reorder variables.
Before this patch, a method "def foo(k1: 1, kr1:, k2: 2, **krest, &b)"
has parameter variables "k1, kr1, k2, &b, internal_id, krest",
but this patch reorders to "kr1, k1, k2, internal_id, krest, &b".
(locate a block variable at last)
* parse.y (vtable_pop): added.
This function remove latest `n' variables from vtable.
* iseq.c: catch up iseq data changes.
* proc.c: ditto.
* class.c (keyword_error): export as rb_keyword_error().
* common.mk: depend vm_args.c for vm.o.
* hash.c (rb_hash_has_key): export.
* internal.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (rb_ary_new_from_args): optimization by expanding
arguments in caller to get rid of va_list if possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This function is similar to rb_gc_mark_locations(), but not
conservertive.
* internal.h: ditto.
* vm.c (env_mark): use rb_gc_mark_values() because env values should
be Ruby VALUEs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Please refer this ticket for details.
This change also introduces the following changes.
* Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3).
Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in
RBasic::flags (2 bit). Age == 3 objects become old objects.
* WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap.
* LONG_LIVED bitmap to represent living objects while minor GCs
It specifies (1) Old objects and (2) remembered shady objects.
* Introduce rb_objspace_t::marked_objects which counts marked
objects in current marking phase. marking count is needed to
introduce incremental marking.
* rename mark related function and sweep related function to
gc_(marks|sweep)_(start|finish|step|rest|continue).
* rename rgengc_report() to gc_report().
* Add obj_info() function to get cstr of object details.
* Add MEASURE_LINE() macro to measure execution time of specific line.
* and many small fixes.
* include/ruby/ruby.h: add flag USE_RINCGC.
Now USE_RINCGC can be set only with USE_RGENGC.
* include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1
to count object age.
* include/ruby/ruby.h: rewrite write barriers for incremental marking.
* debug.c: catch up flag name changes.
* internal.h: add rb_gc_writebarrier_remember() instead of
rb_gc_writebarrier_remember_promoted().
* array.c (ary_memcpy0): use rb_gc_writebarrier_remember().
* array.c (rb_ary_modify): ditto.
* hash.c (rb_hash_keys): ditto.
* hash.c (rb_hash_values): ditto.
* object.c (init_copy): use rb_copy_wb_protected_attribute() because
FL_WB_PROTECTED is moved from RBasic::flags.
* test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (WARN_UNUSED_RESULT): warn unused result by gcc 3.4
or later.
* symbol.c: declare some functions with WARN_UNUSED_RESULT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_setup_fake_str): setup fake string from C pointer,
length, and encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47198 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This function creates internal use only array (which is completely
hided by ObjectSpace.each_object) with filling nil.
Otherwise, it can be incldues strange VALUEs.
* internal.h: added.
* node.h: use rb_ary_tmp_new_fill() for MEMO.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* symbol.h (RSYMBOL): move macros for Symbol from internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (rb_to_symbol): new function to convert an object to a
symbol.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fstrings refered by static symbols and pinned dynamic symbols
are registerd by rb_gc_register_mark_object().
frstring refered by dynamic symbols (not pinned symbols)
are refered from global_symbols.dsymbol_fstr_hash (Hash object).
Note that fstrings refered from dynamic symbols must live loger
than symbol objects themselves because rb_gc_free_dsymbol() uses
fstring to remove from symbol tables.
This is why we can not mark fstrings from dynamic symbols.
This technique reduces root objects for GC marking.
* gc.c (gc_mark_roots): ditto.
* internal.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* object.c (rb_obj_copy_ivar): extract function to copy instance
variables only for T_OBJECT from init_copy.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is too new to be a compatibility problem.
* include/ruby/ruby.h: Hide Symbol internals.
(struct RSymbol): moved to internal.h
(RSYMBOL): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46219 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hash.c (rb_hash_keys): make an internal public function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* object.c (rb_class_search_ancestor): return ancestor class or
iclass if inherited.
* object.c (rb_obj_is_kind_of, rb_class_inherited_p): share
function to search the ancestor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* string.c (sym_to_proc), proc.c (rb_block_clear_env_self): clear
caller's self which is useless, so that it can get collected.
[Fixes GH-592]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 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
* re.c (match_regexp): set regexp for MatchData from string.
* re.c (rb_backref_set_string): create MatchData from string and
set backref.
* string.c (rb_pat_search, rb_str_sub, rb_str_sub_bang, str_gsub),
(scan_once, rb_str_scan, rb_str_partition): use rb_str_index
instead of rb_reg_search() when pattern is a String. based on
the patch by Sam Rawlins <sam.rawlins@gmail.com> [Fixes GH-579]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
* internal.h: add prototype for rb_reg_search0
* re.c: rename rb_reg_search to rb_reg_search0, add set_backref_str
argument to allow callers to indicate that they don't require the
backref string to be allocated
* string.c: don't allocate backref str if replacement string is provided
Closes GH-578. [Bug #9676] [ruby-core:61682]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (to_be_skipped_id): ignore anonymous attributes.
* pack.c (Init_pack): use anonymous ID so that associated objects
do not appear in the packed result.
* parse.y (rb_make_internal_id): return an anonymous ID for
internal use.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
By r44804, string objects can not have STR_ASSOC flag.
* internal.h: ditto.
* ext/objspace/objspace_dump.c (dump_object): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The patch base by drkaes (Stefan Kaes).
[Bug #9321]
* variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
instead of rb_frame_pop().
* vm_eval.c (raise_method_missing): ditto.
* vm_eval.c (rb_iterate): ditto.
* internal.h (rb_vm_pop_cfunc_frame): add decl.
* test/ruby/test_settracefunc.rb: add tests.
provided by drkaes (Stefan Kaes).
* vm.c, eval.c, include/ruby/intern.h (rb_frame_pop):
move definition of rb_frame_pop() and deprecate it.
It doesn't care about `return' events.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
it is no longer used from array.c since r43969.
the patch is from normalperson (Eric Wong).
[ruby-core:59449] [Feature #9336]
* internal.h: remove definition of rb_hash_keys().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (struct RClass): add super, remove iv_index_tbl.
since RCLASS_SUPER() is commonly used inside while loops, we move it
back inside struct RClass to improve cache hits. this provides a
small improvement (1%) in hotspots like rb_obj_is_kind_of()
* internal.h (struct rb_classext_struct): remove super, add
iv_index_table
* internal.h (RCLASS_SUPER): update for new location
* internal.h (RCLASS_SET_SUPER): ditto
* internal.h (RCLASS_IV_INDEX_TBL): ditto
* object.c (rb_class_get_superclass): ditto
* include/ruby/backward/classext.h (RCLASS_SUPER): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Now, there are no setter and independent from Exception#backtrace.
[Feature #8960]
* eval.c (setup_exception): set backtrace locations for `bt_location'
special attribute.
* vm_backtrace.c (rb_backtrace_to_location_ary): added.
* internal.h: ditto.
* test/ruby/test_backtrace.rb: add a test for
Exception#backtrace_locations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/objspace/objspace_dump.c (dump_object): include fstring flag on
strings. include gc flags (old, remembered, wb_protected) on all objects.
* ext/objspace/objspace_dump.c (Init_objspace_dump): initialize lazy
IDs before first use.
* gc.c (rb_obj_gc_flags): new function to retrieve object flags
* internal.h (RB_OBJ_GC_FLAGS_MAX): maximum flags allowed for one obj
* test/objspace/test_objspace.rb (test_dump_flags): test for above
* test/objspace/test_objspace.rb (test_trace_object_allocations):
resolve name before dump (for rb_class_path_cached)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_insnhelper.c (rb_get_kwargs): get keyword argument values from an
option hash, not only checking keys.
* dir.c (dir_initialize): use rb_get_kwargs.
* gc.c (gc_start_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
settings can be applied before rb_safe_level() is available.
* internal.h (rb_gc_set_params): ditto.
* ruby.c (process_options): Apply GC tuning early during boot process
so boot-time allocations can benefit. This also benefits any code
loaded in via `ruby -r`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in: check malloc_size() available on BSD.
* gc.c: use malloc_size() with malloc/malloc.h on BSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_eval.c (rb_catch_protect): new function similar to
rb_catch_obj(), but protect from all global jumps like as
rb_load_protect(), rb_protect(), etc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RClass->m_tbl with serial. This prevents double marking method
tables, since many classes/modules can share the same method table.
This improves minor mark time in a large application by 30%.
* internal.h (struct method_table_wrapper): Define new
wrapper struct with additional serial.
* internal.h (RCLASS_M_TBL_INIT): New macro for initializing method
table wrapper and st_table.
* method.h (void rb_sweep_method_entry): Rename rb_free_m_table to
rb_free_m_tbl for consistentcy
* .gdbinit (define rb_method_entry): Update rb_method_entry gdb helper
for new method table structure.
* class.c: Use RCLASS_M_TBL_WRAPPER and
RCLASS_M_TBL_INIT macros.
* class.c (rb_include_class_new): Share WRAPPER between module and
iclass, so serial can prevent double marking.
* eval.c (rb_prepend_module): ditto.
* eval.c (rb_using_refinement): ditto.
* gc.c: Mark and free new wrapper struct.
* gc.c (obj_memsize_of): Count size of additional wrapper struct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (rb_block_call_func_t): strict check for
rb_block_call_func* if RB_BLOCK_CALL_FUNC_STRICT is set.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined.
We don't need these function if malloc_usable_size() is available.
* gc.c: catch up this change.
* gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32.
* array.c (ary_resize_capa): do not use ruby_sized_xfree() with
local variable to avoid "unused local variable" warning.
This change only has few impact.
* string.c (rb_str_resize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_gc_set_params because it's only used in ruby internal.
* internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
alias function.
* gc.c: ditto.
* ruby.c: use ruby_gc_set_params.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
objspace.
* gc.c (ruby_mimfree): added. It is similar to ruby_mimmalloc().
* internal.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_fstring() used rb_gc_mark() to avoid freeing used string.
However, rb_gc_mark() set mark bit *and* pushes mark_stack.
rb_gc_resurrect() does only set mark bit if it is before sweeping.
* string.c (rb_fstring): use rb_gc_resurrect.
* internal.h: add decl.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (ruby_register_rollback_func_for_ensure): catch up above change.
Add rollback mechanism API.
* vm_core.h (typedef struct rb_vm_struct): catch up above change.
Introdule ensure-rollback relation table.
* vm_core.h (typedef struct rb_thread_struct): catch up above change.
Introdule ensure stack.
* eval.c (rb_ensure): catch up above change.
Introdule ensure stack.
* hash.c : New function for rollback ensure, and register it to
ensure-rollback relation table. [ruby-dev:47803] [Bug #9105]
Ensure Rollback Mechanism:
A rollback's function is a function to rollback a state before ensure's
function execution.
When the jump of callcc is across the scope of rb_ensure,
ensure's functions and rollback's functions are executed appropriately
for keeping consistency.
Current API is unstable, and only internal use.
ruby_register_rollback_func_for_ensure(ensure_func,rollback_func)
This API create relation ensure's function to rollback's function.
By registered rollback's function, it is executed When jumpping into
corresponding rb_ensure scope.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
These declarations should be exported.
This reverts commit 3c9f88c2ce138f2714c36cd25dc9b50ec93861e7.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This is another approach to solve an issue discussed at r43530.
This feature is diabled as default.
This feature measures an increment of memory consuption by oldgen
objects. It measures memory consumption for each objects when
the object is promoted. However, measurement of memory consumption
is not accurate now. So that this measurement is `estimation'.
To implement this feature, move memsize_of() function from
ext/objspace/objspace.c and expose rb_obj_memsize_of().
Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
measure memory size, so that we ignores T_DATA objects now.
For example, some functions skip NULL check for pointer.
The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
and turned off as default.
We need to compare 3gen GC and this feature carefully.
(it is possible to enable both feature)
We need a help to compare them.
* internal.h: expose rb_obj_memsize_of().
* ext/objspace/objspace.c: use rb_obj_memsize_of() function.
* cont.c (fiber_memsize): fix to check NULL.
* variable.c (autoload_memsize): ditto.
* vm.c (vm_memsize): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (rb_syserr_fail_path): fix typo on platforms where
function name string predefined identifier is not supported.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_syserr_fail_path_in): new function split from
rb_sys_fail_path_in to raise SystemCallError without errno.
* internal.h (rb_syserr_fail_path): like rb_sys_fail_path but without
errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (rb_w32_init_file): no longer defined since r43362.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_bug_reporter_add() allows to register a function which
is called at rb_bug() called.
* ext/-test-/bug_reporter/bug_reporter.c: add a test for this C-API.
* ext/-test-/bug_reporter/extconf.rb: ditto.
* test/-ext-/bug_reporter/test_bug_reporter.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Each symbols has String objects respectively to represent
Symbols.
These objects are marked only when:
* full marking
* new symbols are added
This hack reduce symbols (related strings) marking time.
For example, on my Linux environment, the following code
"20_000_000.times{''}"
with 40k symbols (similar symbol number on Rails 3.2.14 app,
@jugyo tells me) boosts, from 7.3sec to 4.2sec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (load_lock): display backtrace to $stderr at circular
require.
* vm_backtrace.c (rb_backtrace_print_to): new function to print
backtrace to the given output.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c (rb_ary_uniq): use rb_hash_values(), as well as the case no
block is given.
* internal.h: define rb_hash_values() as internal API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* VALUE rb_iseq_path(VALUE iseqval);
* VALUE rb_iseq_absolute_path(VALUE iseqval);
* VALUE rb_iseq_label(VALUE iseqval);
* VALUE rb_iseq_base_label(VALUE iseqval);
* VALUE rb_iseq_first_lineno(VALUE iseqval);
And new (temporary) function:
* VALUE rb_iseq_klass(VALUE iseqval);
* iseq.c. vm_core.h (int rb_iseq_first_lineno): remove
function `int rb_iseq_first_lineno(const rb_iseq_t *iseq)'.
Use `VALUE rb_iseq_first_lineno(VALUE iseqval)' instead.
* proc.c. vm_insnhelper.c, vm_method.c: catch up this change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* gc.c (obj_free): ditto
* internal.h (struct rb_classext_struct): ditto
* method.h (rb_method_entry): remove ent param
* vm_method.c: restore the global method cache. Per class cache tables
turned out to be far too slow.
[ruby-core:57289] [Bug #8930]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/intern.h (rb_ary_cat): move from internal.h, since it
is described in README.EXT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (vm_state_version_t): use uint64_t when it is larger than
LONG_LONG, and fallback to unsigned long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(str2big_gmp): New function.
(rb_cstr_to_inum): Use str2big_gmp for big bignums.
(rb_str2big_gmp): New function.
* internal.h (rb_str2big_gmp): Declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(big2str_gmp): New function.
(rb_big2str1): Use big2str_gmp for big bignums.
* internal.h (rb_big2str_gmp): Declared.
* ext/-test-/bignum/big2str.c (big2str_gmp): New method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
big2str_base_powerof2.
(rb_big2str_poweroftwo): New function for test.
(big2str_generic): Extracted from rb_big2str1.
(rb_big2str_generic): New function for test.
* internal.h (rb_big2str_poweroftwo): Declared.
(rb_big2str_generic): Ditto.
* ext/-test-/bignum/big2str.c: New file.
* test/-ext-/bignum/test_big2str.rb: New file.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(bary_mul_gmp): New function.
(bary_mul): Use bary_mul_gmp.
(bigsq): Use different threshold with GMP.
* configure.in: Detect GMP.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c (dir_each): get rid of allocate new string from UTF-8 string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
HFS Plus (Mac OS Extended) uses a variant of Normal Form D in which
U+2000 through U+2FFF, U+F900 through U+FAFF, and U+2F800 through
U+2FAFF are not decomposed (this avoids problems with round trip
conversions from old Mac text encodings).
http://developer.apple.com/library/mac/qa/qa1173/_index.html
Therefore fix r42457 to exclude the range.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (io_fread): use rb_str_locktmp_ensure().
[ruby-core:56121] [Bug #8669]
* test/ruby/test_io.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* dir.c (dir_s_home): use rb_home_dir_of and rb_default_home_dir.
* file.c (rb_home_dir_of): split from rb_home_dir() for the home
directry of the given user, and the user name is a VALUE, not a bare
pointer. should raise if the user does not exist.
* file.c (rb_default_home_dir): split from rb_home_dir() for the home
directry of the current user.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
function to remember an specified object. This api is only
experimental (strongly depend on WB/rgengc strategy).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
__builtin_bswap64.
* internal.h (swap32): Use the configure result for the condition to
use __builtin_bswap32.
(swap64): Use the configure result for the condition to use
__builtin_bswap64.
* bignum.c (ones): Use the configure result for the condition to use
__builtin_popcountl.
(bary_unpack_internal): Use appropriate types for swap argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* encoding.c (rb_enc_associate_index): refill the terminator if it
becomes longer than before. [ruby-dev:47500] [Bug #8624]
* string.c (str_null_char, str_fill_term): get rid of out of bound
access.
* string.c (rb_str_fill_terminator): add a parameter for the length of
new terminator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* transcode.c (str_encode_associate): fill terminator after conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION flag.
Fix byte order and word order handling in code specialized for
wordsize % SIZEOF_BDIGITS == 0.
* internal.h (INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION): Defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(HOST_BIGENDIAN_P): New macro.
(ALIGNOF): New macro.
(CLEAR_LOWBITS): New macro.
(FILL_LOWBITS): New macro.
(swap_bdigit): New macro.
(bary_2comp): Returns an int.
* internal.h (swap16): Moved from pack.c
(swap32): Ditto.
(swap64): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(integer_unpack_num_bdigits): Extracted from
rb_integer_unpack_internal.
(bary_unpack_internal): Renamed from bary_unpack and support
INTEGER_PACK_2COMP.
(bary_unpack): New function to validate arguments and invoke
bary_unpack_internal.
(rb_integer_unpack_internal): Removed.
(rb_integer_unpack): Invoke bary_unpack_internal.
(rb_integer_unpack_2comp): Removed.
* internal.h (rb_integer_unpack_2comp): Removed.
* pack.c: Follow the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_integer_unpack_internal): Extracted from rb_integer_unpack and
nlp_bits_ret argument added.
(integer_unpack_num_bdigits_small): nlp_bits_ret argument added to
return number of leading padding bits.
(integer_unpack_num_bdigits_generic): Ditto.
* internal.h (rb_integer_unpack_2comp): Declared.
* pack.c (pack_unpack): Use rb_integer_unpack_2comp and
rb_integer_unpack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e