•internal.PureKeep
This commit is contained in:
parent
01b1ee3637
commit
a8af920dc9
@ -95,6 +95,7 @@ Namespace of various internal functions. May change at any time.
|
||||
| `•internal.ObjFlags` | Monadically, get the flags of `𝕩`. Dyadically, set the flags of `𝕩` to `𝕨`. |
|
||||
| `•internal.ElType` | Element size type identifier; see `enum ElType` |
|
||||
| `•internal.Keep` | Require the argument to stay alive up to this point in the program. Returns the argument, but without signaling to possible optimizations that the input and output will be equal |
|
||||
| `•internal.PureKeep` | `•internal.Keep` but marked as a pure function |
|
||||
| `•internal.Refc` | Reference count of the argument, if it's heap-allocated |
|
||||
| `•internal.IsPure` | Whether the vm considers the argument pure (i.e. it can execute it safely for computing fills) |
|
||||
| `•internal.Info` | General internal info about the object; a left argument of `1` gives more details |
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
/* sfns.c*/A(shape,"⥊") A(pick,"⊑") A(pair,"⋈") A(select,"⊏") A(slash,"/") A(join,"∾") A(couple,"≍") A(shiftb,"»") \
|
||||
/* sfns.c*/A(shifta,"«") A(take,"↑") A(drop,"↓") A(group,"⊔") A(reverse,"⌽") A(transp,"⍉") \
|
||||
/* sort.c*/A(gradeUp,"⍋") A(gradeDown,"⍒") \
|
||||
/* sysfn.c*/M(iPureKeep,"•internal.PureKeep") \
|
||||
/* everything before the definition of •Type is defined to be pure, and everything after is not */ \
|
||||
/* sysfn.c*/A(invalidFn, "(invalid fn)") A(grLen,"•GroupLen") D(grOrd,"•GroupOrd") A(compObj, "•CompObj") A(fill,"•FillFn") M(sys,"•getsys") M(primInd,"•PrimInd") M(glyph,"•Glyph") \
|
||||
/* sysfn.c*/M(type,"•Type") M(decp,"•Decompose") M(repr,"•Repr") M(parseFloat,"•ParseFloat") M(fmt,"•Fmt") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") \
|
||||
|
||||
@ -380,9 +380,8 @@ B iHasFill_c1(B t, B x) {
|
||||
return m_f64(1);
|
||||
}
|
||||
|
||||
B iKeep_c1(B t, B x) {
|
||||
return x;
|
||||
}
|
||||
B iPureKeep_c1(B t, B x) { return x; }
|
||||
B iKeep_c1(B t, B x) { return x; }
|
||||
|
||||
B unshare_c1(B t, B x) {
|
||||
if (!isArr(x)) thrM("•internal.Unshare: Argument must be an array");
|
||||
@ -405,8 +404,8 @@ B getInternalNS(void) {
|
||||
#undef F
|
||||
|
||||
#define F(X) incG(bi_##X),
|
||||
Body* d = m_nnsDesc("type","eltype","refc","squeeze","ispure","info", "keep","listvariations","variation","clearrefs", "hasfill","unshare","deepsqueeze","heapdump","eequal", "gc", "temp","heapstats", "objflags");
|
||||
internalNS = m_nns(d,F(itype)F(elType)F(refc)F(squeeze)F(isPure)F(info)F(iKeep)F(listVariations)F(variation)F(clearRefs)F(iHasFill)F(unshare)F(deepSqueeze)F(heapDump)F(eequal)F(internalGC)F(internalTemp)F(heapStats)F(iObjFlags));
|
||||
Body* d = m_nnsDesc("type","eltype","refc","squeeze","ispure","info", "keep", "purekeep","listvariations","variation","clearrefs", "hasfill","unshare","deepsqueeze","heapdump","eequal", "gc", "temp","heapstats", "objflags");
|
||||
internalNS = m_nns(d,F(itype)F(elType)F(refc)F(squeeze)F(isPure)F(info)F(iKeep)F(iPureKeep)F(listVariations)F(variation)F(clearRefs)F(iHasFill)F(unshare)F(deepSqueeze)F(heapDump)F(eequal)F(internalGC)F(internalTemp)F(heapStats)F(iObjFlags));
|
||||
#undef F
|
||||
gc_add(internalNS);
|
||||
}
|
||||
|
||||
@ -1967,7 +1967,7 @@ u32* const dsv_text[] = {
|
||||
U"•file.Accessed",U"•file.At",U"•file.Bytes",U"•file.Chars",U"•file.Created",U"•file.CreateDir",U"•file.Exists",U"•file.Lines",U"•file.List",
|
||||
U"•file.MapBytes",U"•file.Modified",U"•file.Name",U"•file.Parent",U"•file.path",U"•file.RealPath",U"•file.Remove",U"•file.Rename",U"•file.Size",U"•file.Type",
|
||||
|
||||
U"•internal.ClearRefs",U"•internal.DeepSqueeze",U"•internal.EEqual",U"•internal.ElType",U"•internal.GC",U"•internal.HasFill",U"•internal.HeapDump",U"•internal.HeapStats",U"•internal.Info",U"•internal.IsPure",U"•internal.Keep",U"•internal.ListVariations",U"•internal.ObjFlags",U"•internal.Refc",U"•internal.Squeeze",U"•internal.Temp",U"•internal.Type",U"•internal.Unshare",U"•internal.Variation",
|
||||
U"•internal.ClearRefs",U"•internal.DeepSqueeze",U"•internal.EEqual",U"•internal.ElType",U"•internal.GC",U"•internal.HasFill",U"•internal.HeapDump",U"•internal.HeapStats",U"•internal.Info",U"•internal.IsPure",U"•internal.Keep",U"•internal.ListVariations",U"•internal.ObjFlags",U"•internal.PureKeep",U"•internal.Refc",U"•internal.Squeeze",U"•internal.Temp",U"•internal.Type",U"•internal.Unshare",U"•internal.Variation",
|
||||
U"•math.Acos",U"•math.Acosh",U"•math.Asin",U"•math.Asinh",U"•math.Atan",U"•math.Atan2",U"•math.Atanh",U"•math.Cbrt",U"•math.Comb",U"•math.Cos",U"•math.Cosh",U"•math.Erf",U"•math.ErfC",U"•math.Expm1",U"•math.Fact",U"•math.GCD",U"•math.Hypot",U"•math.LCM",U"•math.Log10",U"•math.Log1p",U"•math.Log2",U"•math.LogFact",U"•math.Sin",U"•math.Sinh",U"•math.Sum",U"•math.Tan",U"•math.Tanh",
|
||||
|
||||
U"•ns.Get",U"•ns.Has",U"•ns.Keys",
|
||||
|
||||
@ -361,6 +361,8 @@ a←•internal.Unshare ↕10 ⋄ b←10⥊<a ⋄ ! 11 ≡ •internal.Refc a
|
||||
! 0 ≡ •internal.IsPure ⊑⟨⊑⟜1‿2‿{𝕩}∘+¨++⟩ # could be 1
|
||||
! 0 ≡ •internal.IsPure •show
|
||||
! 0 ≡ •internal.IsPure •file.chars
|
||||
! 0 ≡ •internal.IsPure •internal.keep
|
||||
! 1 ≡ •internal.IsPure •internal.pureKeep
|
||||
# •internal.Info
|
||||
•internal.Info 1 %% "3ff0000000000000: not heap-allocated"
|
||||
33↑•internal.Info •internal.Unshare ↕10 %% "fff7: refc:1 type:23=i8arr alloc:"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user