David wrote:
1. How do you handle variant (either string or numeric) data? Do you set up one of the string registers with a string "ssnnnnssnnnn" to keep track of datatypes?
N/Y. This would need probably a new PMC type.
2. What happens if a routine needs more than 32 variables of one datatype? Do you use hash tables? (Sounds like Lua)
imcc (the assembler) generates spill code, using a PerlArray.
4. What's a frame? (ex: push_p : Push the current frame of the PMC...)
It's a register frame, used for subroutine calling. Current registers of one type are copied to a save area and restored from there on sub return.
5. How are pointers from DLLs handled? For example, I might have a DLL routine which returns a pointer of some flavor, or expects pointers as parameters. Is there a 'void *' PMC?
These are return in UnmanagedStruct PMCs. s. nci.c
6. What's a "scratchpad?" Is it different from a "pad?" What are they used for?
They store the names/PMCs of lexical variables.
7. How are pad *descriptors* created? They are specified in the constant area of the bytefile, but it's not clear how they get there. Then again, I'm not entirely clear on what they are, either.
The variable names (as they are created) happen to be in the constant table, because these are strings. Have a look at t/pmc/scratchpad.t for usage.
8. How do you store things in non-global pads? There is a store_global opcode, but no store_lex opcode.
There is store_lex/find_lex.
9. Is there a substring op? If not, how do you get a substring?
3 variants of substr s. core.ops
10. I didn't see any equality (eq, gt, le, etc.) opcodes for comparing values.
Again, please consult core.ops, they have exactly above names.
11. There's no opcode for supporting a for loop?
No, only labels, branches and if/unless/eq/gt/...
12. There's a string to number op, but no number to string op?
ord, chr, sprintf
1. Was there a compelling reason to mix the strings and numbers into the constant section, instead of creating a seperate string and numeric section?
Dan would probably say "hysterical raisins". But 2 sections don't have much advantage, and we have key constants too.
2. Are duplicate values (strings, numbers) consolidated in the data section?
They are folded, yes.
3. Why store numbers in binary format instead of text format? Doesn't that limit precision?
This is currently worked on. We probably might have a text format sometimes. OTOH 8/12/16 byte doubles ought to have enough precision.
Thanks!
Welcome
-- David Cuny
leo