|
Revision 138, 3.0 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 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
#include "stdafx.h" |
|---|
| 24 |
#include "criScript.h" |
|---|
| 25 |
#include "cilVm.h" |
|---|
| 26 |
#include "cilVMBranchMacro.h" |
|---|
| 27 |
namespace cri { |
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
#ifdef OP |
|---|
| 33 |
#undef OP |
|---|
| 34 |
#endif |
|---|
| 35 |
#define OP == |
|---|
| 36 |
#define OP2 == |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
void CCilVm::BneOperator() |
|---|
| 51 |
{ |
|---|
| 52 |
assert( getEvalStackSize() >= 2 ); |
|---|
| 53 |
CVariable& rhs = getEvalStackFirstEntry(); |
|---|
| 54 |
CVariable& lhs = getEvalStackSecondEntry(); |
|---|
| 55 |
|
|---|
| 56 |
bool bTrue = false; |
|---|
| 57 |
|
|---|
| 58 |
#pragma warning( disable:4311 ) |
|---|
| 59 |
|
|---|
| 60 |
CheckBranch( OP, OP2 ); |
|---|
| 61 |
|
|---|
| 62 |
#pragma warning( default:4311 ) |
|---|
| 63 |
|
|---|
| 64 |
if( !bTrue ) |
|---|
| 65 |
{ |
|---|
| 66 |
int32_t* pOffset = (int32_t*)m_pCurrentInstruction; |
|---|
| 67 |
m_pCurrentInstruction += *pOffset + LONGBR_ADJUST; |
|---|
| 68 |
} |
|---|
| 69 |
else |
|---|
| 70 |
m_pCurrentInstruction += LONGBR_ADJUST; |
|---|
| 71 |
|
|---|
| 72 |
popEvalStack(); |
|---|
| 73 |
popEvalStack(); |
|---|
| 74 |
} |
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
void CCilVm::BneShortOperator() |
|---|
| 84 |
{ |
|---|
| 85 |
assert( getEvalStackSize() >= 2 ); |
|---|
| 86 |
CVariable& rhs = getEvalStackFirstEntry(); |
|---|
| 87 |
CVariable& lhs = getEvalStackSecondEntry(); |
|---|
| 88 |
|
|---|
| 89 |
bool bTrue = false; |
|---|
| 90 |
|
|---|
| 91 |
#pragma warning( disable:4311 ) |
|---|
| 92 |
|
|---|
| 93 |
CheckBranch( OP, OP2 ); |
|---|
| 94 |
|
|---|
| 95 |
#pragma warning( default:4311 ) |
|---|
| 96 |
|
|---|
| 97 |
if( !bTrue ) |
|---|
| 98 |
{ |
|---|
| 99 |
int8_t* pOffset = (int8_t*)m_pCurrentInstruction; |
|---|
| 100 |
m_pCurrentInstruction += *pOffset + SHORTBR_ADJUST; |
|---|
| 101 |
} |
|---|
| 102 |
else |
|---|
| 103 |
m_pCurrentInstruction += SHORTBR_ADJUST; |
|---|
| 104 |
|
|---|
| 105 |
popEvalStack(); |
|---|
| 106 |
popEvalStack(); |
|---|
| 107 |
} |
|---|
| 108 |
|
|---|
| 109 |
} |
|---|