{"id":270,"date":"2014-09-02T18:05:14","date_gmt":"2014-09-03T02:05:14","guid":{"rendered":"http:\/\/www.mirandabanda.org\/cogblog\/?page_id=270"},"modified":"2016-03-31T09:38:19","modified_gmt":"2016-03-31T17:38:19","slug":"cog-projects","status":"publish","type":"page","link":"http:\/\/www.mirandabanda.org\/cogblog\/cog-projects\/","title":{"rendered":"Cog Projects"},"content":{"rendered":"<p>Cog is an evolving system. \u00c2\u00a0Some projects are being worked on, some are as yet just dreams. \u00c2\u00a0We&#8217;re interested in collaborators \ud83d\ude09 \u00c2\u00a0This page may help you determine where you can help.<\/p>\n<p>&nbsp;<\/p>\n<h3>Spur<\/h3>\n<p>Spur is a new memory manager whose core is a more efficient object representation that has a single header format for both 64-bit and 32-bit implementations.<\/p>\n<p>Spur is released as Squeak 5.0, Newspeak and Pharo 5, and 64-bit Squeak 5.0 is in use, but green. \u00c2\u00a0There are still important missing\u00c2\u00a0components:<\/p>\n<p>&#8211; an incremental global mark-sweep-compact collector that avoids long pause times running a stop-the-world\u00c2\u00a0scan-mark-compact during interactive use.<\/p>\n<p>&#8211; an improved per-segment compaction algorithm to replace the second cut compaction algorithm (pig compact) that is slow and reorders objects.<\/p>\n<p>-\u00c2\u00a0a solution to the problem of free space in segments containing pinned objects at snapshot time (hopefully solved by the improved per-segment compaction algorithm)<\/p>\n<p>&#8211; A scheme to avoid garbage collecting large class libraries in &#8220;static&#8221; applications (this is what VisualWorks calls &#8220;Perm Save&#8221;). \u00c2\u00a0Spur&#8217;s segmentation could allow e.g. the first segment to be managed as a &#8220;perm segment&#8221; that would not be garbage collected.<\/p>\n<p>&#8211; image segment interoperability between Spur 32-bit and 64-bit versions and between Spur and previous Squeak versions. \u00c2\u00a0(It is hoped that such support would be done at the image level only without VM support).<\/p>\n<p>&nbsp;<\/p>\n<p>64-bit Spur is progressing. \u00c2\u00a0There is a functional system and a Cogit and StackInterpreter for x64 Linux &amp; Mac OS X. \u00c2\u00a0Still required are<\/p>\n<p>&#8211; 64-bit VMs for Windows<br \/>\n&#8211; an ARMv8 backend for the Cogit (Tim would like to\u00c2\u00a0work on this; anybody with funding should contact he or me)<\/p>\n<p>&nbsp;<\/p>\n<h3>Sista\/Scorch<\/h3>\n<p>Sista, the Speculative Inlining Small-talk Architecture, is a combination of an image-level adaptive optimizer and low-level Cogit support for performance counters and unsafe inline primitives, which together can generate much more efficient machine code implementations of often-executed codes. \u00c2\u00a0Scorch is the image level component, Cl\u00c3\u00a9ment&#8217;s SSA optimizer and dynamic deoptimizer. \u00c2\u00a0 Cl\u00c3\u00a9ment\u00c2\u00a0and\u00c2\u00a0Eliot are working on this. \u00c2\u00a0We want\u00c2\u00a0to release a first production version towards the end of\u00c2\u00a02016.<\/p>\n<p>&nbsp;<\/p>\n<h3>Threaded FFI<\/h3>\n<p>The Cog VM is single-threaded, providing green threads to the Smalltalk level, as do most Smalltalk VMs. There is a prototype subclass of the CoInterpreter, CoInterpreterMT, which provides a Python-like multi-threaded VM where any number of threads can share the VM with only one running the VM at any one time. \u00c2\u00a0This uses an extremely simple low-level scheme designed by David Simmons for releasing and re-acquiring ownership of the VM. \u00c2\u00a0This results in any and all FFI calls being non-blocking since there is such a low overhead to making a non-blocking FFI call that all FFI calls can be non-blocking. \u00c2\u00a0Eliot has worked on this, implementing the prototype and the reentrant FFI plugin it requires. \u00c2\u00a0But this needs to be revived. \u00c2\u00a0It would be a really powerful enhancement.<\/p>\n<p>&nbsp;<\/p>\n<h3><\/h3>\n<h3>ABI Compiler<\/h3>\n<p>Complex ABIs such as x86-64 (where for example the contents of structs are scattered across available integer and floating-point argument registers) are difficult to implement via interpretation (where a signature is interpreted to marshal arguments for a specific call). \u00c2\u00a0For both efficiency and correctness a compiled implementation, where for example marshalling code is generated on first use of a given call in any run, is preferrable. \u00c2\u00a0While quite a few people are interested (Igor, Ronie, Eliot), and Ronie&#8217;s Lowcode support is being added to the Cogit, no one is actively working on the image-level ABI compiler. \u00c2\u00a0This is less important than anticipated because the existing FFI plugin has been successfully ported to support x64 on 64-bit Spur.<\/p>\n<p>&nbsp;<\/p>\n<h3>Event-driven VM<\/h3>\n<p>The Cog VM, being derived from the standard Squeak VM, has an unsatisfactory idle implementation, with the background process calling a yield primitive that gives back time to the OS. \u00c2\u00a0This causes the VM to consume of the order of 3%-5% at idle. \u00c2\u00a0Instead the VM should block awaiting events when it has nothing to do. \u00c2\u00a0There are various attempts at an event-driven Squeak VM (e.g. for Android) but none of this has been integrated into Cog, nor has the idle issue been addressed. \u00c2\u00a0Closely related is to replace the use of select(2) for i\/o polling with kqueue(2)\u00c2\u00a0or\u00c2\u00a0epoll(2) on platforms that support it.<\/p>\n<p>&nbsp;<\/p>\n<h3>Native UI\/True Headlessness<\/h3>\n<p>Vassili Bykov has implemented a native Windows UI above Cog&#8217;s callback support. \u00c2\u00a0But a more comprehensive approach is possible, factoring out the GUI support in e.g. the Mac and Windows VMs and replacing it with an FFI-based implementation above the threaded FFI. \u00c2\u00a0Such a VM would be truly headless, containing no GUI code in the base VM.<\/p>\n<p>&nbsp;<\/p>\n<h3>Embedding\/VM as a DLL<\/h3>\n<p>It would be useful to be able to embed a Smalltalk system running above Cog in other clients, e.g. as a DLL. \u00c2\u00a0Cog has callbacks, above which an API can be built to access Smalltalk, but lots of refactoring and repackaging of the VM sources is necessary to realise this.<\/p>\n<p>&nbsp;<\/p>\n<h3>Web Browser &#8220;Plugin&#8221;<\/h3>\n<p>For a really cool project how about grabbing Bert Freudenberg&#8217;s VMMakerJS Squeak-vm-on-JavaScript, extracting the event handling and rendering part into a component and connecting it to the Cog VM via sockets to give us a really fast web plugin? \u00c2\u00a0This would be portable across browsers, and would decouple updating the VM from updating the plugin.<\/p>\n<p>&nbsp;<\/p>\n<h3>Multi-threading<\/h3>\n<p>While multi-threading seems like an obvious and important direction to take the system in, making the VM multi-threaded per-se does not provide any benefit before the Smalltalk image is made thread-safe and that is probably more work than providing a multi-threaded VM. \u00c2\u00a0Hence a potentially more profitable approach is to concentrate on federating multiple VMs running multiple images, communicating through the threaded FFI.<\/p>\n<p>&nbsp;<\/p>\n<h3>Read-only objects (was &#8220;Per-object immutability&#8221;)<\/h3>\n<p>Read-only object support\u00c2\u00a0is the ability to mark individual objects as read-only. \u00c2\u00a0This can be used to make\u00c2\u00a0literals immutable, and to provide efficient\u00c2\u00a0write-through support for orthogonal persistence schemes, and to implement debugging traps, etc. \u00c2\u00a0Cl\u00c3\u00a9ment has implemented the VM and Cogit support. \u00c2\u00a0So\u00c2\u00a0image level work can begin.<\/p>\n<p>&nbsp;<\/p>\n<h3>Subversion\u00c2\u00a0-&gt; Git<\/h3>\n<p>Subversion is the current repository for generated Cog VM sources. \u00c2\u00a0This is seen as less desirable than a git repository for integration with CI. \u00c2\u00a0Moving Cog from subversion to git may seem straight-forward but needs to be done with tact to help people over the transition.<\/p>\n<p>&nbsp;<\/p>\n<h3>Merging with the Squeak VM<\/h3>\n<p>Cog started off from Qwaq&#8217;s fork of the Squeak VM. \u00c2\u00a0As such, Cog and the Squeak VM&#8217;s ObjectMemory hierarchy differ in detail, and Cog&#8217;s Slang has changed considerably to accomodate the much more complex VM. \u00c2\u00a0Merging the two is desirable. \u00c2\u00a0We would also like to see an Interpreter VM for Spur.<\/p>\n<div class=\"pdf24Plugin-cp\"> \t<form name=\"pdf24Form0\" method=\"post\" action=\"https:\/\/doc2pdf.pdf24.org\/wordpress.php\" target=\"pdf24PopWin\" onsubmit=\"var pdf24Win = window.open('about:blank', 'pdf24PopWin', 'resizable=yes,scrollbars=yes,width=600,height=250,left='+(screen.width\/2-300)+',top='+(screen.height\/3-125)+''); pdf24Win.focus(); if(typeof pdf24OnCreatePDF === 'function'){void(pdf24OnCreatePDF(this,pdf24Win));}\"> \t\t<input type=\"hidden\" name=\"blogCharset\" value=\"Cw1x07UAAA==\" \/><input type=\"hidden\" name=\"blogPosts\" value=\"MwQA\" \/><input type=\"hidden\" name=\"blogUrl\" value=\"yygpKbDS1y8vL9fLzSxKzEtJTAIRevlF6frJ+elJOfnpAA==\" \/><input type=\"hidden\" name=\"blogName\" value=\"c85PV3DKyU8HAA==\" \/><input type=\"hidden\" name=\"blogValueEncoding\" value=\"gzdeflate base64\" \/><input type=\"hidden\" name=\"postId_0\" value=\"MzI3AAA=\" \/><input type=\"hidden\" name=\"postTitle_0\" value=\"c85PVwgoys9KTS4pBgA=\" \/><input type=\"hidden\" name=\"postLink_0\" value=\"yygpKbDS1y8vL9fLzSxKzEtJTAIRevlF6frJ+elJOflgWregKD8rNbmkWB8A\" \/><input type=\"hidden\" name=\"postAuthor_0\" value=\"S0zJzcwDAA==\" \/><input type=\"hidden\" name=\"postDateTime_0\" value=\"MzIwNNE1sNQ1MFIwtLAysLQyNAEA\" \/><input type=\"hidden\" name=\"postContent_0\" value=\"jVndjty2Fb7PUxAoYuwCM+vESdygNlzYTp1s4E3cjGv3lpI4ErOSqJDSzE4v26u+Qe\/a275G8kJ9hH7fISlp19migOGdkcjDw3O+852feTo8e+lqZYPSvTIH1x5sX6twCqPpLtQvf\/35XzvXGTV496MpR6zyRhWGa47OX5tKuX6jApfwjQ7qZEb14xRGVXmjuxBlvDcPfvPlo09\/+wRrbD8abyC\/wkdVurbVhfN6dD6o\/\/zzH3+XDW8baDTo2qhOn1Rj2kGd3KQqg72d7Y06NhAiz0oozgUXTx8Ozz56Ojx70BdheBK\/NZ892w2Tf\/oQH\/iOX+SyqjdH1ZnO+ROO6HGSh0wXDDSiklzS8ZPZ721pTT8qV9AEypsB6uOBHq3r1djoUTWa6wPM0hoooytI2zvf4RX+qMKNjXr8+bawI8xcqc8eyUfbDa3psqQwXyAr6U1rdICdIH3302T0tfri4pON+s4cw8BvlPWm0d6pLzbyJZ2xLKYYWHkKZqOKaVS1N6a\/SCamBem1MNq2pTbOjxoX7WzgVbiodHjaQ8Xwu9m89OSnT4gX25c+XqBVdesK\/Om0v96GozHDlns1DEYXw3Cwg9hKH5ytgmodMDRoaKZG2xncdup74gp2HN2wHRuzBcTaimoEOHkrorPQavJcLGDCd3swvOTFrynZAb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YcwbCXSmZ8GmSNMfIY8NYnMMVfWVhzQlF+jwRZqeYBN2qYfrEobnlM3wHaTBUG7JmzD7iRTfjYZ7GyKTLY8M222c9DcLfxtUy1Bs4ugAI6cXYE4dZ6tKVVKaYauFAuG0gG49lriHyXOWDJJzbdAi7NZDKv1iJrVbDHsFdvPv\/CM3dVKRxC\/dvH9TjE\/W1HZfB2\/w+D5TKCW2NNGDI2lYqUxphaVASSSVSv126B6mbUgnPaYGP2UxKeFXbD8TmoowKSDJ\/mZLzlZNf7XiY0FFYFBVKHOVXNHIJu05t62bcQiAnSrEGXLXQMgeOlTQnlHgov76l1ojzghgPaNChGo64l+iQKuY6Tqgjl6KrDrpmzS+9htvvo\/J\/POqf5hSzl5Hq\/vb+eOnnseneyLXz7GBeM0v4XgLiKv7S11j4xZfNSXpkQ5PyN0X02psMpmUE2Oo+FQHwSC1zRVyZjEI+i+neda4i2fDsZXJZpslAVjWbQgx3dHT+7O9lHph+pwguz5TpMdL+egLOjAMoLA3YfwE=\" \/> \t\t<a href=\"https:\/\/www.pdf24.org\" target=\"_blank\" title=\"www.pdf24.org\" rel=\"nofollow\"><img src=\"http:\/\/www.mirandabanda.org\/cogblog\/wp-content\/plugins\/pdf24-post-to-pdf\/img\/pdf_32x32.png\" alt=\"\" border=\"0\" height=\"32\" \/><\/a> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<span class=\"pdf24Plugin-cp-text\">Send article as PDF<\/span> \t\t<span class=\"pdf24Plugin-cp-space\">&nbsp;&nbsp;<\/span> \t\t<input class=\"pdf24Plugin-cp-input\" style=\"margin: 0px;\" type=\"text\" name=\"sendEmailTo\" placeholder=\"Enter email address\" \/> \t\t<input class=\"pdf24Plugin-cp-submit\" style=\"margin: 0px;\" type=\"submit\" value=\"Send\" \/> \t<\/form> <\/div>","protected":false},"excerpt":{"rendered":"<p>Cog is an evolving system. \u00c2\u00a0Some projects are being worked on, some are as yet just dreams. \u00c2\u00a0We&#8217;re interested in collaborators \ud83d\ude09 \u00c2\u00a0This page may help you determine where you can help. &nbsp; Spur Spur is a new memory manager whose core is a more efficient object representation that has a single header format for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages\/270"}],"collection":[{"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":12,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages\/270\/revisions"}],"predecessor-version":[{"id":339,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages\/270\/revisions\/339"}],"wp:attachment":[{"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/media?parent=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}