{"id":174,"date":"2007-10-11T12:10:06","date_gmt":"2007-10-11T16:10:06","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2007-10-11\/dehydra-ftw\/"},"modified":"2007-10-11T12:10:06","modified_gmt":"2007-10-11T16:10:06","slug":"dehydra-ftw","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2007-10-11\/dehydra-ftw\/","title":{"rendered":"Dehydra is cool"},"content":{"rendered":"<p>In a lonely corner of Mozilla-land, <a href=\"http:\/\/blog.mozilla.com\/tglek\">Taras Glek<\/a> has been working on tools to support automated analysis and rewriting of the Mozilla codebase. I hadn&#8217;t gotten a chance to play with these tools until recently, when I started working on mozilla2 code refactoring pretty much full-time. And Taras&#8217; tools are amazing!<\/p>\n<p>For instance, for <a href=\"http:\/\/wiki.mozilla.org\/XPCOMGC\">XPCOMGC<\/a> we needed to  identify Mozilla XPCOM classes that <a href=\"http:\/\/wiki.mozilla.org\/XPCOMGC\/GCObject_Inheritance\">need to inherit from GCObject<\/a>. Taras has an uber-cool tool called Dehydra that reflects the C++ AST into JavaScript: with a little handholding, I was able to write the logic for this task in in <a href='http:\/\/benjamin.smedbergs.us\/blog\/wp-content\/uploads\/2007\/10\/gcobject.js' title='gcobject.js'>127-line JS file<\/a>!<\/p>\n<pre>Processing (122\/2004): .\/security\/manager\/ssl\/src\/nsSmartCardMonitor.ii...  running dehydra... done.<\/pre>\n<p>It takes about 4 hours to run this script on every file in the tree (using multiple cores could make this much faster). Then I use a <a href='http:\/\/benjamin.smedbergs.us\/blog\/wp-content\/uploads\/2007\/10\/add-gcobject-inheritancepy.txt' title='add-gcobject-inheritance.py'>python script<\/a> to post-process the output and create <a href='http:\/\/benjamin.smedbergs.us\/blog\/wp-content\/uploads\/2007\/10\/gcobjectpatch.txt' title='gcobject.patch'>gcobject.patch<\/a> (truncated example patch).<\/p>\n<p>The possible uses of dehydra are almost limitless: it&#8217;s very likely that in due course we will do nightly dehydra runs with scripts that detect bad code patterns; it&#8217;s also possible to  set up a tryserver to run dehydra over a build tree.<\/p>\n<p>See the <a href=\"http:\/\/wiki.mozilla.org\/DeHydra\">Mozilla wik<\/a>i for more information about dehydra, including links to a PDF specification and more information from Taras&#8217; blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a lonely corner of Mozilla-land, Taras Glek has been working on tools to support automated analysis and rewriting of the Mozilla codebase. I hadn&#8217;t gotten a chance to play with these tools until recently, when I started working on mozilla2 code refactoring pretty much full-time. And Taras&#8217; tools are amazing! For instance, for XPCOMGC [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[57,56],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-dehydra","tag-mozilla2"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}