Created
January 19, 2025 05:58
-
-
Save miura1729/a79ed0ec0a4305962044d37902092b13 to your computer and use it in GitHub Desktop.
thread.rbの出力結果
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mruby.h> | |
#include <mruby/value.h> | |
#include <mruby/array.h> | |
#include <mruby/hash.h> | |
#include <mruby/throw.h> | |
#include <mruby/proc.h> | |
#include <mruby/string.h> | |
#include <mruby/range.h> | |
#include <mruby/error.h> | |
#include <mruby/variable.h> | |
#include <mruby/throw.h> | |
#include <mruby/data.h> | |
#include <mruby/class.h> | |
#include <math.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdarg.h> | |
#include <pthread.h> | |
#undef mrb_int | |
typedef mrb_float mrb_float2; | |
#define mrb_float_value2(n) ({\ | |
mrb_value rc; \ | |
rc.f = n; \ | |
rc; \ | |
}) | |
#define mmc_boxing_array(src, size, boxing_func) ({ \ | |
mrb_value ary; \ | |
ary = mrb_ary_new_capa(mrb, (size)); \ | |
for (int i = 0; i < (size); i++) { \ | |
mrb_ary_push(mrb, ary, (boxing_func)(mrb, (src)[i])); \ | |
} \ | |
ary; \ | |
}) | |
typedef void *gproc; | |
struct gctab { | |
int size; | |
int csize; | |
int osize; | |
struct gctab *prev; | |
mrb_value **complex; | |
mrb_value **object; | |
void *caller_alloc; | |
int ret_status; | |
mrb_value *single[0]; | |
}; | |
typedef mrb_value mrb_value_mutex; | |
struct mutex_wrapper { | |
pthread_mutex_t mp; | |
}; | |
void mrb_mutex_free(mrb_state *mrb, void *data) | |
{ | |
struct mutex_wrapper *mutex_data = (struct mutex_wrapper *)data; | |
pthread_mutex_destroy(&mutex_data->mp); | |
mrb_free(mrb, data); | |
} | |
mrb_data_type mutex_data_header = {"Mutex Data", mrb_mutex_free}; | |
void mrb_mark_local(mrb_state *mrb) | |
{ | |
struct gctab *curtab = (struct gctab *)mrb->ud; | |
while (curtab) { | |
for (int i = curtab->size; i--;) { | |
if (!mrb_immediate_p(*curtab->single[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->single[i])); | |
} | |
} | |
for (int i = curtab->osize; i--;) { | |
if (!mrb_immediate_p(*curtab->object[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(*curtab->object[i])); | |
} | |
} | |
for (int i = curtab->csize; i--;) { | |
mrb_value *cptr = curtab->complex[i]; | |
for (int j = 0; cptr[j].value.ttt != MRB_TT_FREE; j++) { | |
if (!mrb_immediate_p(cptr[i])) { | |
mrb_gc_mark(mrb, mrb_basic_ptr(cptr[j])); | |
} | |
} | |
} | |
curtab = curtab->prev; | |
} | |
} | |
struct RClass *pthread_class; | |
struct env2 { | |
struct env0 *prev; | |
}; | |
struct env5 { | |
struct env2 *prev; | |
}; | |
struct env8 { | |
struct env2 *prev; | |
}; | |
struct env11 { | |
struct env2 *prev; | |
}; | |
struct env17 { | |
struct env2 *prev; | |
}; | |
struct env12 { | |
struct env2 *prev; | |
}; | |
struct cls0_9 { | |
}; | |
struct cls4_9 { | |
}; | |
struct cls2_9 { | |
}; | |
struct cls6_9 { | |
pthread_t thread; | |
void *argv; | |
void (*thread_func)(void *); | |
}; | |
struct cls7_9 { | |
}; | |
struct cls8_9 { | |
}; | |
struct cls9_9 { | |
}; | |
struct env14 { | |
struct env12 *prev; | |
}; | |
static mrb_value main_Object_0(mrb_state *, mrb_value self,struct gctab *); | |
struct cls4_9 * const0; | |
struct cls2_9 * const1; | |
struct proc12 { | |
int id; | |
void *code[1]; | |
struct env2 *env; | |
mrb_value self; | |
}; | |
static mrb_value foo__Object__1(mrb_state *, mrb_value self,struct gctab *); | |
static mrb_value initialize__Chan__10(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value_mutex a__Chan__11(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value_mutex a__Chan__12(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value b__Chan__13(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value foo__Chan__15(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value b__Chan__16(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_int p12_Object_1_14(mrb_state *, gproc cgproc, mrb_value_mutex v256, mrb_int v257, mrb_value v258, struct gctab *); | |
static mrb_value_mutex a__Chan__17(mrb_state *, mrb_value_mutex self,struct gctab *); | |
static mrb_value_mutex bar__Object__18(mrb_state *, mrb_value self, mrb_value_mutex v1332,struct gctab *); | |
static mrb_value foo__Chan__19(mrb_state *, mrb_value_mutex self,struct gctab *); | |
int main(int argc, char **argv) | |
{ | |
mrb_state *mrb = mrb_open(); | |
struct mrb_jmpbuf c_jmp; | |
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab)); | |
gctab->prev = NULL; | |
gctab->size = 0; | |
gctab->csize = 0; | |
gctab->osize = 0; | |
gctab->ret_status = 0; | |
pthread_class = mrb_define_class(mrb, "Pthread", mrb->object_class); | |
MRB_SET_INSTANCE_TT(pthread_class, MRB_TT_DATA); | |
MRB_TRY(&c_jmp) { | |
mrb->jmp = &c_jmp; | |
main_Object_0(mrb, mrb_top_self(mrb), gctab); | |
} | |
MRB_CATCH(&c_jmp) { | |
mrb_p(mrb, mrb_obj_value(mrb->exc)); | |
return 1; | |
} | |
MRB_END_EXC(&c_jmp); | |
return 0; | |
} | |
static mrb_value main_Object_0(mrb_state *mrb, mrb_value self, struct gctab *prevgctab) { | |
mrb_value v13; | |
mrb_value v17; | |
struct gctab *gctab = prevgctab; | |
L0:; | |
v13 = self; | |
v17 = foo__Object__1(mrb, self, gctab); | |
return v17; | |
} | |
static mrb_value foo__Object__1(mrb_state *mrb, mrb_value self, struct gctab *prevgctab) { | |
struct env2 env; | |
struct REnv *venv = NULL; | |
mrb_value v209; | |
mrb_value_mutex v226; | |
mrb_value_mutex v227;/*snd*/ | |
mrb_value_mutex v229;/*snd*/ | |
mrb_value_mutex v231; | |
mrb_value_mutex v234; | |
mrb_value v869; | |
mrb_value_mutex v235;/*snd*/ | |
mrb_value_mutex v237; | |
mrb_value_mutex v240; | |
mrb_value v872; | |
mrb_value_mutex v241;/*snd*/ | |
mrb_value v243; | |
mrb_value v244; | |
mrb_value v246; | |
mrb_value v1143; | |
mrb_value_mutex v249;/*snd*/ | |
struct proc12 v251; | |
mrb_value vv251; | |
struct cls6_9 * v296; | |
; | |
struct cls6_9 * v297;/*snd*/ | |
mrb_value_mutex v298;/*snd*/ | |
mrb_value v300; | |
mrb_value_mutex v302;/*snd*/ | |
mrb_value v304; | |
mrb_value v306; | |
mrb_value v308; | |
struct cls6_9 * v309;/*snd*/ | |
; | |
struct cls6_9 * v311; | |
char *v313 = "end"; | |
mrb_value v315; | |
int ai = mrb_gc_arena_save(mrb); | |
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 2 * sizeof(mrb_value *)); | |
gctab->prev = prevgctab; | |
gctab->complex = alloca(sizeof(mrb_value *) * 1); | |
gctab->object = NULL; | |
gctab->size = 0; | |
gctab->csize = 0; | |
gctab->osize = 0; | |
gctab->ret_status = 0; | |
L6:; | |
v209 = self; | |
mrb->ud = (void *)gctab; | |
gctab->size = 0; | |
mrb->ud = (void *)gctab; | |
v226 = mrb_nil_value(); | |
gctab->single[0] = &v226; /* conversion */ | |
gctab->size++; | |
v226 = ({ struct mutex_wrapper *mutex = malloc(sizeof(struct mutex_wrapper)); | |
mrb_value mutexobj = mrb_obj_value(mrb_data_object_alloc(mrb, pthread_class, mutex, &mutex_data_header)); | |
pthread_mutex_init(&mutex->mp, NULL); | |
mrb_iv_set(mrb, mutexobj, mrb_intern_cstr(mrb, "@object"), mrb_ary_new_capa(mrb, 0)); | |
mutexobj; | |
}) | |
; | |
for (int i = 0;i < 0; i++) ARY_PTR(mrb_ary_ptr(v226))[i] = mrb_nil_value(); | |
ARY_SET_LEN(mrb_ary_ptr(v226), 0); | |
gctab->size = 0; | |
initialize__Chan__10(mrb, v226, gctab); | |
v227 = v226; | |
mrb_value v228[2] = { | |
}; | |
v228[0].value.ttt = MRB_TT_FREE; | |
v228[1].value.ttt = MRB_TT_FREE; | |
gctab->complex[0] = v228; | |
gctab->csize = 1; | |
v229 = v227; | |
gctab->single[0] = &v227;/* normal */ | |
gctab->size = 1; | |
v231 = a__Chan__11(mrb, v229, gctab); | |
v869 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(v231); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, v231, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
mrb_ary_push(mrb, v869, (mrb_fixnum_value(1))); | |
v234 = v231; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v231)))->mp); | |
v235 = v227; | |
v237 = a__Chan__12(mrb, v235, gctab); | |
v872 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(v237); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, v237, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
mrb_ary_push(mrb, v872, (mrb_fixnum_value(2))); | |
v240 = v237; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v237)))->mp); | |
v241 = v227; | |
v243 = b__Chan__13(mrb, v241, gctab); | |
gctab->single[1] = &v243;/* normal */ | |
gctab->size = 2; | |
mrb->ud = (void *)gctab; | |
v244 = mrb_str_new(mrb, "ab", 2); | |
v1143 = v243; | |
mrb_ary_push(mrb, v1143, v244); | |
v246 = v243; | |
v249 = v227; | |
v251.id = 12; | |
v251.self = self; | |
v251.env = &env; | |
vv251 = ({ | |
mrb_value tmpval[1]; | |
struct RProc *tproc; | |
{ | |
tmpval[0] = ((struct proc12 *)((gproc)&v251))->self; | |
tproc = mrb_proc_new_cfunc_with_env(mrb, ((struct proc12 *)(gproc)&v251)->code, 1, tmpval); | |
venv = tproc->e.env; | |
} | |
mrb_obj_value(tproc); | |
}); | |
{ | |
struct thprocarg296 { | |
mrb_state *mrb; | |
gproc cgproc; | |
mrb_value_mutex v249; | |
mrb_int v250; | |
mrb_value v251; | |
struct gctab *prevgctab; | |
}; | |
struct thprocarg296 *tpargv = malloc(sizeof(struct thprocarg296)); | |
tpargv->mrb = mrb; | |
tpargv->cgproc = (gproc)&vv251; | |
tpargv->v249 = v249; | |
tpargv->v250 = 1; | |
tpargv->v251 = vv251; | |
tpargv->prevgctab = gctab; | |
void *apply_thproc(void *arg) { | |
struct thprocarg296 *tpargv = (struct thprocarg296 *)arg; | |
p12_Object_1_14(tpargv->mrb, tpargv->cgproc, tpargv->v249, tpargv->v250, tpargv->v251, tpargv->prevgctab); | |
return NULL; | |
} | |
v296 = malloc(sizeof(*v296)); | |
v296->argv = tpargv; | |
pthread_create(&v296->thread, NULL, apply_thproc, tpargv); | |
} | |
v297 = v296; | |
v298 = v227; | |
gctab->size = 1; | |
v300 = foo__Chan__15(mrb, v298, gctab); | |
v302 = v227; | |
v304 = b__Chan__16(mrb, v302, gctab); | |
v306 = mrb_ary_pop(mrb, v304); | |
mrb->ud = (void *)gctab; | |
mrb_p(mrb, v306); | |
v308 = v306; | |
v309 = v297; | |
{ | |
void *ret; | |
pthread_join(val, &v309->thread); | |
} | |
mrb->ud = (void *)gctab; | |
mrb->ud = (void *)gctab; | |
mrb_p(mrb, (mrb_str_new_cstr(mrb, "end"))); | |
v315 = (mrb_str_new_cstr(mrb, "end")); | |
mrb_gc_arena_restore(mrb, ai); | |
return mrb_nil_value(); | |
mrb_gc_arena_restore(mrb, ai); | |
} | |
static mrb_value initialize__Chan__10(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env5 env; | |
struct REnv *venv = NULL; | |
mrb_value v584; | |
mrb_value v590; | |
mrb_value v591; | |
int ai = mrb_gc_arena_save(mrb); | |
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 2 * sizeof(mrb_value *)); | |
gctab->prev = prevgctab; | |
gctab->complex = NULL; | |
gctab->object = NULL; | |
gctab->size = 0; | |
gctab->csize = 0; | |
gctab->osize = 0; | |
gctab->ret_status = 0; | |
L18:; | |
v584 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
{ | |
mrb_value tmpele[] = { | |
}; | |
gctab->size = 0; | |
mrb->ud = (void *)gctab; | |
v590 = mrb_nil_value(); | |
gctab->single[0] = &v590; /* conversion */ | |
gctab->size++; | |
mrb_value array = mrb_ary_new_from_values(mrb, 0, tmpele); | |
v590 = array; | |
ARY_SET_LEN(mrb_ary_ptr(array), 0); | |
} | |
mrb->ud = (void *)gctab; | |
{mrb_value_mutex val; | |
val = ({ struct mutex_wrapper *mutex = malloc(sizeof(struct mutex_wrapper)); | |
mrb_value mutexobj = mrb_obj_value(mrb_data_object_alloc(mrb, pthread_class, mutex, &mutex_data_header)); | |
pthread_mutex_init(&mutex->mp, NULL); | |
mrb_iv_set(mrb, mutexobj, mrb_intern_cstr(mrb, "@object"), v590); | |
mutexobj; | |
}) | |
; | |
ARY_PTR(mrb_ary_ptr(v584))[0] = val; | |
mrb_field_write_barrier_value(mrb, (struct RBasic*)mrb_ary_ptr(v584), val); | |
} | |
{ | |
mrb_value tmpele[] = { | |
}; | |
mrb->ud = (void *)gctab; | |
v591 = mrb_nil_value(); | |
gctab->single[1] = &v591; /* conversion */ | |
gctab->size++; | |
mrb_value array = mrb_ary_new_from_values(mrb, 0, tmpele); | |
v591 = array; | |
ARY_SET_LEN(mrb_ary_ptr(array), 0); | |
} | |
{mrb_value val; | |
val = v591; | |
ARY_PTR(mrb_ary_ptr(v584))[1] = val; | |
mrb_field_write_barrier_value(mrb, (struct RBasic*)mrb_ary_ptr(v584), val); | |
} | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v584)))->mp); | |
mrb_gc_arena_restore(mrb, ai); | |
return v591; | |
mrb_gc_arena_restore(mrb, ai); | |
} | |
static mrb_value_mutex a__Chan__11(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env8 env; | |
struct REnv *venv = NULL; | |
mrb_value v861; | |
mrb_value_mutex v867; | |
struct gctab *gctab = prevgctab; | |
L29:; | |
v861 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
v867 = ARY_PTR(mrb_ary_ptr(v861))[0]; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v861)))->mp); | |
return v867; | |
} | |
static mrb_value_mutex a__Chan__12(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env8 env; | |
struct REnv *venv = NULL; | |
mrb_value v861; | |
mrb_value_mutex v867; | |
struct gctab *gctab = prevgctab; | |
L29:; | |
v861 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
v867 = ARY_PTR(mrb_ary_ptr(v861))[0]; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v861)))->mp); | |
return v867; | |
} | |
static mrb_value b__Chan__13(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env11 env; | |
struct REnv *venv = NULL; | |
mrb_value v1135; | |
mrb_value v1141; | |
struct gctab *gctab = prevgctab; | |
L40:; | |
v1135 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
v1141 = ARY_PTR(mrb_ary_ptr(v1135))[1]; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v1135)))->mp); | |
return v1141; | |
} | |
static mrb_value foo__Chan__15(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env17 env; | |
struct REnv *venv = NULL; | |
mrb_value v1607; | |
mrb_value v1614; | |
int ai = mrb_gc_arena_save(mrb); | |
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 1 * sizeof(mrb_value *)); | |
gctab->prev = prevgctab; | |
gctab->complex = NULL; | |
gctab->object = NULL; | |
gctab->size = 0; | |
gctab->csize = 0; | |
gctab->osize = 0; | |
gctab->ret_status = 0; | |
L57:; | |
v1607 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
{ | |
mrb_value tmpele[] = { | |
(mrb_symbol_value(mrb_intern_lit(mrb, "a"))) | |
}; | |
gctab->size = 0; | |
mrb->ud = (void *)gctab; | |
v1614 = mrb_nil_value(); | |
gctab->single[0] = &v1614; /* conversion */ | |
gctab->size++; | |
mrb_value array = mrb_ary_new_from_values(mrb, 1, tmpele); | |
v1614 = array; | |
ARY_SET_LEN(mrb_ary_ptr(array), 1); | |
} | |
mrb->ud = (void *)gctab; | |
{mrb_value_mutex val; | |
val = ({ struct mutex_wrapper *mutex = malloc(sizeof(struct mutex_wrapper)); | |
mrb_value mutexobj = mrb_obj_value(mrb_data_object_alloc(mrb, pthread_class, mutex, &mutex_data_header)); | |
pthread_mutex_init(&mutex->mp, NULL); | |
mrb_iv_set(mrb, mutexobj, mrb_intern_cstr(mrb, "@object"), v1614); | |
mutexobj; | |
}) | |
; | |
ARY_PTR(mrb_ary_ptr(v1607))[0] = val; | |
mrb_field_write_barrier_value(mrb, (struct RBasic*)mrb_ary_ptr(v1607), val); | |
} | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v1607)))->mp); | |
mrb_gc_arena_restore(mrb, ai); | |
return v1614; | |
mrb_gc_arena_restore(mrb, ai); | |
} | |
static mrb_value b__Chan__16(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env11 env; | |
struct REnv *venv = NULL; | |
mrb_value v1135; | |
mrb_value v1141; | |
struct gctab *gctab = prevgctab; | |
L40:; | |
v1135 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
v1141 = ARY_PTR(mrb_ary_ptr(v1135))[1]; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v1135)))->mp); | |
return v1141; | |
} | |
static mrb_int p12_Object_1_14(mrb_state *mrb, gproc cgproc, mrb_value_mutex v256, mrb_int v257, mrb_value v258, struct gctab *prevgctab) { | |
struct proc12 *proc = (struct proc12 *)cgproc; | |
mrb_value self = proc->self; | |
struct env12 env; | |
struct REnv *venv = NULL; | |
mrb_value v264; | |
mrb_value_mutex v265; | |
mrb_int v266; | |
mrb_value v267; | |
mrb_value_mutex v280; | |
mrb_int v282; | |
mrb_value_mutex v287; | |
mrb_value v290; | |
mrb_int v294; | |
struct gctab *gctab = prevgctab; | |
env.prev = proc->env; | |
L7:; | |
v264 = self; | |
v265 = v256; | |
v266 = v257; | |
v267 = v258; | |
v280 = a__Chan__17(mrb, v265, gctab); | |
v282 = (mrb_fixnum(mrb_ary_pop(mrb, ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(v280); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, v280, mrb_intern_cstr(mrb, "@object")); | |
}) | |
))); | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v280)))->mp); | |
v287 = bar__Object__18(mrb, self, v265, gctab); | |
v290 = foo__Chan__19(mrb, v265, gctab); | |
mrb->ud = (void *)gctab; | |
mrb_p(mrb, (mrb_fixnum_value(v282))); | |
v294 = (mrb_fixnum((mrb_fixnum_value(v282)))); | |
return v294; | |
} | |
static mrb_value_mutex a__Chan__17(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env8 env; | |
struct REnv *venv = NULL; | |
mrb_value v861; | |
mrb_value_mutex v867; | |
struct gctab *gctab = prevgctab; | |
L29:; | |
v861 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
v867 = ARY_PTR(mrb_ary_ptr(v861))[0]; | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v861)))->mp); | |
return v867; | |
} | |
static mrb_value_mutex bar__Object__18(mrb_state *mrb, mrb_value self, mrb_value_mutex v1332, struct gctab *prevgctab) { | |
struct env14 env; | |
struct REnv *venv = NULL; | |
mrb_value v1336; | |
mrb_value_mutex v1337; | |
struct gctab *gctab = prevgctab; | |
L46:; | |
v1336 = self; | |
v1337 = v1332; | |
return v1337; | |
} | |
static mrb_value foo__Chan__19(mrb_state *mrb, mrb_value_mutex self, struct gctab *prevgctab) { | |
struct env17 env; | |
struct REnv *venv = NULL; | |
mrb_value v1607; | |
mrb_value v1614; | |
int ai = mrb_gc_arena_save(mrb); | |
struct gctab *gctab = (struct gctab *)alloca(sizeof(struct gctab) + 1 * sizeof(mrb_value *)); | |
gctab->prev = prevgctab; | |
gctab->complex = NULL; | |
gctab->object = NULL; | |
gctab->size = 0; | |
gctab->csize = 0; | |
gctab->osize = 0; | |
gctab->ret_status = 0; | |
L57:; | |
v1607 = ({ | |
struct mutex_wrapper *mutex = (struct mutex_wrapper *)DATA_PTR(self); | |
pthread_mutex_lock(&mutex->mp); | |
mrb_iv_get(mrb, self, mrb_intern_cstr(mrb, "@object")); | |
}) | |
; | |
{ | |
mrb_value tmpele[] = { | |
(mrb_symbol_value(mrb_intern_lit(mrb, "a"))) | |
}; | |
gctab->size = 0; | |
mrb->ud = (void *)gctab; | |
v1614 = mrb_nil_value(); | |
gctab->single[0] = &v1614; /* conversion */ | |
gctab->size++; | |
mrb_value array = mrb_ary_new_from_values(mrb, 1, tmpele); | |
v1614 = array; | |
ARY_SET_LEN(mrb_ary_ptr(array), 1); | |
} | |
mrb->ud = (void *)gctab; | |
{mrb_value_mutex val; | |
val = ({ struct mutex_wrapper *mutex = malloc(sizeof(struct mutex_wrapper)); | |
mrb_value mutexobj = mrb_obj_value(mrb_data_object_alloc(mrb, pthread_class, mutex, &mutex_data_header)); | |
pthread_mutex_init(&mutex->mp, NULL); | |
mrb_iv_set(mrb, mutexobj, mrb_intern_cstr(mrb, "@object"), v1614); | |
mutexobj; | |
}) | |
; | |
ARY_PTR(mrb_ary_ptr(v1607))[0] = val; | |
mrb_field_write_barrier_value(mrb, (struct RBasic*)mrb_ary_ptr(v1607), val); | |
} | |
pthread_mutex_unlock(&((struct mutex_wrapper *)(DATA_PTR(v1607)))->mp); | |
mrb_gc_arena_restore(mrb, ai); | |
return v1614; | |
mrb_gc_arena_restore(mrb, ai); | |
} | |
/* | |
Class Object | |
Instance variables | |
methodes | |
foo (Object e=false, NilClass e=false l=0 var=0) -> Literal NilClass | |
-- effects --- | |
modify push [[Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>]] | |
modify push [[Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>]] | |
modify push [[Array<[:undef] => String val="ab" e=true|1 => String val="ab" e=true> e=true l=4]] | |
modify pop [[Array<[:undef] => String val="ab" e=true|1 => String val="ab" e=true> e=true l=4]] | |
bar (Object e=false, Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Chan e=true l=3 var=0> | |
bar (Object e=false, Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0>|Mutex<Chan e=true l=3 var=0> | |
-- effects --- | |
p (Object e=false, Fixnum e=false pos =true, NilClass e=false l=0 var=0) -> Fixnum e=false pos =true | |
p (Object e=false, String e=true, NilClass e=false l=0 var=0) -> Fixnum e=false pos =true|String e=true | |
p (Object e=false, String e=false, NilClass e=false l=0 var=0) -> Fixnum e=false pos =true|String e=false l=0 var=0 | |
-- effects --- | |
Class Chan | |
Instance variables | |
@a: Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=5|Array<> e=true l=4|Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=8|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4> | |
@b: Array<[:undef] => String e=true|1 => String e=true> e=true l=4|Array<> e=true l=4 | |
methodes | |
initialize (Mutex<Chan e=false l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => String e=true|1 => String e=true> e=true l=4 | |
initialize (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => String e=true|1 => String e=true> e=true l=4 | |
initialize (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<> e=true l=4 | |
-- effects --- | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
iv_write @a SETIV 2 2 | |
iv_write @b SETIV 1 1 | |
a (Mutex<Chan e=false l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4> | |
a (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4> | |
a (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=5|Array<> e=true l=4|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4> | |
a (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=5|Array<> e=true l=4|Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=8|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4>|Mutex<Array<[:undef] => Fixnum e=false pos =true|1 => Fixnum e=false pos =true> e=true l=4> | |
-- effects --- | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
iv_read @a GETIV 2 2 | |
b (Mutex<Chan e=false l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => String e=true|1 => String e=true> e=true l=4 | |
b (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => String e=true|1 => String e=true> e=true l=4 | |
b (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => String e=true|1 => String e=true> e=true l=4|Array<> e=true l=4 | |
-- effects --- | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
iv_read @b GETIV 1 1 | |
foo (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=5 | |
foo (Mutex<Chan e=true l=3 var=0>, NilClass e=false l=0 var=0) -> Array<[:undef] => Symbol(:a)|0 => Symbol(:a)> e=true l=8 | |
-- effects --- | |
iv_write @a SETIV 2 2 | |
iv_write @a SETIV 2 2 | |
iv_write @a SETIV 2 2 | |
iv_write @a SETIV 2 2 | |
iv_write @a SETIV 2 2 | |
iv_write @a SETIV 2 2 | |
Class #<Class:MMC_EXT> | |
Instance variables | |
methodes | |
Module Kernel | |
Instance variables | |
methodes | |
Class #<Class:Chan> | |
Instance variables | |
methodes | |
Class MMC_EXT::Mutex | |
Instance variables | |
methodes | |
Class MMC_EXT::Thread | |
Instance variables | |
methodes | |
Class #<Class:MMC_EXT::Thread> | |
Instance variables | |
methodes | |
Class Fixnum | |
Instance variables | |
methodes | |
Class String | |
Instance variables | |
methodes | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment