Examples of VmMethod


Examples of org.jnode.vm.classmgr.VmMethod

    protected final void verifyInvoke(VmConstMethodRef methodRef) {
        if (currentKernelSpace || currentUninterruptible) {
            // May only call methods with kernelspace pragma.
            methodRef.resolve(currentMethod.getDeclaringClass().getLoader());

            final VmMethod callee = methodRef.getResolvedVmMethod();
            if (currentKernelSpace) {
                if (!callee.hasKernelSpacePragma()) {
                    // throw new ClassFormatError("Method '" + currentMethod +
                    // "' calls method outside KernelSpace: " + callee);
                    System.out.println("Method calls method outside KernelSpace:\n\tcaller: " +
                        currentMethod.getFullName() + "\n\tcallee: " +
                        callee.getFullName());
                }
            }
            if (currentUninterruptible) {
                if (!callee.isUninterruptible()) {
                    if (currentMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.schedule")) {
                        // throw new ClassFormatError("Method '" + currentMethod +
                        // "' calls interruptible method: " + callee);
                        System.out.println("Method calls interruptible method:\n\tcaller: " +
                            currentMethod.getFullName() + "\n\tcallee: " +
                            callee.getFullName());
                    }
                }
            }
            if (callee.isSynchronized()) {
                //throw new ClassFormatError("Method '" + currentMethod + "' calls synchronized method: " + callee);
                System.out.println(
                    "Method '" + currentMethod.getFullName() + "' calls synchronized method: " + callee.getFullName());
            }
        }
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

     */
    protected void initCallMain(X86BinaryAssembler os) throws BuildException,
        ClassNotFoundException {
        final VmType<?> vmMethodClass = loadClass(VmMethod.class);
        final VmType<?> vmMainClass = loadClass(Main.class);
        final VmMethod mainMethod = vmMainClass.getMethod(
            Main.MAIN_METHOD_NAME, Main.MAIN_METHOD_SIGNATURE);
        final VmInstanceField nativeCodeField = (VmInstanceField) vmMethodClass
            .getField("nativeCode");

        final GPR aax = os.isCode32() ? (GPR) X86Register.EAX : X86Register.RAX;
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

        os.setObjectRef(clInitCaller);

        // Call VmClass.loadFromBootClassArray
        final VmType<?> vmClassClass = loadClass(VmType.class);
        final VmMethod lfbcaMethod = vmClassClass.getMethod(
            "loadFromBootClassArray", "([Lorg/jnode/vm/classmgr/VmType;)V");
        final VmType<?> vmMethodClass = loadClass(VmMethod.class);
        final VmInstanceField nativeCodeField = (VmInstanceField) vmMethodClass
            .getField("nativeCode");

        final GPR aax = os.isCode32() ? (GPR) X86Register.EAX : X86Register.RAX;
        final GPR abx = os.isCode32() ? (GPR) X86Register.EBX : X86Register.RBX;

        os.writeMOV_Const(aax, bootClasses);
        os.writePUSH(aax);
        os.writeMOV_Const(aax, lfbcaMethod);
        os.writeMOV(abx.getSize(), abx, aax, nativeCodeField.getOffset());
        os.writeCALL(abx);

        // Now call all static initializers
        for (int i = 0; (i < bootClasses.length); i++) {
            VmType<?> vmClass = bootClasses[i];
            if ((vmClass instanceof VmClassType)
                && (((VmClassType<?>) vmClass).getInstanceCount() > 0)) {
                VmMethod clInit = vmClass.getMethod("<clinit>", "()V");
                if (clInit != null) {
                    // os.setObjectRef(clInitCaller + "$$" + vmClass.getName());
                    log("Missing static initializer in class "
                        + vmClass.getName(), Project.MSG_WARN);
                }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

     */
    public boolean visit(Object object) {
        final int color = VmMagic.getObjectColor(object);
        if (color == GC_YELLOW) {
            final VmClassType type = VmMagic.getObjectType(object);
            final VmMethod fm = type.getFinalizeMethod();
            if (fm != null) {
                try {
                    helper.invokeFinalizer(fm, object);
                } catch (Throwable ex) {
                    // Ignore error in finalize
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

    private static VmByteCode loadByteCode(String className)
        throws MalformedURLException, ClassNotFoundException {
        VmSystemClassLoader vmc = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture32());
        VmType type = vmc.loadClass(className, true);
        VmMethod arithMethod = null;
        int nMethods = type.getNoDeclaredMethods();
        for (int i = 0; i < nMethods; i += 1) {
            VmMethod method = type.getDeclaredMethod(i);
            if ("const1".equals(method.getName())) {
                arithMethod = method;
                break;
            }
        }
        VmByteCode code = arithMethod.getBytecode();
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

        VmType old_type = VmType.fromClass(oldClass);
        VmClassLoader loader = VmType.fromClass(oldClass).getLoader();
        ProtectionDomain pd = oldClass.getProtectionDomain();
        VmType new_type = ClassDecoder.defineClass(name, ByteBuffer.wrap(classData), false, loader, pd);
        for(int i = 0; i < old_type.getNoDeclaredMethods(); i++){
            VmMethod old_method = old_type.getDeclaredMethod(i);
            if (!old_method.isNative()) {
                VmMethod new_method = new_type.getDeclaredMethod(old_method.getName(), old_method.getSignature());
                if(new_method == null) continue;

                old_method.setBytecode(new_method.getBytecode());
                old_method.resetOptLevel();
                old_method.recompile();
                System.out.println("Redefined method: " + old_method.getFullName());
            }
        }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

    private static <T> Method[] getDeclaredMethods0(Class<T> instance, boolean publicOnly) {
        final VmType<T> vmClass = getLinkedVmClass(instance);
        final int cnt = vmClass.getNoDeclaredMethods();
        int max = 0;
        for (int i = 0; i < cnt; i++) {
            VmMethod method = vmClass.getDeclaredMethod(i);
            if (!method.isConstructor() &&
                    (!publicOnly || method.isPublic())) {
                max++;
            }
        }
        final Method[] list = new Method[max];
        max = 0;
        for (int i = 0; i < cnt; i++) {
            VmMethod vmMethod = vmClass.getDeclaredMethod(i);
            if (!vmMethod.isConstructor() &&
                    (!publicOnly || vmMethod.isPublic())) {
                list[max++] = (Method) vmMethod.asMember();
            }
        }
        return list;
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

            }
        }
        Constructor<?>[] list = new Constructor[max];
        max = 0;
        for (int i = 0; i < cnt; i++) {
            VmMethod vmMethod = vmClass.getDeclaredMethod(i);
            if (vmMethod.isConstructor()) {
                list[max++] = (Constructor<?>) vmMethod.asMember();
            }
        }
        return list;
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

     * @see sun.reflect.NativeMethodAccessorImpl#invoke0(java.lang.reflect.Method, java.lang.Object, java.lang.Object[])
     */
    private static Object invoke0(Method arg1, Object arg2, Object[] arg3) throws IllegalArgumentException,
        InvocationTargetException {
        VmType<?> vmt = VmType.fromClass((Class<?>) arg1.getDeclaringClass());
        VmMethod vmm = vmt.getDeclaredMethod(arg1.getSlot());
        return VmReflection.invoke(vmm, arg2, arg3);
    }
View Full Code Here

Examples of org.jnode.vm.classmgr.VmMethod

     */
    private static Object newInstance0(Constructor<?> arg1, Object[] arg2) throws InstantiationException,
               IllegalArgumentException,
        InvocationTargetException{
        VmType<?> vmt = VmType.fromClass(arg1.getDeclaringClass());
        VmMethod vmm = vmt.getDeclaredMethod(arg1.getSlot());
        try {
            return VmReflection.newInstance(vmm, arg2);
        } catch (IllegalAccessException iae)  { //todo| this should not happen, fix VmReflection.newInstance() to not
                                                //todo| throw this exception
            throw new InstantiationException("Unexpected IllegalAccessException");
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.