Monday, September 1, 2014

The irregularities of irregexp (plus: the resurrection of thule)

31.1.0 is now released to an adoring public, a little ahead of Firefox which apparently releases on Wednesday but I don't see any reason why we should be delayed.

I also made a major breakthrough over the weekend and irregexp, the regular expression engine Firefox switched to in Fx32, is now generating working JIT code on PowerPC. This involved fixing a couple of undiscovered bugs in our JIT and adding support for the PowerPC byte-swapping load instructions (lhbrx and lwbrx) so that irregexp's inherent little-endian orientation could be worked around on our side. It now passes V8, and I think I can get it passing all the tests in a couple more days. This was a must-complete milestone because without it not only will we be unable to implement our new MIPS-based JIT, but we almost certainly won't make the next ESR. This makes our chances much better.

That's the good news. The bad news is that, at least on V8, it seems to be anywhere from 30 to 50 percent slower on compiled expressions than YARR, which we use in 31 stable. It's always hard to assess final performance on a debug build, but I want to make sure that our use of the byte-swapping instructions is not to blame. It may end up being faster to emit code to do a regular big-endian load and then rotate things around with rlwinm and rlwimi, even though that's two or three more instructions in the I-cache; I'm going to do some more testing with that once I have the test suite passing completely. It doesn't look like it's an emulated instruction on G5, thank goodness.

Those of you on ThinkClassic will have already seen this story, and if you're not on TC you should be, but this weekend thule, my long-running Macintosh IIci NetBSD/mac68k server, finally blew its logic board after fifteen years. Most likely it needs a recap, but the good news is, I already had a spare board with fresh caps in reserve for just such a day and thule is running again. When it was the only server in my apartment, it acted as a cross-development machine for my Commodore 64 programs (the 7300 mounted it over AFP and I ran a cross-assembler on it that emitted binaries the 7300's C64 emulator could pick up and run in the debugger), a small file server and a backup repository. Today, a decade and a half later, it still handles internal DNS resolution and AppleTalk services for the classic pre-OS X machines, and even though a 25MHz '030 is glacial by current standards -- especially since I pulled the L1 cache card to improve its uptime -- it has rendered reliable and sterling service since 1999. I see no reason it won't continue to do so on its new logic board. Here's to another fifteen years of putting a classic to work every day.

Friday, August 29, 2014

31.1.0 available

31.1.0 is now available (downloads, release notes). This incorporates the fixes for trackpad scrolling and Mighty Mouse scrolling, and some changes backported from Fx33/34 to improve overall scrolling performance. It also slightly reduces the latency of the JavaScript JIT compiler which improves SunSpider and V8 by around 0.5-1% (since the improvement is in code generation, it is more noticeable in scripts with short runtimes and microbenchmarks). If you are using the "31.1pre" you should upgrade to this finalized version as it fixes a glitch in rendering and adds the JavaScript changes, as well as the security and stability fixes, of course. Assuming no issues, it will become live on Monday night as usual.

I still don't know what's wrong with irregexp yet. I plan to do more work on that over the long Labour Day weekend.

Monday, August 25, 2014

Status update

Sorry for the radio silence, but I've just been incredibly busy with this and the degree. The patches are down for TenFourFox 33, but it took me about a week to get JavaScript compiling again after most of the old Nitro macroassembler was ripped out and V8 irregexp added to replace YARR as the regular expression engine. The JIT mostly works ... except irregexp, which gets simple patterns wrong and crashes on complicated ones. The issue is probably endian, though running the JIT with native regular expression compilation disabled works fine. However, the performance regression this would cause is not acceptable to ship, so this has to be fixed or we can't advance. Fortunately, I still have over six weeks yet to figure that out.

The MIPS JIT also landed, which is important because it is the architecture Mozilla supports most similar to PowerPC. The MIPS JIT is little-endian, so we still have to account for that, but it's a more conventional RISC instruction set than ARM, has a link register, requires lui/ori to load 32-bit quantities just like we need lis/ori, and has similar requirements for branch stanzas. Moreover, it does not have the technical debt we have accrued getting our JaegerMonkey (Firefox 10-era) JIT working at all with BaselineCompiler, which is the basis of PPCBC; as it stands there are several bugs in full IonMonkey branching and bailouts I can't fix with our current implementation. The MIPS JIT gives me the chance to blow up everything and start over with a template that will be very similar for our own machines, but I have to get 33 working first. If we're really lucky, we can get this in for Fx38, if there is one.

