MCPcopy Create free account
hub / github.com/anjo76/angelscript / ResolveJumpAddresses

Method ResolveJumpAddresses

sdk/angelscript/source/as_bytecode.cpp:1879–1921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1877}
1878
1879int asCByteCode::ResolveJumpAddresses()
1880{
1881 TimeIt("asCByteCode::ResolveJumpAddresses");
1882
1883 asUINT currPos = 0;
1884
1885 asCByteInstruction *instr = first;
1886 while( instr )
1887 {
1888 if( instr->op == asBC_JMP ||
1889 instr->op == asBC_JZ || instr->op == asBC_JNZ ||
1890 instr->op == asBC_JLowZ || instr->op == asBC_JLowNZ ||
1891 instr->op == asBC_JS || instr->op == asBC_JNS ||
1892 instr->op == asBC_JP || instr->op == asBC_JNP )
1893 {
1894 int label = *((int*) ARG_DW(instr->arg));
1895 int labelPosOffset;
1896 int r = FindLabel(label, instr, 0, &labelPosOffset);
1897 if( r == 0 )
1898 *((int*) ARG_DW(instr->arg)) = labelPosOffset;
1899 else
1900 return -1;
1901 }
1902 else if (instr->op == asBC_TryBlock)
1903 {
1904 int label = *((int*)ARG_DW(instr->arg));
1905 int labelPosOffset;
1906 int r = FindLabel(label, instr, 0, &labelPosOffset);
1907 if (r == 0)
1908 {
1909 // Should store the absolute address so the exception handler doesn't need to figure it out
1910 *((int*)ARG_DW(instr->arg)) = currPos + labelPosOffset;
1911 }
1912 else
1913 return -1;
1914 }
1915
1916 currPos += instr->GetSize();
1917 instr = instr->next;
1918 }
1919
1920 return 0;
1921}
1922
1923
1924asCByteInstruction *asCByteCode::DeleteInstruction(asCByteInstruction *instr)

Callers

nothing calls this directly

Calls 1

GetSizeMethod · 0.45

Tested by

no test coverage detected