Optimised T0 generated code: when possible (at most 256 words), word calls are encoded over one byte, even in the 128..255 range.
This commit is contained in:
parent
e61ad42191
commit
fb7052216d
8 changed files with 114 additions and 20 deletions
|
|
@ -30,7 +30,7 @@ abstract class CodeElement {
|
|||
|
||||
internal int LastLength { get; set; }
|
||||
|
||||
internal abstract int Length { get; }
|
||||
// internal abstract int Length { get; }
|
||||
|
||||
internal CodeElement()
|
||||
{
|
||||
|
|
@ -42,7 +42,19 @@ abstract class CodeElement {
|
|||
throw new Exception("Code element accepts no target");
|
||||
}
|
||||
|
||||
internal abstract int Encode(BlobWriter bw);
|
||||
internal abstract int GetLength(bool oneByteCode);
|
||||
|
||||
internal abstract int Encode(BlobWriter bw, bool oneByteCode);
|
||||
|
||||
internal static int EncodeOneByte(uint val, BlobWriter bw)
|
||||
{
|
||||
if (val > 255) {
|
||||
throw new Exception(string.Format(
|
||||
"Cannot encode '{0}' over one byte", val));
|
||||
}
|
||||
bw.Append((byte)val);
|
||||
return 1;
|
||||
}
|
||||
|
||||
internal static int Encode7EUnsigned(uint val, BlobWriter bw)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue