From 59ddb88da6bf483eeec7b85b8a85cf3719edf440 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Sun, 6 Dec 2020 15:40:16 +0900 Subject: [PATCH] RB_EC_NEWOBJ_OF NEWOBJ with current ec. --- gc.c | 2 +- internal/gc.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gc.c b/gc.c index ea21e614c8..6f683cba64 100644 --- a/gc.c +++ b/gc.c @@ -2335,7 +2335,7 @@ rb_wb_protected_newobj_of(VALUE klass, VALUE flags) } VALUE -rb_wb_protected_newobj_of_ec(rb_execution_context_t *ec, VALUE klass, VALUE flags) +rb_ec_wb_protected_newobj_of(rb_execution_context_t *ec, VALUE klass, VALUE flags) { GC_ASSERT((flags & FL_WB_PROTECTED) == 0); return newobj_of_cr(rb_ec_ractor_ptr(ec), klass, flags, 0, 0, 0, TRUE); diff --git a/internal/gc.h b/internal/gc.h index 490f42e06a..ed8616d5ac 100644 --- a/internal/gc.h +++ b/internal/gc.h @@ -30,6 +30,12 @@ struct rb_objspace; /* in vm_core.h */ T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \ rb_wb_protected_newobj_of((c), (f) & ~FL_WB_PROTECTED) : \ rb_wb_unprotected_newobj_of((c), (f))) + +#define RB_EC_NEWOBJ_OF(ec, var, T, c, f) \ + T *(var) = (T *)(((f) & FL_WB_PROTECTED) ? \ + rb_ec_wb_protected_newobj_of((ec), (c), (f) & ~FL_WB_PROTECTED) : \ + rb_wb_unprotected_newobj_of((c), (f))) + #define NEWOBJ_OF(var, T, c, f) RB_NEWOBJ_OF((var), T, (c), (f)) #define RB_OBJ_GC_FLAGS_MAX 6 /* used in ext/objspace */ @@ -85,6 +91,7 @@ RUBY_SYMBOL_EXPORT_BEGIN const char *rb_objspace_data_type_name(VALUE obj); VALUE rb_wb_protected_newobj_of(VALUE, VALUE); VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE); +VALUE rb_ec_wb_protected_newobj_of(struct rb_execution_context_struct *ec, VALUE klass, VALUE flags); size_t rb_obj_memsize_of(VALUE); void rb_gc_verify_internal_consistency(void); size_t rb_obj_gc_flags(VALUE, ID[], size_t);