Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: compile would return a structure with information #754

Open
jpellegrini opened this issue Mar 21, 2025 · 0 comments
Open

Idea: compile would return a structure with information #754

jpellegrini opened this issue Mar 21, 2025 · 0 comments

Comments

@jpellegrini
Copy link
Contributor

In order to implement procedure inlining and other optimizations it would be nice to know what parts of the code will read/write to what locations; which of them do input or output to which ports; which of them do use dynamic-wind, call/cc etc.

So maybe each compile-... procedure, and the compile procedure itself in STklos could return an object with that information. And each procedure (or closure) would have this information in its plist. That would be a structure like

For example, compiling this code

(define (f a x)
  (let ((b 1)
        (c 2))
    (display a)
    (display b)))

would create the closure f whose plist would include a pair (:compile-info . X) where X is something like:

Slots are:
     reads = ()
     writes = (a)
     binds = (b c)
     outputs = ( (a . #[output-port '*stdout*' (1)]) ) ; writes a to stdout
     inputs = ()
     dynamic-wind = #f
     call/cc = #f
     unknown = ()

Not sure about the plists only. Is there a way to include this in epairs Because it would also be nice to know about the code in a LET for example.

What do you think @egallesio ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant