1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00
serenity/Userland/Libraries/LibWasm/Constants.h
Ali Mohammad Pur b538e15548 LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails
instead of just "too bad, something went wrong".
2021-07-02 04:53:01 +04:30

43 lines
1 KiB
C++

/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
namespace Wasm::Constants {
// Value
static constexpr auto i32_tag = 0x7f;
static constexpr auto i64_tag = 0x7e;
static constexpr auto f32_tag = 0x7d;
static constexpr auto f64_tag = 0x7c;
static constexpr auto function_reference_tag = 0x70;
static constexpr auto extern_reference_tag = 0x6f;
// Function
static constexpr auto function_signature_tag = 0x60;
// Global
static constexpr auto const_tag = 0x00;
static constexpr auto var_tag = 0x01;
// Block
static constexpr auto empty_block_tag = 0x40;
// Import section
static constexpr auto extern_function_tag = 0x00;
static constexpr auto extern_table_tag = 0x01;
static constexpr auto extern_memory_tag = 0x02;
static constexpr auto extern_global_tag = 0x03;
static constexpr auto page_size = 64 * KiB;
// Limits
static constexpr auto max_allowed_call_stack_depth = 1000;
static constexpr auto max_allowed_executed_instructions_per_call = 1024 * 1024 * 1024;
}