@@ -19,19 +19,27 @@ MRuby::Gem::Specification.new('picoruby-mruby') do |spec|
1919 spec . cc . include_paths << "#{ build . gems [ 'mruby-compiler2' ] . dir } /include"
2020 spec . cc . include_paths << "#{ build . gems [ 'mruby-compiler2' ] . dir } /lib/prism/include"
2121
22- align = 4
22+ ALIGN = 4 # or 8
23+
24+ build . cc . defines << "MRB_INT64"
25+
26+ if spec . cc . defines . include? ( "PICORB_ALLOC_O1HEAP" )
27+ heap_page_size = o1heap_page_size ( 13 )
28+ else
29+ heap_page_size = 256
30+ end
31+ spec . cc . defines << "MRB_HEAP_PAGE_SIZE=#{ heap_page_size } "
2332
2433 if spec . cc . defines . include? ( "PICORB_ALLOC_TINYALLOC" )
2534 alloc_dir = "#{ dir } /lib/tinyalloc"
26- spec . cc . defines << "TA_ALIGNMENT=#{ align } "
35+ spec . cc . defines << "TA_ALIGNMENT=#{ ALIGN } "
2736 elsif spec . cc . defines . include? ( "PICORB_ALLOC_O1HEAP" )
2837 alloc_dir = "#{ dir } /lib/o1heap/o1heap"
2938 unless File . directory? ( alloc_dir )
3039 FileUtils . cd "#{ dir } /lib" do
3140 sh "git clone https://github.com/pavel-kirienko/o1heap"
3241 end
3342 end
34- spec . cc . defines << "MRB_HEAP_PAGE_SIZE=#{ o1heap_page_size ( 13 ) } "
3543 elsif spec . cc . defines . include? ( "PICORB_ALLOC_TLSF" )
3644 alloc_dir = "#{ dir } /lib/tlsf"
3745 unless File . directory? ( alloc_dir )
@@ -43,7 +51,7 @@ MRuby::Gem::Specification.new('picoruby-mruby') do |spec|
4351 spec . cc . defines << "_DEBUG"
4452 end
4553 elsif spec . cc . defines . include? ( "PICORB_ALLOC_ESTALLOC" )
46- spec . cc . defines << "ESTALLOC_ALIGNMENT=#{ align } "
54+ spec . cc . defines << "ESTALLOC_ALIGNMENT=#{ ALIGN } "
4755 if spec . cc . defines . any? { _1 . start_with? ( "PICORUBY_DEBUG" ) }
4856 spec . cc . defines << "ESTALLOC_DEBUG=1"
4957 end
0 commit comments