Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into nqp_pct

  • Loading branch information...
commit 21ba7f8b410d81fb6ed6a27388cf43cd73505f7a 2 parents 559ced1 + 865c881
@Benabik Benabik authored
Showing with 10,892 additions and 9,762 deletions.
  1. +13 −1 CREDITS
  2. +4 −0 ChangeLog
  3. +2 −0  MANIFEST
  4. +2 −4 MANIFEST.generated
  5. +11 −0 NEWS
  6. +1 −1  README
  7. +1 −1  VERSION
  8. +1 −0  api.yaml
  9. +1 −0  compilers/imcc/imcc.l
  10. +90 −51 compilers/imcc/imcc.y
  11. +1,658 −1,651 compilers/imcc/imclexer.c
  12. +1,231 −1,176 compilers/imcc/imcparser.c
  13. +55 −53 compilers/imcc/imcparser.h
  14. +6 −2 compilers/imcc/main.c
  15. +46 −2 compilers/imcc/pbc.c
  16. +21 −0 compilers/imcc/symreg.c
  17. +16 −0 compilers/imcc/symreg.h
  18. +12 −1 config/auto/arch.pm
  19. +1 −1  config/auto/headers.pm
  20. +7 −2 config/gen/config_pm.pm
  21. +3 −1 config/gen/config_pm/config_pir.in
  22. +8 −8 config/gen/makefiles/root.in
  23. +41 −6 config/init/hints/msys.pm
  24. +10 −1 docs/book/pct/ch04_pge.pod
  25. +66 −28 docs/dev/profiling.pod
  26. +3 −41 docs/glossary.pod
  27. +1 −0  docs/parrothist.pod
  28. +7 −8 docs/pct/gettingstarted.pod
  29. +1 −1  docs/project/git_workflow.pod
  30. +0 −1  docs/project/release_manager_guide.pod
  31. +21 −3 examples/nci/ls.pir
  32. +7,020 −6,420 ext/winxed/compiler.pir
  33. +1 −1  include/parrot/oplib/core_ops.h
  34. +22 −5 include/parrot/packfile.h
  35. +9 −0 include/parrot/string_funcs.h
  36. +1 −1  lib/Parrot/Pmc2c/PMC.pm
  37. +1 −1  lib/Parrot/Pmc2c/VTable.pm
  38. +7 −0 lib/Parrot/Test/Util.pm
  39. +6 −56 runtime/parrot/library/distutils.pir
  40. +4 −6 src/embed.c
  41. +0 −6 src/nci_test.c
  42. +3 −3 src/ops/core_ops.c
  43. +120 −11 src/packfile/api.c
  44. +7 −0 src/packfile/output.c
  45. +12 −0 src/packfile/segments.c
  46. +7 −0 src/pmc/exception.pmc
  47. +33 −59 src/pmc/imccompiler.pmc
  48. +39 −76 src/pmc/multisub.pmc
  49. +32 −0 src/pmc/packfileconstanttable.pmc
  50. +19 −4 src/pmc/packfileview.pmc
  51. +3 −14 src/pmc/ptr.pmc
  52. +2 −14 src/pmc/unmanagedstruct.pmc
  53. +41 −4 src/string/api.c
  54. +84 −8 t/pmc/packfileview.t
  55. +1 −1  t/pmc/threads.t
  56. +3 −1 t/src/atomic.t
  57. +4 −1 t/src/basic.t
  58. +3 −1 t/src/embed.t
  59. +4 −1 t/src/embed/api.t
  60. +4 −1 t/src/exit.t
  61. +3 −1 t/src/extend.t
  62. +5 −1 t/src/extend_vtable.t
  63. +4 −1 t/src/misc.t
  64. +3 −1 t/src/pointer_array.t
  65. +4 −1 t/src/warnings.t
  66. +22 −2 t/steps/auto/arch-01.t
  67. +6 −4 t/steps/auto/headers-01.t
  68. +6 −5 t/tools/dev/headerizer/02_methods.t
  69. +7 −7 tools/release/release.json
