Skip to content

Commit

Permalink
Merge pmc_freeze_with_pmcs into trunk.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@43706 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
darbelo committed Feb 2, 2010
1 parent da84039 commit 836e73e
Show file tree
Hide file tree
Showing 33 changed files with 742 additions and 947 deletions.
1 change: 1 addition & 0 deletions MANIFEST
Expand Up @@ -1428,6 +1428,7 @@ src/pmc/handle.pmc [devel]src
src/pmc/hash.pmc [devel]src
src/pmc/hashiterator.pmc [devel]src
src/pmc/hashiteratorkey.pmc [devel]src
src/pmc/imageio.pmc [devel]src
src/pmc/integer.pmc [devel]src
src/pmc/iterator.pmc [devel]src
src/pmc/key.pmc [devel]src
Expand Down
1 change: 1 addition & 0 deletions PBC_COMPAT
Expand Up @@ -27,6 +27,7 @@

# please insert tab separated entries at the top of the list

6.2 2010.01.31 cotto serialization-related changes to ParrotInterpreter
6.1 2010.01.30 whiteknight remove Array PMC
6.0 2010.01.19 chromatic released 2.0.0
5.1 2009.08.06 cotto remove branch_cs opcode
Expand Down
44 changes: 1 addition & 43 deletions include/parrot/pmc_freeze.h
Expand Up @@ -14,7 +14,7 @@
#define PARROT_PMC_FREEZE_H_GUARD

struct _visit_info;
typedef void (*visit_f)(PARROT_INTERP, ARGIN_NULLOK(PMC*), ARGIN(struct _visit_info*));
typedef void (*visit_f)(PARROT_INTERP, ARGIN_NULLOK(PMC*), ARGIN(PMC*));

typedef enum {
VISIT_HOW_PMC_TO_VISITOR = 0x00, /* push to visitor */
Expand All @@ -40,53 +40,11 @@ typedef enum {
#define VISIT_THAW_NORMAL (VISIT_HOW_VISITOR_TO_PMC | VISIT_WHAT_PMC)
#define VISIT_THAW_CONSTANTS VISIT_THAW_NORMAL

struct _visit_info;
typedef INTVAL (*get_integer_f) (PARROT_INTERP, struct _visit_info*);
typedef void (*push_integer_f) (PARROT_INTERP, struct _visit_info*, INTVAL);
typedef void (*push_string_f) (PARROT_INTERP, struct _visit_info*, STRING*);
typedef void (*push_number_f) (PARROT_INTERP, struct _visit_info*, FLOATVAL);
typedef void (*push_pmc_f) (PARROT_INTERP, struct _visit_info*, PMC*);
typedef INTVAL (*shift_integer_f) (PARROT_INTERP, struct _visit_info*);
typedef STRING* (*shift_string_f) (PARROT_INTERP, struct _visit_info*);
typedef FLOATVAL (*shift_number_f) (PARROT_INTERP, struct _visit_info*);
typedef PMC* (*shift_pmc_f) (PARROT_INTERP, struct _visit_info*);

typedef struct _image_funcs {
get_integer_f get_integer;
push_integer_f push_integer;
push_string_f push_string;
push_number_f push_float;
push_pmc_f push_pmc;
shift_integer_f shift_integer;
shift_string_f shift_string;
shift_number_f shift_float;
shift_pmc_f shift_pmc;
} image_funcs;

typedef enum {
EXTRA_IS_NULL,
EXTRA_IS_PROP_HASH,
} extra_flags_enum;

typedef struct _visit_info {
visit_f visit_pmc_now;
size_t pos; /* current read/write position in buffer */
Buffer *buffer;
size_t input_length; /* */
INTVAL what;
PMC **thaw_ptr; /* where to thaw a new PMC */
PMC *seen; /* seen hash */
PMC *todo; /* todo list */
PMC *id_list; /* seen list used by thaw */
UINTVAL id; /* freze ID of PMC */
INTVAL extra_flags; /* concerning to extra */
struct PackFile *pf;
const image_funcs *vtable;
struct _visit_info *image_io; /* dummy backwards-compat pointer. */
} visit_info;

#define IMAGE_IO visit_info

#define VISIT_PMC(interp, visit, pmc) do {\
const INTVAL _visit_pmc_flags = VTABLE_get_integer((interp), (visit)); \
if (_visit_pmc_flags & VISIT_WHAT_PMC) { \
Expand Down
16 changes: 8 additions & 8 deletions src/hash.c
Expand Up @@ -55,15 +55,15 @@ static void expand_hash(PARROT_INTERP, ARGMOD(Hash *hash))

static void hash_freeze(PARROT_INTERP,
ARGIN(const Hash * const hash),
ARGMOD(visit_info *info))
ARGMOD(PMC *info))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
FUNC_MODIFIES(*info);

static void hash_thaw(PARROT_INTERP,
ARGMOD(Hash *hash),
ARGMOD(visit_info *info))
ARGMOD(PMC *info))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
Expand Down Expand Up @@ -541,7 +541,7 @@ parrot_mark_hash_both(PARROT_INTERP, ARGIN(Hash *hash))

/*
=item C<static void hash_thaw(PARROT_INTERP, Hash *hash, visit_info *info)>
=item C<static void hash_thaw(PARROT_INTERP, Hash *hash, PMC *info)>
Visits the contents of a hash during freeze/thaw.
Expand All @@ -552,7 +552,7 @@ C<pinfo> is the visit info, (see include/parrot/pmc_freeze.h>).
*/

static void
hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(visit_info *info))
hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
{
ASSERT_ARGS(hash_thaw)

Expand Down Expand Up @@ -608,8 +608,8 @@ hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(visit_info *info))

