Skip to content

Instantly share code, notes, and snippets.

@timo
Last active August 29, 2015 14:17
Show Gist options
  • Save timo/2514267f199a91ce1940 to your computer and use it in GitHub Desktop.
Save timo/2514267f199a91ce1940 to your computer and use it in GitHub Desktop.
What's spesh doing wrong with regards to a simple set-array-slots-to-1 benchmark?
diff --git a/set_array_contents_spesh_before_excerpt.txt b/set_array_contents_spesh_excerpt.txt
index 6c7fe99..243f69a 100644
--- a/set_array_contents_spesh_before_excerpt.txt
+++ b/set_array_contents_spesh_excerpt.txt
@@ -1,5 +1,7 @@
-Before:
-Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
+Finished specialization of '<unit>' (cuid: cuid_2_1426600013.59422)
+
+Spesh of '<unit>' (cuid: cuid_2_1426600013.59422, file: -e:1)
+Callsite 0x1234 (0 args, 0 pos)
BB 0 (0x1234):
Instructions:
@@ -10,8 +12,6 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 1 (0x1234):
Instructions:
- checkarity liti16(0), liti16(0)
- paramnamesused
const_i64_16 r0(1), liti16(0)
bindlex lex(idx=0,outers=0,$i), r0(1)
const_s r1(1), lits($_)
@@ -29,7 +29,7 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
Instructions:
decont r5(2), r4(1)
const_s r1(3), lits(ctxsave)
- can_s r7(1), r5(2), r1(3)
+ can r7(1), r5(2), lits(ctxsave)
unless_i r7(1), BB(5)
Successors: 5, 3
Predeccessors: 1
@@ -38,11 +38,11 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 3 (0x1234):
Instructions:
decont r8(1), r4(1)
- findmeth r5(3), r8(1), lits(ctxsave)
+ sp_findmeth r5(3), r8(1), lits(ctxsave), sslot(4)
prepargs <nyi(lit)>
arg_o liti16(0), r4(1)
- [Annotation: INS Deopt All (idx 1 -> pc 132)]
[Annotation: INS Deopt One (idx 0 -> pc 132)]
+ [Annotation: INS Deopt All (idx 1 -> pc 132)]
invoke_o r5(4), r5(3)
Successors: 4
Predeccessors: 2
@@ -57,7 +57,6 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 5 (0x1234):
Instructions:
- PHI r8(2), r8(0), r8(1)
PHI r5(5), r5(2), r5(4)
goto BB(6)
Successors: 6
@@ -66,17 +65,8 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 6 (0x1234):
Instructions:
- PHI r13(1), r13(0), r13(0), r13(0), r13(3)
- PHI r12(1), r12(0), r12(0), r12(0), r12(5)
- PHI r11(1), r11(0), r11(0), r11(0), r11(6)
- PHI r10(1), r10(0), r10(0), r10(0), r10(8)
- PHI r9(1), r9(0), r9(0), r9(0), r9(4)
- PHI r8(3), r8(0), r8(0), r8(2), r8(6)
- PHI r7(2), r7(0), r7(0), r7(1), r7(5)
- PHI r6(2), r6(0), r6(1), r6(1), r6(7)
PHI r5(6), r5(0), r5(1), r5(5), r5(7)
PHI r4(2), r4(0), r4(1), r4(1), r4(3)
- PHI r3(1), r3(0), r3(0), r3(0), r3(3)
PHI r2(2), r2(0), r2(1), r2(1), r2(3)
PHI r1(4), r1(0), r1(2), r1(3), r1(5)
PHI r0(2), r0(0), r0(1), r0(1), r0(3)
@@ -96,54 +86,42 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 7 (0x1234):
Instructions:
- PHI r13(2), r13(0), r13(1)
- PHI r12(2), r12(0), r12(1)
- PHI r11(2), r11(0), r11(1)
- PHI r10(2), r10(0), r10(1)
- PHI r9(2), r9(0), r9(1)
- PHI r8(4), r8(0), r8(3)
PHI r7(5), r7(0), r7(4)
- PHI r6(5), r6(0), r6(4)
PHI r5(7), r5(0), r5(6)
PHI r4(3), r4(0), r4(2)
- PHI r3(2), r3(0), r3(1)
PHI r2(3), r2(0), r2(2)
PHI r1(5), r1(0), r1(4)
PHI r0(3), r0(0), r0(2)
- [Annotation: FH Goto (0)]
- [Annotation: INS Deopt OSR (idx 3 -> pc 184)]
- osrpoint
[Annotation: INS Deopt One (idx 4 -> pc 192)]
+ [Annotation: INS Deopt OSR (idx 3 -> pc 184)]
+ [Annotation: FH Goto (0)]
getlex r8(5), lex(idx=4,outers=0,$_)
set r3(3), r8(5)
- [Annotation: INS Deopt One (idx 5 -> pc 206)]
getlex r9(3), lex(idx=1,outers=0,@a)
+ [Annotation: INS Deopt One (idx 5 -> pc 206)]
+ sp_guardconc r9(3), sslot(2)
set r8(6), r9(3)
[Annotation: INS Deopt One (idx 6 -> pc 220)]
- getlex r10(3), lex(idx=0,outers=0,$i)
- set r6(6), r10(3)
- wval r11(3), liti16(0), liti16(21)
- set r9(4), r11(3)
- decont r12(3), r8(6)
- findmeth r11(4), r12(3), lits(ASSIGN-POS)
- prepargs <nyi(lit)>
- arg_o liti16(0), r8(6)
- arg_i liti16(1), r6(6)
- arg_o liti16(2), r9(4)
+ getlex r6(6), lex(idx=0,outers=0,$i)
+ wval r9(4), liti16(0), liti16(21)
+ set r12(3), r8(6)
+ sp_getspeshslot r11(4), sslot(6)
+ sp_getspeshslot r11(4), sslot(7)
+ set r14(1), r8(6)
+ set r15(1), r6(6)
+ set r16(1), r9(4)
[Annotation: INS Deopt All (idx 8 -> pc 284)]
- [Annotation: INS Deopt One (idx 7 -> pc 284)]
- invoke_o r11(5), r11(4)
- Successors: 8
+ goto BB(13)
+ Successors: 13
Predeccessors: 0, 6
Dominance children: 8
BB 8 (0x1234):
Instructions:
- hllize r11(6), r11(5)
- isconcrete r10(4), r11(6)
- unless_i r10(4), BB(11)
- Successors: 11, 9
- Predeccessors: 7
+ [Annotation: INS Deopt One (idx 7 -> pc 284)]
+ sp_guardconc r11(5), sslot(3)
+ Successors: 9
+ Predeccessors: 13
Dominance children: 9, 11
BB 9 (0x1234):
@@ -156,7 +134,7 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 10 (0x1234):
Instructions:
- findmeth r12(4), r11(6), lits(sink)
+ sp_findmeth r12(4), r11(6), lits(sink), sslot(9)
prepargs <nyi(lit)>
arg_o liti16(0), r11(6)
[Annotation: INS Deopt All (idx 9 -> pc 346)]
@@ -168,7 +146,6 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
BB 11 (0x1234):
Instructions:
PHI r12(5), r12(3), r12(3), r12(4)
- PHI r10(6), r10(4), r10(5), r10(5)
[Annotation: INS Deopt One (idx 10 -> pc 354)]
getlex r6(7), lex(idx=0,outers=0,$i)
const_i64_16 r10(7), liti16(1)
@@ -178,25 +155,12 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
const_i64_16 r13(3), liti16(0)
goto BB(6)
Successors: 6
- Predeccessors: 8, 9, 10
+ Predeccessors: 9, 10
Dominance children:
BB 12 (0x1234):
Instructions:
- PHI r13(4), r13(0), r13(1)
- PHI r12(6), r12(0), r12(1)
- PHI r11(7), r11(0), r11(1)
- PHI r10(9), r10(0), r10(1)
- PHI r9(5), r9(0), r9(1)
- PHI r8(7), r8(0), r8(3)
- PHI r7(6), r7(0), r7(4)
PHI r6(8), r6(0), r6(4)
- PHI r5(8), r5(0), r5(6)
- PHI r4(4), r4(0), r4(2)
- PHI r3(4), r3(0), r3(1)
- PHI r2(4), r2(0), r2(2)
- PHI r1(6), r1(0), r1(4)
- PHI r0(4), r0(0), r0(2)
[Annotation: FH Goto (2)]
[Annotation: FH End (2)]
[Annotation: FH End (1)]
@@ -206,101 +170,133 @@ Spesh of '<unit>' (cuid: cuid_2_1426600094.9543, file: -e:1)
Predeccessors: 0, 6
Dominance children:
+ BB 13 (0x1234):
+ Instructions:
+ [Annotation: Inline Start (0)]
+ takedispatcher r21(1)
+ decont_i r22(1), r16(1)
+ bindpos_i r14(1), r15(1), r22(1)
+ hllboxtype_i r11(5)
+ box_i r11(5), r22(1), r11(5)
+ [Annotation: Inline End (0)]
+ goto BB(8)
+ Successors: 8
+ Predeccessors: 7
+ Dominance children:
+
Facts:
+ r0(0): usages=5, flags=0
+ r0(1): usages=3, flags=2
+ r0(2): usages=1, flags=0 (merged from 4 regs)
+ r0(3): usages=2, flags=0 (merged from 2 regs)
+ r0(4): usages=0, flags=0 (merged from 2 regs)
+ r1(0): usages=5, flags=0
+ r1(1): usages=1, flags=2
+ r1(2): usages=2, flags=2
+ r1(3): usages=1, flags=2
+ r1(4): usages=1, flags=0 (merged from 4 regs)
+ r1(5): usages=2, flags=0 (merged from 2 regs)
+ r1(6): usages=0, flags=0 (merged from 2 regs)
+ r2(0): usages=5, flags=0
+ r2(1): usages=2, flags=0
+ r2(2): usages=1, flags=0 (merged from 4 regs)
+ r2(3): usages=2, flags=0 (merged from 2 regs)
+ r2(4): usages=0, flags=0 (merged from 2 regs)
+ r3(0): usages=5, flags=0
+ r3(1): usages=0, flags=0 (merged from 4 regs)
+ r3(2): usages=0, flags=0 (merged from 2 regs)
+ r3(3): usages=3, flags=425
+ r3(4): usages=0, flags=0 (merged from 2 regs)
+ r4(0): usages=5, flags=0
+ r4(1): usages=6, flags=0
+ r4(2): usages=1, flags=0 (merged from 4 regs)
+ r4(3): usages=2, flags=0 (merged from 2 regs)
+ r4(4): usages=0, flags=0 (merged from 2 regs)
+ r5(0): usages=5, flags=0
+ r5(1): usages=2, flags=0
+ r5(2): usages=2, flags=4
+ r5(3): usages=2, flags=0
+ r5(4): usages=4, flags=0
+ r5(5): usages=1, flags=0 (merged from 2 regs)
+ r5(6): usages=1, flags=0 (merged from 4 regs)
+ r5(7): usages=2, flags=0 (merged from 2 regs)
+ r5(8): usages=0, flags=0 (merged from 2 regs)
+ r6(0): usages=4, flags=0
+ r6(1): usages=1, flags=0
+ r6(2): usages=0, flags=0 (merged from 4 regs)
+ r6(3): usages=1, flags=0
+ r6(4): usages=3, flags=0
+ r6(5): usages=0, flags=0 (merged from 2 regs)
+ r6(6): usages=1, flags=0
+ r6(7): usages=2, flags=0
+ r6(8): usages=1, flags=0 (merged from 2 regs)
+ r7(0): usages=5, flags=0
+ r7(1): usages=1, flags=0
+ r7(2): usages=0, flags=0 (merged from 4 regs)
+ r7(3): usages=1, flags=2
+ r7(4): usages=5, flags=0
+ r7(5): usages=1, flags=0 (merged from 2 regs)
+ r7(6): usages=0, flags=0 (merged from 2 regs)
+ r8(0): usages=5, flags=0
+ r8(1): usages=1, flags=4
+ r8(2): usages=0, flags=0 (merged from 2 regs)
+ r8(3): usages=0, flags=0 (merged from 4 regs)
+ r8(4): usages=0, flags=0 (merged from 2 regs)
+ r8(5): usages=4, flags=425
+ r8(6): usages=5, flags=269
+ r8(7): usages=0, flags=0 (merged from 2 regs)
+ r9(0): usages=5, flags=0
+ r9(1): usages=0, flags=0 (merged from 4 regs)
+ r9(2): usages=0, flags=0 (merged from 2 regs)
+ r9(3): usages=4, flags=269
+ r9(4): usages=2, flags=15
+ r9(5): usages=0, flags=0 (merged from 2 regs)
+ r10(0): usages=5, flags=0
+ r10(1): usages=0, flags=0 (merged from 4 regs)
+ r10(2): usages=0, flags=0 (merged from 2 regs)
r10(3): usages=0, flags=0
+ r10(4): usages=0, flags=2
+ r10(5): usages=1, flags=0
+ r10(6): usages=0, flags=0 (merged from 3 regs)
+ r10(7): usages=1, flags=2
+ r10(8): usages=2, flags=0
+ r10(9): usages=0, flags=0 (merged from 2 regs)
+ r11(0): usages=5, flags=0
+ r11(1): usages=0, flags=0 (merged from 4 regs)
+ r11(2): usages=0, flags=0 (merged from 2 regs)
+ r11(3): usages=0, flags=15
+ r11(4): usages=2, flags=2
+ r11(5): usages=4, flags=269
+ r11(6): usages=4, flags=269
+ r11(7): usages=0, flags=0 (merged from 2 regs)
+ r12(0): usages=5, flags=0
+ r12(1): usages=0, flags=0 (merged from 4 regs)
+ r12(2): usages=0, flags=0 (merged from 2 regs)
+ r12(3): usages=4, flags=269
+ r12(4): usages=3, flags=0
+ r12(5): usages=1, flags=0 (merged from 3 regs)
+ r12(6): usages=0, flags=0 (merged from 2 regs)
+ r13(0): usages=5, flags=0
+ r13(1): usages=0, flags=0 (merged from 4 regs)
+ r13(2): usages=0, flags=0 (merged from 2 regs)
+ r13(3): usages=1, flags=2
+ r13(4): usages=0, flags=0 (merged from 2 regs)
+ r14(0): usages=0, flags=0
+ r14(1): usages=2, flags=269
+ r15(0): usages=0, flags=0
+ r15(1): usages=2, flags=0
+ r16(0): usages=0, flags=0
+ r16(1): usages=2, flags=15
+ r17(0): usages=0, flags=0
+ r18(0): usages=0, flags=0
+ r19(0): usages=0, flags=0
+ r20(0): usages=0, flags=0
+ r21(0): usages=0, flags=0
+ r21(1): usages=0, flags=0
+ r22(0): usages=0, flags=0
+ r22(1): usages=2, flags=0
+ r23(0): usages=0, flags=0
+ r24(0): usages=0, flags=0
+ r25(0): usages=0, flags=0
+ r26(0): usages=0, flags=0
Finished specialization of '<unit>' (cuid: cuid_2_1426600013.59422)
Spesh of '<unit>' (cuid: cuid_2_1426600013.59422, file: -e:1)
Callsite 0x7fb74e37e860 (0 args, 0 pos)
BB 0 (0x577f700):
Instructions:
no_op
Successors: 1, 7, 6, 12
Predeccessors:
Dominance children: 1, 6, 7, 12
BB 1 (0x577f778):
Instructions:
const_i64_16 r0(1), liti16(0)
bindlex lex(idx=0,outers=0,$i), r0(1)
const_s r1(1), lits($_)
getlexouter r2(1), r1(1)
const_s r1(2), lits($*CTXSAVE)
getdynlex r5(1), r1(2)
set r4(1), r5(1)
isnull r6(1), r4(1)
if_i r6(1), BB(6)
Successors: 6, 2
Predeccessors: 0
Dominance children: 2
BB 2 (0x577f7c8):
Instructions:
decont r5(2), r4(1)
const_s r1(3), lits(ctxsave)
can r7(1), r5(2), lits(ctxsave)
unless_i r7(1), BB(5)
Successors: 5, 3
Predeccessors: 1
Dominance children: 3, 5
BB 3 (0x577f818):
Instructions:
decont r8(1), r4(1)
sp_findmeth r5(3), r8(1), lits(ctxsave), sslot(4)
prepargs <nyi(lit)>
arg_o liti16(0), r4(1)
[Annotation: INS Deopt One (idx 0 -> pc 132)]
[Annotation: INS Deopt All (idx 1 -> pc 132)]
invoke_o r5(4), r5(3)
Successors: 4
Predeccessors: 2
Dominance children: 4
BB 4 (0x577f868):
Instructions:
goto BB(5)
Successors: 5
Predeccessors: 3
Dominance children:
BB 5 (0x577f8b8):
Instructions:
PHI r5(5), r5(2), r5(4)
goto BB(6)
Successors: 6
Predeccessors: 2, 4
Dominance children:
BB 6 (0x577f908):
Instructions:
PHI r5(6), r5(0), r5(1), r5(5), r5(7)
PHI r4(2), r4(0), r4(1), r4(1), r4(3)
PHI r2(2), r2(0), r2(1), r2(1), r2(3)
PHI r1(4), r1(0), r1(2), r1(3), r1(5)
PHI r0(2), r0(0), r0(1), r0(1), r0(3)
[Annotation: FH Start (2)]
[Annotation: FH Goto (1)]
[Annotation: FH Start (1)]
[Annotation: FH Start (0)]
[Annotation: INS Deopt One (idx 2 -> pc 152)]
getlex r6(3), lex(idx=0,outers=0,$i)
const_i64_32 r7(3), liti32(10000000)
lt_i r7(4), r6(3), r7(3)
set r6(4), r7(4)
unless_i r7(4), BB(12)
Successors: 12, 7
Predeccessors: 0, 1, 5, 11
Dominance children:
BB 7 (0x577f958):
Instructions:
PHI r7(5), r7(0), r7(4)
PHI r5(7), r5(0), r5(6)
PHI r4(3), r4(0), r4(2)
PHI r2(3), r2(0), r2(2)
PHI r1(5), r1(0), r1(4)
PHI r0(3), r0(0), r0(2)
[Annotation: INS Deopt One (idx 4 -> pc 192)]
[Annotation: INS Deopt OSR (idx 3 -> pc 184)]
[Annotation: FH Goto (0)]
getlex r8(5), lex(idx=4,outers=0,$_)
set r3(3), r8(5)
getlex r9(3), lex(idx=1,outers=0,@a)
[Annotation: INS Deopt One (idx 5 -> pc 206)]
sp_guardconc r9(3), sslot(2)
set r8(6), r9(3)
[Annotation: INS Deopt One (idx 6 -> pc 220)]
getlex r6(6), lex(idx=0,outers=0,$i)
wval r9(4), liti16(0), liti16(21)
set r12(3), r8(6)
sp_getspeshslot r11(4), sslot(6)
sp_getspeshslot r11(4), sslot(7)
set r14(1), r8(6)
set r15(1), r6(6)
set r16(1), r9(4)
[Annotation: INS Deopt All (idx 8 -> pc 284)]
goto BB(13)
Successors: 13
Predeccessors: 0, 6
Dominance children: 8
BB 8 (0x577f9a8):
Instructions:
[Annotation: INS Deopt One (idx 7 -> pc 284)]
sp_guardconc r11(5), sslot(3)
Successors: 9
Predeccessors: 13
Dominance children: 9, 11
BB 9 (0x577f9f8):
Instructions:
can r10(5), r11(6), lits(sink)
unless_i r10(5), BB(11)
Successors: 11, 10
Predeccessors: 8
Dominance children: 10
BB 10 (0x577fa48):
Instructions:
sp_findmeth r12(4), r11(6), lits(sink), sslot(9)
prepargs <nyi(lit)>
arg_o liti16(0), r11(6)
[Annotation: INS Deopt All (idx 9 -> pc 346)]
invoke_v r12(4)
Successors: 11
Predeccessors: 9
Dominance children:
BB 11 (0x577fa98):
Instructions:
PHI r12(5), r12(3), r12(3), r12(4)
[Annotation: INS Deopt One (idx 10 -> pc 354)]
getlex r6(7), lex(idx=0,outers=0,$i)
const_i64_16 r10(7), liti16(1)
add_i r10(8), r6(7), r10(7)
bindlex lex(idx=0,outers=0,$i), r10(8)
bindlex lex(idx=4,outers=0,$_), r3(3)
const_i64_16 r13(3), liti16(0)
goto BB(6)
Successors: 6
Predeccessors: 9, 10
Dominance children:
BB 12 (0x577fae8):
Instructions:
PHI r6(8), r6(0), r6(4)
[Annotation: FH Goto (2)]
[Annotation: FH End (2)]
[Annotation: FH End (1)]
[Annotation: FH End (0)]
return_i r6(8)
Successors:
Predeccessors: 0, 6
Dominance children:
BB 13 (0x57ce8d8):
Instructions:
[Annotation: Inline Start (0)]
takedispatcher r21(1)
decont_i r22(1), r16(1)
bindpos_i r14(1), r15(1), r22(1)
hllboxtype_i r11(5)
box_i r11(5), r22(1), r11(5)
[Annotation: Inline End (0)]
goto BB(8)
Successors: 8
Predeccessors: 7
Dominance children:
Facts:
r0(0): usages=5, flags=0
r0(1): usages=3, flags=2
r0(2): usages=1, flags=0 (merged from 4 regs)
r0(3): usages=2, flags=0 (merged from 2 regs)
r0(4): usages=0, flags=0 (merged from 2 regs)
r1(0): usages=5, flags=0
r1(1): usages=1, flags=2
r1(2): usages=2, flags=2
r1(3): usages=1, flags=2
r1(4): usages=1, flags=0 (merged from 4 regs)
r1(5): usages=2, flags=0 (merged from 2 regs)
r1(6): usages=0, flags=0 (merged from 2 regs)
r2(0): usages=5, flags=0
r2(1): usages=2, flags=0
r2(2): usages=1, flags=0 (merged from 4 regs)
r2(3): usages=2, flags=0 (merged from 2 regs)
r2(4): usages=0, flags=0 (merged from 2 regs)
r3(0): usages=5, flags=0
r3(1): usages=0, flags=0 (merged from 4 regs)
r3(2): usages=0, flags=0 (merged from 2 regs)
r3(3): usages=3, flags=425
r3(4): usages=0, flags=0 (merged from 2 regs)
r4(0): usages=5, flags=0
r4(1): usages=6, flags=0
r4(2): usages=1, flags=0 (merged from 4 regs)
r4(3): usages=2, flags=0 (merged from 2 regs)
r4(4): usages=0, flags=0 (merged from 2 regs)
r5(0): usages=5, flags=0
r5(1): usages=2, flags=0
r5(2): usages=2, flags=4
r5(3): usages=2, flags=0
r5(4): usages=4, flags=0
r5(5): usages=1, flags=0 (merged from 2 regs)
r5(6): usages=1, flags=0 (merged from 4 regs)
r5(7): usages=2, flags=0 (merged from 2 regs)
r5(8): usages=0, flags=0 (merged from 2 regs)
r6(0): usages=4, flags=0
r6(1): usages=1, flags=0
r6(2): usages=0, flags=0 (merged from 4 regs)
r6(3): usages=1, flags=0
r6(4): usages=3, flags=0
r6(5): usages=0, flags=0 (merged from 2 regs)
r6(6): usages=1, flags=0
r6(7): usages=2, flags=0
r6(8): usages=1, flags=0 (merged from 2 regs)
r7(0): usages=5, flags=0
r7(1): usages=1, flags=0
r7(2): usages=0, flags=0 (merged from 4 regs)
r7(3): usages=1, flags=2
r7(4): usages=5, flags=0
r7(5): usages=1, flags=0 (merged from 2 regs)
r7(6): usages=0, flags=0 (merged from 2 regs)
r8(0): usages=5, flags=0
r8(1): usages=1, flags=4
r8(2): usages=0, flags=0 (merged from 2 regs)
r8(3): usages=0, flags=0 (merged from 4 regs)
r8(4): usages=0, flags=0 (merged from 2 regs)
r8(5): usages=4, flags=425
r8(6): usages=5, flags=269
r8(7): usages=0, flags=0 (merged from 2 regs)
r9(0): usages=5, flags=0
r9(1): usages=0, flags=0 (merged from 4 regs)
r9(2): usages=0, flags=0 (merged from 2 regs)
r9(3): usages=4, flags=269
r9(4): usages=2, flags=15
r9(5): usages=0, flags=0 (merged from 2 regs)
r10(0): usages=5, flags=0
r10(1): usages=0, flags=0 (merged from 4 regs)
r10(2): usages=0, flags=0 (merged from 2 regs)
r10(3): usages=0, flags=0
r10(4): usages=0, flags=2
r10(5): usages=1, flags=0
r10(6): usages=0, flags=0 (merged from 3 regs)
r10(7): usages=1, flags=2
r10(8): usages=2, flags=0
r10(9): usages=0, flags=0 (merged from 2 regs)
r11(0): usages=5, flags=0
r11(1): usages=0, flags=0 (merged from 4 regs)
r11(2): usages=0, flags=0 (merged from 2 regs)
r11(3): usages=0, flags=15
r11(4): usages=2, flags=2
r11(5): usages=4, flags=269
r11(6): usages=4, flags=269
r11(7): usages=0, flags=0 (merged from 2 regs)
r12(0): usages=5, flags=0
r12(1): usages=0, flags=0 (merged from 4 regs)
r12(2): usages=0, flags=0 (merged from 2 regs)
r12(3): usages=4, flags=269
r12(4): usages=3, flags=0
r12(5): usages=1, flags=0 (merged from 3 regs)
r12(6): usages=0, flags=0 (merged from 2 regs)
r13(0): usages=5, flags=0
r13(1): usages=0, flags=0 (merged from 4 regs)
r13(2): usages=0, flags=0 (merged from 2 regs)
r13(3): usages=1, flags=2
r13(4): usages=0, flags=0 (merged from 2 regs)
r14(0): usages=0, flags=0
r14(1): usages=2, flags=269
r15(0): usages=0, flags=0
r15(1): usages=2, flags=0
r16(0): usages=0, flags=0
r16(1): usages=2, flags=15
r17(0): usages=0, flags=0
r18(0): usages=0, flags=0
r19(0): usages=0, flags=0
r20(0): usages=0, flags=0
r21(0): usages=0, flags=0
r21(1): usages=0, flags=0
r22(0): usages=0, flags=0
r22(1): usages=2, flags=0
r23(0): usages=0, flags=0
r24(0): usages=0, flags=0
r25(0): usages=0, flags=0
r26(0): usages=0, flags=0
given this code:
my int @a; my int $i;
while $i < 10000000 { @a[$i] = 1; $i = $i + 1 }
There's a lot of things still not optimal in the post-spesh code.
Here's a little summary:
- lex2loc-related problems (blocking on correct code-gen for access to localref vars)
* @a is kept in a lexical slot
* $i is kept in a lexical slot
* around the loop body, we have code to preserve the contents of $_
- unused things not being eliminated
* over the course of inlining ASSIGN-POS, two spesh slots (6 and 7) are read from into the same register consecutively, but the results are not used anywhere (perhaps after a deopt boundary?)
* in the inline result of ASSIGN-POS, a return value is generated (likely because bindpos_i is defined to return its second argument) as a boxed integer, which then has a ".sink if .can('sink')" generated for it.
* for no apparent reason, r13 is set to const 0 on every iteration ...
- general improvement opportunities
* VMArray doesn't spesh bindpos and atpos into sp_get_* ops yet, which would jit very nicely.
→ scratch that - what makes VMArray great is the movable first element, which means an additional lookup in the object, as well as the potential to shuffle elements around or resize the storage space when space runs out
→ however, the JIT can remove a few layers of indirection from reprops in general by looking up the right function to call from the REPR of an object's potentially known type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment