Examples of VmMethod


Examples of org.jnode.vm.classmgr.VmMethod

                LittleEndian.setInt32(code, ofs, (extraIndex - ofs) - 4);
                ofs += 4;

                // Create extra field
                for (int k = 0; k < arrLength; k++) {
                    final VmMethod method = (VmMethod) arr[k];

                    if (k + 1 == arrLength) {
                        // Last entry, jump directly
                        // JMP [statics+method_statics_index]
                        extraIndex = genJmpStaticsCodeOfs(code, extraIndex,
                            method.getSharedStaticsIndex());
                    } else {
                        // Non-last entry, compare and jump of select match

                        // CMP selectorReg, imm32_selector
                        code[extraIndex++] = (byte) 0x81;
                        code[extraIndex++] = (byte) 0xFA;
                        LittleEndian.setInt32(code, extraIndex, method
                            .getSelector());
                        extraIndex += 4;

                        // JNE labelAfterJump
                        code[extraIndex++] = (byte) 0x75;
                        code[extraIndex++] = (byte) 0x06;

                        // JMP [statics+method_statics_index]
                        extraIndex = genJmpStaticsCodeOfs(code, extraIndex,
                            method.getSharedStaticsIndex());
                    }
                }
            } else if (imt[i] != null) {
                // Simple route

                // JMP [STATICS+staticsOfs]
                final VmMethod method = (VmMethod) imt[i];
                ofs = genJmpStaticsCodeOfs(code, ofs, method.getSharedStaticsIndex());
            } else {
                // Empty IMT slot
                // INT ABSTRACT_METHOD
                code[ofs++] = (byte) 0xCD;
                code[ofs++] = (byte) X86CompilerConstants.ABSTRACT_METHOD_INTNO;
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

     * Gets the method at the current stack position.
     *
     * @return
     */
    public final VmMethod getMethod() {
        VmMethod m = null;
        if (cc != null) {
            m = cc.getAddressMap().getMethodAtIndex(codeIndex);
        }
        if (m == null) {
            m = cc.getMethod();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            final VmStackReader reader = VmProcessor.current()
                .getArchitecture().getStackReader();
            final VmStackFrameEnumerator sfEnum = new VmStackFrameEnumerator(reader);
            int recursionCount = 0;
            while (sfEnum.isValid()) {
                final VmMethod method = sfEnum.getMethod();
                if (method.hasDoPrivilegedPragma()) {
                    // Stop here with the current thread's stacktrace.
                    break;
                } else if (method.hasCheckPermissionPragma()) {
                    // Be paranoia for now, let's check for recursive
                    // checkPermission calls.
                    recursionCount++;
                    if (recursionCount > 2) {
                        reader.debugStackTrace();
                        Unsafe.die("Recursive checkPermission");
                    }
                } else {
                    final VmType<?> declClass = method.getDeclaringClass();
                    final ProtectionDomain pd = declClass.getProtectionDomain();
                    if (pd != null) {
                        // Unsafe.debug(":pd");
                        if (!pd.implies(perm)) {
                            // Unsafe.debug("Permission denied");
                            throw new AccessControlException("Permission \""
                                + perm + "\" not granted due to "
                                + declClass.getName());
                        }
                    }
                }
                if (method.hasPrivilegedActionPragma()) {
                    // Break here, do not include inherited thread context
                    return;
                }
                sfEnum.next();
            }
View Full Code Here

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

Examples of org.jnode.vm.classmgr.VmMethod

     * 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

Examples of org.jnode.vm.classmgr.VmMethod

        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

Examples of org.jnode.vm.classmgr.VmMethod

    /**
     * @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

Examples of org.jnode.vm.classmgr.VmMethod

    /**
     * @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

Examples of org.jnode.vm.classmgr.VmMethod

    /**
     * @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

Examples of org.jnode.vm.classmgr.VmMethod

     */
    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
TOP
Copyright © 2018 www.massapi.com. 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.