The boundaries below state the compiler as of release 7.8.1.
Every entry here is a decision, not an oversight: a boundary the current release draws, together with the spelling that works now and, where one is set, the release line on which the boundary moves. When a limitation is lifted, its entry leaves this page in the same release.
Language
A sum type’s fields hold no pointer, view or array of arrays
The field sets of a sum type hold numbers, booleans,
enumerations, strings, fixed arrays, records, other sum types, array of any of
these that holds no array or sum type of its own, and array of a type whose
values hold values of their own kind, such as the sum type itself written in the
field or a record that holds it. A pointer, a stringbuffer, a borrowed
stringpart, an array of arrays, and an array whose elements hold arrays or sum
types of any other kind are refused with analyzer error 5560: keep such inner
arrays in an array beside the value and store their indexes in the field set. A
case that reaches its own sum type by value, through a pointer, or through a
named array type or a record field that holds the array, is refused with error
5559, which names the road that compiles: write the field as array of the sum
type, as in children : array of Tree.
A record holds its own type only through a pointer
A record reaches a value of its own type only through a pointer: in a field of its own type, in the elements of a fixed or a dynamic array, or in another record that holds it back. Each of these is refused by name, and the refusal writes out the spelling that works. A field of the record’s own type is refused with analyzer error 5686, a fixed array written in the field with 5696, two records that hold each other with 5697, and an array declared under a name of its own, or a dynamic array written in the field, with 5793, whether the record holds the array, borrows it or points at it. This tree is refused:
type
Forest = array of Tree;
Tree = record
weight : int64;
kids : Forest;
end;the record 'Tree' cannot hold its own type in the elements of the array 'Forest': a record reaches its own type only through a pointer, while an array can hold pointers to records of its own type, written 'Forest = array of pointer Tree'Let the array hold pointers to the records, as the refusal writes,
Forest = array of pointer Tree, and make each child with new; releasing the
root releases every child it holds. Where the tree is a value, a sum type holds
its own type in a dynamic array written in its field, as the entry above
describes.
A sum type is not generic
A case with a field set inside a generic type template is refused with analyzer
error 5561, and a sum type a generic routine declares whose case holds the
routine’s type parameter with error 5807, which names the parameter and the
routine. Declare the sum type over concrete field types. A generic type whose
body is an enumeration, Color of T = (Red, Green, Blue), is refused at its
first literal with error 5808: declare the enumeration without type parameters.
A generic sum type is on the 7.x line.
A case test binds only as the whole condition of an if
value is Case(binding) binds the case’s fields only when the test is the whole
condition of an if; anywhere else, in a while condition or under and, it is
refused with analyzer error 5574, because the binding has no arm to live in.
Test with the wildcard there, value is Case(*), and read the fields with a
case statement.
A generic function does not admit a nested subprogram
A function or procedure declared inside a generic function is refused with analyzer error 5424. A specialization clones the generic’s body once per type argument, and a nested subprogram would demand a second specialization authored inside the first. Declare the helper beside the generic function and pass what it needs.
Unicode case mapping is one-to-one
UpperCase and LowerCase of the strings unit map each code point to
exactly one code point, as UpperCasePoint and LowerCasePoint do for a
single unicode value: ß stays ß rather than becoming SS, and the Greek final
sigma is not selected by position. The one-to-many and positional rules are on
the release-8 line.
The program’s own statements for its end do not run on Halt
A statement the program’s own body defers with defer until program runs when
that body ends. Halt and C’s exit end the program before its body ends, and
then only the statements of its object units and its libraries run. Write a
statement that must run on every orderly end, Halt included, in the body of an
object unit or a library. The program’s own statements on Halt are set for
release 7.8.2.
A list changed inside a walk is refused only where both names lead to it
A for ... in loop reads its list from where the list stood when the loop
began, so a statement inside the loop that replaces or grows that list is
refused with analyzer error 5535 ('mine' cannot grow inside the loop that walks it). The compiler refuses it wherever it can follow the loop’s name and
the statement’s name to one list: the loop names the list or walks it through
a pointer variable given the address of that list alone, and the statement
names the list, writes through a pointer to it, replaces a record that holds
it, or calls a routine that does. Spellings it cannot follow:
- The loop walks through a pointer that its routine or the program also gives the address of another list, and the body replaces or grows the walked list by name.
- The loop walks through a pointer kept in a record field or an array
element,
for w in value (h.target) do, or copied out of one into a variable, and the body replaces or grows that list by name. - A routine walks the list its pointer parameter names,
for w in value p do, and its body replaces or grows by name the list its caller handed it withWalk(address list). - The loop walks a list inside an element,
for w in rows[0].items do, and the body replacesrows, or writes that element whole,rows[0] := fresh, by name or through its address. - The loop walks a list inside a record, and the body stores a whole record
into that record through a field of the record holding it,
outer.shelf := freshunderfor w in outer.shelf.items do, through a pointer kept in a record, or through a pointer also given the address of another record.
These programs compile, and the loop can then read texts and elements the list
has already given back, from its first round or a later one, at every
optimization level. Walk a copy instead,
snapshot := value p; for w in snapshot do, which keeps the texts the loop
began with in every round, or walk by index, for k := 0 to Length(value p) - 1 do,
which reads the list as it stands in each round. A check of what a pointer
names while the loop runs is on the release-8 line.
A text read through a pointer can change under a later argument of its call
A call reads its arguments in the order it writes them and enters its routine
once all of them are read. When a call hands a routine written in Mica a text
read through a pointer, First(crate.name, MutateCrate(crate)), and a later
argument of the same call replaces that text through the same pointer, the
routine can read another text in place of the one it was handed, at every
optimization level. A text handed this way to WriteLn, to another routine of
a C library or to a routine that calls one, and a text read by its name, stay
the text that was handed. Take the later argument’s value into a variable
first, then call: mutated := MutateCrate(crate); First(crate.name, mutated)
hands the text the record holds once MutateCrate has run. A text kept across
the rest of every such call is set for release 7.8.2.
Tasks, generators and processes
A concurrent block does not nest in the same activation
A concurrent block written inside another one in the same routine is refused
with analyzer error 5328: an activation joins one scope, so the inner block’s
end would drain the outer block’s children as well. Write the blocks one after
another, or move the inner one into a task or a procedure of its own, which
brings its own scope. Independent scopes nesting inside one activation are on
the release-8 line.
A stream lives in a routine’s own variables
A stream variable is declared in its routine’s or the program’s own var
section. One declared where a statement stands, var inner : stream of int64;
inside a begin ... end, is refused with analyzer error 5387, and a stream in a
record field, a case’s field set, an array element or a pointer’s target with
error 5413. Keep the
stream in a variable or a stream of parameter, and store the values it
delivers. A stream declared in an inner block and held in a record is on the
release-8 line.
One select delivers one failure domain
The fallible arms of one select carry one failure domain; an arm whose stream
fails with another domain is refused with analyzer error 5456. Split the
select, or give the streams one domain. A select over several domains is on
the release-8 line.
A pull chain handed to a scheduled producer has one consumer
A pull chain, a stream opened by a plain call, is one paused generator that
whoever pulls it resumes, so a chain handed to a scheduled producer is consumed
by that producer alone: another pull, hand-off or bind of the same variable is
refused with analyzer error 5411, and so is a second hand-off of a stream
parameter, whose form the routine cannot see. Open the upstream with
schedule ... buffer instead: a ring takes any number of consumers, stages,
tasks, the owner’s own loop and select arms alike, and each value reaches
exactly one of them.
Another unit’s task takes a stream only as a ring, and a library’s task none
A task that an object unit exports with a stream of parameter is refused a
generator’s call as its argument, schedule Drain(Local(5));, with analyzer
error 5369, whose words speak of calling the generator; the same task declared
in the program takes it. Open the generator as a ring and hand the ring,
events := schedule Local(5) buffer 4; and then schedule Drain(events);,
on one carrier or on several.
A library cannot export such a task. Its build with --emit-contract is
refused with interop error 588, whose words,
a compiled library's contract carries an array of fixed size only under the name a declaration gives it,
ask for the type under a name of its own: here they mean that a contract
cannot carry a stream of parameter, and a stream type takes no name
(analyzer error 5422). Without --emit-contract the build finishes with a note
that the archive carries no contract, so no Mica program can import the
library. Build the unit with the program as an object unit and hand its task a
ring. The answer to both, the stream taken or a refusal that says so, is set
for release 7.8.2.
A task on a process reads a stream of values without pointers
A worker shares none of the program’s memory, so a task placed on a process
reads a stream given to it as a parameter of its own one value at a time: its
worker asks the program for each value its loop pulls, and a stream that can
fail ends the worker’s loop with its failure, as it ends a reader’s loop on a
carrier. The values cross as their bytes, together with the bytes of the text
and the arrays they hold and the descriptors beside them, so a stream whose
elements hold a pointer is refused with analyzer error 5614, and so is a
producer placed on a process that would pull a stream of the program. Keep the
work that reads or adapts such a stream in the program, on a carrier. One value
crosses with at most 253 descriptors, the most one message between two
processes carries: an element whose fixed shape holds more is refused (5614),
and a value whose dynamic arrays hold more stops the program with a message
that names the count. An on lost section names no value that holds a
descriptor (5738), because the descriptors a lost worker held ended with it.
An element of a worker’s stream holds at most 253 descriptors
A stream a producer on a process may feed says so in its type, stream of int64 from process, and is read by a for ... in loop with an on lost section, by
a loop in a generator whose own stream says from process, which passes the
loss on, or by a select with an on lost arm for it. Its elements
may hold descriptors, at most 253 in one element, and the reader owns the ones
it receives; an element whose fixed shape holds more is refused (5604).
Work on a process places no work on a process
A worker is forked without a process server of its own, so a task placed on a process whose work places work on a process, directly or through a routine it calls, is refused with analyzer error 5642. Schedule that task on a carrier, where the program’s server runs what it places, or run the work it places on carriers inside the worker. No release is set for this boundary.
Tasks on processes that wait for each other need as many workers
At most as many workers run at once as the program’s worker count, and a task
placed beyond it waits for a worker to end. Tasks on processes that wait for
each other, such as a server and its client placed side by side, therefore need
a count at least as large as the tasks that wait together. With fewer, nothing
can move: wherever the kernel’s records of the program’s processes show that no
wait can end, the program stops with a report that names the placements waiting
for a worker, the cause and the remedy, and where they cannot show it, the
program waits. Set the count with --processes N when the program is built or
+mica processes=N -mica when it starts, or place fewer such tasks at once.
A library that places work on processes links as an archive
A library that places work on processes, and a library that exports a task,
link as an archive into the program that uses them; a shared object of either
is refused when it is linked, with the reason. A C program that links such an
archive calls the library’s process entry once, early in main and before it
starts a thread of its own, as the C boundary
describes; without that call the program ends at the library’s first placement
with words that name the entry.
A thread that ends inside a library’s body leaves its entry running
A C thread that ends inside the body of a library built with
--tasking multicore, by pthread_exit or by a cancellation in a C function
the body calls, leaves the library’s body entry running for good, so every
later call of that entry waits forever.
A trap in a task on a carrier ends the program
A task on a carrier shares the program’s fate: a trap in it ends the whole
program, as a trap in the program’s own body does. Only a worker process can be
lost and answered, by the block’s on lost section. Place work that may trap on a
process. A trap that ends only its own block, answered as a lost worker is, is
on the release-8 line.
A task’s body runs on a stack of 256 KiB
A task’s body and a stackful generator’s body run on the stack the runtime
floor maps for each, 256 KiB, 1 MiB under --sanitize thread, which
--stack-size does not change. A body whose frame that stack cannot hold,
with room left below it for the routines it calls, is refused at compile time
with placement error 14016, which names the body and both sizes. Shrink its
largest locals, or allocate them on the heap from its own body. No release is
set for this.
On a fixed arena every task takes about 25 KiB of the C heap
A program built with --memory-class fixed-arena takes about 25 KiB for each
task from the C heap, outside the arena. Under valgrind, 1,000 tasks that stood
at once took 24 MiB of the C heap, where the same program on the hosted heap
took 1 MiB, and the program’s peak resident memory rose from about 2 MiB with
one task to about 30 MiB, against 6 to 8 MiB on the hosted heap.
+mica heap -mica counts what the arena holds, not the C heap, so for these
tasks it wrote mica heap: peak 0 bytes of a fixed arena of 1048576 bytes.
When you size a device’s memory, count about 25 KiB of C heap for every task
that can stand at once. How a task on a fixed arena holds this memory is set
for release 7.8.2.
A Halt in a task while the program ends stops the end at once
On several carriers, a task that runs while the program’s statements for its
end run, one such a statement started above all, may run on another thread than
those statements. A Halt in it then ends the program at once with its status,
the program’s output written, and the remaining statements for the end do not
run. Standard error says:
Mica runtime note: the program halted from a task while its end ran, so its remaining statements for the end do not runLet such a task answer the statement that started it, with a value or a
failure, and let the statement call Halt: a Halt inside the statement sets
the status, and every remaining statement still runs. A Halt from a task that
lets the remaining statements run is set for release 7.8.2.
A carrier in a long C call holds the tasks queued behind it
On several carriers a task that computes gives its carrier to the tasks queued
on it once its slice is spent, but only at a safepoint. A task inside a long C
call, a blocking system call or a contended synchronized mark reaches none
until the call returns, and the tasks queued behind it on that carrier wait
with it, unless an idle carrier steals half of that queue or a busy one, finding
it longer than its own by two, takes up to half the difference, at most
thirty-one tasks a millisecond. The linux unit’s TimerFdRead on a timer
descriptor opened without TFD_NONBLOCK is such a call, and one that parks is
set for release 7.8.2: until then, read the descriptor with the posix unit’s
Read into eight bytes, which parks the task until the timer fires. With more
carriers than processors a carrier can also wait for a queue’s lock that another
carrier’s thread holds while the kernel has that thread set aside. A loop in a
unit that declares no task and no generator carries no safepoint, so a long
routine of such a unit runs as one step, as a call into C does; long work beside
tasks that must stay awake is a task of its own, on another carrier or in a
process. Tasks move whole, so computations that do not divide evenly among the
carriers, nine on eight, do not share them evenly. A task that waits inside a
callback from C, for a sleep, a stream or a block’s end, keeps its thread,
which waits with it while a spare thread runs its carrier, so the C function
goes on on the thread that called it. Such a wait costs two hand-overs between
threads, so a callback that a library fires often hands its event to a task
and returns, and a program holds at most 10,000 threads that run its carriers,
its carriers’ own among them. No release is set for these.
A callback on a C library’s own thread does not read a pipe while every carrier is in C
A callback that a C library fires on a thread of its own waits for ever when it
reads from a pipe or a socket that has nothing to read yet while every carrier
of the program is inside a call into C, as when each of them waits in that
library for the same callback: the read needs a carrier that watches the
descriptor. A sleep, a select’s timeout and a block’s deadline inside such a
callback end by themselves. Give the pool more carriers than calls into C can
wait at once, or read in a task of the program and hand the bytes to the
callback. A read that waits by itself is set for release 7.8.2.
A one-carrier library’s callback is refused on a C library’s own thread
A C library that fires the callback of a Mica library built for one carrier on
a thread of its own ends the program as the callback is entered, with a line
that names the callback, under a program of either tasking flavor. Build the
library and the program with --tasking multicore, which runs such a thread
as a task of its own. No release is set for this.
The thread sanitizer reports a C thread that enters Mica before the first task
Under --sanitize thread, a program on several carriers whose C library
starts a thread of its own, which calls a Mica callback before the program’s
first task has started, ends with a ThreadSanitizer report of a data race on
__mica_carrier_count between the pool’s start and the callback, and with
status 66. Without the sanitizer the same program computes its values right.
Let the C library start its thread after the program’s first task has run,
for example after a concurrent block that schedules one task: the sanitizer
then reports nothing. A count that such a thread reads safely while the pool
starts is set for release 7.8.2.
A block’s deadline does not end a generator’s wait that the block’s own statements pull
Inside a block with a deadline, a for loop among the block’s own statements
that pulls a generator does not end at the deadline while the generator’s body
waits: the block ends only when that wait ends by itself, and the loop still
takes the value. A generator pulled from a task scheduled in the block ends its
wait at the deadline, so pull it from such a task. The same end for the block’s
own statements is set for release 7.8.2.
A deadline reaches a loop over a contended synchronized statement late
A block’s deadline can take seconds to end tasks that loop over a contended
synchronized statement: a cancellation reaches such a loop once in 1,024
rounds, and every round first waits for the mark. Keep the marked statement
short and its holders few. A cancellation that reaches the wait for a mark is
set for release 7.8.2.
A loop over a text gives no turn and meets no deadline until it ends
A for ... in loop over a string carries no safepoint, where a counted loop
carries one, so a task whose body is such a loop over a long text is not
stopped by its block’s deadline until the loop ends: over a text of 33 million
letters at the debug tier, a block with a deadline of 50 ms ended after about
half a second. On one carrier the task beside it, which slept a millisecond at
a time, did not wake once meanwhile; on several carriers it ran on another.
Loop over the positions instead, for position := 0 to Length(text) - 1 do
reading text[position], which carries the safepoint: the same block then
ended after 50 ms. A loop over a string with a safepoint is set for release
7.8.2.
A library’s routine needs a mark at its plain call from a task
A routine whose every touch of shared state stands under a synchronized mark
of its own is called from a task without a mark. A routine imported from a
library’s contract still needs one at its plain call from a task, and is
refused there with analyzer error 5337: the contract states whether an entry
touches its unit’s state, not whether a mark inside covers the touch. Mark the
call, synchronized Bump();. No release is set for this.
A task’s own pointer to a cell it has made shared needs no mark
A task that makes a cell with new, stores the pointer into a program
variable under a mark, synchronized gp := q;, and goes on writing the cell
through its own pointer, q.name := ..., compiles in either tasking flavor,
although another task can read the cell through gp at the same time, and
--sanitize thread reports nothing. The compiler judges a touch by the root of
its path, and q is the task’s own: the same write through the program
variable, gp.name := ..., is refused with analyzer error 5337. Mark the write
through q too, synchronized q.name := ...;. The answer to this shape is set
for release 7.8.2.
A task woken at a stream runs after the task that woke it
When a task hands a value through a stream to a task that waits for it, on a pool of two carriers or more, the woken task runs next on the waker’s carrier, so two tasks that pass values back and forth stay on one carrier and no other carrier is woken for a value. The woken task runs once the waker waits, ends or gives its turn, and behind a waker that keeps computing another carrier runs it within about a tenth of a millisecond. Behind a waker that sits in a call into C which does not return to the scheduler, such as a read of the keyboard or a C library’s sleep, another carrier takes the woken task after about a millisecond, and within about three milliseconds where every processor is busy; for that an idle carrier wakes about twice for each value such a waker passes. From the first such task on, the program holds two more file descriptors for its life, the scheduler’s poll set and its wake door. A task that wakes two tasks in a row, as the middle stage of a pipeline does for every value, sends the first one to the other carriers, one of which wakes for it: held to two processors on AArch64, a pipeline of three stages through streams of one or two slots takes about 1.3 to 1.5 times as long as its stages would take waiting their turns in order, and through a stream of 64 slots about 1.1 to 1.2 times on AArch64 and x86-64 alike. A pool of one carrier runs its ready tasks in order, as the single-task flavor does. No release is set for these.
A program that hands values between carriers all the time takes longer than in 7.8.0
A task that waits at a stream parks at once: it does not look again for a value before it sleeps, so a task that waits holds no processor. A value handed to a task on another carrier therefore pays that carrier’s sleep and its wake. A program whose tasks hand values between carriers all the time takes longer for it than under release 7.8.0, which looked for up to four microseconds before it slept: on four carriers about twice as long on AArch64 and 1.3 to 1.5 times as long on x86-64, on sixteen carriers about 1.2 times as long on AArch64 and no longer than 7.8.0 on x86-64. Many producers that fill one small stream pay it most: 64 or 256 producers that share a stream of four slots take four to five times as long as under 7.8.0 on two and four carriers on AArch64 and three to four times as long on x86-64, about twice as long on eight carriers, and on sixteen as long as 7.8.0 on AArch64 and 1.3 times as long on x86-64. Under 7.8.0 many of those producers delivered nothing on two and four carriers, up to 57 of 64 on AArch64 and up to 28 of 64 on x86-64; now every producer delivers its share. The same rule gains wherever processors are scarce or shared: two tasks that pass 200,000 values held to one processor take 37 ms on AArch64 and 48 ms on x86-64, where 7.8.0 took 1.6 and 1.7 s, and the program on sixteen carriers uses a third to a fifth of the processor time 7.8.0 used. No release is set for this.
A burst of short tasks ends no sooner on more than eight idle carriers
On a machine of 32 processors, a burst of 20,000 tasks that each compute for
40 microseconds and end took longer on an idle pool of sixteen or thirty-two
carriers than on one of eight: on x86-64 about 187 ms on eight carriers, 227 ms
on sixteen and 246 ms on thirty-two, where four took 260 ms. Give a program
whose work comes in such bursts no more than eight carriers,
--tasking multicore,8. Its cause is set to be found in release 7.8.2.
Device work runs on one carrier
A program that places a tensor on gpu links only in the single-task flavor:
under --tasking multicore its link is refused with A device placement needs the single-task flavor: the device floor serves device work from one thread, and the multicore flavor runs a program's code on several carriers - drop the '--tasking multicore' selection, or keep every tensor host-resident. A device
tensor cannot cross a subprogram boundary either, into a routine’s or a task’s
parameter (5478): pass the host value, and move it with ToDevice inside the
scope that computes on it. Device work under several carriers, and a device
value handed to a task, are on the release-9 line.
The same holds where the code that computes on a GPU is a Mica library’s: a program built over a library whose code
places a tensor on gpu, linked as an archive or as a shared object, runs on one carrier and on the hosted heap, and a
build with --tasking multicore or --memory-class fixed-arena is refused by the library’s name. Device work under
several carriers is on the release-9 line here too.
Build and run
A checked build’s memory grows with the run
The checked build keeps every cell a program releases, poisoned, so that a read through a pointer to it is recognized; blocks it can serve no further cell from are quarantined for the rest of the run. Its memory therefore grows with the work the program does, however carefully the program releases what it owns. A fixed-arena program sized with its release build exhausts that arena under a checked build, and the failure report says so in a closing note. Size a checked run for the whole run, or give it the hosted heap; the guarantee is not traded for a smaller budget. A region’s blocks start small and grow, and a checked build never gives a block back, so each small block it fills leaves its unused end behind: measured over the compiler’s flat-memory test programs, a checked program on a fixed arena needed up to 6.0 % more arena for it. See what the checked tier costs in memory.
A checked program with heapless routines links its Mica libraries as archives
A program built with checked watches its heapless routines at the memory
allocator’s entries, which its link points only at the floor inside the
program, so its link over a Mica shared library is refused by the library’s
name. Link the library’s archive, built with --output-modifier archive, or
drop checked from --optimize. No release is set for this.
A text replaced through a pointer can stay until the program ends
A store through a pointer that replaces a text in a list, such as
target.items[0] := line or value p := new Texts reserve 3, keeps the text it
replaces until the program ends wherever the program may still read a text of
such a list across a write. That is the case when the program reads a text out
of a list it reaches through a pointer, or out of a list whose address it takes
anywhere (Append(address names, line) takes it), and either walks that list
with for ... in while the loop’s body stores through a pointer, calls a
routine that may, or calls a C routine whose contract lets it call back into
the program or keep what it is handed, or hands the text by value to a routine
that stores through a pointer. A C routine whose contract states nothing is
such a routine, and so is one handed a pointer. Printing with WriteLn,
Write, WriteErrLn or WriteErr is not: the standard library’s contract
says that they never call back and keep nothing they print, so a walk that
prints its texts gives them back. The compiler judges this by the list’s element type for the whole
program, so the walk or the call need not touch the list the store replaces,
nor run near it. A loop of such stores then grows by the texts it replaces:
about 66 bytes a round at the debug tier and 46 at O2 for a text of 40
letters. The hosted heap holds that, and a fixed arena runs out of it, with an
allocation failure in the store. A text such a store keeps in a cell made with
new stays until the program ends, also after the cell’s dispose.
To keep such a loop flat, copy the text into a variable of its own before you
hand it to such a C routine, here Notify, and walk the list by index for
that:
for i := 0 to Length(names) - 1 do
begin
line := names[i];
Notify(line);
end;Or keep the walk’s body to reading, or replace the whole list by its name in a
list whose address the program does not take. Releases up to 7.8.0 gave the
text back in these programs, and where the program still read it, as a text
handed by value while the list was replaced through a pointer, a text made
afterwards took its bytes and the program read the wrong text. A C library’s
contract says what its routines keep, with keeps on a parameter and
variadic_keeps beside variadic (Contracts), and a
walk that calls a routine whose row says it keeps nothing and never calls back
gives back.
A cell made with new that holds texts is not released in full, nor always checked
The texts of a list stored into a field of a cell made with new are not
released when the cell is disposed: after cell.items := Words(3); a
dispose cell; leaves the three texts behind, and a loop that makes and
disposes such cells grows by them.
A routine that stores a text into a field of its cell and then leaves the cell
unreleased on some road compiles, where the same routine without the store is
refused with obligation error 13102. A task that is cancelled at a wait between
the store and its dispose is such a road. Release the cell in a defer,
which runs however the routine ends.
Both are set for release 7.8.2.
A shared library links Mica libraries as shared objects
A library built as a shared object against a Mica library’s archive is
refused by both libraries’ names, under either tasking flavor and in a chain
of libraries, also where the archive holds only types and constants: a Mica
library’s archive links into a program only. Build the inner library as a
shared object too, with --output-modifier object, which every program over
the outer one then needs when it starts, or build the outer library as an
archive. An inner library built for the light runtime profile is an archive
only, so the outer one is built as an archive too. No release is set for this.
A C program that names no floor runs a Mica shared library on the plain floor
A C program that loads a Mica shared library and links no floor of its own gets the plain floor: release tier, hosted heap, one carrier. A library built at the debug tier then records no allocation sites, one built for the fixed arena runs on the hosted heap, and one built for several threads refuses to start with a line that spells the link options of the multicore floor. A C program that wants another variant links that variant’s floor and names its folder in its own run path. No release is set for this.
The light floor has no shared and no sanitized build
The light runtime profile’s floor is built as a static archive alone. A
library built on it links as an archive, and a shared object is refused
beside --runtime-profile light; a program on it runs unsanitized, and
--sanitize is refused beside it, each by name before anything compiles.
A program on it links its Mica libraries as archives too: a Mica shared
object on its line is refused at the link by the library’s name, with the
library’s archive and the full profile as the ways out.
Build on the full profile to link a shared object or to run sanitized. See
the light runtime profile.
A light library exports no generator template
A library built with --runtime-profile light is refused an exported
generator template at its heading, even where the program that would
specialize it stands on the full floor. Build the library on the full profile
to export one.
A compiled library’s exported surface does not spell a generic instance
A library built as an archive or a shared object with --emit-contract or
--emit-header cannot export a routine whose heading spells an instance of a
generic type, such as function MakeBox(w : int64) : Box of (Node), nor a
record, sum type, named array type or second name whose definition spells one:
its build is refused with interop error 587, which names each such declaration
and its instance. The
same holds for a private routine or type that an exported generic body names.
Export a generic routine or type instead, which travels as source and is
compiled where it is imported, or build the units together as object units.
An instance inside an array written in place in a heading or a field, such as
array of Box of (Node), is refused with interop error 587 the same way. A
build that asks for neither finishes for a C program with no contract inside
the archive or the shared object, and says so in one note for each such
declaration.
A compiled library’s exported surface names its fixed arrays
A library built as an archive or a shared object with --emit-contract
cannot export a routine whose heading writes a fixed array in place, such as
function Sum(row : array[1..3] of int64) : int64, nor a record or sum type
whose field writes one: a contract carries a fixed array only under the name a
declaration gives it, so the build is refused with interop error 588, which
names each such declaration and its array. A fixed-size tensor written in place,
such as vector[3] of float32, is refused the same way. Declare the array as
a type, exp Row = array[1..3] of int64;, and spell Row in the heading, or
build the units together as object units. A build that asks only for the C
header (--emit-header) writes it and leaves such a routine out by the
header’s rule for a fixed array passed by value. A build that asks for neither
finishes for a C program with no contract inside the archive or the shared
object. Both builds say so in one note for each such declaration:
Note: 'build/rows.a' carries no contract, so no Mica program can import the library 'rows', whose contract would be refused with interop code 588: library 'rows' exports the routine 'Sum', whose heading spells the type 'array[1..3] of int64' in place: a compiled library's contract carries an array of fixed size only under the name a declaration gives it, so declare the type in a 'type' section, mark it 'exp' and spell its name hereThe library’s manifest records the same words, and a program that imports the library from that file is refused by them.
The editor does not show tensor arithmetic refused on the light profile
Tensor arithmetic on the light profile is refused as its code is written, by error 22080 at the operation, and the editor writes no code, so a light project shows nothing there while you type; the build reports it.
Tooling and platforms
macOS hosts compile but do not link
On Darwin/ARM64 the compiler cross-compiles both Linux targets, but linking is not available — the binutils integration is bound to Linux hosts. Linux containers on macOS build and run everything, and the container image is the supported macOS road.
A runtime-protocol client that cancels a program’s last scope and asks again at once can leave it hanging
A program on several carriers that a client drives over the
runtime protocol can hang at its end. It takes
a client that cancels the scope whose end ends the program with tasks/cancel
and sends its next request that stops the program’s threads, tasks/tree or
runtime/suspend among them, within a few microseconds of the cancel’s
answer, as a script does: the program’s main thread is then stopped inside
its end while it holds a lock the protocol’s own thread waits for. Of 61,000
starts with such a client, 5 did not end, and release 7.8.0 hangs the same
way. A program that hangs so is ended from outside. Let a client wait for the
session to close after a cancel that can end the program, before it asks
again. An end that no stop can hold is set for release 7.8.2.
C built by GCC reads a record of bfloat16 values from other registers on arm64
On arm64, Mica passes a record of up to four half-precision values, float16
or bfloat16, the way the platform’s calling convention, AAPCS64, lays it
down: in floating-point registers, one value to each, as Clang passes it.
GCC 15 and 16 pass a record of bfloat16 values in an integer register
instead. A C function GCC compiled therefore reads such a record with other
bits than the ones Mica sent, a record it answers reaches Mica with other bits,
and nothing reports the difference. A single bfloat16 value, a record of
float16 values, and every record of half-precision values on amd64 cross the
same way with either compiler.
Two roads work. Pass the record through a pointer, which every compiler passes
the same way: the C function takes a pointer to the record, and its
contract gives the parameter a pointer type. Or
build the C side with Clang: compile the C file with clang where the build
names gcc. Mica keeps to the convention, the contract the platform’s C
compilers share, so this entry stays as long as GCC passes the record in an
integer register.
JSON has no library surface yet
No unit of the standard library reads or writes JSON. A program writes JSON
as text, with the strings unit’s verbs, and reads it through a C library it
imports by a contract of its own, as
the library contracts describe. A json unit that
holds any JSON value, reads JSON text and encodes typed records, with a
jsonrpc unit beside it, is on the 7.x line.