Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ jobs:
key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }}

- name: Install libraries with vcpkg
id: build-vcpkg
run: |
git -C "%VCPKG_INSTALLATION_ROOT%" pull --quiet
vcpkg install
Expand All @@ -106,7 +107,13 @@ jobs:
with:
path: src\vcpkg_installed
key: windows-${{ matrix.os }}-vcpkg-${{ hashFiles('src/vcpkg.json') }}
if: ${{ ! steps.restore-vcpkg.outputs.cache-hit && (github.ref_name == 'master' || startsWith(github.ref_name, 'ruby_')) }}
if: >-
steps.build-vcpkg.outcome == 'success' &&
( github.ref_name == 'master'
|| startsWith(github.ref_name, 'ruby_')
|| ( github.event.pull_request.user.login == 'dependabot[bot]'
&& startsWith(github.head_ref || github.ref_name, 'dependabot/vcpkg'))
)

- name: setup env
# Available Ruby versions: https://github.com/actions/runner-images/blob/main/images/windows/Windows2019-Readme.md#ruby
Expand Down
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ releases.
* minitest 6.0.6
* rake 13.4.2
* 13.3.1 to [v13.4.0][rake-v13.4.0], [v13.4.1][rake-v13.4.1], [v13.4.2][rake-v13.4.2]
* test-unit 3.7.7
* 3.7.5 to [3.7.6][test-unit-3.7.6], [3.7.7][test-unit-3.7.7]
* test-unit 3.7.8
* 3.7.5 to [3.7.6][test-unit-3.7.6], [3.7.7][test-unit-3.7.7], [3.7.8][test-unit-3.7.8]
* net-imap 0.6.4
* 0.6.2 to [v0.6.3][net-imap-v0.6.3], [v0.6.4][net-imap-v0.6.4]
* rbs 4.0.2
Expand Down Expand Up @@ -242,6 +242,7 @@ A lot of work has gone into making Ractors more stable, performant, and usable.
[rake-v13.4.2]: https://github.com/ruby/rake/releases/tag/v13.4.2
[test-unit-3.7.6]: https://github.com/test-unit/test-unit/releases/tag/3.7.6
[test-unit-3.7.7]: https://github.com/test-unit/test-unit/releases/tag/3.7.7
[test-unit-3.7.8]: https://github.com/test-unit/test-unit/releases/tag/3.7.8
[net-imap-v0.6.3]: https://github.com/ruby/net-imap/releases/tag/v0.6.3
[net-imap-v0.6.4]: https://github.com/ruby/net-imap/releases/tag/v0.6.4
[rbs-v3.10.1]: https://github.com/ruby/rbs/releases/tag/v3.10.1
Expand Down
4 changes: 4 additions & 0 deletions ext/json/generator/generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,11 @@ static void State_compact(void *ptr)

static size_t State_memsize(const void *ptr)
{
#ifdef HAVE_RUBY_TYPED_EMBEDDABLE
return 0;
#else
return sizeof(JSON_Generator_State);
#endif
}

static const rb_data_type_t JSON_Generator_State_type = {
Expand Down
49 changes: 41 additions & 8 deletions ext/json/parser/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static void rvalue_stack_mark(void *ptr)
long index;
if (stack && stack->ptr) {
for (index = 0; index < stack->head; index++) {
rb_gc_mark(stack->ptr[index]);
rb_gc_mark_movable(stack->ptr[index]);
}
}
}
Expand All @@ -268,7 +268,22 @@ static void rvalue_stack_free(void *ptr)
static size_t rvalue_stack_memsize(const void *ptr)
{
const rvalue_stack *stack = (const rvalue_stack *)ptr;
return sizeof(rvalue_stack) + sizeof(VALUE) * stack->capa;
size_t memsize = sizeof(VALUE) * stack->capa;
#ifndef HAVE_RUBY_TYPED_EMBEDDABLE
memsize += sizeof(rvalue_stack);
#endif
return memsize;
}

static void rvalue_stack_compact(void *ptr)
{
rvalue_stack *stack = (rvalue_stack *)ptr;
long index;
if (stack && stack->ptr) {
for (index = 0; index < stack->head; index++) {
stack->ptr[index] = rb_gc_location(stack->ptr[index]);
}
}
}

static const rb_data_type_t JSON_Parser_rvalue_stack_type = {
Expand All @@ -277,6 +292,7 @@ static const rb_data_type_t JSON_Parser_rvalue_stack_type = {
.dmark = rvalue_stack_mark,
.dfree = rvalue_stack_free,
.dsize = rvalue_stack_memsize,
.dcompact = rvalue_stack_compact,
},
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_EMBEDDABLE,
};
Expand Down Expand Up @@ -452,7 +468,12 @@ static void json_frame_stack_free(void *ptr)
static size_t json_frame_stack_memsize(const void *ptr)
{
const json_frame_stack *stack = (const json_frame_stack *)ptr;
return sizeof(json_frame_stack) + sizeof(json_frame) * stack->capa;

size_t memsize = sizeof(json_frame) * stack->capa;
#ifndef HAVE_RUBY_TYPED_EMBEDDABLE
memsize += sizeof(json_frame_stack);
#endif
return memsize;
}

static const rb_data_type_t JSON_Parser_frame_stack_type = {
Expand Down Expand Up @@ -1955,21 +1976,33 @@ static VALUE cParser_m_parse(VALUE klass, VALUE Vsource, VALUE opts)
static void JSON_ParserConfig_mark(void *ptr)
{
JSON_ParserConfig *config = ptr;
rb_gc_mark(config->on_load_proc);
rb_gc_mark(config->decimal_class);
rb_gc_mark_movable(config->on_load_proc);
rb_gc_mark_movable(config->decimal_class);
}

static size_t JSON_ParserConfig_memsize(const void *ptr)
{
#ifdef HAVE_RUBY_TYPED_EMBEDDABLE
return 0;
#else
return sizeof(JSON_ParserConfig);
#endif
}

static void JSON_ParserConfig_compact(void *ptr)
{
JSON_ParserConfig *config = ptr;
config->on_load_proc = rb_gc_location(config->on_load_proc);
config->decimal_class = rb_gc_location(config->decimal_class);
}

static const rb_data_type_t JSON_ParserConfig_type = {
.wrap_struct_name = "JSON::Ext::Parser/ParserConfig",
.function = {
JSON_ParserConfig_mark,
RUBY_DEFAULT_FREE,
JSON_ParserConfig_memsize,
.dmark = JSON_ParserConfig_mark,
.dfree = RUBY_DEFAULT_FREE,
.dsize = JSON_ParserConfig_memsize,
.dcompact = JSON_ParserConfig_compact,
},
.flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE | RUBY_TYPED_EMBEDDABLE,
};
Expand Down
2 changes: 1 addition & 1 deletion gems/bundled_gems
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
minitest 6.0.6 https://github.com/minitest/minitest
power_assert 3.0.1 https://github.com/ruby/power_assert
rake 13.4.2 https://github.com/ruby/rake
test-unit 3.7.7 https://github.com/test-unit/test-unit
test-unit 3.7.8 https://github.com/test-unit/test-unit
rexml 3.4.4 https://github.com/ruby/rexml
rss 0.3.2 https://github.com/ruby/rss
net-imap 0.6.4 https://github.com/ruby/net-imap
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"openssl",
"zlib"
],
"builtin-baseline": "56bb2411609227288b70117ead2c47585ba07713"
"builtin-baseline": "f3e10653cc27d62a37a3763cd84b38bca07c6075"
}