# US 2026/0099309 A1 · Wasm bytecode optimization methods, execution methods, computer devices, and storage media

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0099309 A1
- Document ID: US20260099309A1
- Status: Published application
- Kind: A1
- Application number: 19/416,147
- Filed: 2025-12-11
- Published: 2026-04-09
- Earliest claimed: 2023-07-24
- Assignees: Ant Blockchain Technology (Shanghai) Co., Ltd.
- Applicants: Ant Blockchain Technology (Shanghai) Co., Ltd.
- Inventors: Wei ZHOU; Lei ZHANG
- Web page: https://patentgrep.com/patent/US20260099309A1

## CPC

- G06F 8/443: {Optimisation}
- G06F 9/4552: {Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A WebAssembly (Wasm) bytecode optimization method and device is provided. In an implementation, the method includes: reading and parsing Wasm bytecode to obtain a Wasm module object, generating a linear memory and filling the linear memory based on the Wasm module object, executing a start function in the Wasm module object and modifying the linear memory based on an execution result of the start function, replacing a corresponding data segment in the Wasm module object with data in a modified linear memory, and encoding a Wasm module obtained by replacing the data segment and storing the encoded Wasm module as Wasm bytecode.

## Claims

### Claim 1

A method comprising:
parsing WebAssembly (Wasm) bytecode to obtain a Wasm module object;
generating a linear memory and filling the linear memory based on the Wasm module object;
executing a start function in the Wasm module object to obtain an execution result;
modifying the linear memory based on the execution result of the start function;
replacing a corresponding data segment in the Wasm module object with data in a modified linear memory to obtain a Wasm module; and
encoding the Wasm module and storing the encoded Wasm module as Wasm bytecode.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the method further comprises:
removing the start function from the Wasm module object before encoding the Wasm module.

### Claim 3 (depends on 1)

The method according to claim 1, wherein removing the start function from the Wasm module object comprises:
deleting a start marker of the start function; or
removing entire content of the start function.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the Wasm module object is stored in a managed memory or a memory other than the managed memory.

### Claim 5 (depends on 4)

The method according to claim 4, wherein a corresponding data segment in a Wasm module object stored in the managed memory or the memory other than the managed memory is replaced with the data in the modified linear memory.

### Claim 6 (depends on 1)

The method according to claim 1, wherein replacing the corresponding data segment in the Wasm module object with data in the modified linear memory comprises:
replacing a corresponding part in the data segment in the Wasm module object with a part that causes a change to the linear memory after the start function is executed; or
replacing the corresponding data segment in the Wasm module object with entire data in the modified linear memory.

### Claim 7 (depends on 1)

The method according to claim 1, wherein replacing the corresponding data segment in the Wasm module object with data in the modified linear memory comprises:
removing a hole area from the data in the modified linear memory; and
replacing the corresponding data segment in the Wasm module object.

### Claim 8

A computing device, comprising:
at least one processor; and
a memory coupled to the at least one processor and stores programming instructions for execution by the at least one processor to perform operations comprising:
parsing WebAssembly (Wasm) bytecode to obtain a Wasm module object;
generating a linear memory and filling the linear memory based on the Wasm module object;
executing a start function in the Wasm module object to obtain an execution result;
modifying the linear memory based on the execution result of the start function;
replacing a corresponding data segment in the Wasm module object with data in a modified linear memory to obtain a Wasm module; and
encoding the Wasm module and storing the encoded Wasm module as Wasm bytecode.

### Claim 9 (depends on 8)

The computing device according to claim 8, wherein the operations comprise:
removing the start function from the Wasm module object before encoding the Wasm module.

### Claim 10 (depends on 8)

The computing device according to claim 8, wherein removing the start function from the Wasm module object comprises:
deleting a start marker of the start function; or
removing entire content of the start function.

### Claim 11 (depends on 8)

The computing device according to claim 8, wherein the Wasm module object is stored in a managed memory or a memory other than the managed memory.

### Claim 12 (depends on 11)

The computing device according to claim 11, wherein a corresponding data segment in a Wasm module object stored in the managed memory or the memory other than the managed memory is replaced with the data in the modified linear memory.

### Claim 13 (depends on 8)

The computing device according to claim 8, wherein replacing the corresponding data segment in the Wasm module object with data in the modified linear memory comprises:
replacing a corresponding part in the data segment in the Wasm module object with a part that causes a change to the linear memory after the start function is executed; or
replacing the corresponding data segment in the Wasm module object with entire data in the modified linear memory.

### Claim 14 (depends on 8)

The computing device according to claim 8, wherein replacing the corresponding data segment in the Wasm module object with data in the modified linear memory comprises:
removing a hole area from the data in the modified linear memory; and
replacing the corresponding data segment in the Wasm module object.

### Claim 15

A non-transitory, computer-readable medium storing one or more instructions executable by at least one processor to perform operations comprising:
reading and parsing Wasm bytecode, to obtain a Wasm module object;
creating a linear memory and filling the linear memory based on the Wasm module object obtained through parsing;
executing a start function in the Wasm module object, and modifying the linear memory based on an execution result of the start function;
replacing a corresponding data segment in the Wasm module object with data in a modified linear memory; and
encoding a Wasm module obtained by replacing the data segment, and storing the encoded Wasm module as Wasm bytecode.

### Claim 16 (depends on 15)

The non-transitory, computer-readable medium according to claim 15, wherein the operations comprise:
removing the start function from the Wasm module object before encoding the Wasm module.

### Claim 17 (depends on 15)

The non-transitory, computer-readable medium according to claim 15, wherein removing the start function from the Wasm module object comprises:
deleting a start marker of the start function; or
removing entire content of the start function.

### Claim 18 (depends on 15)

The non-transitory, computer-readable medium according to claim 15, wherein the Wasm module object is stored in a managed memory or a memory other than the managed memory.

### Claim 19 (depends on 18)

The non-transitory, computer-readable medium according to claim 18, wherein a corresponding data segment in a Wasm module object stored in the managed memory or the memory other than the managed memory is replaced with the data in the modified linear memory.

### Claim 20 (depends on 15)

The non-transitory, computer-readable medium according to claim 15, wherein replacing the corresponding data segment in the Wasm module object with data in the modified linear memory comprises:
replacing a corresponding part in the data segment in the Wasm module object with a part that causes a change to the linear memory after the start function is executed; or
replacing the corresponding data segment in the Wasm module object with entire data in the modified linear memory.