As mentioned multiple times, loss of 10.6 support would hurt us very badly. Mozilla will not do this until Google does in Chrome, though they have made some steps towards removal of support, the most important being that 10.6 is no longer supported as a build platform. (If you had hopes of me creating a TenSixFox, sorry.) The browser currently will still run on 10.6, but is linked against a later SDK. For their part, Chromium is tallying 10.6 specific bugs in their tracker as well as bugs hard to fix with 10.6 support, and it is possible that some future changes for 10.10+ will make it infeasible for them to continue supporting Snow Leopard. Generally this decision comes without warning, as it did for 10.5. I am watching these issues carefully. If the blade does not fall by 37 or 38, and Electrolysis is still not mandatory, we should make it.

31.1 will be out later this week with the scrollpad/Mighty Mouse scroll gestures fix, a tiny tweak to reduce JIT latency and some improvements to scrolling screen performance backported from Fx32 and 33.

Saturday, August 9, 2014

Get your pkgs from the src on PPC

Ob10.4FxNews: about 50% done with the Firefox 33 patches. Not sure if it'll even build yet after the irregexp changes, but we'll see when I have the rest of the changes landed.

One of the things that keeps our Power Macs relevant (besides this project, of course) is a steady stream of ready-to-use open source software; as even 10.6 becomes considered "legacy" this is an even greater concern. In fact, because TenFourFox depends on gcc 4.6 to build (a compiler never shipped with any version of PPC OS X) and various other tools, we wouldn't exist as a project without it.

For years, getting such ported software meant MacPorts (what we currently use here at Floodgap HQ) and Fink, and lately Tigerbrew. However, other than Tigerbrew, which Misty DeMeo specifically targets at PowerPC OS X 10.4, both MacPorts and Fink no longer officially support PowerPC even on 10.5 or only do so on a best-effort basis. Whatever support exists is what's there modulo occasional port updates contributed by nice folks, and as a result I've lately started backing up /opt before I go updating a port lest I endure bustage I can't back out. More to the point, virtually no pre-built MacPorts binary packages remain for 10.4, so every update is an arduous and possibly fruitless build from source code.

So I'm delighted to shamelessly pimp a new alternative which is also available, but based on a very old friend. If you are familiar with the BSD family (I've used NetBSD on 68K Macs and Power Macs since 2000, and to this day I have a NetBSD Macintosh IIci and Cobalt RaQ 1 providing critical services on the internal Floodgap HQ network), you are almost certainly already familiar with pkgsrc, which evolved from the FreeBSD ports subsystem to be the default package manager in NetBSD and is now available on Linux, proprietary Un*ces like Solaris, AIX, HP-UX and IRIX, and even MINIX, Haiku and Cygwin. pkgsrc has also supported Darwin and OS X since 2001, and at least in theory still should build packages on 10.4, but it's all going to be from source now too because the binary packages currently available are for -- you guessed it -- 10.6. And that's assuming they build.

That's where Sevan Janiyan comes in: an up-to-date build of substantial parts of pkgsrc-current for 10.4/10.5 on PowerPC, with pre-built binaries saving you enormous amounts of time. Using his easy-to-follow instructions, install the bootstrap, set your environment up, and start pkg_adding your way to awesome. All the usual suspects are there, including Perl, Python, Ruby, gcc and lots of necessary libraries.

Not everything builds yet, which is why not all the standard packages are available (besides the fact that a G4 Mac mini compiling any large project is generally a pedestrian affair). However, the mini so far has chugged through 1064 out of a queue of 2083 packages over the last week, and fixes are landing for the pieces that don't build yet. Not bad for a little white box on the shelf.

The more package managers we have that work on PowerPC, and the more binary offerings we have available, the better off we'll be and the easier it will be to bring things back up if something fails. So thumbs up to Sevan for another alternative, along with the hard work Misty still does on Tigerbrew and our usual unsung suspects quietly keeping MacPorts and Fink still viable on the platform Apple wishes would just go away.

Monday, August 4, 2014

And now for something completely different: Rhapsody revisited (to go)

