mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Refactor: Improve Set GC marking and freeing
This commit addresses feedback on the initial Set GC marking implementation. Changes include: - Renamed set marking function to `mrb_gc_mark_set` and updated its return type to `size_t`. - Introduced an explicit `mrb_gc_free_set` function for Set objects. - Updated `gc_mark_children` to use the new mark function signature. - Added an explicit `case MRB_TT_SET:` in `obj_free` to call `mrb_gc_free_set`. - Adjusted `set_get_khash` in `mruby-set` to work with `MRB_TT_SET` directly, rather than relying on `mrb_data_get_ptr`. - Corrected type checks in `set_init_copy` to use `MRB_TT_SET`. - Updated function prototypes in internal headers and stubs in mrbc.
This commit is contained in:
@@ -133,6 +133,10 @@ mrb_value mrb_as_rational(mrb_state *mrb, mrb_value x);
|
||||
void mrb_rational_copy(mrb_state *mrb, mrb_value x, mrb_value y);
|
||||
int mrb_rational_mark(mrb_state *mrb, struct RBasic *rat);
|
||||
#endif
|
||||
#ifdef MRB_USE_SET
|
||||
size_t mrb_gc_mark_set(mrb_state *mrb, struct RBasic *set);
|
||||
void mrb_gc_free_set(mrb_state *mrb, struct RBasic *set);
|
||||
#endif
|
||||
|
||||
#ifdef MRUBY_PROC_H
|
||||
struct RProc *mrb_closure_new(mrb_state*, const mrb_irep*);
|
||||
|
||||
@@ -163,7 +163,8 @@ static const unsigned int IEEE754_INFINITY_BITS_SINGLE = 0x7F800000;
|
||||
f(MRB_TT_COMPLEX, struct RComplex, "Complex") \
|
||||
f(MRB_TT_RATIONAL, struct RRational, "Rational") \
|
||||
f(MRB_TT_BIGINT, struct RBigint, "Integer") \
|
||||
f(MRB_TT_BACKTRACE, struct RBacktrace, "backtrace")
|
||||
f(MRB_TT_BACKTRACE, struct RBacktrace, "backtrace") \
|
||||
f(MRB_TT_SET, struct RData, "Set")
|
||||
|
||||
enum mrb_vtype {
|
||||
#define MRB_VTYPE_DEFINE(tt, type, name) tt,
|
||||
|
||||
Reference in New Issue
Block a user