pub struct CodeWriter {
pub max_stack: u16,
pub max_locals: u16,
pub bytecode: Vec<u8>,
pub exception_table: Vec<ExceptionHandler>,
/* private fields */
}Fields§
§max_stack: u16§max_locals: u16§bytecode: Vec<u8>§exception_table: Vec<ExceptionHandler>Implementations§
Source§impl CodeWriter
impl CodeWriter
pub fn new(max_stack: u16, max_locals: u16) -> Self
pub fn current_pc(&self) -> u16
pub fn new_label(&mut self) -> LabelId
pub fn bind_label(&mut self, label: LabelId)
Sourcepub fn bind_label_with_frame(
&mut self,
label: LabelId,
locals: Vec<VerificationType>,
stack: Vec<VerificationType>,
)
pub fn bind_label_with_frame( &mut self, label: LabelId, locals: Vec<VerificationType>, stack: Vec<VerificationType>, )
Binds a label and records an explicit StackMapTable FullFrame at this PC.
pub fn emit_u8(&mut self, b: u8)
pub fn emit_u16(&mut self, val: u16)
pub fn emit_i16(&mut self, val: i16)
pub fn emit_jump(&mut self, opcode: u8, target: LabelId)
pub fn emit_int_const(&mut self, value: i32)
pub fn emit_ldc(&mut self, cp_idx: u16)
pub fn emit_load(&mut self, ty: &JvmType, slot: u16)
pub fn emit_aload(&mut self, slot: u16)
pub fn emit_astore(&mut self, slot: u16)
pub fn emit_return(&mut self, ty: &JvmType)
Sourcepub fn emit_box_if_primitive(&mut self, cp: &mut ConstantPool, ty: &JvmType)
pub fn emit_box_if_primitive(&mut self, cp: &mut ConstantPool, ty: &JvmType)
Boxes a primitive value on the top of the operand stack into its java.lang.* wrapper.
Sourcepub fn emit_unbox_or_cast(&mut self, cp: &mut ConstantPool, ty: &JvmType)
pub fn emit_unbox_or_cast(&mut self, cp: &mut ConstantPool, ty: &JvmType)
Casts or unboxes java/lang/Object on top of the stack to the expected JvmType.
pub fn finalize_jumps(&mut self) -> Result<(), String>
Trait Implementations§
Source§impl Clone for CodeWriter
impl Clone for CodeWriter
Auto Trait Implementations§
impl Forget for CodeWriter
impl Freeze for CodeWriterwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<ExceptionHandler>: Freeze,
PhantomData<Option<u16>>: Freeze,
PhantomData<JumpPatch>: Freeze,
PhantomData<FrameEntry>: Freeze,
impl Move for CodeWriter
impl RefUnwindSafe for CodeWriter
impl Send for CodeWriterwhere
RawVecInner: Send,
impl Sync for CodeWriterwhere
RawVecInner: Sync,
impl Unpin for CodeWriter
impl UnsafeUnpin for CodeWriterwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<ExceptionHandler>: UnsafeUnpin,
PhantomData<Option<u16>>: UnsafeUnpin,
PhantomData<JumpPatch>: UnsafeUnpin,
PhantomData<FrameEntry>: UnsafeUnpin,
impl UnwindSafe for CodeWriterwhere
RawVecInner: UnwindSafe,
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