[svn:parrot] r48912 - in branches/oplib_handling_cleanup: compilers/opsc/src/Ops include/parrot src src/interp src/ops src/pmc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Fri Sep 10 18:47:50 UTC 2010
Author: plobsing
Date: Fri Sep 10 18:47:50 2010
New Revision: 48912
URL: https://trac.parrot.org/parrot/changeset/48912
Log:
eliminate interp.op_info_table and interp.op_func_table
Modified:
branches/oplib_handling_cleanup/compilers/opsc/src/Ops/Emitter.pm
branches/oplib_handling_cleanup/include/parrot/call.h
branches/oplib_handling_cleanup/include/parrot/interpreter.h
branches/oplib_handling_cleanup/include/parrot/op.h
branches/oplib_handling_cleanup/src/debug.c
branches/oplib_handling_cleanup/src/interp/inter_create.c
branches/oplib_handling_cleanup/src/ops/core_ops.c
branches/oplib_handling_cleanup/src/pbc_merge.c
branches/oplib_handling_cleanup/src/pmc/sub.pmc
branches/oplib_handling_cleanup/src/sub.c
Modified: branches/oplib_handling_cleanup/compilers/opsc/src/Ops/Emitter.pm
==============================================================================
--- branches/oplib_handling_cleanup/compilers/opsc/src/Ops/Emitter.pm Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/compilers/opsc/src/Ops/Emitter.pm Fri Sep 10 18:47:50 2010 (r48912)
@@ -257,6 +257,7 @@
# TODO There is a bug in NQP about \{
$fh.print(q|
+PARROT_EXPORT
op_lib_t *
| ~ self.init_func ~ q|(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
Modified: branches/oplib_handling_cleanup/include/parrot/call.h
==============================================================================
--- branches/oplib_handling_cleanup/include/parrot/call.h Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/include/parrot/call.h Fri Sep 10 18:47:50 2010 (r48912)
@@ -303,10 +303,11 @@
} while (0)
#define ADD_OP_VAR_PART(interp, seg, pc, n) do { \
- if (OPCODE_IS((interp), (seg), *(pc), PARROT_OP_set_args_pc) \
- || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_get_results_pc) \
- || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_get_params_pc) \
- || OPCODE_IS((interp), (seg), *(pc), PARROT_OP_set_returns_pc)) { \
+ op_lib_t *_core_ops = PARROT_GET_CORE_OPLIB(interp); \
+ if (OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_set_args_pc) \
+ || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_results_pc) \
+ || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_params_pc) \
+ || OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_set_returns_pc)) { \
PMC * const sig = (seg)->const_table->constants[(pc)[1]].u.key; \
(n) += VTABLE_elements((interp), sig); \
} \
Modified: branches/oplib_handling_cleanup/include/parrot/interpreter.h
==============================================================================
--- branches/oplib_handling_cleanup/include/parrot/interpreter.h Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/include/parrot/interpreter.h Fri Sep 10 18:47:50 2010 (r48912)
@@ -184,14 +184,6 @@
op_lib_t *op_lib; /* Opcode library */
size_t op_count; /* The number of ops */
- op_info_t *op_info_table; /* Opcode info table
- * (name, nargs, arg types) */
-
- op_func_t *op_func_table; /* opcode dispatch table
- * (functions, labels, or nothing
- * (e.g. switched core), which
- * the interpreter is currently
- * running */
op_func_t *evc_func_table; /* event check opcode dispatch */
size_t evc_func_table_size;
Modified: branches/oplib_handling_cleanup/include/parrot/op.h
==============================================================================
--- branches/oplib_handling_cleanup/include/parrot/op.h Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/include/parrot/op.h Fri Sep 10 18:47:50 2010 (r48912)
@@ -81,8 +81,8 @@
#define OP_INFO_OPNUM(oi) ((oi) - (oi)->lib->op_info_table)
#define OP_INFO_OPFUNC(oi) ((oi)->lib->op_func_table[OP_INFO_OPNUM(oi)])
-#define OPCODE_IS(interp, seg, opnum, global_opnum) \
- ((seg)->op_func_table[(opnum)] == (interp)->op_func_table[(global_opnum)])
+#define OPCODE_IS(interp, seg, opnum, lib, oplibnum) \
+ ((seg)->op_func_table[(opnum)] == (lib)->op_func_table[(oplibnum)])
#endif /* PARROT_OP_H_GUARD */
Modified: branches/oplib_handling_cleanup/src/debug.c
==============================================================================
--- branches/oplib_handling_cleanup/src/debug.c Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/debug.c Fri Sep 10 18:47:50 2010 (r48912)
@@ -33,6 +33,7 @@
#include "debug.str"
#include "pmc/pmc_continuation.h"
#include "pmc/pmc_callcontext.h"
+#include "parrot/oplib/core_ops.h"
/* Hand switched debugger tracing
* Set to 1 to enable tracing to stderr
@@ -2256,6 +2257,7 @@
int j;
size_t size = 0;
int specialop = 0;
+ op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp);
/* Write the opcode name */
const char * p = full_name ? info->full_name : info->name;
@@ -2452,15 +2454,15 @@
one fixed parameter (the signature vector), plus a varying number of
registers/constants. For each arg/return, we show the register and its
flags using PIR syntax. */
- if (OPCODE_IS(interp, interp->code, *(op), PARROT_OP_set_args_pc)
- || OPCODE_IS(interp, interp->code, *(op), PARROT_OP_set_returns_pc))
+ if (OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_set_args_pc)
+ || OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_set_returns_pc))
specialop = 1;
/* if it's a retrieving op, specialop = 2, so that later a :flat flag
* can be changed into a :slurpy flag. See flag handling below.
*/
- if (OPCODE_IS(interp, interp->code, *(op), PARROT_OP_get_results_pc)
- || OPCODE_IS(interp, interp->code, *(op), PARROT_OP_get_params_pc))
+ if (OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_get_results_pc)
+ || OPCODE_IS(interp, interp->code, *(op), core_ops, PARROT_OP_get_params_pc))
specialop = 2;
if (specialop > 0) {
Modified: branches/oplib_handling_cleanup/src/interp/inter_create.c
==============================================================================
--- branches/oplib_handling_cleanup/src/interp/inter_create.c Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/interp/inter_create.c Fri Sep 10 18:47:50 2010 (r48912)
@@ -254,8 +254,6 @@
/* Load the core op func and info tables */
interp->op_lib = PARROT_CORE_OPLIB_INIT(interp, 1);
interp->op_count = interp->op_lib->op_count;
- interp->op_func_table = interp->op_lib->op_func_table;
- interp->op_info_table = interp->op_lib->op_info_table;
interp->all_op_libs = NULL;
interp->evc_func_table = NULL;
interp->evc_func_table_size = 0;
Modified: branches/oplib_handling_cleanup/src/ops/core_ops.c
==============================================================================
--- branches/oplib_handling_cleanup/src/ops/core_ops.c Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/ops/core_ops.c Fri Sep 10 18:47:50 2010 (r48912)
@@ -26205,6 +26205,7 @@
hop = NULL;
hop_buckets = NULL;
}
+PARROT_EXPORT
op_lib_t *
Parrot_DynOp_core_2_7_0(PARROT_INTERP, long init) {
/* initialize and return op_lib ptr */
Modified: branches/oplib_handling_cleanup/src/pbc_merge.c
==============================================================================
--- branches/oplib_handling_cleanup/src/pbc_merge.c Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/pbc_merge.c Fri Sep 10 18:47:50 2010 (r48912)
@@ -41,6 +41,7 @@
#include "parrot/parrot.h"
#include "parrot/embed.h"
#include "parrot/oplib/ops.h"
+#include "parrot/oplib/core_ops.h"
#include "pmc/pmc_sub.h"
@@ -699,6 +700,7 @@
opcode_t *ops = bc->base.data;
opcode_t cur_op = 0;
int cur_input = 0;
+ op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp);
/* Loop over the ops in the merged bytecode. */
while (cur_op < (opcode_t)bc->base.size) {
@@ -738,10 +740,10 @@
/* Handle special case variable argument opcodes. */
op_func = interp->code->op_func_table[op_num];
- if (op_func == interp->op_func_table[PARROT_OP_set_args_pc] ||
- op_func == interp->op_func_table[PARROT_OP_get_results_pc] ||
- op_func == interp->op_func_table[PARROT_OP_get_params_pc] ||
- op_func == interp->op_func_table[PARROT_OP_set_returns_pc]) {
+ if (op_func == core_ops->op_func_table[PARROT_OP_set_args_pc] ||
+ op_func == core_ops->op_func_table[PARROT_OP_get_results_pc] ||
+ op_func == core_ops->op_func_table[PARROT_OP_get_params_pc] ||
+ op_func == core_ops->op_func_table[PARROT_OP_set_returns_pc]) {
/* Get the signature. */
PMC * const sig = bc->const_table->constants[op_ptr[1]].u.key;
Modified: branches/oplib_handling_cleanup/src/pmc/sub.pmc
==============================================================================
--- branches/oplib_handling_cleanup/src/pmc/sub.pmc Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/pmc/sub.pmc Fri Sep 10 18:47:50 2010 (r48912)
@@ -19,6 +19,7 @@
*/
#include "parrot/oplib/ops.h"
+#include "parrot/oplib/core_ops.h"
#include "sub.str"
/* HEADERIZER HFILE: none */
@@ -863,14 +864,14 @@
if (!sub->arg_info) {
/* Get pointer into the bytecode where this sub starts. */
const opcode_t *pc = sub->seg->base.data + sub->start_offs;
+ op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(INTERP);
/* Allocate structure to store argument information in. */
sub->arg_info = mem_gc_allocate_zeroed_typed(INTERP,
Parrot_sub_arginfo);
/* If the first instruction is a get_params... */
- if (sub->seg->op_func_table[*pc]
- == interp->op_func_table[PARROT_OP_get_params_pc]) {
+ if (OPCODE_IS(INTERP, sub->seg, *pc, core_ops, PARROT_OP_get_params_pc)) {
/* Get the signature (the next thing in the bytecode). */
PMC * const sig = PF_CONST(sub->seg, *(++pc)).u.key;
Modified: branches/oplib_handling_cleanup/src/sub.c
==============================================================================
--- branches/oplib_handling_cleanup/src/sub.c Fri Sep 10 18:10:04 2010 (r48911)
+++ branches/oplib_handling_cleanup/src/sub.c Fri Sep 10 18:47:50 2010 (r48912)
@@ -23,6 +23,7 @@
#include "sub.str"
#include "pmc/pmc_sub.h"
#include "pmc/pmc_continuation.h"
+#include "parrot/oplib/core_ops.h"
/* HEADERIZER HFILE: include/parrot/sub.h */
More information about the parrot-commits
mailing list