My favourite Mac laptop of all time remains the PowerBook 1400, the first laptop I ever owned (I don't count the Commodore SX-64, which would be more likely to damage your lap) and my faithful companion for about five years as a hand-me-down from my brother-in-law, who had recently bought a snow iBook G3 and said that if I could fix the 1400, I could keep it. It turned out to need a new inverter board and LCD, so I just bought a whole new top case for $140 and his 1400c/117 lived again. Since then it picked up an Ethernet card (Nate had already installed a modem card), a new battery, an 8-bit video out card, a full 64MB complement of memory (supplemented by RAM Doubler), a 4GB hard disk and a 333MHz G3 and later a 466MHz G3 CPU board. I eventually transplanted most of it to a new logic board when the old one got flaky, and this reincarnated version still works great where it gets lots of weird looks at the local coffee shop because I put biohazard stickers on the clear cover. The 1400 has the best keyboard of any Mac laptop ever made, the highest marks for modularity and upgradability, and who doesn't like installing a different cover to match your mood?

(By the way, the only major upgrade I'm missing for it is the hard-to-find solar cover, which I've sought for years. If you've got one and your 1400 is dying a slow moldy death in a closet, send me an E-mail. I'm willing to deal.)

Evolutionarily, though, the NuBus architecture in the 1400 made it a dead end and I jumped directly from there to an iBook G4, so I never got to try anything between 9.1 and 10.4 on the road; in fact, I didn't move to OS X until the Jaguar days when I bought the last of the MDDs so I could still boot OS 9. (Ironically, I wound up with Nate's iBook G3 too. It's in a bag waiting for a new backlight.) I never really got to play with Rhapsody back in the day, and when I found a set of Mac OS X Server v1.2 CDs on sale, I knew I had a use for another PowerBook I'd picked up along the way: a PowerBook G3 Wallstreet II, also known as the PDQ.

This one was a university castoff from up in the Bay Area, where it was ending its days acting as a sync station for a Newton that had long since found another home. It was quietly leaked to me, where I refurbished it, cleaned up the case, got it a RAM upgrade and a new battery, and then put it in the closet and forgot about it until I discovered the Wally G3 was the best portable Rhapsody workstation ever made. Consider: it's bootable (hardly guaranteed with Rhapsody), it supports 24-bit colour at 1024x768, and it supports all the standard internal devices that Rhapsody did, including the optical drive and network. Previous G3 PowerBooks (and the 2400c, 3400c and clamshell iBook) only run at 800x600, and not only does the Lombard only work at 256 colours, you have to swap optical drives to get it to install and discs to mount if you have a DVD-ROM unit. And you can forget about the Pismo or any G4 PowerBook -- it won't boot at all.

Rhapsody really is the closest thing to pure NeXTStep that ever ran on a PowerPC-based computer (NeXT never ported it to the Power Mac back in the day), but as you can see from the screen shot (besides the 2014 date which I swear is not Photoshopped; the OS apparently puts the current year in the copyright string) it does so with a not-quite-100% veneer of Platinum. I say it's not 100% because it puts a dot in the close gadget when a window is dirty, like NeXTStep and OS X both do but OS 9 never did; there is no true Finder in the Classic sense (certainly not the lovely spatial one we loved); and their Charcoal font has some peculiarities from the nice regular version in the real OS 9. But it makes the OS seem so clean and beautiful that I can almost forgive the ugly huge desktop icons.

Having a mobile Rhapsody is great from a computing archaeology perspective. I don't have to dedicate a seat to it and I can throw it on a project table if I want to work with it. I theorize that the Apple developers wanted to do their work on a laptop too and snuck partial support in so that they could, and at least with respect to Rhapsody 5.6 (v1.2), it works well enough for that purpose.

It hasn't aged completely well, though. Some older file archive sites have Rhapsody-compatible software, but there's not a lot of it. OmniWeb 3 is appallingly old by modern web standards, mostly Netscape Communicator 4-era in terms of what it supports (no CSS of any kind), and the only compiler is Apple's hacked gcc -- which doesn't build modern Cocoa software because not all the libraries are there, and doesn't build old Carbon software because Rhapsody doesn't have Carbon! Classilla does run ... but only within the Blue Box emulation layer, which is both better and worse than Classic. It's better in that it's incredibly fast compared to the double-buffered Classic of 10.3 and 10.4, almost native speed, but worse in that it is extremely badly integrated into the OS, can only run up to 8.6, and only runs full screen (although this may be partially why screen updates are so speedy -- it doesn't have to composite any windows). While I wanted to do more with Rhapsody, I found I was spending most of my time in the Blue Box, so I ended up repartitioning the hard disk so I had a 9.2.2 partition on it as well, and the default Blue Box disk image was too small, so I ended up copying it to the 7300 and having Disk Copy make it larger. (No, you can't do this in Rhapsody itself. WTF. Though having the whole of the Blue Box environment in a disk image is very convenient for backups.)

Which leads me to some annoyances about a portable Rhapsody installation specifically. First, there's no power management. The CPU runs full speed, no throttling, no cycling. There's no battery gadget for you to monitor how much time you have left (I'm sure there must be a way to check the battery through the I/O system, but I haven't found it yet). If you close the lid, the machine doesn't sleep, because there's no sleep support of any kind: you're either fully powered up or fully powered down. That's it.

If the battery runs out, and like most PowerBooks of this age the PRAM battery doesn't hold much of a charge anymore, I found out the hard way that Rhapsody becomes unbootable (more accurately, PRAM gets whacked, and the first-stage bootloader is not a normal "Toolbox-style" Open Firmware booter, so the Mac fails to start the operating system). Fortunately, OS 9.2.2 can fix this. When I set it up to dual-boot, and the original battery was flat, it automatically started OS 9. I rebooted it once (if you don't do this, Startup Disk will hang) and went to the Startup Disk control panel, and it saw the Rhapsody partition and offered it as a choice. Whew! You can force the Rhapsody bootloader to boot something else by holding Option down as you power on the machine, by the way, and Rhapsody will see the OS 9 partition (just not vice versa except as a startup choice). It's interesting how dependent Rhapsody is upon Mac OS 9 to be fully functional, just like 10.0 and 10.1 were.

