I’ve updated Git to support the new Glulx 3.1.2 floating-point opcodes, and a source release is available here:
http://ifarchive.org/if-archive/programming/glulx/interpreters/git/git-127.zip
When I try compiling this for 64-bit mode, either with gcc 3.4 or 4.4, glulxercise crashes when it tries to do the undo test. Is there some special option I need to use to compile it? It doesn’t look like this problem is new to this version.
Interpreter claims to support undo.
Restore without saveundo: 1
Undo saved...
Restoring undo...
*** fatal error: Illegal instruction ***
There was a problem in Git that the undo test case revealed, with the undo information incorrectly being discarded on a restore. This was fixed in Git 1.2.7 by deleting a line of code, so possibly there is some other problem there. Unfortunately I don’t have a 64-bit system to test with, so I can’t offer much guidance.
Further thoughts:
- Does it work in 32-bit mode? From your original message I’m not clear if you’ve tried it.
- Did you use the USE_DIRECT_THREADING option in the makefile? This is a bad idea except with GCC 2.95, I think.
- Are you compiling to x86_64 or 64-bit PPC? In the latter case you need the USE_BIG_ENDIAN_UNALIGNED option in the makefile, I believe.
It works fine in 32-bit mode.
That doesn’t seem to make a difference for this problem.
x86_64.
I can’t see anything that would obviously be 32/64- bit sensitive in that area, so ummm, I don’t know. Sorry. If you get anywhere looking into this let me know.
Here’s a fix for the undo issue on x64.
In saveundo.c, change line 43:
git_uint32 stackSize = sizeof(git_sint32*) * (sp - base);
To:
git_uint32 stackSize = sizeof(git_sint32) * (sp - base);
Oh, good catch, Ben. Thanks.
I just made the following change to the Glulxe code for the @ceil opcode. Git should pick up the equivalent, since the same problem arises. (Only on OSX 10.5.8 Intel, so far.)
case op_ceil:
valf = decode_float(inst[0].value);
value = encode_float(ceilf(valf));
+ if (value == 0x0 || value == 0x80000000) {
+ /* When the result is zero, the sign may have been lost in the
+ shuffle. (This is a bug in some C libraries.) We'll set the
+ sign by hand, based on the original argument. */
+ value = inst[0].value & 0x80000000;
+ }
store_operand(inst[1].desttype, inst[1].value, value);
break;
Ouch, thanks for that. I’ll give it a week or so for any more bugs to show up and then push out a new Git version with this and Andrew’s ceil() fix.