mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
op: introduce CallOp
We'd like to improve the API of Flex, Stack and similar layouts that use MacroOps internall. Unfortunately, the func (m MacroOp) Add(o *Ops) method causes the MacroOp to be allocated on the heap, ruining the nice garbage-free property of layouts. Fortunately, layouts don't need the feature that caused the heap allocation: invoking operation lists different than the current. CallOp separates the invoke-different-list semantic from MacroOp, in preparation for removing the feature from MacroOp. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -26,6 +26,7 @@ const (
|
||||
TypeAux
|
||||
TypeClip
|
||||
TypeProfile
|
||||
TypeCall
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -47,6 +48,7 @@ const (
|
||||
TypeAuxLen = 1
|
||||
TypeClipLen = 1 + 4*4
|
||||
TypeProfileLen = 1
|
||||
TypeCallLen = 1
|
||||
)
|
||||
|
||||
func (t OpType) Size() int {
|
||||
@@ -69,12 +71,13 @@ func (t OpType) Size() int {
|
||||
TypeAuxLen,
|
||||
TypeClipLen,
|
||||
TypeProfileLen,
|
||||
TypeCallLen,
|
||||
}[t-firstOpIndex]
|
||||
}
|
||||
|
||||
func (t OpType) NumRefs() int {
|
||||
switch t {
|
||||
case TypeMacro, TypeKeyInput, TypePointerInput, TypeProfile:
|
||||
case TypeMacro, TypeKeyInput, TypePointerInput, TypeProfile, TypeCall:
|
||||
return 1
|
||||
case TypeImage:
|
||||
return 2
|
||||
|
||||
Reference in New Issue
Block a user