Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
196 changes: 196 additions & 0 deletions docs/changes/2026-11-29-wasm-memory-grow-lazy-compile/BENCHMARK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# Wasm growth and compiler reuse benchmark

The base is upstream `0595767`. The primary Release binaries were built from
`afecbac` and the three ordered implementation snapshots. The intervening
upstream commit adds tooling with an identical engine and benchmark tree.
The primary configuration uses GCC 14.2, LLVM 15.0.6, CPU traps, Singlepass,
Multipass and WASI. EVM and the virtual stack were disabled for these WASI
measurements. CPU affinity is specified for each cohort on AMD EPYC 9V74.

The memory variant only changes growth after bucket migration. The object
variant builds on memory and borrows the emitted object buffer. The combined
variant also reuses the FastRA register orders. The final patch caps retained
object storage at 64 KiB. The last two cohorts isolate the cap with matching
Release spec-enabled builds of the previous and final combination.

Each round shuffles fresh CLI processes with matching inputs and a discarded
warmup. Times include load, compilation, instantiation, execution and shutdown.
Each row verifies guest stdout, stderr and exit. Wasmtime uses cache-disabled
official 45.0.0 and 51.0.0 binaries. Percent changes are paired medians with
pointwise bootstrap 95% intervals. A/A repeats the same executable.

## Dual-core Lazy

41 measured rounds, milliseconds.

| Case | Main | Memory | Memory + object | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 20.87 | 20.78 | 20.53 | 20.36 | 27.10 | 9.08 | 27.32 | -0.56% [-2.30%, +3.24%] | -1.56% [-3.37%, +1.06%] |
| echo | 19.09 | 19.31 | 19.18 | 18.74 | 22.88 | 7.16 | 23.47 | -1.22% [-2.47%, +1.22%] | +0.84% [-1.17%, +4.29%] |
| figlet | 39.17 | 39.91 | 38.85 | 38.76 | 52.77 | 13.72 | 56.60 | -0.39% [-2.24%, +0.37%] | -0.13% [-1.17%, +1.57%] |
| qr2text | 40.25 | 40.59 | 40.42 | 40.30 | 63.42 | 19.96 | 66.67 | +0.11% [-1.94%, +2.43%] | -0.41% [-2.09%, +2.27%] |
| base64cli | 89.53 | 90.77 | 90.72 | 90.16 | 231.52 | 54.75 | 250.10 | +0.57% [-1.80%, +2.19%] | +0.31% [-1.23%, +1.90%] |
| bicg | 56.56 | 55.86 | 55.54 | 55.78 | 56.65 | 58.14 | 56.38 | -0.12% [-3.74%, +1.28%] | -0.66% [-1.39%, +0.47%] |
| atax | 46.83 | 45.66 | 45.64 | 45.61 | 48.82 | 60.41 | 50.19 | -1.08% [-3.38%, +0.59%] | -0.92% [-2.45%, +1.47%] |

| Case | Memory vs main | Object vs memory | FastRA vs memory + object |
| --- | ---: | ---: | ---: |
| md5 | -0.40% [-2.40%, +2.71%] | -0.75% [-4.12%, +0.52%] | -0.24% [-2.29%, +4.10%] |
| echo | +1.22% [-0.87%, +4.14%] | +0.16% [-2.18%, +1.10%] | -2.05% [-4.10%, -0.01%] |
| figlet | +1.53% [-0.08%, +2.73%] | -1.95% [-3.57%, +0.49%] | -0.01% [-1.23%, +1.51%] |
| qr2text | +0.22% [-1.34%, +1.45%] | +0.73% [-0.65%, +1.88%] | -0.23% [-2.15%, +1.12%] |
| base64cli | +0.19% [-0.82%, +2.78%] | -0.09% [-2.28%, +0.44%] | -0.26% [-1.32%, +0.99%] |
| bicg | -0.94% [-4.65%, +0.36%] | -0.01% [-1.44%, +4.07%] | -0.09% [-3.04%, +2.50%] |
| atax | -0.39% [-1.64%, +0.10%] | -1.15% [-2.33%, +0.79%] | -0.17% [-1.28%, +1.40%] |

## Single-core Lazy

31 measured rounds, milliseconds.

| Case | Main | Memory | Memory + object | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 19.97 | 20.24 | 19.85 | 20.02 | 36.68 | 10.47 | 38.35 | +1.95% [-1.79%, +2.70%] | -0.38% [-2.90%, +2.92%] |
| echo | 18.74 | 19.18 | 18.97 | 18.81 | 32.18 | 9.90 | 33.86 | -0.14% [-1.52%, +1.73%] | -0.72% [-1.99%, +1.68%] |
| figlet | 38.51 | 38.74 | 38.57 | 38.39 | 96.97 | 20.15 | 100.91 | +0.28% [-2.80%, +2.08%] | +0.20% [-2.00%, +1.84%] |
| base64cli | 87.81 | 87.44 | 87.71 | 87.13 | 435.94 | 88.15 | 459.62 | -1.12% [-1.58%, -0.44%] | -0.26% [-0.74%, +0.11%] |

| Case | Memory vs main | Object vs memory | FastRA vs memory + object |
| --- | ---: | ---: | ---: |
| md5 | +1.73% [+0.44%, +4.05%] | -1.38% [-2.35%, +0.21%] | +0.83% [-1.52%, +2.03%] |
| echo | +1.54% [-0.08%, +3.33%] | +0.33% [-1.34%, +1.15%] | -0.29% [-2.42%, +0.77%] |
| figlet | +0.17% [-0.39%, +3.10%] | -0.73% [-1.65%, -0.03%] | -0.47% [-2.14%, +1.25%] |
| base64cli | -0.42% [-0.91%, +0.17%] | -0.21% [-0.71%, +0.64%] | -0.54% [-1.41%, +0.02%] |

## IRB Lazy

7 measured rounds, milliseconds.

| Case | Main | Memory | Memory + object | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| irb | 3,264.92 | 1,822.66 | 1,839.94 | 1,785.26 | 4,780.35 | 920.67 | 5,386.46 | -46.71% [-48.10%, -43.96%] | -1.32% [-3.34%, +4.60%] |

| Case | Memory vs main | Object vs memory | FastRA vs memory + object |
| --- | ---: | ---: | ---: |
| irb | -44.45% [-47.70%, -41.78%] | +1.99% [-8.68%, +9.79%] | -1.45% [-7.20%, +0.01%] |

## IRB Singlepass

5 measured rounds, milliseconds.

| Case | Main | Memory | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| irb | 2,045.32 | 469.41 | 475.17 | 4,838.10 | 941.54 | 5,291.41 | -76.51% [-76.77%, -74.06%] | +5.17% [-16.58%, +13.62%] |

## Singlepass controls

15 measured rounds, milliseconds.

| Case | Main | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 5.21 | 5.24 | 24.38 | 8.43 | 24.72 | +1.02% [-6.14%, +7.90%] | +4.65% [-3.62%, +10.63%] |
| figlet | 8.23 | 7.98 | 50.91 | 13.20 | 54.27 | -1.81% [-7.82%, +0.19%] | -0.27% [-8.40%, +0.59%] |
| bicg | 79.09 | 77.15 | 53.80 | 56.66 | 52.83 | +0.20% [-4.35%, +3.16%] | -0.60% [-5.82%, +1.41%] |
| atax | 77.90 | 80.76 | 48.62 | 61.01 | 48.24 | +2.60% [-0.27%, +8.88%] | +0.02% [-1.37%, +1.12%] |

## Eager controls

15 measured rounds, milliseconds.

| Case | Main | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 67.01 | 66.22 | 26.21 | 8.08 | 25.43 | -0.75% [-3.23%, +3.45%] | -3.04% [-22.41%, +10.53%] |
| figlet | 117.85 | 116.44 | 51.82 | 13.58 | 56.87 | -0.79% [-4.52%, +1.97%] | -0.19% [-3.27%, +5.54%] |
| bicg | 87.35 | 90.48 | 52.56 | 57.62 | 52.22 | +3.98% [-3.50%, +13.81%] | +0.30% [-2.66%, +19.50%] |
| atax | 84.41 | 87.83 | 42.12 | 58.91 | 42.77 | -1.14% [-10.45%, +15.40%] | -4.05% [-11.74%, +10.19%] |

## Large PolyBench control

3 measured rounds, milliseconds.

| Case | Main | Combined | 45 Cranelift | 45 Winch | 51 Cranelift | Combined vs main | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| syr2k | 2,296.09 | 2,288.94 | 2,782.76 | 5,442.13 | 2,884.34 | -0.31% [-3.54%, +7.18%] | +4.41% [+0.66%, +5.27%] |

## Final buffer cap controls

31 measured rounds, milliseconds.

| Case | Uncapped | Capped | 45 Cranelift | 45 Winch | 51 Cranelift | Capped vs uncapped | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 19.75 | 19.70 | 24.64 | 7.94 | 24.78 | +0.56% [-1.36%, +3.05%] | +0.95% [-0.73%, +2.81%] |
| echo | 18.55 | 18.63 | 22.94 | 7.30 | 23.32 | +0.96% [-2.05%, +2.29%] | +1.45% [-1.40%, +5.24%] |
| figlet | 37.26 | 37.28 | 52.38 | 13.71 | 56.29 | -0.08% [-1.31%, +1.16%] | +1.14% [-1.99%, +3.01%] |
| base64cli | 89.40 | 88.17 | 233.47 | 53.71 | 249.35 | -1.77% [-2.60%, +1.36%] | -0.04% [-1.06%, +1.01%] |
| bicg | 55.70 | 54.63 | 55.41 | 57.30 | 55.28 | -0.88% [-2.91%, +2.64%] | -3.31% [-7.34%, +1.93%] |
| atax | 47.11 | 45.92 | 44.82 | 60.00 | 44.74 | -0.57% [-2.12%, +0.32%] | -1.68% [-2.45%, -0.19%] |

## Final buffer cap on IRB

3 measured rounds, milliseconds.

| Case | Uncapped | Capped | 45 Cranelift | 45 Winch | 51 Cranelift | Capped vs uncapped | Baseline A/A |
| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
| irb | 1,737.73 | 1,739.40 | 4,712.11 | 884.77 | 5,266.84 | +1.63% [-2.34%, +2.29%] | +4.02% [-1.23%, +4.22%] |

## Compiler diagnostics

Separate single-core processes with `--enable-statistics` measure aggregate
foreground compilation and the execution timer with foreground JIT removed.
The libc allocation cohort counts requests and requested bytes through
`malloc`, `calloc` and `realloc`. Requested capacity is cumulative over the
process. These runs are independent from the wall-time cohorts.

| Case | Foreground compiles | Main ms | Memory ms | Memory + object ms | Combined ms | Compiler changes vs memory |
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
| md5 | 31 | 14.94 | 14.85 | 14.68 | 14.63 | -1.21% [-2.02%, +0.19%] |
| echo | 30 | 13.59 | 13.45 | 13.54 | 13.40 | -0.54% [-1.29%, -0.05%] |
| figlet | 113 | 30.81 | 30.93 | 30.60 | 30.38 | -2.35% [-2.93%, -1.69%] |
| qr2text | 74 | 33.54 | 33.58 | 33.20 | 32.84 | -2.61% [-4.43%, -1.20%] |
| base64cli | 215 | 79.82 | 79.41 | 79.20 | 79.02 | -0.39% [-1.26%, +0.95%] |
| bicg | 35 | 17.85 | 18.50 | 17.82 | 17.80 | -2.17% [-2.87%, +1.37%] |
| atax | 35 | 17.47 | 17.58 | 17.38 | 17.22 | -2.02% [-4.35%, +0.70%] |
| irb | 1910 | 1,440.54 | 1,454.99 | 1,470.56 | 1,441.13 | -0.95% [-2.23%, +10.74%] |

| Case | Main calls | Memory calls | Memory + object calls | Combined calls | Requested MiB saved by compiler changes |
| --- | ---: | ---: | ---: | ---: | ---: |
| md5 | 35213 | 35213 | 34906 | 34764 | 0.25 |
| echo | 33022 | 33022 | 32728 | 32591 | 0.23 |
| figlet | 85444 | 85444 | 84248 | 83690 | 0.82 |
| qr2text | 79502 | 79502 | 78721 | 78330 | 0.67 |
| base64cli | 197541 | 197541 | 195227 | 194109 | 1.90 |
| bicg | 42560 | 42560 | 42221 | 42066 | 0.24 |
| atax | 40222 | 40222 | 39883 | 39728 | 0.24 |
| irb | 3206695 | 3206695 | 3183738 | 3172404 | 28.32 |

## Findings and verification

The first migration out of a bucket still copies the accessible prefix. The
independent mapping keeps its base through later growth. On `irb`, the
Singlepass trace counted 50 reservations and 49 releases of 8 GiB in main,
and two reservations and one release in both the memory-only and combined
variants. These are virtual reservations. The execution timer after removing
foreground JIT fell from 1,736.67 to 210.41 ms in the diagnostic cohort.

The compiler reuse changes reduced `irb` allocation requests from 3,206,695
to 3,172,404 relative to memory alone. Cumulative requested capacity dropped
by 28.32 MiB. Foreground compile medians changed from 1,455.00 to 1,441.13 ms.
The short-process and incremental IRB process intervals limit the precision
of an independent wall-time claim. The cap has its own matched control above.

The final Release spec-enabled build passed seven CTest targets. Both
bucket tests ran and passed, including existing slot retirement coverage.
The boundary regression uses two live instances. It verifies 32 MiB bucket
exhaustion, one copy on migration, a stable independent base, prefix writes,
zero newly committed pages, zero growth, a 514-page runtime cap, overflowing
growth, and traps past the new size. The standalone crossing fixture passed
in interpreter, Singlepass, Eager and Lazy with both default mapping and
explicit heap/soft checks. The standard `memory_grow` case passed in those
four modes. The first-growth anonymous tail and bucket guards retain their
existing implementation. The runtime's dWASM default cap is checked before
allocation. SGX was reviewed at source level. EVM JIT logging and Linux perf
compiler declarations passed syntax checks.

The serial FastRA page capture compares five workloads. Each variant has the
same number of executable mappings. The sets of pages with differing hashes
were the same as on a repeat of main, which also changes process addresses.
The timed and traced guests emitted matching output.
22 changes: 22 additions & 0 deletions docs/changes/2026-11-29-wasm-memory-grow-lazy-compile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Reuse Wasm memory reservations and compiler state

- **Status**: Proposed
- **Date**: 2026-11-29
- **Tier**: Full

When Wasm linear memory outgrows a mapped bucket, the allocator moves it
to an independent mapping. Subsequent growth uses that mapping's own
capacity. The first move retains the bucket's existing protection,
copying, and retirement rules. Guest page limits apply before growth.

Multipass keeps FastRA's register-class orders in each compile context.
It checks target, callee-saved and reserved registers before reuse.
The object loader borrows the emitted bytes during parsing and copying,
then retains up to 64 KiB of capacity in the context. These changes preserve
register selection, relocation processing and the code publication path.

See the [runtime specification](../../modules/runtime/spec.md) and
[compiler specification](../../modules/compiler/spec.md).

The [benchmark report](BENCHMARK.md) includes matched process measurements,
incremental compiler experiments and the mapping correctness checks.
9 changes: 9 additions & 0 deletions docs/modules/compiler/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ and the sole internal function export is `_start` with signature
configured allocator. Its stub publishes directly through the serial lazy
path. The thread pool remains available for opt-in private promotion.

### Per-context compiler reuse

FastRA caches target register-class orders in its compile context. A
change in target register information, callee-saved registers or the
current function's reserved register mask invalidates the orders. The
loader reads the emitted object from the context's byte buffer and resets
the buffer size after parsing, relocation extraction and code copying. It
releases backing allocations larger than 64 KiB.

### Opt-in private loop tiering

`EnableLazyPrivateTiering` permits demand-compiled private WASM helpers to
Expand Down
5 changes: 4 additions & 1 deletion docs/modules/runtime/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ anonymous PROT_NONE pages. Existing mprotect exposes exactly the requested size;
later growth reuses the reservation, since Wasm memory never shrinks. Existing
contents, neighbouring items and guard permissions stay unchanged. Accounting,
protection and bucket retirement operate across both mapping types. Growth past
the bucket limit retains the existing allocate/copy fallback.
the bucket limit uses the allocate/copy fallback. The resulting independent
mapping grows in place within its own reservation. The grow operation checks
the module and runtime page limits before changing the mapping. The reserved
tail beyond the current size stays inaccessible.
18 changes: 1 addition & 17 deletions src/compiler/cgir/pass/cg_register_class_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ void CgRegisterClassInfo::runOnCgFunction(CgFunction &cg_func) {
}
CalleeSavedRegs = CSR;

// Even if CSR list is same, we could have had a different allocation order
// if ignoreCSRForAllocationOrder is evaluated differently.
BitVector CSRHintsForAllocOrder(TRI->getNumRegs());
#if 0
for (const MCPhysReg *I = CSR; *I; ++I)
for (MCRegAliasIterator AI(*I, TRI, true); AI.isValid(); ++AI)
CSRHintsForAllocOrder[*AI] = STI.ignoreCSRForAllocationOrder(mf, *AI);
#endif
if (IgnoreCSRForAllocOrder.size() != CSRHintsForAllocOrder.size() ||
IgnoreCSRForAllocOrder != CSRHintsForAllocOrder) {
Update = true;
IgnoreCSRForAllocOrder = CSRHintsForAllocOrder;
}

RegCosts = COMPILER::getTargetRegisterCosts(TRI);