/*
=item C<static void hash_freeze(PARROT_INTERP, const Hash * const hash,
visit_info *info)>
=item C<static void hash_freeze(PARROT_INTERP, const Hash * const hash, PMC
*info)>
Freezes hash into a string.
Expand All @@ -623,7 +623,7 @@ Use by parrot_hash_visit.
*/

static void
hash_freeze(PARROT_INTERP, ARGIN(const Hash * const hash), ARGMOD(visit_info *info))
hash_freeze(PARROT_INTERP, ARGIN(const Hash * const hash), ARGMOD(PMC *info))
{
ASSERT_ARGS(hash_freeze)
size_t i;
Expand Down Expand Up @@ -677,7 +677,7 @@ void
parrot_hash_visit(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(void *pinfo))
{
ASSERT_ARGS(parrot_hash_visit)
visit_info* const info = (visit_info*) pinfo;
PMC* const info = (PMC*) pinfo;

switch (VTABLE_get_integer(interp, info)) {
case VISIT_THAW_NORMAL:
Expand Down
16 changes: 8 additions & 8 deletions src/pmc/class.pmc
Expand Up @@ -1421,7 +1421,7 @@ Returns the integer type of the class.

/*

=item C<void visit(visit_info *info)>
=item C<void visit(PMC *info)>

This is used by freeze/thaw to visit the contents of the class.

Expand All @@ -1431,7 +1431,7 @@ C<*info> is the visit info, (see F<include/parrot/pmc_freeze.h>).

*/

VTABLE void visit(visit_info *info) {
VTABLE void visit(PMC *info) {
/* 1) visit the attribute description hash */
VISIT_PMC_ATTR(INTERP, info, SELF, Class, attrib_metadata);

Expand All @@ -1453,15 +1453,15 @@ C<*info> is the visit info, (see F<include/parrot/pmc_freeze.h>).

/*

=item C<void freeze(visit_info *info)>
=item C<void freeze(PMC *info)>

Used to archive the class.

=cut

*/

VTABLE void freeze(visit_info *info) {
VTABLE void freeze(PMC *info) {
Parrot_Class_attributes * const class_data = PARROT_CLASS(SELF);
STRING *serial_namespace = CONST_STRING(interp, "");

Expand All @@ -1483,15 +1483,15 @@ Used to archive the class.

/*

=item C<void thaw(visit_info *info)>
=item C<void thaw(PMC *info)>

Used to unarchive the class.

=cut

*/

VTABLE void thaw(visit_info *info) {
VTABLE void thaw(PMC *info) {
/* The class might already exist in the interpreter, so create it as an
* anonymous class and later decide whether to link it into the
* namespace. */
Expand Down Expand Up @@ -1549,15 +1549,15 @@ with functions like pmc_new and pmc_reuse, which take type ID numbers still.

/*

=item C<void thawfinish(visit_info *info)>
=item C<void thawfinish(PMC *info)>

Called after the class has been thawed.

=cut

*/

VTABLE void thawfinish(visit_info *info) {
VTABLE void thawfinish(PMC *info) {
Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
UNUSED(info)

Expand Down
16 changes: 8 additions & 8 deletions src/pmc/default.pmc
Expand Up @@ -1043,15 +1043,15 @@ Add class C<parent> to the list of our parents.

/*

=item C<void visit(visit_info *info)>
=item C<void visit(PMC *info)>

Used by GC to mark the PMC.

=cut

*/

VTABLE void visit(visit_info *info) {
VTABLE void visit(PMC *info) {
}

/*
Expand All @@ -1070,45 +1070,45 @@ Clones this PMC. By default, this just does a freeze and thaw.

/*

=item C<void freeze(visit_info *info)>
=item C<void freeze(PMC *info)>

Does nothing.

=cut

*/

VTABLE void freeze(visit_info *info) {
VTABLE void freeze(PMC *info) {
UNUSED(info)
/* default - no action */
}

/*

=item C<void thaw(visit_info *info)>
=item C<void thaw(PMC *info)>

Initializes the PMC during unarchiving.

=cut

*/

VTABLE void thaw(visit_info *info) {
VTABLE void thaw(PMC *info) {
/* default - initialize the PMC */
SELF.init();
}

/*

=item C<void thawfinish(visit_info *info)>
=item C<void thawfinish(PMC *info)>

Does nothing.

=cut

*/

VTABLE void thawfinish(visit_info *info) {
VTABLE void thawfinish(PMC *info) {
UNUSED(info)
/* default - no action */
}
Expand Down
8 changes: 4 additions & 4 deletions src/pmc/eval.pmc
Expand Up @@ -320,26 +320,26 @@ Returns the Sub PMC of the element at index C<key> or PMCNULL.

/*

=item C<void freeze(visit_info *info)>
=item C<void freeze(PMC *info)>

Archives the evaled code

=item C<void thaw(visit_info *info)>
=item C<void thaw(PMC *info)>

Unarchives the code.

=cut

*/

VTABLE void freeze(visit_info *info) {
VTABLE void freeze(PMC *info) {
STRING *packed = SELF.get_string();
VTABLE_push_string(INTERP, info, packed);

SUPER(info);
}

VTABLE void thaw(visit_info *info) {
VTABLE void thaw(PMC *info) {
STRING *packed = VTABLE_shift_string(INTERP, info);
PackFile *pf;
PackFile_Segment *seg;
Expand Down
8 changes: 4 additions & 4 deletions src/pmc/fixedbooleanarray.pmc
Expand Up @@ -506,14 +506,14 @@ Return a new iterator for SELF.

=over 4

=item C<void freeze(visit_info *info)>
=item C<void freeze(PMC *info)>

Used to archive the string.

=cut

*/
VTABLE void freeze(visit_info *info) {
VTABLE void freeze(PMC *info) {
UINTVAL size, resize_threshold;
unsigned char * bit_array;
STRING * s;
Expand All @@ -530,14 +530,14 @@ Used to archive the string.

/*

=item C<void thaw(visit_info *info)>
=item C<void thaw(PMC *info)>

Used to unarchive the string.

=cut

*/
VTABLE void thaw(visit_info *info) {
VTABLE void thaw(PMC *info) {
SUPER(info);

{
Expand Down
12 changes: 6 additions & 6 deletions src/pmc/fixedintegerarray.pmc
Expand Up @@ -537,29 +537,29 @@ Return a new Iterator for this PMC.

/*

=item C<void visit(visit_info *info)>
=item C<void visit(PMC *info)>

This is used by freeze/thaw to visit the contents of the array.

C<*info> is the visit info, (see F<include/parrot/pmc_freeze.h>).

=item C<void freeze(visit_info *info)>
=item C<void freeze(PMC *info)>

Used to archive the array.

=item C<void thaw(visit_info *info)>
=item C<void thaw(PMC *info)>

Used to unarchive the array.

=cut

*/

/*VTABLE void visit(visit_info *info) {
/*VTABLE void visit(PMC *info) {
SUPER(info);
}*/

VTABLE void freeze(visit_info *info) {
VTABLE void freeze(PMC *info) {
INTVAL *int_array;
INTVAL i, n;

Expand All @@ -573,7 +573,7 @@ Used to unarchive the array.
VTABLE_push_integer(INTERP, info, int_array[i]);
}

VTABLE void thaw(visit_info *info) {
VTABLE void thaw(PMC *info) {
INTVAL n;

SUPER(info);
Expand Down

0 comments on commit 836e73e

Please sign in to comment.