[squeak-dev] Re: Bug with valueWithReceiver:arguments:

Antoine Marot amarot at ulb.ac.be
Thu Nov 20 14:17:30 UTC 2008


Hi all,

Do you know when this fix will be added in a new squeak vm release ?

I really need it for my thesis... So I tried to build the vm (without  
VMMaker since it doesn't want to be loaded...).

This is how I tried to fix the interp.c file (it's probably wrong  
since this doesn't fix anything) :

sqInt primitiveExecuteMethod(void) {
register struct foo * foo = &fum;
     sqInt top;
     sqInt successValue;
     sqInt primIdx;
     sqInt nArgs;
     sqInt delta;
     sqInt primBits;

	/* begin popStack */
	top = longAt(foo->stackPointer);
	foo->stackPointer -= BytesPerWord;
	foo->newMethod = top;
	/* begin primitiveIndexOf: */
	primBits = (((usqInt) (longAt((foo->newMethod + BaseHeaderSize) +  
(HeaderIndex << ShiftForWord)))) >> 1) & 268435967;
	foo->primitiveIndex = (primBits & 511) + (((usqInt) primBits) >> 19);
	/* begin success: */
	successValue = (foo->argumentCount - 1) == ((((usqInt) (longAt((foo- 
 >newMethod + BaseHeaderSize) + (HeaderIndex << ShiftForWord)))) >>  
25) & 15);
	foo->successFlag = successValue && foo->successFlag;
	if (foo->successFlag) {
		foo->argumentCount -= 1;
		/* begin executeNewMethod */
		if (foo->primitiveIndex > 0) {
			/* begin primitiveResponse */
			if (DoBalanceChecks) {
				nArgs = foo->argumentCount;
				delta = foo->stackPointer - foo->activeContext;
			}
			primIdx = foo->primitiveIndex;
			foo->successFlag = 1;
			dispatchFunctionPointerOnin(primIdx, primitiveTable);
			if (DoBalanceChecks) {
				if (!(balancedStackafterPrimitivewithArgs(delta, primIdx, nArgs))) {
					printUnbalancedStack(primIdx);
				}
			}
			if (foo->successFlag) {
				goto l1;
			}
		}
		activateNewMethod();
		/* begin quickCheckForInterrupts */
		if ((foo->interruptCheckCounter -= 1) <= 0) {
			checkForInterrupts();
		}
	l1:	/* end executeNewMethod */;
		foo->successFlag = 1;
	} else {
		/* begin unPop: */
		foo->stackPointer += 1 * BytesPerWord;
	}
}

Basically, I just added "foo->successFlag = 1;" after /* end  
executeNewMethod */;.

Cheers,

Antoine


> Date: Oct 28, 2008; 12:55am
> Author: Eliot Miranda-2
> Squeak - Dev (http://www.nabble.com/Squeak---Dev-f14154.html)
> Well I actually wrote the fix as
>
> primitiveExecuteMethod
> 	"receiver, args, then method are on top of stack. Execute method  
> against receiver and args"
> 	newMethod := self popStack.
> 	primitiveIndex := self primitiveIndexOf: newMethod.
> 	self success: argumentCount - 1 = (self argumentCountOf: newMethod).
> 	successFlag
> 		ifTrue: [argumentCount := argumentCount - 1.
> 			self executeNewMethod.
> 			"Recursive xeq affects successFlag"
> 			successFlag := true]
> 		ifFalse: [self unPop: 1]
>
> to agree with the perform code.  The fix is to ensure that  
> successFlag is true.
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20081120/eff37017/attachment.htm


More information about the Squeak-dev mailing list