BUILD_SLICE (BINARY|STORE)_SUBSCR superinstructions. #319
Replies: 4 comments
-
I gave this a go late last year (albeit without the instruction reordering proposed here for augmented subscription), and wasn't able to get a speedup, even after specializing for many different flavors of The main "issues" I ran into are that:
|
Beta Was this translation helpful? Give feedback.
-
I'd like to resurrect this in light of the latest stats. Creating a slice might not be that expensive, but it isn't free and it obscures the underlying operation.
Super instructions won't help with the unboxing, but keeps the ints on the stack where other optimizations might be able to. While it might be tricky to handle |
Beta Was this translation helpful? Give feedback.
-
I think it might be worthwhile to store a pointer to a function for extracting slices. Something like the old The VM can handle bounds correction, provided we only specialize for simple sequences where Example:
We want to specialize for the shape of the slice, not the class of the sequence. We might also want to specialize for const indexes, as they are quite common.
|
Beta Was this translation helpful? Give feedback.
-
These pairs are relatively rare, but it might be worth combining them for a couple reasons:
BINARY_SUBSCR
andSTORE_SUBSCR
to be better specialized as we don't need to worry about slicesIf we do add these superinstructions, then the compiler will need to changed for augmented assignment.
compiles to:
We will want to replace the
BUILD_SLICE; COPY 2; COPY 2; BINARY_SUBSCR
with
COPY 3; COPY 3; COPY 3; BUILD_SLICE; BINARY_SUBSCR
and the subsequent
SWAP 3; SWAP 2; STORE_SUBSCR
with
SWAP 4; SWAP 3; SWAP 2; BUILD_SLICE; STORE_SUBSCR
allowing both
BUILD_SLICE
s to be combined.Beta Was this translation helpful? Give feedback.
All reactions