Skip to main content

unidecompiler-simulator

unidecompiler-simulator is a library for bounded execution of unidecompiler generic IR. It depends on the decompiler core but the core does not depend on, import, or know about this package.

The simulator owns frames, control flow, calls, limits, exceptions, and the execution trace. A frontend may expose an optional simulation_adapter attribute for frontend-specific function lookup and runtime facts. The adapter may answer individual operations, but it must not execute functions, interpret instructions, recover control flow, or return executable callbacks.

Generic IR execution is available without a frontend:

from unidecompiler_simulator import SimulationEngine

result = SimulationEngine().simulate_function(module, function, args=(1, 2))

Artifact execution gives an adapter the decoded frontend-owned payload only for function lookup and runtime hooks:

result = SimulationEngine().simulate_artifact(
    data,
    "sample.bytecode",
    query={"class": "Example", "method": "run"},
)

The unidecompiler-cli package hosts the command-line interface and accepts a frontend-owned function query and JSON arguments:

unidecompiler simulate sample.bytecode --function 'Example.run' --args '[1, 2]'

For the Lua bubble-sort fixture, compile the source before invoking the simulator. The Lua frontend adapter supplies only Lua function lookup and runtime value facts; the simulator still executes the lifted generic IR.

luac -o bubble_sort.luac simulator_projects/source/arithmetic.lua
unidecompiler simulate bubble_sort.luac --frontend lua --function bubble_sort --args '[[5, 1, 4, 2, 8]]'

The completed result contains "values": [[1, 2, 4, 5, 8]].

Built-in frontend adapters accept the following frontend-owned function queries:

Frontend Query
Python .pyc Unique function name, for example arithmetic
JVM .class Unique method name or Class.method, for example Sample.add
.NET assembly Unique method name or Type.Method, for example Probe.Add
WebAssembly Function name or $funcN, for example add or $func0
Lua chunk Unique function name, for example bubble_sort

Ambiguous queries are rejected by the relevant frontend adapter. The simulator does not choose among overloads or perform frontend-specific name recovery.

Execution is bounded and in-memory. Unknown operations, unsupported IR, and unsafe runtime behavior stop with a structured result instead of guessing.

Applications may inject an ExternalEnvironment for unresolved named calls. The environment receives only ExternalCallRequest data and returns an ExternalCallResult; it never receives IR, frames, adapters, or execution control. Python-file loading is intentionally owned by unidecompiler-cli, not this library.

The simulator does not resolve Global expressions as function names. Any frontend-specific function lookup or dynamic call target must be provided by the optional adapter and must resolve back to a FunctionIR owned by the current lifted module.

The simulator intentionally does not execute frontend bytecode, frontend opcode tables, or core Effect objects directly. Core is responsible for lifting VM-neutral effects into generic IR; this package executes that generic IR. Keeping that boundary strict prevents a language-specific opcode switch from leaking into the simulator and keeps every frontend replaceable.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unidecompiler_simulator-0.1.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

unidecompiler_simulator-0.1.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file unidecompiler_simulator-0.1.2.tar.gz.

File metadata

  • Download URL: unidecompiler_simulator-0.1.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.12

File hashes

Hashes for unidecompiler_simulator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 33e6e75248c9cd07a879de4b36af7c2bea77c0b6991a64e5f77f660c5e6f8285
MD5 46b7b1c288917ebe2ba695736c855c65
BLAKE2b-256 7bc473c2060696f61d575cfe5a2362ef32379fc416748b355dc435803bcfa3c8

See more details on using hashes here.

File details

Details for the file unidecompiler_simulator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for unidecompiler_simulator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3a7da5a5e4135d4c4265233f6148468c2331fa3b0d366597772ee4e0ad2b760
MD5 3692782081c5868f536892fa1446e340
BLAKE2b-256 8874d06475a79b2ffad9dbdcab8d3f3e2ed477ebca608893d8414c7905795bf4

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page