Class SVM_ASSIGN
SVM-INSTRUCTION: ASSIGN and UPDATE
ASSIGN objadr size
Runtime Stack ..., oaddr(?), offset(?), index(?), value1, value2, ... , value'size → ...
UPDATE objadr size
Runtime Stack ..., oaddr(?), offset(?), index(?), value1, value2, ... , value'size → ..., value1, value2, ... , value'size
First, the values are popped off the Runtime stack and remembered.
Then, if the 'objadr.indexed' flag is set, the 'index' is popped off and added to 'objadr'.
Then Force 'objadr' unstacked. Ie. pop off any stacked part and form the resulting address 'resadr'.
The unstacking of the 'objadr' depend on its address kind:
- REMOTE_ADDR: object address 'oaddr' is popped of the Runtime stack.
resadr := oaddr + objadr.offset
- REFER_ADDR: 'offset' and object address 'oaddr' is popped of the Runtime stack.
resadr := oaddr + objadr.offset + offset
- Otherwise: resadr := objadr
Finally, the remembered values are successively stored in address resadr, resadr+1, ... and upwards
and, if UPDATE operation, the values are pushed back onto the Runtime stack.
Link to GitHub: Source File.
- Author:
- S-Port: Definition of S-code, Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ObjectAddressThe target addressprivate final intThe value sizeprivate final booleantrue:UPDATE, otherwise ASSIGN instructionFields inherited from class SVM_Instruction
iADD, iADDREG, iAND, iASSIGN, iCALL, iCALLSYS, iCOMPARE, iCONVERT, iDECO, iDIST, iDIV, iDUP, iENTER, iEQV, iGETO, iGOTO, iIMP, iINCO, iINITO, iJUMP, iJUMPIF, iLINE, iLOAD, iLOADA, iMax, iMULT, iNEG, iNOOP, iNOT, iOR, iPOPK, iPRECALL, iPUSHC, iPUSHLEN, iPUSHR, iREM, iRESTORE, iRETURN, iSAVE, iSETO, iSHIFT, iSTORE, iSUB, iSWITCH, iXOR, opcode -
Constructor Summary
ConstructorsModifierConstructorDescriptionSVM_ASSIGN(boolean update, ObjectAddress objadr, int size) Construct a new SVM_ASSIGN instructionprivateConstruct an SVM_ASSIGN instruction from the given input. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Execute this SVM instructionstatic SVM_ASSIGNread(AttributeInputStream inpt) Reads an SVM_ASSIGN instruction from the given input.toString()voidwrite(AttributeOutputStream oupt) Write this SVM instruction to the given output.Methods inherited from class SVM_Instruction
edOpcode, readObject
-
Field Details
-
update
private final boolean updatetrue:UPDATE, otherwise ASSIGN instruction -
objadr
The target address -
size
private final int sizeThe value size
-
-
Constructor Details
-
SVM_ASSIGN
Construct a new SVM_ASSIGN instruction- Parameters:
update- true:UPDATE, otherwise ASSIGN instructionobjadr- the target addresssize- the value size
-
SVM_ASSIGN
Construct an SVM_ASSIGN instruction from the given input.- Parameters:
inpt- the input stream- Throws:
IOException- if IOException occur
-
-
Method Details
-
execute
public void execute()Description copied from class:SVM_InstructionExecute this SVM instruction- Overrides:
executein classSVM_Instruction
-
toString
-
write
Description copied from class:SVM_InstructionWrite this SVM instruction to the given output.- Overrides:
writein classSVM_Instruction- Parameters:
oupt- the output stream- Throws:
IOException- if IOException occur
-
read
Reads an SVM_ASSIGN instruction from the given input.- Parameters:
inpt- the input stream- Returns:
- the SVM_ASSIGN instruction read
- Throws:
IOException- if IOException occur
-