|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66191 - sandbox/function/boost/function
From: dsaritz_at_[hidden]
Date: 2010-10-25 17:34:17
Author: psiha
Date: 2010-10-25 17:34:16 EDT (Mon, 25 Oct 2010)
New Revision: 66191
URL: http://svn.boost.org/trac/boost/changeset/66191
Log:
Reordered function arguments for the free-call invokers to make the stack layout as similar as possible to the one expected by the target.
Text files modified:
sandbox/function/boost/function/function_template.hpp | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
Modified: sandbox/function/boost/function/function_template.hpp
==============================================================================
--- sandbox/function/boost/function/function_template.hpp (original)
+++ sandbox/function/boost/function/function_template.hpp 2010-10-25 17:34:16 EDT (Mon, 25 Oct 2010)
@@ -73,7 +73,13 @@
>
struct BOOST_FUNCTION_FUNCTION_OBJ_INVOKER : public function_buffer_holder
{
- static R free_invoke( function_buffer & buffer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS )
+ // Implementation note:
+ // The buffer argument comes last so that the stack layout in the
+ // invoker would be as similar as possible to the one expected by the
+ // target (with the assumption of a cdecl-like right-to-left argument
+ // order).
+ // (25.10.2010.) (Domagoj Saric)
+ static R free_invoke( BOOST_FUNCTION_PARMS BOOST_FUNCTION_COMMA function_buffer & buffer )
{
// We provide the invoker with a manager with a minimum amount of
// type information (because it already knows the stored function
@@ -100,7 +106,7 @@
R bound_invoke( BOOST_FUNCTION_PARMS )
{
- return free_invoke( buffer BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS );
+ return free_invoke( BOOST_FUNCTION_ARGS BOOST_FUNCTION_COMMA buffer );
}
};
@@ -112,7 +118,7 @@
>
struct BOOST_FUNCTION_VOID_FUNCTION_OBJ_INVOKER : public function_buffer_holder
{
- static BOOST_FUNCTION_VOID_RETURN_TYPE free_invoke( function_buffer & buffer BOOST_FUNCTION_COMMA BOOST_FUNCTION_PARMS )
+ static BOOST_FUNCTION_VOID_RETURN_TYPE free_invoke( BOOST_FUNCTION_PARMS BOOST_FUNCTION_COMMA function_buffer & buffer )
{
// See the above comments for the non-void invoker.
FunctionObj & functionObject( *static_cast<FunctionObj *>( static_cast<void *>( FunctionObjManager::functor_ptr( buffer ) ) ) );
@@ -121,7 +127,7 @@
BOOST_FUNCTION_VOID_RETURN_TYPE bound_invoke( BOOST_FUNCTION_PARMS )
{
- BOOST_FUNCTION_RETURN( free_invoke( buffer BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS ) );
+ BOOST_FUNCTION_RETURN( free_invoke( BOOST_FUNCTION_ARGS BOOST_FUNCTION_COMMA ) );
}
};
} // end namespace function
@@ -468,8 +474,8 @@
result_type do_invoke( BOOST_FUNCTION_PARMS BOOST_FUNCTION_COMMA mpl::false_ /*free call*/ ) const
{
- typedef result_type (* invoker_type)(detail::function::function_buffer & BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS);
- return get_vtable().invoker<invoker_type>()( functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS );
+ typedef result_type (* invoker_type)( BOOST_FUNCTION_TEMPLATE_ARGS BOOST_FUNCTION_COMMA detail::function::function_buffer & );
+ return get_vtable().invoker<invoker_type>()( BOOST_FUNCTION_ARGS BOOST_FUNCTION_COMMA functor );
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk