Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Scheduler
Class jq_NativeThread  view jq_NativeThread download jq_NativeThread.java

java.lang.Object
  extended byScheduler.jq_NativeThread
All Implemented Interfaces:
Assembler.x86.x86Constants

public class jq_NativeThread
extends java.lang.Object
implements Assembler.x86.x86Constants


Field Summary
static Clazz.jq_Class _class
          Initialize the thread switch stub function.
static Clazz.jq_StaticMethod _ctrl_break_handler
           
static Clazz.jq_InstanceMethod _nativeThreadEntry
           
static Clazz.jq_StaticField _num_of_daemon_threads
           
static Clazz.jq_StaticField _num_of_java_threads
           
static Clazz.jq_InstanceMethod _schedulerLoop
           
static Clazz.jq_InstanceMethod _threadSwitch
           
private static boolean all_native_threads_initialized
           
private static boolean all_native_threads_started
           
 Memory.Heap.SegregatedListHeap backingSLHeap
           
private static jq_Thread break_jthread
           
private static jq_NativeThread break_nthread
           
private  jq_Thread currentThread
          NOTE: C code relies on this field being second.
 Memory.Heap.SizeControl[] GC_INDEX_ARRAY
           
private static jq_Thread gc_jthread
           
private static jq_NativeThread gc_nthread
           
private static int gcType
           
private static boolean has_break_occurred
           
private  jq_ThreadQueue idleQueue
          Queue of idle Java threads.
private static jq_NativeThread idleThread
          This static variable is set to an idle native thread, or null if there are no idle native threads.
private  int index
          The index of this native thread.
static jq_NativeThread initial_native_thread
          Data structure to represent the native thread that exists at virtual machine startup.
static int MAX_NATIVE_THREADS
           
private  Allocator.CodeAllocator myCodeAllocator
          Thread-local allocators.
private  Allocator.HeapAllocator myHeapAllocator
           
static jq_NativeThread[] native_threads
          An array of all native threads.
private static int num_of_daemon_threads
          Number of daemon threads that are currently active.
private static int num_of_java_threads
          Number of Java threads that are currently active.
(package private)  Memory.StackAddress original_ebp
          Original thread's stack pointer and base pointer.
(package private)  Memory.StackAddress original_esp
          Original thread's stack pointer and base pointer.
private  int pid
          NOTE: C code relies on this field being third.
private  jq_ThreadQueue readyQueue
          Queue of ready Java threads.
private static int round_robin_counter
          Counter for round-robin scheduling.
private  jq_Thread schedulerThread
          The Java thread that is executing while we are in the scheduler.
 Memory.Heap.SizeControl[] sizes
           
private  int thread_handle
          NOTE: C code relies on this field being first.
static boolean TRACE
          Trace flag.
private  jq_SynchThreadQueue transferQueue
          Queue of Java threads transferred from another native thread.
static boolean USE_INTERRUPTER_THREAD
           
 
Fields inherited from interface Assembler.x86.x86Constants
AL, AX, BOUNDS_EX_NUM, CACHE_LINE_SIZE, CJUMP_NEAR, CJUMP_SHORT, COMPLEX, EAX, EBP, EBX, ECX, EDI, EDX, ESI, ESP, JUMP_NEAR, JUMP_SHORT, MOD_DISP32, MOD_DISP8, MOD_EA, MOD_REG, NP, PU, PV, RA, RM_SIB, SCALE_1, SCALE_2, SCALE_4, SCALE_8, SEIMM8, SHIFT_ONCE, UV
 
Constructor Summary
private jq_NativeThread(int i)
          Create a new jq_NativeThread (only called from initNativeThreads(), and during bootstrap initialization of initial_native_thread and break_nthread field)
(package private) jq_NativeThread(jq_Thread t)
          Create a new jq_NativeThread that is tied to a specific jq_Thread.
 
Method Summary
static boolean allNativeThreadsInitialized()
           
static void ctrl_break_handler()
           
 void dump(jq_RegisterState regs)
           
static void dumpAllThreads()
           
static void endCurrentJavaThread()
          End the currently-executing Java thread and go back to the scheduler loop to pick up another thread.
 Allocator.CodeAllocator getCodeAllocator()
          Get the native thread-local code allocator.
 boolean getContext(jq_RegisterState r)
          Gets context of this native thread and puts it in r.
 jq_Thread getCurrentJavaThread()
          Get the currently-executing Java thread.
 jq_Thread getCurrentThread()
           
 Allocator.HeapAllocator getHeapAllocator()
          Get the native thread-local heap allocator.
 jq_ThreadQueue getIdleQueue()
           
 int getIndex()
           
private  jq_Thread getNextReadyThread()
          Get the next ready thread from the transfer queue or the ready queue.
 jq_ThreadQueue getReadyQueue()
           
 jq_ThreadQueue getTransferQueue()
           
static void initBreakThread()
           
static void initGCThread()
           
static void initInitialNativeThread()
          Initialize the initial native thread.
static void initNativeThreads(jq_NativeThread nt, int num)
          Initialize the extra native threads.
 void nativeThreadEntry()
          The entry point for new native threads.
 void resume()
          Starts up/resumes this native thread.
static void resumeTheFeast()
           
 void schedulerLoop()
           
 boolean setContext(jq_RegisterState r)
          Sets context of this native thread to r.
static void startJavaThread(jq_Thread t)
          Put the given Java thread on the queue of a (preferably idle) native thread.
static void startNativeThreads()
          Start up the extra native threads.
static void stopTheWorld()
           
 void suspend()
          Suspends this native thread.
 void threadSwitch()
          Performs a thread switch based on a timer interrupt.
 void threadSwitch(jq_Thread t2)
          Performs a thread switch to a specific thread in our local queue.
 java.lang.String toString()
          Convert this Object to a human-readable String.
private  void transferExtraWork()
          Transfer a Java thread from our ready queue to an idle native thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRACE

public static boolean TRACE
Trace flag.


initial_native_thread

public static final jq_NativeThread initial_native_thread
Data structure to represent the native thread that exists at virtual machine startup.


native_threads

public static jq_NativeThread[] native_threads
An array of all native threads.


num_of_java_threads

private static volatile int num_of_java_threads
Number of Java threads that are currently active. When this equals the number of active daemon threads, it is time to shut down.


num_of_daemon_threads

private static volatile int num_of_daemon_threads
Number of daemon threads that are currently active. Daemon threads do not keep the VM running.


thread_handle

private int thread_handle
NOTE: C code relies on this field being first.


currentThread

private jq_Thread currentThread
NOTE: C code relies on this field being second.


pid

private int pid
NOTE: C code relies on this field being third.


readyQueue

private final jq_ThreadQueue readyQueue
Queue of ready Java threads.


idleQueue

private final jq_ThreadQueue idleQueue
Queue of idle Java threads.


transferQueue

private final jq_SynchThreadQueue transferQueue
Queue of Java threads transferred from another native thread.


myCodeAllocator

private Allocator.CodeAllocator myCodeAllocator
Thread-local allocators.


myHeapAllocator

private Allocator.HeapAllocator myHeapAllocator

original_esp

Memory.StackAddress original_esp
Original thread's stack pointer and base pointer. These are used for longjmp'ing back to schedulerLoop when the currently executing Java thread exits.


original_ebp

Memory.StackAddress original_ebp
Original thread's stack pointer and base pointer. These are used for longjmp'ing back to schedulerLoop when the currently executing Java thread exits.


idleThread

private static volatile jq_NativeThread idleThread
This static variable is set to an idle native thread, or null if there are no idle native threads.


index

private final int index
The index of this native thread.


schedulerThread

private final jq_Thread schedulerThread
The Java thread that is executing while we are in the scheduler.


sizes

public Memory.Heap.SizeControl[] sizes

GC_INDEX_ARRAY

public Memory.Heap.SizeControl[] GC_INDEX_ARRAY

backingSLHeap

public Memory.Heap.SegregatedListHeap backingSLHeap

MAX_NATIVE_THREADS

public static final int MAX_NATIVE_THREADS
See Also:
Constant Field Values

all_native_threads_initialized

private static boolean all_native_threads_initialized

all_native_threads_started

