mruby

5分でmrubyをswiftから呼ぶ方法

まずはmrubyをios用にビルドします。 こちら を参考にbuild_config.rbを編集します。 build_config.rb MRuby::CrossBuild.new('ios_sim') do |conf| toolchain :clang SDK_PATH_SIM = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulato…

mruby khash.h の UPPER_BOUNDとは何でしょうか?

#defineUPPER_BOUND(x) ( (x) >> 2 | (x) >> 1) とあります。さらに下の方で #define khash_upper_bound(h) (UPPER_BOUND( (h)->n_buckets) 何かのbucketの数 ( n_)の上限ということでしょうか。 if (h->n_occupied >= khash_upper_bound(h)) { \ kh_resize_…

mruby gc.c のis_deadとは何でしょうか

#define is_dead(s, o) (((o)->color & other_white_part(s) & MRB_GC_WHITES) || (o)->tt == MRB_TT_FREE) object.hで定義されています。 まずはother_white_partが何かを見てみましょう。 #define other_white_part(s) ((s)->current_white_part ^ MRB_GC_…

MRubyのincremental_sweep_phaseを読んでみた。

struct heap_page *page = mrb->sweeps; でpageをスタート。 while (page && (tried_sweep < limit)) でnextのpageへループその中で RVALUE *p = page->objects;RVALUE *e = p + MRB_HEAP_PAGE_SIZE このpとeの間でまたループ。 while (p<e) if (is_minor_gc(mrb) && page->old) { /* skip a sl</e)>…