{"action":"opened","issue":{"url":"https://api.github.com/repos/scala/scala-dev/issues/473","repository_url":"https://api.github.com/repos/scala/scala-dev","labels_url":"https://api.github.com/repos/scala/scala-dev/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/scala/scala-dev/issues/473/comments","events_url":"https://api.github.com/repos/scala/scala-dev/issues/473/events","html_url":"https://github.com/scala/scala-dev/issues/473","id":297976022,"number":473,"title":"Result of inlining a method dealing with generic arrays is disappointing","user":{"login":"retronym","id":65551,"avatar_url":"https://avatars0.githubusercontent.com/u/65551?v=4","gravatar_id":"","url":"https://api.github.com/users/retronym","html_url":"https://github.com/retronym","followers_url":"https://api.github.com/users/retronym/followers","following_url":"https://api.github.com/users/retronym/following{/other_user}","gists_url":"https://api.github.com/users/retronym/gists{/gist_id}","starred_url":"https://api.github.com/users/retronym/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retronym/subscriptions","organizations_url":"https://api.github.com/users/retronym/orgs","repos_url":"https://api.github.com/users/retronym/repos","events_url":"https://api.github.com/users/retronym/events{/privacy}","received_events_url":"https://api.github.com/users/retronym/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-17T03:45:57Z","updated_at":"2018-02-17T03:45:57Z","closed_at":null,"author_association":"OWNER","body":"Perhaps a heuristic to inline `array_apply` / `array_update` / `array_length` when we know the specific array type (reference vs primitive) could do better.\r\n\r\n```scala\r\n  @inline final def hashArray[T <: AnyRef](s: Array[T], hashF: T => Unit): Unit = {\r\n    extend(s.length)\r\n    var i = 0\r\n    while (i < s.length) {\r\n      hashF(s(i))\r\n      i += 1\r\n    }\r\n  }\r\n```\r\n\r\n```scala\r\ndef hashValueParameters(valueParameters: Array[ParameterList]) =\r\n    hashArray(valueParameters, hashValueParameterList)\r\n```\r\n\r\n```\r\npublic hashValueParameters([Lxsbti/api/ParameterList;)V\r\n    // parameter final  valueParameters\r\n    GETSTATIC scala/runtime/ScalaRunTime$.MODULE$ : Lscala/runtime/ScalaRunTime$;\r\n    ALOAD 1\r\n    INVOKEVIRTUAL scala/runtime/ScalaRunTime$.array_length (Ljava/lang/Object;)I\r\n    ISTORE 3\r\n    ALOAD 0\r\n    GETSTATIC scala/util/hashing/MurmurHash3$.MODULE$ : Lscala/util/hashing/MurmurHash3$;\r\n    ALOAD 0\r\n    GETFIELD xsbt/api/HashAPI.xsbt$api$HashAPI$$hash : I\r\n    ILOAD 3\r\n    INVOKEVIRTUAL scala/util/hashing/MurmurHash3$.mix (II)I\r\n    PUTFIELD xsbt/api/HashAPI.xsbt$api$HashAPI$$hash : I\r\n    ICONST_0\r\n    ISTORE 2\r\n   L0\r\n    ILOAD 2\r\n    GETSTATIC scala/runtime/ScalaRunTime$.MODULE$ : Lscala/runtime/ScalaRunTime$;\r\n    ALOAD 1\r\n    INVOKEVIRTUAL scala/runtime/ScalaRunTime$.array_length (Ljava/lang/Object;)I\r\n    IF_ICMPGE L1\r\n    GETSTATIC scala/runtime/ScalaRunTime$.MODULE$ : Lscala/runtime/ScalaRunTime$;\r\n    ALOAD 1\r\n    ILOAD 2\r\n    INVOKEVIRTUAL scala/runtime/ScalaRunTime$.array_apply (Ljava/lang/Object;I)Ljava/lang/Object;\r\n    CHECKCAST xsbti/api/ParameterList\r\n    ASTORE 4\r\n    ALOAD 0\r\n    ALOAD 4\r\n    INVOKESTATIC xsbt/api/HashAPI.$anonfun$hashValueParameters$1 (Lxsbt/api/HashAPI;Lxsbti/api/ParameterList;)V\r\n    ILOAD 2\r\n    ICONST_1\r\n    IADD\r\n    ISTORE 2\r\n    GOTO L0\r\n   L1\r\n    RETURN\r\n    MAXSTACK = 4\r\n    MAXLOCALS = 5\r\n```"}}
{"actor":{"display_login":"retronym"}}