{"id":17928557,"url":"https://github.com/kavon/llvm-statepoint-utils","last_synced_at":"2025-03-24T03:31:31.584Z","repository":{"id":45776455,"uuid":"65507859","full_name":"kavon/llvm-statepoint-utils","owner":"kavon","description":"Runtime support for LLVM's GC Statepoints","archived":false,"fork":false,"pushed_at":"2020-03-10T19:41:15.000Z","size":60,"stargazers_count":42,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-19T01:42:08.337Z","etag":null,"topics":["garbage-collection","garbage-collector","llvm","runtime-system","statepoint"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kavon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-11T23:21:25.000Z","updated_at":"2023-12-17T10:33:37.000Z","dependencies_parsed_at":"2022-07-22T06:02:17.742Z","dependency_job_id":null,"html_url":"https://github.com/kavon/llvm-statepoint-utils","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavon%2Fllvm-statepoint-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavon%2Fllvm-statepoint-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavon%2Fllvm-statepoint-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavon%2Fllvm-statepoint-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kavon","download_url":"https://codeload.github.com/kavon/llvm-statepoint-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245204646,"owners_count":20577382,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["garbage-collection","garbage-collector","llvm","runtime-system","statepoint"],"created_at":"2024-10-28T21:04:03.451Z","updated_at":"2025-03-24T03:31:31.334Z","avatar_url":"https://github.com/kavon.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## LLVM Statepoint Utilities\n\n[![Build Status](https://travis-ci.org/kavon/llvm-statepoint-utils.svg?branch=master)](https://travis-ci.org/kavon/llvm-statepoint-utils)\n\nLLVM's [statepoint](http://llvm.org/docs/Statepoints.html)  infrastructure generates stack frame layout information to enable\nprecise garbage collection.\nHowever, the information is not in a suitable form for\nefficient lookups by an actual garbage collector scanning the stack.\nThis design is [intentional](http://llvm.org/docs/StackMaps.html#stack-map-format) because\n\"the runtime is expected to parse the [stack map] immediately after compiling a module and\nencode the information in its own format.\"\n\nThe utilities herein are designed to do just that: it can generate an efficient hash table at runtime that can be used by a garbage collector to walk the stack and find all pointers.\nGenerating the table at runtime works around [issues](https://en.wikipedia.org/wiki/Address_space_layout_randomization) with position independent code, since the table is keyed on absolute return addresses.\nThe code is pure, unadulterated C99\u003csup\u003e[*](#caveat)\u003c/sup\u003e with no dependencies and a permissive license.\n\nNote that this library was designed to work for programs whose stack map information was generated solely by ``gc.statepoint`` intrinsics, as these intrinsics generate specially formatted stack map records. If you're mixing ``patchpoint`` or regular ``stackmap`` intrinsics in the same code, you might need to modify the library in addition to marking call sites to differentiate them from statepoints.\n\nThe currently supported [Stackmap Format](http://llvm.org/docs/StackMaps.html#stack-map-format) is version 3, which is found in LLVM 5+.\n\n#### how to build and use\n\n1. Run ``OPT_FLAG=\"-O3 -DNDEBUG\" make``\n2. Look inside ``dist`` and you should see a library file and a header file\n3. Enjoy\n\n\u003ca name=\"caveat\"\u003e\\*\u003c/a\u003e *almost*... we rely on the [packed attribute](https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#Common-Type-Attributes)\n supported by popular C compilers (*i.e.,* clang and gcc).\n\n#### including these utils in your project\n\nYou can generate a single `.c` and corresponding `.h` file for inclusion in your own\nbuild system. To do this, run `make unified`, and the output code will be placed under `build/`.\n\n#### a fancier implementation\n\nTo avoid having to generate the hash table each time the program starts up, you could extend\nthis utility to instead generate a position-independent, static, callsite-offset table.\nFor example, to lookup information about a callsite, we would:\n\n1.  Take the return address, and subtract from it the starting address of the `.text` section,\n    to obtain the callsite offset.\n    The starting address would change on each launch because of ASLR,\n    but it can be determined once during program startup and saved to a global variable.\n\n2.  Use the call-site offset as the key into the statically allocated table. There are\n    various ways of doing this, such as using a perfect hash function + a pointer array,\n    or generating a standard hash table that is laid out statically in the data section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavon%2Fllvm-statepoint-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavon%2Fllvm-statepoint-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavon%2Fllvm-statepoint-utils/lists"}