[svn:parrot] r49253 - in branches/typesafe_consttable: . compilers/imcc compilers/opsc/src/Ops/Trans compilers/pct/src/PAST config/gen/makefiles docs docs/pdds/draft docs/project include/parrot include/parrot/oplib runtime/parrot/library/LWP src src/gc src/interp src/io src/ops src/packfile src/pmc src/runcore src/string t/dynoplibs t/pmc t/run t/src tools/dev tools/release
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Thu Sep 23 03:38:50 UTC 2010
Author: plobsing
Date: Thu Sep 23 03:38:47 2010
New Revision: 49253
URL: https://trac.parrot.org/parrot/changeset/49253
Log:
sync with trunk
Deleted:
branches/typesafe_consttable/docs/pdds/draft/pdd31_hll_interop.pod
Modified:
branches/typesafe_consttable/ (props changed)
branches/typesafe_consttable/CREDITS
branches/typesafe_consttable/ChangeLog
branches/typesafe_consttable/MANIFEST
branches/typesafe_consttable/MANIFEST.generated
branches/typesafe_consttable/PBC_COMPAT
branches/typesafe_consttable/README
branches/typesafe_consttable/VERSION
branches/typesafe_consttable/compilers/imcc/pbc.c
branches/typesafe_consttable/compilers/imcc/symreg.c
branches/typesafe_consttable/compilers/opsc/src/Ops/Trans/C.pm
branches/typesafe_consttable/compilers/pct/src/PAST/Compiler.pir
branches/typesafe_consttable/config/gen/makefiles/root.in
branches/typesafe_consttable/docs/parrothist.pod
branches/typesafe_consttable/docs/project/release_manager_guide.pod
branches/typesafe_consttable/include/parrot/hash.h
branches/typesafe_consttable/include/parrot/oplib.h
branches/typesafe_consttable/include/parrot/oplib/core_ops.h
branches/typesafe_consttable/include/parrot/runcore_trace.h (props changed)
branches/typesafe_consttable/runtime/parrot/library/LWP/Protocol.pir
branches/typesafe_consttable/src/gc/system.c
branches/typesafe_consttable/src/hash.c
branches/typesafe_consttable/src/interp/inter_create.c (props changed)
branches/typesafe_consttable/src/io/utf8.c
branches/typesafe_consttable/src/main.c
branches/typesafe_consttable/src/ops/core_ops.c
branches/typesafe_consttable/src/packfile/pf_items.c
branches/typesafe_consttable/src/pmc/codestring.pmc
branches/typesafe_consttable/src/pmc/exceptionhandler.pmc
branches/typesafe_consttable/src/pmc/filehandle.pmc
branches/typesafe_consttable/src/pmc/hash.pmc
branches/typesafe_consttable/src/pmc/hashiterator.pmc
branches/typesafe_consttable/src/pmc/imageiothaw.pmc
branches/typesafe_consttable/src/pmc/lexpad.pmc
branches/typesafe_consttable/src/pmc/nci.pmc
branches/typesafe_consttable/src/runcore/cores.c (props changed)
branches/typesafe_consttable/src/runcore/main.c
branches/typesafe_consttable/src/runcore/trace.c (contents, props changed)
branches/typesafe_consttable/src/scheduler.c
branches/typesafe_consttable/src/string/api.c
branches/typesafe_consttable/t/dynoplibs/trans-infnan.t
branches/typesafe_consttable/t/pmc/bytebuffer.t
branches/typesafe_consttable/t/pmc/exceptionhandler.t
branches/typesafe_consttable/t/pmc/hash.t
branches/typesafe_consttable/t/pmc/io.t
branches/typesafe_consttable/t/pmc/stringbuilder.t
branches/typesafe_consttable/t/run/options.t
branches/typesafe_consttable/t/src/embed.t (props changed)
branches/typesafe_consttable/tools/dev/mk_gitignore.pl (props changed)
branches/typesafe_consttable/tools/release/release.json
Modified: branches/typesafe_consttable/CREDITS
==============================================================================
--- branches/typesafe_consttable/CREDITS Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/CREDITS Thu Sep 23 03:38:47 2010 (r49253)
@@ -402,7 +402,7 @@
N: Gerd Pokorra
E: pokorra at uni-siegen.de
-D: Release manager for 1.9.0, 2.3.0 and 2.5.0
+D: Release manager for 1.9.0, 2.3.0, 2.5.0 and 2.8.0
N: Goplat
D: Win98 and other fixes.
Modified: branches/typesafe_consttable/ChangeLog
==============================================================================
--- branches/typesafe_consttable/ChangeLog Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/ChangeLog Thu Sep 23 03:38:47 2010 (r49253)
@@ -1,8 +1,12 @@
#1 $Id$
+2010.09.21 Gerd
+ * Released 2.8.0
+ See NEWS for more.
+
2010.08.17 mikehh
- * Released 2.7.0
- See NEWS for more.
+ * Released 2.7.0
+ See NEWS for more.
2010.07.10 coke
* Released 2.6.0
Modified: branches/typesafe_consttable/MANIFEST
==============================================================================
--- branches/typesafe_consttable/MANIFEST Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/MANIFEST Thu Sep 23 03:38:47 2010 (r49253)
@@ -432,7 +432,6 @@
docs/pdds/draft/pdd16_native_call.pod [doc]
docs/pdds/draft/pdd29_compiler_tools.pod [doc]
docs/pdds/draft/pdd31_hll.pod [doc]
-docs/pdds/draft/pdd31_hll_interop.pod [doc]
docs/pdds/pdd00_pdd.pod [doc]
docs/pdds/pdd03_calling_conventions.pod [doc]
docs/pdds/pdd07_codingstd.pod [doc]
Modified: branches/typesafe_consttable/MANIFEST.generated
==============================================================================
--- branches/typesafe_consttable/MANIFEST.generated Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/MANIFEST.generated Thu Sep 23 03:38:47 2010 (r49253)
@@ -2,11 +2,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.2.7.0.dylib [main]lib
+blib/lib/libparrot.2.8.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.2.7.0 [main]lib
+blib/lib/libparrot.so.2.8.0 [main]lib
compilers/data_json/data_json.pbc [data_json]
config/gen/call_list/opengl.in []
docs/ops/bit.pod [doc]
Modified: branches/typesafe_consttable/PBC_COMPAT
==============================================================================
--- branches/typesafe_consttable/PBC_COMPAT Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/PBC_COMPAT Thu Sep 23 03:38:47 2010 (r49253)
@@ -28,6 +28,7 @@
# please insert tab separated entries at the top of the list
+8.4 2010.09.19 cotto add imageiothaw and imageiofreeze PMCs (plobsing)
8.3 2010.09.15 luben removed logical vtables
8.2 2010.08.19 cotto minor version bump for 2.7.0
8.1 2010.08.10 plobsing merge dynop_mapping branch
Modified: branches/typesafe_consttable/README
==============================================================================
--- branches/typesafe_consttable/README Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/README Thu Sep 23 03:38:47 2010 (r49253)
@@ -1,4 +1,4 @@
-This is Parrot, version 2.7.0
+This is Parrot, version 2.8.0
------------------------------
Parrot is Copyright (C) 2001-2010, Parrot Foundation.
Modified: branches/typesafe_consttable/VERSION
==============================================================================
--- branches/typesafe_consttable/VERSION Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/VERSION Thu Sep 23 03:38:47 2010 (r49253)
@@ -1 +1 @@
-2.7.0
+2.8.0
Modified: branches/typesafe_consttable/compilers/imcc/pbc.c
==============================================================================
--- branches/typesafe_consttable/compilers/imcc/pbc.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/compilers/imcc/pbc.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -633,11 +633,11 @@
static
opcode_t
bytecode_map_op(PARROT_INTERP, op_info_t *info) {
- int i;
op_lib_t *lib = info->lib;
op_func_t op_func = OP_INFO_OPFUNC(info);
PackFile_ByteCode *bc = interp->code;
PackFile_ByteCode_OpMappingEntry *om;
+ opcode_t i;
for (i = 0; i < bc->op_mapping.n_libs; i++) {
if (lib == bc->op_mapping.libs[i].lib) {
Modified: branches/typesafe_consttable/compilers/imcc/symreg.c
==============================================================================
--- branches/typesafe_consttable/compilers/imcc/symreg.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/compilers/imcc/symreg.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -859,11 +859,14 @@
}
errno = 0;
+
if (base == 10) {
- (void)strtol(digits, NULL, base);
+ long int unused = strtol(digits, NULL, base);
+ UNUSED(unused);
}
else {
- (void)strtoul(digits + 2, NULL, base);
+ unsigned long int unused = strtoul(digits + 2, NULL, base);
+ UNUSED(unused);
}
return errno ? 1 : 0;
Modified: branches/typesafe_consttable/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- branches/typesafe_consttable/compilers/opsc/src/Ops/Trans/C.pm Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/compilers/opsc/src/Ops/Trans/C.pm Thu Sep 23 03:38:47 2010 (r49253)
@@ -359,7 +359,7 @@
HOP *hops = hop_buckets =
mem_gc_allocate_n_zeroed_typed(interp, [[BS]]op_lib.op_count * 2, HOP );
- size_t i;
+ opcode_t i;
/* store full names */
for (i = 0; i < [[BS]]op_lib.op_count; i++) {
Modified: branches/typesafe_consttable/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/typesafe_consttable/compilers/pct/src/PAST/Compiler.pir Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/compilers/pct/src/PAST/Compiler.pir Thu Sep 23 03:38:47 2010 (r49253)
@@ -931,9 +931,8 @@
$S0 = self.'unique'('control_')
ctrllabel = $P0.'new'('result'=>$S0)
$S0 = self.'uniquereg'('P')
- bpost.'push_pirop'('new', $S0, "'ExceptionHandler'")
+ bpost.'push_pirop'('new', $S0, "['ExceptionHandler']", '.CONTROL_RETURN')
bpost.'push_pirop'('set_addr', $S0, ctrllabel)
- bpost.'push_pirop'('callmethod', '"handle_types"', $S0, '.CONTROL_RETURN')
bpost.'push_pirop'('push_eh', $S0)
bpost.'add_directive'('.include "except_types.pasm"')
Modified: branches/typesafe_consttable/config/gen/makefiles/root.in
==============================================================================
--- branches/typesafe_consttable/config/gen/makefiles/root.in Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/config/gen/makefiles/root.in Thu Sep 23 03:38:47 2010 (r49253)
@@ -1574,7 +1574,7 @@
src/spf_vtable$(O) : $(PARROT_H_HEADERS) src/spf_vtable.str src/spf_vtable.c
-src/string/encoding$(O) : $(PARROT_H_HEADERS)
+src/string/encoding$(O) : $(PARROT_H_HEADERS) src/string/encoding.c
src/string/encoding/tables$(O) : $(PARROT_H_HEADERS) \
src/string/encoding/tables.h
@@ -2523,7 +2523,7 @@
src/nci_test$(O): $(PARROT_H_HEADERS) src/nci_test.c
$(CC) $(CFLAGS) @optimize::src/nci_test.c@ @ccwarn::src/nci_test.c@ @cc_shared@ -I$(@D) @cc_o_out@$@ -c src/nci_test.c
-$(LIBNCI_TEST_SO): src/nci_test$(O) $(LIBPARROT)
+$(LIBNCI_TEST_SO): src/nci_test$(O)
$(LD) $(LD_LOAD_FLAGS) @ncilib_link_extra@ $(LDFLAGS) \
@ld_out@$@ src/nci_test$(O) $(C_LIBS)
Modified: branches/typesafe_consttable/docs/parrothist.pod
==============================================================================
--- branches/typesafe_consttable/docs/parrothist.pod Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/docs/parrothist.pod Thu Sep 23 03:38:47 2010 (r49253)
@@ -113,5 +113,6 @@
coke 2.6.0 * 2010-Jul-20 "Red-rumped"
mikehh 2.7.0 2010-Aug-17 "Australian King"
+ Gerd 2.8.0 2010-Sep-21 "Tui Parakeet"
=cut
Deleted: branches/typesafe_consttable/docs/pdds/draft/pdd31_hll_interop.pod
==============================================================================
--- branches/typesafe_consttable/docs/pdds/draft/pdd31_hll_interop.pod Thu Sep 23 03:38:47 2010 (r49252)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,606 +0,0 @@
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-=head1 [DRAFT] PDD 31: Inter-Language Calling
-
-=head2 Abstract
-
-This PDD describes Parrot's conventions and support for communication between
-high-level languages (HLLs). It is focused mostly on what implementors should
-do in order to provide this capability to their users.
-
-=head2 Version
-
-$Revision$
-
-=head2 Description
-
-The ability to mix different high-level languages at runtime has always been
-an important design goal of Parrot. Another important goal, that of
-supporting all dynamic languages, makes language interoperability especially
-interesting -- where "interesting" means the same as it does in the Chinese
-curse, "May you live in interesting times." It is expected that language
-implementers, package authors, and package users will have to be aware of
-language boundaries when writing their code. It is hoped that this will not
-become too burdensome.
-
-None of what follows is binding on language implementors, who may do whatever
-they please. Nevertheless, we hope they will at least follow the spirit of
-this document so that the code they produce can be used by the rest of the
-Parrot community, and save the fancy footwork for intra-language calling.
-However, this PDD B<is> binding on Parrot implementors, who must provide a
-stable platform for language interoperability to the language implementors.
-
-=head3 Ground rules
-
-In order to avoid N**2 complexity and the resulting coordination headaches,
-each language compiler provides an interface as a target for other languages
-that should be designed to require a minimum of translation. In the general
-case, some translation may be required by both the calling language and the
-called language:
-
-{{ There seems to be an implied basic assumption here that language
-interoperability is the responsibility of the language implementor. It is not.
-We cannot require that language implementors design and implement their
-languages according to some global specification. Any interoperability
-infrastructure must be provide by Parrot, and must work for all languages.
---allison }}
-
- |
- |
- | Calling sub
- | |
- | Language X |
- | V
- | Calling stub
- +================ |
- |
- "plain Parrot" |
- |
- +================ |
- | V
- | Called wrapper
- | |
- | |
- | Language Y V
- | Called sub
- |
-
-Where necessary, a language may need to provide a "wrapper" sub to interface
-external calls to the language's internal calling and data representation
-requirements. Such wrappers are free to do whatever translation is required.
-
-Similarly, the caller may need to emit a stub that converts an internal call
-into something more generic.
-
-{{ Of course, "stub" is really too close to "sub", so we should find a better
-word. Doesn't the C community call these "bounce routines"? Or something?
--- rgr, 31-Jul-08.
-
-The language will never provide a wrapper for its subs. For the most part,
-wrappers will be unnecessary. Where a wrapper is desired to make a library
-from some other language act more like a "native" library, the person who
-desires the native behavior can implement the wrapper and make it publicly
-available. --allison }}
-
-{{ I am discovering that there are five different viewpoints here,
-corresponding to the five layers (including "plain Parrot") of the diagram
-above. I need to make these viewpoints clearer, and describe the
-responsibilities of each of these parties to each other. -- rgr, 31-Jul-08.
-}}
-
-Languages are free to implement the stub and wrapper layers (collectively
-called "glue") as they see fit. In particular, they may be inlined in the
-caller, or integral to the callee.
-
-Ideally, of course, the "plain Parrot" layer will be close enough to the
-semantics of both languages that glue code is unnecessary, and the call can be
-made directly. Language implementors are encouraged to dispense with glue
-whenever possible, even if glue is sometimes required for the general case.
-
-In summary:
-
-=over 4
-
-=item *
-
-Each HLL gets its own namespace subtree, within which C<get_hll_global> and
-C<set_hll_global> operate. In order to make external calls, the HLL must
-provide a means of identifying the language, the function, and enough
-information about the arguments and return values for the calling language to
-generate the call correctly. This is necessarily language-dependent, and is
-beyond the scope of this document.
-
-=item *
-
-When calling across languages, both the caller and the callee should try to
-use "plain Parrot semantics" to the extent possible. This is explained in
-more detail below, but essentially means to use the simplest calling
-conventions and PMC classes possible. Ideally, if an API uses only PMCs that
-are provided by a "bare Parrot" (i.e. one without any HLL runtime code), then
-it should be possible to use this API from any other language.
-
-{{ This is unnecessarily restrictive --allison }}
-
-=item *
-
-It is acceptable for languages to define subs for internal calling that are
-not suitable for external calling. Such subs should be marked as such, and
-other languages should respect those distinctions. (Or, if they choose to
-call intra-language subs, they should be very sure they understand that
-language's calling conventions.
-
-{{ It's not possible to define a sub that can't be called externally
---allison }}
-
-=back
-
-=head2 Half-Baked Ideas
-
-{{ Every draft PDD should have one of these. ;-} -- rgr, 28-Jul-08. }}
-
-=head3 Common syntax for declaring exported functions?
-
-I assume we will need some additional namespace support. Not clear yet
-whether it's better to mark the ones that or OK for external calling, or the
-ones that are not.
-
-(As you can guess, I don't have a strong suggestion for what to call these
-functions yet. Do we call them "external"? Would that get confused with
-intra-language public interfaces?)
-
-Beyond that, we probably need additional metainformation on the external subs
-so that calling compilers will know what code to emit. Putting them on the
-subs means that the calling compiler just needs to load the PBC in order to
-access the module API (though it may need additional hints). Of course, that
-also requires a PIR API for accessing this metainformation . . .
-
-{{ Exporting is very much a Perl idea, not much applicability for exporting
-outside of Perl. --allison}}
-
-Crazy idea: This is more or less the same information (typing) required for
-multimethods. If we encourage the export of multisubs, then the exporting
-language could provide multiple interfaces, and the calling compiler could
-query the set of methods for the one most suitable.
-
-{{ Proposal rejected, because we aren't going with "external" and "internal"
-subroutine variants, so it's not needed. --allison }}
-
-=head3 More namespace complexity?
-
-{{ Proposal rejected, because we aren't going with "external" and "internal"
-subroutine variants, so it's not needed. --allison }}
-
-It might be good to have some way for HLLs to define a separate external
-definition for a given sub (i.e. one that provides the wrapper) that can be
-done without too much namespace hair. I.e.
-
- .sub foo :extern
-
-defines the version that is used by interlanguage calling, and
-
- .sub foo
-
-defines the version that is seen by other code written in that language
-(i.e. via C<get_hll_global>). If there is no plain C<foo>, the C<:extern>
-version is used for internal calls. That way, the compiler can emit both
-wrapper code and internal code without having to do anything special (much),
-even if different calling conventions and/or data conversions are required.
-
-{{ Of course, this wouldn't be necessary if all external subs were multisubs.
--- rgr, 31-Jul-08. }}
-
-=head3 Multiple type hierarchies?
-
-Different languages will have to "dress up" the Parrot type/class hierarchy
-differently. For example, Common Lisp specifies that C<STRING> is a subtype
-of C<VECTOR>, which in turn is a subtype of C<ARRAY>. This is not likely to
-be acceptable to other languages, so Lisp needs its own view of type
-relationships, which must affect multimethod dispatch for Lisp generic
-functions, i.e. a method defined for C<VECTOR> must be considered when passed
-a string as a parameter.
-
-{{ Common Lisp (for example) will have its own set of type relationships,
-because it will have its own set of types. There will be no "remapping" of
-core types --allison }}
-
-The language that owns the multisub gets to define the type hierarchy and
-dispatch rules used when it gets called. In order to handle objects from
-foreign languages, the "owning" language must decide where to graft the
-foreign class inheritance graph into its own graph. {{ It would be nice if
-some Parrot class, e.g. C<Object>, could be defined as the conventional place
-to root language-specific object class hierarchies; that way, a language would
-only have to include C<Object> in order to incorporate objects from all other
-conforming languages. -- rgr, 26-Aug-08. }}
-
-{{ The language that owns the multisub does get to define the dispatch rules
-for the multisub. But, it doesn't get to alter the type hierarchy of objects
-from other languages. --allison }}
-
-Note that common Parrot classes will in general appear in different places in
-different languages' dispatch hierarchies, so it is important to bear in mind
-which language "owns" the dispatch.
-
-{{ Absolutely not true. --allison }}
-
-=head2 Definitions
-
-{{ Collect definitions of new jargon words here, once we figure out what they
-should be. -- rgr, 29-Jul-08. }}
-
-=head2 Implementation
-
-=head3 Plain Parrot Semantics
-
-Fortunately, "plain Parrot" is pretty powerful, so the "common denominator" is
-not in fact the lowest possible. For example, not all Parrot languages
-support named, optional, or repeated arguments. For the called language, this
-is never a problem; calling module can only use the subset API anyway.
-Implementers of subset calling languages are encouraged to provide their users
-with an extended API for the interlanguage call; typically, this is only
-required for named arguments.
-
-{{ This needs more? -- rgr, 28-Jul-08. }}
-
-=head3 Strings
-
- {{ I am probably not competent to write this section. At the very least,
- it requires discussion of languages that expect strings to be mutable
- versus . . . Java. -- rgr, 28-Jul-08. }}
-
-=head3 Other scalar data types
-
-All Parrot language implementations should stick to native Parrot PMC types
-for scalar data, except in case of dire need. To see with this is so, take
-the particular case of integer division, which differs significantly between
-languages.
-
-{{ No, this is completely backwards. Languages are heartily encouraged to
-create their own PMCs for any and all common variable types found in the
-language. --allison }}
-
-In Tcl, "the integer three divided by the integer five" produces the integer
-value 0.
-
-In Perl 5 and Lua, this division produces the floating-point value 0.6. (This
-happens to be Parrot's native behavior as well.)
-
-In Common Lisp, this division produces "3/5", a number of type C<RATIO> with
-numerator 3 and denominator 5 that represents the mathematically-exact result.
-
-Furthermore, no Perl 5 code, when given two integers to divide, will expect a
-Common Lisp ratio as a result. Any Perl 5 implementation that does this has a
-bug, even if both those integers happen to come from Common Lisp. Ditto for a
-floating-point result from Common Lisp code that happens to get two integers
-from Perl or Lua (or both!).
-
-{{ Not a bug, it's the expected result. Divide operations are
-multi-dispatched. If you pass two Common Lisp integers into a divide
-operation in Perl 5, it'll search for the best matching multi, and if it finds
-one for Common Lisp integers (an exact match), it'll run that and return a
-Common Lisp ratio. --allison }}
-
-Even though these languages all use "/" to represent division, they do not all
-mean the same thing by it, and similarly for most (if not all) other built-in
-arithmetic operators. However, they pretty clearly B<do> mean the same thing
-by (e.g.) "the integer with value five," so there is no need to represent the
-inputs to these operations differently; they can all be represented by the
-same C<Integer> PMC class.
-
-{{ The whole point of having sets of PMCs in different languages is to handle
-the case where "it's an integer, but has a different division operation than
-other languages" --allison}}
-
-{{ Must also discuss morphing: If some languages do it and other do not, then
-care must be taken at the boundaries. -- rgr, 31-Jul-08. }}
-
-=head4 Defining new scalar data types
-
-There will be cases where existing Parrot PMC classes cannot represent a
-primitive HLL scalar type, and so a new PMC class is required. In this case,
-interoperability cannot be guaranteed, since it may not be possible to define
-behavior for such objects in other languages. But the choice of a new PMC is
-forced, so we must make the best of it.
-
-{{ Yes, except this is the common case, and interoperability will still work
---allison }}
-
-A good case in point is that of complex rational numbers in Common Lisp. The
-C<Complex> type provided by Parrot assumes that its components are
-floating-point numbers. This is a suitable representation type for C<(COMPLEX
-REAL)>, but CL partitions "COMPLEX" into C<(COMPLEX REAL)> and C<(COMPLEX
-RATIONAL)>, with the latter being further divided into C<(COMPLEX RATIO)>,
-C<(COMPLEX INTEGER)>, etc. The straightforward way to provide this
-functionality is to define a C<ComplexRational> PMC that is built on
-C<Complex> and has real and imaginary PMC components that are constrained to
-be Integer, Bigint, or Ratio PMCs.
-
-So how do we make C<(COMPLEX RATIONAL)> arithmetic work as broadly as
-possible?
-
-The first aspect is defining how the new type actually works within its own
-language. The Lisp arithmetic operators will usually return a ComplexRational
-if given one, but need to return a RATIONAL subtype if the imaginary part is
-zero, and that may not be suitable for other languages, so Lisp needs its own
-set of basic arithmetic operators. We must therefore define methods on these
-multis that specialize ComplexRational (and probably the generic arithmetic to
-redispatch on the type of the real and imaginary parts; you know the drill).
-But, in case we are also passed another operand that is another language's
-exotic type, we should take care to use the most general possible class to
-specialize the other operands, in the hope that other exotics are subclasses
-of these.
-
-{{ It is perfectly fine for a Lisp arithmetic operator to return a RATIONAL
-subtype. Please don't define methods for a pile of operations that already
-have vtable functions --allison }}
-
-The other aspect is extending other languages' arithmetic to do something
-reasonable with our exotic types. If we're lucky, Parrot will provide a basic
-multisub that takes care of most cases, and we just need to add method(s) to
-that. If not, we will have to add specialized methods on the other language's
-multisub, trying to redispatch to the other language's arithmetic ops passing
-the (hopefully more generic) component PMCs. Doing so is still the
-responsibility of the language that defines the exotic class, since it is in
-charge of its internal representation.
-
-{{ The default multi for a common operation like division will call the PMC's
-C<get_number> vtable function, perform a standard division operation, and
-return a standard Integer/Number/BigNum. --allison }}
-
-{{ We can define multimethods on another language without loading it, can't
-we? If not, then making this work may require negotiation between language
-implementors, if it is feasible at all. -- rgr, 31-Jul-08. }}
-
-{{ I'm not sure what you mean by defining multimethods on another language.
-Perhaps you're asking if it's possible to declare a multisub for a type that
-doesn't exist yet? --allison }}
-
-This brings us to a number of guidelines for defining language-specific
-arithmetic so as to maximize interoperability:
-
-=over 4
-
-=item 1.
-
-Define language-specific operations using multimethods (to avoid conflict with
-other languages).
-
-{{ Clarify? How would non-multi's conflict? --allison }}
-
-=item 2.
-
-Define them on the highest (most general) possible PMC classes (in order that
-they continue to work if passed a subclass by a call from a different
-language).
-
-{{ Define them on the class that makes sense. There's no point in targeting
-any particular level of the inheritance hierarchy. --allison }}
-
-=item 3.
-
-Don't define a language-specific PMC class unless there is clear need for a
-different internal representation. (And even then, you might consider
-donating it to become part of the Parrot core.)
-
-{{ This is definitely not true. --allison }}
-
-=back
-
-{{ The fundamental rule is to implement your language in the way that makes
-the most sense for your language. Language implementors don't have to think
-about interoperability. --allison }}
-
-The rest of this section details exceptions and caveats in dealing with scalar
-data types.
-
-=head4 "Fuzzy" scalars
-
-Some languages are willing to coerce strings to numbers and vice versa without
-any special action on the part of the programmer and others are not. The
-problem arises when such "fuzzy" scalars are passed (or returned) to languages
-that do not support "fuzzy" coercion . . .
-
-{{ This section is meant to answer Geoffrey's "What does Lisp do with a Perl 5
-Scalar?" question. I gotta think about this more. -- rgr, 29-Jul-08. }}
-
-{{ The scalar decides when to morph, not the language. All the languages that
-have morphing scalars implement them in such a way that they know how to
-handle, for example, morphing when a string value is assigned to an integer
-scalar, and what to do if that value is later used as an integer again.
---allison }}
-
-=head4 C<Complex> numbers
-
-Not all languages support complex numbers, so if an exported function requires
-a complex argument, it should either throw a suitable error, or coerce an
-acceptable numeric argument. In the latter case, be sure to advertise this in
-the documentation, so that callers without complex numbers can tell their
-compiler that acceptable numeric type.
-
-{{ All documentation for a library should state what argument types it accepts
-and what results it returns, there's nothing unique about complex numbers.
---allison }}
-
-=head4 C<Ratio> numbers
-
-Not all languages support ratios (rather few, actually), so if an exported
-function requires a ratio as an argument, it should either throw a suitable
-error, or convert an acceptable numeric value.
-
-However, since ratios are rare (and it is rather eccentric for a program to
-insist on a ratio as a parameter), it is strongly advised to accept a floating
-point or integer value, and convert it in the wrapper.
-
-{{ All documentation for a library should state what argument types it accepts
-and what results it returns, there's nothing unique about ratios. --allison }}
-
-
- {{ Parrot does not support these yet, so this is not a current issue. --
- rgr, 28-Jul-08. }}
-
-=head3 Aggregate data types
-
-{{ I probably haven't done these issues justice; I don't know enough Java or
-Tcl to grok this part of the list discussion. -- rgr, 28-Jul-08. }}
-
-Aggregates (hashes, arrays, and struct-like thingies) can either be passed
-directly, or mapped by wrapper or caller code into something different. The
-problem with mapping, besides being slow, is that if I<either> the caller or
-the callee does this, the aggregate is effectively read-only. (It is possible
-for the wrapper to stuff the changes back in the original structure by side
-effect, but this has its own set of problems.)
-
-{{ Mapping is generally discouraged, but I don't see any reason it would make
-the aggregate read-only. You can certainly convert a Python dictionary to a
-Perl hash, use it in your Perl code, and then either return it as a Perl hash,
-or convert it back to a Python dictionary. --allison }}
-
-In other words, if the mapping is not straightforward, it may not be possible.
-If the mapping C<is> straightforward it may not be necessary -- and an
-unnecessary mapping may limit use of the called module's API.
-
-Struct-like objects are problematic. They are normally considered as
-low-level and language-specific, and handled by emitting special code for slot
-accessor/setter function, which other language compilers won't necessarily
-know how to do. The choices are therefore to (a) treat them like black boxes
-in the other language, or (b) provide a separate functional or OO API (or
-both) for calling from other languages.
-
-{{ (a) is generally preferred --allison }}
-
-Several questions arise for languages with multiple representations for
-aggregate types. Typically, this is because these types are more restricted
-in some fashion. [finish. -- rgr, 29-Jul-08.]
-
-{{ Not clear where you're going with this --allison }}
-
-=head3 Functional data types
-
-In a sense, functional types (i.e. callable objects) are the easiest things to
-pass across languages, since they require no mapping at all. On the other
-hand, if a language doesn't support functional arguments, then there is no
-hope of using an API written in another language that requires them.
-
-{{ Hmmm? They're just subs, how would they not be callable from another
-language? --allison }}
-
-=head3 Datum vs. object
-
-Some languages present everything to the programmer as an object; in such
-languages, code only exists in methods. A few languages have no methods, only
-functions (and/or subroutines) and "passive" data. The remainder have both,
-and pose no problem calling into the others.
-
-But how does an obligate OO language call a non-OO language, or vice versa?
-An extreme case would be Ruby (which has only objects) and Scheme (which (as
-far as Ruby is concerned) has none). What good is a Ruby object as a datum to
-a Scheme program if Scheme can't access any of the methods? Similarly, what
-could Ruby do with a Scheme list when it can't even get to the Scheme C<car>
-function?
-
-{{ Except that Ruby would never even get a Scheme list in the first place if
-it hadn't loaded a Scheme library of some sort. And, being a list, the Scheme
-list would still support the standard vtable functions for lists. --allison }}
-
-{{ Methinks the right thing would be to define a common introspection API (a
-good thing in its own right). Scheme and Ruby should each define their own
-implementation of the same in "plain Parrot semantics" terms, independently.
-The caller can then use his/her language's binding of the introspection API to
-poke around in the other module, and find the necessary tools to call the
-other. For Scheme, this would mean functions for finding Ruby classes and
-providing functional wrappers around methods. For Ruby, I admit this would
-probably be even weirder. In any case, it is important that the calling user
-not need anything out of the ordinary, from either language or the called
-module author. -- rgr, 29-Jul-08. }}
-
-{{ There is a common introspection API, the 'inspect' vtable function. But
-what you're describing here isn't introspection, it's actually the standard
-vtable functions. --allison }}
-
-=head4 Defining methods across language boundaries
-
-{{ Is the term "unimethod" acceptable here? -- rgr, 29-Jul-08. They're just
-methods or subroutines, and it's just "single dispatch". --allison}}
-
-There will be cases where a module user wants to extend that module by
-defining a new method on an externally-defined class, or add a multimethod to
-an externally-defined multisub. Since a class with unimethod dispatch belongs
-wholly to the external language, the calling language (i.e. the one adding the
-method) must use the semantics of the external language. If the external
-language uses a significantly different metamodel, simply adding the
-C<:method> pragma may not cut it.
-
-{{ No, the C<:method> flag is always all you need to define a method. The
-class object you add the method to determines what it does with that method.
---allison }}
-
-There are two cases: (1) The calling language is adding a new method, which
-cannot therefore interfere with existing usage in the called language; and (2)
-the calling language is attempting to extend an existing interface provided by
-the called language. In the first case, the calling compiler has the option
-of treating the new method as part of the calling language, and dispensing
-with the glue altogether. In the second case, the compiler must treat the new
-method as part of the foreign language, and provide B<both> glue layers (as
-necessary) around it. It is therefore not expected that all compilers will
-provide a way to define methods on all foreign classes for all language pairs.
-
-{{ These should generally be handled by subclassing the parent language class,
-and adding your method to the subclass. Monkeypatching is certainly possible,
-but not encouraged. And, there really isn't any distinction between "treating
-the new method as part of the calling language" and "treat[ing] the new method
-as part of the foreign language". It's a method, you call it on an object, the
-class of the object determines how it's found and invoked. --allison }}
-
-Multimethods are easier; although the multisub does belong conceptually to one
-language (from whose namespace the caller must find the multisub), multis are
-more loosely coupled to their original language.
-
-{{ Well, the semantics of the language that defined the multisub also
-determine how it is found and invoked. --allison }}
-
-The cases for multimethods are similar, though: (1) If the calling language
-method is specialized to classes that appear only in the calling module, then
-other uses of the multisub will never call the new method, and the calling
-language can choose to treat as internal. (2) If the calling method is
-specialized only on Parrot or called-language classes, then the compiler
-should take care to make it generally usable.
-
-{{ Not sure what you mean here. --allison }}
-
-=head4 Subclassing across language boundaries
-
-{{ This is an important feature, but requires compatible metamodels. -- rgr,
-29-Jul-08.
-
-Or Proxy PMCs, which is how we're currently handling inheritance across
-metamodel boundaries. --allison
-}}
-
-=head4 Method vs. multimethod
-
-{{ This is the issue where some languages (e.g. Common Lisp) use only
-multimethods, where others (e.g. Ruby) use only unimethods. (S04 says
-something about MMD "falling back" to unimethods, but so far this is not
-described in Parrot.) Calling is easy; multimethods look like functions, so
-the MM language just has to create a function (or MM) wrapper for the UM
-language, and a UM language can similarly treat a MM call as a normal function
-call. (Which will require the normal "make the function look like a method"
-hack for obligate OO languages like Ruby.) Defining methods across the
-boundary is harder, and may not be worth the trouble. -- rgr, 29-Jul-08. }}
-
-{{ That's "multiple dispatch" and "single dispatch". In general, defining code
-in one language and injecting it into the namespace of another language isn't
-the primary focus of language interoperability. Using libraries from other
-languages is. --allison }}
-
-=head2 References
-
-None.
-
-=cut
-
-__END__
-Local Variables:
- fill-column:78
-End:
-vim: expandtab shiftwidth=4:
Modified: branches/typesafe_consttable/docs/project/release_manager_guide.pod
==============================================================================
--- branches/typesafe_consttable/docs/project/release_manager_guide.pod Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/docs/project/release_manager_guide.pod Thu Sep 23 03:38:47 2010 (r49253)
@@ -407,7 +407,6 @@
visible at
L<http://www.google.com/calendar/render?cid=ldhctdamsgfg5a1cord52po9h8@group.calendar.google.com>.
- - Sep 21, 2010 - 2.8 - gerd
- Oct 19, 2010 - 2.9* - gerd
- Nov 16, 2010 - 2.10 - tcurtis
- Dec 21, 2010 - 2.11 - whiteknight
Modified: branches/typesafe_consttable/include/parrot/hash.h
==============================================================================
--- branches/typesafe_consttable/include/parrot/hash.h Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/include/parrot/hash.h Thu Sep 23 03:38:47 2010 (r49253)
@@ -72,7 +72,6 @@
};
/* Utility macros - use them, do not reinvent the wheel */
-#define parrot_hash_iterate parrot_hash_iterate_linear
#define parrot_hash_iterate_linear(_hash, _code) \
{ \
@@ -89,34 +88,28 @@
#define parrot_hash_iterate_indexed(_hash, _code) \
{ \
- INTVAL _loc; \
- if ((_hash)->entries){ \
- for (_loc = 0; _loc <= (_hash)->mask; ++_loc) { \
- HashBucket *_bucket = (_hash)->index[_loc]; \
- while (_bucket) { \
- _code \
- _bucket = _bucket->next; \
- } \
+ UINTVAL _loc; \
+ if ((_hash)->entries){ \
+ for (_loc = 0; _loc <= (_hash)->mask; ++_loc) { \
+ HashBucket *_bucket = (_hash)->index[_loc]; \
+ while (_bucket) { \
+ _code \
+ _bucket = _bucket->next; \
} \
} \
+ } \
}
-#define parrot_hash_iterator_advance(_hash, _bucket, _loc) \
+#define parrot_hash_iterate(_hash, _code) \
{ \
- if ((_hash)->entries) { \
- /* Try to advance current bucket */ \
- if ((_bucket)) \
- (_bucket) = (_bucket)->next; \
- while (!(_bucket)) { \
- /* If there is no more buckets */ \
- if ((_loc) == (INTVAL)(_hash)->mask+1) \
- break; \
- (_bucket) = (_hash)->index[(_loc)++]; \
- } \
- } \
+ if ((_hash)->key_type == Hash_key_type_int \
+ || (_hash)->key_type == Hash_key_type_cstring \
+ || (_hash)->key_type == Hash_key_type_ptr) \
+ parrot_hash_iterate_indexed((_hash), _code) \
+ else \
+ parrot_hash_iterate_linear((_hash), _code) \
}
-
typedef void (*value_free)(ARGFREE(void *));
/* To avoid creating OrderedHashItem PMC we reuse FixedPMCArray PMC */
Modified: branches/typesafe_consttable/include/parrot/oplib.h
==============================================================================
--- branches/typesafe_consttable/include/parrot/oplib.h Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/include/parrot/oplib.h Thu Sep 23 03:38:47 2010 (r49253)
@@ -24,14 +24,14 @@
typedef struct op_lib_t {
const char *name;
const char *suffix;
- int core_type;
- int flags;
- int major_version;
- int minor_version;
- int patch_version;
- size_t op_count;
- op_info_t * op_info_table;
- op_func_t * op_func_table;
+ int core_type;
+ int flags;
+ int major_version;
+ int minor_version;
+ int patch_version;
+ opcode_t op_count;
+ op_info_t *op_info_table;
+ op_func_t *op_func_table;
int (*_op_code)(PARROT_INTERP, const char * name, int full);
} op_lib_t;
Modified: branches/typesafe_consttable/include/parrot/oplib/core_ops.h
==============================================================================
--- branches/typesafe_consttable/include/parrot/oplib/core_ops.h Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/include/parrot/oplib/core_ops.h Thu Sep 23 03:38:47 2010 (r49253)
@@ -21,7 +21,7 @@
#include "parrot/runcore_api.h"
PARROT_EXPORT
-op_lib_t *Parrot_DynOp_core_2_7_0(PARROT_INTERP, long init);
+op_lib_t *Parrot_DynOp_core_2_8_0(PARROT_INTERP, long init);
opcode_t * Parrot_end(opcode_t *, PARROT_INTERP);
opcode_t * Parrot_noop(opcode_t *, PARROT_INTERP);
Modified: branches/typesafe_consttable/runtime/parrot/library/LWP/Protocol.pir
==============================================================================
--- branches/typesafe_consttable/runtime/parrot/library/LWP/Protocol.pir Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/runtime/parrot/library/LWP/Protocol.pir Thu Sep 23 03:38:47 2010 (r49253)
@@ -476,6 +476,8 @@
$S0 = _format_request(method, fullpath, request_headers)
sock.'send'($S0)
+ .local pmc response
+ response = new ['HTTP';'Response']
.local string content
content = request.'content'()
unless content goto L11
@@ -486,13 +488,18 @@
unless $I0 < content_length goto L11
$S0 = substr content, $I0, 8192
$I1 = sock.'send'($S0)
+ if $I1 >= 0 goto L13
+ $P0 = box RC_INTERNAL_SERVER_ERROR
+ setattribute response, 'code', $P0
+ $P0 = box "I/O error"
+ setattribute response, 'message', $P0
+ .return (response)
+ L13:
$I0 += $I1
$N0 = $I0 / content_length
goto L12
L11:
- .local pmc response
- response = new ['HTTP';'Response']
.local pmc buf
buf = new 'StringBuilder'
.local int header_length
Modified: branches/typesafe_consttable/src/gc/system.c
==============================================================================
--- branches/typesafe_consttable/src/gc/system.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/gc/system.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -526,7 +526,7 @@
{
ASSERT_ARGS(is_pmc_ptr)
return contained_in_pool(mem_pools->pmc_pool, ptr)
- && PObj_is_PMC_TEST((PObj *)ptr);
+ && PObj_is_PMC_TEST((const PObj *)ptr);
}
Modified: branches/typesafe_consttable/src/hash.c
==============================================================================
--- branches/typesafe_consttable/src/hash.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/hash.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -172,9 +172,9 @@
PARROT_CAN_RETURN_NULL
static HashBucket * parrot_hash_get_bucket_string(PARROT_INTERP,
- ARGIN(Hash *hash),
+ ARGIN(const Hash *hash),
ARGIN(STRING *s),
- INTVAL hashval)
+ UINTVAL hashval)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -1470,8 +1470,8 @@
/*
-=item C<static HashBucket * parrot_hash_get_bucket_string(PARROT_INTERP, Hash
-*hash, STRING *s, INTVAL hashval)>
+=item C<static HashBucket * parrot_hash_get_bucket_string(PARROT_INTERP, const
+Hash *hash, STRING *s, UINTVAL hashval)>
Given a hash, a STRING key, and the hashval of the key, returns the appropriate
bucket of the hash for the key. This assumes buckets are already available, so
@@ -1483,8 +1483,8 @@
PARROT_CAN_RETURN_NULL
static HashBucket *
-parrot_hash_get_bucket_string(PARROT_INTERP, ARGIN(Hash *hash),
- ARGIN(STRING *s), INTVAL hashval)
+parrot_hash_get_bucket_string(PARROT_INTERP, ARGIN(const Hash *hash),
+ ARGIN(STRING *s), UINTVAL hashval)
{
ASSERT_ARGS(parrot_hash_get_bucket_string)
HashBucket *bucket = hash->index[hashval & hash->mask];
@@ -1678,6 +1678,15 @@
{
ASSERT_ARGS(parrot_hash_clone_prunable)
+ /* dest hash has the same size as source hash */
+ if (dest->buckets){
+ if (dest->mask+1 > SPLIT_POINT)
+ Parrot_gc_free_memory_chunk(interp, dest->buckets);
+ else
+ Parrot_gc_free_fixed_size_storage(interp, HASH_ALLOC_SIZE(dest->mask+1), dest->buckets);
+ }
+ allocate_buckets(interp, dest, hash->mask);
+
parrot_hash_iterate(hash,
void *valtmp;
void * const key = _bucket->key;
@@ -1708,8 +1717,11 @@
Parrot_ex_throw_from_c_args(interp, NULL, -1,
"hash corruption: type = %d\n", hash->entry_type);
};
- if (key)
- parrot_hash_put(interp, dest, key, valtmp););
+ if (key) {
+ const size_t hashval = key_hash(interp, dest, key);
+ /* hash tables has no duplicate keys */
+ parrot_hash_store_value_in_bucket(interp, dest, NULL, hashval, key, valtmp);
+ });
}
/*
Modified: branches/typesafe_consttable/src/io/utf8.c
==============================================================================
--- branches/typesafe_consttable/src/io/utf8.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/io/utf8.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -65,31 +65,32 @@
const UINTVAL c = *u8ptr;
if (UTF8_IS_START(c)) {
- UINTVAL len2 = UTF8SKIP(u8ptr);
+ UINTVAL new_bufused = iter.bytepos + UTF8SKIP(u8ptr);
+ UINTVAL len2;
INTVAL read;
- if (iter.bytepos + len2 <= s->bufused)
+ if (new_bufused <= s->bufused)
goto ok;
- /* need len - 1 more chars */
- --len2;
- s2 = Parrot_str_new_init(interp, NULL, len2,
- Parrot_utf8_encoding_ptr, 0);
- s2->bufused = len2;
-
- read = Parrot_io_read_buffer(interp, filehandle, &s2);
+ /* read additional bytes to complete UTF-8 char */
+ len2 = new_bufused - s->bufused;
+ s2 = Parrot_str_new_init(interp, NULL, len2,
+ Parrot_binary_encoding_ptr, 0);
+ s2->bufused = len2;
+ read = Parrot_io_read_buffer(interp, filehandle, &s2);
UNUSED(read);
- s->strlen = iter.charpos;
- s = Parrot_str_concat(interp, s, s2);
- *buf = s;
- len += len2 + 1;
+ Parrot_gc_reallocate_string_storage(interp, s, new_bufused);
+ mem_sys_memcopy(s->strstart + s->bufused, s2->strstart, len2);
+
+ s->bufused = new_bufused;
+ len += len2;
/* check last char */
}
}
ok:
- Parrot_utf8_encoding_ptr->iter_get_and_advance(interp, *buf, &iter);
+ STRING_iter_get_and_advance(interp, s, &iter);
}
s->strlen = iter.charpos;
return len;
Modified: branches/typesafe_consttable/src/main.c
==============================================================================
--- branches/typesafe_consttable/src/main.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/main.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -398,7 +398,9 @@
}
break;
}
- else if (!strncmp(arg, "--gc-threshold", 14)) {
+ /* don't overflow argv; check length first */
+ else if (argc > arg + 14
+ && !strncmp(arg, "--gc-threshold", 14)) {
if ((arg = strrchr(arg, '=')))
++arg;
Modified: branches/typesafe_consttable/src/ops/core_ops.c
==============================================================================
--- branches/typesafe_consttable/src/ops/core_ops.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/ops/core_ops.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -26093,7 +26093,7 @@
PARROT_FUNCTION_CORE, /* core_type = PARROT_XX_CORE */
0, /* flags */
2, /* major_version */
- 7, /* minor_version */
+ 8, /* minor_version */
0, /* patch_version */
1083, /* op_count */
core_op_info_table, /* op_info_table */
@@ -26197,7 +26197,7 @@
HOP *hops = hop_buckets =
mem_gc_allocate_n_zeroed_typed(interp, core_op_lib.op_count * 2, HOP );
- size_t i;
+ opcode_t i;
/* store full names */
for (i = 0; i < core_op_lib.op_count; i++) {
@@ -26220,7 +26220,7 @@
hop_buckets = NULL;
}PARROT_EXPORT
op_lib_t *
-Parrot_DynOp_core_2_7_0(PARROT_INTERP, long init) {
+Parrot_DynOp_core_2_8_0(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
if (init == 1) {
@@ -26249,7 +26249,7 @@
{
PMC *const lib = Parrot_pmc_new(interp, enum_class_ParrotLibrary);
- ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_7_0;
+ ((Parrot_ParrotLibrary_attributes*)PMC_data(lib))->oplib_init = (void *) Parrot_DynOp_core_2_8_0;
dynop_register(interp, lib);
return lib;
}
Modified: branches/typesafe_consttable/src/packfile/pf_items.c
==============================================================================
--- branches/typesafe_consttable/src/packfile/pf_items.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/packfile/pf_items.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -967,7 +967,7 @@
const unsigned char *ucstream = *(const unsigned char **)stream;
opcode_t o = (pf->fetch_op)(ucstream);
ucstream += pf->header->wordsize;
- *stream = (opcode_t *)ucstream;
+ *stream = (const opcode_t *)ucstream;
return o;
}
}
Modified: branches/typesafe_consttable/src/pmc/codestring.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/codestring.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/codestring.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -107,6 +107,8 @@
STRING * const percent = CONST_STRING(INTERP, "%");
STRING * const comma = CONST_STRING(INTERP, ",");
STRING * const comma_space = CONST_STRING(INTERP, ", ");
+ STRING * const newline = CONST_STRING(INTERP, "\n");
+ PMC *parts = PMCNULL;
STRING *key, *repl, *S1;
INTVAL pos = 0;
INTVAL replen = 0;
@@ -144,18 +146,15 @@
GET_ATTR_str_val(INTERP, SELF, S1);
+ parts = Parrot_pmc_new_init_int(INTERP, enum_class_FixedStringArray, 3);
+ VTABLE_set_string_keyed_int(INTERP, parts, 0, S1);
+ VTABLE_set_string_keyed_int(INTERP, parts, 1, fmt);
+
/* Add a newline if necessary */
- if ('\n' != Parrot_str_indexed(INTERP, fmt, Parrot_str_length(INTERP, fmt) - 1)) {
- STRING * const newline = CONST_STRING(INTERP, "\n");
- PMC *parts = Parrot_pmc_new_init_int(INTERP, enum_class_FixedStringArray, 3);
- VTABLE_set_string_keyed_int(INTERP, parts, 0, S1);
- VTABLE_set_string_keyed_int(INTERP, parts, 1, fmt);
+ if ('\n' != Parrot_str_indexed(INTERP, fmt, Parrot_str_length(INTERP, fmt) - 1))
VTABLE_set_string_keyed_int(INTERP, parts, 2, newline);
- S1 = Parrot_str_join(INTERP, STRINGNULL, parts);
- }
- else
- S1 = Parrot_str_concat(INTERP, S1, fmt);
+ S1 = Parrot_str_join(INTERP, STRINGNULL, parts);
VTABLE_set_string_native(INTERP, SELF, S1);
RETURN(PMC *SELF);
Modified: branches/typesafe_consttable/src/pmc/exceptionhandler.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/exceptionhandler.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/exceptionhandler.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -61,6 +61,24 @@
/*
+=item C<void init_int(INTVAL)>
+
+Initializes the exception handler with one handled type.
+
+=cut
+
+*/
+
+ VTABLE void init_int(INTVAL handledtype) {
+ Parrot_ExceptionHandler_attributes * const attrs = PARROT_EXCEPTIONHANDLER(SELF);
+ SELF.init();
+
+ attrs->handled_types = Parrot_pmc_new_init_int(INTERP, enum_class_FixedIntegerArray, 1);
+ VTABLE_set_integer_keyed_int(INTERP, attrs->handled_types, 0, handledtype);
+ }
+
+/*
+
=item C<void mark()>
Mark any active exception handler data as live.
Modified: branches/typesafe_consttable/src/pmc/filehandle.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/filehandle.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/filehandle.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -379,11 +379,20 @@
Parrot_str_free_cstring(prompt_cstring);
if (r) {
+ STRING *encoding;
+ const STR_VTABLE *enc = NULL;
+ GET_ATTR_encoding(INTERP, SELF, encoding);
if (*r)
add_history(r);
-
- string_result = Parrot_str_new(INTERP, r, 0);
+ if (!STRING_IS_NULL(encoding))
+ enc = Parrot_get_encoding(INTERP, Parrot_encoding_number(INTERP, encoding));
+ if (enc == NULL)
+ string_result = Parrot_str_new(INTERP, r, 0);
+ else
+ string_result = Parrot_str_new_init(INTERP, r, strlen(r), enc, 0);
free(r);
+ if (enc != NULL)
+ STRING_validate(INTERP, string_result);
}
#else
if (got_prompt) {
Modified: branches/typesafe_consttable/src/pmc/hash.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/hash.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/hash.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -373,12 +373,13 @@
}
VTABLE STRING *get_repr() {
- /* TT #1231: Use freeze in get_repr() (for hashes) */
- PMC * const iter = VTABLE_get_iter(INTERP, SELF);
- STRING *res = CONST_STRING(INTERP, "{");
- const INTVAL n = VTABLE_elements(INTERP, SELF);
+ PMC * const iter = VTABLE_get_iter(INTERP, SELF);
+ PMC *sb = Parrot_pmc_new(INTERP, enum_class_StringBuilder);
+ const INTVAL n = VTABLE_elements(INTERP, SELF);
INTVAL j;
+ VTABLE_push_string(INTERP, sb, CONST_STRING(INTERP, "{"));
+
for (j = 0; j < n; ++j) {
STRING * const key = VTABLE_shift_string(INTERP, iter);
char * const key_str = Parrot_str_to_cstring(INTERP, key);
@@ -397,25 +398,22 @@
Parrot_str_free_cstring(key_str);
if (all_digit) {
- res = Parrot_str_concat(INTERP, res, key);
+ VTABLE_push_string(INTERP, sb, key);
}
else {
- res = Parrot_str_concat(INTERP, res, CONST_STRING(INTERP, "'"));
- res = Parrot_str_concat(INTERP, res, key);
- res = Parrot_str_concat(INTERP, res, CONST_STRING(INTERP, "'"));
+ VTABLE_push_string(INTERP, sb, CONST_STRING(INTERP, "'"));
+ VTABLE_push_string(INTERP, sb, key);
+ VTABLE_push_string(INTERP, sb, CONST_STRING(INTERP, "'"));
}
-
- res = Parrot_str_concat(INTERP, res, CONST_STRING(INTERP, ": "));
+ VTABLE_push_string(INTERP, sb, CONST_STRING(INTERP, ":"));
val = SELF.get_pmc_keyed_str(key);
- res = Parrot_str_concat(INTERP, res, VTABLE_get_string(INTERP, val));
+ VTABLE_push_string(INTERP, sb, VTABLE_get_string(INTERP, val));
if (j < n - 1)
- res = Parrot_str_concat(INTERP, res, CONST_STRING(INTERP, ", "));
+ VTABLE_push_string(INTERP, sb, CONST_STRING(INTERP, ", "));
}
- res = Parrot_str_concat(INTERP, res, CONST_STRING(INTERP, "}"));
-
- return res;
+ return VTABLE_get_string(INTERP, sb);
}
/*
Modified: branches/typesafe_consttable/src/pmc/hashiterator.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/hashiterator.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/hashiterator.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -79,7 +79,32 @@
{
ASSERT_ARGS(advance_to_next)
Parrot_HashIterator_attributes * const attrs = PARROT_HASHITERATOR(self);
- parrot_hash_iterator_advance(attrs->parrot_hash, attrs->bucket, attrs->pos);
+ if (attrs->parrot_hash->key_type == Hash_key_type_int
+ || attrs->parrot_hash->key_type == Hash_key_type_ptr
+ || attrs->parrot_hash->key_type == Hash_key_type_cstring){
+ /* indexed scan */
+ if (attrs->elements){
+ if (attrs->bucket)
+ attrs->bucket = attrs->bucket->next;
+ while (!attrs->bucket) {
+ /* If there is no more buckets */
+ if (attrs->pos == attrs->total_buckets)
+ break;
+ attrs->bucket = attrs->parrot_hash->index[attrs->pos++];
+ }
+ }
+ }
+ else{
+ /* linear scan */
+ if (!attrs->bucket)
+ attrs->bucket = attrs->parrot_hash->buckets;
+ while (attrs->elements > 0) {
+ attrs->bucket = attrs->parrot_hash->buckets + attrs->pos++;
+ if (attrs->bucket->key)
+ break;
+ }
+ }
+
--attrs->elements;
return;
}
@@ -110,17 +135,11 @@
attrs->pmc_hash = hash;
attrs->parrot_hash = (Hash*)VTABLE_get_pointer(INTERP, hash);
attrs->total_buckets = attrs->parrot_hash->mask + 1;
- attrs->bucket = 0;
+ attrs->elements = attrs->parrot_hash->entries;
+ attrs->bucket = NULL;
attrs->pos = 0;
- /* Will be decreased on initial advance_to_next */
- /* XXX Do we really need to support this use-case ? */
- attrs->elements = attrs->parrot_hash->entries + 1;
PObj_custom_mark_SET(SELF);
-
- /* Initial state of iterator is "before start" */
- /* So, advance to first element */
- advance_to_next(INTERP, SELF);
}
/*
@@ -163,9 +182,9 @@
if (value == ITERATE_FROM_START) {
/* Restart iterator */
- attrs->bucket = 0;
+ attrs->elements = attrs->parrot_hash->entries;
+ attrs->bucket = NULL;
attrs->pos = 0;
- advance_to_next(INTERP, SELF);
return;
}
@@ -197,7 +216,8 @@
*/
VTABLE INTVAL get_bool() {
- return PARROT_HASHITERATOR(SELF)->bucket != 0;
+ return PARROT_HASHITERATOR(SELF)->elements != 0;
+
}
/*
@@ -215,7 +235,7 @@
}
VTABLE INTVAL get_integer() {
- return SELF.elements();
+ return PARROT_HASHITERATOR(SELF)->elements;
}
/*
@@ -235,7 +255,10 @@
PMC *ret;
- if (!attrs->bucket)
+ /* Move to next bucket */
+ advance_to_next(INTERP, SELF);
+
+ if (attrs->elements < 0)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
"StopIteration");
@@ -243,9 +266,6 @@
VTABLE_set_pointer_keyed_int(INTERP, ret, 0, attrs->parrot_hash);
VTABLE_set_pointer_keyed_int(INTERP, ret, 1, attrs->bucket);
- /* Move to next bucket */
- advance_to_next(INTERP, SELF);
-
return ret;
}
@@ -254,17 +274,15 @@
*/
VTABLE STRING* shift_string() {
- Parrot_HashIterator_attributes * const attrs =
- PARROT_HASHITERATOR(SELF);
- HashBucket * const bucket = attrs->bucket;
-
- if (!attrs->parrot_hash || !attrs->bucket)
- return CONST_STRING(INTERP, "");
+ Parrot_HashIterator_attributes * const attrs = PARROT_HASHITERATOR(SELF);
/* Move to next bucket */
advance_to_next(INTERP, SELF);
- return hash_key_to_string(INTERP, attrs->parrot_hash, bucket->key);
+ if (attrs->elements < 0)
+ return CONST_STRING(INTERP, "");
+
+ return hash_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key);
}
}
Modified: branches/typesafe_consttable/src/pmc/imageiothaw.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/imageiothaw.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/imageiothaw.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -133,7 +133,7 @@
/* we're done reading the image */
PARROT_ASSERT(image->strstart + Parrot_str_byte_length(interp, image) ==
- PARROT_IMAGEIOTHAW(SELF)->curs);
+ (char *)PARROT_IMAGEIOTHAW(SELF)->curs);
Parrot_visit_loop_thawfinish(INTERP, SELF);
@@ -235,10 +235,10 @@
*/
VTABLE FLOATVAL shift_float() {
- const PackFile *pf = PARROT_IMAGEIOTHAW(SELF)->pf;
- opcode_t *curs = PARROT_IMAGEIOTHAW(SELF)->curs;
+ PackFile *pf = PARROT_IMAGEIOTHAW(SELF)->pf;
+ const opcode_t *curs = PARROT_IMAGEIOTHAW(SELF)->curs;
FLOATVAL f = PF_fetch_number(pf, &curs);
- PARROT_IMAGEIOTHAW(SELF)->curs = curs;
+ PARROT_IMAGEIOTHAW(SELF)->curs = (opcode_t *)curs;
BYTECODE_SHIFT_OK(INTERP, SELF);
return f;
}
@@ -272,9 +272,9 @@
{
PackFile *pf = PARROT_IMAGEIOTHAW(SELF)->pf;
- opcode_t *curs = PARROT_IMAGEIOTHAW(SELF)->curs;
+ const opcode_t *curs = PARROT_IMAGEIOTHAW(SELF)->curs;
STRING *s = PF_fetch_string(INTERP, pf, &curs);
- PARROT_IMAGEIOTHAW(SELF)->curs = curs;
+ PARROT_IMAGEIOTHAW(SELF)->curs = (opcode_t *)curs;
BYTECODE_SHIFT_OK(INTERP, SELF);
return s;
}
Modified: branches/typesafe_consttable/src/pmc/lexpad.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/lexpad.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/lexpad.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2007-2009, Parrot Foundation.
+Copyright (C) 2007-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -97,10 +97,14 @@
}
VTABLE INTVAL exists_keyed_str(STRING *name) {
- PMC *info;
+ PMC *info;
+ Hash *hash;
GET_ATTR_lexinfo(INTERP, SELF, info);
- return parrot_hash_get_bucket(INTERP,
- (Hash *)VTABLE_get_pointer(INTERP, info), name) != 0;
+ hash = (Hash *)VTABLE_get_pointer(INTERP, info);
+
+ return hash->entries
+ ? (parrot_hash_get_bucket(INTERP, hash, name) != 0)
+ : 0;
}
VTABLE INTVAL exists_keyed(PMC *name) {
@@ -109,23 +113,24 @@
}
VTABLE PMC *get_pmc_keyed_str(STRING *name) {
- PMC * info;
- Hash * hash;
- PMC * ctx;
- HashBucket * b;
- INTVAL regno;
+ PMC *info;
+ Hash *hash;
+ PMC *ctx;
+ HashBucket *b;
GET_ATTR_lexinfo(INTERP, SELF, info);
- GET_ATTR_ctx(INTERP, SELF, ctx);
hash = (Hash *)VTABLE_get_pointer(INTERP, info);
- b = parrot_hash_get_bucket(INTERP, hash, name);
- if (!b)
- return NULL;
+ if (!hash->entries)
+ return PMCNULL;
- regno = (INTVAL) b->value;
+ b = parrot_hash_get_bucket(INTERP, hash, name);
+
+ if (!b)
+ return PMCNULL;
- return CTX_REG_PMC(ctx, regno);
+ GET_ATTR_ctx(INTERP, SELF, ctx);
+ return CTX_REG_PMC(ctx, (INTVAL)b->value);
}
VTABLE PMC *get_pmc_keyed(PMC *name) {
@@ -138,10 +143,8 @@
Hash * hash;
PMC * ctx;
HashBucket * b;
- INTVAL regno;
GET_ATTR_lexinfo(INTERP, SELF, info);
- GET_ATTR_ctx(INTERP, SELF, ctx);
hash = (Hash *)VTABLE_get_pointer(INTERP, info);
b = parrot_hash_get_bucket(INTERP, hash, name);
@@ -149,8 +152,8 @@
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_LEX_NOT_FOUND,
"Lexical '%Ss' not found", name);
- regno = (INTVAL) b->value;
- CTX_REG_PMC(ctx, regno) = value;
+ GET_ATTR_ctx(INTERP, SELF, ctx);
+ CTX_REG_PMC(ctx, (INTVAL)b->value) = value;
}
VTABLE void set_pmc_keyed(PMC *name, PMC *value) {
Modified: branches/typesafe_consttable/src/pmc/nci.pmc
==============================================================================
--- branches/typesafe_consttable/src/pmc/nci.pmc Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/pmc/nci.pmc Thu Sep 23 03:38:47 2010 (r49253)
@@ -143,7 +143,7 @@
nci_info->pcc_return_signature =
Parrot_str_new(interp, sig_buf, 1);
- nci_info->pcc_params_signature = j ?
+ nci_info->pcc_params_signature = j > 1 ?
Parrot_str_new(interp, sig_buf + 1, j - 1) :
CONST_STRING(interp, "");
Modified: branches/typesafe_consttable/src/runcore/main.c
==============================================================================
--- branches/typesafe_consttable/src/runcore/main.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/runcore/main.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -338,12 +338,17 @@
parrot_hash_oplib(PARROT_INTERP, ARGIN(op_lib_t *lib))
{
ASSERT_ARGS(parrot_hash_oplib)
- int i;
+
+ size_t i;
+
for (i = 0; i < lib->op_count; i++) {
op_info_t *op = &lib->op_info_table[i];
- parrot_hash_put(interp, interp->op_hash, (void *)op->full_name, (void *)op);
+ parrot_hash_put(interp, interp->op_hash, (void *)op->full_name,
+ (void *)op);
+
if (!parrot_hash_exists(interp, interp->op_hash, (void *)op->name))
- parrot_hash_put(interp, interp->op_hash, (void *)op->name, (void *)op);
+ parrot_hash_put(interp, interp->op_hash, (void *)op->name,
+ (void *)op);
}
}
@@ -401,7 +406,7 @@
/* ensure event checking table is big enough */
if (interp->evc_func_table_size < cs->op_count) {
- int i;
+ size_t i;
op_lib_t *core_lib = get_core_op_lib_init(interp, interp->run_core)(interp, 1);
interp->evc_func_table = interp->evc_func_table ?
Modified: branches/typesafe_consttable/src/runcore/trace.c
==============================================================================
--- branches/typesafe_consttable/src/runcore/trace.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/runcore/trace.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -239,7 +239,7 @@
break;
case KEY_string_FLAG|KEY_register_FLAG:
{
- const INTVAL keynum = VTABLE_get_integer(interp, key);
+ const UINTVAL keynum = (UINTVAL)VTABLE_get_integer(interp, key);
if (keynum < Parrot_pcc_get_regs_used(interp, CURRENT_CONTEXT(interp), REGNO_STR)) {
const STRING * const s = REG_STR(interp, keynum);
STRING * const escaped = Parrot_str_escape_truncate(interp, s, 20);
Modified: branches/typesafe_consttable/src/scheduler.c
==============================================================================
--- branches/typesafe_consttable/src/scheduler.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/scheduler.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -859,9 +859,9 @@
static PMC * keep_context = NULL;
PMC *context;
- PMC *iter = PMCNULL;
- STRING * const handled_str = CONST_STRING(interp, "handled");
- STRING * const iter_str = CONST_STRING(interp, "handler_iter");
+ PMC *iter = PMCNULL;
+ STRING * const handled_str = CONST_STRING(interp, "handled");
+ STRING * const handler_iter_str = CONST_STRING(interp, "handler_iter");
if (already_doing) {
Parrot_io_eprintf(interp,
@@ -886,7 +886,7 @@
* tasks don't (though they could). */
if (task->vtable->base_type == enum_class_Exception
&& VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
- iter = VTABLE_get_attr_str(interp, task, iter_str);
+ iter = VTABLE_get_attr_str(interp, task, handler_iter_str);
context = (PMC *)VTABLE_get_pointer(interp, task);
}
else {
@@ -904,17 +904,13 @@
if (!PMC_IS_NULL(handler)) {
INTVAL valid_handler = 0;
- if (handler->vtable->base_type == enum_class_Object)
- Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
- "P->I", task, &valid_handler);
- else
- Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
+ Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
"P->I", task, &valid_handler);
if (valid_handler) {
if (task->vtable->base_type == enum_class_Exception) {
/* Store iterator and context for a later rethrow. */
- VTABLE_set_attr_str(interp, task, CONST_STRING(interp, "handler_iter"), iter);
+ VTABLE_set_attr_str(interp, task, handler_iter_str, iter);
VTABLE_set_pointer(interp, task, context);
}
--already_doing;
Modified: branches/typesafe_consttable/src/string/api.c
==============================================================================
--- branches/typesafe_consttable/src/string/api.c Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/src/string/api.c Thu Sep 23 03:38:47 2010 (r49253)
@@ -1010,7 +1010,7 @@
ASSERT_STRING_SANITY(src);
/* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
- if (offset == src_length || length < 1)
+ if (true_offset == src_length || length < 1)
return CONST_STRING(interp, "");
if (offset < 0)
Modified: branches/typesafe_consttable/t/dynoplibs/trans-infnan.t
==============================================================================
--- branches/typesafe_consttable/t/dynoplibs/trans-infnan.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/dynoplibs/trans-infnan.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -187,38 +187,38 @@
$N0 = 'Inf'
#$N1 = coth $N0
#is($N1, 1, 'coth: coth Inf')
- todo(0, 'coth Inf', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'coth Inf', 'coth not implemented for real numbers')
$N0 = '-Inf'
#$N1 = coth $N0
#is($N1, -1, '... coth -Inf')
- todo(0, 'coth -Inf', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'coth -Inf', 'coth not implemented for real numbers')
$N0 = 'NaN'
#$N1 = coth $N0
#is($N1, 'NaN', '... coth NaN')
- todo(0, 'coth NaN', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'coth NaN', 'coth not implemented for real numbers')
.end
.sub test_acot
$N0 = 'Inf'
#$N1 = acot $N0
#is($N1, 'NaN', 'acot: acot Inf')
- todo(0, 'acot Inf', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'acot Inf', 'acot not implemented for real numbers')
$N0 = '-Inf'
#$N1 = acot $N0
#is($N1, 'NaN', '... acot -Inf')
- todo(0, 'acot -Inf', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'acot -Inf', 'acot not implemented for real numbers')
$N0 = 'NaN'
#$N1 = acot $N0
#is($N1, 'NaN', '... acot NaN')
- todo(0, 'acot NaN', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'acot NaN', 'acot not implemented for real numbers')
$N0 = '-2'
#$N1 = acot $N0
#is($N1, 'NaN', '... acot -2')
- todo(0, 'acot -2', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'acot -2', 'acot not implemented for real numbers')
$N0 = '2'
#$N1 = acot $N0
#is($N1, 'NaN', '... acot 2')
- todo(0, 'acot 2', 'cot/coth/acot not implemented for real numbers')
+ todo(0, 'acot 2', 'acot not implemented for real numbers')
.end
.sub test_sec
Modified: branches/typesafe_consttable/t/pmc/bytebuffer.t
==============================================================================
--- branches/typesafe_consttable/t/pmc/bytebuffer.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/pmc/bytebuffer.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -349,12 +349,14 @@
.end
.sub test_invalid
- .local pmc bb, ex
+ .local pmc bb, eh, ex
.local string s
+ eh = new ['ExceptionHandler'], .EXCEPTION_INVALID_ENCODING
+ set_addr eh, catch_encoding
+ push_eh eh
bb = new ['ByteBuffer']
bb = 'something'
- push_eh catch_encoding
- s = bb.'get_string'('ascii', '???INVALID eNCODING===')
+ s = bb.'get_string'('???INVALID eNCODING===')
pop_eh
ok(0, "get_string with invalid encoding should throw")
goto check_content
@@ -365,8 +367,10 @@
ok(1, "get_string with invalid encoding throws")
check_content:
bb[0] = 128 # Out of ascii range
- push_eh catch_content
- s = bb.'get_string'('ascii', 'fixed_8')
+ eh = new ['ExceptionHandler'], .EXCEPTION_INVALID_STRING_REPRESENTATION
+ set_addr eh, catch_content
+ push_eh eh
+ s = bb.'get_string'('ascii')
pop_eh
ok(0, "get_string with invalid content should throw")
goto end
Modified: branches/typesafe_consttable/t/pmc/exceptionhandler.t
==============================================================================
--- branches/typesafe_consttable/t/pmc/exceptionhandler.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/pmc/exceptionhandler.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -23,7 +23,7 @@
.include 'test_more.pir'
# If test exited with "bad plan" MyHandlerCan.can_handle wasn't invoked.
- plan(18)
+ plan(19)
test_bool()
test_int()
@@ -105,7 +105,7 @@
test_handle_types_except()
- goto subclass_handler
+ goto init_int
typed_handler_one:
.get_results (e)
@@ -120,6 +120,21 @@
eh = 0
c()
+ init_int:
+ eh = new ['ExceptionHandler'], .CONTROL_BREAK
+ set_addr eh, init_int_eh
+ push_eh eh
+ $P0 = new ['Exception']
+ $P0['type'] = .CONTROL_BREAK
+ throw $P0
+ $I0 = 0
+ goto init_int_done
+ init_int_eh:
+ pop_eh
+ $I0 = 1
+ init_int_done:
+ ok($I0, "init_int handler correctly caught exception")
+
subclass_handler:
.local pmc myhandler, myhandlercan
myhandler = subclass_exception_handler()
Modified: branches/typesafe_consttable/t/pmc/hash.t
==============================================================================
--- branches/typesafe_consttable/t/pmc/hash.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/pmc/hash.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -739,10 +739,6 @@
.end
.sub freeze_thaw_preserves_order
- # is internal order important somehow?
- todo("freeze/thaw preserves hash internal order")
- .return ()
-
.local pmc h, cloned
.local string s1, s2
.local int all_ok
Modified: branches/typesafe_consttable/t/pmc/io.t
==============================================================================
--- branches/typesafe_consttable/t/pmc/io.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/pmc/io.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -631,7 +631,7 @@
($FOO, $temp_file) = create_tempfile( UNLINK => 1 );
-print $FOO "T\xc3\xb6tsch\n";
+print $FOO "T\xc3\xb6tsch \xe2\x82\xac100\n";
close $FOO;
pir_output_is( sprintf(<<'CODE', $temp_file), <<"OUTPUT", "utf8 read enabled, read parts" );
@@ -642,6 +642,10 @@
pio.'open'(temp_file, 'r')
pio.'encoding'("utf8")
$S0 = pio.'read'(2)
+ say $S0
+ $S1 = pio.'read'(7)
+ say $S1
+ $S0 .= $S1
$S1 = pio.'read'(1024) # read the rest of the file (much shorter than 1K)
$S0 .= $S1
pio.'close'()
@@ -650,13 +654,13 @@
$S2 = encodingname $I1
say $S2
- $I1 = find_encoding 'iso-8859-1'
- trans_encoding $S1, $S0, $I1
- print $S1
+ print $S0
.end
CODE
+T\xc3\xb6
+tsch \xe2\x82\xac
utf8
-T\xf6tsch
+T\xc3\xb6tsch \xe2\x82\xac100
OUTPUT
pir_output_is( <<"CODE", <<"OUTPUT", "PIO.readall() - classmeth" );
Modified: branches/typesafe_consttable/t/pmc/stringbuilder.t
==============================================================================
--- branches/typesafe_consttable/t/pmc/stringbuilder.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/pmc/stringbuilder.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -23,6 +23,7 @@
test_create() # 3 tests
test_init_pmc()
test_push_string()
+ test_push_string_resize()
test_push_pmc() # 4 tests
test_push_string_unicode() # 1 test
test_i_concatenate() # 1 test
@@ -109,6 +110,29 @@
is( $S0, $S1, "push a null string does nothing" )
.end
+.sub 'test_push_string_resize'
+ # Try to cover the case of resizing a buffer while converting it to utf8
+ # Depends on internal details of StringBuffer, so it may need changes
+ # when that internals do.
+ .local pmc sb
+ sb = new ["StringBuilder"]
+ .local string s
+ .local int i, n
+ # Get the allocated capacity and almost fill it
+ n = sb
+ n -= 2
+ s = repeat iso-8859-1:"x", n
+ push sb, s
+ # push a string that needs reallocation and has incompatible encoding rep.
+ s = unicode:"yyyy"
+ push sb, s
+ # Check the expected string length. Not a rock solid check, but the
+ # purpose of this test is just code coverage, so is enough.
+ i = sb.'get_string_length'()
+ n = n + 4
+ is(i, n, 'test_push_string_resize')
+.end
+
.sub 'test_push_pmc'
.local pmc sb
sb = new ["StringBuilder"]
Modified: branches/typesafe_consttable/t/run/options.t
==============================================================================
--- branches/typesafe_consttable/t/run/options.t Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/t/run/options.t Thu Sep 23 03:38:47 2010 (r49253)
@@ -20,7 +20,7 @@
use warnings;
use lib qw( lib . ../lib ../../lib );
-use Test::More tests => 28;
+use Test::More tests => 30;
use Parrot::Config;
use File::Temp 0.13 qw/tempfile/;
use File::Spec;
@@ -96,6 +96,13 @@
# Test --runtime-prefix
like( qx{$PARROT --runtime-prefix}, qr/^.+$/, "--runtime-prefix" );
+# TT #1797: check for warning error and mask off "did it crash?" bits
+my $output = qx{$PARROT --gc-threshold 2>&1 };
+my $exit = $? & 127;
+like( $output, qr/--gc-threshold needs an argument/,
+ '--gc-threshold needs argument warning' );
+is( $exit, 0, '... and should not crash' );
+
# clean up temporary files
unlink $first_pir_file;
unlink $second_pir_file;
Modified: branches/typesafe_consttable/tools/release/release.json
==============================================================================
--- branches/typesafe_consttable/tools/release/release.json Wed Sep 22 23:22:35 2010 (r49252)
+++ branches/typesafe_consttable/tools/release/release.json Thu Sep 23 03:38:47 2010 (r49253)
@@ -1,9 +1,9 @@
{
- "release.version" : "2.7.0",
- "release.name" : "Australian King",
+ "release.version" : "2.8.0",
+ "release.name" : "Tui Parakeet",
"release.day" : "Tuesday",
- "release.date" : "17 August 2010",
- "release.nextdate" : "21 September 2010",
+ "release.date" : "21 September 2010",
+ "release.nextdate" : "19 October 2010",
"web.root" : "http://parrot.org/",
"web.source" : "download",
@@ -11,11 +11,11 @@
"web.repository" : "https://svn.parrot.org/parrot/trunk/",
"bugday.day" : "Saturday",
- "bugday.date" : "18 September 2010",
+ "bugday.date" : "16 October 2010",
"wiki.root" : "https://trac.parrot.org/parrot/wiki/",
- "wiki.bugday" : "bug_day_2010_09_18",
+ "wiki.bugday" : "bug_day_2010_10_16",
- "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/2.7.0/",
+ "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/2.8.0/",
"subversion.root" : "http://subversion.apache.org/"
}
More information about the parrot-commits
mailing list