Go to the first, previous, next, last section, table of contents.
JOB_STACKFRAME_THUNK stackframes in context look as follows:
job_RunState.l -> size in bytes of below stackframe
JOB_STACKFRAME_THUNK
stack slot in which to place thunk return value
saved logical-bottom-of-data-stack.
saved actual_user
saved acting_user
saved privs
size in bytes of above stackframe
size in bytes of below stackframe
JOB_STACKFRAME_NORMAL
local_variable_N
...
local_variable_1
job_RunState.v -> local_variable_0
compiledFunction for this frame.
programCounter for this frame.
size in bytes of above stackframe
Rationale:
-
A function may take any number of arguments, and any of them may
prove to be a thunk requiring evaluation. We need to remember
where in the stack to put the return value from the thunk when
it completes execution.
-
We need to create a logically empty data stack in order to prevent
the thunk from messing with existing stack contents, which could
be a security and/or privacy breach. Hence the need to save the
old logical-bottom-of-data-stack for later restoration.
-
We need to clear the privilege-conferring entries in the job state
to innocuous values for similar security/privacy reasons,
and must save them for later restoration before doing so.
POSSIBLE BUG: It doesn't seem safe to clear current 'job' entry;
If any special privileges are accessable via it, thunks may be
a privacy/security hole.
A full getStackframe[
THUNK frame result looks like:
:owner object
:kind :thunk
:privileges fixnum
:actingUser object
:actualUser object
:stackBottom fixnum
:return-slot fixnum
Go to the first, previous, next, last section, table of contents.