[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: printing function name in luac/print.c?
- From: Jeroen Janssen <japj@...>
- Date: Wed, 18 Oct 2000 13:35:05 +0200
btw... looking at the (luac) listing of life.lua I have some question
* is there an opcode list that describes the parameters "passed" to
opcodes? + what each opcode does?
listing
=======
main <@life.lua:0> (146 instructions/584 bytes at 002F3868)
0 params, 26 stack positions, 0 locals, 19 strings, 0 numbers, 7
functions
1 PUSHSTRING 1 ; *
2 SETGLOBAL 0 ; ALIVE
3 PUSHSTRING 3 ; .
4 SETGLOBAL 2 ; DEAD
5 CLOSURE 0 0 ; 002F3A70
6 SETGLOBAL 4 ; delay
7 CLOSURE 1 0 ; 002F3E88
8 SETGLOBAL 5 ; ARRAY2D
9 CREATETABLE 0
10 SETGLOBAL 6 ; _CELLS
11 GETGLOBAL 6 ; _CELLS
12 PUSHSTRING 7 ; spawn
13 CLOSURE 2 0 ; 002F4430
14 SETTABLE 3 3
15 GETGLOBAL 6 ; _CELLS
16 PUSHSTRING 8 ; evolve
17 CLOSURE 3 0 ; 002F4148
18 SETTABLE 3 3
19 GETGLOBAL 6 ; _CELLS
20 PUSHSTRING 9 ; draw
21 CLOSURE 4 0 ; 002F3BD8
22 SETTABLE 3 3
23 CLOSURE 5 0 ; 002F5410
24 SETGLOBAL 10 ; CELLS
140 CLOSURE 6 0 ; 002F5E98
141 SETGLOBAL 18 ; LIFE
142 GETGLOBAL 18 ; LIFE
143 PUSHINT 40
144 PUSHINT 20
145 CALL 0 0
146 END
* The number after CLOSURE tells the function number (local to this
function) in the source file (0 being the first (delay), and 6 being
LIFE)?
* SETTABLE sets an item of a table (_CELLS:spawn , evolve and draw
functions), are those functions "appended" to the list? (thus the order
of SETTABLE determines what should be used with GETDOTTED and
GETINDEXED?)
listing
=======
function <@life.lua:78> (22 instructions/88 bytes at 002F5410)
2 params, 7 stack positions, 3 locals, 5 strings, 0 numbers, 0 functions
1 GETGLOBAL 0 ; ARRAY2D
2 GETLOCAL 0 ; w
3 GETLOCAL 1 ; h
4 CALL 2 1
5 GETLOCAL 2 ; c
6 PUSHSTRING 1 ; spawn
7 GETGLOBAL 2 ; _CELLS
8 GETDOTTED 1 ; spawn
9 SETTABLE 3 3
10 GETLOCAL 2 ; c
11 PUSHSTRING 3 ; evolve
12 GETGLOBAL 2 ; _CELLS
13 GETDOTTED 3 ; evolve
14 SETTABLE 3 3
15 GETLOCAL 2 ; c
16 PUSHSTRING 4 ; draw
17 GETGLOBAL 2 ; _CELLS
18 GETDOTTED 4 ; draw
19 SETTABLE 3 3
20 GETLOCAL 2 ; c
21 RETURN 3
22 END
* In the main SETGLOBAL 0 sets ALIVE to "*". in CELLS(w,h) - function at
line 78 - GETGLOBAL 0 returns ARRAY2D? This looks wrong (since ARRAY2D
is global 5?)
--
Best regards,
Jeroen Janssen
+++
"You can't trample infidels when you're a tortoise. I mean, all you
could
do is give them a meaningful look."
-- (Terry Pratchett, Small Gods)
+++