mirror of https://github.com/arendst/Tasmota.git
Merge pull request #13918 from s-hadinger/berry_sync
Berry sync with upstream
This commit is contained in:
commit
b9a34326d6
|
@ -51,7 +51,7 @@ static void class_init(bvm *vm, bclass *c, const bnfuncinfo *lib)
|
|||
++slib;
|
||||
}
|
||||
}
|
||||
be_map_release(vm, c->members); /* clear space */
|
||||
be_map_compact(vm, c->members); /* clear space */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ bclass* be_newclass(bvm *vm, bstring *name, bclass *super)
|
|||
void be_class_compress(bvm *vm, bclass *c)
|
||||
{
|
||||
if (!gc_isconst(c) && c->members) {
|
||||
be_map_release(vm, c->members); /* clear space */
|
||||
be_map_compact(vm, c->members); /* clear space */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ static binstance* newobject(bvm *vm, bclass *c)
|
|||
/* Instanciate new instance from stack with argc parameters */
|
||||
/* Pushes the constructor on the stack to be executed if a construtor is found */
|
||||
/* Returns true if a constructor is found */
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode)
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode)
|
||||
{
|
||||
bvalue init;
|
||||
binstance *obj = newobject(vm, c); /* create empty object hierarchy from class hierarchy */
|
||||
|
|
|
@ -58,7 +58,7 @@ void be_prim_method_bind(bvm *vm, bclass *c, bstring *name, bntvfunc f);
|
|||
void be_closure_method_bind(bvm *vm, bclass *c, bstring *name, bclosure *cl);
|
||||
int be_class_closure_count(bclass *c);
|
||||
void be_class_upvalue_init(bvm *vm, bclass *c);
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int32_t pos, int argc, int mode);
|
||||
bbool be_class_newobj(bvm *vm, bclass *c, int pos, int argc, int mode);
|
||||
int be_instance_member_simple(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
|
||||
int be_instance_member(bvm *vm, binstance *obj, bstring *name, bvalue *dst);
|
||||
int be_class_member(bvm *vm, bclass *obj, bstring *name, bvalue *dst);
|
||||
|
|
|
@ -54,7 +54,7 @@ static int is_object(bvm *vm, const char *class, int idx)
|
|||
}
|
||||
be_remove(vm, -2);
|
||||
}
|
||||
const char *name = be_classname(vm, idx);
|
||||
const char *name = be_classname(vm, -1);
|
||||
bbool ret = !strcmp(name, class);
|
||||
be_pop(vm, 1);
|
||||
return ret;
|
||||
|
|
|
@ -343,7 +343,7 @@ bmapnode* be_map_val2node(bvalue *value)
|
|||
return (bmapnode *)((size_t)value - sizeof(bmapkey));
|
||||
}
|
||||
|
||||
void be_map_release(bvm *vm, bmap *map)
|
||||
void be_map_compact(bvm *vm, bmap *map)
|
||||
{
|
||||
(void)vm;
|
||||
if (!gc_isconst(map)) {
|
||||
|
|
|
@ -56,6 +56,6 @@ bvalue* be_map_insertstr(bvm *vm, bmap *map, bstring *key, bvalue *value);
|
|||
void be_map_removestr(bvm *vm, bmap *map, bstring *key);
|
||||
bmapnode* be_map_next(bmap *map, bmapiter *iter);
|
||||
bmapnode* be_map_val2node(bvalue *value);
|
||||
void be_map_release(bvm *vm, bmap *map);
|
||||
void be_map_compact(bvm *vm, bmap *map);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -99,7 +99,7 @@ static bmodule* new_module(bvm *vm, const bntvmodule *nm)
|
|||
obj->table = NULL; /* gc protection */
|
||||
obj->table = be_map_new(vm);
|
||||
insert_attrs(vm, obj->table, nm);
|
||||
be_map_release(vm, obj->table); /* clear space */
|
||||
be_map_compact(vm, obj->table); /* clear space */
|
||||
be_stackpop(vm, 1);
|
||||
}
|
||||
return obj;
|
||||
|
|
|
@ -42,7 +42,7 @@ static void m_solidify_bvalue(bvm *vm, bvalue * value, const char *classname, co
|
|||
static void m_solidify_map(bvm *vm, bmap * map, const char *class_name)
|
||||
{
|
||||
// compact first
|
||||
be_map_release(vm, map);
|
||||
be_map_compact(vm, map);
|
||||
|
||||
logfmt(" be_nested_map(%i,\n", map->count);
|
||||
|
||||
|
|
|
@ -330,7 +330,6 @@ static bstring* string_range(bvm *vm, bstring *str, binstance *range)
|
|||
{
|
||||
bint lower, upper;
|
||||
bint size = str_len(str); /* size of source string */
|
||||
// bint size = be_data_size(vm, -1); /* get source list size */
|
||||
/* get index range */
|
||||
bvalue temp;
|
||||
be_instance_member(vm, range, be_newstr(vm, "__lower__"), &temp);
|
||||
|
|
|
@ -87,7 +87,7 @@ bvalue* be_global_var(bvm *vm, int index)
|
|||
|
||||
void be_global_release_space(bvm *vm)
|
||||
{
|
||||
be_map_release(vm, global(vm).vtab);
|
||||
be_map_compact(vm, global(vm).vtab);
|
||||
be_vector_release(vm, &global(vm).vlist);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ int be_builtin_new(bvm *vm, bstring *name)
|
|||
|
||||
void be_bulitin_release_space(bvm *vm)
|
||||
{
|
||||
be_map_release(vm, builtin(vm).vtab);
|
||||
be_map_compact(vm, builtin(vm).vtab);
|
||||
be_vector_release(vm, &builtin(vm).vlist);
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -142,7 +142,7 @@
|
|||
_vm->cf->status = PRIM_FUNC; \
|
||||
}
|
||||
|
||||
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode);
|
||||
static void prep_closure(bvm *vm, int pos, int argc, int mode);
|
||||
|
||||
static void attribute_error(bvm *vm, const char *t, bvalue *b, bvalue *c)
|
||||
{
|
||||
|
@ -1186,7 +1186,7 @@ newframe: /* a new call frame */
|
|||
}
|
||||
}
|
||||
|
||||
static void prep_closure(bvm *vm, int32_t pos, int argc, int mode)
|
||||
static void prep_closure(bvm *vm, int pos, int argc, int mode)
|
||||
{
|
||||
bvalue *v, *end;
|
||||
bproto *proto = var2cl(vm->reg + pos)->proto;
|
||||
|
@ -1211,7 +1211,7 @@ static void prep_closure(bvm *vm, int32_t pos, int argc, int mode)
|
|||
}
|
||||
}
|
||||
|
||||
static void do_closure(bvm *vm, int32_t pos, int argc)
|
||||
static void do_closure(bvm *vm, int pos, int argc)
|
||||
{
|
||||
// bvalue *v, *end;
|
||||
// bproto *proto = var2cl(reg)->proto;
|
||||
|
@ -1225,7 +1225,7 @@ static void do_closure(bvm *vm, int32_t pos, int argc)
|
|||
vm_exec(vm);
|
||||
}
|
||||
|
||||
static void do_ntvclos(bvm *vm, int32_t pos, int argc)
|
||||
static void do_ntvclos(bvm *vm, int pos, int argc)
|
||||
{
|
||||
bntvclos *f = var_toobj(vm->reg + pos);
|
||||
push_native(vm, vm->reg + pos, argc, 0);
|
||||
|
@ -1233,7 +1233,7 @@ static void do_ntvclos(bvm *vm, int32_t pos, int argc)
|
|||
ret_native(vm);
|
||||
}
|
||||
|
||||
static void do_ntvfunc(bvm *vm, int32_t pos, int argc)
|
||||
static void do_ntvfunc(bvm *vm, int pos, int argc)
|
||||
{
|
||||
bntvfunc f = var_tontvfunc(vm->reg + pos);
|
||||
push_native(vm, vm->reg + pos, argc, 0);
|
||||
|
@ -1241,7 +1241,7 @@ static void do_ntvfunc(bvm *vm, int32_t pos, int argc)
|
|||
ret_native(vm);
|
||||
}
|
||||
|
||||
static void do_class(bvm *vm, int32_t pos, int argc)
|
||||
static void do_class(bvm *vm, int pos, int argc)
|
||||
{
|
||||
if (be_class_newobj(vm, var_toobj(vm->reg + pos), pos, ++argc, 0)) {
|
||||
be_incrtop(vm);
|
||||
|
@ -1254,7 +1254,7 @@ void be_dofunc(bvm *vm, bvalue *v, int argc)
|
|||
{
|
||||
be_assert(vm->reg <= v && v < vm->stacktop);
|
||||
be_assert(vm->stack <= vm->reg && vm->reg < vm->stacktop);
|
||||
int32_t pos = v - vm->reg;
|
||||
int pos = v - vm->reg;
|
||||
switch (var_type(v)) {
|
||||
case BE_CLASS: do_class(vm, pos, argc); break;
|
||||
case BE_CLOSURE: do_closure(vm, pos, argc); break;
|
||||
|
|
Loading…
Reference in New Issue