Commit Graph

90 Commits

Author SHA1 Message Date
Alan Modra c57173b69a [RS6000] Correct powerpc sysv stack argument accounting
ppc32 starts using the stack for integer arg passing when we run out
of integer arg passing registers.  Similarly, we start using the stack
for floating point args when we run out of floating point registers.
The decision on where an integer arg goes does not depend on number of
floating point args, nor does the decision on where a floating point
arg goes depend on number of integer args.  Alignment of stack args
also simply depends on number of stack args.

This patch untangles the horrible mess we had, with intarg_count being
wrongly used to count both integer args and stack words.

	* src/powerpc/ffi_sysv.c (ffi_prep_cif_sysv_core): Count fprs,
	gprs, and stack words separately.
	(ffi_prep_args_SYSV): Similarly.

From-SVN: r228307
2015-10-01 06:59:00 +09:30
Richard Henderson b1760f7f91 Merge libffi to upstream commit c82cc159426d8d4402375fa1ae3f045b9cf82e16
From-SVN: r219477
2015-01-12 08:19:59 -08:00
Jakub Jelinek 1138382be4 linux64.S: Emit .note.GNU-stack even when POWERPC64 is not defined.
* src/powerpc/linux64.S: Emit .note.GNU-stack even when
	POWERPC64 is not defined.
	* src/powerpc/linux64_closure.S: Likewise.  Also test _CALL_ELF == 2.

From-SVN: r215155
2014-09-11 11:03:49 +02:00
Alan Modra e73d2479dd ffitarget.h: Import from upstream.
* src/powerpc/ffitarget.h: Import from upstream.
	* src/powerpc/ffi_powerpc.h: Likewise.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffi_sysv.c: Likewise.
	* src/powerpc/ffi_linux64.c: Likewise.
	* src/powerpc/sysv.S: Likewise.
	* src/powerpc/ppc_closure.S: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/types.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add new src/powerpc files.
	(nodist_libffi_la_SOURCES <POWERPC, POWERPC_FREEBSD>): Likewise.
	* configure.ac (HAVE_LONG_DOUBLE_VARIANT): Define for powerpc.
	* include/ffi.h.in (ffi_prep_types): Declare.
	* src/prep_cif.c (ffi_prep_cif_core): Call ffi_prep_types.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* Makefile.in: Regenerate.
	* man/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r205844
2013-12-10 11:12:14 +10:30
Alan Modra fd4da58cd8 ppc_closure.S: Don't bl .Luint128.
* src/powerpc/ppc_closure.S: Don't bl .Luint128.

From-SVN: r204918
2013-11-18 01:14:03 +10:30
Alan Modra 3521ba8b2e PowerPC64 ELFv2 support
PowerPC64 ELFv2 support
	* src/powerpc/ffitarget.h: Import from upstream.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/linux64_closure.S: Likewise.
	* doc/libffi.texi: Likewise.
	* testsuite/libffi.call/cls_double_va.c: Likewise.
	* testsuite/libffi.call/cls_longdouble_va.c: Likewise.

From-SVN: r204917
2013-11-18 01:05:08 +10:30
Alan Modra 40b45a6d76 ffi.c (ffi_prep_args_SYSV): Move var declaration before statements.
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
	before statements.
	(ffi_prep_args64): Support little-endian.
	(ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Likewise.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

From-SVN: r200383
2013-06-25 09:38:47 +09:30
Andreas Tobler 8f093ea0b1 ffi.c (ffi_prep_cif_machdep): Fix case where DOUBLE equal LONGDOUBLE.
2013-02-06  Andreas Tobler  <andreast@fgznet.ch>

        * src/powerpc/ffi.c (ffi_prep_cif_machdep): Fix case where
        DOUBLE equal LONGDOUBLE.

From-SVN: r195812
2013-02-06 18:32:41 +01:00
Anthony Green b4b575ce78 libffi merge
From-SVN: r194722
2012-12-26 16:28:02 +00:00
Alan Modra 7054d980c1 linux64_closure.S: Add new ABI support.
* src/powerpc/linux64_closure.S: Add new ABI support.
	* src/powerpc/linux64.S: Likewise.

From-SVN: r193015
2012-10-31 14:15:34 +10:30
Peter Bergner efe2a4b70e ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Declare double_tmp.
	Silence casting pointer to integer of different size warning.
	Delete goto to previously deleted label.
	(ffi_call): Silence possibly undefined warning.
	(ffi_closure_helper_SYSV): Declare variable type.

From-SVN: r186091
2012-04-02 13:29:22 -05:00
David Edelsohn 935a74eea2 aix_closure.S (ffi_closure_ASM): Adjust for Darwin64 change to return value of ffi_closure_helper_DARWIN and...
* src/powerpc/aix_closure.S (ffi_closure_ASM): Adjust for Darwin64
        change to return value of ffi_closure_helper_DARWIN and load type
        from return type.

From-SVN: r185152
2012-03-09 14:51:54 -05:00
Anthony Green 34fa7690ac Merge upstream libffi
From-SVN: r184897
2012-03-04 21:11:09 +00:00
Iain Sandoe b90c2c4c0b re PR libffi/49594 (bootstrap failure in libffi:darwin_closure for powerpc-darwin8)
PR libffi/49594
	* src/powerpc/darwin_closure.S (stubs): Make the stub binding
	helper reference track the architecture pointer size.

From-SVN: r178512
2011-09-04 19:19:39 +00:00
Iain Sandoe 3a9f56e8c8 re PR libffi/29152 (64-bit darwin ppc port needed for libffi)
libffi:
	PR libffi/29152
	PR libffi/42378
	* src/powerpc/darwin_closure.S: Provide Darwin64 implementation,
	update comments.
	* src/powerpc/ffitarget.h (POWERPC_DARWIN64): New,
	(FFI_TRAMPOLINE_SIZE): Update for Darwin64.
	* src/powerpc/darwin.S: Provide Darwin64 implementation,
	update comments.
	* src/powerpc/ffi_darwin.c: Likewise.

From-SVN: r168016
2010-12-18 08:56:46 +00:00
Dan Witte 7862d49629 Remove warnings
From-SVN: r162959
2010-08-06 20:05:33 +00:00
Dan Horák 3d420bdf4d Define libffi macros carefully
From-SVN: r162945
2010-08-06 12:26:52 +00:00
David Edelsohn 72b79d3945 ffi_darwin.c (ffi_prep_args): Copy abi and nargs to local variables.
* src/powerpc/ffi_darwin.c (ffi_prep_args): Copy abi and nargs to
        local variables.
        (aix_adjust_aggregate_sizes): New function.
        (ffi_prep_cif_machdep): Call it.

From-SVN: r155492
2009-12-28 13:19:18 -05:00
Andreas Schwab 302486f4fb ffi.c (ffi_prep_args_SYSV): Advance intarg_count when a float arguments is passed in memory.
* src/powerpc/ffi.c (ffi_prep_args_SYSV): Advance intarg_count
when a float arguments is passed in memory.
(ffi_closure_helper_SYSV): Mark general registers as used up when
a 64bit or soft-float long double argument is passed in memory.

From-SVN: r155473
2009-12-26 12:40:27 +00:00
David Edelsohn 9e7e65a08b aix_closure.S (libffi_closure_ASM): Fix tablejump typo.
* src/powerpc/aix_closure.S (libffi_closure_ASM): Fix tablejump
        typo.

From-SVN: r155070
2009-12-07 19:41:10 -05:00
David Edelsohn 5d7fc9412c aix.S: Update AIX32 code to be consistent with AIX64 code.
* src/powerpc/aix.S: Update AIX32 code to be consistent with AIX64
        code.
        * src/powerpc/aix_closure.s: Same.

From-SVN: r155016
2009-12-05 16:48:58 -05:00
David Edelsohn 2f2d73866b aix_closure.S: Reorganize 64-bit code to match linux64_closure.S.
* src/powerpc/aix_closure.S: Reorganize 64-bit code to match
        linux64_closure.S.

From-SVN: r155001
2009-12-04 17:24:05 -05:00
David Edelsohn 0c5526222c ffi_darwin.c (ffi_closure_helper_DARWIN): Increment pfr for long double split between fpr13 and stack.
* src/powerpc/ffi_darwin.c (ffi_closure_helper_DARWIN): Increment
        pfr for long double split between fpr13 and stack.

From-SVN: r154983
2009-12-04 10:36:50 -05:00
David Edelsohn afb5e62297 ffi_darwin.c (ffi_prep_args): Increment next_arg and fparg_count twice for long double.
* src/powerpc/ffi_darwin.c (ffi_prep_args): Increment next_arg and
        fparg_count twice for long double.

From-SVN: r154967
2009-12-03 22:43:40 -05:00
David Edelsohn be311914b8 re PR libffi/42243 (powerpc-apple-darwin9 libffi failures)
PR libffi/42243
        * src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses.

From-SVN: r154956
2009-12-03 14:09:29 -05:00
David Edelsohn 7837c24708 ffi_darwin.c (ffi_prep_args): Fix typo in INT64 case.
* src/powerpc/ffi_darwin.c (ffi_prep_args): Fix typo in INT64
        case.

From-SVN: r154932
2009-12-02 20:32:21 -05:00
David Edelsohn 6d518d3b72 aix.S (ffi_call_AIX): Convert to more standard register usage.
* src/powerpc/aix.S (ffi_call_AIX): Convert to more standard
        register usage.  Call ffi_prep_args directly.  Add long double
        return value support.
        * src/powerpc/ffi_darwin.c (ffi_prep_args): Double arg increment
        applies to FFI_TYPE_DOUBLE.  Correct fpr_base increment typo.
        Separate FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases.
        (ffi_prep_cif_machdep): Only 16 byte stack alignment in 64 bit
        mode.
        (ffi_closure_helper_DARWIN): Remove nf and ng counters.  Move temp
        into case.
        * src/powerpc/aix_closure.S: Maintain 16 byte stack alignment.
        Allocate result area between params and FPRs.

From-SVN: r154892
2009-12-01 23:21:08 -05:00
David Edelsohn 5751cf6fef re PR libffi/35484 (libffi doesn't support AIX 64bit)
2009-11-30  David Edelsohn  <edelsohn@gnu.org>

        PR target/35484
        * src/powerpc/ffitarget.h (POWERPC64): Define for PPC64 Linux and
        AIX64.
        * src/powerpc/aix.S: Implement AIX64 version.
        * src/powerpc/aix_closure.S: Implement AIX64 version.
        (ffi_closure_ASM): Use extsb, lha and displament addresses.
        * src/powerpc/ffi_darwin.c (ffi_prep_args): Implement AIX64
        support.
        (ffi_prep_cif_machdep): Same.
        (ffi_call): Same.
        (ffi_closure_helper_DARWIN): Same.

From-SVN: r154855
2009-11-30 18:34:33 -05:00
Wim Lewis 6975f17fe7 ffi.c: Avoid clobbering cr3 and cr4, which are supposed to be callee-saved.
2009-06-16  Wim Lewis  <wiml@hhhh.org>

	* src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are
	supposed to be callee-saved.
	* src/powerpc/sysv.S (small_struct_return_value): Fix overrun of
	return buffer for odd-size structs.

From-SVN: r148543
2009-06-16 19:55:39 +02:00
Andrew Haley 7446546ab0 [multiple changes]
2009-06-04  Andrew Haley  <aph@redhat.com>

	* src/powerpc/ppc_closure.S: Insert licence header.
	* src/powerpc/linux64_closure.S: Likewise.
	* src/m68k/sysv.S: Likewise.

	* src/sh64/ffi.c: Change void (*)() to void (*)(void).
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffi_darwin.c: Likewise.
	* src/m32r/ffi.c: Likewise.
	* src/sh64/ffi.c: Likewise.
	* src/x86/ffi64.c: Likewise.
	* src/alpha/ffi.c: Likewise.
	* src/alpha/osf.S: Likewise.
	* src/frv/ffi.c: Likewise.
	* src/s390/ffi.c: Likewise.
	* src/pa/ffi.c: Likewise.
	* src/pa/hpux32.S: Likewise.
	* src/ia64/unix.S: Likewise.
	* src/ia64/ffi.c: Likewise.
	* src/sparc/ffi.c: Likewise.
	* src/mips/ffi.c: Likewise.
	* src/sh/ffi.c: Likewise.

2008-02-15  David Daney  <ddaney@avtrex.com>

        * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE):
        Define (conditionally), and use it to include cachectl.h.
        (ffi_prep_closure_loc): Fix cache flushing.
        * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define.

From-SVN: r148172
2009-06-04 15:43:03 +00:00
Andrew Haley 5f933ef0d8 2009-06-04 Andrew Haley <aph@redhat.com>
include/ffi.h.in,
        src/arm/ffitarget.h,
        src/arm/ffi.c,
        src/arm/sysv.S,
        src/powerpc/ffitarget.h,
        src/closures.c,
        src/sh64/ffitarget.h,
        src/sh64/ffi.c,
        src/sh64/sysv.S,
        src/types.c,
        src/x86/ffi64.c,
        src/x86/ffitarget.h,
        src/x86/win32.S,
        src/x86/darwin.S,
        src/x86/ffi.c,
        src/x86/sysv.S,
        src/x86/unix64.S,
        src/alpha/ffitarget.h,
        src/alpha/ffi.c,
        src/alpha/osf.S,
        src/m68k/ffitarget.h,
        src/frv/ffitarget.h,
        src/frv/ffi.c,
        src/s390/ffitarget.h,
        src/s390/sysv.S,
        src/cris/ffitarget.h,
        src/pa/linux.S,
        src/pa/ffitarget.h,
        src/pa/ffi.c,
        src/raw_api.c,
        src/ia64/ffitarget.h,
        src/ia64/unix.S,
        src/ia64/ffi.c,
        src/ia64/ia64_flags.h,
        src/java_raw_api.c,
        src/debug.c,
        src/sparc/v9.S,
        src/sparc/ffitarget.h,
        src/sparc/ffi.c,
        src/sparc/v8.S,
        src/mips/ffitarget.h,
        src/mips/n32.S,
        src/mips/o32.S,
        src/mips/ffi.c,
        src/prep_cif.c,
        src/sh/ffitarget.h,
        src/sh/ffi.c,
        src/sh/sysv.S: Update license text.

From-SVN: r148171
2009-06-04 15:11:12 +00:00
Andreas Tobler d7f68a672e ffitarget.h (ffi_abi): Add FFI_LINUX and FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
2008-08-25  Andreas Tobler  <a.tobler@schweiz.org>

	* src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and
	FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum.
	Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT.
	Adjust copyright notice.
	* src/powerpc/ffi.c: Add two new flags to indicate if we have one
	register or two register to use for FFI_SYSV structs.
	(ffi_prep_cif_machdep): Pass the right register flag introduced above.
	(ffi_closure_helper_SYSV): Fix the return type for
	FFI_SYSV_TYPE_SMALL_STRUCT. Comment.
	Adjust copyright notice.

From-SVN: r139567
2008-08-25 20:35:20 +02:00
Matthias Klose feb5153085 [multiple changes]
2008-03-26  Daniel Jacobowitz  <dan@debian.org>

        * src/arm/sysv.S: Fix ARM comment marker.

2008-03-26  Jakub Jelinek  <jakub@redhat.com>

        * src/alpha/osf.S: Add .note.GNU-stack on Linux.
        * src/s390/sysv.S: Likewise.
        * src/powerpc/ppc_closure.S: Likewise.
        * src/powerpc/sysv.S: Likewise.
        * src/x86/unix64.S: Likewise.
        * src/x86/sysv.S: Likewise.
        * src/sparc/v8.S: Likewise.
        * src/sparc/v9.S: Likewise.
        * src/m68k/sysv.S: Likewise.
        * src/arm/sysv.S: Likewise.

From-SVN: r133594
2008-03-26 08:24:42 +00:00
Andreas Tobler 162871481a re PR libffi/31937 (libffi doesn't support ppc without FPU)
2007-12-01  Andreas Tobler  <a.tobler@schweiz.org>

	PR libffi/31937
	* src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT.
	Add local FFI_TYPE_UINT128 to handle soft-float long-double-128.
	* src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and
	set the NUM_FPR_ARG_REGISTERS according to.
	Add support for potential soft-float support under hard-float
	architecture.
	(ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of
	FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according
	to the FFI_LINUX_SOFT_FLOAT ABI.
	(ffi_prep_cif_machdep): Likewise.
	(ffi_closure_helper_SYSV): Likewise.
	* src/powerpc/ppc_closure.S: Make sure not to store float/double
	on archs where __NO_FPRS__ is true.
	Add FFI_TYPE_UINT128 support.
	* src/powerpc/sysv.S: Add support for soft-float long-double-128.
	Adjust copyright notice.

From-SVN: r130559
2007-12-01 22:00:04 +01:00
Andreas Tobler e84296c66c sysv.S: Load correct cr to compare if we have long double.
2007-11-17  Andreas Tobler  <a.tobler@schweiz.org>

	* src/powerpc/sysv.S: Load correct cr to compare if we have long double.
	* src/powerpc/linux64.S: Likewise.
	* src/powerpc/ffi.c: Add a comment to show which part goes into cr6.
	* testsuite/libffi.call/return_ldl.c: New test.

From-SVN: r130247
2007-11-17 00:24:53 +01:00
Alexandre Oliva 8b9cf39ead ffi.c (flush_icache): Fix left-over from previous patch.
* src/powerpc/ffi.c (flush_icache): Fix left-over from previous
patch.
(ffi_prep_closure_loc): Remove unneeded casts.  Add needed ones.

From-SVN: r122692
2007-03-08 11:06:41 +00:00
Alexandre Oliva 18fa3240db ffi.h.in (ffi_closure_alloc, [...]): New.
libffi/ChangeLog:
* include/ffi.h.in (ffi_closure_alloc, ffi_closure_free): New.
(ffi_prep_closure_loc): New.
(ffi_prep_raw_closure_loc): New.
(ffi_prep_java_raw_closure_loc): New.
* src/closures.c: New file.
* src/dlmalloc.c [FFI_MMAP_EXEC_WRIT] (struct malloc_segment):
Replace sflags with exec_offset.
[FFI_MMAP_EXEC_WRIT] (mmap_exec_offset, add_segment_exec_offset,
sub_segment_exec_offset): New macros.
(get_segment_flags, set_segment_flags, check_segment_merge): New
macros.
(is_mmapped_segment, is_extern_segment): Use get_segment_flags.
(add_segment, sys_alloc, create_mspace, create_mspace_with_base,
destroy_mspace): Use new macros.
(sys_alloc): Silence warning.
* Makefile.am (libffi_la_SOURCES): Add src/closures.c.
* Makefile.in: Rebuilt.
* src/prep_cif [FFI_CLOSURES] (ffi_prep_closure): Implement in
terms of ffi_prep_closure_loc.
* src/raw_api.c (ffi_prep_raw_closure_loc): Renamed and adjusted
from...
(ffi_prep_raw_closure): ... this.  Re-implement in terms of the
renamed version.
* src/java_raw_api (ffi_prep_java_raw_closure_loc): Renamed and
adjusted from...
(ffi_prep_java_raw_closure): ... this.  Re-implement in terms of
the renamed version.
* src/alpha/ffi.c (ffi_prep_closure_loc): Renamed from
(ffi_prep_closure): ... this.
* src/pa/ffi.c: Likewise.
* src/cris/ffi.c: Likewise.  Adjust.
* src/frv/ffi.c: Likewise.
* src/ia64/ffi.c: Likewise.
* src/mips/ffi.c: Likewise.
* src/powerpc/ffi_darwin.c: Likewise.
* src/s390/ffi.c: Likewise.
* src/sh/ffi.c: Likewise.
* src/sh64/ffi.c: Likewise.
* src/sparc/ffi.c: Likewise.
* src/x86/ffi64.c: Likewise.
* src/x86/ffi.c: Likewise.
(FFI_INIT_TRAMPOLINE): Adjust.
(ffi_prep_raw_closure_loc): Renamed and adjusted from...
(ffi_prep_raw_closure): ... this.
* src/powerpc/ffi.c (ffi_prep_closure_loc): Renamed from
(ffi_prep_closure): ... this.
(flush_icache): Adjust.
boehm-gc/ChangeLog:
* include/gc.h (GC_REGISTER_FINALIZER_UNREACHABLE): New.
(GC_register_finalizer_unreachable): Declare.
(GC_debug_register_finalizer_unreachable): Declare.
* finalize.c (GC_unreachable_finalize_mark_proc): New.
(GC_register_finalizer_unreachable): New.
(GC_finalize): Handle it.
* dbg_mlc.c (GC_debug_register_finalizer_unreachable): New.
(GC_debug_register_finalizer_no_order): Fix whitespace.
libjava/ChangeLog:
* include/jvm.h (_Jv_ClosureListFinalizer): New.
(_Jv_Linker::create_error_method): Adjust.
* boehm.cc (_Jv_ClosureListFinalizer): New.
* nogc.cc (_Jv_ClosureListFinalizer): New.
* java/lang/Class.h (class _Jv_ClosureList): New.
(class java::lang::Class): Declare it as friend.
* java/lang/natClass.cc (_Jv_ClosureList::releaseClosures): New.
(_Jv_ClosureList::registerClousure): New.
* include/execution.h (_Jv_ExecutionEngine): Add get_closure_list.
(_Jv_CompiledEngine::do_get_closure_list): New.
(_Jv_CompiledEngine::_Jv_CompiledEngine): Use it.
(_Jv_IndirectCompiledClass): Add closures.
(_Jv_IndirectCompiledEngine::get_aux_info): New.
(_Jv_IndirectCompiledEngine::do_allocate_field_initializers): Use
it.
(_Jv_IndirectCompiledEngine::do_get_closure_list): New.
(_Jv_IndirectCompiledEngine::_Jv_IndirectCompiledEngine): Use it.
(_Jv_InterpreterEngine::do_get_closure_list): Declare.
(_Jv_InterpreterEngine::_Jv_InterpreterEngine): Use it.
* interpret.cc (FFI_PREP_RAW_CLOSURE): Use _loc variants.
(node_closure): Add closure list.
(_Jv_InterpMethod::ncode): Add jclass argument.  Use
ffi_closure_alloc and the separate code pointer.  Register the
closure for finalization.
(_Jv_JNIMethod::ncode): Likewise.
(_Jv_InterpreterEngine::do_create_ncode): Pass klass to ncode.
(_Jv_InterpreterEngine::do_get_closure_list): New.
* include/java-interp.h (_Jv_InterpMethod::ncode): Adjust.
(_Jv_InterpClass): Add closures field.
(_Jv_JNIMethod::ncode): Adjust.
* defineclass.cc (_Jv_ClassReader::handleCodeAttribute): Adjust.
(_Jv_ClassReader::handleMethodsEnd): Likewise.
* link.cc (struct method_closure): Add closure list.
(_Jv_Linker::create_error_method): Add jclass argument.  Use
ffi_closure_alloc and the separate code pointer.  Register the
closure for finalization.
(_Jv_Linker::link_symbol_table): Remove outdated comment about
sharing of otable and atable.  Adjust.
* java/lang/reflect/natVMProxy.cc (ncode_closure): Add closure
list.
(ncode): Add jclass argument.  Use ffi_closure_alloc and the
separate code pointer.  Register the closure for finalization.
(java::lang::reflect::VMProxy::generateProxyClass): Adjust.
* testsuite/libjava.jar/TestClosureGC.java: New.
* testsuite/libjava.jar/TestClosureGC.out: New.
* testsuite/libjava.jar/TestClosureGC.xfail: New.
* testsuite/libjava.jar/TestClosureGC.jar: New.

From-SVN: r122652
2007-03-07 07:27:25 +00:00
Jakub Jelinek 8aaf4681da linux64.S (ffi_call_LINUX64): Move restore of r2 immediately after bctrl instruction.
* src/powerpc/linux64.S (ffi_call_LINUX64): Move restore of r2
	immediately after bctrl instruction.

From-SVN: r121498
2007-02-02 13:28:27 +01:00
Geoffrey Keating 58182de357 In gcc/: PR 23067
In gcc/:
	PR 23067
	* c-decl.c (start_struct): Don't create self-containing
	structures.
	* config/rs6000/rs6000.c (darwin_rs6000_special_round_type_align):
	New.
	* config/rs6000/rs6000-protos.h
	(darwin_rs6000_special_round_type_align): New.
	* config/rs6000/darwin.h (ADJUST_FIELD_ALIGN): Rewrite.
	(ROUND_TYPE_ALIGN): Use darwin_rs6000_special_round_type_align.
In gcc/testsuite/:
	PR 23067
	* gcc.target/powerpc/darwin-abi-3.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-6.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-7.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-8.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-9.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-10.c: Remove XFAIL.
	* gcc.target/powerpc/darwin-abi-11.c: Remove XFAIL.
In libobjc/:
	* encoding.c (darwin_rs6000_special_round_type_align): New.
In libffi/:
	* src/powerpc/ffi_darwin.c (darwin_adjust_aggregate_sizes): New.
	(ffi_prep_cif_machdep): Call darwin_adjust_aggregate_sizes for
	Darwin.
	* testsuite/libffi.call/nested_struct4.c: Remove Darwin XFAIL.
	* testsuite/libffi.call/nested_struct6.c: Remove Darwin XFAIL.

From-SVN: r118365
2006-11-01 05:28:41 +00:00
Andreas Tobler ac6ed182ed README: Remove notice about 'Crazy Comments'.
2006-04-22  Andreas Tobler  <a.tobler@schweiz.ch>

	* README: Remove notice about 'Crazy Comments'.
	* src/debug.c: Remove lint directives. Cleanup white spaces.
	* src/java_raw_api.c: Likewise.
	* src/prep_cif.c: Likewise.
	* src/raw_api.c: Likewise.
	* src/ffitest.c: Delete. No longer needed, all test cases migrated
	to the testsuite.
	* src/arm/ffi.c: Remove lint directives.
	* src/m32r/ffi.c: Likewise.
	* src/pa/ffi.c: Likewise.
	* src/powerpc/ffi.c: Likewise.
	* src/powerpc/ffi_darwin.c: Likewise.
	* src/sh/ffi.c: Likewise.
	* src/sh64/ffi.c: Likewise.
	* src/x86/ffi.c: Likewise.
	* testsuite/libffi.call/float2.c: Likewise.
	* testsuite/libffi.call/promotion.c: Likewise.
	* testsuite/libffi.call/struct1.c: Likewise.

From-SVN: r113181
2006-04-22 23:17:35 +02:00
Alan Modra 75b8b1becb ffitarget.h (enum ffi_abi): Add FFI_LINUX.
* src/powerpc/ffitarget.h (enum ffi_abi): Add FFI_LINUX.  Default
	for 32-bit using IBM extended double format.  Fix FFI_LAST_ABI.
	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Handle linux variant of
	FFI_TYPE_LONGDOUBLE.
	(ffi_prep_args64): Assert using IBM extended double.
	(ffi_prep_cif_machdep): Don't munge FFI_TYPE_LONGDOUBLE type.
	Handle FFI_LINUX FFI_TYPE_LONGDOUBLE return and args.
	(ffi_call): Handle FFI_LINUX.
	(ffi_closure_helper_SYSV): Non FFI_LINUX long double return needs
	gpr3 return pointer as for struct return.  Handle FFI_LINUX
	FFI_TYPE_LONGDOUBLE return and args.  Don't increment "nf"
	unnecessarily.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Load both f1 and f2
	for FFI_TYPE_LONGDOUBLE.  Move epilogue insns into case table.
	Don't use r6 as pointer to results, instead use sp offset.  Don't
	make a special call to load lr with case table address, instead
	use offset from previous call.
	* src/powerpc/sysv.S (ffi_call_SYSV): Save long double return.
	* src/powerpc/linux64.S (ffi_call_LINUX64): Simplify long double
	return.

From-SVN: r112340
2006-03-24 09:45:46 +10:30
Jakub Jelinek 71aa1a7029 sysv.S (smst_two_register): Don't call __ashldi3, instead do the shifting inline.
* src/powerpc/sysv.S (smst_two_register): Don't call __ashldi3,
	instead do the shifting inline.
	* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't compute %r5
	shift count unconditionally.  Simplify load sequences for 1, 2, 3, 4
	and 8 byte structs, for the remaining struct sizes don't call
	__lshrdi3, instead do the shifting inline.

From-SVN: r109879
2006-01-18 09:04:52 +01:00
Alan Modra cd4241aa71 ffi.c: Formatting.
* src/powerpc/ffi.c: Formatting.
	(ffi_prep_args_SYSV): Avoid possible aliasing problems by using unions.
	(ffi_prep_args64): Likewise.

From-SVN: r107963
2005-12-03 10:36:33 +10:30
Tom Tromey d674eb2f5c float1.c (value_type): New typedef.
* testsuite/libffi.call/float1.c (value_type): New typedef.
	(CANARY): New define.
	(main): Check for result buffer overflow.
	* src/powerpc/linux64.S: Handle linux64 long double returns.
	* src/powerpc/ffi.c (FLAG_RETURNS_128BITS): New constant.
	(ffi_prep_cif_machdep): Handle linux64 long double returns.

From-SVN: r104660
2005-09-26 19:56:22 +00:00
Alan Modra 2d9c5743d6 re PR target/23404 (gij trashes args of functions with more than 8 fp args)
PR target/23404
	* src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack
	homed fp args.
	(ffi_status ffi_prep_cif_machdep): Correct stack sizing for same.

From-SVN: r103462
2005-08-25 10:24:54 +09:30
Jakub Jelinek 8a42356f48 configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test.
* configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test.
	(AH_BOTTOM): Add FFI_HIDDEN definition.
	* configure: Rebuilt.
	* fficonfig.h.in: Rebuilt.
	* src/powerpc/ffi.c (hidden): Remove.
	(ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64,
	ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden.
	* src/powerpc/linux64_closure.S (ffi_closure_LINUX64,
	.ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden.
	* src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove,
	add FFI_HIDDEN to its prototype.
	(ffi_closure_SYSV_inner): New.
	* src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.
	* src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New.

From-SVN: r103002
2005-08-11 23:18:24 +02:00
Jakub Jelinek 6a26ea58f6 ppc_closure.S (ffi_closure_SYSV): Use DW_CFA_offset_extended_sf rather than DW_CFA_GNU_negative_offset_extended.
* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Use
	DW_CFA_offset_extended_sf rather than
	DW_CFA_GNU_negative_offset_extended.
	* src/powerpc/sysv.S (ffi_call_SYSV): Likewise.

From-SVN: r102900
2005-08-09 10:06:16 +02:00
Andreas Tobler 970676420b Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD.
2005-07-19  Andreas Tobler  <a.tobler@schweiz.ch>

	* Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD.
	* Makefile.in: Regenerate.
	* include/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.
	* configure.ac: Add POWERPC_FREEBSD rules.
	* configure: Regenerate.
	* src/powerpc/ffitarget.h: Add POWERPC_FREEBSD rules.
	(FFI_SYSV_TYPE_SMALL_STRUCT): Define.
	* src/powerpc/ffi.c: Add flags to handle small structure returns
	in ffi_call_SYSV.
	(ffi_prep_cif_machdep): Handle small structures for SYSV 4 ABI.
	Aka FFI_SYSV.
	(ffi_closure_helper_SYSV): Likewise.
	* src/powerpc/ppc_closure.S: Add return types for small structures.
	* src/powerpc/sysv.S: Add bits to handle small structures for
	final SYSV 4 ABI

From-SVN: r102174
2005-07-19 23:15:36 +02:00
Alan Modra 6d0d376c8f ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET to call ffi_closure_helper_SYSV.
* src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET
	to call ffi_closure_helper_SYSV.  Append @local instead.
	* src/powerpc/sysv.S (ffi_call_SYSV): Likewise for ffi_prep_args_SYSV.

From-SVN: r100416
2005-06-01 10:03:09 +09:30
Mike Stump 1488177afe darwin.S: Update for -m64 multilib.
* src/powerpc/darwin.S: Update for -m64 multilib.
        * src/powerpc/darwin_closure.S: Likewise.

From-SVN: r96967
2005-03-24 00:45:38 +00:00