Giter Club home page Giter Club logo

loxido's People

Contributors

ceronman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

loxido's Issues

Garbage collector not freeing full object?

I read your blog post and and I'm using your unsafe implementation as a reference for my own implementation.

I might be misunderstanding, but wouldn't this particular line just free memory up to the size of a GcObject (i.e. just the header part of your object) and not the full object?

Box::from_raw(object_ptr);

Wouldn't you need to do a match and transmute to each type, similar to how you've done it in blacken_object?
e.g.

loxido/src/gc.rs

Lines 195 to 199 in a605c17

ObjectType::Instance => {
let instance: &Instance = unsafe { mem::transmute(pointer.as_ref()) };
self.mark_object(instance.class);
self.mark_table(&instance.fields);
}

Script returning values

Hi,

great implementation!

Would it be difficult to add the ability of scripts to return values ? For example if I would like to evaluate an expression and would expect an boolean return type, or if I want to evaluate a number expression and would expect a number to be returned ?

Thanks

cycles of objects

loxido/src/gc.rs

Lines 220 to 224 in a605c17

pub fn mark_object<T: 'static>(&mut self, mut reference: GcRef<T>) {
unsafe {
let mut header: NonNull<GcObject> = mem::transmute(reference.pointer.as_mut());
header.as_mut().marked = true;
self.grey_stack.push(header);

if header.as_mut().marked {
    return
}

[Question] Why is trace_references pushing objects to grey_stack?

Hi,
Thank you so much for sharing your great code and your experience in the blog.
I'm reading your GC code in unsafe https://github.com/ceronman/loxido/blob/unsafe/src/gc.rs and have a question.

Question

Is it intentional that trace_references is marking objects (= trace from roots) and pushing them to grey_stack?

Why I'm asking

In my understanding the GC works in 3 steps as below.

  1. Mark roots and push them to grey_stack. (= Mark)
  2. Iterate over grey_ stack and recursively mark used objects (= Trace).
  3. Free unused objects (= Sweep).

I see grey_stack as a collection of root objects and it is created in 1 and used in 2.
But I see grey_stack is actually updated in 2 which makes me think why.

Thank you in advance,
Taro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.