bb_offset <- getCodeOffset
let bbstarts' = M.insert bid bb_offset bbstarts
defineLabel $ getLabel bid lmap
- cs <- mapM emit' $ code bb
+ cs <- mapM emit'' $ code bb
let calls' = calls `M.union` M.fromList (catMaybes cs)
case successor bb of
Return -> return (calls', bbstarts')
let imm8 = is8BitOffset offset
return $ Just (calladdr + (if imm8 then 3 else 6), trapcause imm8)
+ emit'' :: J.Instruction -> CodeGen e s (Maybe (Word32, TrapCause))
+ emit'' insn = newNamedLabel ("jvm_insn: " ++ show insn) >>= defineLabel >> emit' insn
+
emit' :: J.Instruction -> CodeGen e s (Maybe (Word32, TrapCause))
emit' (INVOKESPECIAL cpidx) = emitInvoke cpidx True
emit' (INVOKESTATIC cpidx) = emitInvoke cpidx False