From 1493c5f50cd9caeaa5fc83fba277d74ff16a036e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 28 Aug 2008 17:13:19 +0200
Subject: [PATCH] Added modify_stack_depth().

Rev: src/docode.c:1.204
Rev: src/docode.h:1.21
---
 src/docode.c | 12 +++++++++++-
 src/docode.h |  3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/docode.c b/src/docode.c
index def6f8be04..9c91305766 100644
--- a/src/docode.c
+++ b/src/docode.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: docode.c,v 1.203 2008/07/14 21:39:20 grubba Exp $
+|| $Id: docode.c,v 1.204 2008/08/28 15:13:19 grubba Exp $
 */
 
 #include "global.h"
@@ -247,6 +247,16 @@ static int ins_label(int lbl)
   return lbl;
 }
 
+void modify_stack_depth(int delta)
+{
+  current_stack_depth += delta;
+#ifdef PIKE_DEBUG
+  if (current_stack_depth < 0) {
+    Pike_fatal("Popped out of virtual stack.\n");
+  }
+#endif
+}
+
 void do_pop(int x)
 {
   struct compilation *c = THIS_COMPILATION;
diff --git a/src/docode.h b/src/docode.h
index c27f3c9feb..9742ae97ba 100644
--- a/src/docode.h
+++ b/src/docode.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: docode.h,v 1.20 2008/04/14 10:14:38 grubba Exp $
+|| $Id: docode.h,v 1.21 2008/08/28 15:13:19 grubba Exp $
 */
 
 #ifndef DOCODE_H
@@ -29,6 +29,7 @@ void push_explicit(INT32 address);
 INT32 pop_address(void);
 int alloc_label(void);
 int do_jump(int token,INT32 lbl);
+void modify_stack_depth(int delta);
 void do_pop(int x);
 int do_docode(node *n, int flags);
 void do_cond_jump(node *n, int label, int iftrue, int flags);
-- 
GitLab