Author: infinoid
Date: Fri Jan 9 06:56:39 2009
New Revision: 35305
Modified:
trunk/languages/befunge/befunge.pir
trunk/languages/befunge/debug.pir
trunk/languages/befunge/flow.pir
trunk/languages/befunge/io.pir
trunk/languages/befunge/maths.pir
trunk/languages/befunge/stack.pir
trunk/src/jit/i386/jit_defs.c
trunk/src/jit/i386/jit_emit.h
trunk/src/pmc/packfileconstanttable.pmc
trunk/src/pmc/packfilerawsegment.pmc
Log:
[cage] Fix some "make codetest" failures (c_code_coda, c_indent, c_parens,
linelength, tabs, trailing_space).
Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir (original)
+++ trunk/languages/befunge/befunge.pir Fri Jan 9 06:56:39 2009
@@ -80,7 +80,7 @@
if char == '|' goto FLOW_IF_VERTICAL
if char == '#' goto FLOW_BRIDGE
if char == '@' goto FLOW_END
-
+
# math functions
if char == '+' goto MATHS_ADD
if char == '-' goto MATHS_SUB
@@ -88,7 +88,7 @@
if char == '/' goto MATHS_DIV
if char == '%' goto MATHS_MOD
if char == '!' goto MATHS_NOT
-
+
# stack operations
if char == ':' goto STACK_DUP
if char == '$' goto STACK_POP
@@ -101,7 +101,7 @@
if char == '.' goto IO_OUTPUT_INT
if char == 'g' goto IO_VALUE_GET
if char == 'p' goto IO_VALUE_PUT
-
+
# unknown instruction
goto MOVE_PC
@@ -188,7 +188,7 @@
MATHS_SUB:
maths__sub()
goto MOVE_PC
-
+
# stack operations
STACK_DUP:
stack__duplicate()
@@ -199,7 +199,7 @@
STACK_SWAP:
$I0 = stack__swap()
goto MOVE_PC
-
+
# instruction executed, now move the pc
Modified: trunk/languages/befunge/debug.pir
==============================================================================
--- trunk/languages/befunge/debug.pir (original)
+++ trunk/languages/befunge/debug.pir Fri Jan 9 06:56:39 2009
@@ -209,20 +209,20 @@
$P0[$S0] = 1
set_global "breakpoints", $P0
goto DEBUG__INTERACT__LOOP
-
+
DEBUG__INTERACT__CONTINUE:
$P0 = get_global "step"
$P0 = 0
set_global "step", $P0
goto DEBUG__INTERACT__END
-
+
DEBUG__INTERACT__DELETE:
substr $S0, 0, 7, ""
$P0 = get_global "breakpoints"
delete $P0[$S0]
set_global "breakpoints", $P0
goto DEBUG__INTERACT__LOOP
-
+
DEBUG__INTERACT__DUMP:
_debug__dump_playfield()
goto DEBUG__INTERACT__LOOP
@@ -244,11 +244,11 @@
DEBUG__INTERACT__QUIT:
end
-
+
DEBUG__INTERACT__RESTART:
print "Not yet implemented...\n"
goto DEBUG__INTERACT__LOOP
-
+
DEBUG__INTERACT__STATUS:
_debug__print_status()
goto DEBUG__INTERACT__LOOP
Modified: trunk/languages/befunge/flow.pir
==============================================================================
--- trunk/languages/befunge/flow.pir (original)
+++ trunk/languages/befunge/flow.pir Fri Jan 9 06:56:39 2009
@@ -94,11 +94,11 @@
.local int a, b
b = stack__pop()
a = stack__pop()
-
+
if a < b goto FLOW__COMPARE__FALSE
stack__push(1)
.return()
-
+
FLOW__COMPARE__FALSE:
stack__push(0)
.end
Modified: trunk/languages/befunge/io.pir
==============================================================================
--- trunk/languages/befunge/io.pir (original)
+++ trunk/languages/befunge/io.pir Fri Jan 9 06:56:39 2009
@@ -41,15 +41,15 @@
$P1 = getstdin
$S0 = readline $P1
chopn $S0, 1
-
+
_IO__INPUT_CHAR__SUBSTR:
$S1 = substr $S0, 0, 1, ""
$P0 = $S0
set_global "user_input", $P0
-
+
$I0 = ord $S1
stack__push($I0)
-
+
.end
#
@@ -74,7 +74,7 @@
$S0 = readline $P1
chopn $S0, 1
len = length $S0
-
+
_IO__INPUT_INT__PARSE_INPUT:
.local int i
.local string buf
@@ -87,12 +87,12 @@
concat buf, $S1
inc i
if i < len goto _IO__INPUT_INT__NEXT_CHAR
-
+
_IO__INPUT_INT__NAN:
substr $S0, 0, i, ""
$P0 = $S0
set_global "user_input", $P0
-
+
$I0 = buf
stack__push($I0)
.end
@@ -146,7 +146,7 @@
.local int x, y
y = stack__pop()
x = stack__pop()
-
+
$P0 = get_global "playfield"
$I0 = $P0[y;x]
stack__push($I0)
Modified: trunk/languages/befunge/maths.pir
==============================================================================
--- trunk/languages/befunge/maths.pir (original)
+++ trunk/languages/befunge/maths.pir Fri Jan 9 06:56:39 2009
@@ -50,7 +50,7 @@
$I2 = $I0 / $I1
stack__push($I2)
.return()
-
+
MATHS__DIV__BY_ZERO:
stack__push(0)
.end
Modified: trunk/languages/befunge/stack.pir
==============================================================================
--- trunk/languages/befunge/stack.pir (original)
+++ trunk/languages/befunge/stack.pir Fri Jan 9 06:56:39 2009
@@ -11,7 +11,7 @@
#
.sub "stack__duplicate"
$I0 = stack__pop()
-
+
$P0 = get_global "stack"
push $P0, $I0
push $P0, $I0
Modified: trunk/src/jit/i386/jit_defs.c
==============================================================================
--- trunk/src/jit/i386/jit_defs.c (original)
+++ trunk/src/jit/i386/jit_defs.c Fri Jan 9 06:56:39 2009
@@ -4,13 +4,6 @@
*/
/* HEADERIZER HFILE: none */
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
-
#include <assert.h>
#include "parrot/parrot.h"
#include "parrot/hash.h"
@@ -347,7 +340,7 @@
*(pc++) = imm;
return pc;
}
-
+
char *
opt_mul(PARROT_INTERP, char *pc, int dest, INTVAL imm, int src)
{
@@ -719,7 +712,7 @@
saved = 1;
jit_emit_mov_rr_i(pc, emit_ECX, emit_EDX);
}
- }
+ }
/* this sequence allows 2 other instructions to run parallel */
jit_emit_mov_rr_i(pc, emit_EDX, emit_EAX);
pc = emit_shift_i_r(interp, pc, emit_b111, 31, emit_EDX); /* SAR 31 */
@@ -1106,40 +1099,40 @@
/*
* TODO not all constants are shared between interpreters
*/
-# if EXEC_CAPABLE
+#if EXEC_CAPABLE
if (jit_info->objfile) {
jit_emit_fload_m_n(interp, jit_info->native_ptr, CONST(i));
Parrot_exec_add_text_rellocation(jit_info->objfile,
jit_info->native_ptr, RTYPE_DATA, "const_table",
-4);
}
else
-# endif
+#endif
jit_emit_fload_m_n(interp, jit_info->native_ptr,
&interp->code->const_table->
constants[pi]->u.number);
store:
-# if NUMVAL_SIZE == 8
+#if NUMVAL_SIZE == 8
/* make room for double */
emitm_addb_i_r(jit_info->native_ptr, -8, emit_ESP);
emitm_fstpl(interp, jit_info->native_ptr, emit_ESP, emit_None,
1, 0);
/* additional stack adjustment */
st += 4;
-# else
+#else
emitm_addb_i_r(jit_info->native_ptr, -12, emit_ESP);
emitm_fstpt(jit_info->native_ptr, emit_ESP, emit_None, 1, 0);
st += 8;
-# endif
+#endif
break;
case PARROT_ARG_SC:
-# if EXEC_CAPABLE
+#if EXEC_CAPABLE
if (jit_info->objfile) {
emitm_pushl_m(jit_info->native_ptr, CONST(i));
Parrot_exec_add_text_rellocation(jit_info->objfile,
jit_info->native_ptr, RTYPE_DATA, "const_table",
-4);
}
else
-# endif
+#endif
emitm_pushl_i(jit_info->native_ptr,
interp->code->const_table->
constants[pi]->u.string);
@@ -1147,7 +1140,7 @@
case PARROT_ARG_KC:
case PARROT_ARG_PC:
-# if EXEC_CAPABLE
+#if EXEC_CAPABLE
if (jit_info->objfile) {
emitm_pushl_m(jit_info->native_ptr, CONST(i));
Parrot_exec_add_text_rellocation(jit_info->objfile,
@@ -1155,7 +1148,7 @@
"const_table", -4);
}
else
-# endif
+#endif
emitm_pushl_i(jit_info->native_ptr,
interp->code->const_table->
constants[pi]->u.key);
@@ -1393,12 +1386,12 @@
/* push pmc enum and interpreter */
emitm_pushl_i(jit_info->native_ptr, i2);
emitm_pushl_r(jit_info->native_ptr, emit_ECX);
-# if EXEC_CAPABLE
+#if EXEC_CAPABLE
if (jit_info->objfile) {
CALL("pmc_new_noinit");
}
else
-# endif
+#endif
{
call_func(jit_info, (void (*) (void))pmc_new_noinit);
}
@@ -1713,7 +1706,8 @@
int j;
for (j = 0; j < reg_info->n_mapped_F; ++j) {
if (reg_info->map_F[j] == MAP(2+i)) {
- jit_emit_fload_mb_n(interp, NATIVECODE, emit_ESP,
(j * sizeof (FLOATVAL)));
+ jit_emit_fload_mb_n(interp, NATIVECODE, emit_ESP,
+ (j * sizeof (FLOATVAL)));
emitm_fstp(NATIVECODE, (1+params_map));
break;
}
@@ -1836,13 +1830,13 @@
jit_emit_mov_ri_i(interp, jit_info->native_ptr, emit_EAX, 1);
if (!jit_info->objfile)
call_func(jit_info, (void (*)(void))cgp_core);
-# if EXEC_CAPABLE
+# if EXEC_CAPABLE
else {
Parrot_exec_add_text_rellocation_func(jit_info->objfile,
jit_info->native_ptr, "cgp_core");
emitm_calll(jit_info->native_ptr, EXEC_CALLDISP);
}
-# endif
+# endif
/* when cur_opcode == 1, cgp_core jumps back here
* when EAX == 0, the official return from HALT was called */
jit_emit_test_r_i(jit_info->native_ptr, emit_EAX);
@@ -1973,11 +1967,11 @@
jit_emit_stack_frame_leave(NATIVECODE);
emitm_ret(NATIVECODE);
/* align the inner sub */
-# if SUB_ALIGN
+#if SUB_ALIGN
while ((long)jit_info->native_ptr & ((1<<SUB_ALIGN) - 1)) {
jit_emit_noop(jit_info->native_ptr);
}
-# endif
+#endif
/* fixup call statement */
L1[1] = NATIVECODE - L1 - 5;
}
@@ -2028,7 +2022,7 @@
jit_emit_finit(jit_info->native_ptr);
}
-# ifdef JIT_CGP
+#ifdef JIT_CGP
/*
* XXX needs some fixing
* s. t/sub/pmc_{8,9}.t: the 2 print in tail call without that 'end'
@@ -2098,7 +2092,7 @@
}
}
-# else /* JIT_CGP */
+#else /* JIT_CGP */
extern int jit_op_count(void);
void
@@ -2122,52 +2116,52 @@
* decide to reuse the argument space though. If you are *absolutely sure*
* this does not happen define PARROT_JIT_STACK_REUSE_INTERP.
*/
-# ifdef PARROT_JIT_STACK_REUSE_INTERP
+# ifdef PARROT_JIT_STACK_REUSE_INTERP
/*
* op functions have the signature (cur_op, interp)
* we use the interpreter already on stack and only push the
* cur_op
*/
-# else
+# else
/* push interpreter */
Parrot_jit_emit_get_INTERP(interp, jit_info->native_ptr, emit_ECX);
emitm_pushl_r(jit_info->native_ptr, emit_ECX);
-# endif
+# endif
emitm_pushl_i(jit_info->native_ptr, CORE_OPS_check_events);
call_func(jit_info,
(void (*) (void)) (interp->op_func_table[CORE_OPS_check_events]));
-# ifdef PARROT_JIT_STACK_REUSE_INTERP
+# ifdef PARROT_JIT_STACK_REUSE_INTERP
emitm_addb_i_r(jit_info->native_ptr, 4, emit_ESP);
-# else
+# else
emitm_addb_i_r(jit_info->native_ptr, 8, emit_ESP);
-# endif
+# endif
}
-# ifdef PARROT_JIT_STACK_REUSE_INTERP
+# ifdef PARROT_JIT_STACK_REUSE_INTERP
/*
* op functions have the signature (cur_op, interp)
* we use the interpreter already on stack and only push the
* cur_op
*/
-# else
+# else
Parrot_jit_emit_get_INTERP(interp, jit_info->native_ptr, emit_ECX);
emitm_pushl_r(jit_info->native_ptr, emit_ECX);
-# endif
+# endif
emitm_pushl_i(jit_info->native_ptr, jit_info->cur_op);
call_func(jit_info,
(void (*) (void))(interp->op_func_table[cur_op]));
-# ifdef PARROT_JIT_STACK_REUSE_INTERP
+# ifdef PARROT_JIT_STACK_REUSE_INTERP
emitm_addb_i_r(jit_info->native_ptr, 4, emit_ESP);
-# else
+# else
emitm_addb_i_r(jit_info->native_ptr, 8, emit_ESP);
-# endif
+# endif
}
-# endif /* JIT_CGP */
+#endif /* JIT_CGP */
void
Parrot_jit_cpcf_op(Parrot_jit_info_t *jit_info,
@@ -2208,7 +2202,7 @@
* the needed register number
* TODO handel overflow params
*/
-
+
int
count_regs(PARROT_INTERP, char *sig, char *sig_start)
{
@@ -2263,7 +2257,7 @@
return stack_size;
}
-
+
/*
* The function generated here is called as func(interp, nci_info)
* interp ... 8(%ebp)
@@ -2273,7 +2267,7 @@
* an optimized compile of src/nci.c:pcf_x_yy(). In case of any troubles
* just compare the disassembly.
*/
-
+
void *
Parrot_jit_build_call_func(PARROT_INTERP, PMC *pmc_nci, STRING *signature)
{
@@ -2391,34 +2385,36 @@
break;
case 'p': /* push pmc->data */
emitm_call_cfunc(pc, get_nci_P);
-# if ! PMC_DATA_IN_EXT
+#if ! PMC_DATA_IN_EXT
/* mov pmc, %edx
* mov 8(%edx), %eax
* push %eax
*/
emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
offsetof(struct PMC, data));
-# else
+#else
/* push pmc->pmc_ext->data
* mov pmc, %edx
* mov pmc_ext(%edx), %eax
* mov data(%eax), %eax
* push %eax
*/
- emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
offsetof(struct PMC, pmc_ext));
- emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
offsetof(struct PMC_EXT, data));
-# endif
+ emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
+ offsetof(struct PMC, pmc_ext));
+ emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
+ offsetof(struct PMC_EXT, data));
+#endif
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1,
args_offset);
break;
case 'O': /* push PMC * object in P2 */
case 'P': /* push PMC * */
case '@':
emitm_call_cfunc(pc, get_nci_P);
-# if PARROT_CATCH_NULL
+#if PARROT_CATCH_NULL
/* PMCNULL is a global */
jit_emit_cmp_rm_i(pc, emit_EAX, &PMCNULL);
emitm_jxs(pc, emitm_jne, 2); /* skip the xor */
jit_emit_bxor_rr_i(interp, pc, emit_EAX, emit_EAX);
-# endif
+#endif
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1,
args_offset);
break;
case 'v':
@@ -2431,12 +2427,14 @@
break;
case 'b': /* buffer (void*) pass PObj_bufstart(SReg) */
emitm_call_cfunc(pc, get_nci_S);
- emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, (size_t)
&PObj_bufstart((STRING *) 0));
+ emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
+ (size_t) &PObj_bufstart((STRING *) 0));
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1,
args_offset);
break;
case 'B': /* buffer (void**) pass &PObj_bufstart(SReg) */
emitm_call_cfunc(pc, get_nci_S);
- emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, (size_t)
&PObj_bufstart((STRING *) 0));
+ emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
+ (size_t) &PObj_bufstart((STRING *) 0));
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1,
args_offset);
break;
case 'S':
@@ -2455,7 +2453,8 @@
/* This might be right. Or not... */
/* we need the offset of PMC_int_val */
emitm_call_cfunc(pc, get_nci_P);
- emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1, (size_t)
&PMC_int_val((PMC *) 0));
+ emitm_lea_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
+ (size_t) &PMC_int_val((PMC *) 0));
emitm_movl_r_m(interp, pc, emit_EAX, emit_EBP, 0, 1,
args_offset);
break;
default:
@@ -2556,15 +2555,15 @@
/* eax = PMC, get return value into edx */
/* stuff return value into pmc->data */
-# if ! PMC_DATA_IN_EXT
+#if ! PMC_DATA_IN_EXT
/* mov %edx, (data) %eax */
emitm_movl_r_m(interp, pc, emit_EDX, emit_EAX, 0, 1,
offsetof(struct PMC, data));
-# else
+#else
/* mov pmc_ext(%eax), %eax
mov %edx, data(%eax) */
emitm_movl_m_r(interp, pc, emit_EAX, emit_EAX, 0, 1,
offsetof(struct PMC, pmc_ext));
emitm_movl_r_m(interp, pc, emit_EDX, emit_EAX, 0, 1,
offsetof(struct PMC_EXT, data));
-# endif
+#endif
/* reset EBP(4) */
emitm_lea_m_r(interp, pc, emit_EAX, emit_EBP, 0, 1, st_offset);
@@ -2683,3 +2682,9 @@
return &arch_info;
}
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: trunk/src/jit/i386/jit_emit.h
==============================================================================
--- trunk/src/jit/i386/jit_emit.h (original)
+++ trunk/src/jit/i386/jit_emit.h Fri Jan 9 06:56:39 2009
@@ -1877,7 +1877,7 @@
int count_regs(PARROT_INTERP, char *sig, char *sig_start);
size_t calc_signature_needs(const char *sig, int *strings);
-
+
void * Parrot_jit_build_call_func(PARROT_INTERP, PMC *pmc_nci,
STRING *signature);
Modified: trunk/src/pmc/packfileconstanttable.pmc
==============================================================================
--- trunk/src/pmc/packfileconstanttable.pmc (original)
+++ trunk/src/pmc/packfileconstanttable.pmc Fri Jan 9 06:56:39 2009
@@ -30,11 +30,11 @@
getconst(PARROT_INTERP, PackFile_ConstTable *table, int index, int type)
{
PackFile_Constant *rv;
- if(index < 0 || index >= table->const_count)
+ if (index < 0 || index >= table->const_count)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
"Requested data out of range.");
rv = table->constants[index];
- if(rv->type != type)
+ if (rv->type != type)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
"Requested constant of the wrong type.");
return rv;
@@ -178,7 +178,7 @@
PackFile_ConstTable *pftable = PMC_data_typed(SELF,
PackFile_ConstTable *);
PackFile_Constant *constant;
INTVAL rv;
- if(index < 0 || index >= pftable->const_count)
+ if (index < 0 || index >= pftable->const_count)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
"Requested data out of range.");
constant = pftable->constants[index];
Modified: trunk/src/pmc/packfilerawsegment.pmc
==============================================================================
--- trunk/src/pmc/packfilerawsegment.pmc (original)
+++ trunk/src/pmc/packfilerawsegment.pmc Fri Jan 9 06:56:39 2009
@@ -55,7 +55,7 @@
*/
VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
PackFile_Segment *pfseg = PMC_data_typed(SELF, PackFile_Segment *);
- if(key < 0 || (UINTVAL)key >= pfseg->size)
+ if (key < 0 || (UINTVAL)key >= pfseg->size)
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_OUT_OF_BOUNDS,
"Requested data out of range.");
return pfseg->data[key];