Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 01d0161

Browse files
Mike KleinSkia Commit-Bot
authored andcommitted
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>
1 parent 5778078 commit 01d0161

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/core/SkRuntimeEffect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static skvm::Color program_fn(skvm::Builder* p,
420420
default:
421421
#if 0
422422
fn.disassemble();
423-
SkDebugf("inst %04x unimplemented\n", inst);
423+
SkDebugf("inst %02x unimplemented\n", inst);
424424
__builtin_debugtrap();
425425
#endif
426426
return {};

src/sksl/SkSLByteCode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ using U32 = skvx::Vec<VecWidth, uint32_t>;
4747

4848
static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
4949
auto inst = READ_INST();
50-
printf("%04x ", (int)inst);
50+
printf("%02x ", (int)inst);
5151
switch (inst) {
5252
DISASSEMBLE_COUNT(kAddF, "addf")
5353
DISASSEMBLE_COUNT(kAddI, "addi")

src/sksl/SkSLByteCode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace SkSL {
1919
class ExternalValue;
2020
struct FunctionDeclaration;
2121

22-
enum class ByteCodeInstruction : uint16_t {
22+
enum class ByteCodeInstruction : uint8_t {
2323
// B = bool, F = float, I = int, S = signed, U = unsigned
2424

2525
kAddF, // N

src/sksl/SkSLByteCodeGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ void ByteCodeGenerator::write(ByteCodeInstruction i, int count) {
633633
case ByteCodeInstruction::kMaskBlend: this->exitCondition(); break;
634634
default: /* Do nothing */ break;
635635
}
636-
this->write16((uint16_t)i);
636+
this->write8((uint8_t)i);
637637
fStackCount += StackUsage(i, count);
638638
fMaxStackCount = std::max(fMaxStackCount, fStackCount);
639639

0 commit comments

Comments
 (0)