Deduplicate the per-architecture cmplog/expression code (~2,800 lines)

Aperta
#424 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
devtools, testing

Direzione di ricerca

Read the architecture files under src/arch/ and the forwarding implementation in src/arch/mod.rs lines 524–698. Compare the repeated arithmetic, simplify, pair matching, and accessors, then inspect the proposed split between shared arithmetic and dispatch. Done means the duplicated code and identified dead code are addressed consistently across architectures; verify behavior with the project’s relevant tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Where

  • src/arch/{x86_64,x86,arm,aarch64,risc_v}.rs, src/arch/mod.rs 524-698

Problem
The 196-line CmpExpr::Add table is byte-identical in all five arch files (all say "Cannot multiply" in the Add error). simplify is identical between arm/aarch64 and between x86/x86_64. The CmpValue pair match, trace_pc, new_unchecked and accessors are copied five times. mod.rs hand-forwards ~175 lines of trait methods (where the magic-3 dispatch bug lives). Dead: cpu_instrumentation_subscribe, CmpValue::Expr, CmpType::{Fp,FpMod,IntMod,Transform}; x86 cmp_type() always returns vec![].

Impact
Fixes land in one arch and not the others (several issues above).

Suggested fix
PR A: move arithmetic to impl CmpValue plus one shared cmp_pair(). PR B: replace the forwarding impl with a macro or enum_dispatch.

Status
Reported by static code review at 79972db; not yet re-verified line by line. Found by reading the code; not reproduced under SIMICS.

Lingua principale
Rust
Stelle
335
Fork
26
Merge medio
1g 50m
PR unite (30g)
12

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intel/tsffs

Tutte le issue di intel/tsffs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.