|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.elang.smallcaps.SmallcapsEncoder
Untamed: A code generator that just emits Smallcaps instructions directly.
Field Summary | |
private byte[] |
myBuf
Encoded bytes in reverse order. |
private int |
myCodeSize
|
private int |
myMaxHandlers
|
private int |
myMaxOperands
|
private int |
myNumHandlers
|
private int |
myNumOperands
|
Fields inherited from interface org.erights.e.elang.smallcaps.SmallcapsOps |
ADDR_FRAME, ADDR_FRAME_SLOT, ADDR_LITERAL, ADDR_LOCAL, ADDR_LOCAL_SLOT, ADDR_OUTER_SLOT, OP_ASSIGN, OP_BIND, OP_BIND_SLOT, OP_BRANCH, OP_CALL, OP_CALL_ONLY, OP_CDR_PATT, OP_CHAR, OP_DUP, OP_EJECTOR, OP_EJECTOR_ONLY, OP_END_HANDLER, OP_FALSE, OP_FLOAT64, OP_JUMP, OP_LIST_PATT, OP_NEG_INT, OP_NOUN, OP_NULL, OP_OBJECT, OP_POP, OP_RETURN, OP_ROT, OP_SCOPE, OP_SEND, OP_SEND_ONLY, OP_SLOT, OP_STRING, OP_SWAP, OP_TRUE, OP_TRY, OP_TWINE, OP_UNWIND, OP_WHOLE_NUM |
Constructor Summary | |
(package private) |
SmallcapsEncoder()
|
Method Summary | |
void |
associateSourceLocation(int lowLabel,
int highLabel,
SourceSpan span)
Enabled: |
(package private) byte[] |
copyBytes()
|
void |
emitAssign(int addressingMode,
int index)
Enabled: |
void |
emitBind(int addressingMode,
int index,
boolean slot)
Enabled: |
void |
emitBranch()
Enabled: |
void |
emitCall(String verb,
int arity,
boolean only)
Enabled: |
void |
emitCdrPatt(int n)
Enabled: |
void |
emitChar(char chr)
Enabled: |
void |
emitContourTop()
Enabled: |
void |
emitDup()
Enabled: |
void |
emitEjector(int label)
Enabled: |
void |
emitEjectorOnly(int label)
Enabled: |
void |
emitEndHandler()
Enabled: |
void |
emitFalse()
Enabled: |
void |
emitFloat64(double float64)
Enabled: |
void |
emitInteger(BigInteger num)
Enabled: |
private void |
emitInvoke(int opcode,
String verb,
int arity,
int pushed)
|
void |
emitJump(int label)
Enabled: |
void |
emitListPatt(int n)
Enabled: |
void |
emitLiteral(Object obj)
Enabled: |
void |
emitNoun(int addressingMode,
int index,
boolean slot)
Enabled: |
void |
emitNull()
Enabled: |
void |
emitObject(String docComment,
String optFQN,
EExpr[] auditors,
EScript eScript)
Enabled: |
void |
emitPop()
Enabled: |
void |
emitRot()
Enabled: |
void |
emitScope()
Enabled: |
void |
emitSend(String verb,
int arity,
boolean only)
Enabled: |
void |
emitString(String str)
Enabled: |
void |
emitSwap()
Enabled: |
void |
emitTrue()
Enabled: |
void |
emitTry(int label)
Enabled: |
void |
emitUnwind(int label)
Enabled: |
int |
getLabel()
Enabled: Return a value representing the current position in the code buffer. |
(package private) static int |
numDocBytes(BigInteger wholeNum)
How many bytes are needed to represent the whole number wholeNum in Waterken Doc ExtensionNumber format? |
private void |
writeByte(int byt)
|
(package private) void |
writeBytes(byte[] bytes)
|
(package private) void |
writeChar(char c)
Writes out a unicode character as a high-order byte followed by a low order byte. |
(package private) void |
writeFloat64(double float64)
Writes out a float64 as 8 bytes according to Double.doubleToLongBits(double) , written out most significant byte
first. |
(package private) void |
writeOpcode(int opcode,
int deltaOperands,
int deltaHandlers)
|
(package private) void |
writeUTF(String str)
Writes out a String of Unicode characters in UTF-8. |
(package private) void |
writeWholeNum(BigInteger wholeNum)
Encodes a whole number (a non-negative integer) using the Waterken Doc ExtensionNumber format, written using just enough bytes. |
(package private) void |
writeWholeNum(BigInteger wholeNum,
int numBytes)
Encodes a whole number (a non-negative integer) using the Waterken Doc ExtensionNumber format, zero-extended to fit into numBytes bytes. |
(package private) void |
writeWholeNum(int wholeNum)
Just like writeWholeNum(BigInteger) , but when the argument
already fits in a Java int. |
(package private) void |
writeWholeNum(int wholeNum,
int numBytes)
Just like writeWholeNum(BigInteger, int) , but when the
argument already fits in a Java int. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private byte[] myBuf
private int myCodeSize
private int myNumOperands
private int myMaxOperands
private int myNumHandlers
private int myMaxHandlers
Constructor Detail |
SmallcapsEncoder()
Method Detail |
public void associateSourceLocation(int lowLabel, int highLabel, SourceSpan span)
associateSourceLocation
in interface SmallcapsEmitter
public int getLabel()
getLabel
in interface SmallcapsEmitter
public void emitContourTop()
emitContourTop
in interface SmallcapsEmitter
public void emitDup()
emitDup
in interface SmallcapsEmitter
public void emitPop()
emitPop
in interface SmallcapsEmitter
public void emitSwap()
emitSwap
in interface SmallcapsEmitter
public void emitRot()
emitRot
in interface SmallcapsEmitter
public void emitJump(int label)
emitJump
in interface SmallcapsEmitter
public void emitBranch()
emitBranch
in interface SmallcapsEmitter
public void emitCall(String verb, int arity, boolean only)
emitCall
in interface SmallcapsEmitter
public void emitSend(String verb, int arity, boolean only)
emitSend
in interface SmallcapsEmitter
private void emitInvoke(int opcode, String verb, int arity, int pushed)
public void emitEjectorOnly(int label)
emitEjectorOnly
in interface SmallcapsEmitter
public void emitEjector(int label)
emitEjector
in interface SmallcapsEmitter
public void emitTry(int label)
emitTry
in interface SmallcapsEmitter
public void emitUnwind(int label)
emitUnwind
in interface SmallcapsEmitter
public void emitEndHandler()
emitEndHandler
in interface SmallcapsEmitter
public void emitInteger(BigInteger num)
emitInteger
in interface SmallcapsEmitter
public void emitFloat64(double float64)
emitFloat64
in interface SmallcapsEmitter
public void emitChar(char chr)
emitChar
in interface SmallcapsEmitter
public void emitString(String str)
emitString
in interface SmallcapsEmitter
public void emitTrue()
emitTrue
in interface SmallcapsEmitter
public void emitFalse()
emitFalse
in interface SmallcapsEmitter
public void emitNull()
emitNull
in interface SmallcapsEmitter
public void emitLiteral(Object obj)
emitLiteral
in interface SmallcapsEmitter
public void emitScope()
emitScope
in interface SmallcapsEmitter
public void emitObject(String docComment, String optFQN, EExpr[] auditors, EScript eScript)
emitObject
in interface SmallcapsEmitter
public void emitListPatt(int n)
emitListPatt
in interface SmallcapsEmitter
public void emitCdrPatt(int n)
emitCdrPatt
in interface SmallcapsEmitter
public void emitNoun(int addressingMode, int index, boolean slot)
emitNoun
in interface SmallcapsEmitter
public void emitAssign(int addressingMode, int index)
emitAssign
in interface SmallcapsEmitter
public void emitBind(int addressingMode, int index, boolean slot)
emitBind
in interface SmallcapsEmitter
byte[] copyBytes()
private void writeByte(int byt)
void writeOpcode(int opcode, int deltaOperands, int deltaHandlers)
void writeBytes(byte[] bytes)
static int numDocBytes(BigInteger wholeNum)
void writeWholeNum(BigInteger wholeNum)
void writeWholeNum(BigInteger wholeNum, int numBytes)
numBytes must be large enough, and therefore must be >= 1 even if wholeNum == 0. By "zero extended", we mean extended with leading 0x80 bytes, in keeping with the ExtensionNumber format.
void writeWholeNum(int wholeNum)
writeWholeNum(BigInteger)
, but when the argument
already fits in a Java int.
void writeWholeNum(int wholeNum, int numBytes)
writeWholeNum(BigInteger, int)
, but when the
argument already fits in a Java int.
void writeUTF(String str)
void writeChar(char c)
void writeFloat64(double float64)
Double.doubleToLongBits(double)
, written out most significant byte
first.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |