picrin-scheme / picrin

lightweight scheme interpreter
MIT License
414 stars 35 forks source link

Reduce size of data object by removing unused dict field #325

Closed dcurrie closed 8 years ago

dcurrie commented 8 years ago

struct pic_data has a dict field that is initialized but never referenced. This patch removes that field.

nyuichi commented 8 years ago

Storage is necessary, because some data types want to hold picrin objects, and GC needs to properly mark&sweep them.

dcurrie commented 8 years ago

OK, but isn't that what pic_data_type.mark is for?

nyuichi commented 8 years ago

@dcurrie

Well, yes it is, but normal users should not use it. I originally planned to get rid of that field because it extremely slows down the mark phase in some cases. But I found it was hard to refactor, so have left it unrefactorred. As of now pic_data_type.mark is only used by callcc-nitro, which copies the interpreter stack, callframes, jmp_buf, and almost everything unfriendly to GC. In order to remove custom markers, making the continuation object a part of the core would be straightforward, though it is difficult to design clean and reusable APIs and I have had no good idea about that. Also, thinking about adding a native implementation of delimited continuations or something in future, I haven't decided my mind yet.

nyuichi commented 8 years ago

@dcurrie

I noticed that attribute replaces pic_data's dict, so I'll merge this :)