diff --git a/ChangeLog b/ChangeLog index 2349eff..d199efc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,16 @@ #1 $Id$ 2009.10.20 dukeleto - * Released 1.7.0 - See NEWS for more. + * Released 1.7.0 + See NEWS for more. 2009.9.15 particle - * Released 1.6.0 - See NEWS for more. + * Released 1.6.0 + See NEWS for more. 2009.8.18 Whiteknight - * Released 1.5.0 - See NEWS for more. + * Released 1.5.0 + See NEWS for more. 2009.7.21 cotto * Released 1.4.0 @@ -18,7 +18,7 @@ 2009.06.16 Whiteknight * Released 1.3.0 - Ses NEWS for more. + See NEWS for more. 2009.05.19 Infinoid * Released 1.2.0 diff --git a/MANIFEST b/MANIFEST index 0f3bd1b..39a60b8 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1227,7 +1227,6 @@ runtime/parrot/library/Test/More.pir [library] runtime/parrot/library/YAML/Dumper.pir [library] runtime/parrot/library/YAML/Dumper/Base.pir [library] runtime/parrot/library/YAML/Dumper/Default.pir [library] -runtime/parrot/library/YAML/Parser/Syck.pir [library] runtime/parrot/library/dumper.pir [library] runtime/parrot/library/libpcre.pir [library] runtime/parrot/library/ncurses.declarations [library] @@ -1271,7 +1270,6 @@ src/events.c [] src/exceptions.c [] src/exit.c [] src/extend.c [] -src/frame_builder.c [] src/frame_builder.h [] src/gc/alloc_memory.c [] src/gc/alloc_resources.c [] @@ -1683,7 +1681,6 @@ t/library/test_class.t [test] t/library/test_more.t [test] t/library/uuid.t [test] t/library/yaml_dumper.t [test] -t/library/yaml_parser_syck.t [test] t/manifest/01-basic.t [test] t/manifest/02-regenerate_file.t [test] t/manifest/03-regenerate_skip.t [test] diff --git a/PLATFORMS b/PLATFORMS index 155157a..6781704 100644 --- a/PLATFORMS +++ b/PLATFORMS @@ -18,6 +18,7 @@ darwin8.11.1-x86-gcc4.0.1 ?? Y ? ? ? Y Y N 20091020 linux-x86-gcc4.1.2 Y ? Y Y Y Y ? 20090419 linux-x86-gcc4.2.4 Y ? Y Y Y Y ? 20081023 linux-x86-gcc4.3.2 Y ? Y Y Y Y ? 20081030 +linux-x86-gcc4.4.1 Y ? Y Y Y Y ? 20091103 linux-x86-llvm-gcc-4.2 Y ? ? ? Y Y ? 20091021 sol10-sparc-cc_5.9 B4 Y - Y Y Y Y ? 20090720 sol10-sparc-cc_5.9 B8 Y - Y Y Y Y ? 20090720 diff --git a/compilers/imcc/pbc.c b/compilers/imcc/pbc.c index a90656c..110df3d 100644 --- a/compilers/imcc/pbc.c +++ b/compilers/imcc/pbc.c @@ -906,7 +906,7 @@ IMCC_string_from_reg(PARROT_INTERP, ARGIN(const SymReg *r)) /* -=item C +=item C =cut @@ -915,7 +915,7 @@ IMCC_string_from_reg(PARROT_INTERP, ARGIN(const SymReg *r)) PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL STRING * -IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(const char *buf)) +IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) { ASSERT_ARGS(IMCC_string_from__STRINGC) const int ascii = (*buf == '\'' || *buf == '"'); diff --git a/compilers/imcc/pbc.h b/compilers/imcc/pbc.h index 83bd04f..40e3046 100644 --- a/compilers/imcc/pbc.h +++ b/compilers/imcc/pbc.h @@ -38,7 +38,7 @@ INTVAL IMCC_int_from_reg(PARROT_INTERP, ARGIN(const SymReg *r)) PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL -STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(const char *buf)) +STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) __attribute__nonnull__(1) __attribute__nonnull__(2); diff --git a/compilers/imcc/reg_alloc.c b/compilers/imcc/reg_alloc.c index 4303dff..cf21401 100644 --- a/compilers/imcc/reg_alloc.c +++ b/compilers/imcc/reg_alloc.c @@ -725,7 +725,7 @@ rebuild_reglist(ARGMOD(IMC_Unit *unit)) for (i = count = unused = 0; i < unit->n_symbols; i++) { SymReg * const r = unit->reglist[i]; - char *p; + const char *p; int reg_set; if (r->color == -1) diff --git a/config/auto/libjit.pm b/config/auto/libjit.pm index 868cb1e..9dca132 100644 --- a/config/auto/libjit.pm +++ b/config/auto/libjit.pm @@ -12,7 +12,7 @@ It is OK when it doesn't exist. The libjit library implements just-in-time compilation functionality. Unlike other JITs, this one is designed to be independent of any particular virtual -machine bytecode format or language. +machine bytecode format or language. libjit can be obtained from L or through your distribution's package manager. Developer documentation is available from diff --git a/config/gen/call_list/misc.in b/config/gen/call_list/misc.in index 3edb791..f801e26 100644 --- a/config/gen/call_list/misc.in +++ b/config/gen/call_list/misc.in @@ -32,7 +32,7 @@ v ii v illllllll v l v p -v pbip # for libsyck +v pbip v pi v piiii v pl @@ -380,6 +380,11 @@ v p p ppiii p ppiiiiiii +i ppii +i ppiii +i ppiiii +i ppiiiii +i ppiiiiii i ppt i pppi i pppii diff --git a/config/gen/libjit.pm b/config/gen/libjit.pm index cbe784a..12e3eaa 100644 --- a/config/gen/libjit.pm +++ b/config/gen/libjit.pm @@ -38,22 +38,17 @@ sub _init { frame_builder_c => 'config/gen/libjit/frame_builder_libjit_c.in', }, wrapped_vtables => { - get_integer => [ () => 'INTVAL' ], - set_integer_native => [ ('INTVAL') => 'void' ], - get_pointer => [ () => 'void_ptr' ], - set_pointer => [ ('void_ptr') => 'void' ], + get_integer => [ () => 'INTVAL' ], + set_integer_native => [ ('INTVAL') => 'void' ], + get_pointer => [ () => 'void_ptr' ], + set_pointer => [ ('void_ptr') => 'void' ], + get_string_keyed_int => [ ('INTVAL') => 'void_ptr' ], }, wrapped_funcs => { - get_nci_I => [ qw(void_ptr void_ptr sys_int) => 'INTVAL' ], - get_nci_N => [ qw(void_ptr void_ptr sys_int) => 'FLOATVAL' ], - get_nci_S => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], - get_nci_P => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], - get_nci_p => [ qw(void_ptr void_ptr sys_int) => 'void_ptr' ], - - set_nci_I => [ qw(void_ptr void_ptr INTVAL) => 'void' ], - set_nci_N => [ qw(void_ptr void_ptr FLOATVAL) => 'void' ], - set_nci_S => [ qw(void_ptr void_ptr void_ptr) => 'void' ], - set_nci_P => [ qw(void_ptr void_ptr void_ptr) => 'void' ], + Parrot_pcc_fill_params_from_c_args => + [ qw(void_ptr void_ptr void_ptr ...) => 'void' ], + Parrot_pcc_fill_returns_from_c_args => + [ qw(void_ptr void_ptr void_ptr ...) => 'void' ], Parrot_str_new => [ qw(void_ptr void_ptr UINTVAL) => 'void_ptr' ], @@ -62,8 +57,6 @@ sub _init { Parrot_str_free_cstring => [ ('void_ptr') => 'void' ], - Parrot_init_arg_nci => - [ qw(void_ptr void_ptr void_ptr) => 'void_ptr' ], pmc_new_noinit => [ qw(void_ptr INTVAL) => 'void_ptr' ], @@ -146,10 +139,10 @@ sub gen_vtable_wrapper { my $_arg_v = $n_args ? ", $arg_v" : ""; return { decl => < <[-1] eq '...') { + $vararg = 1; + pop @$func_sig; + } + my $arg_t = join ", ", @$func_sig; my $n_args = scalar @$func_sig; - my $arg_decls_t = join ", ", map {'jit_value_t'} 1..$n_args; - my $arg_decls_v = join ", ", map {"jit_value_t v$_"} 1..$n_args; + my $arg_decls_t = join ", ", map {'jit_value_t'} 1..$n_args; + my $arg_decls_v = join ", ", map {"jit_value_t v$_"} 1..$n_args; my $arg_v = join ", ", map {"v$_"} 1..$n_args; - return { decl => < < $decl, defn => $defn }; } sub jit_prefix_type { my $type = shift; - if ($type !~ /[A-Z]/) { - return "jit_type_$_"; + if ($type =~ /^[_a-z]+$/) { + return "jit_type_$type"; + } + elsif ($type =~ /^[_A-Z]+$/) { + return "JIT_TYPE_$type"; } else { - return "JIT_TYPE_$_"; + return $type; } } 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/config/gen/libjit/frame_builder_libjit_c.in +++ b/config/gen/libjit/frame_builder_libjit_c.in @@ -7,9 +7,10 @@ $Id$ /* HEADERIZER STOP */ #include "parrot/parrot.h" +#include "pmc/pmc_context.h" #include "pmc/pmc_integer.h" -#include "pmc/pmc_unmanagedstruct.h" #include "pmc/pmc_managedstruct.h" +#include "pmc/pmc_unmanagedstruct.h" #include "frame_builder.h" #include "frame_builder_libjit.h" @@ -108,12 +109,13 @@ Parrot_jit_clone_buffer(PARROT_INTERP, PMC *pmc, void *priv) * JIT functions */ -void * +static void * Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { struct jit_buffer_private_data *p; jit_function_t f; jit_value_t jit_interp, jit_nci_pmc, jit_pcc_sig; - jit_value_t jit_func, jit_st; + jit_value_t jit_func, jit_pcc_sig_args, jit_pcc_sig_ret; + jit_value_t jit_call_object; /* populate private data */ p = (struct jit_buffer_private_data*)priv; @@ -128,39 +130,43 @@ Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { jit_type_t arg_types[] = { jit_type_void_ptr, /* interp */ jit_type_void_ptr, /* nci_pmc */ - jit_type_void_ptr /* pcc_sig */ }; - jit_type_t f_sig = jit_type_create_signature(jit_abi_cdecl, jit_type_void, arg_types, 3, 1); + jit_type_t f_sig = jit_type_create_signature(jit_abi_cdecl, jit_type_void, arg_types, 2, 1); f = jit_function_create(p->ctx, f_sig); } /* get the incomming args */ jit_interp = jit_value_get_param(f, 0); jit_nci_pmc = jit_value_get_param(f, 1); - jit_pcc_sig = jit_value_get_param(f, 2); - /* get the wrapped function */ - jit_func = jit__vtable_get_pointer(f, jit_interp, jit_nci_pmc); - - /* allocate call_state */ + /* get information out of the NCI object */ + jit_func = jit__vtable_get_pointer(f, jit_interp, jit_nci_pmc); + { + jit_value_t temp = jit__vtable_get_string_keyed_int(f, jit_interp, jit_nci_pmc, + jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, PARROT_NCI_PCC_SIGNATURE_PARAMS)); + jit_pcc_sig_args = jit__Parrot_str_to_cstring(f, jit_interp, temp); + } { - jit_value_t sizeof_call_state - = jit_value_create_nint_constant(f, jit_type_sys_int, sizeof (call_state)); - jit_st = JIT_ALLOCA(f, sizeof_call_state); + jit_value_t temp = jit__vtable_get_string_keyed_int(f, jit_interp, jit_nci_pmc, + jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, PARROT_NCI_PCC_SIGNATURE_RET)); + jit_pcc_sig_ret = jit__Parrot_str_to_cstring(f, jit_interp, temp); } - /* init pcc */ - jit__Parrot_init_arg_nci(f, jit_interp, jit_st, jit_pcc_sig); + /* get call_object */ + { + jit_value_t ctx = jit__CURRENT_CONTEXT(f, jit_interp); + jit_call_object = jit__Parrot_pcc_get_signature(f, jit_interp, ctx); + } /* get the outgoing args */ { int nargs = strlen(sig) - 1; - jit_type_t jit_args_t[nargs]; + jit_type_t jit_args_t[nargs]; jit_value_t jit_args_v[nargs]; jit_value_t jit_regs[nargs]; - Parrot_jit_parse_sig_args_pre(interp, sig, nargs, f, jit_interp, jit_st, + Parrot_jit_parse_sig_args_pre(interp, sig, nargs, f, jit_interp, jit_call_object, jit_pcc_sig_args, jit_args_t, jit_args_v, jit_regs); /* get the return type */ @@ -178,15 +184,16 @@ Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { } /* get the incomming return */ - Parrot_jit_parse_sig_ret_post(interp, sig, f, jit_interp, jit_st, ret_v); + Parrot_jit_parse_sig_ret_post(interp, sig, f, jit_interp, jit_call_object, jit_pcc_sig_ret, ret_v); } /* clean up args */ Parrot_jit_parse_sig_args_post(interp, sig, nargs, f, jit_interp, jit_args_v, jit_regs); } - /* deallocate call_state */ - JIT_ALLOCA_FREE(f, jit_st); + /* free PCC signature bits */ + jit__Parrot_str_free_cstring(f, jit_pcc_sig_args); + jit__Parrot_str_free_cstring(f, jit_pcc_sig_ret); /* end JIT function */ jit_insn_return(f, NULL); @@ -198,275 +205,340 @@ Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { return jit_function_to_closure(f); } -void -Parrot_jit_parse_sig_args_pre(PARROT_INTERP, char *sig, int nargs, - jit_function_t f, jit_value_t jinterp, jit_value_t st, - jit_type_t *arg_types, - jit_value_t *arg_vals, jit_value_t *arg_regs) { +static int +Parrot_jit_create_arg_regs(PARROT_INTERP, char *sig, int nargs, + jit_function_t f, jit_value_t *reg_v) { int i, j; - - sig += 1; /* ignore return character */ - for (i = 0, j = 0; i < nargs; i++) { char c; - jit_type_t t1; - jit_value_t v1, v2, v3, v4; switch (c = sig[i]) { - case 'I': - t1 = JIT_TYPE_INTVAL; - read_int_reg: - arg_types[i] = t1; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_I(f, jinterp, st, v1); - arg_regs[j++] = arg_vals[i] = v2; - break; - case 'c': - t1 = jit_type_sys_char; - goto read_int_reg; - case 's': - t1 = jit_type_sys_short; - goto read_int_reg; - case 'i': - t1 = jit_type_sys_int; - goto read_int_reg; - case 'l': - t1 = jit_type_sys_long; - goto read_int_reg; - - case 'N': - t1 = JIT_TYPE_FLOATVAL; - read_float_reg: - arg_types[i] = t1; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_N(f, jinterp, st, v1); - arg_regs[j++] = arg_vals[i] = v2; - break; - case 'f': - t1 = jit_type_sys_float; - goto read_float_reg; - case 'd': - t1 = jit_type_sys_double; - goto read_float_reg; - - case 'S': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_S(f, jinterp, st, v1); - arg_regs[j++] = arg_vals[i] = v2; - break; - - case 't': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_S(f, jinterp, st, v1); - arg_regs[j++] = v2; - arg_vals[i] = jit__Parrot_str_to_cstring(f, jinterp, v2); - break; + case 'I': + case 'c': + case 's': + case 'i': + case 'l': + reg_v[j++] = jit_value_create(f, JIT_TYPE_INTVAL); + break; + + case 'N': + case 'd': + case 'f': + reg_v[j++] = jit_value_create(f, JIT_TYPE_FLOATVAL); + break; + + case 'S': + case 'B': + case 'b': + case 't': + reg_v[j++] = jit_value_create(f, jit_type_void_ptr); + break; + + case 'p': + case 'P': + case 'O': + case '@': + case '2': + case '3': + case '4': + case 'V': + reg_v[j++] = jit_value_create(f, jit_type_void_ptr); + break; + + default: + /* don't catch errors here; fail elsewhere */ + break; + } + } - case 'b': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_S(f, jinterp, st, v1); - arg_regs[j++] = v2; - arg_vals[i] = jit__Buffer_bufstart(f, v2); - break; - case 'B': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_S(f, jinterp, st, v1); - arg_regs[j++] = v2; - v3 = jit__Parrot_str_to_cstring(f, jinterp, v2); - jit_value_set_addressable(v3); - arg_vals[i] = jit_insn_address_of(f, v3); - break; + return j; +} - case 'p': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_p(f, jinterp, st, v1); - arg_regs[j++] = arg_vals[i] = v2; - break; - case 'P': - case 'O': - case '@': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_P(f, jinterp, st, v1); - arg_regs[j++] = arg_vals[i] = v2; - break; - case '2': - t1 = jit_type_sys_short; - goto call_get_integer; - case '3': - t1 = jit_type_sys_int; - goto call_get_integer; - case '4': - t1 = jit_type_sys_long; - call_get_integer: - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_P(f, jinterp, st, v1); - arg_regs[j++] = v2; - v3 = jit__vtable_get_integer(f, jinterp, v2); - v4 = jit_value_create(f, t1); - jit_value_set_addressable(v4); - jit_insn_store(f, v4, v3); - arg_vals[i] = jit_insn_address_of(f, v4); - break; +static void +Parrot_jit_fill_args(PARROT_INTERP, char *sig, int nargs, int nregs, + jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, jit_value_t jit_pcc_sig_args, + jit_value_t *reg_v, jit_type_t *arg_t, jit_value_t *arg_v) { + int i, j; - case 'V': - arg_types[i] = jit_type_void_ptr; - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, j); - v2 = jit__get_nci_P(f, jinterp, st, v1); - arg_regs[j++] = v2; - v3 = jit__vtable_get_pointer(f, jinterp, v2); - v4 = jit_value_create(f, jit_type_void_ptr); - jit_value_set_addressable(v4); - jit_insn_store(f, v4, v3); - arg_vals[i] = jit_insn_address_of(f, v4); - break; + /* fill argument registers */ + { + jit_type_t jit_reg_addr_t[nregs]; + jit_value_t jit_reg_addr_v[nregs]; + for (i = 0; i < nregs; i++) { + jit_reg_addr_t[i] = jit_type_void_ptr; + jit_value_set_addressable(reg_v[i]); + jit_reg_addr_v[i] = jit_insn_address_of(f, reg_v[i]); + } + jit__Parrot_pcc_fill_params_from_c_args(f, jit_interp, call_object, jit_pcc_sig_args, + jit_reg_addr_t, jit_reg_addr_v, nregs); + } - case '0': - arg_types[i] = jit_type_void_ptr; - arg_vals[i] = jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL); - break; + for (i = 0, j = 0; i < nargs; i++) { + char c; + jit_type_t t1; + jit_label_t l1; + jit_value_t v1, v2, v3, v4; + switch (c = sig[i]) { + case 'I': + t1 = JIT_TYPE_INTVAL; + goto pop_reg; + case 'c': + t1 = jit_type_sys_char; + goto pop_reg; + case 's': + t1 = jit_type_sys_short; + goto pop_reg; + case 'i': + t1 = jit_type_sys_int; + goto pop_reg; + case 'l': + t1 = jit_type_sys_long; + goto pop_reg; + case 'N': + t1 = JIT_TYPE_FLOATVAL; + goto pop_reg; + case 'f': + t1 = jit_type_sys_float; + goto pop_reg; + case 'd': + t1 = jit_type_sys_double; + goto pop_reg; + case 'S': + case 'P': + case 'O': + case '@': + t1 = jit_type_void_ptr; + pop_reg: + arg_t[i] = t1; + arg_v[i] = jit_value_create(f, t1); + jit_insn_store(f, arg_v[i], reg_v[j]); + j++; + break; + + case 't': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit_value_create(f, jit_type_void_ptr); + jit_insn_store(f, arg_v[i], + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); + v1 = jit_insn_eq(f, reg_v[j], + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); + l1 = jit_label_undefined; + jit_insn_branch_if(f, v1, &l1); + jit_insn_store(f, arg_v[i], jit__Parrot_str_to_cstring(f, jit_interp, reg_v[j])); + jit_insn_label(f, &l1); + + j++; + break; + + case 'b': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit__Buffer_bufstart(f, reg_v[j]); + j++; + break; + + case 'B': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit_value_create(f, jit_type_void_ptr); + jit_insn_store(f, arg_v[i], + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); + v1 = jit_insn_eq(f, reg_v[j], + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); + l1 = jit_label_undefined; + jit_insn_branch_if(f, v1, &l1); + v2 = jit__Parrot_str_to_cstring(f, jit_interp, reg_v[j]); + v3 = jit_value_create(f, jit_type_void_ptr); + jit_value_set_addressable(v3); + jit_insn_store(f, v3, v2); + jit_insn_store(f, arg_v[i], jit_insn_address_of(f, v3)); + jit_insn_label(f, &l1); + j++; + break; + + case 'p': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit_value_create(f, jit_type_void_ptr); + jit_insn_store(f, arg_v[i], + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)); + v1 = jit__PMC_IS_NULL(f, reg_v[j]); + l1 = jit_label_undefined; + jit_insn_branch_if(f, v1, &l1); + v2 = jit__vtable_get_pointer(f, jit_interp, reg_v[j]); + jit_insn_store(f, arg_v[i], v2); + jit_insn_label(f, &l1); + j++; + break; + + case '2': + t1 = jit_type_sys_short; + goto call_get_integer; + case '3': + t1 = jit_type_sys_int; + goto call_get_integer; + case '4': + t1 = jit_type_sys_long; + call_get_integer: + arg_t[i] = jit_type_void_ptr; + v1 = jit__vtable_get_integer(f, jit_interp, reg_v[j]); + v2 = jit_value_create(f, t1); + jit_value_set_addressable(v2); + jit_insn_store(f, v2, v1); + arg_v[i] = jit_insn_address_of(f, v2); + j++; + break; + + case 'V': + arg_t[i] = jit_type_void_ptr; + v1 = jit__vtable_get_pointer(f, jit_interp, reg_v[j]); + v2 = jit_value_create(f, jit_type_void_ptr); + jit_value_set_addressable(v2); + jit_insn_store(f, v2, v1); + arg_v[i] = jit_insn_address_of(f, v2); + j++; + break; + + case '0': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL); + break; + + case 'J': + arg_t[i] = jit_type_void_ptr; + arg_v[i] = jit_interp; + break; + + default: + Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, + "unkown arg type '%c'", c); + return; + } + } +} - case 'J': - arg_types[i] = jit_type_void_ptr; - arg_vals[i] = jinterp; - break; +static void +Parrot_jit_parse_sig_args_pre(PARROT_INTERP, char *sig, int nargs, + jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, jit_value_t jit_pcc_sig_args, + jit_type_t *jit_args_t, + jit_value_t *jit_args_v, jit_value_t *jit_regs_v) { + int nregs; - case 'U': - /* TODO */ - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, - "arg type 'U' not yet implemented"); - return; + sig += 1; /* ignore return character */ - default: - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, - "unkown arg type '%c'", c); - return; - } - } + nregs = Parrot_jit_create_arg_regs(interp, sig, nargs, f, jit_regs_v); + Parrot_jit_fill_args(interp, sig, nargs, nregs, f, jit_interp, call_object, jit_pcc_sig_args, + jit_regs_v, jit_args_t, jit_args_v); } -jit_type_t +static jit_type_t Parrot_jit_parse_sig_ret_pre(PARROT_INTERP, char *sig) { char c; switch (c = sig[0]) { - case 'v': - return jit_type_void; - - case 'I': - return JIT_TYPE_INTVAL; - case 'c': - return jit_type_sys_char; - case 's': - return jit_type_sys_short; - case 'i': - return jit_type_sys_int; - case 'l': - return jit_type_sys_long; - - case 'N': - return JIT_TYPE_FLOATVAL; - case 'f': - return jit_type_sys_float; - case 'd': - return jit_type_sys_double; - - case 'S': - case 't': - return jit_type_void_ptr; - - case 'p': - case 'P': - return jit_type_void_ptr; - - case 'U': - /* TODO */ - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, - "return type 'U' not yet implemented"); - return NULL; - default: - /* FAIL */ - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, - "unknown return type '%c'", c); - return NULL; + case 'v': + return jit_type_void; + + case 'I': + return JIT_TYPE_INTVAL; + case 'c': + return jit_type_sys_char; + case 's': + return jit_type_sys_short; + case 'i': + return jit_type_sys_int; + case 'l': + return jit_type_sys_long; + + case 'N': + return JIT_TYPE_FLOATVAL; + case 'f': + return jit_type_sys_float; + case 'd': + return jit_type_sys_double; + + case 'S': + case 't': + return jit_type_void_ptr; + + case 'p': + case 'P': + return jit_type_void_ptr; + + default: + /* FAIL */ + Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_JIT_ERROR, + "unknown return type '%c'", c); + return NULL; } } -void +static void Parrot_jit_parse_sig_ret_post(PARROT_INTERP, char *sig, - jit_function_t f, jit_value_t jinterp, jit_value_t st, - jit_value_t retval) { + jit_function_t f, jit_value_t jit_interp, jit_value_t call_object, + jit_value_t pcc_sig, jit_value_t retval) { + jit_type_t ret_t[1]; + jit_value_t ret_v[1]; + jit_type_t t1; jit_value_t v1, v2, v3; switch (sig[0]) { - case 'v': - break; - - case 'I': - case 'c': - case 's': - case 'i': - case 'l': - jit__set_nci_I(f, jinterp, st, retval); - break; - - case 'N': - case 'f': - case 'd': - jit__set_nci_N(f, jinterp, st, retval); - break; - - case 'S': - jit__set_nci_S(f, jinterp, st, retval); - break; - case 't': - v1 = jit_value_create_nint_constant(f, jit_type_sys_int, 0); - v2 = jit__Parrot_str_new(f, jinterp, retval, v1); - jit__set_nci_S(f, jinterp, st, v2); - break; - - case 'P': - jit__set_nci_P(f, jinterp, st, retval); - break; - case 'p': - v1 = jit_value_create_intval_constant(f, enum_class_UnManagedStruct); - v2 = jit__pmc_new_noinit(f, jinterp, v1); - jit__vtable_set_pointer(f, jinterp, v2, retval); - jit__set_nci_P(f, jinterp, st, v2); - break; - case '2': - t1 = jit_type_sys_short; - goto create_int_pmc; - case '3': - t1 = jit_type_sys_int; - goto create_int_pmc; - case '4': - t1 = jit_type_sys_long; - create_int_pmc: - v1 = jit_insn_load_relative(f, retval, 0, t1); - v2 = jit_value_create_intval_constant(f, enum_class_Integer); - v3 = jit__pmc_new_noinit(f, jinterp, v2); - jit__vtable_set_integer_native(f, jinterp, v3, v1); - jit__set_nci_P(f, jinterp, st, v3); - break; - - case 'U': - /* ignore (failed elsewhere) */ - break; - - default: - /* ignore (failed elsewhere) */ - break; + case 'v': + break; + + case 'I': + case 'c': + case 's': + case 'i': + case 'l': + ret_t[0] = JIT_TYPE_INTVAL; + goto fill_ret; + case 'N': + case 'f': + case 'd': + ret_t[0] = JIT_TYPE_FLOATVAL; + goto fill_ret; + case 'S': + case 'P': + ret_t[0] = jit_type_void_ptr; + goto fill_ret; + case 't': + ret_t[0] = jit_type_void_ptr; + retval = jit__Parrot_str_new(f, jit_interp, retval, + jit_value_create_nint_constant(f, jit_type_sys_int, 0)); + goto fill_ret; + case 'p': + ret_t[0] = jit_type_void_ptr; + v1 = jit__pmc_new_noinit(f, jit_interp, + jit_value_create_intval_constant(f, enum_class_UnManagedStruct)); + jit__vtable_set_pointer(f, jit_interp, v1, retval); + retval = v1; + goto fill_ret; + case '2': + t1 = jit_type_sys_short; + goto create_int_pmc; + case '3': + t1 = jit_type_sys_int; + goto create_int_pmc; + case '4': + t1 = jit_type_sys_long; + create_int_pmc: + ret_t[0] = jit_type_void_ptr; + v1 = jit_insn_load_relative(f, retval, 0, t1); + v2 = jit__pmc_new_noinit(f, jit_interp, + jit_value_create_intval_constant(f, enum_class_Integer)); + jit__vtable_set_integer_native(f, jit_interp, v2, v1); + retval = v2; + fill_ret: + ret_v[0] = jit_value_create(f, ret_t[0]); + jit_insn_store(f, ret_v[0], retval); + jit__Parrot_pcc_fill_returns_from_c_args(f, jit_interp, call_object, pcc_sig, ret_t, ret_v, 1); + break; + + default: + /* ignore (failed elsewhere) */ + break; } } -void +static void Parrot_jit_parse_sig_args_post(PARROT_INTERP, char *sig, int nargs, - jit_function_t f, jit_value_t jinterp, + jit_function_t f, jit_value_t jit_interp, jit_value_t *args, jit_value_t *regs) { int i, j; @@ -476,64 +548,61 @@ Parrot_jit_parse_sig_args_post(PARROT_INTERP, char *sig, int nargs, jit_type_t t1; jit_value_t v1; switch (sig[i]) { - case 't': - jit__Parrot_str_free_cstring(f, args[i]); - j++; - break; - - case 'B': - v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); - jit__Parrot_str_free_cstring(f, v1); - j++; - break; - - case '2': - t1 = jit_type_sys_short; - goto set_integer; - case '3': - t1 = jit_type_sys_int; - goto set_integer; - case '4': - t1 = jit_type_sys_long; - set_integer: - v1 = jit_insn_load_relative(f, args[i], 0, t1); - jit__vtable_set_integer_native(f, jinterp, regs[j], v1); - j++; - break; - - case 'V': - v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); - jit__vtable_set_pointer(f, jinterp, regs[j], v1); - j++; - break; - - case 'I': - case 'c': - case 'i': - case 'l': - case 'N': - case 'f': - case 'd': - case 'S': - case 'b': - case 'p': - case 'P': - case 'O': - case '@': - j++; - break; - - case 'U': - /* TODO */ - break; - default: - /* ignore */ - break; + case 't': + jit__Parrot_str_free_cstring(f, args[i]); + j++; + break; + + case 'B': + v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); + jit__Parrot_str_free_cstring(f, v1); + j++; + break; + + case '2': + t1 = jit_type_sys_short; + goto set_integer; + case '3': + t1 = jit_type_sys_int; + goto set_integer; + case '4': + t1 = jit_type_sys_long; + set_integer: + v1 = jit_insn_load_relative(f, args[i], 0, t1); + jit__vtable_set_integer_native(f, jit_interp, regs[j], v1); + j++; + break; + + case 'V': + v1 = jit_insn_load_relative(f, args[i], 0, jit_type_void_ptr); + jit__vtable_set_pointer(f, jit_interp, regs[j], v1); + j++; + break; + + case 'I': + case 'c': + case 'i': + case 'l': + case 'N': + case 'f': + case 'd': + case 'S': + case 'b': + case 'p': + case 'P': + case 'O': + case '@': + j++; + break; + + default: + /* ignore */ + break; } } } -jit_value_t +static jit_value_t jit_value_create_intval_constant(jit_function_t f, INTVAL i) { return jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, i); } @@ -543,11 +612,33 @@ jit_value_create_intval_constant(jit_function_t f, INTVAL i) { */ /* custom wrappers */ -jit_value_t +static jit_value_t jit__Buffer_bufstart(jit_function_t f, jit_value_t buf) { return jit_insn_load_relative(f, buf, offsetof(Buffer, _bufstart), jit_type_void_ptr); } +static jit_value_t +jit__CURRENT_CONTEXT(jit_function_t f, jit_value_t interp) { + return jit_insn_load_relative(f, interp, offsetof(struct parrot_interp_t, ctx), jit_type_void_ptr); +} + +static jit_value_t +jit__PMC_IS_NULL(jit_function_t f, jit_value_t pmc) { + return jit_insn_or(f, + jit_insn_eq(f, pmc, + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)NULL)), + jit_insn_eq(f, pmc, + jit_value_create_nint_constant(f, jit_type_void_ptr, (jit_nint)PMCNULL))); +} + +static jit_value_t +jit__Parrot_pcc_get_signature(jit_function_t f, jit_value_t interp, jit_value_t ctx) { + return jit_insn_load_relative(f, + jit_insn_load_relative(f, ctx, offsetof(struct PMC, data), jit_type_void_ptr), + offsetof(struct Parrot_Context_attributes, current_sig), + jit_type_void_ptr); +} + /* vtable wrappers */ @TEMP_vtable_wrap_defns@ 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/config/gen/libjit/frame_builder_libjit_h.in +++ b/config/gen/libjit/frame_builder_libjit_h.in @@ -41,23 +41,30 @@ struct jit_buffer_private_data { * JIT functions */ -void * +static void * Parrot_jit_create_thunk(Interp *, char *, void *); -void -Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, +static void +Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, jit_value_t, jit_type_t *, jit_value_t *, jit_value_t *); -jit_type_t +static jit_type_t Parrot_jit_parse_sig_ret_pre(Interp *, char *); -void -Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t); +static void +Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t, jit_value_t); -void +static void Parrot_jit_parse_sig_args_post(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t *, jit_value_t *); -jit_value_t +static int +Parrot_jit_create_arg_regs(Interp *, char *, int, jit_function_t, jit_value_t *); + +static void +Parrot_jit_fill_args(Interp *, char *, int, int, jit_function_t, jit_value_t, jit_value_t, jit_value_t, + jit_value_t *, jit_type_t *, jit_value_t *); + +static jit_value_t jit_value_create_intval_constant(jit_function_t, INTVAL); /* @@ -76,9 +83,18 @@ jit_value_create_intval_constant(jit_function_t, INTVAL); */ /* custom wrappers */ -jit_value_t +static jit_value_t jit__Buffer_bufstart(jit_function_t, jit_value_t); +static jit_value_t +jit__CURRENT_CONTEXT(jit_function_t, jit_value_t); + +static jit_value_t +jit__PMC_IS_NULL(jit_function_t, jit_value_t); + +static jit_value_t +jit__Parrot_pcc_get_signature(jit_function_t, jit_value_t, jit_value_t); + /* vtable wrappers */ @TEMP_vtable_wrap_decls@ diff --git a/config/gen/makefiles/root.in b/config/gen/makefiles/root.in index 823709c..59af370 100644 --- a/config/gen/makefiles/root.in +++ b/config/gen/makefiles/root.in @@ -315,7 +315,6 @@ GEN_LIBRARY := \ $(LIBRARY_DIR)/YAML/Dumper/Base.pbc \ $(LIBRARY_DIR)/YAML/Dumper/Default.pbc \ $(LIBRARY_DIR)/YAML/Dumper.pbc \ - $(LIBRARY_DIR)/YAML/Parser/Syck.pbc \ $(LIBRARY_DIR)/STM.pbc \ $(LIBRARY_DIR)/libpcre.pbc \ $(LIBRARY_DIR)/postgres.pbc @@ -443,7 +442,6 @@ INTERP_O_FILES := \ $(SRC_DIR)/longopt$(O) \ $(SRC_DIR)/misc$(O) \ $(SRC_DIR)/multidispatch$(O) \ - $(SRC_DIR)/frame_builder$(O) \ $(SRC_DIR)/frame_builder_libjit$(O) \ $(SRC_DIR)/nci$(O) \ $(SRC_DIR)/oo$(O) \ @@ -627,7 +625,6 @@ STR_FILES := \ $(SRC_DIR)/key.str \ $(SRC_DIR)/library.str \ $(SRC_DIR)/multidispatch.str \ - $(SRC_DIR)/frame_builder.str \ $(SRC_DIR)/frame_builder_libjit.str \ $(SRC_DIR)/nci.str \ $(SRC_DIR)/packfile.str \ @@ -1204,18 +1201,11 @@ $(SRC_DIR)/dataypes$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dataypes.c $(SRC_DIR)/exit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exit.c $(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c $(SRC_DIR)/nci.str \ - $(SRC_DIR)/frame_builder$(O) \ $(SRC_DIR)/frame_builder_libjit$(O) \ $(SRC_DIR)/pmc/pmc_managedstruct.h \ $(SRC_DIR)/pmc/pmc_nci.h \ $(SRC_DIR)/pmc/pmc_pointer.h -$(SRC_DIR)/frame_builder$(O) : \ - $(SRC_DIR)/frame_builder.h \ - $(SRC_DIR)/frame_builder.c \ - $(SRC_DIR)/frame_builder.str \ - $(GENERAL_H_FILES) - $(SRC_DIR)/frame_builder_libjit$(O) : \ $(SRC_DIR)/frame_builder_libjit.h \ $(SRC_DIR)/frame_builder_libjit.c \ diff --git a/docs/book/draft/ch11_directive_reference.pod b/docs/book/draft/ch11_directive_reference.pod index 6f65deb..6425aa1 100644 --- a/docs/book/draft/ch11_directive_reference.pod +++ b/docs/book/draft/ch11_directive_reference.pod @@ -41,7 +41,7 @@ X<.emit directive> .emit -Define a compilation unit of PASM code. Always paired with C<.eom>. +Define a block of PASM code. Always paired with C<.eom>. =head3 .end @@ -49,7 +49,7 @@ X<.end directive> .end -End a compilation unit. Always paired with C<.sub>. +End a subroutine. Always paired with C<.sub>. =head3 .endm @@ -65,7 +65,7 @@ X<.eom directive> .eom -End a compilation unit of PASM code. Always paired with C<.emit>. +End a block of PASM code. Always paired with C<.emit>. =head3 .flatten_arg @@ -208,7 +208,7 @@ X<.sub directive> .sub R -Define a compilation unit. Always paired with C<.end>. Names begin +Define a subroutine. Always paired with C<.end>. Names begin with "C<_>" by convention. =head3 .sym diff --git a/docs/compiler_faq.pod b/docs/compiler_faq.pod index f7d0f20..591ac8b 100644 --- a/docs/compiler_faq.pod +++ b/docs/compiler_faq.pod @@ -96,7 +96,7 @@ The method name may also be a string variable representing a method name: There are several ways to achieve this, depending on the location of the subroutine. -If the sub is in the same compilation unit use a Sub constant: +If the sub is in the same file use a Sub constant: =begin PIR_FRAGMENT @@ -780,22 +780,4 @@ Create a new C PMC and access it like a hash. See F for all the keys in the config hash - or iterate over the config hash. -=head1 Languages - -=head2 What files do I need to modify to add my new language compiler? - -Aside from the files in your new language directory, you must modify - - CREDITS - MANIFEST - config/gen/languages.pm - config/gen/makefiles/languages.in - -Inside your language dir, you may consider adding the following: - - LICENSE - MAINTAINER - README - STATUS - -Look to existing languages for some examples. +=cut diff --git a/docs/pdds/draft/pdd10_embedding.pod b/docs/pdds/draft/pdd10_embedding.pod index f2b71aa..44eddd9 100644 --- a/docs/pdds/draft/pdd10_embedding.pod +++ b/docs/pdds/draft/pdd10_embedding.pod @@ -96,7 +96,7 @@ Gotchas: =item * probably a continuation/control flow boundary -=item * packfiles and compilation units probably too much information for +=item * packfiles and subroutines probably too much information for either =item * do not let MMD and other implementation details escape diff --git a/docs/pdds/pdd07_codingstd.pod b/docs/pdds/pdd07_codingstd.pod index 809d933..d3fd677 100644 --- a/docs/pdds/pdd07_codingstd.pod +++ b/docs/pdds/pdd07_codingstd.pod @@ -208,8 +208,6 @@ Return values should not be parenthesized without need. It may be necessary to parenthesize a long return expression so that a smart editor will properly indent it. -{{ RT#45365: Modify parrot.el so this rule is no longer required. }} - =item * When assigning inside a conditional, use extra parentheses, diff --git a/docs/pdds/pdd19_pir.pod b/docs/pdds/pdd19_pir.pod index a067e9a..540cfcd 100644 --- a/docs/pdds/pdd19_pir.pod +++ b/docs/pdds/pdd19_pir.pod @@ -397,9 +397,9 @@ level language debug information. Examples: =end PIR_FRAGMENT An annotation stays in effect until the next annotation with the same key or -the end of the current compilation unit (that is, if you use a tool such as -C to link multiple bytecode files, then annotations will not spill -over from one mergee's bytecode to another). +the end of the current file (that is, if you use a tool such as C +to link multiple bytecode files, then annotations will not spill over from one +mergee's bytecode to another). One annotation covers many PIR instructions. If the result of compiling one line of HLL code is 15 lines of PIR, you only need to emit one annotation diff --git a/docs/project/release_manager_guide.pod b/docs/project/release_manager_guide.pod index 07f0e8f..9f66a4c 100644 --- a/docs/project/release_manager_guide.pod +++ b/docs/project/release_manager_guide.pod @@ -34,7 +34,7 @@ For example, you could select a name from L. Set up your account on L and ask an existing release -manager to provide you with admin privileges if you don't already have them. +manager to provide you with editor privileges if you don't already have them. =item 1. @@ -235,7 +235,7 @@ features, just be sure to say the same thing in both text and HTML versions. =item 10. -Update the website. You will need an account with administrative rights +Update the website. You will need an account with editor rights on L. =over 4 @@ -383,7 +383,9 @@ L require deprecation notices: =over 4 -=item * Parrot functions I marked with C +=item * Parrot functions I marked with C or documented as part +of the public API (listed in docs/embed.pod) =item * The layout of Parrot's internal data structures diff --git a/examples/nci/Xlib.pir b/examples/nci/Xlib.pir index 98a1139..e5f507a 100644 --- a/examples/nci/Xlib.pir +++ b/examples/nci/Xlib.pir @@ -934,6 +934,23 @@ doit: .end #----------------------------------------------------------------------- +.sub ClearArea :method + .param int x + .param int y + .param int width + .param int height + .param int exposures + .local pmc xdisp + xdisp = self.'getdisplay'() + .local pmc xwin + xwin = getattribute self, attr_XWindow + .local pmc func + func = get_xlib_function('XClearArea', 'ippiiiii') + $I0 = func(xdisp, xwin, x, y, width, height, exposures) + .return($I0) +.end + +#----------------------------------------------------------------------- .sub StoreName :method .param string name diff --git a/runtime/parrot/include/test_more.pir b/runtime/parrot/include/test_more.pir index 3afbf74..e368535 100644 --- a/runtime/parrot/include/test_more.pir +++ b/runtime/parrot/include/test_more.pir @@ -20,7 +20,7 @@ simple test file written in parrot. .local pmc exports, curr_namespace, test_namespace curr_namespace = get_namespace test_namespace = get_root_namespace [ 'parrot'; 'Test'; 'More' ] - exports = split ' ', 'plan diag ok nok is is_deeply like substring isa_ok skip isnt todo throws_like lives_ok throws_substring' + exports = split ' ', 'plan diag ok nok is is_deeply like substring isa_ok skip isnt todo throws_like lives_ok dies_ok throws_substring' test_namespace.'export_to'(curr_namespace, exports) diff --git a/runtime/parrot/library/Test/More.pir b/runtime/parrot/library/Test/More.pir index fa4d271..4959c60 100644 --- a/runtime/parrot/library/Test/More.pir +++ b/runtime/parrot/library/Test/More.pir @@ -13,7 +13,7 @@ Test::More - Parrot extension for testing modules .local pmc exports, curr_namespace, test_namespace curr_namespace = get_namespace test_namespace = get_namespace [ 'Test'; 'More' ] - exports = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo throws_like lives_ok' + exports = split ' ', 'plan diag ok nok is is_deeply like isa_ok skip isnt todo throws_like lives_ok dies_ok' test_namespace.'export_to'(curr_namespace, exports) @@ -838,10 +838,59 @@ This handles comparisons of array-like and hash-like structures. .return( equal ) .end +=item C + +Takes PIR code in C and an optional message in C. +Passes a test if the PIR code throws any exception, fails a test otherwise. + +=cut + +.sub dies_ok + .param string target + .param string description :optional + + .local pmc test + get_hll_global test, [ 'Test'; 'More' ], '_test' + + .local pmc comp + .local pmc compfun + .local pmc compiler + compiler = compreg 'PIR' + + .local pmc eh + eh = new 'ExceptionHandler' + set_addr eh, handler # set handler label for exceptions + push_eh eh + + compfun = compiler(target) + compfun() # eval the target code + + pop_eh + + # if it doesn't throw an exception fail + test.'ok'( 0, description ) + test.'diag'('no error thrown') + + goto done + + handler: + .local pmc ex + .local string error_msg + .local string diagnostic + + .get_results (ex) + pop_eh + error_msg = ex + test.'ok'( 1, description ) + + done: + +.end + =item C Takes PIR code in C and an optional message in C. -Passes a test if the PIR does not throw any exception. +Passes a test if the PIR does not throw any exception, fails a test otherwise. =cut 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/runtime/parrot/library/YAML/Parser/Syck.pir +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright (C) 2005-2008, Parrot Foundation. -# $Id$ - -=head1 NAME - -YAML/Parser/Syck.pir - Interface to libsyck - -=head1 SYNOPSIS - -This won't work yet with a standard libsyck, as libsyck needs to be -aware of Parrot. - -=head1 DESCRIPTION - -Ask libsyck to do some work. -Uses the native call interface. -Needs synchronous callbacks. - -=head1 METHODS - -=cut - -=head2 load - -Parses a YAML string and returns a data structure. - -=cut - -.include "datatypes.pasm" - -.sub load - .param string yaml_string - - # prepare user data - .local pmc user_data - user_data = new 'String' - - .local string library_name - library_name = 'libsyck' - .local pmc libsyck - libsyck = loadlib library_name - unless libsyck goto NOT_LOADED - - .local int is_defined - - # getting a handle on a YAML parser - .local pmc syck_new_parser - syck_new_parser = dlfunc libsyck, "syck_new_parser", "p" - .local pmc parser - ( parser ) = syck_new_parser( ) - is_defined = defined parser - unless is_defined goto NOT_DEFINED - - # A Sub that can be given to the library - # this callback function will eventually by called by the library - .const 'Sub' yaml_handler = "_yaml_handler" - .local pmc yaml_handler_wrapped - yaml_handler_wrapped = new_callback yaml_handler, user_data, "vUp" # Z in pdd16 - - .local pmc synchronous - synchronous = new 'Integer' - synchronous = 1 - setprop user_data, "_synchronous", synchronous - - # call syck_parser_handler - .local pmc syck_parser_handler - syck_parser_handler = dlfunc libsyck, "syck_parser_handler", "vpp" - syck_parser_handler( parser, yaml_handler_wrapped ) - - # tell about the user_data - .local pmc syck_parser_bonus - syck_parser_bonus = dlfunc libsyck, "syck_parser_bonus", "vpP" - syck_parser_bonus( parser, user_data ) - - # tell about the string - .local pmc syck_parser_str, read - read = new 'UnManagedStruct' - pin yaml_string - syck_parser_str = dlfunc libsyck, "syck_parser_str", "vpbip" - .local int yaml_string_len - yaml_string_len = length yaml_string - syck_parser_str( parser, yaml_string, yaml_string_len, read ) - - # call syck_parse - .local pmc syck_parse - .local int sym_id - syck_parse = dlfunc libsyck, "syck_parse", "ip" - ( sym_id ) = syck_parse( parser ) - - # cleaning up a handle on a YAML parser - .local pmc syck_free_parser - syck_free_parser = dlfunc libsyck, "syck_free_parser", "vp" - syck_free_parser( parser ) - -NOT_DEFINED: -NOT_LOADED: - .return( user_data ) -.end - - -.sub _yaml_handler - .param pmc user_data - .param pmc external_data - - # struct _syck_node { - # /* Symbol table ID */ - # SYMID id; - # /* Underlying kind */ - # enum syck_kind_tag kind; - # /* Fully qualified tag-uri for type */ - # char *type_id; - # /* Anchor name */ - # char *anchor; - # union { - # /* Storage for map data */ - # struct SyckMap { - # SYMID *keys; - # SYMID *values; - # long capa; - # long idx; - # } *pairs; - # /* Storage for sequence data */ - # struct SyckSeq { - # SYMID *items; - # long capa; - # long idx; - # } *list; - # /* Storage for string data */ - # struct SyckStr { - # enum scalar_style style; - # char *ptr; - # long len; - # } *str; - # } data; - # /* Shortcut node */ - # void *shortcut; - # }; - - - # external_data is an UnManagedStruct PMC containing node info - .local pmc external_data_decl, data_str_decl, data_str - external_data_decl = new 'ResizablePMCArray' - data_str_decl = new 'ResizablePMCArray' - - # id - push external_data_decl, .DATATYPE_INT - push external_data_decl, 0 - push external_data_decl, 0 - # kind - push external_data_decl, .DATATYPE_INT - push external_data_decl, 0 - push external_data_decl, 0 - # type_id - push external_data_decl, .DATATYPE_CSTR - push external_data_decl, 0 - push external_data_decl, 0 - # anchor - push external_data_decl, .DATATYPE_CSTR - push external_data_decl, 0 - push external_data_decl, 0 - - # style - push data_str_decl, .DATATYPE_INT - push data_str_decl, 0 - push data_str_decl, 0 - # ptr - push data_str_decl, .DATATYPE_CSTR - push data_str_decl, 0 - push data_str_decl, 0 - # len - push data_str_decl, .DATATYPE_INT - push data_str_decl, 0 - push data_str_decl, 0 - data_str = new 'UnManagedStruct', data_str_decl - - push external_data_decl, .DATATYPE_STRUCT_PTR - $P9 = external_data_decl[-1] - setprop $P9, "_struct", data_str - push external_data_decl, 0 - push external_data_decl, 0 - - assign external_data, external_data_decl - - .local int id, kind, data_str_len - .local string type_id, anchor, data_str_ptr - .local string cloned - id = external_data[0] - kind = external_data[1] - # type_id = external_data[2] # This might be NULL - # anchor = external_data[3] # This might be NULL - data_str_len = external_data[4;2] - - # For now just save all the strings - unless kind == 2 goto IGNORE_NON_STRING - data_str_ptr = external_data[4;1] - concat user_data, user_data, data_str_ptr - concat user_data, user_data, "\n" -IGNORE_NON_STRING: - - # debug output - print user_data - print "\n" - - .return() -.end - -=head1 TODO - -Do some object stuff. -Be nice and put stuff into a namespace. -Provide a patch for libsyck. - -=head1 AUTHOR - -Bernhard Schmalhofer - - -=head1 SEE ALSO - - YAML::Parser::Syck.pm - yaml.kwiki.org - -=cut - -# Local Variables: -# mode: pir -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4 ft=pir: diff --git a/src/call/context.c b/src/call/context.c index 5795bdf..542c998 100644 --- a/src/call/context.c +++ b/src/call/context.c @@ -74,7 +74,7 @@ static void allocate_registers(PARROT_INTERP, __attribute__nonnull__(3); static size_t calculate_registers_size(SHIM_INTERP, - ARGIN(const INTVAL *number_regs_used)) + ARGIN(const UINTVAL *number_regs_used)) __attribute__nonnull__(2); static void clear_regs(PARROT_INTERP, ARGMOD(PMC *pmcctx)) @@ -97,7 +97,7 @@ static void init_context(PARROT_INTERP, FUNC_MODIFIES(*pmcctx); static size_t Parrot_pcc_calculate_registers_size(PARROT_INTERP, - ARGIN(const INTVAL *number_regs_used)) + ARGIN(const UINTVAL *number_regs_used)) __attribute__nonnull__(1) __attribute__nonnull__(2); @@ -399,7 +399,7 @@ Parrot_pop_context(PARROT_INTERP) /* -=item C Calculate memory size required for registers. @@ -408,7 +408,7 @@ Calculate memory size required for registers. */ static size_t -calculate_registers_size(SHIM_INTERP, ARGIN(const INTVAL *number_regs_used)) +calculate_registers_size(SHIM_INTERP, ARGIN(const UINTVAL *number_regs_used)) { ASSERT_ARGS(calculate_registers_size) @@ -423,7 +423,7 @@ calculate_registers_size(SHIM_INTERP, ARGIN(const INTVAL *number_regs_used)) /* =item C +UINTVAL *number_regs_used)> Calculate size of Context. @@ -432,7 +432,7 @@ Calculate size of Context. */ static size_t -Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used)) +Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const UINTVAL *number_regs_used)) { ASSERT_ARGS(Parrot_pcc_calculate_registers_size) return calculate_registers_size(interp, number_regs_used); diff --git a/src/extend.c b/src/extend.c index 5d247bd..aa58f2a 100644 --- a/src/extend.c +++ b/src/extend.c @@ -1182,7 +1182,7 @@ Parrot_call_sub(PARROT_INTERP, Parrot_PMC sub_pmc, /* Add the return argument onto the call signature object (a bit * hackish, added for backward compatibility in deprecated API function, - * see TT #XXX). */ + * see TT #1145). */ switch (return_sig) { case 'v': { @@ -1243,7 +1243,7 @@ Parrot_call_sub_ret_int(PARROT_INTERP, Parrot_PMC sub_pmc, /* Add the return argument onto the call signature object (a bit * hackish, added for backward compatibility in deprecated API function, - * see TT #XXX). */ + * see TT #1145). */ append_result(interp, sig_object, Parrot_str_new_constant(interp, "I"), &result); Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object); @@ -1281,7 +1281,7 @@ Parrot_call_sub_ret_float(PARROT_INTERP, Parrot_PMC sub_pmc, /* Add the return argument onto the call signature object (a bit * hackish, added for backward compatibility in deprecated API function, - * see TT #XXX). */ + * see TT #1145). */ append_result(interp, sig_object, Parrot_str_new_constant(interp, "N"), &result); PMC_get_sub(interp, sub_pmc, sub); Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), sub->seg->const_table->constants); @@ -1330,7 +1330,7 @@ Parrot_call_method(PARROT_INTERP, Parrot_PMC sub_pmc, Parrot_PMC obj, /* Add the return argument onto the call signature object (a bit * hackish, added for backward compatibility in deprecated API function, - * see TT #XXX). */ + * see TT #1145). */ switch (return_sig) { case 'v': { diff --git a/src/frame_builder.c b/src/frame_builder.c deleted file mode 100644 index 1296ac9..0000000 --- a/src/frame_builder.c +++ /dev/null @@ -1,141 +0,0 @@ -/* -Copyright (C) 2008-2009, Parrot Foundation. -$Id$ -*/ - -/* HEADERIZER HFILE: none */ -/* HEADERIZER STOP */ - -#include "parrot/parrot.h" -#include "frame_builder.h" - -INTVAL -get_nci_I(PARROT_INTERP, ARGMOD(call_state *st), int n) -{ - if (n >= st->src.n) - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, - "too few arguments passed to NCI function"); - - Parrot_fetch_arg_nci(interp, st); - - return UVal_int(st->val); -} - -FLOATVAL -get_nci_N(PARROT_INTERP, ARGMOD(call_state *st), int n) -{ - if (n >= st->src.n) - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, - "too few arguments passed to NCI function"); - - Parrot_fetch_arg_nci(interp, st); - - return UVal_num(st->val); -} - -PARROT_WARN_UNUSED_RESULT -PARROT_CANNOT_RETURN_NULL -STRING* -get_nci_S(PARROT_INTERP, ARGMOD(call_state *st), int n) -{ - /* TODO or act like below? */ - if (n >= st->src.n) - Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, - "too few arguments passed to NCI function"); - - Parrot_fetch_arg_nci(interp, st); - - return UVal_str(st->val); -} - -PARROT_WARN_UNUSED_RESULT -PARROT_CAN_RETURN_NULL -PMC* -get_nci_P(PARROT_INTERP, ARGMOD(call_state *st), int n) -{ - /* - * excessive args are passed as NULL - * used by e.g. MMD infix like __add - */ - if (n < st->src.n) { - PMC *value; - Parrot_fetch_arg_nci(interp, st); - value = UVal_pmc(st->val); - return PMC_IS_NULL(value) ? (PMC *)NULL : value; - } - else - return NULL; -} - -PARROT_WARN_UNUSED_RESULT -PARROT_CAN_RETURN_NULL -void* -get_nci_p(PARROT_INTERP, ARGMOD(call_state *st), int n) -{ - /* - * excessive args are passed as NULL - * used by e.g. MMD infix like __add - */ - if (n < st->src.n) { - PMC *value; - Parrot_fetch_arg_nci(interp, st); - value = UVal_pmc(st->val); - return PMC_IS_NULL(value) ? (PMC *)NULL : VTABLE_get_pointer(interp, value); - } - else - return NULL; -} - -/* - * set return value - */ -void -set_nci_I(PARROT_INTERP, ARGOUT(call_state *st), INTVAL val) -{ - Parrot_init_ret_nci(interp, st, "I"); - if (st->dest.i < st->dest.n) { - UVal_int(st->val) = val; - Parrot_convert_arg(interp, st); - Parrot_store_arg(interp, st); - } -} - -void -set_nci_N(PARROT_INTERP, ARGOUT(call_state *st), FLOATVAL val) -{ - Parrot_init_ret_nci(interp, st, "N"); - if (st->dest.i < st->dest.n) { - UVal_num(st->val) = val; - Parrot_convert_arg(interp, st); - Parrot_store_arg(interp, st); - } -} - -void -set_nci_S(PARROT_INTERP, ARGOUT(call_state *st), STRING *val) -{ - Parrot_init_ret_nci(interp, st, "S"); - if (st->dest.i < st->dest.n) { - UVal_str(st->val) = val; - Parrot_convert_arg(interp, st); - Parrot_store_arg(interp, st); - } -} - -void -set_nci_P(PARROT_INTERP, ARGOUT(call_state *st), PMC* val) -{ - Parrot_init_ret_nci(interp, st, "P"); - if (st->dest.i < st->dest.n) { - UVal_pmc(st->val) = val; - Parrot_convert_arg(interp, st); - Parrot_store_arg(interp, st); - } -} - -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */ diff --git a/src/nci_test.c b/src/nci_test.c index 7593431..f1c972e 100644 --- a/src/nci_test.c +++ b/src/nci_test.c @@ -110,8 +110,8 @@ PARROT_DYNEXT_EXPORT char * nci_ttt(char *, char *); PARROT_DYNEXT_EXPORT void nci_vfff(float, float, float); PARROT_DYNEXT_EXPORT void nci_vV(const char **); PARROT_DYNEXT_EXPORT void nci_vVVV(const char **, const char **, const char **); -PARROT_DYNEXT_EXPORT int nci_i20(int, int, int, int, int, int, int, int, int, int, int, int, int, int, - int, int, int, int, int); +PARROT_DYNEXT_EXPORT int nci_i20(int, int, int, int, int, int, int, int, int, int, int, int, + int, int, int, int, int, int, int); /* Declarations for callback tests */ diff --git a/src/pmc/callsignaturereturns.pmc b/src/pmc/callsignaturereturns.pmc index 3a2eb25..becbd6e 100644 --- a/src/pmc/callsignaturereturns.pmc +++ b/src/pmc/callsignaturereturns.pmc @@ -308,7 +308,9 @@ necessary. *(STRING **)ptr = value; break; case PARROT_ARG_PMC: - *(PMC **)ptr = get_string_pmc(INTERP, value); + *(PMC **)ptr = STRING_IS_NULL(value) ? + PMCNULL : + get_string_pmc(INTERP, value); break; default: PARROT_ASSERT(!"Impossible type"); diff --git a/src/string/api.c b/src/string/api.c index a1b96e7..763f7cf 100644 --- a/src/string/api.c +++ b/src/string/api.c @@ -2780,14 +2780,14 @@ Parrot_str_unescape(PARROT_INTERP, ASSERT_ARGS(Parrot_str_unescape) STRING *result; - const ENCODING *encoding; const CHARSET *charset; + const ENCODING *encoding = NULL; /* the default encoding is ascii */ const char *enc_name = enc_char ? enc_char : "ascii"; /* does the encoding have a character set? */ - char *p = enc_char ? strchr(enc_char, ':') : NULL; + const char *p = enc_char ? strchr(enc_char, ':') : NULL; size_t clength = strlen(cstring); String_iter iter; UINTVAL offs, d; @@ -2800,8 +2800,16 @@ Parrot_str_unescape(PARROT_INTERP, --clength; if (p) { - *p = '\0'; - encoding = Parrot_find_encoding(interp, enc_char); + #define MAX_ENCODING_NAME_ALLOWED 63 + char buffer[MAX_ENCODING_NAME_ALLOWED + 1]; + size_t l = p - enc_char; + charset = NULL; + + if (l < MAX_ENCODING_NAME_ALLOWED) { + memcpy(buffer, enc_char, l); + buffer[l] = '\0'; + encoding = Parrot_find_encoding(interp, buffer); + } if (!encoding) Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, "Can't make '%s' encoding strings", enc_char); diff --git a/t/library/test_more.t b/t/library/test_more.t index 00bc89a..b4fa044 100644 --- a/t/library/test_more.t +++ b/t/library/test_more.t @@ -15,14 +15,14 @@ .local pmc exports, curr_namespace, test_namespace curr_namespace = get_namespace test_namespace = get_namespace [ 'Test'; 'More' ] - exports = split " ", "ok nok is diag like skip todo is_deeply isa_ok isnt throws_like lives_ok" + exports = split " ", "ok nok is diag like skip todo is_deeply isa_ok isnt throws_like lives_ok dies_ok" test_namespace.'export_to'(curr_namespace, exports) test_namespace = get_namespace [ 'Test'; 'Builder'; 'Tester' ] exports = split " ", "plan test_out test_diag test_fail test_pass test_test" test_namespace.'export_to'(curr_namespace, exports) - plan( 98 ) + plan( 102 ) test_skip() test_todo() @@ -34,12 +34,51 @@ test_is_deeply() test_diagnostics() test_lives_ok() + test_dies_ok() test_throws_like() test_isa_ok() test.'finish'() .end +.sub test_dies_ok + test_pass( 'dies_ok passes when there is an error' ) + dies_ok( <<'CODE', 'dies_ok passes when there is an error' ) +.sub main + die 'I did it for the lulz' +.end +CODE + test_test( 'dies_ok passes when there is an error' ) + + test_fail( 'dies_ok fails when there is no error' ) + dies_ok( <<'CODE', 'dies_ok fails when there is no error' ) +.sub main + $I0 = 42 +.end +CODE + test_diag( 'no error thrown' ) + test_test( 'dies_ok fails when there is no error' ) + + test_pass( 'dies_ok passes when there is an error with diagnostic message' ) + dies_ok( <<'CODE', 'dies_ok passes when there is an error with diagnostic message' ) +.sub main + die 'I did it for the lulz' +.end +CODE + test_diag( '' ) + test_test( 'dies_ok passes when there is an error with diagnostic message' ) + + test_fail( 'dies_ok fails when there is no error with diagnostic message' ) + dies_ok( <<'CODE', 'dies_ok fails when there is no error with diagnostic message' ) +.sub main + $I0 = 42 +.end +CODE + test_diag( 'no error thrown' ) + test_test( 'dies_ok fails when there is no error with diagnostic message' ) + +.end + .sub test_lives_ok test_pass( 'lives_ok passes when there is no error' ) diff --git a/t/library/yaml_parser_syck.t b/t/library/yaml_parser_syck.t deleted file mode 100644 index 0556786..0000000 --- a/t/library/yaml_parser_syck.t +++ /dev/null @@ -1,175 +0,0 @@ -#!perl -# Copyright (C) 2001-2006, Parrot Foundation. -# $Id$ - -use strict; -use warnings; -use lib qw( t . lib ../lib ../../lib ); - -use Test::More; -use Parrot::Test tests => 1; - -=head1 NAME - -t/library/yaml_parser_syck.t - testing library/YAML/Parser/Syck.pir - -=head1 SYNOPSIS - - % prove t/library/yaml_parser_syck.t - -=head1 DESCRIPTION - -Try to parse a YAML document. - -=cut - -TODO: { - - local $TODO = 'Not properly implemented yet'; - - pir_output_is( << 'CODE', << 'OUT', "basic parsing" ); - -.sub test :main - load_bytecode "YAML/Parser/Syck.pbc" - load_bytecode "dumper.pbc" - - .local pmc loaded - ( 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" ) - _dumper( "loaded", loaded ) - - end -.end -CODE -val1 - -val1 -key1 - -val1 -key1 -val2 - -val1 -key1 -val2 -key2 - -val1 -key1 -val2 -key2 - -val1 -key1 -val2 -key2 -elem1 - -val1 -key1 -val2 -key2 -elem1 -elem12 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 -elem12345 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 -elem12345 -elem123456 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 -elem12345 -elem123456 -elem1234567 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 -elem12345 -elem123456 -elem1234567 -elem12345678 - -val1 -key1 -val2 -key2 -elem1 -elem12 -elem123 -elem1234 -elem12345 -elem123456 -elem1234567 -elem12345678 - -"loaded" => "val1\nkey1\nval2\nkey2\nelem1\nelem12\nelem123\nelem1234\nelem12345\nelem123456\nelem1234567\nelem12345678\n" with-properties: Hash { - "_interpreter" => PMC 'ParrotInterpreter' { ... }, - "_signature" => "Up", - "_sub" => sub { ... }, - "_synchronous" => 1 -} -OUT -} - -=head1 AUTHOR - -Bernhard Schmalhofer - - -=head1 SEE ALSO - -F - -=cut - -# Local Variables: -# mode: cperl -# cperl-indent-level: 4 -# fill-column: 100 -# End: -# vim: expandtab shiftwidth=4: diff --git a/t/pmc/sub.t b/t/pmc/sub.t index f22b7c6..4d70a9d 100644 --- a/t/pmc/sub.t +++ b/t/pmc/sub.t @@ -688,7 +688,7 @@ print $TEMP <<'EOF'; .end # :load or other pragmas are only evaluated on the first -# instruction of a compilation unit +# instruction of a subroutine .sub _sub1 :load say "in sub1" returncc diff --git a/t/src/warnings.t b/t/src/warnings.t index 0f35793..a884a57 100644 --- a/t/src/warnings.t +++ b/t/src/warnings.t @@ -36,13 +36,11 @@ c_output_is( <<'CODE', <<'OUTPUT', "print_pbc_location" ); int main(int argc, char* argv[]) { - Interp *interp; + Parrot_Interp interp = Parrot_new(NULL); int error_val; - interp = Parrot_new(NULL); - if (!interp) { + if (!interp) return 1; - } print_pbc_location(interp); @@ -61,13 +59,12 @@ c_output_is( <<'CODE', <<'OUTPUT', "Parrot_warn" ); int main(int argc, char* argv[]) { - Interp *interp; + Parrot_Interp interp = Parrot_new(NULL); int error_val; - interp = Parrot_new(NULL); - if (!interp) { + if (!interp) return 1; - } + PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG); error_val = Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG, "all");