{"id":18932543,"url":"https://github.com/adrianherrera/probabilistic-calling-context","last_synced_at":"2026-05-05T02:37:57.109Z","repository":{"id":85069635,"uuid":"153444297","full_name":"adrianherrera/probabilistic-calling-context","owner":"adrianherrera","description":"Implementation of Mike Bond's PCC in LLVM","archived":false,"fork":false,"pushed_at":"2020-05-12T02:43:22.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-25T04:36:18.047Z","etag":null,"topics":["calling-context","llvm","probabilistic-calling-context"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrianherrera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-17T11:18:19.000Z","updated_at":"2020-05-18T03:34:54.000Z","dependencies_parsed_at":"2023-03-03T01:00:32.932Z","dependency_job_id":null,"html_url":"https://github.com/adrianherrera/probabilistic-calling-context","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adrianherrera/probabilistic-calling-context","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianherrera%2Fprobabilistic-calling-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianherrera%2Fprobabilistic-calling-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianherrera%2Fprobabilistic-calling-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianherrera%2Fprobabilistic-calling-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrianherrera","download_url":"https://codeload.github.com/adrianherrera/probabilistic-calling-context/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrianherrera%2Fprobabilistic-calling-context/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32633437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["calling-context","llvm","probabilistic-calling-context"],"created_at":"2024-11-08T11:49:39.888Z","updated_at":"2026-05-05T02:37:57.092Z","avatar_url":"https://github.com/adrianherrera.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Probabilistic Calling Context\n\nAn implementation of Mike Bond's \"probabilistic calling context\" (PCC) in LLVM,\nas described in his OOPSLA 2007 paper\n[Probabilistic Calling Context](http://web.cse.ohio-state.edu/~bond.213/pcc-oopsla-2007.pdf).\n\n## Background\n\nA *dynamic calling context* is the sequence of active function invocations that\nlead to a particular program location. This could be described exactly using\na stack backtrace, however walking the stack can be expensive (particularly if\nthe calling context is queried regularly). To counter this cost, Mike Bond\nproposed a *probabilistic* calling context (PCC) that continuously maintains a\nvalue that represents the current calling context with very low overhead. The\nfollowing function is used to compute and maintain the PCC:\n\n```\nf(V, cs) := 3 * V + cs\n```\n\nWhere `V` is the current calling context value and `cs` is an identifier for\nthe call site of a function.\n\n### Differences to the original paper\n\nIn the original PCC paper, `cs` was statically computed by hashing the function\nname and line number. This works well for Java programs (for which PCC was\noriginally implemented for), however within the LLVM framework this approach is\nmore difficult to implement (although still doable). Instead, we assign `cs` a\nrandom number (computed at compile time). This random number serves as an\nidentifier for each call site. This approach is inspired by the instrumentation\nused in the American Fuzzy Lop (AFL) fuzzer.\n\n## Usage\n\nTo build:\n\n```console\nmkdir build\ncd build\ncmake ..\nmake\n```\n\nThis will produce both `pcc-llvm.so` and `libpcc-rt.a`.\n\n* `Transform/pcc-llvm.so`: The LLVM pass; and\n* `Runtime/libpcc-rt.a`: A static library that is linked with your application\nand gives you the ability to query the calling context via `__pcc_query`\n(remember to include `pcc.h`).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianherrera%2Fprobabilistic-calling-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrianherrera%2Fprobabilistic-calling-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrianherrera%2Fprobabilistic-calling-context/lists"}