Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler generates mismatched text maps for "t:=b ifTrue: [x] ifFalse: [y]. ^t" #533

Open
blairmcg opened this issue Jun 18, 2018 · 1 comment
Assignees
Labels

Comments

@blairmcg
Copy link
Contributor

From @blairmcg on October 5, 2016 18:11

The compiler is able to spot and optimise away a redundant temp that is assigned to and then its value immediately returned. It can also optimise away unconditional jumps to a return message bytecode, by inlining a copy of the return bytecode in place of the jump. In combination this particular code form causes the compiler to generate text maps with different numbers of entries for release (optimized) vs debug (non-optimized) code. It is an invariant of the debugger that the text maps should have the same number of entries as these are used to map between debug/release representations of methods when de-optimizing methods on the stack for debugging.

Copied from original issue: dolphinsmalltalk/DolphinVM#95

@blairmcg
Copy link
Contributor Author

Another slightly different case is TestCase>>#runCase, defined as follows:

runCase
	
	[self setUp.
	self performTest] ensure: [self tearDown]

If a breakpoint is set inside the setUp method and then a step occurs so the debugger converts the setUp frame and the runCase (block) frame to debug frames, the IP is remapped incorrectly in the runCase frame so that when returned to it sends the setUp message again. The issue relates to the optimisation of 'push self; send' into a single instruction in the release build of the method vs separate instructions in the debug build.

This can be worked around by changing the pair of sends in the runCase block to a cascade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant