Performance optimisation for directors for classes passed by value
The directorin typemaps in the director methods now use std::move on the input parameter when copying the object from the stack to the heap prior to the callback into the target language, thereby taking advantage of move semantics if available.
This commit is contained in:
parent
e75095e6c5
commit
71cd6a38fe
24 changed files with 80 additions and 20 deletions
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") CONST TYPE
|
||||
%{ $input = 0;
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype((const $1_ltype &)$1)); %}
|
||||
*((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > (new $1_ltype(SWIG_STD_MOVE($1))); %}
|
||||
|
||||
%typemap(directorout) CONST TYPE
|
||||
%{ if (!$input) {
|
||||
|
|
|
|||
|
|
@ -676,7 +676,7 @@ Swig::LocalRefGuard $1_refguard(jenv, $input); }
|
|||
|
||||
%typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE
|
||||
%{ $input = 0;
|
||||
*(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %}
|
||||
*(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %}
|
||||
%typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, true)"
|
||||
%typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)"
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
%typemap(javadirectorout) CTYPE *const& "$javacall.$*interfacename_GetInterfaceCPtr()"
|
||||
%typemap(directorin,descriptor="L$packagepath/$&javainterfacename;") CTYPE
|
||||
%{ $input = 0;
|
||||
*(($&1_ltype*)&$input) = new $1_ltype((const $1_ltype &)$1); %}
|
||||
*(($&1_ltype*)&$input) = new $1_ltype(SWIG_STD_MOVE($1)); %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE *, CTYPE []
|
||||
%{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
|
||||
%typemap(directorin,descriptor="L$packagepath/$javainterfacename;") CTYPE &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue