From fef42adeb80d00c5dadbc8fe617d469f09b05ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Thu, 9 Jul 2020 14:13:28 +0300 Subject: [PATCH] Implement the GC in Rust This implements the current garbage collector in Rust. No changes were made to the GC design -- it's just ports the one implemented in code generator to Rust. The goals are: - Evaluate Rust for Motoko's RTS implementation - Make the collector easier to read, understand, modify, and extend. Currently passes the tests locally. We can't run this branch on CI yet as it needs to download rustc nightly and xargo and the domains are not allowed on the CI. I think in the final version we'll have to build rustc outselves instead of downloading. (Nightly rustc is needed as "core" distributed with rustc is not built with PIC relocation model on wam32, so we can't use it to generate a shared wasm32 library) Main changes: - New Rust crate "motoko-rts" introduced, which currently implements the garbage collector. It also has some utilities for printing the heap or individual objects, to be used when debugging. - Nix files updated to download rustc and xargo. These are used to build Rust's "core" library with PIC relocation model for wasm32. - We no longer build memset and memcpy of musl as those are provided by Rust's "core" now. The main algorithm is in `gc.rs`. Rest of the Rust files are helpers, mainly for debugging. Other changes: - I had to update lots of ic-ref-run outputs. See #1854 for the details. Remaining work and issues: - There's currently a bug somewhere that causes random failures as I move the code around. One example of this is in the last line of `gc.rs` where I have a no-op function call `dump_heap()` which when removed causes the test "life" to fail with a trap. - Figure out how to use rustc nightly (with PIC wasm32 libraries) in CI. --- .gitignore | 1 + default.nix | 18 +- nix/default.nix | 38 +- nix/xargo.nix | 42 ++ rts/Makefile | 30 +- rts/motoko-rts/.cargo/config | 4 + rts/motoko-rts/.vim/coc-settings.json | 8 + rts/motoko-rts/Cargo.lock | 14 + rts/motoko-rts/Cargo.toml | 17 + rts/motoko-rts/src/alloc.rs | 41 ++ rts/motoko-rts/src/common.rs | 3 + rts/motoko-rts/src/debug.rs | 151 ++++++ rts/motoko-rts/src/gc.rs | 419 ++++++++++++++ rts/motoko-rts/src/lib.rs | 34 ++ rts/motoko-rts/src/print.rs | 136 +++++ rts/motoko-rts/src/types.rs | 143 +++++ src/codegen/compile.ml | 513 ++---------------- test/run-drun/ok/AST-66.ic-ref-run.ok | 2 +- test/run-drun/ok/GIT-843.ic-ref-run.ok | 2 +- test/run-drun/ok/actor-capture.ic-ref-run.ok | 2 +- .../run-drun/ok/actor-class-arg.ic-ref-run.ok | 10 +- .../ok/actor-creator-shadow-too.ic-ref-run.ok | 2 +- .../ok/actor-creator-shadow.ic-ref-run.ok | 2 +- test/run-drun/ok/actor-creator.ic-ref-run.ok | 2 +- test/run-drun/ok/actor-import.ic-ref-run.ok | 2 +- .../ok/actor-reference-bad.ic-ref-run.ok | 2 +- .../ok/actor-reference-return.ic-ref-run.ok | 2 +- .../run-drun/ok/actor-reference.ic-ref-run.ok | 2 +- .../ok/array-out-of-bounds.ic-ref-run.ok | 2 +- test/run-drun/ok/async-any.ic-ref-run.ok | 2 +- test/run-drun/ok/async-calls1.ic-ref-run.ok | 2 +- test/run-drun/ok/async-calls2.ic-ref-run.ok | 2 +- test/run-drun/ok/async-calls3.ic-ref-run.ok | 2 +- test/run-drun/ok/async-free-var.ic-ref-run.ok | 2 +- .../ok/async-loop-while.ic-ref-run.ok | 2 +- test/run-drun/ok/async-loop.ic-ref-run.ok | 2 +- test/run-drun/ok/async-new-obj.ic-ref-run.ok | 2 +- test/run-drun/ok/async-obj-mut.ic-ref-run.ok | 2 +- test/run-drun/ok/async-while.ic-ref-run.ok | 2 +- test/run-drun/ok/await-sugar.ic-ref-run.ok | 2 +- test/run-drun/ok/await.ic-ref-run.ok | 2 +- test/run-drun/ok/block.ic-ref-run.ok | 2 +- .../ok/call-async-method.ic-ref-run.ok | 2 +- test/run-drun/ok/caller-prim.ic-ref-run.ok | 2 +- test/run-drun/ok/caller.ic-ref-run.ok | 2 +- test/run-drun/ok/closure-params.ic-ref-run.ok | 2 +- .../run-drun/ok/count-callbacks.ic-ref-run.ok | 2 +- test/run-drun/ok/counter.ic-ref-run.ok | 2 +- test/run-drun/ok/counter2.ic-ref-run.ok | 2 +- test/run-drun/ok/data-params.ic-ref-run.ok | 2 +- test/run-drun/ok/divide-by-zero.ic-ref-run.ok | 2 +- test/run-drun/ok/empty-actor.ic-ref-run.ok | 2 +- test/run-drun/ok/empty-call.ic-ref-run.ok | 2 +- test/run-drun/ok/error-codes.ic-ref-run.ok | 2 +- .../ok/flatten-awaitables.ic-ref-run.ok | 2 +- test/run-drun/ok/for-await.ic-ref-run.ok | 2 +- test/run-drun/ok/free-callbacks.ic-ref-run.ok | 2 +- test/run-drun/ok/general_await.ic-ref-run.ok | 2 +- .../ok/general_await_implicit.ic-ref-run.ok | 2 +- .../ok/generic-tail-rec.ic-ref-run.ok | 2 +- .../ok/hello-world-async.ic-ref-run.ok | 2 +- .../ok/hello-world-await.ic-ref-run.ok | 2 +- .../ok/hello-world-message.ic-ref-run.ok | 2 +- .../ok/hello-world-return.ic-ref-run.ok | 2 +- test/run-drun/ok/hello-world.ic-ref-run.ok | 2 +- test/run-drun/ok/ic-calls.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-any-stable.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-any.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-bad.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-bool.ic-ref-run.ok | 2 +- .../ok/idl-buf-size-bug.ic-ref-run.ok | 2 +- .../ok/idl-field-escape.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-float.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-func.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-mo.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-nary.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-nat-int.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-option.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-pair.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-principal.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-record.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-shorthand.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-tuple.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-unit.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-variant.ic-ref-run.ok | 2 +- test/run-drun/ok/idl-vector.ic-ref-run.ok | 2 +- test/run-drun/ok/interleave.ic-ref-run.ok | 2 +- test/run-drun/ok/issue-894.ic-ref-run.ok | 2 +- test/run-drun/ok/local-throw.ic-ref-run.ok | 2 +- test/run-drun/ok/mod-rebind.ic-ref-run.ok | 2 +- test/run-drun/ok/nary-async.ic-ref-run.ok | 2 +- test/run-drun/ok/oneway-throw.ic-ref-run.ok | 2 +- test/run-drun/ok/oneway.ic-ref-run.ok | 2 +- test/run-drun/ok/oom.ic-ref-run.ok | 2 +- test/run-drun/ok/overflow.ic-ref-run.ok | 2 +- .../run-drun/ok/print-from-init.ic-ref-run.ok | 2 +- test/run-drun/ok/query.ic-ref-run.ok | 2 +- test/run-drun/ok/query2.ic-ref-run.ok | 2 +- test/run-drun/ok/reinstall.ic-ref-run.ok | 4 +- test/run-drun/ok/reject-bug.ic-ref-run.ok | 2 +- test/run-drun/ok/reject.ic-ref-run.ok | 2 +- test/run-drun/ok/rts-stats.ic-ref-run.ok | 2 +- test/run-drun/ok/rts-stats2.ic-ref-run.ok | 2 +- test/run-drun/ok/self-upgrade.ic-ref-run.ok | 4 +- test/run-drun/ok/selftail.ic-ref-run.ok | 2 +- test/run-drun/ok/shared-object.ic-ref-run.ok | 2 +- test/run-drun/ok/sharingbug.ic-ref-run.ok | 2 +- test/run-drun/ok/show.ic-ref-run.ok | 2 +- test/run-drun/ok/stable-mutable.ic-ref-run.ok | 6 +- test/run-drun/ok/stable.ic-ref-run.ok | 4 +- .../ok/static-call-from-pub.ic-ref-run.ok | 2 +- test/run-drun/ok/static-gc.ic-ref-run.ok | 2 +- test/run-drun/ok/switch-await.ic-ref-run.ok | 2 +- test/run-drun/ok/text-iter.ic-ref-run.ok | 2 +- test/run-drun/ok/throw.ic-ref-run.ok | 2 +- test/run-drun/ok/time.ic-ref-run.ok | 2 +- test/run-drun/ok/transpose.ic-ref-run.ok | 2 +- test/run-drun/ok/type-lub.ic-ref-run.ok | 2 +- test/run-drun/ok/upgrade-hooks.ic-ref-run.ok | 8 +- test/run-drun/ok/upgrades.ic-ref-run.ok | 8 +- test/run-drun/ok/utf8.ic-ref-run.ok | 2 +- 121 files changed, 1257 insertions(+), 593 deletions(-) create mode 100644 nix/xargo.nix create mode 100644 rts/motoko-rts/.cargo/config create mode 100644 rts/motoko-rts/.vim/coc-settings.json create mode 100644 rts/motoko-rts/Cargo.lock create mode 100644 rts/motoko-rts/Cargo.toml create mode 100644 rts/motoko-rts/src/alloc.rs create mode 100644 rts/motoko-rts/src/common.rs create mode 100644 rts/motoko-rts/src/debug.rs create mode 100644 rts/motoko-rts/src/gc.rs create mode 100644 rts/motoko-rts/src/lib.rs create mode 100644 rts/motoko-rts/src/print.rs create mode 100644 rts/motoko-rts/src/types.rs diff --git a/.gitignore b/.gitignore index ffe32527beb..3d1eecb2eac 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ _out _output _build +target **/*~ /result* diff --git a/default.nix b/default.nix index 3e4acf8a95b..fd132e5b3a6 100644 --- a/default.nix +++ b/default.nix @@ -19,16 +19,19 @@ let haskellPackages = nixpkgs.haskellPackages.override { overrides = import nix/haskell-packages.nix nixpkgs subpath; }; in let - llvmBuildInputs = [ + rtsBuildInputs = [ nixpkgs.clang_10 # for native/wasm building nixpkgs.lld_10 # for wasm building + nixpkgs.rustc-nightly + nixpkgs.cargo-nightly + nixpkgs.xargo ]; - # When compiling natively, we want to use `clang` (which is a nixpkgs - # provided wrapper that sets various include paths etc). - # But for some reason it does not handle building for Wasm well, so - # there we use plain clang-10. There is no stdlib there anyways. llvmEnv = '' + # When compiling natively, we want to use `clang` (which is a nixpkgs + # provided wrapper that sets various include paths etc). + # But for some reason it does not handle building for Wasm well, so + # there we use plain clang-10. There is no stdlib there anyways. export CLANG="${nixpkgs.clang_10}/bin/clang" export WASM_CLANG="clang-10" export WASM_LD=wasm-ld @@ -126,7 +129,7 @@ rec { src = subpath ./rts; nativeBuildInputs = [ nixpkgs.makeWrapper ]; - buildInputs = llvmBuildInputs; + buildInputs = rtsBuildInputs; preBuild = '' ${llvmEnv} @@ -200,7 +203,7 @@ rec { wasmtime nixpkgs.sources.esm ] ++ - llvmBuildInputs; + rtsBuildInputs; checkPhase = '' patchShebangs . @@ -329,6 +332,7 @@ rec { [ { name = "bin/FileCheck"; path = "${nixpkgs.llvm}/bin/FileCheck";} ]; wabt = nixpkgs.wabt; wasmtime = nixpkgs.wasmtime; + xargo = nixpkgs.xargo; wasm = nixpkgs.wasm; overview-slides = stdenv.mkDerivation { diff --git a/nix/default.nix b/nix/default.nix index 21fbcc94788..0e6de3aa31e 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -10,7 +10,30 @@ let import nixpkgs_src { inherit system; overlays = [ - (self: super: { sources = import sourcesnix { sourcesFile = ./sources.json; pkgs = super; }; }) + # rust nightly + (self: super: let + moz_overlay = import (self.fetchzip { + url = https://github.com/mozilla/nixpkgs-mozilla/archive/efda5b357451dbb0431f983cca679ae3cd9b9829.tar.gz; + sha256 = "11wqrg86g3qva67vnk81ynvqyfj0zxk83cbrf0p9hsvxiwxs8469"; + }) self super; + rust-channel = moz_overlay.rustChannelOf { date = "2020-07-22"; channel = "nightly"; }; + in rec { + rustc-nightly = rust-channel.rust.override { + targets = [ "wasm32-unknown-unknown" "wasm32-unknown-emscripten" ]; + extensions = ["rust-src"]; + }; + cargo-nightly = rustc-nightly; + rustPlatform-nightly = pkgs.makeRustPlatform { + rustc = rustc-nightly; + cargo = cargo-nightly; + }; + }) + + # add nix/sources.json + (self: super: { + sources = import sourcesnix { sourcesFile = ./sources.json; pkgs = super; }; + }) + # Selecting the ocaml version # (self: super: { ocamlPackages = super.ocamlPackages; }) ( @@ -30,10 +53,21 @@ let inherit (self) ocamlPackages; }; }; - # wasmtime wasmtime = self.callPackage ./wasmtime.nix {}; + xargo = self.callPackage ./xargo.nix {}; } ) + # nixpkgs's rustc does not include the wasm32-unknown-unknown target, so + # lets add it here. + # (self: super: { + # rustc = super.rustc.overrideAttrs (old: { + # configureFlags = self.lib.lists.forEach old.configureFlags (flag: + # if self.lib.strings.hasPrefix "--target=" flag + # then flag + ",wasm32-unknown-unknown,wasm32-unknown-emscripten" + # else flag + # ); + # }); + # }) ]; }; in diff --git a/nix/xargo.nix b/nix/xargo.nix new file mode 100644 index 00000000000..ebf1b3cfde1 --- /dev/null +++ b/nix/xargo.nix @@ -0,0 +1,42 @@ +# xargo is used to build motoko-rts for wasm32. We need to make a shared Wasm +# library for the RTS (that's what moc-ld supports) but Rust ships wasm32 +# libraries (core and std) without PIC relocation model, so we use xargo to make +# PIC versions of core and std. + +{ rustPlatform-nightly, fetchFromGitHub, lib, python, cmake, llvmPackages, clang, stdenv, darwin, zlib }: + +rustPlatform-nightly.buildRustPackage rec { + name = "xargo"; + + src = fetchFromGitHub { + owner = "japaric"; + repo = "${name}"; + rev = "16035a7c401262824edcb87e1401fe4b05a5ccc0"; + sha256 = "0m1dg7vwmmlpqp20p219gsm7zbnnii6lik6hc2vvfsdmnygf271l"; + fetchSubmodules = true; + }; + + cargoSha256 = "0zzksgi2prgw01m6r4bqjjz902h5g5ich0h3xvb60w4sshlss891"; + + # nativeBuildInputs = [ python cmake clang ]; + # buildInputs = [ llvmPackages.libclang ] ++ + # lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + # LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; + + doCheck = false; + # error: couldn't lock thumbv6m-panic_abort-eabi's sysroot as read-only + USER = "nobody"; # for xargo tests (if we would run them) + + meta = with lib; { + description = "The sysroot manager that lets you build and customize std"; + homepage = "https://github.com/japaric/xargo"; + license = licenses.mit; + maintainers = [ { + email = "omer.agacan@dfinity.org"; + github = "osa1"; + githubId = 123123; + name = "Ömer Sinan Ağacan"; + } ]; + platforms = platforms.unix; + }; +} diff --git a/rts/Makefile b/rts/Makefile index 69e29c93be7..ec75a02615c 100644 --- a/rts/Makefile +++ b/rts/Makefile @@ -1,3 +1,5 @@ +SHELL:=bash -O globstar + CLANG ?= clang-10 WASM_CLANG ?= clang-10 WASM_LD ?= wasm-ld-10 @@ -19,7 +21,7 @@ TOMMATHFILES = \ MUSLFILES = \ pow pow_data sin cos tan asin acos atan atan2 exp exp_data log log_data fmod \ towctrans iswspace iswupper iswlower iswalpha wcschr wcslen \ - floor scalbn frexp strnlen memchr memset memcpy snprintf vsnprintf vfprintf \ + floor scalbn frexp strnlen memchr snprintf vsnprintf vfprintf \ __math_oflow __math_uflow __math_xflow __math_divzero __math_invalid \ __rem_pio2 __rem_pio2_large __sin __cos __tan \ stubs @@ -154,29 +156,45 @@ _build/native/tommath_%.o: %.c rts.h buf.h | _build/native _build/wasm/musl_%.o: %.c | _build/wasm $(WASM_CLANG) $(CLANG_FLAGS) $(WASM_FLAGS) $(MUSL_FLAGS) $< --output $@ +.PHONY: _build/wasm/libmotoko_rts.a +_build/wasm/libmotoko_rts.a: | _build/wasm + # NB. codegen-units=1 is to make debugging easier, not strictly + # necessary + cd motoko-rts && \ + xargo rustc --target=wasm32-unknown-emscripten --release -- \ + -Crelocation-model=pic -Ccodegen-units=1 + cp motoko-rts/target/wasm32-unknown-emscripten/release/libmotoko_rts.a $@ + +.PHONY: _build/native/libmotoko_rts.a +_build/native/libmotoko_rts.a: | _build/native + cd motoko-rts && cargo build --release + cp motoko-rts/target/release/libmotoko_rts.a $@ + RTS_WASM_O=$(RTSFILES:%=_build/wasm/%.o) RTS_NATIVE_O=$(RTSFILES:%=_build/native/%.o) +RTS_RUST_WASM_O=_build/wasm/libmotoko_rts.a +RTS_RUST_NATIVE_O=_build/native/libmotoko_rts.a # # The actual RTS, as we ship it with the compiler # -mo-rts.wasm: $(RTS_WASM_O) $(TOMMATH_WASM_O) $(MUSL_WASM_O) +mo-rts.wasm: $(RTS_WASM_O) $(RTS_RUST_WASM_O) $(TOMMATH_WASM_O) $(MUSL_WASM_O) $(WASM_LD) -o $@ \ --import-memory --shared --no-entry --gc-sections \ --export=__wasm_call_ctors \ + --whole-archive \ $+ # # A simple program to do simple tests of rts.c, using native compilation # -test_rts: test_rts.c $(RTS_NATIVE_O) $(TOMMATH_NATIVE_O) +test_rts: test_rts.c $(RTS_NATIVE_O) $(RTS_RUST_NATIVE_O) $(TOMMATH_NATIVE_O) $(CLANG) -o $@ $+ -test_leb128: test_leb128.c $(RTS_NATIVE_O) $(TOMMATH_NATIVE_O) +test_leb128: test_leb128.c $(RTS_NATIVE_O) $(RTS_RUST_NATIVE_O) $(TOMMATH_NATIVE_O) $(CLANG) -o $@ $+ clean: - rm -rf _build mo-rts.wasm test_rts test_leb128 - + rm -rf _build mo-rts.wasm test_rts test_leb128 motoko-rts/target diff --git a/rts/motoko-rts/.cargo/config b/rts/motoko-rts/.cargo/config new file mode 100644 index 00000000000..5eaa82beb8a --- /dev/null +++ b/rts/motoko-rts/.cargo/config @@ -0,0 +1,4 @@ +# NB. codegen-units=1 is not necessary, but it generates less .o files for core, +# std, and compiler_builtins and makes it easier to find symbols. +[build] +rustflags = ["-Crelocation-model=pic", "-Ccodegen-units=1"] diff --git a/rts/motoko-rts/.vim/coc-settings.json b/rts/motoko-rts/.vim/coc-settings.json new file mode 100644 index 00000000000..cfb30689af9 --- /dev/null +++ b/rts/motoko-rts/.vim/coc-settings.json @@ -0,0 +1,8 @@ +// https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/package.json +{ + "rust-analyzer.cargo.target": "wasm32-unknown-emscripten", + + // This is required as `cargo check --all-targets` doesn't seem to work well + // on no-std crates, it generates false "duplicate lang item" errors. + "rust-analyzer.checkOnSave.allTargets": false +} diff --git a/rts/motoko-rts/Cargo.lock b/rts/motoko-rts/Cargo.lock new file mode 100644 index 00000000000..3018ee72481 --- /dev/null +++ b/rts/motoko-rts/Cargo.lock @@ -0,0 +1,14 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "libc" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" + +[[package]] +name = "motoko-rts" +version = "0.1.0" +dependencies = [ + "libc", +] diff --git a/rts/motoko-rts/Cargo.toml b/rts/motoko-rts/Cargo.toml new file mode 100644 index 00000000000..53fd42ce26e --- /dev/null +++ b/rts/motoko-rts/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "motoko-rts" +version = "0.1.0" +authors = ["Ömer Sinan Ağacan "] +edition = "2018" + +[dependencies] +libc = "0.2.73" + +[lib] +crate-type = ["staticlib"] + +[profile.dev] +panic = "abort" + +[profile.release] +panic = "abort" diff --git a/rts/motoko-rts/src/alloc.rs b/rts/motoko-rts/src/alloc.rs new file mode 100644 index 00000000000..668b2eab56d --- /dev/null +++ b/rts/motoko-rts/src/alloc.rs @@ -0,0 +1,41 @@ +//! Implements allocation routines used by the generated code and the GC. + +use core::arch::wasm32; + +use crate::common::rts_trap_with; +use crate::gc; +use crate::types::*; + +#[no_mangle] +pub unsafe extern "C" fn alloc_bytes(n: Bytes) -> SkewedPtr { + alloc_words(bytes_to_words(n)) +} + +#[no_mangle] +pub unsafe extern "C" fn alloc_words(n: Words) -> SkewedPtr { + let bytes = words_to_bytes(n); + // Update ALLOCATED + gc::ALLOCATED.0 += bytes.0 as u64; + + // Update heap pointer + let old_hp = gc::get_hp(); + let new_hp = old_hp + bytes.0 as usize; + gc::set_hp(new_hp); + + // Grow memory if needed + grow_memory(new_hp); + + skew(old_hp) +} + +/// Page allocation. Ensures that the memory up to the given pointer is allocated. +pub(crate) unsafe fn grow_memory(ptr: usize) { + let total_pages_needed = ((ptr / 65536) + 1) as i32; + let current_pages = wasm32::memory_size(0) as i32; + let new_pages_needed = total_pages_needed - current_pages; + if new_pages_needed > 0 { + if wasm32::memory_grow(0, new_pages_needed as usize) == core::usize::MAX { + rts_trap_with("Cannot grow memory\0".as_ptr()); + } + } +} diff --git a/rts/motoko-rts/src/common.rs b/rts/motoko-rts/src/common.rs new file mode 100644 index 00000000000..0f5fb99567e --- /dev/null +++ b/rts/motoko-rts/src/common.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn rts_trap_with(msg: *const u8) -> !; +} diff --git a/rts/motoko-rts/src/debug.rs b/rts/motoko-rts/src/debug.rs new file mode 100644 index 00000000000..902764f574f --- /dev/null +++ b/rts/motoko-rts/src/debug.rs @@ -0,0 +1,151 @@ +#![allow(dead_code)] + +use crate::gc; +use crate::print::*; +use crate::types::*; + +use core::fmt::Write; + +pub(crate) unsafe fn dump_heap() { + print_closure_table(); + print_static_roots(); + print_heap(); +} + +pub(crate) unsafe fn print_closure_table() { + let closure_tbl = gc::closure_table_loc().unskew() as *const SkewedPtr; + + if (*closure_tbl).0 == 0 { + println!(100, "Closure table not initialized"); + return; + } + + let len = (*((*closure_tbl).unskew() as *const Array)).len; + + if len == 0 { + println!(50, "Closure table empty"); + return; + } + + let arr = (*closure_tbl).unskew() as *const Array; + + println!(50, "Closure table: {}", len); + + let mut buf = [0u8; 1000]; + let mut write_buf = WriteBuf::new(&mut buf); + + for i in 0..len { + let elem = array_get(arr, i); + if !gc::is_tagged_scalar(SkewedPtr(elem as usize)) { + let _ = write!(&mut write_buf, "{}: {:#x} --> ", i, elem.wrapping_add(1)); + print_closure(&mut write_buf, SkewedPtr(elem as usize).unskew()); + print(&write_buf); + write_buf.reset(); + } + } + println!(50, "End of closure table"); +} + +pub(crate) unsafe fn print_static_roots() { + let static_roots = gc::get_static_roots().unskew() as *const Array; + let len = (*static_roots).len; + + if len == 0 { + println!(50, "Static roots empty"); + return; + } + + println!(50, "Static roots: {}", len); + + let mut buf = [0u8; 1000]; + let mut write_buf = WriteBuf::new(&mut buf); + + for i in 0..len { + let obj = SkewedPtr(array_get(static_roots, i) as usize); + let _ = write!(&mut write_buf, "{}: {:#x} --> ", i, obj.unskew()); + print_closure(&mut write_buf, obj.unskew()); + print(&write_buf); + write_buf.reset(); + } + + println!(50, "End of static roots"); +} + +unsafe fn print_heap() { + let heap_begin = gc::get_heap_base(); + let heap_end = gc::get_hp(); + + println!( + 200, + "Heap begin={:#x}, heap end={:#x}, size={} bytes", + heap_begin, + heap_end, + heap_end - heap_begin + ); + + let mut buf = [0u8; 1000]; + let mut write_buf = WriteBuf::new(&mut buf); + + let mut p = heap_begin; + while p < heap_end { + let _ = write!(&mut write_buf, "{:#x}: ", p); + print_closure(&mut write_buf, p); + print(&write_buf); + write_buf.reset(); + + p += words_to_bytes(gc::object_size(p)).0 as usize; + } +} + +unsafe fn print_closure(buf: &mut WriteBuf, p: usize) { + let obj = p as *const Obj; + let tag = (*obj).tag; + + match tag { + TAG_OBJECT => { + let _ = write!(buf, ""); + } + TAG_OBJ_IND => { + let _ = write!(buf, ""); + } + TAG_ARRAY => { + let _ = write!(buf, ""); + } + TAG_BITS64 => { + let _ = write!(buf, ""); + } + TAG_MUTBOX => { + let _ = write!(buf, ""); + } + TAG_CLOSURE => { + let _ = write!(buf, ""); + } + TAG_SOME => { + let _ = write!(buf, ""); + } + TAG_VARIANT => { + let _ = write!(buf, ""); + } + TAG_BLOB => { + let _ = write!(buf, ""); + } + TAG_INDIRECTION => { + let _ = write!(buf, ""); + } + TAG_BITS32 => { + let _ = write!(buf, ""); + } + TAG_BIGINT => { + let _ = write!(buf, ""); + } + TAG_CONCAT => { + let _ = write!(buf, ""); + } + TAG_STABLE_SEEN => { + let _ = write!(buf, ""); + } + other => { + let _ = write!(buf, "", other); + } + } +} diff --git a/rts/motoko-rts/src/gc.rs b/rts/motoko-rts/src/gc.rs new file mode 100644 index 00000000000..875f1681e3b --- /dev/null +++ b/rts/motoko-rts/src/gc.rs @@ -0,0 +1,419 @@ +use crate::alloc; +use crate::common::rts_trap_with; +use crate::types::*; + +extern "C" { + /// Get end_of_heap. Implemented by the compiler. + pub(crate) fn get_hp() -> usize; + + /// Set end_of_heap. Implemented by the compiler. + pub(crate) fn set_hp(hp: usize); + + /// Get __heap_base + pub(crate) fn get_heap_base() -> usize; + + /// Skewed pointer to a skewed pointer to an array. See closure-table.c for details. + pub(crate) fn closure_table_loc() -> SkewedPtr; + + pub(crate) fn get_static_roots() -> SkewedPtr; + + pub(crate) fn as_memcpy(to: usize, from: usize, n: Bytes); +} + +/// Maximum live data retained in a GC. +// +// NOTE (osa): In the original code (compile.ml) this variable was 64-bit, but I'm not sure why +// that is necessary. Pointers in wasm32 are 32-bits so if the entire address space is live you +// you max u32::MAX here, no need for 64-bits. +// +static mut MAX_LIVE: Bytes = Bytes(0); + +/// Amount of garbage collected so far. +static mut RECLAIMED: Bytes = Bytes(0); + +/// Counter for total allocations done by `alloc::alloc_words` (called by the generated code). +pub static mut ALLOCATED: Bytes = Bytes(0); + +unsafe fn note_live_size(live: Bytes) { + MAX_LIVE = Bytes(::core::cmp::max(MAX_LIVE.0, live.0)); +} + +#[no_mangle] +pub unsafe extern "C" fn get_max_live_size() -> Bytes { + MAX_LIVE +} + +unsafe fn note_reclaimed(reclaimed: Bytes) { + RECLAIMED.0 += reclaimed.0 as u64; +} + +#[no_mangle] +pub unsafe extern "C" fn get_reclaimed() -> Bytes { + RECLAIMED +} + +#[no_mangle] +pub unsafe extern "C" fn get_total_allocations() -> Bytes { + ALLOCATED +} + +/// Returns object size in words +pub(crate) unsafe fn object_size(obj: usize) -> Words { + let obj = obj as *const Obj; + match (*obj).tag { + TAG_OBJECT => { + let object = obj as *const Object; + let size = (*object).size; + Words(size + 3) // TODO: document what "3" includes + } + + TAG_OBJ_IND => Words(2), + + TAG_ARRAY => { + let array = obj as *const Array; + let size = (*array).len; + Words(size + 2) // TODO: document what "2" includes + } + + TAG_BITS64 => Words(3), + + TAG_MUTBOX => Words(2), + + TAG_CLOSURE => { + let closure = obj as *const Closure; + let size = (*closure).size; + Words(size + 3) // TODO: document what "3" includes + } + + TAG_SOME => Words(2), + + TAG_VARIANT => Words(3), + + TAG_BLOB => { + let blob = obj as *const Blob; + Words(bytes_to_words((*blob).len).0 + 2) // TODO: document this + } + + TAG_INDIRECTION => { + rts_trap_with("object_size of indirection\0".as_ptr()); + } + + TAG_BITS32 => Words(2), + + TAG_BIGINT => Words(5), + + TAG_CONCAT => Words(4), + + other => { + let msg = format!(200, "invalid object tag {} in object size\0", other); + rts_trap_with(msg.as_ptr()); + } + } +} + +pub(crate) fn is_tagged_scalar(p: SkewedPtr) -> bool { + p.0 & 0b1 == 0 +} + +unsafe fn memcpy_words(to: usize, from: usize, n: Words) { + as_memcpy(to, from, words_to_bytes(n)) +} + +unsafe fn memcpy_bytes(to: usize, from: usize, n: Bytes) { + as_memcpy(to, from, n) +} + +unsafe fn memset(s: usize, c: Words, b: u32) { + let s_ptr = s as *mut u32; + for i in 0..c.0 { + *s_ptr.offset(i as isize) = b; + } +} + +/// Evacuate (copy) an object in from-space to to-space, return new end of to-space. Returns the +/// original to-space if the object is already evacuated. +/// +/// Arguments: +/// +/// - begin_from_space: Where the dynamic heap starts. Used for two things: +/// +/// - An object is static if its address is below this value. These objects don't point to +/// dynamic heap so we skip those. +/// +/// - After all objects are evacuated we move to-space to from-space, to be able to do that the +/// pointers need to point to their locations in from-space, which is calculated with +/// `end_to_space - begin_to_space + begin_from_space`. +/// +/// - begin_to_space: Where to-space starts. See above for how this is used. +/// +/// - end_to_space: Where the object in `ptr_loc` will be copied. +/// +/// - ptr_loc: Location of the object to evacuate, e.g. an object field address. +/// +unsafe fn evac( + begin_from_space: usize, + begin_to_space: usize, + end_to_space: usize, + ptr_loc: usize, +) -> usize { + // Field holds a skewed pointer to the object to evacuate + let ptr_loc = ptr_loc as *mut SkewedPtr; + + if is_tagged_scalar(*ptr_loc) { + return end_to_space; + } + + // Ignore static objects, they can't point to dynamic heap + if (*ptr_loc).unskew() < begin_from_space { + return end_to_space; + } + + let obj = (*ptr_loc).unskew() as *mut Obj; + + // Update the field if the object is already evacauted + if (*obj).tag == TAG_INDIRECTION { + let fwd = (*(obj as *const Indirection)).fwd; + *ptr_loc = fwd; + return end_to_space; + } + + let obj_size = object_size(obj as usize); + let obj_size_bytes = words_to_bytes(obj_size); + + // Grow memory if needed + alloc::grow_memory(end_to_space + obj_size_bytes.0 as usize); + + // Copy object to to-space + memcpy_words(end_to_space, obj as usize, obj_size); + + // Final location of the object after copying to-space back to from-space + let obj_loc = (end_to_space - begin_to_space) + begin_from_space; + + // Set forwarding pointer + let fwd = obj as *mut Indirection; + (*fwd).header.tag = TAG_INDIRECTION; + (*fwd).fwd = skew(obj_loc); + + // Update evacuated field + *ptr_loc = skew(obj_loc); + + // Return new end of to-space + end_to_space + obj_size_bytes.0 as usize +} + +/// Evacuate a blob payload pointed by a bigint. bigints are special in that a bigint's first field +/// is an internal pointer: it points to payload of a blob object, instead of to the header. +/// +/// - `ptr_loc`: Address of a `data_ptr` field of a BigInt (see types.rs). Points to payload of a +/// blob. See types.rs for blob layout. +unsafe fn evac_bigint_blob( + begin_from_space: usize, + begin_to_space: usize, + end_to_space: usize, + ptr_loc: *mut usize, // address of field with a pointer to a blob payload +) -> usize { + let blob_payload_addr = *ptr_loc; + + // Get blob object from the payload + let mut blob_obj_addr = skew(blob_payload_addr - 2 * (WORD_SIZE as usize)); + // Create a temporary field to the blob object, to be passed to `evac`. + let blob_obj_addr_field = &mut blob_obj_addr; + let blob_obj_addr_field_ptr = blob_obj_addr_field as *mut _; + + let ret = evac( + begin_from_space, + begin_to_space, + end_to_space, + blob_obj_addr_field_ptr as usize, + ); + + // blob_obj_addr_field now has the new location of the blob, get the payload address + let blob_new_addr = (*blob_obj_addr_field).unskew(); + let blob_new_payload_addr = blob_new_addr + 2 * (WORD_SIZE as usize); + + // Update evacuated field + *ptr_loc = blob_new_payload_addr; // not skewed! + + ret +} + +unsafe fn scav( + begin_from_space: usize, + begin_to_space: usize, + mut end_to_space: usize, + obj: usize, +) -> usize { + let obj = obj as *const Obj; + + match (*obj).tag { + TAG_OBJECT => { + let obj = obj as *mut Object; + let obj_payload = obj.offset(1) as *mut SkewedPtr; + for i in 0..(*obj).size as isize { + end_to_space = evac( + begin_from_space, + begin_to_space, + end_to_space, + obj_payload.offset(i) as usize, + ); + } + } + + TAG_ARRAY => { + let array = obj as *mut Array; + let array_payload = array.offset(1) as *mut SkewedPtr; + for i in 0..(*array).len as isize { + end_to_space = evac( + begin_from_space, + begin_to_space, + end_to_space, + array_payload.offset(i) as usize, + ); + } + } + + TAG_MUTBOX => { + let mutbox = obj as *mut MutBox; + let field_addr = ((&mut (*mutbox).field) as *mut _) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field_addr); + } + + TAG_CLOSURE => { + let closure = obj as *mut Closure; + let closure_payload = closure.offset(1) as *mut SkewedPtr; + for i in 0..(*closure).size as isize { + end_to_space = evac( + begin_from_space, + begin_to_space, + end_to_space, + closure_payload.offset(i) as usize, + ); + } + } + + TAG_SOME => { + let some = obj as *mut Some; + let field_addr = ((&mut (*some).field) as *mut _) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field_addr); + } + + TAG_VARIANT => { + let variant = obj as *mut Variant; + let field_addr = ((&mut (*variant).field) as *mut _) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field_addr); + } + + TAG_BIGINT => { + let bigint = obj as *mut BigInt; + let data_ptr_addr = (&mut (*bigint).data_ptr) as *mut _; + + end_to_space = evac_bigint_blob( + begin_from_space, + begin_to_space, + end_to_space, + data_ptr_addr, + ); + } + + TAG_CONCAT => { + let concat = obj as *mut Concat; + let field1_addr = ((&mut (*concat).text1) as *mut _) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field1_addr); + let field2_addr = ((&mut (*concat).text2) as *mut _) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field2_addr); + } + + TAG_OBJ_IND => { + let field_addr = obj.offset(1) as usize; + end_to_space = evac(begin_from_space, begin_to_space, end_to_space, field_addr); + } + + TAG_BITS64 | TAG_BITS32 | TAG_BLOB => { + // These don't include pointers, skip + } + + TAG_INDIRECTION => { + // These are ignored in the original code for some reason + // TODO (osa): I think this branch should panic + } + + _ => { + // Any other tag is a bug + rts_trap_with("invalid object tag in scav\0".as_ptr()); + } + } + + end_to_space +} + +// We have a special evacuation routine for "static roots" array: we don't evacuate elements of +// "static roots", we just scavenge them. +unsafe fn evac_static_roots( + begin_from_space: usize, + begin_to_space: usize, + mut end_to_space: usize, + roots: *const Array, +) -> usize { + // Roots are in a static array which we don't evacuate. Only evacuate elements. + for i in 0..(*roots).len { + let obj = SkewedPtr(array_get(roots, i) as usize); + end_to_space = scav(begin_from_space, begin_to_space, end_to_space, obj.unskew()); + } + end_to_space +} + +/// The entry point. Called by the generated code. +#[no_mangle] +pub unsafe extern "C" fn collect() { + // Beginning of tospace = end of fromspace + let begin_from_space = get_heap_base(); + let end_from_space = get_hp(); + let begin_to_space = end_from_space; + let mut end_to_space = begin_to_space; + + let static_roots = get_static_roots().unskew() as *const Array; + + // Evacuate roots + end_to_space = evac_static_roots(begin_from_space, begin_to_space, end_to_space, static_roots); + + end_to_space = evac( + begin_from_space, + begin_to_space, + end_to_space, + closure_table_loc().unskew(), + ); + + // Scavenge to-space + let mut p = begin_to_space; + while p < end_to_space { + end_to_space = scav(begin_from_space, begin_to_space, end_to_space, p); + p += words_to_bytes(object_size(p)).0 as usize; + } + + // Note the stats + let new_live_size = end_to_space - begin_to_space; + note_live_size(Bytes(new_live_size as u32)); + + let reclaimed = (end_from_space - begin_from_space) - (end_to_space - begin_to_space); + note_reclaimed(Bytes(reclaimed as u32)); + + // Copy to-space to the beginning of from-space + memcpy_bytes( + begin_from_space, + begin_to_space, + Bytes((end_to_space - begin_to_space) as u32), + ); + + // Reset the heap pointer + let new_hp = begin_from_space + (end_to_space - begin_to_space); + set_hp(new_hp); + + // Reset scratch space (for debugging purposes) + memset( + new_hp, + bytes_to_words(Bytes((end_to_space - new_hp) as u32)), + 0, + ); + + crate::debug::dump_heap(); // TODO (osa): The test 'life' fails if I remove this line?!?!?! +} diff --git a/rts/motoko-rts/src/lib.rs b/rts/motoko-rts/src/lib.rs new file mode 100644 index 00000000000..80368601b91 --- /dev/null +++ b/rts/motoko-rts/src/lib.rs @@ -0,0 +1,34 @@ +//! Implements bits and pieces of Motoko runtime system. Currently garbage collection and a few +//! utilities. + +#![no_std] + +#[macro_use] +mod print; + +mod common; + +#[cfg(target_arch = "wasm32")] +mod types; + +#[cfg(target_arch = "wasm32")] +mod debug; + +#[cfg(target_arch = "wasm32")] +mod alloc; + +#[cfg(target_arch = "wasm32")] +mod gc; + +#[cfg(target_arch = "wasm32")] +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + unsafe { ::core::arch::wasm32::unreachable() } +} + +// TODO: Native version should print and abort the process with return code 1. +#[cfg(not(target_arch = "wasm32"))] +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/rts/motoko-rts/src/print.rs b/rts/motoko-rts/src/print.rs new file mode 100644 index 00000000000..238ca23acc2 --- /dev/null +++ b/rts/motoko-rts/src/print.rs @@ -0,0 +1,136 @@ +//! Implements non-allocating printing utilities. All allocations are done on stack. +//! +//! TODO: native versions of the macros/functions currently don't do anything. + +use core::fmt; + +/* +NB (osa): Implementation below uses const_generics and non-inlined function, which is probably +better for code size, but generates this warning: + + warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause + compiler crashes + +which looks scary. + +--- + +use crate::common::WriteBuf; + +#[macro_export] +macro_rules! println { + ($buf_size:tt, $($arg:tt)*) => ({ + $crate::print::print::<$buf_size>(::core::format_args_nl!($($arg)*)); + }) +} + +pub(crate) fn print(args: fmt::Arguments<'_>) { + let mut buf = [0 as u8; BUF_SIZE]; + let mut fmt = WriteBuf::new(&mut buf); + fmt.write_fmt(args).unwrap(); + fmt.print(); +} +*/ + +#[macro_export] +macro_rules! println { + ($buf_size:tt, $($arg:tt)*) => ({ + { + use core::fmt::Write; + let mut buf = [0 as u8; $buf_size]; + let mut fmt = $crate::print::WriteBuf::new(&mut buf); + let _ = write!(&mut fmt, $($arg)*); + $crate::print::print(&fmt); + } + }) +} + +#[macro_export] +macro_rules! format { + ($buf_size:tt, $($arg:tt)*) => ({ + { + use core::fmt::Write; + let mut buf = [0 as u8; $buf_size]; + let mut fmt = $crate::print::WriteBuf::new(&mut buf); + let _ = write!(&mut fmt, $($arg)*); + buf + } + }) +} + +pub(crate) struct WriteBuf<'a> { + buf: &'a mut [u8], + offset: usize, +} + +impl<'a> WriteBuf<'a> { + pub(crate) fn new(buf: &'a mut [u8]) -> Self { + Self { + buf: buf, + offset: 0, + } + } + + pub(crate) fn reset(&mut self) { + self.offset = 0; + } +} + +// https://stackoverflow.com/questions/39488327/how-to-format-output-to-a-byte-array-with-no-std-and-no-allocator +impl<'a> fmt::Write for WriteBuf<'a> { + fn write_str(&mut self, s: &str) -> fmt::Result { + let bytes = s.as_bytes(); + // Skip over already-copied data + let remainder = &mut self.buf[self.offset..]; + // Check if there is space remaining (return error instead of panicking) + if remainder.len() < bytes.len() { + return Err(core::fmt::Error); + } + // Make the two slices the same length + let remainder = &mut remainder[..bytes.len()]; + // Copy + remainder.copy_from_slice(bytes); + // Update offset to avoid overwriting + self.offset += bytes.len(); + + Ok(()) + } +} + +// TODO (osa): ic0 is only available when compiling to the IC, so the commented-out code below only +// compiles when using IC. +// +// I think we can have another RTS library for emulating some of the IC functions (e.g. +// debug_print) and link that in the final program when compiling to WASI, but that probably +// requires some work on mo-ld. + +#[cfg(target_arch = "wasm32")] +pub(crate) mod ic0 { + // NB: The #[link(...)] line below really needs to be before `extern "C"` part, we can't move + // it inside the extern block, it doesn't work. + // #[link(wasm_import_module = "ic0")] + // extern "C" { + // #[no_mangle] + // pub(crate) fn debug_print(msg: *const u8, len: u32); + // } + + pub(crate) fn debug_print(_msg: *const u8, _len: u32) {} +} + +#[cfg(target_arch = "wasm32")] +pub(crate) unsafe fn print(buf: &WriteBuf) { + ic0::debug_print(buf.buf.as_ptr(), buf.offset as u32); +} + +#[cfg(target_arch = "wasm32")] +pub(crate) unsafe fn debug_print(s: &str) { + ic0::debug_print(s.as_ptr(), s.len() as u32) +} + +// TODO +#[cfg(not(target_arch = "wasm32"))] +pub(crate) unsafe fn print(_buf: &WriteBuf) {} + +// TODO +#[cfg(not(target_arch = "wasm32"))] +pub(crate) unsafe fn debug_print(_s: &str) {} diff --git a/rts/motoko-rts/src/types.rs b/rts/motoko-rts/src/types.rs new file mode 100644 index 00000000000..0a8ae9b009e --- /dev/null +++ b/rts/motoko-rts/src/types.rs @@ -0,0 +1,143 @@ +pub const WORD_SIZE: u32 = 4; + +pub fn words_to_bytes(words: Words) -> Bytes { + Bytes(words.0 * WORD_SIZE) +} + +// Rounds up +pub fn bytes_to_words(bytes: Bytes) -> Words { + // Rust issue for adding ceiling_div: https://github.com/rust-lang/rfcs/issues/2844 + Words((bytes.0 + WORD_SIZE - 1) / WORD_SIZE) +} + +/// The unit "words": `Words(123u32)` means 123 words. +#[repr(C)] +#[derive(PartialEq, Eq, Clone, Copy)] +pub struct Words(pub A); + +/// The unit "bytes": `Bytes(123u32)` means 123 bytes. +#[repr(C)] +#[derive(PartialEq, Eq, Clone, Copy)] +pub struct Bytes(pub A); + +#[repr(C)] +#[derive(Clone, Copy)] +pub struct SkewedPtr(pub usize); + +impl SkewedPtr { + pub fn unskew(self) -> usize { + self.0.wrapping_add(1) + } +} + +pub fn skew(ptr: usize) -> SkewedPtr { + SkewedPtr(ptr.wrapping_sub(1)) +} + +// NOTE: We don't create an enum for tags as we can never assume to do exhaustive pattern match on +// tags, because of heap corruptions and other bugs (in the code generator or RTS, or maybe because +// of an unsafe API usage). +pub type Tag = u32; + +pub const TAG_OBJECT: Tag = 1; +pub const TAG_OBJ_IND: Tag = 2; +pub const TAG_ARRAY: Tag = 3; +pub const TAG_BITS64: Tag = 5; +pub const TAG_MUTBOX: Tag = 6; +pub const TAG_CLOSURE: Tag = 7; +pub const TAG_SOME: Tag = 8; +pub const TAG_VARIANT: Tag = 9; +pub const TAG_BLOB: Tag = 10; +pub const TAG_INDIRECTION: Tag = 11; +pub const TAG_BITS32: Tag = 12; +pub const TAG_BIGINT: Tag = 13; +pub const TAG_CONCAT: Tag = 14; +pub const TAG_STABLE_SEEN: Tag = 0xffffffff; // No idea what this is + +// Common parts of any object. Other object pointers can be coerced into a pointer to this. +#[repr(C)] +pub struct Obj { + pub tag: Tag, +} + +#[repr(C)] +#[rustfmt::skip] +pub struct Array { + pub header: Obj, + pub len: u32, // number of elements + + // Array elements follow, each u32 sized. We can't have variable-sized structs in Rust so we + // can't add a field here for the elements. + // https://doc.rust-lang.org/nomicon/exotic-sizes.html +} + +pub(crate) unsafe fn array_get(array: *const Array, idx: u32) -> u32 { + let slot_addr = array.offset(1) as usize + (idx * WORD_SIZE) as usize; + *(slot_addr as *const u32) +} + +#[repr(C)] +pub struct Object { + pub header: Obj, + pub size: u32, + pub hash_ptr: u32, // TODO: Not sure how this is used, we don't scavenge this field in GC + // other stuff follows, but we don't need them currently +} + +#[repr(C)] +pub struct Closure { + pub header: Obj, + pub funid: u32, + pub size: u32, // number of elements + // other stuff follows ... +} + +#[repr(C)] +pub struct Blob { + pub header: Obj, + pub len: Bytes, + // data follows .. +} + +// aka. a forwarding pointer +#[repr(C)] +pub struct Indirection { + pub header: Obj, + pub fwd: SkewedPtr, +} + +#[repr(C)] +pub struct BigInt { + pub header: Obj, + pub size: u32, + pub alloc: u32, // TODO: Not sure what this is + // Unskewed pointer to a blob payload. data_ptr - 2 (words) gives us the blob header. + pub data_ptr: usize, +} + +#[repr(C)] +pub struct MutBox { + pub header: Obj, + pub field: SkewedPtr, +} + +#[repr(C)] +pub struct Some { + pub header: Obj, + pub field: SkewedPtr, +} + +#[repr(C)] +pub struct Variant { + pub header: Obj, + pub tag: u32, + pub field: SkewedPtr, +} + +#[repr(C)] +pub struct Concat { + pub header: Obj, + pub n_bytes: u32, + pub text1: SkewedPtr, + pub text2: SkewedPtr, +} diff --git a/src/codegen/compile.ml b/src/codegen/compile.ml index 0c61da14291..6ffd324aa1d 100644 --- a/src/codegen/compile.ml +++ b/src/codegen/compile.ml @@ -805,6 +805,12 @@ module RTS = struct E.add_func_import env "rts" "char_is_lowercase" [I32Type] [I32Type]; E.add_func_import env "rts" "char_is_uppercase" [I32Type] [I32Type]; E.add_func_import env "rts" "char_is_alphabetic" [I32Type] [I32Type]; + E.add_func_import env "rts" "get_max_live_size" [] [I32Type]; + E.add_func_import env "rts" "get_reclaimed" [] [I64Type]; + E.add_func_import env "rts" "collect" [] []; + E.add_func_import env "rts" "alloc_bytes" [I32Type] [I32Type]; + E.add_func_import env "rts" "alloc_words" [I32Type] [I32Type]; + E.add_func_import env "rts" "get_total_allocations" [] [I64Type]; () end (* RTS *) @@ -826,117 +832,34 @@ module Heap = struct G.i (GlobalGet (nr (E.get_global env "end_of_heap"))) let set_heap_ptr env = G.i (GlobalSet (nr (E.get_global env "end_of_heap"))) - let get_skewed_heap_ptr env = get_heap_ptr env ^^ compile_add_const ptr_skew let register_globals env = (* end-of-heap pointer, we set this to __heap_base upon start *) E.add_global32 env "end_of_heap" Mutable 0xDEADBEEFl; - (* counter for total allocations *) - E.add_global64 env "allocations" Mutable 0L; - (* counter for total reclaimed bytes *) E.add_global64 env "reclaimed" Mutable 0L; (* counter for max live bytes *) E.add_global64 env "max_live" Mutable 0L - let count_allocations env = - (* assumes number of allocated bytes on the stack *) - G.i (Convert (Wasm.Values.I64 I64Op.ExtendUI32)) ^^ - G.i (GlobalGet (nr (E.get_global env "allocations"))) ^^ - G.i (Binary (Wasm.Values.I64 I64Op.Add)) ^^ - G.i (GlobalSet (nr (E.get_global env "allocations"))) - let get_total_allocation env = - G.i (GlobalGet (nr (E.get_global env "allocations"))) - - let add_reclaimed env = - (* assumes number of reclaimed bytes on the stack *) - G.i (Convert (Wasm.Values.I64 I64Op.ExtendUI32)) ^^ - G.i (GlobalGet (nr (E.get_global env "reclaimed"))) ^^ - G.i (Binary (Wasm.Values.I64 I64Op.Add)) ^^ - G.i (GlobalSet (nr (E.get_global env "reclaimed"))) + E.call_import env "rts" "get_total_allocations" let get_reclaimed env = - G.i (GlobalGet (nr (E.get_global env "reclaimed"))) + E.call_import env "rts" "get_reclaimed" let get_memory_size = G.i MemorySize ^^ compile_mul_const page_size - let note_live_size env = - (* assumes size of live set on the stack *) - let (set_live_size, get_live_size) = new_local env "live_size" in - set_live_size ^^ - get_live_size ^^ G.i (Convert (Wasm.Values.I64 I64Op.ExtendUI32)) ^^ - G.i (GlobalGet (nr (E.get_global env "max_live"))) ^^ - G.i (Compare (Wasm.Values.I64 I64Op.LtU)) ^^ - G.if_ [] G.nop begin - get_live_size ^^ G.i (Convert (Wasm.Values.I64 I64Op.ExtendUI32)) ^^ - G.i (GlobalSet (nr (E.get_global env "max_live"))) - end - let get_max_live_size env = - G.i (GlobalGet (nr (E.get_global env "max_live"))) - - - (* Page allocation. Ensures that the memory up to the given unskewed pointer is allocated. *) - let grow_memory env = - Func.share_code1 env "grow_memory" ("ptr", I32Type) [] (fun env get_ptr -> - let (set_pages_needed, get_pages_needed) = new_local env "pages_needed" in - get_ptr ^^ compile_divU_const page_size ^^ - compile_add_const 1l ^^ - G.i MemorySize ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - set_pages_needed ^^ - - (* Check that the new heap pointer is within the memory *) - get_pages_needed ^^ - compile_unboxed_zero ^^ - G.i (Compare (Wasm.Values.I32 I32Op.GtS)) ^^ - G.if_ [] - ( get_pages_needed ^^ - G.i MemoryGrow ^^ - (* Check result *) - compile_unboxed_zero ^^ - G.i (Compare (Wasm.Values.I32 I32Op.LtS)) ^^ - E.then_trap_with env "Cannot grow memory." - ) G.nop - ) - - let dyn_alloc_words env = G.i (Call (nr (E.built_in env "alloc_words"))) - let dyn_alloc_bytes env = G.i (Call (nr (E.built_in env "alloc_bytes"))) + E.call_import env "rts" "get_max_live_size" - let declare_alloc_functions env = - (* Dynamic allocation *) - Func.define_built_in env "alloc_words" [("n", I32Type)] [I32Type] (fun env -> - (* expects the size (in words), returns the skewed pointer *) - let get_n = G.i (LocalGet (nr 0l)) in - (* return the current pointer (skewed) *) - get_skewed_heap_ptr env ^^ - - (* Count allocated bytes *) - get_n ^^ compile_mul_const word_size ^^ - count_allocations env ^^ - - (* Update heap pointer *) - get_heap_ptr env ^^ - get_n ^^ compile_mul_const word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - set_heap_ptr env ^^ - - (* grow memory if needed *) - get_heap_ptr env ^^ grow_memory env - ); - Func.define_built_in env "alloc_bytes" [("n", I32Type)] [I32Type] (fun env -> - let get_n = G.i (LocalGet (nr 0l)) in - (* Round up to next multiple of the word size and convert to words *) - get_n ^^ - compile_add_const 3l ^^ - compile_divU_const word_size ^^ - dyn_alloc_words env - ) + let dyn_alloc_words env = + E.call_import env "rts" "alloc_words" + let dyn_alloc_bytes env = + E.call_import env "rts" "alloc_bytes" (* Static allocation (always words) (uses dynamic allocation for smaller and more readable code) *) @@ -998,24 +921,6 @@ module Heap = struct (* Comparing bytes (works on unskewed memory addresses) *) let memcmp env = E.call_import env "rts" "as_memcmp" - (* Copying words (works on skewed memory addresses) *) - let memcpy_words_skewed env = - Func.share_code3 env "memcpy_words_skewed" (("to", I32Type), ("from", I32Type), ("n", I32Type)) [] (fun env get_to get_from get_n -> - get_n ^^ - from_0_to_n env (fun get_i -> - get_to ^^ - get_i ^^ compile_mul_const word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - - get_from ^^ - get_i ^^ compile_mul_const word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - load_ptr ^^ - - store_ptr - ) - ) - end (* Heap *) module Stack = struct @@ -1068,7 +973,6 @@ module ClosureTable = struct let recall env : G.t = E.call_import env "rts" "recall_closure" let count env : G.t = E.call_import env "rts" "closure_count" let size env : G.t = E.call_import env "rts" "closure_table_size" - let root env : G.t = E.call_import env "rts" "closure_table_loc" end (* ClosureTable *) module Bool = struct @@ -1227,10 +1131,10 @@ module Tagged = struct | Some (* For opt *) | Variant | Blob - | Indirection + (* | Indirection -- commented out, only used by the GC *) | Bits32 (* Contains a 32 bit unsigned number *) | BigInt - | Concat (* String concatenation, used by rts/text.c *) + (* | Concat -- String concatenation, used by rts/text.c *) | StableSeen (* Marker that we have seen this thing before *) (* Let's leave out tag 0 to trap earlier on invalid memory *) @@ -1244,10 +1148,8 @@ module Tagged = struct | Some -> 8l | Variant -> 9l | Blob -> 10l - | Indirection -> 11l | Bits32 -> 12l | BigInt -> 13l - | Concat -> 14l | StableSeen -> 0xffffffffl (* The tag *) @@ -1278,12 +1180,6 @@ module Tagged = struct set_tag ^^ go cases - (* like branch_default but the tag is known statically *) - let branch env retty = function - | [] -> G.i Unreachable - | [_, code] -> G.i Drop ^^ code - | (_, code) :: cases -> branch_default env retty code cases - (* like branch_default but also pushes the scrutinee on the stack for the * branch's consumption *) let _branch_default_with env retty def cases = @@ -2878,9 +2774,6 @@ module Text = struct This is internal to rts/text.c, with the exception of GC-related code. *) - let concat_field1 = Int32.add Tagged.header_size 1l - let concat_field2 = Int32.add Tagged.header_size 2l - let of_ptr_size env = E.call_import env "rts" "text_of_ptr_size" let concat env = @@ -2937,7 +2830,7 @@ module Arr = struct No difference between mutable and immutable arrays. *) - let header_size = Int32.add Tagged.header_size 1l + let header_size = Int32.add Tagged.header_size 1l (* 2 *) let element_size = 4l let len_field = Int32.add Tagged.header_size 0l @@ -3207,6 +3100,9 @@ module Lifecycle = struct end (* Lifecycle *) +let collect_garbage env = + E.call_import env "rts" "collect" + module Dfinity = struct (* Dfinity-specific stuff: System imports, databufs etc. *) @@ -3345,7 +3241,7 @@ module Dfinity = struct G.i (Call (nr (E.built_in env "init"))) ^^ (* Collect garbage *) - G.i (Call (nr (E.built_in env "collect"))) ^^ + collect_garbage env ^^ Lifecycle.trans env Lifecycle.Idle ) in @@ -3382,7 +3278,7 @@ module Dfinity = struct Lifecycle.trans env Lifecycle.InPostUpgrade ^^ G.i (Call (nr (E.built_in env "post_exp"))) ^^ Lifecycle.trans env Lifecycle.Idle ^^ - G.i (Call (nr (E.built_in env "collect"))) + collect_garbage env )) in E.add_export env (nr { @@ -3511,15 +3407,6 @@ end (* Dfinity *) module RTS_Exports = struct let system_exports env = - Heap.declare_alloc_functions env; - E.add_export env (nr { - name = Wasm.Utf8.decode "alloc_bytes"; - edesc = nr (FuncExport (nr (E.built_in env "alloc_bytes"))) - }); - E.add_export env (nr { - name = Wasm.Utf8.decode "alloc_words"; - edesc = nr (FuncExport (nr (E.built_in env "alloc_words"))) - }); let bigint_trap_fi = E.add_fun env "bigint_trap" ( Func.of_body env [] [] (fun env -> E.trap_with env "bigint function error" @@ -3543,157 +3430,6 @@ module RTS_Exports = struct end (* RTS_Exports *) - -module HeapTraversal = struct - (* Returns the object size (in words) *) - let object_size env = - Func.share_code1 env "object_size" ("x", I32Type) [I32Type] (fun env get_x -> - get_x ^^ - Tagged.branch env [I32Type] - [ Tagged.Bits64, - compile_unboxed_const 3l - ; Tagged.Bits32, - compile_unboxed_const 2l - ; Tagged.BigInt, - compile_unboxed_const 5l (* HeapTag + sizeof(mp_int) *) - ; Tagged.Some, - compile_unboxed_const 2l - ; Tagged.Variant, - compile_unboxed_const 3l - ; Tagged.ObjInd, - compile_unboxed_const 2l - ; Tagged.MutBox, - compile_unboxed_const 2l - ; Tagged.Array, - get_x ^^ - Heap.load_field Arr.len_field ^^ - compile_add_const Arr.header_size - ; Tagged.Blob, - get_x ^^ - Heap.load_field Blob.len_field ^^ - compile_add_const 3l ^^ - compile_divU_const Heap.word_size ^^ - compile_add_const Blob.header_size - ; Tagged.Object, - get_x ^^ - Heap.load_field Object.size_field ^^ - compile_add_const Object.header_size - ; Tagged.Closure, - get_x ^^ - Heap.load_field Closure.len_field ^^ - compile_add_const Closure.header_size - ; Tagged.Concat, - compile_unboxed_const 4l - ] - (* Indirections have unknown size. *) - ) - - let walk_heap_from_to env compile_from compile_to mk_code = - let (set_x, get_x) = new_local env "x" in - compile_from ^^ set_x ^^ - compile_while - (* While we have not reached the end of the area *) - ( get_x ^^ - compile_to ^^ - G.i (Compare (Wasm.Values.I32 I32Op.LtU)) - ) - ( mk_code get_x ^^ - get_x ^^ - get_x ^^ object_size env ^^ compile_mul_const Heap.word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - set_x - ) - - let for_each_array_elem env get_array mk_code = - get_array ^^ - Heap.load_field Arr.len_field ^^ - from_0_to_n env (fun get_i -> - mk_code ( - get_array ^^ - get_i ^^ - Arr.idx env - ) - ) - - (* Calls mk_code for each pointer in the object pointed to by get_x, - passing code get the address of the pointer, - and code to get the offset of the pointer (for the BigInt payload field). *) - let for_each_pointer env get_x mk_code mk_code_offset = - let (set_ptr_loc, get_ptr_loc) = new_local env "ptr_loc" in - let code = mk_code get_ptr_loc in - let code_offset = mk_code_offset get_ptr_loc in - get_x ^^ - Tagged.branch_default env [] G.nop - [ Tagged.MutBox, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size MutBox.field) ^^ - set_ptr_loc ^^ - code - ; Tagged.BigInt, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size 4l) ^^ - set_ptr_loc ^^ - code_offset Blob.unskewed_payload_offset - ; Tagged.Some, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size Opt.payload_field) ^^ - set_ptr_loc ^^ - code - ; Tagged.Variant, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size Variant.payload_field) ^^ - set_ptr_loc ^^ - code - ; Tagged.ObjInd, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size 1l) ^^ - set_ptr_loc ^^ - code - ; Tagged.Array, - for_each_array_elem env get_x (fun get_elem_ptr -> - get_elem_ptr ^^ - set_ptr_loc ^^ - code - ) - ; Tagged.Object, - get_x ^^ - Heap.load_field Object.size_field ^^ - - from_0_to_n env (fun get_i -> - get_i ^^ - compile_add_const Object.header_size ^^ - compile_mul_const Heap.word_size ^^ - get_x ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - set_ptr_loc ^^ - code - ) - ; Tagged.Closure, - get_x ^^ - Heap.load_field Closure.len_field ^^ - - from_0_to_n env (fun get_i -> - get_i ^^ - compile_add_const Closure.header_size ^^ - compile_mul_const Heap.word_size ^^ - get_x ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - set_ptr_loc ^^ - code - ) - ; Tagged.Concat, - get_x ^^ - compile_add_const (Int32.mul Heap.word_size Text.concat_field1) ^^ - set_ptr_loc ^^ - code ^^ - get_x ^^ - compile_add_const (Int32.mul Heap.word_size Text.concat_field2) ^^ - set_ptr_loc ^^ - code - ] - -end (* HeapTraversal *) - module Serialization = struct (* The general serialization strategy is as follows: @@ -4937,192 +4673,51 @@ module Stabilization = struct end module GC = struct - (* This is a very simple GC: - It copies everything live to the to-space beyond the bump pointer, - then it memcpies it back, over the from-space (so that we still neatly use - the beginning of memory). - - Roots are: - * All objects in the static part of the memory. - * the closure_table (see module ClosureTable) - *) - - let gc_enabled = true - - (* If the pointer at ptr_loc points after begin_from_space, copy - to after end_to_space, and replace it with a pointer, adjusted for where - the object will be finally. *) - (* Returns the new end of to_space *) - (* Invariant: Must not be called on the same pointer twice. *) - (* All pointers, including ptr_loc and space end markers, are skewed *) - - let evacuate_common env - get_obj update_ptr - get_begin_from_space get_begin_to_space get_end_to_space - = - - let (set_len, get_len) = new_local env "len" in - - (* If this is static, ignore it *) - get_obj ^^ - get_begin_from_space ^^ - G.i (Compare (Wasm.Values.I32 I32Op.LtU)) ^^ - G.if_ [] (get_end_to_space ^^ G.i Return) G.nop ^^ - - (* If this is an indirection, just use that value *) - get_obj ^^ - Tagged.branch_default env [] G.nop [ - Tagged.Indirection, - update_ptr (get_obj ^^ Heap.load_field 1l) ^^ - get_end_to_space ^^ G.i Return - ] ^^ - - (* Get object size *) - get_obj ^^ HeapTraversal.object_size env ^^ set_len ^^ - - (* Grow memory if needed *) - get_end_to_space ^^ - get_len ^^ compile_mul_const Heap.word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - Heap.grow_memory env ^^ - - (* Copy the referenced object to to space *) - get_obj ^^ HeapTraversal.object_size env ^^ set_len ^^ - get_end_to_space ^^ get_obj ^^ get_len ^^ Heap.memcpy_words_skewed env ^^ - - let (set_new_ptr, get_new_ptr) = new_local env "new_ptr" in - - (* Calculate new pointer *) - get_end_to_space ^^ - get_begin_to_space ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - get_begin_from_space ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - set_new_ptr ^^ - - (* Set indirection *) - get_obj ^^ - Tagged.(store Indirection) ^^ - get_obj ^^ - get_new_ptr ^^ - Heap.store_field 1l ^^ - - (* Update pointer *) - update_ptr get_new_ptr ^^ - - (* Calculate new end of to space *) - get_end_to_space ^^ - get_len ^^ compile_mul_const Heap.word_size ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) + let register env static_roots = - (* Used for normal skewed pointers *) - let evacuate env = Func.share_code4 env "evacuate" (("begin_from_space", I32Type), ("begin_to_space", I32Type), ("end_to_space", I32Type), ("ptr_loc", I32Type)) [I32Type] (fun env get_begin_from_space get_begin_to_space get_end_to_space get_ptr_loc -> + let get_static_roots = E.add_fun env "get_static_roots" (Func.of_body env [] [I32Type] (fun env -> + compile_unboxed_const static_roots + )) in - let get_obj = get_ptr_loc ^^ load_ptr in + E.add_export env (nr { + name = Wasm.Utf8.decode "get_static_roots"; + edesc = nr (FuncExport (nr get_static_roots)) + }); - (* If this is an unboxed scalar, ignore it *) - get_obj ^^ - BitTagged.if_tagged_scalar env [] (get_end_to_space ^^ G.i Return) G.nop ^^ + let get_hp = E.add_fun env "get_hp" (Func.of_body env [] [I32Type] (fun env -> + Heap.get_heap_ptr env + )) in - let update_ptr new_val_code = - get_ptr_loc ^^ new_val_code ^^ store_ptr in + E.add_export env (nr { + name = Wasm.Utf8.decode "get_hp"; + edesc = nr (FuncExport (nr get_hp)) + }); - evacuate_common env - get_obj update_ptr - get_begin_from_space get_begin_to_space get_end_to_space - ) + let set_hp = E.add_fun env "set_hp" (Func.of_body env [("new_hp", I32Type)] [] (fun env -> + G.i (LocalGet (nr (Int32.of_int 0))) ^^ + Heap.set_heap_ptr env + )) in - (* A variant for pointers that point into the payload (used for the bignum objects). - These are never scalars. *) - let evacuate_offset env offset = - let name = Printf.sprintf "evacuate_offset_%d" (Int32.to_int offset) in - Func.share_code4 env name (("begin_from_space", I32Type), ("begin_to_space", I32Type), ("end_to_space", I32Type), ("ptr_loc", I32Type)) [I32Type] (fun env get_begin_from_space get_begin_to_space get_end_to_space get_ptr_loc -> - let get_obj = get_ptr_loc ^^ load_ptr ^^ compile_sub_const offset in + E.add_export env (nr { + name = Wasm.Utf8.decode "set_hp"; + edesc = nr (FuncExport (nr set_hp)) + }); - let update_ptr new_val_code = - get_ptr_loc ^^ new_val_code ^^ compile_add_const offset ^^ store_ptr in + let get_heap_base = E.add_fun env "get_heap_base" (Func.of_body env [] [I32Type] (fun env -> + Heap.get_heap_base env + )) in - evacuate_common env - get_obj update_ptr - get_begin_from_space get_begin_to_space get_end_to_space - ) + E.add_export env (nr { + name = Wasm.Utf8.decode "get_heap_base"; + edesc = nr (FuncExport (nr get_heap_base)) + }); - let register env static_roots = Func.define_built_in env "get_heap_size" [] [I32Type] (fun env -> Heap.get_heap_ptr env ^^ Heap.get_heap_base env ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) - ); - - Func.define_built_in env "collect" [] [] (fun env -> - if not gc_enabled then G.nop else - - (* Copy all roots. *) - let (set_begin_from_space, get_begin_from_space) = new_local env "begin_from_space" in - let (set_begin_to_space, get_begin_to_space) = new_local env "begin_to_space" in - let (set_end_to_space, get_end_to_space) = new_local env "end_to_space" in - - Heap.get_heap_base env ^^ compile_add_const ptr_skew ^^ set_begin_from_space ^^ - let get_end_from_space = get_begin_to_space in - Heap.get_skewed_heap_ptr env ^^ set_begin_to_space ^^ - Heap.get_skewed_heap_ptr env ^^ set_end_to_space ^^ - - - (* Common arguments for evacuate *) - let evac get_ptr_loc = - get_begin_from_space ^^ - get_begin_to_space ^^ - get_end_to_space ^^ - get_ptr_loc ^^ - evacuate env ^^ - set_end_to_space in - - let evac_offset get_ptr_loc offset = - get_begin_from_space ^^ - get_begin_to_space ^^ - get_end_to_space ^^ - get_ptr_loc ^^ - evacuate_offset env offset ^^ - set_end_to_space in - - (* Go through the roots, and evacuate them *) - HeapTraversal.for_each_array_elem env (compile_unboxed_const static_roots) (fun get_elem_ptr -> - let (set_static, get_static) = new_local env "static_obj" in - get_elem_ptr ^^ load_ptr ^^ set_static ^^ - HeapTraversal.for_each_pointer env get_static evac evac_offset - ) ^^ - evac (ClosureTable.root env) ^^ - - (* Go through the to-space, and evacuate that. - Note that get_end_to_space changes as we go, but walk_heap_from_to can handle that. - *) - HeapTraversal.walk_heap_from_to env - get_begin_to_space - get_end_to_space - (fun get_x -> HeapTraversal.for_each_pointer env get_x evac evac_offset) ^^ - - (* Note some stats *) - get_end_to_space ^^ get_begin_to_space ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - Heap.note_live_size env ^^ - - get_end_from_space ^^ get_begin_from_space ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - get_end_to_space ^^ get_begin_to_space ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - Heap.add_reclaimed env ^^ - - (* Copy the to-space to the beginning of memory. *) - get_begin_from_space ^^ compile_add_const ptr_unskew ^^ - get_begin_to_space ^^ compile_add_const ptr_unskew ^^ - get_end_to_space ^^ get_begin_to_space ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - Heap.memcpy env ^^ - - (* Reset the heap pointer *) - get_begin_from_space ^^ compile_add_const ptr_unskew ^^ - get_end_to_space ^^ get_begin_to_space ^^ G.i (Binary (Wasm.Values.I32 I32Op.Sub)) ^^ - G.i (Binary (Wasm.Values.I32 I32Op.Add)) ^^ - Heap.set_heap_ptr env - ) + ) let get_heap_size env = G.i (Call (nr (E.built_in env "get_heap_size"))) @@ -5536,7 +5131,7 @@ module FuncDec = struct let message_cleanup env sort = match sort with | Type.Shared Type.Write -> - G.i (Call (nr (E.built_in env "collect"))) ^^ + collect_garbage env ^^ Lifecycle.trans env Lifecycle.Idle | Type.Shared Type.Query -> Lifecycle.trans env Lifecycle.PostQuery @@ -7196,7 +6791,7 @@ and compile_exp (env : E.t) ae exp = | OtherPrim "rts_max_live_size", [] -> SR.Vanilla, - Heap.get_max_live_size env ^^ BigNum.from_word64 env + Heap.get_max_live_size env ^^ BigNum.from_word32 env | OtherPrim "rts_callback_table_count", [] -> SR.Vanilla, diff --git a/test/run-drun/ok/AST-66.ic-ref-run.ok b/test/run-drun/ok/AST-66.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/AST-66.ic-ref-run.ok +++ b/test/run-drun/ok/AST-66.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/GIT-843.ic-ref-run.ok b/test/run-drun/ok/GIT-843.ic-ref-run.ok index a8511890bb3..a9aa07b819a 100644 --- a/test/run-drun/ok/GIT-843.ic-ref-run.ok +++ b/test/run-drun/ok/GIT-843.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update Bad() debug.print: ok diff --git a/test/run-drun/ok/actor-capture.ic-ref-run.ok b/test/run-drun/ok/actor-capture.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/actor-capture.ic-ref-run.ok +++ b/test/run-drun/ok/actor-capture.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/actor-class-arg.ic-ref-run.ok b/test/run-drun/ok/actor-class-arg.ic-ref-run.ok index 9dfd011b595..40eb66e912c 100644 --- a/test/run-drun/ok/actor-class-arg.ic-ref-run.ok +++ b/test/run-drun/ok/actor-class-arg.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob "DIDL\00\00"; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7… +→ update install_code(record {4849238 = blob "DIDL\00\00"; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7… debug.print: hello ← completed: () → query check(1) @@ -8,7 +8,7 @@ debug.print: hello → update echo() debug.print: hello ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: hello ← completed: () → query check(1) @@ -16,7 +16,7 @@ debug.print: hello → update echo() debug.print: hello ← completed: () -→ update install_code(record {4849238 = blob "DIDL\00\01q\05Hello"; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\0… +→ update install_code(record {4849238 = blob "DIDL\00\01q\05Hello"; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\0… debug.print: Hello ← completed: () → query check(1) @@ -24,7 +24,7 @@ debug.print: Hello → update echo() debug.print: Hello ← completed: () -→ update install_code(record {4849238 = blob "DIDL\00\02qq\05Hello\05World"; 265441191 = blob "\00asm\01\00\00\00\01\a0\8… +→ update install_code(record {4849238 = blob "DIDL\00\02qq\05Hello\05World"; 265441191 = blob "\00asm\01\00\00\00\01\b1\8… debug.print: Hello ← completed: () → query check(1) @@ -33,7 +33,7 @@ debug.print: Hello debug.print: Hello debug.print: World ← completed: () -→ update install_code(record {4849238 = blob "DIDL\00\02qq\05Hello\05World"; 265441191 = blob "\00asm\01\00\00\00\01\a0\8… +→ update install_code(record {4849238 = blob "DIDL\00\02qq\05Hello\05World"; 265441191 = blob "\00asm\01\00\00\00\01\b1\8… debug.print: Hello ← completed: () → query check(1) diff --git a/test/run-drun/ok/actor-creator-shadow-too.ic-ref-run.ok b/test/run-drun/ok/actor-creator-shadow-too.ic-ref-run.ok index 134f050701b..f0546a8b0c1 100644 --- a/test/run-drun/ok/actor-creator-shadow-too.ic-ref-run.ok +++ b/test/run-drun/ok/actor-creator-shadow-too.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update c1() ← completed: (0x4449444c01690001000109000400000000000001) diff --git a/test/run-drun/ok/actor-creator-shadow.ic-ref-run.ok b/test/run-drun/ok/actor-creator-shadow.ic-ref-run.ok index bc1d959ffd6..3a66c176432 100644 --- a/test/run-drun/ok/actor-creator-shadow.ic-ref-run.ok +++ b/test/run-drun/ok/actor-creator-shadow.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update c1() ← completed: (1) diff --git a/test/run-drun/ok/actor-creator.ic-ref-run.ok b/test/run-drun/ok/actor-creator.ic-ref-run.ok index a2c2fa4ed56..11dda06fcf9 100644 --- a/test/run-drun/ok/actor-creator.ic-ref-run.ok +++ b/test/run-drun/ok/actor-creator.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update c1() ← completed: (service "w7x7r-cok77-xa") diff --git a/test/run-drun/ok/actor-import.ic-ref-run.ok b/test/run-drun/ok/actor-import.ic-ref-run.ok index 1b17a319d31..922fe093e16 100644 --- a/test/run-drun/ok/actor-import.ic-ref-run.ok +++ b/test/run-drun/ok/actor-import.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: (0x4449444c016900010001022a01) diff --git a/test/run-drun/ok/actor-reference-bad.ic-ref-run.ok b/test/run-drun/ok/actor-reference-bad.ic-ref-run.ok index 5407c65f272..6c2e312260d 100644 --- a/test/run-drun/ok/actor-reference-bad.ic-ref-run.ok +++ b/test/run-drun/ok/actor-reference-bad.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: "bfozs-kwa73-7nadi": diff --git a/test/run-drun/ok/actor-reference-return.ic-ref-run.ok b/test/run-drun/ok/actor-reference-return.ic-ref-run.ok index 33d1080ddb3..b8a64fb5f8c 100644 --- a/test/run-drun/ok/actor-reference-return.ic-ref-run.ok +++ b/test/run-drun/ok/actor-reference-return.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query foo() ← completed: (0x4449444c01690001000105c0fefed00d) diff --git a/test/run-drun/ok/actor-reference.ic-ref-run.ok b/test/run-drun/ok/actor-reference.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/actor-reference.ic-ref-run.ok +++ b/test/run-drun/ok/actor-reference.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/array-out-of-bounds.ic-ref-run.ok b/test/run-drun/ok/array-out-of-bounds.ic-ref-run.ok index 9daee8da556..7becc76ebd3 100644 --- a/test/run-drun/ok/array-out-of-bounds.ic-ref-run.ok +++ b/test/run-drun/ok/array-out-of-bounds.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update foo1() Trap: EvalTrapError :0.1 "canister trapped explicitly: Array index out of bounds" diff --git a/test/run-drun/ok/async-any.ic-ref-run.ok b/test/run-drun/ok/async-any.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/async-any.ic-ref-run.ok +++ b/test/run-drun/ok/async-any.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/async-calls1.ic-ref-run.ok b/test/run-drun/ok/async-calls1.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/async-calls1.ic-ref-run.ok +++ b/test/run-drun/ok/async-calls1.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/async-calls2.ic-ref-run.ok b/test/run-drun/ok/async-calls2.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/async-calls2.ic-ref-run.ok +++ b/test/run-drun/ok/async-calls2.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/async-calls3.ic-ref-run.ok b/test/run-drun/ok/async-calls3.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/async-calls3.ic-ref-run.ok +++ b/test/run-drun/ok/async-calls3.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/async-free-var.ic-ref-run.ok b/test/run-drun/ok/async-free-var.ic-ref-run.ok index e258d137e9d..5d9ae83ff9f 100644 --- a/test/run-drun/ok/async-free-var.ic-ref-run.ok +++ b/test/run-drun/ok/async-free-var.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: A diff --git a/test/run-drun/ok/async-loop-while.ic-ref-run.ok b/test/run-drun/ok/async-loop-while.ic-ref-run.ok index 3980287e956..45b691cc8a8 100644 --- a/test/run-drun/ok/async-loop-while.ic-ref-run.ok +++ b/test/run-drun/ok/async-loop-while.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 0 diff --git a/test/run-drun/ok/async-loop.ic-ref-run.ok b/test/run-drun/ok/async-loop.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/async-loop.ic-ref-run.ok +++ b/test/run-drun/ok/async-loop.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/async-new-obj.ic-ref-run.ok b/test/run-drun/ok/async-new-obj.ic-ref-run.ok index 345244a96d6..2d0cd812a8b 100644 --- a/test/run-drun/ok/async-new-obj.ic-ref-run.ok +++ b/test/run-drun/ok/async-new-obj.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: aaab diff --git a/test/run-drun/ok/async-obj-mut.ic-ref-run.ok b/test/run-drun/ok/async-obj-mut.ic-ref-run.ok index 9c7d3d3b79c..3622f9249c2 100644 --- a/test/run-drun/ok/async-obj-mut.ic-ref-run.ok +++ b/test/run-drun/ok/async-obj-mut.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 1 diff --git a/test/run-drun/ok/async-while.ic-ref-run.ok b/test/run-drun/ok/async-while.ic-ref-run.ok index 3980287e956..45b691cc8a8 100644 --- a/test/run-drun/ok/async-while.ic-ref-run.ok +++ b/test/run-drun/ok/async-while.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 0 diff --git a/test/run-drun/ok/await-sugar.ic-ref-run.ok b/test/run-drun/ok/await-sugar.ic-ref-run.ok index 80f3ef326ba..80b7e9ea7fb 100644 --- a/test/run-drun/ok/await-sugar.ic-ref-run.ok +++ b/test/run-drun/ok/await-sugar.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update test() ← completed: () diff --git a/test/run-drun/ok/await.ic-ref-run.ok b/test/run-drun/ok/await.ic-ref-run.ok index b6e15c5792d..b45413bd84b 100644 --- a/test/run-drun/ok/await.ic-ref-run.ok +++ b/test/run-drun/ok/await.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: a diff --git a/test/run-drun/ok/block.ic-ref-run.ok b/test/run-drun/ok/block.ic-ref-run.ok index d89af7d7eab..7644111b362 100644 --- a/test/run-drun/ok/block.ic-ref-run.ok +++ b/test/run-drun/ok/block.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: a1 diff --git a/test/run-drun/ok/call-async-method.ic-ref-run.ok b/test/run-drun/ok/call-async-method.ic-ref-run.ok index d84b9f57887..3c3e622332e 100644 --- a/test/run-drun/ok/call-async-method.ic-ref-run.ok +++ b/test/run-drun/ok/call-async-method.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update __motoko_async_helper() Trap: EvalTrapError :0.1 "canister trapped explicitly: not a self-call" diff --git a/test/run-drun/ok/caller-prim.ic-ref-run.ok b/test/run-drun/ok/caller-prim.ic-ref-run.ok index c3c1508f012..07409751d34 100644 --- a/test/run-drun/ok/caller-prim.ic-ref-run.ok +++ b/test/run-drun/ok/caller-prim.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query caller() ← completed: (service "w7x7r-cok77-xa") diff --git a/test/run-drun/ok/caller.ic-ref-run.ok b/test/run-drun/ok/caller.ic-ref-run.ok index e96451d2a06..156944680fe 100644 --- a/test/run-drun/ok/caller.ic-ref-run.ok +++ b/test/run-drun/ok/caller.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update c1() ← completed: () diff --git a/test/run-drun/ok/closure-params.ic-ref-run.ok b/test/run-drun/ok/closure-params.ic-ref-run.ok index 2e02c0b2aab..f5bd2dcf1eb 100644 --- a/test/run-drun/ok/closure-params.ic-ref-run.ok +++ b/test/run-drun/ok/closure-params.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 1 diff --git a/test/run-drun/ok/count-callbacks.ic-ref-run.ok b/test/run-drun/ok/count-callbacks.ic-ref-run.ok index 8913ad48815..ae99fbad3c0 100644 --- a/test/run-drun/ok/count-callbacks.ic-ref-run.ok +++ b/test/run-drun/ok/count-callbacks.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: go 1: 0 diff --git a/test/run-drun/ok/counter.ic-ref-run.ok b/test/run-drun/ok/counter.ic-ref-run.ok index fde70b1f36d..88b85288983 100644 --- a/test/run-drun/ok/counter.ic-ref-run.ok +++ b/test/run-drun/ok/counter.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update inc() debug.print: 2 diff --git a/test/run-drun/ok/counter2.ic-ref-run.ok b/test/run-drun/ok/counter2.ic-ref-run.ok index ed9912cd54b..8c52f96ac75 100644 --- a/test/run-drun/ok/counter2.ic-ref-run.ok +++ b/test/run-drun/ok/counter2.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 2 diff --git a/test/run-drun/ok/data-params.ic-ref-run.ok b/test/run-drun/ok/data-params.ic-ref-run.ok index b2a6cfeb398..b0a827e1425 100644 --- a/test/run-drun/ok/data-params.ic-ref-run.ok +++ b/test/run-drun/ok/data-params.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\ab\81\80\80\00\1c`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\bc\81\80\80\00\1e`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: ("sendn", 0) diff --git a/test/run-drun/ok/divide-by-zero.ic-ref-run.ok b/test/run-drun/ok/divide-by-zero.ic-ref-run.ok index 5eadc61ad24..db4218b6079 100644 --- a/test/run-drun/ok/divide-by-zero.ic-ref-run.ok +++ b/test/run-drun/ok/divide-by-zero.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← rejected (RC_CANISTER_ERROR): Initialization trapped: EvalTrapError :0.1 "NumericIntegerDivideByZero" diff --git a/test/run-drun/ok/empty-actor.ic-ref-run.ok b/test/run-drun/ok/empty-actor.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/empty-actor.ic-ref-run.ok +++ b/test/run-drun/ok/empty-actor.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/empty-call.ic-ref-run.ok b/test/run-drun/ok/empty-call.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/empty-call.ic-ref-run.ok +++ b/test/run-drun/ok/empty-call.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/error-codes.ic-ref-run.ok b/test/run-drun/ok/error-codes.ic-ref-run.ok index c3c0fb9abf5..f4e17ef538f 100644 --- a/test/run-drun/ok/error-codes.ic-ref-run.ok +++ b/test/run-drun/ok/error-codes.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: canister_reject:ball diff --git a/test/run-drun/ok/flatten-awaitables.ic-ref-run.ok b/test/run-drun/ok/flatten-awaitables.ic-ref-run.ok index d78510b8616..924054d85f4 100644 --- a/test/run-drun/ok/flatten-awaitables.ic-ref-run.ok +++ b/test/run-drun/ok/flatten-awaitables.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: first-order diff --git a/test/run-drun/ok/for-await.ic-ref-run.ok b/test/run-drun/ok/for-await.ic-ref-run.ok index b3953985353..2bedf7cae5d 100644 --- a/test/run-drun/ok/for-await.ic-ref-run.ok +++ b/test/run-drun/ok/for-await.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 0 diff --git a/test/run-drun/ok/free-callbacks.ic-ref-run.ok b/test/run-drun/ok/free-callbacks.ic-ref-run.ok index e22b5f3c1b5..6cd0fbd2004 100644 --- a/test/run-drun/ok/free-callbacks.ic-ref-run.ok +++ b/test/run-drun/ok/free-callbacks.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a6\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b7\81\80\80\00\1d`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: Ignore Diff: (ignored) diff --git a/test/run-drun/ok/general_await.ic-ref-run.ok b/test/run-drun/ok/general_await.ic-ref-run.ok index e3a5efcc141..142dfda6803 100644 --- a/test/run-drun/ok/general_await.ic-ref-run.ok +++ b/test/run-drun/ok/general_await.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a6\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b7\81\80\80\00\1d`\n\7f\7f\7f\7f… ← completed: () → update Test() debug.print: Ack diff --git a/test/run-drun/ok/general_await_implicit.ic-ref-run.ok b/test/run-drun/ok/general_await_implicit.ic-ref-run.ok index e3a5efcc141..142dfda6803 100644 --- a/test/run-drun/ok/general_await_implicit.ic-ref-run.ok +++ b/test/run-drun/ok/general_await_implicit.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a6\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b7\81\80\80\00\1d`\n\7f\7f\7f\7f… ← completed: () → update Test() debug.print: Ack diff --git a/test/run-drun/ok/generic-tail-rec.ic-ref-run.ok b/test/run-drun/ok/generic-tail-rec.ic-ref-run.ok index 6b3449f2cfc..615e65e359b 100644 --- a/test/run-drun/ok/generic-tail-rec.ic-ref-run.ok +++ b/test/run-drun/ok/generic-tail-rec.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: done 1 debug.print: done 2 debug.print: done 3 diff --git a/test/run-drun/ok/hello-world-async.ic-ref-run.ok b/test/run-drun/ok/hello-world-async.ic-ref-run.ok index 7cd2cab0c4c..16d1457b3cb 100644 --- a/test/run-drun/ok/hello-world-async.ic-ref-run.ok +++ b/test/run-drun/ok/hello-world-async.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: Hello diff --git a/test/run-drun/ok/hello-world-await.ic-ref-run.ok b/test/run-drun/ok/hello-world-await.ic-ref-run.ok index 936bbee34e3..f82254581fb 100644 --- a/test/run-drun/ok/hello-world-await.ic-ref-run.ok +++ b/test/run-drun/ok/hello-world-await.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: Hello World! diff --git a/test/run-drun/ok/hello-world-message.ic-ref-run.ok b/test/run-drun/ok/hello-world-message.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/hello-world-message.ic-ref-run.ok +++ b/test/run-drun/ok/hello-world-message.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/hello-world-return.ic-ref-run.ok b/test/run-drun/ok/hello-world-return.ic-ref-run.ok index c0071c6ff6b..cc6595d16f5 100644 --- a/test/run-drun/ok/hello-world-return.ic-ref-run.ok +++ b/test/run-drun/ok/hello-world-return.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query hello("World") ← completed: ("Hello World!") diff --git a/test/run-drun/ok/hello-world.ic-ref-run.ok b/test/run-drun/ok/hello-world.ic-ref-run.ok index 792f11a0fae..1d069a3899a 100644 --- a/test/run-drun/ok/hello-world.ic-ref-run.ok +++ b/test/run-drun/ok/hello-world.ic-ref-run.ok @@ -1,5 +1,5 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: Hello World! ← completed: () diff --git a/test/run-drun/ok/ic-calls.ic-ref-run.ok b/test/run-drun/ok/ic-calls.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/ic-calls.ic-ref-run.ok +++ b/test/run-drun/ok/ic-calls.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/idl-any-stable.ic-ref-run.ok b/test/run-drun/ok/idl-any-stable.ic-ref-run.ok index 4e2b943b154..eda3a99c99b 100644 --- a/test/run-drun/ok/idl-any-stable.ic-ref-run.ok +++ b/test/run-drun/ok/idl-any-stable.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query any(0x4449444c01017102007100000000000003424144) ← rejected (RC_CANISTER_ERROR): canister trapped: EvalTrapError :0.1 "canister trapped explicitly: IDL error: illegal type table" diff --git a/test/run-drun/ok/idl-any.ic-ref-run.ok b/test/run-drun/ok/idl-any.ic-ref-run.ok index ba499bfee3a..2bdedd8fe06 100644 --- a/test/run-drun/ok/idl-any.ic-ref-run.ok +++ b/test/run-drun/ok/idl-any.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query any(null, "Foo") debug.print: ok: Foo diff --git a/test/run-drun/ok/idl-bad.ic-ref-run.ok b/test/run-drun/ok/idl-bad.ic-ref-run.ok index 19d21260f64..9e0f256af35 100644 --- a/test/run-drun/ok/idl-bad.ic-ref-run.ok +++ b/test/run-drun/ok/idl-bad.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query foo(0x4e4f544449444c) ← rejected (RC_CANISTER_ERROR): canister trapped: EvalTrapError :0.1 "canister trapped explicitly: IDL error: missing magic bytes" diff --git a/test/run-drun/ok/idl-bool.ic-ref-run.ok b/test/run-drun/ok/idl-bool.ic-ref-run.ok index b29d7feac7f..266d9a5f387 100644 --- a/test/run-drun/ok/idl-bool.ic-ref-run.ok +++ b/test/run-drun/ok/idl-bool.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query flip(false) ← completed: (true) diff --git a/test/run-drun/ok/idl-buf-size-bug.ic-ref-run.ok b/test/run-drun/ok/idl-buf-size-bug.ic-ref-run.ok index 6425b97be70..770a5afae45 100644 --- a/test/run-drun/ok/idl-buf-size-bug.ic-ref-run.ok +++ b/test/run-drun/ok/idl-buf-size-bug.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update do() ← completed: () diff --git a/test/run-drun/ok/idl-field-escape.ic-ref-run.ok b/test/run-drun/ok/idl-field-escape.ic-ref-run.ok index 4cb33bfab8a..762055aac3f 100644 --- a/test/run-drun/ok/idl-field-escape.ic-ref-run.ok +++ b/test/run-drun/ok/idl-field-escape.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query foo1() ← completed: (record {5097222 = null}) diff --git a/test/run-drun/ok/idl-float.ic-ref-run.ok b/test/run-drun/ok/idl-float.ic-ref-run.ok index ada6ae207e7..fc7beed9948 100644 --- a/test/run-drun/ok/idl-float.ic-ref-run.ok +++ b/test/run-drun/ok/idl-float.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a5\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b6\81\80\80\00\1d`\n\7f\7f\7f\7f… ← completed: () → query foon((3.0 : float64)) ← completed: ((6.0 : float64)) diff --git a/test/run-drun/ok/idl-func.ic-ref-run.ok b/test/run-drun/ok/idl-func.ic-ref-run.ok index b8f43356a1f..9807cd7f9b1 100644 --- a/test/run-drun/ok/idl-func.ic-ref-run.ok +++ b/test/run-drun/ok/idl-func.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query fun() ← completed: (0x4449444c026e016a017c010100010000) diff --git a/test/run-drun/ok/idl-mo.ic-ref-run.ok b/test/run-drun/ok/idl-mo.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/idl-mo.ic-ref-run.ok +++ b/test/run-drun/ok/idl-mo.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/idl-nary.ic-ref-run.ok b/test/run-drun/ok/idl-nary.ic-ref-run.ok index 64e317b98ef..a37ef4b31e5 100644 --- a/test/run-drun/ok/idl-nary.ic-ref-run.ok +++ b/test/run-drun/ok/idl-nary.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query two("One", "Two") ← completed: ("One", "Two") diff --git a/test/run-drun/ok/idl-nat-int.ic-ref-run.ok b/test/run-drun/ok/idl-nat-int.ic-ref-run.ok index f5a3f5dd31e..44c9da6d671 100644 --- a/test/run-drun/ok/idl-nat-int.ic-ref-run.ok +++ b/test/run-drun/ok/idl-nat-int.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query absolute(42) ← completed: (42) diff --git a/test/run-drun/ok/idl-option.ic-ref-run.ok b/test/run-drun/ok/idl-option.ic-ref-run.ok index f07a1d93d63..3ef4e7008ee 100644 --- a/test/run-drun/ok/idl-option.ic-ref-run.ok +++ b/test/run-drun/ok/idl-option.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query any(null) debug.print: ok: null diff --git a/test/run-drun/ok/idl-pair.ic-ref-run.ok b/test/run-drun/ok/idl-pair.ic-ref-run.ok index e4a967fd306..d04107c8eaf 100644 --- a/test/run-drun/ok/idl-pair.ic-ref-run.ok +++ b/test/run-drun/ok/idl-pair.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query len2("Hi", "World") ← completed: (record {+2; +5}) diff --git a/test/run-drun/ok/idl-principal.ic-ref-run.ok b/test/run-drun/ok/idl-principal.ic-ref-run.ok index b9c9af9b27c..93c3b7176d9 100644 --- a/test/run-drun/ok/idl-principal.ic-ref-run.ok +++ b/test/run-drun/ok/idl-principal.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query fun(service "w7x7r-cok77-xa") ← completed: (service "w7x7r-cok77-xa") diff --git a/test/run-drun/ok/idl-record.ic-ref-run.ok b/test/run-drun/ok/idl-record.ic-ref-run.ok index f2b693fdc0c..18f64d8019e 100644 --- a/test/run-drun/ok/idl-record.ic-ref-run.ok +++ b/test/run-drun/ok/idl-record.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query pair(record {"Hey!"; +42}) debug.print: ok: +42 diff --git a/test/run-drun/ok/idl-shorthand.ic-ref-run.ok b/test/run-drun/ok/idl-shorthand.ic-ref-run.ok index 0243b1e11b7..dc0456737a5 100644 --- a/test/run-drun/ok/idl-shorthand.ic-ref-run.ok +++ b/test/run-drun/ok/idl-shorthand.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query foo(variant {5493713}) ← completed: (variant {5493713}) diff --git a/test/run-drun/ok/idl-tuple.ic-ref-run.ok b/test/run-drun/ok/idl-tuple.ic-ref-run.ok index eae976e2269..5e03ca71329 100644 --- a/test/run-drun/ok/idl-tuple.ic-ref-run.ok +++ b/test/run-drun/ok/idl-tuple.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query len2("Hi", "World") ← completed: (+2, +5) diff --git a/test/run-drun/ok/idl-unit.ic-ref-run.ok b/test/run-drun/ok/idl-unit.ic-ref-run.ok index a882706c8ba..738723ba7f8 100644 --- a/test/run-drun/ok/idl-unit.ic-ref-run.ok +++ b/test/run-drun/ok/idl-unit.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query unit_id() ← completed: () diff --git a/test/run-drun/ok/idl-variant.ic-ref-run.ok b/test/run-drun/ok/idl-variant.ic-ref-run.ok index df87b4887b7..aad2303532a 100644 --- a/test/run-drun/ok/idl-variant.ic-ref-run.ok +++ b/test/run-drun/ok/idl-variant.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query numify(variant {5095893 = variant {3915647964 = (32 : nat32)}}) ← completed: (variant {5095893 = variant {1202718727 = (32 : nat32)}}) diff --git a/test/run-drun/ok/idl-vector.ic-ref-run.ok b/test/run-drun/ok/idl-vector.ic-ref-run.ok index dd7d0d3c86c..5138e7777da 100644 --- a/test/run-drun/ok/idl-vector.ic-ref-run.ok +++ b/test/run-drun/ok/idl-vector.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query rose(vec {vec {}; vec {vec {}; vec {vec {}; vec {}}; vec {}; vec {}}; vec {}}) ← completed: (opt vec {opt vec {}; opt vec {opt vec {}; opt vec {opt vec {}; opt vec {}}; opt vec {}; opt vec {}}… diff --git a/test/run-drun/ok/interleave.ic-ref-run.ok b/test/run-drun/ok/interleave.ic-ref-run.ok index 9fe8d18eaa5..05dab5c1003 100644 --- a/test/run-drun/ok/interleave.ic-ref-run.ok +++ b/test/run-drun/ok/interleave.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: g diff --git a/test/run-drun/ok/issue-894.ic-ref-run.ok b/test/run-drun/ok/issue-894.ic-ref-run.ok index cd23b982203..e4da16acea8 100644 --- a/test/run-drun/ok/issue-894.ic-ref-run.ok +++ b/test/run-drun/ok/issue-894.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 1 diff --git a/test/run-drun/ok/local-throw.ic-ref-run.ok b/test/run-drun/ok/local-throw.ic-ref-run.ok index 57b92776160..79a7eafba9c 100644 --- a/test/run-drun/ok/local-throw.ic-ref-run.ok +++ b/test/run-drun/ok/local-throw.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: t2 ok diff --git a/test/run-drun/ok/mod-rebind.ic-ref-run.ok b/test/run-drun/ok/mod-rebind.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/mod-rebind.ic-ref-run.ok +++ b/test/run-drun/ok/mod-rebind.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/nary-async.ic-ref-run.ok b/test/run-drun/ok/nary-async.ic-ref-run.ok index 2f26fe4fe15..1a2a81b4f39 100644 --- a/test/run-drun/ok/nary-async.ic-ref-run.ok +++ b/test/run-drun/ok/nary-async.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go1() debug.print: 0_0 diff --git a/test/run-drun/ok/oneway-throw.ic-ref-run.ok b/test/run-drun/ok/oneway-throw.ic-ref-run.ok index 00f20268247..4553f4f6b27 100644 --- a/test/run-drun/ok/oneway-throw.ic-ref-run.ok +++ b/test/run-drun/ok/oneway-throw.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: go1 diff --git a/test/run-drun/ok/oneway.ic-ref-run.ok b/test/run-drun/ok/oneway.ic-ref-run.ok index ed6e61f2110..062904bc77a 100644 --- a/test/run-drun/ok/oneway.ic-ref-run.ok +++ b/test/run-drun/ok/oneway.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: A diff --git a/test/run-drun/ok/oom.ic-ref-run.ok b/test/run-drun/ok/oom.ic-ref-run.ok index f0539b4faa3..af8ae205d6d 100644 --- a/test/run-drun/ok/oom.ic-ref-run.ok +++ b/test/run-drun/ok/oom.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/overflow.ic-ref-run.ok b/test/run-drun/ok/overflow.ic-ref-run.ok index 2d8ff0f8960..228860eebac 100644 --- a/test/run-drun/ok/overflow.ic-ref-run.ok +++ b/test/run-drun/ok/overflow.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a6\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b7\81\80\80\00\1d`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: ok 1 diff --git a/test/run-drun/ok/print-from-init.ic-ref-run.ok b/test/run-drun/ok/print-from-init.ic-ref-run.ok index 6a270257ddd..43172baa10e 100644 --- a/test/run-drun/ok/print-from-init.ic-ref-run.ok +++ b/test/run-drun/ok/print-from-init.ic-ref-run.ok @@ -1,5 +1,5 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: Debug out ← completed: () diff --git a/test/run-drun/ok/query.ic-ref-run.ok b/test/run-drun/ok/query.ic-ref-run.ok index 3748179537a..cf0aa43185b 100644 --- a/test/run-drun/ok/query.ic-ref-run.ok +++ b/test/run-drun/ok/query.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update inc() debug.print: 2 diff --git a/test/run-drun/ok/query2.ic-ref-run.ok b/test/run-drun/ok/query2.ic-ref-run.ok index abe9d390746..c2d6fdc619d 100644 --- a/test/run-drun/ok/query2.ic-ref-run.ok +++ b/test/run-drun/ok/query2.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: 2 diff --git a/test/run-drun/ok/reinstall.ic-ref-run.ok b/test/run-drun/ok/reinstall.ic-ref-run.ok index 1f07f66e4db..b4d393cd88f 100644 --- a/test/run-drun/ok/reinstall.ic-ref-run.ok +++ b/test/run-drun/ok/reinstall.ic-ref-run.ok @@ -1,10 +1,10 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query check() ← completed: (1) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query check() ← completed: (2) diff --git a/test/run-drun/ok/reject-bug.ic-ref-run.ok b/test/run-drun/ok/reject-bug.ic-ref-run.ok index ad805365957..9738d2771fb 100644 --- a/test/run-drun/ok/reject-bug.ic-ref-run.ok +++ b/test/run-drun/ok/reject-bug.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query ok() ← rejected (RC_CANISTER_REJECT): abcdefgh diff --git a/test/run-drun/ok/reject.ic-ref-run.ok b/test/run-drun/ok/reject.ic-ref-run.ok index d711220662f..340b7bc00fd 100644 --- a/test/run-drun/ok/reject.ic-ref-run.ok +++ b/test/run-drun/ok/reject.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update reject1() debug.print: 1 diff --git a/test/run-drun/ok/rts-stats.ic-ref-run.ok b/test/run-drun/ok/rts-stats.ic-ref-run.ok index d20d081bb19..96778a8a8d7 100644 --- a/test/run-drun/ok/rts-stats.ic-ref-run.ok +++ b/test/run-drun/ok/rts-stats.ic-ref-run.ok @@ -1,5 +1,5 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a6\81\80\80\00\1b`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b7\81\80\80\00\1d`\n\7f\7f\7f\7f… debug.print: Size and allocation delta: (10_008, 10_008) ← completed: () diff --git a/test/run-drun/ok/rts-stats2.ic-ref-run.ok b/test/run-drun/ok/rts-stats2.ic-ref-run.ok index c79e88f868d..3c7d1bb38c9 100644 --- a/test/run-drun/ok/rts-stats2.ic-ref-run.ok +++ b/test/run-drun/ok/rts-stats2.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update foo() ← completed: () diff --git a/test/run-drun/ok/self-upgrade.ic-ref-run.ok b/test/run-drun/ok/self-upgrade.ic-ref-run.ok index ac03c34f5a3..58d49a6f25c 100644 --- a/test/run-drun/ok/self-upgrade.ic-ref-run.ok +++ b/test/run-drun/ok/self-upgrade.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () → query check(1) @@ -16,7 +16,7 @@ debug.print: aa → query check(3) debug.print: aaa ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () → query check(3) diff --git a/test/run-drun/ok/selftail.ic-ref-run.ok b/test/run-drun/ok/selftail.ic-ref-run.ok index 77dcbdfe8bb..7e58cbd125e 100644 --- a/test/run-drun/ok/selftail.ic-ref-run.ok +++ b/test/run-drun/ok/selftail.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: ok1 debug.print: ok2 ← rejected (RC_CANISTER_ERROR): Initialization trapped: EvalExhaustionError :0.1 "call stack exhausted" diff --git a/test/run-drun/ok/shared-object.ic-ref-run.ok b/test/run-drun/ok/shared-object.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/shared-object.ic-ref-run.ok +++ b/test/run-drun/ok/shared-object.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/sharingbug.ic-ref-run.ok b/test/run-drun/ok/sharingbug.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/sharingbug.ic-ref-run.ok +++ b/test/run-drun/ok/sharingbug.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/show.ic-ref-run.ok b/test/run-drun/ok/show.ic-ref-run.ok index 2d6bad793ef..e1d423badec 100644 --- a/test/run-drun/ok/show.ic-ref-run.ok +++ b/test/run-drun/ok/show.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: true debug.print: false debug.print: -42_000_000_000_000 diff --git a/test/run-drun/ok/stable-mutable.ic-ref-run.ok b/test/run-drun/ok/stable-mutable.ic-ref-run.ok index 3ed7bfca8be..c7e7d57f223 100644 --- a/test/run-drun/ok/stable-mutable.ic-ref-run.ok +++ b/test/run-drun/ok/stable-mutable.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update tie(1) ← completed: () @@ -10,7 +10,7 @@ ← completed: () → query checkCycle(1) ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query checkArray(1) ← completed: () @@ -18,7 +18,7 @@ ← completed: () → query checkCycle(1) ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → query checkArray2(1) ← completed: () diff --git a/test/run-drun/ok/stable.ic-ref-run.ok b/test/run-drun/ok/stable.ic-ref-run.ok index cc1b8e69f26..447d1aae775 100644 --- a/test/run-drun/ok/stable.ic-ref-run.ok +++ b/test/run-drun/ok/stable.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () → query check(1) @@ -13,7 +13,7 @@ debug.print: init'ed ← completed: () → query check(3) ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () → query check(3) diff --git a/test/run-drun/ok/static-call-from-pub.ic-ref-run.ok b/test/run-drun/ok/static-call-from-pub.ic-ref-run.ok index 7aa7a02c160..8137ce7e902 100644 --- a/test/run-drun/ok/static-call-from-pub.ic-ref-run.ok +++ b/test/run-drun/ok/static-call-from-pub.ic-ref-run.ok @@ -1,4 +1,4 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () diff --git a/test/run-drun/ok/static-gc.ic-ref-run.ok b/test/run-drun/ok/static-gc.ic-ref-run.ok index 39475029d0e..a7046da18c6 100644 --- a/test/run-drun/ok/static-gc.ic-ref-run.ok +++ b/test/run-drun/ok/static-gc.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update foo1() ← completed: () diff --git a/test/run-drun/ok/switch-await.ic-ref-run.ok b/test/run-drun/ok/switch-await.ic-ref-run.ok index 627f46ff01d..b7b3649c539 100644 --- a/test/run-drun/ok/switch-await.ic-ref-run.ok +++ b/test/run-drun/ok/switch-await.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go_tt() ← completed: ("One") diff --git a/test/run-drun/ok/text-iter.ic-ref-run.ok b/test/run-drun/ok/text-iter.ic-ref-run.ok index 911177faa70..b31a8130b5f 100644 --- a/test/run-drun/ok/text-iter.ic-ref-run.ok +++ b/test/run-drun/ok/text-iter.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: via `debugPrint`: debug.print: hello world! debug.print: diff --git a/test/run-drun/ok/throw.ic-ref-run.ok b/test/run-drun/ok/throw.ic-ref-run.ok index 57b92776160..79a7eafba9c 100644 --- a/test/run-drun/ok/throw.ic-ref-run.ok +++ b/test/run-drun/ok/throw.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: t2 ok diff --git a/test/run-drun/ok/time.ic-ref-run.ok b/test/run-drun/ok/time.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/time.ic-ref-run.ok +++ b/test/run-drun/ok/time.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/transpose.ic-ref-run.ok b/test/run-drun/ok/transpose.ic-ref-run.ok index 291f429ac86..5cebe1b403a 100644 --- a/test/run-drun/ok/transpose.ic-ref-run.ok +++ b/test/run-drun/ok/transpose.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() debug.print: All good diff --git a/test/run-drun/ok/type-lub.ic-ref-run.ok b/test/run-drun/ok/type-lub.ic-ref-run.ok index 893032984b5..5273816acc7 100644 --- a/test/run-drun/ok/type-lub.ic-ref-run.ok +++ b/test/run-drun/ok/type-lub.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update go() ← completed: () diff --git a/test/run-drun/ok/upgrade-hooks.ic-ref-run.ok b/test/run-drun/ok/upgrade-hooks.ic-ref-run.ok index 45caa236c39..8749bd666b6 100644 --- a/test/run-drun/ok/upgrade-hooks.ic-ref-run.ok +++ b/test/run-drun/ok/upgrade-hooks.ic-ref-run.ok @@ -1,9 +1,9 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed 0 debug.print: postupgrade 0 ← completed: () @@ -17,7 +17,7 @@ debug.print: aa ← completed: () → update inc() ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: preupgrade 0 debug.print: init'ed 1 debug.print: postupgrade 1 @@ -32,7 +32,7 @@ debug.print: aaa debug.print: 4 debug.print: aaa ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: preupgrade 1 debug.print: init'ed 2 debug.print: postupgrade 2 diff --git a/test/run-drun/ok/upgrades.ic-ref-run.ok b/test/run-drun/ok/upgrades.ic-ref-run.ok index 1102439a407..dd7908b3d27 100644 --- a/test/run-drun/ok/upgrades.ic-ref-run.ok +++ b/test/run-drun/ok/upgrades.ic-ref-run.ok @@ -1,9 +1,9 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed 0 ← completed: () → query check(1) @@ -16,7 +16,7 @@ debug.print: aa ← completed: () → update inc() ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed 1 ← completed: () → query check(3) @@ -29,7 +29,7 @@ debug.print: aaa debug.print: 4 debug.print: aaa ← completed: () -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… debug.print: init'ed 2 ← completed: () → query check(4) diff --git a/test/run-drun/ok/utf8.ic-ref-run.ok b/test/run-drun/ok/utf8.ic-ref-run.ok index 2eeab4d526c..7a0f3def855 100644 --- a/test/run-drun/ok/utf8.ic-ref-run.ok +++ b/test/run-drun/ok/utf8.ic-ref-run.ok @@ -1,6 +1,6 @@ → update create_canister() ← completed: (record {1313628723 = service "cvccv-qqaaq-aaaaa-aaaaa-c"}) -→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\a0\81\80\80\00\1a`\n\7f\7f\7f\7f… +→ update install_code(record {4849238 = blob ""; 265441191 = blob "\00asm\01\00\00\00\01\b1\81\80\80\00\1c`\n\7f\7f\7f\7f… ← completed: () → update callshow() debug.print: ██ ██