Closed codefrau closed 9 months ago
With a Spur object memory, classes are supposed to be entered into the global class table. Their identity hash is the index into that class table. The identity hash primitive is supposed to put them there. That index is used instead of a class pointer in object headers.
SqueakJS doesn’t actually use the index or class table at runtime, it just tries to keep track of it. It’s quite possible I never tested that properly.
Workaround from Dan:
First I filed out the class in question (would help if the error told me which it was, but I figured it was the one to which I had added an instvar).
Then I removed the class. Might have to nil its value in Undeclared (I didn’t)
Then I saved and it worked.
Then I filed the class back in from its filout (could add the instvar in the file if desired).
All seems fine.
FWIW, I've implemented this some time ago in TruffleSqueak. :wink:
Yeah I implemented it 7 years ago too (35a209bc649419465a81f9e19c28b749faafab7c and 93827e81df93955341b08eee7b12eb825b9305aa) and it normally works fine, but for some reason not after adding an inst var to the class...
Found the bug: when the class was become'd (e.g. when adding an inst var) then the class table entry would still point to the obsolete class. That's why the check failed when saving the class table.
Bug report from Dan Ingalls:
The error is "Class not in class table"