Branch: Tag:

2012-07-16

2012-07-16 21:09:01 by Per Hedbor <ph@opera.com>

[compiler] Added support for hooks before and after functions

The function callbacks can be used to generate helper code that will
not actually be inside the function body and similar tasks.

324:    jumps = labels + max_label + 2;    uses = jumps + max_label + 2;    aliases = uses + max_label + 2; -  +     while(relabel)    {    /* First do the relabel pass. */
460:    }       /* Time to create the actual bytecode. */ -  +     c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);       for(e=0;e<=max_label;e++) labels[e]=jumps[e]=-1; -  - #ifdef ALIGN_PIKE_FUNCTION_BEGINNINGS -  while( ( (((INT32) PIKE_PC)+2) & (ALIGN_PIKE_JUMPS-1))) -  ins_byte(0); - #endif -  +    #ifdef PIKE_PORTABLE_BYTECODE    if (store_linenumbers) {    ins_data(store_prog_string(tripples));
480:    }   #endif /* PIKE_PORTABLE_BYTECODE */    +  + #ifdef START_NEW_FUNCTION +  START_NEW_FUNCTION(store_linenumbers); + #endif +  + #ifdef ALIGN_PIKE_FUNCTION_BEGINNINGS +  while( ( (((INT32) PIKE_PC)+2) & (ALIGN_PIKE_JUMPS-1))) +  ins_byte(0); + #endif +     entry_point = PIKE_PC;      #ifdef PIKE_DEBUG
760:       free((char *)labels);    + #ifdef END_FUNCTION +  END_FUNCTION(store_linenumbers); + #endif +    #ifdef PIKE_DEBUG    if (a_flag > 6) {    size_t len = (Pike_compiler->new_program->num_program - fun_start)*