aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--opcode.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/opcode.c b/opcode.c
index d7b82c50..4f488bb0 100644
--- a/opcode.c
+++ b/opcode.c
@@ -3,7 +3,7 @@
3** TecCGraf - PUC-Rio 3** TecCGraf - PUC-Rio
4*/ 4*/
5 5
6char *rcs_opcode="$Id: opcode.c,v 3.30 1994/12/28 12:55:47 roberto Exp roberto $"; 6char *rcs_opcode="$Id: opcode.c,v 3.31 1994/12/30 17:45:11 roberto Exp celes $";
7 7
8#include <setjmp.h> 8#include <setjmp.h>
9#include <stdio.h> 9#include <stdio.h>
@@ -96,22 +96,21 @@ static void lua_initstack (void)
96/* 96/*
97** Check stack overflow and, if necessary, realloc vector 97** Check stack overflow and, if necessary, realloc vector
98*/ 98*/
99static void lua_checkstack (StkId n) 99#define lua_checkstack(n) if ((Long)(n) > maxstack) checkstack(n)
100
101static void checkstack (StkId n)
100{ 102{
101 if ((Long)n > maxstack) 103 StkId t;
102 { 104 if (stack == NULL)
103 StkId t; 105 lua_initstack();
104 if (stack == NULL) 106 if (maxstack >= MAX_INT)
105 lua_initstack(); 107 lua_error("stack size overflow");
106 if (maxstack >= MAX_INT) 108 t = top-stack;
107 lua_error("stack size overflow"); 109 maxstack *= 2;
108 t = top-stack; 110 if (maxstack >= MAX_INT)
109 maxstack *= 2; 111 maxstack = MAX_INT;
110 if (maxstack >= MAX_INT) 112 stack = growvector(stack, maxstack, Object);
111 maxstack = MAX_INT; 113 top = stack + t;
112 stack = growvector(stack, maxstack, Object);
113 top = stack + t;
114 }
115} 114}
116 115
117 116
@@ -565,6 +564,14 @@ lua_Object lua_getlocked (int ref)
565} 564}
566 565
567 566
567void lua_pushlocked (int ref)
568{
569 lua_checkstack(top-stack+1);
570 *top = *luaI_getlocked(ref);
571 top++;
572}
573
574
568int lua_lock (void) 575int lua_lock (void)
569{ 576{
570 adjustC(1); 577 adjustC(1);