Docs for C++ VM
Reported by Brian Ford | July 28th, 2008 @ 09:03 AM | in 1.0 preview
Various questions about the C++ VM architecture:
- In prelude.cpp, why is there e.g. class Fixnum; typedef Fixnum*
FIXNUM; but this is not done for e.g. Tuple? (Answered, see 7060708c9)
-
What does this translate to in the new vm?
RAISE_FROM_ERRNO("Unable
to open directory"); More generally, how are Ruby exceptions raised from C++? (TODO)
- Will static methods of the C++ classes be available as primitives?
If not, what would be the appropriate way to handle e.g.
LookupTable.allocate (i.e. the classes like Array, etc that must have
fully initialized state after .allocate and before #initialize). So,
for example, if I add "OBJECT allocate(STATE);" in
builtin_lookuptable.cpp (analogous to allocate in builtin_class.hpp),
the code output in primitives_glue.gen.cpp is "ret =
as(msg.recv)->allocate(state);", which doesn't look right
(but granted I'm still refreshing my C++ knowledge). (Answered, see 6506bead)
- Presently, primitives for Dir return a MemoryPointer instance that
is stored in an instance variable. Would it be reasonable to make this
a slot in the C++ Dir class? (Our current implementation of Dir is
broken in that Dir.open(".") should return a viable, open Dir instance
even if Dir is subclassed and the subclass #initialize does not call
super. We could have a private instance method that actually opens the
directory, called from #initialize for .new and in .open called like
"dir = allocate; dir.__open__(path)".) (Done, see 9488e4ac, 1c1db20, 22df3fa9, 1dca7d7)
- How does the class Info stuff work? I'm guessing it somehow relates
to GC because I see the mark method in MemoryPointer. (TODO)
- What is the layout of globals.hpp and why? The comment at the top
about appending to the ends of the two "lists" doesn't seem to jive
with what is there. (Answered, see 7060708c9)
- What's up with these different things: state->om->new_object,
state->om->new_object_bytes, state->new_object, state->new_struct
(I've got an idea but understanding the rationale would be helpful). (TODO)
- Are we going to reorganize builtin_xxx.[hc]pp into
builtin/xxx.[hc]pp ? (Done)
- Is it accurate that primitives must always return a value (i.e. void foo() is not allowed)? (Yes, they must return a value.)
- What's the guideline for method bodies in the .hpp files (e.g. changes in 63182f1f)? (Don't put it in the header unless you know why you are doing it. Don't take it out of the header unless you know why you are doing it.
-
When should
__ivars__slot be added to a class? Also, in objects.cpp there isG(array)->has_ivars = Qfalse;but in builtin_array.hpp there is a slot identified for__ivars__. (TODO,__ivars__slot is being added to header.)
Comments and changes to this ticket
-
Brian Ford July 28th, 2008 @ 10:14 AM
If context helps for explaining any of these questions, I've added an outline for the steps to create
Dirhere: http://rubinius.lighthouseapp.co.... -
Eric Hodel July 28th, 2008 @ 12:14 PM
- → Tag changed from task to doc task
How do we raise exceptions from primitives?
-
-
Brian Ford November 24th, 2008 @ 04:29 PM
- → State changed from new to resolved
Docs for these are in the source repository.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
