Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'origin/master' into leto/embed_grant

  • Loading branch information...
commit 67b40809b95712a56863ba817fd60dadf8221570 2 parents 56fa3c4 + cbfc76e
@leto leto authored
Showing with 1,527 additions and 459 deletions.
  1. +2 −1  .gitignore
  2. +4 −0 CREDITS
  3. +17 −1 MANIFEST
  4. +8 −0 NEWS
  5. +1 −0  config/auto/warnings.pm
  6. +1 −46 config/gen/makefiles/root.in
  7. +4 −6 config/init/hints/darwin.pm
  8. +1 −1  docs/book/pir/ch03_basic_syntax.pod
  9. +1 −1  docs/book/pir/ch04_variables.pod
  10. +231 −0 docs/deprecations/deprecations.pod
  11. +73 −0 docs/deprecations/deprecations_2_6.pod
  12. +200 −0 docs/deprecations/deprecations_2_9.pod
  13. +222 −0 docs/deprecations/deprecations_3_0.pod
  14. +28 −0 docs/deprecations/deprecations_3_3.pod
  15. +59 −0 docs/deprecations/deprecations_3_6.pod
  16. +135 −0 docs/deprecations/how_to_deprecate.pod
  17. +0 −2  docs/embed.pod
  18. +12 −0 docs/index/developer.json
  19. +34 −5 docs/project/git_workflow.pod
  20. +1 −1  include/parrot/compiler.h
  21. +94 −73 lib/Parrot/Test.pm
  22. +1 −0  lib/Parrot/Vtable.pm
  23. +24 −16 src/call/args.c
  24. +17 −29 src/dynpmc/os.pmc
  25. +1 −1  src/gc/alloc_resources.c
  26. +9 −7 src/gc/string_gc.c
  27. +2 −2 src/pmc/structview.pmc
  28. +3 −3 src/pmc/unmanagedstruct.pmc
  29. +37 −0 t/dynpmc/foo-01.t
  30. +19 −0 t/dynpmc/foo-02.t
  31. +23 −0 t/dynpmc/foo-03.t
  32. +30 −0 t/dynpmc/foo-04.t
  33. +28 −0 t/dynpmc/foo-05.t
  34. +32 −0 t/dynpmc/foo-06.t
  35. +36 −0 t/dynpmc/foo-07.t
  36. +23 −0 t/dynpmc/foo-08.t
  37. +22 −0 t/dynpmc/foo-09.t
  38. +22 −0 t/dynpmc/foo-10.t
  39. +0 −217 t/dynpmc/foo.t
  40. +19 −4 t/harness
  41. +46 −9 t/pmc/socket_ipv6.t
  42. +0 −30 t/src/extend_vtable.t
  43. +4 −2 t/steps/init/hints/darwin-01.t
  44. +1 −1  t/tools/dev/headerizer/01_functions.t
  45. +0 −1  tools/dev/merge_pull_request.pl
