Starting -O2 upgrades

This commit is contained in:
Y_Less 2022-06-07 15:03:46 +01:00
parent 07ad8e84e4
commit d7a093fdc8
3 changed files with 13 additions and 3 deletions

View File

@ -860,6 +860,7 @@ static int amx_BrowseRelocate(AMX *amx)
amx->flags &= ~AMX_FLAG_BROWSE; amx->flags &= ~AMX_FLAG_BROWSE;
amx->flags |= AMX_FLAG_RELOC; amx->flags |= AMX_FLAG_RELOC;
amx->flags |= AMX_FLAG_SYSREQD;
if (sysreq_flg & 0x02) if (sysreq_flg & 0x02)
amx->flags |= AMX_FLAG_SYSREQN; amx->flags |= AMX_FLAG_SYSREQN;
return AMX_ERR_NONE; return AMX_ERR_NONE;

View File

@ -152,10 +152,16 @@ extern "C" {
* this number needs to be incremented. * this number needs to be incremented.
* The file version supported by the JIT may run behind MIN_AMX_VERSION. So * The file version supported by the JIT may run behind MIN_AMX_VERSION. So
* there is an extra constant for it: MAX_FILE_VER_JIT. * there is an extra constant for it: MAX_FILE_VER_JIT.
*
* For open.mp the file and AMX versions are different, to detect files built
* with the new compiler and `-O2`. This prevents code compiled on the old
* compiler using `-O2`, despite the fact that they are the same. Assembly code
* written on the old compiler can't use the macro ops, and can't detect when
* `-O2` is being used, so a lot of code breaks in that case.
*/ */
#define CUR_FILE_VERSION 9 /* current file version; also the current AMX version */ #define CUR_FILE_VERSION 9 /* current file version; also the current AMX version */
#define MIN_FILE_VERSION 6 /* lowest supported file format version for the current AMX version */ #define MIN_FILE_VERSION 6 /* lowest supported file format version for the current AMX version */
#define MIN_AMX_VERSION 9 /* minimum AMX version needed to support the current file format */ #define MIN_AMX_VERSION 10 /* minimum AMX version needed to support the current file format */
#define MAX_FILE_VER_JIT 8 /* file version supported by the JIT */ #define MAX_FILE_VER_JIT 8 /* file version supported by the JIT */
#define MIN_AMX_VER_JIT 8 /* AMX version supported by the JIT */ #define MIN_AMX_VER_JIT 8 /* AMX version supported by the JIT */
@ -348,6 +354,7 @@ enum {
#define AMX_FLAG_COMPACT 0x04 /* compact encoding */ #define AMX_FLAG_COMPACT 0x04 /* compact encoding */
#define AMX_FLAG_SLEEP 0x08 /* script uses the sleep instruction (possible re-entry or power-down mode) */ #define AMX_FLAG_SLEEP 0x08 /* script uses the sleep instruction (possible re-entry or power-down mode) */
#define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no BREAK opcodes */ #define AMX_FLAG_NOCHECKS 0x10 /* no array bounds checking; no BREAK opcodes */
#define AMX_FLAG_SYSREQD 0x400 /* SYSREQ.D is NOT used */
#define AMX_FLAG_SYSREQN 0x800 /* script new (optimized) version of SYSREQ opcode */ #define AMX_FLAG_SYSREQN 0x800 /* script new (optimized) version of SYSREQ opcode */
#define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */ #define AMX_FLAG_NTVREG 0x1000 /* all native functions are registered */
#define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */ #define AMX_FLAG_JITC 0x2000 /* abstract machine is JIT compiled */

View File

@ -1450,7 +1450,7 @@ static int command(void)
/* write parameter (if any) */ /* write parameter (if any) */
while (*lptr<=' ' && *lptr!='\0') while (*lptr<=' ' && *lptr!='\0')
lptr++; lptr++;
if (*lptr!='\0') { while (*lptr!='\0') {
symbol *sym; symbol *sym;
tok=lex(&val,&str); tok=lex(&val,&str);
switch (tok) { switch (tok) {
@ -1519,7 +1519,9 @@ static int command(void)
break; break;
} /* case */ } /* case */
} /* switch */ } /* switch */
} /* if */ while (*lptr<=' ' && *lptr!='\0')
lptr++;
} /* while */
stgwrite("\n"); stgwrite("\n");
check_empty(lptr); check_empty(lptr);
} /* if */ } /* if */