Skip to content

Commit

Permalink
[ops] Moved P6LowLevelSig initialization to the PMC out of allocate_s…
Browse files Browse the repository at this point in the history
…ignature

op into the PMC itself.
  • Loading branch information
chromatic committed Mar 25, 2010
1 parent a93b9a5 commit 9a4cabb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/ops/perl6.ops
@@ -1,6 +1,6 @@
/*
* $Id$
* Copyright (C) 2008-2009, The Perl Foundation.
* Copyright (C) 2008-2010, The Perl Foundation.
*/

BEGIN_OPS_PREAMBLE
Expand Down Expand Up @@ -416,19 +416,7 @@ inline op allocate_signature(out PMC, in INT) :base_core {
INTVAL i;

/* Create new low level signature PMC. */
$1 = pmc_new(interp, lls_id);

/* Allocate required amount of structs. */
elements = (struct llsig_element **)mem_sys_allocate(($2 + 1) * sizeof(llsig_element *));

for (i = 0; i < $2; i++)
elements[i] = (llsig_element *)mem_sys_allocate_zeroed(sizeof(llsig_element));
elements[$2] = NULL;
SETATTR_P6LowLevelSig_elements(interp, $1, elements);

/* Stash size. */
SETATTR_P6LowLevelSig_num_elements(interp, $1, $2);

$1 = Parrot_pmc_new_init_int(interp, lls_id, $2);
goto NEXT();
}

Expand Down
17 changes: 17 additions & 0 deletions src/pmc/p6lowlevelsig.pmc
Expand Up @@ -72,6 +72,23 @@ Allocates the PMC's underlying storage.
PObj_custom_mark_destroy_SETALL(SELF);
}

VTABLE void init_int(INTVAL init) {
llsig_element **elements;
INTVAL i;

SELF.init();

elements = mem_gc_allocate_n_zeroed_typed(INTERP, init + 1,
llsig_element *);

for (i = 0; i < init; i++)
elements[i] = mem_gc_allocate_zeroed_typed(INTERP, llsig_element);

elements[init] = NULL;

SETATTR_P6LowLevelSig_elements(interp, SELF, elements);
SETATTR_P6LowLevelSig_num_elements(interp, SELF, init);
}

/*

Expand Down

0 comments on commit 9a4cabb

Please sign in to comment.