summaryrefslogtreecommitdiff
path: root/ext/json/parser/parser.rl
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-11-23 09:51:57 +0100
committerHiroshi SHIBATA <[email protected]>2024-11-26 15:11:05 +0900
commit6805e889354aa0eb6901c2a24c107fded436b4cc (patch)
tree2789fc6d610ac94780d3848746844954de4bec07 /ext/json/parser/parser.rl
parentee0de3fd4e02f95f42fd3fe9cb18bcfe3e7e2bf1 (diff)
[ruby/json] Stop using `rb_gc_mark_locations`
It's using `rb_gc_mark_maybe` under the hood, which isn't what we need. https://github.com/ruby/json/commit/e10d0bffcd
Diffstat (limited to 'ext/json/parser/parser.rl')
-rw-r--r--ext/json/parser/parser.rl24
1 files changed, 8 insertions, 16 deletions
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index eab60b919b..ac9493454d 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -26,19 +26,6 @@ static const char deprecated_create_additions_warning[] =
"and will be removed in 3.0, use JSON.unsafe_load or explicitly "
"pass `create_additions: true`";
-#ifndef HAVE_RB_GC_MARK_LOCATIONS
-// For TruffleRuby
-void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
-{
- VALUE *value = start;
-
- while (value < end) {
- rb_gc_mark(*value);
- value++;
- }
-}
-#endif
-
#ifndef HAVE_RB_HASH_BULK_INSERT
// For TruffleRuby
void rb_hash_bulk_insert(long count, const VALUE *pairs, VALUE hash)
@@ -264,7 +251,10 @@ static inline void rvalue_stack_pop(rvalue_stack *stack, long count)
static void rvalue_stack_mark(void *ptr)
{
rvalue_stack *stack = (rvalue_stack *)ptr;
- rb_gc_mark_locations(stack->ptr, stack->ptr + stack->head);
+ long index;
+ for (index = 0; index < stack->head; index++) {
+ rb_gc_mark(stack->ptr[index]);
+ }
}
static void rvalue_stack_free(void *ptr)
@@ -1349,8 +1339,10 @@ static void JSON_mark(void *ptr)
rb_gc_mark(json->match_string);
rb_gc_mark(json->stack_handle);
- const VALUE *name_cache_entries = &json->name_cache.entries[0];
- rb_gc_mark_locations(name_cache_entries, name_cache_entries + json->name_cache.length);
+ long index;
+ for (index = 0; index < json->name_cache.length; index++) {
+ rb_gc_mark(json->name_cache.entries[index]);
+ }
}
static void JSON_free(void *ptr)