pharo-project / pharo-vm

This is the VM used by Pharo
http://pharo.org
Other
110 stars 67 forks source link

`become` primitive does not support objects in PermSpace #815

Open PalumboN opened 2 weeks ago

PalumboN commented 2 weeks ago

I'm running some benchmarks using the PermSpace and I get an error running the tests in Kernel.* packages.

I moved all classes using following these instructions.

Then you can run

ObjectsAsMethodsTest suite debug

And you get a primitive error for elementsForwardIdentityTo:.

➜  latest10 git:(server) ✗ ./Pharo.app/Contents/MacOS/Pharo ../../images/p11-classes-permi/p11-classes-permi.image eval "ObjectsAsMethodsTest suite debug"
PrimitiveFailed: primitive #elementsForwardIdentityTo: in Array failed
Array(ProtoObject)>>primitiveFailed:
Array(ProtoObject)>>primitiveFailed
Array>>elementsForwardIdentityTo:
MethodDictionary(ProtoObject)>>becomeForward:
MethodDictionary>>grow
MethodDictionary(HashedCollection)>>fullCheck
MethodDictionary>>at:put:
ObjectsAsMethodsTest class(Behavior)>>addSelectorSilently:withMethod:
ObjectsAsMethodsTest class(ClassDescription)>>addSelectorSilently:withMethod:
ObjectsAsMethodsTest class(ClassDescription)>>addSelector:withMethod:

Checking the GC code about becoming objects, there is a check for the case that an object is in the old space and the other in the new space using the OldBecameNewFlag. Probably (I didn't debug it) a check for the permanent space is missing there.

Here https://github.com/pharo-project/pharo-vm/blob/c012a6b38aca269fcbbe42f8c8b119741578569c/smalltalksrc/VMMaker/SpurMemoryManager.class.st#L4387-L4401

And here https://github.com/pharo-project/pharo-vm/blob/c012a6b38aca269fcbbe42f8c8b119741578569c/smalltalksrc/VMMaker/SpurMemoryManager.class.st#L10107-L10142