1. Ministry of Truth
  2. Newspeak
  3. newspeak
  4. Issues
Issue #32 resolved

ObjectMirror setClass:ifFail: does not work

Nikolay Botev
created an issue

The following class tests the use of setClass:ifFail: (the only other use of this message is in the Past framework, which AFAIK is not used anywhere as of 2011.10.19):



Newspeak3 'Testing' class SetClassTest usingPlatform: platform = ( "Test changing the class of an object via ObjectMirror."| private ObjectMirror = platform mirrors ObjectMirror. |) ( class Class1 = ( "The first class with one slot named x."| x = 1. |) () : () class Class2 = ( "The second class with one slot named y."| y = 2. |) () : ()'as yet unclassified' testOneTwo = ( "Create an instance of Class1 and change its class to Class2." | a aMirror | a:: Class1 new. aMirror:: ObjectMirror reflecting: a. aMirror setClass: Class2 ifFail: [ :ex | halt. ]. ^a. )) : () }}}

Running the above code on 2011.10.19 results in a halt with the ex variable containing #'bad selector'.

The setClass:ifFail: method ultimately invokes <primitive: 115>, which is defined as "SystemDictionary oopsLeft" in the Smalltalk-80 BlueBook with no further explanation on what oopsLeft means.

I could not find a reference of the Squeak-supported primitives online by googling.

This exhausts my capacity to investigate this issue at this time without spending a significant amount of time on learning Newspeak and Squeak internals.

Comments (9)

  1. Nikolay Botev reporter

    No idea. I am running the 10-19 release on Windows 7, that comes with nsvm-11.42.2502.msi, which I installed and run without any customizations /options. Would that be a JIT or interpreter VM?

  2. Nikolay Botev reporter

    I just reinstalled (uninstall then install again), even though the .msi file says 11.42..., the entry in the Programs and Features Control Panel applet says 11.33 still. setClass:ifFail: still fails.

  3. Ryan Macnak

    You would be running the JIT then. In the past, we had to fix primitives that were pulling their arguments from fixed offsets rather than relative to the stack. But I checked and get the same error for the interpreter as well. A quick peek at VMMaker reveals that the 'bad argument' error code I get means the VM believes the old and new class have different formats, although by my image-level inspect they have identical formats...

  4. Log in to comment