org.jikesrvm.ia32
Class ThreadLocalState

java.lang.Object
  extended by org.jikesrvm.ia32.ThreadLocalState
Direct Known Subclasses:
ArchitectureSpecific.ThreadLocalState

public abstract class ThreadLocalState
extends Object

This class provides a layer of abstraction that the rest of the VM must use in order to access the current RVMThread object.

See Also:
RVMThread

Field Summary
protected static RegisterConstants.GPR THREAD_REGISTER
           
 
Constructor Summary
ThreadLocalState()
           
 
Method Summary
static void boot()
          The C bootstrap program has placed a pointer to the initial RVMThread in ESI.
static void emitCompareAndExchangeField(Assembler asm, Offset offset, RegisterConstants.GPR srcReg)
          Emit an instruction sequence to to an atomic compare and exchange on a field in the current thread offset with an immediate value.
static void emitCompareFieldWithImm(Assembler asm, Offset offset, int imm)
          Emit an instruction sequence to compare the value of a field in the current thread offset with an immediate value
static void emitDecrementField(Assembler asm, Offset offset)
          Emit an instruction sequence to decrement the value of a field in the current thread offset
static void emitLoadThread(Assembler asm, RegisterConstants.GPR base, Offset offset)
          Emit an instruction sequence to load current RVMThread object from a location defined by [base]+offset
static void emitMoveFieldToReg(Assembler asm, RegisterConstants.GPR dest, Offset offset)
          Emit an instruction sequence to move the value of a field in the current thread offset to a register
static void emitMoveImmToField(Assembler asm, Offset offset, int imm)
          Emit an instruction sequence to move an immediate value into a field in the current thread offset
static void emitMoveRegToField(Assembler asm, Offset offset, RegisterConstants.GPR reg)
          Emit an instruction sequence to move the value of a register into a field in the current thread offset
static void emitPopField(Assembler asm, Offset offset)
          Emit an instruction sequence to POP a value into a field in the current thread offset
static void emitPopThread(Assembler asm)
          Emit an instruction sequence to POP a value on the stack, and set the current thread reference to be this value.
static void emitPushField(Assembler asm, Offset offset)
          Emit an instruction sequence to PUSH the value of a field in the current thread offset
static void emitPushThread(Assembler asm)
          Emit an instruction sequence to PUSH a pointer to the current RVMThread object on the stack.
static void emitStoreThread(Assembler asm, RegisterConstants.GPR base, Offset offset)
          Emit an instruction sequence to store a pointer to the current RVMThread object at a location defined by [base]+offset
static RVMThread getCurrentThread()
          Return the current RVMThread object
static void setCurrentThread(RVMThread p)
          Set the current RVMThread object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THREAD_REGISTER

protected static final RegisterConstants.GPR THREAD_REGISTER
Constructor Detail

ThreadLocalState

public ThreadLocalState()
Method Detail

boot

public static void boot()
The C bootstrap program has placed a pointer to the initial RVMThread in ESI.


getCurrentThread

public static RVMThread getCurrentThread()
Return the current RVMThread object


setCurrentThread

public static void setCurrentThread(RVMThread p)
Set the current RVMThread object


emitMoveRegToField

public static void emitMoveRegToField(Assembler asm,
                                      Offset offset,
                                      RegisterConstants.GPR reg)
Emit an instruction sequence to move the value of a register into a field in the current thread offset

Parameters:
asm - assembler object
offset - of field in the RVMThread object
reg - number of the register supplying the new value

emitMoveImmToField

public static void emitMoveImmToField(Assembler asm,
                                      Offset offset,
                                      int imm)
Emit an instruction sequence to move an immediate value into a field in the current thread offset

Parameters:
asm - assembler object
offset - of field in the RVMThread object
imm - immediate value

emitMoveFieldToReg

public static void emitMoveFieldToReg(Assembler asm,
                                      RegisterConstants.GPR dest,
                                      Offset offset)
Emit an instruction sequence to move the value of a field in the current thread offset to a register

Parameters:
asm - assembler object
dest - number of destination register
offset - of field in the RVMThread object

emitCompareFieldWithImm

public static void emitCompareFieldWithImm(Assembler asm,
                                           Offset offset,
                                           int imm)
Emit an instruction sequence to compare the value of a field in the current thread offset with an immediate value

Parameters:
asm - assembler object
offset - of field in the RVMThread object
imm - immediate value to compare with

emitCompareAndExchangeField

public static void emitCompareAndExchangeField(Assembler asm,
                                               Offset offset,
                                               RegisterConstants.GPR srcReg)
Emit an instruction sequence to to an atomic compare and exchange on a field in the current thread offset with an immediate value. Assumes EAX (T0) contains old value.

Parameters:
asm - assembler object
offset - of field in the RVMThread object
srcReg - register containing value to exchange

emitDecrementField

public static void emitDecrementField(Assembler asm,
                                      Offset offset)
Emit an instruction sequence to decrement the value of a field in the current thread offset

Parameters:
asm - assembler object
offset - of field in the RVMThread object

emitPushField

public static void emitPushField(Assembler asm,
                                 Offset offset)
Emit an instruction sequence to PUSH the value of a field in the current thread offset

Parameters:
asm - assembler object
offset - of field in the RVMThread object

emitPopField

public static void emitPopField(Assembler asm,
                                Offset offset)
Emit an instruction sequence to POP a value into a field in the current thread offset

Parameters:
asm - assembler object
offset - of field in the RVMThread object

emitPushThread

public static void emitPushThread(Assembler asm)
Emit an instruction sequence to PUSH a pointer to the current RVMThread object on the stack.

Parameters:
asm - assembler object

emitPopThread

public static void emitPopThread(Assembler asm)
Emit an instruction sequence to POP a value on the stack, and set the current thread reference to be this value.

Parameters:
asm - assembler object

emitStoreThread

public static void emitStoreThread(Assembler asm,
                                   RegisterConstants.GPR base,
                                   Offset offset)
Emit an instruction sequence to store a pointer to the current RVMThread object at a location defined by [base]+offset

Parameters:
asm - assembler object
base - number of base register
offset - offset

emitLoadThread

public static void emitLoadThread(Assembler asm,
                                  RegisterConstants.GPR base,
                                  Offset offset)
Emit an instruction sequence to load current RVMThread object from a location defined by [base]+offset

Parameters:
asm - assembler object
base - number of base register
offset - offset