Commit Graph

44 Commits

Author SHA1 Message Date
Miura Hideki 75ec86ed00 Improve Array structure 2017-08-18 20:12:00 +09:00
Yukihiro "Matz" Matsumoto ef0b239704 Remove unnecessary inline function ary_elt.
And the function does not conform the naming convention anyway.
2017-08-11 12:57:37 +09:00
Yukihiro "Matz" Matsumoto 67e2dddb82 Remove mrb_ary_len function. Use RARRAY_LEN instead. 2017-08-11 12:52:36 +09:00
Yukihiro "Matz" Matsumoto 8f6b2121d9 Update document comment of array C API functions. 2017-08-11 12:51:45 +09:00
Yukihiro "Matz" Matsumoto ae04005092 The type of ARY_EMBED_LEN should be mrb_int. 2017-08-11 12:09:37 +09:00
Yukihiro "Matz" Matsumoto f26d00d9e8 Embed small size array elements in the heap.
It reduces the memory consumption and sometimes improve the
performance as well.  For example, the consumed memory size
of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and
its total execution time become 18.795 sec from 22.229 sec.
2017-07-27 16:13:06 +09:00
Herwin Weststrate d20c56c7fa Documented most methods in mruby/array.h 2016-11-17 11:41:49 +01:00
Herwin Weststrate c043dc631e Typo fix: poped => popped 2016-11-17 11:05:27 +01:00
Yukihiro "Matz" Matsumoto 739dad6e87 Fixed a memory problem in Array#to_h
Reported from Alex Snaps via Mathieu Leduc-Hamel,
both from shopify.com.  Thank you!
2016-11-16 01:29:04 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa ef73ec560e array header cleanup 2015-10-08 13:33:38 -03:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 4c8205db1f Merge descriptions from doc/api/mruby/array.h.md 2015-09-21 15:13:43 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Yukihiro "Matz" Matsumoto 48c5321dca constify pointer from RARRAY_PTR to detect potential write barrier bugs.
if you see compiler errors due to this commit, you'd better to use array-modifying
functions, e.g. mrb_ary_set() or mrb_ary_push(), otherwise you might see nasty
GC bugs in the future.  if you are sure what you are doing, replace `RARRAY_PTR(ary)`
by `mrb_ary_ptr(ary)->ptr`. but be warned.
2014-09-12 12:42:39 +09:00
Jun Hiroe 3569723ab3 Refactor obj_free() in gc.c 2014-08-05 23:16:01 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
take_cheeze 13d9631e21 Add new API mrb_ary_resize(mruby implementation of rb_ary_resize). 2014-07-06 22:23:29 +09:00
cremno 7691b64963 array implementation: several small changes
src/array.c:
 - make various functions without declaration in the mruby headers static
 - removed all uncessary int casts and two useless comments
 mrb_ary_new_from_values: move to similar functions
 mrb_check_array_type: fix indentation

include/mruby/array.h:
 mrb_shared_array: padding (default "mrbconf.h" on an usual 64-bit system)
                   sizeof(mrb_int)==sizeof(int)==4 && sizeof(mrb_value*)==8

both:
 mrb_ary_aget:  remove declaration in header and make static
                nobody uses it which is not surprising since it has 1 req arg!
 mrb_assoc_new: small optimization and move to similar functions
 mrb_ary_len:   re-implement as static inline function (it is used by mrbgems)
                programmers should directly use RARRAY_LEN instead
2014-02-12 00:37:47 +01:00
Yukihiro "Matz" Matsumoto 92825660ea changed argument type of mrb_ary_modify(); ref #1554 2013-11-01 09:57:20 +09:00
Yukihiro "Matz" Matsumoto af03812877 add mrb_ary_modify(mrb,a); you have to ensure mrb_value a to be an array; ref #1554 2013-10-31 23:34:08 +09:00
Yukihiro "Matz" Matsumoto 40e6cdcb5c rename mrb_value_p() to mrb_ptr() since _p means predicate in mruby source 2013-08-07 17:39:28 +09:00
Yuichi Nishiwaki 8dc2fa3bc8 add read barrier to value.p
API changes:
- value.p must be accessed via mrb_value_p macro
- value.p must be mutated via MRB_SET_VALUE_P macro
2013-08-03 14:03:44 -07:00
Yukihiro Matz Matsumoto 8ce842a5d9 implement mrb_format and mrb_vformat 2013-03-27 23:03:48 +09:00
Yukihiro Matz Matsumoto 8d98b84543 removed compatibility macros mrb_ary_new_elts() and mrb_ary_new4() 2013-03-15 23:23:45 +09:00
Yukihiro Matz Matsumoto cdd41a33de unify mrb_ary_new{,_elts,_from_values}; mrb_ary_from_values() is a winner 2013-03-08 05:18:33 +09:00
Masaki Muranaka f998691da8 Define ARY_MAX_SIZE strictly. Use mrb_int instead of int. 2013-03-03 11:43:56 +09:00
Masaki Muranaka e4231a0a33 Add typedef to structures that have mrb_ prefix. Use typedef-ed type instead of struct directly. 2013-03-01 14:28:22 +09:00
Daniel Bovensiepen af75d8de2c Export mrb_ary_clear in array.h 2013-01-08 10:07:15 +08:00
Yukihiro Matsumoto 97b7eb6096 rename MRUBY_OBJECT_HEADER to MRB_OBJECT_HEADER 2012-08-18 19:05:18 +09:00
Yukihiro Matsumoto 7d02df3016 NaN boxing 2012-08-14 13:16:34 +09:00
Masaki Muranaka 7ac4b56141 Remove unimplemented declarations. 2012-07-29 20:35:23 +09:00
Yukihiro Matsumoto 4c01f002fd mruby/array.h: rename buf to ptr 2012-06-05 23:20:36 +09:00
Yukihiro Matsumoto e4529c065d make arrays to share bodies 2012-06-03 23:05:31 +09:00
Yukihiro Matsumoto 34c049c63e remove unused mrb_mem_clear 2012-06-02 21:34:10 +09:00
Yukihiro Matsumoto 92ee53146f unify long,size_t to int in array.[ch] 2012-06-02 21:30:04 +09:00
Yukihiro Matsumoto 0e46f49aaa changed prototype mrb_ary_replace to (mrb_state*,mrb_value,mrb_value) 2012-06-02 21:26:30 +09:00
Yukihiro Matsumoto f56abcbb5a reorder mrb_ary_new_from_values() args to (argc, argv) 2012-06-01 02:18:30 +09:00
Yukihiro Matsumoto a4d3579e31 add extern "C" guards; close #126 2012-05-18 02:02:49 +09:00
roco 4ec6d41f16 rm whitespace 2012-04-30 14:29:19 -07:00
mimaki 835443614d add file header 2012-04-23 11:46:16 +09:00
mimaki e0d6430f63 add mruby sources 2012-04-20 09:39:03 +09:00