jit-1_-_github__ysei~mruby-meta-circular-heiretu_-_nightly_-_2_0_2_4_0_2_2_1__1220420200.rb
# -*- coding: iso-2022-jp -*-
# include MMM # conf.gem :github => 'miura1729/mruby-mmm'
((((((((( [ # Thread.new { [
:ctr, :th, :th0, :th1 , :sym, :cop, :sp, :pc,
:_ctr_s, :s, :p, :r, :c, :fml_th_bt, :fmli,
:Array, :Numeric, :Fixnum, :Symbol, # :String,
:-, :/, :*, :+, :ji_ngq,
:_a, :_b, :_sbx, :_bx, :_c,
:getarg_a, :getarg_b, :getarg_sbx, :getarg_bx,
:mk_opcode, :getarg_c,
:MOVE, :LOADL, :LOADI, :LOADSYM, :LOADSELF, :LOADT,
:ADD, :ADDI, :SUB, :SUBI, :MUL, :DIV, :EQ, # :LOADF,
:JMP, :JMPIF, :JMPNOT, :RETURN, :SEND, :ENTER, :NOP,
:sr0, :r0, :sr01, :r1_eq_sr01,
:s__send, :__pool, :__syms,
:fibt, :FRTH].clear # , :FORTH, :FOURTH, :$DEADC0DE
))))))))) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
# GC.generational_mode = false # g # http://syucream.github.io/mrubook/gc.html
# GC.start # g
NSL_ = 6309 # OSX/PPC : 20476309 ? # nanosleep()
# NSL_ = 10065 # OSX/PPC : 20480065 ? # nanosleep()
TS = 3
NTH = 1 # = 68060
MTH = 1 # = 6809
PUTSN = 0 # = ~ 0 # = ~ 68 # = 0xbe
VMD = 0 # = 1
FL = '~~ritepl'
TB = []
THLB = :th
MH_THL = (0 .. 1).map { |n| THLB.to_s << n.to_xeh}
LV__VRB = 1
TABU1 = 8 - 1
I_V = 1; I_V_ = 1 - I_V
STR__GETARG = 'getarg' # $str__getarg
# $rmtb = false
# $rmt = [Thread.new {Pl.new.plm(1)}]
# class GC # monami-ya.mrb # http://www.monami-ya.jp/
# end
# def GC.start() end
# def GC.disable() end
module M__H
# rmth = 63
# rmth = 47
# @@rmth = 39
@@rmth = 7
@@ts = TS + (NSL_ >> 0x1a) # = (@@rmth >> 1) + 1 # = $$ + 1
end
module M__Symbol
def [](n) self.to_s[n] end
def <<(s) (self.to_s << s.to_s) # .to_sym
end
end
class Object # class Symbol # .:mrblib:irep.rb ?
include M__Symbol
end
module M__Object
# def mapr(&b)
# knid(self, :Array) ? self.map { |v| v.__method__ b} : yield(self)
# end
# def mapr(a, &b)
# a.map { |v| knid(v, :Array) ? __method__(v, b) : yield(v)}
# def mapr(&b)
# self.map { |v| knid(v, :Array) ? v.__method__(b) : yield(v)}
# def to_i_from(k, i = 0)
## self.is_a?(k) ? i + self.to_i : self # unwork ? ( thread ? ) # mrblib/
## knid(k, self) ? i + self.to_i : self # unwork ? ( thread ? ) # mrblib/
# self.class.to_s == k.to_s ? i + self.to_i : self # unwork ? ( thread ? ) # mrblib/
# end
# def kind_of?(k)
## self.class == k.class
# self.kind_of?(k) # unwork ? ( thread ? )
# end
def knid(v, k)
## return v.kind_of?(Object.const_get k) # if 0.kind_of?(Numeric) # super
# return v.kind_of?(Kernel.const_get k) # if 0.kind_of?(Numeric) # super
## return v.kind_of?(k.constantize) # if 0.kind_of?(Numeric) # RoR # super
# case k.to_s[1] # .to_sym[1] # higokan mruby 70410200
# @@ks ||= (0 .. 9).to_a.join + ?- # * '' higokan mruby 70410200 # ?0.upto # higokan mruby 70410200 # 7221410200 6ccae658 suzukaze http://mruby-master-changes.hatenablog.com/entry/2014/12/27# ? # q
case v when Kernel.const_get(k) then true end.!.!
end
def to_xeh
case self when Numeric then self.to_s(0x10).reverse else ?- end
end
# def getarg
# def getarg__
# ?_ == (s = self.to_s)[0] && self.replace("getarg" << s)
# end
end
class Object
include M__Object
end
module M__Numeric
# def to_xeh # unwork mruby 60410200 # mrblib/
# def absb(i)
## self + (((0 <=> self) + 1 >> 1 << 0x10) - 1 & self << 1)
# i + (((0 <=> i) + 1 >> 1 << 0x10) - 1 & i << 1)
## i + (((0 <=> i) + 1 >> 1 << 0x20) - 1 & i << 1)
# end
# def pid_g; $$ || self end
end
class Numeric
include M__Numeric
end
module M__Range
def +(i = 0)
i + self.first .. i + self.last - (self.exclude_end? ? 1 : 0)
end
end
class Range
include M__Range
end
module M__Array
include M__H
# def ijr(&b)
# yield self.map { |v| knid(v, :Array) ? v.__method__(b) : v}
# end
def afl(k, m = self) # unwork ( thread ? ) # mrblib/
# self[0].index(k) # higokan mruby 10410200 ( irep.rb )
?i != m ? self[m.afl(k, ?i)] : # .__method__(k, ?i)] : #? mruby 410200 # q 2
(s0 = self[0]).index(s0.assoc(k)) # self.index(idx)
# loop {(s0 = self[0]).index(s0.assoc(k)) && break} # self.index(idx) # fuguai taisaku
end
# def height # unwork ( thread ? ) # mrblib/
# self.size - 1
# end
# def delif_c(i, a = self) # # higokan ? mruby-thread:410200 monami-ya.mrb:60510200 mruby:70410200
# def delif_c(i = @@ts, a = nil, fr = 0)
def delif_c(i = @@ts, fr = 0, a = nil)
# f = (a == self) # higokan ? mruby-thread:410200 monami-ya.mrb:60510200 mruby:70410200
# i.! ? a.delete_if(&:yield) : a.each_with_index { |v, n|
# break if n >= i; v && yield(v, n) && a.delete_at(n)}
## [! a, ( # fuguai taisaku
a ||= self # a ||= f = self # a ||= (f = true; self)
n = fr + (fr = fr.abs) >> 1
((i > fr = a.size - fr) || 0 == i) && i = fr
i.times { |fr|
# (i = a[n]) && yield(i, fr) && (next a.delete_at(n)); n += 1
# a[-1 + n += 1] && yield(a[n - 1], fr) && a.delete_at(n -= 1)
(i = a[-1 + n += 1]) && yield(i, fr) && a.delete_at(n -= 1)
}
## )][0] ? self.replace(a) : # f ? self.replace(a) : # fuguai taisaku
a
end
end
class Array
include M__Array
end
# module M__Fiber
# def yield(a)
# [super, (sl = Slp.new).slp 0][0]
# end
# end
#
# class Fiber
# include M__Fiber
# end
# module M__CaAry_
# (
# @@ca = []
# ## @@ctr = -1
# @@m = Mutex.new
# @@ofs = MTH # + 1
# )
#
# def initialize(a = [], id = 0, ofs = @@ofs)
# # @ca = [] # cannot set instance variable (ArgumentError)
# # @@ca[ofs + id + @@ctr += 1] = a
# @@ca[ofs + id] = a
# end
# end
#
# class CaAry_ < Array
# include M__CaAry_
# end
module M__Mlok
@@m = nil
def initialize(m = @@m)
@m = m ||= Mutex.new
end
def mlok(&b)
@m.lock
yield
@m.unlock
end
end
class Mlok
include M__Mlok
end
MLOK = Mlok.new
module M__Slp
# @@m = Mlok.new
# @@m = MLOK
# @@slp = 7; @@slp = # [ #? mruby 410200
# (((NSL_ >> 9 - @@slp) + (NSL_ >> 7 - (@@slp - 7))) >> @@slp) + 1 >> 1
# @@slp = 2; @@slp = # [ #? mruby 410200
# (((NSL_ >> @@slp) + (NSL_ >> 5 + @@slp)) >> 9 - @@slp) + 1 >> 1
# ].lazy #? mruby 410200
# @@nsl_ = [ #? mruby 410200
@@slp = # conf.gem :github => 'matsumotory/mruby-sleep' # 'bamchoh/mruby-sleep' # msleep usleep
(((@@slp = NSL_ >> 2) + (@@slp >> 5)) >> 7) + 1 >> 1
# (((@@slp = NSL_ >> 1) + (@@slp >> 5)) >> 8) + 1 >> 1
# (( NSL_ + (NSL_ >> 5)) >> 8) + 2 >> 2 # 16+ bit MPU
# ].lazy #? mruby 410200
# @@slp = 0xbe # nanosleep()
# @@ctr = 0
# def initialize; @@slp = @@nsl_.force[0] end #? mruby 410200
def slp(t = @@slp, r = 1, &b)
# t += 1 - (t <=> 0) # 1 <=> t
(r - 1).times {usleep 0}; b && yield; r.times {usleep t} # g # conf.gem :github => 'kimushu/mruby-sleep' # msleep usleep
# (r - 1).times {msleep 0}; b && yield; r.times {msleep t} # g # usleep yobi
# (r - 1).times {sleep 0}; b && yield; r.times {sleep t} # g
# (r - 1).times {usleep 0}; r.times {usleep t}
# (r - 1).times {msleep 0}; r.times {msleep t} # usleep yobi
# (r - 1).times {sleep 0}; r.times {sleep t} # antei ?
# (r - 1).times {sleep 0}
# r.times {sleep t}
# (self.size << 4).times {sleep 0; (true == true).is_a?(Object); sleep 0}
# [true][Time.now.to_f.to_s.split(?.)[1].to_i & 15] && GC.start # q # g
# [true][(@@ctr += 1; @@ctr &= 3)] && GC.start # g
end
# def plwt(m = 1)
def plwt(m = 1, sl = nil)
sl && slp(sl)
sf = 2 # (@@ts >> 1) + 1
((m >> sf) + 1).times { |n| yield n}
end
end
class Slp
# include M__H
include M__Slp
end
SLP = Slp.new
module M__Plok # Inspired by Professor NAGAI Hidetosi http://rubykaigi.org/2011/ja/schedule/details/17S05/#KyuTech
(
# @@m = Mlok.new
@@mlok = MLOK
# @@m = Mutex.new
@@Slp = SLP
# @@Imem = IMEM
) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
# attr_accessor :ji_ngq
def initialize(nm = nil)
@nm = nm
## @ji_ngq = true
end
def plok(*a)
## @@mlok.mlok {
## @@m.lock
# GC.disable # g
# s = nil
begin
## @@Slp.slp 0 # read syoutotu taisaku
f = File.open(@nm, ?w) # q
f.flock(File::LOCK_EX)
rescue
# f.close # ?
# (s ||= @@Slp).slp 0 # higokan ? mruby 70410200
@@Slp.slp 0
### @nm && retry
end ## if @ji_ngq
GC.disable # hituyou <-> monami-ya.mrb:60510200 osoku-naru , mruby:70410200 SeguFo(-nado?) # g
## @@m.unlock
[yield(a), GC.start, ## @ji_ngq && # g
f.close][0]
# @@m.unlock][0]
# ][0]
# a = yield(r)
## }
## @@m.unlock
end
end
class Plok
include M__Plok
end
LOC = Plok.new(FL << ?. << 'lok'.replace('loc')) # q
# LOC = Plok.new(FL << ?/ << 'lok'.sub(/lok/, 'loc') # RISC OS ? # q
# Plok.new(FL << '/' 'lok'[''] = 'loc') # RISC OS ? # higokan monami-ya.mrb:60510200 mruby:70410200
module M__Rou
# @@I_s__stack = @@I_s__irep =
# @@I_s__i = 0; @@I_s__r0 = 1; @@I_s__r1 = 2; @@I_s__mt = 3
def getarg__(s)
?_ == (s = s.to_s)[0] ? 'getarg' << s : s # q # higokan monami-ya.mrb:60510200 mruby:70410200 : STR__GETARG , $str__getarg
end
# def s__i_pool_r0( *a) a[@@I_s__i].pool[ a[@@I_s__r0]] end
# def s__i_syms_r0( *a) a[@@I_s__i].syms[ a[@@I_s__r0]] end
def s__sr0( *a) a[0][ a[1]] end
def s__r0( *a) a[1] end
def s__sr01( *a) a[0][ a[1] + 1] end
# def s__i__r0( *a) a[0].send(a[3])[ a[1]] end
def s__send( *a) a[0].send(a[3])[ a[1]] end
def s__r1EQsr01(*a) a[2] &&
a[0][a[1] + 1] == a[0][ a[2]] end
def method_missing(*a)
# '__' != a[0][0 .. 1] ? # higokan mruby 70410200
if '__' != (a[0] = a[0].to_s)[0 .. 1]
a[0] = 's__' << a[0]
case a[3] # a[@@I_s__r1 + 1]
when Array then return a.pop.map{ |v| v.nil? ? v : send(*a, v)} # r
## when Array then a.pop.map{ |v| v.nil? ? v : self.send(*a, v)}
else send(*a)
end
else
send(:s__send, a[1][2 .. -1], *a[2 .. -1]) # higokan mruby 70410200
## send(:s__send, a[1].to_s[2 .. -1], *a[2 .. -1])
end
end
end
class Rou
include RiteOpcodeUtil
include M__Rou
end
ROU = Rou.new
#module M__RiteOpcodeUtil__Getarg__
# def getarg__(s)
# ?_ == (s = s.to_s)[0] ? 'getarg' << s : s # q # higokan monami-ya.mrb:60510200 mruby:70410200 : STR__GETARG , $str__getarg
# end
#end
# when :NOP # 何もしない
# when :MOVE # MOVE Ra, RbでレジスタRaにレジスタRbの内容をセットする
# @stack[@sp + getarg_a(cop)] = @stack[@sp + getarg_b(cop)]
# @stack[r1] = @stack[r0]
# when :LOADL # LOADL Ra, pb でレジスタRaに定数テーブル(pool)のpb番目の値をセットする
# @stack[@sp + getarg_a(cop)] = @irep.pool[getarg_bx(cop)]
# @stack[r1] = @irep[0].pool[r0]
# ops = [[['getarg_bx', cop], [sp, ['getarg_a', cop]]]]
# when :LOADI # LOADI Ra, n でレジスタRaにFixnumの値 nをセットする
# @stack[@sp + getarg_a(cop)] = getarg_sbx(cop)
# @stack[r1] = r0
# when :LOADSYM
# @stack[@sp + getarg_a(cop)] = irep.syms[getarg_bx(cop)]
# @stack[r1] = @irep[0].syms[r0]
# when :LOADSELF # LOADSELF Ra でレジスタRaに現在のselfをセットする
# @stack[@sp + getarg_a(cop)] = @stack[@sp]
# @stack[r1] = @stack[r0]
# ops = [[[sp], [sp, ['getarg_a', cop]]]]
# when :LOADT
# @stack[@sp + getarg_a(cop)] = true
# @stack[r1] = r0
# when :ADD # ADD Ra, Rb でレジスタRaにRa+Rbをセットする
# @stack[@sp + getarg_a(cop)] += @stack[@sp + getarg_a(cop) + 1]
# @stack[r1] += @stack[r0 + 1]
# ops = [[[sp, ['getarg_a', cop]]]]
# when :ADDI
# @stack[@sp + getarg_a(cop)] += getarg_c(cop)
# @stack[r1] += r0
# when :SUB
# @stack[@sp + getarg_a(cop)] -= @stack[@sp + getarg_a(cop) + 1]
# @stack[r1] -= @stack[r0 + 1]
# when :SUBI # SUB Ra, n でレジスタRaにRa-nをセットする
# @stack[@sp + getarg_a(cop)] -= getarg_c(cop)
# @stack[r1] -= r0
# when :MUL
# @stack[@sp + getarg_a(cop)] *= @stack[@sp + getarg_a(cop) + 1]
# @stack[r1] *= @stack[r0 + 1]
# when :DIV
# @stack[@sp + getarg_a(cop)] /= @stack[@sp + getarg_a(cop) + 1]
# @stack[r1] /= @stack[r0 + 1]
# when :EQ # EQ Ra でRaとR(a+1)を比べて同じならtrue, 違うならfalseをRaにセットする
# val = (@stack[@sp + getarg_a(cop)] == @stack[@sp + getarg_a(cop) + 1])
# val = @stack[r1] == @stack[r0 + 1]
# @stack[@sp + getarg_a(cop)] = val
# @stack[r1] = val
module M__Imem
@@Loc = LOC
# @@fml_th_bt = [['sym', true, 'th', true], ['sym', false, 'th', true]]
@@fml_th_bt = [[:sym, true, :th, true], [:sym, false, :th, true]]
@@fmli = ['st', 'th']
@@fml = [
[:MOVE, [:sr0 ], [[:_b ], []]],
[:LOADL, [:__pool ], [[:_bx ], []]],
[:LOADI, [:r0 ], [[:_sbx ], []]],
[:LOADSYM, [:__syms ], [[:_bx ], []]],
[:LOADSELF, [:sr0 ], [[:mk_opcode, 0 ], []]], # mk_opcode 0
[:LOADT, [:r0 ], [[true , '', 0 ], []]],
# [:LOADF, [:r0 ], [[false , '', 0 ], []]], # ?
[:ADD, [:sr01, :+ ], [[]]],
[:ADDI, [:r0, :+ ], [[:_c ], []]],
[:SUB, [:sr01, :- ], [[]]],
[:SUBI, [:r0, :- ], [[:_c ], []]],
[:MUL, [:sr01, :* ], [[]]],
[:DIV, [:sr01, :/ ], [[]]],
[:EQ, [:r1EQsr01 ], [[]]]
]
# ['st', nil, 'th', ['bt', ['sym', true, 'th', true], ['sym', false, 'th', true]],
attr_accessor :fml_th_bt, :fmli
def initialize
# @fml = @@fml
@fml_th_bt = @@fml_th_bt
@fmli = @@fmli
end
# def ta(l, cop) [l[0] || :getarg_a, l[1] || cop][0 .. l[2] || 1] end
def ta(l, cop) [l[0] || :_a, l[1] || cop][0 .. l[2] || 1] end
# def fml(lb, sym)
def fml(i_lb, sym)
# Rg.new
# [sym, @@fml.assoc(sym)[@@fmli.index(lb) + 1]] # fukusayou ?
# [sym, @@fml.assoc(sym)[@@fmli.index(lb) + 1] + []] # fukusayou ? kaihi : mruby 70410200
# @@fml.assoc(sym)[@@fmli.index(lb) + 1] + [] # fukusayou ? kaihi : mruby 70410200
# @@fml.assoc(sym)[i_lb + 1] + [] # fukusayou ? kaihi : mruby 70410200
[] + (@@fml.assoc(sym)[i_lb + 1] || ( # fukusayou ? kaihi : mruby 70410200
# printf("Unkown code %s \n", OPTABLE_SYM[imem.get_opcode(cop)])
# printf("Unkown code %s \n", OPTABLE_SYM[@Rou.get_opcode(cop)])
(loc = @@Loc).vrb("Unkown code #{sym} ") # .to_s
return nil
# raise
# rg = Fiber.yield(nil)
))
end
end
class Imem
include M__Imem
end
IMEM = Imem.new
# module M__PlIni # Omoi ?
# module M__ENVary # higokan ? mruby 70410200
class ENVary < Array
# include RiteOpcodeUtil
include M__H
(
# @imem = Imem.new # higokan mruby 80410200
@@Imem = IMEM
@@Slp = SLP.dup
@@idb = FL
# @@idb = 0.pid_g.to_xeh + @@idb # +
# (rand 0xff).to_xeh +
# (Time.now.to_f - 0x3fffffff.to_f << 0x10).to_s.split(?.)[0][-8..-1].to_xeh # q
# @@dlm = '\n'
# @@dlm = '__--__'
# @@thini = [false, 0]
# @@plini = [@@thini, @@thini, [], []]
@@plini = [false, 0]
@@plini = [@@plini, @@plini, [], []]
@@pl0i = nil
@@bfsz = nil
@@Loc = LOC
# @@tp = Array.new(0x8); @@tp.delete(nil)
# @@tp = Array.new(0x3f)
# @@tp = []
module M__Idx
def initialize(idb = FL.dup) @@idb = idb end
def idx(*a) a[0].to_xeh end
def lbl(a) @@idb + idx(*a) end
end
class Idx
@@idb = nil
include M__Idx
end
@@Idx = Idx.new(@@idb)
) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
def initialize(a = nil)
# @m = Mutex.new
# @imem = Imem.new # higokan mruby 80410200
### @ca = nil
# $mh_thl ||= (0 .. 1).map { |n| ('th' << n.to_xeh).to_sym} # symbol fuguai : mattn/mruby-json
a || return # 410200plini
# plini(@@rmth) # 410200plini
a = @@plini
1.step(@@rmth + 1) { |i| self[i] = *a}
end
# include M__PlIni # 410200plini # ok ? ( osx10.4/ppc 1koa )
def []=(n, v)
# ENV[@@idb + n.to_s] = v.to_msgpack
# ENV[@@idb + n.to_s] = MsgPack.dump(v)
## ENV[@@idb + n.to_s] = JSON::generate(v)
@@Loc.plok(n, v) { |a| ENV[@@Idx.lbl(a)] =
JSON::generate(
a[1])} # || nil
# super
end
def [](n)
# MessagePack.unpack(ENV[@@idb + n.to_s])
# MsgPack.load(ENV[@@idb + n.to_s])
## JSON::parse(ENV[@@idb + n.to_s])
### a = [n]
@@Loc.plok(n) { |a| ### @ca =
(a = ENV[@@Idx.lbl(a)]) && ### @ca =
'[]' == a[0] << a[-1] && ### @ca =
JSON::parse(a)
} # || nil
# super
end
# def idx0(n = 0, t = 1)
## t > n ? n + 1 : n ## n + (t > n ? 1 : 0)
## n + [false, true].index(t > n) ## n + (((t > n) && 1) || 0)
## n + (t > n && 1 || 0) # n - ((n <=> t) >> 1)
## n + ((t <=> n) & 1)[0] ## n + (((t <=> n) + 1) & 2)[1] # higokan mruby 70410200
## n + ((((t <=> n) + 1) & 2) >> 1) ## n + ((t <=> n) + 1 >> 1)
# end
# @@Idx0 = ->(n = 0, t = 1) {n + (t > n ? 1 : 0)} # l
# def pl_g(n = 0)
# def pl_g(n, *a)
def pl_g(n)
# sleep 0; GC.start; sleep 0 # g
# self[n < 0 ? n + 1 : n][idx0(n)]
pl = self[0 > n ? ~ n : n]
# 1 > n ? pl[idx0(n)] : pl
# if 1 > n then pl = pl[idx0(n)] end
0 == n ? pl.map! { |a| a[1]} :
# case pl when Array then else pl = @@plini end # higokan ? mruby 70410200
# case pl when Array then true end || pl = @@plini # higokan ? mruby 70410200
pl || pl = [] # pl ||= [] # higokan ? monami-ya.mrb:60510200 mruby:70410200
# a.empty? ? pl : a.map { |a| pl.afl(a, self)}
end
@@Plmg = ->(pi, pv) {pi.map { |v| [v[0], pv.shift]}} # l
# def pl_s(n = 0, pl)
def pl_s(n = 0, pl = nil)
# self[n] = 0 == n ? pl_g(-1).transpose[0].zip(pl) : pl # higokan mruby 70410200
# self[n] = 0 == n ? @@Plmg.(pl_g(-1), pl) : pl # c
self[n] = 0 == n ? @@Plmg.(@@pl0i, pl) : pl # c
# self[n] = 0 == n ? pl_g(-1).map { |v| [v[0], pl.shift]} : pl
end
# def pl_eg(n = 0, k)
def pl_eg(n, k)
pl_g(n).afl(k, self)
end
def pl_es(n = 0, a)
# def pl_es(n, a, wt = false)
# @@tp.delete(nil)
# if wt
## @@tp<< ary
# @@tp.push(*ary)
# else
# aa = []
# pl[0 == n ? 1 : nil][idx(k)] = v
# n = arg.shift if arg.first.is_a?(Numeric) # unwork ( thread ? )
# arg[0].is_a?(Numeric) ? n = arg.shift : n = 0 # unwork ( thread ? )
pl = pl_g(n)
a.each_slice(2) { |k, v| # .shift(2) higokan mruby 70410200
# (@@tp + ary).each_slice(2) { |k, v| # .shift(2) higokan mruby 70410200
# 'ctr_s' == k && break(-v) # higokan ? mruby 70410200
# knid(k, :Symbol) && (aa.push(k, v); next)
# knid(k, :Symbol) && (aa.push(k, v); break)
# case k when Symbol then aa.push(k, v); break end
# knid(k, :Symbol) && (send(k, v); break)
?_ == (k = k.to_s)[0] && (send(k[1 .. -1], v); next) # q
# case k when Symbol then send(k, v); break end
# case k when Symbol then send(k, v); true end && break
k = self.afl(k, ?i) # q
#### k = loop {self.afl(k, ?i) && break} # q # fuguai taisaku
pl[k] = case v when Numeric then pl[k]<< v else v end # p
# pl[k = self.afl(k, ?i)] += [v] # q # ?
# pl[k] += [v]
# pl[k].map!{|k| k.send(case v when Numeric then 'itself' else 'pop' end)} # p
# pl[k] = pl[k][case v when Numeric then 0 .. -1 else -1 end] # p # ?
}
pl_s(n, pl) # ,
## aa.each_slice(2) { |k, v| send(k, v)}
# aa.empty? || send(*aa)
# ][0]
#@@tp.clear
#@@tp = [nil]
#@@tp = Array.new(0xf)
# end
end
def ref_pl0i; @@pl0i = pl_g(-1) end
# def to_ia(n)
def to_ia(n, lpl = self)
if 0 == n
# self[n]
lpl[n]
else
# @@Plmg.(pl_g(-1), self[n]) # c
@@Plmg.(@@pl0i, lpl[n]) # c
end
# lpl = lpl[n]
# if 0 == n
## lpl[n]
# lpl
# else
## @@Plmg.(@@pl0i, lpl[n]) # c
# @@Plmg.(@@pl0i, lpl) # c
# end
# return lpl = lpl[n]
# lpl = lpl[n]
# ensure
# 0 != n && (return @@Plmg.(@@pl0i, lpl)) # c
# [lpl = lpl[n], 0 != n && (return @@Plmg.(@@pl0i, lpl))][0] # c
end
## @@pl0i, 0 == n ? lpl[n][1] : lpl[n])
## @@pl0i, (lpl = lpl[n]; 0 == n ? lpl[1] : lpl))
# @@pl0i, (0 == n && lpl = lpl[0]; lpl[n + (n <=> 0 & 1 ^ 1)]))
def ctr_g
[(c = pl_g(0).afl('ctr', self)).shift, pl_es(0, ['ctr', c])][0] # ctr = (cta = pl_g(0).afl('ctr', self)).shift # pl_es(0, ['ctr', cta]) # ctr
end
def ctr_s(c)
pl_es(0, [:ctr, c])
c
end
def tha(th) [knid(th, :Array), (TB) == th] end
def bfsz; @@bfsz ||= tha(true).size end
def ckth(th, md)
# self[pc][idx('th')].is_a?(Array) # higokan mruby 10410200 ( irep.rb )
# sz = (a = [knid(th, :Array), (TB) == th]).size
sz = (a = tha(th)).size
# sz = (a = [case th when Array then true end.!.!, tb == th]).size
# bf = (Array.new(sz, '1').join).to_i(2) # higokan ? mruby 70410200
# bf = Array.new(sz) { |n| 1 << n}.inject # higokan ? mruby 70410200
bf = (1 << sz) - 1
# 0 : ary 1 : ! ary 2 : kara ary 3 : ! kara ary
while (0 == 1 & md) == a[(md & bf) >> 1]
# ((a[(md & bf) >> 1] ? 0 : 1) == 1 & md)
# ([true, false][1 & md] == a[(md & bf) >> 1])
## md >>= bfsz; 0 == lf ? return(false) : (md &= bf if 0 == lf >> bfsz) # ? mruby 70410200 # r
0 == (md >>= sz) >> sz && break # lf damii bit
end.!.!
end
# private
end
# module M__Pl # higokan ? mruby 70410200
class Pl < ENVary
# include M__RiteOpcodeUtil__Getarg__
# def initialize(*a) super end
def send(*a)
### GC.start # g
case a[0] when Numeric then a.inject else (ROU).send(
# *a) end
## a[0].getarg__, a[1]) end
ROU.getarg__(a[0]), a[1]) end
end
def st_id(a)
# ([] == a || ! knid(a, :Array)) && (return a) # t
# ([] == a || case a when Array then true end.!) && (return a) # t # higokan mruby:70410200 monami-ya.mrb:60510200
((TB) == a || ! knid(a, :Array)) && (return a)
a.map! { |a|
## v.kind_of?(Array) ? # unwork ( thread ? )
knid(a, :Array) && # Thread.new { # TRON,BeOS,PalmOS6,Aperios,HongmengOS,1489922543/30-42#97-98 <-> Smalltalk(AlanKay,NAKAJIMA,YOKOTE,TOKORO,OTIAI,NAGAMATSU,TERAOKA,MITUZAWA,FUJINAMI(,itojun)),DeepConnect,PIMOS ?
# case a when Array then # Thread.new { # TRON,BeOS,PalmOS6,Aperios,HongmengOS,1489922543/30-42#97-98 <-> Smalltalk(AlanKay,NAKAJIMA,YOKOTE,TOKORO,OTIAI,NAGAMATSU,TERAOKA,MITUZAWA,FUJINAMI(,itojun)),DeepConnect,PIMOS ? # higokan monami-ya.mrb:60510200 mruby:70410200
a = st_id(a)[0] # } # __method__(a) # } #? mruby 410200
# end
a
}
return [a[0], nil] if 0 >= a.hgt # r
## return a.ijr { |v| v.inject(@@imem.mcall) || v[0]} # r
# GC.start # g # fuantei ( keisan gosa ) ?
# opc, op = a
## [self.send(*a) || a[1], case a[0] when Numeric then else a end] # then nil
# [self.send(*a) || a[1], knid(a[0], :Numeric).! && a]
[self.send(*a) || a[1], a]
end
# def plw__kt(pc)
# ckth(pl_eg(pc, 'ctr')[0], 0) # sp [sp]
# end
# @@kt = ->(pc) {ckth(pl_eg(pc, 'ctr')[0], 0)} # l # sp [sp] # higokan ? mruby 70410200
def plw(pc) ##
# i_th = self.afl('th', ?i) # # higokan mruby 10410200 ( irep.rb ) # q
tb = TB.dup
sl = @@Slp
imem = @@Imem
thl = MH_THL
# th = Array.new(thl.size) { |v| 0 == v ? pl_eg(pc, thl[v]) : tb} # unwork ( thread ) # mruby-thread e139cfe 1211410200 sdottaka
th, mx = nil
idx, ji_ngq = (ini = ->(i = 0) {[idx = i, ji_ngq = false]}).call # l # fuguai taisaku ? # idx = 0 ##
fb0 = ->(m) {0 < m && Fiber.yield(false); th = [tb] * (1 + mx = thl.hgt)}
kt = -> {ji_ngq ||= ckth(pl_eg(pc, 'ctr')[0], 0)} # l # sp [sp]
# kt = @@kt
s_id = ->(ti) { # l
ti = st_id([a = ti]) #(a = ti)
ti[1].nil? && ti[1] = a
ti
}
Fiber.new { |m = 1| fb0.(m) # c
loop {
(th[idx].! || ckth(th[idx], 2)) && ((th[idx] = pl_eg(pc, thl[idx])) || # fuguai taisaku ?
(next Fiber.yield(! ini.(idx)))) # false # fuguai taisaku ? # c
0 < idx && ckth(th[idx], 2) && kt.call ? idx -= 1 : # ji_ngq ||= plw__kt(pc)
(th[idx], v = s_id.(th[idx])) # if mx >= idx # && ckth(th[idx], 3) # c
if ckth(th[idx], 1)
# r = pl_es(pc, ((kt.call && mx <= idx ? 0 : idx) .. idx # kt : ato
r = pl_es(pc, (idx - if mx <= idx && kt.call then idx end.to_i .. idx
).flat_map { |n| [thl[n], [th[n]] + [[v], v = []][0]]}) # .slice! higokan monami-ya.mrb:60510200 mruby:70410200
r || (next(Fiber.yield(false); ini.(idx))) # fuguai taisaku ? # c
idx -= (idx <=> mx) >> 1 # += (mx <=> idx) + 1 >> 1
end
m = sl.plwt(m, 0) { |n| Fiber.yield([ji_ngq][n])}
} ##
}
## self.lf_d
end
##@@plw = nil
def plm(pc = 1)
# until $rmtb do true; true end
ts = @@ts # + 1
(sl = @@Slp).slp
fpl = []
loop {
pc = ctr_g
pc && 0 <= pc && fpl<< plw(pc) # p
## pc && 0 <= pc && fpl<< (@@plw ||= plw); GC.disable # p # g
# pc, cto = self.ctr_g if flg
# if pc != cto or ! flg
# if pc >= 0 || ! flg
# cto += 1
# fpl<< self.plw(pc) if flg[0] # p
# an[cto] = Thread.new(envid) { |envid|
# (ith, th) = self.pl(pc, ith, th) ###
# (flg = [true][ith]) || redo ###
# fpl.delete_if(&:resume)
## fpl.delete_if(&:resume(pc))
# fpl = delif_c(ts, fpl) { |fb, n| fb.resume(n)}
fpl = delif_c(ts, 0, fpl) { |fb, n| fb.resume(n)}
## fpl = delif_c(1, 0, fpl) { |fb, n| fb.resume(pc)} # ?
sl.slp
### GC.start # g # antei ?
}
end
end
# class Pl < ENVary
# include M__Pl
# end
# module M__AryM # higokan ? mruby 70410200
class AryM < Array
# @@f = 0x0.chr * (0x20 << 2)
# @@bm = 0xff.chr
# def initialize
## @f = '' # cannot set instance variable (ArgumentError)
# end
# def [](*a) # ok : monami-ya.mrb:60510200
## sleep 0
## @@Slp.slp 0
## a.to_s
# super
# end
# def []=(*a)
## sleep 0
## @@Slp.slp 0
## a.to_s
# super
# end
end
# class AryM < Array
# include M__AryM
# end
module M__Stack
@@s = AryM.new
@@ow = []
# @@m = Mutex.new
# attr_accessor :p, :r
attr_accessor :c, :p, :r, :s
def initialize(sp = 0, s = @@s)
# def initialize(sp = 0, s = @@s, m = @@m)
# id = self.object_id
@p = sp; @s = s; @ir, @i_i, @c, @r = nil
# @p = sp; @m = m; @s = s
# @@m.lock
# s = @s
# @@m.unlock
s
# @s
end
def [](*a)
# @@m.lock
# s = @s
# @@m.unlock
# s[@p.ipt a[0]]
@s[a[0] + @p]
end
def []=(sp, va, pc = nil)
#p [sp, va, pc, self.object_id]
# @@m.lock
pp = sp + @p
# @@ow[@@ow.owasoc(i)] # <<
# @@m.lock
# @i_i = @@ow.owasoc(i)
# @@m.lock
# knid(pc, :Fixnum) && (@ow[pc] && (@ow[pc].include?(pp) || (@ow.push(pp); @ow.sort!)) || @ow[pc] = [pp])
# a = @s[@p.ipt a[0]] = a[1]
# a = @s[@p + a[0].sgp] = a[1]
@s[pp] = va
# @@m.unlock
# a
end
def size; @s.length - @p end
def irep(i)
owasoc(i) || (
@@ow<< [i, []] # p
0xf < @@ow.size && @@ow.shift
@ir = i
)
end
def idel(i)
@@ow.delete(owasoc(i))
end
def owasoc(i) @@ow.assoc(i) end
def owc(i = @ir) i = owasoc(i) && @@ow.delete_at(@@ow.index(i)) end
# def rs(r = nil)
# @r = r
# end
# def cs(c = nil)
# @c = c
# end
def method_missing(*a)
@s[@r.send(a[0], @c) + @p]
end
end
class Stack
include M__Stack
end
module M__Rg
attr_accessor :p
def initialize(*a)
# @i = 1
@s = a
@p = 0
end
def push(*a)
@s.assoc(a.shift)[1]<< a[0] # p
end
def pop(*a)
@s.assoc(a.shift)[1].pop
end
def shift(*a)
@s.assoc(a.shift)[1].shift
end
def delete_at(*a)
@s.assoc(a.shift)[0].delete_at a[0]
end
def to_ra(*a)
a.map { |v| self[v]}
end
def to_a
@s.map { |v| [v[0], v[1][0 .. -1]].dup}
end
def [](k, i = nil, m = nil)
i ||= @p
@s.assoc(k)[1][i]
end
def []=(k, i = nil, v)
i ||= @p
@s.assoc(k)[1][i] = v
end
def flgflp; @p = ~ @p end
# def flg_e; @p = ~ @p end
# def flg_d; @p = ~ @p end
def flge?; 0 <= @p end
def flgd?; 0 > @p end
# prepend M__Ist
end
class Rg # higokan ? mruby-thread:410200
include M__Rg
end
module M__Vrb
@@s = nil
attr_accessor :s
def initialize(a = @@s)
# @s = a ||= AryM.new(2, []) # ?
@s = a ||= AryM.new(2){[]}
@ap = nil # fuguai taisaku
end
# def vrb(fls2 = false, fr = 0)
def vrb(fls2 = false, fr = 0, ptn = PUTSN, i_v = I_V, i_v_ = I_V_)
# until @s.empty?
until @s[i_v].empty? || @s[i_v].uniq! # fuguai taisaku
s = ''
### puts(
@s[i_v].delif_c( ### ~ # puts
ptn, fr){ |a| # fuguai taisaku ? ( osx/ppc, freebsd8/i386 )
case a
when Array
# a.size.times{a.push(*a.shift)}; ak, apc, a2, a3, a4 = a
# if 2 == a[0] && (siv = (siv = @s[i_v_]).index(siv.assoc(a[1]))) # ?
if 2 == a[0] # fuguai taisaku ?
sz = a.size
(siv = (siv = @s[i_v_]).index(siv.assoc(a[1]))) ? (
a += (a = @s[i_v_].delete_at(siv)[1 .. -1]
a[0] = (rou ||= ROU).getarg__(a[0]) # .chomp # fuguai taisaku ( freebsd8/i386 )
a)
a && @ap = a # fuguai taisaku
) : (a = @ap || next) # fuguai taisaku # r
sz >= a.size && ( @s[i_v_].clear # fuguai taisaku # .shift
a.push(*@ap[sz .. -1])) # fuguai taisaku
a[2] = (a = a.dup)[2].chomp # fuguai taisaku ( osx/ppc, freebsd8/i386 ) # .to_s : nil taisaku
end
# sa ||= [[' ', ' '], [' ', ' ']][a[0] <=> 2]
sa ||= [' ', ' ', ' '][a[0] & 1, 2]
# 2 == a[0] && a[2] = getarg__(a[2]) # .chomp # fuguai taisaku ( freebsd8/i386 )
s << a[1].to_xeh << " " * a[0] <<
## "#{a[2]} #{a[3].to_xeh}"
"#{a[2] << sa[(0 <=> a[2].size - TABU1) >> 1]}#{a[3].to_xeh}"
a[4] && s << " #{a[4].to_xeh}"
else
s << a
end
s << "\n" # "\C-J" "\xa" http://techracho.bpsinc.jp/hachi8833/2018_06_21/58071
# }.chop # fuguai taisaku ( osx/ppc, freebsd8/i386 )
}
### )
1 < s.size && # puts(s.chop) # .chop # fuguai taisaku (osx/ppc, freebsd8/i386)
s.each_line { |s| puts s} # fuguai taisaku ? (osx/ppc, freebsd8/i386)
break unless (fls2 && (@s[i_v].clear; fls2)) || 0 > fr # fuguai taisaku
end
# @@Slp.slp 0
end
end
class Vrb
# include M__RiteOpcodeUtil__Getarg__
include M__Vrb
end
# module M__Wkth
def wkth(pc = 1)
# Thread.new($pcmax) { |pcmax|
# Thread.new(@pl, pc) { |pl, pc| # @Imem,
# pl.plm(pc)
Thread.new(pc) { |pc|
Pl.new.plm(pc)
}
end
# end
# include M__Wkth # higokan ? monami-ya.mrb:60510200 mruby:70410200 # omoi ?
class FibVM
@@Rmt = [wkth]
# include RiteOpcodeUtil
include M__H
(
OPTABLE_CODE = Irep::OPTABLE_CODE
OPTABLE_SYM = Irep::OPTABLE_SYM
@@Loc = LOC
@@Imem = IMEM
@@Slp = SLP
@@Rou = ROU
@@nth = NTH
)
def initialize
### GC.start # g # antei ?
# @pla = Array.new($pcmax)
# $pltini.call()
# @pl = ENVary.new(true) # 410200plini
plini(@@rmth, @pl = ENVary.new(true)) # 310200plini ?
@rmt = @@Rmt + Array.new(@@nth - 1) {wkth}
@Imem = @@Imem
@Rou = @@Rou
@Slp = @@Slp
# For Interpriter
# @stack = [] # スタック(@spより上位をレジスタとして扱う)
@stack = Stack.new # スタック(@spより上位をレジスタとして扱う)
# @callinfo = [] # メソッド呼び出しで呼び出し元の情報を格納
@callinfo = Stack.new(0, []) # メソッド呼び出しで呼び出し元の情報を格納
@pc = 0 # 実行する命令の位置
@sp = 0 # スタックポインタ
# @cp = 0 # callinfoのポインタ
@irep = nil # 現在実行中の命令列オブジェクト
@irepid =nil # 命令列オブジェクトのid(JIT用)
### GC.disable # g # gene gc enable : mruby 6170410200 d17506c1
# 5ff9c1d2 : ( irep.rb )
# Assertion failed: ((obj)->tt != MRB_TT_FREE), function mrb_gc_mark, file src/gc.c, line 577.
# ysei/mruby-thread/tree/normal/ 4c02f126
# / mruby-thread/crimsonwoods/tree/experimental-thread-support/
# / mruby/mruby/ 32818bd2 : ( irep.rb )
# Assertion failed: (((mrb)->is_generational_gc_mode) || mrb->gc_state != GC_STATE_NONE),
# function mrb_write_barrier, file src/gc.c, line 1103.
@@Vrb = Vrb.new
end
# include M__PlIni # 310200plini ? # ok ? ( osx10.4/ppc 1koa ) # omoi ? ( osx10.4/ppc 2koa )
# module M__PlIni # osx/ppc http://master.dl.sourceforge.net/project/hpc/OldFiles/gcc-bin.tar.gz#4p3__3.400 #gcc-tiger-bin.tar.gz#4p1__1.400 # cctools-590.36.dmg # Rake : Ruby1.9+/OSX10.4/PPC ?
def plini(rmth = nil, pl = self)
thini = false
thl = MH_THL
# pl0i = [thl[0], thl[1], 'sym', 'ctr']
pl0i = [thl[0], thl[1], :sym, :ctr] # , :hoka]
# 3080410200 : gene gc off : mruby 6170410200 d17506c1
# 3080410200 : 5x2 ng ( segmentation fault ) : mruby 3080410200 0878900f
# 3080410200 : 5x2 ok ( gc ) : monami-ya.mrb 8270410200 813e2af8 # http://www.monami-ya.jp/
# mruby 20410200 : higokan ? : ary_many
# mruby 70410200 : 4x2 ok , 5x2 ng
pl[0] = [[pl0i[0], [thini]], [pl0i[1], [thini]],
[pl0i[2], [0]], [pl0i[3], []]] # , [pl0i[4], []]] # @pla = [['sp', 'ctr']]
# if 1 < self.size # self.size : 0 ?? # higokan ? mruby:70410200 monami-ya.mrb:60510200
# self.replace(0 ... self.size & ((n = rmth + 1) << 1) | n]) # ?? # higokan ? mruby:70410200 monami-ya.mrb:60510200
# self.slice!((self.size & ((n = rmth + 1) << 1) | n) + 1 .. -1) # higokan mruby:70410200 monami-ya.mrb:60510200
pl[1] && pl[0 .. -1] =
pl[0 .. pl.hgt & ((thini = rmth + 1) << 1) | thini]
pl.ref_pl0i
end
# end
# include M__Wkth # higokan ? monami-ya.mrb:60510200 mruby:70410200
class Fls__l
@@fls_m = nil
@@fls_mc = ->(sz) {
@@fls_m = 1 << sz
[((@@fls_m += (@@fls_m <<= 1) + (@@fls_m <<= 2) + (@@fls_m << 2)) >> sz
sz = 1 << @@fls_m = sz
# [((sz += (sz <<= 1) + (sz <<= 2) + (sz << 2)) >> @@fls_m
) + 1 >> 1,
@@fls_mc = nil][0]
}
@@mh_thl = MH_THL # .dup # dup omoi ?
@@i_sp, @@i_sym = nil; @@i_thl = []
def initialize(s, irep, imem, rou, lpl, pc, vrb)
# def initialize(s, irep, imem, rou, lpl, pc, vrb, ap)
@@Vrb = vrb
(
# i_sp = lpl.afl(@pla.assoc('sp')[1], ?i) ## # q
@s = s; @imem = imem; @rou = rou, @lpl = lpl; @pc = pc
@pr, @sym, @mt = nil; @r = []
@sy = nil
@v_ = []
# ap = @f = false; @ji_ngq = [ap, ap]
@f =
ap = false; @ji_ngq = [ap, ap]
# ap = @@fls_m ||= (ap = 1 << @@fls_m = 3; # @@fls_mc.(3) # c
# ((ap += (ap <<= 1) + (ap <<= 2) + (ap << 2)) >> @@fls_m) + 1 >> 1)
ap = @@fls_m ||= @@fls_mc.(3) # c
@pl = []; plr = []
# lm = ->(r1) {r1 && rou.send(@pr, @mt ? irep : s, @r[0], r1, @mt)} # l
lm = ->(r1) { rou.send(@pr, @mt ? irep : s, @r[0], r1, @mt)} # l
mkt = ->(v) {v.nil?} # v[0].nil?} # l
@ca = [
# ->(r, sz = plr.size) { # f
->(sz = plr.size, r = @r) { r = r[1] # f
# ->(r) { r = r[1] # f
# sz = plr.size
# sz = ([r < sz, sz = plr[r]][0] && ! sz.nil?) ? sz : lm.(r) # ) ? _ : lm.(r) # c
sz = plr.fetch(r) { |v| (r >= sz || mkt.(v)) ? lm.(r) : v} # c 2
plr.clear # .slice! .pop(n) .shift(n) higokan monami-ya.mrb:60510200 mruby:70410200
# s[r[1]] = @sy ? [s[r[1]], _].inject(@sy) : _
s[r] = @sy ? [s[r], sz].inject(@sy) : sz
# 0 == m && wo.include?(r) || wo.push(r).sort!
}, # rs = [r1, r0]
->(sz = plr.size, r = @r) { # ji_ngq[0]
## ((sw = sp + sz) + 0xe).step(sw, -1) { # higokan mruby 70410200 # bbab89e7 5211410200 tmtm http://mruby-master-changes.hatenablog.com/entry/2014/11/26/203350
# sz.step(sz + ap = (ap += ap >> 1) >> 1) { |n| @plr<< lm.(s[n])} # p # c
0 == s.size ? Slp.new.slp(0) : ## @Slp.slp(0) :
# @plr += lm.(s[sz, ap = (ap += ap >> 1) >> 1]) # c
# 0 == (as = s.s).size ? Slp.new.slp(0) : ## @Slp.slp(0) :
# sz = plr.size
# as = s[sz, ap = (ap += ap >> 1) >> 1]
# as && @plr += lm.(as) # c
# as = s[sz, (sz = as.size - sz; sz > (ap = (ap += ap >> 1) >> 1) && sz = ap; sz)]
# as && plr += lm.(as) # c
sz = s[sz, (ap = (ap += ap >> 1) >> 1)] && plr += lm.(sz) # + (ap <=> 0)]) # c
# plr<< s.ow?(n) ? nil : lm.(s[n]) # p # c
} # @rs[1] = r[0]
] # .lazy #? mruby 410200
# plb = Plb
# i_th = lpl.afl('th', ?i) # q
# @i_sp = plb.assoc('sp')[1]
# @i_sp = lpl.afl('ctr', ?i) # q
@i_lb = imem.fmli.index('st') # + 1
) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
end
def ca # (pc)
if (ji_ngq = @ji_ngq)[0]
@pr || (pr, @sy = @imem.fml(@i_lb, @sym)
?_ != (@pr = pr)[1] || @mt = pr) # q
# (@ca).force[ #? mruby 410200
# @ca.force[ #? mruby 410200
@ca[
ji_ngq[1] ? 0 : 1].call
### (1 <=> @plr.size) | (ji_ngq[1] ? 0 : 1)].(@plr.size, @r) # c
end
@f
end
def rslt # (pc)
@f && (return true) # r
pc = @pc
lpl = @lpl
pl = @pl
v_ = @v_.dup # .sort # fukusayou kaihi ?
@sym ||= pl[lpl.afl('sym', ?i)].to_sym # q
sp = pl[@@i_sp ||= lpl.afl('ctr', ?i)][0] # q
thl = @@mh_thl
ji_ngq = [v = ! r = []] # , false]
ve = ->{
# case v when Array then ! v.empty? end &&
# @@Vrb.s<< [2, pc, # *v] # p
# *v.map{|v| case v when String then v.chomp else v end}] # fuguai taisaku
# lpl.ckth(v, (3 << (lpl.bfsz << 1)) | 3) && @@Vrb.s<< [2, pc, # *v]) # fuguai taisaku # p
1 == VMD && (0 >= v_.hgt || ! v_.include?(v)) && (v_<< v
lpl.ckth(v, @@bf30 ||= (3 << (lpl.bfsz << 1)) | 3) && # gosadou ? : ckth ( nise-true / osx/ppc )
@@vrb.s[I_V]<< [2, pc, *v] #) # p
# *v.map{|v| knid(v, :String) ? @rou.getarg__(v) : v}] # otiru # fuguai taisaku
## [2, pc, *v.map{|v| knid(v, :String) ? @rou.getarg__(v) : v}] # fuguai taisaku
## "#{(pc).to_xeh} #{getarg__(v[0])} #{v[1].to_xeh}")}
)
}
# r = Array.new(thl.size) { |n| pl[lpl.afl(thl[n], ?i)]} # q
# r = r.map { |v| v[1] = v[-1]} # higokan ? mruby 70410200
(0 ... thl.size).each { |n|
r[n] = (pl[@@i_thl[n] ||= lpl.afl(thl[n], ?i)] || @r[n]) # q # fuguai taisaku
v ||= r[n][1] || [] # @r[n] # true # fuguai taisaku
knid(r[n][0], :Numeric) && r[n] = r[n][0]
}
r[1] = r[0] if case sp when Array then ji_ngq[1] = lpl.ckth(r[1], 2) end
ve.call
# sym, (r0, r1) = rslt pl # higokan mruby 70410200 # bce75e27 2211410200 matz http://mruby-master-changes.hatenablog.com/entry/2014/11/24/114903
@s.p = [sp].flatten[0] if (ji_ngq = (@r = r).map.with_index { |r, n|
# ji_ngq[n] || r && lpl.ckth(r, 1)})[0]
(ji_ngq[n] || r && lpl.ckth(r, 1)) &&
0 == VMD && (v_[n] || (@@Vrb.s[I_V]<< [2, pc]); true)})[0]
verb
# @f ||= (@ji_ngq = ji_ngq).all? || return # r
@f ||= (r = (@ji_ngq = ji_ngq).all?) && (v_.clear; @v_ = v_; r) || return # r
end
def plg # (pc)
@f || ! ((@pl = @lpl.pl_g(@pc + 1)).empty? && @r.empty?) # fuguai taisaku
end
def verb # (pc)
return if @ji_ngq[n = -1] == n # r
## @@Vrb.vrb "#{@pc.to_xeh} #{@sym} #{r[0].to_xeh} #{r[1].to_xeh}"
# @@Vrb.s<< [3, @pc, @sym, *@r] # p
@@Vrb.s[I_V]<< [3, @pc, @sym, *@r] # p
@f && @ji_ngq<< n # p
end
end
def fls(pc) ##
## pl[i_th] = lpl.pl_eg(pc, 'th') ### fls
(
# loc = @@Loc
imem = @Imem
s = Stack.new
s.irep(i = @irepid)
# c_l = Fls__l.new(s, i, imem, @Rou, @pl, loc, sl)
c_l = Fls__l.new(s, i, imem, @Rou, @pl, pc, @@Vrb)
) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
Fiber.new { |m = 1, sl_ = @Slp| loop {sl_.plwt(m) {
m = Fiber.yield(c_l.plg && c_l.rslt && 0 == m && c_l.ca)
}}} ##
end
# include M__RiteOpcodeUtil__Getarg__
# def iset(rg) ##
def iset ##
(
# pc, sp, cop, sym = [rg[:pc], rg[:sp], rg[:cop], rg[:sym]]
# pc, sp, cop, sym = rg.to_ra(:pc, :sp, :cop, :sym)
pc, sp, cop, sym = nil
# pc1 = 1 + pcabs = pc.abs # cp
tb = (TB)
imem = @Imem
pl = @pl
# str__getarg = STR__GETARG
# i_lf = @idx['lf']
i_lb = imem.fmli.index('th') # + 1
loc = @@Loc
sl = @Slp
pc1, pcabs, fml = nil
) # .move # ? # conf.gem :github => 'miura1729/mruby-mmm'
ini = ->(rg = nil) { # l
# ini = ->(pc, sp, cop, sym) { # l
pc, sp, cop, sym = rg
# fml = imem.fml(i_lb, sym) || (
fml = ([sym]<< imem.fml(i_lb, sym)) || ( # p
# printf("Unkown code %s \n", OPTABLE_SYM[imem.get_opcode(cop)])
# printf("Unkown code %s \n", OPTABLE_SYM[@Rou.get_opcode(cop)])
# loc.vrb("Unkown code #{sym} ") # .to_s
return nil
# raise
# rg = Fiber.yield(nil)
)
# fml = [sym]<< fml # p
pc1 = (pcabs = pc.abs) + 1 # cp
}
bt = imem.fml_th_bt
thl = MH_THL
ht = 1
fv = []
vmd = nil
vrb = ->(vrb) { # l # LV__VRB
# @@Vrb.s<< [2, pc, getarg__(vrb[0]), vrb[1]] # p
@@Vrb.s[I_V_]<< [pc, *vrb] if 0 == vmd ||= VMD # p
vrb
}
fvl = [->(oi) {[:ctr, [sp]] + [[:_ctr_s, pc1], []][oi <=> 0]}, # l
# [->(oi) {[thl[oi], imem.ta(fv[oi], cop), thl[oi + 1], tb]}, # l
[->(oi) {[thl[oi], vrb.(imem.ta(fv[oi], cop)), thl[oi + 1], tb]}, # l
->(oi) {((oi <= ht = fv.hgt) && fv[oi] = imem.ta(fv[oi], cop)) ? # l
## [thl[oi], fv[oi]] : []}].lazy] #? mruby 410200
# (vrb.(fv[oi]); [thl[oi], fv[oi]]) : []}]].lazy #? mruby 410200
(vrb.(fv[oi]); [thl[oi], fv[oi]]) : []}]]
opg = ->(oi, lopa = [], i = -1) { # l
# bt[oi].each_slice(2).with_index { |k, i| k, v = k # higokan mruby:70410200 monami-ya.mrb:60510200
bt[oi].each_slice(2) { |k, v| fv = fml[i += 1]
if v # && knid(fv, :Array)
case k
## when 'th' then fv = fvl.(oi) # c
# when 'th' then fv = fvl[1].force[oi <=> 0].(oi) # c #? mruby 410200
# when 'th' then fv = fvl.force[1][oi <=> 0].(oi) # c #? mruby 410200
# when :th then fv = fvl.force[1][oi <=> 0].(oi) # c #? mruby 410200
when :th then fv = fvl[1][oi <=> 0].(oi) # c
else lopa<< k # p
end
lopa.push(*fv)
end
}
# lopa + fvl.force[0].(oi) # c #? mruby 410200
lopa + fvl[0].(oi) # c
}
thi = 0 ##
# Fiber.new { |rg, thi = 0| ## # higokan monami-ya.mrb:60510200 mruby:70410200
Fiber.new { |rg|
# Fiber.new { |rg, m = 0|
loop { ##
# 0.upto(NaN) { |thi| # higokan ? mruby 70410200
# [1].cycle.with_index { |t, thi|
rg && ini.(rg) # c
pl.pl_es(pc1, opg.(thi)) # c
thi += 0 != thi && ht <= thi ? -thi : 1
sl.slp 0
rg = Fiber.yield(0 <= pc ? [true][thi] : ([pcabs][thi] || pc)) # cp
# sp = [sp].flatten
sp = [*sp]
} ##
# pl1[i_lf] += 1
} ##
end
@@jsc = Proc.new { |stack, callinfo, irep, rg, imem|
rou = @@Rou
cop, sym = rg.to_ra(:cop, :sym)
case sym
# メソッドの先頭で引数のセットアップする命令。面倒なので詳細は省略
when :ENTER
# SEND Ra, mid, anumでRaをレシーバにしてシンボルmidの名前のメソッドを
# 呼び出す。ただし、引数はanum個あり、R(a+1), R(a+2)... R(a+anum)が引数
when :SEND
# a = getarg_a(cop)
a = rou.getarg_a(cop)
# mid = @irep.syms[getarg_b(cop)]
mid = irep.syms[rou.getarg_b(cop)]
# n = getarg_c(cop)
n = rou.getarg_c(cop)
# newirep = Irep::get_irep(@stack[@sp + a], mid)
# newirep = Irep::get_irep(@stack[rg[:sp] + a], mid)
newirep = Irep::get_irep(stack[a], mid)
if newirep then
# @callinfo[@cp] = @sp
# callinfo[0] = rg[:sp]
# @cp += 1
# callinfo.p += 1
# @callinfo[@cp] = @pc
# callinfo[0] = rg[:pc]
# @cp += 1
# callinfo.p += 1
# @callinfo[@cp] = @irep
# callinfo[0] = irep
# @cp += 1
# callinfo.p += 1
callinfo.p += (callinfo[0 .. 2] = rg.to_ra(:sp, :pc) << irep).size
# @sp += a
# rg[:sp] += a
rg[:sp, -1] = rg[:sp] + a
# @pc = 0
rg[:pc, -1] = 0
# @irep = newirep
irep = newirep
# @irepid = @irep.id
@irepid = irep.id
# next
else
args = []
n.times do |i|
# args.push @stack[@sp + a + i + 1]
args<< stack[a + i + 1] # p
# args<< stack.getarg_a(i + 1) # p
end
# @stack[@sp + a] = @stack[@sp + a].send(mid, *args)
# @stack[rg[:sp] + a] = @stack[rg[:sp] + a].send(mid, *args)
stack[a] = stack[a].send(mid, *args)
end
# else
# printf("Unkown code %s \n", OPTABLE_SYM[get_opcode(cop)])
# printf("Unkown code %s \n", OPTABLE_SYM[imem.get_opcode(cop)])
end
[callinfo, irep, rg]
}
@@opf = ->(irep, pc) { # l
# 命令コードの取り出し
# cop = @irep.iseq[@pc]
cop = irep.iseq[pc]
# case OPTABLE_SYM[get_opcode(cop)]
# sym = OPTABLE_SYM[get_opcode(cop)]
sym = OPTABLE_SYM[(rou = @@Rou).get_opcode(cop)]
[cop, sym]
}
@@fb = nil
def isfl(rg)
# rg.to_s # fuguai taisaku mruby 70410200
# pc = rg[:pc]
# rgd = rg.dup
# rgd = rg.to_ra(:pc, :sp, :cop, :sym)
rgd = rg
pc = rgd[0]
@@fb ||= iset
fb = @@fb
fl = fls(pc.abs) # if 0 <= pc # cp
Fiber.new { |m = 1, ri = false, rf = false, sl_ = @@Slp|
loop { sl_.slp 0
ri ||= [true == fb.resume(rgd), rgd = nil][0] # .slice! higokan mruby 70410200
(fl.resume(m) && rf = true) if 0 <= m = Fiber.yield(ri && rf) # || 0 <= pc
}
}
end
def eval(irep)
loc = @@Loc
sl = @Slp
ts = @@ts
lpl = @pl
imem = @Imem
stack = @stack
stack.r = rou = @Rou
callinfo = @callinfo
@irep = irep
# @irepid = @irep.id
@irepid = irep.id
ise = [[], []]
pctj = []
pc = @pc
sym = nil
# i_iD = 0; i_iS = 1; i_pc = 0; i_rg = 1; i_fb = 1
i_iD = 0; i_iS = ise.hgt; i_pc = 0; i_rg = 1; i_fb = 1
rg = Rg.new([:pc, [pc]], [:sp, [@sp]], [:cop, []], [:sym, []])
ifj = -> {?J == sym[0]} # l # q
ifs = -> {[:ENTER, :SEND, :RETURN, :NOP].include?(sym)} # l
jm = ->(cop, sym) { # l
# JMP nでpcをnだけ増やす。ただし、nは符号付き
# when :JMP
### @pc = @pc + getarg_sbx(cop)
### pc = pc + lpl.getarg_sbx(cop) - 1
# when :JMPIF
### if @stack[@sp + getarg_a(cop)] then
### @pc = @pc + getarg_sbx(cop)
# stack.getarg_a
# JMPNOT Ra, nでもしRaがnilかfalseならpcをnだけ増やす。ただし、nは符号付き
# when :JMPNOT
### if !@stack[@sp + getarg_a(cop)] then
# ! stack.getarg_a
# end && rg[:pc, -1] = rg[:pc] + rou.getarg_sbx(cop)
c = [:JMP, :JMPIF, :JMPNOT].index(sym) - 1
(0 > c || [true, false].index(stack.getarg_a) == c) &&
rg[:pc, -1] = rg[:pc] + rou.getarg_sbx(cop) # cp
}
jsc = Proc.new {
cop, sym = rg.to_ra(:cop, :sym)
case sym
# RETURN Raで呼び出し元のメソッドに戻る。Raが戻り値になる
when :RETURN
@@Vrb.vrb(true) # fuguai taisaku
# stack.idel(irep)
stack.idel(@irepid)
# if @cp == 0 then
if 0 == callinfo.p
# @rmt.join # higokan ? mruby-thread:410200
# @rmt.each { |rmt| rmt.join} # .alive?
# return @stack[@sp + getarg_a(cop)]
# return stack[rou.getarg_a(cop)]
return stack.getarg_a
else
# @stack[@sp] = @stack[@sp + getarg_a(cop)]
# stack[0] = stack[rou.getarg_a(cop)]
stack[0] = stack.getarg_a
# @cp -= 1
callinfo.p -= 1
# @irep = @callinfo[@cp]
# irep = @callinfo[@cp]
irep = callinfo[0]
# @irepid = @irep.id
@irepid = irep.id
# @cp -= 1
callinfo.p -= 1
# @pc = @callinfo[@cp]
# pc = @callinfo[@cp] - 1
# rg[:pc, -1] = @callinfo[@cp]
rg[:pc, -1] = callinfo[0] + 1
# @cp -= 1
callinfo.p -= 1
# @sp = @callinfo[@cp]
# sp = @callinfo[@cp]
# rg[:sp] = @callinfo[@cp]
# rg[:sp, -1] = @callinfo[@cp]
rg[:sp, -1] = callinfo[0]
end
# 何もしない
when :NOP
sl.slp 0
### GC.disable # g
else
if ifj.call
jm.(cop, sym) # c
else
callinfo, irep, rg = @@jsc.(stack, callinfo, irep, rg, imem) # c
# printf("Unkown code %s \n", OPTABLE_SYM[get_opcode(cop)])
# printf("Unkown code %s \n", OPTABLE_SYM[imem.get_opcode(cop)])
end
end
# [callinfo, irep, rg]
}
pco = []
pcoj = -> { # l
if rg.flgd?
rg.pop :sym
rg.pop :cop; stack.c = rg[:cop]
sl.slp 0
# true
end # || false
}
# @@opg = ->(irep, rg, imem) { # l
opg = ->(pcl) { # l
## c, sym = @@opf.(irep, pcl) # c
rg.push(:cop, stack.c = (sym = @@opf.(irep, pcl))[0]) # c
rg.push(:sym, sym = sym[1])
# rg
}
istm = -> { # l
! if pfl = ise[i_iD].pop
if 0 > pcf = pfl[i_pc]
if ~ pcf == rg[:pc] # cp
pcf = ! pfl[i_pc] = ~ pcf # cp
else
pfl = nil
end
end
pfl && ise[i_iD]<< pfl # p
! pcf
end
}
ist = ->(pcl, po = 0) { # l
ise[i_iS]<< [rg.flgd? ? ~ pcl : pcl, rg.to_ra(:pc, :sp, :cop, :sym)] # p # cp
}
stu = -> { # l
ifj.call || (! sym = ! ifs.call) || # sym hakai # sym = (nifs && nifj) # bagu no moto
pctj.pop != pc && istm.call && ! ist.(pc) # false # c
}
while true
# loop { # higokan ? monami-ya.mrb:60510200 mruby:70410200
# begin
@@Vrb.vrb
# if pco.slice!(0 .. -1) || 0 <= rg['ctr', 1] # higokan monami-ya.mrb:60510200 mruby:70410200
if pco.pop || rg.flge?
opg.(pc) # c
# @@opg.(irep, rg, imem) # c
sym = rg[:sym]
# @@Vrb.vrb "#{pc.to_xeh} #{sym} #{rg[:cop].to_xeh}" if 0 <= rg.p
# @@Vrb.vrb [1, rg[:pc], rg[:sym], rg[:cop]] if 0 <= rg.p
# @@Vrb.s<< [1, pc, sym, rg[:cop]] if 0 <= rg.p # p
@@Vrb.s[I_V]<< [1, pc, sym, rg[:cop]] if rg.flge? # p
@@Vrb.vrb
if [stu.call, ( # sym hakai # bagu no moto
next if pcoj.call)][0] # r
then
sym && pctj<< 1 + pco[0] = pc # p # ifj.call && pctj<<
rg.flgflp # flg_d
# )
end
rg.push(:pc, pc = rg[:pc, -1] + 1)
rg.push(:sp, rg[:sp, -1])
end
if rg.flgd? &&
ise[i_iD].empty? || (0 == ise[i_iD].hgt && 0 > ise[i_iD][-1][i_pc])
# rg.p = 0 > (pt = rg.p) ? ~ pt : pt
# 0 > rg.p && rg.p = ~ rg.p
# 0 > (pt = rg.p) && rg.p = ~ pt
rg.flgflp # flg_e
# lpl.plini
plini(@@rmth, lpl) # 310200plini ?
# lpl.plini(@@rmth) # 410200plini
# callinfo, irep, rg = @@jsc.(stack, callinfo, irep, rg, imem) # c
jsc.call
sl.slp(0, 0xf)
@@Vrb.vrb
end
if rg.flge?
rg.shift(:pc); rg.shift(:sp); rg.shift(:cop); rg.shift(:sym)
@pc = pc = rg[:pc]
@sp = rg[:sp]
stack.p = rg[:sp]
@irep = irep
end
# ise[i_iS].reject! { |pfl| # Inspired by : RobertDoggett ? http://microware.com/# , Professor TAKAZAWA Yosimitu http://mu.ice.uec.ac.jp/~takazawa/
# ise[i_iS].delif_c(ts) { |pfl, n|
ise[i_iS].delif_c { |pfl, n|
ise[i_iD]<< [pfl[i_pc], isfl(pfl[i_rg])] # p
}
# ise[i_iD].reject!.with_index { |fis, n|
# ise[i_iD].delif_c(ts) { |fis, n|
ise[i_iD].delif_c { |fis, n|
fis[i_fb].resume(0 > fis[i_pc] ? -1 : n) # cp
}
sl.slp # {GC.start} # g
end
# ensure
## @rmt.kill # nil ( monami-ya.mrb 60510200 ) , Assertion failed: ((obj)->tt != MRB_TT_FREE), function mrb_gc_mark, file src/gc.c, line 591. ( mruby 70410200 )
### @rmt.join
# @rmt.each(&:kill)
end
end
def fib(n)
if n == 1 then
1
elsif n == 0 then
1
else
fib(n - 1) + fib(n - 2)
end
end
def fibt
fib(20)
end
# GC.stress = true # g
# GC.start # g
a = Irep::get_irep(self, :fibt)
# GC.start # g # antei ?
vm = FibVM.new
# $rmtb = true
p vm.eval(a)
p fibt
--
YAMAGUTIseisei ( str_h__namae = { :sei => "山口" , :mei => "青星" } )
http://hello.to/seisei/ mailto:seiseiATx68k.net phs://81.70.5152.1104/
謝々々々 台湾宮廷料理海味館 名古屋市熊の前二丁目 ( MiniStop 対面 )
# 台湾がアメリカからちょっかい掛けられていた頃に小説ネタとして考えた策 :
#
# A. 国名変更 ( 台湾民族日本州国 )
#
# B. 大政馳走 ( 下渡 / 維持 ) + 大台湾島無血開城 ( ※ 但し 鴻海夏普国ゑ ) ← 中華漁師は台湾籍を名乗れば日本領海 ( 含尖閣 ) で少量漁猟可 ?
# ( 日本からは沖縄県を嫁に出す ( 日本国台湾州沖縄県 ※ 但し 沖縄米軍基地一掃 ( 台湾移設 → 三つ巴の状況を作る為に北●鮮大使館なりを隣接 + 韓国軍基地 + 自●隊基地 )
# → 沖縄県経済策 : 全県民へベーシックインカム )
#
# C. B. + 台湾島各米軍基地傍にコ●壱と●戸屋と個人寿司店と個人拉麺店の出店を大バックアップ ( 謝辞 : 機材提供実績感謝 徳鮨白土店 寿司けん白土店 寿し友司岡崎店 六八鮨鴻海店 )
#
# この小説を何方かご執筆なさっては如何でしょうか ( 顔のない独裁者 2 ? )
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735