[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: "or" shortcut does not work - but why?
- From: Andreas Rozek <Rozek@...>
- Date: Mon, 18 Jun 2007 07:15:40 +0200
Good morning!
This is what I got from running ChunkSpy on my PC for the follow-
ing code (compiled on my Handheld PC)
Result = false;
Result = Result or "anything else";
io.stdout:write("Result = '"..tostring(Result).."'\n");
ChunkSpy:
0041 02000000 [01] loadbool 0 0 0 ; false
0045 07000000 [02] setglobal 0 0 ; Result
0049 05000000 [03] getglobal 0 0 ; Result
004D 1A400000 [04] test 0 1 ; to [6] if false
0051 16000080 [05] jmp 1 ; to [7]
0055 01400000 [06] loadk 0 1 ; "anything else"
0059 07000000 [07] setglobal 0 0 ; Result
005D 05800000 [08] getglobal 0 2 ; io
0061 06C04000 [09] gettable 0 0 259 ; "stdout"
0065 0B004100 [10] self 0 0 260 ; "write"
0069 81400100 [11] loadk 2 5 ; "Result = '"
006D C5800100 [12] getglobal 3 6 ; tostring
0071 05010000 [13] getglobal 4 0 ; Result
0075 DC800001 [14] call 3 2 2
0079 01C10100 [15] loadk 4 7 ; "'\n"
007D 95000101 [16] concat 2 2 4
0081 1C408001 [17] call 0 3 1
0085 1E008000 [18] return 0 1
This looks very similar to what Nick Gammon posted (taking into
account, that I have used globals in that specific case)
What surprises me a bit is the following info which is also prin-
ted by ChuinkSpy:
0004 51 version (major:minor hex digits)
0005 00 format (0=official)
0006 01 endianness (1=little endian)
0007 04 size of int (bytes)
0008 04 size of size_t (bytes)
0009 04 size of Instruction (bytes)
000A 08 size of number (bytes)
000B 00 integral (1=integral)
* number type: double
* x86 standard (32-bit, little endian, doubles)
** global header end **
Look at the "endianess": yesterday, I got an error message from
ChunkSpy about an "unsupported endianess" - now it seems as if
HPC and PC share the same endianess (which could be true, as the
MIPS processor supports both ways - as far as I know)
Could a wrong endianess be the reason for the reported misbehavi-
our? Compilation and execution take place on the same platform,
usually within the same program...
I'll try to look at the TEST instruction, as suggested by Nick.
Kind regards,
Andreas Rozek Phone: ++49 (7031) 436 5784
Brunnenstraße 30/2 Mobile: ++49 (151) 172 879 18
D-71032 Böblingen EMail: Andreas.Rozek@gmx.de
Germany URL: http://www.Andreas-Rozek.de