Bug 2519 - PowerPC JIT VM is flakey on Mac OS X and Linux.
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Misc
Version: 1.33 SVN
Hardware: Macintosh MacOS X
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2005-12-04 20:00 EST by Zachary J. Slater
Modified: 2007-05-21 11:22:51 EDT
6 users (show)

See Also:


Attachments
fixes crashing issue with vm_ppc_new.c (2.41 KB, patch)
2006-05-28 15:31 EDT, Tony J. White

Description Zachary J. Slater 2005-12-04 20:00:49 EST
If you try to scan for servers, at least on mac os x, you'll crash. Very reproducable.
Comment 1 Ryan C. Gordon 2005-12-04 20:24:46 EST
Crash caused by broken JIT VM...use interpreted VM or native DLLs (if/when they work):

On the command line:
  +set vm_ui 1 +set vm_game 1 +set vm_cgame 1

Let's leave this bug open for now but change the summary.

--ryan.

Comment 2 Tim Angus 2005-12-05 12:40:19 EST
Perhaps OS X should not have HAVE_VM_COMPILED set to true while the ppc vm is broken?
Comment 3 Ryan C. Gordon 2005-12-05 19:16:56 EST
Yes, that is a good idea. svn revision #419 disables it, but this bug will remain open until someone actually fixes it.  :)

--ryan.

Comment 4 Mattias Nissler 2006-03-15 06:27:54 EST
See 2465 for a patch that should work for at least linux/ppc. It's a little dated, I will see whether it works with current SVN.
Comment 5 Tony J. White 2006-04-12 11:04:04 EDT
(In reply to comment #0)
> If you try to scan for servers, at least on mac os x, you'll crash. Very
> reproducable.

See bug 2649 for the fix.  This particular problem is not VM related.
Comment 6 Joshua Root 2006-04-12 17:13:35 EDT
This crash still happens for me after applying the patch from bug 2649 and re-enabling the JIT VM in the Makefile.
Comment 7 Tony J. White 2006-04-19 00:06:21 EDT
(In reply to comment #6)
> This crash still happens for me after applying the patch from bug 2649 and
> re-enabling the JIT VM in the Makefile.
> 

Are you using OSX or linux ppc?

If OSX, do you still get the crash when running this tremulous build?

http://trem.tjw.org/Tremulous-20060413.dmg
Comment 8 Joshua Root 2006-04-19 05:28:13 EDT
(In reply to comment #7)
> Are you using OSX or linux ppc?

OS X (10.4.6).

> If OSX, do you still get the crash when running this tremulous build?
> 
> http://trem.tjw.org/Tremulous-20060413.dmg

No.
Comment 9 Tony J. White 2006-04-19 11:25:55 EDT
(In reply to comment #8)
> (In reply to comment #7)
> > Are you using OSX or linux ppc?
> 
> OS X (10.4.6).

This is the same version I use.  I assume the difference then is in the Xcode version or more precisely the Xcode header files.  I'm using Xcode 2.2 I think.

Can you tell me the output of this command?

grep -A3 _SIZEOF_ADDR_IFREQ /usr/include/net/if.h


> > If OSX, do you still get the crash when running this tremulous build?
> > 
> > http://trem.tjw.org/Tremulous-20060413.dmg
> 
> No.

I guess that narrows this to a build problem not a general problem with the PPC VM.  I think this ticket should probably be closed and bug 2649 reopened.
Comment 10 Joshua Root 2006-04-19 12:17:39 EDT
(In reply to comment #9)
> Can you tell me the output of this command?
> 
> grep -A3 _SIZEOF_ADDR_IFREQ /usr/include/net/if.h

#define _SIZEOF_ADDR_IFREQ(ifr) \
        ((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \
         (sizeof(struct ifreq) - sizeof(struct sockaddr) + \
          (ifr).ifr_addr.sa_len) : sizeof(struct ifreq))

> I guess that narrows this to a build problem not a general problem with the PPC
> VM.  I think this ticket should probably be closed and bug 2649 reopened.

Whatever the cause, interpreted mode is fine while JIT mode crashes, which is what this bug is about.
Comment 11 Tony J. White 2006-04-24 10:23:29 EDT
(In reply to comment #10)
> (In reply to comment #9)
> > I guess that narrows this to a build problem not a general problem with the PPC
> > VM.  I think this ticket should probably be closed and bug 2649 reopened.
> 
> Whatever the cause, interpreted mode is fine while JIT mode crashes, which is
> what this bug is about.

Yes, I was wrong about this being a build problem.  These were indeed seperate issues.  I tracked down my quake3 CD, and I can verify that I have the same vm_ppc_new.c issue with the server browser.  My confusion stemmed from the fact that this crashing does not happen with the server browser in the tremulous ui.qvm.

Comment 12 Tony J. White 2006-05-28 15:31:47 EDT
Created attachment 920 [details]
fixes crashing issue with vm_ppc_new.c

The op codes OP_LEU, OP_LTU, OP_GTU, and OP_GEU were using the "cmp" PPC operator:

http://pds.twi.tudelft.nl/vakken/in1200/labcourse/instruction-set/cmp.html

instead of the "cmpl" operator:

http://pds.twi.tudelft.nl/vakken/in1200/labcourse/instruction-set/cmpl.html

This caused expressions comparing unsigned values to behave unexpectedly.  For example, this one from bg_lib.c:

#define is_digit(c)             ((unsigned)to_digit(c) <= 9)

This patch fixes the crashing issue in the server browser and the Com_sprintf warning spam from the bot code and probably more.
Comment 13 Ryan C. Gordon 2006-05-28 23:03:21 EDT
Definitely fixes issue here. Your patch is in Subversion now, thanks!

--ryan.

Comment 14 Ryan C. Gordon 2007-05-21 11:22:51 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.