Fixed OP_SWITCH accidentally using the wrong address to get the pcode base (regression based on assumption of JitWriter::inbase).
authorDavid Anderson <dvander@alliedmods.net>
Tue Aug 19 06:40:25 2008 +0000 (2008-08-19)
changeset 2231f13eb5a31226
parent 2230 e650c36ac67b
child 2232 1205e2f3d8e5
Fixed OP_SWITCH accidentally using the wrong address to get the pcode base (regression based on assumption of JitWriter::inbase).
sourcepawn/jit/x86/jit_x86.cpp
     1.1 --- a/sourcepawn/jit/x86/jit_x86.cpp	Sun Aug 17 18:27:51 2008 +0000
     1.2 +++ b/sourcepawn/jit/x86/jit_x86.cpp	Tue Aug 19 06:40:25 2008 +0000
     1.3 @@ -1600,8 +1600,9 @@
     1.4  
     1.5  inline void WriteOp_Switch(JitWriter *jit)
     1.6  {
     1.7 +	CompData *data = (CompData *)jit->data;
     1.8  	cell_t offs = jit->read_cell();
     1.9 -	cell_t *tbl = (cell_t *)((char *)jit->inbase + offs + sizeof(cell_t));
    1.10 +	cell_t *tbl = (cell_t *)((char *)data->plugin->pcode + offs + sizeof(cell_t));
    1.11  
    1.12  	struct casetbl
    1.13  	{
    1.14 @@ -2436,6 +2437,12 @@
    1.15  		/* Offset must always be 1)positive and 2)less than or equal to the codesize */
    1.16  		assert(pcode_offs >= 0 && (uint32_t)pcode_offs <= data->plugin->pcode_size);
    1.17  		/* Do the lookup in the native dictionary. */
    1.18 +#if defined _DEBUG
    1.19 +		if (jit->outbase != NULL)
    1.20 +		{
    1.21 +			assert(*(jitoffs_t *)(data->rebase + pcode_offs) != NULL);
    1.22 +		}
    1.23 +#endif
    1.24  		return *(jitoffs_t *)(data->rebase + pcode_offs);
    1.25  	}
    1.26  	else