| 343 | /// The Lean compiler mirror applies the same rule. |
| 344 | #[cfg(not(target_arch = "riscv64"))] |
| 345 | pub fn register_hint(&self, addr: Address, hints: ReducibilityHints) { |
| 346 | fn rank(h: &ReducibilityHints) -> (u8, u32) { |
| 347 | match h { |
| 348 | ReducibilityHints::Opaque => (0, 0), |
| 349 | ReducibilityHints::Abbrev => (1, 0), |
| 350 | ReducibilityHints::Regular(x) => (2, *x), |
| 351 | } |
| 352 | } |
| 353 | match self.anon_hints.entry(addr) { |
| 354 | dashmap::mapref::entry::Entry::Occupied(mut e) => { |
| 355 | if rank(&hints) < rank(e.get()) { |
| 356 | e.insert(hints); |
| 357 | } |
| 358 | }, |
| 359 | dashmap::mapref::entry::Entry::Vacant(e) => { |
| 360 | e.insert(hints); |
| 361 | }, |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | /// Store a structured constant under `addr`. |
| 366 | /// |
| 367 | /// Serializes the constant once. With demotion disabled, |
| 368 | /// the [`LazyConstant`] cache is pre-populated so `get_const` is |
| 369 | /// free; under [`DEMOTE`] (the default) the structured value is |
| 370 | /// dropped and the entry costs only its bytes (`get_const` re-parses |
| 371 | /// per access). Compilation never reads stored constants back, so the |
| 372 | /// modes differ only in memory footprint and later readers' CPU cost. |
| 373 | /// |
| 374 | /// Host-only — see `store_blob`. |
| 375 | #[cfg(not(target_arch = "riscv64"))] |
| 376 | pub fn store_const(&self, addr: Address, constant: Constant) { |
| 377 | self.store_const_demoted(addr, constant, *DEMOTE); |
| 378 | } |
| 379 | |
| 380 | /// `store_const` with an explicit demotion choice, bypassing |
| 381 | /// `IX_COMPILE_DEMOTE`. Exists so tests can drive both reprs without |
| 382 | /// process-global env-var races. |