# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# Path: pyjvm/jassert.py
# def jassert_float(value):
#     assert type(value) is tuple and value[0] == "float"
# 
# Path: pyjvm/jassert.py
# def jassert_double(value):
#     assert type(value) is tuple and value[0] == "double"
# 
# Path: pyjvm/jassert.py
# def jassert_int(value):
#     assert type(value) is int or type(value) is long
#     assert -2147483648 <= value <= 2147483647
# 
# Path: pyjvm/jassert.py
# def jassert_long(value):
#     assert type(value) is tuple and value[0] == "long"
#     assert -9223372036854775808 <= value[1] <= 9223372036854775807
# 
# Path: pyjvm/jassert.py
# def jassert_ref(ref):
#     assert ref is None or (type(ref) is tuple and ref[0] in ("ref", "vm_ref"))
# 
# Path: pyjvm/throw.py
# class JavaException(Exception):
#     '''PY excpetion.
# 
#     Real heap reference is stored in ref
#     '''
# 
#     def __init__(self, _vm, _ref):
#         self.vm = _vm
#         self.ref = _ref
#         self.stack = []
# 
#     def __str__(self):
#         ex = self.vm.heap[self.ref[1]]
#         return str(ex)


import logging
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_float
from pyjvm.jassert import jassert_double
from pyjvm.jassert import jassert_int
from pyjvm.jassert import jassert_long
from pyjvm.jassert import jassert_ref
from pyjvm.throw import JavaException
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''Java bytecode implementation'''



logger = logging.getLogger(__name__)


@bytecode(code=0xac)
def ireturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_int(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1


@bytecode(code=0xad)
def lreturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_long(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1



# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# Path: pyjvm/jassert.py
# def jassert_float(value):
#     assert type(value) is tuple and value[0] == "float"
# 
# Path: pyjvm/jassert.py
# def jassert_double(value):
#     assert type(value) is tuple and value[0] == "double"
# 
# Path: pyjvm/jassert.py
# def jassert_int(value):
#     assert type(value) is int or type(value) is long
#     assert -2147483648 <= value <= 2147483647
# 
# Path: pyjvm/jassert.py
# def jassert_long(value):
#     assert type(value) is tuple and value[0] == "long"
#     assert -9223372036854775808 <= value[1] <= 9223372036854775807
# 
# Path: pyjvm/jassert.py
# def jassert_ref(ref):
#     assert ref is None or (type(ref) is tuple and ref[0] in ("ref", "vm_ref"))
# 
# Path: pyjvm/throw.py
# class JavaException(Exception):
#     '''PY excpetion.
# 
#     Real heap reference is stored in ref
#     '''
# 
#     def __init__(self, _vm, _ref):
#         self.vm = _vm
#         self.ref = _ref
#         self.stack = []
# 
#     def __str__(self):
#         ex = self.vm.heap[self.ref[1]]
#         return str(ex)


# Path: pyjvm/ops/ops_ret.py
import logging
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_float
from pyjvm.jassert import jassert_double
from pyjvm.jassert import jassert_int
from pyjvm.jassert import jassert_long
from pyjvm.jassert import jassert_ref
from pyjvm.throw import JavaException

#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''Java bytecode implementation'''



logger = logging.getLogger(__name__)


@bytecode(code=0xac)
def ireturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_int(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1


@bytecode(code=0xad)
def lreturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_long(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1



@bytecode(code=0xae)