2009/11/7 Stéphane Ducasse <[email protected]>:
>
> On Nov 7, 2009, at 8:30 PM, Martin McClure wrote:
>
>> Adrian Lienhard wrote:
>>> Yes, in "normal" use of Pharo, holding the sources in memory would
>>> only consume a fraction of the available RAM. Some applications,
>>> however, have several hundred images running at the same time on a
>>> server. In this case the picture looks very different again.
>>
>> It would be easy to strip all sources from production images, but the
>> simple way of doing that would mean any debugging would be done on
>> decompiled code.
>>
>>>
>>> I think Marcus' idea of swapping in/out ressources is very
>>> interesting. We could get rid of the ancient sources handling but
>>> still have a low, or even lower, memory footprint.
>>>
>>
>> This would be even better.
>> ImageSegments are a start in this direction.
>
> yes this is why I always wanted to have tests to make sure that we do
> not break them.
>
> Stef
>>
>> -Martin
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [email protected]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

Until these great ideas take form, find a workaround attached.
'From Pharo1.1a of ''19 October 2009'' [Latest update: #11035] on 7 November 2009 at 11:30:33 pm'!
"Change Set:		condenseChangesShouldInvalidateUnstalledCompiledMethod
Date:			7 November 2009
Author:			nice

When a #condenseSources or #condenseChanges occurs, all un-installed CompiledMethod are let with an invalid sourcePointer.

Fix this with a #destroySourcePointer."!


!CompiledMethod methodsFor: 'source code management' stamp: 'nice 11/7/2009 23:20'!
destroySourcePointer
	self sourcePointer = 0 ifFalse: [self setSourcePointer: 0]! !


!SystemDictionary methodsFor: 'housekeeping' stamp: 'nice 11/7/2009 23:24'!
condenseChanges
	"Move all the changes onto a compacted sources file."
	"Smalltalk condenseChanges"
	| f oldChanges count |
	f := FileStream fileNamed: 'ST80.temp'.
	f header; timeStamp.
	'Condensing Changes File...'
		displayProgressAt: Sensor cursorPoint
		from: 0
		to: self classNames size + self traitNames size
		during: [:bar | 
			count := 0.
			self
				allClassesAndTraitsDo: [:classOrTrait | 
					bar value: (count := count + 1).
					classOrTrait moveChangesTo: f.
					classOrTrait putClassCommentToCondensedChangesFile: f.
					classOrTrait classSide moveChangesTo: f]].
	SmalltalkImage current lastQuitLogPosition: f position.
	f trailer; close.
	CompiledMethod allInstancesDo: [:e | e isInstalled ifFalse: [e destroySourcePointer]].
	oldChanges := SourceFiles at: 2.
	oldChanges close.
	FileDirectory default deleteFileNamed: oldChanges name , '.old';
		 rename: oldChanges name toBe: oldChanges name , '.old';
		 rename: f name toBe: oldChanges name.
	self setMacFileInfoOn: oldChanges name.
	SourceFiles
		at: 2
		put: (FileStream oldFileNamed: oldChanges name)! !

!SystemDictionary methodsFor: 'housekeeping' stamp: 'nice 11/7/2009 23:24'!
condenseSources	
	"Move all the changes onto a compacted sources file."
	"Smalltalk condenseSources"

	| f dir newVersionString count |
	Utilities fixUpProblemsWithAllCategory.
	"The above removes any concrete, spurious '-- all --' categories, which mess up the process."
	dir := FileDirectory default.
	newVersionString := UIManager default request: 'Please designate the version
for the new source code file...' initialAnswer: SmalltalkImage current sourceFileVersionString.
	newVersionString ifNil: [^ self].
	newVersionString = SmalltalkImage current sourceFileVersionString ifTrue:
		[^ self error: 'The new source file must not be the same as the old.'].
	SmalltalkImage current sourceFileVersionString: newVersionString.

	"Write all sources with fileIndex 1"
	f := FileStream newFileNamed: SmalltalkImage current sourcesName.
	f header; timeStamp.
'Condensing Sources File...'
	displayProgressAt: Sensor cursorPoint
	from: 0 to: self classNames size + self traitNames size
	during:
		[:bar | count := 0.
		Smalltalk allClassesAndTraitsDo:
			[:classOrTrait | bar value: (count := count + 1).
			classOrTrait fileOutOn: f moveSource: true toFile: 1]].
	f trailer; close.
	CompiledMethod allInstancesDo: [:e | e isInstalled ifFalse: [e destroySourcePointer]].

	"Make a new empty changes file"
	SmalltalkImage current closeSourceFiles.
	dir rename: SmalltalkImage current changesName
		toBe: SmalltalkImage current changesName , '.old'.
	(FileStream newFileNamed: SmalltalkImage current changesName)
		header; timeStamp; close.
	SmalltalkImage current lastQuitLogPosition: 0.

	self setMacFileInfoOn: SmalltalkImage current changesName.
	self setMacFileInfoOn: SmalltalkImage current sourcesName.
	SmalltalkImage current openSourceFiles.
	self inform: 'Source files have been rewritten!!
Check that all is well,
and then save/quit.'! !

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to