Repository navigation
ASM Frontend
Bogdan edited this page Jun 21, 2026
·
5 revisions
The ASM frontend is a strict GPU-friendly subset frontend, not a generic JVM decompiler.
Its intended architecture is:
your AST -> GPU-friendly ASM -> JavaToGpu ASM frontend -> IR -> OpenCL
- compiler integrations
- generator pipelines
- canonical structured control flow
Treat the ASM input as a purpose-built subset with:
-
staticmethods - explicit temporary-heavy lowering
- predictable labels and control flow
-
INVOKESTATIChelper and intrinsic calls - supported wrappers, vectors, and structs
- canonical
if / else,while,do-while, andswitch
- arbitrary JVM bytecode
- virtual dispatch
- exception-heavy code
If your generator has a choice between:
- compact JVM bytecode
- explicit GPU-friendly bytecode
choose the second one.
JavaToGpu is designed to lift canonical bytecode shapes back into structured IR, not to reverse-engineer every possible JVM pattern.
The project also contains optional helper layers for generator authors:
- a builder-style API for canonical structured ASM generation
- a tiny experimental neutral AST that lowers into canonical ASM
These helpers are conveniences, not mandatory user-facing API.
Preferred patterns:
- explicit locals
- simple stack usage
- direct numeric opcodes
- direct branch layouts
- switches with predictable case bodies
Avoid:
-
dup_x*stack tricks - dynamic dispatch
- exception tables
- non-canonical merged CFG shapes