Last Comment Bug 315163 - x86 Mac JEP crashes, no Java
: x86 Mac JEP crashes, no Java
Status: RESOLVED FIXED
[camino-1.0]
: fixed1.8.0.2, fixed1.8.1
Product: Core
Classification: Components
Component: Plug-ins (show other bugs)
: Trunk
: PowerPC Mac OS X
: -- critical (vote)
: ---
Assigned To: Mark Mentovai
:
Mentors:
Depends on:
Blocks: 324651
  Show dependency treegraph
 
Reported: 2005-11-04 18:46 PST by Chris McAfee
Modified: 2006-03-28 12:28 PST (History)
7 users (show)
dveditz: blocking1.8.0.2+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Crash log of JEP when visiting page with an applet (26.93 KB, text/plain)
2005-11-04 18:47 PST, Chris McAfee
no flags Details
Make MRJPluginJEP on x86 functional (46.31 KB, patch)
2006-01-17 12:28 PST, Mark Mentovai
no flags Details | Diff | Review
Make JavaEmbeddingPlugin for Cocoa browsers functional on x86 (9.02 KB, patch)
2006-01-18 11:36 PST, Mark Mentovai
no flags Details | Diff | Review

Description Chris McAfee 2005-11-04 18:46:23 PST
8F1111/i386 (latest seed)

FF1.5rc1/intel/josh-build crashes with JEP 0.9.4+a, crash log to follow.
Comment 1 Chris McAfee 2005-11-04 18:47:30 PST
Created attachment 201899 [details]
Crash log of JEP when visiting page with an applet
Comment 2 Chris McAfee 2005-11-04 18:49:57 PST
We may just need a recompile here, both the josh-firefox binary and the JEP
were pre-8F1111 for me.  We may be getting bitten by either the jni.h or
the dyld problems from earlier 8F* builds.
Comment 3 Chris McAfee 2005-11-04 18:58:29 PST
JEP: 0.9.4+a, steven mailed this to me 10/3/2005
FF15rc1: the binary from josh's blog site:

Firefox (http://josh.trancesoftware.com/mozilla/firefox-1.5.intel.mac.dmg) (2005.10.21, contains patch from bug 312929 (https://bugzilla.mozilla.org/show_bug.cgi?id=312929))
Comment 4 Samuel Sidler (old account; do not CC) 2006-01-16 13:46:00 PST
-> core
Comment 5 Mark Mentovai 2006-01-16 21:13:06 PST
I've got this covered.
Comment 6 Mark Mentovai 2006-01-17 12:28:09 PST
Created attachment 208768 [details] [diff] [review]
Make MRJPluginJEP on x86 functional

Patch against JEP 0.9.5+b, MRJPlugin in-tree portion.  A test build with this plugin is available at http://wiki.mozilla.org/Mac:Intel .
Comment 7 Mark Mentovai 2006-01-18 08:36:19 PST
JEP still doesn't work with Cocoa on x86.  It crashes with an evil $ebp and resultant garbage stack.  Dumping from $esp gave some clues.  At the very least, direct use of objc_msgSend_stret is causing problems because the calling convention varies.

http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_23.html

If [normal objc] is out of the question (I see why it's difficult where it's not used), we can do something like:

#ifdef __ppc__
#define objc_msgSend_stret_NSRect objc_msgSend_stret
#elif defined (__i386__)
static const NSRect (*objc_msgSend_stret_NSRect)(NSRect*, id, SEL, ...) = &objc
_msgSend_stret;
#endif

[...]

objc_msgSend_stret_NSRect(&dirty, self, @selector(_dirtyRect));

These changes prevent $ebp from getting trashed due to not following the ABI and allows something resembling normal flow.  I still see crashes in objc_msgSend_stret called by something in AppKit, usually on something overridden by JEP where JEP calls back into AppKit with objc_msgSendSuper.

I can get the first frame of the applet to display by skipping the call into [NSView _propagateDirtyRectsToOpaqueAncestors].  And I can bypass the crashes entirely by skipping the call into [NSView _drawRect:clip:], but of course nothing draws then.
Comment 8 Mark Mentovai 2006-01-18 09:52:09 PST
Making these calls through [normal objc] allows JEP to function in Camino.
Comment 9 Mark Mentovai 2006-01-18 11:36:54 PST
Created attachment 208885 [details] [diff] [review]
Make JavaEmbeddingPlugin for Cocoa browsers functional on x86

objc_msgSend_stret was the only culprit.  I wasn't able to successfully send messages by calling that function directly, so I adapted it to standard Objective-C and added category interfaces to handle private methods that aren't defined by the system headers.
Comment 10 Mark Mentovai 2006-02-02 19:07:58 PST
A fat JEP has been checked into CAMINO_1_0_BRANCH.  This is JEP 0.9.5+c with x86 bits produced using these patches merged in using lipo.
Comment 11 Mark Mentovai 2006-02-23 11:45:12 PST
This was fixed on the trunk, 1_8, and 1_8_0 branches by checking in a universal JEP 0.9.5+c with these patches in bug 327785.  Bug 327785 contains details about what exactly was checked in.  This bug will remain open until the patches or something else that accounts for the bugs makes it upstream to the JEP.
Comment 12 Mark Mentovai 2006-03-28 12:28:50 PST
This is SO fixed.

Note You need to log in before you can comment on or make changes to this bug.