lua-users home
lua-l archive

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


On Thu, 3 Jan 2002, Frederic Rudman wrote:

> My first question is: how native-stack hungry is the interpreter/vm (we'll
> only use the interpreter in the device: all compilation/parsing will be done
> "offline" on a regular workstation). Specifically, we have less than 300
> words of stack available in the machine for everything. Is that OK for the
> Lua VM? Will it be close? Is the stack used dependant on the Lua program
> being run or can it be computed to a fixed amount? Or is it a "Stack is way
> too small. No way Lua VM will ever run on that device"?

Currently, Lua uses the C stack to make its own calls, so yes, the stack
used depends on the Lua program being running. On my machine, Lua uses
72 "words" (288 bytes) for each function call, so I would say that with
only 300 words you wouldn't be able to do much programming...

The next version will have (more or less) fixed use of stack when running
Lua programs, but there is no schedule for its release...


> Question 2: the cpu for this device is an old TMS320 from TI with 16-bit
> bytes! How much tinkering will I need in order to port the Lua VM? A lot? A
> little? I know there'll be at least a little because at first glance I've
> noticed that the generated code (from luac) seems to be 8-bit-byte oriented
> (right?).

We try to make Lua completely ANSI. ANSI does not specify that a byte
(char) has 8 bits, only that a byte has at least 8 bits. So,
"theoretically", Lua should work in your machine. However, we never tested
Lua in such machines, so you could find new bugs (places where we did wrong
assumptions). We are very interested in the results of your port, since
one of the main goals of Lua is real portability.

I think luac does not assume a byte of 8 bits, but it does assume some
uniformity between the "compiler" machine and the target machine.


> Question 3: This device does not have the regular ANSI-C library of modules
> but we did implement some of the basics (malloc, strcmp, ...) but only a few
> of these. Does anyone know which modules I'll need to implement to compile
> and run the vm on this new environment (or where to go to find out about
> these modules).

>From the ANSI-C library functions that the VM uses, most are very
easy to implement (strcmp, memcopy, etc.). As far as I remember, the
only "hard" functions in the VM are malloc/realloc/free, and sprintf,
although the VM uses very few format options: %d, %.XXs, and %.16g (in
only one place).


-- Roberto