[Vm-dev] Mac PPC Carbon VM resuscitation part 2: status and two questions

Tim Johnson digit at sonic.net
Sat Jul 25 18:02:17 UTC 2020

Hi all,

Continuing down the dusty road of bringing the Mac Carbon VM back to  
life on PowerPC for research and educational purposes.  Here's a  
status update and two questions.

First, status update:
I've concluded that the VM will continue to build with very few  
changes up to VMMaker 4.4.14, but then a VM that locks up at  
interpret() as of 4.4.15.  I then fast-forwarded to VMMaker 4.7.8 and  
again have a working VM.  But, this has required a few changes to  
methods and I have had to stop building a few more plugins (to be  
expected, I think!), namely B3DEnginePlugin and  
SoundGenerationPlugin.  The VM built with VMMaker 4.7.8 passes more  
tests in Squeak 4.6 than those built with previous versions, but also  
happens to be failing one test which may be consequential:   

I've been working lately within a 4.6 image converted to 6504 format  
(thanks for the tip, Dave!).  Note that my build product, even at  
4.7.8, still can't natively launch & interpret a 6505-format image  
like the release version of 4.6 from files.squeak.org.  Nor can it  
launch & interpret Squeak5.2-V3-18216.image.  Squeak5.2-V3-18216.image  
is already in 6504 format, so I suspect something else to be at fault  
(I just force-quit it now, and found it having trouble at  
_primDigitMultiplyNegative and _cDigitMultiplylenwithleninto).  May be  
worth further research on my part.

By VMMaker 4.7.8, my VM build workspace is as follows:

vmm := (Smalltalk at: #VMMaker) default.
" We can't cascade here.  Maybe was fixed in later versions."
vmm deleteEntireGeneratedTree.
vmm makeAllModulesInternal.
vmm internalModules removeAll: #( ADPCMCodecPlugin B3DEnginePlugin  
ClipboardExtendedPlugin CroquetPlugin FFIPlugin FloatMathPlugin  
FileCopyPlugin ImmX11Plugin LocalePlugin Mpeg3Plugin QuicktimePlugin  
SlangTestSupportSSIP SlangTestSupportPlugin SoundGenerationPlugin  
vmm generateEntire.
((Smalltalk at: #Gnuifier) on: (FileDirectory default fullName), '/src/ 
vm') gnuify.

The script I used for getting a VMMaker build image going in a "stock"  
Squeak 4.5/4.6 image is attached.   It was based off of (and, I  
believe, clarifies or codifies) the instructions found in platforms/ 
Mac OS/vm/Documentation/readme.txt  re: proper load order.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: VMBuilder.st
Type: application/octet-stream
Size: 1358 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200725/b043ff1c/attachment.obj>
-------------- next part --------------

Question 1:

uses usqLong which wasn't defined in any of my platform support code:

value := 0 - (self cCoerce: value to: 'usqLong').

I changed it to:

value := 0 - (self cCoerce: value to: 'unsigned sqLong').

...does that seem equivalent?

Should I have usqLong defined somewhere in my platform support code?   
It is used more heavily in opensmalltalk-vm, but I can't seem to find  
where it is defined over there, either.

Question 2:

was introduced in VMMaker 4.4.20 (VMMaker-dtl.233) and later bugfixed  
in VMMaker 4.5.3 (VMMaker-dtl.239)

However, this method calls "self error:"  as follows:

	firstLen <= thirdLen ifFalse: [^self error: 'firstLarge must be less  
than thirdLarge'].
	secondLen <= thirdLen ifFalse: [^self error: 'secondLarge must be  
less than thirdLarge'].
	(mInv >= 0 and: [mInv <= 255]) ifFalse: [^self error: 'mInvMod256  
must be between 0 and 255'].

which results in an undefined symbol _error when building this VM.

What would be the proper way to address this?  Find a place to  
implement error() in the VM cross/ or platform/ sources (or steal from  
newer support code)?  Or to change the call to self error: to  
something else?

To get the VM building, I've just hand-patched LargeIntegers.c as  

if (!(firstLen <= thirdLen)) {
	/* return error("firstLarge must be less than thirdLarge"); */
	return interpreterProxy->success(false);
if (!(secondLen <= thirdLen)) {
	/* return error("secondLarge must be less than thirdLarge"); */
	return interpreterProxy->success(false);
if (!((mInv >= 0) && (mInv <= 255))) {
	/* return error("mInvMod256 must be between 0 and 255"); */
	return interpreterProxy->success(false);

Lastly:  I'm tempted to ask if anybody ever tried controlling the  
Xcode project via AppleScript, back when Xcode was still a big part of  
building the Mac or iOS VM.  Maybe maximum effort with minimum payoff,  
but could be interesting or fun to automatically enable/disable plugin  
sources based on VMMaker(Tool) selections, and automatically trigger  
build/clean from within the Squeak image.

a Tim

More information about the Vm-dev mailing list