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

349 Коммитов

Автор SHA1 Сообщение Дата
nobu 7bfeb1c2ae remove SIGN_EXTEND_CHAR macro
* marshal.c (r_long): cast to `signed char`, which is used
  already, instead of SIGN_EXTEND_CHAR.
* parse.y: SIGN_EXTEND_CHAR is no longer used.  [Fix GH-1302]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-23 02:44:54 +00:00
drbrain c9165d0644 * marshal.c (r_object0): raise ArgumentError when linking to undefined
object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 22:18:12 +00:00
drbrain fa0e37646a * marshal.c (r_object0): Fix Marshal crash for corrupt extended object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-14 18:36:14 +00:00
naruse 826f2ee306 * marshal.c (r_object0): honor Marshal.load post proc
value for TYPE_LINK.  by Hiroshi Nakamura <nahi@ruby-lang.org>
  https://github.com/ruby/ruby/pull/1204 fix GH-1204

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-21 08:36:01 +00:00
normal 328205c56e marshal.c: remove NULL checks for *_memsize
This follows r52986, NULL checks in rb_data_type_t.function.dsize
callbacks are unnecessary.

* marshal.c (memsize_dump_arg): remove NULL check
  (memsize_load_arg): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-09 21:34:01 +00:00
nobu 1fadd43881 marshal.c: skip internal names
* marshal.c (w_objivar): skip internal instance variables in
  T_OBJECT too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 05:20:41 +00:00
