pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Fix cannotInterpret: and test many VM callback methods

Open privat opened this issue 2 years ago • 2 comments

Fix and test ProtoObject>>cannotInterpret: as the implementation was broken at many levels.

The PR also add systematic tests for the special selectors that the VM might send in specific situations. These tests try to check the callbacks as they are handled by default in ProtoObject/Object (booooriiiiing), but mostly check custom defined handling trough redefinition in subclasses (with more complex situations).

Tested:

  • #attemptToAssign:withIndex:
  • #cannotInterpret:
  • #doesNotUnderstand:
  • #mustBeBoolean
  • #run:with:in:

What is missing:

  • Method sends to the context because I am not sure how to provide custom Context class to the VM: #cannotReturn:, #aboutToReturn:through:, #unusedBytecode
  • Special selectors that are not implemented #conditionalBranchCounterTrippedOn: and #classTrapFor: (I did not look at them yet)

privat avatar Jul 04 '23 23:07 privat

About the cannotReturn:, why not just testing it with an exception? [...]

I have a work in progress branch with things more or less equivalent with your proposals. Testing callbacks on real context objects is ok.

I also want to check directly the behaviour of the VM by instrumenting, diverting and hacking the receiver of these callbacks. I cannot really do that with the image implementation of Context. But catching the callbacks on a made up context-ish class is not easy (and very low-level to debug). Currently, I have some weird behavior that could be some programmer (me) errors (likely) or some VM limitations (possible).

Anyway, I plan to make a new PR special-methods-for-Context once this one is merged

privat avatar Jul 06 '23 13:07 privat

What is the state of this PR?

Tests are green. Some changes were requested but Jean seems to think the changes requested are not needed.

Can we integrate this change?

jecisc avatar Jul 12 '23 13:07 jecisc