Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono][interp] Allocate basic block link array in exponential fashion #98701

Merged
merged 2 commits into from
Feb 21, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
[mono][interp] Use memcpy
  • Loading branch information
BrzVlad committed Feb 21, 2024
commit 00c61256600b8cf26f01710258adff22f6c56d44
6 changes: 2 additions & 4 deletions src/mono/mono/mini/interp/transform-opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1709,8 +1709,7 @@ interp_link_bblocks (TransformData *td, InterpBasicBlock *from, InterpBasicBlock
int new_capacity = get_bb_links_capacity (from->out_count + 1);
if (new_capacity > prev_capacity) {
InterpBasicBlock **newa = (InterpBasicBlock**)mono_mempool_alloc (td->mempool, new_capacity * sizeof (InterpBasicBlock*));
for (i = 0; i < from->out_count; ++i)
newa [i] = from->out_bb [i];
memcpy (newa, from->out_bb, from->out_count * sizeof (InterpBasicBlock*));
from->out_bb = newa;
}
from->out_bb [from->out_count] = to;
Expand All @@ -1729,8 +1728,7 @@ interp_link_bblocks (TransformData *td, InterpBasicBlock *from, InterpBasicBlock
int new_capacity = get_bb_links_capacity (to->in_count + 1);
if (new_capacity > prev_capacity) {
InterpBasicBlock **newa = (InterpBasicBlock**)mono_mempool_alloc (td->mempool, new_capacity * sizeof (InterpBasicBlock*));
for (i = 0; i < to->in_count; ++i)
newa [i] = to->in_bb [i];
memcpy (newa, to->in_bb, to->in_count * sizeof (InterpBasicBlock*));
to->in_bb = newa;
}
to->in_bb [to->in_count] = from;
Expand Down