M lib/scopes/compiler/libscopes.sc +2 -2
@@ 348,7 348,7 @@ struct Context
op := 'instructionof& self.builder up-proc up-sub
(countof op.operands) - 1
upattrid := 'instruction self.builder procid
- Module.Operation.UPVAL
+ Module.Operation.UPATTR
'wrap Module.Id.IndexAttr idx
'tag self procid aid upattrid
level := level + 1
@@ 367,7 367,7 @@ struct Context
op := 'instructionof& self.builder up-proc up-sub
(countof op.operands) - 1
upattrid := 'instruction self.builder procid
- Module.Operation.UPVAL
+ Module.Operation.UPATTR
'wrap Module.Id.IndexAttr idx
'tag self procid aid upattrid
do
M lib/scopes/compiler/noir/effects.sc +5 -5
@@ 57,7 57,11 @@ EFFECT_DESC := sugar-quote
# apply function-like object to arguments
APPLY f ...
# access nth parameter bound to parents `CLOSURE`
- UPVAL index
+ UPATTR index
+ # unsized argument mapped to macro parameter `index`
+ INATTR index
+ # arguments mapped to macro parameters `index` and following
+ INATTRS index
# retrieve from a MAP, CLOSURE or procedure a value with the provided
name (must be Const); instruction is translated to `ALIAS <result>`.
for closures, the retrieved value must not be an instruction.
@@ 104,12 108,8 @@ EFFECT_DESC := sugar-quote
# is defined void when `a` and `b` are the same id, otherwise undefined.
both arguments must not be meta-instructions.
SAME a b
- # unsized argument mapped to macro parameter `index`
- INATTR index
# convert constant to index attribute
INDEXATTR value
- # arguments mapped to macro parameters `index` and following
- INATTRS index
# produce the number of arguments in VA `args`. if `args`
is not a VA, it is treated as a list with one element.
COUNTOF args
M lib/scopes/compiler/noir/rules-reducer.sx +10 -10
@@ 276,7 276,7 @@ FUNC-MACRO-instance
ARG $instance $id 1 $sz
FUNC $funcid _ $instance
CLOSURE-inline-global
- # inline constant upvals into macro;
+ # inline constant upattrs into macro;
we assume that each closure is uniquely used, saving the instance
;
OP $ctx $id CLOSURE
@@ 286,7 286,7 @@ CLOSURE-inline-global
RULE () ((VACOUNT 0 0) (VACOUNT 1 0) (VACOUNT 2 0))
RULE
;
- OP $macro $mid UPVAL
+ OP $macro $mid UPATTR
ARG $macro $mid 0 $i_
ADD $i $i_ 1
ARG $ctx $id $i $value_
@@ 307,8 307,8 @@ CLOSURE-inline-global
;
ALIAS $macro $mid $value
-CLOSURE-remove-unused-upval
- # remove unused upvals from closure
+CLOSURE-remove-unused-upattr
+ # remove unused upattrs from closure
;
OP $ctx $id CLOSURE
ARG $ctx $id 0 $macro_
@@ 324,7 324,7 @@ CLOSURE-remove-unused-upval
VA 0 $i false
RULE
;
- OP $macro $mid UPVAL
+ OP $macro $mid UPATTR
ARG $macro $mid 0 $i_
ADD $i $i_ 1
LT true $i $original_n
@@ 354,14 354,14 @@ CLOSURE-remove-unused-upval
;
ARG $ctx $id $i $tail
ARGCOUNT $ctx $id $n
- RULE # fix upvals
+ RULE # fix upattrs
;
- OP $macro $mid UPVAL
+ OP $macro $mid UPATTR
ARG $macro $mid 0 $n_
;
ARG $macro $mid 0 $i
CLOSURE-0
- # alias closure with no upvals to macro
+ # alias closure with no upattrs to macro
;
OP $ctx $id CLOSURE
ARGCOUNT $ctx $id $n
@@ 401,7 401,7 @@ APPLY-MACRO
ARG $ctx $id 0 $newid
NDEP $ctx $id _ _
APPLY-CLOSURE-N
- # transform APPLY to closure with upvals into instance with upvals as arguments
+ # transform APPLY to closure with upattrs into instance with upattrs as arguments
;
OP $ctx $id APPLY
ARG $ctx $id 0 $closure_
@@ 425,7 425,7 @@ APPLY-CLOSURE-N
INSTANCE $instance $macro $ctx_id
RULE
;
- OP $instance $inst_id UPVAL
+ OP $instance $inst_id UPATTR
ARG $instance $inst_id 0 $i
ADD $parami $numinattrs $i
;
M lib/scopes/compiler/noir/rules-validator.sx +3 -3
@@ 32,11 32,11 @@ typed-macro-rules
VA 1 _ $target
;
RULE
- # unresolved UPVALs
+ # unresolved upattrs
;
- OP $proc $id UPVAL
+ OP $proc $id UPATTR
;
- COMPLAIN $proc $id "could not inline captured value into closure"
+ COMPLAIN $proc $id "toplevel functions may only capture constants"
RULE
# non-meta effects that do not have a valid size
;