<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.0.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2019-12-12T01:13:50+01:00</updated><id>/feed.xml</id><title type="html">Viua VM weekly</title><subtitle>A blog covering recent developments in Viua VM and related projects. Posts published every Tuesday.
</subtitle><entry><title type="html">New docs</title><link href="/issue/35" rel="alternate" type="text/html" title="New docs" /><published>2019-12-12T00:10:00+01:00</published><updated>2019-12-12T00:10:00+01:00</updated><id>/issue/issue-35</id><content type="html" xml:base="/issue/35">&lt;p&gt;
    No technical stuff in this post. Just a heads-up that new documentation is
    being written.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;new-docs&quot;&gt;New docs&lt;/h1&gt;

    &lt;p&gt;
        There is a new documentation available that describes all public
        instructions and register sets. The
        &lt;a href=&quot;https://docs.viuavm.org/isa&quot;&gt;ISA docs&lt;/a&gt; are not yet finished
        but &lt;em&gt;all&lt;/em&gt; instructions have their syntax forms documented so you
        can experiment with them and see what they are doing.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">No technical stuff in this post. Just a heads-up that new documentation is being written.</summary></entry><entry><title type="html">Slow, but (almost) steady</title><link href="/issue/34" rel="alternate" type="text/html" title="Slow, but (almost) steady" /><published>2019-09-01T02:57:00+02:00</published><updated>2019-09-01T02:57:00+02:00</updated><id>/issue/issue-34</id><content type="html" xml:base="/issue/34">&lt;p&gt;
    No technical information in this post. It's mostly an update on the general
    state of things in the Viua VM-land.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;still-alive&quot;&gt;Still alive&lt;/h1&gt;

    &lt;p&gt;
        Viua VM is not dead. The rumours about its demise were greatly
        exaggerated. In fact, it is the best shape it ever was and has
        seen usage in almost-real-world projects (I was dogfooding during my
        engineer's degree final project).
    &lt;/p&gt;

    &lt;p&gt;
        However, the development substantially slowed down in recent times.
        There's no denying that the amount of code I put out there is in no way
        comparable to what it used to be. This is particularly due to the amount
        of work I had to do in the academia (a degree does not earn itself) and
        industry (the bills do not want to pay themselves). This are just lazy
        excuses, though.
    &lt;/p&gt;

    &lt;p&gt;
        Hopefully, the pace of progress should now pick up a little as I have a
        bit more free time on my hands. If it doesn't - too bad, but the VM is
        definitely not dead.
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;io-schedulers-and-instructions&quot;&gt;I/O schedulers and instructions&lt;/h1&gt;

    &lt;p&gt;
        One of the most recent additions were I/O schedulers and I/O
        instructions. In theory, they should take some load off of FFI
        schedulers which were until now used to execute both CPU-related and
        I/O-related calls.
    &lt;/p&gt;

    &lt;p&gt;
        I/O is based on ports, requests, and interactions.

        First you open an I/O port (it can represent a file, a socket, a pipe,
        etc.). Then, you use this port to submit I/O requests to the kernel and
        then to I/O schedulers.

        User code sees the I/O operation to perform as an &quot;I/O&amp;nbsp;request&quot;
        value, the kernel sees it as an &quot;I/O&amp;nbsp;interaction&quot; to perform - they
        are both linked together by an ID assigned to every I/O interaction.
    &lt;/p&gt;

    &lt;p&gt;
        While an I/O scheduler goes about executing an I/O interaction the user
        code may wait for an I/O request to become complete (either successfully
        or with an error) or cancel it. I/O is performed asynchronously (after
        an I/O interaction is submitted the user code just receives a handle, in
        the form of an I/O request value) and the user code is not blocked.
        It must explicitly block on an I/O request by using the
        &lt;code&gt;io_wait&lt;/code&gt; instruction.
        Alternatively, if the request does not complete for too long it may be
        cancelled using the &lt;code&gt;io_cancel&lt;/code&gt; instruction.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">No technical information in this post. It's mostly an update on the general state of things in the Viua VM-land.</summary></entry><entry><title type="html">More documentation</title><link href="/issue/33" rel="alternate" type="text/html" title="More documentation" /><published>2018-02-06T18:01:34+01:00</published><updated>2018-02-06T18:01:34+01:00</updated><id>/issue/issue-33</id><content type="html" xml:base="/issue/33">&lt;p&gt;
    Once again, not much happened except for new documentation being written.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;more-documentation&quot;&gt;More documentation&lt;/h1&gt;

    &lt;p&gt;
        Documentation has been expanded to include chapters about the general architecture
        of the VM, as seen by the programmer.
        The documentation is available &lt;a href=&quot;https://docs.viuavm.org/manual.html&quot;&gt;here&lt;/a&gt;.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Once again, not much happened except for new documentation being written.</summary></entry><entry><title type="html">Documentation continues</title><link href="/issue/32" rel="alternate" type="text/html" title="Documentation continues" /><published>2018-01-30T18:44:17+01:00</published><updated>2018-01-30T18:44:17+01:00</updated><id>/issue/issue-32</id><content type="html" xml:base="/issue/32">&lt;p&gt;
    Once again, not much happened except for new documentation being written.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;documentation-effort-continues&quot;&gt;Documentation effort continues&lt;/h1&gt;

    &lt;p&gt;
        Documentation for Viua VM has been expanded by quite a few new chapters in the last week.
        The document has also been renamed to &quot;Viua VM manual&quot;.
    &lt;/p&gt;

    &lt;p&gt;
    Among the new instructions that were documented are
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-25&quot;&gt;&lt;code&gt;process&lt;/code&gt;&lt;/a&gt;,
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-18&quot;&gt;&lt;code&gt;join&lt;/code&gt;&lt;/a&gt; (both for concurrency),

    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-10&quot;&gt;&lt;code&gt;function&lt;/code&gt;&lt;/a&gt; (create a function ref),
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-3&quot;&gt;&lt;code&gt;call&lt;/code&gt;&lt;/a&gt;,
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-23&quot;&gt;&lt;code&gt;pamv&lt;/code&gt;&lt;/a&gt; (pass a parameter by move),
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-24&quot;&gt;&lt;code&gt;param&lt;/code&gt;&lt;/a&gt; (pass a parameter by copy),
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-27&quot;&gt;&lt;code&gt;return&lt;/code&gt;&lt;/a&gt;,
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-8&quot;&gt;&lt;code&gt;frame&lt;/code&gt;&lt;/a&gt; (construct a call frame),
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-2&quot;&gt;&lt;code&gt;arg&lt;/code&gt;&lt;/a&gt; (obtain passed argument),

    and
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#6-13&quot;&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt;.
    &lt;/p&gt;

    &lt;p&gt;
        The manual is now in an overall better shape as more references are now being used in text;
        especially the HTML version is now much more usable as the refs allow the reader to jump from
        one interesting section to the next.
    &lt;/p&gt;

    &lt;h2&gt;Future content&lt;/h2&gt;

    &lt;p&gt;
        The manual now also includes two sections that are just stubs to be be expanded in the future, but
        are tremendously important - the environment (that the VM provides), and the standard library.
    &lt;/p&gt;

    &lt;p&gt;
        The first one will describe the environment in which the programs running on Viua VM are executed;
        this includes program organisation, description of available error handling techniques, how
        concurrency is realised in the VM, etc.
    &lt;/p&gt;

    &lt;p&gt;
        The second will describe the standard library supplied with the VM (which so far is of poor
        quality, and extremely limited usefulness).
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;pdf-version&quot;&gt;PDF version&lt;/h1&gt;

    &lt;p&gt;
        A &lt;a href=&quot;https://docs.viuavm.org/manual.pdf&quot;&gt;PDF version&lt;/a&gt; has been made available to
        accompany the HTML and plaintext versions.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Once again, not much happened except for new documentation being written.</summary></entry><entry><title type="html">More documentation</title><link href="/issue/31" rel="alternate" type="text/html" title="More documentation" /><published>2018-01-23T21:38:04+01:00</published><updated>2018-01-23T21:38:04+01:00</updated><id>/issue/issue-31</id><content type="html" xml:base="/issue/31">&lt;p&gt;
    Once again, not much happened except for new documentation being written.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;more-documentation&quot;&gt;More documentation&lt;/h1&gt;

    &lt;p&gt;
    Assembly language &lt;a href=&quot;https://docs.viuavm.org/manual.html#3-1&quot;&gt;directives&lt;/a&gt; and
    &lt;a href=&quot;https://docs.viuavm.org/manual.html#3-2-1&quot;&gt;function definitions&lt;/a&gt;
    are now partially documented.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Once again, not much happened except for new documentation being written.</summary></entry><entry><title type="html">More documentation</title><link href="/issue/30" rel="alternate" type="text/html" title="More documentation" /><published>2018-01-16T18:15:06+01:00</published><updated>2018-01-16T18:15:06+01:00</updated><id>/issue/issue-30</id><content type="html" xml:base="/issue/30">&lt;p&gt;
    Last week was spent only on writing documentation.
    No new code was introduced to the codebase of the VM.
    The work will most likely resume after most currently available features are documented.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;documentation-for-tools&quot;&gt;Documentation for tools&lt;/h1&gt;

    &lt;p&gt;
        Basic documentation is now available for
        &lt;a href=&quot;https://docs.viuavm.org/manual.html#4-1&quot;&gt;assembler&lt;/a&gt;,
        &lt;a href=&quot;https://docs.viuavm.org/manual.html#4-2&quot;&gt;kernel&lt;/a&gt;,
        and &lt;a href=&quot;https://docs.viuavm.org/manual.html#4-3&quot;&gt;assembler&lt;/a&gt;.
    &lt;/p&gt;

    &lt;h3&gt;Assembler&lt;/h3&gt;

    &lt;p&gt;
        Features of the assembler (type checking, static control-flow and register access analysis, type
        inference) are now shortly described.
        Also, it is noted that the assembler also performs the role of the linker.
    &lt;/p&gt;

    &lt;h3&gt;Kernel&lt;/h3&gt;

    &lt;p&gt;
        Kernel &lt;a href=&quot;https://docs.viuavm.org/manual.html#4-2-1&quot;&gt;environment variables&lt;/a&gt; are described.
        These variables may be used to tune some aspects of the kernel, or enable execution traces which are
        useful for debugging your programs (or the VM).
    &lt;/p&gt;

    &lt;h3&gt;Disassembler&lt;/h3&gt;

    &lt;p&gt;
        A brief description is provided, along with the list of its deficiencies.
        Disassembler is probably the least-frequently used tool of the three, so these deficiencies are not
        high on the list of priorities (for now, at least).
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Last week was spent only on writing documentation. No new code was introduced to the codebase of the VM. The work will most likely resume after most currently available features are documented.</summary></entry><entry><title type="html">New documentation</title><link href="/issue/29" rel="alternate" type="text/html" title="New documentation" /><published>2018-01-09T18:50:22+01:00</published><updated>2018-01-09T18:50:22+01:00</updated><id>/issue/issue-29</id><content type="html" xml:base="/issue/29">&lt;p&gt;
    New documentation is being written.
    So far it does not cover all instructions and is not as in-depth as it should be, but it is only a matter
    of time before it will be.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;new-documentation&quot;&gt;New documentation&lt;/h1&gt;

    &lt;p&gt;
        New documentation is written in a form of a single-file document covering
        &lt;strong&gt;&lt;em&gt;everything&lt;/em&gt;&lt;/strong&gt; there is to cover about the VM.
        Available instructions, syntax of the assembly language, tools that are shipped in a standard
        distribution, programming techniques, etc.
    &lt;/p&gt;

    &lt;p&gt;
        There are three versions of the manual (all with the same content):
    &lt;/p&gt;

    &lt;ul&gt;
        &lt;li&gt; &lt;a href=&quot;https://docs.viuavm.org/manual.txt&quot;&gt;plaintext&lt;/a&gt; version &lt;/a&gt; &lt;/li&gt;
        &lt;li&gt; &lt;a href=&quot;https://docs.viuavm.org/manual.html&quot;&gt;colorised HTML&lt;/a&gt; version (dark background, light
            text) &lt;/a&gt; &lt;/li&gt;
        &lt;li&gt; &lt;a href=&quot;https://docs.viuavm.org/manual.nocolor.html&quot;&gt;browser-default HTML&lt;/a&gt; version (whatever
            your browser-default colors happen to be &lt;/a&gt; &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;
        All versions have &lt;em&gt;exactly&lt;/em&gt; the same content, and are rendered in &lt;em&gt;exactly&lt;/em&gt; the same
        way; except for the colors and links from ToC to sections in the HTML versions.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">New documentation is being written. So far it does not cover all instructions and is not as in-depth as it should be, but it is only a matter of time before it will be.</summary></entry><entry><title type="html">Document all the things!</title><link href="/issue/28" rel="alternate" type="text/html" title="Document all the things!" /><published>2018-01-02T18:35:33+01:00</published><updated>2018-01-02T18:35:33+01:00</updated><id>/issue/issue-28</id><content type="html" xml:base="/issue/28">&lt;p&gt;
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;a-new-take-on-documentation&quot;&gt;A new take on documentation&lt;/h1&gt;

    &lt;p&gt;
        Another attempt at documenting user-visible Viua interface is being made.
        There are several things that require attention, and which &lt;em&gt;have to&lt;/em&gt; be documented.
        In no particular order:
    &lt;/p&gt;

    &lt;ul&gt;
        &lt;li&gt; the instruction set &lt;/li&gt;
        &lt;li&gt; what is a register? &lt;/li&gt;
        &lt;li&gt; what is a &lt;em&gt;register set&lt;/em&gt;? &lt;/li&gt;
        &lt;li&gt; how to access values held in registers? &lt;/li&gt;
        &lt;li&gt; what is the execution model of the VM (asynchronously communicating processes)? &lt;/li&gt;
        &lt;li&gt; how to send and receive messages? &lt;/li&gt;
        &lt;li&gt; how to handle errors? &lt;/li&gt;
        &lt;li&gt; how to do I/O? &lt;/li&gt;
    &lt;/ul&gt;

    &lt;p&gt;
        These are all important issues, but Viua does not currently provide documentation for them in any
        form.
        There are several articles in a few places, almost 600 example programs written for Viua, but this is
        not enough for the VM to be usable.
    &lt;/p&gt;

    &lt;p&gt;
        The newest place when documentation can be found is &lt;a href=&quot;https://docs.viuavm.org/manual.txt&quot;&gt;here&lt;/a&gt;.
        It combines documentation of available instructions with explanations of the core concepts of Viua VM:
        registers, register sets, value lifetimes, types, processes, messages, exceptions and error handling.
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;finished-exception-handling-wiring-rework&quot;&gt;Finished exception-handling wiring rework&lt;/h1&gt;

    &lt;p&gt;
        Explicit &lt;code&gt;new&lt;/code&gt;s were removed from Viua code, removing the last place where naked pointers
        to dynamically allocated objects were used and increasing the overall reliability of Viua VM.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Wiring improvements</title><link href="/issue/27" rel="alternate" type="text/html" title="Wiring improvements" /><published>2017-12-19T17:12:09+01:00</published><updated>2017-12-19T17:12:09+01:00</updated><id>/issue/issue-27</id><content type="html" xml:base="/issue/27">&lt;p&gt;
    Last week was spent on implementation of subtraction instructions, and
    on improving machine's internals.
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;signed-subtraction&quot;&gt;Signed subtraction&lt;/h1&gt;

    &lt;p&gt;
        It turned out that dedicated subtraction instructions are needed after all.
    &lt;/p&gt;

    &lt;p&gt;
        For wrapping arithmetic a separate subtraction instruction is not as critical as for the other types
        of arithmetic.
        There subtraction is just the regular &quot;flip the bits, add one&quot; and add.
        However, for checked or saturating arithmetic additional checks must be done and that justifies adding
        additional opcodes to the VM's instruction set:
        &lt;code&gt;checkedssub&lt;/code&gt; (checked signed subtraction),
        &lt;code&gt;checkedusub&lt;/code&gt; (checked unsigned subtraction),
        &lt;code&gt;saturatingssub&lt;/code&gt; (saturating signed subtraction),
        &lt;code&gt;saturatingusub&lt;/code&gt; (saturating unsigned subtraction), and
        &lt;code&gt;wrapsub&lt;/code&gt; (wrapping subtraction).
    &lt;/p&gt;

    &lt;p&gt;
        For now, only the signed versions were implemented.
        Unsigned versions will be implemented with the rest of unsigned arithmetic instructions.
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;improved-memory-safety-during-exception-handling&quot;&gt;Improved memory safety during exception handling&lt;/h1&gt;

    &lt;p&gt;
        Exception handling is the last part of Viua where one can see naked &quot;&lt;code&gt;new&lt;/code&gt;&quot; and
        &quot;&lt;code&gt;delete&lt;/code&gt;&quot;.
        During this week a rework operation has been started to move to &lt;code&gt;std::unique_ptr&lt;/code&gt; for all
        exception handling.
        Lifetimes of all values inside Viua (that are visible to the user code, as exceptions are) are managed
        through &lt;code&gt;std::unique_ptr&lt;/code&gt;s, and exceptions were the last holdouts not abiding by this rule.
        This will change during the following week.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Last week was spent on implementation of subtraction instructions, and on improving machine's internals.</summary></entry><entry><title type="html">Signed fixed-width arithmetic implementation is complete</title><link href="/issue/26" rel="alternate" type="text/html" title="Signed fixed-width arithmetic implementation is complete" /><published>2017-12-12T19:21:32+01:00</published><updated>2017-12-12T19:21:32+01:00</updated><id>/issue/issue-26</id><content type="html" xml:base="/issue/26">&lt;p&gt;
    Last two weeks were &lt;em&gt;slow&lt;/em&gt;.
    Not much happened.
    Mostly small improvements, and some work around the VM (CI maintenance, checking compiler behaviour, etc.).
