Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit fbcf6e0

Browse files
committed
优化数学表达式的JIT编译逻辑,新增错误处理机制以应对编译失败的情况,提升表达式求值的稳定性。
1 parent 2c6f72d commit fbcf6e0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/interpreter/expression_evaluator.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ impl<'a> Interpreter<'a> {
8585
let jit = jit::get_jit();
8686
if jit.should_compile_math_expression(&key) {
8787
// 尝试编译数学表达式
88-
if let Ok(_compiled) = jit.compile_math_expression(expr, key.clone(), false) {
89-
// 编译成功,将编译结果缓存
90-
// 注意:这里我们暂时返回None,因为实际执行需要更复杂的实现
91-
// 但是编译过程已经被记录在统计中
88+
match jit.compile_math_expression(expr, key.clone(), false) {
89+
Ok(_compiled) => {
90+
// 编译成功,记录在统计中
91+
// 注意:这里我们暂时返回None,因为实际执行需要更复杂的实现
92+
// 但是编译过程已经被记录在统计中
93+
},
94+
Err(_) => {
95+
// 编译失败,继续使用解释执行
96+
}
9297
}
9398
}
9499

0 commit comments

Comments
 (0)