(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_DUPLICATEASM_ERROR_LABEL_OVERFLOWASM_ERROR_NONEASM_ERROR_OPCODEASM_ERROR_OPERANDASM_ERROR_SPACEAsmClearErrorAsmGetErrorDebug_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_GetAddrOP_PROCOP_RETNOP_ZERO_PRIRelocateOpcodeYSI_gAMXAddress_YSI_g_sCodeEndYSI_g_sCodeSpace__1_cell__2_cells__3_cells
4 cells
VA_OnCodeInit()Initialise the library.
AMX_HEADER_CODCGen_SetupCodeSpaceDisasmContextDisasmInitDisasmNextInsnOP_NONEOP_NOPRelocateOpcodeYSI_gAMXAddress_YSI_g_sCodeSpace
public
11 cells