[squeak-dev] Re: shared object between main.exe and Squeak.dll

Andreas Raab andreas.raab at gmx.de
Sat May 8 17:01:40 UTC 2010


On 5/8/2010 9:54 AM, Ang BeePeng wrote:
> sqInt primitiveReturnString(void){
> 	sqInt* tempPtr = 0x111EB8D4;
> 	sqInt temp;
>
> 	temp = popStack();
> 	if(isIntegerObject(temp))
> 		dllMemory[dllResult] = temp;
> 	else{
> 		*tempPtr = temp;
> 		dllMemory[dllResult] = temp; //I'm not sure what to do with this yet
> 		addGCRoot(tempPtr);	
                 ^^^^^^^^^^^^^^^^^^^

This is wrong. It needs to be

		addGCRoot(&tempPtr);
                          ^^^

The call takes a variable location (pointer to a pointer). The contents 
of the variable is then updated.

Cheers,
   - Andreas

	
> 	}
> 	pop(1);
> 	interpReturn = 1;
> }
>
> I start up SqueakVM, and execute primitiveReturnString() with a float on top
> of the stack. After this primitive, SqueakVM is allow to run on its own. And
> then I got an access violation, with call stack look like this.
>
> 	Squeak4.dll!markAndTrace(int oop=0)  Line 11883 + 0x3 bytes	C
>   	Squeak4.dll!markPhase()  Line 12221 + 0x9 bytes	C
>   	Squeak4.dll!incrementalGC()  Line 5578	C
>   	Squeak4.dll!instantiateContextsizeInBytes(int classPointer=275821428, int
> sizeInBytes=92)  Line 6218	C
>   	Squeak4.dll!allocateOrRecycleContext(int needsLarge=0)  Line 2553 + 0x10
> bytes	C
>   	Squeak4.dll!interpret(int * sharedMemory=0x0015fabc, int rcvr=0, char *
> selector=0x0015fc54, int arg=1, int result=2)  Line 8485 + 0xc bytes	C
>   	Squeak4.dll!SqueakInterp2(int * sharedMemory=0x0015fabc, int rcvr=0, char
> * selector=0x0015fc54, int arg=1, int result=2)  Line 10 + 0x19 bytes	C
>   	MainProgram.exe!main()  Line 49 + 0x19 bytes	C
>   	MainProgram.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
>   	MainProgram.exe!mainCRTStartup()  Line 403	C
>   	kernel32.dll!76b91194() 	
>   	[Frames below may be incorrect and/or missing, no symbols loaded for
> kernel32.dll]	
>   	ntdll.dll!7767b435() 	
>   	ntdll.dll!7767b408() 	
>
> or sometimes, it is like this:
>
>   	Squeak4.dll!incCompMakeFwd()  Line 5368 + 0xc bytes	C
>   	Squeak4.dll!incCompBody()  Line 5260 + 0x5 bytes	C
>   	Squeak4.dll!incrementalGC()  Line 5588	C
>   	Squeak4.dll!sufficientSpaceAfterGC(unsigned int minFree=202504)  Line
> 23654	C
>   	Squeak4.dll!primitiveNew()  Line 17781 + 0x9 bytes	C
>> 	Squeak4.dll!dispatchFunctionPointer(void * aFunctionPointer=0x100403c5)
> Line 4097	C
>   	Squeak4.dll!interpret(int * sharedMemory=0x001dfd48, int rcvr=0, char *
> selector=0x001dfee0, int arg=1, int result=2)  Line 8458 + 0xb bytes	C
>   	Squeak4.dll!SqueakInterp2(int * sharedMemory=0x001dfd48, int rcvr=0, char
> * selector=0x001dfee0, int arg=1, int result=2)  Line 10 + 0x19 bytes	C
>   	MainProgram.exe!main()  Line 49 + 0x19 bytes	C
>   	MainProgram.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
>   	MainProgram.exe!mainCRTStartup()  Line 403	C
>   	kernel32.dll!76b91194() 	
>   	[Frames below may be incorrect and/or missing, no symbols loaded for
> kernel32.dll]	
>   	ntdll.dll!7767b435() 	
>   	ntdll.dll!7767b408() 	
>
>
> sometimes, it is at remap() as I mention earlier.
>
> At extraRoots[1] I can see 0x111EB8D4, which is still tempPtr. But at
> 0x111EB8D4, I see some non address value which is for example 0x00000002.
>
> Thanks.
>
> Ang Beepeng




More information about the Squeak-dev mailing list