byte code instructions can fit in a byte
This isn't particularly important. It just struck me that if we're
going to be byte-thrifty, might as well go all the way.
Change-Id: I4d137731ac06643c50e6bc66cc4654abad732cea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/310325
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 36db364..760e870 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -420,7 +420,7 @@
default:
#if 0
fn.disassemble();
- SkDebugf("inst %04x unimplemented\n", inst);
+ SkDebugf("inst %02x unimplemented\n", inst);
__builtin_debugtrap();
#endif
return {};
diff --git a/src/sksl/SkSLByteCode.cpp b/src/sksl/SkSLByteCode.cpp
index d16d2bb..04bd452 100644
--- a/src/sksl/SkSLByteCode.cpp
+++ b/src/sksl/SkSLByteCode.cpp
@@ -47,7 +47,7 @@
static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
auto inst = READ_INST();
- printf("%04x ", (int)inst);
+ printf("%02x ", (int)inst);
switch (inst) {
DISASSEMBLE_COUNT(kAddF, "addf")
DISASSEMBLE_COUNT(kAddI, "addi")
diff --git a/src/sksl/SkSLByteCode.h b/src/sksl/SkSLByteCode.h
index 2540f7a..030a3b9 100644
--- a/src/sksl/SkSLByteCode.h
+++ b/src/sksl/SkSLByteCode.h
@@ -19,7 +19,7 @@
class ExternalValue;
struct FunctionDeclaration;
-enum class ByteCodeInstruction : uint16_t {
+enum class ByteCodeInstruction : uint8_t {
// B = bool, F = float, I = int, S = signed, U = unsigned
kAddF, // N
diff --git a/src/sksl/SkSLByteCodeGenerator.cpp b/src/sksl/SkSLByteCodeGenerator.cpp
index 9f6148c..e46cca9 100644
--- a/src/sksl/SkSLByteCodeGenerator.cpp
+++ b/src/sksl/SkSLByteCodeGenerator.cpp
@@ -633,7 +633,7 @@
case ByteCodeInstruction::kMaskBlend: this->exitCondition(); break;
default: /* Do nothing */ break;
}
- this->write16((uint16_t)i);
+ this->write8((uint8_t)i);
fStackCount += StackUsage(i, count);
fMaxStackCount = std::max(fMaxStackCount, fStackCount);