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

Work on GC issues #31

Merged
merged 27 commits into from
Jul 28, 2024
Merged

Work on GC issues #31

merged 27 commits into from
Jul 28, 2024

Conversation

smarr
Copy link
Member

@smarr smarr commented Jul 28, 2024

This PR works on various issues around GC, trying to find leaks/incorrect bits etc.

There are a lot of bits here that change code to slowly get clang-tidy become useful, which also includes reducing undefined behavior etc.

The major changes are:

  • add a copying GC that's backed per-object by malloc: DebugCopyingGC
  • add IsMarkedValid for more aggressive assertion checking
  • add logging levels
  • refactor helpers to write pointers, to make more explicit what the GC-related invariants are
  • make sure object hash is stable across GCs
  • rework object creation to avoid undefined behavior (pass total object size into constructor)

smarr added 2 commits July 28, 2024 16:20
The sanitizers just make these run for too long.

Signed-off-by: Stefan Marr <[email protected]>
- IsValidObject should be used in debug mode
- reorder tests, null check first
- add messages to asserts
- handle forwarded objects

- add assertions to AddLiteral, and use it for IfAbsent

Signed-off-by: Stefan Marr <[email protected]>
smarr added 25 commits July 28, 2024 22:03
Signed-off-by: Stefan Marr <[email protected]>

Define log levels to be able to be more selective with debug logging

Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
But delay write barrier to the subclass constructors to make sure the object is already constructed.

Signed-off-by: Stefan Marr <[email protected]>
The hash is expected to be stable, for instance, to use it in a hash table.

Signed-off-by: Stefan Marr <[email protected]>
 - fix include order
 - add missing parentheses
 - type int literals
 - use static instead of instance way of calling static method
 - avoid ambiguous signature

Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
- as part of this do a bit of refactoring, defining a funtion to get and check the vtable of an oop

Signed-off-by: Stefan Marr <[email protected]>
- check more consistently for no superclass

Signed-off-by: Stefan Marr <[email protected]>
I’d expect this to be a primitive, but just to be sure…

Signed-off-by: Stefan Marr <[email protected]>
This GC uses malloc to allocate objects, but otherwise behaves like a semi-space GC.

This hopefully enables us to use memory/address senatizers to catch GC bugs.

Signed-off-by: Stefan Marr <[email protected]>
This makes it a bit more complicated to work out the totalObjectSize, because it has to be passed into the VMObject constructor, but it also works out some other odities.

- make additional bytes arg to `new` operator mandatory, just for consistency
- change naming of various bits
- use constructors more aggressively to initialize VM* fields and avoid unnecessary setters
- change VMArray to use numberOfFields to indexed elements. This means we do not support any fields on subclasses of array, which is fine with me. We don’t really support subclassing array in most SOMs anyway. And this way, VMArray is really just a VMObject from the perspective of GC

Signed-off-by: Stefan Marr <[email protected]>
- fix typing for calls to NEW_INT

Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
… VMInteger and VMDouble hashes

Signed-off-by: Stefan Marr <[email protected]>
@smarr smarr merged commit eca9b14 into SOM-st:master Jul 28, 2024
19 checks passed
@smarr smarr deleted the gc-debug branch July 28, 2024 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant