{"id":107,"date":"2011-07-26T08:45:35","date_gmt":"2011-07-26T16:45:35","guid":{"rendered":"http:\/\/www.mirandabanda.org\/cogblog\/?page_id=107"},"modified":"2016-06-16T10:58:34","modified_gmt":"2016-06-16T18:58:34","slug":"about-cog","status":"publish","type":"page","link":"http:\/\/www.mirandabanda.org\/cogblog\/about-cog\/","title":{"rendered":"About Cog"},"content":{"rendered":"<p>Cog is a virtual machine designed for <a href=\"http:\/\/en.wikipedia.org\/wiki\/Smalltalk\">Smalltalk<\/a> and other similar dynamic languages. \u00c2\u00a0Cog extends\u00c2\u00a0the <a href=\"http:\/\/www.mirandabanda.org\/files\/Papers\/BttF.html\">Squeak virtual machine<\/a> adding a stack-to-register-mapping just-in-time compiler, aggressive <a href=\"http:\/\/en.wikipedia.org\/wiki\/Inline_caching\">in-line message cacheing<\/a> and <a href=\"http:\/\/www.mirandabanda.org\/cogblog\/2009\/01\/14\/under-cover-contexts-and-the-big-frame-up\/\">effective optimization of Smalltalk\u00e2\u20ac\u2122s first-class activation records<\/a>. \u00c2\u00a0Cog is the virtual machine underlying <a href=\"http:\/\/www.3dicc.com\">3D ICC&#8217;s<\/a> <a href=\"http:\/\/en.wikipedia.org\/wiki\/Croquet_Project\">Croquet-based<\/a> enterprise virtual collaboration spaces software, and is the fastest virtual machine for <a href=\"http:\/\/www.squeak.org\/\">Squeak<\/a>\u00c2\u00a0and <a href=\"http:\/\/pharo.org\">Pharo<\/a>. Cog is also the development VM for Gilad Bracha&#8217;s <a href=\"http:\/\/newspeaklanguage.org\/\">Newspeak<\/a>\u00c2\u00a0modular language inspired by Beta and Smalltalk.<\/p>\n<p>Like the original Squeak VM, Cog is implemented and developed in Smalltalk, and translated into a lower-level language to produce the production VM. \u00c2\u00a0Being a Smalltalk program it is a delight to develop. \u00c2\u00a0Cog is available under the <a href=\"http:\/\/en.wikipedia.org\/wiki\/MIT_License\">MIT open source license<\/a> and is unencumbered for commercial deployment. \u00c2\u00a0Cog lives on github at\u00c2\u00a0<a href=\"https:\/\/github.com\/OpenSmalltalk\/vm\" target=\"_blank\">https:\/\/github.com\/OpenSmalltalk\/vm<\/a>. \u00c2\u00a0See <a href=\"https:\/\/github.com\/OpenSmalltalk\/vm\/blob\/Cog\/README.md\" target=\"_blank\">README.md<\/a> for more information on the repository.<\/p>\n<p>Cog&#8217;s performance relative to the existing Squeak interpreter varies, depending on the benchmark chosen. \u00c2\u00a0As of early-2011, the Cog JIT used strong inline cacheing techniques and stack-to-register mapping that results in a register-based calling convention for low-arity methods. \u00c2\u00a0Due to the complexity of the Squeak object representation it has a limited set of primitives implemented in machine code that, for example, exclude object allocation. \u00c2\u00a0Performance of the early-2011 JIT for the nbody, binarytrees and chameneos redux benchmarks from the <a href=\"http:\/\/shootout.alioth.debian.org\/\">computer language shootout<\/a> is in the range of 4 to 6 times faster than the interpreter. \u00c2\u00a0As of mid 2014 the new Spur object representation provides the Cog \u00c2\u00a0JIT with more opportunities to optimize. \u00c2\u00a0Performance for the same set of benchmarks is 4 to 11 times faster\u00c2\u00a0than the interpreter, and overall Cog Spur is about -40% faster than <a title=\"VisualWorks\" href=\"http:\/\/www.cincomsmalltalk.com\/main\/products\/visualworks\/\">VisualWorks<\/a>&#8216;s HPS for the shootout benchmarks on x86.<\/p>\n<p>Cog is now the standard VM for <a title=\"Squeak\" href=\"http:\/\/squeak.org\">Squeak<\/a>, <a title=\"Pharo\" href=\"http:\/\/pharo.org\">Pharo<\/a>, <a title=\"Newspeak\" href=\"http:\/\/www.newspeaklanguage.org\">Newspeak<\/a> and <a href=\"https:\/\/www.raspberrypi.org\/blog\/a-new-version-of-scratch-for-raspberry-pi-now-with-added-gpio\/\">Scratch on Raspberry Pi<\/a>. \u00c2\u00a0Cog currently has back ends for x86, ARMv6, and\u00c2\u00a0x64 (x86_64), with a MIPSEL back-end in preparation. \u00c2\u00a0Squeak 5.0 uses Spur, while Pharo is currently transitioning to Spur for the upcoming Pharo 6 release. \u00c2\u00a0Spur provides both 32-bit and 64-bit support. \u00c2\u00a0Squeak 5.0 is available in either 32-bit or 64-bit versions.<\/p>\n<p><a title=\"Eliot Miranda\" href=\"http:\/\/www.mirandabanda.org\/cogblog\/microbio\/\">I<\/a> am writing an occasional series of blog posts describing the implementation <a href=\"http:\/\/www.mirandabanda.org\/cogblog\/\">on this site<\/a>. See the Cog category at the left side of the page. \u00c2\u00a0With <a href=\"http:\/\/clementbera.wordpress.com\/\">Cl\u00c3\u00a9ment B\u00c3\u00a9ra<\/a> I&#8217;m working on adaptive optimisation (a.k.a. speculative inlining) at the image level, optimising from bytecode to bytecode. \u00c2\u00a0We call this project Sista, which stands for Speculative Inlining Smalltalk Architecture. \u00c2\u00a0Cl\u00c3\u00a9ment&#8217;s image-level (entirely in Smalltalk above the virtual machine) adaptive optimizer is called Scorch. \u00c2\u00a0Sista should offer about a -66% speed-up (3x) for conventional Smalltalk code. \u00c2\u00a0The combination of Spur and Sista should yield almost a 5x speedup over the original Cog. \u00c2\u00a0See the side bar for <a href=\"http:\/\/www.mirandabanda.org\/cogblog\/on-line-papers-and-presentations\/\">more information<\/a>.<\/p>\n<p>Cog is simply a small part of a Smalltalk system. The name is appropriate, but inspired in part by another <a href=\"https:\/\/www.youtube.com\/watch?v=bl2U1p3fVRk\">beautiful<\/a> <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cog_(advertisement)\">Cog<\/a>.<\/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=\"MzQwBwA=\" \/><input type=\"hidden\" name=\"postTitle_0\" value=\"c0zKLy1RcM5PBwA=\" \/><input type=\"hidden\" name=\"postLink_0\" value=\"yygpKbDS1y8vL9fLzSxKzEtJTAIRevlF6frJ+elJOfnp+olJ+aUlukCePgA=\" \/><input type=\"hidden\" name=\"postAuthor_0\" value=\"S0zJzcwDAA==\" \/><input type=\"hidden\" name=\"postDateTime_0\" value=\"MzIwNNQ1MNc1MlMwsLAyMLcyNgUA\" \/><input type=\"hidden\" name=\"postContent_0\" value=\"lVjbbuPIEX3PVzQUbGADoujbKptkRsF4ZpJ4MU6M8cb7aDTJFtXrJpvpbkrWPu7mQ4J9C5Cv2PmT\/ZKcqiYp2tJgZ14ESuyurjp16lS1XjSL17YU2gsp1tqFVhpRyXylayUK5XVZq0IsrRMvpFg5tXw5WYXQ\/DFNVT3b6AfdqELLmXVlSt\/S20oaE6R5mCyGxxepXAhZF8KGlXLC60ob6USxrWWlc2FkXbayVH4mPvzw83\/IG\/UYVF14+oote0dvNptZpR1Myow++PilNsqnN7JRzqeXIfxltgqVgRv\/apV8eB5b9KkodF0icB9k\/pAEmzhVah+USyrZNPTuu9aHRNdJ0JUSua0anOKmQpalU97rtfpEXK5qg1Pvcz69nCxgkn4QFawgdkEvFN4MWH1SzLktM2PL9Ozk5A\/pyWl6epG2dQH3c7vmzzoASp9gQwIgk0yXydLJSiVtk04WarlUeaAgbIMA9fcyaFsLuxRD7j789MsP\/\/vl3z95sdQOUORGelCFdsXFTuXWFZ783uUPbKK8PecT+2a2hOuh8M4LneczgDxZnL8RV69f\/+63X52d\/v5PbPwTcX7tLPId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UW6i\/z\/\" \/> \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 a virtual machine designed for Smalltalk and other similar dynamic languages. \u00c2\u00a0Cog extends\u00c2\u00a0the Squeak virtual machine adding a stack-to-register-mapping just-in-time compiler, aggressive in-line message cacheing and effective optimization of Smalltalk\u00e2\u20ac\u2122s first-class activation records. \u00c2\u00a0Cog is the virtual machine underlying 3D ICC&#8217;s Croquet-based enterprise virtual collaboration spaces software, and is the fastest virtual machine [&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\/107"}],"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=107"}],"version-history":[{"count":30,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages\/107\/revisions"}],"predecessor-version":[{"id":345,"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/pages\/107\/revisions\/345"}],"wp:attachment":[{"href":"http:\/\/www.mirandabanda.org\/cogblog\/wp-json\/wp\/v2\/media?parent=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}