JIT lower/builder リファクタリング: モジュール分割による整理
## 🔧 builder.rs のモジュール分割 - noop.rs: NoopBuilder実装を独立モジュールへ - object.rs: ObjectBuilderの実装を分離 - rt_shims.rs: ランタイムシムパス関連を整理 ## 目的 - 2000行超のbuilder.rsを責務単位で分割 - 可読性とメンテナンス性の向上 - 各ビルダー実装の独立性を確保 ChatGPT5による大規模リファクタリング作業の一環 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
34
src/jit/lower/builder/noop.rs
Normal file
34
src/jit/lower/builder/noop.rs
Normal file
@ -0,0 +1,34 @@
|
||||
use super::{IRBuilder, BinOpKind, CmpKind, ParamKind};
|
||||
|
||||
pub struct NoopBuilder {
|
||||
pub consts: usize,
|
||||
pub binops: usize,
|
||||
pub cmps: usize,
|
||||
pub branches: usize,
|
||||
pub rets: usize,
|
||||
}
|
||||
|
||||
impl NoopBuilder {
|
||||
pub fn new() -> Self { Self { consts: 0, binops: 0, cmps: 0, branches: 0, rets: 0 } }
|
||||
}
|
||||
|
||||
impl IRBuilder for NoopBuilder {
|
||||
fn begin_function(&mut self, _name: &str) {}
|
||||
fn end_function(&mut self) {}
|
||||
fn emit_param_i64(&mut self, _index: usize) { self.consts += 1; }
|
||||
fn emit_const_i64(&mut self, _val: i64) { self.consts += 1; }
|
||||
fn emit_const_f64(&mut self, _val: f64) { self.consts += 1; }
|
||||
fn emit_binop(&mut self, _op: BinOpKind) { self.binops += 1; }
|
||||
fn emit_compare(&mut self, _op: CmpKind) { self.cmps += 1; }
|
||||
fn emit_jump(&mut self) { self.branches += 1; }
|
||||
fn emit_branch(&mut self) { self.branches += 1; }
|
||||
fn emit_return(&mut self) { self.rets += 1; }
|
||||
fn emit_select_i64(&mut self) { self.binops += 1; }
|
||||
fn emit_host_call_typed(&mut self, _symbol: &str, _params: &[ParamKind], has_ret: bool, _ret_is_f64: bool) { if has_ret { self.consts += 1; } }
|
||||
fn emit_plugin_invoke(&mut self, _type_id: u32, _method_id: u32, _argc: usize, has_ret: bool) { if has_ret { self.consts += 1; } }
|
||||
fn emit_plugin_invoke_by_name(&mut self, _method: &str, _argc: usize, has_ret: bool) { if has_ret { self.consts += 1; } }
|
||||
fn ensure_local_i64(&mut self, _index: usize) { }
|
||||
fn store_local_i64(&mut self, _index: usize) { self.consts += 1; }
|
||||
fn load_local_i64(&mut self, _index: usize) { self.consts += 1; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user