&lt;/p&gt;

&lt;hr&gt;

&lt;section&gt;
    &lt;h1 id=&quot;saturating-signed-division&quot;&gt;Saturating signed division&lt;/h1&gt;

    &lt;p&gt;
        Saturating signed division instruction &lt;code&gt;saturatingsdiv&lt;/code&gt; was implemented.
        This was the last instruction to be implemented for signed values, which means that the signed
        fixed-width arithmetic implementation is now (mostly) complete.
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;fixed-width-arithmetic-in-devel-branch&quot;&gt;Fixed width arithmetic in devel branch&lt;/h1&gt;

    &lt;p&gt;
        Signed fixed-width arithmetic instructions
        &lt;a href=&quot;http://git.savannah.nongnu.org/cgit/viuavm.git/commit/?h=devel&amp;id=c9c46309c70e6bc2f8ac8b96d970ebd6f47959cd&quot;&gt;&lt;code&gt;were merged&lt;/code&gt;&lt;/a&gt;
        into &lt;a href=&quot;http://git.savannah.nongnu.org/cgit/viuavm.git/log/?h=devel&quot;&gt;&lt;code&gt;devel&lt;/code&gt; branch&lt;/a&gt;.
    &lt;/p&gt;
&lt;/section&gt;

&lt;section&gt;
    &lt;h1 id=&quot;preparations-for-better-type-checker&quot;&gt;Preparations for better type checker&lt;/h1&gt;

    &lt;p&gt;
        Current type checker for Viua VM assembly is incredibly limited, and is unable to check more complex
        types.
        This comes mostly from the limitations of the type inferencer.
        &quot;Complex type&quot; means that the type is parametrised by more than one value (or the parametrisation goes
        more than one level deep).
    &lt;/p&gt;

    &lt;p&gt;
        As an example: the inferencer is able to correctly and fully deduce a type &quot;pointer to
        &lt;code&gt;T&lt;/code&gt;&quot;, but is unable to deduce &quot;vector of pointer to &lt;code&gt;T&lt;/code&gt;&quot; and will leave such
        values as &quot;vector of pointer to value&quot; which means that anything goes.
        The final goal for the inferencer and checker is to be able to deduce arbitratily nested types, e.g.
        &quot;pointer to vector of vector of pointer to text&quot; (in C++ this would be
        &quot;&lt;code&gt;std::vector&amp;lt;std::vector&amp;lt;std::string*&amp;gt;&amp;gt;*&lt;/code&gt;&quot;.
        Type checker could then use the detailed types to better verify programs.
    &lt;/p&gt;

    &lt;p&gt;
        What is more, the static analyser could employ the richer type information provided by the enhanced
        inferencer to check things other than types:
        &lt;strong&gt;1/&lt;/strong&gt; process joinability,
        &lt;strong&gt;2/&lt;/strong&gt; bit shifts and operations (i.e. ensuring that matching widths are used, or that
        no narrowing conversions happen),
        &lt;strong&gt;3/&lt;/strong&gt; whether fixed width arithmetic operations are used consistently,
        etc.
    &lt;/p&gt;

    &lt;p&gt;
        There are no plans, though, to extend the support to verify types of fields in structures.
        The type checker and static analyser will only ensure that the types are used consistently, but Viua
        VM assembly will not provide a way to declare types for structure fields (similarly as it does not
        provide a way to declare types of functions - they are only verified for consistency of use, not
        declared explicitly).
        This functionality will be left for higher-level languages.
    &lt;/p&gt;
&lt;/section&gt;</content><author><name></name></author><summary type="html">Last two weeks were slow. Not much happened. Mostly small improvements, and some work around the VM (CI maintenance, checking compiler behaviour, etc.).</summary></entry></feed>