root/src/VM/cil/cilVMGarbageCollector.cpp

Revision 138, 2.6 kB (checked in by hak, 2 years ago)

- Added CCilVm::reset()
- Fixed VM status management (ticket #5)
- Fixed API names not to have upper case as 1st letter.
- Fixed sample build break
- Added new sample, "vm_contol" to demonstrate VM status control API

Line 
1 /****************************************************************************
2  *
3  * CRI Middleware SDK
4  *
5  * Copyright (c) 2008 CRI Middleware, Inc. All rights reserved.
6  *
7  * Use, modification and distribution are subject to the CRI Script Software
8  * License, Version 1.0(see accompanying file "CriScript_License_1_0.txt" or
9  * copy at www.criscript.com/trac/wiki/CRI%20Script%20Software%20License%201.0 ).
10  *
11  *
12  * Library  : CRIScript
13  * Module   : cil Virtual Machine
14  * File     : cilVMGarbageCollector.cpp
15  * Date     :
16  * Version  :
17  *
18  ****************************************************************************/
19
20 /***************************************************************************
21  *      Include file
22  ***************************************************************************/
23 #include "stdafx.h"
24 #include "criScript.h"
25 #include "cilVM.h"
26 namespace cri {
27 /***************************************************************************
28  *      Variables
29  ***************************************************************************/
30
31 /***************************************************************************
32  *      Methods
33  ***************************************************************************/
34 void CCilVm::cleanObjectPool()
35 {
36 //TODO: This is a quick fix for GPF on XP.
37 //Need to be revisited and cleaned up later
38
39         int32_t iDeletedObject = 0;
40         size_t iSize = getObjectPool().size();
41         list< CVmObject >::iterator itSt = getObjectPool().begin();
42         list< CVmObject >::iterator itEnd = getObjectPool().end();
43         while( itSt != itEnd )
44         {
45                 {
46                         iDeletedObject++;
47
48                         hash_map< wstring, CVariable >::iterator itStart = itSt->getPropertyMap().begin();
49                         hash_map< wstring, CVariable >::iterator itEnd = itSt->getPropertyMap().end();
50                         while( itStart != itEnd )
51                         {
52                                 itStart->second.iOperandType = OPERAND_SYSTEM_DELETION;
53                                 itStart ++;
54                         }
55                        
56                         //Destruct everything
57                         itSt->getPropertyMap().clear();
58                         //itSt->GetProtoType().iOperandType = OPERAND_SYSTEM_DELETION;
59                         itSt->getParentVariable().iOperandType = OPERAND_SYSTEM_DELETION;
60                         itSt->getValue().iOperandType = OPERAND_SYSTEM_DELETION;
61
62                 }
63                 itSt++;
64         }
65
66 }
67
68        
69 /***************************************************************************
70  *      Clear refence count ot Zero
71  *              helper for kicking off the gc process
72  ***************************************************************************/
73 void CCilVm::clearRefCount()
74 {
75         list< CVmObject >::iterator itSt = getObjectPool().begin();
76         list< CVmObject >::iterator itEnd = getObjectPool().end();
77         while( itSt != itEnd )
78         {
79                 itSt->clearRefCount();
80                 itSt ++;
81         }
82 }
83
84
85 } //namespace CRI
Note: See TracBrowser for help on using the browser.