pub struct JvmBackend { /* private fields */ }Expand description
The JVM backend that compiles LCNF to a JvmClass IR.
Implementations§
Source§impl JvmBackend
impl JvmBackend
Sourcepub fn default_backend() -> Self
pub fn default_backend() -> Self
Create a backend with the default configuration.
Sourcepub fn emit_literal(&self, lit: &LcnfLit) -> JvmResult<Vec<JvmInstruction>>
pub fn emit_literal(&self, lit: &LcnfLit) -> JvmResult<Vec<JvmInstruction>>
Emit instructions that push a literal value onto the operand stack.
Sourcepub fn emit_binop(&self, op: &str) -> JvmResult<JvmInstruction>
pub fn emit_binop(&self, op: &str) -> JvmResult<JvmInstruction>
Emit a simple binary arithmetic instruction for int operands.
Sourcepub fn emit_invokevirtual(
&self,
class: &str,
name: &str,
descriptor: &str,
) -> JvmInstruction
pub fn emit_invokevirtual( &self, class: &str, name: &str, descriptor: &str, ) -> JvmInstruction
Build an invokevirtual instruction.
Sourcepub fn emit_invokestatic(
&self,
class: &str,
name: &str,
descriptor: &str,
) -> JvmInstruction
pub fn emit_invokestatic( &self, class: &str, name: &str, descriptor: &str, ) -> JvmInstruction
Build an invokestatic instruction.
Sourcepub fn emit_new_default(&self, class: &str) -> Vec<JvmInstruction>
pub fn emit_new_default(&self, class: &str) -> Vec<JvmInstruction>
Emit a new + dup + invokespecial <init> sequence (default ctor).
Sourcepub fn emit_load(&self, slot: u16, ty: &JvmType) -> JvmInstruction
pub fn emit_load(&self, slot: u16, ty: &JvmType) -> JvmInstruction
Emit a typed load instruction for the given local-variable slot.
Sourcepub fn emit_store(&self, slot: u16, ty: &JvmType) -> JvmInstruction
pub fn emit_store(&self, slot: u16, ty: &JvmType) -> JvmInstruction
Emit a typed store instruction for the given local-variable slot.
Sourcepub fn emit_return(&self, ty: &JvmType) -> JvmInstruction
pub fn emit_return(&self, ty: &JvmType) -> JvmInstruction
Emit a typed return instruction.
Sourcepub fn emit_clinit(&self, class_name: &str) -> JvmMethod
pub fn emit_clinit(&self, class_name: &str) -> JvmMethod
Generate a canonical <clinit> that writes a fresh INSTANCE field.
Sourcepub fn emit_default_init(&self, superclass: &str) -> JvmMethod
pub fn emit_default_init(&self, superclass: &str) -> JvmMethod
Generate a default <init> constructor that delegates to super().
Sourcepub fn emit_fun_decl(&mut self, decl: &LcnfFunDecl) -> JvmResult<JvmClass>
pub fn emit_fun_decl(&mut self, decl: &LcnfFunDecl) -> JvmResult<JvmClass>
Compile an LCNF function declaration into a JvmClass.
Auto Trait Implementations§
impl Freeze for JvmBackend
impl RefUnwindSafe for JvmBackend
impl Send for JvmBackend
impl Sync for JvmBackend
impl Unpin for JvmBackend
impl UnsafeUnpin for JvmBackend
impl UnwindSafe for JvmBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more