Skip to content

Conversation

@adri09070
Copy link
Collaborator

@adri09070 adri09070 commented Oct 21, 2022

Fixes #51.

skip used to step over jump bytecodes. Notably, if a comparison before a ifTrue:ifFalse:message was skipped, it used to skip the comparison and then step the jumpIfFalse bytecode. As this bytecode expected a boolean on the stack (the result of the comparison that has been skipped) and as the result on the stack is (probably) not a boolean, an exception MustBeBoolean was raised and was not handled. As a result, skipUpTo entered an infinite loop because we would never reach the aimed node.

Now, skips stops on jump bytecodes (notably on ifTrue:ifFalse messages) and manages these bytecodes separately: it pops the argument if it has one (this is the case for jumpTrue: and jumpFalse: bytecodes) and it simply does not execute the jump bytecode. Then, it steps to the first next interesting bytecode (I reimplemented this function in DebugSession to stop on jump bytecodes

@adri09070
Copy link
Collaborator Author

Failing test does not seem related.

Comment on lines 568 to 570
self node isMessage ifTrue: [ ^ self skipMessageNode ].
self node isMethod ifTrue: [ ^ self step ].
self node isBlock ifTrue: [ ^ self skipBlockNode ].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by db dispatch

Comment on lines 565 to 567
(instructionStream willJumpTo or: [
instructionStream willJumpIfFalse or: [
instructionStream willJumpIfTrue ] ]) ifTrue: [ ^ self skipJump ].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactor in InstructionStream>>willJump

each offset = self pc ].

(self node isReturn or: [
nextBytecode bytes first between: 88 and: 94 ]) ifTrue: [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= instructionSteram willReturn

@adri09070
Copy link
Collaborator Author

It fails because of a fuel test and other tests ... so not related

@StevenCostiou StevenCostiou merged commit 96fd175 into pharo-spec:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SkipUpTo enters an infinite loop when it encounters a jumpFalse: or a jumpTrue: bytecode

2 participants