chromium/v8/third_party/wasm-api/wasm.hh

// WebAssembly C++ API

#ifndef __WASM_HH
#define __WASM_HH

#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <memory>
#include <limits>
#include <string>


///////////////////////////////////////////////////////////////////////////////
// Auxiliaries

// Machine types

static_assert;
static_assert;
static_assert;

byte_t;
float32_t;
float64_t;


namespace wasm {

// Vectors

template<class T>
class vec {};


// Ownership

own;
ownvec;

template<class T>
auto make_own(T* x) -> own<T> {}


///////////////////////////////////////////////////////////////////////////////
// Runtime Environment

// Configuration

class Config {};


// Engine

class Engine {};


// Store

class Store {};


///////////////////////////////////////////////////////////////////////////////
// Type Representations

// Type attributes

enum Mutability : uint8_t {};

struct Limits {};


// Value Types

enum ValKind : uint8_t {};

inline bool is_num(ValKind k) {}
inline bool is_ref(ValKind k) {}


class ValType {};


// External Types

enum ExternKind : uint8_t {};

class FuncType;
class GlobalType;
class TableType;
class MemoryType;

class ExternType {};


// Function Types

class FuncType : public ExternType {};


// Global Types

class GlobalType : public ExternType {};


// Table Types

class TableType : public ExternType {};


// Memory Types

class MemoryType : public ExternType {};


// Import Types

Name;

class ImportType {};


// Export Types

class ExportType {};


///////////////////////////////////////////////////////////////////////////////
// Runtime Objects

// References

class Ref {};


// Values

class Val {};


template<> inline auto Val::make<int32_t>(int32_t x) -> Val {}
template<> inline auto Val::make<int64_t>(int64_t x) -> Val {}
template<> inline auto Val::make<float32_t>(float32_t x) -> Val {}
template<> inline auto Val::make<float64_t>(float64_t x) -> Val {}
template<> inline auto Val::make<Ref>(own<Ref>&& x) -> Val {}

template<> inline auto Val::make<uint32_t>(uint32_t x) -> Val {}
template<> inline auto Val::make<uint64_t>(uint64_t x) -> Val {}

template<> inline auto Val::get<int32_t>() const -> int32_t {}
template<> inline auto Val::get<int64_t>() const -> int64_t {}
template<> inline auto Val::get<float32_t>() const -> float32_t {}
template<> inline auto Val::get<float64_t>() const -> float64_t {}
template<> inline auto Val::get<Ref*>() const -> Ref* {}

template<> inline auto Val::get<uint32_t>() const -> uint32_t {}
template<> inline auto Val::get<uint64_t>() const -> uint64_t {}


// Traps

Message;  // null terminated

class Instance;

class Frame {};

class Trap : public Ref {};


// Shared objects

template<class T>
class Shared {};


// Modules

class Module : public Ref {};


// Foreign Objects

class Foreign : public Ref {};


// Externals

class Func;
class Global;
class Table;
class Memory;

class Extern : public Ref {};


// Function Instances

class Func : public Extern {};


// Global Instances

class Global : public Extern {};


// Table Instances

class Table : public Extern {};


// Memory Instances

class Memory : public Extern {};


// Module Instances

class Instance : public Ref {};


///////////////////////////////////////////////////////////////////////////////

}  // namespace wasm

#endif  // #ifdef __WASM_HH