diff --git a/lib/libesp32/berry/src/be_gc.h b/lib/libesp32/berry/src/be_gc.h index 49e311291..1544041de 100644 --- a/lib/libesp32/berry/src/be_gc.h +++ b/lib/libesp32/berry/src/be_gc.h @@ -47,7 +47,7 @@ if (!gc_isconst(o)) { \ #define gc_exmark(o) (((o)->marked >> 4) & 0x0F) #define gc_setexmark(o, k) ((o)->marked |= (k) << 4) -#define be_isgcobj(o) (var_primetype(o) >= BE_GCOBJECT) +#define be_isgcobj(o) (var_primetype(o) >= BE_GCOBJECT && var_primetype(o) < BE_GCOBJECT_MAX) #define be_gcnew(v, t, s) be_newgcobj((v), (t), sizeof(s)) #define set_fixed(s) bbool _was_fixed = be_gc_fix_set(vm, cast(bgcobject*, (s)), 1) diff --git a/lib/libesp32/berry/src/be_object.h b/lib/libesp32/berry/src/be_object.h index 56bf03a9b..d9d777fe4 100644 --- a/lib/libesp32/berry/src/be_object.h +++ b/lib/libesp32/berry/src/be_object.h @@ -21,6 +21,7 @@ #define BE_FUNCTION 6 #define BE_GCOBJECT 16 /* from this type can be gced */ +#define BE_GCOBJECT_MAX (3<<5) /* from this type can't be gced */ #define BE_STRING 16 #define BE_CLASS 17