View
3  .gitignore
@@ -31,7 +31,8 @@
/*.sto
/*.suo
/*.tmp
-/*.sw?
+# vim swap files
+/\.*sw?
/*.vcproj*
/.git
/.parrot_current_rev
View
4 CREDITS
@@ -719,6 +719,10 @@ N: Markus Mayr
D: Implementation of the Rational PMC
D: Fixing SDL-bindings and examples
+N: Matt Boyle
+U: ligne
+D: Fixes to docs and test-suite.
+
N: Matt Diephouse
U: mdiep
E: matt@diephouse.com
View
18 MANIFEST
@@ -286,6 +286,13 @@ docs/compiler_faq.pod [doc]
docs/configuration.pod [doc]
docs/debug.pod [doc]
docs/debugger.pod [doc]
+docs/deprecations/deprecations.pod [doc]
+docs/deprecations/deprecations_2_6.pod [doc]
+docs/deprecations/deprecations_2_9.pod [doc]
+docs/deprecations/deprecations_3_0.pod [doc]
+docs/deprecations/deprecations_3_3.pod [doc]
+docs/deprecations/deprecations_3_6.pod [doc]
+docs/deprecations/how_to_deprecate.pod [doc]
docs/dev/byteorder.pod [doc]
docs/dev/c_functions.pod [doc]
docs/dev/coverage.pod [doc]
@@ -1635,7 +1642,16 @@ t/dynoplibs/trans-old.t [test]
t/dynoplibs/trans.t [test]
t/dynpmc/dynlexpad.t [test]
t/dynpmc/file.t [test]
-t/dynpmc/foo.t [test]
+t/dynpmc/foo-01.t [test]
+t/dynpmc/foo-02.t [test]
+t/dynpmc/foo-03.t [test]
+t/dynpmc/foo-04.t [test]
+t/dynpmc/foo-05.t [test]
+t/dynpmc/foo-06.t [test]
+t/dynpmc/foo-07.t [test]
+t/dynpmc/foo-08.t [test]
+t/dynpmc/foo-09.t [test]
+t/dynpmc/foo-10.t [test]
t/dynpmc/foo2.t [test]
t/dynpmc/gziphandle.t [test]
t/dynpmc/os.t [test]
View
8 NEWS
@@ -1,3 +1,11 @@
+New in 3.5.0
+- Core
+- Languages
+- Tests
+ + The Parrot test suite harness now understands the HARNESS_TIMER environment
+ variable. Setting it to a true value will show timing results for a test run.
+ + IPv6 tests are now parallel testing friendly
+
New in 3.4.0
- Core
+ The Generational Mark and Sweep garbage collector is the new default.
View
1  config/auto/warnings.pm
@@ -235,6 +235,7 @@ sub _init {
-Wformat
-Wformat-security
-Wmain
+ -Wmaybe-uninitialized
-Wmissing-declarations
-Wmissing-prototypes
-Wpointer-arith
View
47 config/gen/makefiles/root.in
@@ -2511,50 +2511,6 @@ SPLINT = splint
# kept in there after completion.
SPLINT_TMP = $(TEMPDIR)/splint
-# Transfer errors (-mem-trans) are too tough for us right now
-OLD_SPLINTFLAGS_MEMORY_SAFETY = \
- -mem-trans \
- -memchecks \
- +bufferoverflow \
- +bufferoverflowhigh \
- +read-only-strings \
- +read-only-trans \
- -strict-destroy \
- -strict-use-released \
- +use-released \
- -must-free \
- -mustfreefresh \
- -mustfreeonly \
- +null \
- +nullptrarith \
- +nullret \
- -ptr-arith \
- +ptr-negate \
-
-# Watch for unsafe comparisons
-OLD_SPLINTFLAGS_UNSAFE_COMPARISONS = \
- +bool-compare \
- +ptr-compare \
- +real-compare \
- +unsigned-compare
-
-# const and other qualifiers
-# Report qualifier mismatches only if dangerous (+relax-quals)
-OLD_SPLINTFLAGS_QUALIFIERS = \
- +relax-quals
-
-# Symbol definitions
-OLD_SPLINTFLAGS_SYMBOL_DEFINITIONS = \
- +decl-undef \
- +incon-defs \
- +incon-defs-lib \
-
-# Problems with evaluation and control structions
-OLD_SPLINTFLAGS_EVALUATION = \
- +controlnestdepth 15 \
- +duplicate-quals \
-
-
# Splint flags: http://splint.org/manual/html/appB.html
# The dashes in the names don't make any difference to Splint, but I've
# made them match how they are in the manual. Otherwise, you might be
@@ -2679,9 +2635,8 @@ SPLINTFLAGS = \
$(SPLINTFLAGS_COMPLETENESS) \
$(SPLINTFLAGS_MISCELLANEOUS) \
-#SPLINT_SOURCE = `echo $(O_FILES) | $(PERL) -pe @PQ@s/\.o/\.c/g@PQ@ | sort`
SPLINT_SOURCE = \
- $$(find src/*.c src/gc/*.c src/io/*.c src/packfile/*.c src/string/*.c -type f | \
+ $$(find src/*.c src/call/*.c src/gc/*.c src/io/*.c src/packfile/*.c src/string/*.c -type f | \
grep -v src/gc/malloc.c | \
grep -v src/gc/malloc_trace.c | \
grep -v extend_vtable.c | \
View
10 config/init/hints/darwin.pm
@@ -40,15 +40,12 @@ sub runstep {
my $libs = _strip_ldl_as_needed( $conf->data->get( 'libs' ) );
- _set_deployment_environment();
+ my $deploy_target = _set_deployment_environment();
my $lib_dir = $conf->data->get('build_dir') . "/blib/lib";
$flagsref->{ldflags} .= ' -L"' . $lib_dir . '"';
- if ($ENV{'MACOSX_DEPLOYMENT_TARGET'} eq '10.6') {
- $flagsref->{ccflags} .= ' -pipe -fno-common ';
- }
- elsif ($ENV{'MACOSX_DEPLOYMENT_TARGET'} eq '10.5') {
+ if ($deploy_target =~ /^10\.(5|6|7)$/) {
$flagsref->{ccflags} .= ' -pipe -fno-common ';
}
else {
@@ -69,7 +66,7 @@ sub runstep {
$conf->data->set(
darwin => 1,
- osx_version => $ENV{'MACOSX_DEPLOYMENT_TARGET'},
+ osx_version => $deploy_target,
osvers => $osvers,
ccflags => $flagsref->{ccflags},
ldflags => $flagsref->{ldflags},
@@ -169,6 +166,7 @@ sub _set_deployment_environment {
$OSX_vers =join '.', (split /[.]/, $OSX_vers)[0,1];
$ENV{'MACOSX_DEPLOYMENT_TARGET'} = $OSX_vers;
}
+ return $ENV{'MACOSX_DEPLOYMENT_TARGET'};
}
sub _probe_for_fink {
View
2  docs/book/pir/ch03_basic_syntax.pod
@@ -266,7 +266,7 @@ true or false before jumping:
if $I0 > 5 goto GREET
-=end PIR_FRAGMENT
+=end PIR_FRAGMENT_INVALID
You can construct any traditional control structure from PIR's built-in control structures.
View
2  docs/book/pir/ch04_variables.pod
@@ -1314,7 +1314,7 @@ reached the end of the aggregate:
if $P1 goto iter_repeat
-=end PIR_FRAGMENT
+=end PIR_FRAGMENT_INVALID
Parrot provides predefined constants for working with iterators.
C<.ITERATE_FROM_START> and C<.ITERATE_FROM_END> constants select whether an
View
231 docs/deprecations/deprecations.pod
@@ -0,0 +1,231 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations.pod - Parrot Deprecations
+
+=head1 Parrot Deprecations
+
+This page exists to systematically document all deprecations that apply to core
+Parrot code.
+
+We don't hate our users and while we love ripping out crufty old code, we also
+don't want anyone developing code on top of Parrot to dread paying the
+"upgrade tax" when moving from one supported version to the next.
+
+The idea behind this page is that by following the instructions for each version
+transition, developers of HLLs and libraries can have a well-known and
+deterministic upgrade path.
+
+Any new deprecations must be described on the appropriate page and summarized
+here before being committed to master. This deprecation policy will be
+instituted shortly before the 2.6 release.
+
+Although we will attempt to add notices for previous version transitions, these
+lists may be incomplete.
+
+Notifications for the 2.6->2.9 transition and later will be complete.
+
+For instructions on how to deprecate Parrot code, please see:
+ F<how-to-deprecate.pod>.
+
+=head2 Changes Between 3.3 and 3.6
+
+=over 4
+
+=item *
+
+Special Purpose NCI Parameter Types
+
+- moderate impact expected:
+ some NCI-using code needs to be rewritten
+
+=back
+
+=head2 Changes Between 3.0 and 3.3
+
+=over 4
+
+=item *
+
+pkg-config Support
+
+- low impact expected:
+ feature has been unusable since at least 1.0
+
+
+=back
+
+=head2 Changes Between 2.9 and 3.0
+
+This list is a summary. A more complete description and migration path for each
+change is at F<deprecations_3_0.pod>.
+
+Any deprecations occurring after the 2.9.0 release require an accompanying
+notice here and F<deprecations_3_0.pod>, so the list should
+be exhaustive.
+
+If you find a deprecation that should be listed here, file a ticket
+ L<http://trac.parrot.org/parrot/newticket>
+or hop on #parrot on irc.parrot.org and let us know.
+
+=over 4
+
+=item *
+
+PARROT_ERRORS_GLOBALS_FLAG
+
+- low impact expected: no-op removal
+
+=item *
+
+CodeString. TT #1633
+
+- high impact expected:
+ PGE interface changed. user updates required.
+
+=item *
+
+unique_reg PIR flag. TT #1622
+
+- low impact expected:
+ equivalent functionality available by text substitution.
+
+=item *
+
+PIRspecialforms .nci_call and .meth_call. TT #1623 TT #1624
+
+- low impact expected: no known users.
+
+=item *
+
+Indirect Register Access Ops. TT #1642
+
+- low impact expected: no known users.
+
+=item *
+
+Exchange Op. TT #1643
+
+- low impact expected: no known users.
+
+=item *
+
+PIR string literals with charset and encoding are deprecated. TT #1808
+
+- medium impact expected:
+ the conversion is straightforward.
+
+=item *
+
+Remaining string_* functions are deprecated. TT #1809
+
+- medium impact expected:
+ these functions have been deprecated for a while.
+
+=item *
+
+Method lower in String PMC. TT #1606
+
+- low impact expected:
+ has been deprecated for a while.
+
+=item *
+
+Final removal of mutable strings leftovers. TT #1540.
+
+- Op C<concat_s_s> was removed.
+ Trivial change to C<concat_s_s_s>
+ or slightly better solution to refactor with StringBuilder.
+
+=back
+
+=head2 Changes Between 2.6 and 2.9
+
+This list is a summary. A more complete description and migration path for
+each change is at F<deprecations_2_9.pod>.
+
+If you find a deprecation that should be listed here, file a ticket
+ L<http://trac.parrot.org/parrot/newticket>
+or hop on #parrot on irc.parrot.org and let us know.
+
+=over 4
+
+=item *
+
+Remove charset opcodes. TT #1778
+
+- low impact expected: the conversion to encoding opcodes is straightforward.
+
+
+=item *
+
+Remove ParrotPCCINVOKE.
+
+- negligible impact expected:
+ this function has been deprecated for a long time.
+
+=item *
+Remove Parrot_find_global_s and Parrot_store_global_s TT #1660
+
+- low impact expected: these functions were used rarely outside Parrot.
+
+=item *
+
+Change find_lex opcode behaviour.
+
+- low impact expected: this function has been deprecated for awhile.
+
+=item *
+
+Eliminate Raw NCI.
+
+- negligible impact expected:
+ this functionality has little use that doesn't result in a segfault
+
+=item *
+
+Remove Parrot_get_runtime_prefix. TT #1191
+
+- Zero impact expected, it's been unused since long time.
+=item *
+
+RemoveIsTty Remove is_tty methods. #1689
+
+- negligible impact expected.
+
+=back
+
+=head2 Changes Between 2.3 and 2.6
+
+This list is a summary. A more complete description and migration path for
+each change is at F<deprecations_2_6.pod>.
+
+=over 4
+
+=item *
+
+Remove sizeof op.
+
+No replacement currently exists. TT #633
+
+- negligible impact expected: this op was not widely used
+
+=item *
+
+Replace STRING_is_null with Parrot_str_is_null TT #1585
+
+- moderate impact expected: simple textual substitution for C code dealing
+ with STRING* values
+
+=item *
+
+Remove in-place substr op variants. TT #1450
+
+- high impact expected: most PIR code dealing with string substitution will
+ need to be updated
+
+
+=back
+
+=cut
View
73 docs/deprecations/deprecations_2_6.pod
@@ -0,0 +1,73 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations_2_6.pod - Parrot Deprecations for 2.6
+
+=head1 Parrot Deprecations for 2.6
+
+=head2 Remove sizeof op
+
+=head3 Description
+
+The PIR op C<sizeof> was removed.
+
+See TT #633
+
+=head3 Rational
+
+This op was used to determine the size of a PMC's C-level struct given a
+numerical PMC type id. This op was deprecated because numerical PMC id values
+should not be exposed to PIR-level code.
+
+=head3 Replacment
+
+No replacement currently exists because no core, library or HLL code was found
+to rely on this op. If this functionality is needed, a string-based version
+could easily be implemented.
+
+=head2 Replace STRING_is_null with Parrot_str_is_null
+
+=head3 Description
+
+The C-level macro STRING_is_null was replaced with Parrot_str_is_null.
+
+See TT #1585
+
+=head3 Rational
+
+Make string null checks look like a Parrot API function.
+
+=head3 Replacment
+
+Replace uses of the C function STRING_is_null with Parrot_str_is_null.
+Parrot_str_is_null is a drop-in replacement for STRING_is_null.
+
+=head2 Remove in-place substr op variants
+
+=head3 Description
+
+All variants of the PIR op C<substr> which mutate an argument in-place were
+removed.
+
+See TT #1450
+
+=head3 Rational
+
+Parrot moved to immutable strings for performance reasons. With immutable
+strings, a PIR-level string is never changed once it's been created. This
+means that ops that work on a string in-place no longer make sense.
+
+=head3 Replacment
+
+PIR code should be changed as follows:
+
+ #old version
+ substr $S0, $I0, $I1, $S1
+
+ #new version
+ $S0 = replace $S0, $I0, $I1, $S1
+
+See also r46055 for more examples.
+
+=cut
View
200 docs/deprecations/deprecations_2_9.pod
@@ -0,0 +1,200 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations_2_9.pod - Parrot Deprecations for 2.9
+
+=head1 Parrot Deprecations for 2.9
+
+=head2 Remove charset opcodes and fixed_8 encoding
+
+=head3 Description
+
+Charsets have been merged into encodings. The charset opcodes and the fixed_8
+encoding will be removed.
+
+=head3 Rational
+
+After the charset/encoding merge, they're unneeded.
+
+=head3 Replacment
+
+Use the corresponding encoding opcodes instead.
+
+ /* old code */
+ $I0 = charset $S0
+ $S1 = charsetname $I0
+ $I1 = find_charset "ascii"
+ $S2 = trans_charset $S0, $I1
+
+ /* updated code */
+ $I0 = encoding $S0
+ $S1 = encodingname $I0
+ $I1 = find_encoding "ascii"
+ $S2 = trans_encoding $S0, $I1
+
+The list of supported encodings is:
+
+ ascii
+ iso-8859-1
+ binary
+ utf8
+ utf16
+ ucs2
+ ucs4
+
+Use the 'utf8' encoding instead of the 'unicode' charset. The 'fixed_8'
+encoding is also going away. Use 'ascii' instead. If you want to test
+for a fixed_8 encoding, you have to compare the encoding to 'ascii',
+'iso-8859-1' and 'binary' separately.
+
+=head2 Remove Parrot_PCCINVOKE
+
+=head3 Description
+
+The C function Parrot_PCCINVOKE has been removed.
+
+See TT #443 and [wiki:PCCMigrationNotes] for details.
+
+=head3 Rational
+
+This function didn't conform to Parrot's naming conventions.
+
+=head3 Replacment
+
+Use Parrot_pcc_invoke_method_from_c_arg instead.
+
+A simple textual substitution is enough to update any code that depends on this
+function.
+
+ /* old code */
+ Parrot_PCCINVOKE(interp, interp->scheduler, CONST_STRING(interp, "count_handlers"), "S->I", handler_type, &count);
+
+ /* updated code */
+ Parrot_pcc_invoke_method_from_c_args(interp, interp->scheduler, CONST_STRING(interp, "count_handlers"), "S->I", handler_type, &count);
+
+See r42129 for more examples.
+
+=head2 Remove Parrot_find_global_s and Parrot_store_global_s
+
+=head3 Description
+
+Parrot_find_global_s and Parrot_store_global_s were removed after they were
+found to be unused.
+
+=head3 Rational
+
+Nothing in Parrot used them and they were therefore untested.
+
+=head3 Replacment
+
+Use the body of one of the old functions in place of its call.
+
+ /* old code */
+ XXX: insert code here
+
+ /* updated code */
+ XXX: insert code here
+
+See r48435 (src/namespace.c changes) for an example of what to replace calls to
+these functions with.
+
+See r42129 for more example
+
+=head2 Change behavior of find_lex opcode
+
+=head3 Description
+
+The find_lex opcode no longer throws an exception when the lexical is not
+found; it returns PMCNULL instead.
+
+=head3 Rational
+
+This is consistent with the other "lookup" opcodes.
+
+=head3 Replacment
+
+If you want to throw an exception, you must check the result of the opcode and
+throw the exception explicitly.
+
+=head2 Remove CodeString PMC
+
+=head3 Description
+
+The CodeString pmc has been removed.
+
+See TT #1633
+
+=head3 Rational
+
+With the switch to immutable strings, CodeString became very expensive, as it
+did a lot of string concatenations.
+
+=head3 Replacment
+
+As a replacement for the .emit() functionality, instead use .append_format() in
+StringBuilder. Only difference from emit() is that newlines are not
+automatically appended, so you'll have to add them manually.
+
+Charname_to_ord is now an opcode: find_codepoint.
+
+The other methods that were provided are now part of PCT (and are probably not
+needed directly).
+
+=head2 Eliminate Raw NCI
+
+=head3 Description
+
+It is no longer possible to create an NCI pmc without a corresponding NCI
+signature.
+
+See TT #1549
+
+=head3 Rational
+
+This functionality abused the NCI and went against the initial purpose
+- bridging the gap between parrot and C by translating calling conventions.
+
+This was error prone, generally leading to segfaults.
+
+=head3 Replacment
+
+If you must have an equivalent, take a look at NativePCCMethod. Otherwise,
+enjoy the fact that your segfaults are now most likely "not implemented"
+errors.
+
+=head2 GetRuntimePrefix
+
+=head3 Description
+
+The function Parrot_get_runtime_prefix has been removed.
+
+See TT #1191
+
+=head3 Rational
+
+It returned a char * instead of a Parrot string.
+
+A new function provides better functionality and there is no need to keep this.
+
+=head3 Replacment
+
+Parrot_get_runtime_path
+
+=head2 RemoveIsTty
+
+=head3 Description
+
+The method is_tty in several Handle PMCs has been removed.
+
+See TT #1689
+
+=head3 Rational
+
+There was a inconsistency, some PMCs used is_tty and others isatty. The decision was to keep isatty.
+
+=head3 Replacment
+
+Use isatty.
+
+=cut
View
222 docs/deprecations/deprecations_3_0.pod
@@ -0,0 +1,222 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations_3_0.pod - Parrot Deprecations for 3.0
+
+=head1 Parrot Deprecations for 3.0
+
+=head2 PARROT_ERRORS_GLOBALS_FLAG
+
+=head3 Description
+
+The PARROT_ERRORS_GLOBALS_FLAG constant has been removed.
+
+=head3 Rational
+
+This flag does not modify the behaviour of parrot in any way.
+
+=head3 Replacment
+
+Remove all code attempting to set/unset this flag.
+
+It didn't do anything anyways.
+
+=head2 CodeString
+
+=head3 Description
+
+The CodeString PMC has been removed
+
+=head3 Rational
+
+Equivalent and more efficient functionality is available from StringBuilder.
+
+=head3 Replacment
+
+CodeString contains a number of convenience methods in addition to its core
+functionality.
+
+It is easier to replace these first.
+
+=over 4
+
+=item *
+
+CodeString.lineof can be replaced by PGE;Util;line_number
+
+=item *
+
+CodeString.unique can be replaced by PGE;Util;unique, PAST;Compiler;unique, or
+PAST;Compiler;uniquereg
+
+=item *
+
+CodeString.escape can be replaced by PGE;Util;pir_str_escape
+
+=item *
+
+CodeString.key can be replaced by PGE;Util;pir_key_escape
+
+=item *
+
+CodeString.charname_to_ord can be replaced by the find_codepoint opcode
+
+=back
+
+After these replacements, StringBuilder can be substituted for CodeString by
+changing .emit to .append_format. append_format does not add newlines, so these
+must be added to the format string.
+
+=head2 :unique_reg PIR value flag
+
+=head3 Description
+
+The :unique_reg flag on registers in PIR is no longer available.
+
+=head3 Rational
+
+It doesn't do anything.
+
+Also, this is a terrible way to work around register allocator failures if/when
+we get a register allocator.
+
+=head3 Replacment
+
+ s/:unique_reg//g
+
+=head2 .nci_call and .meth_call PIR special forms
+
+Specifying the type of call being performed is no longer required thanks to the
+magic of virtual dispatch.
+
+=head3 Rational
+
+They're old, crufty, and don't do anything that cannot be acheived by .call.
+
+Except obfuscasion of course.
+
+=head3 Replacment
+
+Use .call. It should be a simple text replacement fix.
+
+=head2 Indirect Register Access Ops
+
+=head3 Description
+
+Opcodes that access registers that are not their direct arguments are
+deprecated.
+
+Note, however, that direct arguments does include keys and pcc ops.
+
+Ops that are known to have this behaviour are clear{i,n,s,p} and
+set{i,n,s,p}_ind.
+
+These have been removed. No other core ops are known to have this behaviour.
+If you've created a dynop that has this behaviour, it and code using it is
+subject to breakage without notice (we reserve the right to implement
+optimizers).
+
+=head3 Rational
+
+They don't fit well with the level of the rest of parrot's opcodes.
+They make register lifetime analysis impossible, preventing many optimizations.
+
+=head3 Replacment
+
+If you really are using this, rethink your code. Stop using the register frame
+as an aggregate. Use an object aggregate in stead.
+
+=head2 Exchange Op
+
+=head3 Description
+
+The exchange ops are deprecated.
+
+=head3 Rational
+
+They operate at too low a level to be useful as parrot ops.
+
+=head3 Replacment
+
+You aren't using this. Seriously?
+
+ .macro xchg_int(a, b)
+ $I0 = .a
+ .a = .b
+ .b = $I0
+ .endm
+
+=head2 PIR string literals with charset and encoding are deprecated
+
+=head3 Description
+
+PIR string literals of the form
+
+ encoding:charset:"string"
+
+are deprecated.
+
+=head3 Rational
+
+After the charset/encoding merge, they're unneeded.
+
+=head3 Replacment
+
+They can be replaced with
+
+ encoding:"string"
+
+The encoding should be one of the new unified encodings.
+
+=head2 Remaining string_* functions are deprecated
+
+=head3 Description
+
+The string_* functions have been deprecated for a while.
+
+The remaining functions are:
+
+ string_make
+ string_ord
+ string_chr
+ string_to_cstring_nullable
+ string_max_bytes
+ string_increment
+
+=head3 Rational
+
+They're old cruft.
+
+=head3 Replacment
+
+string_make should be replaced with Parrot_str_new_init.
+You can use Parrot_find_encoding to get an encoding from a cstring.
+
+Replace string_ord with Parrot_str_indexed.
+
+Replace string_chr with Parrot_str_chr.
+
+Replace string_to_cstring_nullable with Parrot_str_to_cstring.
+
+string_max_bytes and string_increment will be removed.
+
+=head2 Method lower in String PMC
+
+=head3 Description
+
+The method lower in the String PMC has been removed.
+
+=head3 Rational
+
+HLLs may need its own version with different name and semantic, having a
+generic one is confusing. For other usages string registers are more
+convenient.
+
+=head3 Replacment
+
+Use string registers and the downcase opcode.
+
+For HLLs, provide its own version in the HLL mapped String type.
+
+=cut
View
28 docs/deprecations/deprecations_3_3.pod
@@ -0,0 +1,28 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations_3_3.pod - Parrot Deprecations for 3.3
+
+=head1 Parrot Deprecations for 3.3
+
+=head2 pkg-config Support
+
+parrot.pc will no longer be generated or installed.
+
+=head3 Rationale
+
+pkg-config conflicts with Parrot's installation guidelines which support
+multiple simultaneous installed versions (PDD30).
+
+As it stands, Parrot's pkg-config information has been unusable for several
+years, but no one has complained, indicating that this is unused.
+
+=head3 Replacement
+
+Use parrot_config, which is installed with the parrot system.
+
+The keys 'embed-cflags' and 'embed-ldflags' replace the pkg-config values of
+'CFlags' and 'Libs'.
+
+=cut
View
59 docs/deprecations/deprecations_3_6.pod
@@ -0,0 +1,59 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/deprecations_3_6.pod - Parrot Deprecations for 3.6
+
+=head1 Parrot Deprecations for 3.6
+
+=head2 Special Purpose NCI Parameter Types
+
+The NCI parameter types 'J', '@', 't', '0', 'V', '2', '3', '4', 'B', 'b', 'L',
+and 'T' have been removed.
+
+=head3 Rationale
+
+These types are special-purpose and their function can be accomplished by other
+means.
+
+=head3 Replacement
+
+=head4 B<'J', '@', 't', '0'>
+
+These types accomplish tasks which can be accomplished from PIR and are
+therefore redundant
+
+=over 4
+
+=item 'J'
+
+getinterp + pointer NCI types
+
+=item '@'
+
+slurpy param on a wrapping PIR sub
+
+=item 't'
+
+manual lifetime management of C string buffer through NCI access to
+Parrot_str_to_cstring() and Parrot_str_free_cstring()
+
+=item '0'
+
+null + pointer NCI type
+
+=back
+
+=head4 B<'V', '2', '3', '4', 'B'>
+
+A less type-specific pass-by-reference mechanism is available.
+
+See the bindings for pcre_compile() in runtime/parrot/library/pcre.pir
+for an example of its use.
+
+=head4 B<'b', 'L', 'T'>
+
+These were poorly documented and were broken in their implementation.
+No replacement has been provided as these do not represent desirable behaviour.
+
+=cut
View
135 docs/deprecations/how_to_deprecate.pod
@@ -0,0 +1,135 @@
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+docs/deprecations/how_to_deprecate.pod - How to Deprecate Parrot Code
+
+=head1 How to Deprecate Parrot Code
+
+So you've found a crufty bit of code in Parrot that's just screaming to be
+removed. Welcome to the club. There's a lot of them. This page documents
+the proper procedure to go through to get that junk code out of Parrot while
+causing minimal pain to Parrot's users (i.e. people who develop HLLs or
+libraries on top of Parrot).
+
+=head2 Step 1: Give Notice
+
+=over 4
+
+=item *
+
+file a ticket
+
+=item *
+
+add a note to api.yaml
+
+=item *
+
+maybe post to parrot-dev and/or parrot-users depending on the nature of the change
+
+=item *
+
+get some feedback indicating that the change is sane
+
+=item *
+
+set up automatic usage detection using api.yaml regexes (static usage
+detection) and/or Parrot_warn_deprecated (dynamic usage detection)
+
+=back
+
+=head2 Step 2: Wait
+
+=over 4
+
+=item *
+
+pick an eligible release for the deprecation policy
+
+=item *
+
+backwards-incompatible changes can't happen until a stable release has gone out
+the door with a notification of the coming deprecation
+
+=item *
+
+see:
+http://docs.parrot.org/parrot/latest/html/docs/project/support_policy.pod.html
+Parrot Release and Support Policy for more information
+
+=back
+
+=head2 Step 3: Patch
+
+=over 4
+
+=item *
+
+write the code, possibly in a branch
+
+=item *
+
+unless it's highly impractical, maintain backwards-compatibility to ease the
+migration - this also means you can commit your changes immediately and remove
+the deprecated interface later
+
+=item *
+
+test your changes with current HLLs and libraries such as partcl-nqp, Rakudo,
+winxed, Kakapo, etc
+
+=back
+
+=head2 Step 4: Document
+
+=over 4
+
+=item *
+
+add a summary of your change to ParrotDeprecations
+
+=item *
+
+add a complete description to the appropriate version transition deprecations
+page (e.g. [wiki:ParrotDeprecationsFor2.6 ParrotDeprecationsFor2.6])
+
+=item *
+
+walk through the the documentation to ensure that it's sufficient for a user to
+use to upgrade his or her code
+
+=item *
+
+Add the tag of "completed" to the entry in api.yaml
+
+=back
+
+=head2 Step 5: Apply
+
+=over 4
+
+=item *
+
+make sure the HLLs and libraries are ready the deprecation (and submit patches
+if not)
+
+=item *
+
+merge or commit your backwards-incompatible changes to master
+
+=item *
+
+close the deprecation ticket, linking to the wiki transition documentation
+
+=item *
+
+bump PBC_COMPAT and run mk_native_pbc if needed
+
+=item *
+
+that's it
+
+=back
+
+=cut
View
2  docs/embed.pod
@@ -1025,8 +1025,6 @@ The list may also be augmented if additional functionality is required.
=item C<Parrot_PMC_delprop>
-=item C<Parrot_PMC_destroy>
-
=item C<Parrot_PMC_divide>
=item C<Parrot_PMC_divide_float>
View
12 docs/index/developer.json
@@ -35,6 +35,18 @@
},
{
"source" : [
+ "docs/deprecations/deprecations.pod",
+ "docs/deprecations/deprecations_3_6.pod",
+ "docs/deprecations/deprecations_3_3.pod",
+ "docs/deprecations/deprecations_3_0.pod",
+ "docs/deprecations/deprecations_2_9.pod",
+ "docs/deprecations/deprecations_2_6.pod",
+ "docs/deprecations/how_to_deprecate.pod"
+ ],
+ "title" : "Deprecations"
+ },
+ {
+ "source" : [
"docs/user/pir/*",
"docs/pmc/array.pod",
"docs/pmc/struct.pod",
View
39 docs/project/git_workflow.pod
@@ -14,7 +14,7 @@ does one thing, so that it makes it easier to accept/revert some things while
keeping others. Git provides many powerful tools in the maintenance of
branches. This document aims to provide everything a Parrot developer needs to
know about Git to successfully create a branch, work on it, keep it in sync
-with changes on master and finally merge the branch.
+with changes on master and finally merge the branch (or send a pull request).
=head2 Cloning the Git Repository
@@ -128,8 +128,10 @@ stuff that will be included in your next commit):
git add foo.c bar.c
-The command C<git add> is not only for adding new files, just keep that in mind.
-It tells git "add the state of these files to my staging area."
+The command C<git add> is not only for adding new files, just keep that in
+mind. It tells git "add the *current* state of these files to my staging
+area." If these files change after you C<git add> them, they will need to be
+added again.
If you are trying to add files that are in .gitignore, you can do that with
the --force flag:
@@ -368,12 +370,39 @@ ye will.
NOTE: This is not official policy, and could change at any time.
+ALSO NOTE: With the introduction of the magical Github Merge Button, doesn't
+this seem like a ridiculous amount of work to accept code from a fork? This
+workflow is still useful if you want to run tests or do any other analysis
+on the pull request.
+
If you are merging code from non-core committers, Parrot would like to see
"Signed-off-by" lines on each commit, so it is clear that one person wrote the
code and someone else is taking responsibility for merging the code.
-To merge in a pull request on Github, the following method should be used.
-Follow the first two steps on the Github pull request page, i.e:
+To merge in a pull request on Github, there is the easy way or the hard way.
+The easy way is to use tools/dev/merge_pull_request.pl like so:
+
+ perl $PARROT/tools/dev/merge_pull_request.pl N
+
+where N is the number of the pull request. This will create a branch for the
+pull request and plop you on it, so that tests or other analyses can be run.
+
+This script can be used to merge a pull request for any repo in the Parrot
+Github Organization. For instance, to merge Cardinal Pull request #4:
+
+ perl $PARROT/tools/dev/merge_pull_request.pl 4 cardinal
+
+If you do not want the default branch name, you can specify a third
+argument to specify one:
+
+ perl $PARROT/tools/dev/merge_pull_request.pl 4 cardinal awesome_feature
+
+This will merge pull request #4 in the cardinal repo into a branch
+called 'awesome_feature'.
+
+Run C<perldoc tools/dev/merge_pull_request.pl> for more info.
+
+The hard way: Follow the first two steps on the Github pull request page, i.e:
# 1) Make a new branch to pull stuff into
git checkout -b someguy-newbranch master
View
2  include/parrot/compiler.h
@@ -106,7 +106,7 @@
* get "_unused" added to them so that you can't accidentally use them
* without removing the shim designation.
*/
-#define SHIM(a) /*@unused@*/ /*@null@*/ a ##_unused __attribute__unused__
+#define SHIM(a) /*@unused@*/ a ##_unused __attribute__unused__
/* UNUSED() is the old way we handled shim arguments Should still be
used in cases where the argument should, at some point be used.
View
167 lib/Parrot/Test.pm
@@ -23,79 +23,99 @@ Write individual tests like this:
This module provides various Parrot-specific test functions.
-=head2 Functions
+=head2 Function Parameters
+
+=over 4
+
+=item C<$language>
+
+The language of the code being tested.
+
+=item C<$code>
-The parameter C<$language> is the language of the code.
-The parameter C<$code> is the code that should be executed or transformed.
-The parameter C<$expected> is the expected result.
-The parameter C<$unexpected> is the unexpected result.
-The parameter C<$description> should describe the test.
+The code that should be executed or transformed.
-Any optional parameters can follow. For example, to mark a test as a TODO test
-(where you know the implementation does not yet work), pass:
+=item C<$expected>
+
+The expected result.
+
+=item C<$unexpected>
+
+The unexpected result.
+
+=item C<$description>
+
+A short description of the test.
+
+=back
+
+Any optional parameters can follow. For example, to mark a test as a TODO test
+(where you know the implementation does not work yet), pass:
todo => 'reason to consider this TODO'
-at the end of the argument list. Valid reasons include C<bug>,
+at the end of the argument list. Valid reasons include C<bug>,
C<unimplemented>, and so on.
B<Note:> you I<must> use a C<$description> with TODO tests.
+=head2 Functions
+
=over 4
-=item C<language_output_is( $language, $code, $expected, $description)>
+=item C<language_output_is($language, $code, $expected, $description)>
-=item C<language_error_output_is( $language, $code, $expected, $description)>
+=item C<language_error_output_is($language, $code, $expected, $description)>
Runs a language test and passes the test if a string comparison
-of the output with the expected result it true.
-For C<language_error_output_is()> the exit code also has to be non-zero.
+of the output with the expected result is true. For
+C<language_error_output_is()>, the exit code also has to be non-zero.
-=item C<language_output_like( $language, $code, $expected, $description)>
+=item C<language_output_like($language, $code, $expected, $description)>
-=item C<language_error_output_like( $language, $code, $expected, $description)>
+=item C<language_error_output_like($language, $code, $expected, $description)>
Runs a language test and passes the test if the output matches the expected
-result.
-For C<language_error_output_like()> the exit code also has to be non-zero.
+result. For C<language_error_output_like()>, the exit code also has to be
+non-zero.
-=item C<language_output_isnt( $language, $code, $expected, $description)>
+=item C<language_output_isnt($language, $code, $expected, $description)>
-=item C<language_error_output_isnt( $language, $code, $expected, $description)>
+=item C<language_error_output_isnt($language, $code, $expected, $description)>
Runs a language test and passes the test if a string comparison
-if a string comparison of the output with the unexpected result is false.
-For C<language_error_output_isnt()> the exit code also has to be non-zero.
+of the output with the unexpected result is false. For
+C<language_error_output_isnt()>, the exit code also has to be non-zero.
=item C<pasm_output_is($code, $expected, $description)>
-Runs the Parrot Assembler code and passes the test if a string comparison of
-the output with the expected result it true.
+Runs the PASM code and passes the test if a string comparison of
+the output with the expected result is true.
=item C<pasm_error_output_is($code, $expected, $description)>
-Runs the Parrot Assembler code and passes the test if a string comparison of
-the output with the expected result it true I<and> if Parrot exits with a
+Runs the PASM code and passes the test if a string comparison of
+the output with the expected result is true I<and> if Parrot exits with a
non-zero exit code.
=item C<pasm_output_like($code, $expected, $description)>
-Runs the Parrot Assembler code and passes the test if the output matches
+Runs the PASM code and passes the test if the output matches
C<$expected>.
=item C<pasm_error_output_like($code, $expected, $description)>
-Runs the Parrot Assembler code and passes the test if the output matches
+Runs the PASM code and passes the test if the output matches
C<$expected> I<and> if Parrot exits with a non-zero exit code.
=item C<pasm_output_isnt($code, $unexpected, $description)>
-Runs the Parrot Assembler code and passes the test if a string comparison of
+Runs the PASM code and passes the test if a string comparison of
the output with the unexpected result is false.
=item C<pasm_error_output_isnt($code, $unexpected, $description)>
-Runs the Parrot Assembler code and passes the test if a string comparison of
+Runs the PASM code and passes the test if a string comparison of
the output with the unexpected result is false I<and> if Parrot exits with a
non-zero exit code.
@@ -106,21 +126,23 @@ fails the test otherwise.
=item C<pir_output_is($code, $expected, $description)>
-Runs the PIR code and passes the test if a string comparison of output with the
-expected result is true.
+Runs the PIR code and passes the test if a string comparison of the output
+with the expected result is true.
=item C<pir_error_output_is($code, $expected, $description)>
-Runs the PIR code and passes the test if a string comparison of output with the
-expected result is true I<and> if Parrot exits with a non-zero exit code.
+Runs the PIR code and passes the test if a string comparison of the output
+with the expected result is true I<and> if Parrot exits with a non-zero exit
+code.
=item C<pir_output_like($code, $expected, $description)>
-Runs the PIR code and passes the test if output matches the expected result.
+Runs the PIR code and passes the test if the output matches the expected
+result.
=item C<pir_error_output_like($code, $expected, $description)>
-Runs the PIR code and passes the test if output matches the expected result
+Runs the PIR code and passes the test if the output matches the expected result
I<and> if Parrot exits with a non-zero exit code.
=item C<pir_output_isnt($code, $unexpected, $description)>
@@ -141,66 +163,67 @@ fails the test otherwise.
=item C<pbc_output_is($code, $expected, $description)>
-Runs the Parrot Bytecode and passes the test if a string comparison of output
-with the expected result is true.
+Runs the Parrot bytecode and passes the test if a string comparison of the
+output with the expected result is true.
=item C<pbc_error_output_is($code, $expected, $description)>
-Runs the Parrot Bytecode and passes the test if a string comparison of the output
-with the expected result is true I<and> if Parrot exits with a non-zero exit code.
+Runs the Parrot bytecode and passes the test if a string comparison of the
+output with the expected result is true I<and> if Parrot exits with a non-zero
+exit code.
=item C<pbc_output_like($code, $expected, $description)>
-Runs the Parrot Bytecode and passes the test if output matches the expected
+Runs the Parrot bytecode and passes the test if the output matches the expected
result.
=item C<pbc_error_output_like($code, $expected, $description)>
-Runs the Parrot Bytecode and passes the test if output matches the expected
+Runs the Parrot bytecode and passes the test if the output matches the expected
result I<and> if Parrot exits with a non-zero exit code.
=item C<pbc_output_isnt($code, $unexpected, $description)>
-Runs the Parrot Bytecode and passes the test if a string comparison of output
-with the unexpected result is false.
+Runs the Parrot bytecode and passes the test if a string comparison of the
+output with the unexpected result is false.
=item C<pbc_error_output_isnt($code, $unexpected, $description)>
-Runs the Parrot Bytecode and passes the test if a string comparison of output
-with the unexpected result is false I<and> if Parrot exits with a non-zero exit
-code.
+Runs the Parrot bytecode and passes the test if a string comparison of the
+output with the unexpected result is false I<and> if Parrot exits with a
+non-zero exit code.
=item C<pbc_exit_code_is($code, $exit_code, $description)>
-Runs the Parrot Bytecode and passes the test if the exit code equals $exit_code,
+Runs the Parrot bytecode and passes the test if the exit code equals $exit_code,
fails the test otherwise.
=item C<c_output_is($code, $expected, $description, %options)>
-Compiles and runs the C code, passing the test if a string comparison of output
-with the expected result it true. Valid options are 'todo' => 'reason' to mark
-a TODO test.
+Compiles and runs the C code, passing the test if a string comparison of the
+output with the expected result is true. Valid options are 'todo' => 'reason'
+to mark a TODO test.
=item C<c_output_like($code, $expected, $description, %options)>
-Compiles and runs the C code, passing the test if output matches the expected
-result. Valid options are 'todo' => 'reason' to mark a TODO test.
+Compiles and runs the C code, passing the test if the output matches the
+expected result. Valid options are 'todo' => 'reason' to mark a TODO test.
=item C<c_output_isnt($code, $unexpected, $description, %options)>
-Compiles and runs the C code, passing the test if a string comparison of output
-with the unexpected result is false. Valid options are 'todo' => 'reason' to
-mark a TODO test.
+Compiles and runs the C code, passing the test if a string comparison of the
+output with the unexpected result is false. Valid options are
+'todo' => 'reason' to mark a TODO test.
-=item C<example_output_is( $example_f, $expected, @todo )>
+=item C<example_output_is($example_f, $expected, @todo)>
-=item C<example_output_like( $example_f, $expected, @todo )>
+=item C<example_output_like($example_f, $expected, @todo)>
-=item C<example_output_isnt( $example_f, $expected, @todo )>
+=item C<example_output_isnt($example_f, $expected, @todo)>
Determines the language, PIR or PASM, from the extension of C<$example_f> and runs
-the appropriate C<^language_output_(is|like|isnt)> sub.
-C<$example_f> is used as a description, so don't pass one.
+the appropriate C<language_output_(is|like|isnt)> subroutine. C<$example_f> is
+used as a description, so don't pass one.
=item C<skip($why, $how_many)>
@@ -224,32 +247,30 @@ For example:
=item C<slurp_file($file_name)>
-Read the whole file $file_name and return the content as a string. This is
+Read the whole file $file_name and return the content as a string. This is
just an alias for C<Parrot::BuildUtil::slurp_file>.
=item C<convert_line_endings($text)>
-Convert Win32 style line endins with Unix style line endings.
+Convert Win32 style line endings with Unix style line endings.
=item C<path_to_parrot()>
-Construct an absolute path to the parrot root dir.
+Construct an absolute path to the Parrot root directory.
-=item C<per_test( $ext, $test_no )>
+=item C<per_test($ext, $test_no)>
-Construct a path for a temporary files.
-Takes C<$0> into account.
+Construct a path for temporary files. Takes C<$0> into account.
=item C<write_code_to_file($code, $code_f)>
Writes C<$code> into the file C<$code_f>.
-=item C<generate_languages_functions>
+=item C<generate_languages_functions()>
-Generate functions that are only used by a couple of
-Parrot::Test::<lang> modules.
-This implementation is experimental and currently only works
-for languages/pipp.
+Generate functions that are only used by a couple of Parrot::Test::<lang>
+modules. This implementation is experimental and currently only works for
+languages/pipp.
=back
@@ -621,7 +642,7 @@ sub pir_stdin_output_like {
Test::More::like($result, $expected_output, $description);
}
-# The following methods are private. They should not be used by modules
+# The following methods are private. They should not be used by modules
# inheriting from Parrot::Test.
sub _handle_error_output {
@@ -775,7 +796,7 @@ sub _generate_test_functions {
my $args = $ENV{TEST_PROG_ARGS} || '';
# Due to ongoing changes in PBC format, all tests in
- # t/native_pbc/*.t are currently being SKIPped. This means we
+ # t/native_pbc/*.t are currently being SKIPped. This means we
# have no tests on which to model tests of the following block.
# Hence, test coverage will be lacking.
if ( $func =~ /^pbc_output_/ && $args =~ /-r / ) {
View
1  lib/Parrot/Vtable.pm
@@ -317,6 +317,7 @@ sub vtbl_embed {
}
next if $@;
+ next if $name eq "destroy";
my $signature = join( ', ', @sig );
my $arguments = join( ', ', @args );
View
40 src/call/args.c
@@ -110,8 +110,9 @@ static INTVAL intval_constant_from_op(PARROT_INTERP,
PARROT_WARN_UNUSED_RESULT
static INTVAL intval_constant_from_varargs(PARROT_INTERP,
- void *data,
- INTVAL index);
+ ARGIN(void *data),
+ INTVAL index)
+ __attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
@@ -146,8 +147,9 @@ static FLOATVAL numval_constant_from_op(PARROT_INTERP,
PARROT_WARN_UNUSED_RESULT
static FLOATVAL numval_constant_from_varargs(PARROT_INTERP,
- void *data,
- INTVAL index);
+ ARGIN(void *data),
+ INTVAL index)
+ __attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
@@ -183,8 +185,9 @@ static PMC* pmc_constant_from_op(PARROT_INTERP,
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
static PMC* pmc_constant_from_varargs(PARROT_INTERP,
- void *data,
- INTVAL index);
+ ARGIN(void *data),
+ INTVAL index)
+ __attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
@@ -212,8 +215,9 @@ static STRING* string_constant_from_op(PARROT_INTERP,
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
static STRING* string_constant_from_varargs(PARROT_INTERP,
- void *data,
- INTVAL index);
+ ARGIN(void *data),
+ INTVAL index)
+ __attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
@@ -254,7 +258,8 @@ static STRING** string_param_from_op(PARROT_INTERP,
, PARROT_ASSERT_ARG(accessor))
#define ASSERT_ARGS_intval_constant_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(raw_params))
-#define ASSERT_ARGS_intval_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_intval_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(data_unused))
#define ASSERT_ARGS_intval_param_from_c_args __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_intval_param_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -266,7 +271,8 @@ static STRING** string_param_from_op(PARROT_INTERP,
#define ASSERT_ARGS_numval_constant_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(raw_params))
-#define ASSERT_ARGS_numval_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_numval_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(data_unused))
#define ASSERT_ARGS_numval_param_from_c_args __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_numval_param_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -279,7 +285,8 @@ static STRING** string_param_from_op(PARROT_INTERP,
#define ASSERT_ARGS_pmc_constant_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(raw_params))
-#define ASSERT_ARGS_pmc_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_pmc_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(data_unused))
#define ASSERT_ARGS_pmc_param_from_c_args __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_pmc_param_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -288,7 +295,8 @@ static STRING** string_param_from_op(PARROT_INTERP,
#define ASSERT_ARGS_string_constant_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(raw_params))
-#define ASSERT_ARGS_string_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_string_constant_from_varargs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(data_unused))
#define ASSERT_ARGS_string_param_from_c_args __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_string_param_from_op __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -1719,7 +1727,7 @@ pmc_param_from_c_args(SHIM_INTERP, ARGIN(va_list *args), SHIM(INTVAL param_index
PARROT_WARN_UNUSED_RESULT
static INTVAL
-intval_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
+intval_constant_from_varargs(SHIM_INTERP, ARGIN(SHIM(void *data)), SHIM(INTVAL index))
{
ASSERT_ARGS(intval_constant_from_varargs)
PARROT_FAILURE("Wrong call");
@@ -1728,7 +1736,7 @@ intval_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
PARROT_WARN_UNUSED_RESULT
static FLOATVAL
-numval_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
+numval_constant_from_varargs(SHIM_INTERP, ARGIN(SHIM(void *data)), SHIM(INTVAL index))
{
ASSERT_ARGS(numval_constant_from_varargs)
PARROT_FAILURE("Wrong call");
@@ -1738,7 +1746,7 @@ numval_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
static STRING*
-string_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
+string_constant_from_varargs(SHIM_INTERP, ARGIN(SHIM(void *data)), SHIM(INTVAL index))
{
ASSERT_ARGS(string_constant_from_varargs)
PARROT_FAILURE("Wrong call");
@@ -1748,7 +1756,7 @@ string_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
PARROT_CAN_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
static PMC*
-pmc_constant_from_varargs(SHIM_INTERP, SHIM(void *data), SHIM(INTVAL index))
+pmc_constant_from_varargs(SHIM_INTERP, ARGIN(SHIM(void *data)), SHIM(INTVAL index))
{
ASSERT_ARGS(pmc_constant_from_varargs)
PARROT_FAILURE("Wrong call");
View
46 src/dynpmc/os.pmc
@@ -7,7 +7,7 @@ src/pmc/os.pmc - Files and Directories PMC
=head1 DESCRIPTION
-C<OS> is a singleton class which provides access to the filesystem
+C<OS> is a PMC type which provides access to the filesystem
files and directories.
=head2 Methods
@@ -71,34 +71,7 @@ stat_buf_to_array(PARROT_INTERP, ARGIN(const Parrot_Stat_Buf *buf))
return array;
}
-static PMC *OS_PMC;
-pmclass OS dynpmc singleton {
-
-/*
-
-=item C<void *get_pointer()>
-
-=item C<void set_pointer(void *ptr)>
-
-These two functions are part of the singleton creation interface. For more
-information see F<src/pmc.c>.
-
-=cut
-
-*/
-
- void class_init() {
- OS_PMC = NULL;
- }
-
- VTABLE void *get_pointer() {
- return OS_PMC;
- }
-
- VTABLE void set_pointer(void *ptr) {
- OS_PMC = (PMC *)ptr;
- }
-
+pmclass OS dynpmc {
/*
@@ -368,6 +341,21 @@ Returns the ID number of the current user. This is platform-dependent.
RETURN(INTVAL can);
}
+/*
+
+=item C<exists(STRING *filename)>
+
+Determine if the file exists. Return C<1> if it exists. Return C<0> otherwise.
+
+=cut
+
+*/
+
+ METHOD exists(STRING *filename) {
+ const INTVAL e = Parrot_file_stat_intval(INTERP, filename, STAT_EXISTS);
+ RETURN(INTVAL e);
+ }
+
}
/*
View
2  src/gc/alloc_resources.c
@@ -151,7 +151,7 @@ buffer_location(PARROT_INTERP, ARGIN(const Buffer *b))
ASSERT_ARGS(buffer_location)
Parrot_Context * const ctx = CONTEXT(interp);
static char reg[10];
- UINTVAL i;
+ int i;
for (i = 0; i < ctx->n_regs_used[REGNO_STR]; ++i) {
PObj * const obj = (PObj *)Parrot_pcc_get_STRING_reg(interp, ctx, i);
View
16 src/gc/string_gc.c
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2010, Parrot Foundation.
+Copyright (C) 2010-2011, Parrot Foundation.
=head1 NAME
@@ -38,7 +38,8 @@ typedef void (*compact_f) (Interp *, GC_Statistics *stats, Variable_Size_Pool *)
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
-static char * aligned_mem(const Buffer *buffer, ARGIN(char *mem))
+static char * aligned_mem(ARGIN(const Buffer *buffer), ARGIN(char *mem))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2);
static void alloc_new_block(
@@ -126,7 +127,8 @@ static UINTVAL pad_pool_size(ARGIN(const Variable_Size_Pool *pool))
__attribute__nonnull__(1);
#define ASSERT_ARGS_aligned_mem __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem))
+ PARROT_ASSERT_ARG(buffer_unused) \
+ , PARROT_ASSERT_ARG(mem))
#define ASSERT_ARGS_alloc_new_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool) \
@@ -665,7 +667,7 @@ memory alignment.
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
static char *
-aligned_mem(SHIM(const Buffer *buffer), ARGIN(char *mem))
+aligned_mem(ARGIN(SHIM(const Buffer *buffer)), ARGIN(char *mem))
{
ASSERT_ARGS(aligned_mem)
mem += sizeof (void *);
@@ -805,10 +807,10 @@ static void
move_buffer_callback(PARROT_INTERP, ARGIN(Buffer *b), ARGIN(void *data))
{
ASSERT_ARGS(move_buffer_callback)
- Memory_Block *new_block = (Memory_Block *)data;
+ Memory_Block * const new_block = (Memory_Block *)data;
if (Buffer_buflen(b) && PObj_is_movable_TESTALL(b)) {
- Memory_Block *old_block = Buffer_pool(b);
+ Memory_Block * const old_block = Buffer_pool(b);
if (!is_block_almost_full(old_block))
move_one_buffer(interp, new_block, b);
@@ -942,7 +944,7 @@ move_one_buffer(PARROT_INTERP, ARGIN(Memory_Block *pool),
Buffer_bufstart(old_buf) = Buffer_bufstart(hdr);
}
else {
- char *new_pool_ptr = aligned_mem(old_buf, pool->top);
+ char * const new_pool_ptr = aligned_mem(old_buf, pool->top);
/* Copy our memory to the new pool */
memcpy(new_pool_ptr, Buffer_bufstart(old_buf), Buffer_buflen(old_buf));
View
4 src/pmc/structview.pmc
@@ -812,9 +812,9 @@ any other type of element.
break;
case enum_type_sized:
if (VTABLE_does(INTERP, p, CONST_STRING(INTERP, "buffer"))) {
- void *q = VTABLE_get_pointer(INTERP, p);
+ void * const q = VTABLE_get_pointer(INTERP, p);
size_t len = VTABLE_get_integer(INTERP, p);
- if (!len || len > elts[i].size)
+ if (len == 0 || len > elts[i].size)
len = elts[i].size;
memcpy(ptr, q, len);
break;
View
6 src/pmc/unmanagedstruct.pmc
@@ -94,7 +94,7 @@ static PMC* ret_pmc(PARROT_INTERP,
__attribute__nonnull__(3);
PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
+PARROT_CANNOT_RETURN_NULL
static STRING* ret_string(PARROT_INTERP, ARGIN(char *p), int type)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -474,7 +474,7 @@ Returns the element of type C<type> starting at C<*p> as a Parrot string.
*/
PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
+PARROT_CANNOT_RETURN_NULL
static STRING*
ret_string(PARROT_INTERP, ARGIN(char *p), int type)
{
@@ -495,7 +495,7 @@ ret_string(PARROT_INTERP, ARGIN(char *p), int type)
Parrot_latin1_encoding_ptr, 0);
}
else
- return NULL;
+ return STRINGNULL;
}
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
View
37 t/dynpmc/foo-01.t
@@ -0,0 +1,37 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+=head1 NAME
+
+t/dynpmc/foo-01.t - Test for a very simple dynamic PMC
+
+=head1 SYNOPSIS
+
+ % prove t/dynpmc/foo-*.t
+
+=head1 DESCRIPTION
+
+Tests the dynamic loading of the Foo DynPMC.
+
+Note that each test of dynamically loading this PMC must be in its own
+individual file, because a DynPMC cannot be unloaded, so having more than
+one loadlib per file will produce false positives. See TT#1217 for more detail.
+
+=cut
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ loadlib $P1, "foo_group"
+ $P1 = new "Foo"
+
+ $I1 = $P1
+ is($I1, 42, 'get integer')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
19 t/dynpmc/foo-02.t
@@ -0,0 +1,19 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ loadlib $P1, 'foo_group'
+ sweep 1
+ $P2 = getprop '_type', $P1
+ $S0 = $P2
+ is($S0, 'PMC', 'ParrotLibrary props survive GC')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
23 t/dynpmc/foo-03.t
@@ -0,0 +1,23 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ ## load a relative pathname without the extension. loadlib will convert the
+ ## '/' characters to '\\' on windows.
+ $S0 = "runtime/parrot/dynext/foo_group"
+ loadlib $P1, $S0
+
+ ## ensure that we can still make Foo instances.
+ $P1 = new "Foo"
+ $I1 = $P1
+ is($I1, 42, 'test loadlib with relative pathname, no ext')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
30 t/dynpmc/foo-04.t
@@ -0,0 +1,30 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ ## get cwd in $S0.
+ .include "iglobals.pasm"
+ $P11 = getinterp
+ $P12 = $P11[.IGLOBALS_CONFIG_HASH]
+ $S0 = $P12["prefix"]
+
+ ## convert cwd to an absolute pathname without the extension, and load it.
+ ## this should always find the version in the build directory, since that's
+ ## the only place "make test" will work.
+ $S0 .= "/runtime/parrot/dynext/foo_group"
+ loadlib $P1, $S0
+
+ ## ensure that we can still make Foo instances.
+ $P1 = new "Foo"
+ $I1 = $P1
+ is($I1, 42, 'loadlib with absolute pathname, no ext')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
28 t/dynpmc/foo-05.t
@@ -0,0 +1,28 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ ## get load_ext in $S0.
+ .include "iglobals.pasm"
+ $P11 = getinterp
+ $P12 = $P11[.IGLOBALS_CONFIG_HASH]
+ $S0 = $P12["load_ext"]
+
+ ## load a relative pathname with an extension.
+ $S0 = concat "runtime/parrot/dynext/foo_group", $S0
+ loadlib $P1, $S0
+
+ ## ensure that we can still make Foo instances.
+ $P1 = new "Foo"
+ $I1 = $P1
+ is($I1, 42, 'loadlib with relative pathname & ext')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
32 t/dynpmc/foo-06.t
@@ -0,0 +1,32 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ ## get cwd in $S0, load_ext in $S1.
+ .include "iglobals.pasm"
+ $P11 = getinterp
+ $P12 = $P11[.IGLOBALS_CONFIG_HASH]
+ $S0 = $P12["prefix"]
+ $S1 = $P12["load_ext"]
+
+ ## convert $S0 to an absolute pathname with extension, and load it.
+ ## this should always find the version in the build directory, since that's
+ ## the only place "make test" will work.
+ $S0 = concat $S0, "/runtime/parrot/dynext/foo_group"
+ $S0 = concat $S0, $S1
+ loadlib $P1, $S0
+
+ ## ensure that we can still make Foo instances.
+ $P1 = new "Foo"
+ $I1 = $P1
+ is($I1, 42, 'loadlib with absolute pathname & ext')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
36 t/dynpmc/foo-07.t
@@ -0,0 +1,36 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(3)
+
+ .include "iglobals.pasm"
+ .local pmc config_hash, interp
+ .local pmc d, l, r
+ interp = getinterp
+ config_hash = interp[.IGLOBALS_CONFIG_HASH]
+ $S0 = config_hash['gmp']
+ unless $S0 goto no_bigint
+
+ $P0 = loadlib "foo_group"
+ ok(1, 'inherited add - loadlib')
+ l = new "Foo"
+ l = 42
+ r = new 'BigInt'
+ r = 0x7ffffff
+ d = new 'Undef'
+ add d, l, r
+ is(d, 134217769, 'inherited add')
+ $S0 = typeof d
+ is($S0, 'BigInt', 'inherited add - typeof')
+ .return()
+ no_bigint:
+ skip( 3, 'No BigInt Lib configured' )
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
23 t/dynpmc/foo-08.t
@@ -0,0 +1,23 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ .local pmc F, f, d, r
+ loadlib F, "foo_group"
+ f = new "Foo"
+ f = 1
+ d = new 'Integer'
+ r = new 'Integer'
+ r = 2
+ d = f - r
+ is(d, 144, 'Foo subclass isa Integer')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
22 t/dynpmc/foo-09.t
@@ -0,0 +1,22 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+# load our Foo test (pseudo) language
+# it defines one PMC type "Foo"
+.HLL "Fool"
+.loadlib "foo_group"
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ new $P1, "Foo" # load by name
+ $I1 = $P1
+ is($I1, 42, '.HLL 1')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
22 t/dynpmc/foo-10.t
@@ -0,0 +1,22 @@
+#! parrot
+# Copyright (C) 2011, Parrot Foundation.
+
+# load our Foo test (pseudo) language
+# it defines one PMC type "Foo"
+.HLL "Fool"
+.loadlib "foo_group"
+
+.sub main :main
+ .include 'test_more.pir'
+ plan(1)
+
+ new $P1, 'Foo' # load by index
+ $I1 = $P1
+ is($I1, 42, '.HLL 2')
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
View
217 t/dynpmc/foo.t
@@ -1,217 +0,0 @@
-#! perl
-# Copyright (C) 2005, Parrot Foundation.
-
-use strict;
-use warnings;
-use lib qw( . lib ../lib ../../lib );
-use Test::More;
-use Parrot::Test tests => 10;
-use Parrot::Config;
-
-=head1 NAME
-
-t/dynpmc/foo.t - Test for a very simple dynamic PMC
-
-=head1 SYNOPSIS
-
- % prove t/dynpmc/foo.t
-
-=head1 DESCRIPTION
-
-Tests the Foo PMC.
-
-=cut
-
-pir_output_is( << 'CODE', << 'OUTPUT', "get_integer" );
-
-.sub main :main
- loadlib $P1, "foo_group"
- $P1 = new "Foo"
-
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', "ParrotLibrary props survive GC" );
-.sub main :main
- loadlib $P1, 'foo_group'
- sweep 1
- $P2 = getprop '_type', $P1
- say $P2
-.end
-CODE
-PMC
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with relative pathname, no ext" );
-.sub main :main
- ## load a relative pathname without the extension. loadlib will convert the
- ## '/' characters to '\\' on windows.
- $S0 = "runtime/parrot/dynext/foo_group"
- loadlib $P1, $S0
-
- ## ensure that we can still make Foo instances.
- $P1 = new "Foo"
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with absolute pathname, no ext" );
-.sub main :main
- ## get cwd in $S0.
- .include "iglobals.pasm"
- $P11 = getinterp
- $P12 = $P11[.IGLOBALS_CONFIG_HASH]
- $S0 = $P12["prefix"]
-
- ## convert cwd to an absolute pathname without the extension, and load it.
- ## this should always find the version in the build directory, since that's
- ## the only place "make test" will work.
- $S0 .= "/runtime/parrot/dynext/foo_group"
- loadlib $P1, $S0
-
- ## ensure that we can still make Foo instances.
- $P1 = new "Foo"
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with relative pathname & ext" );
-.sub main :main
- ## get load_ext in $S0.
- .include "iglobals.pasm"
- $P11 = getinterp
- $P12 = $P11[.IGLOBALS_CONFIG_HASH]
- $S0 = $P12["load_ext"]
-
- ## load a relative pathname with an extension.
- $S0 = concat "runtime/parrot/dynext/foo_group", $S0
- loadlib $P1, $S0
-
- ## ensure that we can still make Foo instances.
- $P1 = new "Foo"
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', "loadlib with absolute pathname & ext" );
-.sub main :main
- ## get cwd in $S0, load_ext in $S1.
- .include "iglobals.pasm"
- $P11 = getinterp
- $P12 = $P11[.IGLOBALS_CONFIG_HASH]
- $S0 = $P12["prefix"]
- $S1 = $P12["load_ext"]
-
- ## convert $S0 to an absolute pathname with extension, and load it.
- ## this should always find the version in the build directory, since that's
- ## the only place "make test" will work.
- $S0 = concat $S0, "/runtime/parrot/dynext/foo_group"
- $S0 = concat $S0, $S1
- loadlib $P1, $S0
-
- ## ensure that we can still make Foo instances.
- $P1 = new "Foo"
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-SKIP: {
- skip( "No BigInt Lib configured", 1 ) if !$PConfig{gmp};
-
- pir_output_is( << 'CODE', << 'OUTPUT', "inherited add" );
-.sub _main :main
- .local pmc d, l, r
- $P0 = loadlib "foo_group"
- print "ok\n"
- l = new "Foo"
- l = 42
- r = new 'BigInt'
- r = 0x7ffffff
- d = new 'Undef'
- add d, l, r
- print d
- print "\n"
- $S0 = typeof d
- print $S0
- print "\n"
-.end
-CODE
-ok
-134217769
-BigInt
-OUTPUT
-
-}
-
-pir_output_is( <<'CODE', <<'OUTPUT', "Foo subclass isa Integer" );
-.sub main :main
- .local pmc F, f, d, r
- loadlib F, "foo_group"
- f = new "Foo"
- f = 1
- d = new 'Integer'
- r = new 'Integer'
- r = 2
- d = f - r
- print d
- print "\n"
-.end
-CODE
-144
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', ".HLL 1" );
-# load our Foo test (pseudo) language
-# it defines one PMC type "Foo"
-.HLL "Fool"
-.loadlib "foo_group"
-.sub main :main
- new $P1, "Foo" # load by name
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-pir_output_is( << 'CODE', << 'OUTPUT', ".HLL 2" );
-.HLL "Fool"
-.loadlib "foo_group"
-.sub main :main
- new $P1, 'Foo' # load by index
- $I1 = $P1
- print $I1
- print "\n"
-.end
-CODE
-42
-OUTPUT
-
-# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
View
23 t/harness
@@ -1,5 +1,5 @@
#!perl
-# Copyright (C) 2001-2009, Parrot Foundation.
+# Copyright (C) 2001-2011, Parrot Foundation.
use strict;
use warnings;
@@ -105,10 +105,11 @@ else {
}
else {
$harness = TAP::Harness->new({
- verbosity => $ENV{HARNESS_VERBOSE},
- merge => 0,
- jobs => $ENV{TEST_JOBS} || 1,
+ verbosity => $ENV{HARNESS_VERBOSE},
+ merge => 0,
+ jobs => $ENV{TEST_JOBS} || 1,
directives => 1,
+ timer => $ENV{HARNESS_TIMER} || 0,
});
}
my $results = $harness->runtests(@tests);
@@ -126,6 +127,8 @@ t/harness - Parrot Test Harness