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

Bytes panel is broken on CompiledMethods #16018

Closed
Ducasse opened this issue Jan 25, 2024 · 4 comments
Closed

Bytes panel is broken on CompiledMethods #16018

Ducasse opened this issue Jan 25, 2024 · 4 comments
Assignees
Labels

Comments

@Ducasse
Copy link
Member

Ducasse commented Jan 25, 2024

Capture 2024-01-25 at 09 33 56

@MarcusDenker
Copy link
Member

The reason is that CompiledMethod inherits ByteArray>>#inspectBytes:, but that makes no sense for any of the CompiledCode subclasses.

@Ducasse
Copy link
Member Author

Ducasse commented Jan 25, 2024

I do not really understand but we should fix it or remove it.

@MarcusDenker
Copy link
Member

We could override it. I have not found a way to do nothing, so mayeb we could show the bytes of the Bytecode:

inspectBytes: specBuilder
	<inspectorPresentationOrder: 30 title: 'Bytes'>

	^ self size > 1000 
		ifTrue: [
			(StSimpleInspectorBuilder on: specBuilder)
				key: 'error' value: 'too many bytes, size is ' , self size asString;
				table ]
		ifFalse: [
			(StSimpleInspectorBuilder on: specBuilder)
				key: 'hex string bytecode' value: (String streamContents: [ :out | 
					self bytecodes do: [ :each | each printOn: out base: 16 nDigits: 2 ] ]);
				key: 'hex lines bytecode' value: (String streamContents: [ :out |
					self bytecodes withIndexDo: [ :each :index |
						index = 1 ifFalse: [ 
							index - 1 \\ 8 = 0 ifTrue: [ out cr ] ifFalse: [ out space ] ].
						each printOn: out base: 16 nDigits: 2 ] ]);
				table]

Code here instead of PR as I can not commit, I added another issue for that: #16019

@hernanmd
Copy link
Member

Merged in pharo-spec/NewTools#670

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

No branches or pull requests

3 participants