cvsuser 04/12/17 04:15:13
Modified: config/gen/makefiles root.in
include/parrot interpreter.h
. MANIFEST
src interpreter.c
Added: src pic.c
Log:
cache the new_p_sc result
Revision Changes Path
1.269 +4 -1 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -r1.268 -r1.269
--- root.in 7 Dec 2004 14:19:11 -0000 1.268
+++ root.in 17 Dec 2004 12:15:05 -0000 1.269
@@ -1,4 +1,4 @@
-# $Id: root.in,v 1.268 2004/12/07 14:19:11 leo Exp $
+# $Id: root.in,v 1.269 2004/12/17 12:15:05 leo Exp $
###############################################################################
#
@@ -353,6 +353,7 @@
$(SRC)/dynext$(O) \
$(SRC)/utils$(O) \
$(SRC)/vtables$(O) \
+ $(SRC)/pic$(O) \
$(SRC)/mmd$(O) \
$(SRC)/mmd_fallback$(O) \
$(SRC)/extend$(O) \
@@ -854,6 +855,8 @@
$(SRC)/memory$(O) : $(GENERAL_H_FILES)
+$(SRC)/pic$(O) : $(GENERAL_H_FILES)
+
$(SRC)/mmd$(O) : $(GENERAL_H_FILES)
$(SRC)/mmd_fallback$(O) : $(GENERAL_H_FILES)
1.166 +3 -1 parrot/include/parrot/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -r1.165 -r1.166
--- interpreter.h 15 Dec 2004 08:45:47 -0000 1.165
+++ interpreter.h 17 Dec 2004 12:15:11 -0000 1.166
@@ -1,7 +1,7 @@
/* interpreter.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: interpreter.h,v 1.165 2004/12/15 08:45:47 leo Exp $
+ * $Id: interpreter.h,v 1.166 2004/12/17 12:15:11 leo Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -455,6 +455,8 @@
void enter_nci_method(Interp *, int type,
void *func, const char *name, const char *proto);
+void parrot_PIC_prederef(Interp *, opcode_t op, void **pc_pred, int type);
+
#else
typedef void * *(*native_func_t)(Parrot_Interp interpreter,
1.807 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.806
retrieving revision 1.807
diff -u -r1.806 -r1.807
--- MANIFEST 13 Dec 2004 21:50:56 -0000 1.806
+++ MANIFEST 17 Dec 2004 12:15:12 -0000 1.807
@@ -2764,6 +2764,7 @@
src/pbc_info.c []
src/pdb.c []
src/pdump.c []
+src/pic.c []
src/pmc.c []
src/pmc_freeze.c []
src/py_func.c []
1.322 +4 -6 parrot/src/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/src/interpreter.c,v
retrieving revision 1.321
retrieving revision 1.322
diff -u -r1.321 -r1.322
--- interpreter.c 24 Nov 2004 05:56:57 -0000 1.321
+++ interpreter.c 17 Dec 2004 12:15:13 -0000 1.322
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: interpreter.c,v 1.321 2004/11/24 05:56:57 leo Exp $
+$Id: interpreter.c,v 1.322 2004/12/17 12:15:13 leo Exp $
=head1 NAME
@@ -164,19 +164,17 @@
if (*pc < 0 || *pc >= (opcode_t)interpreter->op_count)
internal_exception(INTERP_ERROR, "Illegal opcode");
opinfo = &interpreter->op_info_table[*pc];
+ /* first arguments - PIC needs it */
+ prederef_args(pc_prederef, interpreter, pc, opinfo);
switch (type) {
case PARROT_SWITCH_CORE:
- *pc_prederef = (void**) *pc;
- break;
case PARROT_CGP_CORE:
- *pc_prederef = ((void**)(prederef_op_func)) [*pc];
+ parrot_PIC_prederef(interpreter, *pc, pc_prederef, type);
break;
default:
internal_exception(1, "Tried to prederef wrong core");
break;
}
- /* and arguments */
- prederef_args(pc_prederef, interpreter, pc, opinfo);
/*
* now remember backward branches, invoke and similar opcodes
*/
1.1 parrot/src/pic.c
Index: pic.c
===================================================================
/*
Copyright: 2004 The Perl Foundation. All Rights Reserved.
$Id: pic.c,v 1.1 2004/12/17 12:15:13 leo Exp $
=head1 NAME
src/pic.c - Polymorphic Inline Cache
=head1 DESCRIPTION
The PIC supports inline caching for MMD and object method lookups in
prederefed run cores. Additionally opcodes that do some kind of lookup
like C<new_p_sc> are changed to faster variants.
=head2 Functions
=over 4
=cut
*/
#include "parrot/parrot.h"
#include "parrot/oplib/ops.h"
#include <assert.h>
#define OP_AS_OFFS(o) (_reg_base + ((opcode_t*)cur_opcode)[o])
/*
=item C<void parrot_PIC_prederef(Interp *, opcode_t op, void **pc_pred, int
type)>
Define either the normal prederef function or the PIC stub, if PIC for
this opcode function is available. Called from C<do_prederef>.
=cut
*/
void
parrot_PIC_prederef(Interp *interpreter, opcode_t op, void **pc_pred, int
core)
{
op_func_t *prederef_op_func = interpreter->op_lib->op_func_table;
char * _reg_base = (char*)interpreter->ctx.bp;
opcode_t *cur_opcode = (opcode_t*)pc_pred;
switch (op) {
case PARROT_OP_new_p_sc:
{
STRING *class;
INTVAL type;
class = *(STRING **)cur_opcode[2];
type = pmc_type(interpreter, class);
if (!type) {
Parrot_autoload_class(interpreter, class);
type = pmc_type(interpreter, class);
}
if (type <= 0)
real_exception(interpreter, NULL, NO_CLASS,
"Class '%Ss' not found", class);
(*(INTVAL *)cur_opcode[2]) = type;
op = PARROT_OP_new_p_ic;
}
break;
}
/*
* else set default prederef code address
*/
if (core == PARROT_SWITCH_CORE)
*pc_pred = (void**) op;
else
*pc_pred = ((void **)prederef_op_func)[op];
}
/*
=back
=head1 AUTHOR
Leopold Toetsch with many hints from Ken Fox.
=head1 SEE ALSO
F<src/mmd.c>, F<src/object.c>, F<src/interpreter.c>, F<ops/core_ops_cgp.c>
=cut
*/
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/