chore: 未使用インポートの削除と軽微な警告修正
This commit is contained in:
@ -11,11 +11,10 @@
|
||||
* Behavior and public APIs are preserved. This is a pure move/refactor.
|
||||
*/
|
||||
|
||||
use crate::mir::{MirModule, MirFunction, MirInstruction, ValueId, BasicBlockId};
|
||||
use crate::mir::{MirModule, MirFunction, MirInstruction, BasicBlockId};
|
||||
use crate::box_trait::NyashBox;
|
||||
use super::{vm::VM, vm::VMError, vm::VMValue};
|
||||
use crate::backend::vm_control_flow::ControlFlow;
|
||||
use std::sync::Arc;
|
||||
|
||||
impl VM {
|
||||
/// Execute a MIR module
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* - Debug prints for roots snapshot and shallow reachability
|
||||
*/
|
||||
|
||||
use super::vm::{VM, VMError, VMValue};
|
||||
use super::vm::{VM, VMValue};
|
||||
|
||||
impl VM {
|
||||
/// Enter a GC root region and return a guard that leaves on drop
|
||||
@ -96,4 +96,3 @@ impl VM {
|
||||
eprintln!("[GC] depth2_children: total={} top5={:?}", child_count, top);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
use crate::mir::ValueId;
|
||||
use std::sync::Arc;
|
||||
use crate::backend::vm::ControlFlow;
|
||||
use crate::backend::{VM, VMError, VMValue};
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use clap::{Arg, ArgAction, Command, value_parser};
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use std::fs::{self, File};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::io::{self, Read};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command as PCommand, Stdio};
|
||||
|
||||
@ -117,11 +117,12 @@ fn current_dir_bin(name: &str) -> PathBuf {
|
||||
}
|
||||
}
|
||||
// Fallback to target/release
|
||||
let mut cand = PathBuf::from("target/release").join(name);
|
||||
let cand = PathBuf::from("target/release").join(name);
|
||||
if cand.exists() { return cand; }
|
||||
#[cfg(windows)]
|
||||
{
|
||||
cand = PathBuf::from("target/release").join(format!("{}.exe", name));
|
||||
let cand = PathBuf::from("target/release").join(format!("{}.exe", name));
|
||||
return cand;
|
||||
}
|
||||
cand
|
||||
}
|
||||
|
||||
1
src/jit/extern/result.rs
vendored
1
src/jit/extern/result.rs
vendored
@ -1,5 +1,6 @@
|
||||
//! Result-related JIT extern symbols
|
||||
|
||||
#[cfg(feature = "cranelift-jit")]
|
||||
use crate::box_trait::NyashBox;
|
||||
|
||||
/// Symbol name for wrapping a handle into Result.Ok(handle)
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
pub fn dump_cfg_dot(func: &crate::mir::MirFunction, path: &str, phi_min: bool) -> std::io::Result<()> {
|
||||
use std::io::Write;
|
||||
let mut out = String::new();
|
||||
out.push_str(&format!("digraph \"{}\" {{\n", func.signature.name));
|
||||
out.push_str(" node [shape=box, fontsize=10];\n");
|
||||
|
||||
@ -15,7 +15,7 @@ impl LowerCore {
|
||||
// Copied logic from core.rs PluginInvoke arm (scoped to PyRuntimeBox path)
|
||||
let bt = self.box_type_map.get(box_val).cloned().unwrap_or_default();
|
||||
let m = method;
|
||||
if (bt == "PyRuntimeBox" && (m == "import")) {
|
||||
if bt == "PyRuntimeBox" && (m == "import") {
|
||||
let argc = 1 + args.len();
|
||||
if let Some(pidx) = self.param_index.get(box_val).copied() { b.emit_param_i64(pidx); } else { self.push_value_if_known_or_param(b, box_val); }
|
||||
let decision = crate::jit::policy::invoke::decide_box_method(&bt, m, argc, dst.is_some());
|
||||
@ -24,7 +24,7 @@ impl LowerCore {
|
||||
crate::jit::observe::lower_plugin_invoke(&box_type, m, type_id, method_id, argc);
|
||||
if let Some(d) = dst { self.handle_values.insert(*d); }
|
||||
} else { if dst.is_some() { b.emit_const_i64(0); } }
|
||||
} else if (bt == "PyRuntimeBox" && (m == "getattr" || m == "call")) {
|
||||
} else if bt == "PyRuntimeBox" && (m == "getattr" || m == "call") {
|
||||
let argc = 1 + args.len();
|
||||
if let Some(pidx) = self.param_index.get(box_val).copied() { b.emit_param_i64(pidx); } else { b.emit_const_i64(-1); }
|
||||
for a in args.iter() { self.push_value_if_known_or_param(b, a); }
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* - Dead code elimination
|
||||
*/
|
||||
|
||||
use super::{MirModule, MirFunction, MirInstruction, ValueId, MirType, TypeOpKind, EffectMask, Effect};
|
||||
use super::{MirModule, MirFunction, MirInstruction, ValueId, MirType, EffectMask, Effect};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
/// MIR optimization passes
|
||||
@ -464,7 +464,7 @@ impl MirOptimizer {
|
||||
/// Rewrites: PluginInvoke { box_val=py (PyRuntimeBox), method="getattr"|"call", args=[obj, rest...] }
|
||||
/// → PluginInvoke { box_val=obj, method, args=[rest...] }
|
||||
fn normalize_python_helper_calls(&mut self, module: &mut MirModule) -> OptimizationStats {
|
||||
use super::{MirInstruction as I, MirType};
|
||||
use super::MirInstruction as I;
|
||||
let mut stats = OptimizationStats::new();
|
||||
for (_fname, function) in &mut module.functions {
|
||||
for (_bb, block) in &mut function.blocks {
|
||||
@ -914,7 +914,7 @@ impl MirOptimizer {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::mir::{MirModule, MirFunction, FunctionSignature, MirType, BasicBlock, BasicBlockId, ValueId, ConstValue};
|
||||
use crate::mir::{MirModule, MirFunction, FunctionSignature, MirType, TypeOpKind, BasicBlock, BasicBlockId, ValueId, ConstValue};
|
||||
|
||||
#[test]
|
||||
fn test_optimizer_creation() {
|
||||
|
||||
@ -597,7 +597,7 @@ fn lower_args(f: &mut MirFunction, cur_bb: BasicBlockId, args: &[ExprV0]) -> Res
|
||||
|
||||
pub fn maybe_dump_mir(module: &MirModule) {
|
||||
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
|
||||
let mut p = MirPrinter::new();
|
||||
let p = MirPrinter::new();
|
||||
println!("{}", p.print_module(module));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use super::Semantics;
|
||||
use crate::jit::lower::builder::{IRBuilder, BinOpKind, CmpKind, ParamKind};
|
||||
use crate::jit::lower::builder::{IRBuilder, BinOpKind, CmpKind};
|
||||
use crate::mir::{ValueId, BasicBlockId};
|
||||
|
||||
/// Adapter that translates Semantics operations into IRBuilder calls (Cranelift path)
|
||||
@ -53,4 +53,3 @@ impl<'a> Semantics for ClifSemanticsAdapter<'a> {
|
||||
fn barrier_write(&mut self, _ptr: &Self::Ptr, v: Self::Val) -> Self::Val { v }
|
||||
fn safepoint(&mut self) { /* Lowered via explicit hostcall in LowerCore path */ }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user