{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/1233","labels_url":"https://api.github.com/repos/dotnet/coreclr/issues/1233/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/coreclr/issues/1233/comments","events_url":"https://api.github.com/repos/dotnet/coreclr/issues/1233/events","html_url":"https://github.com/dotnet/coreclr/issues/1233","id":94788682,"number":1233,"title":"Funclet stack frames","user":{"login":"JosephTremoulet","id":10655216,"avatar_url":"https://avatars.githubusercontent.com/u/10655216?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephTremoulet","html_url":"https://github.com/JosephTremoulet","followers_url":"https://api.github.com/users/JosephTremoulet/followers","following_url":"https://api.github.com/users/JosephTremoulet/following{/other_user}","gists_url":"https://api.github.com/users/JosephTremoulet/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephTremoulet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephTremoulet/subscriptions","organizations_url":"https://api.github.com/users/JosephTremoulet/orgs","repos_url":"https://api.github.com/users/JosephTremoulet/repos","events_url":"https://api.github.com/users/JosephTremoulet/events{/privacy}","received_events_url":"https://api.github.com/users/JosephTremoulet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-13T19:06:08Z","updated_at":"2015-07-21T17:03:49Z","closed_at":null,"body":"I'm looking at the frame setup code for EH funclets.  I see that the frame that is created upon entry to a funclet is just a small thing that holds callee-saves, the PSPSym, and outgoing args; for all other purposes, funclets use the frame of the main function, and the funclet prolog sequence sets up the frame pointer to point to that main function frame.\r\n \r\nThis poses a problem for LLILC, because LLVM isn't equipped to handle that kind of frame sharing (in particular, the size of space needed for e.g. register spills in the funclet isn't known when the frame for the main function is finalized).  So on the compiler side, it would be preferable for each funclet to use its own frame for spills and the like (and thus use a normal prolog that sets up the frame pointer to point to that frame); locals would still be homed in the main function's frame, and the funclets would access them indirectly off the PSPSym (and they'd be reported to the GC from the main function, not the funclet(s)).\r\n \r\nThis raises a few questions:\r\n1) Can the GC tolerate funclets that have their own frames?  From my reading of code/comments, it sounds like I'd definitely want WantsReportOnlyLeaf to be false, but it's not clear to me if that would be enough.  For nested funclets, does !WantsReportOnlyLeaf imply calling back for all funclets, or just the leaf funclet and the main function (skipping over intermediate funclets)?\r\n2) Can the debugger and debug info handle having the frame pointer set to a different address in funclets than it is in the main function?\r\n3) Does anywhere else come to mind that the runtime would assume a shared frame pointer?\r\n4) For things that wouldn't just work, would it require large or small changes to make them work?\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/coreclr/issues/comments/123403609","html_url":"https://github.com/dotnet/coreclr/issues/1233#issuecomment-123403609","issue_url":"https://api.github.com/repos/dotnet/coreclr/issues/1233","id":123403609,"user":{"login":"JosephTremoulet","id":10655216,"avatar_url":"https://avatars.githubusercontent.com/u/10655216?v=3","gravatar_id":"","url":"https://api.github.com/users/JosephTremoulet","html_url":"https://github.com/JosephTremoulet","followers_url":"https://api.github.com/users/JosephTremoulet/followers","following_url":"https://api.github.com/users/JosephTremoulet/following{/other_user}","gists_url":"https://api.github.com/users/JosephTremoulet/gists{/gist_id}","starred_url":"https://api.github.com/users/JosephTremoulet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JosephTremoulet/subscriptions","organizations_url":"https://api.github.com/users/JosephTremoulet/orgs","repos_url":"https://api.github.com/users/JosephTremoulet/repos","events_url":"https://api.github.com/users/JosephTremoulet/events{/privacy}","received_events_url":"https://api.github.com/users/JosephTremoulet/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T17:03:49Z","updated_at":"2015-07-21T17:03:49Z","body":"Thanks for the pointers, Noah.\r\n\r\nI'm wondering if there's a middle-ground where funclets still point the frame pointer to the parent frame (that seems to be the most pervasive assumption) and still home locals in the parent frame (that matches their scope anyway), but where funclet-local temps could be spilled to funclet frames (accessed off the stack pointer) and we could free up some of the other cross-frame dependencies.  It seems like any such approach would require changing the interface with the GC, though (is that a non-starter?), to allow reporting per-funclet rather than per-method.  In particular it would be nice if funclets could have GC pointer spilled temps and the slots didn't have to line up, and if the PSPSymbol didn't need to be placed somewhere that forces (on x64) each funclet's frame to have the same amount of outgoing argument space.  I'd naively hope that the result would be a simplification in the GC scanning code, since I think what I'm wanting is for funclet frames to be treated similarly to regular frames there (though the burden of supporting different conventions for different jits might outweigh that?).  I'd also think it would be nice not to require the main/hot path to allocate stack space for presumably-cold funclets.\r\n\r\nThoughts?"}}