View
14 CREDITS
@@ -8,7 +8,7 @@
grepping and beautification by scripts.
The fields are: name (N), email (E), web-address (W),
description (D), main username (U), alias usernames (A)
- and snail-mail address (S).
+ and geographic location (S).
Thanks,
@@ -454,6 +454,12 @@ A: gerd
E: pokorra@uni-siegen.de
D: Release manager for 1.9.0, 2.3.0, 2.5.0, 2.8.0, 2.9.0, 3.2.0 and 3.4.0
+N: Gerhard R.
+U: gerdr
+A: not_gerd
+W: http://gerdr.github.com/on-parrot/
+D: MSYS fixes
+
N: Goplat
D: Win98 and other fixes.
@@ -579,6 +585,12 @@ D: coding standard tests
N: John Paul Wallington
D: pir-mode.el: fix for xemacs plus bugfixes and cleanups
+N: Jonathan Gentle
+E: atrodo@atrodo.org
+U: atrodo
+A: atrodo
+S: Ohio, USA
+
N: Jonathan "Duke" Leto
E: jonathan@leto.net
W: http://leto.net
View
4 ChangeLog
@@ -1,5 +1,9 @@
#1
+2011.08.15 coke
+ * Released 3.7.0
+ See NEWS for more information.
+
2011.07.19 jkeenan
* Released 3.6.0
See NEWS for more information.
View
2  MANIFEST
@@ -591,6 +591,8 @@ examples/languages/abc/t/abc_special_variables [examples]
examples/languages/abc/t/abc_statement [examples]
examples/languages/squaak/MAINTAINER [examples]
examples/languages/squaak/README [examples]
+examples/languages/squaak/doc/pct-stages.png [examples]
+examples/languages/squaak/doc/pct-stages.svg [examples]
examples/languages/squaak/doc/tutorial_episode_1.pod [examples]
examples/languages/squaak/doc/tutorial_episode_2.pod [examples]
examples/languages/squaak/doc/tutorial_episode_3.pod [examples]
View
6 MANIFEST.generated
@@ -1,11 +1,11 @@
# See tools/dev/install_files.pl for documentation on the
# format of this file.
# Please re-sort this file after *EVERY* modification
-blib/lib/libparrot.3.6.0.dylib [main]lib
+blib/lib/libparrot.3.7.0.dylib [main]lib
blib/lib/libparrot.a [main]lib
blib/lib/libparrot.dylib [main]lib
blib/lib/libparrot.so [main]lib
-blib/lib/libparrot.so.3.6.0 [main]lib
+blib/lib/libparrot.so.3.7.0 [main]lib
compilers/data_json/data_json.pbc [data_json]
config/gen/call_list/opengl.in []
docs/ops/bit.pod [doc]
@@ -143,8 +143,6 @@ installable_parrot-prove.exe [main]bin
installable_parrot.exe [main]bin
installable_parrot_config [main]bin
installable_parrot_config.exe [main]bin
-installable_parrot_debugger [main]bin
-installable_parrot_debugger.exe [main]bin
installable_parrot_nci_thunk_gen [main]bin
installable_pbc_disassemble [main]bin
installable_pbc_disassemble.exe [main]bin
View
11 NEWS
@@ -1,6 +1,17 @@
New in 3.7.0
- Core
+ + Added mem_sys_strndup function.
+ + Added new load_bytecode_p_s opcode as an eventual replacement for load_bytecode_s
+ + Added new :tag() syntax to IMCC for PIR
+ + Improved configuration support for msys
+ + known-buggy parrot_debugger is no longer installed
- Languages
+ + Winxed
+ - Updated snapshot to version 1.1.0
+ - multi functions and methods
+ - cast to var
+ - load_packfile builtin
+ - __NAMESPACE__ and __CLASS__ predefined constants
- Documentation
+ The Archive::Tar and Archive::Zip libraries now have POD docs
- Tests
View
2  README
@@ -1,4 +1,4 @@
-This is Parrot, version 3.6.0
+This is Parrot, version 3.7.0
------------------------------
Parrot is Copyright (C) 2001-2011, Parrot Foundation.
View
2  VERSION
@@ -1 +1 @@
-3.6.0
+3.7.0
View
1  api.yaml
@@ -17,6 +17,7 @@
tags:
- 'C'
- 'deprecated'
+ - 'completed'
ticket: 'http://trac.parrot.org/parrot/ticket/2010'
-
name: '":init" Sub flag'
View
1  compilers/imcc/imcc.l
@@ -308,6 +308,7 @@ SP [ ]
<emit,INITIAL>":init" return INIT;
<emit,INITIAL>":immediate" return IMMEDIATE;
<emit,INITIAL>":postcomp" return POSTCOMP;
+<emit,INITIAL>":tag" return SUBTAG;
<emit,INITIAL>":anon" return ANON;
<emit,INITIAL>":outer" return OUTER;
<emit,INITIAL>":lex" return NEED_LEX;
View
141 compilers/imcc/imcc.y
@@ -1054,7 +1054,7 @@ do_loadlib(ARGMOD(imc_info_t *imcc), ARGIN(const char *lib))
%token <t> PCC_BEGIN PCC_END PCC_CALL PCC_SUB PCC_BEGIN_RETURN PCC_END_RETURN
%token <t> PCC_BEGIN_YIELD PCC_END_YIELD INVOCANT
%token <t> MAIN LOAD INIT IMMEDIATE POSTCOMP METHOD ANON OUTER NEED_LEX
-%token <t> MULTI VTABLE_METHOD LOADLIB SUB_INSTANCE_OF SUBID
+%token <t> MULTI SUBTAG VTABLE_METHOD LOADLIB SUB_INSTANCE_OF SUBID
%token <t> NS_ENTRY
%token <s> LABEL
%token <t> EMIT EOM
@@ -1071,9 +1071,10 @@ do_loadlib(ARGMOD(imc_info_t *imcc), ARGIN(const char *lib))
%type <i> pcc_sub_call
%type <sr> sub_param pcc_arg pcc_result pcc_args pcc_results sub_param_type_def
%type <sr> pcc_returns pcc_yields pcc_return pcc_call arg arglist the_sub multi_type
+%type <sr> subtags
%type <t> argtype_list argtype paramtype_list paramtype
%type <t> pcc_return_many
-%type <t> proto sub_proto sub_proto_list multi multi_types outer
+%type <t> proto sub_proto sub_proto_list multi subtag multi_types outer
%type <t> vtable instanceof subid
%type <t> method ns_entry_name
%type <i> instruction assignment conditional_statement labeled_inst opt_label op_assign
@@ -1407,6 +1408,76 @@ multi:
MULTI '(' multi_types ')' { $$ = 0; }
;
+multi_types:
+ /* empty */
+ {
+ add_pcc_multi(imcc, imcc->cur_call, NULL);
+ }
+ | multi_types COMMA multi_type
+ {
+ $$ = 0;
+ add_pcc_multi(imcc, imcc->cur_call, $3);
+ }
+ | multi_type
+ {
+ $$ = 0;
+ add_pcc_multi(imcc, imcc->cur_call, $1);
+ }
+ ;
+
+multi_type:
+ INTV { $$ = mk_const(imcc, "INTVAL", 'S'); }
+ | FLOATV { $$ = mk_const(imcc, "FLOATVAL", 'S'); }
+ | PMCV { $$ = mk_const(imcc, "PMC", 'S'); }
+ | STRINGV { $$ = mk_const(imcc, "STRING", 'S'); }
+ | IDENTIFIER
+ {
+ SymReg *r;
+ if (strcmp($1, "_") != 0)
+ r = mk_const(imcc, $1, 'S');
+ else {
+ r = mk_const(imcc, "PMC", 'S');
+ }
+ mem_sys_free($1);
+ $$ = r;
+ }
+ | STRINGC
+ {
+ SymReg *r;
+ if (strcmp($1, "\"_\"") == 0 || strcmp($1, "'_'") == 0)
+ r = mk_const(imcc, "PMC", 'S');
+ else {
+ r = mk_const(imcc, $1, 'S');
+ }
+ mem_sys_free($1);
+ $$ = r;
+ }
+ | '[' keylist ']' { $$ = $2; }
+ ;
+
+
+subtag:
+ SUBTAG '(' subtags ')' { $$ = 0; }
+ ;
+
+subtags:
+ subtags COMMA STRINGC
+ {
+ SymReg * const r = mk_const(imcc, $3, 'S');
+ add_pcc_flag_str(imcc, imcc->cur_call, r);
+ mem_sys_free($3);
+ $$ = r;
+ }
+ | STRINGC
+ {
+ SymReg * const r = mk_const(imcc, $1, 'S');
+ add_pcc_flag_str(imcc, imcc->cur_call, r);
+ mem_sys_free($1);
+ $$ = r;
+ }
+ ;
+
+
outer:
OUTER '(' STRINGC ')'
{
@@ -1491,53 +1562,6 @@ subid:
}
;
-multi_types:
- /* empty */
- {
- add_pcc_multi(imcc, imcc->cur_call, NULL);
- }
- | multi_types COMMA multi_type
- {
- $$ = 0;
- add_pcc_multi(imcc, imcc->cur_call, $3);
- }
- | multi_type
- {
- $$ = 0;
- add_pcc_multi(imcc, imcc->cur_call, $1);
- }
- ;
-
-multi_type:
- INTV { $$ = mk_const(imcc, "INTVAL", 'S'); }
- | FLOATV { $$ = mk_const(imcc, "FLOATVAL", 'S'); }
- | PMCV { $$ = mk_const(imcc, "PMC", 'S'); }
- | STRINGV { $$ = mk_const(imcc, "STRING", 'S'); }
- | IDENTIFIER
- {
- SymReg *r;
- if (strcmp($1, "_") != 0)
- r = mk_const(imcc, $1, 'S');
- else {
- r = mk_const(imcc, "PMC", 'S');
- }
- mem_sys_free($1);
- $$ = r;
- }
- | STRINGC
- {
- SymReg *r;
- if (strcmp($1, "_") != 0)
- r = mk_const(imcc, $1, 'S');
- else {
- r = mk_const(imcc, "PMC", 'S');
- }
- mem_sys_free($1);
- $$ = r;
- }
- | '[' keylist ']' { $$ = $2; }
- ;
-
sub_body:
/* empty */
| statements
@@ -1590,14 +1614,29 @@ sub_proto_list:
;
proto:
- LOAD { $$ = P_LOAD; }
- | INIT { $$ = P_INIT; }
+ LOAD {
+ $$ = P_LOAD;
+ /*
+ SymReg * const r = mk_const(imcc, "load", 'S');
+ add_pcc_flag_str(imcc, imcc->cur_call, r);
+ $$ = r;
+ */
+ }
+ | INIT {
+ $$ = P_INIT;
+ /*
+ SymReg * const r = mk_const(imcc, "load", 'S');
+ add_pcc_flag_str(imcc, imcc->cur_call, r);
+ $$ = r;
+ */
+ }
| MAIN { $$ = P_MAIN; }
| IMMEDIATE { $$ = P_IMMEDIATE; }
| POSTCOMP { $$ = P_POSTCOMP; }
| ANON { $$ = P_ANON; }
| NEED_LEX { $$ = P_NEED_LEX; }
| multi
+ | subtag
| outer
| vtable
| method
View
3,309 compilers/imcc/imclexer.c
1,658 additions, 1,651 deletions not shown
View
2,407 compilers/imcc/imcparser.c
1,231 additions, 1,176 deletions not shown
View
108 compilers/imcc/imcparser.h
@@ -138,32 +138,33 @@
OUTER = 343,
NEED_LEX = 344,
MULTI = 345,
- VTABLE_METHOD = 346,
- LOADLIB = 347,
- SUB_INSTANCE_OF = 348,
- SUBID = 349,
- NS_ENTRY = 350,
- LABEL = 351,
- EMIT = 352,
- EOM = 353,
- IREG = 354,
- NREG = 355,
- SREG = 356,
- PREG = 357,
- IDENTIFIER = 358,
- REG = 359,
- MACRO = 360,
- ENDM = 361,
- STRINGC = 362,
- INTC = 363,
- FLOATC = 364,
- USTRINGC = 365,
- PARROT_OP = 366,
- VAR = 367,
- LINECOMMENT = 368,
- FILECOMMENT = 369,
- DOT = 370,
- CONCAT = 371
+ SUBTAG = 346,
+ VTABLE_METHOD = 347,
+ LOADLIB = 348,
+ SUB_INSTANCE_OF = 349,
+ SUBID = 350,
+ NS_ENTRY = 351,
+ LABEL = 352,
+ EMIT = 353,
+ EOM = 354,
+ IREG = 355,
+ NREG = 356,
+ SREG = 357,
+ PREG = 358,
+ IDENTIFIER = 359,
+ REG = 360,
+ MACRO = 361,
+ ENDM = 362,
+ STRINGC = 363,
+ INTC = 364,
+ FLOATC = 365,
+ USTRINGC = 366,
+ PARROT_OP = 367,
+ VAR = 368,
+ LINECOMMENT = 369,
+ FILECOMMENT = 370,
+ DOT = 371,
+ CONCAT = 372
};
#endif
/* Tokens. */
@@ -255,32 +256,33 @@
#define OUTER 343
#define NEED_LEX 344
#define MULTI 345
-#define VTABLE_METHOD 346
-#define LOADLIB 347
-#define SUB_INSTANCE_OF 348
-#define SUBID 349
-#define NS_ENTRY 350
-#define LABEL 351
-#define EMIT 352
-#define EOM 353
-#define IREG 354
-#define NREG 355
-#define SREG 356
-#define PREG 357
-#define IDENTIFIER 358
-#define REG 359
-#define MACRO 360
-#define ENDM 361
-#define STRINGC 362
-#define INTC 363
-#define FLOATC 364
-#define USTRINGC 365
-#define PARROT_OP 366
-#define VAR 367
-#define LINECOMMENT 368
-#define FILECOMMENT 369
-#define DOT 370
-#define CONCAT 371
+#define SUBTAG 346
+#define VTABLE_METHOD 347
+#define LOADLIB 348
+#define SUB_INSTANCE_OF 349
+#define SUBID 350
+#define NS_ENTRY 351
+#define LABEL 352
+#define EMIT 353
+#define EOM 354
+#define IREG 355
+#define NREG 356
+#define SREG 357
+#define PREG 358
+#define IDENTIFIER 359
+#define REG 360
+#define MACRO 361
+#define ENDM 362
+#define STRINGC 363
+#define INTC 364
+#define FLOATC 365
+#define USTRINGC 366
+#define PARROT_OP 367
+#define VAR 368
+#define LINECOMMENT 369
+#define FILECOMMENT 370
+#define DOT 371
+#define CONCAT 372
@@ -301,7 +303,7 @@ typedef union YYSTYPE
/* Line 1676 of yacc.c */
-#line 294 "compilers/imcc/imcparser.h"
+#line 296 "compilers/imcc/imcparser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
View
8 compilers/imcc/main.c
@@ -553,7 +553,8 @@ imcc_run_compilation_internal(ARGMOD(imc_info_t *imcc), ARGIN(STRING *source),
ASSERT_ARGS(imcc_run_compilation_internal)
yyscan_t yyscanner = imcc_get_scanner(imcc);
PackFile * const pf_raw = PackFile_new(imcc->interp, 0);
- PMC * const packfilepmc = Parrot_pf_get_packfile_pmc(imcc->interp, pf_raw);
+ PMC * const old_packfilepmc = Parrot_pf_get_current_packfile(imcc->interp);
+ PMC * const packfilepmc = Parrot_pf_get_packfile_pmc(imcc->interp, pf_raw);
INTVAL success = 0;
/* TODO: Don't set current packfile in the interpreter. Leave the
@@ -578,7 +579,8 @@ imcc_run_compilation_internal(ARGMOD(imc_info_t *imcc), ARGIN(STRING *source),
/* XXX Parrot_pf_get_packfile_pmc registers PMC */
Parrot_pmc_gc_unregister(imcc->interp, packfilepmc);
-
+ if (!PMC_IS_NULL(old_packfilepmc))
+ Parrot_pf_set_current_packfile(imcc->interp, old_packfilepmc);
return PMCNULL;
}
@@ -592,6 +594,8 @@ imcc_run_compilation_internal(ARGMOD(imc_info_t *imcc), ARGIN(STRING *source),
PackFile_fixup_subs(imcc->interp, PBC_IMMEDIATE, packfilepmc);
PackFile_fixup_subs(imcc->interp, PBC_POSTCOMP, packfilepmc);
+ if (!PMC_IS_NULL(old_packfilepmc))
+ Parrot_pf_set_current_packfile(imcc->interp, old_packfilepmc);
return packfilepmc;
}
View
48 compilers/imcc/pbc.c
@@ -260,6 +260,17 @@ static void store_sub_size(
__attribute__nonnull__(1)
FUNC_MODIFIES(* imcc);
+static void store_sub_tags(
+ ARGMOD(imc_info_t * imcc),
+ ARGIN(pcc_sub_t * sub),
+ const int sub_idx,
+ ARGMOD(PackFile_ConstTable * ct))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(* imcc)
+ FUNC_MODIFIES(* ct);
+
static void verify_signature(
ARGMOD(imc_info_t * imcc),
ARGIN(const Instruction *ins),
@@ -350,6 +361,10 @@ static void verify_signature(
, PARROT_ASSERT_ARG(str))
#define ASSERT_ARGS_store_sub_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc))
+#define ASSERT_ARGS_store_sub_tags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(imcc) \
+ , PARROT_ASSERT_ARG(sub) \
+ , PARROT_ASSERT_ARG(ct))
#define ASSERT_ARGS_verify_signature __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(ins) \
@@ -1423,8 +1438,8 @@ add_const_pmc_sub(ARGMOD(imc_info_t * imcc), ARGMOD(SymReg *r), size_t offs,
PMC *ns_pmc;
PMC *sub_pmc;
Parrot_Sub_attributes *sub;
- PackFile_ByteCode * const interp_code = Parrot_pf_get_current_code_segment(imcc->interp);
- PackFile_ConstTable * const ct = interp_code->const_table;
+ PackFile_ByteCode * const interp_code = Parrot_pf_get_current_code_segment(imcc->interp);
+ PackFile_ConstTable * const ct = interp_code->const_table;
IMC_Unit * const unit = imcc->globals->cs->subs->unit;
int i;
@@ -1646,6 +1661,8 @@ add_const_pmc_sub(ARGMOD(imc_info_t * imcc), ARGMOD(SymReg *r), size_t offs,
}
}
+ store_sub_tags(imcc, r->pcc_sub, k, ct);
+
return k;
}
}
@@ -1653,6 +1670,33 @@ add_const_pmc_sub(ARGMOD(imc_info_t * imcc), ARGMOD(SymReg *r), size_t offs,
/*
+=item C<static void store_sub_tags(imc_info_t * imcc, pcc_sub_t * sub, const int
+sub_idx, PackFile_ConstTable * ct)>
+
+Store the tags associated with a sub in the provided constant table.
+
+=cut
+
+*/
+
+static void
+store_sub_tags(ARGMOD(imc_info_t * imcc), ARGIN(pcc_sub_t * sub), const int sub_idx,
+ ARGMOD(PackFile_ConstTable * ct))
+{
+ ASSERT_ARGS(store_sub_tags)
+ opcode_t i;
+ for (i = 0; i < sub->nflags; i++) {
+ SymReg * const flag = sub->flags[i];
+
+ STRING * const tag = Parrot_str_new(imcc->interp, flag->name + 1,
+ strlen(flag->name) - 2);
+ const int tag_idx = add_const_str(imcc, tag, ct->code);
+ Parrot_pf_tag_constant(imcc->interp, ct, tag_idx, sub_idx);
+ }
+}
+
+/*
+
=item C<static opcode_t build_key(imc_info_t * imcc, SymReg *key_reg,
PackFile_ByteCode * bc)>
View
21 compilers/imcc/symreg.c
@@ -486,6 +486,27 @@ add_pcc_multi(ARGMOD(imc_info_t * imcc), ARGMOD(SymReg *r), ARGIN_NULLOK(SymReg
/*
+=item C<void add_pcc_flag_str(imc_info_t * imcc, SymReg * r, SymReg * arg)>
+
+Associate a tag with a sub.
+
+=cut
+
+*/
+
+void
+add_pcc_flag_str(ARGMOD(imc_info_t * imcc), ARGMOD(SymReg * r), ARGIN(SymReg * arg))
+{
+ ASSERT_ARGS(add_pcc_flag_str)
+ pcc_sub_t * const sub = r->pcc_sub;
+ const int n = sub->nflags;
+ sub->flags = mem_gc_realloc_n_typed(imcc->interp, sub->flags, n + 1, SymReg*);
+ sub->flags[n] = arg;
+ sub->nflags++;
+}
+
+/*
+
=item C<void add_pcc_sub(SymReg *r, SymReg *arg)>
Sets the current sub in the given SymReg to the second SymReg.
View
16 compilers/imcc/symreg.h
@@ -104,11 +104,13 @@ typedef struct pcc_sub_t {
SymReg **multi;
SymReg **ret;
SymReg *object;
+ SymReg **flags; /* "load", "init", etc */
int *arg_flags; /* :slurpy, :optional, ... */
int *ret_flags; /* :slurpy, :optional, ... */
int nargs;
int nret;
int nmulti;
+ int nflags;
int yield;
int tailcall;
int label;
@@ -204,6 +206,16 @@ void add_pcc_cc(ARGMOD(SymReg *r), ARGIN(SymReg *arg))
__attribute__nonnull__(2)
FUNC_MODIFIES(*r);
+void add_pcc_flag_str(
+ ARGMOD(imc_info_t * imcc),
+ ARGMOD(SymReg * r),
+ ARGIN(SymReg * arg))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(* imcc)
+ FUNC_MODIFIES(* r);
+
void add_pcc_multi(
ARGMOD(imc_info_t * imcc),
ARGMOD(SymReg *r),
@@ -425,6 +437,10 @@ char * symreg_to_str(ARGIN(const SymReg *s))
#define ASSERT_ARGS_add_pcc_cc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(r) \
, PARROT_ASSERT_ARG(arg))
+#define ASSERT_ARGS_add_pcc_flag_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(imcc) \
+ , PARROT_ASSERT_ARG(r) \
+ , PARROT_ASSERT_ARG(arg))
#define ASSERT_ARGS_add_pcc_multi __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(r))
View
13 config/auto/arch.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, Parrot Foundation.
+# Copyright (C) 2001-2011, Parrot Foundation.
=head1 NAME
@@ -79,6 +79,16 @@ sub runstep {
$cpuarch = 'i386';
$osname = 'cygwin';
}
+ elsif ( $osname =~ /msys/i || $cpuarch =~ /msys/i ) {
+ # msys-perl is 32bit-only, so we use the information provided by
+ # the OS. Might be incorrect in case of mingw32 on 64bit hardware.
+ $cpuarch = lc (
+ $ENV{PROCESSOR_ARCHITEW6432} ||
+ $ENV{PROCESSOR_ARCHITECTURE} ||
+ 'x86'
+ );
+ $osname = 'msys';
+ }
elsif ( $cpuarch eq 'i86pc' and $osname eq 'solaris' ) {
# That's only the perl value, and is the same for both i386
# and amd64. Use uname -p instead to find the processor type.
@@ -93,6 +103,7 @@ sub runstep {
$cpuarch =~ s/armv[34]l?/arm/i;
$cpuarch =~ s/i[456]86/i386/i;
$cpuarch =~ s/x86_64/amd64/i;
+ $cpuarch =~ s/x86/i386/i;
$conf->data->set(
cpuarch => $cpuarch,
View
2  config/auto/headers.pm
@@ -101,7 +101,7 @@ sub _list_extra_headers {
# more extra_headers needed on mingw/msys; *BSD fails if they are present
if ( $conf->data->get('OSNAME_provisional') eq "msys" ) {
- push @extra_headers, qw(sysmman.h netdb.h);
+ push @extra_headers, qw(sysmman.h netdb.h sys/utsname.h);
}
if ( $conf->data->get('OSNAME_provisional') eq "MSWin32" ) {
View
9 config/gen/config_pm.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2010, Parrot Foundation.
+# Copyright (C) 2001-2011, Parrot Foundation.
=head1 NAME
@@ -71,8 +71,13 @@ sub runstep {
'-L' . $conf->data->get('libdir') . ' -lparrot ' . $conf->data->get('icu_shared') .
' ' . $conf->data->get('libs') );
- # escape spaces in current directory
my $cwd = cwd();
+
+ # expand msys virtual paths
+ $cwd = `cd '$cwd' && pwd -W`, chomp $cwd
+ if $conf->data->get('osname') eq 'msys';
+
+ # escape spaces in current directory
$cwd =~ s{ }{\\ }g;
# Build directory can have non ascii characters
View
4 config/gen/config_pm/config_pir.in
@@ -42,6 +42,7 @@ undefined values) is undefined, and may be rather funky.
.sub _config
.local string prefix, conf_file
+ .local pmc ex
prefix = interpinfo .INTERPINFO_RUNTIME_PREFIX
$S0 = concat prefix, "/runtime"
@@ -58,6 +59,8 @@ undefined values) is undefined, and may be rather funky.
$P0.'stat'($S0)
goto L1
file_not_found:
+ .get_results (ex)
+ finalize ex
# Treat it as installed parrot.
conf_file = "@libdir@@versiondir@/include/config.fpmc"
goto L2
@@ -85,7 +88,6 @@ undefined values) is undefined, and may be rather funky.
.return( conf_hash )
error:
- .local pmc ex
.get_results (ex)
$S0 = "Can't read '"
$S0 .= conf_file
View
16 config/gen/makefiles/root.in
@@ -530,7 +530,7 @@ PBC_TO_EXE = .@slash@pbc_to_exe$(EXE)
PARROT_CONFIG = .@slash@parrot_config$(EXE)
NQP_RX = .@slash@parrot-nqp$(EXE)
NCI_THUNK_GEN = .@slash@parrot_nci_thunk_gen$(EXE)
-PROVE = .@slash@parrot-prove$(EXE)
+PARROT_PROVE = .@slash@parrot-prove$(EXE)
OPS2C = .@slash@ops2c$(EXE)
WINXED = .@slash@winxed$(EXE)
@@ -543,8 +543,8 @@ INSTALLABLEPBCTOEXE = .@slash@installable_pbc_to_exe$(EXE)
INSTALLABLEPDB = .@slash@installable_parrot_debugger$(EXE)
INSTALLABLECONFIG = .@slash@installable_parrot_config$(EXE)
INSTALLABLENQP = .@slash@installable_parrot-nqp$(EXE)
-INSTALLABLENCITHUNKGEN = .@slash@installable_parrot_nci_thunk_gen$(EXE)
-INSTALLABLEPROVE = .@slash@installable_parrot-prove$(EXE)
+INSTALLABLENCITHUNKGEN = .@slash@installable_parrot_nci_thunk_gen$(EXE)
+INSTALLABLEPARROT_PROVE = .@slash@installable_parrot-prove$(EXE)
INSTALLABLEOPS2C = .@slash@installable_ops2c$(EXE)
INSTALLABLEWINXED = .@slash@installable_winxed$(EXE)
@@ -838,9 +838,9 @@ help :
world : parrot_utils
-parrot_utils : all $(PDUMP) $(DIS) $(PDB) $(PBC_MERGE) $(PBC_TO_EXE) $(PARROT_CONFIG) src/install_config$(O) $(PROVE) $(OPS2C)
+parrot_utils : all $(PDUMP) $(DIS) $(PDB) $(PBC_MERGE) $(PBC_TO_EXE) $(PARROT_CONFIG) src/install_config$(O) $(PARROT_PROVE) $(OPS2C)
-installable: all $(INSTALLABLEPARROT) $(INSTALLABLEPDUMP) $(INSTALLABLEDIS) $(INSTALLABLEPDB) $(INSTALLABLEPBC_MERGE) $(INSTALLABLEPBCTOEXE) $(INSTALLABLECONFIG) $(INSTALLABLENQP) $(INSTALLABLENCITHUNKGEN) $(INSTALLABLEPROVE) $(INSTALLABLEOPS2C) $(INSTALLABLEWINXED)
+installable: all $(INSTALLABLEPARROT) $(INSTALLABLEPDUMP) $(INSTALLABLEDIS) $(INSTALLABLEPDB) $(INSTALLABLEPBC_MERGE) $(INSTALLABLEPBCTOEXE) $(INSTALLABLECONFIG) $(INSTALLABLENQP) $(INSTALLABLENCITHUNKGEN) $(INSTALLABLEPARROT_PROVE) $(INSTALLABLEOPS2C) $(INSTALLABLEWINXED)
bootstrap-ops : $(OPS2C)
$(OPS2C) --core --quiet
@@ -885,7 +885,7 @@ $(NCI_THUNK_GEN) : parrot_nci_thunk_gen.pbc $(PBC_TO_EXE)
parrot-prove.pbc : runtime/parrot/bin/prove.pir $(PARROT)
$(PARROT) -o parrot-prove.pbc runtime/parrot/bin/prove.pir
-$(PROVE) : parrot-prove.pbc $(PARROT) $(PBC_TO_EXE)
+$(PARROT_PROVE) : parrot-prove.pbc $(PARROT) $(PBC_TO_EXE)
$(PBC_TO_EXE) parrot-prove.pbc
$(PARROT_CONFIG) : $(DEV_TOOLS_DIR)/parrot-config.pir $(PARROT) $(PBC_TO_EXE)
@@ -1044,7 +1044,7 @@ $(INSTALLABLEPBCTOEXE) : $(PBC_TO_EXE) src/install_config$(O)
$(INSTALLABLENCITHUNKGEN) : parrot_nci_thunk_gen.pbc $(PBC_TO_EXE) src/install_config$(O)
$(PBC_TO_EXE) parrot_nci_thunk_gen.pbc --install
-$(INSTALLABLEPROVE) : parrot-prove.pbc $(PBC_TO_EXE) src/install_config$(O)
+$(INSTALLABLEPARROT_PROVE) : parrot-prove.pbc $(PBC_TO_EXE) src/install_config$(O)
$(PBC_TO_EXE) parrot-prove.pbc --install
#
@@ -2303,7 +2303,7 @@ prog-clean :
$(INSTALLABLECONFIG) \
$(INSTALLABLENQP) \
$(INSTALLABLENCITHUNKGEN) \
- $(INSTALLABLEPROVE) \
+ $(INSTALLABLEPARROT_PROVE) \
$(INSTALLABLEWINXED) \
pbc_to_exe.pbc pbc_to_exe.c pbc_to_exe$(O) pbc_to_exe$(EXE) \
$(NCI_THUNK_GEN) parrot_nci_thunk_gen.c parrot_nci_thunk_gen$(O) parrot_nci_thunk_gen.pbc \
View
47 config/init/hints/msys.pm
@@ -1,21 +1,56 @@
-# Copyright (C) 2005-2007, Parrot Foundation.
+# Copyright (C) 2005-2011, Parrot Foundation.
package init::hints::msys;
use strict;
use warnings;
+sub _real_path {
+ my ( $path ) = @_;
+ $path = `cd '$path' && pwd -W`;
+ chomp $path;
+ return $path;
+}
+
sub runstep {
my ( $self, $conf ) = @_;
+ # Translate absolute paths accessed by Parrot tools
+ # from UNIX-style to Windows-style
+ my @keys = qw{bindir build_dir tempdir};
+ my %dirs;
+ @dirs{@keys} = map { _real_path $conf->data->get($_) } @keys;
+ $conf->data->set(%dirs);
+
+ # Assume Windows 2000 or above
+ $conf->data->set(ccflags => "-DWIN32 -DWINVER=0x0500 ");
+
+ # Create Parrot as shared library
$conf->data->set(
- ld => '$(PERL) /bin/perlld',
- ld_load_flags => '-shared ',
+ parrot_is_shared => 1,
+ has_dynamic_linking => 1,
+ ld_share_flags => '-shared',
+ ld_load_flags => '-shared',
+ sym_export => '__declspec(dllexport)',
+ sym_import => '__declspec(dllimport)'
+ );
+
+ # Create libparrot.dll in same directory as parrot.exe
+ # Generates unnecessary clutter in build directory
+ $conf->data->set(blib_dir => '.');
+
+ # Setup dynamic linking
+ $conf->data->set(
+ libparrot_ldflags => '-L' . $dirs{build_dir} . ' -lparrot',
+ libparrot_linkflags => '-L' . $dirs{build_dir} . ' -lparrot',
+ inst_libparrot_ldflags => '-L' . $dirs{bindir} . ' -lparrot',
+ inst_libparrot_linkflags => '-L' . $dirs{bindir} . ' -lparrot',
libs =>
-'-lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 ',
- ncilib_link_extra => 'src/libnci_test.def',
- has_socklen_t => 0,
+'-lmsvcrt -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion '
);
+
+ # NCI testing
+ $conf->data->set(ncilib_link_extra => 'src/libnci_test.def');
}
1;
View
11 docs/book/pct/ch04_pge.pod
@@ -65,7 +65,16 @@ X<token>
There are two different kinds of rules: C<rule>, which we saw above, and
C<token>. A C<rule> performs smart whitespace matching between the various
pieces of the pattern. The C<record> rule given previously would match
-"6355 John" or "6355 John" but not "6355John".
+
+ 6355 John
+
+or
+
+ 6355 John
+
+but not
+
+ 6355John
A C<token> matches whitespace only if you specifically request it. To get the
same effect with a token, add the C<\s> (match a space character) and C<+>
View
94 docs/dev/profiling.pod
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2005, Parrot Foundation.
+# Copyright (C) 2001-2011, Parrot Foundation.
=head1 NAME
@@ -10,74 +10,112 @@ This file documents the use of Parrot's profiling runcore.
=head2 Summary
-The profiling runcore is built as part of Parrot and is designed to allow
-discovery of bottlenecks in PIR code. It is also being instrumented to support
-HLL profiling, but this support is currently limited. Code can be run under
-the profiling runcore by passing C<-Rprofiling> or C<--runcore profiling> to
-the C<parrot> binary. The location and format of the output file are
-determined by environment variables as documented below. If the profiling
-runcore does not detect any relevant environment variables, it will use the
-defaults described below.
+This file provides an introduction on how to profile code written in a
+Parrot-hosted language. Parrot includes profiling as a built-in runcore which
+outputs a textual line-based format. This file will generally need to be
+post-processed, either by a custom script or by C<tools/dev/pprof2cg.pl>, which
+is installed under C<lib/3.6.0-devel/tools/dev/pprof2cg.pl> in a standard
+installation.
+
+The profiling runcore can record any annotations added by HLL compilers, though
+annotations are ignored by C<pprof2cg.pl> and are not recorded by default.
+This and various other aspects of profiling can be controlled through
+environment variables, as described below.
=head2 Running Code Under the Profiler
-<add something here>
+In Parrot, profiling capability is provided in the form of a built-in runcore
+and is available with any installed version of Parrot. The only condition is
+that you be able to run your code as a series of arguments passed directly to
+the parrot executable, rather than a "fakecutable" (a native executable that
+runs built-in hard-coded Parrot bytecode). If you usually run your code via a
+fakecutable such as C<perl6>, you'll need to run C<perl6.pbc> directly instead.
+For example, if you run C<./perl6 foo.p6>, instead run C<parrot perl6.pbc foo.p6>.
+If your code can run normally when passed to the C<parrot> executable
+directly, you can easily profile it.
-=head2 Profile Post-processing Tools
+To profile, add C<-Rprofiling> to the command-line invocation of C<parrot>
+before any C<.pbc> files are added, e.g. C<./parrot -Rprofiling perl6.pbc foo.p6>.
+Your program will run more slowly and will end with a message such as
-<add something here>
+ PROFILING RUNCORE: wrote profile to parrot.pprof.4251
-=head3 Interpreting Post-processed Output
+Use F<tools/dev/pprof2cg.pl> to generate Callgrind-compatible output from this file.
-<add something here>
+You now have a raw profile of your code.
-=head2 Bugs and Surprises
+=head2 Profile Post-processing Tools
-<add something here>
+The profiling runcore spits out a line-oriented plain-text file which contains
+the timing information for each executed instruction and a description of each
+context change. This data should be sufficient to determine any information
+about the timing of instructions and subs. The format is intended to be
+straightforward and amenable to processing by external tools.
+F<tools/dev/pprof2cg.pl> is included with Parrot and attempts to read a profile
+generated by the profiling runcore and produce a profile which
+callgrind-compatible tools (e.g. F<kcachegrind>) can understand.
-=head2 Manually Post-processing
+=head2 Bugs and Surprises
-<add something here>
+In theory the output of F<pprof2cg.pl> should be compatible with F<kcachegrind>. In
+practice, it isn't. If you have a use case that reliably produces non-sensical
+results, talk to cotto on #parrot or file a ticket.
=head2 Environment Variables
+=head3 Generally Useful Variables
+
+This section includes environment variables which are likely to be of interest
+to developers wishing to profile HLL code.
+
=over 4
=item C<PARROT_PROFILING_FILENAME>
This determines the full name of the file where the output will be written, if
any. Parrot does not check if the filename exists before opening it for
-writing and will happily overwrite any existing files, including previous profiles.
+writing and will happily truncate and overwrite any existing files, including
+previous profiles.
-If no value is specified, Parrot will write to a file named C<parrot.pprof.X>,
+If no value is specified, Parrot will write to a file named F<parrot.pprof.X>,
where X is the PID of the Parrot process. When the profiling runcore exits, it
will print a message announcing where the profile was written.
This variable can also have the special values C<stdout> and C<stderr>. When
either of these values are detected (case-insensitively), Parrot will print its
-profiling output the stdout or stderr.
+profiling output to STDOUT or STDERR.
+
+=item C<PARROT_PROFILING_ANNOTATIONS>
+
+This determines whether PIR annotations will be recorded as part of the
+profile. Annotations are necessary when profiling HLL code, but will cause the
+profiling runcore to run more slowly. By default, they are disabled. Set this
+value to enable them.
=item C<PARROT_PROFILING_OUTPUT>
This determines the type of output which will contain the profile. Current
options are C<pprof> and C<none>. C<pprof> is the default and is a ascii-based
human-readable format. It can be post-processed into a Callgrind-compatible
-format by tools/dev/pprof2cg.pl. C<none> writes nothing to the output file.
+format by C<tools/dev/pprof2cg.pl>. C<none> writes nothing to the output file.
It is most useful for testing and optimizing the profiling runcore itself. It
is expected to be of little interest to users wishing to profile PIR and HLL
code.
-=item C<PARROT_PROFILING_ANNOTATIONS>
+=back
-This determines whether PIR annotations will be recorded as part of the
-profile. Annotations are necessary when profiling HLL code, but will cause the
-profiling runcore to run more slowly. By default, they are disabled. Set this
-value to enable them.
+=head3 Debugging-Related Variables
+
+These variables are intended primarly for testing of the profiling code itself.
+You can play with them if you want, but they probably won't help you get any
+useful work done.
+
+=over 4
=item C<PARROT_PROFILING_CANONICAL_OUPUT>
When this is set, the profiling runcore will record all addresses as a single
-constant value and all times as 1. This options is useful primarily for
+constant value and all times as C<1>. This option is useful primarily for
testing, where it's helpful to have a way to ensure that a given chunk of code
will always produce exactly the same profile. If you want this feature
enabled, you also probably want to pass a fixed hash seed to Parrot via
View
44 docs/glossary.pod
@@ -248,13 +248,8 @@ be added, or overridden (for instance, the PAST to PIR transformation).
Parrot Design Document: documents that describe the features parrot must
implement.
-See also L<< http://github.com/parrot/parrot/docs/pdds/pdd00_pdd.pod.html >>.
-
-=begin html
-
-<a href="http://github.com/parrot/parrot/docs/pdds/pdd00_pdd.pod">pdd00_pdd.pod</a>
-
-=end html
+See also L<< Running|http://docs.parrot.org/parrot/latest/html/docs/running.pod.html >> and
+L<< PDD 0: Design Document Format|http://docs.parrot.org/parrot/latest/html/docs/pdds/pdd00_pdd.pod.html >>.
=item PGE
@@ -302,49 +297,16 @@ See also L<"PCT">.
=item Predereferencing
-=for comment
-XXX This section needs to be edited down.
-
A bytecode transformation technique which reduces the amount of pointer
dereferencing done in the inner loop of the interpreter by pre-converting
opcode numbers into pointers to their opfuncs, and also converting the register
numbers and constant numbers in the arguments to the ops into pointers.
-The original implementation by Gregor Purdy was posted on 2001-12-11. On one
-test system, it resulted in a 22% speed increase on a test program with a tight
-inner loop.
-
-L<http://archive.develooper.com/perl6-internals@perl.org/msg06941.html>
-
-On 2001-12-18, predereferencing got a speed boost (to about 47% faster than the
-regular DO_OP inner loop -- without compiler optimizations turned on). This was
-due to an off-list (actually over lunch) suggestion by John Kennedy that
-instead of pre-initializing the new copy of the bytecode with NULL pointers, we
-pre-initialize it with pointers to a pseudo-opfunc that does the
-predereferencing whenever it is encountered.
-
-On 2002-04-11, Jason Gloudon suggested combining aspects of the Computed Goto
-Core and the Prederef[erencing] Core.
-
-L<http://archive.develooper.com/perl6-internals@perl.org/msg07064.html>
-
-The week of 2003-02-09, Leopold Toetsch combined Computed Goto and
-Predereferencing to produce the CGP core.
-
-L<http://dev.perl.org/perl6/list-summaries/2003/p6summary.2003-02-09.html#Week_of_the_alternative_runloops>
-
-Later, on 2003-02-14, Leopold Totsch and Nicholas Clark combined the JIT and
-the Computed Goto Prederef cores to great effect.
-
-L<http://www.perl.com/pub/a/2003/02/p6pdigest/20030216.html>
-
=item run core
aka run loop, aka runcore. The way Parrot executes PBCs.
See running.pod for a list of available runcores, and how to tell
-parrot which one to use.
-
-running.pod: L<< https://github.com/parrot/parrot/parrot/docs/running.pod >>
+parrot which one to use. L<< Running|http://docs.parrot.org/parrot/latest/html/docs/running.pod.html >>
=item SMOP
View
1  docs/parrothist.pod
@@ -130,5 +130,6 @@ Starred release numbers indicate supported releases.
cotto 3.5.0 2011-Jun-21 "Menelaus"
jkeenan 3.6.0 * 2011-Jul-19 "Pájaros del Caribe"
+ coke 3.7.0 2011-Aug-16 "Wanda"
=cut
View
15 docs/pct/gettingstarted.pod
@@ -6,14 +6,13 @@ Getting Started with the Parrot Compiler Tools
=head1 DESCRIPTION
-This document can be considered your Number One entry point for starting to use
-the Parrot Compiler Tools (PCT). As there's a whole lot of acronyms flying
-around (see Parrot's glossary at
-L<https://github.com/parrot/parrot/blob/master/docs/glossary.pod>),
-this document will get you up and running within 10 minutes (that excludes
-building Parrot). Once you begin, it's a matter of getting your hands dirty and
-get experienced using the tools. Feel free to ask questions in
-the #parrot channel on irc.parrot.org .
+This document can be considered your Number One entry point for starting to
+use the Parrot Compiler Tools (PCT). There will be a whole lot of acronyms
+flying around. Consult L<< Parrot's glossary|http://docs.parrot.org/parrot/latest/html/docs/glossary.html >> about
+them. This document will get you up and running within 10 minutes (that
+excludes building Parrot). Once you begin, it's a matter of getting your hands
+dirty and get experienced using the tools. Feel free to ask questions in the
+#parrot channel on irc.parrot.org .
=head1 GETTING STARTED
View
2  docs/project/git_workflow.pod
@@ -70,7 +70,7 @@ get the latest commits with:
Then use this syntax to track the remote branch with a local branch:
- git checkout -b username/foo origin/username/foo
+ git checkout -t origin/username/foo
If you are using a very old version of Git, such as 1.5.x.x or older, you will
want to tell it to track the remote branch:
View
1  docs/project/release_manager_guide.pod
@@ -515,7 +515,6 @@ L<http://www.google.com/calendar/render?cid=ldhctdamsgfg5a1cord52po9h8@group.cal
Versions with a asterisk (*) are supported releases.
- - Aug 16, 2011 - 3.7 - coke
- Sep 20, 2011 - 3.8 - soh_cah_toa
- Oct 18, 2011 - 3.9* - dukeleto
- Nov 15, 2011 - 3.10 - ??
View
24 examples/nci/ls.pir
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2010, Parrot Foundation.
+# Copyright (C) 2005-2011, Parrot Foundation.
=head1 NAME
@@ -21,11 +21,29 @@ In this encarnation it works on linux i386 and amd64 systems.
.local pmc readdir
.local pmc closedir
libc = loadlib 'libc'
- dlfunc opendir, libc, 'opendir', 'pt'
+ dlfunc opendir, libc, 'opendir', 'pp'
dlfunc readdir, libc, 'readdir', 'pp'
dlfunc closedir, libc, 'closedir', 'ip'
+
+ .const string dirname = "docs"
+ .local pmc dirname_c
+ # Convert the directory name string to a C string.
+ dirname_c = new ["ByteBuffer"]
+ dirname_c = dirname
+ push dirname_c, 0
+
.local pmc curdir
- curdir = opendir("docs")
+ curdir = opendir(dirname_c)
+ unless null curdir goto opened
+
+ .local pmc err
+ getstderr err
+ print err, "Cannot open directory '"
+ print err, dirname
+ print err, "'\n"
+ exit 1
+
+opened:
.local pmc entry
.include "datatypes.pasm"
View
13,440 ext/winxed/compiler.pir
7,020 additions, 6,420 deletions not shown
View
2  include/parrot/oplib/core_ops.h
@@ -19,7 +19,7 @@
#include "parrot/runcore_api.h"
PARROT_EXPORT
-op_lib_t *Parrot_DynOp_core_3_6_0(PARROT_INTERP, long init);
+op_lib_t *Parrot_DynOp_core_3_7_0(PARROT_INTERP, long init);
opcode_t * Parrot_end(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_noop(opcode_t *, PARROT_INTERP);
View
27 include/parrot/packfile.h
@@ -168,6 +168,11 @@ typedef struct PackFile_Segment {
typedef INTVAL (*PackFile_map_segments_func_t)(PARROT_INTERP, ARGMOD(PackFile_Segment *seg), ARGIN_NULLOK(void *user_data));
+typedef struct PackFile_ConstTagPair {
+ opcode_t tag_idx;
+ opcode_t const_idx;
+} PackFile_ConstTagPair;
+
typedef struct PackFile_ConstTable {
PackFile_Segment base;
struct {
@@ -182,9 +187,11 @@ typedef struct PackFile_ConstTable {
opcode_t const_count;
PMC **constants;
} pmc;
- PackFile_ByteCode *code; /* where this segment belongs to */
- Hash *string_hash; /* Hash for lookup of string indices */
- Hash *pmc_hash; /* Hash for lookup of pmc indices */
+ PackFile_ByteCode *code; /* where this segment belongs to */
+ Hash *string_hash; /* Hash for lookup of string indices */
+ Hash *pmc_hash; /* Hash for lookup of pmc indices */
+ PackFile_ConstTagPair *tag_map; /* n-m Mapping pmc constants to string tags */
+ opcode_t ntags; /* Number of tags */
} PackFile_ConstTable;
typedef struct PackFile_ByteCode_OpMappingEntry {
@@ -711,7 +718,7 @@ void Parrot_pf_set_current_packfile(PARROT_INTERP, ARGIN(PMC *pbc))
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-PMC * Parrot_pf_subs_by_flag(PARROT_INTERP,
+PMC * Parrot_pf_subs_by_tag(PARROT_INTERP,
ARGIN(PMC * pfpmc),
ARGIN(STRING * flag))
__attribute__nonnull__(1)
@@ -772,6 +779,13 @@ void Parrot_pf_mark_packfile(PARROT_INTERP, ARGMOD_NULLOK(PackFile * pf))
__attribute__nonnull__(1)
FUNC_MODIFIES(* pf);
+void Parrot_pf_tag_constant(PARROT_INTERP,
+ ARGIN(PackFile_ConstTable *ct),
+ const int tag_idx,
+ const int const_idx)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
#define ASSERT_ARGS_do_sub_pragmas __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pfpmc))
@@ -864,7 +878,7 @@ void Parrot_pf_mark_packfile(PARROT_INTERP, ARGMOD_NULLOK(PackFile * pf))
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pbc))
-#define ASSERT_ARGS_Parrot_pf_subs_by_flag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_Parrot_pf_subs_by_tag __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pfpmc) \
, PARROT_ASSERT_ARG(flag))
@@ -893,6 +907,9 @@ void Parrot_pf_mark_packfile(PARROT_INTERP, ARGMOD_NULLOK(PackFile * pf))
, PARROT_ASSERT_ARG(pbc))
#define ASSERT_ARGS_Parrot_pf_mark_packfile __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_pf_tag_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ct))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/packfile/api.c */
View
9 include/parrot/string_funcs.h
@@ -489,6 +489,13 @@ STRING * Parrot_str_iter_substr(PARROT_INTERP,
__attribute__nonnull__(2)
__attribute__nonnull__(3);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+STRING * Parrot_str_new_from_cstring(PARROT_INTERP,
+ ARGIN_NULLOK(const char *buffer),
+ ARGIN_NULLOK(STRING *encodingname))
+ __attribute__nonnull__(1);
+
#define ASSERT_ARGS_Parrot_str_bitwise_and __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_str_bitwise_not __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -652,6 +659,8 @@ STRING * Parrot_str_iter_substr(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(str) \
, PARROT_ASSERT_ARG(l))
+#define ASSERT_ARGS_Parrot_str_new_from_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/string/api.c */
View
2  lib/Parrot/Pmc2c/PMC.pm
@@ -71,7 +71,7 @@ sub dump {
# gen_parent_lookup_info( $self, $pmc2cMain, $pmcs );
# gen_parent_reverse_lookup_info( $self, $pmcs, $vtable_dump );
- Storable::store( $self, $self->filename('.dump') );
+ Storable::nstore( $self, $self->filename('.dump') );
}
# methods
View
2  lib/Parrot/Pmc2c/VTable.pm
@@ -53,7 +53,7 @@ sub dump {
my $dump_filename =
cwd() . q{/}
. basename( Parrot::Pmc2c::UtilFunctions::filename( $self->filename, '.dump' ) );
- Storable::store( $self, $dump_filename );
+ Storable::nstore( $self, $dump_filename );
return $dump_filename;
}
View
7 lib/Parrot/Test/Util.pm
@@ -50,6 +50,13 @@ as (likely invalid) unicode escape codes.
sub create_tempfile {
my ($filehandle, $filename) = &tempfile;
+ # expand msys virtual paths
+ if($^O eq 'msys') {
+ my $tmpdir = `cd /tmp && pwd -W`;
+ chomp $tmpdir;
+ $filename =~ s/^\/tmp\//$tmpdir\//;
+ }
+
$filename =~ s/\\/\//g;
return ($filehandle, $filename);
View
62 runtime/parrot/library/distutils.pir
@@ -61,7 +61,7 @@ Update from the repository.
Output a skeleton for Plumage
-=item sdist, sdist_gztar, sdist_zip, sdist_rpm, manifest
+=item sdist, sdist_gztar, sdist_rpm, manifest
Create a source distribution or a source RPM package
@@ -271,8 +271,6 @@ L<http://github.com/ekiru/tree-optimization/blob/master/setup.nqp>
register_step_after('clean', _clean_man_pod)
.const 'Sub' _clean_gztar = '_clean_gztar'
register_step_after('clean', _clean_gztar)
- .const 'Sub' _clean_zip = '_clean_zip'
- register_step_after('clean', _clean_zip)
.const 'Sub' _clean_smoke = '_clean_smoke'
register_step_after('clean', _clean_smoke)
@@ -304,8 +302,6 @@ L<http://github.com/ekiru/tree-optimization/blob/master/setup.nqp>
register_step('sdist', _sdist)
.const 'Sub' _sdist_gztar = '_sdist_gztar'
register_step('sdist_gztar', _sdist_gztar)
- .const 'Sub' _sdist_zip = '_sdist_zip'
- register_step('sdist_zip', _sdist_zip)
.const 'Sub' _manifest = '_manifest'
register_step('manifest', _manifest)
.const 'Sub' _sdist_rpm = '_sdist_rpm'
@@ -336,7 +332,6 @@ L<http://github.com/ekiru/tree-optimization/blob/master/setup.nqp>
.const 'Sub' _no_zlib = '_no_zlib'
register_step('smoke', _no_zlib)
register_step('sdist_gztar', _no_zlib)
- register_step('sdist_zip', _no_zlib)
register_step('bdist_rpm', _no_zlib)
L2:
.end
@@ -2457,6 +2452,11 @@ the default value is man
.local int has_zlib
$P0 = get_config()
has_zlib = $P0['has_zlib']
+ $S0 = $P0['osname']
+ unless $S0 == 'MSWin32' goto L8
+ has_zlib = 0
+ L8:
+
$P0 = get_install_gzfiles(kv :flat :named)
$P1 = iter $P0
L5:
@@ -3217,17 +3217,10 @@ the default value is setup.pir
=head3 Step sdist
-On Windows calls sdist_zip, otherwise sdist_gztar
-
=cut
.sub '_sdist' :anon
.param pmc kv :slurpy :named
- $P0 = get_config()
- $S0 = $P0['osname']
- unless $S0 == 'MSWin32' goto L1
- .tailcall run_step('sdist_zip', kv :flat :named)
- L1:
.tailcall run_step('sdist_gztar', kv :flat :named)
.end
@@ -3293,49 +3286,6 @@ On Windows calls sdist_zip, otherwise sdist_gztar
.return ($S0)
.end
-=head3 Step sdist_zip
-
-=cut
-
-.sub '_sdist_zip' :anon
- .param pmc kv :slurpy :named
- run_step('manifest', kv :flat :named)
-
- load_bytecode 'Archive/Zip.pbc'
- $S0 = slurp('MANIFEST')
- $P0 = split "\n", $S0
- $S0 = pop $P0
- .local string archive_file
- archive_file = get_tarname('.zip', kv :flat :named)
- $I0 = newer(archive_file, $P0)
- if $I0 goto L1
- .local pmc archive
- archive = new ['Archive';'Zip']
- .local string dirname
- $S0 = get_tarname('', kv :flat :named)
- dirname = $S0 . '/'
- $P1 = iter $P0
- L2:
- unless $P1 goto L3
- $S0 = shift $P1
- $S1 = dirname . $S0
- archive.'addFile'($S0, $S1)
- goto L2
- L3:
- archive.'writeToFileNamed'(archive_file)
- print "creat "
- say archive_file
- L1:
-.end
-
-.sub '_clean_zip' :anon
- .param pmc kv :slurpy :named
-
- $S0 = get_tarname('.zip', kv :flat :named)
- unlink($S0, 1 :named('verbose'))
- unlink('MANIFEST', 1 :named('verbose'))
-.end
-
=head3 Step sdist_rpm
=cut
View
10 src/embed.c
@@ -39,16 +39,14 @@ static void print_constant_table(PARROT_INTERP, ARGIN(PMC *output))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void print_debug(PARROT_INTERP, int status, ARGIN(void *p))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3);
+static void print_debug(PARROT_INTERP, int status, ARGIN_NULLOK(void *p))
+ __attribute__nonnull__(1);
#define ASSERT_ARGS_print_constant_table __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(output))
#define ASSERT_ARGS_print_debug __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(p_unused))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -130,7 +128,7 @@ Prints GC info.
*/
static void
-print_debug(PARROT_INTERP, SHIM(int status), ARGIN(SHIM(void *p)))
+print_debug(PARROT_INTERP, SHIM(int status), ARGIN_NULLOK(SHIM(void *p)))
{
ASSERT_ARGS(print_debug)
if (Interp_debug_TEST(interp, PARROT_MEM_STAT_DEBUG_FLAG)) {
View
6 src/nci_test.c
@@ -1065,12 +1065,6 @@ nci_cstring_cstring(const char * src)
return buffer;
}
-/*
-
-=cut
-
-*/
-
#ifdef TEST
char l2 = 4;
View
6 src/ops/core_ops.c
@@ -23685,7 +23685,7 @@ op_lib_t core_op_lib = {
PARROT_FUNCTION_CORE, /* core_type = PARROT_XX_CORE */
0, /* flags */
3, /* major_version */
- 6, /* minor_version */
+ 7, /* minor_version */
0, /* patch_version */
1091, /* op_count */
core_op_info_table, /* op_info_table */
@@ -23813,7 +23813,7 @@ static void hop_deinit(PARROT_INTERP)
hop_buckets = NULL;
}PARROT_EXPORT
op_lib_t *
-Parrot_DynOp_core_3_6_0(PARROT_INTERP, long init) {
+Parrot_DynOp_core_3_7_0(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
if (init == 1) {
@@ -23842,7 +23842,7 @@ Parrot_lib_core_ops_load(PARROT_INTERP)
{
PMC *const lib = Parrot_pmc_new(interp, enum_class_ParrotLibrary);
- ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_3_6_0;
+ ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_3_7_0;
dynop_register(interp, lib);
return lib;
}
View
131 src/packfile/api.c
@@ -360,11 +360,65 @@ Parrot_pf_deserialize(PARROT_INTERP, ARGIN(STRING *str))
/*
-=item C<PMC * Parrot_pf_subs_by_flag(PARROT_INTERP, PMC * pfpmc, STRING * flag)>
+=item C<void Parrot_pf_tag_constant(PARROT_INTERP, PackFile_ConstTable *ct,
+const int tag_idx, const int const_idx)>
-Get an array of Subs in the packfile by named flag.
+Tag a constant PMC with a constant STRING
+
+=cut
+
+*/
+
+void
+Parrot_pf_tag_constant(PARROT_INTERP, ARGIN(PackFile_ConstTable *ct),
+ const int tag_idx, const int const_idx)
+{
+ ASSERT_ARGS(Parrot_pf_tag_constant)
+ int lo, hi, cur;
+ const STRING *tag = ct->str.constants[tag_idx];
+
+ /* allocate space */
+ if (ct->tag_map == NULL) {
+ ct->tag_map = mem_gc_allocate_n_zeroed_typed(interp, 1, PackFile_ConstTagPair);
+ ct->ntags = 1;
+ }
+ else {
+ ct->tag_map = mem_gc_realloc_n_typed_zeroed(interp, ct->tag_map, ct->ntags + 1, ct->ntags,
+ PackFile_ConstTagPair);
+ ct->ntags++;
+ }
+
+ /* find the slot to insert into */
+ lo = 0;
+ cur = 0;
+ hi = ct->ntags - 1;
+ while (lo < hi) {
+ cur = (lo + hi)/2;
+
+ switch (STRING_compare(interp, tag, ct->str.constants[ct->tag_map[cur].tag_idx])) {
+ case -1:
+ lo = ++cur;
+ break;
+ case 0:
+ lo = hi = cur;
+ break;
+ case 1:
+ hi = cur;
+ break;
+ }
+ }
+
+ mem_sys_memmove(&ct->tag_map[cur + 1], &ct->tag_map[cur],
+ ((ct->ntags - 1) - cur) * sizeof (PackFile_ConstTagPair));
+ ct->tag_map[cur].tag_idx = tag_idx;
+ ct->tag_map[cur].const_idx = const_idx;
+}
+
+/*
+
+=item C<PMC * Parrot_pf_subs_by_tag(PARROT_INTERP, PMC * pfpmc, STRING * flag)>
-Currently accepted values are "load" and "init".
+Get an array of Subs in the packfile by named flag.
=cut
@@ -373,11 +427,12 @@ Currently accepted values are "load" and "init".
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PMC *
-Parrot_pf_subs_by_flag(PARROT_INTERP, ARGIN(PMC * pfpmc), ARGIN(STRING * flag))
+Parrot_pf_subs_by_tag(PARROT_INTERP, ARGIN(PMC * pfpmc), ARGIN(STRING * flag))
{
- ASSERT_ARGS(Parrot_pf_subs_by_flag)
+ ASSERT_ARGS(Parrot_pf_subs_by_tag)
PackFile * const pf = (PackFile*)VTABLE_get_pointer(interp, pfpmc);
int mode = 0;
+ PMC * const subs = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
if (!pf || !pf->cur_cs || !pf->cur_cs->const_table)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNEXPECTED_NULL,
"NULL or invalid packfile");
@@ -386,12 +441,66 @@ Parrot_pf_subs_by_flag(PARROT_INTERP, ARGIN(PMC * pfpmc), ARGIN(STRING * flag))
mode = 1;
else if (STRING_equal(interp, flag, CONST_STRING(interp, "init")))
mode = 2;
- else
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
- "%S is not a valid packfile trigger", flag);
-
{
- PMC * const subs = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
+ PackFile_ConstTable * const ct = pf->cur_cs->const_table;
+ opcode_t flag_idx = -1;
+
+ int bottom_lo, bottom_hi, top_lo, top_hi, cur;
+ int i;
+
+ bottom_lo = top_lo = cur = 0;
+ bottom_hi = top_hi = ct->ntags;
+
+ /* find the first match (if any) */
+ while (flag_idx < 0) {
+ if (bottom_lo == top_hi) {
+ /* tag not present */
+ goto done_find_bounds;
+ }
+
+ cur = (bottom_lo + top_hi)/2;
+
+ switch (STRING_compare(interp, flag, ct->str.constants[ct->tag_map[cur].tag_idx])) {
+ case -1:
+ bottom_lo = cur + 1;
+ break;
+ case 0:
+ flag_idx = ct->tag_map[cur].tag_idx;
+ bottom_hi = cur;
+ top_lo = cur + 1;
+ break;
+ case 1:
+ top_hi = cur;
+ break;
+ }
+ }
+
+ /* find the bottom of the map's range with this tag */
+ while (bottom_lo < bottom_hi) {
+ cur = (bottom_lo + bottom_hi)/2;
+ if (ct->tag_map[cur].tag_idx == flag_idx)
+ bottom_hi = cur;
+ else
+ bottom_lo = cur + 1;
+ }
+
+ /* find the top */
+ while (top_lo < top_hi) {
+ cur = (top_lo + top_hi)/2;
+ if (ct->tag_map[cur].tag_idx == flag_idx)
+ top_lo = cur + 1;
+ else
+ top_hi = cur;
+ }
+
+ done_find_bounds:
+ for (i = bottom_lo; i < top_hi; i++)
+ VTABLE_push_pmc(interp, subs, ct->pmc.constants[ct->tag_map[i].const_idx]);
+ }
+
+ /* Backwards compatibility. :load is equivalent to "load" tag. :init is
+ equivalent to "init" tag */
+ if (mode == 1 || mode == 2) {
PackFile_ByteCode * const self = pf->cur_cs;
PackFile_ConstTable * const ct = self->const_table;
STRING * const SUB = CONST_STRING(interp, "Sub");
@@ -412,8 +521,8 @@ Parrot_pf_subs_by_flag(PARROT_INTERP, ARGIN(PMC * pfpmc), ARGIN(STRING * flag))
else if (mode == 2 && Sub_comp_INIT_TEST(sub))
VTABLE_push_pmc(interp, subs, sub_pmc);
}
- return subs;
}
+ return subs;
}
/*
View
7 src/packfile/output.c
@@ -225,6 +225,7 @@ PackFile_ConstTable_pack_size(PARROT_INTERP, ARGMOD(PackFile_Segment *seg))
}
Parrot_hash_destroy(interp, self->pmc_hash);
self->pmc_hash = NULL;
+ size += 1 + (self->ntags * 2);
return size;
}
@@ -277,6 +278,12 @@ PackFile_ConstTable_pack(PARROT_INTERP,
Parrot_hash_destroy(interp, self->pmc_hash);
self->pmc_hash = NULL;
+ *cursor++ = self->ntags;
+ for (i = 0; i < self->ntags; i++) {
+ *cursor++ = self->tag_map[i].tag_idx;
+ *cursor++ = self->tag_map[i].const_idx;
+ }
+
return cursor;
}
View
12 src/packfile/segments.c
@@ -339,6 +339,11 @@ PackFile_ConstTable_clear(PARROT_INTERP, ARGMOD(PackFile_ConstTable *self))
self->string_hash = NULL;
}
+ if (self->tag_map) {
+ mem_gc_free(interp, self->tag_map);
+ self->ntags = 0;
+ }
+
return;
}
@@ -420,6 +425,13 @@ PackFile_ConstTable_unpack(PARROT_INTERP, ARGMOD(PackFile_Segment *seg),
Parrot_ns_store_sub(interp, pmc);
}
+ self->ntags = PF_fetch_opcode(pf, &cursor);
+ self->tag_map = mem_gc_allocate_n_zeroed_typed(interp, self->ntags, PackFile_ConstTagPair);
+ for (i = 0; i < self->ntags; i++) {
+ self->tag_map[i].tag_idx = PF_fetch_opcode(pf, &cursor);
+ self->tag_map[i].const_idx = PF_fetch_opcode(pf, &cursor);
+ }
+
return cursor;
err:
View
7 src/pmc/exception.pmc
@@ -870,6 +870,13 @@ which holds the PMC representing the sub, and C<annotations> which is a hash
of the annotations at the point where the exception was thrown for the current
sub, or for the point of the call a level deeper for the rest.
+=item C<PMC *backtrace_strings>
+
+Return an array of strings representing a displayable backtrace. Each element
+in the array is the backtrace at the time when the exception was thrown.
+Rethrowing the exception adds a new entry. The first item in the list is the
+most recent throw of the Exception.
+
=cut
*/
View
92 src/pmc/imccompiler.pmc
@@ -30,21 +30,37 @@ static PMC * get_packfile_eval_pmc(PARROT_INTERP,
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-static PMC * get_packfile_pmc(PARROT_INTERP, ARGIN(PMC *pf_ptr_pmc))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
#define ASSERT_ARGS_get_packfile_eval_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pf_pmc))
-#define ASSERT_ARGS_get_packfile_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(pf_ptr_pmc))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+#define BEGIN_IMCC_COMPILE(i) \
+ do { \
+ UINTVAL __regs_used[4] = {3, 3, 3, 3}; \
+ PMC * const __newcontext = Parrot_push_context((i), __regs_used); \
+ PackFile_ByteCode * const __old_bc = (i)->code; \
+ PMC * const __old_cur_pf = (i)->current_pf; \
+ Parrot_block_GC_mark((i)); \
+ Parrot_pcc_set_HLL((i), __newcontext, 0); \
+ Parrot_pcc_set_sub((i), __newcontext, 0); \
+
+#define END_IMCC_COMPILE(i) \
+ Parrot_pop_context((i)); \
+ Parrot_unblock_GC_mark((i)); \
+ (i)->code = __old_bc; \
+ if (!PMC_IS_NULL(__old_cur_pf)) \
+ Parrot_pf_set_current_packfile((i), __old_cur_pf); \
+ } while (0)
+
+#define ERROR_IMCC_COMPILE(i) \
+ Parrot_pop_context((i)); \
+ Parrot_unblock_GC_mark((i)); \
+ (i)->code = __old_bc; \
+ if (!PMC_IS_NULL(__old_cur_pf)) \
+ Parrot_pf_set_current_packfile((i), __old_cur_pf); \
+
/*
=over 4
@@ -78,31 +94,6 @@ get_packfile_eval_pmc(PARROT_INTERP, ARGIN(PMC *pf_pmc), INTVAL current_eval)
return eval_pmc;
}
-/*
-
-=item C<static PMC * get_packfile_pmc(PARROT_INTERP, PMC *pf_ptr_pmc)>
-
-Get a PMC pointer to a passed packfile pointer
-
-=back
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-static PMC *
-get_packfile_pmc(PARROT_INTERP, ARGIN(PMC *pf_ptr_pmc))
-{
- ASSERT_ARGS(get_packfile_pmc)
-
- PackFile * const pf = (PackFile*)VTABLE_get_pointer(interp, pf_ptr_pmc);
- PMC * const pf_pmc = Parrot_pmc_new(interp, enum_class_PackfileView);
- VTABLE_set_pointer(interp, pf_pmc, pf);
- return pf_pmc;
-}
-
/* HEADERIZER HFILE: none */
pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
@@ -131,6 +122,7 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
}
/* provided to emulate the current NCI compreg */
+ /* DEPRECATED. See TT #1967 */
VTABLE opcode_t* invoke(void* next) {
Parrot_IMCCompiler_attributes * const attrs = PARROT_IMCCOMPILER(SELF);
imc_info_t * const imcc = (imc_info_t*) attrs->imcc_info;
@@ -204,34 +196,26 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
{
Parrot_IMCCompiler_attributes * const attrs = PARROT_IMCCOMPILER(SELF);
PMC * pf;
- PMC * eval_pmc = PMCNULL;
imc_info_t * const imcc = (imc_info_t*)attrs->imcc_info;
- UINTVAL regs_used[4] = {3, 3, 3, 3};
- PMC * const newcontext = Parrot_push_context(interp, regs_used);
- PackFile_ByteCode * const old_bc = interp->code;
if (has_target)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"IMCCompiler: compiler does not support the target option");
- Parrot_block_GC_mark(interp);
- Parrot_pcc_set_HLL(interp, newcontext, 0);
- Parrot_pcc_set_sub(interp, newcontext, 0);
+ BEGIN_IMCC_COMPILE(interp);
/* TODO: Handle outer_ctx */
pf = imcc_compile_string(imcc, source, attrs->is_pasm);
if (PMC_IS_NULL(pf)) {
STRING * const msg = imcc_last_error_message(imcc);
INTVAL code = imcc_last_error_code(imcc);
+ ERROR_IMCC_COMPILE(interp);
Parrot_ex_throw_from_c_args(INTERP, NULL, code, "%Ss", msg);
}
- eval_pmc = get_packfile_pmc(INTERP, pf);
- Parrot_pop_context(interp);
- Parrot_unblock_GC_mark(interp);
- interp->code = old_bc;
+ END_IMCC_COMPILE(interp);
- RETURN(PMC *eval_pmc);
+ RETURN(PMC *pf);
}
METHOD compile_file(STRING *filename,
@@ -241,33 +225,23 @@ pmclass IMCCompiler auto_attrs provides HLLCompiler provide invokable {
Parrot_IMCCompiler_attributes * const attrs = PARROT_IMCCOMPILER(SELF);
PMC * pf = PMCNULL;
imc_info_t * const imcc = (imc_info_t*)attrs->imcc_info;
- UINTVAL regs_used[4] = {3, 3, 3, 3};
- PMC * const newcontext = Parrot_push_context(interp, regs_used);
- PMC * const old_pf = Parrot_pf_get_current_packfile(interp);
- PMC * pf_pmc;
if (has_target)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"IMCCompiler: compiler does not support the target option");
- Parrot_block_GC_mark(interp);
- Parrot_pcc_set_HLL(interp, newcontext, 0);
- Parrot_pcc_set_sub(interp, newcontext, 0);
+ BEGIN_IMCC_COMPILE(interp);
/* TODO: Handle outer_ctx */
pf = imcc_compile_file(imcc, filename, attrs->is_pasm);
if (PMC_IS_NULL(pf)) {
STRING * const msg = imcc_last_error_message(imcc);
const INTVAL code = imcc_last_error_code(imcc);
+ ERROR_IMCC_COMPILE(interp);
Parrot_ex_throw_from_c_args(INTERP, NULL, code, "%Ss", msg);
}
- /* This causes errors during the build */
- /*pf_pmc = get_packfile_pmc(INTERP, pf);*/
- Parrot_pop_context(interp);
- Parrot_unblock_GC_mark(interp);
- if (!PMC_IS_NULL(old_pf))
- Parrot_pf_set_current_packfile(interp, old_pf);
+ END_IMCC_COMPILE(interp);
RETURN(PMC *pf);
}
View
115 src/pmc/multisub.pmc
@@ -22,47 +22,62 @@ Sub PMCs with the same short name, but different long names.
/* HEADERIZER HFILE: none */
/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+static void check_is_valid_sub(PARROT_INTERP, ARGIN(PMC * sub))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+#define ASSERT_ARGS_check_is_valid_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-pmclass MultiSub extends ResizablePMCArray auto_attrs provides array provides invokable {
+/*
+
+=item C<static void check_is_valid_sub(PARROT_INTERP, PMC * sub)>
+
+TK
+
+=cut
+
+*/
+
+static void
+check_is_valid_sub(PARROT_INTERP, ARGIN(PMC * sub))
+{
+ ASSERT_ARGS(check_is_valid_sub)
+ STRING * const invokable_str = CONST_STRING(interp, "invokable");
+ if (!VTABLE_does(interp, sub, invokable_str))
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+ "attempt to add non-invokable PMC");
+}
+
+pmclass MultiSub
+ extends ResizablePMCArray
+ auto_attrs
+ provides array
+ provides invokable {
VTABLE STRING * get_string() {
PMC * const sub0 = VTABLE_get_pmc_keyed_int(INTERP, SELF, 0);
+ /*if (PMC_IS_NULL(sub0))
+ return STRINGNULL;*/
STRING * const name = VTABLE_get_string(INTERP, sub0);
return name;
}
VTABLE void push_pmc(PMC *value) {
- if (!VTABLE_does(INTERP, value, CONST_STRING(INTERP, "invokable")))
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_INVALID_OPERATION, "attempt to push non Sub PMC");
-
+ check_is_valid_sub(INTERP, value);
SUPER(value);
}
VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) {
- STRING * const _sub = CONST_STRING(INTERP, "Sub");
- if (!VTABLE_isa(INTERP, value, _sub))
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
- "attempt to set non Sub PMC");
+ check_is_valid_sub(INTERP, value);
SUPER(key, value);
}
- VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
- "attempt to set non Sub PMC");
- }
-
- VTABLE void set_string_keyed_int(INTVAL key, STRING *value) {
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
- "attempt to set non Sub PMC");
- }
-
- VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
- "attempt to set non Sub PMC");
- }
-
VTABLE opcode_t *invoke(void *next) {
PMC * const sig_obj = CONTEXT(INTERP)->current_sig;
PMC * const func = Parrot_mmd_sort_manhattan_by_sig_pmc(INTERP,
@@ -74,56 +89,6 @@ pmclass MultiSub extends ResizablePMCArray auto_attrs provides array provides in
VTABLE_get_string(INTERP, SELF));
return VTABLE_invoke(INTERP, func, next);
}
-
-
- /* I don't really know how to implement these if they need something
- special, so I'll sort the sub list and defer processing to the
- ResizablePMCArray's VTABLEs of the same names. Hopefully we
- don't need anything beyond that. */
- VTABLE PMC *get_pmc_keyed(PMC *key) {
- PMC * const sig_obj = CONTEXT(INTERP)->current_sig;
- PMC * const sub = Parrot_mmd_sort_manhattan_by_sig_pmc(INTERP,
- SELF, sig_obj);
-
- if (PMC_IS_NULL(sub))
- Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
- "No applicable candidates found to dispatch to for '%Ss'",
- VTABLE_get_string(INTERP, SELF));
- return SUPER(key);
- }
-
- VTABLE PMC *get_pmc_keyed_str(STRING *s) {
- PMC * const sig_obj = CONTEXT(INTERP)->current_sig;
- PMC * const sub = Parrot_mmd_sort_manhattan_by_sig_pmc(INTERP,
- SELF, sig_obj);
-
- if (PMC_IS_NULL(sub))
- Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
- "No applicable candidates found to dispatch to for '%Ss'",
- VTABLE_get_string(INTERP, SELF));
- return SUPER(s);
- }
-
- /* get_iter method should take one of two inputs: either an array of
- arguments, or a string with a whitespace delimited function signature
- (N, I, S, P). It should sort the argument list according to closeness
- to this input argument list and return an iterator over that list. */
-
- METHOD get_iter(PMC *args) {
- STRING * const _array = CONST_STRING(INTERP, "Array");
- STRING * const _string = CONST_STRING(INTERP, "String");
-
- if (VTABLE_isa(INTERP, args, _array)){