cvsuser 03/11/23 21:47:40
Modified: ops var.ops
src dod.c embed.c interpreter.c packfile.c
Log:
Rename perl_stash to globals since that is what it is.
Add a couple of comments to uncommented routines.
Revision Changes Path
1.10 +5 -3 parrot/ops/var.ops
Index: var.ops
===================================================================
RCS file: /cvs/public/parrot/ops/var.ops,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- var.ops 23 Oct 2003 17:41:55 -0000 1.9
+++ var.ops 24 Nov 2003 05:47:38 -0000 1.10
@@ -234,8 +234,9 @@
=cut
op store_global(in STR, in PMC) {
+ /* XXX: All globals should go through an API */
PMC * key = key_new_string(interpreter, $1);
- PMC * globals = interpreter->perl_stash->stash_hash;
+ PMC * globals = interpreter->globals->stash_hash;
globals->vtable->set_pmc_keyed(interpreter, globals, key, $2);
goto NEXT();
}
@@ -249,6 +250,7 @@
=cut
op find_global(out PMC, in STR) {
+ /* XXX: All globals should go through an API */
opcode_t * resume;
PMC* key = key_new_string(interpreter, $2);
if (!$2)
@@ -256,12 +258,12 @@
resume = expr NEXT();
if (!VTABLE_exists_keyed(interpreter,
- interpreter->perl_stash->stash_hash, key))
+ interpreter->globals->stash_hash, key))
real_exception(interpreter, resume, GLOBAL_NOT_FOUND,
"Global '%s' not found\n", string_to_cstring(interpreter, $2));
$1 = VTABLE_get_pmc_keyed(interpreter,
- interpreter->perl_stash->stash_hash, key);
+ interpreter->globals->stash_hash, key);
restart ADDRESS(resume);
}
1.76 +2 -2 parrot/src/dod.c
Index: dod.c
===================================================================
RCS file: /cvs/public/parrot/src/dod.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -w -r1.75 -r1.76
--- dod.c 12 Nov 2003 11:02:33 -0000 1.75
+++ dod.c 24 Nov 2003 05:47:40 -0000 1.76
@@ -1,7 +1,7 @@
/* dod.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: dod.c,v 1.75 2003/11/12 11:02:33 leo Exp $
+ * $Id: dod.c,v 1.76 2003/11/24 05:47:40 mrjoltcola Exp $
* Overview:
* Handles dead object destruction of the various headers
* Data Structure and Algorithms:
@@ -149,7 +149,7 @@
}
/* Walk through the stashes */
- stash = interpreter->perl_stash;
+ stash = interpreter->globals;
while (stash) {
pobject_lives(interpreter, (PObj *)stash->stash_hash);
stash = stash->parent_stash;
1.96 +5 -1 parrot/src/embed.c
Index: embed.c
===================================================================
RCS file: /cvs/public/parrot/src/embed.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -w -r1.95 -r1.96
--- embed.c 13 Nov 2003 10:42:38 -0000 1.95
+++ embed.c 24 Nov 2003 05:47:40 -0000 1.96
@@ -1,7 +1,7 @@
/* embed.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: embed.c,v 1.95 2003/11/13 10:42:38 leo Exp $
+ * $Id: embed.c,v 1.96 2003/11/24 05:47:40 mrjoltcola Exp $
* Overview:
* The Parrot embedding interface.
* Data Structure and Algorithms:
@@ -81,6 +81,10 @@
PARROT_WARNINGS_on(interpreter, wc);
}
+/*
+ * Read in a bytecode, unpack it into a PackFile structure
+ * and do fixups.
+ */
struct PackFile *
Parrot_readbc(struct Parrot_Interp *interpreter, char *filename)
{
1.231 +5 -5 parrot/src/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/src/interpreter.c,v
retrieving revision 1.230
retrieving revision 1.231
diff -u -w -r1.230 -r1.231
--- interpreter.c 22 Nov 2003 09:55:49 -0000 1.230
+++ interpreter.c 24 Nov 2003 05:47:40 -0000 1.231
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: interpreter.c,v 1.230 2003/11/22 09:55:49 leo Exp $
+ * $Id: interpreter.c,v 1.231 2003/11/24 05:47:40 mrjoltcola Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -840,10 +840,10 @@
#endif
/* Need an empty stash */
- interpreter->perl_stash = mem_sys_allocate(sizeof(struct Stash));
- interpreter->perl_stash->stash_hash =
+ interpreter->globals = mem_sys_allocate(sizeof(struct Stash));
+ interpreter->globals->stash_hash =
pmc_new(interpreter, enum_class_PerlHash);
- interpreter->perl_stash->parent_stash = NULL;
+ interpreter->globals->parent_stash = NULL;
/* context data */
/* Initialize interpreter's flags */
@@ -988,7 +988,7 @@
}
/* walk and free the stash, pmc's are already dead */
- stash = interpreter->perl_stash;
+ stash = interpreter->globals;
while (stash) {
next_stash = stash->parent_stash;
mem_sys_free(stash);
1.125 +8 -3 parrot/src/packfile.c
Index: packfile.c
===================================================================
RCS file: /cvs/public/parrot/src/packfile.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -w -r1.124 -r1.125
--- packfile.c 22 Nov 2003 15:32:39 -0000 1.124
+++ packfile.c 24 Nov 2003 05:47:40 -0000 1.125
@@ -7,7 +7,7 @@
** This program is free software. It is subject to the same
** license as Parrot itself.
**
-** $Id: packfile.c,v 1.124 2003/11/22 15:32:39 leo Exp $
+** $Id: packfile.c,v 1.125 2003/11/24 05:47:40 mrjoltcola Exp $
**
** History:
** Rework by Melvin; new bytecode format, make bytecode portable.
@@ -1957,7 +1957,7 @@
#if TRACE_PACKFILE_PMC
fprintf(stderr, "PMC_CONST: store_global: name '%s'\n", name);
#endif
- VTABLE_set_pmc_keyed(interpreter, interpreter->perl_stash->stash_hash,
+ VTABLE_set_pmc_keyed(interpreter, interpreter->globals->stash_hash,
key, sub_pmc);
/*
@@ -2052,6 +2052,7 @@
=item PackFile_append_pbc
Read a PBC and append it to the current directory
+Fixup local label and sub addresses in newly loaded bytecode.
=item Parrot_load_bytecode
@@ -2073,6 +2074,9 @@
return pf;
}
+/*
+ * Load and append a bytecode, IMC or PASM file into interpreter
+ */
void
Parrot_load_bytecode(struct Parrot_Interp *interpreter, char *filename)
{
@@ -2085,7 +2089,8 @@
ext = strrchr(filename, '.');
if (ext && strcmp (ext, ".pbc") == 0) {
- PackFile_append_pbc(interpreter, filename);
+ struct PackFile * pf;
+ pf = PackFile_append_pbc(interpreter, filename);
}
else {
PMC * compiler, *code;