Changeset 138 for src/VM/cil/cilVMEvalStack.cpp
- Timestamp:
- 07/24/08 17:04:30 (2 years ago)
- Files:
-
- src/VM/cil/cilVMEvalStack.cpp (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/VM/cil/cilVMEvalStack.cpp
r110 r138 37 37 //Write allocate, pointer based implementation 38 38 39 void CCilVm::PushEvalStack( const CVariable& operand ) 39 /*************************************************************************** 40 * pushEvalStack 41 ***************************************************************************/ 42 void CCilVm::pushEvalStack( const CVariable& operand ) 40 43 { 41 44 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 49 52 var.iOperandFlag = OPERAND_FLAG_NONE; 50 53 #endif 51 UpdateEvalStackIndex(); 52 } 53 54 void CCilVm::PushEvalStackString( const wchar_t* pStr ) 54 updateEvalStackIndex(); 55 } 56 57 /*************************************************************************** 58 * pushEvalStackString 59 ***************************************************************************/ 60 void CCilVm::pushEvalStackString( const wchar_t* pStr ) 55 61 { 56 62 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 62 68 var = CVariable( pStr ); 63 69 #endif 64 UpdateEvalStackIndex(); 65 } 66 67 void CCilVm::PushEvalStackString( const wstring* str ) 70 updateEvalStackIndex(); 71 } 72 73 /*************************************************************************** 74 * pushEvalStackString( wstring * version ) 75 ***************************************************************************/ 76 void CCilVm::pushEvalStackString( const wstring* str ) 68 77 { 69 78 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 78 87 var.pString = new wstring( *str ); 79 88 #endif 80 UpdateEvalStackIndex(); 81 } 82 83 void CCilVm::PushEvalStackStringPointer( wstring* pstr ) 89 updateEvalStackIndex(); 90 } 91 92 /*************************************************************************** 93 * pushEvalStackStringPointer 94 ***************************************************************************/ 95 void CCilVm::pushEvalStackStringPointer( wstring* pstr ) 84 96 { 85 97 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 94 106 var.pString = pstr; 95 107 #endif 96 UpdateEvalStackIndex(); 97 } 98 99 void CCilVm::PushEvalStack( const int32_t i ) 108 updateEvalStackIndex(); 109 } 110 111 /*************************************************************************** 112 * pushEvalStack( int32_t version ) 113 ***************************************************************************/ 114 void CCilVm::pushEvalStack( const int32_t i ) 100 115 { 101 116 CVariable& var = *m_pCurrentEvalStack; … … 106 121 var = CVariable( i ); 107 122 #endif 108 UpdateEvalStackIndex(); 109 } 110 111 void CCilVm::PushEvalStack( const int64_t i ) 123 updateEvalStackIndex(); 124 } 125 126 /*************************************************************************** 127 * pushEvalStack( int64_t version ) 128 ***************************************************************************/ 129 void CCilVm::pushEvalStack( const int64_t i ) 112 130 { 113 131 CVariable& var = *m_pCurrentEvalStack; … … 118 136 var = CVariable( i ); 119 137 #endif 120 UpdateEvalStackIndex(); 121 } 122 123 void CCilVm::PushEvalStack( const bool b ) 138 updateEvalStackIndex(); 139 } 140 141 /*************************************************************************** 142 * pushEvalStack ( boolean ) 143 ***************************************************************************/ 144 void CCilVm::pushEvalStack( const bool b ) 124 145 { 125 146 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 131 152 var = CVariable( b ); 132 153 #endif 133 UpdateEvalStackIndex(); 134 } 135 136 void CCilVm::PushEvalStack( const float f ) 154 updateEvalStackIndex(); 155 } 156 157 /*************************************************************************** 158 * pushEvalStack( float ) 159 ***************************************************************************/ 160 void CCilVm::pushEvalStack( const float f ) 137 161 { 138 162 CVariable& var = *m_pCurrentEvalStack; … … 143 167 var = CVariable( f ); 144 168 #endif 145 UpdateEvalStackIndex(); 146 } 147 148 void CCilVm::PushEvalStack( const double d ) 169 updateEvalStackIndex(); 170 } 171 172 /*************************************************************************** 173 * pushEvalStack( double ) 174 ***************************************************************************/ 175 void CCilVm::pushEvalStack( const double d ) 149 176 { 150 177 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 156 183 var = CVariable( d ); 157 184 #endif 158 UpdateEvalStackIndex(); 159 } 160 161 void CCilVm::PushEvalStackNull() 185 updateEvalStackIndex(); 186 } 187 188 /*************************************************************************** 189 * pushEvalStackNull 190 ***************************************************************************/ 191 void CCilVm::pushEvalStackNull() 162 192 { 163 193 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 171 201 var = operand; 172 202 #endif 173 UpdateEvalStackIndex(); 174 } 175 176 void CCilVm::PushEvalStackUndefined() 203 updateEvalStackIndex(); 204 } 205 206 /*************************************************************************** 207 * pushEvalStackUndefined 208 ***************************************************************************/ 209 void CCilVm::pushEvalStackUndefined() 177 210 { 178 211 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 186 219 var = operand; 187 220 #endif 188 UpdateEvalStackIndex(); 189 } 190 191 void CCilVm::PushEvalStackNaN() 221 updateEvalStackIndex(); 222 } 223 224 /*************************************************************************** 225 * 226 ***************************************************************************/ 227 void CCilVm::pushEvalStackNaN() 192 228 { 193 229 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 201 237 var = operand; 202 238 #endif 203 UpdateEvalStackIndex(); 204 } 205 206 void CCilVm::PushEvalStackInfinity() 239 updateEvalStackIndex(); 240 } 241 242 /*************************************************************************** 243 * pushEvalStackInfinity 244 ***************************************************************************/ 245 void CCilVm::pushEvalStackInfinity() 207 246 { 208 247 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 217 256 var = operand; 218 257 #endif 219 UpdateEvalStackIndex(); 220 } 221 222 void CCilVm::PushEvalStackObjectRef( VMOBJECTREF refObject ) 258 updateEvalStackIndex(); 259 } 260 261 /*************************************************************************** 262 * 263 ***************************************************************************/ 264 void CCilVm::pushEvalStackObjectRef( VMOBJECTREF refObject ) 223 265 { 224 266 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 228 270 var.refObject = refObject; 229 271 if( refObject ) 230 refObject-> AddRef();272 refObject->addRef(); 231 273 #else 232 274 CVariable operand; … … 235 277 var = operand; 236 278 #endif 237 UpdateEvalStackIndex(); 238 } 239 240 void CCilVm::PushEvalStackVariable( const CVariable& varSrc ) 279 updateEvalStackIndex(); 280 } 281 282 /*************************************************************************** 283 * pushEvalStackVariable 284 ***************************************************************************/ 285 void CCilVm::pushEvalStackVariable( const CVariable& varSrc ) 241 286 { 242 287 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 248 293 var.iOperandFlag = OPERAND_FLAG_NONE; 249 294 #endif 250 UpdateEvalStackIndex(); 251 } 252 253 void CCilVm::PopEvalStack( void ) 295 updateEvalStackIndex(); 296 } 297 298 /*************************************************************************** 299 * 300 ***************************************************************************/ 301 void CCilVm::popEvalStack( void ) 254 302 { 255 303 assert( m_pCurrentEvalStack > &m_OperandEvalStack[ 0 ] ); … … 261 309 } 262 310 311 /*************************************************************************** 312 * popEvalStackFast 313 ***************************************************************************/ 263 314 //Used after moveto() 264 void CCilVm:: PopEvalStackFast( void )315 void CCilVm::popEvalStackFast( void ) 265 316 { 266 317 assert( m_pCurrentEvalStack > &m_OperandEvalStack[ 0 ] ); … … 268 319 } 269 320 270 bool CCilVm::IsEvalStackEmpty() { return (bool)(m_pCurrentEvalStack != &m_OperandEvalStack[ 0 ]); } 271 272 void CCilVm::DupEvalStack( void ) 321 /*************************************************************************** 322 * isEvalStackEmpty 323 ***************************************************************************/ 324 bool CCilVm::isEvalStackEmpty() { return (bool)(m_pCurrentEvalStack != &m_OperandEvalStack[ 0 ]); } 325 326 /*************************************************************************** 327 * dupEvalStack 328 ***************************************************************************/ 329 void CCilVm::dupEvalStack( void ) 273 330 { 274 331 assert( m_pCurrentEvalStack > &m_OperandEvalStack[ 0 ] ); … … 279 336 var = *(m_pCurrentEvalStack - 1); 280 337 #endif 281 UpdateEvalStackIndex(); 282 } 283 284 size_t CCilVm::GetEvalStackSize() 338 updateEvalStackIndex(); 339 } 340 341 /*************************************************************************** 342 * getEvalStackSize 343 ***************************************************************************/ 344 size_t CCilVm::getEvalStackSize() 285 345 { 286 346 return (m_pCurrentEvalStack - &m_OperandEvalStack[ 0 ] ) / (&m_OperandEvalStack[ 1 ] - &m_OperandEvalStack[ 0 ] ); 287 347 } 288 348 289 CVariable& CCilVm::GetEvalStackNewEntry() 349 /*************************************************************************** 350 * getEvalStackNewEntry 351 ***************************************************************************/ 352 CVariable& CCilVm::getEvalStackNewEntry() 290 353 { 291 354 assert( m_pCurrentEvalStack < &m_OperandEvalStack[ MAX_EVALSTACK - 1 ] ); … … 293 356 } 294 357 295 CVariable& CCilVm::GetEvalStackFirstEntry() 296 { 297 assert( GetEvalStackSize() >= 1 ); 358 /*************************************************************************** 359 * getEvalStackFirstEntry 360 ***************************************************************************/ 361 CVariable& CCilVm::getEvalStackFirstEntry() 362 { 363 assert( getEvalStackSize() >= 1 ); 298 364 return *(m_pCurrentEvalStack - 1); 299 365 } 300 366 301 CVariable& CCilVm::GetEvalStackSecondEntry() 302 { 303 assert( GetEvalStackSize() >= 2 ); 367 /*************************************************************************** 368 * getEvalStackSecondEntry 369 ***************************************************************************/ 370 CVariable& CCilVm::getEvalStackSecondEntry() 371 { 372 assert( getEvalStackSize() >= 2 ); 304 373 return *(m_pCurrentEvalStack - 2); 305 374 } 306 375 307 void CCilVm::ClearEvalStack() 376 /*************************************************************************** 377 * clearCallStack 378 ***************************************************************************/ 379 void CCilVm::clearCallStack() 380 { 381 m_CallStack.clear(); 382 } 383 384 /*************************************************************************** 385 * clearStaticFields 386 ***************************************************************************/ 387 void CCilVm::clearStaticFields() 388 { 389 for( uint32_t i = 0; i < m_iStaticFieldTalbeSize; ++i ) 390 { 391 switch( OperandType( m_pStaticFieldTable[ i ].iOperandType ) ) 392 { 393 case OPERAND_OBJECTREF: 394 m_pStaticFieldTable[ i ].i64Value = 0; 395 break; 396 case OPERAND_STRING: 397 delete( m_pStaticFieldTable[ i ].pString ) ; 398 m_pStaticFieldTable[ i ].pString = NULL; 399 break; 400 default: 401 m_pStaticFieldTable[ i ].i64Value = 0; 402 break; 403 } 404 } 405 } 406 407 /*************************************************************************** 408 * clearEvalStack 409 ***************************************************************************/ 410 void CCilVm::clearEvalStack() 308 411 { 309 412 CVariable var ( 0 ); … … 317 420 } 318 421 319 void CCilVm::ClearLocalVariableList() 422 /*************************************************************************** 423 * clearLocalVariableList 424 ***************************************************************************/ 425 void CCilVm::clearLocalVariableList() 320 426 { 321 427 CVariable var ( 0 ); … … 328 434 } 329 435 330 void CCilVm::ClearArgList() 436 /*************************************************************************** 437 * clearArgList 438 ***************************************************************************/ 439 void CCilVm::clearArgList() 331 440 { 332 441 CVariable var ( 0 );
