[Pkg] The Trunk: Kernel-nice.1387.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Apr 15 00:20:45 UTC 2021


Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1387.mcz

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

Name: Kernel-nice.1387
Author: nice
Time: 15 April 2021, 2:20:34.212568 am
UUID: 523bbb98-def1-bc48-8cb0-d2a1038a180e
Ancestors: Kernel-nice.1386

Workaround recursive SyntaxErrorNotification occurring when trying to decompile broken source.

We shouldn't have broken source, but if we have, we shouldn't exhaust memory and crash the VM while trying to open a Debugger.

=============== Diff against Kernel-nice.1386 ===============

Item was changed:
  ----- Method: CompiledMethod>>decompileWithTemps (in category 'decompiling') -----
  decompileWithTemps
  	"Return the decompiled parse tree that represents self, but with the temp names obtained
  	 either by compiling the sourcecode, or directly if the method has temps in its trailer."
  
  	| class selector tempNames source |
  	class := self methodClass ifNil: [Object].
  	selector := self selector ifNil: [self defaultSelector].
  
  	self holdsTempNames
  		ifTrue: [tempNames := self tempNamesString]
  		ifFalse:
  			[| compiler |
  			 "No source file or no source (e.g. doits) and no temp names
  			 -- decompile without temp names "
  			((self fileIndex > 0 and: [(SourceFiles at: self fileIndex) isNil])
  			or: [(source := self getSourceFromFile) isNil]) ifTrue:
  				[^self decompile].
  			compiler := class newCompiler.
  			compiler parser encoderClass: self encoderClass.
+ 			tempNames := [(compiler
- 			tempNames := (compiler
  								parse: source asString
  								in: class
  								notifying: nil)
  									generate: CompiledMethodTrailer empty;
+ 									schematicTempNamesString] on: SyntaxErrorNotification do: [:ex | nil].
+ 			tempNames ifNil: ["broken source, give up tempNames" ^self decompile]].
- 									schematicTempNamesString].
  
  	^(self decompilerClass new withTempNames: tempNames)
  		decompile: selector
  		in: class
  		method: self methodForDecompile!



More information about the Packages mailing list