[svn:parrot] r43974 - in branches/tt362: include/parrot src src/pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Mon Feb 15 22:21:23 UTC 2010
Author: plobsing
Date: Mon Feb 15 22:21:23 2010
New Revision: 43974
URL: https://trac.parrot.org/parrot/changeset/43974
Log:
use ImageIOSize in Parrot_freeze_size
use Parrot_freeze_size in Packfile_Constant_pack_size.
this completes the todo item in this function and satisfies tt362
Modified:
branches/tt362/include/parrot/pmc_freeze.h
branches/tt362/src/hash.c
branches/tt362/src/packfile.c
branches/tt362/src/pmc/imageiosize.pmc
branches/tt362/src/pmc_freeze.c
Modified: branches/tt362/include/parrot/pmc_freeze.h
==============================================================================
--- branches/tt362/include/parrot/pmc_freeze.h Mon Feb 15 21:27:04 2010 (r43973)
+++ branches/tt362/include/parrot/pmc_freeze.h Mon Feb 15 22:21:23 2010 (r43974)
@@ -121,6 +121,13 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
+INTVAL Parrot_freeze_size(PARROT_INTERP, ARGIN(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
PMC* Parrot_thaw(PARROT_INTERP, ARGIN(STRING *image))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -132,18 +139,35 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+void Parrot_visit_loop_thawfinish(PARROT_INTERP, ARGIN(PMC *info))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+void Parrot_visit_loop_visit(PARROT_INTERP, ARGIN(PMC *info))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
#define ASSERT_ARGS_Parrot_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_freeze __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_Parrot_freeze_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_thaw __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(image))
#define ASSERT_ARGS_Parrot_thaw_constants __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(image))
+#define ASSERT_ARGS_Parrot_visit_loop_thawfinish __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(info))
+#define ASSERT_ARGS_Parrot_visit_loop_visit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(info))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/pmc_freeze.c */
Modified: branches/tt362/src/hash.c
==============================================================================
--- branches/tt362/src/hash.c Mon Feb 15 21:27:04 2010 (r43973)
+++ branches/tt362/src/hash.c Mon Feb 15 22:21:23 2010 (r43974)
@@ -61,9 +61,7 @@
__attribute__nonnull__(3)
FUNC_MODIFIES(*info);
-static void hash_thaw(PARROT_INTERP,
- ARGMOD(Hash *hash),
- ARGMOD(PMC *info))
+static void hash_thaw(PARROT_INTERP, ARGMOD(Hash *hash), ARGMOD(PMC *info))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
Modified: branches/tt362/src/packfile.c
==============================================================================
--- branches/tt362/src/packfile.c Mon Feb 15 21:27:04 2010 (r43973)
+++ branches/tt362/src/packfile.c Mon Feb 15 22:21:23 2010 (r43974)
@@ -3866,7 +3866,6 @@
{
ASSERT_ARGS(PackFile_Constant_pack_size)
PMC *component;
- STRING *image;
size_t packed_size;
switch (self->type) {
@@ -3890,13 +3889,8 @@
case PFC_PMC:
component = self->u.key; /* the pmc (Sub, ...) */
- /*
- * TODO create either
- * a) a frozen_size freeze entry or
- * b) change packout.c so that component size isn't needed
- */
- image = Parrot_freeze(interp, component);
- packed_size = PF_size_string(image);
+ packed_size =
+ PF_size_string(STRINGNULL) + Parrot_freeze_size(interp, component) / sizeof (opcode_t);
break;
default:
Modified: branches/tt362/src/pmc/imageiosize.pmc
==============================================================================
--- branches/tt362/src/pmc/imageiosize.pmc Mon Feb 15 21:27:04 2010 (r43973)
+++ branches/tt362/src/pmc/imageiosize.pmc Mon Feb 15 22:21:23 2010 (r43974)
@@ -32,8 +32,6 @@
UINTVAL id;
int packid_type;
- PARROT_ASSERT(PARROT_IMAGEIOSIZE(info)->what == VISIT_FREEZE_NORMAL);
-
if (PMC_IS_NULL(pmc)) {
id = 0;
packid_type = enum_PackID_seen;
Modified: branches/tt362/src/pmc_freeze.c
==============================================================================
--- branches/tt362/src/pmc_freeze.c Mon Feb 15 21:27:04 2010 (r43973)
+++ branches/tt362/src/pmc_freeze.c Mon Feb 15 22:21:23 2010 (r43974)
@@ -31,6 +31,8 @@
#define THAW_BLOCK_GC_SIZE 100000
+/* HEADERIZER HFILE: include/parrot/pmc_freeze.h */
+
/*
=head2 Public Interface
@@ -57,6 +59,32 @@
return VTABLE_get_string(interp, image);
}
+/*
+
+=item C<INTVAL Parrot_freeze_size(PARROT_INTERP, PMC *pmc)>
+
+Get the size of an image to be frozen without allocating a large buffer.
+
+Used in C<Packfile_Constant_pack_size>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+INTVAL
+Parrot_freeze_size(PARROT_INTERP, ARGIN(PMC *pmc))
+{
+ ASSERT_ARGS(Parrot_freeze_size)
+ PMC *result;
+ PMC *visitor = pmc_new(interp, enum_class_ImageIOSize);
+ VTABLE_set_pmc(interp, visitor, pmc);
+ result = VTABLE_get_pmc(interp, visitor);
+ return VTABLE_get_integer(interp, result);
+}
+
/*
@@ -169,7 +197,9 @@
*/
void
-Parrot_visit_loop_visit(PARROT_INTERP, PMC *info) {
+Parrot_visit_loop_visit(PARROT_INTERP, ARGIN(PMC *info)) {
+ ASSERT_ARGS(Parrot_visit_loop_visit)
+
INTVAL i;
PMC * const todo = VTABLE_get_iter(interp, info);
@@ -199,7 +229,9 @@
*/
void
-Parrot_visit_loop_thawfinish(PARROT_INTERP, PMC *info) {
+Parrot_visit_loop_thawfinish(PARROT_INTERP, ARGIN(PMC *info)) {
+ ASSERT_ARGS(Parrot_visit_loop_thawfinish)
+
/* call thawfinish for each processed PMC */
/*
* Thaw in reverse order. We have to fully thaw younger PMCs
More information about the parrot-commits
mailing list