Hi all,
I have played with a very simple, extremely slow but powerful shrinking method: - take some very small image - create a task you want to do, for example some basic script like (FileStream forceNewFileNamed: 'out.txt') nextPutAll: (Compiler evaluate: '3+4') asString; close. SmalltalkImage current snapshot: true andQuit: false. - define the correct outputs (the file out.txt includes the text '7') - create a control image (with OSProcess) that takes the small image and starts to remove method by method and tests if the resultant image is not broken and returns correct outputs ;-) - the result is an image with the minimal possible count of methods for this task Of course it isn't so simple in real but this is the basic principle. I got the result 1944 methods the Squeak 3.10 (Squeak 2.2 mini image has more than 4000 methods). The image and the lists of methods can be downloaded here: http://comtalk.net/public/tmp/shrink20070513.zip For example the only Methods for UndefinedObject are UndefinedObject >> notNil UndefinedObject >> handleSignal: UndefinedObject >> isEmptyOrNil UndefinedObject >> isNil If you're expecting extremely small image with few kilobytes, I have to disappoint you - the image has about 1,2 MB. That's because it includes lot of the other garbage. The main purpose is to show the Squeak code base. In fact the image can do much more than evaluate the script - it can shrink yourself to this size and test if the methods were removed properly. It can write the number of instances of a class etc. Some methods are redundant because I included it during shrinking manually. Of course it removed the platform specific code that it doesn't need so I expect that it will be runnable only on Linux. Maybe it opens the new interesting way how to continue with the license change. Only very few people can help with the license audit but all have computers and somebody may have access to powerful clusters. If the output conditions will be: "file-in the removed code back and perform basic tests", we may get relatively small set of methods for the license conversion. So we can have small MIT kernel and the rest of "non-free" Squeak code can be downloaded and loaded manually by users. Cheers, -- Pavel |
Hi Pavel-- > ...create a control image (with OSProcess) that takes the small image > and starts to remove method by method and tests if the resultant image > is not broken and returns correct outputs ;-) Why not just keep track of all the methods that get used by the virtual machine by the task, and throw away all the rest of them with the garbage collector? I did this for 3+4 and got an image that was 1,337 bytes[1]. > Maybe it opens the new interesting way how to continue with the > license change. Only very few people can help with the license audit > but all have computers and somebody may have access to powerful > clusters. > > If the output conditions will be: "file-in the removed code back and > perform basic tests", we may get relatively small set of methods for > the license conversion. So we can have small MIT kernel and the rest > of "non-free" Squeak code can be downloaded and loaded manually by > users. Sure, this has been the plan with Spoon, and we can do it with a single modest machine. Is there some reason why you're reinventing here? I've been mentioning Spoon progress and releases here the whole time I've been working on it. curious, -C [1] http://netjam.org/spoon/smallest -- Craig Latta improvisational musical informaticist www.netjam.org Smalltalkers do: [:it | All with: Class, (And love: it)] |
In reply to this post by Pavel Krivanek
On Wed, Jun 13, 2007 at 10:01:52PM +0200, Pavel Krivanek wrote:
> Hi all, > > I have played with a very simple, extremely slow but powerful shrinking > method: > - take some very small image > - create a task you want to do, for example some basic script like > > (FileStream forceNewFileNamed: 'out.txt') nextPutAll: (Compiler > evaluate: '3+4') asString; close. > SmalltalkImage current snapshot: true andQuit: false. > > - define the correct outputs (the file out.txt includes the text '7') > - create a control image (with OSProcess) that takes the small image > and starts to remove method by method and tests if the resultant image > is not broken and returns correct outputs ;-) > - the result is an image with the minimal possible count of methods > for this task Hi Pavel, I think I can help with the "extremely slow" part. Try making the test images (the ones started by the control image) headless, and do all the I/O through an OS pipe rather than with files. For example: | pipe testBlock c | pipe := OSPipe new. testBlock := [(Compiler evaluate: '3 + 4') asString = '7' ifTrue: [pipe nextPut: $Y] ifFalse: [pipe nextPut: $N]. pipe flush]. [10 timesRepeat: ["remove a method here then run the remote test" UnixProcess forkHeadlessSqueakAndDoThenQuit: testBlock. [(c := pipe next) isNil] whileTrue: []. (c == $Y) ifTrue: [Transcript show: 'the remote test succeeded'; cr] ifFalse: [self error: 'the remote test failed, need to undo the last change']]] ensure: [pipe close]. Dave |
In reply to this post by Pavel Krivanek
On Thursday 14 June 2007 1:31 am, Pavel Krivanek wrote:
> Hi all, > > I have played with a very simple, extremely slow but powerful shrinking > method: - take some very small image > - create a task you want to do, for example some basic script like > > (FileStream forceNewFileNamed: 'out.txt') nextPutAll: (Compiler > evaluate: '3+4') asString; close. > SmalltalkImage current snapshot: true andQuit: false. Very nice work, Pavel. If there is a way for the image to return a boolean or byte value to the VM when shutting down, then we could use code like : Smalltalk current snapshot: true andReturn: (Compiler evaluate: '3+4=7'). to shrink the image to its essentials. File I/O could be factored out of the basic methods. Regards .. Subbu |
In reply to this post by ccrraaiigg
On 6/14/07, Craig Latta <[hidden email]> wrote:
> > Hi Pavel-- > > > ...create a control image (with OSProcess) that takes the small image > > and starts to remove method by method and tests if the resultant image > > is not broken and returns correct outputs ;-) > > Why not just keep track of all the methods that get used by the > virtual machine by the task, and throw away all the rest of them with > the garbage collector? I did this for 3+4 and got an image that was > 1,337 bytes[1]. > > > Maybe it opens the new interesting way how to continue with the > > license change. Only very few people can help with the license audit > > but all have computers and somebody may have access to powerful > > clusters. > > > > If the output conditions will be: "file-in the removed code back and > > perform basic tests", we may get relatively small set of methods for > > the license conversion. So we can have small MIT kernel and the rest > > of "non-free" Squeak code can be downloaded and loaded manually by > > users. > > Sure, this has been the plan with Spoon, and we can do it with a > single modest machine. > > Is there some reason why you're reinventing here? I've been > mentioning Spoon progress and releases here the whole time I've been > working on it. > > curious, I know the VM monitoring - with no doubt it's much more elegant way. This way I considered to be more useful in case you want to automatically load the removed methods again. Last but not least I simply wanted to try that :-) I don't want to create an alternative to Spoon, I want to help with the packaging effort to adopt Spoon in future as the Squeak kernel. Cheers, -- Pavel > > -C > > [1] http://netjam.org/spoon/smallest > > -- > Craig Latta > improvisational musical informaticist > www.netjam.org > Smalltalkers do: [:it | All with: Class, (And love: it)] > > > > |
> This way I considered to be more useful in case you want to > automatically load the removed methods again. Spoon supports that, by replacing the removed methods with references to nil, and automatically swapping in the right method from a control image whenever it encounters a nil during method lookup. One can just as well swap in all such methods at once, without waiting for them to be used. I use this capability frequently. -C -- Craig Latta improvisational musical informaticist www.netjam.org Smalltalkers do: [:it | All with: Class, (And love: it)] |
In reply to this post by Pavel Krivanek
El 6/13/07 5:01 PM, "Pavel Krivanek" <[hidden email]> escribió: > Hi all, > > I have played with a very simple, extremely slow but powerful shrinking > method: > - take some very small image > - create a task you want to do, for example some basic script like > > (FileStream forceNewFileNamed: 'out.txt') nextPutAll: (Compiler > evaluate: '3+4') asString; close. > SmalltalkImage current snapshot: true andQuit: false. > > - define the correct outputs (the file out.txt includes the text '7') > - create a control image (with OSProcess) that takes the small image > and starts to remove method by method and tests if the resultant image > is not broken and returns correct outputs ;-) > - the result is an image with the minimal possible count of methods > for this task > > Of course it isn't so simple in real but this is the basic principle. > I got the result 1944 methods the Squeak 3.10 (Squeak 2.2 mini image > has more than 4000 methods). The image and the lists of methods can > be downloaded here: > http://comtalk.net/public/tmp/shrink20070513.zip > > For example the only Methods for UndefinedObject are > UndefinedObject >> notNil > UndefinedObject >> handleSignal: > UndefinedObject >> isEmptyOrNil > UndefinedObject >> isNil > > If you're expecting extremely small image with few kilobytes, I have > to disappoint you - the image has about 1,2 MB. That's because it > includes lot of the other garbage. The main purpose is to show the > Squeak code base. > > In fact the image can do much more than evaluate the script - it can > shrink yourself to this size and test if the methods were removed > properly. It can write the number of instances of a class etc. Some > methods are redundant because I included it during shrinking manually. > > Of course it removed the platform specific code that it doesn't need > so I expect that it will be runnable only on Linux. > > Maybe it opens the new interesting way how to continue with the > license change. Only very few people can help with the license audit > but all have computers and somebody may have access to powerful > clusters. > > If the output conditions will be: "file-in the removed code back and > perform basic tests", we may get relatively small set of methods for > the license conversion. So we can have small MIT kernel and the rest > of "non-free" Squeak code can be downloaded and loaded manually by > users. > > Cheers, > -- Pavel Pavel: You work is always inspirational, bravo. A question: What if I wish produce a daughter image with my own final class set ? I could as example take the class list of my proposal MinimalAgreement (that is MinimalMorphic plus some I know need ) And build a clean image ? Or I misunderstood some ? Edgar |
> Pavel:
> > You work is always inspirational, bravo. > > A question: > > What if I wish produce a daughter image with my own final class set ? > I could as example take the class list of my proposal MinimalAgreement (that > is MinimalMorphic plus some I know need ) > > And build a clean image ? > > Or I misunderstood some ? > > Edgar > This technique doesn't fit well for the big images and it doesn't work with classes directly. But you may try to play with Goya (method coloring). Cheers, -- Pavel |
In reply to this post by Pavel Krivanek
> For example the only Methods for UndefinedObject are
> UndefinedObject >> notNil > UndefinedObject >> handleSignal: > UndefinedObject >> isEmptyOrNil > UndefinedObject >> isNil > > If you're expecting extremely small image with few kilobytes, I have > to disappoint you - the image has about 1,2 MB. That's because it > includes lot of the other garbage. The main purpose is to show the > Squeak code base. garbage like what? > In fact the image can do much more than evaluate the script - it can > shrink yourself to this size and test if the methods were removed > properly. It can write the number of instances of a class etc. Some > methods are redundant because I included it during shrinking manually. > > Of course it removed the platform specific code that it doesn't need > so I expect that it will be runnable only on Linux. > > Maybe it opens the new interesting way how to continue with the > license change. Only very few people can help with the license audit > but all have computers and somebody may have access to powerful > clusters. > > If the output conditions will be: "file-in the removed code back and > perform basic tests", we may get relatively small set of methods for > the license conversion. So we can have small MIT kernel and the rest > of "non-free" Squeak code can be downloaded and loaded manually by > users. > > Cheers, > -- Pavel > > |
Hi Stef,
On 6/14/07, stephane ducasse <[hidden email]> wrote: > > For example the only Methods for UndefinedObject are > > UndefinedObject >> notNil > > UndefinedObject >> handleSignal: > > UndefinedObject >> isEmptyOrNil > > UndefinedObject >> isNil > > > > If you're expecting extremely small image with few kilobytes, I have > > to disappoint you - the image has about 1,2 MB. That's because it > > includes lot of the other garbage. The main purpose is to show the > > Squeak code base. > > garbage like what? The image includes for example some block contexts with active old shrinking scripts. You can see it if you open the image in a standard text editor. On the other hand, the space tally of the base image (1.8 MB) seems to be pretty clean so I really would like to know if I'm right :-) > > In fact the image can do much more than evaluate the script - it can > > shrink yourself to this size and test if the methods were removed > > properly. It can write the number of instances of a class etc. Some > > methods are redundant because I included it during shrinking manually. > > > > Of course it removed the platform specific code that it doesn't need > > so I expect that it will be runnable only on Linux. > > > > Maybe it opens the new interesting way how to continue with the > > license change. Only very few people can help with the license audit > > but all have computers and somebody may have access to powerful > > clusters. > > > > If the output conditions will be: "file-in the removed code back and > > perform basic tests", we may get relatively small set of methods for > > the license conversion. So we can have small MIT kernel and the rest > > of "non-free" Squeak code can be downloaded and loaded manually by > > users. > > > > Cheers, > > -- Pavel > > > > > > > |
> The image includes for example some block contexts with active old > shrinking scripts. You can see it if you open the image in a standard > text editor. On the other hand, the space tally of the base image (1.8 > MB) seems to be pretty clean so I really would like to know if I'm > right :-) Just load that image into the simulator and scan for them. It's much nicer than using a text editor. :) -C -- Craig Latta improvisational musical informaticist www.netjam.org Smalltalkers do: [:it | All with: Class, (And love: it)] |
but the simulator does not work on 3.9. Pavel can you confirm that?
We tried and the changes in Spoon are spoon specific. Or we could not understand how to use it. Stef On 15 juin 07, at 01:20, Craig Latta wrote: > >> The image includes for example some block contexts with active old >> shrinking scripts. You can see it if you open the image in a standard >> text editor. On the other hand, the space tally of the base image >> (1.8 >> MB) seems to be pretty clean so I really would like to know if I'm >> right :-) > > Just load that image into the simulator and scan for them. It's > much nicer than using a text editor. :) > > > -C > > -- > Craig Latta > improvisational musical informaticist > www.netjam.org > Smalltalkers do: [:it | All with: Class, (And love: it)] > > > > |
On 6/15/07, stephane ducasse <[hidden email]> wrote:
> but the simulator does not work on 3.9. Pavel can you confirm that? > We tried and the changes in Spoon are spoon specific. Or we could not > understand how to use it. Right, at least I was not successful. -- Pavel > Stef > > On 15 juin 07, at 01:20, Craig Latta wrote: > > > > >> The image includes for example some block contexts with active old > >> shrinking scripts. You can see it if you open the image in a standard > >> text editor. On the other hand, the space tally of the base image > >> (1.8 > >> MB) seems to be pretty clean so I really would like to know if I'm > >> right :-) > > > > Just load that image into the simulator and scan for them. It's > > much nicer than using a text editor. :) > > > > > > -C > > > > -- > > Craig Latta > > improvisational musical informaticist > > www.netjam.org > > Smalltalkers do: [:it | All with: Class, (And love: it)] > > > > > > > > > > > |
In reply to this post by stephane ducasse
> but the simulator does not work on 3.9. Pavel can you confirm that? > We tried and the changes in Spoon are spoon specific. Or we could not > understand how to use it. That only matters if you actually start processing instructions. For what Pavel wants to do (scan for certain objects without actually running the interpreter), all you need to be able to do is load the object memory. Spoon's processor changes are to method lookup during processing. -C -- Craig Latta improvisational musical informaticist www.netjam.org Smalltalkers do: [:it | All with: Class, (And love: it)] |
Free forum by Nabble | Edit this page |