2001-05-14
2001-05-14 03:26:21 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
-
105ade9aae7a4328b7a35ad8e419e18e699a7bec
(90 lines)
(+12/-78)
[
Show
| Annotate
]
Branch: 7.9
some fixes for the 'use less stack' stuff, PROFILING and SECURITY is still broken
Rev: src/interpret.c:1.196
Rev: src/interpret_functions.h:1.54
1:
/*
- * $Id: interpret_functions.h,v 1.53 2001/05/11 12:21:10 grubba Exp $
+ * $Id: interpret_functions.h,v 1.54 2001/05/14 03:26:21 hubbe Exp $
*
* Opcode definitions for the interpreter.
*/
1102:
if(Pike_fp -> flags & PIKE_FRAME_RETURN_INTERNAL)
{
int f=Pike_fp->flags;
- gdb_stop_here();
+
low_return();
if(f & PIKE_FRAME_RETURN_POP)
pop_stack();
1504:
BREAK;
OPCODE1(F_CALL_LFUN,"call lfun")
- #if 0
- apply_low(Pike_fp->current_object,
- arg1+Pike_fp->context.identifier_level,
- DO_NOT_WARN(Pike_sp - *--Pike_mark_sp));
- #else
+
if(low_mega_apply(APPLY_LOW,
DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),
Pike_fp->current_object,
(void *)(arg1+Pike_fp->context.identifier_level)))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
pc=Pike_fp->pc;
}
- #endif
+
BREAK;
OPCODE1(F_CALL_LFUN_AND_POP,"call lfun & pop")
- #if 1
+ #if 0
apply_low(Pike_fp->current_object,
arg1+Pike_fp->context.identifier_level,
DO_NOT_WARN(Pike_sp - *--Pike_mark_sp));
1535:
(void *)(arg1+Pike_fp->context.identifier_level)))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;
pc=Pike_fp->pc;
}else{
1550:
&((Pike_fp->context.prog->constants + arg1)->sval),0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
pc=Pike_fp->pc;
}
1562:
&((Pike_fp->context.prog->constants + arg1)->sval),0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;
pc=Pike_fp->pc;
}else{
1576:
&((Pike_fp->context.prog->constants + arg1)->sval),0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
pc=Pike_fp->pc;
}
1589:
&((Pike_fp->context.prog->constants + arg1)->sval),0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;
pc=Pike_fp->pc;
}else{
1604:
0,0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
pc=Pike_fp->pc;
}
1617:
0,0))
{
Pike_fp->next->pc=pc;
- gdb_stop_here();
+
Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;
pc=Pike_fp->pc;
}else{
1652: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
Pike_fp->next->pc=0;
#endif
- gdb_stop_here();
+
pc=Pike_fp->pc;
unlink_previous_frame();
}else{
1670: Inside #if defined(PIKE_DEBUG)
#ifdef PIKE_DEBUG
Pike_fp->next->pc=0;
#endif
- gdb_stop_here();
+
pc=Pike_fp->pc;
unlink_previous_frame();
}else{
1689:
*/
if(Pike_fp->current_object->prog != Pike_fp->context.prog)
{
- apply_low(Pike_fp->current_object,
- arg1+Pike_fp->context.identifier_level,
- DO_NOT_WARN(Pike_sp - *--Pike_mark_sp));
+
pc+=sizeof(INT32);
-
+ if(low_mega_apply(APPLY_LOW,
+ DO_NOT_WARN(Pike_sp - *--Pike_mark_sp),
+ Pike_fp->current_object,
+ (void *)(arg1+Pike_fp->context.identifier_level)))
+ {
+ Pike_fp->next->pc=pc;
+ Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
+ pc=Pike_fp->pc;
+ }
DONE;
}
}
1703:
OPCODE0_TAILJUMP(F_RECUR,"recur")
OPCODE0_TAILJUMP(F_RECUR_AND_POP,"recur & pop")
{
- #if 1
+
int opcode = instr;
unsigned char *addr;
struct pike_frame *new_frame;
1750: Inside #if 1
new_frame->flags=PIKE_FRAME_RETURN_INTERNAL;
if (opcode == F_RECUR_AND_POP-F_OFFSET)
new_frame->flags|=PIKE_FRAME_RETURN_POP;
- #else /* 0 */
- int x, opcode = instr;
- INT32 num_locals, args;
- char *addr;
- struct light_frame_info info;
- struct svalue *save_sp, **save_mark_sp;
- ONERROR uwp;
-
- fast_check_threads_etc(6);
- check_c_stack(8192);
- check_stack(256);
-
- info.saved_fp = Pike_fp;
- info.expendible = Pike_fp->expendible;
- info.locals = Pike_fp->locals;
- info.flags=Pike_fp->flags;
- SET_ONERROR(uwp, restore_light_frame_info, &info);
-
- save_sp = Pike_fp->expendible = Pike_fp->locals = *--Pike_mark_sp;
- args = DO_NOT_WARN(Pike_sp - Pike_fp->locals);
- save_mark_sp = Pike_mark_sp;
-
- addr=pc+GET_JUMP();
- num_locals=EXTRACT_UCHAR(addr-2);
-
- #ifdef PIKE_DEBUG
- if(args != EXTRACT_UCHAR(addr-1))
- fatal("Wrong number of arguments in F_RECUR %d!=%d\n",
- args, EXTRACT_UCHAR(addr-1));
- #endif
- clear_svalues(Pike_sp, num_locals - args);
- Pike_sp += num_locals - args;
-
- x=eval_instruction(addr);
- EVAL_INSTR_RET_CHECK(x);
- #ifdef PIKE_DEBUG
- if(Pike_mark_sp < save_mark_sp)
- fatal("mark Pike_sp underflow in F_RECUR.\n");
- #endif
- Pike_mark_sp=save_mark_sp;
- if(x>=0) mega_apply(APPLY_STACK, x, 0,0);
- pc+=sizeof(INT32);
- if(save_sp+1 < Pike_sp)
- {
- assign_svalue(save_sp,Pike_sp-1);
- pop_n_elems(Pike_sp-save_sp-1);
+
}
- CALL_AND_UNSET_ONERROR(uwp);
- print_return_value();
- #ifdef 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();
- #endif /* 0 */
- }
+
BREAK
/* Assume that the number of arguments is correct */