Skip to content
Commit 470b1734 authored by Nick Wellnhofer's avatar Nick Wellnhofer
Browse files

Rewrite memory management of local RVTs

The psvi slot of RVTs documents is used to store ownership information.

XSLT_RVT_LOCAL for RVTs that are destroyed after the current instructions
ends.

XSLT_RVT_VARIABLE for RVTs that are part of a local variable and are
destroyed after the variable goes out of scope.

XSLT_RVT_FUNC_RESULT for RVTs that are part of results returned with
func:result. These RVTs won't be destroyed after exiting a template and
will be reset to XSLT_RVT_LOCAL or XSLT_RVT_VARIABLE in the template
that receives the return value.

XSLT_RVT_GLOBAL for RVTs that are part of a global variable.

The function xsltFlagRVTs is used for the following ownership
transitions:

- LOCAL or VARIABLE to FUNC_RESULT when returning a value with
  func:result.
- FUNC_RESULT to LOCAL or VARIABLE when receiving a func:result.
- LOCAL to GLOBAL after evaluating global variables or parameters.

This obsoletes the element localRVTBase in the context struct and the
xsltExtensionInstructionResultRegister function. Aside from the
func:result implementation, the only reason for the old mechanism was
to protect RVTs (which can only be returned from extension functions)
in global variables from being destroyed too early. This is done
automatically now, so there's no need for extension authors to call
this function anymore.

The function xsltExtensionInstructionResultFinalize is unsupported
now. To the best of my knowledge, it isn't used outside of libxslt.

Another benefit is that, in some cases, RVTs are freed earlier now.

Also fixes bug #602531.
parent fe54d5e0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment