diff --git a/cranelift/codegen/src/isa/zkasm/lower.isle b/cranelift/codegen/src/isa/zkasm/lower.isle index 4fe4b47938b7..d8de173995f5 100644 --- a/cranelift/codegen/src/isa/zkasm/lower.isle +++ b/cranelift/codegen/src/isa/zkasm/lower.isle @@ -353,6 +353,7 @@ (load_ext_name name 0)) ;;;;; Rules for `symbol_value`;;;;;;;;; +;; Heap starts at offset 0 in zkAsm machine memory. (rule (lower (symbol_value (zkasm_base ZkasmBase.Heap))) (imm $I32 0)) diff --git a/cranelift/codegen/src/isa/zkasm/lower/isle.rs b/cranelift/codegen/src/isa/zkasm/lower/isle.rs index 3015b7efc5d2..794970fae214 100644 --- a/cranelift/codegen/src/isa/zkasm/lower/isle.rs +++ b/cranelift/codegen/src/isa/zkasm/lower/isle.rs @@ -375,6 +375,10 @@ impl generated_code::Context for ZkAsmIsleContext<'_, '_, MInst, ZkAsmBackend> { match name { ExternalName::User(user_name_ref) => { // All ZKASM "memory"-like accesses use this name, but different offsets. + // This is our convention as is not related to the actual offsets in zkAsm + // machine memory that will be used by each base. + // These offsets need to be aligned with the offsets used in + // `cranelift_wasm::environ::zkasm::ZkasmFuncEnvironment`. if user_name_ref.index() != 0 { return None; }