Skip to content

Commit

Permalink
misc fixes
Browse files Browse the repository at this point in the history
* make it compile - Makefile typo
* remove constness warnings
* turn off return continuation and stack frame recycling
* readd accidental backed out function


git-svn-id: https://svn.parrot.org/parrot/trunk@6623 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Leopold Toetsch committed Sep 10, 2004
1 parent 08de5d0 commit 7ad9b35
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
22 changes: 21 additions & 1 deletion classes/delegate.pmc
Expand Up @@ -152,7 +152,15 @@ pmclass delegate {

=item C<void init()>

Calls the delegated C<init()> method.
Calls the delegated C<__init()> method if it exists.

=item C<PMC* new_extended()>

Calls the delegated C<__new_extended> method if it exists.

XXX Actually the PMC compiler should emit different code, if a method is
present in classes/default.pmc. Some defaulted methods like this one have
useful defaults and don't throw exceptiions.

=cut

Expand All @@ -169,6 +177,18 @@ Calls the delegated C<init()> method.
void destroy() {
/* don't delegate destroy */
}

PMC* new_extended() {
STRING *meth = const_string(interpreter,
PARROT_VTABLE_NEW_EXTENDED_METHNAME );
PMC *sub = find_meth(interpreter, SELF, meth);
if (PMC_IS_NULL(sub)) {
/* run default fallback that constructs an empty object */
return SUPER();
}
return (PMC*) Parrot_run_meth_fromc_args_save(interpreter, sub,
pmc, meth, "P");
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion config/gen/makefiles/root.in
Expand Up @@ -795,7 +795,7 @@ $(SRC)/inter_cb$(O) : $(SRC)/inter_cb.c $(GENERAL_H_FILES) \
$(SRC)/inter_cb.str

$(SRC)/inter_misc$(O) : $(SRC)/inter_misc.c $(GENERAL_H_FILES) \
$(SRC)/inter_misc.src
$(SRC)/inter_misc.str

$(SRC)/inter_create$(O) : $(SRC)/inter_create.c $(GENERAL_H_FILES)

Expand Down
4 changes: 3 additions & 1 deletion include/parrot/caches.h
Expand Up @@ -14,7 +14,9 @@
#define PARROT_CACHES_H_GUARD

#define DISABLE_METH_CACHE 0
#define DISABLE_RETC_RECYCLING 0

/* turn off this hack, we need something better */
#define DISABLE_RETC_RECYCLING 1

/*
* object method cache entry
Expand Down
8 changes: 4 additions & 4 deletions include/parrot/memory.h
Expand Up @@ -21,16 +21,16 @@ void *mem__sys_realloc(void *, size_t);
#define mem_sys_realloc(x,y) (assert(x!=NULL), mem__sys_realloc(x,y))
void mem_sys_free(void *);

void *mem__internal_allocate(size_t, char *, int);
void *mem__internal_allocate(size_t, const char *, int);
#define mem_internal_allocate(x) mem__internal_allocate(x, __FILE__, __LINE__)

void *mem__internal_allocate_zeroed(size_t, char *, int);
void *mem__internal_allocate_zeroed(size_t, const char *, int);
#define mem_internal_allocate_zeroed(x) mem__internal_allocate_zeroed(x, __FILE__, __LINE__)

void *mem__internal_realloc(void *, size_t, char *, int);
void *mem__internal_realloc(void *, size_t, const char *, int);
#define mem_internal_realloc(x, y) mem__internal_realloc(x, y, __FILE__, __LINE__)

void mem__internal_free(void *, char *, int);
void mem__internal_free(void *, const char *, int);
#define mem_internal_free(x) mem__internal_free(x, __FILE__, __LINE__)


Expand Down
8 changes: 4 additions & 4 deletions src/memory.c
Expand Up @@ -50,7 +50,7 @@ mem_sys_allocate(size_t size)
}

void *
mem__internal_allocate(size_t size, char *file, int line)
mem__internal_allocate(size_t size, const char *file, int line)
{
void *ptr = malloc((size_t)size);
#ifdef DETAIL_MEMORY_DEBUG
Expand Down Expand Up @@ -85,7 +85,7 @@ mem_sys_allocate_zeroed(size_t size)
}

void *
mem__internal_allocate_zeroed(size_t size, char *file, int line)
mem__internal_allocate_zeroed(size_t size, const char *file, int line)
{
void *ptr = calloc(1, (size_t)size);
if (!ptr)
Expand Down Expand Up @@ -124,7 +124,7 @@ mem__sys_realloc(void *from, size_t size)
}

void *
mem__internal_realloc(void *from, size_t size, char *file, int line)
mem__internal_realloc(void *from, size_t size, const char *file, int line)
{
void *ptr = realloc(from, size);
if (!ptr)
Expand Down Expand Up @@ -158,7 +158,7 @@ mem_sys_free(void *from)
}

void
mem__internal_free(void *from, char *file, int line)
mem__internal_free(void *from, const char *file, int line)
{
#ifdef DETAIL_MEMORY_DEBUG
printf("Internal free of %p (%s/%d)\n", from, file, line);
Expand Down

0 comments on commit 7ad9b35

Please sign in to comment.