Package org.jnode.vm.classmgr

Examples of org.jnode.vm.classmgr.VmMethod


            .getCurrentFrame(), null, Integer.MAX_VALUE);
        final int count = stack.length;
        final ProtectionDomain domains[] = new ProtectionDomain[count];

        for (int i = 0; i < count; i++) {
            final VmMethod method = stack[i].getMethod();
            if (method.hasDoPrivilegedPragma()) {
                // Stop here
                break;
            } else if (method.hasPrivilegedActionPragma()) {
                // Break here, do not include inherited thread context
                return new VmAccessControlContext(domains, null);
            } else {
                domains[i] = method.getDeclaringClass().getProtectionDomain();
            }
        }
        final VmThread thread = VmThread.currentThread();
        return new VmAccessControlContext(domains, thread.getContext());
    }
View Full Code Here


     * Convert to a String representation.
     *
     * @see java.lang.Object#toString()
     */
    public String toString() {
        final VmMethod method = sfMethod;
        final VmType<?> vmClass = (method == null) ? null : method.getDeclaringClass();
        final String cname = (vmClass == null) ? "<unknown class>" : vmClass.getName();
        final String mname = (method == null) ? "<unknown method>" : method.getName();
        final String location = getLocationInfo();

        return cname + '!' + mname + " (" + location + ')';
    }
View Full Code Here

        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        final VmType cls = VmType.fromClass(cl.loadClass(className));

        final int cnt = cls.getNoDeclaredMethods();
        for (int i = 0; i < cnt; i++) {
            final VmMethod method = cls.getDeclaredMethod(i);
            if ((mname == null) || method.getName().equals(mname)) {
                System.out.println("OptL: " + method.getNativeCodeOptLevel());
                System.out.println("Code: " + method.getDefaultCompiledCode());
            }
        }

    }
View Full Code Here

    /**
     * @see org.jnode.vm.bytecode.BytecodeVisitor#visit_invokespecial(org.jnode.vm.classmgr.VmConstMethodRef)
     */
    public void visit_invokespecial(VmConstMethodRef methodRef) {
        methodRef.resolve(loader);
        final VmMethod im = methodRef.getResolvedVmMethod();
        if (!canInline(im)) {
            // Do not inline this call
            super.visit_invokespecial(methodRef);
        } else {
            verifyInvoke(methodRef);
View Full Code Here

    /**
     * @see org.jnode.vm.bytecode.BytecodeVisitor#visit_invokestatic(org.jnode.vm.classmgr.VmConstMethodRef)
     */
    public void visit_invokestatic(VmConstMethodRef methodRef) {
        methodRef.resolve(loader);
        final VmMethod im = methodRef.getResolvedVmMethod();
        if (!canInline(im)) {
            // Do not inline this call
            super.visit_invokestatic(methodRef);
        } else {
            verifyInvoke(methodRef);
View Full Code Here

    /**
     * @see org.jnode.vm.bytecode.BytecodeVisitor#visit_invokevirtual(org.jnode.vm.classmgr.VmConstMethodRef)
     */
    public void visit_invokevirtual(VmConstMethodRef methodRef) {
        methodRef.resolve(loader);
        final VmMethod im = methodRef.getResolvedVmMethod();
        if (!canInline(im)) {
            // Do not inline this call
            super.visit_invokevirtual(methodRef);
        } else {
            verifyInvoke(methodRef);
View Full Code Here

     */
    private void inline(VmMethod im) {
        // Save some variables
        final char oldLocalDelta = this.localDelta;
        final boolean oldVisitedReturn = this.visitedReturn;
        final VmMethod oldMethod = this.method;
        final InlineBytecodeVisitor ibv = getDelegate();
        final VmByteCode bc = im.getBytecode();

        // Calculate the new maxLocals
        final int imLocals = bc.getNoLocals(); // #Locals of the inlined method
        final int curLocals = oldMethod.getBytecode().getNoLocals(); // #Locals
        // of
        // the
        // current
        // method
        maxLocals = (char) Math.max(maxLocals, oldLocalDelta + curLocals
View Full Code Here

        final VmStackReader reader = VmProcessor.current().getArchitecture()
            .getStackReader();
        final VmSystemClassLoader systemLoader = VmSystem.systemLoader;
        Address f = VmMagic.getCurrentFrame();
        while (reader.isValid(f)) {
            final VmMethod method = reader.getMethod(f);
            final VmClassLoader loader = method.getDeclaringClass().getLoader();
            if ((loader != null) && (loader != systemLoader)) {
                return loader;
            } else {
                f = reader.getPrevious(f);
            }
View Full Code Here

            .getCurrentFrame(), null, VmThread.STACKTRACE_LIMIT);
        final int count = stack.length;
        final Class[] result = new Class[count];
        int real_count = 0;
        for (int i = 0; i < count; i++) {
            VmMethod method = stack[i].getMethod();
            VmType<?> clazz = method.getDeclaringClass();
            if ((method.getName().equals("invoke") && (
                clazz.getName().equals("java.lang.reflect.Method") ||
                    clazz.getName().equals("org.jnode.vm.VmReflection"))))
                continue;

            result[real_count++] = clazz.asClass();
View Full Code Here

            final VmProcessor proc = VmProcessor.current();
            final VmStackReader reader = proc.getArchitecture()
                .getStackReader();

            final VmType exClass = VmMagic.getObjectType(ex);
            final VmMethod method = reader.getMethod(frame);
            if (method == null) {
                Unsafe.debug("Unknown method in class " + ex.getClass().getName());
                return null;
            }

            // if (interpreted) {
            /*
             * Screen.debug("{ex at pc:"); Screen.debug(pc); Screen.debug(" of " +
             * method.getBytecodeSize()); Screen.debug(method.getName());
             */
            // }
            final int count;
            final VmByteCode bc = method.getBytecode();
            final VmCompiledCode cc = reader.getCompiledCode(frame);
            if (bc != null) {
                count = bc.getNoExceptionHandlers();
            } else {
                count = 0;
            }
            // Screen.debug("eCount=" + count);
            for (int i = 0; i < count; i++) {
                final AbstractExceptionHandler eh;
                final VmCompiledExceptionHandler ceh;
                ceh = cc.getExceptionHandler(i);
                eh = ceh;
                boolean match;

                match = ceh.isInScope(address);

                if (match) {
                    final VmConstClass catchType = eh.getCatchType();

                    if (catchType == null) {
                        /* Catch all exceptions */
                        return Address.fromAddress(ceh.getHandler());
                    } else {
                        if (!catchType.isResolved()) {
                            SoftByteCodes.resolveClass(catchType);
                        }
                        final VmType handlerClass = catchType
                            .getResolvedVmClass();
                        if (handlerClass != null) {
                            if (handlerClass.isAssignableFrom(exClass)) {
                                return Address.fromAddress(ceh.getHandler());
                            }
                        } else {
                            System.err
                                .println("Warning: handler class==null in "
                                    + method.getName());
                        }
                    }
                }
            }

View Full Code Here

TOP

Related Classes of org.jnode.vm.classmgr.VmMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.