{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/corert/pulls/comments/50313147","id":50313147,"diff_hunk":"@@ -0,0 +1,171 @@\n+//\n+// Copyright (c) Microsoft. All rights reserved.\n+// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n+//\n+\n+.intel_syntax noprefix\n+#include <unixasmmacros.inc>\n+\n+// Macro that generates a stub consuming a cache with the given number of entries.\n+.macro DEFINE_INTERFACE_DISPATCH_STUB entries\n+\n+LEAF_ENTRY RhpInterfaceDispatch\\entries, _TEXT\n+\n+        // r10 currently contains the indirection cell address.\n+        // load r11 to point to the cache block.\n+        mov     r11, [r10 + OFFSETOF__InterfaceDispatchCell__m_pCache]\n+\n+        // Load the EEType from the object instance in rdi.\n+        mov     rax, [rdi]\n+\n+        // Point r11 at the address of the first cache entry\n+        // Switch to ATT syntax because add r11, OFFSETOF__InterfaceDispatchCache__m_rgEntries\n+        // refuses to treat symbols as immediate values.\n+        .att_syntax\n+        addq     $OFFSETOF__InterfaceDispatchCache__m_rgEntries, %r11\n+        .intel_syntax noprefix\n+\n+        // For each entry in the cache, see if its EEType type matches the EEType in rax.\n+        // If so, call the second cache entry.  If not, skip the InterfaceDispatchCacheEntry.\n+        .rept \\entries\n+            cmp     rax, [r11]\n+            je      DispatchCall\\entries\n+\n+            .att_syntax\n+            addq    $SIZEOF__InterfaceDispatchCacheEntry, %r11\n+            .intel_syntax noprefix\n+        .endr\n+\n+        // r10 still contains the the indirection cell address.\n+\n+        jmp     C_FUNC(RhpInterfaceDispatchSlow)\n+DispatchCall\\entries:\n+        add     r11, 0x8h\n+        mov     rax, [r11]\n+        jmp     rax\n+LEAF_END RhpInterfaceDispatch\\entries, _TEXT\n+\n+.endm // DEFINE_INTERFACE_DISPATCH_STUB\n+\n+\n+\n+// Define all the stub routines we currently need.\n+//\n+// The mrt100dbi requires these be exported to identify mrt100 code that dispatches back into managed.\n+// If you change or add any new dispatch stubs, please also change slr.def and dbi\\process.cpp CordbProcess::GetExportStepInfo\n+//\n+DEFINE_INTERFACE_DISPATCH_STUB 1\n+DEFINE_INTERFACE_DISPATCH_STUB 2\n+DEFINE_INTERFACE_DISPATCH_STUB 4\n+DEFINE_INTERFACE_DISPATCH_STUB 8\n+DEFINE_INTERFACE_DISPATCH_STUB 16\n+DEFINE_INTERFACE_DISPATCH_STUB 32\n+DEFINE_INTERFACE_DISPATCH_STUB 64\n+\n+// Initial dispatch on an interface when we don't have a cache yet.\n+LEAF_ENTRY RhpInitialInterfaceDispatch, _TEXT\n+ALTERNATE_ENTRY RhpInitialDynamicInterfaceDispatch\n+\n+        // Just tail call to the cache miss helper.\n+        jmp     C_FUNC(RhpInterfaceDispatchSlow)\n+\n+LEAF_END RhpInitialInterfaceDispatch, _TEXT\n+\n+// Cache miss case, call the runtime to resolve the target and update the cache.\n+NESTED_ENTRY RhpInterfaceDispatchSlow, _TEXT, NoHandler\n+\n+        .equ RIDS_ReservedStack, 30h + 50h + 80h + 8h     // Scratch space, transition frame, xmm registers and padding\n+\n+        alloc_stack         RIDS_ReservedStack\n+\n+        // Preserve the argument registers in the scratch space across the helper call. Note that we depend on these\n+        // registers (which may contain GC references) being spilled before we build the PInvokeTransitionFrame below\n+        // due to the way we build a stack range to report to the GC conservatively during a collection.\n+        mov     [rsp + 8*0], rdi","path":"src/Native/Runtime/amd64/StubDispatch.S","position":84,"original_position":84,"commit_id":"b74b76347c489642d6c0807fd11fa244783ee3be","original_commit_id":"291d6bd44403e2df17ce4787d76a754b408331b6","user":{"login":"janvorli","id":10758568,"avatar_url":"https://avatars.githubusercontent.com/u/10758568?v=3","gravatar_id":"","url":"https://api.github.com/users/janvorli","html_url":"https://github.com/janvorli","followers_url":"https://api.github.com/users/janvorli/followers","following_url":"https://api.github.com/users/janvorli/following{/other_user}","gists_url":"https://api.github.com/users/janvorli/gists{/gist_id}","starred_url":"https://api.github.com/users/janvorli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janvorli/subscriptions","organizations_url":"https://api.github.com/users/janvorli/orgs","repos_url":"https://api.github.com/users/janvorli/repos","events_url":"https://api.github.com/users/janvorli/events{/privacy}","received_events_url":"https://api.github.com/users/janvorli/received_events","type":"User","site_admin":false},"body":"Hmm, actually the .cfi annotation in the macros update only the call frame address and so it matters only if you use the push / pop. So in your way, you don't need that and my calling it a benefit is incorrect.","created_at":"2016-01-20T20:23:27Z","updated_at":"2016-01-20T20:23:27Z","html_url":"https://github.com/dotnet/corert/pull/684#discussion_r50313147","pull_request_url":"https://api.github.com/repos/dotnet/corert/pulls/684","_links":{"self":{"href":"https://api.github.com/repos/dotnet/corert/pulls/comments/50313147"},"html":{"href":"https://github.com/dotnet/corert/pull/684#discussion_r50313147"},"pull_request":{"href":"https://api.github.com/repos/dotnet/corert/pulls/684"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/corert/pulls/684","id":56655960,"html_url":"https://github.com/dotnet/corert/pull/684","diff_url":"https://github.com/dotnet/corert/pull/684.diff","patch_url":"https://github.com/dotnet/corert/pull/684.patch","issue_url":"https://api.github.com/repos/dotnet/corert/issues/684","number":684,"state":"open","locked":false,"title":"Interface dispatch for Linux and OSX","user":{"login":"nattress","id":116900,"avatar_url":"https://avatars.githubusercontent.com/u/116900?v=3","gravatar_id":"","url":"https://api.github.com/users/nattress","html_url":"https://github.com/nattress","followers_url":"https://api.github.com/users/nattress/followers","following_url":"https://api.github.com/users/nattress/following{/other_user}","gists_url":"https://api.github.com/users/nattress/gists{/gist_id}","starred_url":"https://api.github.com/users/nattress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nattress/subscriptions","organizations_url":"https://api.github.com/users/nattress/orgs","repos_url":"https://api.github.com/users/nattress/repos","events_url":"https://api.github.com/users/nattress/events{/privacy}","received_events_url":"https://api.github.com/users/nattress/received_events","type":"User","site_admin":false},"body":"Added StubDispatch.S containing the unix assembly interface dispatch helper and cache generation.\r\n\r\nDefined a Unix flavor of AsmOffsets.cpp since assembler symbols are defined differently in GAS vs MASM\r\n\r\nAdd compiler flag that allows lock-free exchange of 16 byte data (used for InterlockedExchange of interface dispatch cache entries) and filled in PalInterlockedCompareExchange128 for Unix\r\n\r\nWorked around missing ManagedCallout2's assembly code on Unix by directly invoking the function pointer passed into it.\r\n\r\nFix bug in PalVirtualAlloc to allocate memory when MEM_COMMIT is specified without MEM_RESERVE on Unix","created_at":"2016-01-20T19:35:51Z","updated_at":"2016-01-20T20:23:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0589509e570dd1353949dcd1f9edb8a007645550","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/corert/pulls/684/commits","review_comments_url":"https://api.github.com/repos/dotnet/corert/pulls/684/comments","review_comment_url":"https://api.github.com/repos/dotnet/corert/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/corert/issues/684/comments","statuses_url":"https://api.github.com/repos/dotnet/corert/statuses/b74b76347c489642d6c0807fd11fa244783ee3be","head":{"label":"nattress:crossplat_interfaces","ref":"crossplat_interfaces","sha":"b74b76347c489642d6c0807fd11fa244783ee3be","user":{"login":"nattress","id":116900,"avatar_url":"https://avatars.githubusercontent.com/u/116900?v=3","gravatar_id":"","url":"https://api.github.com/users/nattress","html_url":"https://github.com/nattress","followers_url":"https://api.github.com/users/nattress/followers","following_url":"https://api.github.com/users/nattress/following{/other_user}","gists_url":"https://api.github.com/users/nattress/gists{/gist_id}","starred_url":"https://api.github.com/users/nattress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nattress/subscriptions","organizations_url":"https://api.github.com/users/nattress/orgs","repos_url":"https://api.github.com/users/nattress/repos","events_url":"https://api.github.com/users/nattress/events{/privacy}","received_events_url":"https://api.github.com/users/nattress/received_events","type":"User","site_admin":false},"repo":{"id":46596706,"name":"corert","full_name":"nattress/corert","owner":{"login":"nattress","id":116900,"avatar_url":"https://avatars.githubusercontent.com/u/116900?v=3","gravatar_id":"","url":"https://api.github.com/users/nattress","html_url":"https://github.com/nattress","followers_url":"https://api.github.com/users/nattress/followers","following_url":"https://api.github.com/users/nattress/following{/other_user}","gists_url":"https://api.github.com/users/nattress/gists{/gist_id}","starred_url":"https://api.github.com/users/nattress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nattress/subscriptions","organizations_url":"https://api.github.com/users/nattress/orgs","repos_url":"https://api.github.com/users/nattress/repos","events_url":"https://api.github.com/users/nattress/events{/privacy}","received_events_url":"https://api.github.com/users/nattress/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nattress/corert","description":"This repo contains CoreRT, a .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying .NET Native compiler toolchain.","fork":true,"url":"https://api.github.com/repos/nattress/corert","forks_url":"https://api.github.com/repos/nattress/corert/forks","keys_url":"https://api.github.com/repos/nattress/corert/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nattress/corert/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nattress/corert/teams","hooks_url":"https://api.github.com/repos/nattress/corert/hooks","issue_events_url":"https://api.github.com/repos/nattress/corert/issues/events{/number}","events_url":"https://api.github.com/repos/nattress/corert/events","assignees_url":"https://api.github.com/repos/nattress/corert/assignees{/user}","branches_url":"https://api.github.com/repos/nattress/corert/branches{/branch}","tags_url":"https://api.github.com/repos/nattress/corert/tags","blobs_url":"https://api.github.com/repos/nattress/corert/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nattress/corert/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nattress/corert/git/refs{/sha}","trees_url":"https://api.github.com/repos/nattress/corert/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nattress/corert/statuses/{sha}","languages_url":"https://api.github.com/repos/nattress/corert/languages","stargazers_url":"https://api.github.com/repos/nattress/corert/stargazers","contributors_url":"https://api.github.com/repos/nattress/corert/contributors","subscribers_url":"https://api.github.com/repos/nattress/corert/subscribers","subscription_url":"https://api.github.com/repos/nattress/corert/subscription","commits_url":"https://api.github.com/repos/nattress/corert/commits{/sha}","git_commits_url":"https://api.github.com/repos/nattress/corert/git/commits{/sha}","comments_url":"https://api.github.com/repos/nattress/corert/comments{/number}","issue_comment_url":"https://api.github.com/repos/nattress/corert/issues/comments{/number}","contents_url":"https://api.github.com/repos/nattress/corert/contents/{+path}","compare_url":"https://api.github.com/repos/nattress/corert/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nattress/corert/merges","archive_url":"https://api.github.com/repos/nattress/corert/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nattress/corert/downloads","issues_url":"https://api.github.com/repos/nattress/corert/issues{/number}","pulls_url":"https://api.github.com/repos/nattress/corert/pulls{/number}","milestones_url":"https://api.github.com/repos/nattress/corert/milestones{/number}","notifications_url":"https://api.github.com/repos/nattress/corert/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nattress/corert/labels{/name}","releases_url":"https://api.github.com/repos/nattress/corert/releases{/id}","created_at":"2015-11-21T01:52:47Z","updated_at":"2016-01-14T06:20:32Z","pushed_at":"2016-01-20T20:22:44Z","git_url":"git://github.com/nattress/corert.git","ssh_url":"git@github.com:nattress/corert.git","clone_url":"https://github.com/nattress/corert.git","svn_url":"https://github.com/nattress/corert","homepage":"http://dotnet.github.io/","size":5952,"stargazers_count":1,"watchers_count":1,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"bfc4ff883e0f93a623d82da5e02b67bfede4d7f8","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":42552143,"name":"corert","full_name":"dotnet/corert","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/corert","description":"This repo contains CoreRT, a .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying .NET Native compiler toolchain.","fork":false,"url":"https://api.github.com/repos/dotnet/corert","forks_url":"https://api.github.com/repos/dotnet/corert/forks","keys_url":"https://api.github.com/repos/dotnet/corert/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/corert/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/corert/teams","hooks_url":"https://api.github.com/repos/dotnet/corert/hooks","issue_events_url":"https://api.github.com/repos/dotnet/corert/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/corert/events","assignees_url":"https://api.github.com/repos/dotnet/corert/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/corert/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/corert/tags","blobs_url":"https://api.github.com/repos/dotnet/corert/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/corert/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/corert/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/corert/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/corert/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/corert/languages","stargazers_url":"https://api.github.com/repos/dotnet/corert/stargazers","contributors_url":"https://api.github.com/repos/dotnet/corert/contributors","subscribers_url":"https://api.github.com/repos/dotnet/corert/subscribers","subscription_url":"https://api.github.com/repos/dotnet/corert/subscription","commits_url":"https://api.github.com/repos/dotnet/corert/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/corert/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/corert/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/corert/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/corert/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/corert/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/corert/merges","archive_url":"https://api.github.com/repos/dotnet/corert/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/corert/downloads","issues_url":"https://api.github.com/repos/dotnet/corert/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/corert/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/corert/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/corert/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/corert/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/corert/releases{/id}","created_at":"2015-09-15T23:10:53Z","updated_at":"2016-01-20T15:40:01Z","pushed_at":"2016-01-20T20:23:10Z","git_url":"git://github.com/dotnet/corert.git","ssh_url":"git@github.com:dotnet/corert.git","clone_url":"https://github.com/dotnet/corert.git","svn_url":"https://github.com/dotnet/corert","homepage":"http://dotnet.github.io/","size":6502,"stargazers_count":228,"watchers_count":228,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":129,"forks":64,"open_issues":129,"watchers":228,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/corert/pulls/684"},"html":{"href":"https://github.com/dotnet/corert/pull/684"},"issue":{"href":"https://api.github.com/repos/dotnet/corert/issues/684"},"comments":{"href":"https://api.github.com/repos/dotnet/corert/issues/684/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/corert/pulls/684/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/corert/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/corert/pulls/684/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/corert/statuses/b74b76347c489642d6c0807fd11fa244783ee3be"}}}}