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

Regarding documenting the internals #144

Closed
abhi18av opened this Issue Feb 7, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@abhi18av
Copy link

abhi18av commented Feb 7, 2017

Hii @ChezScheme-team

I find this project to be an amazing asset for learning, I've gone through the WIki ( not much here), Docs and the Book as well but I didn't see any reference to the byte code or the VM - having seen the garbage collection being documented so thoroughly I imagined ChezScheme has a VM or something.

Could you please point me to the right resources? I'm not as proficient in reading the source code as of yet :)

@dybvig

This comment has been minimized.

Copy link
Member

dybvig commented Feb 7, 2017

This is a great question that highlights the lack of sufficient documentation for the implementation of Chez Scheme. Someday I'd like to rectify this. In the meantime, there are a number of papers that describe with more or less precision and more or less accuracy the implementation of various subsystems and features. Most of these are linked from http://www.cs.indiana.edu/chezscheme/pubs/.

Chez Scheme does not employ a byte-code representation. The compiler generates machine code directly, either in memory or to disk (via compile-file and related procedures). Nor does Chez Scheme have a VM in the sense of a program that interprets byte code. It does have a run-time architecture that dictates the structure of objects, the heap, stacks, thread contexts, etc. The generated machine code directly manipulates elements of the run-time architecture in cooperation with the storage manager and other parts of the run-time system, just as one would expect the code generated by a JIT compiler for JVM code to do.

Some of the papers mentioned above describe how elements of Chez Scheme's run-time architecture are (or once were) structured and manipulated, and most of the structure is codified in s/cmacros.ss and c/globals.h, but the architecture is otherwise undocumented.

@abhi18av

This comment has been minimized.

Copy link

abhi18av commented Feb 7, 2017

Thank you @dybvig for the wonderful response. I was wondering about what makes Chez different from Racket or Guile.

Also, could you please tell me more about the design decisions that the ChezScheme team has made regarding targeting LLVM - if at all?

P.S. I love reading Source code and understanding the organization of project and I must say Chez has one of the cleanest code bases 👍

@dybvig

This comment has been minimized.

Copy link
Member

dybvig commented Feb 8, 2017

It would be interesting to try using LLVM as an alternative back end for the compiler, but it's not something we've really thought about.

@abhi18av

This comment has been minimized.

Copy link

abhi18av commented Feb 9, 2017

Mm hmm, so I'll close the issue. I do hope to see a better documentation of the internals though soon :)

@abhi18av abhi18av closed this Feb 9, 2017

@abhi18av

This comment has been minimized.

Copy link

abhi18av commented Feb 17, 2017

@dybvig , I've been using Chez a lot and I can honestly say I look forward to using it more and more.

However, I'd like to ask you whether it's possible to replace the C code with say, Rust or Go and make Chez a more native companion to that language? How much of the C-related code in interspersed in the s or other directory apart from c of course.

@abhi18av

This comment has been minimized.

Copy link

abhi18av commented Feb 17, 2017

It's mentioned in the csug that the c portion relies upon the header file generated by the s files. Does it mean more effort would be required in untangling Chez from C?

@harryfei

This comment has been minimized.

Copy link

harryfei commented Oct 22, 2018

+1 for the internal documentation. Look forward to learning Chez's architecture from it.

BTW, does anyone know which files are related to macro expander in Chez repository?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment