# MOO into C

Nate Massey (nmassey@caxy.lfa.lfc.edu)
Wed, 24 Jul 1996 17:12:32 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    On Wed, 24 Jul 1996, Adams, Charles wrote:

    >
    > in order to append something to a list has to deep copy the entire list
    > structure into a new list with the new element appended.  This can cause
    > some significant overhead with large lists.  I understand that with certain
    > optimizations, this wouldn't be necessary.  A byte-code optimizer would be
    > fabulous, and could speed up the server tremendously.
    >
    > The only downside is that optimized code wouldn't decompile back into MOO
    > source code.  This could be worked around by giving programmers some
    > facility to save the un-optimized bytecodes (perhaps as a binary string?)
    > before optimizing.

    I, about a month or so ago, wrote a program that I haven't found much
    use for, but it works great and is a little fun.  My "MOO-Code Assembler"
    will allow you two, with the use of two builtin functions that I wrote,
    modify the code in the server directly.  I additionally wrote two verbs
    in the database: $asm:assemble and $asm:disassemble, which would take a
    list of strings with assembly-like-looking code and transform it into
    these opcodes (and vice versa).  The thing is, I don't truly know assembly,
    so I cannot say how closely my stuff matches the real thing.  But I know
    it works, and aside from the fact that you can write a simple program
    (such as "pop") which will panic the MOO server, it works well.  The other
    major problem is that the server will die when trying to checkpoint if
    any of the verbs exist in the "assembled byte-code" state, since it can't
    figure out how to disassemble them.

    Comments?

    --Nate

    (I am in the process of relocation, so delays in email are inevitable.)