There are also some other general annoyances with Rhapsody as a daily driver besides the dearth of software. In addition to the default Blue Box image being too damn small (after you run it for the first time, copy it from /Local/Library/MacOS/Users/your user name/StartupDisk.img to your OS 9 partition and let Disk Copy enlarge it; here are some tips on that), if you leave a CD in the optical drive when the machine boots, then you have to be root to eject it. This led to a lot of cussing until I figured out what was going on, which was worsened by the weird way the OS handles volumes (/Local?) and sometimes keeps ghosts of them around. And while the detachable menus are neat, they have a habit of detaching rather easily; fortunately Apple ditched this for the OS X Public Beta.

But Rhapsody was revolutionary at the time, and I can see why. It almost promised a nearly seamless transition from the Classic age to the NeXT one, even with the same skin and basic appearance. It would be hard for me to work in it compared to OS 9, let alone Tiger, and I really need to do something about that compiler, at least, but now I've got a little Rhapsody to go when my curiosity gets piqued and I can enjoy what might have been any time I want. So here's to you, Wally. Job well done.

Retracting the statistics post

Some of my recent numbers are causing me to consider my previous estimates unreliable. I'm retracting our previous statistics post and I will put up a revised one with hopefully solid numbers in a month or two when I am satisfied everything has settled down.

Saturday, July 26, 2014

We miss Power Computing

The 31 launch went off mostly without a hitch, though the interface has jarred a few people because almost all of the vestiges of the old pre-Firefox 4 interface are now gone. However, the overall improvements in 31 I think do ultimately exceed its drawbacks.

The only significant non-cosmetic issue right now is issue 283, which made trackpad and Mighty Mouse scrolling abnormally slow (scrolling with the scroll bar or with a regular USB mouse scrollwheel works fine). This was because of a workaround for Lion code that didn't take account of the right selector. If you have a PowerBook or iBook affected by this, there is a test build available for you (7450 only). This appears to fix the problem and will be officially part of 31.1.

The test build also has the patches from issue 284 which fix certain rendering errors and improve performance with extra-tall gradients and/or opaque background scrolling. These are part of Firefox 32+ but they're not going to be backported to ESR, so I went ahead and adapted them since they do affect our primarily software-based graphics stack and they will also be in 31.1. You're welcome to try it on a 7450 system if you like; I didn't bother making other test builds since the only systems supporting trackpad scrolling are the late-model PowerBooks and iBooks, all of which are 7450-series G4 CPUs.

In the propaganda department, I picked up this rare but classic poster from kootenaymac (who also has a link to TenFourFox, thanks!; saturation up since the lights washed the photo out a bit):

For those of you in the younger set, you may not remember how aggressive Power Computing was back in the day, probably the most successful and certainly the most visible of the doomed Mac clone companies. Steve Kahng was notorious for beating Apple to the fastest PowerPC chips because of his history with IBM from his Leading Edge days (remember those?), introducing the 225MHz 604e PowerTower Pro in July 1996 which was faster than any other personal computer at the time. Apple could not beat it until the 300MHz 8600/9600 in 1997, and I think that's what scared Cupertino the most; Steve Jobs bought them out and cancelled the license when he returned to Apple. Power Computing even had a laptop ready to go, and G3-based systems, none of which Apple ever let them release.

Their marketing was as controversial as their sales tactics and as impactful as their technology -- lots of paramilitary themes, handguns and of course Sluggo, all done by artist Frank Kozik and engineered by marketing "weasel" Mark Rosenfelt. The Sluggo poster bought them a famous lawsuit from the original artist when it showed up at MacWorld Expo 1996 in Boston, and PowerComputing lawyers made the floor staff take down the posters and stop handing them out. So, of course, it's my favourite of a great number of great ads, and I'm delighted to finally own one because there are very few out and about. It's hanging in my server room with space for the G5 poster they're sending me too.

I put Sluggo as an easter egg in early versions of Classilla and since then every release of TenFourFox has had a version, updated for the times. See if you can find it. (Don't spoil the surprise in the comments!)

I'm planning to see how viable 33 is next week, and I'm working on the annual statistics post in the meantime, because I have no life.