Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[pmc] remove SIG_x macros, mostly fix t/examples/shootout.t

git-svn-id: https://svn.parrot.org/parrot/trunk@36081 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
commit d923b9fa5bb7dd3624b26783c2c1a792c64baae2 1 parent 36bd033
@cotto cotto authored
View
4 include/parrot/inter_call.h
@@ -356,10 +356,6 @@ STRING* set_retval_s(PARROT_INTERP, int sig_ret, ARGIN(Parrot_Context *ctx))
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 || \
View
14 include/parrot/pic.h
@@ -87,13 +87,14 @@ void parrot_PIC_alloc_store(ARGOUT(PackFile_ByteCode *cs), size_t n)
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 @@ void parrot_PIC_prederef(PARROT_INTERP,
#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 @@ void parrot_PIC_prederef(PARROT_INTERP,
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)
View
2  src/debug.c
@@ -2840,7 +2840,7 @@ PDB_disassemble_op(PARROT_INTERP, ARGOUT(char *dest), size_t space,
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
View
2  src/interpreter.c
@@ -203,7 +203,7 @@ prederef_args(ARGMOD(void **pc_prederef), PARROT_INTERP,
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
View
9 src/jit/i386/core.jit
@@ -1461,14 +1461,14 @@ Parrot_pic_callr___pc {
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 @@ Parrot_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))
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));
}
View
22 src/jit/i386/jit_defs.c
@@ -10,6 +10,7 @@ Copyright (C) 2008, The Perl Foundation.
#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 @@ jit_get_params_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP)
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 @@ jit_set_returns_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
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 @@ jit_set_args_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
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 @@ jit_set_args_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
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 @@ Parrot_jit_begin_sub_regs(Parrot_jit_info_t *jit_info,
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 {
View
6 src/jit/ppc/core.jit
@@ -1262,7 +1262,7 @@ Parrot_pic_callr___pc {
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 @@ Parrot_pic_callr___pc {
/* 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 @@ Parrot_get_results_pc {
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 */
View
13 src/jit/ppc/jit_emit.h
@@ -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 @@ jit_set_returns_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP,
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 @@ jit_set_args_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP, int recursive)
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 @@ jit_set_args_pc(Parrot_jit_info_t *jit_info, PARROT_INTERP, int recursive)
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);
View
9 src/ops/pic.ops
@@ -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 @@ inline op pic_callr__(inconst PMC) :pic :flow {
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 @@ inline op pic_callr__(inconst PMC) :pic :flow {
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:
View
67 src/pic.c
@@ -78,6 +78,7 @@ lookup of the cache has to be done in the opcode itself.
#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 @@ static void parrot_pic_move(PARROT_INTERP, ARGMOD(Parrot_MIC *mic))
__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 @@ static int pass_int(SHIM_INTERP,
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 @@ static int pass_mixed(PARROT_INTERP,
__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 @@ static int pass_num(SHIM_INTERP,
__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 @@ static int pass_pmc(SHIM_INTERP,
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 @@ static int pass_str(PARROT_INTERP,
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 @@ static int pass_str(PARROT_INTERP,
|| 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 @@ RT #48260: Not yet documented!!!
*/
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 @@ RT #48260: Not yet documented!!!
*/
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 @@ RT #48260: Not yet documented!!!
*/
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 @@ RT #48260: Not yet documented!!!
*/
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 @@ RT #48260: Not yet documented!!!
*/
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 @@ the type PARROT_ARG_CONSTANT stands for mixed types or constants
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 @@ parrot_pic_check_sig(ARGIN(const PMC *sig1), ARGIN(const PMC *sig2),
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 @@ parrot_pic_check_sig(ARGIN(const PMC *sig1), ARGIN(const PMC *sig2),
}
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 @@ is_pic_param(PARROT_INTERP, ARGIN(void **pc), ARGOUT(Parrot_MIC *mic), opcode_t
/* 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 @@ is_pic_func(PARROT_INTERP, ARGIN(void **pc), ARGOUT(Parrot_MIC *mic), int core_t
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;
View
52 src/pic_jit.c
@@ -40,13 +40,14 @@ their JITted variants, if
/* 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 @@ static int jit_can_compile_sub(PARROT_INTERP, ARGIN(PMC *sub))
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 @@ static opcode_t * pic_test_func(PARROT_INTERP,
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 @@ static int returns_match_results(
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 @@ Returns C<0> otherwise.
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 @@ args_match_params(ARGIN(const PMC *sig_args), ARGIN(const PackFile_ByteCode *seg
/* 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 @@ otherwise.
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 @@ call_is_safe(PARROT_INTERP, ARGIN(PMC *sub), ARGMOD(opcode_t **set_args))
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 @@ call_is_safe(PARROT_INTERP, ARGIN(PMC *sub), ARGMOD(opcode_t **set_args))
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 @@ otherwise.
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 @@ ops_jittable(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(const PMC *sig_results),
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 @@ RT#48260: Not yet documented!!!
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 @@ parrot_pic_is_safe_to_jit(PARROT_INTERP, ARGIN(PMC *sub), ARGIN(const PMC *sig_a
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;
/*
View
4 src/pmc/bound_nci.pmc
@@ -77,7 +77,9 @@ Set the bound object live.
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)
View
4 src/pmc/fixedintegerarray.pmc
@@ -417,8 +417,8 @@ Resizes the array to C<size> elements.
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);
}
View
4 src/pmc/integer.pmc
@@ -71,8 +71,8 @@ Initializes the integer with a default value of C<0>.
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;
View
4 src/trace.c
@@ -314,7 +314,7 @@ trace_op_dump(PARROT_INTERP,
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 @@ trace_op_dump(PARROT_INTERP,
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, " ");
View
8 t/tools/ops2pm/samples/core_ops.original
@@ -494,7 +494,7 @@ op set_args(inconst PMC) :flow {
/* 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 @@ op get_results(inconst PMC) :flow {
INTVAL argc;
CONTEXT(interp)->current_results = _this;
- argc = SIG_ELEMS(signature);
+ argc = VTABLE_elements(interp, signature);
goto OFFSET(argc + 2);
}
@@ -538,7 +538,7 @@ op get_params(inconst PMC) :flow {
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 @@ op set_returns(inconst PMC) :flow {
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);
}
View
9 t/tools/ops2pm/samples/pic_ops.original
@@ -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 @@ inline op pic_callr__(inconst PMC) :pic :flow {
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 @@ inline op pic_callr__(inconst PMC) :pic :flow {
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:
Please sign in to comment.
Something went wrong with that request. Please try again.