{"action":"created","issue":{"url":"https://api.github.com/repos/scala-js/scala-js/issues/2122","labels_url":"https://api.github.com/repos/scala-js/scala-js/issues/2122/labels{/name}","comments_url":"https://api.github.com/repos/scala-js/scala-js/issues/2122/comments","events_url":"https://api.github.com/repos/scala-js/scala-js/issues/2122/events","html_url":"https://github.com/scala-js/scala-js/pull/2122","id":122767824,"number":2122,"title":"Tools Refactoring","user":{"login":"gzm0","id":1140323,"avatar_url":"https://avatars.githubusercontent.com/u/1140323?v=3","gravatar_id":"","url":"https://api.github.com/users/gzm0","html_url":"https://github.com/gzm0","followers_url":"https://api.github.com/users/gzm0/followers","following_url":"https://api.github.com/users/gzm0/following{/other_user}","gists_url":"https://api.github.com/users/gzm0/gists{/gist_id}","starred_url":"https://api.github.com/users/gzm0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gzm0/subscriptions","organizations_url":"https://api.github.com/users/gzm0/orgs","repos_url":"https://api.github.com/users/gzm0/repos","events_url":"https://api.github.com/users/gzm0/events{/privacy}","received_events_url":"https://api.github.com/users/gzm0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sjrd","id":535934,"avatar_url":"https://avatars.githubusercontent.com/u/535934?v=3","gravatar_id":"","url":"https://api.github.com/users/sjrd","html_url":"https://github.com/sjrd","followers_url":"https://api.github.com/users/sjrd/followers","following_url":"https://api.github.com/users/sjrd/following{/other_user}","gists_url":"https://api.github.com/users/sjrd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjrd/subscriptions","organizations_url":"https://api.github.com/users/sjrd/orgs","repos_url":"https://api.github.com/users/sjrd/repos","events_url":"https://api.github.com/users/sjrd/events{/privacy}","received_events_url":"https://api.github.com/users/sjrd/received_events","type":"User","site_admin":false},"milestone":null,"comments":66,"created_at":"2015-12-17T16:16:37Z","updated_at":"2016-01-16T21:23:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/scala-js/scala-js/pulls/2122","html_url":"https://github.com/scala-js/scala-js/pull/2122","diff_url":"https://github.com/scala-js/scala-js/pull/2122.diff","patch_url":"https://github.com/scala-js/scala-js/pull/2122.patch"},"body":"This commit substantially refactors Scala.js' linker. Notably:\r\n\r\n# Linker pipeline\r\nThe linker pipeline is divided into a frontend and a backend.\r\n\r\nThe frontend links and optimizes IR files into a `LinkingUnit`. It paves the path for linker plugins in the future.\r\n\r\nThe backend emits a linking unit into a JavaScript file. Currently there are two backends:\r\n* BasicLinkerBackend (basic JavaScript generation, aka fastOptJS)\r\n* ClosureBackend (optimization pass with the Google Closure compiler, aka fullOptJS)\r\n\r\nAs a side effect of this change, Rhino now runs optimized code (unless this is explicitly disabled). This further has the side effect, that the `PreLinkStage` was entirely removed.\r\n\r\n# Classpath traversal\r\nClasspath traversal and abstraction is fully pushed to the build system. As a consequence, the whole `org.scalajs.core.tools.classpath` package is removed. Functionally is mostly replaced by a couple of lines of sbt code.\r\n\r\nThis also fixes #1635.\r\n\r\n# IR caching\r\nIn the past, each linker cached its own IR. This caused a lot of IR to be in memory multiple times. This commit replaces caching with a global IR cache. There are two main advantages:\r\n\r\n* IR for each class is only cached once in memory.\r\n* Linking other projects or configurations (e.g. compile v.s. test) can reuse the already cached IR.\r\n\r\n# JSEnvs\r\nSince classpaths have been removed, we need a way to re-enable lazy loading in Rhino. We therefore introduce the `LinkingUnitJSEnv` that can directly accept a `LinkingUnit`. Further, we enrich the `JSEnv`s with an API to load libraries. This allows for much nicer interfaces in a couple of spots, where you essentially just pass a `JSEnv` and then run your code in it, with all dependencies already present (e.g. FrameworkDetector).\r\n\r\nThere are a couple of advantages:\r\n- Symbol requirements are made explicit\r\n- No duplicate code for linking in RhinoJSEnv\r\n- Rhino can now run with optimized code (and does so by default)"},"comment":{"url":"https://api.github.com/repos/scala-js/scala-js/issues/comments/172259032","html_url":"https://github.com/scala-js/scala-js/pull/2122#issuecomment-172259032","issue_url":"https://api.github.com/repos/scala-js/scala-js/issues/2122","id":172259032,"user":{"login":"scala-jenkins","id":1563693,"avatar_url":"https://avatars.githubusercontent.com/u/1563693?v=3","gravatar_id":"","url":"https://api.github.com/users/scala-jenkins","html_url":"https://github.com/scala-jenkins","followers_url":"https://api.github.com/users/scala-jenkins/followers","following_url":"https://api.github.com/users/scala-jenkins/following{/other_user}","gists_url":"https://api.github.com/users/scala-jenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/scala-jenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scala-jenkins/subscriptions","organizations_url":"https://api.github.com/users/scala-jenkins/orgs","repos_url":"https://api.github.com/users/scala-jenkins/repos","events_url":"https://api.github.com/users/scala-jenkins/events{/privacy}","received_events_url":"https://api.github.com/users/scala-jenkins/received_events","type":"User","site_admin":false},"created_at":"2016-01-16T21:23:50Z","updated_at":"2016-01-16T21:23:50Z","body":"\nRefer to this link for build results (access rights to CI server needed): \n\n<a href='https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/2764/'>https://scala-webapps.epfl.ch/jenkins/job/scalajs-pr/2764/</a>\n<a href='https://scala-webapps.epfl.ch/jenkins/job/scalajs-matrix-build/3562/'>https://scala-webapps.epfl.ch/jenkins/job/scalajs-matrix-build/3562/</a>\nTest FAILed."}}