[svn:parrot] r48410 - in branches/dynop_mapping: . compilers/data_json compilers/imcc compilers/opsc/src/Ops/Trans compilers/pct compilers/pge compilers/tge config/auto/sizes config/auto/zlib docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cygwin ports/debian runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math src src/call src/dynpmc src/gc src/interp src/ops src/pmc src/runcore t/codingstd t/compilers/tge t/oo t/pmc t/src t/steps/init/hints tools/build tools/dev tools/util
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Wed Aug 11 04:50:49 UTC 2010
Author: plobsing
Date: Wed Aug 11 04:50:48 2010
New Revision: 48410
URL: https://trac.parrot.org/parrot/changeset/48410
Log:
sync with trunk
Added:
branches/dynop_mapping/t/codingstd/pmc_docs.t
- copied unchanged from r48409, trunk/t/codingstd/pmc_docs.t
Modified:
branches/dynop_mapping/ (props changed)
branches/dynop_mapping/CREDITS
branches/dynop_mapping/MANIFEST
branches/dynop_mapping/compilers/data_json/Rules.mak (props changed)
branches/dynop_mapping/compilers/imcc/Rules.in (props changed)
branches/dynop_mapping/compilers/opsc/src/Ops/Trans/C.pm
branches/dynop_mapping/compilers/pct/Rules.mak (props changed)
branches/dynop_mapping/compilers/pge/Rules.mak (props changed)
branches/dynop_mapping/compilers/tge/Rules.mak (props changed)
branches/dynop_mapping/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/dynop_mapping/config/auto/zlib/ (props changed)
branches/dynop_mapping/docs/book/draft/README (props changed)
branches/dynop_mapping/docs/book/draft/appa_glossary.pod (props changed)
branches/dynop_mapping/docs/book/draft/appb_patch_submission.pod (props changed)
branches/dynop_mapping/docs/book/draft/appc_command_line_options.pod (props changed)
branches/dynop_mapping/docs/book/draft/appd_build_options.pod (props changed)
branches/dynop_mapping/docs/book/draft/appe_source_code.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch01_introduction.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch02_getting_started.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch08_dynops.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/dynop_mapping/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/dynop_mapping/docs/book/draft/chXX_hlls.pod (props changed)
branches/dynop_mapping/docs/book/draft/chXX_library.pod (props changed)
branches/dynop_mapping/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/dynop_mapping/docs/book/pct/ch01_introduction.pod (props changed)
branches/dynop_mapping/docs/book/pct/ch02_getting_started.pod (props changed)
branches/dynop_mapping/docs/book/pct/ch03_compiler_tools.pod (props changed)
branches/dynop_mapping/docs/book/pct/ch04_pge.pod (props changed)
branches/dynop_mapping/docs/book/pct/ch05_nqp.pod (props changed)
branches/dynop_mapping/docs/dev/c_functions.pod (props changed)
branches/dynop_mapping/docs/pdds/pdd30_install.pod (props changed)
branches/dynop_mapping/examples/embed/cotorra.c (props changed)
branches/dynop_mapping/examples/languages/abc/ (props changed)
branches/dynop_mapping/examples/languages/squaak/ (props changed)
branches/dynop_mapping/examples/pge/demo.pir (props changed)
branches/dynop_mapping/ext/nqp-rx/Rules.mak (props changed)
branches/dynop_mapping/include/parrot/call.h (contents, props changed)
branches/dynop_mapping/include/parrot/gc_api.h (props changed)
branches/dynop_mapping/include/parrot/memory.h
branches/dynop_mapping/include/parrot/runcore_api.h (props changed)
branches/dynop_mapping/include/parrot/runcore_profiling.h (props changed)
branches/dynop_mapping/include/parrot/runcore_trace.h (props changed)
branches/dynop_mapping/lib/Parrot/Configure/Step/Test.pm (props changed)
branches/dynop_mapping/lib/Parrot/H2inc.pm (props changed)
branches/dynop_mapping/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/dynop_mapping/ports/debian/libparrot-dev.install.in (props changed)
branches/dynop_mapping/ports/debian/libparrot.install.in (props changed)
branches/dynop_mapping/ports/debian/parrot-doc.install.in (props changed)
branches/dynop_mapping/ports/debian/parrot.install.in (props changed)
branches/dynop_mapping/runtime/parrot/languages/ (props changed)
branches/dynop_mapping/runtime/parrot/library/Math/Rand.pir (props changed)
branches/dynop_mapping/runtime/parrot/library/Rules.mak (props changed)
branches/dynop_mapping/src/call/args.c
branches/dynop_mapping/src/call/ops.c (props changed)
branches/dynop_mapping/src/call/pcc.c (props changed)
branches/dynop_mapping/src/dynpmc/rational.pmc
branches/dynop_mapping/src/exceptions.c
branches/dynop_mapping/src/gc/alloc_memory.c (contents, props changed)
branches/dynop_mapping/src/gc/alloc_resources.c (props changed)
branches/dynop_mapping/src/gc/api.c (props changed)
branches/dynop_mapping/src/gc/malloc.c (props changed)
branches/dynop_mapping/src/gc/malloc_trace.c (props changed)
branches/dynop_mapping/src/gc/mark_sweep.c (props changed)
branches/dynop_mapping/src/gc/system.c (props changed)
branches/dynop_mapping/src/hash.c
branches/dynop_mapping/src/interp/inter_cb.c (props changed)
branches/dynop_mapping/src/interp/inter_create.c (props changed)
branches/dynop_mapping/src/interp/inter_misc.c (props changed)
branches/dynop_mapping/src/ops/core_ops.c
branches/dynop_mapping/src/pmc/coroutine.pmc
branches/dynop_mapping/src/pmc/fixedintegerarray.pmc
branches/dynop_mapping/src/pmc/hash.pmc
branches/dynop_mapping/src/pmc/hashiterator.pmc
branches/dynop_mapping/src/pmc/role.pmc
branches/dynop_mapping/src/pmc/sub.pmc
branches/dynop_mapping/src/pmc/threadinterpreter.pmc
branches/dynop_mapping/src/runcore/cores.c (props changed)
branches/dynop_mapping/src/runcore/main.c (props changed)
branches/dynop_mapping/src/runcore/profiling.c (props changed)
branches/dynop_mapping/src/runcore/trace.c (props changed)
branches/dynop_mapping/t/compilers/tge/NoneGrammar.tg (props changed)
branches/dynop_mapping/t/oo/objects.t (props changed)
branches/dynop_mapping/t/oo/root_new.t (props changed)
branches/dynop_mapping/t/pmc/namespace-old.t (props changed)
branches/dynop_mapping/t/src/embed.t (props changed)
branches/dynop_mapping/t/steps/init/hints/linux-01.t (props changed)
branches/dynop_mapping/tools/build/h2inc.pl (props changed)
branches/dynop_mapping/tools/dev/fetch_languages.pl (props changed)
branches/dynop_mapping/tools/dev/mk_gitignore.pl (props changed)
branches/dynop_mapping/tools/util/perlcritic-cage.conf (props changed)
Modified: branches/dynop_mapping/CREDITS
==============================================================================
--- branches/dynop_mapping/CREDITS Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/CREDITS Wed Aug 11 04:50:48 2010 (r48410)
@@ -810,6 +810,10 @@
D: Pynie
E: pmichaud at pobox.com
+N: Paul C. Anagnostopoulos
+U: Paul_the_Greek
+D: Memory management
+
N: Paul Cochrane
U: paultcochrane
D: Changing the newspaper in the parrot cage
Modified: branches/dynop_mapping/MANIFEST
==============================================================================
--- branches/dynop_mapping/MANIFEST Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/MANIFEST Wed Aug 11 04:50:48 2010 (r48410)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Aug 3 18:21:50 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Aug 8 16:31:42 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -1503,6 +1503,7 @@
t/codingstd/pdd_format.t [test]
t/codingstd/perlcritic.t [test]
t/codingstd/pir_code_coda.t [test]
+t/codingstd/pmc_docs.t [test]
t/codingstd/pod_description.t [test]
t/codingstd/pod_syntax.t [test]
t/codingstd/pod_todo.t [test]
Modified: branches/dynop_mapping/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- branches/dynop_mapping/compilers/opsc/src/Ops/Trans/C.pm Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/compilers/opsc/src/Ops/Trans/C.pm Wed Aug 11 04:50:48 2010 (r48410)
@@ -280,11 +280,13 @@
op_info_t * info;
struct hop *next;
} HOP;
+
+static HOP *hop_buckets;
static HOP **hop;
static void hop_init(PARROT_INTERP);
static size_t hash_str(const char *str);
-static void store_op(PARROT_INTERP, op_info_t *info, int full);
+static void store_op(PARROT_INTERP, op_info_t *info, HOP *p, int full);
/* XXX on changing interpreters, this should be called,
through a hook */
@@ -316,9 +318,8 @@
return key;
}
-static void store_op(PARROT_INTERP, op_info_t *info, int full)
+static void store_op(PARROT_INTERP, op_info_t *info, HOP *p, int full)
{
- HOP * const p = mem_gc_allocate_zeroed_typed(interp, HOP);
const size_t hidx =
hash_str(full ? info->full_name : info->name) % OP_HASH_SIZE;
@@ -344,32 +345,34 @@
static void hop_init(PARROT_INTERP)
{
- size_t i;
op_info_t * const info = [[BS]]op_lib.op_info_table;
+
+ /* allocate the storage all in one chunk
+ * yes, this is profligate, but we can tighten it later */
+ HOP *hops = hop_buckets =
+ mem_gc_allocate_n_zeroed_typed(interp, [[BS]]op_lib.op_count * 2, HOP );
+
+ size_t i;
+
/* store full names */
for (i = 0; i < [[BS]]op_lib.op_count; i++)
- store_op(interp, info + i, 1);
+ store_op(interp, info + i, hops++, 1);
+
/* plus one short name */
for (i = 0; i < [[BS]]op_lib.op_count; i++)
if (get_op(interp, info[i].name, 0) == -1)
- store_op(interp, info + i, 0);
+ store_op(interp, info + i, hops++, 0);
}
static void hop_deinit(PARROT_INTERP)
{
- if (hop) {
- size_t i;
- for (i = 0; i < OP_HASH_SIZE; i++) {
- HOP *p = hop[i];
- while (p) {
- HOP * const next = p->next;
- mem_gc_free(interp, p);
- p = next;
- }
- }
+ if (hop)
mem_sys_free(hop);
- hop = NULL;
- }
+ if (hop_buckets)
+ mem_gc_free(interp, hop_buckets);
+
+ hop = NULL;
+ hop_buckets = NULL;
}|;
$fh.print(subst($res, /'[[' BS ']]'/, $emitter.bs, :global));
Modified: branches/dynop_mapping/include/parrot/call.h
==============================================================================
--- branches/dynop_mapping/include/parrot/call.h Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/include/parrot/call.h Wed Aug 11 04:50:48 2010 (r48410)
@@ -29,6 +29,7 @@
* jump buffer stack */
opcode_t *handler_start; /* Used in exception handling */
int id; /* runloop id */
+ PMC *exception; /* Reference to the exception object */
/* let the biggest element cross the cacheline boundary */
Parrot_jump_buff resume; /* jmp_buf */
Modified: branches/dynop_mapping/include/parrot/memory.h
==============================================================================
--- branches/dynop_mapping/include/parrot/memory.h Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/include/parrot/memory.h Wed Aug 11 04:50:48 2010 (r48410)
@@ -17,20 +17,33 @@
/* Use these macros instead of calling the functions listed below. */
/* They protect against things like passing null to mem__sys_realloc, */
/* which is not portable. */
-#define mem_internal_allocate(x) mem__internal_allocate((x), __FILE__, __LINE__)
-#define mem_internal_allocate_typed(type) \
- (type *)mem__internal_allocate(sizeof (type), __FILE__, __LINE__)
-#define mem_internal_allocate_zeroed(x) mem__internal_allocate_zeroed((x), \
- __FILE__, __LINE__)
+
+/* It was decided that having a second set of memory allocation functions
+ is a waste. These macros were rewritten to use the much more prevalent
+ mem_sys_* functions and then the mem__internal_* functions were
+ eliminated. */
+
+#define mem_internal_allocate(x) mem_sys_allocate(x)
+
+#define mem_internal_allocate_typed(type) (type *)mem_sys_allocate(sizeof (type))
+
+#define mem_internal_allocate_zeroed(x) mem_sys_allocate_zeroed(x)
+
#define mem_internal_allocate_zeroed_typed(type) \
- (type *)mem__internal_allocate_zeroed(sizeof (type), __FILE__, __LINE__)
+ (type *)mem_sys_allocate_zeroed(sizeof (type))
+
#define mem_internal_allocate_n_zeroed_typed(n, type) \
- (type *)mem__internal_allocate_zeroed((n) * sizeof (type), __FILE__, __LINE__)
+ (type *)mem_sys_allocate_zeroed((n) * sizeof (type))
+
+#define mem_internal_realloc(x, y) mem_sys_realloc((x), (y))
+
+#define mem_internal_realloc_zeroed(p, x, y) mem_sys_realloc_zeroed((p), (x), (y))
+
+#define mem_internal_realloc_n_zeroed_typed(p, x, y, type) \
+ (type *)mem_sys_realloc_zeroed((p), (x) * sizeof (type), (y) * sizeof (type))
+
+#define mem_internal_free(x) mem_sys_free(x)
-#define mem_internal_realloc(x, y) mem__internal_realloc((x), (y), __FILE__, __LINE__)
-#define mem_internal_realloc_zeroed(p, x, y) mem__internal_realloc_zeroed((p), (x), (y), __FILE__, __LINE__)
-#define mem_internal_realloc_n_zeroed_typed(p, x, y, type) (type *)mem__internal_realloc_zeroed((p), (x) * sizeof (type), (y) * sizeof (type), __FILE__, __LINE__)
-#define mem_internal_free(x) mem__internal_free((x), __FILE__, __LINE__)
#define mem_sys_memcopy memcpy
#define mem_sys_memmove memmove
@@ -93,47 +106,6 @@
char * mem_sys_strdup(ARGIN(const char *src))
__attribute__nonnull__(1);
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void * mem__internal_allocate(
- size_t size,
- ARGIN(const char *file),
- int line)
- __attribute__nonnull__(2);
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void * mem__internal_allocate_zeroed(
- size_t size,
- ARGIN(const char *file),
- int line)
- __attribute__nonnull__(2);
-
-void mem__internal_free(
- ARGFREE(void *from),
- ARGIN(const char *file),
- int line)
- __attribute__nonnull__(2);
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void * mem__internal_realloc(
- ARGFREE(void *from),
- size_t size,
- ARGIN(const char *file),
- int line)
- __attribute__nonnull__(3);
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void * mem__internal_realloc_zeroed(
- ARGFREE(void *from),
- size_t size,
- size_t old_size,
- ARGIN(const char *file),
- int line)
- __attribute__nonnull__(4);
-
#define ASSERT_ARGS_mem_sys_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_mem_sys_allocate_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_mem_sys_free __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
@@ -141,16 +113,6 @@
#define ASSERT_ARGS_mem_sys_realloc_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_mem_sys_strdup __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_mem__internal_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(file))
-#define ASSERT_ARGS_mem__internal_allocate_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(file))
-#define ASSERT_ARGS_mem__internal_free __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(file))
-#define ASSERT_ARGS_mem__internal_realloc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(file))
-#define ASSERT_ARGS_mem__internal_realloc_zeroed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(file))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/alloc_memory.c */
Modified: branches/dynop_mapping/src/call/args.c
==============================================================================
--- branches/dynop_mapping/src/call/args.c Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/call/args.c Wed Aug 11 04:50:48 2010 (r48410)
@@ -563,9 +563,9 @@
ARGMOD(va_list *args))
{
ASSERT_ARGS(Parrot_pcc_build_call_from_varargs)
- PMC * arg_flags = PMCNULL;
- PMC * call_object;
- INTVAL i = 0;
+ PMC *call_object;
+ PMC *arg_flags = PMCNULL;
+ INTVAL i = 0;
if (PMC_IS_NULL(signature))
call_object = Parrot_pmc_new(interp, enum_class_CallContext);
@@ -816,29 +816,29 @@
/* If the parameter is slurpy, collect all remaining positional
* arguments into an array.*/
if (param_flags & PARROT_ARG_SLURPY_ARRAY) {
- PMC *collect_positional;
- int j;
-
/* Can't handle named slurpy here, go to named argument handling */
- if (param_flags & PARROT_ARG_NAME)
- break;
+ if (!(param_flags & PARROT_ARG_NAME)) {
+ PMC *collect_positional;
+ int j;
+ INTVAL num_positionals = positional_args - arg_index;
+ if (num_positionals < 0)
+ num_positionals = 0;
+ if (named_count > 0)
+ Parrot_ex_throw_from_c_args(interp, NULL,
+ EXCEPTION_INVALID_OPERATION,
+ "named parameters must follow all positional parameters");
- if (named_count > 0)
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_INVALID_OPERATION,
- "named parameters must follow all positional parameters");
+ collect_positional = Parrot_pmc_new_init_int(interp,
+ Parrot_get_ctx_HLL_type(interp, enum_class_ResizablePMCArray),
+ num_positionals);
- collect_positional = Parrot_pmc_new_init_int(interp,
- Parrot_get_ctx_HLL_type(interp, enum_class_ResizablePMCArray),
- positional_args - arg_index);
-
- for (j = 0; arg_index < positional_args; ++arg_index) {
- VTABLE_set_pmc_keyed_int(interp, collect_positional, j++,
- VTABLE_get_pmc_keyed_int(interp, call_object, arg_index));
- }
+ for (j = 0; arg_index < positional_args; ++arg_index)
+ VTABLE_set_pmc_keyed_int(interp, collect_positional, j++,
+ VTABLE_get_pmc_keyed_int(interp, call_object, arg_index));
- *accessor->pmc(interp, arg_info, param_index) = collect_positional;
- ++param_index;
+ *accessor->pmc(interp, arg_info, param_index) = collect_positional;
+ ++param_index;
+ }
break; /* Terminate the positional arg loop. */
}
@@ -1364,10 +1364,10 @@
ARGMOD(PMC **arg_flags))
{
ASSERT_ARGS(parse_signature_string)
- PMC *current_array;
+ PMC *current_array;
const char *x;
- INTVAL flags = 0;
- INTVAL set = 0;
+ INTVAL flags = 0;
+ INTVAL set = 0;
if (PMC_IS_NULL(*arg_flags))
*arg_flags = Parrot_pmc_new(interp, enum_class_ResizableIntegerArray);
Modified: branches/dynop_mapping/src/dynpmc/rational.pmc
==============================================================================
--- branches/dynop_mapping/src/dynpmc/rational.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/dynpmc/rational.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -46,7 +46,7 @@
/*
-=item * static STRING *rat_get_string_to_base(PARROT_INTERP, PMC *self, int base)
+=item C<static STRING *rat_get_string_to_base(PARROT_INTERP, PMC *self, int base)>
Returns a string representation of a Rational-PMC to a certain base.
@@ -66,7 +66,7 @@
/*
-=item * static void rat_add_integer(PARROT_INTERP, PMC *self, int value)
+=item C<static void rat_add_integer(PARROT_INTERP, PMC *self, int value)>
Adds an integer "value" to a Rational-PMC inplace.
@@ -87,7 +87,7 @@
/*
-=item * static void rat_add_float(PARROT_INTERP, PMC *self, double value)
+=item C<static void rat_add_float(PARROT_INTERP, PMC *self, double value)>
Adds a float "value" to a Rational-PMC in-place. "value" is first conveted to a
rational using GMPs mpq_set_d-function. This is meant to be exact.
@@ -110,7 +110,7 @@
/*
-=item * static void rat_multiply_integer(PARROT_INTERP, PMC *self, int value)
+=item C<static void rat_multiply_integer(PARROT_INTERP, PMC *self, int value)>
Multiplys a Rational-PMC with an integer "value" in-place.
@@ -127,7 +127,7 @@
/*
-=item * static void rat_multiply_float(PARROT_INTERP, PMC *self, double value)
+=item C<static void rat_multiply_float(PARROT_INTERP, PMC *self, double value)>
Multiplies a Rational-PMC with a float "value" in-place.
@@ -149,7 +149,7 @@
/*
-=item * static void rat_divide_integer(PARROT_INTERP, PMC *self, int value)
+=item C<static void rat_divide_integer(PARROT_INTERP, PMC *self, int value)>
Divides a Rational-PMC through an integer "value" in-place.
@@ -171,7 +171,7 @@
/*
-=item * static void rat_divide_float(PARROT_INTERP, PMC *self, double value)
+=item C<static void rat_divide_float(PARROT_INTERP, PMC *self, double value)>
Divides a Rational-PMC through a float "value" in-place.
Modified: branches/dynop_mapping/src/exceptions.c
==============================================================================
--- branches/dynop_mapping/src/exceptions.c Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/exceptions.c Wed Aug 11 04:50:48 2010 (r48410)
@@ -242,6 +242,7 @@
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
/* it's a C exception handler */
Parrot_runloop * const jump_point = (Parrot_runloop *)address;
+ jump_point->exception = exception;
longjmp(jump_point->resume, 1);
}
@@ -367,6 +368,7 @@
if (PObj_get_FLAGS(handler) & SUB_FLAG_C_HANDLER) {
Parrot_runloop * const jump_point =
(Parrot_runloop * const)VTABLE_get_pointer(interp, handler);
+ jump_point->exception = exception;
longjmp(jump_point->resume, 1);
}
Modified: branches/dynop_mapping/src/gc/alloc_memory.c
==============================================================================
--- branches/dynop_mapping/src/gc/alloc_memory.c Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/gc/alloc_memory.c Wed Aug 11 04:50:48 2010 (r48410)
@@ -64,37 +64,6 @@
/*
-=item C<void * mem__internal_allocate(size_t size, const char *file, int line)>
-
-Calls C<malloc> to allocate memory from the system, Panics if there is no
-memory available. If C<DETAIL_MEMORY_DEBUG> macro is defined, prints
-debug information to C<STDERR>.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void *
-mem__internal_allocate(size_t size, ARGIN(const char *file), int line)
-{
- ASSERT_ARGS(mem__internal_allocate)
- void * const ptr = malloc((size_t)size);
-#ifdef DETAIL_MEMORY_DEBUG
- fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
- size, ptr, file, line);
-#else
- UNUSED(file);
- UNUSED(line);
-#endif
- if (!ptr)
- PANIC_OUT_OF_MEM(size);
- return ptr;
-}
-
-/*
-
=item C<void * mem_sys_allocate_zeroed(size_t size)>
Uses C<calloc> to allocate system memory. Guaranteed to succeed, Panics
@@ -122,38 +91,6 @@
/*
-=item C<void * mem__internal_allocate_zeroed(size_t size, const char *file, int
-line)>
-
-Uses C<calloc> to allocate system memory. Guaranteed to succeed, Panics
-otherwise. If C<DETAIL_MEMORY_DEBUG> macro is defined, prints
-debug information to C<STDERR>.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void *
-mem__internal_allocate_zeroed(size_t size, ARGIN(const char *file), int line)
-{
- ASSERT_ARGS(mem__internal_allocate_zeroed)
- void * const ptr = calloc(1, (size_t)size);
-#ifdef DETAIL_MEMORY_DEBUG
- fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
- size, ptr, file, line);
-#else
- UNUSED(file);
- UNUSED(line);
-#endif
- if (!ptr)
- PANIC_OUT_OF_MEM(size);
- return ptr;
-}
-
-/*
-
=item C<void * mem_sys_realloc(void *from, size_t size)>
Resizes a chunk of memory. Unlike C<realloc>, it can handle a
@@ -226,81 +163,6 @@
/*
-=item C<void * mem__internal_realloc(void *from, size_t size, const char *file,
-int line)>
-
-Resizes a chunk of system memory. Unlike C<realloc>, it can handle a
-NULL pointer, in which case a new memory block is allocated for the
-requested size. If C<DETAIL_MEMORY_DEBUG> macro is defined, debug
-information is printed to C<STDERR>.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void *
-mem__internal_realloc(ARGFREE(void *from), size_t size,
- ARGIN(const char *file), int line)
-{
- ASSERT_ARGS(mem__internal_realloc)
- void * const ptr = realloc(from, size);
-#ifdef DETAIL_MEMORY_DEBUG
- fprintf(stderr, "internal free of %p (realloc -- %i bytes) (%s/%d)\n",
- from, size, file, line);
- fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
- size, ptr, file, line);
-#else
- UNUSED(file);
- UNUSED(line);
-#endif
- if (!ptr)
- PANIC_OUT_OF_MEM(size);
- return ptr;
-}
-
-/*
-
-=item C<void * mem__internal_realloc_zeroed(void *from, size_t size, size_t
-old_size, const char *file, int line)>
-
-Reallocates a given buffer of size C<old_size> to C<size>. If the new size
-is larger then the old size, the difference is filled with zeros. Contains
-debugging information, and can print filename and line number where it is
-used if C<DETAIL_MEMORY_DEBUG> is defined.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-void *
-mem__internal_realloc_zeroed(ARGFREE(void *from), size_t size, size_t old_size,
- ARGIN(const char *file), int line)
-{
- ASSERT_ARGS(mem__internal_realloc_zeroed)
- void * const ptr = realloc(from, size);
-#ifdef DETAIL_MEMORY_DEBUG
- fprintf(stderr, "internal free of %p (realloc -- %i bytes) (%s/%d)\n",
- from, size, file, line);
- fprintf(stderr, "Internal malloc %i at %p (%s/%d)\n",
- size, ptr, file, line);
-#else
- UNUSED(file);
- UNUSED(line);
-#endif
- if (!ptr)
- PANIC_OUT_OF_MEM(size);
- if (size > old_size)
- memset((char*)ptr + old_size, 0, size - old_size);
-
- return ptr;
-}
-
-/*
-
=item C<void mem_sys_free(void *from)>
Frees a chunk of memory back to the system.
@@ -323,31 +185,6 @@
/*
-=item C<void mem__internal_free(void *from, const char *file, int line)>
-
-Frees a chunk of memory back to the system. If
-C<DETAIL_MEMORY_DEBUG> macro is defined, prints debug information to
-C<STDERR>.
-
-=cut
-
-*/
-
-void
-mem__internal_free(ARGFREE(void *from), ARGIN(const char *file), int line)
-{
- ASSERT_ARGS(mem__internal_free)
-#ifdef DETAIL_MEMORY_DEBUG
- fprintf(stderr, "Internal free of %p (%s/%d)\n", from, file, line);
-#else
- UNUSED(file);
- UNUSED(line);
-#endif
- free(from);
-}
-
-/*
-
=item C<char * mem_sys_strdup(const char *src)>
Copy a C string to a new block of memory allocated with mem_sys_allocate,
Modified: branches/dynop_mapping/src/hash.c
==============================================================================
--- branches/dynop_mapping/src/hash.c Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/hash.c Wed Aug 11 04:50:48 2010 (r48410)
@@ -508,23 +508,20 @@
parrot_mark_hash_keys(PARROT_INTERP, ARGIN(Hash *hash))
{
ASSERT_ARGS(parrot_mark_hash_keys)
- UINTVAL entries = hash->entries;
- UINTVAL found = 0;
- INTVAL i;
+ const UINTVAL entries = hash->entries;
+ UINTVAL found = 0;
+ UINTVAL i;
- for (i = hash->mask; i >= 0; --i) {
- HashBucket *bucket = hash->bucket_indices[i];
+ HashBucket *bucket = hash->buckets;
- while (bucket) {
- if (++found > entries)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Detected hash corruption at hash %p entries %d",
- hash, (int)entries);
+ for (i= 0; i <= hash->mask; ++i, ++bucket) {
+ if (bucket->key){
PARROT_ASSERT(bucket->key);
Parrot_gc_mark_PObj_alive(interp, (PObj *)bucket->key);
- bucket = bucket->next;
+ if (++found >= entries)
+ break;
}
}
}
@@ -545,22 +542,19 @@
{
ASSERT_ARGS(parrot_mark_hash_values)
const UINTVAL entries = hash->entries;
- UINTVAL found = 0;
- INTVAL i;
+ UINTVAL found = 0;
+ UINTVAL i;
- for (i = hash->mask; i >= 0; --i) {
- HashBucket *bucket = hash->bucket_indices[i];
+ HashBucket *bucket = hash->buckets;
- while (bucket) {
- if (++found > entries)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Detected hash corruption at hash %p entries %d",
- hash, (int)entries);
+ for (i= 0; i <= hash->mask; ++i, ++bucket) {
+ if (bucket->key){
PARROT_ASSERT(bucket->value);
Parrot_gc_mark_PObj_alive(interp, (PObj *)bucket->value);
- bucket = bucket->next;
+ if (++found >= entries)
+ break;
}
}
}
@@ -580,30 +574,25 @@
{
ASSERT_ARGS(parrot_mark_hash_both)
const UINTVAL entries = hash->entries;
- UINTVAL found = 0;
- INTVAL i;
+ UINTVAL found = 0;
+ UINTVAL i;
- for (i = hash->mask; i >= 0; --i) {
- HashBucket *bucket = hash->bucket_indices[i];
-
- while (bucket) {
- if (++found > entries)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Detected hash corruption at hash %p entries %d",
- hash, (int)entries);
+ HashBucket *bucket = hash->buckets;
+ for (i= 0; i <= hash->mask; ++i, ++bucket) {
+ if (bucket->key){
PARROT_ASSERT(bucket->key);
Parrot_gc_mark_PObj_alive(interp, (PObj *)bucket->key);
PARROT_ASSERT(bucket->value);
Parrot_gc_mark_PObj_alive(interp, (PObj *)bucket->value);
- bucket = bucket->next;
+ if (++found >= entries)
+ break;
}
}
}
-
/*
=item C<static void hash_thaw(PARROT_INTERP, Hash *hash, PMC *info)>
Modified: branches/dynop_mapping/src/ops/core_ops.c
==============================================================================
--- branches/dynop_mapping/src/ops/core_ops.c Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/ops/core_ops.c Wed Aug 11 04:50:48 2010 (r48410)
@@ -26132,11 +26132,13 @@
op_info_t * info;
struct hop *next;
} HOP;
+
+static HOP *hop_buckets;
static HOP **hop;
static void hop_init(PARROT_INTERP);
static size_t hash_str(const char *str);
-static void store_op(PARROT_INTERP, op_info_t *info, int full);
+static void store_op(PARROT_INTERP, op_info_t *info, HOP *p, int full);
/* XXX on changing interpreters, this should be called,
through a hook */
@@ -26168,9 +26170,8 @@
return key;
}
-static void store_op(PARROT_INTERP, op_info_t *info, int full)
+static void store_op(PARROT_INTERP, op_info_t *info, HOP *p, int full)
{
- HOP * const p = mem_gc_allocate_zeroed_typed(interp, HOP);
const size_t hidx =
hash_str(full ? info->full_name : info->name) % OP_HASH_SIZE;
@@ -26196,32 +26197,34 @@
static void hop_init(PARROT_INTERP)
{
- size_t i;
op_info_t * const info = core_op_lib.op_info_table;
+
+ /* allocate the storage all in one chunk
+ * yes, this is profligate, but we can tighten it later */
+ HOP *hops = hop_buckets =
+ mem_gc_allocate_n_zeroed_typed(interp, core_op_lib.op_count * 2, HOP );
+
+ size_t i;
+
/* store full names */
for (i = 0; i < core_op_lib.op_count; i++)
- store_op(interp, info + i, 1);
+ store_op(interp, info + i, hops++, 1);
+
/* plus one short name */
for (i = 0; i < core_op_lib.op_count; i++)
if (get_op(interp, info[i].name, 0) == -1)
- store_op(interp, info + i, 0);
+ store_op(interp, info + i, hops++, 0);
}
static void hop_deinit(PARROT_INTERP)
{
- if (hop) {
- size_t i;
- for (i = 0; i < OP_HASH_SIZE; i++) {
- HOP *p = hop[i];
- while (p) {
- HOP * const next = p->next;
- mem_gc_free(interp, p);
- p = next;
- }
- }
+ if (hop)
mem_sys_free(hop);
- hop = NULL;
- }
+ if (hop_buckets)
+ mem_gc_free(interp, hop_buckets);
+
+ hop = NULL;
+ hop_buckets = NULL;
}
op_lib_t *
Parrot_DynOp_core_2_6_0(PARROT_INTERP, long init) {
Modified: branches/dynop_mapping/src/pmc/coroutine.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/coroutine.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/coroutine.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -46,6 +46,15 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+/*
+
+=item C<static void print_sub_name(PARROT_INTERP, PMC *sub_pmc)>
+
+
+
+=cut
+
+*/
static void
print_sub_name(PARROT_INTERP, ARGIN(PMC *sub_pmc))
Modified: branches/dynop_mapping/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/fixedintegerarray.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/fixedintegerarray.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -34,6 +34,16 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+/*
+
+=item C<static int auxcmpfunc(const INTVAL *i, const INTVAL *j)>
+
+
+
+=cut
+
+*/
+
PARROT_PURE_FUNCTION
static int
auxcmpfunc(ARGIN(const INTVAL *i), ARGIN(const INTVAL *j))
Modified: branches/dynop_mapping/src/pmc/hash.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/hash.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/hash.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -697,12 +697,12 @@
GET_ATTR_hash(INTERP, SELF, hash);
- /* special case the most key type, for speed */
- if (hash->key_type == Hash_key_type_STRING)
- b = parrot_hash_get_bucket(INTERP, hash, key);
- else
- b = parrot_hash_get_bucket(INTERP, hash,
- hash_key_from_string(INTERP, hash, key));
+ /* special case the most likely key type, for speed */
+ key = hash->key_type == Hash_key_type_STRING
+ ? key
+ : (STRING *)hash_key_from_string(INTERP, hash, key);
+
+ b = parrot_hash_get_bucket(INTERP, hash, key);
if (!b)
return PMCNULL;
Modified: branches/dynop_mapping/src/pmc/hashiterator.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/hashiterator.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/hashiterator.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -66,8 +66,12 @@
/*
+=item C<static void advance_to_next(PARROT_INTERP, PMC *self)>
+
Advance to next position. Return found (if any) HashBucket.
+=cut
+
*/
static void
@@ -191,6 +195,7 @@
Returns this Iterator's Hash.
=cut
+
*/
VTABLE PMC* get_pmc() {
return PARROT_HASHITERATOR(SELF)->pmc_hash;
Modified: branches/dynop_mapping/src/pmc/role.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/role.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/role.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -68,7 +68,16 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-/* Takes a hash and initializes the role based on it. */
+/*
+
+=item C<static void init_role_from_hash(PARROT_INTERP, PMC *self, PMC *info)>
+
+Takes a hash and initializes the role based on it.
+
+=cut
+
+*/
+
static void
init_role_from_hash(PARROT_INTERP, ARGIN(PMC *self), ARGIN(PMC *info))
{
Modified: branches/dynop_mapping/src/pmc/sub.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/sub.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/sub.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -33,6 +33,16 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
+/*
+
+=item C<static void print_sub_name(PARROT_INTERP, PMC *sub)>
+
+
+
+=cut
+
+*/
+
static void
print_sub_name(PARROT_INTERP, ARGIN_NULLOK(PMC *sub))
{
@@ -1145,7 +1155,10 @@
(Experimental) Returns Sub flags.
+=back
+
=cut
+
*/
METHOD comp_flags() {
Parrot_Sub_attributes *sub;
Modified: branches/dynop_mapping/src/pmc/threadinterpreter.pmc
==============================================================================
--- branches/dynop_mapping/src/pmc/threadinterpreter.pmc Wed Aug 11 04:22:01 2010 (r48409)
+++ branches/dynop_mapping/src/pmc/threadinterpreter.pmc Wed Aug 11 04:50:48 2010 (r48410)
@@ -44,6 +44,17 @@
* can't do multi-threaded GC yet
* XXX a quick hack to pass the few tests
*/
+
+/*
+
+=item C<static void stop_GC(Interp *parent, Interp *thread)>
+
+
+
+=cut
+
+*/
+
static void
stop_GC(ARGMOD(Interp *parent), ARGMOD(Interp *thread))
{
Copied: branches/dynop_mapping/t/codingstd/pmc_docs.t (from r48409, trunk/t/codingstd/pmc_docs.t)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/dynop_mapping/t/codingstd/pmc_docs.t Wed Aug 11 04:50:48 2010 (r48410, copy of r48409, trunk/t/codingstd/pmc_docs.t)
@@ -0,0 +1,150 @@
+#! perl
+# Copyright (C) 2006-2010, Parrot Foundation.
+# $Id$
+
+use strict;
+use warnings;
+
+use lib qw( . lib ../lib ../../lib );
+use Test::More;
+use Parrot::Config qw(%PConfig);
+use Parrot::Distribution;
+use Parrot::Headerizer;
+
+=head1 NAME
+
+t/codingstd/pmc_docs.t - checks for missing function documentation
+
+=head1 SYNOPSIS
+
+ # test all files
+ % prove t/codingstd/pmc_docs.t
+
+ # test specific files
+ % perl t/codingstd/pmc_docs.t src/foo.pmc src/bar.pmc
+
+=head1 DESCRIPTION
+
+Checks that all PMC source files have documentation for each function
+declared.
+
+=cut
+
+my $DIST = Parrot::Distribution->new;
+my $headerizer = Parrot::Headerizer->new;
+
+my @files = @ARGV ? @ARGV :
+ map {s/^$PConfig{build_dir}\///; $_}
+ map {s/\\/\//g; $_}
+ map {$_->path} $DIST->pmc_source_files();
+
+plan tests => scalar @files;
+
+my %todos;
+while (<DATA>) {
+ next if /^#/;
+ next if /^\s*$/;
+ chomp;
+ $todos{$_} = 1;
+}
+
+my %all_files = ();
+
+# Traverse each file, analyzing each function declaration therein, then
+# post results in %all_files.
+
+foreach my $path (@files) {
+ my $buf = $DIST->slurp($path);
+ my @function_decls = $headerizer->extract_function_declarations($buf);
+
+ # We start out asserting that every file will have documentation for each
+ # of its function declarations. We then seek to contradict this
+ # assertion.
+
+ my %this_file = ( overall => 1 );
+
+ for my $function_decl (@function_decls) {
+ my $escaped_decl
+ = $headerizer->generate_documentation_signature($function_decl);
+ $this_file{$function_decl}{esc} = $escaped_decl;
+
+ if ( $buf =~ m/^\Q$escaped_decl\E$(.*?)^=cut/sm ) {
+ my $docs = $1;
+ $docs =~ s/\s//g;
+ if ($docs eq '') { # boilerplate only
+ $this_file{$function_decl}{status} = 0;
+ $this_file{overall} = 0;
+ }
+ else { # documentation found
+ $this_file{$function_decl}{status} = 1;
+ }
+ }
+ else { # no documentation found
+ $this_file{$function_decl}{status} = undef;
+ $this_file{overall} = 0;
+ }
+ }
+ $all_files{$path} = \%this_file;
+}
+
+foreach my $path (sort keys %all_files) {
+ TODO: {
+ local $TODO = 'Missing function docs' if $todos{$path};
+ ok( $all_files{$path}{overall}, $path )
+ or diag( diagnosis( \%all_files, $path ) );
+ }
+}
+
+sub diagnosis {
+ my ($all_files_ref, $path) = @_;
+ my $missing = '';
+ my $boilerplate = '';
+ my %this_file = %{ $all_files_ref->{$path} };
+ delete $this_file{overall};
+ foreach my $decl ( sort keys %this_file ) {
+ if ( ! defined $this_file{$decl}{status} ) {
+ $missing .= "$decl\n";
+ $missing .= "Need:\n";
+ $missing .= "$this_file{$decl}{esc}\n\n";
+ }
+ elsif ( ! $this_file{$decl}{status} ) {
+ $boilerplate .= "$this_file{$decl}{esc}\n\n";
+ }
+ else {
+ # docs!
+ }
+ }
+ my $diagnosis = "$path\n";
+ $diagnosis .= "Undocumented functions:\n\n$missing" if $missing;
+ $diagnosis .= "Boilerplate only:\n$boilerplate" if $boilerplate;
+ return "$diagnosis";
+}
+
+__DATA__
+src/pmc/bigint.pmc
+src/pmc/bignum.pmc
+src/pmc/callcontext.pmc
+src/pmc/class.pmc
+src/pmc/complex.pmc
+src/pmc/coroutine.pmc
+src/pmc/eval.pmc
+src/pmc/fixedintegerarray.pmc
+src/pmc/imageio.pmc
+src/pmc/imageiosize.pmc
+src/pmc/integer.pmc
+src/pmc/namespace.pmc
+src/pmc/nci.pmc
+src/pmc/null.pmc
+src/pmc/object.pmc
+src/pmc/orderedhash.pmc
+src/pmc/packfile.pmc
+src/pmc/sub.pmc
+src/pmc/threadinterpreter.pmc
+src/pmc/unmanagedstruct.pmc
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
More information about the parrot-commits
mailing list