Ticket #1105: pcc_reapply_merge_fixups.patch

File pcc_reapply_merge_fixups.patch, 74.4 KB (added by plobsing, 12 years ago)

fixups after merging trunk

  • ChangeLog

    diff --git a/ChangeLog b/ChangeLog
    index 2349eff..d199efc 100644
    a b  
    11#1 $Id$ 
    22 
    332009.10.20     dukeleto 
    4     * Released 1.7.0 
    5     See NEWS for more. 
     4        * Released 1.7.0 
     5        See NEWS for more. 
    66 
    772009.9.15     particle 
    8     * Released 1.6.0 
    9     See NEWS for more. 
     8        * Released 1.6.0 
     9        See NEWS for more. 
    1010 
    11112009.8.18     Whiteknight 
    12     * Released 1.5.0 
    13     See NEWS for more. 
     12        * Released 1.5.0 
     13        See NEWS for more. 
    1414 
    15152009.7.21     cotto 
    1616        * Released 1.4.0 
     
    1818 
    19192009.06.16    Whiteknight 
    2020        * Released 1.3.0 
    21         Ses NEWS for more. 
     21        See NEWS for more. 
    2222 
    23232009.05.19    Infinoid 
    2424        * Released 1.2.0 
  • MANIFEST

    diff --git a/MANIFEST b/MANIFEST
    index 0f3bd1b..39a60b8 100644
    a b  
    12271227runtime/parrot/library/YAML/Dumper.pir                      [library] 
    12281228runtime/parrot/library/YAML/Dumper/Base.pir                 [library] 
    12291229runtime/parrot/library/YAML/Dumper/Default.pir              [library] 
    1230 runtime/parrot/library/YAML/Parser/Syck.pir                 [library] 
    12311230runtime/parrot/library/dumper.pir                           [library] 
    12321231runtime/parrot/library/libpcre.pir                          [library] 
    12331232runtime/parrot/library/ncurses.declarations                 [library] 
     
    12711270src/exceptions.c                                            [] 
    12721271src/exit.c                                                  [] 
    12731272src/extend.c                                                [] 
    1274 src/frame_builder.c                                         [] 
    12751273src/frame_builder.h                                         [] 
    12761274src/gc/alloc_memory.c                                       [] 
    12771275src/gc/alloc_resources.c                                    [] 
     
    16831681t/library/test_more.t                                       [test] 
    16841682t/library/uuid.t                                            [test] 
    16851683t/library/yaml_dumper.t                                     [test] 
    1686 t/library/yaml_parser_syck.t                                [test] 
    16871684t/manifest/01-basic.t                                       [test] 
    16881685t/manifest/02-regenerate_file.t                             [test] 
    16891686t/manifest/03-regenerate_skip.t                             [test] 
  • PLATFORMS

    diff --git a/PLATFORMS b/PLATFORMS
    index 155157a..6781704 100644
    a b  
    1818linux-x86-gcc4.1.2                Y    ?     Y   Y   Y    Y     ?  20090419 
    1919linux-x86-gcc4.2.4                Y    ?     Y   Y   Y    Y     ?  20081023 
    2020linux-x86-gcc4.3.2                Y    ?     Y   Y   Y    Y     ?  20081030 
     21linux-x86-gcc4.4.1                Y    ?     Y   Y   Y    Y     ?  20091103 
    2122linux-x86-llvm-gcc-4.2            Y    ?     ?   ?   Y    Y     ?  20091021 
    2223sol10-sparc-cc_5.9           B4   Y    -     Y   Y   Y    Y     ?  20090720 
    2324sol10-sparc-cc_5.9           B8   Y    -     Y   Y   Y    Y     ?  20090720 
  • compilers/imcc/pbc.c

    diff --git a/compilers/imcc/pbc.c b/compilers/imcc/pbc.c
    index a90656c..110df3d 100644
    a b  
    906906 
    907907/* 
    908908 
    909 =item C<STRING * IMCC_string_from__STRINGC(PARROT_INTERP, const char *buf)> 
     909=item C<STRING * IMCC_string_from__STRINGC(PARROT_INTERP, char *buf)> 
    910910 
    911911=cut 
    912912 
     
    915915PARROT_WARN_UNUSED_RESULT 
    916916PARROT_CANNOT_RETURN_NULL 
    917917STRING * 
    918 IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(const char *buf)) 
     918IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) 
    919919{ 
    920920    ASSERT_ARGS(IMCC_string_from__STRINGC) 
    921921    const int ascii = (*buf == '\'' || *buf == '"'); 
  • compilers/imcc/pbc.h

    diff --git a/compilers/imcc/pbc.h b/compilers/imcc/pbc.h
    index 83bd04f..40e3046 100644
    a b  
    3838 
    3939PARROT_WARN_UNUSED_RESULT 
    4040PARROT_CANNOT_RETURN_NULL 
    41 STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(const char *buf)) 
     41STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) 
    4242        __attribute__nonnull__(1) 
    4343        __attribute__nonnull__(2); 
    4444 
  • compilers/imcc/reg_alloc.c

    diff --git a/compilers/imcc/reg_alloc.c b/compilers/imcc/reg_alloc.c
    index 4303dff..cf21401 100644
    a b  
    725725 
    726726    for (i = count = unused = 0; i < unit->n_symbols; i++) { 
    727727        SymReg * const r = unit->reglist[i]; 
    728         char *p; 
     728        const char *p; 
    729729        int reg_set; 
    730730 
    731731        if (r->color == -1) 
  • config/auto/libjit.pm

    diff --git a/config/auto/libjit.pm b/config/auto/libjit.pm
    index 868cb1e..9dca132 100644
    a b  
    1212 
    1313The libjit library implements just-in-time compilation functionality. Unlike 
    1414other JITs, this one is designed to be independent of any particular virtual 
    15 machine bytecode format or language.  
     15machine bytecode format or language. 
    1616 
    1717libjit can be obtained from L<http://freshmeat.net/projects/libjit/> or through 
    1818your distribution's package manager. Developer documentation is available from 
  • config/gen/call_list/misc.in

    diff --git a/config/gen/call_list/misc.in b/config/gen/call_list/misc.in
    index 3edb791..f801e26 100644
    a b  
    3232v    illllllll 
    3333v    l 
    3434v    p 
    35 v    pbip     # for libsyck 
     35v    pbip 
    3636v    pi 
    3737v    piiii 
    3838v    pl 
     
    380380 
    381381p    ppiii 
    382382p    ppiiiiiii 
     383i    ppii 
     384i    ppiii 
     385i    ppiiii 
     386i    ppiiiii 
     387i    ppiiiiii 
    383388i    ppt 
    384389i    pppi 
    385390i    pppii 
  • config/gen/libjit.pm

    diff --git a/config/gen/libjit.pm b/config/gen/libjit.pm
    index cbe784a..12e3eaa 100644
    a b  
    3838            frame_builder_c => 'config/gen/libjit/frame_builder_libjit_c.in', 
    3939        }, 
    4040        wrapped_vtables => { 
    41             get_integer        => [ ()           => 'INTVAL' ], 
    42             set_integer_native => [ ('INTVAL')   => 'void' ], 
    43             get_pointer        => [ ()           => 'void_ptr' ], 
    44             set_pointer        => [ ('void_ptr') => 'void' ], 
     41            get_integer          => [ ()           => 'INTVAL' ], 
     42            set_integer_native   => [ ('INTVAL')   => 'void' ], 
     43            get_pointer          => [ ()           => 'void_ptr' ], 
     44            set_pointer          => [ ('void_ptr') => 'void' ], 
     45            get_string_keyed_int => [ ('INTVAL')   => 'void_ptr' ], 
    4546        }, 
    4647        wrapped_funcs => { 
    47             get_nci_I => [ qw(void_ptr void_ptr sys_int) => 'INTVAL' ], 
    48             get_nci_N => [ qw(void_ptr void_ptr sys_int) => 'FLOATVAL' ], 
    49             get_nci_S => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], 
    50             get_nci_P => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], 
    51             get_nci_p => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], 
    52  
    53             set_nci_I => [ qw(void_ptr void_ptr INTVAL)   => 'void' ], 
    54             set_nci_N => [ qw(void_ptr void_ptr FLOATVAL) => 'void' ], 
    55             set_nci_S => [ qw(void_ptr void_ptr void_ptr) => 'void' ], 
    56             set_nci_P => [ qw(void_ptr void_ptr void_ptr) => 'void' ], 
     48            Parrot_pcc_fill_params_from_c_args => 
     49                [ qw(void_ptr void_ptr void_ptr ...) => 'void' ], 
     50            Parrot_pcc_fill_returns_from_c_args => 
     51                [ qw(void_ptr void_ptr void_ptr ...) => 'void' ], 
    5752 
    5853            Parrot_str_new          => 
    5954                [ qw(void_ptr void_ptr UINTVAL) => 'void_ptr' ], 
     
    6257            Parrot_str_free_cstring => 
    6358                [ ('void_ptr')                  => 'void' ], 
    6459 
    65             Parrot_init_arg_nci => 
    66                 [ qw(void_ptr void_ptr void_ptr) => 'void_ptr' ], 
    6760            pmc_new_noinit      => 
    6861                [ qw(void_ptr INTVAL)            => 'void_ptr' ], 
    6962 
     
    146139    my $_arg_v = $n_args ? ", $arg_v" : ""; 
    147140 
    148141    return { decl => <<DECL, defn => <<DEFN }; 
    149 jit_value_t 
     142static jit_value_t 
    150143jit__vtable_$entry_name(jit_function_t, jit_value_t, jit_value_t $_arg_decls_t); 
    151144DECL 
    152 jit_value_t 
     145static jit_value_t 
    153146jit__vtable_$entry_name(jit_function_t f, jit_value_t interp, jit_value_t self $_arg_decls_v) { 
    154147    jit_type_t sig; 
    155148    jit_value_t vtable, method; 
     
    173166    $_ = jit_prefix_type($_) for @$func_sig; 
    174167 
    175168    my $ret_t = pop @$func_sig; 
     169 
     170    my $vararg = 0; 
     171    if ($func_sig->[-1] eq '...') { 
     172        $vararg = 1; 
     173        pop @$func_sig; 
     174    } 
     175 
    176176    my $arg_t = join ", ", @$func_sig; 
    177177 
    178178    my $n_args      = scalar @$func_sig; 
    179     my $arg_decls_t = join ", ",  map {'jit_value_t'}     1..$n_args; 
    180     my $arg_decls_v = join ", ",  map {"jit_value_t v$_"} 1..$n_args; 
     179    my $arg_decls_t = join ", ", map {'jit_value_t'}     1..$n_args; 
     180    my $arg_decls_v = join ", ", map {"jit_value_t v$_"} 1..$n_args; 
    181181    my $arg_v       = join ", ", map {"v$_"}             1..$n_args; 
    182182 
    183     return { decl => <<DECL, defn => <<DEFN }; 
    184 jit_value_t 
     183    my ($decl, $defn); 
     184    if ($vararg) { 
     185        $decl = <<DECL; 
     186static jit_value_t 
     187jit__$func_name(jit_function_t, $arg_decls_t, jit_type_t *, jit_value_t *, int); 
     188DECL 
     189        $defn = <<DEFN; 
     190static jit_value_t 
     191jit__$func_name(jit_function_t f, $arg_decls_v, jit_type_t *va_t, jit_value_t *va_v, int va_n) { 
     192    int i; 
     193    int n_args           = $n_args + va_n; 
     194    jit_type_t sig; 
     195    jit_type_t  arg_t[n_args]; 
     196    jit_value_t arg_v[n_args]; 
     197    jit_type_t  carg_t[] = { $arg_t }; 
     198    jit_value_t carg_v[] = { $arg_v }; 
     199 
     200    for (i = 0; i < $n_args; i++) { 
     201        arg_t[i] = carg_t[i]; 
     202        arg_v[i] = carg_v[i]; 
     203    } 
     204    for (i = $n_args; i < n_args; i++) { 
     205        arg_t[i] = va_t[i - $n_args]; 
     206        arg_v[i] = va_v[i - $n_args]; 
     207    } 
     208 
     209    sig = jit_type_create_signature(jit_abi_cdecl, $ret_t, arg_t, n_args, 1); 
     210 
     211    return jit_insn_call_native(f, "$func_name", (void *)&$func_name, sig, arg_v, n_args, 0); 
     212} 
     213DEFN 
     214    } 
     215    else { 
     216        $decl = <<DECL; 
     217static jit_value_t 
    185218jit__$func_name(jit_function_t, $arg_decls_t); 
    186219DECL 
    187 jit_value_t 
     220        $defn = <<DEFN; 
     221static jit_value_t 
    188222jit__$func_name(jit_function_t f, $arg_decls_v) { 
    189     jit_type_t sig; 
     223    int n_args          = $n_args; 
     224    jit_type_t  sig; 
    190225    jit_type_t  arg_t[] = { $arg_t }; 
    191226    jit_value_t arg_v[] = { $arg_v }; 
    192227 
    193     sig = jit_type_create_signature(jit_abi_cdecl, $ret_t, arg_t, $n_args, 1); 
     228    sig = jit_type_create_signature(jit_abi_cdecl, $ret_t, arg_t, n_args, 1); 
    194229 
    195     return jit_insn_call_native(f, "$func_name", (void *)&$func_name, sig, arg_v, $n_args, 0); 
     230    return jit_insn_call_native(f, "$func_name", (void *)&$func_name, sig, arg_v, n_args, 0); 
    196231} 
    197232DEFN 
     233    } 
     234 
     235    return { decl => $decl, defn => $defn }; 
    198236} 
    199237 
    200238sub jit_prefix_type { 
    201239    my $type = shift; 
    202     if ($type !~ /[A-Z]/) { 
    203         return "jit_type_$_"; 
     240    if ($type =~ /^[_a-z]+$/) { 
     241        return "jit_type_$type"; 
     242    } 
     243    elsif ($type =~ /^[_A-Z]+$/) { 
     244        return "JIT_TYPE_$type"; 
    204245    } 
    205246    else { 
    206         return "JIT_TYPE_$_"; 
     247        return $type; 
    207248    } 
    208249} 
    209250 
  • config/gen/libjit/frame_builder_libjit_c.in

    diff --git a/config/gen/libjit/frame_builder_libjit_c.in b/config/gen/libjit/frame_builder_libjit_c.in
    index e3d2e8a..a312959 100644
    a b  
    77/* HEADERIZER STOP */ 
    88 
    99#include "parrot/parrot.h" 
     10#include "pmc/pmc_context.h" 
    1011#include "pmc/pmc_integer.h" 
    11 #include "pmc/pmc_unmanagedstruct.h" 
    1212#include "pmc/pmc_managedstruct.h" 
     13#include "pmc/pmc_unmanagedstruct.h" 
    1314#include "frame_builder.h" 
    1415#include "frame_builder_libjit.h" 
    1516 
     
    108109 * JIT functions 
    109110 */ 
    110111 
    111 void * 
     112static void * 
    112113Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { 
    113114    struct jit_buffer_private_data *p; 
    114115    jit_function_t f; 
    115116    jit_value_t jit_interp, jit_nci_pmc, jit_pcc_sig; 
    116     jit_value_t jit_func, jit_st; 
     117    jit_value_t jit_func, jit_pcc_sig_args, jit_pcc_sig_ret; 
     118    jit_value_t jit_call_object; 
    117119 
    118120    /* populate private data */ 
    119121    p      = (struct jit_buffer_private_data*)priv; 
     
    128130        jit_type_t arg_types[] = { 
    129131            jit_type_void_ptr, /* interp */ 
    130132            jit_type_void_ptr, /* nci_pmc */ 
    131             jit_type_void_ptr  /* pcc_sig */ 
    132133        }; 
    133         jit_type_t f_sig = jit_type_create_signature(jit_abi_cdecl, jit_type_void, arg_types, 3, 1); 
     134        jit_type_t f_sig = jit_type_create_signature(jit_abi_cdecl, jit_type_void, arg_types, 2, 1); 
    134135        f                = jit_function_create(p->ctx, f_sig); 
    135136    } 
    136137 
    137138    /* get the incomming args */ 
    138139    jit_interp  = jit_value_get_param(f, 0); 
    139140    jit_nci_pmc = jit_value_get_param(f, 1); 
    140     jit_pcc_sig = jit_value_get_param(f, 2); 
    141141 
    142     /* get the wrapped function */ 
    143     jit_func   = jit__vtable_get_pointer(f, jit_interp, jit_nci_pmc); 
    144  
    145     /* allocate call_state */ 
     142    /* get information out of the NCI object */ 
     143    jit_func         = jit__vtable_get_pointer(f, jit_interp, jit_nci_pmc); 
     144    { 
     145        jit_value_t temp = jit__vtable_get_string_keyed_int(f, jit_interp, jit_nci_pmc, 
     146                            jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, PARROT_NCI_PCC_SIGNATURE_PARAMS)); 
     147        jit_pcc_sig_args = jit__Parrot_str_to_cstring(f, jit_interp, temp); 
     148    } 
    146149    { 
    147         jit_value_t sizeof_call_state 
    148                = jit_value_create_nint_constant(f, jit_type_sys_int, sizeof (call_state)); 
    149         jit_st = JIT_ALLOCA(f, sizeof_call_state); 
     150        jit_value_t temp = jit__vtable_get_string_keyed_int(f, jit_interp, jit_nci_pmc, 
     151                            jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, PARROT_NCI_PCC_SIGNATURE_RET)); 
     152        jit_pcc_sig_ret  = jit__Parrot_str_to_cstring(f, jit_interp, temp); 
    150153    } 
    151154 
    152     /* init pcc */ 
    153     jit__Parrot_init_arg_nci(f, jit_interp, jit_st, jit_pcc_sig); 
     155    /* get call_object */ 
     156    { 
     157        jit_value_t ctx = jit__CURRENT_CONTEXT(f, jit_interp); 
     158        jit_call_object = jit__Parrot_pcc_get_signature(f, jit_interp, ctx); 
     159    } 
    154160 
    155161    /* get the outgoing args */ 
    156162    { 
    157163        int nargs = strlen(sig) - 1; 
    158164 
    159         jit_type_t jit_args_t[nargs]; 
     165        jit_type_t  jit_args_t[nargs]; 
    160166        jit_value_t jit_args_v[nargs]; 
    161167        jit_value_t jit_regs[nargs]; 
    162168 
    163         Parrot_jit_parse_sig_args_pre(interp, sig, nargs, f, jit_interp, jit_st, 
     169        Parrot_jit_parse_sig_args_pre(interp, sig, nargs, f, jit_interp, jit_call_object, jit_pcc_sig_args, 
    164170                                      jit_args_t, jit_args_v, jit_regs); 
    165171 
    166172        /* get the return type */ 
     
    178184            } 
    179185 
    180186            /* get the incomming return */ 
    181             Parrot_jit_parse_sig_ret_post(interp, sig, f, jit_interp, jit_st, ret_v); 
     187            Parrot_jit_parse_sig_ret_post(interp, sig, f, jit_interp, jit_call_object, jit_pcc_sig_ret, ret_v); 
    182188        } 
    183189 
    184190        /* clean up args */ 
    185191        Parrot_jit_parse_sig_args_post(interp, sig, nargs, f, jit_interp, jit_args_v, jit_regs); 
    186192    } 
    187193 
    188     /* deallocate call_state */ 
    189     JIT_ALLOCA_FREE(f, jit_st); 
     194    /* free PCC signature bits */ 
     195    jit__Parrot_str_free_cstring(f, jit_pcc_sig_args); 
     196    jit__Parrot_str_free_cstring(f, jit_pcc_sig_ret); 
    190197 
    191198    /* end JIT function */ 
    192199    jit_insn_return(f, NULL); 
     
    198205    return jit_function_to_closure(f); 
    199206} 
    200207 
    201 void 
    202 Parrot_jit_parse_sig_args_pre(PARROT_INTERP, char *sig, int nargs, 
    203                               jit_function_t f, jit_value_t jinterp, jit_value_t st, 
    204                               jit_type_t *arg_types, 
    205                               jit_value_t *arg_vals, jit_value_t *arg_regs) { 
     208static int 
     209Parrot_jit_create_arg_regs(PARROT_INTERP, char *sig, int nargs, 
     210                            jit_function_t f, jit_value_t *reg_v) { 
    206211    int i, j; 
    207  
    208     sig += 1; /* ignore return character */ 
    209  
    210212    for (i = 0, j = 0; i < nargs; i++) { 
    211213        char c; 
    212         jit_type_t t1; 
    213         jit_value_t v1, v2, v3, v4; 
    214214        switch (c = sig[i]) { 
    215           case 'I': 
    216             t1 = JIT_TYPE_INTVAL; 
    217           read_int_reg: 
    218             arg_types[i]  = t1; 
    219             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    220             v2            = jit__get_nci_I(f, jinterp, st, v1); 
    221             arg_regs[j++] = arg_vals[i] = v2; 
    222             break; 
    223           case 'c': 
    224             t1 = jit_type_sys_char; 
    225             goto read_int_reg; 
    226           case 's': 
    227             t1 = jit_type_sys_short; 
    228             goto read_int_reg; 
    229           case 'i': 
    230             t1 = jit_type_sys_int; 
    231             goto read_int_reg; 
    232           case 'l': 
    233             t1 = jit_type_sys_long; 
    234             goto read_int_reg; 
    235  
    236           case 'N': 
    237             t1 = JIT_TYPE_FLOATVAL; 
    238           read_float_reg: 
    239             arg_types[i]  = t1; 
    240             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    241             v2            = jit__get_nci_N(f, jinterp, st, v1); 
    242             arg_regs[j++] = arg_vals[i] = v2; 
    243             break; 
    244           case 'f': 
    245             t1 = jit_type_sys_float; 
    246             goto read_float_reg; 
    247           case 'd': 
    248             t1 = jit_type_sys_double; 
    249             goto read_float_reg; 
    250  
    251           case 'S': 
    252             arg_types[i]  = jit_type_void_ptr; 
    253             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    254             v2            = jit__get_nci_S(f, jinterp, st, v1); 
    255             arg_regs[j++] = arg_vals[i] = v2; 
    256             break; 
    257  
    258           case 't': 
    259             arg_types[i]  = jit_type_void_ptr; 
    260             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    261             v2            = jit__get_nci_S(f, jinterp, st, v1); 
    262             arg_regs[j++] = v2; 
    263             arg_vals[i]   = jit__Parrot_str_to_cstring(f, jinterp, v2); 
    264             break; 
     215            case 'I': 
     216            case 'c': 
     217            case 's': 
     218            case 'i': 
     219            case 'l': 
     220                reg_v[j++] = jit_value_create(f, JIT_TYPE_INTVAL); 
     221                break; 
     222 
     223            case 'N': 
     224            case 'd': 
     225            case 'f': 
     226                reg_v[j++] = jit_value_create(f, JIT_TYPE_FLOATVAL); 
     227                break; 
     228 
     229            case 'S': 
     230            case 'B': 
     231            case 'b': 
     232            case 't': 
     233                reg_v[j++] = jit_value_create(f, jit_type_void_ptr); 
     234                break; 
     235 
     236            case 'p': 
     237            case 'P': 
     238            case 'O': 
     239            case '@': 
     240            case '2': 
     241            case '3': 
     242            case '4': 
     243            case 'V': 
     244                reg_v[j++] = jit_value_create(f, jit_type_void_ptr); 
     245                break; 
     246 
     247            default: 
     248                /* don't catch errors here; fail elsewhere */ 
     249                break; 
     250        } 
     251    } 
    265252 
    266           case 'b': 
    267             arg_types[i]  = jit_type_void_ptr; 
    268             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    269             v2            = jit__get_nci_S(f, jinterp, st, v1); 
    270             arg_regs[j++] = v2; 
    271             arg_vals[i]   = jit__Buffer_bufstart(f, v2); 
    272             break; 
    273           case 'B': 
    274             arg_types[i]  = jit_type_void_ptr; 
    275             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    276             v2            = jit__get_nci_S(f, jinterp, st, v1); 
    277             arg_regs[j++] = v2; 
    278             v3            = jit__Parrot_str_to_cstring(f, jinterp, v2); 
    279             jit_value_set_addressable(v3); 
    280             arg_vals[i]   = jit_insn_address_of(f, v3); 
    281             break; 
     253    return j; 
     254} 
    282255 
    283           case 'p': 
    284             arg_types[i]  = jit_type_void_ptr; 
    285             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    286             v2            = jit__get_nci_p(f, jinterp, st, v1); 
    287             arg_regs[j++] = arg_vals[i] = v2; 
    288             break; 
    289           case 'P': 
    290           case 'O': 
    291           case '@': 
    292             arg_types[i]  = jit_type_void_ptr; 
    293             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    294             v2            = jit__get_nci_P(f, jinterp, st, v1); 
    295             arg_regs[j++] = arg_vals[i] = v2; 
    296             break; 
    297           case '2': 
    298             t1 = jit_type_sys_short; 
    299             goto call_get_integer; 
    300           case '3': 
    301             t1 = jit_type_sys_int; 
    302             goto call_get_integer; 
    303           case '4': 
    304             t1 = jit_type_sys_long; 
    305           call_get_integer: 
    306             arg_types[i]  = jit_type_void_ptr; 
    307             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    308             v2            = jit__get_nci_P(f, jinterp, st, v1); 
    309             arg_regs[j++] = v2; 
    310             v3            = jit__vtable_get_integer(f, jinterp, v2); 
    311             v4            = jit_value_create(f, t1); 
    312             jit_value_set_addressable(v4); 
    313             jit_insn_store(f, v4, v3); 
    314             arg_vals[i]   = jit_insn_address_of(f, v4); 
    315             break; 
     256static void 
     257Parrot_jit_fill_args(PARROT_INTERP, char *sig, int nargs, int nregs, 
     258                    jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, jit_value_t jit_pcc_sig_args, 
     259                    jit_value_t *reg_v, jit_type_t *arg_t, jit_value_t *arg_v) { 
     260    int i, j; 
    316261 
    317           case 'V': 
    318             arg_types[i]  = jit_type_void_ptr; 
    319             v1            = jit_value_create_nint_constant(f, jit_type_sys_int, j); 
    320             v2            = jit__get_nci_P(f, jinterp, st, v1); 
    321             arg_regs[j++] = v2; 
    322             v3            = jit__vtable_get_pointer(f, jinterp, v2); 
    323             v4            = jit_value_create(f, jit_type_void_ptr); 
    324             jit_value_set_addressable(v4); 
    325             jit_insn_store(f, v4, v3); 
    326             arg_vals[i]   = jit_insn_address_of(f, v4); 
    327             break; 
     262    /* fill argument registers */ 
     263    { 
     264        jit_type_t  jit_reg_addr_t[nregs]; 
     265        jit_value_t jit_reg_addr_v[nregs]; 
     266        for (i = 0; i < nregs; i++) { 
     267            jit_reg_addr_t[i] = jit_type_void_ptr; 
     268            jit_value_set_addressable(reg_v[i]); 
     269            jit_reg_addr_v[i] = jit_insn_address_of(f, reg_v[i]); 
     270        } 
     271        jit__Parrot_pcc_fill_params_from_c_args(f, jit_interp, call_object, jit_pcc_sig_args, 
     272                                                jit_reg_addr_t, jit_reg_addr_v, nregs); 
     273    } 
    328274 
    329           case '0': 
    330             arg_types[i] = jit_type_void_ptr; 
    331             arg_vals[i]  = jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL); 
    332             break; 
     275    for (i = 0, j = 0; i < nargs; i++) { 
     276        char c; 
     277        jit_type_t t1; 
     278        jit_label_t l1; 
     279        jit_value_t v1, v2, v3, v4; 
     280        switch (c = sig[i]) { 
     281            case 'I': 
     282                t1 = JIT_TYPE_INTVAL; 
     283                goto pop_reg; 
     284            case 'c': 
     285                t1 = jit_type_sys_char; 
     286                goto pop_reg; 
     287            case 's': 
     288                t1 = jit_type_sys_short; 
     289                goto pop_reg; 
     290            case 'i': 
     291                t1 = jit_type_sys_int; 
     292                goto pop_reg; 
     293            case 'l': 
     294                t1 = jit_type_sys_long; 
     295                goto pop_reg; 
     296            case 'N': 
     297                t1 = JIT_TYPE_FLOATVAL; 
     298                goto pop_reg; 
     299            case 'f': 
     300                t1 = jit_type_sys_float; 
     301                goto pop_reg; 
     302            case 'd': 
     303                t1 = jit_type_sys_double; 
     304                goto pop_reg; 
     305            case 'S': 
     306            case 'P': 
     307            case 'O': 
     308            case '@': 
     309                t1 = jit_type_void_ptr; 
     310            pop_reg: 
     311                arg_t[i] = t1; 
     312                arg_v[i] = jit_value_create(f, t1); 
     313                jit_insn_store(f, arg_v[i], reg_v[j]); 
     314                j++; 
     315                break; 
     316 
     317            case 't': 
     318                arg_t[i] = jit_type_void_ptr; 
     319                arg_v[i] = jit_value_create(f, jit_type_void_ptr); 
     320                jit_insn_store(f, arg_v[i], 
     321                                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); 
     322                v1       = jit_insn_eq(f, reg_v[j], 
     323                                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); 
     324                l1       = jit_label_undefined; 
     325                jit_insn_branch_if(f, v1, &l1); 
     326                jit_insn_store(f, arg_v[i], jit__Parrot_str_to_cstring(f, jit_interp, reg_v[j])); 
     327                jit_insn_label(f, &l1); 
     328 
     329                j++; 
     330                break; 
     331 
     332            case 'b': 
     333                arg_t[i] = jit_type_void_ptr; 
     334                arg_v[i] = jit__Buffer_bufstart(f, reg_v[j]); 
     335                j++; 
     336                break; 
     337 
     338            case 'B': 
     339                arg_t[i] = jit_type_void_ptr; 
     340                arg_v[i] = jit_value_create(f, jit_type_void_ptr); 
     341                jit_insn_store(f, arg_v[i], 
     342                                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); 
     343                v1       = jit_insn_eq(f, reg_v[j], 
     344                                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); 
     345                l1       = jit_label_undefined; 
     346                jit_insn_branch_if(f, v1, &l1); 
     347                v2       = jit__Parrot_str_to_cstring(f, jit_interp, reg_v[j]); 
     348                v3       = jit_value_create(f, jit_type_void_ptr); 
     349                jit_value_set_addressable(v3); 
     350                jit_insn_store(f, v3, v2); 
     351                jit_insn_store(f, arg_v[i], jit_insn_address_of(f, v3)); 
     352                jit_insn_label(f, &l1); 
     353                j++; 
     354                break; 
     355 
     356            case 'p': 
     357                arg_t[i] = jit_type_void_ptr; 
     358                arg_v[i] = jit_value_create(f, jit_type_void_ptr); 
     359                jit_insn_store(f, arg_v[i], 
     360                                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); 
     361                v1       = jit__PMC_IS_NULL(f, reg_v[j]); 
     362                l1       = jit_label_undefined; 
     363                jit_insn_branch_if(f, v1, &l1); 
     364                v2       = jit__vtable_get_pointer(f, jit_interp, reg_v[j]); 
     365                jit_insn_store(f, arg_v[i], v2); 
     366                jit_insn_label(f, &l1); 
     367                j++; 
     368                break; 
     369 
     370            case '2': 
     371                t1 = jit_type_sys_short; 
     372                goto call_get_integer; 
     373            case '3': 
     374                t1 = jit_type_sys_int; 
     375                goto call_get_integer; 
     376            case '4': 
     377                t1 = jit_type_sys_long; 
     378            call_get_integer: 
     379                arg_t[i] = jit_type_void_ptr; 
     380                v1       = jit__vtable_get_integer(f, jit_interp, reg_v[j]); 
     381                v2       = jit_value_create(f, t1); 
     382                jit_value_set_addressable(v2); 
     383                jit_insn_store(f, v2, v1); 
     384                arg_v[i] = jit_insn_address_of(f, v2); 
     385                j++; 
     386                break; 
     387 
     388            case 'V': 
     389                arg_t[i] = jit_type_void_ptr; 
     390                v1       = jit__vtable_get_pointer(f, jit_interp, reg_v[j]); 
     391                v2       = jit_value_create(f, jit_type_void_ptr); 
     392                jit_value_set_addressable(v2); 
     393                jit_insn_store(f, v2, v1); 
     394                arg_v[i] = jit_insn_address_of(f, v2); 
     395                j++; 
     396                break; 
     397 
     398            case '0': 
     399                arg_t[i] = jit_type_void_ptr; 
     400                arg_v[i] = jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL); 
     401                break; 
     402 
     403            case 'J': 
     404                arg_t[i] = jit_type_void_ptr; 
     405                arg_v[i] = jit_interp; 
     406                break; 
     407 
     408            default: 
     409                Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
     410                    "unkown arg type '%c'", c); 
     411                return; 
     412        } 
     413    } 
     414} 
    333415 
    334           case 'J': 
    335             arg_types[i] = jit_type_void_ptr; 
    336             arg_vals[i]  = jinterp; 
    337             break; 
     416static void 
     417Parrot_jit_parse_sig_args_pre(PARROT_INTERP, char *sig, int nargs, 
     418                              jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, jit_value_t jit_pcc_sig_args, 
     419                              jit_type_t  *jit_args_t, 
     420                              jit_value_t *jit_args_v, jit_value_t *jit_regs_v) { 
     421    int nregs; 
    338422 
    339           case 'U': 
    340             /* TODO */ 
    341             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
    342                 "arg type 'U' not yet implemented"); 
    343             return; 
     423    sig += 1; /* ignore return character */ 
    344424 
    345           default: 
    346             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
    347                 "unkown arg type '%c'", c); 
    348             return; 
    349         } 
    350     } 
     425    nregs = Parrot_jit_create_arg_regs(interp, sig, nargs, f, jit_regs_v); 
     426    Parrot_jit_fill_args(interp, sig, nargs, nregs, f, jit_interp, call_object, jit_pcc_sig_args, 
     427                             jit_regs_v, jit_args_t, jit_args_v); 
    351428} 
    352429 
    353 jit_type_t 
     430static jit_type_t 
    354431Parrot_jit_parse_sig_ret_pre(PARROT_INTERP, char *sig) { 
    355432    char c; 
    356433    switch (c = sig[0]) { 
    357       case 'v': 
    358         return jit_type_void; 
    359  
    360       case 'I': 
    361         return JIT_TYPE_INTVAL; 
    362       case 'c': 
    363         return jit_type_sys_char; 
    364       case 's': 
    365         return jit_type_sys_short; 
    366       case 'i': 
    367         return jit_type_sys_int; 
    368       case 'l': 
    369         return jit_type_sys_long; 
    370  
    371       case 'N': 
    372         return JIT_TYPE_FLOATVAL; 
    373       case 'f': 
    374         return jit_type_sys_float; 
    375       case 'd': 
    376         return jit_type_sys_double; 
    377  
    378       case 'S': 
    379       case 't': 
    380         return jit_type_void_ptr; 
    381  
    382       case 'p': 
    383       case 'P': 
    384         return jit_type_void_ptr; 
    385  
    386       case 'U': 
    387         /* TODO */ 
    388         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
    389                                     "return type 'U' not yet implemented"); 
    390         return NULL; 
    391       default: 
    392         /* FAIL */ 
    393         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
    394                                     "unknown return type '%c'", c); 
    395         return NULL; 
     434        case 'v': 
     435            return jit_type_void; 
     436 
     437        case 'I': 
     438            return JIT_TYPE_INTVAL; 
     439        case 'c': 
     440            return jit_type_sys_char; 
     441        case 's': 
     442            return jit_type_sys_short; 
     443        case 'i': 
     444            return jit_type_sys_int; 
     445        case 'l': 
     446            return jit_type_sys_long; 
     447 
     448        case 'N': 
     449            return JIT_TYPE_FLOATVAL; 
     450        case 'f': 
     451            return jit_type_sys_float; 
     452        case 'd': 
     453            return jit_type_sys_double; 
     454 
     455        case 'S': 
     456        case 't': 
     457            return jit_type_void_ptr; 
     458 
     459        case 'p': 
     460        case 'P': 
     461            return jit_type_void_ptr; 
     462 
     463        default: 
     464            /* FAIL */ 
     465            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, 
     466                                        "unknown return type '%c'", c); 
     467            return NULL; 
    396468    } 
    397469} 
    398470 
    399 void 
     471static void 
    400472Parrot_jit_parse_sig_ret_post(PARROT_INTERP, char *sig, 
    401                               jit_function_t f, jit_value_t jinterp, jit_value_t st, 
    402                               jit_value_t retval) { 
     473                              jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, 
     474                              jit_value_t pcc_sig, jit_value_t retval) { 
     475    jit_type_t  ret_t[1]; 
     476    jit_value_t ret_v[1]; 
     477 
    403478    jit_type_t t1; 
    404479    jit_value_t v1, v2, v3; 
    405480    switch (sig[0]) { 
    406       case 'v': 
    407         break; 
    408  
    409       case 'I': 
    410       case 'c': 
    411       case 's': 
    412       case 'i': 
    413       case 'l': 
    414         jit__set_nci_I(f, jinterp, st, retval); 
    415         break; 
    416  
    417       case 'N': 
    418       case 'f': 
    419       case 'd': 
    420         jit__set_nci_N(f, jinterp, st, retval); 
    421         break; 
    422  
    423       case 'S': 
    424         jit__set_nci_S(f, jinterp, st, retval); 
    425         break; 
    426       case 't': 
    427         v1 = jit_value_create_nint_constant(f, jit_type_sys_int, 0); 
    428         v2 = jit__Parrot_str_new(f, jinterp, retval, v1); 
    429         jit__set_nci_S(f, jinterp, st, v2); 
    430         break; 
    431  
    432       case 'P': 
    433         jit__set_nci_P(f, jinterp, st, retval); 
    434         break; 
    435       case 'p': 
    436         v1 = jit_value_create_intval_constant(f, enum_class_UnManagedStruct); 
    437         v2 = jit__pmc_new_noinit(f, jinterp, v1); 
    438         jit__vtable_set_pointer(f, jinterp, v2, retval); 
    439         jit__set_nci_P(f, jinterp, st, v2); 
    440         break; 
    441       case '2': 
    442         t1 = jit_type_sys_short; 
    443         goto create_int_pmc; 
    444       case '3': 
    445         t1 = jit_type_sys_int; 
    446         goto create_int_pmc; 
    447       case '4': 
    448         t1 = jit_type_sys_long; 
    449       create_int_pmc: 
    450         v1 = jit_insn_load_relative(f, retval, 0, t1); 
    451         v2 = jit_value_create_intval_constant(f, enum_class_Integer); 
    452         v3 = jit__pmc_new_noinit(f, jinterp, v2); 
    453         jit__vtable_set_integer_native(f, jinterp, v3, v1); 
    454         jit__set_nci_P(f, jinterp, st, v3); 
    455         break; 
    456  
    457       case 'U': 
    458         /* ignore (failed elsewhere) */ 
    459         break; 
    460  
    461       default: 
    462         /* ignore (failed elsewhere) */ 
    463         break; 
     481        case 'v': 
     482            break; 
     483 
     484        case 'I': 
     485        case 'c': 
     486        case 's': 
     487        case 'i': 
     488        case 'l': 
     489            ret_t[0] = JIT_TYPE_INTVAL; 
     490            goto fill_ret; 
     491        case 'N': 
     492        case 'f': 
     493        case 'd': 
     494            ret_t[0] = JIT_TYPE_FLOATVAL; 
     495            goto fill_ret; 
     496        case 'S': 
     497        case 'P': 
     498            ret_t[0] = jit_type_void_ptr; 
     499            goto fill_ret; 
     500        case 't': 
     501            ret_t[0] = jit_type_void_ptr; 
     502            retval = jit__Parrot_str_new(f, jit_interp, retval, 
     503                        jit_value_create_nint_constant(f, jit_type_sys_int, 0)); 
     504            goto fill_ret; 
     505        case 'p': 
     506            ret_t[0] = jit_type_void_ptr; 
     507            v1 = jit__pmc_new_noinit(f, jit_interp, 
     508                    jit_value_create_intval_constant(f, enum_class_UnManagedStruct)); 
     509            jit__vtable_set_pointer(f, jit_interp, v1, retval); 
     510            retval = v1; 
     511            goto fill_ret; 
     512        case '2': 
     513            t1 = jit_type_sys_short; 
     514            goto create_int_pmc; 
     515        case '3': 
     516            t1 = jit_type_sys_int; 
     517            goto create_int_pmc; 
     518        case '4': 
     519            t1 = jit_type_sys_long; 
     520        create_int_pmc: 
     521            ret_t[0] = jit_type_void_ptr; 
     522            v1 = jit_insn_load_relative(f, retval, 0, t1); 
     523            v2 = jit__pmc_new_noinit(f, jit_interp, 
     524                    jit_value_create_intval_constant(f, enum_class_Integer)); 
     525            jit__vtable_set_integer_native(f, jit_interp, v2, v1); 
     526            retval = v2; 
     527        fill_ret: 
     528            ret_v[0] = jit_value_create(f, ret_t[0]); 
     529            jit_insn_store(f, ret_v[0], retval); 
     530            jit__Parrot_pcc_fill_returns_from_c_args(f, jit_interp, call_object, pcc_sig, ret_t, ret_v, 1); 
     531            break; 
     532 
     533        default: 
     534            /* ignore (failed elsewhere) */ 
     535            break; 
    464536    } 
    465537} 
    466538 
    467 void 
     539static void 
    468540Parrot_jit_parse_sig_args_post(PARROT_INTERP, char *sig, int nargs, 
    469                                jit_function_t f, jit_value_t jinterp, 
     541                               jit_function_t f, jit_value_t jit_interp, 
    470542                               jit_value_t *args, jit_value_t *regs) { 
    471543    int i, j; 
    472544 
     
    476548        jit_type_t t1; 
    477549        jit_value_t v1; 
    478550        switch (sig[i]) { 
    479           case 't': 
    480             jit__Parrot_str_free_cstring(f, args[i]); 
    481             j++; 
    482             break; 
    483  
    484           case 'B': 
    485             v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); 
    486             jit__Parrot_str_free_cstring(f, v1); 
    487             j++; 
    488             break; 
    489  
    490           case '2': 
    491             t1 = jit_type_sys_short; 
    492             goto set_integer; 
    493           case '3': 
    494             t1 = jit_type_sys_int; 
    495             goto set_integer; 
    496           case '4': 
    497             t1 = jit_type_sys_long; 
    498           set_integer: 
    499             v1 = jit_insn_load_relative(f, args[i], 0, t1); 
    500             jit__vtable_set_integer_native(f, jinterp, regs[j], v1); 
    501             j++; 
    502             break; 
    503  
    504           case 'V': 
    505             v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); 
    506             jit__vtable_set_pointer(f, jinterp, regs[j], v1); 
    507             j++; 
    508             break; 
    509  
    510           case 'I': 
    511           case 'c': 
    512           case 'i': 
    513           case 'l': 
    514           case 'N': 
    515           case 'f': 
    516           case 'd': 
    517           case 'S': 
    518           case 'b': 
    519           case 'p': 
    520           case 'P': 
    521           case 'O': 
    522           case '@': 
    523             j++; 
    524             break; 
    525  
    526           case 'U': 
    527             /* TODO */ 
    528             break; 
    529           default: 
    530             /* ignore */ 
    531             break; 
     551            case 't': 
     552                jit__Parrot_str_free_cstring(f, args[i]); 
     553                j++; 
     554                break; 
     555 
     556            case 'B': 
     557                v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); 
     558                jit__Parrot_str_free_cstring(f, v1); 
     559                j++; 
     560                break; 
     561 
     562            case '2': 
     563                t1 = jit_type_sys_short; 
     564                goto set_integer; 
     565            case '3': 
     566                t1 = jit_type_sys_int; 
     567                goto set_integer; 
     568            case '4': 
     569                t1 = jit_type_sys_long; 
     570            set_integer: 
     571                v1 = jit_insn_load_relative(f, args[i], 0, t1); 
     572                jit__vtable_set_integer_native(f, jit_interp, regs[j], v1); 
     573                j++; 
     574                break; 
     575 
     576            case 'V': 
     577                v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); 
     578                jit__vtable_set_pointer(f, jit_interp, regs[j], v1); 
     579                j++; 
     580                break; 
     581 
     582            case 'I': 
     583            case 'c': 
     584            case 'i': 
     585            case 'l': 
     586            case 'N': 
     587            case 'f': 
     588            case 'd': 
     589            case 'S': 
     590            case 'b': 
     591            case 'p': 
     592            case 'P': 
     593            case 'O': 
     594            case '@': 
     595                j++; 
     596                break; 
     597 
     598            default: 
     599                /* ignore */ 
     600                break; 
    532601        } 
    533602    } 
    534603} 
    535604 
    536 jit_value_t 
     605static jit_value_t 
    537606jit_value_create_intval_constant(jit_function_t f, INTVAL i) { 
    538607    return jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, i); 
    539608} 
     
    543612 */ 
    544613 
    545614/* custom wrappers */ 
    546 jit_value_t 
     615static jit_value_t 
    547616jit__Buffer_bufstart(jit_function_t f, jit_value_t buf) { 
    548617    return jit_insn_load_relative(f, buf, offsetof(Buffer, _bufstart), jit_type_void_ptr); 
    549618} 
    550619 
     620static jit_value_t 
     621jit__CURRENT_CONTEXT(jit_function_t f, jit_value_t interp) { 
     622    return jit_insn_load_relative(f, interp, offsetof(struct parrot_interp_t, ctx), jit_type_void_ptr); 
     623} 
     624 
     625static jit_value_t 
     626jit__PMC_IS_NULL(jit_function_t f, jit_value_t pmc) { 
     627    return jit_insn_or(f, 
     628            jit_insn_eq(f, pmc, 
     629                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)), 
     630            jit_insn_eq(f, pmc, 
     631                jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)PMCNULL))); 
     632} 
     633 
     634static jit_value_t 
     635jit__Parrot_pcc_get_signature(jit_function_t f, jit_value_t interp, jit_value_t ctx) { 
     636    return jit_insn_load_relative(f, 
     637                jit_insn_load_relative(f, ctx, offsetof(struct PMC, data), jit_type_void_ptr), 
     638                offsetof(struct Parrot_Context_attributes, current_sig), 
     639                jit_type_void_ptr); 
     640} 
     641 
    551642/* vtable wrappers */ 
    552643@TEMP_vtable_wrap_defns@ 
    553644 
  • config/gen/libjit/frame_builder_libjit_h.in

    diff --git a/config/gen/libjit/frame_builder_libjit_h.in b/config/gen/libjit/frame_builder_libjit_h.in
    index ff22e2e..b77039a 100644
    a b  
    4141 * JIT functions 
    4242 */ 
    4343 
    44 void * 
     44static void * 
    4545Parrot_jit_create_thunk(Interp *, char *, void *); 
    4646 
    47 void 
    48 Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, 
     47static void 
     48Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, jit_value_t, 
    4949                              jit_type_t *, jit_value_t *, jit_value_t *); 
    5050 
    51 jit_type_t 
     51static jit_type_t 
    5252Parrot_jit_parse_sig_ret_pre(Interp *, char *); 
    5353 
    54 void 
    55 Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t); 
     54static void 
     55Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t, jit_value_t); 
    5656 
    57 void 
     57static void 
    5858Parrot_jit_parse_sig_args_post(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t *, jit_value_t *); 
    5959 
    60 jit_value_t 
     60static int 
     61Parrot_jit_create_arg_regs(Interp *, char *, int, jit_function_t, jit_value_t *); 
     62 
     63static void 
     64Parrot_jit_fill_args(Interp *, char *, int, int, jit_function_t, jit_value_t, jit_value_t, jit_value_t, 
     65                    jit_value_t *, jit_type_t *, jit_value_t *); 
     66 
     67static jit_value_t 
    6168jit_value_create_intval_constant(jit_function_t, INTVAL); 
    6269 
    6370/* 
     
    7683 */ 
    7784 
    7885/* custom wrappers */ 
    79 jit_value_t 
     86static jit_value_t 
    8087jit__Buffer_bufstart(jit_function_t, jit_value_t); 
    8188 
     89static jit_value_t 
     90jit__CURRENT_CONTEXT(jit_function_t, jit_value_t); 
     91 
     92static jit_value_t 
     93jit__PMC_IS_NULL(jit_function_t, jit_value_t); 
     94 
     95static jit_value_t 
     96jit__Parrot_pcc_get_signature(jit_function_t, jit_value_t, jit_value_t); 
     97 
    8298/* vtable wrappers */ 
    8399@TEMP_vtable_wrap_decls@ 
    84100 
  • config/gen/makefiles/root.in

    diff --git a/config/gen/makefiles/root.in b/config/gen/makefiles/root.in
    index 823709c..59af370 100644
    a b  
    315315    $(LIBRARY_DIR)/YAML/Dumper/Base.pbc \ 
    316316    $(LIBRARY_DIR)/YAML/Dumper/Default.pbc \ 
    317317    $(LIBRARY_DIR)/YAML/Dumper.pbc \ 
    318     $(LIBRARY_DIR)/YAML/Parser/Syck.pbc \ 
    319318    $(LIBRARY_DIR)/STM.pbc \ 
    320319    $(LIBRARY_DIR)/libpcre.pbc \ 
    321320    $(LIBRARY_DIR)/postgres.pbc 
     
    443442    $(SRC_DIR)/longopt$(O) \ 
    444443    $(SRC_DIR)/misc$(O) \ 
    445444    $(SRC_DIR)/multidispatch$(O) \ 
    446     $(SRC_DIR)/frame_builder$(O) \ 
    447445    $(SRC_DIR)/frame_builder_libjit$(O) \ 
    448446    $(SRC_DIR)/nci$(O) \ 
    449447    $(SRC_DIR)/oo$(O) \ 
     
    627625    $(SRC_DIR)/key.str \ 
    628626    $(SRC_DIR)/library.str \ 
    629627    $(SRC_DIR)/multidispatch.str \ 
    630     $(SRC_DIR)/frame_builder.str \ 
    631628    $(SRC_DIR)/frame_builder_libjit.str \ 
    632629    $(SRC_DIR)/nci.str \ 
    633630    $(SRC_DIR)/packfile.str \ 
     
    12041201$(SRC_DIR)/exit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exit.c 
    12051202 
    12061203$(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c $(SRC_DIR)/nci.str \ 
    1207         $(SRC_DIR)/frame_builder$(O) \ 
    12081204        $(SRC_DIR)/frame_builder_libjit$(O) \ 
    12091205        $(SRC_DIR)/pmc/pmc_managedstruct.h \ 
    12101206        $(SRC_DIR)/pmc/pmc_nci.h \ 
    12111207        $(SRC_DIR)/pmc/pmc_pointer.h 
    12121208 
    1213 $(SRC_DIR)/frame_builder$(O) : \ 
    1214     $(SRC_DIR)/frame_builder.h \ 
    1215     $(SRC_DIR)/frame_builder.c \ 
    1216     $(SRC_DIR)/frame_builder.str \ 
    1217     $(GENERAL_H_FILES) 
    1218  
    12191209$(SRC_DIR)/frame_builder_libjit$(O) : \ 
    12201210    $(SRC_DIR)/frame_builder_libjit.h \ 
    12211211    $(SRC_DIR)/frame_builder_libjit.c \ 
  • docs/book/draft/ch11_directive_reference.pod

    diff --git a/docs/book/draft/ch11_directive_reference.pod b/docs/book/draft/ch11_directive_reference.pod
    index 6f65deb..6425aa1 100644
    a b  
    4141 
    4242  .emit 
    4343 
    44 Define a compilation unit of PASM code. Always paired with C<.eom>. 
     44Define a block of PASM code. Always paired with C<.eom>. 
    4545 
    4646=head3 .end 
    4747 
     
    4949 
    5050  .end 
    5151 
    52 End a compilation unit. Always paired with C<.sub>. 
     52End a subroutine. Always paired with C<.sub>. 
    5353 
    5454=head3 .endm 
    5555 
     
    6565 
    6666  .eom 
    6767 
    68 End a compilation unit of PASM code. Always paired with C<.emit>. 
     68End a block of PASM code. Always paired with C<.emit>. 
    6969 
    7070=head3 .flatten_arg 
    7171 
     
    208208 
    209209  .sub R<NAME> 
    210210 
    211 Define a compilation unit. Always paired with C<.end>. Names begin 
     211Define a subroutine. Always paired with C<.end>. Names begin 
    212212with "C<_>" by convention. 
    213213 
    214214=head3 .sym 
  • docs/compiler_faq.pod

    diff --git a/docs/compiler_faq.pod b/docs/compiler_faq.pod
    index f7d0f20..591ac8b 100644
    a b  
    9696There are several ways to achieve this, depending on the location of 
    9797the subroutine. 
    9898 
    99 If the sub is in the same compilation unit use a Sub constant: 
     99If the sub is in the same file use a Sub constant: 
    100100 
    101101=begin PIR_FRAGMENT 
    102102 
     
    780780See F<config_lib.pasm> for all the keys in the config hash - or iterate over 
    781781the config hash. 
    782782 
    783 =head1 Languages 
    784  
    785 =head2 What files do I need to modify to add my new language compiler? 
    786  
    787 Aside from the files in your new language directory, you must modify 
    788  
    789     CREDITS 
    790     MANIFEST 
    791     config/gen/languages.pm 
    792     config/gen/makefiles/languages.in 
    793  
    794 Inside your language dir, you may consider adding the following: 
    795  
    796     LICENSE 
    797     MAINTAINER 
    798     README 
    799     STATUS 
    800  
    801 Look to existing languages for some examples. 
     783=cut 
  • docs/pdds/draft/pdd10_embedding.pod

    diff --git a/docs/pdds/draft/pdd10_embedding.pod b/docs/pdds/draft/pdd10_embedding.pod
    index f2b71aa..44eddd9 100644
    a b  
    9696 
    9797=item * probably a continuation/control flow boundary 
    9898 
    99 =item * packfiles and compilation units probably too much information for 
     99=item * packfiles and subroutines probably too much information for 
    100100either 
    101101 
    102102=item * do not let MMD and other implementation details escape 
  • docs/pdds/pdd07_codingstd.pod

    diff --git a/docs/pdds/pdd07_codingstd.pod b/docs/pdds/pdd07_codingstd.pod
    index 809d933..d3fd677 100644
    a b  
    208208to parenthesize a long return expression so that a smart editor will properly 
    209209indent it. 
    210210 
    211 {{ RT#45365: Modify parrot.el so this rule is no longer required. }} 
    212  
    213211=item * 
    214212 
    215213When assigning inside a conditional, use extra parentheses, 
  • docs/pdds/pdd19_pir.pod

    diff --git a/docs/pdds/pdd19_pir.pod b/docs/pdds/pdd19_pir.pod
    index a067e9a..540cfcd 100644
    a b  
    397397=end PIR_FRAGMENT 
    398398 
    399399An annotation stays in effect until the next annotation with the same key or 
    400 the end of the current compilation unit (that is, if you use a tool such as 
    401 C<pbc_merge> to link multiple bytecode files, then annotations will not spill 
    402 over from one mergee's bytecode to another). 
     400the end of the current file (that is, if you use a tool such as C<pbc_merge> 
     401to link multiple bytecode files, then annotations will not spill over from one 
     402mergee's bytecode to another). 
    403403 
    404404One annotation covers many PIR instructions. If the result of compiling one 
    405405line of HLL code is 15 lines of PIR, you only need to emit one annotation 
  • docs/project/release_manager_guide.pod

    diff --git a/docs/project/release_manager_guide.pod b/docs/project/release_manager_guide.pod
    index 07f0e8f..9f66a4c 100644
    a b  
    3434L<http://en.wikipedia.org/wiki/List_of_parrots>. 
    3535 
    3636Set up your account on L<http://www.parrot.org/> and ask an existing release 
    37 manager to provide you with admin privileges if you don't already have them. 
     37manager to provide you with editor privileges if you don't already have them. 
    3838 
    3939=item 1. 
    4040 
     
    235235 
    236236=item 10. 
    237237 
    238 Update the website. You will need an account with administrative rights 
     238Update the website. You will need an account with editor rights 
    239239on L<http://www.parrot.org>. 
    240240 
    241241=over 4 
     
    383383 
    384384 - Nov 17, 2009      - 1.8  - bernhard 
    385385 - Dec 15, 2009      - 1.9  - gerd 
    386  - Jan 19, 2010      - 2.0* - 
     386 - Jan 19, 2010      - 2.0* - chromatic 
     387 - Feb 16, 2010      - 2.1  - darbelo 
     388 - Mar 16, 2010      - 2.2  - cotto 
    387389 
    388390=cut 
    389391 
  • docs/project/support_policy.pod

    diff --git a/docs/project/support_policy.pod b/docs/project/support_policy.pod
    index 036dd1b..dce8a2b 100644
    a b  
    176176 
    177177=over 4 
    178178 
    179 =item * Parrot functions I<not> marked with C<PARROT_API> 
     179=item * Parrot functions I<not> marked with C<PARROT_API> or documented as part 
     180of the public API (listed in docs/embed.pod) 
    180181 
    181182=item * The layout of Parrot's internal data structures 
    182183 
  • examples/nci/Xlib.pir

    diff --git a/examples/nci/Xlib.pir b/examples/nci/Xlib.pir
    index 98a1139..e5f507a 100644
    a b  
    934934.end 
    935935 
    936936#----------------------------------------------------------------------- 
     937.sub ClearArea :method 
     938    .param int x 
     939    .param int y 
     940    .param int width 
     941    .param int height 
     942    .param int exposures 
     943    .local pmc xdisp 
     944    xdisp = self.'getdisplay'() 
     945    .local pmc xwin 
     946    xwin = getattribute self, attr_XWindow 
     947    .local pmc func 
     948    func = get_xlib_function('XClearArea', 'ippiiiii') 
     949    $I0 = func(xdisp, xwin, x, y, width, height, exposures) 
     950    .return($I0) 
     951.end 
     952 
     953#----------------------------------------------------------------------- 
    937954.sub StoreName :method 
    938955    .param string name 
    939956 
  • runtime/parrot/include/test_more.pir

    diff --git a/runtime/parrot/include/test_more.pir b/runtime/parrot/include/test_more.pir
    index 3afbf74..e368535 100644
    a b  
    2020    .local pmc exports, curr_namespace, test_namespace 
    2121    curr_namespace = get_namespace 
    2222    test_namespace = get_root_namespace [ 'parrot'; 'Test'; 'More' ] 
    23     exports = split ' ', 'plan diag ok nok is is_deeply like substring isa_ok skip isnt todo throws_like lives_ok throws_substring' 
     23    exports = split ' ', 'plan diag ok nok is is_deeply like substring isa_ok skip isnt todo throws_like lives_ok dies_ok throws_substring' 
    2424 
    2525    test_namespace.'export_to'(curr_namespace, exports) 
    2626 
  • runtime/parrot/library/Test/More.pir

    diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir
    index fa4d271..4959c60 100644
    a b  
    1313    .local pmc exports, curr_namespace, test_namespace 
    1414    curr_namespace = get_namespace 
    1515    test_namespace = get_namespace [ 'Test'; 'More' ] 
    16     exports        = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo throws_like lives_ok' 
     16    exports        = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo throws_like lives_ok dies_ok' 
    1717 
    1818    test_namespace.'export_to'(curr_namespace, exports) 
    1919 
     
    838838    .return( equal ) 
    839839.end 
    840840 
     841=item C<dies_ok( codestring, description )> 
     842 
     843Takes PIR code in C<codestring> and an optional message in C<description>. 
     844Passes a test if the PIR code throws any exception, fails a test otherwise. 
     845 
     846=cut 
     847 
     848.sub dies_ok 
     849    .param string target 
     850    .param string description :optional 
     851 
     852    .local pmc test 
     853    get_hll_global test, [ 'Test'; 'More' ], '_test' 
     854 
     855    .local pmc comp 
     856    .local pmc compfun 
     857    .local pmc compiler 
     858    compiler = compreg 'PIR' 
     859 
     860    .local pmc eh 
     861    eh = new 'ExceptionHandler' 
     862    set_addr eh, handler            # set handler label for exceptions 
     863    push_eh eh 
     864 
     865    compfun = compiler(target) 
     866    compfun()                       # eval the target code 
     867 
     868    pop_eh 
     869 
     870    # if it doesn't throw an exception fail 
     871    test.'ok'( 0, description ) 
     872    test.'diag'('no error thrown') 
     873 
     874    goto done 
     875 
     876  handler: 
     877    .local pmc ex 
     878    .local string error_msg 
     879    .local string diagnostic 
     880 
     881    .get_results (ex) 
     882    pop_eh 
     883    error_msg = ex 
     884    test.'ok'( 1, description ) 
     885 
     886  done: 
     887 
     888.end 
     889 
    841890=item C<lives_ok( codestring, description )> 
    842891 
    843892Takes PIR code in C<codestring> and an optional message in C<description>. 
    844 Passes a test if the PIR does not throw any exception. 
     893Passes a test if the PIR does not throw any exception, fails a test otherwise. 
    845894 
    846895=cut 
    847896 
  • (a) a/runtime/parrot/library/YAML/Parser/Syck.pir vs. (b) /dev/null

    diff --git a/runtime/parrot/library/YAML/Parser/Syck.pir b/runtime/parrot/library/YAML/Parser/Syck.pir
    deleted file mode 100644
    index b3375af..0000000
    a b  
    1 # Copyright (C) 2005-2008, Parrot Foundation. 
    2 # $Id$ 
    3  
    4 =head1 NAME 
    5  
    6 YAML/Parser/Syck.pir - Interface to libsyck 
    7  
    8 =head1 SYNOPSIS 
    9  
    10 This won't work yet with a standard libsyck, as libsyck needs to be 
    11 aware of Parrot. 
    12  
    13 =head1 DESCRIPTION 
    14  
    15 Ask libsyck to do some work. 
    16 Uses the native call interface. 
    17 Needs synchronous callbacks. 
    18  
    19 =head1 METHODS 
    20  
    21 =cut 
    22  
    23 =head2 load 
    24  
    25 Parses a YAML string and returns a data structure. 
    26  
    27 =cut 
    28  
    29 .include "datatypes.pasm" 
    30  
    31 .sub load 
    32     .param string yaml_string 
    33  
    34     # prepare user data 
    35     .local pmc user_data 
    36     user_data = new 'String' 
    37  
    38     .local string library_name 
    39     library_name = 'libsyck' 
    40     .local pmc libsyck 
    41     libsyck = loadlib library_name 
    42     unless libsyck goto NOT_LOADED 
    43  
    44     .local int is_defined 
    45  
    46     # getting a handle on a YAML parser 
    47     .local pmc syck_new_parser 
    48     syck_new_parser = dlfunc libsyck, "syck_new_parser", "p" 
    49     .local pmc parser 
    50     ( parser ) = syck_new_parser( ) 
    51     is_defined = defined parser 
    52     unless is_defined goto NOT_DEFINED 
    53  
    54     # A Sub that can be given to the library 
    55     # this callback function will eventually by called by the library 
    56     .const 'Sub' yaml_handler = "_yaml_handler" 
    57     .local pmc yaml_handler_wrapped 
    58     yaml_handler_wrapped = new_callback yaml_handler, user_data, "vUp"  # Z in pdd16 
    59  
    60     .local pmc synchronous 
    61     synchronous = new 'Integer' 
    62     synchronous = 1 
    63     setprop user_data, "_synchronous", synchronous 
    64  
    65     # call syck_parser_handler 
    66     .local pmc syck_parser_handler 
    67     syck_parser_handler = dlfunc libsyck, "syck_parser_handler", "vpp" 
    68     syck_parser_handler( parser, yaml_handler_wrapped ) 
    69  
    70     # tell about the user_data 
    71     .local pmc syck_parser_bonus 
    72     syck_parser_bonus = dlfunc libsyck, "syck_parser_bonus", "vpP" 
    73     syck_parser_bonus( parser, user_data ) 
    74  
    75     # tell about the string 
    76     .local pmc syck_parser_str, read 
    77     read = new 'UnManagedStruct' 
    78     pin yaml_string 
    79     syck_parser_str = dlfunc libsyck, "syck_parser_str", "vpbip" 
    80     .local int yaml_string_len 
    81     yaml_string_len = length yaml_string 
    82     syck_parser_str( parser, yaml_string, yaml_string_len, read ) 
    83  
    84     # call syck_parse 
    85     .local pmc syck_parse 
    86     .local int sym_id 
    87     syck_parse = dlfunc libsyck, "syck_parse", "ip" 
    88     ( sym_id ) = syck_parse( parser ) 
    89  
    90     # cleaning up a handle on a YAML parser 
    91     .local pmc syck_free_parser 
    92     syck_free_parser = dlfunc libsyck, "syck_free_parser", "vp" 
    93     syck_free_parser( parser ) 
    94  
    95 NOT_DEFINED: 
    96 NOT_LOADED: 
    97     .return( user_data ) 
    98 .end 
    99  
    100  
    101 .sub _yaml_handler 
    102     .param pmc user_data 
    103     .param pmc external_data 
    104  
    105     # struct _syck_node { 
    106     #     /* Symbol table ID */ 
    107     #     SYMID id; 
    108     #     /* Underlying kind */ 
    109     #     enum syck_kind_tag kind; 
    110     #     /* Fully qualified tag-uri for type */ 
    111     #     char *type_id; 
    112     #     /* Anchor name */ 
    113     #     char *anchor; 
    114     #     union { 
    115     #         /* Storage for map data */ 
    116     #         struct SyckMap { 
    117     #             SYMID *keys; 
    118     #             SYMID *values; 
    119     #             long capa; 
    120     #             long idx; 
    121     #         } *pairs; 
    122     #         /* Storage for sequence data */ 
    123     #         struct SyckSeq { 
    124     #             SYMID *items; 
    125     #             long capa; 
    126     #             long idx; 
    127     #         } *list; 
    128     #         /* Storage for string data */ 
    129     #         struct SyckStr { 
    130     #             enum scalar_style style; 
    131     #             char *ptr; 
    132     #             long len; 
    133     #         } *str; 
    134     #     } data; 
    135     #     /* Shortcut node */ 
    136     #     void *shortcut; 
    137     # }; 
    138  
    139  
    140     # external_data is an UnManagedStruct PMC containing node info 
    141     .local pmc external_data_decl, data_str_decl, data_str 
    142     external_data_decl = new 'ResizablePMCArray' 
    143     data_str_decl      = new 'ResizablePMCArray' 
    144  
    145     # id 
    146     push external_data_decl, .DATATYPE_INT 
    147     push external_data_decl, 0 
    148     push external_data_decl, 0 
    149     # kind 
    150     push external_data_decl, .DATATYPE_INT 
    151     push external_data_decl, 0 
    152     push external_data_decl, 0 
    153     # type_id 
    154     push external_data_decl, .DATATYPE_CSTR 
    155     push external_data_decl, 0 
    156     push external_data_decl, 0 
    157     # anchor 
    158     push external_data_decl, .DATATYPE_CSTR 
    159     push external_data_decl, 0 
    160     push external_data_decl, 0 
    161  
    162     # style 
    163     push data_str_decl, .DATATYPE_INT 
    164     push data_str_decl, 0 
    165     push data_str_decl, 0 
    166     # ptr 
    167     push data_str_decl, .DATATYPE_CSTR 
    168     push data_str_decl, 0 
    169     push data_str_decl, 0 
    170     # len 
    171     push data_str_decl, .DATATYPE_INT 
    172     push data_str_decl, 0 
    173     push data_str_decl, 0 
    174     data_str = new 'UnManagedStruct', data_str_decl 
    175  
    176     push  external_data_decl, .DATATYPE_STRUCT_PTR 
    177     $P9 = external_data_decl[-1] 
    178     setprop $P9, "_struct", data_str 
    179     push external_data_decl, 0 
    180     push external_data_decl, 0 
    181  
    182     assign external_data, external_data_decl 
    183  
    184     .local int id, kind, data_str_len 
    185     .local string type_id, anchor, data_str_ptr 
    186     .local string cloned 
    187     id      = external_data[0] 
    188     kind    = external_data[1] 
    189     #    type_id = external_data[2]     # This might be NULL 
    190     #    anchor = external_data[3]      # This might be NULL 
    191     data_str_len = external_data[4;2] 
    192  
    193     # For now just save all the strings 
    194     unless kind == 2 goto IGNORE_NON_STRING 
    195         data_str_ptr = external_data[4;1] 
    196         concat user_data, user_data, data_str_ptr 
    197         concat user_data, user_data, "\n" 
    198 IGNORE_NON_STRING: 
    199  
    200     # debug output 
    201     print user_data 
    202     print "\n" 
    203  
    204     .return() 
    205 .end 
    206  
    207 =head1 TODO 
    208  
    209 Do some object stuff. 
    210 Be nice and put stuff into a namespace. 
    211 Provide a patch for libsyck. 
    212  
    213 =head1 AUTHOR 
    214  
    215 Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de> 
    216  
    217 =head1 SEE ALSO 
    218  
    219   YAML::Parser::Syck.pm 
    220   yaml.kwiki.org 
    221  
    222 =cut 
    223  
    224 # Local Variables: 
    225 #   mode: pir 
    226 #   fill-column: 100 
    227 # End: 
    228 # vim: expandtab shiftwidth=4 ft=pir: 
  • src/call/context.c

    diff --git a/src/call/context.c b/src/call/context.c
    index 5795bdf..542c998 100644
    a b  
    7474        __attribute__nonnull__(3); 
    7575 
    7676static size_t calculate_registers_size(SHIM_INTERP, 
    77     ARGIN(const INTVAL *number_regs_used)) 
     77    ARGIN(const UINTVAL *number_regs_used)) 
    7878        __attribute__nonnull__(2); 
    7979 
    8080static void clear_regs(PARROT_INTERP, ARGMOD(PMC *pmcctx)) 
     
    9797        FUNC_MODIFIES(*pmcctx); 
    9898 
    9999static size_t Parrot_pcc_calculate_registers_size(PARROT_INTERP, 
    100     ARGIN(const INTVAL *number_regs_used)) 
     100    ARGIN(const UINTVAL *number_regs_used)) 
    101101        __attribute__nonnull__(1) 
    102102        __attribute__nonnull__(2); 
    103103 
     
    399399 
    400400/* 
    401401 
    402 =item C<static size_t calculate_registers_size(PARROT_INTERP, const INTVAL 
     402=item C<static size_t calculate_registers_size(PARROT_INTERP, const UINTVAL 
    403403*number_regs_used)> 
    404404 
    405405Calculate memory size required for registers. 
     
    408408 
    409409*/ 
    410410static size_t 
    411 calculate_registers_size(SHIM_INTERP, ARGIN(const INTVAL *number_regs_used)) 
     411calculate_registers_size(SHIM_INTERP, ARGIN(const UINTVAL *number_regs_used)) 
    412412{ 
    413413    ASSERT_ARGS(calculate_registers_size) 
    414414 
     
    423423/* 
    424424 
    425425=item C<static size_t Parrot_pcc_calculate_registers_size(PARROT_INTERP, const 
    426 INTVAL *number_regs_used)> 
     426UINTVAL *number_regs_used)> 
    427427 
    428428Calculate size of Context. 
    429429 
     
    432432*/ 
    433433 
    434434static size_t 
    435 Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used)) 
     435Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const UINTVAL *number_regs_used)) 
    436436{ 
    437437    ASSERT_ARGS(Parrot_pcc_calculate_registers_size) 
    438438    return calculate_registers_size(interp, number_regs_used); 
  • src/extend.c

    diff --git a/src/extend.c b/src/extend.c
    index 5d247bd..aa58f2a 100644
    a b  
    11821182 
    11831183    /* Add the return argument onto the call signature object (a bit 
    11841184     * hackish, added for backward compatibility in deprecated API function, 
    1185      * see TT #XXX). */ 
     1185     * see TT #1145). */ 
    11861186    switch (return_sig) { 
    11871187        case 'v': 
    11881188        { 
     
    12431243 
    12441244    /* Add the return argument onto the call signature object (a bit 
    12451245     * hackish, added for backward compatibility in deprecated API function, 
    1246      * see TT #XXX). */ 
     1246     * see TT #1145). */ 
    12471247    append_result(interp, sig_object, Parrot_str_new_constant(interp, "I"), &result); 
    12481248    Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object); 
    12491249 
     
    12811281 
    12821282    /* Add the return argument onto the call signature object (a bit 
    12831283     * hackish, added for backward compatibility in deprecated API function, 
    1284      * see TT #XXX). */ 
     1284     * see TT #1145). */ 
    12851285    append_result(interp, sig_object, Parrot_str_new_constant(interp, "N"), &result); 
    12861286    PMC_get_sub(interp, sub_pmc, sub); 
    12871287    Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), sub->seg->const_table->constants); 
     
    13301330 
    13311331    /* Add the return argument onto the call signature object (a bit 
    13321332     * hackish, added for backward compatibility in deprecated API function, 
    1333      * see TT #XXX). */ 
     1333     * see TT #1145). */ 
    13341334    switch (return_sig) { 
    13351335        case 'v': 
    13361336        { 
  • (a) a/src/frame_builder.c vs. (b) /dev/null

    diff --git a/src/frame_builder.c b/src/frame_builder.c
    deleted file mode 100644
    index 1296ac9..0000000
    a b  
    1 /* 
    2 Copyright (C) 2008-2009, Parrot Foundation. 
    3 $Id$ 
    4 */ 
    5  
    6 /* HEADERIZER HFILE: none */ 
    7 /* HEADERIZER STOP */ 
    8  
    9 #include "parrot/parrot.h" 
    10 #include "frame_builder.h" 
    11  
    12 INTVAL 
    13 get_nci_I(PARROT_INTERP, ARGMOD(call_state *st), int n) 
    14 { 
    15     if (n >= st->src.n) 
    16         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
    17             "too few arguments passed to NCI function"); 
    18  
    19     Parrot_fetch_arg_nci(interp, st); 
    20  
    21     return UVal_int(st->val); 
    22 } 
    23  
    24 FLOATVAL 
    25 get_nci_N(PARROT_INTERP, ARGMOD(call_state *st), int n) 
    26 { 
    27     if (n >= st->src.n) 
    28         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
    29             "too few arguments passed to NCI function"); 
    30  
    31     Parrot_fetch_arg_nci(interp, st); 
    32  
    33     return UVal_num(st->val); 
    34 } 
    35  
    36 PARROT_WARN_UNUSED_RESULT 
    37 PARROT_CANNOT_RETURN_NULL 
    38 STRING* 
    39 get_nci_S(PARROT_INTERP, ARGMOD(call_state *st), int n) 
    40 { 
    41     /* TODO or act like below? */ 
    42     if (n >= st->src.n) 
    43         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, 
    44             "too few arguments passed to NCI function"); 
    45  
    46     Parrot_fetch_arg_nci(interp, st); 
    47  
    48     return UVal_str(st->val); 
    49 } 
    50  
    51 PARROT_WARN_UNUSED_RESULT 
    52 PARROT_CAN_RETURN_NULL 
    53 PMC* 
    54 get_nci_P(PARROT_INTERP, ARGMOD(call_state *st), int n) 
    55 { 
    56     /* 
    57      * excessive args are passed as NULL 
    58      * used by e.g. MMD infix like __add 
    59      */ 
    60     if (n < st->src.n) { 
    61         PMC *value; 
    62         Parrot_fetch_arg_nci(interp, st); 
    63         value = UVal_pmc(st->val); 
    64         return PMC_IS_NULL(value) ? (PMC *)NULL : value; 
    65     } 
    66     else 
    67         return NULL; 
    68 } 
    69  
    70 PARROT_WARN_UNUSED_RESULT 
    71 PARROT_CAN_RETURN_NULL 
    72 void* 
    73 get_nci_p(PARROT_INTERP, ARGMOD(call_state *st), int n) 
    74 { 
    75     /* 
    76      * excessive args are passed as NULL 
    77      * used by e.g. MMD infix like __add 
    78      */ 
    79     if (n < st->src.n) { 
    80         PMC *value; 
    81         Parrot_fetch_arg_nci(interp, st); 
    82         value = UVal_pmc(st->val); 
    83         return PMC_IS_NULL(value) ? (PMC *)NULL : VTABLE_get_pointer(interp, value); 
    84     } 
    85     else 
    86         return NULL; 
    87 } 
    88  
    89 /* 
    90  * set return value 
    91  */ 
    92 void 
    93 set_nci_I(PARROT_INTERP, ARGOUT(call_state *st), INTVAL val) 
    94 { 
    95     Parrot_init_ret_nci(interp, st, "I"); 
    96     if (st->dest.i < st->dest.n) { 
    97         UVal_int(st->val) = val; 
    98         Parrot_convert_arg(interp, st); 
    99         Parrot_store_arg(interp, st); 
    100     } 
    101 } 
    102  
    103 void 
    104 set_nci_N(PARROT_INTERP, ARGOUT(call_state *st), FLOATVAL val) 
    105 { 
    106     Parrot_init_ret_nci(interp, st, "N"); 
    107     if (st->dest.i < st->dest.n) { 
    108         UVal_num(st->val) = val; 
    109         Parrot_convert_arg(interp, st); 
    110         Parrot_store_arg(interp, st); 
    111     } 
    112 } 
    113  
    114 void 
    115 set_nci_S(PARROT_INTERP, ARGOUT(call_state *st), STRING *val) 
    116 { 
    117     Parrot_init_ret_nci(interp, st, "S"); 
    118     if (st->dest.i < st->dest.n) { 
    119         UVal_str(st->val) = val; 
    120         Parrot_convert_arg(interp, st); 
    121         Parrot_store_arg(interp, st); 
    122     } 
    123 } 
    124  
    125 void 
    126 set_nci_P(PARROT_INTERP, ARGOUT(call_state *st), PMC* val) 
    127 { 
    128     Parrot_init_ret_nci(interp, st, "P"); 
    129     if (st->dest.i < st->dest.n) { 
    130         UVal_pmc(st->val) = val; 
    131         Parrot_convert_arg(interp, st); 
    132         Parrot_store_arg(interp, st); 
    133     } 
    134 } 
    135  
    136 /* 
    137  * Local variables: 
    138  *   c-file-style: "parrot" 
    139  * End: 
    140  * vim: expandtab shiftwidth=4: 
    141  */ 
  • src/nci_test.c

    diff --git a/src/nci_test.c b/src/nci_test.c
    index 7593431..f1c972e 100644
    a b  
    110110PARROT_DYNEXT_EXPORT void   nci_vfff(float, float, float); 
    111111PARROT_DYNEXT_EXPORT void   nci_vV(const char **); 
    112112PARROT_DYNEXT_EXPORT void   nci_vVVV(const char **, const char **, const char **); 
    113 PARROT_DYNEXT_EXPORT int    nci_i20(int, int, int, int, int, int, int, int, int, int, int, int, int, int, 
    114                              int, int, int, int, int); 
     113PARROT_DYNEXT_EXPORT int    nci_i20(int, int, int, int, int, int, int, int, int, int, int, int, 
     114                                    int, int, int, int, int, int, int); 
    115115 
    116116/* Declarations for callback tests */ 
    117117 
  • src/pmc/callsignaturereturns.pmc

    diff --git a/src/pmc/callsignaturereturns.pmc b/src/pmc/callsignaturereturns.pmc
    index 3a2eb25..becbd6e 100644
    a b  
    308308                *(STRING **)ptr = value; 
    309309                break; 
    310310            case PARROT_ARG_PMC: 
    311                 *(PMC **)ptr = get_string_pmc(INTERP, value); 
     311                *(PMC **)ptr = STRING_IS_NULL(value) ? 
     312                    PMCNULL : 
     313                    get_string_pmc(INTERP, value); 
    312314                break; 
    313315            default: 
    314316                PARROT_ASSERT(!"Impossible type"); 
  • src/string/api.c

    diff --git a/src/string/api.c b/src/string/api.c
    index a1b96e7..763f7cf 100644
    a b  
    27802780    ASSERT_ARGS(Parrot_str_unescape) 
    27812781 
    27822782    STRING         *result; 
    2783     const ENCODING *encoding; 
    27842783    const CHARSET  *charset; 
     2784    const ENCODING *encoding = NULL; 
    27852785 
    27862786    /* the default encoding is ascii */ 
    27872787    const char     *enc_name = enc_char ? enc_char : "ascii"; 
    27882788 
    27892789    /* does the encoding have a character set? */ 
    2790     char           *p        = enc_char ? strchr(enc_char, ':') : NULL; 
     2790    const char     *p        = enc_char ? strchr(enc_char, ':') : NULL; 
    27912791    size_t          clength  = strlen(cstring); 
    27922792    String_iter     iter; 
    27932793    UINTVAL         offs, d; 
     
    28002800        --clength; 
    28012801 
    28022802    if (p) { 
    2803         *p       = '\0'; 
    2804         encoding = Parrot_find_encoding(interp, enc_char); 
     2803        #define MAX_ENCODING_NAME_ALLOWED 63 
     2804        char   buffer[MAX_ENCODING_NAME_ALLOWED + 1]; 
     2805        size_t l = p - enc_char; 
     2806        charset  = NULL; 
     2807 
     2808        if (l < MAX_ENCODING_NAME_ALLOWED) { 
     2809            memcpy(buffer, enc_char, l); 
     2810            buffer[l] = '\0'; 
     2811            encoding  = Parrot_find_encoding(interp, buffer); 
     2812        } 
    28052813        if (!encoding) 
    28062814            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, 
    28072815                "Can't make '%s' encoding strings", enc_char); 
  • t/library/test_more.t

    diff --git a/t/library/test_more.t b/t/library/test_more.t
    index 00bc89a..b4fa044 100644
    a b  
    1515    .local pmc exports, curr_namespace, test_namespace 
    1616    curr_namespace = get_namespace 
    1717    test_namespace = get_namespace [ 'Test'; 'More' ] 
    18     exports = split " ", "ok nok is diag like skip todo is_deeply isa_ok isnt throws_like lives_ok" 
     18    exports = split " ", "ok nok is diag like skip todo is_deeply isa_ok isnt throws_like lives_ok dies_ok" 
    1919    test_namespace.'export_to'(curr_namespace, exports) 
    2020 
    2121    test_namespace = get_namespace [ 'Test'; 'Builder'; 'Tester' ] 
    2222    exports = split " ", "plan test_out test_diag test_fail test_pass test_test" 
    2323    test_namespace.'export_to'(curr_namespace, exports) 
    2424 
    25     plan( 98 ) 
     25    plan( 102 ) 
    2626 
    2727    test_skip() 
    2828    test_todo() 
     
    3434    test_is_deeply() 
    3535    test_diagnostics() 
    3636    test_lives_ok() 
     37    test_dies_ok() 
    3738    test_throws_like() 
    3839    test_isa_ok() 
    3940 
    4041    test.'finish'() 
    4142.end 
    4243 
     44.sub test_dies_ok 
     45    test_pass( 'dies_ok passes when there is an error' ) 
     46    dies_ok( <<'CODE', 'dies_ok passes when there is an error' ) 
     47.sub main 
     48    die 'I did it for the lulz' 
     49.end 
     50CODE 
     51    test_test( 'dies_ok passes when there is an error' ) 
     52 
     53    test_fail( 'dies_ok fails when there is no error' ) 
     54    dies_ok( <<'CODE', 'dies_ok fails when there is no error' ) 
     55.sub main 
     56    $I0 = 42 
     57.end 
     58CODE 
     59    test_diag( 'no error thrown' ) 
     60    test_test( 'dies_ok fails when there is no error' ) 
     61 
     62    test_pass( 'dies_ok passes when there is an error with diagnostic message' ) 
     63    dies_ok( <<'CODE', 'dies_ok passes when there is an error with diagnostic message' ) 
     64.sub main 
     65    die 'I did it for the lulz' 
     66.end 
     67CODE 
     68    test_diag( '' ) 
     69    test_test( 'dies_ok passes when there is an error with diagnostic message' ) 
     70 
     71    test_fail( 'dies_ok fails when there is no error with diagnostic message' ) 
     72    dies_ok( <<'CODE', 'dies_ok fails when there is no error with diagnostic message' ) 
     73.sub main 
     74    $I0 = 42 
     75.end 
     76CODE 
     77    test_diag( 'no error thrown' ) 
     78    test_test( 'dies_ok fails when there is no error with diagnostic message' ) 
     79 
     80.end 
     81 
    4382.sub test_lives_ok 
    4483 
    4584    test_pass( 'lives_ok passes when there is no error' ) 
  • (a) a/t/library/yaml_parser_syck.t vs. (b) /dev/null

    diff --git a/t/library/yaml_parser_syck.t b/t/library/yaml_parser_syck.t
    deleted file mode 100644
    index 0556786..0000000
    a b  
    1 #!perl 
    2 # Copyright (C) 2001-2006, Parrot Foundation. 
    3 # $Id$ 
    4  
    5 use strict; 
    6 use warnings; 
    7 use lib qw( t . lib ../lib ../../lib ); 
    8  
    9 use Test::More; 
    10 use Parrot::Test tests => 1; 
    11  
    12 =head1 NAME 
    13  
    14 t/library/yaml_parser_syck.t - testing library/YAML/Parser/Syck.pir 
    15  
    16 =head1 SYNOPSIS 
    17  
    18     % prove t/library/yaml_parser_syck.t 
    19  
    20 =head1 DESCRIPTION 
    21  
    22 Try to parse a YAML document. 
    23  
    24 =cut 
    25  
    26 TODO: { 
    27  
    28     local $TODO = 'Not properly implemented yet'; 
    29  
    30     pir_output_is( << 'CODE', << 'OUT', "basic parsing" ); 
    31  
    32 .sub test :main 
    33     load_bytecode "YAML/Parser/Syck.pbc" 
    34     load_bytecode "dumper.pbc" 
    35  
    36   .local pmc loaded 
    37   ( loaded ) = load( "---\n- key1: val1\n  key2: val2\n- elem1\n- elem12\n- elem123\n- elem1234\n- elem12345\n- elem123456\n- elem1234567\n- elem12345678\n" ) 
    38   _dumper( "loaded", loaded ) 
    39  
    40   end 
    41 .end 
    42 CODE 
    43 val1 
    44  
    45 val1 
    46 key1 
    47  
    48 val1 
    49 key1 
    50 val2 
    51  
    52 val1 
    53 key1 
    54 val2 
    55 key2 
    56  
    57 val1 
    58 key1 
    59 val2 
    60 key2 
    61  
    62 val1 
    63 key1 
    64 val2 
    65 key2 
    66 elem1 
    67  
    68 val1 
    69 key1 
    70 val2 
    71 key2 
    72 elem1 
    73 elem12 
    74  
    75 val1 
    76 key1 
    77 val2 
    78 key2 
    79 elem1 
    80 elem12 
    81 elem123 
    82  
    83 val1 
    84 key1 
    85 val2 
    86 key2 
    87 elem1 
    88 elem12 
    89 elem123 
    90 elem1234 
    91  
    92 val1 
    93 key1 
    94 val2 
    95 key2 
    96 elem1 
    97 elem12 
    98 elem123 
    99 elem1234 
    100 elem12345 
    101  
    102 val1 
    103 key1 
    104 val2 
    105 key2 
    106 elem1 
    107 elem12 
    108 elem123 
    109 elem1234 
    110 elem12345 
    111 elem123456 
    112  
    113 val1 
    114 key1 
    115 val2 
    116 key2 
    117 elem1 
    118 elem12 
    119 elem123 
    120 elem1234 
    121 elem12345 
    122 elem123456 
    123 elem1234567 
    124  
    125 val1 
    126 key1 
    127 val2 
    128 key2 
    129 elem1 
    130 elem12 
    131 elem123 
    132 elem1234 
    133 elem12345 
    134 elem123456 
    135 elem1234567 
    136 elem12345678 
    137  
    138 val1 
    139 key1 
    140 val2 
    141 key2 
    142 elem1 
    143 elem12 
    144 elem123 
    145 elem1234 
    146 elem12345 
    147 elem123456 
    148 elem1234567 
    149 elem12345678 
    150  
    151 "loaded" => "val1\nkey1\nval2\nkey2\nelem1\nelem12\nelem123\nelem1234\nelem12345\nelem123456\nelem1234567\nelem12345678\n" with-properties: Hash { 
    152     "_interpreter" => PMC 'ParrotInterpreter' { ... }, 
    153     "_signature" => "Up", 
    154     "_sub" => sub { ... }, 
    155     "_synchronous" => 1 
    156 } 
    157 OUT 
    158 } 
    159  
    160 =head1 AUTHOR 
    161  
    162 Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de> 
    163  
    164 =head1 SEE ALSO 
    165  
    166 F<runtime/parrot/library/YAML/Parser/Syck.pir> 
    167  
    168 =cut 
    169  
    170 # Local Variables: 
    171 #   mode: cperl 
    172 #   cperl-indent-level: 4 
    173 #   fill-column: 100 
    174 # End: 
    175 # vim: expandtab shiftwidth=4: 
  • t/pmc/sub.t

    diff --git a/t/pmc/sub.t b/t/pmc/sub.t
    index f22b7c6..4d70a9d 100644
    a b  
    688688.end 
    689689 
    690690# :load or other pragmas are only evaluated on the first 
    691 # instruction of a compilation unit 
     691# instruction of a subroutine 
    692692.sub _sub1 :load 
    693693  say "in sub1" 
    694694  returncc 
  • t/src/warnings.t

    diff --git a/t/src/warnings.t b/t/src/warnings.t
    index 0f35793..a884a57 100644
    a b  
    3636int 
    3737main(int argc, char* argv[]) 
    3838{ 
    39     Interp *interp; 
     39    Parrot_Interp interp = Parrot_new(NULL); 
    4040    int error_val; 
    4141 
    42     interp = Parrot_new(NULL); 
    43     if (!interp) { 
     42    if (!interp) 
    4443        return 1; 
    45     } 
    4644 
    4745    print_pbc_location(interp); 
    4846 
     
    6159int 
    6260main(int argc, char* argv[]) 
    6361{ 
    64     Interp *interp; 
     62    Parrot_Interp interp = Parrot_new(NULL); 
    6563    int error_val; 
    6664 
    67     interp = Parrot_new(NULL); 
    68     if (!interp) { 
     65    if (!interp) 
    6966        return 1; 
    70     } 
     67 
    7168    PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG); 
    7269 
    7370    error_val = Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG, "all");