# Path: pyjvm/frame.py
# class Frame(object):
#     '''Frame is created for every method invokation'''
# 
#     def __init__(self, _thread, _this_class, _method, _args=[], _desc=""):
#         self.thread = _thread
#         if _thread is not None:
#             self.vm = _thread.vm
#         self.this_class = _this_class
#         self.pc = 0  # Always points to byte code to be executed
#         self.method = _method
#         self.code = _method[2]  # method body (bytecode)
#         self.stack = []
#         self.args = _args
#         self.ret = None  # return value for non void
#         self.has_result = False  # flag if return value is set
#         self.desc = _desc
#         global f_counter
#         self.id = f_counter
#         # to support multithreaded environment
#         self.cpc = 0
#         self.monitor = None
#         f_counter += 1


from pyjvm.frame import Frame
'''See natives.txt in documentation'''



def java_security_AccessController_getStackAccessControlContext___Ljava_security_AccessControlContext_(frame, args):
    frame.stack.append(None)


def java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction__Ljava_lang_Object_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    o = frame.vm.heap[ref[1]]
    klass = o.java_class
    method = klass.find_method("run", "()Ljava/lang/Object;")
    args = [None]*method[1]
    args[0] = ref
    sub = Frame(frame.thread, klass, method, args,
                "RUN call in java_security_AccessController_doPrivileged")
    frame.thread.frame_stack.append(sub)


def java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction__Ljava_lang_Object_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    o = frame.vm.heap[ref[1]]
    klass = o.java_class
    method = klass.find_method("run", "()Ljava/lang/Object;")
    assert method is not None
    args = [None]*method[1]
    args[0] = ref

# Path: pyjvm/frame.py
# class Frame(object):
#     '''Frame is created for every method invokation'''
# 
#     def __init__(self, _thread, _this_class, _method, _args=[], _desc=""):
#         self.thread = _thread
#         if _thread is not None:
#             self.vm = _thread.vm
#         self.this_class = _this_class
#         self.pc = 0  # Always points to byte code to be executed
#         self.method = _method
#         self.code = _method[2]  # method body (bytecode)
#         self.stack = []
#         self.args = _args
#         self.ret = None  # return value for non void
#         self.has_result = False  # flag if return value is set
#         self.desc = _desc
#         global f_counter
#         self.id = f_counter
#         # to support multithreaded environment
#         self.cpc = 0
#         self.monitor = None
#         f_counter += 1


# Path: pyjvm/platform/java/security/accesscontroller.py
from pyjvm.frame import Frame

'''See natives.txt in documentation'''



def java_security_AccessController_getStackAccessControlContext___Ljava_security_AccessControlContext_(frame, args):
    frame.stack.append(None)


def java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction__Ljava_lang_Object_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    o = frame.vm.heap[ref[1]]
    klass = o.java_class
    method = klass.find_method("run", "()Ljava/lang/Object;")
    args = [None]*method[1]
    args[0] = ref
    sub = Frame(frame.thread, klass, method, args,
                "RUN call in java_security_AccessController_doPrivileged")
    frame.thread.frame_stack.append(sub)


def java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction__Ljava_lang_Object_(frame, args):
    ref = args[0]
    assert type(ref) is tuple and ref[0] == "ref"
    o = frame.vm.heap[ref[1]]
    klass = o.java_class
    method = klass.find_method("run", "()Ljava/lang/Object;")
    assert method is not None
    args = [None]*method[1]
    args[0] = ref

    sub = Frame(frame.thread, klass, method, args,