NAME

B::JVM::Emit - Package used by B::JVM to emit Java Bytecode

SYNOPSIS

use B::JVM::Jasmin::Emit;

my $emitter = new B::JVM::Emit(FILEHANDLE);

# ...
$emitter->DIRECTIVE_NAME([@ARGS]);
#  ...
$emitter->OPCODE_NAME([@ARGS]);
#  ...
$emitter->OPCODE_NAME([@ARGS]);

DESCRIPTION

This class is used Java bytcodes on a file handle. Until someone actually creates a module that truely emits Java bytecodes, the interesting stuff is all happening in the subclass, B::JVM::Jasmin::Emit. The method names used here were built up from the jasmin syntax. There was no reason for this other than the implementor was most familar with that manner of thinking about Java bytecode. However, the set should cover every opcode available.

The user of this module must send opcodes in the order desired and is responsible for emitting a sensible JVM program. All this module provides is a consistent way to emit JVM opcodes from Perl, since there is no universal assembler syntax. Someone who wants to emit opcodes need only subclass this module and implement all the methods.

AUTHOR

Bradley M. Kuhn, bkuhn@ebb.org, http://www.ebb.org/bkuhn

COPYRIGHT

Copyright (C) 1999, Bradley M. Kuhn, All Rights Reserved.

LICENSE

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the LICENSE file that was shipped with this distribution.

SEE ALSO

perl(1), B::JVM::Jasmin(3), B::JVM::Jasmin::Emit(3)

DETAILED DOCUMENTATION

B::JVM::Emit Package Variables

$VERSION

Version number of B::JVM::Emit. For now, it should always match the version of B::JVM::Jasmin

Modules used by B::JVM::Emit

Carp

Used for error reporting

Methods in B::JVM::Emit

B::JVM::Emit::new

usage: B::JVM::Emit::new(FILEHANDLE)

Creates a new object of the class. It assumes that FILEHANDLE is a lexically scoped file handle open for writing.

B::JVM::Emit::_clearMethod

usage: $emitter->_clearMethod()

Clears the current method name.

B::JVM::Emit::_setCurrentMethod

usage: B::JVM::Emit::_setCurrentMethod(METHOD_NAME)

Sets the current name of the method being emitted.

B::JVM::Emit::inMethod

usage: $emitter->inMethod()

Returns true (in particular, the current method name) if we are currently in method, and returns false otherwise.

B::JVM::Emit::_setClassName

usage: B::JVM::Emit::_setClassName(CLASS_NAME)

Sets the name of the class being emitted.