The Trunk: Compiler-ct.534.mcz

[email protected] Thu, 11 Jun 2026 20:42:47 0000
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
Christoph Thiede uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ct.534.mcz

==================== Summary ====================

Name: Compiler-ct.534
Author: ct
Time: 11 June 2026, 10:42:46.879188 pm
UUID: 8558422b-3394-4016-a2b2-92f736de41d3
Ancestors: Compiler-ct.533

Avoids infinite loop in BytecodeEncoder class>>descriptionTable for malformed comments (e.g. when one is stupid enough to send descriptionTable to BytecodeEncoder itself).

=============== Diff against Compiler-ct.533 ===============

Item was changed:
  ----- Method: BytecodeEncoder class>>descriptionTable (in category 'utilities') -----
  descriptionTable
  	"Attempt to answer an Array mapping bytecode indices to bytecode names, derived from the class comment.
  	 The name of the 0th byetcode is in the Array's first variable, the 255th in its 256'th, and so on."
  	| table s lastBC n m line |
  	lastBC := -1. n := 0.
  	table := Array new: 256 withAll: 'Unspecified'.
  	s := ReadStream on: self comment asString.
  	[line := s upTo: Character cr.
+ 	s atEnd or: [s peek = Character tab and: [(s next; peek) isDigit]]] whileFalse.
- 	s peek = Character tab and: [(s next; peek) isDigit]] whileFalse.
  	s skip: -2.
  	[table last ~= 'Unspecified' or: [s atEnd]] whileFalse:
  		[[s peek = $*] whileTrue: [s next].
  		 s skipSeparators.
  		 s peek isDigit
  			ifTrue:
  				[n := Integer readFrom: s.
  				 n > lastBC "filter-out things like ''2 Byte Bytecodes'' etc"
  					ifTrue:
  						[m := (s skipSeparators; peek) = $- ifTrue:
  									[s next; skipSeparators.
  									 Integer readFrom: s].
  						line := s upTo: Character cr.
  						line := line allButFirst: (line findFirst: [:c| c isUppercase]) - 1.
  						m
  							ifNil: [table at: n + 1 put: line]
  							ifNotNil:
  								[table atAll: (n + 1 to: m + 1) put: line.
  								 n := m].
  						lastBC := n]
  					ifFalse:
  						[line := s upTo: Character cr]]
  			ifFalse: "i.e. skip additional notes on following line"
  				[line := s upTo: Character cr]].
  	^table
  
  	"EncoderForSistaV1 descriptionTable"!

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]