diff --git a/src/apply_low.h b/src/apply_low.h
index 5fd853c7f2406b43a40c7143f28db2c4a09eb091..a04e587b03410032d03d9ed85866c090b8d8c6db 100644
--- a/src/apply_low.h
+++ b/src/apply_low.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: apply_low.h,v 1.32 2008/01/26 22:34:17 mast Exp $
+|| $Id: apply_low.h,v 1.33 2008/02/27 23:59:11 grubba Exp $
 */
 
     {
@@ -113,9 +113,10 @@
 
       new_frame->next = Pike_fp;
       new_frame->current_object = o;
-      new_frame->context = p->inherits[ ref->inherit_offset ];
+      new_frame->current_program = p;
+      new_frame->context = p->inherits + ref->inherit_offset;
 
-      function = new_frame->context.prog->identifiers + ref->identifier_offset;
+      function = new_frame->context->prog->identifiers + ref->identifier_offset;
       new_frame->fun = DO_NOT_WARN((unsigned INT16)fun);
 
       
@@ -128,16 +129,16 @@
 		  ref->id_flags);
 
 	  fprintf(stderr,"-- context: prog->id=%d inlev=%d idlev=%d pi=%d po=%d so=%ld name=%s\n",
-		  new_frame->context.prog->id,
-		  new_frame->context.inherit_level,
-		  new_frame->context.identifier_level,
-		  new_frame->context.parent_identifier,
-		  new_frame->context.parent_offset,
-		  DO_NOT_WARN((long)new_frame->context.storage_offset),
-		  new_frame->context.name ? new_frame->context.name->str  : "NULL");
+		  new_frame->context->prog->id,
+		  new_frame->context->inherit_level,
+		  new_frame->context->identifier_level,
+		  new_frame->context->parent_identifier,
+		  new_frame->context->parent_offset,
+		  DO_NOT_WARN((long)new_frame->context->storage_offset),
+		  new_frame->context->name ? new_frame->context->name->str  : "NULL");
 	  if(Pike_interpreter.trace_level>19)
 	  {
-	    describe(new_frame->context.prog);
+	    describe(new_frame->context->prog);
 	  }
 	}
 #endif
@@ -160,8 +161,7 @@
       new_frame->save_sp=save_sp;
       
       add_ref(new_frame->current_object);
-      add_ref(new_frame->context.prog);
-      if(new_frame->context.parent) add_ref(new_frame->context.parent);
+      add_ref(new_frame->current_program);
 #ifdef SCOPE
       if(new_frame->scope) add_ref(new_frame->scope);
 #endif
@@ -208,7 +208,7 @@
       case IDENTIFIER_C_FUNCTION:
 	debug_malloc_touch(Pike_fp);
 	Pike_fp->num_args=args;
-	new_frame->current_storage = o->storage+new_frame->context.storage_offset;
+	new_frame->current_storage = o->storage+new_frame->context->storage_offset;
 	new_frame->num_locals=args;
 	check_threads_etc();
 	(*function->func.c_fun)(args);
@@ -216,7 +216,7 @@
 	
       case IDENTIFIER_CONSTANT:
       {
-	struct svalue *s=&(Pike_fp->context.prog->
+	struct svalue *s=&(Pike_fp->context->prog->
 			   constants[function->func.offset].sval);
 	debug_malloc_touch(Pike_fp);
 	if(s->type == T_PROGRAM)
@@ -289,7 +289,7 @@
 #endif
 
 	debug_malloc_touch(Pike_fp);
-	pc=new_frame->context.prog->program + function->func.offset;
+	pc=new_frame->context->prog->program + function->func.offset;
 
 	/*
 	 * FIXME: The following stack stuff could probably
diff --git a/src/builtin.cmod b/src/builtin.cmod
index babc8a0ac4cf131569235842d66c0ab25313f130..3277010a1c1f52cc78135deca7547a3eef9748c4 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: builtin.cmod,v 1.193 2008/01/26 22:34:17 mast Exp $
+|| $Id: builtin.cmod,v 1.194 2008/02/27 23:59:12 grubba Exp $
 */
 
 #include "global.h"
@@ -1608,7 +1608,7 @@ void low_backtrace(struct Pike_interpreter *i)
 
     bf = OBJ2_BACKTRACE_FRAME(o);
 
-    if ((bf->prog = f->context.prog)) {
+    if ((bf->prog = f->context->prog)) {
       add_ref(bf->prog);
       bf->pc = f->pc;
     }
diff --git a/src/interpret.c b/src/interpret.c
index f1006986fbda7e1446260db38984144368111cc4..6746df79ba166f85a9ad0a0094917bf5c3d9c92c 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: interpret.c,v 1.385 2008/01/26 22:34:20 mast Exp $
+|| $Id: interpret.c,v 1.386 2008/02/27 23:59:12 grubba Exp $
 */
 
 #include "global.h"
@@ -142,10 +142,8 @@ void gc_mark_stack_external (struct pike_frame *f,
   for (; f; f = f->next)
     GC_ENTER (f, T_PIKE_FRAME) {
       if (!debug_gc_check (f, " as frame on stack")) {
-	if(f->context.parent)
-	  gc_mark_external (f->context.parent, " in context.parent in frame on stack");
 	gc_mark_external (f->current_object, " in current_object in frame on stack");
-	gc_mark_external (f->context.prog, " in context.prog in frame on stack");
+	gc_mark_external (f->current_program, " in current_program in frame on stack");
 	if (f->locals) {		/* Check really needed? */
 	  if (f->flags & PIKE_FRAME_MALLOCED_LOCALS) {
 	    gc_mark_external_svalues(f->locals, f->num_locals,
@@ -872,7 +870,7 @@ static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)
     struct pike_string *filep;
     INT32 linep;
 
-    filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep);
+    filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);
     if (filep && !filep->size_shift) {
       file = filep->str;
       while((f=STRCHR(file,'/')))
@@ -881,7 +879,7 @@ static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)
     fprintf(stderr,"- %s:%4ld:(%"PRINTPTRDIFFT"d): "
 	    "%-25s %4"PRINTPTRDIFFT"d %4"PRINTPTRDIFFT"d\n",
 	    file ? file : "-",(long)linep,
-	    Pike_fp->pc - Pike_fp->context.prog->program,
+	    Pike_fp->pc - Pike_fp->context->prog->program,
 	    get_opcode_name(instr),
 	    Pike_sp-Pike_interpreter.evaluator_stack,
 	    Pike_mark_sp-Pike_interpreter.mark_stack);
@@ -906,8 +904,8 @@ static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)
     if(backlog[backlogp].program)
       free_program(backlog[backlogp].program);
 
-    backlog[backlogp].program=Pike_fp->context.prog;
-    add_ref(Pike_fp->context.prog);
+    backlog[backlogp].program=Pike_fp->context->prog;
+    add_ref(Pike_fp->context->prog);
     backlog[backlogp].instruction=instr;
     backlog[backlogp].pc = Pike_fp->pc;
     backlog[backlogp].stack = Pike_sp - Pike_interpreter.evaluator_stack;
@@ -970,9 +968,9 @@ static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)
 
       case 2:
 	check_object_context(Pike_fp->current_object,
-			     Pike_fp->context.prog,
+			     Pike_fp->context->prog,
 			     Pike_fp->current_object->storage+
-			     Pike_fp->context.storage_offset);
+			     Pike_fp->context->storage_offset);
       case 1:
       case 0:
 	break;
@@ -1575,7 +1573,7 @@ static void do_trace_call(INT32 args, dynamic_buffer *old_buf)
   if(Pike_fp && Pike_fp->pc)
   {
     char *f;
-    filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep);
+    filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);
     if (filep->size_shift)
       file = "...";
     else {
@@ -1660,7 +1658,7 @@ static void do_trace_return (int got_retval, dynamic_buffer *old_buf)
   if(Pike_fp && Pike_fp->pc)
   {
     char *f;
-    filep = get_line(Pike_fp->pc,Pike_fp->context.prog,&linep);
+    filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);
     if (filep->size_shift)
       file = "...";
     else {
@@ -1708,8 +1706,7 @@ static void do_trace_return (int got_retval, dynamic_buffer *old_buf)
 #undef EXIT_BLOCK
 #define EXIT_BLOCK(X) do {						\
   free_object(X->current_object);					\
-  if(X->context.prog) free_program(X->context.prog);			\
-  if(X->context.parent) free_object(X->context.parent);			\
+  if(X->current_program) free_program(X->current_program);		\
   if(X->scope) free_pike_scope(X->scope);				\
   DO_IF_SECURITY( if(X->current_creds) {				\
     free_object(X->current_creds);					\
@@ -1719,9 +1716,8 @@ static void do_trace_return (int got_retval, dynamic_buffer *old_buf)
   Pike_fatal("Pike frame is not supposed to have malloced locals here!\n"));	\
 									\
   DO_IF_DMALLOC(							\
-    X->context.prog=0;							\
-    X->context.parent=0;						\
-    X->context.name=0;							\
+    X->current_program=0;						\
+    X->context=0;							\
     X->scope=0;								\
     X->current_object=0;						\
     X->flags=0;								\
@@ -2111,7 +2107,7 @@ void unlink_previous_frame(void)
     cpu_time_t child_time =
       Pike_interpreter.accounted_time - current->children_base;
     struct identifier *function =
-      current->context.prog->identifiers + current->ident;
+      current->context->prog->identifiers + current->ident;
     function->total_time += total_time;
     total_time -= child_time;
     function->self_time += total_time;
@@ -2347,8 +2343,9 @@ PMOD_EXPORT int apply_low_safe_and_stupid(struct object *o, INT32 offset)
 
   /* FIXME: Is this up-to-date with mega_apply? */
   new_frame->next = Pike_fp;
-  new_frame->current_object = o;
-  new_frame->context=o->prog->inherits[0];
+  add_ref(new_frame->current_object = o);
+  add_ref(new_frame->current_program = o->prog);
+  new_frame->context = o->prog->inherits;
   new_frame->locals = Pike_sp;
   new_frame->expendible=new_frame->locals;
   new_frame->args = 0;
@@ -2357,7 +2354,6 @@ PMOD_EXPORT int apply_low_safe_and_stupid(struct object *o, INT32 offset)
   new_frame->fun = o->prog->num_identifier_references-1;
   new_frame->pc = 0;
   new_frame->current_storage=o->storage;
-  new_frame->context.parent=0;
 
 #ifdef PIKE_DEBUG      
   if (Pike_fp && (new_frame->locals < Pike_fp->locals)) {
@@ -2368,9 +2364,6 @@ PMOD_EXPORT int apply_low_safe_and_stupid(struct object *o, INT32 offset)
 
   Pike_fp = new_frame;
 
-  add_ref(new_frame->current_object);
-  add_ref(new_frame->context.prog);
-
   saved_jmpbuf = Pike_interpreter.catching_eval_jmpbuf;
   Pike_interpreter.catching_eval_jmpbuf = NULL;
 
@@ -2755,20 +2748,20 @@ void gdb_backtrace (
       char *file = NULL;
       INT32 line;
 
-      if (f->context.prog) {
+      if (f->context) {
 	if (f->pc)
-	  file = low_get_line_plain (f->pc, f->context.prog, &line, 0);
+	  file = low_get_line_plain (f->pc, f->context->prog, &line, 0);
 	else
-	  file = low_get_program_line_plain (f->context.prog, &line, 0);
+	  file = low_get_program_line_plain (f->context->prog, &line, 0);
       }
       if (file)
 	fprintf (stderr, "%s:%d: ", file, line);
       else
 	fputs ("unknown program: ", stderr);
 
-      if (f->current_object && f->current_object->prog) {
+      if (f->current_program) {
 	/* FIXME: Wide string identifiers. */
-	fputs (safe_idname_from_int(f->current_object->prog, f->fun), stderr);
+	fputs (safe_idname_from_int(f->current_program, f->fun), stderr);
 	fputc ('(', stderr);
       }
       else
diff --git a/src/interpret.h b/src/interpret.h
index cc3891fe6264416a651952f25b461d984f503be6..a1dfe5d249bc11291d1fa016b3d3ebb23c56f906 100644
--- a/src/interpret.h
+++ b/src/interpret.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: interpret.h,v 1.170 2007/06/17 01:33:51 mast Exp $
+|| $Id: interpret.h,v 1.171 2008/02/27 23:59:13 grubba Exp $
 */
 
 #ifndef INTERPRET_H
@@ -89,6 +89,9 @@ struct pike_frame
   struct svalue **save_mark_sp;
   struct svalue **mark_sp_base;
   struct object *current_object;
+  struct program *current_program;	/* program containing the context. */
+  struct inherit *context;
+  char *current_storage;
 
   DO_IF_SECURITY(struct object *current_creds;)
 #if defined(PROFILING)
@@ -96,8 +99,6 @@ struct pike_frame
   cpu_time_t start_time;	/** Adjusted time when thr frame started. */
   cpu_time_t self_time_base;	/* ??? */
 #endif
-  struct inherit context;
-  char *current_storage;
 };
 
 #define PIKE_FRAME_RETURN_INTERNAL 1
@@ -606,8 +607,8 @@ PMOD_EXPORT extern const char msg_pop_neg[];
 			       time_in_children);			\
 		  });							\
       Pike_interpreter.accounted_time += self_time;			\
-      /* FIXME: Can context.prog be NULL? */				\
-      function = _fp_->context.prog->identifiers + _fp_->ident;		\
+      /* FIXME: Can context->prog be NULL? */				\
+      function = _fp_->context->prog->identifiers + _fp_->ident;		\
       /* function->total_time =						\
 	 Pike_fp->self_time_base + time_passed; */			\
       function->total_time += time_passed;				\
@@ -796,7 +797,7 @@ static INLINE void strict_apply_svalue(struct svalue *sval, INT32 args)
 
 #define apply_current(FUN, ARGS)			\
   apply_low(Pike_fp->current_object,			\
-	    (FUN) + Pike_fp->context.identifier_level,	\
+	    (FUN) + Pike_fp->context->identifier_level,	\
 	    (ARGS))
 
 PMOD_EXPORT extern int d_flag; /* really in main.c */
diff --git a/src/interpret_functions.h b/src/interpret_functions.h
index e68c0c25eefc35d081535fabaed622127019dcf2..84b8591666c4ecab86a0764bb2a16cf20e4e9744 100644
--- a/src/interpret_functions.h
+++ b/src/interpret_functions.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: interpret_functions.h,v 1.199 2008/01/30 16:52:24 grubba Exp $
+|| $Id: interpret_functions.h,v 1.200 2008/02/27 23:59:14 grubba Exp $
 */
 
 /*
@@ -264,7 +264,7 @@ OPCODE1(F_NEG_NUMBER, "push -int", I_UPDATE_SP, {
 });
 
 OPCODE1(F_CONSTANT, "constant", I_UPDATE_SP, {
-  push_svalue(& Pike_fp->context.prog->constants[arg1].sval);
+  push_svalue(& Pike_fp->context->prog->constants[arg1].sval);
   print_return_value();
 });
 
@@ -285,7 +285,7 @@ OPCODE1_TAIL(F_MARK_AND_STRING, "mark & string", I_UPDATE_SP|I_UPDATE_M_SP, {
   *(Pike_mark_sp++)=Pike_sp;
 
   OPCODE1(F_STRING, "string", I_UPDATE_SP, {
-    copy_shared_string(Pike_sp->u.string,Pike_fp->context.prog->strings[arg1]);
+    copy_shared_string(Pike_sp->u.string,Pike_fp->context->prog->strings[arg1]);
     Pike_sp->type=PIKE_T_STRING;
     Pike_sp->subtype=0;
     Pike_sp++;
@@ -295,7 +295,7 @@ OPCODE1_TAIL(F_MARK_AND_STRING, "mark & string", I_UPDATE_SP|I_UPDATE_M_SP, {
 
 
 OPCODE1(F_ARROW_STRING, "->string", I_UPDATE_SP, {
-  copy_shared_string(Pike_sp->u.string,Pike_fp->context.prog->strings[arg1]);
+  copy_shared_string(Pike_sp->u.string,Pike_fp->context->prog->strings[arg1]);
   Pike_sp->type=PIKE_T_STRING;
   Pike_sp->subtype=1; /* Magic */
   Pike_sp++;
@@ -337,7 +337,7 @@ OPCODE1(F_LOOKUP_LFUN, "->lfun", 0, {
 
 OPCODE1(F_LFUN, "local function", I_UPDATE_SP, {
   ref_push_function (Pike_fp->current_object,
-		     arg1+Pike_fp->context.identifier_level);
+		     arg1+Pike_fp->context->identifier_level);
   print_return_value();
 });
 
@@ -357,7 +357,7 @@ OPCODE2(F_TRAMPOLINE, "trampoline", I_UPDATE_SP, {
     f=f->scope;
   }
   add_ref( ((struct pike_trampoline *)(o->storage))->frame=f );
-  ((struct pike_trampoline *)(o->storage))->func=arg1+Pike_fp->context.identifier_level;
+  ((struct pike_trampoline *)(o->storage))->func=arg1+Pike_fp->context->identifier_level;
   push_function(o, pike_trampoline_program->lfuns[LFUN_CALL]);
   print_return_value();
 });
@@ -452,7 +452,7 @@ OPCODE2(F_LOCAL_2_LOCAL, "local = local", 0, {
 
 OPCODE2(F_LOCAL_2_GLOBAL, "global = local", 0, {
   object_low_set_index(Pike_fp->current_object,
-		       arg1 + Pike_fp->context.identifier_level,
+		       arg1 + Pike_fp->context->identifier_level,
 		       Pike_fp->locals + arg2);
 });
 
@@ -857,7 +857,7 @@ OPCODE0(F_ADD_TO_AND_POP, "+= and pop", I_UPDATE_SP, {
 
 OPCODE1(F_GLOBAL_LVALUE, "& global", I_UPDATE_SP, {
   ref_push_object(Pike_fp->current_object);
-  push_obj_index(arg1 + Pike_fp->context.identifier_level);
+  push_obj_index(arg1 + Pike_fp->context->identifier_level);
 });
 
 OPCODE0(F_INC, "++x", I_UPDATE_SP, {
@@ -997,7 +997,7 @@ OPCODE0(F_ASSIGN, "assign", I_UPDATE_SP, {
 });
 
 OPCODE2(F_APPLY_ASSIGN_LOCAL_AND_POP, "apply, assign local and pop", I_UPDATE_SP|I_UPDATE_M_SP, {
-  apply_svalue(&((Pike_fp->context.prog->constants + arg1)->sval),
+  apply_svalue(&((Pike_fp->context->prog->constants + arg1)->sval),
 	       DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));
   free_svalue(Pike_fp->locals+arg2);
   move_svalue (Pike_fp->locals + arg2, Pike_sp - 1);
@@ -1005,7 +1005,7 @@ OPCODE2(F_APPLY_ASSIGN_LOCAL_AND_POP, "apply, assign local and pop", I_UPDATE_SP
 });
 
 OPCODE2(F_APPLY_ASSIGN_LOCAL, "apply, assign local", I_UPDATE_ALL, {
-  apply_svalue(&((Pike_fp->context.prog->constants + arg1)->sval),
+  apply_svalue(&((Pike_fp->context->prog->constants + arg1)->sval),
 	       DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)));
   assign_svalue(Pike_fp->locals+arg2, Pike_sp-1);
 });
@@ -1023,13 +1023,13 @@ OPCODE1(F_ASSIGN_LOCAL_AND_POP, "assign local and pop", I_UPDATE_SP, {
 
 OPCODE1(F_ASSIGN_GLOBAL, "assign global", 0, {
   object_low_set_index(Pike_fp->current_object,
-		       arg1 + Pike_fp->context.identifier_level,
+		       arg1 + Pike_fp->context->identifier_level,
 		       Pike_sp-1);
 });
 
 OPCODE1(F_ASSIGN_GLOBAL_AND_POP, "assign global and pop", I_UPDATE_SP, {
   object_low_set_index(Pike_fp->current_object,
-		       arg1 + Pike_fp->context.identifier_level,
+		       arg1 + Pike_fp->context->identifier_level,
 		       Pike_sp-1);
   pop_stack();
 });
@@ -1104,7 +1104,7 @@ OPCODE0_BRANCH(F_BRANCH, "branch", 0, {
 OPCODE2_BRANCH(F_BRANCH_IF_NOT_LOCAL_ARROW, "branch if !local->x", 0, {
   LOCAL_VAR(struct svalue tmp);
   tmp.type=PIKE_T_STRING;
-  tmp.u.string=Pike_fp->context.prog->strings[arg1];
+  tmp.u.string=Pike_fp->context->prog->strings[arg1];
   tmp.subtype=1;
   mark_free_svalue (Pike_sp);
   Pike_sp++;
@@ -1413,7 +1413,7 @@ OPCODE1_JUMP(F_SWITCH, "switch", I_UPDATE_ALL, {
   INT32 tmp;
   PIKE_OPCODE_T *addr;
   JUMP_SET_TO_PC_AT_NEXT (addr);
-  tmp=switch_lookup(Pike_fp->context.prog->
+  tmp=switch_lookup(Pike_fp->context->prog->
 		    constants[arg1].sval.u.array,Pike_sp-1);
   addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *)
 				  DO_ALIGN(PTR_TO_INT(addr),
@@ -1432,7 +1432,7 @@ OPCODE1_JUMP(F_SWITCH_ON_INDEX, "switch on index", I_UPDATE_ALL, {
   index_no_free(&tmp2, Pike_sp-2, Pike_sp-1);
   move_svalue (Pike_sp++, &tmp2);
 
-  tmp=switch_lookup(Pike_fp->context.prog->
+  tmp=switch_lookup(Pike_fp->context->prog->
 		    constants[arg1].sval.u.array,Pike_sp-1);
   pop_n_elems(3);
   addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *)
@@ -1447,7 +1447,7 @@ OPCODE2_JUMP(F_SWITCH_ON_LOCAL, "switch on local", 0, {
   INT32 tmp;
   PIKE_OPCODE_T *addr;
   JUMP_SET_TO_PC_AT_NEXT (addr);
-  tmp=switch_lookup(Pike_fp->context.prog->
+  tmp=switch_lookup(Pike_fp->context->prog->
 		    constants[arg2].sval.u.array,Pike_fp->locals + arg1);
   addr = DO_IF_ELSE_COMPUTED_GOTO(addr, (PIKE_OPCODE_T *)
 				  DO_ALIGN(PTR_TO_INT(addr),
@@ -1831,7 +1831,7 @@ OPCODE2(F_GLOBAL_LOCAL_INDEX, "global[local]", I_UPDATE_SP, {
 OPCODE2(F_LOCAL_ARROW, "local->x", I_UPDATE_SP, {
   LOCAL_VAR(struct svalue tmp);
   tmp.type=PIKE_T_STRING;
-  tmp.u.string=Pike_fp->context.prog->strings[arg1];
+  tmp.u.string=Pike_fp->context->prog->strings[arg1];
   tmp.subtype=1;
   mark_free_svalue (Pike_sp++);
   index_no_free(Pike_sp-1,Pike_fp->locals+arg2, &tmp);
@@ -1842,7 +1842,7 @@ OPCODE1(F_ARROW, "->x", 0, {
   LOCAL_VAR(struct svalue tmp);
   LOCAL_VAR(struct svalue tmp2);
   tmp.type=PIKE_T_STRING;
-  tmp.u.string=Pike_fp->context.prog->strings[arg1];
+  tmp.u.string=Pike_fp->context->prog->strings[arg1];
   tmp.subtype=1;
   index_no_free(&tmp2, Pike_sp-1, &tmp);
   free_svalue(Pike_sp-1);
@@ -1854,7 +1854,7 @@ OPCODE1(F_STRING_INDEX, "string index", 0, {
   LOCAL_VAR(struct svalue tmp);
   LOCAL_VAR(struct svalue tmp2);
   tmp.type=PIKE_T_STRING;
-  tmp.u.string=Pike_fp->context.prog->strings[arg1];
+  tmp.u.string=Pike_fp->context->prog->strings[arg1];
   tmp.subtype=0;
   index_no_free(&tmp2, Pike_sp-1, &tmp);
   free_svalue(Pike_sp-1);
@@ -2059,10 +2059,10 @@ PIKE_CONCAT(OP,_RETURN)(PIKE_CONCAT3(F_MARK_,OPCODE,_AND_RETURN),	   \
 
 MKAPPLY2(OPCODE1,CALL_LFUN,"call lfun",APPLY_LOW,
 	 Pike_fp->current_object,
-	 (void *)(ptrdiff_t)(arg1+Pike_fp->context.identifier_level));
+	 (void *)(ptrdiff_t)(arg1+Pike_fp->context->identifier_level));
 
 MKAPPLY2(OPCODE1,APPLY,"apply",APPLY_SVALUE_STRICT,
-	 &((Pike_fp->context.prog->constants + arg1)->sval),0);
+	 &((Pike_fp->context->prog->constants + arg1)->sval),0);
 
 MKAPPLY(OPCODE0,CALL_FUNCTION,"call function",APPLY_STACK, 0,0);
 
@@ -2082,7 +2082,7 @@ OPCODE1_JUMP(F_CALL_OTHER,"call other", I_UPDATE_ALL, {
       if(FIND_LFUN(p, LFUN_ARROW) == -1)
       {
 	int fun;
-	fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],
+	fun=find_shared_string_identifier(Pike_fp->context->prog->strings[arg1],
 					  p);
 	if(fun >= 0)
 	{
@@ -2105,7 +2105,7 @@ OPCODE1_JUMP(F_CALL_OTHER,"call other", I_UPDATE_ALL, {
     LOCAL_VAR(struct svalue tmp2);
 
     tmp.type=PIKE_T_STRING;
-    tmp.u.string=Pike_fp->context.prog->strings[arg1];
+    tmp.u.string=Pike_fp->context->prog->strings[arg1];
     tmp.subtype=1;
 
     index_no_free(&tmp2, s, &tmp);
@@ -2140,7 +2140,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_POP,"call other & pop", I_UPDATE_ALL, {
       if(FIND_LFUN(p, LFUN_ARROW) == -1)
       {
 	int fun;
-	fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],
+	fun=find_shared_string_identifier(Pike_fp->context->prog->strings[arg1],
 					  p);
 	if(fun >= 0)
 	{
@@ -2165,7 +2165,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_POP,"call other & pop", I_UPDATE_ALL, {
     LOCAL_VAR(struct svalue tmp2);
 
     tmp.type=PIKE_T_STRING;
-    tmp.u.string=Pike_fp->context.prog->strings[arg1];
+    tmp.u.string=Pike_fp->context->prog->strings[arg1];
     tmp.subtype=1;
 
     index_no_free(&tmp2, s, &tmp);
@@ -2200,7 +2200,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_ALL, {
       if(FIND_LFUN(p, LFUN_ARROW) == -1)
       {
 	int fun;
-	fun=find_shared_string_identifier(Pike_fp->context.prog->strings[arg1],
+	fun=find_shared_string_identifier(Pike_fp->context->prog->strings[arg1],
 					  p);
 	if(fun >= 0)
 	{
@@ -2225,7 +2225,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_ALL, {
     LOCAL_VAR(struct svalue tmp2);
 
     tmp.type=PIKE_T_STRING;
-    tmp.u.string=Pike_fp->context.prog->strings[arg1];
+    tmp.u.string=Pike_fp->context->prog->strings[arg1];
     tmp.subtype=1;
 
     index_no_free(&tmp2, s, &tmp);
@@ -2250,7 +2250,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_ALL, {
   int args_=(ARGS);							 \
   struct svalue *expected_stack=Pike_sp-args_;				 \
   LOCAL_VAR(struct svalue *s);						 \
-  s = &Pike_fp->context.prog->constants[arg1].sval;			 \
+  s = &Pike_fp->context->prog->constants[arg1].sval;			 \
   if(Pike_interpreter.trace_level)					 \
   {									 \
     LOCAL_VAR(dynamic_buffer save_buf);					 \
@@ -2293,7 +2293,7 @@ OPCODE1_JUMP(F_CALL_OTHER_AND_RETURN,"call other & return", I_UPDATE_ALL, {
 }while(0)
 #else
 #define DO_CALL_BUILTIN(ARGS) \
-(*(Pike_fp->context.prog->constants[arg1].sval.u.efun->function))(ARGS)
+(*(Pike_fp->context->prog->constants[arg1].sval.u.efun->function))(ARGS)
 #endif
 
 OPCODE1(F_CALL_BUILTIN, "call builtin", I_UPDATE_ALL, {
@@ -2474,18 +2474,16 @@ OPCODE1(F_LTOSVAL_CALL_BUILTIN_AND_ASSIGN_POP,
   DO_IF_PROFILING( new_frame->ident=Pike_fp->ident );			   \
   new_frame->current_storage=Pike_fp->current_storage;                     \
   if(Pike_fp->scope) add_ref(new_frame->scope=Pike_fp->scope);		   \
-  add_ref(new_frame->current_object=Pike_fp->current_object);		   \
-  new_frame->context=Pike_fp->context;                                     \
-  add_ref(new_frame->context.prog);					   \
-  if(new_frame->context.parent)						   \
-    add_ref(new_frame->context.parent);					   \
+  add_ref(new_frame->current_object = Pike_fp->current_object);		   \
+  add_ref(new_frame->current_program = Pike_fp->current_program);	   \
+  new_frame->context = Pike_fp->context;				   \
 									   \
   DO_IF_PROFILING({							   \
       new_frame->start_time =						   \
 	get_cpu_time() - Pike_interpreter.unlocked_time;		   \
       new_frame->ident = Pike_fp->ident;				   \
       new_frame->children_base = Pike_interpreter.accounted_time;	   \
-      new_frame->context.prog->identifiers[new_frame->ident].num_calls++;  \
+      new_frame->context->prog->identifiers[new_frame->ident].num_calls++;  \
       DO_IF_PROFILING_DEBUG({						   \
 	  fprintf(stderr, "%p{: Push at %" PRINT_CPU_TIME		   \
 		  " %" PRINT_CPU_TIME "\n",				   \
@@ -2509,14 +2507,14 @@ OPCODE1(F_LTOSVAL_CALL_BUILTIN_AND_ASSIGN_POP,
 OPCODE1_PTRJUMP(F_COND_RECUR, "recur if not overloaded", I_UPDATE_ALL, {
   PIKE_OPCODE_T *addr;
   LOCAL_VAR(struct program *p);
-  p = Pike_fp->current_object->prog;
+  p = Pike_fp->current_program;
   JUMP_SET_TO_PC_AT_NEXT (addr);
   Pike_fp->return_addr = (PIKE_OPCODE_T *)(((INT32 *)addr) + 1);
 
   /* Test if the function is overloaded.
    *
    * Note: The second part of the test is sufficient, but
-   *       the since first case is much simpler to test and
+   *       since the first case is much simpler to test and
    *       is common, it should offer a speed improvement.
    *
    *	/grubba 2002-11-14
@@ -2526,11 +2524,11 @@ OPCODE1_PTRJUMP(F_COND_RECUR, "recur if not overloaded", I_UPDATE_ALL, {
    *
    *	/grubba 2003-03-25
    */
-  if(((p != Pike_fp->context.prog) &&
-      (p->inherits[p->identifier_references[Pike_fp->context.identifier_level +
-					   arg1].inherit_offset].prog !=
-       Pike_fp->context.prog)) ||
-     (ID_FROM_INT(p, arg1+Pike_fp->context.identifier_level)->
+  if(((p != Pike_fp->context->prog) &&
+      (Pike_fp->context !=
+       &p->inherits[p->identifier_references[Pike_fp->context->identifier_level +
+					     arg1].inherit_offset])) ||
+     (ID_FROM_INT(p, arg1+Pike_fp->context->identifier_level)->
       identifier_flags & IDENTIFIER_SCOPE_USED))
   {
     PIKE_OPCODE_T *faddr;
@@ -2546,7 +2544,7 @@ OPCODE1_PTRJUMP(F_COND_RECUR, "recur if not overloaded", I_UPDATE_ALL, {
 		      args,
 		      Pike_fp->current_object,
 		      (void *)(ptrdiff_t)(arg1+
-					  Pike_fp->context.identifier_level)))
+					  Pike_fp->context->identifier_level)))
     {
       Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
       addr = Pike_fp->pc;
diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c
index 6293a338539046934c306683478d84ebab7e8a3b..d3131944d9d78b3637d62c8874e7dc9b2e61a91b 100644
--- a/src/modules/Gmp/mpz_glue.c
+++ b/src/modules/Gmp/mpz_glue.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: mpz_glue.c,v 1.170 2008/01/26 22:34:25 mast Exp $
+|| $Id: mpz_glue.c,v 1.171 2008/02/27 23:59:24 grubba Exp $
 */
 
 #include "global.h"
@@ -57,7 +57,7 @@ long random(void)
 
 #undef THIS
 #define THIS ((MP_INT *)(fp->current_storage))
-#define THIS_PROGRAM (fp->context.prog)
+#define THIS_PROGRAM (fp->context->prog)
 
 struct program *mpzmod_program = NULL;
 #ifdef AUTO_BIGNUM
diff --git a/src/object.c b/src/object.c
index 895fb9ab8fd68e3e49a91b19c4bb700bddb77af9..6c1fa8e8fcb8c0473c9d22f24edf8324b24230dc 100644
--- a/src/object.c
+++ b/src/object.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: object.c,v 1.281 2008/01/26 22:34:22 mast Exp $
+|| $Id: object.c,v 1.282 2008/02/27 23:59:15 grubba Exp $
 */
 
 #include "global.h"
@@ -158,59 +158,46 @@ PMOD_EXPORT struct object *low_clone(struct program *p)
   return o;
 }
 
-#define LOW_PUSH_FRAME(O)	do{		\
-  struct pike_frame *pike_frame=alloc_pike_frame();		\
+#define LOW_PUSH_FRAME2(O, P)			\
+  pike_frame=alloc_pike_frame();		\
   pike_frame->next=Pike_fp;			\
   pike_frame->current_object=O;			\
+  pike_frame->current_program=P;		\
   pike_frame->locals=0;				\
-  pike_frame->num_locals=0;				\
+  pike_frame->num_locals=0;			\
   pike_frame->fun=-1;				\
-  pike_frame->pc=0;					\
-  pike_frame->context.prog=0;                        \
-  pike_frame->context.parent=0;                        \
-  Pike_fp= pike_frame
+  pike_frame->pc=0;				\
+  pike_frame->context=NULL;                     \
+  Pike_fp = pike_frame
 
+#define LOW_PUSH_FRAME(O, P)	do{		\
+    struct pike_frame *pike_frame;		\
+    LOW_PUSH_FRAME2(O, P)
 
-#define LOW_PUSH_FRAME2(O)                      \
-  pike_frame=alloc_pike_frame();		\
-  pike_frame->next=Pike_fp;			\
-  pike_frame->current_object=O;			\
-  pike_frame->locals=0;				\
-  pike_frame->num_locals=0;				\
-  pike_frame->fun=-1;				\
-  pike_frame->pc=0;					\
-  pike_frame->context.prog=0;                        \
-  pike_frame->context.parent=0;                        \
-  Pike_fp= pike_frame
 
-#define PUSH_FRAME(O) \
-  LOW_PUSH_FRAME(O); \
-  add_ref(pike_frame->current_object)
+#define PUSH_FRAME(O, P)			\
+  LOW_PUSH_FRAME(O, P);				\
+  add_ref(pike_frame->current_object);		\
+  add_ref(pike_frame->current_program)
 
-#define PUSH_FRAME2(O) \
-  do{LOW_PUSH_FRAME2(O); add_ref(pike_frame->current_object);}while(0)
+#define PUSH_FRAME2(O, P) do{			\
+    LOW_PUSH_FRAME2(O, P);			\
+    add_ref(pike_frame->current_object);	\
+    add_ref(pike_frame->current_program);	\
+  }while(0)
 
 /* Note: there could be a problem with programs without functions */
-#define SET_FRAME_CONTEXT(X)						     \
-  if(pike_frame->context.prog) free_program(pike_frame->context.prog);	     \
-  pike_frame->context=(X);						     \
-  pike_frame->fun=pike_frame->context.identifier_level;                      \
-  add_ref(pike_frame->context.prog);					     \
-  pike_frame->current_storage=o->storage+pike_frame->context.storage_offset; \
-  pike_frame->context.parent=0;
-  
-
 #define LOW_SET_FRAME_CONTEXT(X)					     \
   pike_frame->context=(X);						     \
-  pike_frame->fun=pike_frame->context.identifier_level;			     \
-  pike_frame->current_storage=o->storage+pike_frame->context.storage_offset; \
-  pike_frame->context.parent=0;
+  pike_frame->fun=pike_frame->context->identifier_level;		\
+  pike_frame->current_storage=o->storage+pike_frame->context->storage_offset
 
+#define SET_FRAME_CONTEXT(X)						\
+  LOW_SET_FRAME_CONTEXT(X)
+  
 #define LOW_UNSET_FRAME_CONTEXT()		\
-  pike_frame->context.parent=0;			\
-  pike_frame->context.prog=0;			\
-  pike_frame->current_storage=0;		\
-  pike_frame->context.parent=0;
+  pike_frame->context = NULL;			\
+  pike_frame->current_storage = NULL
   
 
 #ifdef DEBUG
@@ -236,6 +223,7 @@ PMOD_EXPORT struct object *low_clone(struct program *p)
 
 #define LOW_POP_FRAME()				\
   add_ref(Pike_fp->current_object); \
+  add_ref(Pike_fp->current_program); \
   POP_FRAME();
 
 
@@ -287,10 +275,10 @@ PMOD_EXPORT void call_c_initializers(struct object *o)
     {
       if( !frame_pushed )
       {
-	PUSH_FRAME2(o);
+	PUSH_FRAME2(o, p);
 	frame_pushed = 1;
       }
-      SET_FRAME_CONTEXT(p->inherits[e]);
+      SET_FRAME_CONTEXT(p->inherits + e);
       prog->event_handler(PROG_EVENT_INIT);
     }
   }
@@ -314,10 +302,10 @@ void call_prog_event(struct object *o, int event)
     {
       if( !frame_pushed )
       {
-	PUSH_FRAME2(o);
+	PUSH_FRAME2(o, p);
 	frame_pushed = 1;
       }
-      SET_FRAME_CONTEXT(p->inherits[e]);
+      SET_FRAME_CONTEXT(p->inherits + e);
       prog->event_handler(event);
     }
   }
@@ -855,10 +843,10 @@ PMOD_EXPORT void destruct_object (struct object *o, enum object_destruct_reason
     {
       if( !frame_pushed )
       {
-	PUSH_FRAME2(o);
+	PUSH_FRAME2(o, p);
 	frame_pushed = 1;
       }
-      SET_FRAME_CONTEXT(p->inherits[e]);
+      SET_FRAME_CONTEXT(p->inherits + e);
       prog->event_handler(PROG_EVENT_EXIT);
     }
 
@@ -1861,18 +1849,18 @@ PMOD_EXPORT void gc_mark_object_as_referenced(struct object *o)
 	  if(PARENT_INFO(o)->parent)
 	    gc_mark_object_as_referenced(PARENT_INFO(o)->parent);
 
-	LOW_PUSH_FRAME(o);
+	LOW_PUSH_FRAME(o, p);
 
 	for(e=p->num_inherits-1; e>=0; e--)
 	{
 	  int q;
       
-	  LOW_SET_FRAME_CONTEXT(p->inherits[e]);
+	  LOW_SET_FRAME_CONTEXT(p->inherits + e);
 
-	  for(q=0;q<(int)pike_frame->context.prog->num_variable_index;q++)
+	  for(q=0;q<(int)pike_frame->context->prog->num_variable_index;q++)
 	  {
-	    int d=pike_frame->context.prog->variable_index[q];
-	    struct identifier *id = pike_frame->context.prog->identifiers + d;
+	    int d=pike_frame->context->prog->variable_index[q];
+	    struct identifier *id = pike_frame->context->prog->identifiers + d;
 	    int id_flags = id->identifier_flags;
 	    int rtt = id->run_time_type;
 
@@ -1899,8 +1887,8 @@ PMOD_EXPORT void gc_mark_object_as_referenced(struct object *o)
 	    }
 	  }
 
-	  if(pike_frame->context.prog->event_handler)
-	    pike_frame->context.prog->event_handler(PROG_EVENT_GC_RECURSE);
+	  if(pike_frame->context->prog->event_handler)
+	    pike_frame->context->prog->event_handler(PROG_EVENT_GC_RECURSE);
 
 	  LOW_UNSET_FRAME_CONTEXT();
 	}
@@ -1926,18 +1914,18 @@ PMOD_EXPORT void real_gc_cycle_check_object(struct object *o, int weak)
       if (!o2) Pike_fatal("Object not on gc_internal_object list.\n");
 #endif
 
-      LOW_PUSH_FRAME(o);
+      LOW_PUSH_FRAME(o, p);
 
       for(e=p->num_inherits-1; e>=0; e--)
       {
 	int q;
       
-	LOW_SET_FRAME_CONTEXT(p->inherits[e]);
+	LOW_SET_FRAME_CONTEXT(p->inherits + e);
 
-	for(q=0;q<(int)pike_frame->context.prog->num_variable_index;q++)
+	for(q=0;q<(int)pike_frame->context->prog->num_variable_index;q++)
 	{
-	  int d=pike_frame->context.prog->variable_index[q];
-	  struct identifier *id = pike_frame->context.prog->identifiers + d;
+	  int d=pike_frame->context->prog->variable_index[q];
+	  struct identifier *id = pike_frame->context->prog->identifiers + d;
 	  int id_flags = id->identifier_flags;
 	  int rtt = id->run_time_type;
 	
@@ -1964,8 +1952,8 @@ PMOD_EXPORT void real_gc_cycle_check_object(struct object *o, int weak)
 	  }
 	}
 
-	if(pike_frame->context.prog->event_handler)
-	  pike_frame->context.prog->event_handler(PROG_EVENT_GC_RECURSE);
+	if(pike_frame->context->prog->event_handler)
+	  pike_frame->context->prog->event_handler(PROG_EVENT_GC_RECURSE);
 
 	LOW_UNSET_FRAME_CONTEXT();
       }
@@ -2000,17 +1988,17 @@ static INLINE void gc_check_object(struct object *o)
       if(p->flags & PROGRAM_USES_PARENT && PARENT_INFO(o)->parent)
 	debug_gc_check (PARENT_INFO(o)->parent, " as parent of an object");
 
-      LOW_PUSH_FRAME(o);
+      LOW_PUSH_FRAME(o, p);
     
       for(e=p->num_inherits-1; e>=0; e--)
       {
 	int q;
-	LOW_SET_FRAME_CONTEXT(p->inherits[e]);
+	LOW_SET_FRAME_CONTEXT(p->inherits + e);
 
-	for(q=0;q<(int)pike_frame->context.prog->num_variable_index;q++)
+	for(q=0;q<(int)pike_frame->context->prog->num_variable_index;q++)
 	{
-	  int d=pike_frame->context.prog->variable_index[q];
-	  struct identifier *id = pike_frame->context.prog->identifiers + d;
+	  int d=pike_frame->context->prog->variable_index[q];
+	  struct identifier *id = pike_frame->context->prog->identifiers + d;
 	  int id_flags = id->identifier_flags;
 	  int rtt = id->run_time_type;
 	
@@ -2037,8 +2025,8 @@ static INLINE void gc_check_object(struct object *o)
 	  }
 	}
       
-	if(pike_frame->context.prog->event_handler)
-	  pike_frame->context.prog->event_handler(PROG_EVENT_GC_CHECK);
+	if(pike_frame->context->prog->event_handler)
+	  pike_frame->context->prog->event_handler(PROG_EVENT_GC_CHECK);
 
 	LOW_UNSET_FRAME_CONTEXT();
       }
diff --git a/src/object.h b/src/object.h
index 503a3c8f944b4cf0bb71a6cb57bb730cb36af86a..0484e22b9a0ba26432c0abce4061f16ed16eeb56 100644
--- a/src/object.h
+++ b/src/object.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: object.h,v 1.92 2006/07/05 02:17:09 mast Exp $
+|| $Id: object.h,v 1.93 2008/02/27 23:59:16 grubba Exp $
 */
 
 #ifndef OBJECT_H
@@ -163,7 +163,7 @@ void check_all_objects(void);
 
 #define low_index_current_object_no_free(TO, FUN)			\
   low_object_index_no_free((TO), Pike_fp->current_object,		\
-			   Pike_fp->context.identifier_level + (FUN))
+			   Pike_fp->context->identifier_level + (FUN))
 
 
 #endif /* OBJECT_H */
diff --git a/src/opcodes.c b/src/opcodes.c
index 5a14f166529f402e658e9432099fad2404436427..9932cc9cdadde2e8d21913729d1ef1e7b28b3593 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: opcodes.c,v 1.169 2008/01/28 18:06:16 grubba Exp $
+|| $Id: opcodes.c,v 1.170 2008/02/27 23:59:16 grubba Exp $
 */
 
 #include "global.h"
@@ -322,8 +322,8 @@ const char *low_get_f_name(int n, struct program *p)
 
 const char *get_f_name(int n)
 {
-  if (Pike_fp && Pike_fp->context.prog)
-    return low_get_f_name(n, Pike_fp->context.prog);
+  if (Pike_fp && Pike_fp->context)
+    return low_get_f_name(n, Pike_fp->context->prog);
   return low_get_f_name(n, NULL);
 }
 
diff --git a/src/operators.c b/src/operators.c
index 11a3fc7124d11fb4bf5328c01b6af1f4371017d0..6ac655d375906ee66a125586bacac6ec2059f2c2 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: operators.c,v 1.226 2008/01/26 22:34:22 mast Exp $
+|| $Id: operators.c,v 1.227 2008/02/27 23:59:18 grubba Exp $
 */
 
 #include "global.h"
@@ -615,7 +615,7 @@ PMOD_EXPORT void o_cast(struct pike_type *type, INT32 run_time_type)
 	    struct pike_string *file;
 	    INT32 lineno;
 	    if(Pike_fp->pc &&
-	       (file = low_get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno))) {
+	       (file = low_get_line(Pike_fp->pc, Pike_fp->context->prog, &lineno))) {
 	      push_string(file);
 	    }else{
 	      push_int(0);
@@ -652,7 +652,7 @@ PMOD_EXPORT void o_cast(struct pike_type *type, INT32 run_time_type)
 	  struct pike_string *file;
 	  INT32 lineno;
 	  if(Pike_fp->pc &&
-	     (file = low_get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno))) {
+	     (file = low_get_line(Pike_fp->pc, Pike_fp->context->prog, &lineno))) {
 	    push_string(file);
 	  }else{
 	    push_int(0);
@@ -1031,11 +1031,10 @@ void o_check_soft_cast(struct svalue *s, struct pike_type *type)
     ONERROR tmp1;
     ONERROR tmp2;
 
-    if (Pike_fp->current_object && Pike_fp->context.prog &&
-	Pike_fp->current_object->prog) {
+    if (Pike_fp->current_program) {
       /* Look up the function-name */
       struct pike_string *name =
-	ID_FROM_INT(Pike_fp->current_object->prog, Pike_fp->fun)->name;
+	ID_FROM_INT(Pike_fp->current_program, Pike_fp->fun)->name;
       if ((!name->size_shift) && (name->len < 100))
 	fname = name->str;
     }
diff --git a/src/program.c b/src/program.c
index b7ce3a7d52174eba63672979f426ca65518d2f24..b760204d2fc6402ca647fba3225cd1c84cb0534d 100644
--- a/src/program.c
+++ b/src/program.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: program.c,v 1.652 2008/02/19 15:35:25 grubba Exp $
+|| $Id: program.c,v 1.653 2008/02/27 23:59:23 grubba Exp $
 */
 
 #include "global.h"
@@ -1786,6 +1786,7 @@ struct program *id_to_program_cache[ID_TO_PROGRAM_CACHE_SIZE];
 
 struct program *id_to_program(INT32 id)
 {
+  struct program_state *state;
   struct program *p;
   INT32 h;
   if(!id) return 0;
@@ -1810,6 +1811,13 @@ struct program *id_to_program(INT32 id)
     }
   }
 
+  /* Check if it is a program being compiled right now. */
+  for (state = Pike_compiler; state; state = state->previous) {
+    if (state->new_program && state->new_program->id == id) {
+      return state->new_program;
+    }
+  }
+
   if ((id > 0) && (id < PROG_DYNAMIC_ID_START)) {
     /* Reserved id. Attempt to load the proper dynamic module
      * to resolv the id.
@@ -3630,7 +3638,7 @@ static void compat_event_handler(int e)
 {
   oldhandlertype handler;
   debug_malloc_touch(Pike_fp->current_object);
-  handler=((oldhandlertype *)Pike_fp->context.prog->program)[e];
+  handler=((oldhandlertype *)Pike_fp->context->prog->program)[e];
   if(handler) handler(Pike_fp->current_object);
   debug_malloc_touch(Pike_fp->current_object);
 }
@@ -7748,10 +7756,8 @@ static void gc_check_frame(struct pike_frame *f)
   {
     if(f->current_object)
       debug_gc_check (f->current_object, " as current_object in trampoline frame");
-    if(f->context.prog)
-      debug_gc_check (f->context.prog, " as context.prog in trampoline frame");
-    if(f->context.parent)
-      debug_gc_check (f->context.parent, " as context.parent in trampoline frame");
+    if(f->current_program)
+      debug_gc_check (f->current_program, " as current_program in trampoline frame");
     debug_gc_check_svalues (f->locals, f->num_locals, " in locals of trampoline frame");
     if(f->scope && !debug_gc_check (f->scope, " as scope frame of trampoline frame"))
       gc_check_frame(f->scope);
@@ -7768,8 +7774,7 @@ static void gc_check_trampoline(struct object *o)
 static void gc_recurse_frame(struct pike_frame *f)
 {
   if(f->current_object) gc_recurse_object(f->current_object);
-  if(f->context.prog)   gc_recurse_program(f->context.prog);
-  if(f->context.parent) gc_recurse_object(f->context.parent);
+  if(f->current_program) gc_recurse_program(f->current_program);
   if(f->flags & PIKE_FRAME_MALLOCED_LOCALS)
     gc_recurse_svalues(f->locals,f->num_locals);
   if(f->scope)          gc_recurse_frame(f->scope);