Title: Auto-deref map access in assignments and Add Forward Declarations by SiyuanSun0736 · Pull Request #14 · multikernel/kernelscript · GitHub
Open Graph Title: Auto-deref map access in assignments and Add Forward Declarations by SiyuanSun0736 · Pull Request #14 · multikernel/kernelscript
X Title: Auto-deref map access in assignments and Add Forward Declarations by SiyuanSun0736 · Pull Request #14 · multikernel/kernelscript
Description: Overview
This PR resolves a type mismatch bug in eBPF C code generation and improves the robustness of userspace code generation. The primary fix ensures that map lookups on the right-hand side of assignment statements follow KernelScript's value semantics rather than returning raw pointers.
Key Changes
1. eBPF C Codegen: Assignment Value Semantics
Target: src/ebpf_c_codegen.ml
Change: Modified generate_assignment to use auto_deref_map_access:true when the source value is an IRMapAccess.
Logic: Previously, while variable declarations (e.g., var x = map[k]) correctly generated dereferencing logic, standard assignments (e.g., x = map[k]) were incorrectly assigning the bpf_map_lookup_elem pointer directly to a value-type variable.
2. Userspace Codegen: Forward Declarations
Target: src/userspace_codegen.ml
Change: Added logic to generate forward declarations for ring buffer callback handlers (e.g., int
Open Graph Description: Overview This PR resolves a type mismatch bug in eBPF C code generation and improves the robustness of userspace code generation. The primary fix ensures that map lookups on the right-hand side of ...
X Description: Overview This PR resolves a type mismatch bug in eBPF C code generation and improves the robustness of userspace code generation. The primary fix ensures that map lookups on the right-hand side of ...
Opengraph URL: https://github.com/multikernel/kernelscript/pull/14
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c96cdc4d-6a49-408c-03e7-277b9f57b80e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D1C2:D33D6:88C77:C1CE7:6A61F7F0 |
| html-safe-nonce | 747a54b2e5ef5d6b285a060e5e142ec132949f5298292ad5a4b9379874ae6080 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUMyOkQzM0Q2Ojg4Qzc3OkMxQ0U3OjZBNjFGN0YwIiwidmlzaXRvcl9pZCI6IjIzMDUxMzIwOTk0MjE3MzA4MDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f0719f414a1b0f7e0f820f9f3af39af11a747f2359420c8dd18720ecaa94286c |
| hovercard-subject-tag | pull_request:3367274583 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/multikernel/kernelscript/pull/14/files |
| twitter:image | https://avatars.githubusercontent.com/u/100674758?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/100674758?s=400&v=4 |
| og:image:alt | Overview This PR resolves a type mismatch bug in eBPF C code generation and improves the robustness of userspace code generation. The primary fix ensures that map lookups on the right-hand side of ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9e41a6fd863e96b9c7e9185dc317bf107dbbf8cb10efd6dea957211963f33775 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/multikernel/kernelscript git https://github.com/multikernel/kernelscript.git |
| octolytics-dimension-user_id | 202362072 |
| octolytics-dimension-user_login | multikernel |
| octolytics-dimension-repository_id | 1019261571 |
| octolytics-dimension-repository_nwo | multikernel/kernelscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1019261571 |
| octolytics-dimension-repository_network_root_nwo | multikernel/kernelscript |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2ed5e9c44acb35dcc1d752e449d2a6f7a6164b7b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width