Conversation
This commit is a sketch of the changes in the interpreter
to integrate Starlark into all of the Go runtime's machinery
for profiling CPU, allocation, etc.
In short, it consists of:
- a declaration to the compiler that the local var 'fr' in
Function.CallInternal is special, and should be made
accessible to the unwinder.
- an init-time declaration to the runtime that
Function.CallInternal is the interpreter's "eval"
function, for which a virtual frame should be emitted,
plus:
- a pair of expressions, derived from the value of fr,
that yield the static "code" and dynamic "pc" of the
current interpreter state. These expressions, which
are safe to execute in an async signal handler, are
denoted using the pprof's Op AST builder API.
- a function called by the pprof encoder that converts the
static "code" and dynamic "pc" values into a
(symbol, file, line) triple that will appear in the
profile.
The commit includes a profile.sh script that demonstrates
the mixed Go/Starlark profiles produced by the interpreter.
This code depends on the proposed
compiler changes in https://go.dev/cl/831624 and
new runtime APIs sketched in https://go.dev/cl/831625.
DO NOT SUBMIT
This was referenced Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit is a sketch of the changes in the interpreter to integrate Starlark into all of the Go runtime's machinery for profiling CPU, allocation, etc.
In short, it consists of:
The commit includes a profile.sh script that demonstrates the mixed Go/Starlark profiles produced by the interpreter.
This code depends on the proposed
compiler changes in https://go.dev/cl/831624 and
new runtime APIs sketched in https://go.dev/cl/831625.
DO NOT SUBMIT