Poster | Thread |
samo79
| |
Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 7:56:32
| | [ #1 ] |
|
|
|
Elite Member |
Joined: 13-Feb-2003 Posts: 3505
From: Italy, Perugia | | |
|
| There is an interesting project for PPC (Mac) that may be interesting also for the future Timberwolf, read it:
Quote:
Enter the nanojit One of Mozilla's marquee features in Firefox 4 is ever-faster JavaScript. Of course, the real speed gains are only to be had on their officially supported architectures, which now only includes x86, x86_64 and ARM, because of modern JavaScript interpreters' heavy dependence on just-in-time compilation. (See also Google's work on this for Chrome, which naturally is also Intel and ARM ISAs only.) Since PowerPC is the old and busted and x86 is the old yet new hotness, x86 gets the goodies. This doesn't mean that the pure-C++ version of Fx 4's JavaScript interpreter is a slouch (and Fx 4 is faster than Fx 3.6, plus our own compiler juicing, of course), and there is JIT support in Firefox for other architectures such as SPARC even though Mozilla does not consider SPARC a tier 1 platform. Which brings us to PPC JIT.
Some terminology: the pure C (and now C++) JavaScript interpreter is properly called SpiderMonkey and descends directly from Brendan Eich's work when he was at Netscape. All Mozilla derivatives use it; Classilla uses the last C version which was in Firefox 3.0.19, and so does Camino, while SeaMonkey and Firefox use the C++ version which was introduced in 3.5 with TraceMonkey. TraceMonkey's key addition to SpiderMonkey is a clever piece of code called the nanojit, which watches execution through code paths and remembers the "trace" (hence the name). That trace is in fact generated as direct machine code, and run as such, so it is very fast. However, the nanojit is unable to effectively optimize certain types of code, notably code with evals in it and code with many type combinations, and it must run the program to a certain extent to determine what code is "hot" (so very branchy code causes the tracing JIT to give up, because it would use too much memory and CPU time to figure out where the hotness lays). To handle those cases, Mozilla added JägerMonkey to Firefox 4.0, which is a true method JIT, borrowing the assembler that powers it (Nitro) from the enemy WebKit. Naturally, it is also limited to the currently supported architectures.
So that's our year in review; now for the diplomatic cables. If you look in the nanojit, you see tons of files for lots of architectures, including x86 (of course), ARM, SPARC, even MIPS, and of course PPC. Great, you say, the nanojit in Firefox seems to generate PowerPC code. Then you look at the configuration scripts and your heart sinks:
PowerPC nanojit doesn't get compiled or included in Firefox 3.5 or 3.6.
But wait, I hear you cry! The code is there, right? What's NativePPC.cpp for? Well, it's truly part of the nanojit, but it is incomplete. While it works as part of Tamarin, which is Adobe's implementation of ActionScript (and is indeed part of PPC Flash Player), it does not support enough instructions to work as part of Firefox or in fact any Gecko browser, and this is why your red-hot quad 2.5GHz G5 still benches slower on SunSpider than a measly Pentium 4: the P4 gets native code, we don't.
Well, that's about to change. With big thanks to Edwin Smith at Adobe who put up with my constant queries, I'm proud to announce that we're making progress on doing the obvious: expanding the PowerPC nanojit so it can be used as part of TenFourFox. Ed helped me out with some of the fiddly aspects, and we're now full speed ahead on implementing the LIR instructions needed to fully support the length and breadth of JavaScript that the Mozilla framework requires. Already it is passing most of the LIR assembler tests, and when it passes all of the supported ones, I'll start work on integrating it with the main browser. At the end of this, we'll pass our work back to Mozilla so it can be a part of Firefox, if they want it.
When will you get to play with the new hotness, and how much faster will it get? Conservatively, you can expect up to 2-3x improvement on many JavaScript benchmarks, possibly more. This is still not enough to reach x86 parity because we don't implement the method JIT (yet: more on that later when that work actually commences, if it's possible -- TraceMonkey depends heavily on Nitro, so we'll have to see how feasible such a port would actually be). However, it is still dramatically faster and wrings that much more performance out of our beloved machines. More to the point, it will work on any supported TenFourFox processor architecture.
However, when you'll get it is another matter. While this might be ready for beta 9 or 10, such a massive sea change requires heavy testing and may have subtle bugs, so it may sit 4.0 out and appear in 4.1, or it may appear in a later beta. I'll post more about this later when I have enough testing data to decide, but I've got enough working code already that I couldn't resist a little tease for y'all. Great things are afoot! |
http://tenfourfox.blogspot.com/ http://tenfourfox.blogspot.com/2010/12/enter-nanojit.html_________________ BACK FOR THE FUTURE
http://www.betatesting.it/backforthefuture
Sam440ep Flex 800 Mhz 1 GB Ram + AmigaOS 4.1 Update 6 AmigaOne XE G3 800 Mhz - 640 MB Ram - Radeon 9200 SE + AmigaOS 4.1 Update 6 |
|
Status: Offline |
|
|
K-L
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 9:42:33
| | [ #2 ] |
|
|
|
Super Member |
Joined: 3-Mar-2006 Posts: 1427
From: Oullins, France | | |
|
| @samo79
Very interesting. I'm pretty sure Hand Joerg and Thomas could even give a hand on this project to this developper. _________________ PowerMac G5 2,7Ghz - 2GB - Radeon 9650 - MorphOS 3.14 AmigaONE X1000, 2GB, Sapphire Radeon HD 7700 FPGA Replay + DB 68060 at 85Mhz |
|
Status: Offline |
|
|
TiredofLife
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 11:40:28
| | [ #3 ] |
|
|
|
Super Member |
Joined: 6-Jul-2005 Posts: 1704
From: Here | | |
|
| @samo79
This is now included with the browser, now at beta 11. Last edited by TiredofLife on 13-Feb-2011 at 11:40 AM.
_________________ If your nose runs and your feet smell, you're upside down. |
|
Status: Offline |
|
|
nubechecorre
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 11:44:11
| | [ #4 ] |
|
|
|
Cult Member |
Joined: 21-Nov-2003 Posts: 895
From: San remo -Italy- | | |
|
| |
Status: Offline |
|
|
TiredofLife
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 12:15:51
| | [ #5 ] |
|
|
|
Super Member |
Joined: 6-Jul-2005 Posts: 1704
From: Here | | |
|
| @nubechecorre
Not sure what you mean by official. If you mean it's really happening then yes, it's official.
It was available to switch on in beta 10 and was switched ob ny default in beta 11. _________________ If your nose runs and your feet smell, you're upside down. |
|
Status: Offline |
|
|
jPV
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 12:21:42
| | [ #6 ] |
|
|
|
Cult Member |
Joined: 11-Apr-2005 Posts: 830
From: .fi | | |
|
| Quick test with SunSpider and current PPC browsers on Mac mini 1.42GHz:
1. OWB/MorphOS 3909.3ms 2. Safari/OSX10.4 6171.0ms 3. Firefox/OSX10.4 8069.9ms 4. Opera/OSX10.4 8533.4ms
Detailed results and more results on different PPC platforms.
_________________ - The wiki based MorphOS Library - Your starting point for MorphOS - Software made by jPV^RNO |
|
Status: Offline |
|
|
billt
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 13-Feb-2011 13:55:11
| | [ #7 ] |
|
|
|
Elite Member |
Joined: 24-Oct-2003 Posts: 3205
From: Maryland, USA | | |
|
| @K-L
Quote:
I'm pretty sure Hand Joerg and Thomas could even give a hand on this project to this developper. |
How many hours are in their day over there? I'm sure they have the smarts for it, but I can't figure out how they do everything they already do because of time and there only being two of them Maybe if they were quadruplets or something..._________________ All glory to the Hypnotoad! |
|
Status: Offline |
|
|
ClassicHasClass
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 20:38:13
| | [ #8 ] |
|
|
|
New Member |
Joined: 13-Feb-2011 Posts: 2
From: Electron Alley | | |
|
| Quote:
If you mean it's really happening then yes, it's official. |
Hi, TenFourFox maintainer here (an associate spotted this thread and asked me to comment).
The nanojit is a fully-fledged part of 10.4Fx beta 11 and is turned on by default for all processor families. It is altered somewhat for G5/PPC 970 due to significantly different performance characteristics, but I'm not aware of a PowerPC 970-based Amiga. If it's anything like Power Mac and iMac G5s, it would be a tank anyway
What it is not is part of the Mozilla tree ... yet. It has been submitted back to them as Bugzilla bug 624164. That just covers the code generator; it does not enable it in the build. That's done by altering the configure script and you can see how it was done for TenFourFox in the changesets.
I was very interested when I heard about Timberwolf at the Commodore Vegas Expo last year and got to play with it on a SAM 440ep. Obviously it was not as polished as Origyn but I'm very pro-Mozilla and it's nice to see Gecko on AmigaOS.
The nanojit is likely to perform very well on PPC Amigas as most of them descend from 60x or 74xx cores in their family tree, and the G3 and G4 easily crush SunSpider in half. However, it will not apply to Timberwolf as is as there are some changes in the LIR originally used in Fx 3.5. Between 3.6 and 4.0 Mozilla and Adobe rewrote several LIRops; it would be instructive to diff NativePPC.cpp between 3.6 and 4.0 so you can see what was altered. The other thing to do is to take what was learned for 3.5 and apply it to 4.0, because there are so many changes in Gecko 2.0 that it will seriously hurt maintainability to be stuck with Mozilla 1.9.x. Just my opinion as a community hacker.
For those interested in hard numbers, look at the graph on the TenFourFox main page. This is for a G4 in Leopard. The numbers are simply raw out of the browser with no manipulation. It really makes a huge difference.
If any MorphOS developers read this thread, I would love to get MorphOS running on my idle iBook G4s. If it runs on G4 Mac minis, I can't imagine why it would be difficult to get it to run on iBooks as the hardware is nearly identical, and I'd love a portable Miggy.
Hope that gives you guys some food for thought. It's nice to see the Amiga still trucking. |
|
Status: Offline |
|
|
Mechanic
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 20:55:39
| | [ #9 ] |
|
|
|
Elite Member |
Joined: 27-Jul-2003 Posts: 2007
From: Unknown | | |
|
| |
Status: Offline |
|
|
_Steve_
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 21:05:28
| | [ #10 ] |
|
|
|
Team Member |
Joined: 17-Oct-2002 Posts: 6814
From: UK | | |
|
| @ClassicHasClass
Welcome to the site, and thank you for the informative posting on your Mac project. _________________ Test sig (new) |
|
Status: Offline |
|
|
Hans
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 21:12:29
| | [ #11 ] |
|
|
|
Elite Member |
Joined: 27-Dec-2003 Posts: 5098
From: New Zealand | | |
|
| @ClassicHasClass
Welcome, and thanks for the info.
Quote:
The nanojit is likely to perform very well on PPC Amigas as most of them descend from 60x or 74xx cores in their family tree, and the G3 and G4 easily crush SunSpider in half. However, it will not apply to Timberwolf as is as there are some changes in the LIR originally used in Fx 3.5. Between 3.6 and 4.0 Mozilla and Adobe rewrote several LIRops; it would be instructive to diff NativePPC.cpp between 3.6 and 4.0 so you can see what was altered. The other thing to do is to take what was learned for 3.5 and apply it to 4.0, because there are so many changes in Gecko 2.0 that it will seriously hurt maintainability to be stuck with Mozilla 1.9.x. Just my opinion as a community hacker. |
IIRC, the Friedens are already migrating to Firefox 4. I'm sure that someone else will dig up the relevant posts about that.
Hans
_________________ Join the Kea Campus - upgrade your skills; support my work; enjoy the Amiga corner. https://keasigmadelta.com/ - see more of my work |
|
Status: Offline |
|
|
samo79
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 21:47:23
| | [ #12 ] |
|
|
|
Elite Member |
Joined: 13-Feb-2003 Posts: 3505
From: Italy, Perugia | | |
|
| @ClassicHasClass
Welcome to Amigaworld and congrats for your project !
_________________ BACK FOR THE FUTURE
http://www.betatesting.it/backforthefuture
Sam440ep Flex 800 Mhz 1 GB Ram + AmigaOS 4.1 Update 6 AmigaOne XE G3 800 Mhz - 640 MB Ram - Radeon 9200 SE + AmigaOS 4.1 Update 6 |
|
Status: Offline |
|
|
pavlor
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 22:23:03
| | [ #13 ] |
|
|
|
Elite Member |
Joined: 10-Jul-2005 Posts: 9636
From: Unknown | | |
|
| @ClassicHasClass
Welcome! |
|
Status: Offline |
|
|
ClassicHasClass
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 14-Feb-2011 23:51:03
| | [ #14 ] |
|
|
|
New Member |
Joined: 13-Feb-2011 Posts: 2
From: Electron Alley | | |
|
| Thanks for the kind welcome, everyone
I should mention one other thing: there were a couple small tweaks I made in the shipping nanojit, including a bad patch pointer in the overflow instruction generator. You can get that out of the changesets -- I'm waiting for Rich to give me a pointer about how he wants label swap locking implemented before I regenerate a new patch for that Bugzilla thread.
The real trick will be CodeAlloc.cpp and that is OS-specific -- I don't know much AmigaOS or MorphOS to advise, unfortunately. That's the piece that allocates blocks in memory for the nanojit to write into, flushes the I and D caches, etc. I do have some code in NativePPC.cpp for flushing the I cache, which could be adapted, but memory management would be OS-dependent. |
|
Status: Offline |
|
|
NutsAboutAmiga
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 15-Feb-2011 0:10:09
| | [ #15 ] |
|
|
|
Elite Member |
Joined: 9-Jun-2004 Posts: 12932
From: Norway | | |
|
| |
Status: Offline |
|
|
Zylesea
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 15-Feb-2011 1:18:58
| | [ #16 ] |
|
|
|
Elite Member |
Joined: 16-Mar-2004 Posts: 2263
From: Ostwestfalen, FRG | | |
|
| @ClassicHasClass
Quote:
ClassicHasClass wrote:
If any MorphOS developers read this thread, I would love to get MorphOS running on my idle iBook G4s. If it runs on G4 Mac minis, I can't imagine why it would be difficult to get it to run on iBooks as the hardware is nearly identical, and I'd love a portable Miggy. |
Unfortunately MorphOS currently does not run on iBooks. There are very similar models to the Mac mini, but some things differ though (I think it is mostly input devices, battery, audio and display control). Dunno exactly though. The only Apple laptops supported soon are the 1.67 GHz 15" & 17" models as well as those 1.5 GHz models that use usb for kbd/tp. It is a matter of resources to support more._________________ My programs: via.bckrs.de MorphOS user since V0.4 (2001) |
|
Status: Offline |
|
|
amigadave
| |
Re: Firefox 4: Javascript acceleration for PowerPC Posted on 17-Feb-2011 3:53:49
| | [ #17 ] |
|
|
|
Super Member |
Joined: 18-Jul-2005 Posts: 1732
From: Lake Shastina, Northern Calif. | | |
|
| @ClassicHasClass,
Welcome to AmigaWorld! I like your nick.
Which model iBook do you have? If it is the last model made, the 1.42GHz w/ 14" LCD, I believe that model has USB keyboard/track pad and might some day be supported by MorphOS, but as Zylesea stated, the initial portable support that is being worked on is only for a few models of the G4 PowerBook that have USB keyboard/track pad interfaces. (I purchased a 17" widescreen, 1.67GHz G4 PowerBook last Summer in preparation of being able to run MorphOS2.x on it, hopefully later this year).
Another option that is almost as portable is any of the G4 MacMini models. They are very portable, with the only limitation being that they don't run on battery power.
It would be great to see work started on Firefox 4 being ported to MorphOS2.x, even though OWB is an excellent browser that performs very well right now for MorphOS users.
_________________ Amiga! The computer that inspired so many, to accomplish so much, but has ended up in the hands of . . . . . . . . . . |
|
Status: Offline |
|
|