| 1858 | } |
| 1859 | |
| 1860 | void asCContext::ExecuteNext() |
| 1861 | { |
| 1862 | asDWORD *l_bc = m_regs.programPointer; |
| 1863 | asDWORD *l_sp = m_regs.stackPointer; |
| 1864 | asDWORD *l_fp = m_regs.stackFramePointer; |
| 1865 | |
| 1866 | for(;;) |
| 1867 | { |
| 1868 | |
| 1869 | #ifdef AS_DEBUG |
| 1870 | // Gather statistics on executed bytecode |
| 1871 | stats.Instr(*(asBYTE*)l_bc); |
| 1872 | |
| 1873 | // Used to verify that the size of the instructions are correct |
| 1874 | asDWORD *old = l_bc; |
| 1875 | #endif |
| 1876 | |
| 1877 | |
| 1878 | // Remember to keep the cases in order and without |
| 1879 | // gaps, because that will make the switch faster. |
| 1880 | // It will be faster since only one lookup will be |
| 1881 | // made to find the correct jump destination. If not |
| 1882 | // in order, the switch will make two lookups. |
| 1883 | switch( *(asBYTE*)l_bc ) |
| 1884 | { |
| 1885 | //-------------- |
| 1886 | // memory access functions |
| 1887 | |
| 1888 | case asBC_PopPtr: |
| 1889 | // Pop a pointer from the stack |
| 1890 | l_sp += AS_PTR_SIZE; |
| 1891 | l_bc++; |
| 1892 | break; |
| 1893 | |
| 1894 | case asBC_PshGPtr: |
| 1895 | // Replaces PGA + RDSPtr |
| 1896 | l_sp -= AS_PTR_SIZE; |
| 1897 | *(asPWORD*)l_sp = *(asPWORD*)asBC_PTRARG(l_bc); |
| 1898 | l_bc += 1 + AS_PTR_SIZE; |
| 1899 | break; |
| 1900 | |
| 1901 | // Push a dword value on the stack |
| 1902 | case asBC_PshC4: |
| 1903 | --l_sp; |
| 1904 | *l_sp = asBC_DWORDARG(l_bc); |
| 1905 | l_bc += 2; |
| 1906 | break; |
| 1907 | |
| 1908 | // Push the dword value of a variable on the stack |
| 1909 | case asBC_PshV4: |
| 1910 | --l_sp; |
| 1911 | *l_sp = *(l_fp - asBC_SWORDARG0(l_bc)); |
| 1912 | l_bc++; |
| 1913 | break; |
| 1914 | |
| 1915 | // Push the address of a variable on the stack |
| 1916 | case asBC_PSF: |
| 1917 | l_sp -= AS_PTR_SIZE; |
nothing calls this directly
no test coverage detected