[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-internals
Subject:    Re: [svn:parrot] r27233 - in branches/pdd25cx/src: . pmc
From:       chromatic <chromatic () wgz ! org>
Date:       2008-04-29 18:27:47
Message-ID: 200804291127.47742.chromatic () wgz ! org
[Download RAW message or body]

On Tuesday 29 April 2008 10:01:27 allison@cvs.perl.org wrote:

> Log:
> [pdd25cx] Merge in my port of Exceptions PMC to use core struct instead of
> array for attribute storage.
> - Keep 'type' attribute.
> - Use attribute access macros instead of direct struct manipulation so
>   Exception PMC is subclassable from HLL.

> --- branches/pdd25cx/src/pmc/exception.pmc	(original)
> +++ branches/pdd25cx/src/pmc/exception.pmc	Tue Apr 29 10:01:26 2008
> @@ -71,23 +46,19 @@
>
>  #include "parrot/parrot.h"
>
> -/*
> -
> -=head2 Methods
> +pmclass Exception extends ResizablePMCArray need_ext {

We should be able to remove 'extends ResizablePMCArray' now, right?

> @@ -98,16 +69,20 @@
>  */
>
>      VTABLE void init() {
> -        Parrot_Exception * const exception =
> +        Parrot_Exception * const core_struct =
>              mem_allocate_zeroed_typed(Parrot_Exception);
>
> +        /* Set flags for custom DOD mark and destroy. */
>          PObj_custom_mark_SET(SELF);
>          PObj_active_destroy_SET(SELF);
>
> -        PMC_data(SELF)      = exception;
> -        exception->message  = CONST_STRING(interp, "");
> -        exception->severity = 0;
> -        exception->payload  = PMCNULL;
> +        /* Set up the core struct and default values for the exception
> object. */ +        PMC_data(SELF)         = core_struct;
> +        core_struct->message   = CONST_STRING(interp, "");
> +        core_struct->payload   = PMCNULL;
> +        core_struct->severity  = 0;
> +        core_struct->type      = 0;
> +        core_struct->exit_code = 0;

These are unnecessary; mem_allocate_zeroed_typed() has already set them to 
zero.

-- c
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic