summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yjit/src/codegen.rs1
-rw-r--r--yjit/src/core.rs8
2 files changed, 4 insertions, 5 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 88b51674cf..5f6d97834a 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -877,6 +877,7 @@ pub fn gen_single_block(
// If code for the block doesn't fit, fail
if cb.has_dropped_bytes() || ocb.unwrap().has_dropped_bytes() {
+ free_block(&blockref);
return Err(());
}
diff --git a/yjit/src/core.rs b/yjit/src/core.rs
index 1805a2bb13..3cecf31a85 100644
--- a/yjit/src/core.rs
+++ b/yjit/src/core.rs
@@ -1438,11 +1438,9 @@ fn gen_block_series_body(
if result.is_err() {
// Remove previously compiled block
// versions from the version map
+ mem::drop(last_branch); // end borrow
for blockref in &batch {
- // FIXME: should be deallocating resources here too
- // e.g. invariants, etc.
- //free_block(blockref)
-
+ free_block(blockref);
remove_block_version(blockref);
}
@@ -2010,7 +2008,7 @@ pub fn defer_compilation(
}
// Remove all references to a block then free it.
-fn free_block(blockref: &BlockRef) {
+pub fn free_block(blockref: &BlockRef) {
use crate::invariants::*;
block_assumptions_free(blockref);