lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Alexander Gladysh wrote:
> Would it be possible to use Clue for rapid prototyping? It is not the
> speed of resulting code that worries me most, but the speed of
> compilation, and possibility to use it as run-time compiler for C code
> at all.

Yes; sparse does compile very quickly (and produces decent code, too).

*However*, Clue's runtime environment is rather odd compared to real
machines. All data types are 1 'byte' wide, and a 'byte' is big enough
to store an integer, a double, a char, etc. Some of the ANSI undefined
behaviour produces *really* weird results --- comparing two pointers
that do not point at the same underlying array can produce any arbitrary
result; reading a value written by one pointer type with another pointer
type will most likely produce a runtime error... some point later; and
the stack traces and debugging info are cryptic in the extreme. So while
it would certainly work, it may not work sufficiently usefully to, er,
be useful. For example, you cannot run Clue in Clue --- sparse does
nasty tricks storing state in the bottom two bits of its pointers.


(Incidentally, you might be amused to know that I've rewritten a big
chunk of the register allocator; the result is that the Whetstone
benchmark has quadrupled, clbg-fannkuch now takes 8% of the time it did,
clbg-nsieve now takes 12% of the time it did... and clbg-binary-trees
now takes 228% of the time it used. No, that's not a typo. Optimisations
are *weird*.)

┌─── ───── ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

Attachment: signature.asc
Description: OpenPGP digital signature