jgpc42 / insn

Functional JVM bytecode generation for Clojure.
Eclipse Public License 1.0
198 stars 5 forks source link

How to use labels? #5

Closed cnuernber closed 3 years ago

cnuernber commented 3 years ago

Hey, still really enjoying this library!

I am working on JDK16 support for dtype-next.

I am curious how to use the goto/if statements; specifically if-icmpne. How do I label a section of code?

jgpc42 commented 3 years ago

Hello again! Glad to hear it.

Regions of bytecode are denoted with the :mark op. By default, insn auto-generates labels (ASM Label objects) based on arbitrary values and caches them for each emitted method. I usually use keywords.

As mentioned in the README, take a look at the wiki, or the tests for additional examples.

Thanks.

cnuernber commented 3 years ago

Thanks, this will do!