2
SP_INC
Nunuhara Cabbage edited this page 2020-05-02 08:15:18 -07:00

SP_INC

Instruction Arguments

None.

Stack Arguments

int32 pageno - The id of the page to reference

Description

Increase the reference count of a page.

Example

In this example, a reference to local variable 0 is assigned to global variable 3 (which is a reference variable). The reference count of the local page is then incremented so that the variable is not deleted when the current function returns:

PUSHGLOBALPAGE ; stack: [ref_pageno]
PUSH 0x3       ; stack: [ref_pageno, 3]
PUSHLOCALPAGE  ; stack: [ref_pageno, 3, var_pageno]
PUSH 0x0       ; stack: [ref_pageno, 4, var_pageno, 0]
R_ASSIGN       ; stack: [var_pageno, 0]
POP            ; stack: [var_pageno]
SP_INC         ; stack: []