summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-07-18 23:26:36 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-07-18 23:26:36 +0900
commit329938ef159d54523cb36aa7069abb7c35ec77d8 (patch)
tree0583d625bed5367ded4bb289cf586218d3424060 /include
parent52aafcd001095470ac1c397bdf83ce10e919c753 (diff)
downloadmruby-329938ef159d54523cb36aa7069abb7c35ec77d8.tar.gz
mruby-329938ef159d54523cb36aa7069abb7c35ec77d8.zip
Simplify `mrb_gc_arena_restore()` to reduce overhead.
It will no longer shrink arena region. Instead `vm.c` uses a static function `mrb_gc_arena_shrink()` to shrink.
Diffstat (limited to 'include')
-rw-r--r--include/mruby.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 592ab1f04..18f54fd2f 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -1036,11 +1036,27 @@ MRB_API mrb_value mrb_Float(mrb_state *mrb, mrb_value val);
MRB_API mrb_value mrb_inspect(mrb_state *mrb, mrb_value obj);
MRB_API mrb_bool mrb_eql(mrb_state *mrb, mrb_value obj1, mrb_value obj2);
+static inline int mrb_gc_arena_save(mrb_state*);
+static inline void mrb_gc_arena_restore(mrb_state*,int);
+
+static inline int
+mrb_gc_arena_save(mrb_state *mrb)
+{
+ return mrb->gc.arena_idx;
+}
+
+static inline void
+mrb_gc_arena_restore(mrb_state *mrb, int idx)
+{
+ mrb->gc.arena_idx = idx;
+}
+
+MRB_API int mrb_gc_arena_save(mrb_state*);
+MRB_API void mrb_gc_arena_restore(mrb_state*,int);
+
MRB_API void mrb_garbage_collect(mrb_state*);
MRB_API void mrb_full_gc(mrb_state*);
MRB_API void mrb_incremental_gc(mrb_state *);
-MRB_API int mrb_gc_arena_save(mrb_state*);
-MRB_API void mrb_gc_arena_restore(mrb_state*,int);
MRB_API void mrb_gc_mark(mrb_state*,struct RBasic*);
#define mrb_gc_mark_value(mrb,val) do {\
if (!mrb_immediate_p(val)) mrb_gc_mark((mrb), mrb_basic_ptr(val)); \