2001-01-31
2001-01-31 21:50:57 by Martin Stjernholm <mast@lysator.liu.se>
-
90703dba769fdf3f1110c1082ae6b612e0ef98c6
(95 lines)
(+63/-32)
[
Show
| Annotate
]
Branch: 7.9
Added F_SYNCH_MARK, F_CLEANUP_SYNCH_MARK and F_POP_SYNCH_MARK opcodes for
stack debug use. Fixes to the trace logging of jumps. Added
F_CALL_FUNCTION_AND_POP and F_RECUR_AND_POP. Use the OPCODE* macros for
a couple of opcodes.
Rev: src/interpret_functions.h:1.43
1:
/*
- * $Id: interpret_functions.h,v 1.42 2001/01/15 00:21:47 mast Exp $
+ * $Id: interpret_functions.h,v 1.43 2001/01/31 21:50:57 mast Exp $
*
* Opcode definitions for the interpreter.
*/
702:
OPCODE0_TAIL(F_MARK2,"mark mark")
*(Pike_mark_sp++)=Pike_sp;
+
+ /* This opcode is only used when running with -d. Identical to F_MARK,
+ * but with a different name to make the debug printouts more clear. */
+ OPCODE0_TAIL(F_SYNCH_MARK,"synch mark")
+
OPCODE0(F_MARK,"mark")
*(Pike_mark_sp++)=Pike_sp;
BREAK;
718:
pop_n_elems(Pike_sp - *--Pike_mark_sp);
BREAK;
+ /* These opcodes are only used when running with -d. The reason for
+ * the two aliases is mainly to keep the indentation in asm debug
+ * output. */
+ OPCODE0(F_CLEANUP_SYNCH_MARK, "cleanup synch mark")
+ OPCODE0_TAIL(F_POP_SYNCH_MARK, "pop synch mark")
+ if (*--Pike_mark_sp != Pike_sp && d_flag) {
+ ptrdiff_t should = *Pike_mark_sp - Pike_interpreter.evaluator_stack;
+ ptrdiff_t is = Pike_sp - Pike_interpreter.evaluator_stack;
+ if (Pike_sp - *Pike_mark_sp > 0) /* not always same as Pike_sp > *Pike_mark_sp */
+ /* Some attempt to recover, just to be able to report the backtrace. */
+ pop_n_elems(Pike_sp - *Pike_mark_sp);
+ fatal("Stack out of synch - should be %ld, is %ld.\n",
+ (long) should, (long) is);
+ }
+ BREAK;
+
OPCODE0(F_CLEAR_STRING_SUBTYPE, "clear string subtype")
if(Pike_sp[-1].type==PIKE_T_STRING) Pike_sp[-1].subtype=0;
BREAK;
860:
pc = Pike_fp->pc;
break;
default:
- pc+=EXTRACT_INT(pc);
+ pc+=GET_JUMP();
}
break;
963:
assign_lvalue(Pike_sp-4, Pike_sp-1);
free_svalue(Pike_sp-1);
Pike_sp--;
- pc+=EXTRACT_INT(pc);
+ pc+=GET_JUMP();
Pike_sp[-1].u.integer++;
}else{
SKIPJUMP();
1485:
pop_stack();
break;
- CASE(F_CALL_FUNCTION);
+ OPCODE0(F_CALL_FUNCTION, "call function")
mega_apply(APPLY_STACK,
DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),
0,0);
- break;
+ BREAK;
- CASE(F_CALL_FUNCTION_AND_RETURN);
+ OPCODE0(F_CALL_FUNCTION_AND_POP, "call function & pop")
+ mega_apply(APPLY_STACK,
+ DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),
+ 0,0);
+ pop_stack();
+ BREAK;
+
+ OPCODE0(F_CALL_FUNCTION_AND_RETURN, "call function & return")
{
INT32 args = DO_NOT_WARN(Pike_sp - *--Pike_mark_sp);
if(!args)
1512:
}
return args;
}
+ BREAK;
-
+
/* Assume that the number of arguments is correct */
OPCODE1_JUMP(F_COND_RECUR,"recur if not overloaded")
{
1535:
/* Assume that the number of arguments is correct */
OPCODE0_TAILJUMP(F_RECUR,"recur")
+ OPCODE0_TAILJUMP(F_RECUR_AND_POP,"recur & pop")
{
- int x;
+ int x, opcode = instr;
INT32 num_locals, args;
char *addr;
struct light_frame_info info;
1556:
args = DO_NOT_WARN(Pike_sp - Pike_fp->locals);
save_mark_sp = Pike_mark_sp;
- addr=pc+EXTRACT_INT(pc);
+ addr=pc+GET_JUMP();
num_locals=EXTRACT_UCHAR(addr-2);
#ifdef PIKE_DEBUG
1588: Inside #if defined(PIKE_DEBUG)
if(Pike_sp != save_sp+1)
fatal("Stack whack in F_RECUR Pike_sp=%p, expected=%p\n",Pike_sp,save_sp+1);
#endif
+ if (opcode == F_RECUR_AND_POP-F_OFFSET) pop_stack();
}
BREAK
1602:
fast_check_threads_etc(6);
- addr=pc+EXTRACT_INT(pc);
+ addr=pc+GET_JUMP();
num_locals=EXTRACT_UCHAR(addr-2);