!=========================================================================
! Copyright (C) VMware, Inc. 1986-2011.  All Rights Reserved.
!
! $Id: methodsTooLargeFor64.topaz,v 1.7 2008-01-09 22:50:12 stever Exp $
!
! Description - 
!     Report on methods that are too large to load into GemStone/64
!
!=========================================================================
output push methodsTooLargeFor64Internal.log only
level 0
iferror stack
abort
begin
category: 'Conversion-Temporary'
classmethod: GsMethod
unconvertibleMethodReport
	"Answer a String detailing which methods in the 32-bit
	repository are too large to be converted to GS/S 64-bit.
	Scans repository to find all methods, so can take a while
	for a large repository."

	"This method is part of a pre-conversion scan. It is a transient method. 
   Normally, it is never committed to the repository."

	| maxSize all badMethods report |
	maxSize := 8000.	"64K bytes = 8K words * 8 bytes/word"
	all := self allInstances.
	badMethods := all select: [:meth | meth sizeInMemory > maxSize].
	report := WriteStream on: String new.
	report cr.
	all size printOn: report.
	report nextPutAll: ' methods scanned.'.
	report cr.
	badMethods size printOn: report.
	report 
		nextPutAll: ' methods too large to load into GemStone/64 1.x.';
		cr.
	badMethods isEmpty 
		ifFalse: [report nextPutAll: 'Size and name of methods whose size in words is greater than the limit of '. 
				maxSize printOn: report.
				report nextPut: $:; cr].
	 badMethods do: [:meth | meth sizeInMemory printOn: report. 
					report 
						nextPut: $ ; 
						nextPutAll: meth inClass printString; 
						nextPut: $ ; 
						nextPutAll: meth selector printString;
						cr].
	^ report contents
%
category: 'Conversion-Temporary'
method: GsMethod
sizeInMemory

	"Number of 64-bit words this method will consume in memory in GS/64-bit"

	"This method is part of a pre-conversion scan. It is a transient method. 
   Normally, it is never committed to the repository."

	^ self _basicSize + (numSends * 3)
%
commit

output pop
output push methodsTooLargeFor64Report.log
run
GsMethod unconvertibleMethodReport
%
output pop

run
GsMethod class removeSelector: 'unconvertibleMethodReport'.
GsMethod removeSelector: 'sizeInMemory'.
%
commit


