Front page | perl.cvs.parrot |
Postings from January 2009
[svn:parrot] r36081 - in trunk: include/parrot src src/jit/i386 src/jit/ppc src/ops src/pmc t/tools/ops2pm/samples
From:
cotto
Date:
January 27, 2009 22:44
Subject:
[svn:parrot] r36081 - in trunk: include/parrot src src/jit/i386 src/jit/ppc src/ops src/pmc t/tools/ops2pm/samples
Message ID:
20090128064256.84B2CCB9AE@x12.develooper.com
Author: cotto
Date: Tue Jan 27 22:42:54 2009
New Revision: 36081
Modified:
trunk/include/parrot/inter_call.h
trunk/include/parrot/pic.h
trunk/src/debug.c
trunk/src/interpreter.c
trunk/src/jit/i386/core.jit
trunk/src/jit/i386/jit_defs.c
trunk/src/jit/ppc/core.jit
trunk/src/jit/ppc/jit_emit.h
trunk/src/ops/pic.ops
trunk/src/pic.c
trunk/src/pic_jit.c
trunk/src/pmc/bound_nci.pmc
trunk/src/pmc/fixedintegerarray.pmc
trunk/src/pmc/integer.pmc
trunk/src/trace.c
trunk/t/tools/ops2pm/samples/core_ops.original
trunk/t/tools/ops2pm/samples/pic_ops.original
Log:
[pmc] remove SIG_x macros, mostly fix t/examples/shootout.t
Modified: trunk/include/parrot/inter_call.h
==============================================================================
--- trunk/include/parrot/inter_call.h (original)
+++ trunk/include/parrot/inter_call.h Tue Jan 27 22:42:54 2009
@@ -356,10 +356,6 @@
PARROT_ASSERT(PObj_is_PMC_TEST(sig)); \
PARROT_ASSERT((sig)->vtable->base_type == enum_class_FixedIntegerArray)
-#define SIG_ELEMS(sig) PMC_int_val(sig)
-#define SIG_ARRAY(sig) (INTVAL*)PMC_data(sig)
-#define SIG_ITEM(sig, idx) (SIG_ARRAY(sig))[(idx)]
-
/* XXX Remove interp from this */
#define ADD_OP_VAR_PART(interp, seg, pc, n) do { \
if (*(pc) == PARROT_OP_set_args_pc || \
Modified: trunk/include/parrot/pic.h
==============================================================================
--- trunk/include/parrot/pic.h (original)
+++ trunk/include/parrot/pic.h Tue Jan 27 22:42:54 2009
@@ -87,13 +87,14 @@
FUNC_MODIFIES(*cs);
PARROT_WARN_UNUSED_RESULT
-int parrot_pic_check_sig(
- ARGIN(const PMC *sig1),
- ARGIN(const PMC *sig2),
+int parrot_pic_check_sig(PARROT_INTERP,
+ ARGIN(PMC *sig1),
+ ARGIN(PMC *sig2),
ARGOUT(int *type))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
+ __attribute__nonnull__(4)
FUNC_MODIFIES(*type);
void parrot_PIC_destroy(ARGMOD(PackFile_ByteCode *cs))
@@ -135,7 +136,8 @@
#define ASSERT_ARGS_parrot_PIC_alloc_store __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(cs)
#define ASSERT_ARGS_parrot_pic_check_sig __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig1) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig1) \
|| PARROT_ASSERT_ARG(sig2) \
|| PARROT_ASSERT_ARG(type)
#define ASSERT_ARGS_parrot_PIC_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -162,8 +164,8 @@
PARROT_WARN_UNUSED_RESULT
int parrot_pic_is_safe_to_jit(PARROT_INTERP,
ARGIN(PMC *sub),
- ARGIN(const PMC *sig_args),
- ARGIN(const PMC *sig_results),
+ ARGIN(PMC *sig_args),
+ ARGIN(PMC *sig_results),
ARGOUT(int *flags))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c (original)
+++ trunk/src/debug.c Tue Jan 27 22:42:54 2009
@@ -2840,7 +2840,7 @@
if (specialop > 0) {
char buf[1000];
PMC * const sig = interp->code->const_table->constants[op[1]]->u.key;
- int n_values = SIG_ELEMS(sig);
+ int n_values = VTABLE_elements(interp, sig);
/* The flag_names strings come from Call_bits_enum_t (with which it
should probably be colocated); they name the bits from LSB to MSB.
The two least significant bits are not flags; they are the register
Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c (original)
+++ trunk/src/interpreter.c Tue Jan 27 22:42:54 2009
@@ -203,7 +203,7 @@
int type;
if (i >= m) {
PMC * const sig = (PMC*) pc_prederef[1];
- type = SIG_ITEM(sig, i - m);
+ type = VTABLE_get_integer_keyed_int(interp, sig, i - m);
type &= (PARROT_ARG_TYPE_MASK | PARROT_ARG_CONSTANT);
}
else
Modified: trunk/src/jit/i386/core.jit
==============================================================================
--- trunk/src/jit/i386/core.jit (original)
+++ trunk/src/jit/i386/core.jit Tue Jan 27 22:42:54 2009
@@ -1461,14 +1461,14 @@
constants = CONTEXT(interp)->constants;
params = jit_info->optimizer->sections->begin;
sig_params = constants[params[1]]->u.key;
- op_i = 2 + SIG_ELEMS(sig_params);
+ op_i = 2 + VTABLE_elements(interp, sig_params);
offset = jit_info->arena.op_map[op_i].offset;
/* TODO preserve necessary regs */
assert(*CUR_OPCODE == PARROT_OP_get_results_pc);
constants = CONTEXT(interp)->constants;
sig_result = constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
skip = -1;
else
skip = MAP(2); /* skip result - save rest */
@@ -1502,9 +1502,10 @@
constants = CONTEXT(interp)->constants;
sig_result = constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
return;
- if (SIG_ITEM(sig_result, 0) == PARROT_ARG_FLOATVAL) {
+ if (VTABLE_get_integer_keyed_int(interp, sig_result, 0) ==
+ PARROT_ARG_FLOATVAL) {
/* float result is in ISR1 */
emitm_fst(NATIVECODE, MAP(2));
}
Modified: trunk/src/jit/i386/jit_defs.c
==============================================================================
--- trunk/src/jit/i386/jit_defs.c (original)
+++ trunk/src/jit/i386/jit_defs.c Tue Jan 27 22:42:54 2009
@@ -10,6 +10,7 @@
#include "parrot/parrot.h"
#include "parrot/hash.h"
#include "parrot/oplib/ops.h"
+#include "pmc/pmc_fixedintegerarray.h"
#include "jit.h"
#include "jit_emit.h"
@@ -1431,8 +1432,8 @@
INTVAL *sig_bits, i, n;
sig_pmc = CONTEXT(interp)->constants[CUR_OPCODE[1]]->u.key;
- sig_bits = SIG_ARRAY(sig_pmc);
- n = SIG_ELEMS(sig_pmc);
+ GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
+ n = VTABLE_elements(interp, sig_pmc);
jit_info->n_args = n;
emitm_movl_m_r(interp, NATIVECODE, emit_EAX, emit_EBP, emit_None, 1, 16);
for (i = 0; i < n; ++i) {
@@ -1568,9 +1569,9 @@
INTVAL *sig_bits, sig;
sig_pmc = CONTEXT(interp)->constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_pmc))
+ if (!VTABLE_elements(interp, sig_pmc))
return;
- sig_bits = SIG_ARRAY(sig_pmc);
+ GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
sig = sig_bits[0];
if (!recursive) {
/* mov 16(%ebp), %eax - fetch args ptr */
@@ -1644,13 +1645,13 @@
constants = CONTEXT(interp)->constants;
sig_args = constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_args))
+ if (!VTABLE_elements(interp, sig_args))
return;
params = jit_info->optimizer->sections->begin;
sig_params = constants[params[1]]->u.key;
ASSERT_SIG_PMC(sig_params);
- sig_bits = SIG_ARRAY(sig_args);
- n = SIG_ELEMS(sig_args);
+ GETATTR_FixedIntegerArray_int_array(interp, sig_args, sig_bits);
+ n = VTABLE_elements(interp, sig_args);
/*
* preserve registers - need get_results, because we skip the
* return value
@@ -1660,7 +1661,7 @@
sig_result = constants[result[1]]->u.key;
ASSERT_SIG_PMC(sig_result);
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
skip = -1;
else
skip = MAP(2 + n + 3 + 2);
@@ -1949,12 +1950,13 @@
constants = CONTEXT(interp)->constants;
result = CONTEXT(interp)->current_results;
sig_result = constants[result[1]]->u.key;
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
goto no_result;
/* fetch args to %edx */
emitm_movl_m_r(interp, NATIVECODE, emit_EDX, emit_EBP, emit_None, 1, 16);
emitm_movl_m_r(interp, NATIVECODE, emit_ECX, emit_EDX, emit_None, 1, 0);
- if (SIG_ITEM(sig_result, 0) == PARROT_ARG_FLOATVAL) {
+ if (VTABLE_get_integer_keyed_int(interp, sig_result, 0) ==
+ PARROT_ARG_FLOATVAL) {
jit_emit_fst_mb_n(interp, jit_info->native_ptr, emit_ECX, 0);
}
else {
Modified: trunk/src/jit/ppc/core.jit
==============================================================================
--- trunk/src/jit/ppc/core.jit (original)
+++ trunk/src/jit/ppc/core.jit Tue Jan 27 22:42:54 2009
@@ -1262,7 +1262,7 @@
PMC *sig_result = constants[CUR_OPCODE[1]]->u.key;
opcode_t *params = jit_info->optimizer->sections->begin;
PMC *sig_params = constants[params[1]]->u.key;
- int op_i = SIG_ELEMS(sig_params) + 2;
+ int op_i = VTABLE_elements(interp, sig_params) + 2;
int offset = jit_info->arena.op_map[op_i].offset;
int here = NATIVECODE - jit_info->arena.start;
int skip;
@@ -1270,7 +1270,7 @@
/* TODO preserve necessary regs */
assert(*CUR_OPCODE == PARROT_OP_get_results_pc);
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
skip = -1;
/* skip result - save rest */
else
@@ -1303,7 +1303,7 @@
PackFile_Constant **constants = CONTEXT(interp)->constants;
PMC *sig_result = constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
return;
/* result is r3 TODO Nums */
Modified: trunk/src/jit/ppc/jit_emit.h
==============================================================================
--- trunk/src/jit/ppc/jit_emit.h (original)
+++ trunk/src/jit/ppc/jit_emit.h Tue Jan 27 22:42:54 2009
@@ -17,6 +17,7 @@
# include <sys/mman.h>
# include <limits.h>
# include "parrot/oplib/ops.h"
+# include "pmc/pmc_fixedintegerarray.h"
#ifndef CACHELINESIZE
/* TODO this should be determined by configure */
@@ -908,9 +909,9 @@
INTVAL *sig_bits, sig;
sig_pmc = CONTEXT(interp)->constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_pmc))
+ if (!VTABLE_elements(interp, sig_pmc))
return;
- sig_bits = SIG_ARRAY(sig_pmc);
+ GETATTR_FixedIntegerArray_int_array(interp, sig_pmc, sig_bits);
sig = sig_bits[0];
if (!recursive) {
/* ISR2 <- args[0] */
@@ -979,13 +980,13 @@
constants = CONTEXT(interp)->constants;
sig_args = constants[CUR_OPCODE[1]]->u.key;
- if (!SIG_ELEMS(sig_args))
+ if (!VTABLE_elements(interp, sig_args))
return;
params = jit_info->optimizer->sections->begin;
sig_params = constants[params[1]]->u.key;
ASSERT_SIG_PMC(sig_params);
- sig_bits = SIG_ARRAY(sig_args);
- n = SIG_ELEMS(sig_args);
+ GETATTR_FixedIntegerArray_int_array(interp, sig_args, sig_bits);
+ n = VTABLE_elements(interp, sig_args);
/*
* preserve registers - need get_results, because we skip the
* return value
@@ -995,7 +996,7 @@
sig_result = constants[result[1]]->u.key;
ASSERT_SIG_PMC(sig_result);
- if (!SIG_ELEMS(sig_result))
+ if (!VTABLE_elements(interp, sig_result))
skip = -1;
else
skip = MAP(2 + n + 3 + 2);
Modified: trunk/src/ops/pic.ops
==============================================================================
--- trunk/src/ops/pic.ops (original)
+++ trunk/src/ops/pic.ops Tue Jan 27 22:42:54 2009
@@ -4,6 +4,7 @@
*/
#include "parrot/oplib/ops.h"
+#include "../src/pmc/pmc_fixedintegerarray.h"
typedef opcode_t* (*interface_f)(Interp*, INTVAL*, void **);
@@ -257,8 +258,8 @@
pred_pc = (void**) pc - ctx->pred_offset;
sig = (PMC*)(pred_pc[1]);
ASSERT_SIG_PMC(sig);
- PARROT_ASSERT(SIG_ELEMS(sig) <= 1);
- args[0] = SIG_ELEMS(sig) ?
+ PARROT_ASSERT(VTABLE_elements(interp, sig) <= 1);
+ args[0] = VTABLE_elements(interp, sig) ?
(_reg_base + ((opcode_t*)pred_pc)[2]) : NULL;
}
else
@@ -267,8 +268,8 @@
n_args = 0;
sig = mic->m.sig;
ASSERT_SIG_PMC(sig);
- n_args = SIG_ELEMS(sig);
- sig_bits = SIG_ARRAY(sig);
+ n_args = VTABLE_elements(interp, sig);
+ GETATTR_FixedIntegerArray_int_array(interp, sig, sig_bits);
for (i = 0; i < n_args; ++i) {
switch (sig_bits[i]) {
case PARROT_ARG_INTVAL:
Modified: trunk/src/pic.c
==============================================================================
--- trunk/src/pic.c (original)
+++ trunk/src/pic.c Tue Jan 27 22:42:54 2009
@@ -78,6 +78,7 @@
#include "parrot/parrot.h"
#include "parrot/oplib/ops.h"
+#include "pmc/pmc_fixedintegerarray.h"
#ifdef HAVE_COMPUTED_GOTO
# include "parrot/oplib/core_ops_cgp.h"
#endif
@@ -127,12 +128,13 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*mic);
-static int pass_int(SHIM_INTERP,
- ARGIN(const PMC *sig),
+static int pass_int(PARROT_INTERP,
+ ARGIN(PMC *sig),
ARGIN(const char *src_base),
ARGIN(const void **src),
ARGOUT(char *dest_base),
ARGIN(void * const *dest))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -141,7 +143,7 @@
FUNC_MODIFIES(*dest_base);
static int pass_mixed(PARROT_INTERP,
- ARGIN(const PMC *sig),
+ ARGIN(PMC *sig),
ARGIN(const char *src_base),
ARGIN(void * const *src),
ARGOUT(char *dest_base),
@@ -154,12 +156,13 @@
__attribute__nonnull__(6)
FUNC_MODIFIES(*dest_base);
-static int pass_num(SHIM_INTERP,
- ARGIN(const PMC *sig),
+static int pass_num(PARROT_INTERP,
+ ARGIN(PMC *sig),
ARGIN(const char *src_base),
ARGIN(const void **src),
ARGOUT(char *dest_base),
ARGIN(void * const *dest))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -167,12 +170,13 @@
__attribute__nonnull__(6)
FUNC_MODIFIES(*dest_base);
-static int pass_pmc(SHIM_INTERP,
- ARGIN(const PMC *sig),
+static int pass_pmc(PARROT_INTERP,
+ ARGIN(PMC *sig),
ARGIN(const char *src_base),
ARGIN(const void **src),
ARGOUT(char *dest_base),
ARGIN(void * const *dest))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -181,7 +185,7 @@
FUNC_MODIFIES(*dest_base);
static int pass_str(PARROT_INTERP,
- ARGIN(const PMC *sig),
+ ARGIN(PMC *sig),
ARGIN(const char *src_base),
ARGIN(const void **src),
ARGOUT(char *dest_base),
@@ -206,7 +210,8 @@
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(mic)
#define ASSERT_ARGS_pass_int __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig) \
|| PARROT_ASSERT_ARG(src_base) \
|| PARROT_ASSERT_ARG(src) \
|| PARROT_ASSERT_ARG(dest_base) \
@@ -219,13 +224,15 @@
|| PARROT_ASSERT_ARG(dest_base) \
|| PARROT_ASSERT_ARG(dest)
#define ASSERT_ARGS_pass_num __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig) \
|| PARROT_ASSERT_ARG(src_base) \
|| PARROT_ASSERT_ARG(src) \
|| PARROT_ASSERT_ARG(dest_base) \
|| PARROT_ASSERT_ARG(dest)
#define ASSERT_ARGS_pass_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig) \
|| PARROT_ASSERT_ARG(src_base) \
|| PARROT_ASSERT_ARG(src) \
|| PARROT_ASSERT_ARG(dest_base) \
@@ -442,12 +449,12 @@
*/
static int
-pass_int(SHIM_INTERP, ARGIN(const PMC *sig), ARGIN(const char *src_base),
+pass_int(PARROT_INTERP, ARGIN(PMC *sig), ARGIN(const char *src_base),
ARGIN(const void **src), ARGOUT(char *dest_base), ARGIN(void * const *dest))
{
ASSERT_ARGS(pass_int)
int i;
- int n = SIG_ELEMS(sig);
+ int n = VTABLE_elements(interp, sig);
for (i = 2; n; ++i, --n) {
const INTVAL arg = *(const INTVAL *)(src_base + ((const opcode_t*)src)[i]);
@@ -467,12 +474,12 @@
*/
static int
-pass_num(SHIM_INTERP, ARGIN(const PMC *sig), ARGIN(const char *src_base),
+pass_num(PARROT_INTERP, ARGIN(PMC *sig), ARGIN(const char *src_base),
ARGIN(const void **src), ARGOUT(char *dest_base), ARGIN(void * const *dest))
{
ASSERT_ARGS(pass_num)
int i;
- int n = SIG_ELEMS(sig);
+ int n = VTABLE_elements(interp, sig);
for (i = 2; n; ++i, --n) {
const FLOATVAL arg = *(const FLOATVAL *)(src_base + ((const opcode_t*)src)[i]);
@@ -492,12 +499,12 @@
*/
static int
-pass_str(PARROT_INTERP, ARGIN(const PMC *sig), ARGIN(const char *src_base),
+pass_str(PARROT_INTERP, ARGIN(PMC *sig), ARGIN(const char *src_base),
ARGIN(const void **src), ARGOUT(char *dest_base), ARGIN(void * const *dest))
{
ASSERT_ARGS(pass_str)
int i;
- int n = SIG_ELEMS(sig);
+ int n = VTABLE_elements(interp, sig);
for (i = 2; n; ++i, --n) {
STRING * const arg = *(STRING* const *)(src_base + ((const opcode_t*)src)[i]);
@@ -518,12 +525,12 @@
*/
static int
-pass_pmc(SHIM_INTERP, ARGIN(const PMC *sig), ARGIN(const char *src_base),
+pass_pmc(PARROT_INTERP, ARGIN(PMC *sig), ARGIN(const char *src_base),
ARGIN(const void **src), ARGOUT(char *dest_base), ARGIN(void * const *dest))
{
ASSERT_ARGS(pass_pmc)
int i;
- int n = SIG_ELEMS(sig);
+ int n = VTABLE_elements(interp, sig);
for (i = 2; n; ++i, --n) {
PMC * const arg = *(PMC* const *)(src_base + ((const opcode_t*)src)[i]);
@@ -543,16 +550,16 @@
*/
static int
-pass_mixed(PARROT_INTERP, ARGIN(const PMC *sig), ARGIN(const char *src_base),
+pass_mixed(PARROT_INTERP, ARGIN(PMC *sig), ARGIN(const char *src_base),
ARGIN(void * const *src), ARGOUT(char *dest_base), ARGIN(void * const *dest))
{
ASSERT_ARGS(pass_mixed)
int i;
INTVAL *bitp;
- int n = SIG_ELEMS(sig);
+ int n = VTABLE_elements(interp, sig);
ASSERT_SIG_PMC(sig);
- bitp = SIG_ARRAY(sig);
+ GETATTR_FixedIntegerArray_int_array(interp, sig, bitp);
for (i = 2; n; ++i, --n) {
const INTVAL bits = *bitp++;
@@ -630,7 +637,7 @@
PARROT_WARN_UNUSED_RESULT
int
-parrot_pic_check_sig(ARGIN(const PMC *sig1), ARGIN(const PMC *sig2),
+parrot_pic_check_sig(PARROT_INTERP, ARGIN(PMC *sig1), ARGIN(PMC *sig2),
ARGOUT(int *type))
{
ASSERT_ARGS(parrot_pic_check_sig)
@@ -639,9 +646,9 @@
ASSERT_SIG_PMC(sig1);
ASSERT_SIG_PMC(sig2);
- n = SIG_ELEMS(sig1);
+ n = VTABLE_elements(interp, sig1);
- if (n != SIG_ELEMS(sig2))
+ if (n != VTABLE_elements(interp, sig2))
return -1;
if (!n) {
@@ -650,8 +657,8 @@
}
for (i = 0; i < n; ++i) {
- int t1 = SIG_ITEM(sig1, i);
- int t2 = SIG_ITEM(sig2, i);
+ int t1 = VTABLE_get_integer_keyed_int(interp, sig1, i);
+ int t2 = VTABLE_get_integer_keyed_int(interp, sig2, i);
if (i) {
t0 = 0;
@@ -728,13 +735,13 @@
/* check current_args signature */
sig2 = caller_ctx->constants[const_nr]->u.key;
- n = parrot_pic_check_sig(sig1, sig2, &type);
+ n = parrot_pic_check_sig(interp, sig1, sig2, &type);
if (n == -1)
return 0;
}
else {
- if (SIG_ELEMS(sig1) == 0) {
+ if (VTABLE_elements(interp, sig1) == 0) {
sig2 = NULL;
type = 0;
}
@@ -811,7 +818,7 @@
PMC * const sig_args = (PMC *)(pc[1]);
ASSERT_SIG_PMC(sig_args);
- n = SIG_ELEMS(sig_args);
+ n = VTABLE_elements(interp, sig_args);
interp->current_args = (opcode_t*)pc + ctx->pred_offset;
pc += 2 + n;
op = (opcode_t*)pc + ctx->pred_offset;
Modified: trunk/src/pic_jit.c
==============================================================================
--- trunk/src/pic_jit.c (original)
+++ trunk/src/pic_jit.c Tue Jan 27 22:42:54 2009
@@ -40,13 +40,14 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_WARN_UNUSED_RESULT
-static int args_match_params(
- ARGIN(const PMC *sig_args),
+static int args_match_params(PARROT_INTERP,
+ ARGIN(PMC *sig_args),
ARGIN(const PackFile_ByteCode *seg),
ARGIN(const opcode_t *start))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
- __attribute__nonnull__(3);
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
PARROT_WARN_UNUSED_RESULT
static int call_is_safe(PARROT_INTERP,
@@ -65,7 +66,7 @@
PARROT_WARN_UNUSED_RESULT
static int ops_jittable(PARROT_INTERP,
ARGIN(PMC *sub),
- ARGIN(const PMC *sig_results),
+ ARGIN(PMC *sig_results),
ARGIN(const PackFile_ByteCode *seg),
ARGIN(opcode_t *pc),
ARGIN(const opcode_t *end),
@@ -89,14 +90,16 @@
FUNC_MODIFIES(*args);
PARROT_WARN_UNUSED_RESULT
-static int returns_match_results(
- ARGIN(const PMC *sig_ret),
- ARGIN(const PMC *sig_result))
+static int returns_match_results(PARROT_INTERP,
+ ARGIN(PMC *sig_ret),
+ ARGIN(PMC *sig_result))
__attribute__nonnull__(1)
- __attribute__nonnull__(2);
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
#define ASSERT_ARGS_args_match_params __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig_args) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig_args) \
|| PARROT_ASSERT_ARG(seg) \
|| PARROT_ASSERT_ARG(start)
#define ASSERT_ARGS_call_is_safe __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -118,7 +121,8 @@
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(args)
#define ASSERT_ARGS_returns_match_results __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(sig_ret) \
+ PARROT_ASSERT_ARG(interp) \
+ || PARROT_ASSERT_ARG(sig_ret) \
|| PARROT_ASSERT_ARG(sig_result)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -243,12 +247,12 @@
PARROT_WARN_UNUSED_RESULT
static int
-args_match_params(ARGIN(const PMC *sig_args), ARGIN(const PackFile_ByteCode *seg),
+args_match_params(PARROT_INTERP, ARGIN(PMC *sig_args), ARGIN(const PackFile_ByteCode *seg),
ARGIN(const opcode_t *start))
{
ASSERT_ARGS(args_match_params)
- const PMC *sig_params;
- int n, type;
+ PMC *sig_params;
+ int n, type;
if (*start != PARROT_OP_get_params_pc)
return 0;
@@ -258,7 +262,7 @@
/* verify that we actually can pass arguments */
ASSERT_SIG_PMC(sig_params);
- n = parrot_pic_check_sig(sig_args, sig_params, &type);
+ n = parrot_pic_check_sig(interp, sig_args, sig_params, &type);
/* arg count mismatch */
if (n == -1)
@@ -293,11 +297,11 @@
PARROT_WARN_UNUSED_RESULT
static int
-returns_match_results(ARGIN(const PMC *sig_ret), ARGIN(const PMC *sig_result))
+returns_match_results(PARROT_INTERP, ARGIN(PMC *sig_ret), ARGIN(PMC *sig_result))
{
ASSERT_ARGS(returns_match_results)
int type;
- const int n = parrot_pic_check_sig(sig_ret, sig_result, &type);
+ const int n = parrot_pic_check_sig(interp, sig_ret, sig_result, &type);
/* arg count mismatch */
if (n == -1)
@@ -342,7 +346,7 @@
PMC_sub(sub)->seg->const_table->constants[pc[1]]->u.key;
/* ignore the signature for now */
- pc += 2 + SIG_ELEMS(sig_args);
+ pc += 2 + VTABLE_elements(interp, sig_args);
if (*pc != PARROT_OP_set_p_pc)
return 0;
@@ -359,7 +363,7 @@
return 0;
sig_results = PMC_sub(sub)->seg->const_table->constants[pc[1]]->u.key;
- pc += 2 + SIG_ELEMS(sig_results);
+ pc += 2 + VTABLE_elements(interp, sig_results);
if (*pc != PARROT_OP_invokecc_p)
return 0;
@@ -383,7 +387,7 @@
PARROT_WARN_UNUSED_RESULT
static int
-ops_jittable(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(const PMC *sig_results),
+ops_jittable(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(PMC *sig_results),
ARGIN(const PackFile_ByteCode *seg), ARGIN(opcode_t *pc),
ARGIN(const opcode_t *end), ARGOUT(int *flags))
{
@@ -403,8 +407,8 @@
break;
case PARROT_OP_set_returns_pc:
{
- const PMC * const sig_ret = seg->const_table->constants[pc[1]]->u.key;
- if (!returns_match_results(sig_ret, sig_results))
+ PMC * const sig_ret = seg->const_table->constants[pc[1]]->u.key;
+ if (!returns_match_results(interp, sig_ret, sig_results))
return 0;
}
goto op_is_ok;
@@ -459,8 +463,8 @@
PARROT_WARN_UNUSED_RESULT
int
-parrot_pic_is_safe_to_jit(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(const PMC *sig_args),
- ARGIN(const PMC *sig_results), ARGOUT(int *flags))
+parrot_pic_is_safe_to_jit(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(PMC *sig_args),
+ ARGIN(PMC *sig_results), ARGOUT(int *flags))
{
ASSERT_ARGS(parrot_pic_is_safe_to_jit)
#ifdef HAS_JIT
@@ -489,7 +493,7 @@
start = base + PMC_sub(sub)->start_offs;
end = base + PMC_sub(sub)->end_offs;
- if (!args_match_params(sig_args, PMC_sub(sub)->seg, start))
+ if (!args_match_params(interp, sig_args, PMC_sub(sub)->seg, start))
return 0;
/*
Modified: trunk/src/pmc/bound_nci.pmc
==============================================================================
--- trunk/src/pmc/bound_nci.pmc (original)
+++ trunk/src/pmc/bound_nci.pmc Tue Jan 27 22:42:54 2009
@@ -77,7 +77,9 @@
ASSERT_SIG_PMC(sig);
/* Get invocant register. */
- if (SIG_ELEMS(sig) > 0 && SIG_ITEM(sig, 0) & PARROT_ARG_PMC) {
+ if (VTABLE_elements(INTERP, sig) > 0 &&
+ VTABLE_get_integer_keyed_int(INTERP, sig, 0) &
+ PARROT_ARG_PMC) {
int invocant_reg = interp->current_args[2];
PMC *p2 = REG_PMC(interp, invocant_reg);
INTERP->current_object = REG_PMC(interp, invocant_reg)
Modified: trunk/src/pmc/fixedintegerarray.pmc
==============================================================================
--- trunk/src/pmc/fixedintegerarray.pmc (original)
+++ trunk/src/pmc/fixedintegerarray.pmc Tue Jan 27 22:42:54 2009
@@ -417,8 +417,8 @@
SET_ATTR_size(INTERP, SELF, size);
GET_ATTR_int_array(INTERP, SELF, int_array);
- int_array = mem_realloc_n_typed(int_array, size, INTVAL);
- SET_ATTR_int_array(INTERP, SELF, int_array);
+ SET_ATTR_int_array(INTERP, SELF,
+ mem_realloc_n_typed(int_array, size, INTVAL));
PObj_active_destroy_SET(SELF);
}
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc (original)
+++ trunk/src/pmc/integer.pmc Tue Jan 27 22:42:54 2009
@@ -71,8 +71,8 @@
opcode_t *arg_op = interp->current_args;
INTVAL init = 0;
- if (SIG_ELEMS(sig) == 2) {
- switch (SIG_ITEM(sig, 1)) {
+ if (VTABLE_elements(interp, sig) == 2) {
+ switch (VTABLE_get_integer_keyed_int(INTERP, sig, 1)) {
case PARROT_ARG_I:
init = REG_INT(interp, arg_op[3]);
break;
Modified: trunk/src/trace.c
==============================================================================
--- trunk/src/trace.c (original)
+++ trunk/src/trace.c Tue Jan 27 22:42:54 2009
@@ -314,7 +314,7 @@
Parrot_ex_throw_from_c_args(interp, NULL, 1,
"NULL sig PMC detected in trace_op_dump");
- type = SIG_ITEM(sig, i - 2) &
+ type = VTABLE_get_integer_keyed_int(interp, sig, i - 2) &
(PARROT_ARG_TYPE_MASK|PARROT_ARG_CONSTANT);
}
if (i > s &&
@@ -403,7 +403,7 @@
if (i < info->op_count)
type = info->types[i - 1];
else
- type = SIG_ITEM(sig, i - 2) &
+ type = VTABLE_get_integer_keyed_int(interp, sig, i - 2) &
(PARROT_ARG_TYPE_MASK|PARROT_ARG_CONSTANT);
if (i > s) {
Parrot_io_eprintf(debugger, " ");
Modified: trunk/t/tools/ops2pm/samples/core_ops.original
==============================================================================
--- trunk/t/tools/ops2pm/samples/core_ops.original (original)
+++ trunk/t/tools/ops2pm/samples/core_ops.original Tue Jan 27 22:42:54 2009
@@ -494,7 +494,7 @@
/* for now just point to the opcode */
interp->current_args = _this;
- argc = SIG_ELEMS(signature);
+ argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -504,7 +504,7 @@
INTVAL argc;
CONTEXT(interp)->current_results = _this;
- argc = SIG_ELEMS(signature);
+ argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -538,7 +538,7 @@
Parrot_free_context(interp, caller_ctx, 0);
interp->current_args = NULL;
}
- argc = SIG_ELEMS(signature);
+ argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -571,7 +571,7 @@
parrot_pass_args(interp, ctx, caller_ctx, src_indexes, dest_indexes, PARROT_PASS_RESULTS);
}
- argc = SIG_ELEMS(signature);
+ argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
Modified: trunk/t/tools/ops2pm/samples/pic_ops.original
==============================================================================
--- trunk/t/tools/ops2pm/samples/pic_ops.original (original)
+++ trunk/t/tools/ops2pm/samples/pic_ops.original Tue Jan 27 22:42:54 2009
@@ -4,6 +4,7 @@
*/
#include "parrot/oplib/ops.h"
+#include "../src/pmc/pmc_fixedintegerarray.h"
typedef opcode_t* (*interface_f)(Interp*, INTVAL*, void **);
@@ -255,8 +256,8 @@
pred_pc = (void**) pc - ctx->pred_offset;
sig = (PMC*)(pred_pc[1]);
ASSERT_SIG_PMC(sig);
- PARROT_ASSERT(SIG_ELEMS(sig) <= 1);
- args[0] = SIG_ELEMS(sig) ?
+ PARROT_ASSERT(VTABLE_elements(interp, sig) <= 1);
+ args[0] = VTABLE_elements(interp, sig) ?
(_reg_base + ((opcode_t*)pred_pc)[2]) : NULL;
}
else
@@ -265,8 +266,8 @@
n_args = 0;
sig = mic->m.sig;
ASSERT_SIG_PMC(sig);
- n_args = SIG_ELEMS(sig);
- sig_bits = SIG_ARRAY(sig);
+ n_args = VTABLE_elements(interp, sig);
+ GETATTR_FixedIntegerArray_int_array(interp, sig, sig_bits);
for (i = 0; i < n_args; ++i) {
switch (sig_bits[i]) {
case PARROT_ARG_INTVAL:
-
[svn:parrot] r36081 - in trunk: include/parrot src src/jit/i386 src/jit/ppc src/ops src/pmc t/tools/ops2pm/samples
by cotto