Package org.jnode.vm.scheduler

Examples of org.jnode.vm.scheduler.VmThread


                    return;
                }
                sfEnum.next();
            }

            final VmThread thread = VmThread.currentThread();
            final VmAccessControlContext inheritedCtx = thread.getContext();
            if (inheritedCtx != null) {
                inheritedCtx.checkPermission(perm);
            }
        }
    }
View Full Code Here


                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

     * @return the result of the <code>action.run()</code> method.
     */
    @DoPrivileged
    public static Object doPrivileged(PrivilegedAction action,
                                      VmAccessControlContext context) {
        final VmThread thread = VmThread.currentThread();
        final VmAccessControlContext prevContext = thread.getContext();
        thread.setContext(context);
        try {
            return action.run();
        } finally {
            thread.setContext(prevContext);
        }
    }
View Full Code Here

     * @return the result of the <code>action.run()</code> method.
     */
    @DoPrivileged
    public static Object doPrivileged(PrivilegedExceptionAction action,
                                      VmAccessControlContext context) throws PrivilegedActionException {
        final VmThread thread = VmThread.currentThread();
        final VmAccessControlContext prevContext = thread.getContext();
        thread.setContext(context);
        try {
            return action.run();
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new PrivilegedActionException(e);
        } finally {
            thread.setContext(prevContext);
        }
    }
View Full Code Here

        });
        findThreads(grp, threadSet);

        PrintWriter out = getOutput().getPrintWriter();
        for (final Thread thread : threadSet) {
            VmThread vmThread = AccessController.doPrivileged(new PrivilegedAction<VmThread>() {
                public VmThread run() {
                    return ThreadHelper.getVmThread(thread);
                }
            });
            out.println(" " + thread.getId() + SEPARATOR + thread.getName() + SEPARATOR + thread.getPriority() +
                SEPARATOR + vmThread.getThreadStateName());
        }
    }
View Full Code Here

        for (int i = 0; i < max; i++) {
            final Thread t = ts[i];
            if (t != null) {
                if ((threadName == null) || threadName.equals(t.getName())) {
                    VmThread vmThread = AccessController
                    .doPrivileged(new PrivilegedAction<VmThread>() {
                        public VmThread run() {
                            return ThreadHelper.getVmThread(t);
                        }
                    });
                    out.println(SLASH_T + t.getId() + SEPARATOR + t.getName() + SEPARATOR +
                            t.getPriority() + SEPARATOR + vmThread.getThreadStateName());
                    if (threadName != null) {
                        final Object[] trace = VmThread.getStackTrace(vmThread);
                        final int traceLen = trace.length;
                        out.println(SLASH_T + SLASH_T + TRACE);
                        for (int k = 0; k < traceLen; k++) {
View Full Code Here

                System.out.println("Thread not found: " + threadName);
                return;
            }
        }

        VmThread vmThread = ThreadHelper.getVmThread(thread);

        final int stackSize = vmThread.getStackSize();
        final Object stack = invoke("getStack", VmThread.class, vmThread);
        if (stack != null) {
            final Address stackBottom = ObjectReference.fromObject(stack).toAddress();
            final Address stackTop = stackBottom.add(stackSize);
            final Address stackEnd;
            if (vmThread == VmThread.currentThread()) {
                stackEnd = stackBottom;
            } else {
                stackEnd = ((VmX86Thread) vmThread).getStackPointer();
            }
            final int slotSize = (Integer) invoke("getReferenceSize", VmX86Thread.class, vmThread);
            Address stackFrame = vmThread.getStackFrame();
            System.out.println("Stack start:    " + NumberUtils.hex(stackTop.toInt()));
            System.out.println("Stack end  :    " + NumberUtils.hex(stackEnd.toInt()));

            System.out.println("Raw stack:");
            Address ptr = stackTop;
View Full Code Here

     * Show the current stacktrace using Screen.debug.
     * TODO that method only exist to have line numbers : find a way to add line numbers to debugStackTrace(max)
     */
    @KernelSpace
    public final void debugStackTraceWithLineNumbers(int max) {
        final VmThread current = VmThread.currentThread();
        final VmStackFrame[] frames = (VmStackFrame[]) VmThread.getStackTrace(current);
        if (frames == null) {
            Unsafe.debug("Debug stacktrace:<no stack trace>\n");
        } else {
            Unsafe.debug("Debug stacktrace: ");
View Full Code Here

        final VmInstanceField threadStackEndField = (VmInstanceField) vmThreadClass
            .getField("stackEnd");
        final VmType<?> vmProcessorClass = loadClass(VmProcessor.class);
        final VmInstanceField procStackEndField = (VmInstanceField) vmProcessorClass
            .getField("stackEnd");
        final VmThread initialThread = processor.getCurrentThread();

        final GPR abx = os.isCode32() ? (GPR) X86Register.EBX : X86Register.RBX;
        final GPR adx = os.isCode32() ? (GPR) X86Register.EDX : X86Register.RDX;
        final int slotSize = arch.getReferenceSize();
View Full Code Here

        final Thread[] ts = new Thread[max];
        grp.enumerate(ts);
        for (int i = 0; i < max; i++) {
            final Thread t = ts[i];
            if (t != null) {
                final VmThread vmThread = ThreadHelper.getVmThread(t);
                final boolean add;
                switch (state) {
                    case ST_ALL:
                        add = true;
                        break;
                    case ST_RUNNING:
                        add = vmThread.isRunning();
                        break;
                    case ST_WAITING:
                        add = vmThread.isWaiting();
                        break;
                    default:
                        add = false;
                }
                if (add) {
View Full Code Here

TOP

Related Classes of org.jnode.vm.scheduler.VmThread

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.