Feature #10302 ยป 0001-marshal.c-lazy-compat_tbl-allocation.patch
marshal.c | ||
---|---|---|
st_data_t real_obj;
|
||
VALUE klass;
|
||
if (st_lookup(arg->compat_tbl, (st_data_t)obj, &real_obj)) {
|
||
if (arg->compat_tbl &&
|
||
st_lookup(arg->compat_tbl, (st_data_t)obj, &real_obj)) {
|
||
obj = (VALUE)real_obj;
|
||
}
|
||
klass = CLASS_OF(obj);
|
||
... | ... | |
marshal_compat_t *compat = (marshal_compat_t*)compat_data;
|
||
VALUE real_obj = obj;
|
||
obj = compat->dumper(real_obj);
|
||
if (!arg->compat_tbl) {
|
||
arg->compat_tbl = st_init_numtable();
|
||
}
|
||
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
|
||
if (obj != real_obj && !ivtbl) hasiv = 0;
|
||
}
|
||
... | ... | |
arg->symbols = 0;
|
||
st_free_table(arg->data);
|
||
arg->data = 0;
|
||
st_free_table(arg->compat_tbl);
|
||
arg->compat_tbl = 0;
|
||
if (arg->compat_tbl) {
|
||
st_free_table(arg->compat_tbl);
|
||
arg->compat_tbl = 0;
|
||
}
|
||
if (arg->encodings) {
|
||
st_free_table(arg->encodings);
|
||
arg->encodings = 0;
|
||
... | ... | |
arg->symbols = st_init_numtable();
|
||
arg->data = st_init_numtable();
|
||
arg->infection = 0;
|
||
arg->compat_tbl = st_init_numtable();
|
||
arg->compat_tbl = 0;
|
||
arg->encodings = 0;
|
||
arg->str = rb_str_buf_new(0);
|
||
if (!NIL_P(port)) {
|
||
... | ... | |
r_entry0(VALUE v, st_index_t num, struct load_arg *arg)
|
||
{
|
||
st_data_t real_obj = (VALUE)Qundef;
|
||
if (st_lookup(arg->compat_tbl, v, &real_obj)) {
|
||
if (arg->compat_tbl && st_lookup(arg->compat_tbl, v, &real_obj)) {
|
||
st_insert(arg->data, num, (st_data_t)real_obj);
|
||
}
|
||
else {
|
||
... | ... | |
r_fixup_compat(VALUE v, struct load_arg *arg)
|
||
{
|
||
st_data_t data;
|
||
if (st_lookup(arg->compat_tbl, v, &data)) {
|
||
if (arg->compat_tbl && st_lookup(arg->compat_tbl, v, &data)) {
|
||
VALUE real_obj = (VALUE)data;
|
||
rb_alloc_func_t allocator = rb_get_alloc_func(CLASS_OF(real_obj));
|
||
st_data_t key = v;
|
||
... | ... | |
VALUE real_obj = rb_obj_alloc(klass);
|
||
VALUE obj = rb_obj_alloc(compat->oldclass);
|
||
if (oldclass) *oldclass = compat->oldclass;
|
||
if (!arg->compat_tbl) {
|
||
arg->compat_tbl = st_init_numtable();
|
||
}
|
||
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
|
||
return obj;
|
||
}
|
||
... | ... | |
arg->symbols = 0;
|
||
st_free_table(arg->data);
|
||
arg->data = 0;
|
||
st_free_table(arg->compat_tbl);
|
||
arg->compat_tbl = 0;
|
||
if (arg->compat_tbl) {
|
||
st_free_table(arg->compat_tbl);
|
||
arg->compat_tbl = 0;
|
||
}
|
||
}
|
||
/*
|
||
... | ... | |
arg->offset = 0;
|
||
arg->symbols = st_init_numtable();
|
||
arg->data = st_init_numtable();
|
||
arg->compat_tbl = st_init_numtable();
|
||
arg->compat_tbl = 0;
|
||
arg->proc = 0;
|
||
arg->readable = 0;
|
||
-
|