Philip Reames via llvm-dev
2018-Nov-08 15:21 UTC
[llvm-dev] Building GC on statepoint-example
Jordon, I just submitted a change to the docs to hopefully address your confusion. Can you take a look and let me know if you have further questions? Start with the revised Stack Map Format section. Philip p.s. I just submitted this and it'll take a few minutes to refresh. In the meantime, you could look at the diff for 346405. On 11/2/18 2:52 PM, Jordan Rudd via llvm-dev wrote:> Note: These instructions seem to be targeted towards people creating a > JIT. My compiler compiles to native. I suppose I just need a reference > to the stack location of the stack map, wherever that is. > ------------------------------------------------------------------------ > *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Jordan > Rudd via llvm-dev <llvm-dev at lists.llvm.org> > *Sent:* Thursday, November 1, 2018 2:06 PM > *To:* llvm-dev at lists.llvm.org > *Subject:* [llvm-dev] Building GC on statepoint-example > Hi, > > I'm trying to build a gc using the statepoint-example strategy. > However, after hours of searching, reading documentation and trying to > find code examples online, I cannot figure out how to access the Stack > Map. > > The documentation for statepoint-example says: > > /The stack map format generated by this GC strategy can be found in > theStack Map Section > <https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStackMaps.html%23stackmap-section&data=02%7C01%7C%7Ce9642625652f4a29fc1f08d6403dfa73%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636767032264647521&sdata=2cqSbyrmgxWfRh95yvOnwU6v42J1HRxI7dPwkSLARTY%3D&reserved=0>using > a format documentedhere > <https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStatepoints.html%23statepoint-stackmap-format&data=02%7C01%7C%7Ce9642625652f4a29fc1f08d6403dfa73%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636767032264647521&sdata=FhoqamuJExS4ZPyk4i2xnHkGS6A13f0v4wIszJ5oBRE%3D&reserved=0>. > This format is intended to be the standard format supported by LLVM > going forward./ > > Ok, great, I see the format. But... how do I access the Stack Map from > my runtime? Where is it? > > The link seems to send me to this instruction: > > /A JIT compiler can easily access this section by providing its own > memory manager via the LLVM C > API|LLVMCreateSimpleMCJITMemoryManager()|. When creating the memory > manager, the JIT provides a > callback:|LLVMMemoryManagerAllocateDataSectionCallback()|. When LLVM > creates this section, it invokes the callback and passes the section > name./ > > None of these API's are well-documented, so I'm kind of trying to > guess what to do here. As a proof of concept, I tried building a > do-nothing memory manager that > calls APILLVMCreateSimpleMCJITMemoryManager on static initialization > and passes the callbacks to it. I link the necessary llvm libs into my > runtime and fire it up. > > I can confirm that my safepoint poll code is getting hit. I can > confirm that creating the "memory manager" is called on runtime boot > and that it's succeeding. But the callbacks never get hit. Even if > they were, it's unclear how I would use the parameters of those > callbacks to locate the stack map. > > What am I missing? > > Thanks! > Jordan > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181108/78198f5c/attachment.html>
Jordan Rudd via llvm-dev
2018-Nov-08 17:06 UTC
[llvm-dev] Building GC on statepoint-example
Yes, that's more clear (you duplicated the word specified, minor typo). The other part that threw me off was that the section name was only identified "for Darwin." I was able to find the section via assembly inspection, but that threw me off a bit. ________________________________ From: Philip Reames <listmail at philipreames.com> Sent: Thursday, November 8, 2018 7:21 AM To: Jordan Rudd; llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Building GC on statepoint-example Jordon, I just submitted a change to the docs to hopefully address your confusion. Can you take a look and let me know if you have further questions? Start with the revised Stack Map Format section. Philip p.s. I just submitted this and it'll take a few minutes to refresh. In the meantime, you could look at the diff for 346405. On 11/2/18 2:52 PM, Jordan Rudd via llvm-dev wrote: Note: These instructions seem to be targeted towards people creating a JIT. My compiler compiles to native. I suppose I just need a reference to the stack location of the stack map, wherever that is. ________________________________ From: llvm-dev <llvm-dev-bounces at lists.llvm.org><mailto:llvm-dev-bounces at lists.llvm.org> on behalf of Jordan Rudd via llvm-dev <llvm-dev at lists.llvm.org><mailto:llvm-dev at lists.llvm.org> Sent: Thursday, November 1, 2018 2:06 PM To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> Subject: [llvm-dev] Building GC on statepoint-example Hi, I'm trying to build a gc using the statepoint-example strategy. However, after hours of searching, reading documentation and trying to find code examples online, I cannot figure out how to access the Stack Map. The documentation for statepoint-example says: The stack map format generated by this GC strategy can be found in the Stack Map Section<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStackMaps.html%23stackmap-section&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=5TKPXTyU5xCrGx67PXW%2FfOHUxhmBJxLAFh1Qckj7jMk%3D&reserved=0> using a format documented here<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStatepoints.html%23statepoint-stackmap-format&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=HXlqIsOn9UXV8kCW508RVYs4UaGk6sDG8VfjmzCHiOc%3D&reserved=0>. This format is intended to be the standard format supported by LLVM going forward. Ok, great, I see the format. But... how do I access the Stack Map from my runtime? Where is it? The link seems to send me to this instruction: A JIT compiler can easily access this section by providing its own memory manager via the LLVM C APILLVMCreateSimpleMCJITMemoryManager(). When creating the memory manager, the JIT provides a callback:LLVMMemoryManagerAllocateDataSectionCallback(). When LLVM creates this section, it invokes the callback and passes the section name. None of these API's are well-documented, so I'm kind of trying to guess what to do here. As a proof of concept, I tried building a do-nothing memory manager that calls APILLVMCreateSimpleMCJITMemoryManager on static initialization and passes the callbacks to it. I link the necessary llvm libs into my runtime and fire it up. I can confirm that my safepoint poll code is getting hit. I can confirm that creating the "memory manager" is called on runtime boot and that it's succeeding. But the callbacks never get hit. Even if they were, it's unclear how I would use the parameters of those callbacks to locate the stack map. What am I missing? Thanks! Jordan _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=%2BRKrFLsD8wLLSHLi4zaXNbY2kOV5ElUbrNUjRkGEWj0%3D&reserved=0> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181108/e44f85aa/attachment.html>
Philip Reames via llvm-dev
2018-Nov-08 17:23 UTC
[llvm-dev] Building GC on statepoint-example
Both should be fixed in 346416. Philip On 11/8/18 9:06 AM, Jordan Rudd wrote:> Yes, that's more clear (you duplicated the word specified, minor typo). > > The other part that threw me off was that the section name was only > identified "for Darwin." I was able to find the section via assembly > inspection, but that threw me off a bit. > ------------------------------------------------------------------------ > *From:* Philip Reames <listmail at philipreames.com> > *Sent:* Thursday, November 8, 2018 7:21 AM > *To:* Jordan Rudd; llvm-dev at lists.llvm.org > *Subject:* Re: [llvm-dev] Building GC on statepoint-example > > Jordon, > > > I just submitted a change to the docs to hopefully address your > confusion. Can you take a look and let me know if you have further > questions? Start with the revised Stack Map Format section. > > > Philip > > > p.s. I just submitted this and it'll take a few minutes to refresh. > In the meantime, you could look at the diff for 346405. > > > On 11/2/18 2:52 PM, Jordan Rudd via llvm-dev wrote: >> Note: These instructions seem to be targeted towards people creating >> a JIT. My compiler compiles to native. I suppose I just need a >> reference to the stack location of the stack map, wherever that is. >> ------------------------------------------------------------------------ >> *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> >> <mailto:llvm-dev-bounces at lists.llvm.org> on behalf of Jordan Rudd via >> llvm-dev <llvm-dev at lists.llvm.org> <mailto:llvm-dev at lists.llvm.org> >> *Sent:* Thursday, November 1, 2018 2:06 PM >> *To:* llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> *Subject:* [llvm-dev] Building GC on statepoint-example >> Hi, >> >> I'm trying to build a gc using the statepoint-example strategy. >> However, after hours of searching, reading documentation and trying >> to find code examples online, I cannot figure out how to access the >> Stack Map. >> >> The documentation for statepoint-example says: >> >> /The stack map format generated by this GC strategy can be found in >> theStack Map Section >> <https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStackMaps.html%23stackmap-section&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=5TKPXTyU5xCrGx67PXW%2FfOHUxhmBJxLAFh1Qckj7jMk%3D&reserved=0>using >> a format documentedhere >> <https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fllvm.org%2Fdocs%2FStatepoints.html%23statepoint-stackmap-format&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=HXlqIsOn9UXV8kCW508RVYs4UaGk6sDG8VfjmzCHiOc%3D&reserved=0>. >> This format is intended to be the standard format supported by LLVM >> going forward./ >> >> Ok, great, I see the format. But... how do I access the Stack Map >> from my runtime? Where is it? >> >> The link seems to send me to this instruction: >> >> /A JIT compiler can easily access this section by providing its own >> memory manager via the LLVM C >> API|LLVMCreateSimpleMCJITMemoryManager()|. When creating the memory >> manager, the JIT provides a >> callback:|LLVMMemoryManagerAllocateDataSectionCallback()|. When LLVM >> creates this section, it invokes the callback and passes the section >> name./ >> >> None of these API's are well-documented, so I'm kind of trying to >> guess what to do here. As a proof of concept, I tried building a >> do-nothing memory manager that >> calls APILLVMCreateSimpleMCJITMemoryManager on static initialization >> and passes the callbacks to it. I link the necessary llvm libs into >> my runtime and fire it up. >> >> I can confirm that my safepoint poll code is getting hit. I can >> confirm that creating the "memory manager" is called on runtime boot >> and that it's succeeding. But the callbacks never get hit. Even if >> they were, it's unclear how I would use the parameters of those >> callbacks to locate the stack map. >> >> What am I missing? >> >> Thanks! >> Jordan >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://eur02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev&data=02%7C01%7C%7C0d564a3c7b9a42962e2608d6458de2c0%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636772873036011590&sdata=%2BRKrFLsD8wLLSHLi4zaXNbY2kOV5ElUbrNUjRkGEWj0%3D&reserved=0>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181108/702f09bc/attachment.html>