# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# Path: pyjvm/jassert.py
# def jassert_ref(ref):
#     assert ref is None or (type(ref) is tuple and ref[0] in ("ref", "vm_ref"))


import logging
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_ref
    index = (ord(frame.code[frame.pc]) << 8) + ord(frame.code[frame.pc + 1])
    frame.pc += 2
    cp_fieldref = frame.this_class.constant_pool[index]
    assert cp_fieldref[0] == 9  # CONSTANT_Fieldref
    klass_info = frame.this_class.constant_pool[cp_fieldref[1]]
    assert klass_info[0] == 7  # CONSTANT_Class_info
    name_and_type = frame.this_class.constant_pool[cp_fieldref[2]]
    assert name_and_type[0] == 12  # CONSTANT_NameAndType_info
    klass_name = frame.this_class.constant_pool[klass_info[1]][1]
    field_name = frame.this_class.constant_pool[name_and_type[1]][1]

    logger.debug("putfield %s %s", field_name, klass_name)
    klass = frame.vm.get_class(klass_name)
    assert klass is not None

    value = frame.stack.pop()
    ref = frame.stack.pop()
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)

    if ref[0] == "vm_ref":
        raise Exception("Special handling required, see vmo.txt")

    instance = frame.vm.heap[ref[1]]
    assert field_name in instance.fields
    instance.fields[field_name] = value



# Path: pyjvm/bytecode.py
# def bytecode(code):
#     def cl(func):
#         BYTECODE[hex(code)] = func
#         return func
# 
#     return cl
# 
# 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/ops/ops_fields.py
import logging
from pyjvm.bytecode import bytecode
from pyjvm.jassert import jassert_ref

    index = (ord(frame.code[frame.pc]) << 8) + ord(frame.code[frame.pc + 1])
    frame.pc += 2
    cp_fieldref = frame.this_class.constant_pool[index]
    assert cp_fieldref[0] == 9  # CONSTANT_Fieldref
    klass_info = frame.this_class.constant_pool[cp_fieldref[1]]
    assert klass_info[0] == 7  # CONSTANT_Class_info
    name_and_type = frame.this_class.constant_pool[cp_fieldref[2]]
    assert name_and_type[0] == 12  # CONSTANT_NameAndType_info
    klass_name = frame.this_class.constant_pool[klass_info[1]][1]
    field_name = frame.this_class.constant_pool[name_and_type[1]][1]

    logger.debug("putfield %s %s", field_name, klass_name)
    klass = frame.vm.get_class(klass_name)
    assert klass is not None

    value = frame.stack.pop()
    ref = frame.stack.pop()
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)

    if ref[0] == "vm_ref":
        raise Exception("Special handling required, see vmo.txt")

    instance = frame.vm.heap[ref[1]]
    assert field_name in instance.fields
    instance.fields[field_name] = value



@bytecode(code=0xbb)