[Scummvm-cvs-logs] SF.net SVN: scummvm:[47833] scummvm/trunk/engines/sci/engine
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Feb 3 02:32:59 CET 2010
Revision: 47833
http://scummvm.svn.sourceforge.net/scummvm/?rev=47833&view=rev
Author: fingolfin
Date: 2010-02-03 01:32:59 +0000 (Wed, 03 Feb 2010)
Log Message:
-----------
SCI: Get rid of EngineState::stack_segment
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/game.cpp
scummvm/trunk/engines/sci/engine/gc.cpp
scummvm/trunk/engines/sci/engine/savegame.cpp
scummvm/trunk/engines/sci/engine/seg_manager.cpp
scummvm/trunk/engines/sci/engine/state.cpp
scummvm/trunk/engines/sci/engine/state.h
scummvm/trunk/engines/sci/engine/vm.cpp
Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/game.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -239,7 +239,7 @@
// FIXME Use new VM instantiation code all over the place
DataStack *stack;
- stack = s->_segMan->allocateStack(VM_STACK_SIZE, &s->stack_segment);
+ stack = s->_segMan->allocateStack(VM_STACK_SIZE, NULL);
s->stack_base = stack->_entries;
s->stack_top = stack->_entries + stack->_capacity;
Modified: scummvm/trunk/engines/sci/engine/gc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/gc.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/gc.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -130,10 +130,11 @@
debugC(2, kDebugLevelGC, "[GC] -- Finished explicitly loaded scripts, done with root set");
// Run Worklist Algorithm
+ SegmentId stack_seg = segMan->findSegmentByType(SEG_TYPE_STACK);
while (!wm._worklist.empty()) {
reg_t reg = wm._worklist.back();
wm._worklist.pop_back();
- if (reg.segment != s->stack_segment) { // No need to repeat this one
+ if (reg.segment != stack_seg) { // No need to repeat this one
debugC(2, kDebugLevelGC, "[GC] Checking %04x:%04x", PRINT_REG(reg));
if (reg.segment < segMan->_heap.size() && segMan->_heap[reg.segment])
segMan->_heap[reg.segment]->listAllOutgoingReferences(reg, &wm, add_outgoing_refs);
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -765,7 +765,6 @@
SegmentId stack_seg = retval->_segMan->findSegmentByType(SEG_TYPE_STACK);
DataStack *stack = (DataStack *)(retval->_segMan->_heap[stack_seg]);
- retval->stack_segment = stack_seg;
retval->stack_base = stack->_entries;
retval->stack_top = stack->_entries + stack->_capacity;
}
Modified: scummvm/trunk/engines/sci/engine/seg_manager.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/seg_manager.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -113,34 +113,36 @@
SegmentObj *SegManager::allocSegment(SegmentObj *mem, SegmentId *segid) {
// Find a free segment
- *segid = findFreeSegment();
+ SegmentId id = findFreeSegment();
+ if (segid)
+ *segid = id;
if (!mem)
error("SegManager: invalid mobj");
// ... and put it into the (formerly) free segment.
- if (*segid >= (int)_heap.size()) {
- assert(*segid == (int)_heap.size());
+ if (id >= (int)_heap.size()) {
+ assert(id == (int)_heap.size());
_heap.push_back(0);
}
- _heap[*segid] = mem;
+ _heap[id] = mem;
return mem;
}
-Script *SegManager::allocateScript(int script_nr, SegmentId *seg_id) {
+Script *SegManager::allocateScript(int script_nr, SegmentId *segid) {
// Check if the script already has an allocated segment. If it
// does, return that segment.
- *seg_id = _scriptSegMap.getVal(script_nr, 0);
- if (*seg_id > 0) {
- return (Script *)_heap[*seg_id];
+ *segid = _scriptSegMap.getVal(script_nr, 0);
+ if (*segid > 0) {
+ return (Script *)_heap[*segid];
}
// allocate the SegmentObj
- SegmentObj *mem = allocSegment(new Script(), seg_id);
+ SegmentObj *mem = allocSegment(new Script(), segid);
// Add the script to the "script id -> segment id" hashmap
- _scriptSegMap[script_nr] = *seg_id;
+ _scriptSegMap[script_nr] = *segid;
return (Script *)mem;
}
Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/state.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -53,7 +53,6 @@
restAdjust = 0;
r_prev = NULL_REG;
- stack_segment = 0;
stack_base = 0;
stack_top = 0;
Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/state.h 2010-02-03 01:32:59 UTC (rev 47833)
@@ -205,7 +205,6 @@
int16 restAdjust; /**< &rest register (only used for save games) */
reg_t r_prev; /**< previous comparison result */
- SegmentId stack_segment; /**< Heap area for the stack to use */
StackPtr stack_base; /**< Pointer to the least stack element */
StackPtr stack_top; /**< First invalid stack element */
Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp 2010-02-03 01:32:27 UTC (rev 47832)
+++ scummvm/trunk/engines/sci/engine/vm.cpp 2010-02-03 01:32:59 UTC (rev 47833)
@@ -568,7 +568,7 @@
#endif
scriptState.variables_seg[VAR_GLOBAL] = s->script_000->_localsSegment;
- scriptState.variables_seg[VAR_TEMP] = scriptState.variables_seg[VAR_PARAM] = s->stack_segment;
+ scriptState.variables_seg[VAR_TEMP] = scriptState.variables_seg[VAR_PARAM] = s->_segMan->findSegmentByType(SEG_TYPE_STACK);
scriptState.variables_base[VAR_TEMP] = scriptState.variables_base[VAR_PARAM] = s->stack_base;
// SCI code reads the zeroth argument to determine argc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list