[svn:parrot] r46843 - in branches/gsoc_past_optimization: . compilers/imcc config/auto editor examples/languages/squaak/t include/parrot lib/Parrot lib/Parrot/Test src src/gc src/interp src/packfile src/runcore t/native_pbc t/src tools/build tools/dev
tcurtis at svn.parrot.org
tcurtis at svn.parrot.org
Fri May 21 07:02:32 UTC 2010
Author: tcurtis
Date: Fri May 21 07:02:31 2010
New Revision: 46843
URL: https://trac.parrot.org/parrot/changeset/46843
Log:
Really sync with trunk.
Modified:
branches/gsoc_past_optimization/ (props changed)
branches/gsoc_past_optimization/PBC_COMPAT
branches/gsoc_past_optimization/compilers/imcc/pbc.c
branches/gsoc_past_optimization/config/auto/warnings.pm
branches/gsoc_past_optimization/editor/pir-mode.el
branches/gsoc_past_optimization/examples/languages/squaak/t/00-sanity.t
branches/gsoc_past_optimization/include/parrot/embed.h
branches/gsoc_past_optimization/include/parrot/exceptions.h
branches/gsoc_past_optimization/include/parrot/runcore_trace.h (props changed)
branches/gsoc_past_optimization/lib/Parrot/Headerizer.pm
branches/gsoc_past_optimization/lib/Parrot/Test/Pod.pm
branches/gsoc_past_optimization/src/embed.c
branches/gsoc_past_optimization/src/exceptions.c
branches/gsoc_past_optimization/src/gc/gc_private.h
branches/gsoc_past_optimization/src/gc/mark_sweep.c
branches/gsoc_past_optimization/src/interp/inter_create.c (props changed)
branches/gsoc_past_optimization/src/packfile/pf_items.c
branches/gsoc_past_optimization/src/runcore/cores.c (props changed)
branches/gsoc_past_optimization/src/runcore/trace.c (props changed)
branches/gsoc_past_optimization/src/utils.c
branches/gsoc_past_optimization/t/native_pbc/annotations.pbc
branches/gsoc_past_optimization/t/native_pbc/integer_1.pbc
branches/gsoc_past_optimization/t/native_pbc/number_1.pbc
branches/gsoc_past_optimization/t/native_pbc/string_1.pbc
branches/gsoc_past_optimization/t/src/embed.t (props changed)
branches/gsoc_past_optimization/tools/build/headerizer.pl
branches/gsoc_past_optimization/tools/dev/mk_gitignore.pl (props changed)
Modified: branches/gsoc_past_optimization/PBC_COMPAT
==============================================================================
--- branches/gsoc_past_optimization/PBC_COMPAT Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/PBC_COMPAT Fri May 21 07:02:31 2010 (r46843)
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+6.17 2010.05.20 NotFound store encoding of string constants
6.16 2010.05.18 plobsing move freeze/thaw adjacent to visit
6.15 2010.05.06 bacek add StringBuilder PMC
6.14 2010.05.03 coke remove popaction, pushmark, pushaction ops.
Modified: branches/gsoc_past_optimization/compilers/imcc/pbc.c
==============================================================================
--- branches/gsoc_past_optimization/compilers/imcc/pbc.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/compilers/imcc/pbc.c Fri May 21 07:02:31 2010 (r46843)
@@ -888,7 +888,7 @@
IMCC_string_from_reg(PARROT_INTERP, ARGIN(const SymReg *r))
{
ASSERT_ARGS(IMCC_string_from_reg)
- const char *buf = r->name;
+ char *buf = r->name;
if (r->type & VT_ENCODED) {
/*
@@ -896,19 +896,63 @@
* get first part as charset, rest as string
*/
STRING *s;
+ const CHARSET *s_charset;
+ const ENCODING *s_encoding = NULL;
+ const ENCODING *src_encoding;
const char *charset;
- char * const p = strchr(r->name, '"');
+ #define MAX_NAME 31
+ char charset_name[MAX_NAME + 1];
+ char encoding_name[MAX_NAME + 1];
+ char * p = strchr(r->name, '"');
+ char * p2 = strchr(r->name, ':');
PARROT_ASSERT(p && p[-1] == ':');
-
- p[-1] = 0;
- charset = r->name;
+ if (p2 < p -1) {
+ strncpy(encoding_name, buf, p2 - buf);
+ encoding_name[p2-buf] = '\0';
+ strncpy(charset_name, p2 +1, p - p2 - 2);
+ charset_name[p- p2 - 2] = '\0';
+ /*fprintf(stderr, "%s:%s\n", charset_name, encoding_name);*/
+ s_charset = Parrot_find_charset(interp, charset_name);
+ s_encoding = Parrot_find_encoding(interp, encoding_name);
+ }
+ else {
+ strncpy(charset_name, buf, p - buf - 1);
+ charset_name[p - buf - 1] = '\0';
+ /*fprintf(stderr, "%s\n", charset_name);*/
+ s_charset = Parrot_find_charset(interp, charset_name);
+ }
+ if (strcmp(charset_name, "unicode") == 0)
+ src_encoding = Parrot_utf8_encoding_ptr;
+ else
+ src_encoding = Parrot_fixed_8_encoding_ptr;
+ if (s_encoding == NULL)
+ s_encoding = src_encoding;
/* past delim */
buf = p + 1;
- s = Parrot_str_unescape(interp, buf, '"', charset);
-
- /* restore colon, as we may reuse this string */
- p[-1] = ':';
+ if (strcmp(charset_name, "unicode") == 0 && strcmp(encoding_name, "utf8") == 0) {
+ /* Special case needed for backward compatibility with utf8 literals
+ * using \xHH\xHH byte sequences */
+ s = Parrot_str_unescape(interp, buf, '"', "utf8:unicode");
+ }
+ else {
+ p = buf;
+ p2 = strchr(buf, '"');
+ while (p2 != NULL) {
+ p = p2;
+ p2 = strchr(p + 1, '"');
+ }
+ {
+ STRING * aux = Parrot_str_new_init(interp, buf, p - buf,
+ src_encoding, s_charset, 0);
+ s = Parrot_str_unescape_string(interp, aux,
+ s_charset, s_encoding, PObj_constant_FLAG);
+ if (!CHARSET_VALIDATE(interp, s))
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_INVALID_STRING_REPRESENTATION,
+ "Malformed string");
+ }
+ }
return s;
}
else if (*buf == '"') {
Modified: branches/gsoc_past_optimization/config/auto/warnings.pm
==============================================================================
--- branches/gsoc_past_optimization/config/auto/warnings.pm Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/config/auto/warnings.pm Fri May 21 07:02:31 2010 (r46843)
@@ -182,6 +182,8 @@
-Wdeprecated-declarations
-Wno-format-extra-args
-Wno-import
+ -Wsuggest-attribute=pure
+ -Wsuggest-attribute=const
-Wunreachable-code
-Wunused
-Wunused-function
Modified: branches/gsoc_past_optimization/editor/pir-mode.el
==============================================================================
--- branches/gsoc_past_optimization/editor/pir-mode.el Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/editor/pir-mode.el Fri May 21 07:02:31 2010 (r46843)
@@ -66,7 +66,7 @@
:type 'boolean
:group 'pir)
-(defcustom pir-basic-indent 8
+(defcustom pir-basic-indent 4
"*Extra indentation applied to statements in PIR block structures."
:type 'integer
:group 'pir)
Modified: branches/gsoc_past_optimization/examples/languages/squaak/t/00-sanity.t
==============================================================================
--- branches/gsoc_past_optimization/examples/languages/squaak/t/00-sanity.t Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/examples/languages/squaak/t/00-sanity.t Fri May 21 07:02:31 2010 (r46843)
@@ -88,7 +88,6 @@
# for-statement
-var i = 1
for var i = 18, 20 do
print("ok ", i)
@@ -104,11 +103,11 @@
#end
-i = 0
-while i < 5 do
+var j = 0
+while j < 5 do
- print("ok ", i + g)
- i = i + 1
+ print("ok ", j + g)
+ j = j + 1
end
Modified: branches/gsoc_past_optimization/include/parrot/embed.h
==============================================================================
--- branches/gsoc_past_optimization/include/parrot/embed.h Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/include/parrot/embed.h Fri May 21 07:02:31 2010 (r46843)
@@ -141,14 +141,17 @@
__attribute__nonnull__(1);
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_UInt Parrot_test_debug(PARROT_INTERP, Parrot_UInt flag)
__attribute__nonnull__(1);
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_Int Parrot_test_flag(PARROT_INTERP, Parrot_Int flag)
__attribute__nonnull__(1);
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_UInt Parrot_test_trace(PARROT_INTERP, Parrot_UInt flag)
__attribute__nonnull__(1);
Modified: branches/gsoc_past_optimization/include/parrot/exceptions.h
==============================================================================
--- branches/gsoc_past_optimization/include/parrot/exceptions.h Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/include/parrot/exceptions.h Fri May 21 07:02:31 2010 (r46843)
@@ -115,9 +115,9 @@
/* HEADERIZER BEGIN: src/exceptions.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+PARROT_EXPORT
PARROT_DOES_NOT_RETURN
PARROT_COLD
-PARROT_EXPORT
void do_panic(
NULLOK_INTERP,
ARGIN_NULLOK(const char *message),
Modified: branches/gsoc_past_optimization/lib/Parrot/Headerizer.pm
==============================================================================
--- branches/gsoc_past_optimization/lib/Parrot/Headerizer.pm Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/lib/Parrot/Headerizer.pm Fri May 21 07:02:31 2010 (r46843)
@@ -247,8 +247,10 @@
}
if ( $return_type =~ /\*/ ) {
if ( !$macros{PARROT_CAN_RETURN_NULL} && !$macros{PARROT_CANNOT_RETURN_NULL} ) {
- $self->squawk( $file, $name,
- 'Returns a pointer, but no PARROT_CAN(NOT)_RETURN_NULL macro found.' );
+ if ( $name !~ /^yy/ ) { # Don't complain about lexer-created functions
+ $self->squawk( $file, $name,
+ 'Returns a pointer, but no PARROT_CAN(NOT)_RETURN_NULL macro found.' );
+ }
}
elsif ( $macros{PARROT_CAN_RETURN_NULL} && $macros{PARROT_CANNOT_RETURN_NULL} ) {
$self->squawk( $file, $name,
Modified: branches/gsoc_past_optimization/lib/Parrot/Test/Pod.pm
==============================================================================
--- branches/gsoc_past_optimization/lib/Parrot/Test/Pod.pm Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/lib/Parrot/Test/Pod.pm Fri May 21 07:02:31 2010 (r46843)
@@ -198,7 +198,7 @@
@files = @{ $self->{argv} };
}
else {
- print STDERR "\nFinding files with POD, this may take a minute.\n";
+ print STDERR "\n# Finding files with POD, this may take a minute.\n";
@files = (
keys(%{ $self->{manifest} }),
keys(%{ $self->{manifest_gen} })
Modified: branches/gsoc_past_optimization/src/embed.c
==============================================================================
--- branches/gsoc_past_optimization/src/embed.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/embed.c Fri May 21 07:02:31 2010 (r46843)
@@ -281,6 +281,7 @@
*/
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_Int
Parrot_test_flag(PARROT_INTERP, Parrot_Int flag)
{
@@ -300,6 +301,7 @@
*/
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_UInt
Parrot_test_debug(PARROT_INTERP, Parrot_UInt flag)
{
@@ -319,6 +321,7 @@
*/
PARROT_EXPORT
+PARROT_PURE_FUNCTION
Parrot_UInt
Parrot_test_trace(PARROT_INTERP, Parrot_UInt flag)
{
Modified: branches/gsoc_past_optimization/src/exceptions.c
==============================================================================
--- branches/gsoc_past_optimization/src/exceptions.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/exceptions.c Fri May 21 07:02:31 2010 (r46843)
@@ -680,9 +680,9 @@
*/
+PARROT_EXPORT
PARROT_DOES_NOT_RETURN
PARROT_COLD
-PARROT_EXPORT
void
do_panic(NULLOK_INTERP, ARGIN_NULLOK(const char *message),
ARGIN_NULLOK(const char *file), unsigned int line)
Modified: branches/gsoc_past_optimization/src/gc/gc_private.h
==============================================================================
--- branches/gsoc_past_optimization/src/gc/gc_private.h Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/gc/gc_private.h Fri May 21 07:02:31 2010 (r46843)
@@ -352,7 +352,7 @@
ARGMOD(Memory_Pools *mem_pools),
int flag,
ARGIN_NULLOK(void *arg),
- ARGIN(pool_iter_fn func))
+ NOTNULL(pool_iter_fn func))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(5)
Modified: branches/gsoc_past_optimization/src/gc/mark_sweep.c
==============================================================================
--- branches/gsoc_past_optimization/src/gc/mark_sweep.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/gc/mark_sweep.c Fri May 21 07:02:31 2010 (r46843)
@@ -840,7 +840,7 @@
header_pools_iterate_callback(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
int flag, ARGIN_NULLOK(void *arg),
- ARGIN(pool_iter_fn func))
+ NOTNULL(pool_iter_fn func))
{
ASSERT_ARGS(header_pools_iterate_callback)
Modified: branches/gsoc_past_optimization/src/packfile/pf_items.c
==============================================================================
--- branches/gsoc_past_optimization/src/packfile/pf_items.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/packfile/pf_items.c Fri May 21 07:02:31 2010 (r46843)
@@ -1216,7 +1216,10 @@
ASSERT_ARGS(PF_fetch_string)
STRING *s;
UINTVAL flags;
+ UINTVAL encoding_nr;
UINTVAL charset_nr;
+ const ENCODING *encoding;
+ const CHARSET *charset;
size_t size;
const int wordsize = pf ? pf->header->wordsize : sizeof (opcode_t);
opcode_t flag_charset_word = PF_fetch_opcode(pf, cursor);
@@ -1224,20 +1227,31 @@
if (flag_charset_word == -1)
return STRINGNULL;
- /* decode flags and charset */
+ /* decode flags, charset and encoding */
flags = (flag_charset_word & 0x1 ? PObj_constant_FLAG : 0) |
(flag_charset_word & 0x2 ? PObj_private7_FLAG : 0) ;
- charset_nr = flag_charset_word >> 8;
+ encoding_nr = (flag_charset_word >> 16);
+ charset_nr = (flag_charset_word >> 8) & 0xFF;
size = (size_t)PF_fetch_opcode(pf, cursor);
TRACE_PRINTF(("PF_fetch_string(): flags=0x%04x, ", flags));
+ TRACE_PRINTF(("encoding_nr=%ld, ", encoding_nr));
TRACE_PRINTF(("charset_nr=%ld, ", charset_nr));
TRACE_PRINTF(("size=%ld.\n", size));
- s = string_make_from_charset(interp, (const char *)*cursor,
- size, charset_nr, flags);
+ encoding = Parrot_get_encoding(interp, encoding_nr);
+ charset = Parrot_get_charset(interp, charset_nr);
+ if (!encoding)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Invalid encoding number '%d' specified", encoding_nr);
+ if (!charset)
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
+ "Invalid charset number '%d' specified", charset_nr);
+
+ s = Parrot_str_new_init(interp, (const char *)*cursor, size,
+ encoding, charset, flags);
/* print only printable characters */
TRACE_PRINTF_VAL(("PF_fetch_string(): string is '%s' at 0x%x\n",
@@ -1298,8 +1312,9 @@
* see also PF_fetch_string
*/
- /* encode charset_nr and flags into the same word for a 33% savings on constant overhead */
- *cursor++ = (Parrot_charset_number_of_str(NULL, s) << 8) |
+ /* encode charset_nr, encoding_nr and flags into the same word */
+ *cursor++ = (Parrot_encoding_number_of_str(NULL, s) << 16) |
+ (Parrot_charset_number_of_str(NULL, s) << 8) |
(PObj_get_FLAGS(s) & PObj_constant_FLAG ? 0x1 : 0x0) |
(PObj_get_FLAGS(s) & PObj_private7_FLAG ? 0x2 : 0x0) ;
*cursor++ = s->bufused;
Modified: branches/gsoc_past_optimization/src/utils.c
==============================================================================
--- branches/gsoc_past_optimization/src/utils.c Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/src/utils.c Fri May 21 07:02:31 2010 (r46843)
@@ -62,12 +62,12 @@
static void next_rand(_rand_buf X);
static void process_cycle_without_exit(
int node_index,
- ARGIN(parrot_prm_context* c))
+ ARGIN(const parrot_prm_context *c))
__attribute__nonnull__(2);
static void rec_climb_back_and_mark(
int node_index,
- ARGIN(parrot_prm_context* c))
+ ARGIN(const parrot_prm_context *c))
__attribute__nonnull__(2);
#define ASSERT_ARGS__drand48 __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
@@ -664,8 +664,8 @@
/*
-=item C<static void rec_climb_back_and_mark(int node_index, parrot_prm_context*
-c)>
+=item C<static void rec_climb_back_and_mark(int node_index, const
+parrot_prm_context *c)>
Recursive function, used by Parrot_register_move to
climb back the graph of register moves operations.
@@ -689,7 +689,7 @@
*/
static void
-rec_climb_back_and_mark(int node_index, ARGIN(parrot_prm_context* c))
+rec_climb_back_and_mark(int node_index, ARGIN(const parrot_prm_context *c))
{
ASSERT_ARGS(rec_climb_back_and_mark)
const int node = c->dest_regs[node_index];
@@ -715,8 +715,8 @@
/*
-=item C<static void process_cycle_without_exit(int node_index,
-parrot_prm_context* c)>
+=item C<static void process_cycle_without_exit(int node_index, const
+parrot_prm_context *c)>
Recursive function, used by Parrot_register_move to handle the case
of cycles without exits, that are cycles of move ops between registers
@@ -732,7 +732,7 @@
*/
static void
-process_cycle_without_exit(int node_index, ARGIN(parrot_prm_context* c))
+process_cycle_without_exit(int node_index, ARGIN(const parrot_prm_context *c))
{
ASSERT_ARGS(process_cycle_without_exit)
const int pred = c->src_regs[node_index];
@@ -915,6 +915,7 @@
/* TODO: Macroize COMPARE */
/* This is an awfully expensive function to call, what with all the */
/* comparisons that never change. We ought to precompute everything. */
+/* XXX We should be able to guarantee that *a and *b never change via const parameters. */
static INTVAL
COMPARE(PARROT_INTERP, ARGIN(void *a), ARGIN(void *b), ARGIN(PMC *cmp))
{
Modified: branches/gsoc_past_optimization/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/gsoc_past_optimization/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/gsoc_past_optimization/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/gsoc_past_optimization/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/gsoc_past_optimization/tools/build/headerizer.pl
==============================================================================
--- branches/gsoc_past_optimization/tools/build/headerizer.pl Fri May 21 06:56:15 2010 (r46842)
+++ branches/gsoc_past_optimization/tools/build/headerizer.pl Fri May 21 07:02:31 2010 (r46843)
@@ -89,8 +89,9 @@
my $heading = $headerizer->generate_documentation_signature($decl);
- $text =~ s/=item C<[^>]*\b$name\b[^>]*>\n+/$heading\n\n/sm or
- warn "$cfile_name: $name has no POD\n";
+ $text =~ s/=item C<[^>]*\b$name\b[^>]*>\n+/$heading\n\n/sm or do {
+ warn "$cfile_name: $name has no POD\n" unless $name =~ /^yy/; # lexer funcs don't have to have POD
+ }
}
open( my $fhout, '>', $cfile_name ) or die "Can't create $cfile_name: $!";
print {$fhout} $text;
@@ -126,7 +127,9 @@
push( @attrs, "__attribute__nonnull__($n)" );
}
if ( ( $arg =~ m{\*} ) && ( $arg !~ /\b(SHIM|((ARGIN|ARGOUT|ARGMOD)(_NULLOK)?)|ARGFREE(_NOTNULL)?)\b/ ) ) {
- $headerizer->squawk( $file, $name, qq{"$arg" isn't protected with an ARGIN, ARGOUT or ARGMOD (or a _NULLOK variant), or ARGFREE} );
+ if ( $name !~ /^yy/ ) { # Don't complain about the lexer auto-generated funcs
+ $headerizer->squawk( $file, $name, qq{"$arg" isn't protected with an ARGIN, ARGOUT or ARGMOD (or a _NULLOK variant), or ARGFREE} );
+ }
}
if ( ($arg =~ /\bconst\b/) && ($arg =~ /\*/) && ($arg !~ /\*\*/) && ($arg =~ /\b(ARG(MOD|OUT))\b/) ) {
$headerizer->squawk( $file, $name, qq{"$arg" is const, but that $1 conflicts with const} );
More information about the parrot-commits
mailing list