Join GitHub today
native unboxed types #14
a major memory and performance win.
as native types in Perl6
Allow native int, double and ASCIIZ pointers on the stack, and provide optimized ops for those.
Check in the compiler (op.c) for safe ranges to use unboxed sequences of ops, and box the stack values when escaping: sub calls, exceptions, jumps outside.
I needed to extend opcodes and opcode.pl to mark the ops with new arg types, change msgrcv and sockpair, because there's no room for 5 op args anymore (no, undone.)
type num (double) can only be used when IVSIZE==NVSIZE, i.e. 32bit with NV=float and 64bit with double. The compiler needs to emits different code when unboxed num is avail. or not.
With more than 2 ops with unboxable args, maybe unbox it.
[b] meaning box result as in box_int
native ops can have OPpBOXRET and UNBOX_* can have the number of stack elements in op_private. Extend B::Concise to display those, and also display the types of pads, like
I had a major thinko btw. Those ops can only refer to other ops, never to data directly. The data ops are const and padsv. Either the native arith ops replace in the optimizer the padsv/const ops by the unboxed variants, where op_first/op_last points to an unboxed data (ptr or literal const?, ptr tagging cannot be used as we need all bits for the literal, which might end with 0b00)
int_padsv holds the data in special curpad SVs with SVf_NATIVE. Or keep it there unboxed, but then we need to assure that all the padops referring to this targ are changed to be properly typed.