[Scummvm-cvs-logs] scummvm master -> 658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2

wjp wjp at usecode.org
Tue Feb 2 02:18:16 CET 2016


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
75f1d2e259 SWORD25: Use more appropriate function for growing the stack
ad688f9d6f SWORD25: Remove now unused function
658306d005 Merge pull request #659 from wjp/sword25_loading


Commit: 75f1d2e2596035f603558dced17e64238032ce2c
    https://github.com/scummvm/scummvm/commit/75f1d2e2596035f603558dced17e64238032ce2c
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-02-02T01:21:28+01:00

Commit Message:
SWORD25: Use more appropriate function for growing the stack

The call to lua_growstack in unpersistThread would unconditionally at
least double the size of the stack. This caused memory usage to grow
exponentially (literally) with the number of serialized threads.

Bugs #6977, #6999.

Changed paths:
    engines/sword25/util/lua_unpersist.cpp



diff --git a/engines/sword25/util/lua_unpersist.cpp b/engines/sword25/util/lua_unpersist.cpp
index ef0ef31..678ddb5 100644
--- a/engines/sword25/util/lua_unpersist.cpp
+++ b/engines/sword25/util/lua_unpersist.cpp
@@ -425,7 +425,7 @@ void unpersistThread(UnSerializationInfo *info, int index) {
 
 	// First, deserialize the object stack
 	uint32 stackSize = info->readStream->readUint32LE();
-	lua_growstack(info->luaState, (int)stackSize);
+	lua_checkstack(info->luaState, (int)stackSize);
 
 	// Make sure that the first stack element (a nil, representing
 	// the imaginary top-level C function) is written to the very,


Commit: ad688f9d6f11e576356fb612e9da9ee66d2e1e6b
    https://github.com/scummvm/scummvm/commit/ad688f9d6f11e576356fb612e9da9ee66d2e1e6b
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-02-02T02:16:41+01:00

Commit Message:
SWORD25: Remove now unused function

Changed paths:
    engines/sword25/util/lua_persistence_util.cpp
    engines/sword25/util/lua_persistence_util.h



diff --git a/engines/sword25/util/lua_persistence_util.cpp b/engines/sword25/util/lua_persistence_util.cpp
index 958fb7a..d0192c2 100644
--- a/engines/sword25/util/lua_persistence_util.cpp
+++ b/engines/sword25/util/lua_persistence_util.cpp
@@ -280,15 +280,6 @@ void lua_reallocstack(lua_State *L, int newsize) {
 	correctStack(L, oldstack);
 }
 
-void lua_growstack(lua_State *L, int n) {
-	// Double size is enough?
-	if (n <= L->stacksize) {
-		lua_reallocstack(L, 2 * L->stacksize);
-	} else {
-		lua_reallocstack(L, L->stacksize + n);
-	}
-}
-
 void lua_reallocCallInfo(lua_State *lauState, int newsize) {
 	CallInfo *oldci = lauState->base_ci;
 	lua_reallocvector(lauState, lauState->base_ci, lauState->size_ci, newsize, CallInfo);
diff --git a/engines/sword25/util/lua_persistence_util.h b/engines/sword25/util/lua_persistence_util.h
index 4d0085e..e3a2935 100644
--- a/engines/sword25/util/lua_persistence_util.h
+++ b/engines/sword25/util/lua_persistence_util.h
@@ -90,7 +90,6 @@ void unboxUpValue(lua_State *luaState);
 size_t appendStackToStack_reverse(lua_State *from, lua_State *to);
 void correctStack(lua_State *L, TValue *oldstack);
 void lua_reallocstack(lua_State *L, int newsize);
-void lua_growstack(lua_State *L, int n);
 
 void lua_reallocCallInfo(lua_State *lauState, int newsize);
 


Commit: 658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2
    https://github.com/scummvm/scummvm/commit/658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2016-02-02T02:17:43+01:00

Commit Message:
Merge pull request #659 from wjp/sword25_loading

SWORD25: Use more appropriate function for growing the stack

Changed paths:
    engines/sword25/util/lua_persistence_util.cpp
    engines/sword25/util/lua_persistence_util.h
    engines/sword25/util/lua_unpersist.cpp









More information about the Scummvm-git-logs mailing list