// Different reserved registers?
Expand Down Expand Up @@ -125,9 +111,7 @@ void CgRegisterClassInfo::compute(const TargetRegisterClass *RC) const {
uint8_t Cost = RegCosts[PhysReg];
MinCost = std::min(MinCost, Cost);

if (CalleeSavedAliases[PhysReg] &&
// !STI.ignoreCSRForAllocationOrder(*MF, PhysReg))
!IgnoreCSRForAllocOrder.test(PhysReg))
if (CalleeSavedAliases[PhysReg])
// PhysReg aliases a CSR, save it for later.
CSRAlias.push_back(PhysReg);
else {
Expand Down
4 changes: 0 additions & 4 deletions src/compiler/cgir/pass/cg_register_class_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ class CgRegisterClassInfo : public NonCopyable {
// Map register alias to the callee saved Register.
SmallVector<MCPhysReg, 4> CalleeSavedAliases;

// Indicate if a specified callee saved register be in the allocation order
// exactly as written in the tablegen descriptions or listed later.
BitVector IgnoreCSRForAllocOrder;

// Reserved registers in the current MF.
BitVector Reserved;

Expand Down
7 changes: 4 additions & 3 deletions src/compiler/cgir/pass/fast_ra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class FastRA::Impl {
// Register masks attached to the current instruction.
SmallVector<const uint32_t *> RegMasks;

CgRegisterClassInfo RegClassInfo;
CgRegisterClassInfo *RegClassInfo = nullptr;
IndexedMap<int, VirtReg2IndexFunctor> StackSlotForVirtReg;

Impl() : StackSlotForVirtReg(-1) {}
Expand All @@ -122,7 +122,8 @@ class FastRA::Impl {
MFI = &(cg_func.getFrameInfo());
_llvm_workaround = &(cg_func.getContext().getLLVMWorkaround());
MRI->freezeReservedRegs(cg_func);
RegClassInfo.runOnCgFunction(cg_func);
RegClassInfo = &cg_func.getContext().getFastRAClassInfo();
RegClassInfo->runOnCgFunction(cg_func);

unsigned NumRegUnits = TRI->getNumRegUnits();
UsedInInstr.resize(NumRegUnits);
Expand Down Expand Up @@ -588,7 +589,7 @@ void FastRA::Impl::allocVirtReg(CgInstruction &MI, LiveReg &LR,

MCPhysReg BestReg = 0;
unsigned BestCost = spillImpossible;
ArrayRef<MCPhysReg> CgAllocationOrder = RegClassInfo.getOrder(&RC);
ArrayRef<MCPhysReg> CgAllocationOrder = RegClassInfo->getOrder(&RC);
for (MCPhysReg PhysReg : CgAllocationOrder) {
// LLVM_DEBUG(dbgs() << "\tRegister: " << printReg(PhysReg, TRI) << '
// ');
Expand Down
25 changes: 19 additions & 6 deletions src/compiler/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
#include "compiler/target/x86/x86_mc_lowering.h"
#include "compiler/target/x86/x86lowering.h"
#include "compiler/wasm_frontend/wasm_mir_compiler.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include "llvm/Support/MemoryBuffer.h"
#include <chrono>
#include <deque>
#include <limits>
Expand Down Expand Up @@ -175,9 +176,21 @@ void JITCompilerBase::emitObjectBuffer(CompileContext *Ctx) {

Ctx->finalize();

auto ObjectToLoad = std::make_unique<llvm::SmallVectorMemoryBuffer>(
std::move(Ctx->getObjBuffer()), false);
auto LoadedObject = llvm::object::ObjectFile::createObjectFile(*ObjectToLoad);
auto &Buffer = Ctx->getObjBuffer();
const auto ClearBuffer = llvm::make_scope_exit([&Buffer] {
constexpr size_t MaxRetainedObjectBytes = 64 * 1024;
if (Buffer.capacity() > MaxRetainedObjectBytes) {
// Release the backing storage of unusually large objects.
llvm::SmallVector<char, 0> Released(std::move(Buffer));
} else {
Buffer.clear();
}
});
// ObjectFile and its section views borrow the bytes until copying finishes.
// Keep the backing capacity in this compilation context for the next object.
const llvm::MemoryBufferRef ObjectToLoad(
llvm::StringRef(Buffer.data(), Buffer.size()), "");
auto LoadedObject = llvm::object::ObjectFile::createObjectFile(ObjectToLoad);
if (!LoadedObject) {
throw getError(ErrorCode::ObjectFileCreationFailed);
}
Expand Down Expand Up @@ -357,7 +370,7 @@ void JITCompilerBase::emitObjectBuffer(CompileContext *Ctx) {
}

#ifdef ZEN_ENABLE_MULTIPASS_JIT_LOGGING
dumpAsm(ObjectToLoad->getBufferStart(), ObjectToLoad->getBufferSize());
dumpAsm(ObjectToLoad.getBufferStart(), ObjectToLoad.getBufferSize());
#endif

Ctx->CodeSize = TextSection->getSize();
Expand All @@ -376,7 +389,7 @@ void JITCompilerBase::emitObjectBuffer(CompileContext *Ctx) {

#if defined(ZEN_ENABLE_EVM) && defined(ZEN_ENABLE_LINUX_PERF) && \
!defined(ZEN_ENABLE_MULTIPASS_JIT_LOGGING)
dumpAsm(ObjectToLoad->getBufferStart(), ObjectToLoad->getBufferSize(),
dumpAsm(ObjectToLoad.getBufferStart(), ObjectToLoad.getBufferSize(),
Ctx->CodePtr);
#endif
}
Expand Down
8 changes: 8 additions & 0 deletions src/compiler/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "compiler/context.h"
#include "compiler/cgir/pass/cg_register_class_info.h"
#include "compiler/mir/function.h"
#include "compiler/mir/pointer.h"
#include "compiler/target/x86/x86_llvm_workaround.h"
Expand Down Expand Up @@ -163,6 +164,13 @@ void CompileContext::finalize() {
MCL->finalize();
}

CgRegisterClassInfo &CompileContext::getFastRAClassInfo() {
if (!FastRAClassInfo) {
FastRAClassInfo = std::make_unique<CgRegisterClassInfo>();
}
return *FastRAClassInfo;
}

/// \warning only used for lazy compilation
void CompileContext::reinitialize() {
ZEN_ASSERT(MCL);
Expand Down
Loading
Loading