SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

SYSTEM WARNING: Creating default object from empty value

Mantis - Squeak
Viewing Issue Advanced Details
5688 VM crash always 12-30-06 20:51 03-08-09 13:36
lewis  
tim  
normal  
closed  
fixed  
none    
none 3.9  
0005688: VM crash due to SmartSyntaxPluginCodeGenerator>>generateCPtrAsOop:indent:
On a 64-bit host (e.g. 64 bit Linux), the VM will crash when attempting to connect to SqueakMap. This is caused by SmartSyntaxPluginCodeGenerator>>generateCPtrAsOop:indent: (in VMMaker 3.8b6), which fails to account for sqMemoryBase when deducing an oop from a pointer. Fix attached.
has duplicate 0006739closed tim Problems with images under 64-bit 
has duplicate 0006344closed lewis Crash while updating SqueakMap 
has duplicate 0006631closed lewis crash while connecting to SqueakMap 
child of 0006671closed tim Build VMMaker for 3.9 
 Fix64BitSmartSyntaxPluginCodeGenerator-dtl.1.cs.gz [^] (519 bytes) 12-30-06 20:51
 Fix64BitSmartSyntaxPluginCodeGenerator-0005688-tpr-dtl.cs [^] (954 bytes) 09-19-07 01:39

Notes
(0008782)
lewis   
12-31-06 20:40   
Additional notes: sqMemoryBase is defined only when building the 64 bit host/32 bit image combination. The patch I provided makes an explicit reference to sqMemoryBase, and this works fine on Linux (both 32 bit and 64 bit host) even if the SocketPlugin is built as an external plugin. However, I am not confident that it will work properly on other platforms, and I tested only on Linux.

Presumably it would be better to make sqMemoryBase visible through the interpreterProxy struct, rather than relying on an explicit reference (but this requires bumping the VM_PROXY_MINOR version), or alternatively make it a variable in ObjectMemory. But perhaps it would be better to just get rid of #cPtrAsOop entirely, and update all the effected plugins?
(0011136)
tim   
09-17-07 20:51   
Dave's code is:-
generateCPtrAsOop: aNode on: aStream indent: anInteger
    "sqMemoryBase is declared as (char *) in platforms/Cross/vm/sqMemoryAccess.h"

    aStream nextPutAll: '((usqInt)(long)((char *)'.
    self emitCExpression: aNode receiver on: aStream.
    aStream nextPutAll: ' - sqMemoryBase ) - ';
         nextPutAll: ObjectMemory baseHeaderSize printString;
         nextPut: $)

Which as mentioned explicitly refers to sqMemoryBase. I'm going to suggest indirecting that just a little to use the pre-existing oopForPointer()

generateCPtrAsOop: aNode on: aStream indent: anInteger
    "derive the proper Oop for a C ptr - use oopForPointer to deal with any base offset"

    aStream nextPutAll: '((usqInt)(long)((char *)'.
       aStream nextPutAll: 'oopForPointer( '.
    self emitCExpression: aNode receiver on: aStream.
    aStream nextPutAll: ' ) - ';
         nextPutAll: ObjectMemory baseHeaderSize printString;
         nextPut: $)
(0011137)
lewis   
09-18-07 00:22   
Using oopForPointer() sounds right to me.
(0011138)
tim   
09-18-07 01:58   
I don't suppose you'd like to hack your code base to try it out while I get on with the miserably delayed putting-together-stuff-wot-others-wrote part?
(0011143)
lewis   
09-18-07 11:03   
I'll check it out on 32 and 64 bit host configurations, but I will be out of town and may not get to it until next week (will respond by Sept 26 at the latest though).
(0011146)
lewis   
09-19-07 00:45   
The oopForPointer() change works fine on H32/I32 and H64/I32, modulo a missing close paren, but I did not test H32/I64 or H64/I64. However this leaves a bunch of slimey typecasts in the method that probably are not necessary. Will try to fix this next week when I get home, mean time I suggest just apply my first change set if you want to update VMM right away, or wait until next week and I'll check it properly.
(0011147)
lewis   
09-19-07 01:47   
Update attached: Fix64BitSmartSyntaxPluginCodeGenerator-0005688-tpr-dtl.cs

This has the oopForPointer() fix plus deuglifier ointment to remove extraneous type casts.

Tested on H32/I32, H32/I64, H64/I32, H64/I64. Confirmed that the VM crash problem is gone for H64/I32.

Ship it.

(0011596)
tim   
12-27-07 23:58   
In VMMaker-tpr.65
(0013023)
lewis   
03-08-09 13:36   
Included in VMMaker-tpr.65 on SqueakSource VMMaker