summaryrefslogtreecommitdiff
path: root/zjit/src/codegen.rs
diff options
context:
space:
mode:
-rw-r--r--zjit/src/codegen.rs60
1 files changed, 49 insertions, 11 deletions
@@ -1,13 +1,6 @@
use crate::{
- asm::CodeBlock,
- backend::lir::{EC, CFP, SP, C_ARG_OPNDS, Assembler, Opnd, asm_comment},
- cruby::*,
- debug,
- hir::{Function, InsnId, Insn, Const},
- virtualmem::CodePtr
};
-#[cfg(feature = "disasm")]
-use crate::get_option;
/// Ephemeral code generation state
struct JITState {
@@ -40,15 +33,19 @@ pub fn gen_function(cb: &mut CodeBlock, function: &Function, iseq: IseqPtr) -> O
if !matches!(*insn, Insn::Snapshot { .. }) {
asm_comment!(asm, "Insn: {:04} {:?}", insn_idx, insn);
}
- match *insn {
- Insn::Const { val: Const::Value(val) } => gen_const(&mut jit, insn_id, val),
- Insn::Return { val } => gen_return(&jit, &mut asm, val)?,
Insn::Snapshot { .. } => {}, // we don't need to do anything for this instruction at the moment
_ => {
debug!("ZJIT: gen_function: unexpected insn {:?}", insn);
return None;
}
}
}
// Generate code if everything can be compiled
@@ -105,3 +102,44 @@ fn gen_return(jit: &JITState, asm: &mut Assembler, val: InsnId) -> Option<()> {
Some(())
}