[squeak-dev] More than 256 literals referenced

David T. Lewis lewis at mail.msen.com
Mon Mar 18 01:53:49 UTC 2013


On Wed, Mar 13, 2013 at 07:48:26PM -0400, David T. Lewis wrote:
> Something changed in trunk a couple of days ago that results in a 'More than
> 256 literals referenced' error in a filein script that previously did not
> display this problem (see attached). It does not seem to be anything in the
> Compiler package (I reverted back a half dozen versions, no change), so I'm
> looking at the CI builds for reference. The problem appears in the image from
> SqueakTrunk build #213 and later, and is not  present in the image from
> build #212 and earlier.
> 

I put Tests-dtl.193 in the inbox (and attached change set) to document the
problem. The issue appears to be related to binding classes in closures,
and I'm not entirely certain if it is a bug or a reasonable side effect of
some other change. In any case, the failing test makes it easier to see
the issue, so perhaps someone more familiar with the compiler can have a
look to see if it is a real problem.

Dave


> I spotted the problem in the CogVM build job, which has been failing for a
> couple of days. The failures are due to the above issue, and the script file
> that fails on filein is http://build.squeak.org/job/CogVM/ws/VMCogUnixBuild.st
> The problem showed up in the CogVM job by coincidence and is not related to
> the VM.
> 
> Filing this VMCogUnixBuild.st into an updated trunk image will reproduce
> the problem.
> 
> Dave
> 
-------------- next part --------------
'From Squeak4.4 of 31 December 2012 [latest update: #12327] on 17 March 2013 at 4:46:29 pm'!
"Change Set:		CompilerTest-maxLiterals-dtl
Date:			17 March 2013
Author:			David T. Lewis

Two tests that illustrate the limit to number of literals in a compiled method. Both tests pass on Squeak 4.4. One of the tests fails in the most recent Squeak trunk."!


!CompilerTest methodsFor: 'limits' stamp: 'dtl 3/17/2013 16:09'!
testMaxLiterals
	"Document the maximum number of literals in a compiled method"

	| maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals |
	maxLiterals := 249.
	stringThatCanBeCompiled := '{ ', (String streamContents: [:strm |
					1 to: maxLiterals do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'.
	stringWithOneTooManyLiterals := '{ ', (String streamContents: [:strm |
					1 to: maxLiterals + 1 do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'.
	self shouldnt: [Compiler evaluate: stringThatCanBeCompiled logged: false] raise: Error.
	self should: (Compiler evaluate: stringThatCanBeCompiled logged: false) size = maxLiterals.
	
	"If the following test fails, it means that the limit has been raised or eliminated,
	and this test should be updated to reflect the improvement."
	self should: [Compiler evaluate: stringWithOneTooManyLiterals logged: false] raise: Error.
! !

!CompilerTest methodsFor: 'limits' stamp: 'dtl 3/17/2013 16:38'!
testMaxLiteralsWithClassReferenceInClosure
	"Document the maximum number of literals in a compiled method. A class
	reference in a closure reduces the maximum literals."

	| maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals |
	maxLiterals := 244.
	stringThatCanBeCompiled := '[ DateAndTime now. Date today. Time ]. { ',
			(String streamContents: [:strm |
					1 to: maxLiterals do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'.
	stringWithOneTooManyLiterals := '[ DateAndTime now. Date today. Time ]. { ',
			(String streamContents: [:strm |
					1 to: maxLiterals + 1 do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'.
	self shouldnt: [Compiler evaluate: stringThatCanBeCompiled logged: false] raise: Error.
	self should: (Compiler evaluate: stringThatCanBeCompiled logged: false) size = maxLiterals.
	
	"If the following test fails, it means that the limit has been raised or eliminated,
	and this test should be updated to reflect the improvement."
	self should: [Compiler evaluate: stringWithOneTooManyLiterals logged: false] raise: Error.
! !



More information about the Squeak-dev mailing list