{"action":"created","comment":{"url":"https://api.github.com/repos/dropbox/pyston/pulls/comments/25211551","id":25211551,"diff_hunk":"@@ -487,24 +490,12 @@ class IRGeneratorImpl : public IRGenerator {\n                 return rtn;\n             }\n             case AST_LangPrimitive::GET_ITER: {\n-                // TODO if this is a type that has an __iter__, we could do way better than this, both in terms of\n-                // function call overhead and resulting type information, if we went with that instead of the generic\n-                // version.\n-                // (ie we can inline getPystonIter here, whether mechanically with LLVM [would require adding more\n-                // optimization passes to make it fast] or by-hand)\n-                //\n-                // TODO Move this behavior into to the type-specific section (compvars.cpp)?\n-                emitter.getBuilder();\n                 assert(node->args.size() == 1);\n                 CompilerVariable* obj = evalExpr(node->args[0], unw_info);\n-\n-                ConcreteCompilerVariable* converted_obj = obj->makeConverted(emitter, obj->getBoxType());\n+                auto rtn = obj->getiter(emitter, getOpInfoForNode(node, unw_info));\n                 obj->decvref(emitter);\n-\n-                llvm::Value* v = emitter.createCall(unw_info, g.funcs.getPystonIter, { converted_obj->getValue() });\n-                assert(v->getType() == g.llvm_value_type_ptr);\n-\n-                return new ConcreteCompilerVariable(UNKNOWN, v, true);\n+                curblock = emitter.getBuilder()->GetInsertBlock();","path":"src/codegen/irgen/irgenerator.cpp","position":66,"original_position":66,"commit_id":"a2b7de1162c3b120acd0fef985841056db186e5d","original_commit_id":"a2b7de1162c3b120acd0fef985841056db186e5d","user":{"login":"kmod","id":271916,"avatar_url":"https://avatars.githubusercontent.com/u/271916?v=3","gravatar_id":"","url":"https://api.github.com/users/kmod","html_url":"https://github.com/kmod","followers_url":"https://api.github.com/users/kmod/followers","following_url":"https://api.github.com/users/kmod/following{/other_user}","gists_url":"https://api.github.com/users/kmod/gists{/gist_id}","starred_url":"https://api.github.com/users/kmod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kmod/subscriptions","organizations_url":"https://api.github.com/users/kmod/orgs","repos_url":"https://api.github.com/users/kmod/repos","events_url":"https://api.github.com/users/kmod/events{/privacy}","received_events_url":"https://api.github.com/users/kmod/received_events","type":"User","site_admin":false},"body":"Hmm so this call worries me because if we wanted to go with this approach (copy the curblock from emitter to curblock), we would need this line a lot more places.\r\n\r\nI think the (hacky) current way of trying to address this is that the emitter has a reference to the curblock, so we should use that.  It looks like it only uses it internally, but we could expose that through some sort of appropriate API, and try to not have multiple places that can get out of sync.","created_at":"2015-02-23T22:53:18Z","updated_at":"2015-02-23T22:53:18Z","html_url":"https://github.com/dropbox/pyston/pull/318#discussion_r25211551","pull_request_url":"https://api.github.com/repos/dropbox/pyston/pulls/318","_links":{"self":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/comments/25211551"},"html":{"href":"https://github.com/dropbox/pyston/pull/318#discussion_r25211551"},"pull_request":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/318"}}},"pull_request":{"url":"https://api.github.com/repos/dropbox/pyston/pulls/318","id":29771198,"html_url":"https://github.com/dropbox/pyston/pull/318","diff_url":"https://github.com/dropbox/pyston/pull/318.diff","patch_url":"https://github.com/dropbox/pyston/pull/318.patch","issue_url":"https://api.github.com/repos/dropbox/pyston/issues/318","number":318,"state":"open","locked":false,"title":"Add compvars and rewriting support for GET_ITER nodes ","user":{"login":"undingen","id":7397630,"avatar_url":"https://avatars.githubusercontent.com/u/7397630?v=3","gravatar_id":"","url":"https://api.github.com/users/undingen","html_url":"https://github.com/undingen","followers_url":"https://api.github.com/users/undingen/followers","following_url":"https://api.github.com/users/undingen/following{/other_user}","gists_url":"https://api.github.com/users/undingen/gists{/gist_id}","starred_url":"https://api.github.com/users/undingen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/undingen/subscriptions","organizations_url":"https://api.github.com/users/undingen/orgs","repos_url":"https://api.github.com/users/undingen/repos","events_url":"https://api.github.com/users/undingen/events{/privacy}","received_events_url":"https://api.github.com/users/undingen/received_events","type":"User","site_admin":false},"body":"If the type analysis successfully determines that the __iter__() and __hasnext__()\r\nmethods we can now replace them with direct calls to the destination.\r\nElse we create a patchpoint and do a rewrite.\r\n\r\n- I'm not sure if there is a cleaner way todo this?\r\n- I inverted the check inside ```BoxdedClass::hasGenericGetattr()``` because I think this is a bug. \r\n- inside the compvar code I'm now passing the ```CallattrFlags``` around instead of the ```bool clsonly```\r\n- only the most common case gets rewriten. e.g. if the object does not implement \"__iter__\" I fallback and call  a helper function\r\n``` \r\npyston (calibration)                      :    0.8s baseline2: 0.8 (+2.7%)\r\npyston interp2.py                         :    3.4s baseline2: 3.7 (-8.9%)\r\npyston raytrace.py                        :    6.7s baseline2: 6.7 (-0.3%)\r\npyston nbody.py                           :    7.0s baseline2: 7.8 (-10.4%)\r\npyston fannkuch.py                        :    5.9s baseline2: 5.9 (-0.4%)\r\npyston chaos.py                           :   15.7s baseline2: 18.0 (-12.7%)\r\npyston spectral_norm.py                   :   16.9s baseline2: 16.9 (-0.0%)\r\npyston fasta.py                           :    5.8s baseline2: 5.4 (+5.8%)\r\npyston pidigits.py                        :    4.2s baseline2: 4.2 (-0.4%)\r\npyston richards.py                        :    1.4s baseline2: 1.5 (-5.0%)\r\npyston deltablue.py                       :    2.1s baseline2: 2.1 (+0.2%)\r\npyston (geomean-0b9f)                     :    5.3s baseline2: 5.5 (-3.4%)\r\n```\r\n\r\n","created_at":"2015-02-22T14:47:30Z","updated_at":"2015-02-23T22:53:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77020ec51ee3150e20b82fa9e1c1b67a69c3c33a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dropbox/pyston/pulls/318/commits","review_comments_url":"https://api.github.com/repos/dropbox/pyston/pulls/318/comments","review_comment_url":"https://api.github.com/repos/dropbox/pyston/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dropbox/pyston/issues/318/comments","statuses_url":"https://api.github.com/repos/dropbox/pyston/statuses/a2b7de1162c3b120acd0fef985841056db186e5d","head":{"label":"undingen:getiter2","ref":"getiter2","sha":"a2b7de1162c3b120acd0fef985841056db186e5d","user":{"login":"undingen","id":7397630,"avatar_url":"https://avatars.githubusercontent.com/u/7397630?v=3","gravatar_id":"","url":"https://api.github.com/users/undingen","html_url":"https://github.com/undingen","followers_url":"https://api.github.com/users/undingen/followers","following_url":"https://api.github.com/users/undingen/following{/other_user}","gists_url":"https://api.github.com/users/undingen/gists{/gist_id}","starred_url":"https://api.github.com/users/undingen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/undingen/subscriptions","organizations_url":"https://api.github.com/users/undingen/orgs","repos_url":"https://api.github.com/users/undingen/repos","events_url":"https://api.github.com/users/undingen/events{/privacy}","received_events_url":"https://api.github.com/users/undingen/received_events","type":"User","site_admin":false},"repo":{"id":19117126,"name":"pyston","full_name":"undingen/pyston","owner":{"login":"undingen","id":7397630,"avatar_url":"https://avatars.githubusercontent.com/u/7397630?v=3","gravatar_id":"","url":"https://api.github.com/users/undingen","html_url":"https://github.com/undingen","followers_url":"https://api.github.com/users/undingen/followers","following_url":"https://api.github.com/users/undingen/following{/other_user}","gists_url":"https://api.github.com/users/undingen/gists{/gist_id}","starred_url":"https://api.github.com/users/undingen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/undingen/subscriptions","organizations_url":"https://api.github.com/users/undingen/orgs","repos_url":"https://api.github.com/users/undingen/repos","events_url":"https://api.github.com/users/undingen/events{/privacy}","received_events_url":"https://api.github.com/users/undingen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/undingen/pyston","description":"An open-source Python implementation using JIT techniques. ","fork":true,"url":"https://api.github.com/repos/undingen/pyston","forks_url":"https://api.github.com/repos/undingen/pyston/forks","keys_url":"https://api.github.com/repos/undingen/pyston/keys{/key_id}","collaborators_url":"https://api.github.com/repos/undingen/pyston/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/undingen/pyston/teams","hooks_url":"https://api.github.com/repos/undingen/pyston/hooks","issue_events_url":"https://api.github.com/repos/undingen/pyston/issues/events{/number}","events_url":"https://api.github.com/repos/undingen/pyston/events","assignees_url":"https://api.github.com/repos/undingen/pyston/assignees{/user}","branches_url":"https://api.github.com/repos/undingen/pyston/branches{/branch}","tags_url":"https://api.github.com/repos/undingen/pyston/tags","blobs_url":"https://api.github.com/repos/undingen/pyston/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/undingen/pyston/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/undingen/pyston/git/refs{/sha}","trees_url":"https://api.github.com/repos/undingen/pyston/git/trees{/sha}","statuses_url":"https://api.github.com/repos/undingen/pyston/statuses/{sha}","languages_url":"https://api.github.com/repos/undingen/pyston/languages","stargazers_url":"https://api.github.com/repos/undingen/pyston/stargazers","contributors_url":"https://api.github.com/repos/undingen/pyston/contributors","subscribers_url":"https://api.github.com/repos/undingen/pyston/subscribers","subscription_url":"https://api.github.com/repos/undingen/pyston/subscription","commits_url":"https://api.github.com/repos/undingen/pyston/commits{/sha}","git_commits_url":"https://api.github.com/repos/undingen/pyston/git/commits{/sha}","comments_url":"https://api.github.com/repos/undingen/pyston/comments{/number}","issue_comment_url":"https://api.github.com/repos/undingen/pyston/issues/comments{/number}","contents_url":"https://api.github.com/repos/undingen/pyston/contents/{+path}","compare_url":"https://api.github.com/repos/undingen/pyston/compare/{base}...{head}","merges_url":"https://api.github.com/repos/undingen/pyston/merges","archive_url":"https://api.github.com/repos/undingen/pyston/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/undingen/pyston/downloads","issues_url":"https://api.github.com/repos/undingen/pyston/issues{/number}","pulls_url":"https://api.github.com/repos/undingen/pyston/pulls{/number}","milestones_url":"https://api.github.com/repos/undingen/pyston/milestones{/number}","notifications_url":"https://api.github.com/repos/undingen/pyston/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/undingen/pyston/labels{/name}","releases_url":"https://api.github.com/repos/undingen/pyston/releases{/id}","created_at":"2014-04-24T17:17:10Z","updated_at":"2015-01-27T22:17:13Z","pushed_at":"2015-02-23T16:50:06Z","git_url":"git://github.com/undingen/pyston.git","ssh_url":"git@github.com:undingen/pyston.git","clone_url":"https://github.com/undingen/pyston.git","svn_url":"https://github.com/undingen/pyston","homepage":"https://tech.dropbox.com/2014/04/introducing-pyston-an-upcoming-jit-based-python-implementation/","size":14509,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dropbox:master","ref":"master","sha":"befacc74e8a4d5a0c3c4eab4d0585d171000dc54","user":{"login":"dropbox","id":559357,"avatar_url":"https://avatars.githubusercontent.com/u/559357?v=3","gravatar_id":"","url":"https://api.github.com/users/dropbox","html_url":"https://github.com/dropbox","followers_url":"https://api.github.com/users/dropbox/followers","following_url":"https://api.github.com/users/dropbox/following{/other_user}","gists_url":"https://api.github.com/users/dropbox/gists{/gist_id}","starred_url":"https://api.github.com/users/dropbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropbox/subscriptions","organizations_url":"https://api.github.com/users/dropbox/orgs","repos_url":"https://api.github.com/users/dropbox/repos","events_url":"https://api.github.com/users/dropbox/events{/privacy}","received_events_url":"https://api.github.com/users/dropbox/received_events","type":"Organization","site_admin":false},"repo":{"id":18320947,"name":"pyston","full_name":"dropbox/pyston","owner":{"login":"dropbox","id":559357,"avatar_url":"https://avatars.githubusercontent.com/u/559357?v=3","gravatar_id":"","url":"https://api.github.com/users/dropbox","html_url":"https://github.com/dropbox","followers_url":"https://api.github.com/users/dropbox/followers","following_url":"https://api.github.com/users/dropbox/following{/other_user}","gists_url":"https://api.github.com/users/dropbox/gists{/gist_id}","starred_url":"https://api.github.com/users/dropbox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dropbox/subscriptions","organizations_url":"https://api.github.com/users/dropbox/orgs","repos_url":"https://api.github.com/users/dropbox/repos","events_url":"https://api.github.com/users/dropbox/events{/privacy}","received_events_url":"https://api.github.com/users/dropbox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dropbox/pyston","description":"An open-source Python implementation using JIT techniques. ","fork":false,"url":"https://api.github.com/repos/dropbox/pyston","forks_url":"https://api.github.com/repos/dropbox/pyston/forks","keys_url":"https://api.github.com/repos/dropbox/pyston/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dropbox/pyston/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dropbox/pyston/teams","hooks_url":"https://api.github.com/repos/dropbox/pyston/hooks","issue_events_url":"https://api.github.com/repos/dropbox/pyston/issues/events{/number}","events_url":"https://api.github.com/repos/dropbox/pyston/events","assignees_url":"https://api.github.com/repos/dropbox/pyston/assignees{/user}","branches_url":"https://api.github.com/repos/dropbox/pyston/branches{/branch}","tags_url":"https://api.github.com/repos/dropbox/pyston/tags","blobs_url":"https://api.github.com/repos/dropbox/pyston/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dropbox/pyston/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dropbox/pyston/git/refs{/sha}","trees_url":"https://api.github.com/repos/dropbox/pyston/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dropbox/pyston/statuses/{sha}","languages_url":"https://api.github.com/repos/dropbox/pyston/languages","stargazers_url":"https://api.github.com/repos/dropbox/pyston/stargazers","contributors_url":"https://api.github.com/repos/dropbox/pyston/contributors","subscribers_url":"https://api.github.com/repos/dropbox/pyston/subscribers","subscription_url":"https://api.github.com/repos/dropbox/pyston/subscription","commits_url":"https://api.github.com/repos/dropbox/pyston/commits{/sha}","git_commits_url":"https://api.github.com/repos/dropbox/pyston/git/commits{/sha}","comments_url":"https://api.github.com/repos/dropbox/pyston/comments{/number}","issue_comment_url":"https://api.github.com/repos/dropbox/pyston/issues/comments{/number}","contents_url":"https://api.github.com/repos/dropbox/pyston/contents/{+path}","compare_url":"https://api.github.com/repos/dropbox/pyston/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dropbox/pyston/merges","archive_url":"https://api.github.com/repos/dropbox/pyston/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dropbox/pyston/downloads","issues_url":"https://api.github.com/repos/dropbox/pyston/issues{/number}","pulls_url":"https://api.github.com/repos/dropbox/pyston/pulls{/number}","milestones_url":"https://api.github.com/repos/dropbox/pyston/milestones{/number}","notifications_url":"https://api.github.com/repos/dropbox/pyston/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dropbox/pyston/labels{/name}","releases_url":"https://api.github.com/repos/dropbox/pyston/releases{/id}","created_at":"2014-04-01T07:17:20Z","updated_at":"2015-02-23T22:38:18Z","pushed_at":"2015-02-23T22:38:17Z","git_url":"git://github.com/dropbox/pyston.git","ssh_url":"git@github.com:dropbox/pyston.git","clone_url":"https://github.com/dropbox/pyston.git","svn_url":"https://github.com/dropbox/pyston","homepage":"https://tech.dropbox.com/2014/04/introducing-pyston-an-upcoming-jit-based-python-implementation/","size":18901,"stargazers_count":2677,"watchers_count":2677,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":196,"mirror_url":null,"open_issues_count":63,"forks":196,"open_issues":63,"watchers":2677,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/318"},"html":{"href":"https://github.com/dropbox/pyston/pull/318"},"issue":{"href":"https://api.github.com/repos/dropbox/pyston/issues/318"},"comments":{"href":"https://api.github.com/repos/dropbox/pyston/issues/318/comments"},"review_comments":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/318/comments"},"review_comment":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dropbox/pyston/pulls/318/commits"},"statuses":{"href":"https://api.github.com/repos/dropbox/pyston/statuses/a2b7de1162c3b120acd0fef985841056db186e5d"}}}}