Ticket #1105: pcc_reapply_merge_fixups.patch
File pcc_reapply_merge_fixups.patch, 74.4 KB (added by plobsing, 12 years ago) |
---|
-
ChangeLog
diff --git a/ChangeLog b/ChangeLog index 2349eff..d199efc 100644
a b 1 1 #1 $Id$ 2 2 3 3 2009.10.20 dukeleto 4 5 4 * Released 1.7.0 5 See NEWS for more. 6 6 7 7 2009.9.15 particle 8 9 8 * Released 1.6.0 9 See NEWS for more. 10 10 11 11 2009.8.18 Whiteknight 12 13 12 * Released 1.5.0 13 See NEWS for more. 14 14 15 15 2009.7.21 cotto 16 16 * Released 1.4.0 … … 18 18 19 19 2009.06.16 Whiteknight 20 20 * Released 1.3.0 21 Se sNEWS for more.21 See NEWS for more. 22 22 23 23 2009.05.19 Infinoid 24 24 * Released 1.2.0 -
MANIFEST
diff --git a/MANIFEST b/MANIFEST index 0f3bd1b..39a60b8 100644
a b 1227 1227 runtime/parrot/library/YAML/Dumper.pir [library] 1228 1228 runtime/parrot/library/YAML/Dumper/Base.pir [library] 1229 1229 runtime/parrot/library/YAML/Dumper/Default.pir [library] 1230 runtime/parrot/library/YAML/Parser/Syck.pir [library]1231 1230 runtime/parrot/library/dumper.pir [library] 1232 1231 runtime/parrot/library/libpcre.pir [library] 1233 1232 runtime/parrot/library/ncurses.declarations [library] … … 1271 1270 src/exceptions.c [] 1272 1271 src/exit.c [] 1273 1272 src/extend.c [] 1274 src/frame_builder.c []1275 1273 src/frame_builder.h [] 1276 1274 src/gc/alloc_memory.c [] 1277 1275 src/gc/alloc_resources.c [] … … 1683 1681 t/library/test_more.t [test] 1684 1682 t/library/uuid.t [test] 1685 1683 t/library/yaml_dumper.t [test] 1686 t/library/yaml_parser_syck.t [test]1687 1684 t/manifest/01-basic.t [test] 1688 1685 t/manifest/02-regenerate_file.t [test] 1689 1686 t/manifest/03-regenerate_skip.t [test] -
PLATFORMS
diff --git a/PLATFORMS b/PLATFORMS index 155157a..6781704 100644
a b 18 18 linux-x86-gcc4.1.2 Y ? Y Y Y Y ? 20090419 19 19 linux-x86-gcc4.2.4 Y ? Y Y Y Y ? 20081023 20 20 linux-x86-gcc4.3.2 Y ? Y Y Y Y ? 20081030 21 linux-x86-gcc4.4.1 Y ? Y Y Y Y ? 20091103 21 22 linux-x86-llvm-gcc-4.2 Y ? ? ? Y Y ? 20091021 22 23 sol10-sparc-cc_5.9 B4 Y - Y Y Y Y ? 20090720 23 24 sol10-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 906 906 907 907 /* 908 908 909 =item C<STRING * IMCC_string_from__STRINGC(PARROT_INTERP, c onst char *buf)>909 =item C<STRING * IMCC_string_from__STRINGC(PARROT_INTERP, char *buf)> 910 910 911 911 =cut 912 912 … … 915 915 PARROT_WARN_UNUSED_RESULT 916 916 PARROT_CANNOT_RETURN_NULL 917 917 STRING * 918 IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(c onst char *buf))918 IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) 919 919 { 920 920 ASSERT_ARGS(IMCC_string_from__STRINGC) 921 921 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 38 38 39 39 PARROT_WARN_UNUSED_RESULT 40 40 PARROT_CANNOT_RETURN_NULL 41 STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(c onst char *buf))41 STRING * IMCC_string_from__STRINGC(PARROT_INTERP, ARGIN(char *buf)) 42 42 __attribute__nonnull__(1) 43 43 __attribute__nonnull__(2); 44 44 -
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 725 725 726 726 for (i = count = unused = 0; i < unit->n_symbols; i++) { 727 727 SymReg * const r = unit->reglist[i]; 728 c har *p;728 const char *p; 729 729 int reg_set; 730 730 731 731 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 12 12 13 13 The libjit library implements just-in-time compilation functionality. Unlike 14 14 other JITs, this one is designed to be independent of any particular virtual 15 machine bytecode format or language. 15 machine bytecode format or language. 16 16 17 17 libjit can be obtained from L<http://freshmeat.net/projects/libjit/> or through 18 18 your 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 32 32 v illllllll 33 33 v l 34 34 v p 35 v pbip # for libsyck35 v pbip 36 36 v pi 37 37 v piiii 38 38 v pl … … 380 380 381 381 p ppiii 382 382 p ppiiiiiii 383 i ppii 384 i ppiii 385 i ppiiii 386 i ppiiiii 387 i ppiiiiii 383 388 i ppt 384 389 i pppi 385 390 i pppii -
config/gen/libjit.pm
diff --git a/config/gen/libjit.pm b/config/gen/libjit.pm index cbe784a..12e3eaa 100644
a b 38 38 frame_builder_c => 'config/gen/libjit/frame_builder_libjit_c.in', 39 39 }, 40 40 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' ], 45 46 }, 46 47 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' ], 57 52 58 53 Parrot_str_new => 59 54 [ qw(void_ptr void_ptr UINTVAL) => 'void_ptr' ], … … 62 57 Parrot_str_free_cstring => 63 58 [ ('void_ptr') => 'void' ], 64 59 65 Parrot_init_arg_nci =>66 [ qw(void_ptr void_ptr void_ptr) => 'void_ptr' ],67 60 pmc_new_noinit => 68 61 [ qw(void_ptr INTVAL) => 'void_ptr' ], 69 62 … … 146 139 my $_arg_v = $n_args ? ", $arg_v" : ""; 147 140 148 141 return { decl => <<DECL, defn => <<DEFN }; 149 jit_value_t142 static jit_value_t 150 143 jit__vtable_$entry_name(jit_function_t, jit_value_t, jit_value_t $_arg_decls_t); 151 144 DECL 152 jit_value_t145 static jit_value_t 153 146 jit__vtable_$entry_name(jit_function_t f, jit_value_t interp, jit_value_t self $_arg_decls_v) { 154 147 jit_type_t sig; 155 148 jit_value_t vtable, method; … … 173 166 $_ = jit_prefix_type($_) for @$func_sig; 174 167 175 168 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 176 176 my $arg_t = join ", ", @$func_sig; 177 177 178 178 my $n_args = scalar @$func_sig; 179 my $arg_decls_t = join ", ", 180 my $arg_decls_v = join ", ", 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; 181 181 my $arg_v = join ", ", map {"v$_"} 1..$n_args; 182 182 183 return { decl => <<DECL, defn => <<DEFN }; 184 jit_value_t 183 my ($decl, $defn); 184 if ($vararg) { 185 $decl = <<DECL; 186 static jit_value_t 187 jit__$func_name(jit_function_t, $arg_decls_t, jit_type_t *, jit_value_t *, int); 188 DECL 189 $defn = <<DEFN; 190 static jit_value_t 191 jit__$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 } 213 DEFN 214 } 215 else { 216 $decl = <<DECL; 217 static jit_value_t 185 218 jit__$func_name(jit_function_t, $arg_decls_t); 186 219 DECL 187 jit_value_t 220 $defn = <<DEFN; 221 static jit_value_t 188 222 jit__$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; 190 225 jit_type_t arg_t[] = { $arg_t }; 191 226 jit_value_t arg_v[] = { $arg_v }; 192 227 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); 194 229 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); 196 231 } 197 232 DEFN 233 } 234 235 return { decl => $decl, defn => $defn }; 198 236 } 199 237 200 238 sub jit_prefix_type { 201 239 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"; 204 245 } 205 246 else { 206 return "JIT_TYPE_$_";247 return $type; 207 248 } 208 249 } 209 250 -
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 7 7 /* HEADERIZER STOP */ 8 8 9 9 #include "parrot/parrot.h" 10 #include "pmc/pmc_context.h" 10 11 #include "pmc/pmc_integer.h" 11 #include "pmc/pmc_unmanagedstruct.h"12 12 #include "pmc/pmc_managedstruct.h" 13 #include "pmc/pmc_unmanagedstruct.h" 13 14 #include "frame_builder.h" 14 15 #include "frame_builder_libjit.h" 15 16 … … 108 109 * JIT functions 109 110 */ 110 111 111 void *112 static void * 112 113 Parrot_jit_create_thunk(PARROT_INTERP, char *sig, void *priv) { 113 114 struct jit_buffer_private_data *p; 114 115 jit_function_t f; 115 116 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; 117 119 118 120 /* populate private data */ 119 121 p = (struct jit_buffer_private_data*)priv; … … 128 130 jit_type_t arg_types[] = { 129 131 jit_type_void_ptr, /* interp */ 130 132 jit_type_void_ptr, /* nci_pmc */ 131 jit_type_void_ptr /* pcc_sig */132 133 }; 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); 134 135 f = jit_function_create(p->ctx, f_sig); 135 136 } 136 137 137 138 /* get the incomming args */ 138 139 jit_interp = jit_value_get_param(f, 0); 139 140 jit_nci_pmc = jit_value_get_param(f, 1); 140 jit_pcc_sig = jit_value_get_param(f, 2);141 141 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 } 146 149 { 147 jit_value_t sizeof_call_state148 = 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); 150 153 } 151 154 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 } 154 160 155 161 /* get the outgoing args */ 156 162 { 157 163 int nargs = strlen(sig) - 1; 158 164 159 jit_type_t jit_args_t[nargs];165 jit_type_t jit_args_t[nargs]; 160 166 jit_value_t jit_args_v[nargs]; 161 167 jit_value_t jit_regs[nargs]; 162 168 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, 164 170 jit_args_t, jit_args_v, jit_regs); 165 171 166 172 /* get the return type */ … … 178 184 } 179 185 180 186 /* 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); 182 188 } 183 189 184 190 /* clean up args */ 185 191 Parrot_jit_parse_sig_args_post(interp, sig, nargs, f, jit_interp, jit_args_v, jit_regs); 186 192 } 187 193 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); 190 197 191 198 /* end JIT function */ 192 199 jit_insn_return(f, NULL); … … 198 205 return jit_function_to_closure(f); 199 206 } 200 207 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) { 208 static int 209 Parrot_jit_create_arg_regs(PARROT_INTERP, char *sig, int nargs, 210 jit_function_t f, jit_value_t *reg_v) { 206 211 int i, j; 207 208 sig += 1; /* ignore return character */209 210 212 for (i = 0, j = 0; i < nargs; i++) { 211 213 char c; 212 jit_type_t t1;213 jit_value_t v1, v2, v3, v4;214 214 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 } 265 252 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 } 282 255 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; 256 static void 257 Parrot_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; 316 261 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 } 328 274 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 } 333 415 334 case 'J': 335 arg_types[i] = jit_type_void_ptr; 336 arg_vals[i] = jinterp; 337 break; 416 static void 417 Parrot_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; 338 422 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 */ 344 424 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); 351 428 } 352 429 353 jit_type_t430 static jit_type_t 354 431 Parrot_jit_parse_sig_ret_pre(PARROT_INTERP, char *sig) { 355 432 char c; 356 433 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; 396 468 } 397 469 } 398 470 399 void471 static void 400 472 Parrot_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 403 478 jit_type_t t1; 404 479 jit_value_t v1, v2, v3; 405 480 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; 464 536 } 465 537 } 466 538 467 void539 static void 468 540 Parrot_jit_parse_sig_args_post(PARROT_INTERP, char *sig, int nargs, 469 jit_function_t f, jit_value_t ji nterp,541 jit_function_t f, jit_value_t jit_interp, 470 542 jit_value_t *args, jit_value_t *regs) { 471 543 int i, j; 472 544 … … 476 548 jit_type_t t1; 477 549 jit_value_t v1; 478 550 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; 532 601 } 533 602 } 534 603 } 535 604 536 jit_value_t605 static jit_value_t 537 606 jit_value_create_intval_constant(jit_function_t f, INTVAL i) { 538 607 return jit_value_create_nint_constant(f, JIT_TYPE_INTVAL, i); 539 608 } … … 543 612 */ 544 613 545 614 /* custom wrappers */ 546 jit_value_t615 static jit_value_t 547 616 jit__Buffer_bufstart(jit_function_t f, jit_value_t buf) { 548 617 return jit_insn_load_relative(f, buf, offsetof(Buffer, _bufstart), jit_type_void_ptr); 549 618 } 550 619 620 static jit_value_t 621 jit__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 625 static jit_value_t 626 jit__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 634 static jit_value_t 635 jit__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 551 642 /* vtable wrappers */ 552 643 @TEMP_vtable_wrap_defns@ 553 644 -
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 41 41 * JIT functions 42 42 */ 43 43 44 void *44 static void * 45 45 Parrot_jit_create_thunk(Interp *, char *, void *); 46 46 47 void48 Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, 47 static void 48 Parrot_jit_parse_sig_args_pre(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t, jit_value_t, 49 49 jit_type_t *, jit_value_t *, jit_value_t *); 50 50 51 jit_type_t51 static jit_type_t 52 52 Parrot_jit_parse_sig_ret_pre(Interp *, char *); 53 53 54 void55 Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t );54 static void 55 Parrot_jit_parse_sig_ret_post(Interp *, char *, jit_function_t, jit_value_t, jit_value_t, jit_value_t, jit_value_t); 56 56 57 void57 static void 58 58 Parrot_jit_parse_sig_args_post(Interp *, char *, int, jit_function_t, jit_value_t, jit_value_t *, jit_value_t *); 59 59 60 jit_value_t 60 static int 61 Parrot_jit_create_arg_regs(Interp *, char *, int, jit_function_t, jit_value_t *); 62 63 static void 64 Parrot_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 67 static jit_value_t 61 68 jit_value_create_intval_constant(jit_function_t, INTVAL); 62 69 63 70 /* … … 76 83 */ 77 84 78 85 /* custom wrappers */ 79 jit_value_t86 static jit_value_t 80 87 jit__Buffer_bufstart(jit_function_t, jit_value_t); 81 88 89 static jit_value_t 90 jit__CURRENT_CONTEXT(jit_function_t, jit_value_t); 91 92 static jit_value_t 93 jit__PMC_IS_NULL(jit_function_t, jit_value_t); 94 95 static jit_value_t 96 jit__Parrot_pcc_get_signature(jit_function_t, jit_value_t, jit_value_t); 97 82 98 /* vtable wrappers */ 83 99 @TEMP_vtable_wrap_decls@ 84 100 -
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 315 315 $(LIBRARY_DIR)/YAML/Dumper/Base.pbc \ 316 316 $(LIBRARY_DIR)/YAML/Dumper/Default.pbc \ 317 317 $(LIBRARY_DIR)/YAML/Dumper.pbc \ 318 $(LIBRARY_DIR)/YAML/Parser/Syck.pbc \319 318 $(LIBRARY_DIR)/STM.pbc \ 320 319 $(LIBRARY_DIR)/libpcre.pbc \ 321 320 $(LIBRARY_DIR)/postgres.pbc … … 443 442 $(SRC_DIR)/longopt$(O) \ 444 443 $(SRC_DIR)/misc$(O) \ 445 444 $(SRC_DIR)/multidispatch$(O) \ 446 $(SRC_DIR)/frame_builder$(O) \447 445 $(SRC_DIR)/frame_builder_libjit$(O) \ 448 446 $(SRC_DIR)/nci$(O) \ 449 447 $(SRC_DIR)/oo$(O) \ … … 627 625 $(SRC_DIR)/key.str \ 628 626 $(SRC_DIR)/library.str \ 629 627 $(SRC_DIR)/multidispatch.str \ 630 $(SRC_DIR)/frame_builder.str \631 628 $(SRC_DIR)/frame_builder_libjit.str \ 632 629 $(SRC_DIR)/nci.str \ 633 630 $(SRC_DIR)/packfile.str \ … … 1204 1201 $(SRC_DIR)/exit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exit.c 1205 1202 1206 1203 $(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c $(SRC_DIR)/nci.str \ 1207 $(SRC_DIR)/frame_builder$(O) \1208 1204 $(SRC_DIR)/frame_builder_libjit$(O) \ 1209 1205 $(SRC_DIR)/pmc/pmc_managedstruct.h \ 1210 1206 $(SRC_DIR)/pmc/pmc_nci.h \ 1211 1207 $(SRC_DIR)/pmc/pmc_pointer.h 1212 1208 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 1219 1209 $(SRC_DIR)/frame_builder_libjit$(O) : \ 1220 1210 $(SRC_DIR)/frame_builder_libjit.h \ 1221 1211 $(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 41 41 42 42 .emit 43 43 44 Define a compilation unitof PASM code. Always paired with C<.eom>.44 Define a block of PASM code. Always paired with C<.eom>. 45 45 46 46 =head3 .end 47 47 … … 49 49 50 50 .end 51 51 52 End a compilation unit. Always paired with C<.sub>.52 End a subroutine. Always paired with C<.sub>. 53 53 54 54 =head3 .endm 55 55 … … 65 65 66 66 .eom 67 67 68 End a compilation unitof PASM code. Always paired with C<.emit>.68 End a block of PASM code. Always paired with C<.emit>. 69 69 70 70 =head3 .flatten_arg 71 71 … … 208 208 209 209 .sub R<NAME> 210 210 211 Define a compilation unit. Always paired with C<.end>. Names begin211 Define a subroutine. Always paired with C<.end>. Names begin 212 212 with "C<_>" by convention. 213 213 214 214 =head3 .sym -
docs/compiler_faq.pod
diff --git a/docs/compiler_faq.pod b/docs/compiler_faq.pod index f7d0f20..591ac8b 100644
a b 96 96 There are several ways to achieve this, depending on the location of 97 97 the subroutine. 98 98 99 If the sub is in the same compilation unituse a Sub constant:99 If the sub is in the same file use a Sub constant: 100 100 101 101 =begin PIR_FRAGMENT 102 102 … … 780 780 See F<config_lib.pasm> for all the keys in the config hash - or iterate over 781 781 the config hash. 782 782 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 96 96 97 97 =item * probably a continuation/control flow boundary 98 98 99 =item * packfiles and compilation units probably too much information for99 =item * packfiles and subroutines probably too much information for 100 100 either 101 101 102 102 =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 208 208 to parenthesize a long return expression so that a smart editor will properly 209 209 indent it. 210 210 211 {{ RT#45365: Modify parrot.el so this rule is no longer required. }}212 213 211 =item * 214 212 215 213 When 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 397 397 =end PIR_FRAGMENT 398 398 399 399 An 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 as401 C<pbc_merge> to link multiple bytecode files, then annotations will not spill 402 over from onemergee's bytecode to another).400 the end of the current file (that is, if you use a tool such as C<pbc_merge> 401 to link multiple bytecode files, then annotations will not spill over from one 402 mergee's bytecode to another). 403 403 404 404 One annotation covers many PIR instructions. If the result of compiling one 405 405 line 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 34 34 L<http://en.wikipedia.org/wiki/List_of_parrots>. 35 35 36 36 Set up your account on L<http://www.parrot.org/> and ask an existing release 37 manager to provide you with adminprivileges if you don't already have them.37 manager to provide you with editor privileges if you don't already have them. 38 38 39 39 =item 1. 40 40 … … 235 235 236 236 =item 10. 237 237 238 Update the website. You will need an account with administrativerights238 Update the website. You will need an account with editor rights 239 239 on L<http://www.parrot.org>. 240 240 241 241 =over 4 … … 383 383 384 384 - Nov 17, 2009 - 1.8 - bernhard 385 385 - 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 387 389 388 390 =cut 389 391 -
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 176 176 177 177 =over 4 178 178 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 180 of the public API (listed in docs/embed.pod) 180 181 181 182 =item * The layout of Parrot's internal data structures 182 183 -
examples/nci/Xlib.pir
diff --git a/examples/nci/Xlib.pir b/examples/nci/Xlib.pir index 98a1139..e5f507a 100644
a b 934 934 .end 935 935 936 936 #----------------------------------------------------------------------- 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 #----------------------------------------------------------------------- 937 954 .sub StoreName :method 938 955 .param string name 939 956 -
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 20 20 .local pmc exports, curr_namespace, test_namespace 21 21 curr_namespace = get_namespace 22 22 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' 24 24 25 25 test_namespace.'export_to'(curr_namespace, exports) 26 26 -
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 13 13 .local pmc exports, curr_namespace, test_namespace 14 14 curr_namespace = get_namespace 15 15 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' 17 17 18 18 test_namespace.'export_to'(curr_namespace, exports) 19 19 … … 838 838 .return( equal ) 839 839 .end 840 840 841 =item C<dies_ok( codestring, description )> 842 843 Takes PIR code in C<codestring> and an optional message in C<description>. 844 Passes 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 841 890 =item C<lives_ok( codestring, description )> 842 891 843 892 Takes PIR code in C<codestring> and an optional message in C<description>. 844 Passes a test if the PIR does not throw any exception .893 Passes a test if the PIR does not throw any exception, fails a test otherwise. 845 894 846 895 =cut 847 896 -
(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 NAME5 6 YAML/Parser/Syck.pir - Interface to libsyck7 8 =head1 SYNOPSIS9 10 This won't work yet with a standard libsyck, as libsyck needs to be11 aware of Parrot.12 13 =head1 DESCRIPTION14 15 Ask libsyck to do some work.16 Uses the native call interface.17 Needs synchronous callbacks.18 19 =head1 METHODS20 21 =cut22 23 =head2 load24 25 Parses a YAML string and returns a data structure.26 27 =cut28 29 .include "datatypes.pasm"30 31 .sub load32 .param string yaml_string33 34 # prepare user data35 .local pmc user_data36 user_data = new 'String'37 38 .local string library_name39 library_name = 'libsyck'40 .local pmc libsyck41 libsyck = loadlib library_name42 unless libsyck goto NOT_LOADED43 44 .local int is_defined45 46 # getting a handle on a YAML parser47 .local pmc syck_new_parser48 syck_new_parser = dlfunc libsyck, "syck_new_parser", "p"49 .local pmc parser50 ( parser ) = syck_new_parser( )51 is_defined = defined parser52 unless is_defined goto NOT_DEFINED53 54 # A Sub that can be given to the library55 # this callback function will eventually by called by the library56 .const 'Sub' yaml_handler = "_yaml_handler"57 .local pmc yaml_handler_wrapped58 yaml_handler_wrapped = new_callback yaml_handler, user_data, "vUp" # Z in pdd1659 60 .local pmc synchronous61 synchronous = new 'Integer'62 synchronous = 163 setprop user_data, "_synchronous", synchronous64 65 # call syck_parser_handler66 .local pmc syck_parser_handler67 syck_parser_handler = dlfunc libsyck, "syck_parser_handler", "vpp"68 syck_parser_handler( parser, yaml_handler_wrapped )69 70 # tell about the user_data71 .local pmc syck_parser_bonus72 syck_parser_bonus = dlfunc libsyck, "syck_parser_bonus", "vpP"73 syck_parser_bonus( parser, user_data )74 75 # tell about the string76 .local pmc syck_parser_str, read77 read = new 'UnManagedStruct'78 pin yaml_string79 syck_parser_str = dlfunc libsyck, "syck_parser_str", "vpbip"80 .local int yaml_string_len81 yaml_string_len = length yaml_string82 syck_parser_str( parser, yaml_string, yaml_string_len, read )83 84 # call syck_parse85 .local pmc syck_parse86 .local int sym_id87 syck_parse = dlfunc libsyck, "syck_parse", "ip"88 ( sym_id ) = syck_parse( parser )89 90 # cleaning up a handle on a YAML parser91 .local pmc syck_free_parser92 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 .end99 100 101 .sub _yaml_handler102 .param pmc user_data103 .param pmc external_data104 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 info141 .local pmc external_data_decl, data_str_decl, data_str142 external_data_decl = new 'ResizablePMCArray'143 data_str_decl = new 'ResizablePMCArray'144 145 # id146 push external_data_decl, .DATATYPE_INT147 push external_data_decl, 0148 push external_data_decl, 0149 # kind150 push external_data_decl, .DATATYPE_INT151 push external_data_decl, 0152 push external_data_decl, 0153 # type_id154 push external_data_decl, .DATATYPE_CSTR155 push external_data_decl, 0156 push external_data_decl, 0157 # anchor158 push external_data_decl, .DATATYPE_CSTR159 push external_data_decl, 0160 push external_data_decl, 0161 162 # style163 push data_str_decl, .DATATYPE_INT164 push data_str_decl, 0165 push data_str_decl, 0166 # ptr167 push data_str_decl, .DATATYPE_CSTR168 push data_str_decl, 0169 push data_str_decl, 0170 # len171 push data_str_decl, .DATATYPE_INT172 push data_str_decl, 0173 push data_str_decl, 0174 data_str = new 'UnManagedStruct', data_str_decl175 176 push external_data_decl, .DATATYPE_STRUCT_PTR177 $P9 = external_data_decl[-1]178 setprop $P9, "_struct", data_str179 push external_data_decl, 0180 push external_data_decl, 0181 182 assign external_data, external_data_decl183 184 .local int id, kind, data_str_len185 .local string type_id, anchor, data_str_ptr186 .local string cloned187 id = external_data[0]188 kind = external_data[1]189 # type_id = external_data[2] # This might be NULL190 # anchor = external_data[3] # This might be NULL191 data_str_len = external_data[4;2]192 193 # For now just save all the strings194 unless kind == 2 goto IGNORE_NON_STRING195 data_str_ptr = external_data[4;1]196 concat user_data, user_data, data_str_ptr197 concat user_data, user_data, "\n"198 IGNORE_NON_STRING:199 200 # debug output201 print user_data202 print "\n"203 204 .return()205 .end206 207 =head1 TODO208 209 Do some object stuff.210 Be nice and put stuff into a namespace.211 Provide a patch for libsyck.212 213 =head1 AUTHOR214 215 Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de>216 217 =head1 SEE ALSO218 219 YAML::Parser::Syck.pm220 yaml.kwiki.org221 222 =cut223 224 # Local Variables:225 # mode: pir226 # fill-column: 100227 # 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 74 74 __attribute__nonnull__(3); 75 75 76 76 static size_t calculate_registers_size(SHIM_INTERP, 77 ARGIN(const INTVAL *number_regs_used))77 ARGIN(const UINTVAL *number_regs_used)) 78 78 __attribute__nonnull__(2); 79 79 80 80 static void clear_regs(PARROT_INTERP, ARGMOD(PMC *pmcctx)) … … 97 97 FUNC_MODIFIES(*pmcctx); 98 98 99 99 static size_t Parrot_pcc_calculate_registers_size(PARROT_INTERP, 100 ARGIN(const INTVAL *number_regs_used))100 ARGIN(const UINTVAL *number_regs_used)) 101 101 __attribute__nonnull__(1) 102 102 __attribute__nonnull__(2); 103 103 … … 399 399 400 400 /* 401 401 402 =item C<static size_t calculate_registers_size(PARROT_INTERP, const INTVAL402 =item C<static size_t calculate_registers_size(PARROT_INTERP, const UINTVAL 403 403 *number_regs_used)> 404 404 405 405 Calculate memory size required for registers. … … 408 408 409 409 */ 410 410 static size_t 411 calculate_registers_size(SHIM_INTERP, ARGIN(const INTVAL *number_regs_used))411 calculate_registers_size(SHIM_INTERP, ARGIN(const UINTVAL *number_regs_used)) 412 412 { 413 413 ASSERT_ARGS(calculate_registers_size) 414 414 … … 423 423 /* 424 424 425 425 =item C<static size_t Parrot_pcc_calculate_registers_size(PARROT_INTERP, const 426 INTVAL *number_regs_used)>426 UINTVAL *number_regs_used)> 427 427 428 428 Calculate size of Context. 429 429 … … 432 432 */ 433 433 434 434 static size_t 435 Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used))435 Parrot_pcc_calculate_registers_size(PARROT_INTERP, ARGIN(const UINTVAL *number_regs_used)) 436 436 { 437 437 ASSERT_ARGS(Parrot_pcc_calculate_registers_size) 438 438 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 1182 1182 1183 1183 /* Add the return argument onto the call signature object (a bit 1184 1184 * hackish, added for backward compatibility in deprecated API function, 1185 * see TT # XXX). */1185 * see TT #1145). */ 1186 1186 switch (return_sig) { 1187 1187 case 'v': 1188 1188 { … … 1243 1243 1244 1244 /* Add the return argument onto the call signature object (a bit 1245 1245 * hackish, added for backward compatibility in deprecated API function, 1246 * see TT # XXX). */1246 * see TT #1145). */ 1247 1247 append_result(interp, sig_object, Parrot_str_new_constant(interp, "I"), &result); 1248 1248 Parrot_pcc_invoke_from_sig_object(interp, sub_pmc, sig_object); 1249 1249 … … 1281 1281 1282 1282 /* Add the return argument onto the call signature object (a bit 1283 1283 * hackish, added for backward compatibility in deprecated API function, 1284 * see TT # XXX). */1284 * see TT #1145). */ 1285 1285 append_result(interp, sig_object, Parrot_str_new_constant(interp, "N"), &result); 1286 1286 PMC_get_sub(interp, sub_pmc, sub); 1287 1287 Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), sub->seg->const_table->constants); … … 1330 1330 1331 1331 /* Add the return argument onto the call signature object (a bit 1332 1332 * hackish, added for backward compatibility in deprecated API function, 1333 * see TT # XXX). */1333 * see TT #1145). */ 1334 1334 switch (return_sig) { 1335 1335 case 'v': 1336 1336 { -
(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 INTVAL13 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 FLOATVAL25 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_RESULT37 PARROT_CANNOT_RETURN_NULL38 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_RESULT52 PARROT_CAN_RETURN_NULL53 PMC*54 get_nci_P(PARROT_INTERP, ARGMOD(call_state *st), int n)55 {56 /*57 * excessive args are passed as NULL58 * used by e.g. MMD infix like __add59 */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 else67 return NULL;68 }69 70 PARROT_WARN_UNUSED_RESULT71 PARROT_CAN_RETURN_NULL72 void*73 get_nci_p(PARROT_INTERP, ARGMOD(call_state *st), int n)74 {75 /*76 * excessive args are passed as NULL77 * used by e.g. MMD infix like __add78 */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 else86 return NULL;87 }88 89 /*90 * set return value91 */92 void93 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 void104 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 void115 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 void126 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 110 110 PARROT_DYNEXT_EXPORT void nci_vfff(float, float, float); 111 111 PARROT_DYNEXT_EXPORT void nci_vV(const char **); 112 112 PARROT_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);113 PARROT_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); 115 115 116 116 /* Declarations for callback tests */ 117 117 -
src/pmc/callsignaturereturns.pmc
diff --git a/src/pmc/callsignaturereturns.pmc b/src/pmc/callsignaturereturns.pmc index 3a2eb25..becbd6e 100644
a b 308 308 *(STRING **)ptr = value; 309 309 break; 310 310 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); 312 314 break; 313 315 default: 314 316 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 2780 2780 ASSERT_ARGS(Parrot_str_unescape) 2781 2781 2782 2782 STRING *result; 2783 const ENCODING *encoding;2784 2783 const CHARSET *charset; 2784 const ENCODING *encoding = NULL; 2785 2785 2786 2786 /* the default encoding is ascii */ 2787 2787 const char *enc_name = enc_char ? enc_char : "ascii"; 2788 2788 2789 2789 /* does the encoding have a character set? */ 2790 c har*p = enc_char ? strchr(enc_char, ':') : NULL;2790 const char *p = enc_char ? strchr(enc_char, ':') : NULL; 2791 2791 size_t clength = strlen(cstring); 2792 2792 String_iter iter; 2793 2793 UINTVAL offs, d; … … 2800 2800 --clength; 2801 2801 2802 2802 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 } 2805 2813 if (!encoding) 2806 2814 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED, 2807 2815 "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 15 15 .local pmc exports, curr_namespace, test_namespace 16 16 curr_namespace = get_namespace 17 17 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" 19 19 test_namespace.'export_to'(curr_namespace, exports) 20 20 21 21 test_namespace = get_namespace [ 'Test'; 'Builder'; 'Tester' ] 22 22 exports = split " ", "plan test_out test_diag test_fail test_pass test_test" 23 23 test_namespace.'export_to'(curr_namespace, exports) 24 24 25 plan( 98)25 plan( 102 ) 26 26 27 27 test_skip() 28 28 test_todo() … … 34 34 test_is_deeply() 35 35 test_diagnostics() 36 36 test_lives_ok() 37 test_dies_ok() 37 38 test_throws_like() 38 39 test_isa_ok() 39 40 40 41 test.'finish'() 41 42 .end 42 43 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 50 CODE 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 58 CODE 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 67 CODE 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 76 CODE 77 test_diag( 'no error thrown' ) 78 test_test( 'dies_ok fails when there is no error with diagnostic message' ) 79 80 .end 81 43 82 .sub test_lives_ok 44 83 45 84 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 #!perl2 # 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 NAME13 14 t/library/yaml_parser_syck.t - testing library/YAML/Parser/Syck.pir15 16 =head1 SYNOPSIS17 18 % prove t/library/yaml_parser_syck.t19 20 =head1 DESCRIPTION21 22 Try to parse a YAML document.23 24 =cut25 26 TODO: {27 28 local $TODO = 'Not properly implemented yet';29 30 pir_output_is( << 'CODE', << 'OUT', "basic parsing" );31 32 .sub test :main33 load_bytecode "YAML/Parser/Syck.pbc"34 load_bytecode "dumper.pbc"35 36 .local pmc loaded37 ( 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 end41 .end42 CODE43 val144 45 val146 key147 48 val149 key150 val251 52 val153 key154 val255 key256 57 val158 key159 val260 key261 62 val163 key164 val265 key266 elem167 68 val169 key170 val271 key272 elem173 elem1274 75 val176 key177 val278 key279 elem180 elem1281 elem12382 83 val184 key185 val286 key287 elem188 elem1289 elem12390 elem123491 92 val193 key194 val295 key296 elem197 elem1298 elem12399 elem1234100 elem12345101 102 val1103 key1104 val2105 key2106 elem1107 elem12108 elem123109 elem1234110 elem12345111 elem123456112 113 val1114 key1115 val2116 key2117 elem1118 elem12119 elem123120 elem1234121 elem12345122 elem123456123 elem1234567124 125 val1126 key1127 val2128 key2129 elem1130 elem12131 elem123132 elem1234133 elem12345134 elem123456135 elem1234567136 elem12345678137 138 val1139 key1140 val2141 key2142 elem1143 elem12144 elem123145 elem1234146 elem12345147 elem123456148 elem1234567149 elem12345678150 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" => 1156 }157 OUT158 }159 160 =head1 AUTHOR161 162 Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de>163 164 =head1 SEE ALSO165 166 F<runtime/parrot/library/YAML/Parser/Syck.pir>167 168 =cut169 170 # Local Variables:171 # mode: cperl172 # cperl-indent-level: 4173 # fill-column: 100174 # 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 688 688 .end 689 689 690 690 # :load or other pragmas are only evaluated on the first 691 # instruction of a compilation unit691 # instruction of a subroutine 692 692 .sub _sub1 :load 693 693 say "in sub1" 694 694 returncc -
t/src/warnings.t
diff --git a/t/src/warnings.t b/t/src/warnings.t index 0f35793..a884a57 100644
a b 36 36 int 37 37 main(int argc, char* argv[]) 38 38 { 39 Interp *interp;39 Parrot_Interp interp = Parrot_new(NULL); 40 40 int error_val; 41 41 42 interp = Parrot_new(NULL); 43 if (!interp) { 42 if (!interp) 44 43 return 1; 45 }46 44 47 45 print_pbc_location(interp); 48 46 … … 61 59 int 62 60 main(int argc, char* argv[]) 63 61 { 64 Interp *interp;62 Parrot_Interp interp = Parrot_new(NULL); 65 63 int error_val; 66 64 67 interp = Parrot_new(NULL); 68 if (!interp) { 65 if (!interp) 69 66 return 1; 70 } 67 71 68 PARROT_WARNINGS_on(interp, PARROT_WARNINGS_ALL_FLAG); 72 69 73 70 error_val = Parrot_warn(interp, PARROT_WARNINGS_ALL_FLAG, "all");