Skip to content

Commit f6542f6

Browse files
committed
update jit
1 parent e965779 commit f6542f6

9 files changed

Lines changed: 375 additions & 103 deletions

File tree

docs/jit-todo.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,24 @@ Status legend: `[x]` done · `[ ]` todo · `[~]` in progress.
7777
stackless interpreter would not. Verified by `backends_agree_on_cross_function_calls`,
7878
the recursion-fallback `jit_plan` test, and the whole parity corpus under
7979
force-all JIT.
80-
- [x] Float / string ops parity coverage in the generator
81-
(`backends_agree_on_float_programs`, `backends_agree_on_string_programs`):
80+
- [x] Float / string / **bytes** ops parity coverage in the generator
81+
(`backends_agree_on_float_programs`, `_string_programs`, `_bytes_programs`):
8282
division-free float arithmetic + comparisons (result reduced to an `Int` so float
83-
*formatting* isn't the variable under test) and `String.concat`/`String.len`
84-
chains, all three-way. Bytes ops can follow the same pattern next.
83+
*formatting* isn't the variable under test), `String.concat`/`String.len` chains,
84+
and `Bytes.from_string`/`concat`/`slice`/`len` chains — all N-way.
85+
- [x] **Native float parameters**: parameter types are inferred by *unification*
86+
(a float param is typed `Float` from a float-typed operand), so float-parameter
87+
functions compile natively (`backends_agree_on_float_param_function`, 5-way).
88+
Surfaced and fixed a real VM↔compiler gap: a `read`-effect float/`Char` argument
89+
to a user function's by-value `Copy` parameter was being borrowed (`blend(&1.25)`)
90+
against a by-value `f64` — now passed by value (`lower_call_arg_for_callee`).
91+
(Int↔Float casts are intrinsics, so they remain on the fallback path.)
92+
- [x] **`Process` `timeout_ms` enforced by the interpreter** (was parsed-but-ignored,
93+
a gap vs the compiled runtime): `process_run_request` now reads stdout/stderr on
94+
background threads and kills the child past the deadline (`sleep 5` with a 200 ms
95+
timeout ends in ~210 ms).
96+
- [x] Consolidated the last drifted type-name helper, `strip_fresh_type` (4 copies →
97+
one in `text_util`), reconciling `body.rs`'s variant; full checker suite green.
8598

8699
### High performance (the actual JIT) — native (Cranelift) tier
87100
Built behind the `native-jit` cargo feature (off by default, so normal builds

src/checks/body.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::text_util::{split_top_level_type_args, type_arg_names, type_root_name};
1+
use crate::text_util::{split_top_level_type_args, strip_fresh_type, type_arg_names, type_root_name};
22
use std::collections::{HashMap, HashSet};
33

44
use crate::analyzer::Analyzer;
@@ -6411,14 +6411,6 @@ fn stream_item_type(type_name: &str) -> Option<&str> {
64116411
split_top_level_type_args(inner).into_iter().next()
64126412
}
64136413

6414-
fn strip_fresh_type(type_name: &str) -> &str {
6415-
type_name
6416-
.strip_prefix("fresh ")
6417-
.map(str::trim)
6418-
.unwrap_or(type_name)
6419-
}
6420-
6421-
64226414
fn check_resource_pool_lease_stmt(analyzer: &mut Analyzer<'_>, statement: &HirStmt) {
64236415
match statement {
64246416
HirStmt::Let {

src/checks/calls.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::text_util::{split_top_level_type_args, type_arg_names, type_root_name};
1+
use crate::text_util::{split_top_level_type_args, strip_fresh_type, type_arg_names, type_root_name};
22
use std::collections::{HashMap, HashSet};
33

44
use crate::analyzer::Analyzer;
@@ -4504,13 +4504,6 @@ fn check_list_literal_item_expr(
45044504
);
45054505
}
45064506

4507-
fn strip_fresh_type(type_name: &str) -> &str {
4508-
type_name
4509-
.trim()
4510-
.strip_prefix("fresh ")
4511-
.unwrap_or(type_name.trim())
4512-
}
4513-
45144507
fn is_result_type_name(type_name: &str) -> bool {
45154508
type_root_name(type_name) == "Result"
45164509
}

src/checks/local.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::text_util::split_top_level_type_args;
1+
use crate::text_util::{strip_fresh_type, split_top_level_type_args};
22
use std::collections::{HashMap, HashSet, VecDeque};
33

44
use crate::diagnostic::Span;
@@ -2470,13 +2470,6 @@ fn is_fresh_match_scrutinee(expr: &HirExpr) -> bool {
24702470
}
24712471

24722472

2473-
fn strip_fresh_type(type_name: &str) -> &str {
2474-
type_name
2475-
.trim()
2476-
.strip_prefix("fresh ")
2477-
.unwrap_or(type_name.trim())
2478-
}
2479-
24802473
fn hir_expr_ident_name(expr: &HirExpr) -> Option<&str> {
24812474
match expr {
24822475
HirExpr::Ident { name, .. } => Some(name.as_str()),

src/hir.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::text_util::{split_top_level_type_args, type_arg_names, type_root_name};
1+
use crate::text_util::{split_top_level_type_args, strip_fresh_type, type_arg_names, type_root_name};
22
use std::collections::{HashMap, HashSet};
33

44
use crate::diagnostic::Span;
@@ -3267,13 +3267,6 @@ fn type_ref_name(ty: &TypeRef) -> String {
32673267
}
32683268

32693269

3270-
fn strip_fresh_type(type_name: &str) -> &str {
3271-
type_name
3272-
.trim()
3273-
.strip_prefix("fresh ")
3274-
.unwrap_or(type_name.trim())
3275-
}
3276-
32773270
fn record_duplicate_symbol(
32783271
duplicates: &mut Vec<DuplicateSymbol>,
32793272
symbols: &mut HashMap<String, (DuplicateSymbolKind, Span)>,

0 commit comments

Comments
 (0)