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

native unboxed types #14

rurban opened this Issue Sep 11, 2015 · 0 comments


1 participant

rurban commented Sep 11, 2015

a major memory and performance win.

as native types in Perl6
new box_{int,num,str} and unbox_{int,num,str} ops, and all the arithmetic ops for int and num, and for const and padsv (padav for native arrays later).

Allow native int, double and ASCIIZ pointers on the stack, and provide optimized ops for those.
Maybe uni strings later.

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 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.

native types strength reduction:
Change ops with typed or const args into typed.
e.g. padsv[$a:int] const(iv) add => i_add

With more than 2 ops with unboxable args, maybe unbox it.
e.g. padsv[$a:int] const(iv) add padsv[$b:int] multiply

 padsv[$a:int] const(iv) unbox[2] int_add
 padsv[$b:int] unbox int_multiply[b]

[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
padsv[$a:int 63,64]

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)
so we need new types const_int, pad_int, ... which hold the unboxed data.

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.

See feature/CM-713-cperl-native-types

@rurban rurban added the enhancement label Sep 11, 2015

@rurban rurban added this to the v5.24.0 milestone Sep 13, 2015

@rurban rurban modified the milestones: v5.26.0, v5.24.0 May 10, 2016

@rurban rurban added the in progress label Dec 1, 2016

@rurban rurban removed this from the v5.26.0c milestone Mar 2, 2017

@rurban rurban added this to the v5.26.0c milestone Mar 30, 2017

@rurban rurban removed the in progress label Mar 30, 2017

@rurban rurban removed this from the v5.26.0c milestone Apr 29, 2017

@rurban rurban referenced this issue Jul 20, 2017


class :native #314

@rurban rurban added this to In progress in cperl Dec 16, 2017

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