private static boolean all_native_threads_started

round_robin_counter

private static volatile int round_robin_counter
Counter for round-robin scheduling.


USE_INTERRUPTER_THREAD

public static boolean USE_INTERRUPTER_THREAD

has_break_occurred

private static boolean has_break_occurred

break_nthread

private static jq_NativeThread break_nthread

break_jthread

private static jq_Thread break_jthread

gcType

private static int gcType

gc_nthread

private static jq_NativeThread gc_nthread

gc_jthread

private static jq_Thread gc_jthread

_class

public static final Clazz.jq_Class _class
Initialize the thread switch stub function.


_nativeThreadEntry

public static final Clazz.jq_InstanceMethod _nativeThreadEntry

_schedulerLoop

public static final Clazz.jq_InstanceMethod _schedulerLoop

_threadSwitch

public static final Clazz.jq_InstanceMethod _threadSwitch

_ctrl_break_handler

public static final Clazz.jq_StaticMethod _ctrl_break_handler

_num_of_java_threads

public static final Clazz.jq_StaticField _num_of_java_threads

_num_of_daemon_threads

public static final Clazz.jq_StaticField _num_of_daemon_threads
Constructor Detail

jq_NativeThread

private jq_NativeThread(int i)
Create a new jq_NativeThread (only called from initNativeThreads(), and during bootstrap initialization of initial_native_thread and break_nthread field)


jq_NativeThread

jq_NativeThread(jq_Thread t)
Create a new jq_NativeThread that is tied to a specific jq_Thread.

Method Detail

initInitialNativeThread

public static void initInitialNativeThread()
Initialize the initial native thread. Must be the first thing called at virtual machine startup.


initNativeThreads

public static void initNativeThreads(jq_NativeThread nt,
                                     int num)
Initialize the extra native threads.


startNativeThreads

public static void startNativeThreads()
Start up the extra native threads.


allNativeThreadsInitialized

public static boolean allNativeThreadsInitialized()

getCurrentThread

public jq_Thread getCurrentThread()

getCodeAllocator

public Allocator.CodeAllocator getCodeAllocator()
Get the native thread-local code allocator.


getHeapAllocator

public Allocator.HeapAllocator getHeapAllocator()
Get the native thread-local heap allocator.


getCurrentJavaThread

public jq_Thread getCurrentJavaThread()
Get the currently-executing Java thread.


resume

public void resume()
Starts up/resumes this native thread.


suspend

public void suspend()
Suspends this native thread.


getContext

public boolean getContext(jq_RegisterState r)
Gets context of this native thread and puts it in r.


setContext

public boolean setContext(jq_RegisterState r)
Sets context of this native thread to r.


startJavaThread

public static void startJavaThread(jq_Thread t)
Put the given Java thread on the queue of a (preferably idle) native thread.


endCurrentJavaThread

public static void endCurrentJavaThread()
End the currently-executing Java thread and go back to the scheduler loop to pick up another thread.


nativeThreadEntry

public void nativeThreadEntry()
The entry point for new native threads.


schedulerLoop

public void schedulerLoop()

threadSwitch

public void threadSwitch()
Performs a thread switch based on a timer interrupt.


threadSwitch

public void threadSwitch(jq_Thread t2)
Performs a thread switch to a specific thread in our local queue.


transferExtraWork

private void transferExtraWork()
Transfer a Java thread from our ready queue to an idle native thread.


getNextReadyThread

private jq_Thread getNextReadyThread()
Get the next ready thread from the transfer queue or the ready queue. Return null if there are no threads ready.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getIndex

public int getIndex()

ctrl_break_handler

public static void ctrl_break_handler()

dumpAllThreads

public static void dumpAllThreads()

initBreakThread

public static void initBreakThread()

stopTheWorld

public static void stopTheWorld()

resumeTheFeast

public static void resumeTheFeast()

initGCThread

public static void initGCThread()

dump

public void dump(jq_RegisterState regs)

getReadyQueue

public jq_ThreadQueue getReadyQueue()

getIdleQueue

public jq_ThreadQueue getIdleQueue()

getTransferQueue

public jq_ThreadQueue getTransferQueue()