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

[TypeSystem] Figure out method 7 (relocate) #589

Closed
water111 opened this issue Jun 13, 2021 · 0 comments · Fixed by #671
Closed

[TypeSystem] Figure out method 7 (relocate) #589

water111 opened this issue Jun 13, 2021 · 0 comments · Fixed by #671

Comments

@water111
Copy link
Collaborator

All GOAL objects have 9 methods:

  • new
  • delete
  • print
  • inspect
  • length
  • asize
  • copy
  • relocate
  • mem-usage

Strangely, the relocate method comes in two different versions.

The first version is used to move an object in memory, like this:

(relocate proc (- size))

which moves it back size bytes in memory. This takes two arguments (this _type_), and (offset int). This method is defined for object in gkernel, and many others in relocate.gc.

The second version is used by the linker when it finishes linking a v2/v4 object. This takes three arguments: (this _type), (heap kheap), and (name (pointer uint8)) (a C string).

We need an option to "override" a method definition in a type tree. This is an unsafe thing to do in general and relies on the programmer being careful on what they call relocate on - doing it on an object is a dangerous thing to do.

@water111 water111 linked a pull request Jul 2, 2021 that will close this issue
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 a pull request may close this issue.

1 participant