Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.04 KB

builtins.md

File metadata and controls

30 lines (21 loc) · 1.04 KB

Byterun

  • Builtins are exposted to frame.f_builtins
  • f_builtins is assigned during frame creation, self.f_builtins = f_locals['builtins'] if hasattr(self.f_builtins, 'dict'): self.f_builtins = self.f_builtins.dict
  • f_locals has a ______builtins___ field which is directly the __builtins__ module

Jaspy

  • The module() function creates either a NativeModule or PythonModule

  • The objects in the module are PyType.native

  • The function call is abstracted as a call function, which handles different

  • IMPORT_NAME depends on __import__() in builtins

TODO:

  • Implement a new type NativeFunction

  • Wrap a function pointer in NativeFunction

  • Refactor the CALL_FUNCTION case so it can call both python function and native function

  • During frame creation, force push a nativefunction print into the namespace

  • Modify LOAD_* so they can search for names in builtins

  • Create a module type

  • In VM initialization, load the builtins module into locals

  • During frame creation, create a field that conatins the builtins dict