(c) 2022 YSI contibutors, licensed under MPL 1.1
@_y_cgen0_y_@()
Calls the CGEN()
function a massive number of times, to generate a lot of useless assembly whose space we can reuse for useful code (i.e. y_hooks stubs).
public
55 cells
@_y_cgen1_y_@()
Denotes the end of the unused code block, so very much relies on the compiler placing this function directly after @_y_cgen0_y_@
.
public
1 cells
CGEN(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k, &l, &m, &n, &o, &p, &q, &r, &s, &t, &u, &v, &w, &x, &y, &z)
Name | Info |
---|---|
a |
& |
b |
& |
c |
& |
d |
& |
e |
& |
f |
& |
g |
& |
h |
& |
i |
& |
j |
& |
k |
& |
l |
& |
m |
& |
n |
& |
o |
& |
p |
& |
q |
& |
r |
& |
s |
& |
t |
& |
u |
& |
v |
& |
w |
& |
x |
& |
y |
& |
z |
& |
This is just a function that takes very little pawn code, but an awful lot of p-code, to call. The pawn is just CGEN()
, but thanks to having a huge number of reference parameters all with default constant values the generated assembly is massive, with twenty-six heap allocations and pushes. It doesn't even do anything, just reserves a huge block of code space in which we can generate new code.
1 cells
CGen_GetAddr(func[])
Name | Info |
---|---|
func |
[] Function name to get the address of. |
The address of the function.
Why this doesn't use functions from in y_amx I don't know.
3 cells
CGen_OOM(ctx[])
Name | Info |
---|---|
ctx |
[21] The AsmContext that ran out of space. |
Called by amx_assembly when more code is written than there is space for, or on some other errors.
ASM_ERROR_LABEL_DUPLICATE
ASM_ERROR_LABEL_OVERFLOW
ASM_ERROR_NONE
ASM_ERROR_OPCODE
ASM_ERROR_OPERAND
ASM_ERROR_SPACE
AsmClearError
AsmGetError
Debug_Kill_
Debug_Print0
public
8 cells
CGen_SetupCodeSpace()
Initialises the storage for unused code, and ensures that the functions being clobbered by said code are at least left in a semi-valid state.
CGen_GetAddr
OP_PROC
OP_RETN
OP_ZERO_PRI
RelocateOpcode
YSI_gAMXAddress_
YSI_g_sCodeEnd
YSI_g_sCodeSpace
__1_cell
__2_cells
__3_cells
4 cells
VA_OnCodeInit()
Initialise the library.
AMX_HEADER_COD
CGen_SetupCodeSpace
DisasmContext
DisasmInit
DisasmNextInsn
OP_NONE
OP_NOP
RelocateOpcode
YSI_gAMXAddress_
YSI_g_sCodeSpace
public
11 cells