Pycket Dev Page
Ok there's not much here right now, but here are some random dev notes that might help:
What's in this page:
-
Add
_immutable_fields_
in the classes. For lists, use[*]
, e.g._immutable_fields_ = ["name", "importss[*]", "exports", "all_forms"]
-
Use static lists, avoid resizing (i.e. don't use
append
). e.g.ls = [None] * N
-
In
try/except
blocks, try to catch specific exceptions, rather than just usingexcept
, like:except KeyError:
Get the trace log from the jit:
PYPYLOG=jit-log-opt,jit-backend:logfile ./pycket-c a.rkt
Get summary statistics:
PYPYLOG=jit-summary:- pycket-c main.rkt
Get the struct type
from pycket.prims.general import exn_fail
Now you can directly call the constructor
with the arguments (as long as you have a continuation and environment in hand).
exn_fail.constructor.call([message, marks], env, cont)
Just like the constructor, we can call it's accessor
with the
object and the field number.
exn_fail.accessor.call([exn_object, 0], env, cont)
Careful about the field argument, it is also related to the parents offset, so it's really 0 + field.
Internally get a value from a parameter :
port = current_error_param.get(cont)
Deleting the compiled zo file directories with find:
find -type d -name "pycket" -exec rm -rf {} +
.interpret should only be called from interpret_one