don't allocate an interpreter register for stores
Instructions only need a register if they've got an output.
This more closely mirrors what the JIT does.
Change-Id: I9cddba124a90c3afa698d82b1bb89808a7abd3c6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253762
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkVM.cpp b/src/core/SkVM.cpp
index 22abda0..fc17abe 100644
--- a/src/core/SkVM.cpp
+++ b/src/core/SkVM.cpp
@@ -1543,12 +1543,15 @@
if (inst.y != inst.x ) { maybe_recycle_register(inst.y); }
if (inst.z != inst.x && inst.z != inst.y) { maybe_recycle_register(inst.z); }
- // Allocate a register if we have to, preferring to reuse anything available.
- if (avail.empty()) {
- reg[id] = fRegs++;
- } else {
- reg[id] = avail.back();
- avail.pop_back();
+ // Instructions that die at themselves (stores) don't need a register.
+ if (inst.death != id) {
+ // Allocate a register if we have to, preferring to reuse anything available.
+ if (avail.empty()) {
+ reg[id] = fRegs++;
+ } else {
+ reg[id] = avail.back();
+ avail.pop_back();
+ }
}
};