Skip to content

Commit 005a81b

Browse files
committed
Don't clone types
1 parent 8e26f00 commit 005a81b

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

zjit/src/profile.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,17 @@ fn profile_insn(profiler: &mut Profiler, opcode: ruby_vminsn_type) {
7575
/// Profile the Type of top-`n` stack operands
7676
fn profile_operands(profiler: &mut Profiler, n: usize) {
7777
let payload = get_or_create_iseq_payload(profiler.iseq);
78-
let mut types = if let Some(types) = payload.opnd_types.get(profiler.insn_idx) {
79-
types.clone()
80-
} else {
81-
vec![Empty; n]
82-
};
83-
78+
if payload.opnd_types.len() <= profiler.insn_idx {
79+
payload.opnd_types.resize(profiler.insn_idx+1, vec![]);
80+
}
81+
let types = &mut payload.opnd_types[profiler.insn_idx];
8482
if types.len() <= n {
8583
types.resize(n, Empty);
8684
}
8785
for i in 0..n {
8886
let opnd_type = Type::from_value(profiler.peek_at_stack((n - i - 1) as isize));
8987
types[i] = types[i].union(opnd_type);
9088
}
91-
92-
if payload.opnd_types.len() <= profiler.insn_idx {
93-
payload.opnd_types.resize(profiler.insn_idx+1, vec![]);
94-
}
95-
payload.opnd_types[profiler.insn_idx] = types;
9689
}
9790

9891
/// This is all the data ZJIT stores on an iseq. This will be dynamically allocated by C code

0 commit comments

Comments
 (0)