nobu 2a66cc554d encoding.c: defer finding encoding
* encoding.c (enc_m_loader): defer finding encoding object not to
  be infected by marshal source.  [ruby-core:71793] [Bug #11760]
* marshal.c (r_object0): enable compatible loader on USERDEF
  class.  the loader function is called with the class itself,
  instead of an allocated object, and the loaded data.
* marshal.c (compat_allocator_table): intialize
  compat_allocator_tbl on demand.
* object.c (rb_undefined_alloc): extract from rb_obj_alloc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02 07:27:22 +00:00
nobu a497ed3733 marshal.c: lookup and remove
* marshal.c (r_fixup_compat): delete compatible object with
  lookup.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-02 06:50:41 +00:00
nobu 6b380a441e marshal.c: reduce arity checks
* marshal.c (rb_marshal_dump_limited): get rid of redundant arity
  check to dump object with limited nest level.

* marshal.c (rb_marshal_load_with_proc): get rid of redundant arity
  check to load object with hook proc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-25 13:14:16 +00:00
nobu 1b9410083e marshal.c: reentrant checks
* marshal.c (dump_funcall, dump_check_funcall, load_funcall):
  function calls with reentrant check.  always show names
  corresponding to the called methods.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-25 12:45:10 +00:00
nobu 2c1aa2caab marshal.c: use STATIC_ASSERT
* marshal.c (MARSHAL_INFECTION): check size by STATIC_ASSERT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-25 12:38:26 +00:00
nobu 078b6c9838 encindex.h: ENCINDEX
* encindex.h: separate encoding index constants from internal.h.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-15 05:49:20 +00:00
ko1 c35ff11ae5 * id_table.h: introduce ID key table.
[Feature #11420]
  This table only manage ID->VALUE table to reduce overhead of st.
  Some functions prefixed rb_id_table_* are provided.
* id_table.c: implement rb_id_table_*.
  There are several algorithms to implement it.
  Now, there are roughly 4 types:
    * st
    * array
    * hash (implemented by  Yura Sokolov)
    * mix of array and hash
  The macro ID_TABLE_IMPL can choose implementation.
  You can see detailes about them at the head of id_table.c.
  At the default, I choose 34 (mix of list and hash).
  This is not final decision.
  Please report your suitable parameters or
  your data structure.
  * symbol.c: introduce rb_id_serial_t and rb_id_to_serial()
    to represent ID by serial number.
  * internal.h: use id_table for method tables.
  * class.c, gc.c, marshal.c, vm.c, vm_method.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-12 08:43:55 +00:00
normal f6cd582505 variable.c: avoid compatibility table with generic ivars
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
2015-05-30 00:20:15 +00:00
nobu 982a9d8e91 marshal.c: class name encoding
* marshal.c (r_object0): preserve the encoding of the class name
  in an error message, in the case of USRMARSHAL without
  marshal_load method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-16 14:28:29 +00:00
nobu 0ea135d177 marshal.c: class name encoding
* marshal.c (r_object0): preserve the encoding of the class name
  in an error message, in the case of USERDEF without _load
  singleton method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-16 14:25:33 +00:00
nobu 53e4fb8c80 marshal.c: class name encoding
* marshal.c (r_object0): preserve the encoding of the class name
  in an error message, in the case of no _load_data method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-16 14:25:19 +00:00
nobu bdf16df33a marshal.c: class name encoding
* marshal.c (w_object): preserve the encoding of the class name in
  an error message, in the case of no _dump_data method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-16 12:46:07 +00:00
nobu 2c1c5570e8 marshal.c: class name encoding
* marshal.c (w_object): preserve the encoding of the class name in
  an error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-16 11:43:37 +00:00
nobu ffcb7abe0b marshal.c: register symbol strings first
* marshal.c (r_symreal): register symbol names as strings first so
  that r_symlink always returns valid names.
  [ruby-core:68587] [Bug #10991]
* marshal.c (r_ivar, r_object0): now need to intern symbol names.
* marshal.c (r_object0): compare with symbol names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-22 17:03:31 +00:00
nobu e567f351c2 marshal.c: indetity tables
* 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
2015-01-23 11:01:02 +00:00
nobu 5fd0076871 marshal.c: append at once
* marshal.c (w_long): append at once by w_nbyte() instead of
  appending byte by byte.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-26 06:20:55 +00:00
nobu e580a631be use 0 for reserved
use 0 for rb_data_type_t::reserved instead of NULL, since its type
may be changed in the future and possibly not a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-01 06:38:04 +00:00
nobu ec81f9c4cd marshal.c: literal method names
* marshal.c (check_dump_arg, check_load_arg): use literal method
  names, instead of converting from ID every time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-24 03:43:59 +00:00
akr 2b9191e557 * internal.h: Gather declarations in non-header files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18 15:13:05 +00:00
akr 7cd76ab0c5 * internal.h: Include ruby.h and ruby/encoding.h to be
includable without prior inclusion.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-15 11:49:06 +00:00
nobu 5617e31771 symbol.c: rename rb_str_dynamic_intern
* iseq.c, marshal.c, string.c: use rb_str_intern instead of
  rb_str_dynamic_intern.
* symbol.c (rb_str_intern): rename rb_str_dynamic_intern.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-14 07:23:01 +00:00
normal a17ffebfa0 marshal.c: lazy compat_tbl allocation
In some common cases, compat_tbl is unused in dump_arg/load_arg,
so avoid malloc/free costs for the unused table.

ruby -e 'h = {a: :b}; 600000.times { Marshal.load(Marshal.dump(h)) }'

before:
	real    0m2.458s
	user    0m2.450s
	sys     0m0.006s

after:
	real    0m2.122s
	user    0m2.110s
	sys     0m0.011s

* marshal.c (w_class): check dump_arg->compat_tbl before lookup
  (w_object): lazy init ->compat_tbl before insert
  (obj_alloc_by_class): ditto
  (clear_dump_arg): free only non-NULL ->compat_tbl
  (clear_load_arg): ditto for ->compat_tbl
  (marshal_dump): ->compat_tbl defaults to zero
  (marshal_load): ditto for ->compat_tbl
  (r_entry0): check l->compat_tbl before lookup
  (r_fixup_compat): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-01 20:29:46 +00:00
nobu c47b523246 ruby.h: warn untyped Data
* include/ruby/ruby.h (rb_data_object_alloc_warning): warn
  Data_Wrap_Struct and Data_Make_Struct only if
  RUBY_UNTYPED_DATA_WARNING is set to 1.

* include/ruby/ruby.h (rb_data_object_get_warning): ditto for
  Data_Get_Struct.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-28 15:27:24 +00:00
nobu bb10a21346 ruby.h: deprecate plain Data
* include/ruby/ruby.h (rb_data_object_alloc_deprecated): deprecate
  Data_Make_Struct and Data_Wrap_Struct.  [EXPERIMENTAL]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-27 01:28:47 +00:00
nobu 360a865246 marshal.c: fix symlink index
* marshal.c (w_symbol): fix symlink index.  register the given
  symbols, not its name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-29 03:28:43 +00:00
nobu 2d1e5bcefc marshal.c: fix instance variable load odrder
* marshal.c (r_symreal): fix instance variable load odrder, its
  name must be read before its value.  the order of function call
  arguments is not stable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 20:36:50 +00:00
nobu 95d1b61a14 symbols instead of IDs
* encoding.c (rb_enc_get_index): deal with symbols instead of IDs
  to get rid of inadvertent pin-downs.

* enum.c (chunk_ii): ditto.

* enumerator.c (append_method): ditto.

* iseq.c (iseq_load): ditto.

* marshal.c (w_symbol, r_symlink, r_symreal, r_symbol): ditto.

* signal.c (trap_handler): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-28 08:15:42 +00:00
akr 95de2b0012 * internal.h (struct RBignum): Use size_t for len.
* include/ruby/intern.h (rb_big_new): Use size_t instead of long to
  specify the size of bignum.
  (rb_big_resize): Ditto.

* bignum.c: Follow above changes.

* rational.c: Follow above changes.

* marshal.c: Follow above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-19 01:11:04 +00:00
akr 9aa67e267b * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
* internal.h: Ditto.

* marshal.c: Ditto.

* rational.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-13 03:48:17 +00:00
nobu be711df831 marshal.c: remove hack for old gcc
* marshal.c (r_object0): remove hack for old gcc, no gcc 2.x any
  more.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-12 12:58:04 +00:00
nobu 3935f2ae6e marshal.c: undumpable hidden objects
* marshal.c (w_object): internal objects are not dumpable.
  [ruby-core:61677] [Bug #9674]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 02:20:52 +00:00
nobu dd998dd561 marshal.c: do not recycle wrapper objects
* marshal.c (marshal_dump, marshal_load): do not recycle wrapper
  objects, to prevent from segfault with continuation.
  [ruby-dev:47970] [Bug #9523]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-17 08:41:57 +00:00
normal f97051512a marshal.c: use rb_gc_force_recycle for GC-safety
Putting rb_gc_force_recycle at the end of the function has a nice
side-effect of keeping wrapper visible to GC until the moment of
recycle, preventing GC from prematurely killing live objects.
volatile is a common source of compiler bugs/differences, avoid it.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 03:45:15 +00:00
akr 3c99764bcd * internal.h: Rename macro names: RBIGNUM_FOO to BIGNUM_FOO.
(BIGNUM_EMBED_LEN_NUMBITS): Renamed from RBIGNUM_EMBED_LEN_NUMBITS.
  (BIGNUM_EMBED_LEN_MAX): Renamed from RBIGNUM_EMBED_LEN_MAX.
  (BIGNUM_SIGN_BIT): Renamed from RBIGNUM_SIGN_BIT.
  (BIGNUM_SIGN): Renamed from RBIGNUM_SIGN.
  (BIGNUM_SET_SIGN): Renamed from RBIGNUM_SET_SIGN.
  (BIGNUM_POSITIVE_P): Renamed from RBIGNUM_POSITIVE_P.
  (BIGNUM_NEGATIVE_P): Renamed from RBIGNUM_NEGATIVE_P.
  (BIGNUM_EMBED_FLAG): Renamed from RBIGNUM_EMBED_FLAG.
  (BIGNUM_EMBED_LEN_MASK): Renamed from RBIGNUM_EMBED_LEN_MASK.
  (BIGNUM_EMBED_LEN_SHIFT): Renamed from RBIGNUM_EMBED_LEN_SHIFT.
  (BIGNUM_LEN): Renamed from RBIGNUM_LEN.
  (RBIGNUM_DIGITS): Renamed from RBIGNUM_DIGITS.
  (BIGNUM_LENINT): Renamed from RBIGNUM_LENINT.

* bignum.c: Follow the above change.

* gc.c: Ditto.

* marshal.c: Ditto.

* math.c: Ditto.

* numeric.c: Ditto.

* random.c: Ditto.

* rational.c: Ditto.

* sprintf.c: Ditto.

* ext/-test-/bignum/bigzero.c: Ditto.

* ext/-test-/bignum/intpack.c: Ditto.

* ext/bigdecimal/bigdecimal.c: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-15 21:17:34 +00:00
hsbt 966d04da60 * marshal.c: fix typo by @xta [fix GH-533] [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-13 06:59:33 +00:00
nobu cc1910b542 marshal.c: Numerics are not tainted
* include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT),
  marshal.c (r_entry0): all Numerics never be tainted now.
  [ruby-core:57346] [Bug #8945]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-08 17:13:55 +00:00
nobu b2b5a5db09 pack.c: hide associated objects
* 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
2014-02-05 11:56:35 +00:00
nobu 5ba39a12d9 marshal.c: refine special instance variables
* marshal.c (w_obj_each, obj_count_ivars): count instance
  variables accurately.

* marshal.c (encoding_name, w_encoding): separate getting encoding
  values and writing them.

* marshal.c (w_symbol, w_ivar, w_objivar, w_object): refine
  special instance variables.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 08:32:11 +00:00
nobu 17a47a3358 marshal.c: preserve encoding
* marshal.c (must_not_be_anonymous, class2path): preserve encoding
  in the exception messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-05 08:24:37 +00:00
hsbt e23627c047 * marshal.c: [DOC] Wordsmith marshal.c documentation. by @vipulnsward [fix GH-470]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-09 08:51:17 +00:00
tmm1 65a564376e * marshal.c (w_object): Use HASH_PROC_DEFAULT directly from internal.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-23 00:46:25 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
akr 2b93ed5e76 * bignum.c (MSB): Removed.
(BDIGIT_MSB): Defined using BIGRAD_HALF.
  (bary_2comp): Apply BIGLO after possible over flow of BDIGIT.
  (get2comp): Ditto.
  (bary_unpack_internal): Use BDIGIT_MSB.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_integer_unpack): Use BDIGIT_MSB.
  (calc_hbase): Use BDIGMAX.
  (big2dbl): Use BDIGMAX.
  Apply BIGLO after possible over flow of BDIGIT.
  (rb_big_neg): Apply BIGLO after possible over flow of BDIGIT.
  (biglsh_bang): Ditto.
  (bigrsh_bang): Ditto.
  (bary_divmod): Use BDIGIT_MSB.
  (bigdivrem): Ditto.
  (bigxor_int): Apply BIGLO after possible over flow of BDIGIT.

* marshal.c (shortlen): Use SIZEOF_BDIGITS instead of sizeof(BDIGIT).

* ext/openssl/ossl_bn.c (ossl_bn_initialize): Use SIZEOF_BDIGITS
  instead of sizeof(BDIGIT).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-25 03:08:23 +00:00
ko1 6a1101f23e * include/ruby/ruby.h: support write barrier protection for T_STRUCT.
Introduce the following C APIs:
  * RSTRUCT_RAWPTR(st) returns pointer (do WB on your risk).
    The type of returned pointer is (const VALUE *).
  * RSTRUCT_GET(st, idx) returns idx-th value of struct.
  * RSTRUCT_SET(st, idx, v) set idx-th value by v with WB.
  And
  * RSTRUCT_PTR(st) returns pointer with shady operation.
    The type of returned pointer is (VALUE *).
* struct.c, re.c, gc.c, marshal.c: rewrite with above APIs.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-21 11:22:18 +00:00