Skip to content

runtime: Add a basic monomorphic cache implementation #24

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sin-ack
Copy link
Owner

@sin-ack sin-ack commented Jun 4, 2023

Tasks:

  • Allocate an inline cache inside ExecutableMap
  • Put receiver map-method object pairs inside the inline cache
  • Query the inline cache during method lookup and use it first
  • Invalidate the inline cache when the dependent method changes
  • Make the inline cache weak, so that references can be dropped when they are no longer referenced by anything else

Optional tasks:

Questions to answer:

  • Who owns the inline cache?
  • Should the inline cache be an ArrayObject or should it be given its own dedicated object type?
  • Should global objects' inline caches be affected by actor-owned methods?
  • Should actors' inline caches be affected by actor-owned methods?
  • Implications of inline caching from a concurrency standpoint

sin-ack added 5 commits June 4, 2023 16:45
This is a very naive implementation that has the following issues;
- It over-allocates by a lot, and I mean *a lot*. It allocates two words
  even when the instruction isn't a message send.
- Currently the memory is owned by the global actor, but who really owns
  the memory is kinda dubious. When do the writes to the inline cache
  happen? Should we record actor-owned objects on a global object's
  inline cache?
There are still many questions to be answered, but this should be a good
MVP.
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

Successfully merging this pull request may close these issues.

1 participant