Patchwork [libjava] : Fix for PR libgcj/50053

login
register
mail settings
Submitter Kai Tietz
Date Dec. 10, 2011, 12:05 p.m.
Message ID <CAEwic4a7n9GTWh5xRU85uBika26i_BMxrnZ9uS60DEOZq1Hq-w@mail.gmail.com>
Download mbox | patch
Permalink /patch/130519/
State New
Headers show

Comments

Kai Tietz - Dec. 10, 2011, 12:05 p.m.
Hi,

this patch addresses ABI change about class-member-functions for
32-bit IA Windows native target.  For
it the calling-convention is now __thiscall, as described by
manufactor's ABI description.

ChangeLog

2011-12-10  Kai Tietz  <ktietz@redhat.com>

	PR libgcj/50053
	* java/lang/natClass.cc (java::lang::Class::newInstance): Special case
	member-call for 32-bit IA native Window target.

Tested by user, and I did a regression test for
x86_64-unknown-linux-gnu for it. Ok for apply?

Regards,
Kai
Andreas Schwab - Dec. 10, 2011, 12:10 p.m.
Kai Tietz <ktietz70@googlemail.com> writes:

> +  /* Class constructor/destructor have for 32-bit native Windows ABI
> +     __thiscall calling convention.  */

     /* Class constructors/destructors have __thiscall calling
        convention for 32-bit native Windows ABI.  */

Andreas.
Andrew Haley - Dec. 12, 2011, 10:07 a.m.
On 12/10/2011 12:05 PM, Kai Tietz wrote:
> 2011-12-10  Kai Tietz  <ktietz@redhat.com>
> 
> 	PR libgcj/50053
> 	* java/lang/natClass.cc (java::lang::Class::newInstance): Special case
> 	member-call for 32-bit IA native Window target.

OK, thanks.

Andrew.

Patch

Index: natClass.cc
===================================================================
--- natClass.cc (revision 182092)
+++ natClass.cc (working copy)
@@ -661,7 +661,13 @@ 
     throw new java::lang::InstantiationException (getName());

   jobject r = _Jv_AllocObject (this);
+  /* Class constructor/destructor have for 32-bit native Windows ABI
+     __thiscall calling convention.  */
+#if defined (__MINGW32__) && defined (__i386__)
+  ((void (__thiscall *) (jobject)) meth->ncode) (r);
+#else
   ((void (*) (jobject)) meth->ncode) (r);
+#endif
   return r;
 }