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

Commit c74db79

Browse files
Mike KleinSkia Commit-Bot
authored andcommitted
remove Assembler::here()
It's just a shortcut for Assembler::Label l; a->label(&l); and it never really took off. It's easier to work on Label without it. Change-Id: I4a060f78f235ac3fcc87b996f5d9404ffba43c53 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288997 Commit-Queue: Mike Klein <[email protected]> Commit-Queue: Herb Derby <[email protected]> Auto-Submit: Mike Klein <[email protected]> Reviewed-by: Herb Derby <[email protected]>
1 parent ef04154 commit c74db79

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/core/SkVM.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,26 +1797,24 @@ namespace skvm {
17971797
void Assembler::vcvtps2dq (Ymm dst, Operand x) { this->op(0x66,0x0f,0x5b, dst,x); }
17981798
void Assembler::vsqrtps (Ymm dst, Operand x) { this->op( 0,0x0f,0x51, dst,x); }
17991799

1800-
Assembler::Label Assembler::here() {
1801-
return { (int)this->size(), Label::NotYetSet, {} };
1802-
}
1803-
18041800
int Assembler::disp19(Label* l) {
18051801
SkASSERT(l->kind == Label::NotYetSet ||
18061802
l->kind == Label::ARMDisp19);
1803+
int here = (int)this->size();
18071804
l->kind = Label::ARMDisp19;
1808-
l->references.push_back(here().offset);
1805+
l->references.push_back(here);
18091806
// ARM 19-bit instruction count, from the beginning of this instruction.
1810-
return (l->offset - here().offset) / 4;
1807+
return (l->offset - here) / 4;
18111808
}
18121809

18131810
int Assembler::disp32(Label* l) {
18141811
SkASSERT(l->kind == Label::NotYetSet ||
18151812
l->kind == Label::X86Disp32);
1813+
int here = (int)this->size();
18161814
l->kind = Label::X86Disp32;
1817-
l->references.push_back(here().offset);
1815+
l->references.push_back(here);
18181816
// x86 32-bit byte count, from the end of this instruction.
1819-
return l->offset - (here().offset + 4);
1817+
return l->offset - (here + 4);
18201818
}
18211819

18221820
void Assembler::op(int prefix, int map, int opcode, int dst, int x, Operand y, W w, L l) {
@@ -2084,9 +2082,10 @@ namespace skvm {
20842082
void Assembler::label(Label* l) {
20852083
if (fCode) {
20862084
// The instructions all currently point to l->offset.
2087-
// We'll want to add a delta to point them to here().
2088-
int delta = here().offset - l->offset;
2089-
l->offset = here().offset;
2085+
// We'll want to add a delta to point them to here.
2086+
int here = (int)this->size();
2087+
int delta = here - l->offset;
2088+
l->offset = here;
20902089

20912090
if (l->kind == Label::ARMDisp19) {
20922091
for (int ref : l->references) {

src/core/SkVM.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ namespace skvm {
211211
void vgatherdps(Ymm dst, Scale scale, Ymm ix, GP64 base, Ymm mask);
212212

213213

214-
Label here();
215214
void label(Label*);
216215

217216
void jmp(Label*);

tests/SkVMTest.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,8 @@ DEF_TEST(SkVM_Assembler, r) {
12451245
});
12461246

12471247
test_asm(r, [&](A& a) {
1248-
A::Label l = a.here();
1248+
A::Label l;
1249+
a.label(&l);
12491250
a.byte(1);
12501251
a.byte(2);
12511252
a.byte(3);
@@ -1302,7 +1303,8 @@ DEF_TEST(SkVM_Assembler, r) {
13021303
});
13031304

13041305
test_asm(r, [&](A& a) {
1305-
A::Label l = a.here();
1306+
A::Label l;
1307+
a.label(&l);
13061308
a.jne(&l);
13071309
a.jne(&l);
13081310
a.je (&l);
@@ -1771,7 +1773,8 @@ DEF_TEST(SkVM_Assembler, r) {
17711773
a.subs(A::xzr, A::x2, 4); // These are actually the same instruction!
17721774
a.cmp(A::x2, 4);
17731775

1774-
A::Label l = a.here();
1776+
A::Label l;
1777+
a.label(&l);
17751778
a.bne(&l);
17761779
a.bne(&l);
17771780
a.blt(&l);
@@ -1822,11 +1825,13 @@ DEF_TEST(SkVM_Assembler, r) {
18221825
// can we redefine it to be a future label?
18231826
// (Not sure this is useful... just want to test it works.)
18241827
test_asm(r, [&](A& a) {
1825-
A::Label l1 = a.here();
1828+
A::Label l1;
1829+
a.label(&l1);
18261830
a.add(A::x3, A::x2, 32);
18271831
a.cbz(A::x2, &l1); // This will jump backward... nothing sneaky.
18281832

1829-
A::Label l2 = a.here(); // Start off the same...
1833+
A::Label l2; // Start off the same...
1834+
a.label(&l2);
18301835
a.add(A::x3, A::x2, 32);
18311836
a.cbz(A::x2, &l2); // Looks like this will go backward...
18321837
a.add(A::x2, A::x2, 4);

0 commit comments

Comments
 (0)