Skip to content

Trap Handling #1

Closed
Closed
@clearloop

Description

@clearloop

Traps

Find a solution to handle traps in wasm execution

Keywords

  • frame_info
  • look_up_frame_info
  • look_up_trap_info

Issues

Under some conditions, certain instructions may produce a trap, which immediately aborts execution. Traps cannot be handled by WebAssembly code, but are reported to the outside environment, where they typically can be caught.

#Traps concept in WebAssembly Overview

Administrative Instructions in WebAssembly Execution

In order to express the reduction of traps, calls, and control instructions, the syntax of instructions is extended to include the following administrative instructions:

instr  ::=  ...
        |   trap
        |   invoke funcaddr
        |   init_elem tabbleaddr u32 funcidx*
        |   init_data memaddr u32 byte*
        |   labe𝑛 { instr* } instr* end
        |   frame𝑛 { frame } instr* end

The trap instruction represents the occurrence of a trap. Traps are bubbled up through nested instruction sequences, ultimately reducing the entire program to a single 𝗍𝗋𝖺𝗉 instruction, signaling abrupt termination.

#Administrative Instructions

Runtime Result

A result is the outcome of a computation. It is either a sequence of values or a trap.

result  ::=  val*
             trap

#Trap as results in runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions