[Vm-dev] Cog on Mac. Problems with mprotect()?

Igor Stasenko siguctua at gmail.com
Mon Dec 6 14:52:55 UTC 2010


OK, i changed

interpreterAllocationReserveBytes
	| availableBytesPerPage maxFramesPerPage |
	availableBytesPerPage := self stackPageByteSize - self
stackLimitOffset - self stackPageHeadroom.
	maxFramesPerPage := availableBytesPerPage / BytesPerWord // MFrameSlots.
	^2 raisedTo: (maxFramesPerPage * LargeContextSize * numStackPages) highBit

to:

interpreterAllocationReserveBytes
	| availableBytesPerPage maxFramesPerPage |
	availableBytesPerPage := self stackPageByteSize - self
stackLimitOffset - self stackPageHeadroom.
	maxFramesPerPage := availableBytesPerPage / BytesPerWord // MFrameSlots.
	^2 << ((maxFramesPerPage * LargeContextSize * numStackPages) highBit -1)


which is equal, except that latter its not using pow() function and
somehow this no longer crashing the VM.
The only conclusion i can make that this is really have nothing to do
with mprotect() and other mmap() stuff.

I can only guess, that xcode doing some aggressive optimization,
violating calling conventions, or in some other way the fullGC is
optimized in a way
that it expected to be called from certain places (but obviously not
from native code generated on the fly).

That's really weird.

-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list