{"id":94,"date":"2012-02-17T13:56:24","date_gmt":"2012-02-17T18:56:24","guid":{"rendered":"http:\/\/blog.mozilla.org\/ted\/?p=94"},"modified":"2012-02-17T13:56:24","modified_gmt":"2012-02-17T18:56:24","slug":"firefox-mobile-on-armv6-processors-2","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/ted\/2012\/02\/17\/firefox-mobile-on-armv6-processors-2\/","title":{"rendered":"Firefox Mobile on ARMv6 processors"},"content":{"rendered":"<p>Most smartphones use <a href=\"http:\/\/en.wikipedia.org\/wiki\/ARM_architecture\">ARM<\/a> processors. Much like how most PCs use <a href=\"http:\/\/en.wikipedia.org\/wiki\/X86\">x86<\/a> processors, for various reasons ARM has become the CPU of choice for mobile devices. Similar to x86, there are different versions of ARM processors that support different features. One of the biggest differences is which <a href=\"http:\/\/en.wikipedia.org\/wiki\/Instruction_set\"><em>instruction set<\/em><\/a> is supported. <em>Instructions<\/em> are the smallest units of what a processor can do, and an <em>instruction set<\/em> are the particular units that a processor knows how to run. For Intel, instruction sets were changed when they went from the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Intel_80386\">386<\/a> to the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Intel_80486\">486<\/a> to the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pentium\">Pentium<\/a> and so on. For ARM, the instruction sets are numbered, with the most current one in use being ARMv7 (with ARMv8 in development). Confusingly, ARM&#8217;s processors themselves have similar naming, with the <a href=\"http:\/\/en.wikipedia.org\/wiki\/ARM11\">ARM11<\/a> being the generation that supports the ARMv6 instruction set, and ARM Cortex being the generation that supports the ARMv7 instruction set. All high-end smartphones that are currently shipping use processors that support the ARMv7 instruction set. The <a href=\"http:\/\/www.apple.com\/iphone\/\">Apple iPhone 4S<\/a>, Samsung <a href=\"http:\/\/www.samsung.com\/global\/microsite\/galaxys2\/html\/\">Galaxy S2<\/a> and <a href=\"http:\/\/www.google.com\/nexus\/\">Galaxy Nexus<\/a>, as well as others all come with similar processors. They&#8217;re all similarly fast as processors in smartphones go, and ARMv7 contains lots of features that allow programs to run very quickly.<\/p>\n<p>How is this relevant to <a href=\"http:\/\/www.mozilla.org\/en-US\/m\/\">Firefox Mobile<\/a>? Currently the builds we&#8217;re producing only run on processors that support ARMv7. This is partially because we&#8217;ve been working on performance for quite a while, and it&#8217;s much harder to get acceptable performance on a slower processor, so targeting only faster processors makes sense. (This is the same reason that <a href=\"https:\/\/market.android.com\/details?id=com.android.chrome&amp;hl=en\">Chrome for Android<\/a> only runs on Android phones running the latest version of Android.) It&#8217;s also partially because all modern JavaScript engines ship with a <a title=\"just-in-time compiler\" href=\"http:\/\/en.wikipedia.org\/wiki\/Just-in-time_compilation\">JIT<\/a>, which is a highly specialized piece of code that needs to know intimate details about the type of processor it&#8217;s running on. We used to produce additional builds that supported ARMv6 alongside our ARMv7 builds, but we saw lots of ARMv6-specific crashes in our crash reporting system, and we didn&#8217;t have the resources to tackle them all. Additionally, we were focused on making Firefox Mobile run well on ARMv7 processors; so making it run well on ARMv6 seemed like a stretch at the time.<\/p>\n<p>Coming back to the present, we&#8217;ve got a revitalized mobile team working on a revamped Firefox Mobile that&#8217;s much faster than previous versions, so the performance target seems much more within reach. We also had people attending MozCamps and other Mozilla events across the globe last year. <a href=\"http:\/\/autonome.wordpress.com\/\">Dietrich<\/a> <a href=\"http:\/\/autonome.wordpress.com\/2011\/04\/29\/trip-log-mozilla-kenya\/\">visited Nairobi for some Mozilla Kenya events<\/a> and found that the most widely used Android phones in Kenya are all ARMv6 devices. In addition, there are lots of Android phones being sold in China that are ARMv6. Even in the USA there are some low-end Android devices being released that are still ARMv6, like the <a href=\"http:\/\/www.gsmarena.com\/lg_optimus_hub-4157.php\">LG Optimus Hub<\/a>, which shipped in October of 2011. As of that date roughly 58% of the Android install base was comprised of ARMv6 phones. That&#8217;s a huge segment of the market that we&#8217;re not supporting.<\/p>\n<p>Because of this, during the Firefox Mobile revamp <a href=\"http:\/\/dougturner.wordpress.com\/\">Doug<\/a> roped me in and asked if I would look into getting our ARMv6 builds back up and running. I started working on it figuring it wouldn&#8217;t be too bad since we used to produce builds. As it turns out, I was wrong. We managed to break things in quite a few ways since we disabled those builds. A few of them were simple fixes in our build configuration (although one of those took <a href=\"http:\/\/glandium.org\/\">Mike Hommey<\/a> and I a solid week of debugging to track down), but I also ran into a few problems with our custom linker. Firefox Mobile ships with a replacement for the system dynamic linker on Android. It&#8217;s pretty complicated, but this is the reason that <a href=\"https:\/\/twitter.com\/#!\/tarasglek\/status\/167303241892237312\">Firefox only takes up about 15MB, whereas Chrome for Android takes up nearly 50MB<\/a> after installation. Being a complicated piece of code there were some hard-to-diagnose bugs in it. Thankfully, with some input from <a href=\"http:\/\/forums.arm.com\/index.php?\/user\/105519-arm-jacob\/page__tab__aboutme\">Jacob Bramley<\/a> from ARM we were able to track down the remaining problem and get builds working again.<\/p>\n<p>With all the setbacks and other issues it&#8217;s not unreasonable to ask why we&#8217;re doing this. Clearly this isn&#8217;t the end of the process by any means. We still have to get automated builds back up and running on our build farm. We will undoubtedly have to shake out more ARMv6-specific bugs in our JavaScript engine and elsewhere. We&#8217;ll almost assuredly have to do some work to make performance acceptable. It&#8217;s a lot of work and it will take time, but this seems like the right thing to do given the number of users we can reach. You can <a title=\"Get ARMv6 builds working again\" href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=697205\">follow along in Bugzilla<\/a> if you&#8217;re interested in this work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most smartphones use ARM processors. Much like how most PCs use x86 processors, for various reasons ARM has become the CPU of choice for mobile devices. Similar to x86, there are different versions of ARM processors that support different features. One of the biggest differences is which instruction set is supported. Instructions are the smallest [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,124],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/94"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/comments?post=94"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/94\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/media?parent=94"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/categories?post=94"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/tags?post=94"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}