Hacking Squeak With Apple MPW

Hans-Martin Mosner hm.mosner at cityweb.de
Sun Jun 6 19:08:27 UTC 1999


"Andrew C. Greenberg" wrote:

> I'd be interested in the experience others have had on other MacOS machines.

I've been compiling Squeak with MPW since its beginning and had mostly good
results.
Coming from a UNIX background, I like MPW's tool architecture, although it's
not quite a Bourne shell.
One thing that I found with MrC (version 4.1.0a2c1) is that at the highest
optimization levels, it produces incorrect code for BitBlt, which is why I
don't use those opt levels. What is really nice about the MPW C library is that
the file operations handle aliases transparently (unlike the CW libs).
My machines are a Performa 6200 (PPC 603, 75 MHz) and a PowerBook 5300cs
(PPC603e, 100 MHz). Although they are kind of slow compared to the recent breed
of PowerPCs, they make very fine Squeak machines (even the Performa, which some
people wouldn't even want to consider as a doorstop).

Andrew, have you found out how to apply the VM patch for MPW-generated VMs?
MrC generates the same unnecessary bounds check for the bytecode switch, only
using LR instead of CTR for the branch. Throwing that out might give you some
of the bytecode level performance you're missing. I've included my version of
the patch method in case you need it.

Hans-Martin

Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="522A6368";
 name="Interpreter cl...chMPWInterp.st"
Content-Transfer-Encoding: 7bit
Content-Description: Unknown Document
Content-Disposition: inline;
 filename="Interpreter cl...chMPWInterp.st"

'From Squeak 2.3 of January 14, 1999 on 6 June 1999 at 8:59:27 pm'!

!Interpreter class methodsFor: 'translation' stamp: 'hmm 2/4/1999 06:46'!
patchMPWInterp: fileName
	"Interpreter patchMPWInterp: 'squeak'"
	"This version is modified for MPW MrC generated VMs"
	"This will patch out the unneccesary range check (a compare
	 and branch) in the inner interpreter dispatch loop."
	"NOTE: You must edit in the Interpeter file name, and the
	 number of instructions (delta) to count back to find the compare
	 and branch that we want to get rid of."

	| delta f code len remnant i instr |
	delta _ 5.
	f _ FileStream fileNamed: fileName.
	f binary.
	code _ Bitmap new: (len _ f size) // 4.
	f nextInto: code.
	remnant _ f next: len - (code size * 4).
	i _ 0.
	instr _ 16r4E800420.
	["Look for a BCTR instruction"
	(i _ code indexOf: instr startingAt: i + 1 ifAbsent: [0]) > 0] whileTrue: [
		"Look for a CMPLWI FF, 5 instrs back"
	       ((code at: i - delta) bitAnd: 16rFFE0FFFF) = 16r280000FF ifTrue: [
	       	"Copy dispatch instrs back over the compare"
			SelectionMenu notify: 'Patching at ', i hex.
			0 to: delta - 2 do: [ :j |
				code at: (i - delta) + j put: (code at: (i - delta) + j + 2).
			].
		].
	].
	f position: 0; nextPutAll: code; nextPutAll: remnant.
	f close.
! !





More information about the Squeak-dev mailing list