homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vladris
Recipients Abraham.Soedjito, cgohlke, jwhitecl, santoso.wijaya, theller, vladris
Date 2011年08月14日.20:46:19
SpamBayes Score 1.7434155e-09
Marked as misclassified No
Message-id <1313354780.62.0.95129727948.issue11835@psf.upfronthosting.co.za>
In-reply-to
Content
Attached patch for this issue.
This only happens on MSVC x64 (I actually tired to repro on Arch Linux x64 before starting work on it and it didn't repro).
What happens is that MSVC on x64 always passes structures larger than 8 bytes by reference. See here: http://msdn.microsoft.com/en-us/library/ms235286(v=vs.90).aspx
Now this was accounted for in callproc.c, line 1143 in development branch with this:
 if (atypes[i]->type == FFI_TYPE_STRUCT
#ifdef _WIN64
 && atypes[i]->size <= sizeof(void *)
#endif
 )
 avalues[i] = (void *)args[i].value.p;
 else
 avalues[i] = (void *)&args[i].value;
This fix wasn't made in libffi_msvc/ffi.c though. Here, regardless of whether we have x64 or x86 build, if z >= sizeof(int) we will hit else branch in libffi_msvc/ffi.c at line 114 and do:
 else
	{
	 memcpy(argp, *p_argv, z);
	}
 p_argv++;
 argp += z;
In our case, we copy 28 bytes as arguments (size of our structure) but in fact for x64 we only need 8 as structure is passed by reference so argument is just a pointer. My patch will adjust z before hitting if statement on x64 and it will cause correct copy as pointer.
History
Date User Action Args
2011年08月14日 20:46:20vladrissetrecipients: + vladris, theller, cgohlke, santoso.wijaya, Abraham.Soedjito, jwhitecl
2011年08月14日 20:46:20vladrissetmessageid: <1313354780.62.0.95129727948.issue11835@psf.upfronthosting.co.za>
2011年08月14日 20:46:20vladrislinkissue11835 messages
2011年08月14日 20:46:19vladriscreate

AltStyle によって変換されたページ (->オリジナル) /