Compare commits

...

537 Commits

Author SHA1 Message Date
Jeffrey A Law 884e7555f0 Remove support for using UWIN as a host machine.
* From Mark Mitchell:
        Remove support for using UWIN as a host machine.
        * configure.in: Issue an error message.  Remove xm_* UWIN configury.
        * configure: Regenerated.
        * config/i386/xm-uwin.h: Remove.

From-SVN: r39043
2001-01-15 10:00:55 -07:00
Jeff Law b493ddc4d3 Stamp ChangeLogs for release
From-SVN: r38098
2000-12-06 23:03:37 -07:00
Jeffrey A Law 1537770738 * version.c: Update for gcc-2.95.2.1 bugfix release.
From-SVN: r38097
2000-12-06 23:00:22 -07:00
Jeffrey A Law bd7c273f3e [multiple changes]
2000-10-11  Jakub Jelinek  <jakub@redhat.com>
        * iostream.cc (ostream::operator<<(double n)) [__GLIBC_MINOR__ >= 2]:
        Initialize new fields wide and i18n of struct printf_info.
        (ostream::operator<<(long double n)) [__GLIBC_MINOR__ >= 2]:
        Likewise.

        2000-09-23  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
        * stdstreams.cc: Include <libio.h>, not "libio.h".
        * iolibio.h: Likewise.
        (_IO_pos_BAD): Use _IO_off_t instead of _IO_fpos_t.
        * libio.h (_IO_USER_LOCK): Define.

       1999-12-13  Jakub Jelinek  <jakub@redhat.com>
        * libio.h (_IO_cookie_io_functions_t): Use _IO_off_t instead of
        _IO_fpos_t.
        (_IO_seekoff, _IO_seekpos): Likewise. Use _IO_off64_t instead of
        _IO_fpos64_t.
        * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t): Likewise.
        (_IO_seekoff, _IO_seekpos): Likewise.
        (_IO_default_seekoff, _IO_default_seekpos): Likewise.
        (_IO_default_seek): Likewise.
        (_IO_file_seekoff, _IO_file_seek, _IO_str_seekoff): Likewise.
        * streambuf.h (streampos): Typedef to _IO_off_t resp. _IO_off64_t.
        * parsestream.h (class parsebuf::pos_at_line_start): Change type
        to _IO_off_t.

From-SVN: r38096
2000-12-06 22:57:29 -07:00
No Author a1765e6f7a This commit was manufactured by cvs2svn to create branch
'gcc-2_95_2_1-branch'.

From-SVN: r30162
1999-10-25 07:23:49 +00:00
Jeff Law 6e0c258e5d Bring over various changes from the mainline sources.
From-SVN: r30160
1999-10-25 01:23:49 -06:00
Jeff Law e9198b8bad Stamp ChangeLogs for release
From-SVN: r30159
1999-10-25 00:59:16 -06:00
Jeff Law 1f01c837c0 prerelease -> release
From-SVN: r30158
1999-10-25 00:49:40 -06:00
Jeff Law 2becde0e74 Bump dates.
From-SVN: r30157
1999-10-25 00:46:05 -06:00
Jeffrey A Law 44430e4b65 loop.c (note_set_pseudo_multiple_uses_retval): New variable.
* loop.c (note_set_pseudo_multiple_uses_retval): New variable.
        (note_set_pseudo_multiple_uses): New function.
        (check_dbra_loop): Use not_set_pseudo_multiple_uses to determine
        if a pseudo set in the loop exit is used elsewhere.

From-SVN: r30156
1999-10-25 00:44:53 -06:00
Jeffrey A Law cb642a0dd6 toplev.c (main): Do not turn on strict aliasing by default.
* toplev.c (main): Do not turn on strict aliasing by default.
        * invoke.texi: Corresponding changes.
Branch patch only.  Heavy sigh.

From-SVN: r30115
1999-10-21 01:01:37 -06:00
Richard Earnshaw 8e76cd45cd * jump.c (jump_optimize_1): More accurately detect casesi insns.
From-SVN: r30114
1999-10-21 00:24:03 -06:00
Jeffrey A Law 396f7e1a0f sparc.md (movsf_const_intreg): If splitting, length must be > 1.
* sparc.md (movsf_const_intreg): If splitting, length must be > 1.
        (movdf_const_intreg_sp64): Similarly.

From-SVN: r30113
1999-10-20 23:35:40 -06:00
Jeffrey A Law 0ecba96618 local-alloc.c (update_equiv_regs): Check the correct insn for pre-existing REG_EQUIV notes.
* local-alloc.c (update_equiv_regs): Check the correct insn
        for pre-existing REG_EQUIV notes.
Fix the sparc tetex bug.

From-SVN: r30110
1999-10-20 22:59:40 -06:00
Jeff Law ab34d5f5c6 Bump dates.
From-SVN: r30083
1999-10-19 02:58:19 -06:00
Jeffrey A Law 233314e214 Revert this change. Gavin's patch to operand_equal_p is a better fix.
* fold-const.c (fold_range_test): Do not try to fold the range
        test if the rhs or lhs has side effects.

        Fri Sep 17 15:05:27 1999  Gavin Romig-Koch  <gavin@cygnus.com>
        * fold-const.c (operand_equal_p): Pay attention to side effects.

From-SVN: r30082
1999-10-19 02:40:05 -06:00
Jeffrey A Law e87b62d96d reg-stack.c (stack_result): Aggregates are not returned in stack registers.
* reg-stack.c (stack_result): Aggregates are not returned in
        stack registers.

From-SVN: r30079
1999-10-19 02:05:40 -06:00
Manfred Hollstein b7883a2432 * POTFILES.in: Track files recently added/deleted/moved.
From-SVN: r30065
1999-10-18 01:54:13 -06:00
Jeffrey A Law da0c310973 combine.c (get_last_value): If the last set of a register is after subst_low_cuid...
* combine.c (get_last_value): If the last set of a register
        is after subst_low_cuid, then we can not use it to determine
        the register's last value.

From-SVN: r30064
1999-10-18 01:52:32 -06:00
Jeffrey A Law 2aa437e3fb gcse.c (hash_expr_1): Add in MEM_ALIAS_SET.
Sat Oct 16 00:07:01 1999  Richard Henderson  <rth@cygnus.com>
        * gcse.c (hash_expr_1): Add in MEM_ALIAS_SET.
        (expr_equiv_p): Reject memories with different alias sets.

From-SVN: r30047
1999-10-16 15:20:32 -06:00
Jeffrey A Law ae698cc0e5 jvspec.c (jvgenmain_spec): Use `%umain', not just `%u'.
1999-10-14  Tom Tromey  <tromey@cygnus.com>
        * jvspec.c (jvgenmain_spec): Use `%umain', not just `%u'.

From-SVN: r30046
1999-10-16 15:18:28 -06:00
Jeffrey A Law 5a7fa3af1d configure.in (sparc-hal-solaris2*): Fix xm_file, xm_defines, float_format and thread_file definitions.
Wed Oct 13 01:44:29 1999  Carol LePage  <carolo@hal.com>
        * configure.in (sparc-hal-solaris2*): Fix xm_file, xm_defines,
        float_format and thread_file definitions.
        * configure: Rebuilt.

From-SVN: r29941
1999-10-13 01:58:02 -06:00
David Edelsohn 5f04f321f2 * collect2.c (main): Do preliminary link on AIX if rflag.
From-SVN: r29928
1999-10-12 17:16:52 -04:00
Jeffrey A Law ca47ce66e6 tlink.c (scan_linker_output): Skip the initial underscore in a mangled name if appropriate.
Fri Sep  3 09:14:32 1999  Marc Espie <espie@tetto.liafa.jussieu.fr>
        * tlink.c (scan_linker_output): Skip the initial underscore in
        a mangled name if appropriate.

From-SVN: r29915
1999-10-12 00:39:14 -06:00
Jeffrey A Law 3c4744ba5d Fri Aug 27 19:19:43 CEST 1999 Marc Espie <espie@cvs.openbsd.org>
Fri Aug 27 19:19:43 CEST 1999   Marc Espie <espie@cvs.openbsd.org>
        * config/openbsd.h (SET_ASM_OP): Define.

From-SVN: r29914
1999-10-12 00:34:49 -06:00
Jeffrey A Law 62b473787a cppinit.c (is_idchar initializer): Loosen tests to accept gcc 2.>6 and >2.
Mon Oct  4 08:54:12 1999  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
        * cppinit.c (is_idchar initializer): Loosen tests to accept
        gcc 2.>6 and >2.

From-SVN: r29913
1999-10-12 00:31:11 -06:00
Jeffrey A Law c397dffd89 parse.h: Undefine DELAY if it's defined.
Tue Sep  7 15:59:56 1999  Dave Brolley  <brolley@cygnus.com>
        * parse.h: Undefine DELAY if it's defined.

From-SVN: r29912
1999-10-12 00:24:41 -06:00
Jeffrey A Law 01a8adb57b pa.h (CPP_SPEC): Conditionally add -D__STDC_EXT__ to the cpp command line.
Tue Jun 29 01:37:53 1999  Jeffrey A Law  (law@cygnus.com)
        * pa.h (CPP_SPEC): Conditionally add -D__STDC_EXT__ to the cpp
        command line.

From-SVN: r29911
1999-10-11 23:51:42 -06:00
Jeffrey A Law c84a15b040 regmove.c (fixup_match_1): Don't change an unchanging register.
Thu Sep  2 20:08:23 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
        * regmove.c (fixup_match_1): Don't change an unchanging register.
        (stable_but_for_p): Renamed to:
        (stable_and_no_regs_but_for_p).  Reject unchanging registers too.
        Changed all callers.

From-SVN: r29910
1999-10-11 23:44:39 -06:00
Jeffrey A Law 8650dafc19 haifa-sched.c (insn_unit): Fix typo on out of range test.
Tue Aug 17 22:06:11 1999  Jan Hubicka  <hubicka@freesoft.cz>
        * haifa-sched.c (insn_unit): Fix typo on out of range test.
        * sched.c (insn_unit): Likewise.
Bring over from teh mainline sources.

From-SVN: r29909
1999-10-11 23:38:53 -06:00
David Edelsohn 6e6c09d918 rs6000.md (scc patterns): Disable most SImode variants if TARGET_POWERPC64.
* rs6000.md (scc patterns): Disable most SImode variants if
        TARGET_POWERPC64.
        * rs6000.c (expand_block_move): Fix gen_movsi typos.

        Thu Oct  7 23:06:50 1999  Richard Henderson  <rth@cygnus.com>
        * rs6000.md (fix_truncdfsi2_internal+1): Emit a clobber
        before the fctiwz insn.

        Thu Oct  7 00:36:17 1999  Diego Novillo  <dnovillo@cygnus.com>
        * config/rs6000/rs6000.c (secondary_reload_class): For TARGET_ELF
        make sure that HIGH instructions are copied into BASE_REGS.

From-SVN: r29896
1999-10-10 21:10:58 -04:00
Richard Earnshaw 2f47f01e3d c-lang.c (finish_file case ndef ASM_OUTPUT_{CON,DE}STRUCTOR): Correctly build argument list to constructor and destructor functions.
* c-lang.c (finish_file case ndef ASM_OUTPUT_{CON,DE}STRUCTOR):
Correctly build argument list to constructor and destructor functions.

From-SVN: r29729
1999-09-30 11:23:56 +00:00
David Edelsohn c9b1b678c4 rs6000.c (expand_block_move): DImode loads and stores require word-aligned displacements.
* rs6000.c (expand_block_move): DImode loads and stores require
	word-aligned displacements.  Increment address registers with
	adddi3 on 64-bit platform.  Use TARGET_POWERPC64 not TARGET_64BIT.

From-SVN: r29605
1999-09-22 18:22:25 -04:00
Alexandre Oliva ce7e825394 sol2.h (PREFERRED_DEBUGGING_TYPE): Use stabs.
* config/i386/sol2.h (PREFERRED_DEBUGGING_TYPE): Use stabs.
(ASM_SPEC): Moved from sol2dbg.h.  Added work-around for gas.
* config/i386/sol2dbg.h: Removed.
* config/i386/sol2gas.h: New file, to enable gas work-around.
* configure.in: Use i386/sol2gas.h on Solaris/x86 --with-gas.
Don't use sol2dbg.h.
* configure: Rebuilt.

From-SVN: r29585
1999-09-22 10:44:21 +00:00
No Author c15164cc43 This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r29584
1999-09-22 10:44:21 +00:00
Mark Mitchell 4a4ff2991c * c-typeck.c (qualify_type): Merge qualifiers from both types.
From-SVN: r29452
1999-09-16 04:17:52 +00:00
Scott Bambrough 01964d5617 define NO_IMPLICIT_EXTERN_C
From-SVN: r29430
1999-09-15 09:09:04 +00:00
David Edelsohn 8ba4326070 rs6000.h (ASM_FILE_START): Specify complete filename, including path, in .file directive.
* rs6000.h (ASM_FILE_START): Specify complete filename, including
        path, in .file directive.

From-SVN: r29174
1999-09-07 16:52:24 -04:00
Jeffrey A Law 907a26b876 fold-const.c (fold_range_test): Do not try to fold the range test if the rhs or lhs has side effects.
Thu Sep  2 00:06:43 1999  Jeffrey A Law  (law@cygnus.com)
        * fold-const.c (fold_range_test): Do not try to fold the range
        test if the rhs or lhs has side effects.

From-SVN: r29162
1999-09-07 02:25:56 -06:00
Jeffrey A Law 7559393d82 [multiple changes]
Sun Aug 29 03:27:23 1999  Scott Weikart <scott@igc.apc.org>
        * fix-header.c (main): Do not pass a null pointer to strcmp.

        Thu Aug 19 14:42:38 1999  Mike Stump <mrs@wrs.com>
                                  Mark Mitchell <mark@codesourcery.com>
        * c-common.c (c_get_alias_set): Fix support for poitners and
        references.

From-SVN: r29161
1999-09-07 02:11:16 -06:00
Mark Mitchell 1d6ec3528e pt.c (tsubst): Back out 1999-08-06 patch.
* pt.c (tsubst): Back out 1999-08-06 patch.  Use fold and
        decl_constant_value to simplify array bounds.

From-SVN: r29159
1999-09-07 01:52:06 -06:00
Jeffrey A Law a0f9fdb29b Fri Aug 27 01:03:48 1999 Jim Kingdon <http://developer.redhat.com> with much...
Fri Aug 27 01:03:48 1999  Jim Kingdon  <http://developer.redhat.com>
        with much help from Jeffrey A Law and Richard Henderson
        * i386.md: In the 6 insns which call output_fix_trunc,
        earlyclobber operands[0].

        Fri Aug 27 01:01:51 1999  Philip Blundell  <pb@nexus.co.uk>
        * jump.c (duplicate_loop_exit_test): Call reg_scan_update after
        creating new registers.

From-SVN: r29158
1999-09-07 01:45:42 -06:00
Jeffrey A Law d47ac78b9b cse.c (fold_rtx): Work around bug in Sun V5.0 compilers.
Fri Aug 27 15:35:24 1999  Jeffrey A Law  (law@cygnus.com)
        * cse.c (fold_rtx): Work around bug in Sun V5.0 compilers.
        * pa.c (emit_move_sequence): Do not stop on SUBREG_WORD of an
        operand.

        Tue Aug 31 11:51:06 1999  Jim Kingdon  <http://developer.redhat.com>
        * i386.c (output_strlen_unroll): Don't write xops[7]
        label if it wasn't set.

From-SVN: r29156
1999-09-07 01:38:56 -06:00
Jeffrey A Law 35d35f91e0 [multiple changes]
Fri Aug 27 09:36:17 1999  Andreas Schwab  <schwab@suse.de>
        * function.c (assign_stack_temp_for_type): Fix change of Mar 5 for
        the fact that ALIGN is measured in bits, not bytes.

        Wed Aug 25 14:00:18 1999  Jason Merrill  <jason@yorick.cygnus.com>
        * c-common.c (combine_strings): Always set TREE_CONSTANT.
Bring over a couple bugfixes to the gcc-2.95 branch.

From-SVN: r29155
1999-09-07 01:34:05 -06:00
Jeff Law b2bc9baf74 Bump to indicate pre-release status of the gcc-2.95 branch.
From-SVN: r29154
1999-09-07 01:27:08 -06:00
Jason Merrill 791bcb1c3e cp-tree.h: Declare flag_use_repository.
* cp-tree.h: Declare flag_use_repository.
	* pt.c (do_decl_instantiation): Don't complain about duplicate
	instantiation with -frepo.
	(do_type_instantiation): Likewise.

	* decl2.c (lookup_arg_dependent): Note that we've already checked
	the current namespace.

From-SVN: r28772
1999-08-19 19:29:45 -04:00
Jason Merrill 54171eb8e7 regen
From-SVN: r28771
1999-08-19 19:23:12 -04:00
David S. Miller 10205f210d sparc.c (sparc_block_profiler): Fix typo in Aug 2 change.
* config/sparc/sparc.c (sparc_block_profiler): Fix typo in Aug 2
	change.

From-SVN: r28746
1999-08-18 01:20:11 -07:00
Jeff Law df1c9ae94a Stamp ChangeLogs for release
From-SVN: r28721
1999-08-16 02:29:55 -06:00
Jeff Law e31f8ca15e Update version string for gcc-2.95.1 release.
From-SVN: r28720
1999-08-16 01:50:26 -06:00
Michael Meissner e0c65d5b4d * Makefile.in (GCC_FOR_TARGET): Move -B./ after the tooldir -B.
From-SVN: r28699
1999-08-13 01:46:55 -06:00
Jeffrey A Law f1eb2eb900 fixincludes: Fix the return type of bsearch, char* -> void*.
Tue Aug  3 00:03:41 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
        * fixincludes: Fix the return type of bsearch, char* -> void*.
        * fixinc/inclhack.def: Likewise.

From-SVN: r28697
1999-08-13 01:44:06 -06:00
Alexandre Oliva 4995d0ea76 dwarfout.c (fundamental_type_code): Return FT_boolean for INTEGER_TYPE with precision==1, it's __java_boolean.
* dwarfout.c (fundamental_type_code): Return FT_boolean for
        INTEGER_TYPE with precision==1, it's __java_boolean.

From-SVN: r28694
1999-08-13 01:32:07 -06:00
Mark Mitchell 99d6a99bfb * decl2.c (lang_decode_option): Deprecate signatures.
From-SVN: r28692
1999-08-13 00:52:31 +00:00
Martin v. Loewis 8d06623ae8 lex.c (do_identifier): If we find a hidden type after a global was selected already...
* lex.c (do_identifier): If we find a hidden type after a global
	was selected already, continue using the global

From-SVN: r28673
1999-08-11 18:36:44 +00:00
Jeff Law f47e98dac9 emit-rtl.c (mark_reg_pointer): Don't increase the alignment of a register that is already known to be a pointer.
* emit-rtl.c (mark_reg_pointer): Don't increase the alignment of
        a register that is already known to be a pointer.

From-SVN: r28662
1999-08-11 01:28:52 -06:00
Bruce Korb 5c2a59b8b0 inclhack.tpl: Only install assert.h conditionally.
* fixinc/inclhack.tpl: Only install assert.h conditionally.
        * fixinc/inclhack.sh: Regenerated.
        * fixinc/fixincl.sh: Regenerated.

From-SVN: r28660
1999-08-11 01:18:16 -06:00
Joe Buck f486d34892 invoke.texi: s/GNU CC/GCC/ for consistency with gcc.texi.
* invoke.texi: s/GNU CC/GCC/ for consistency with gcc.texi.
        Fix documentation of -ansi flag to describe its C++ behavior.
        Remove bogus reference to GCC 2.9.

From-SVN: r28658
1999-08-11 00:50:31 -06:00
Rainer Orth 04212dcfc3 * jvgenmain.c (main): NUL-terminate name_obstack.
From-SVN: r28656
1999-08-11 05:08:32 +00:00
Jeffrey A Law 6de20ea36b lib1funcs.asm (___movstrSI0): Change or r0,r0,r0 to nop.
Thu Aug  5 22:27:15 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
        * config/sh/lib1funcs.asm (___movstrSI0): Change or r0,r0,r0 to nop.
        (___mulsi3): Use '!' comment character.

From-SVN: r28654
1999-08-10 22:41:49 -06:00
Martin v. Löwis be3f8f453a Fix checkin date
From-SVN: r28652
1999-08-10 17:17:27 +00:00
Martin v. Loewis 9ceb04b191 decl2.c (set_decl_namespace): Do not complain about non-matching decls if processing a template.
* decl2.c (set_decl_namespace): Do not complain about non-matching
	decls if processing a template.

From-SVN: r28651
1999-08-10 17:16:26 +00:00
Jason Merrill 96acd5a9b7 parse.y (function_try_block): Call end_protect_partials before expand_start_all_catch.
* parse.y (function_try_block): Call end_protect_partials
	before expand_start_all_catch.

From-SVN: r28625
1999-08-09 06:51:17 -04:00
Jason Merrill c22de166bd revert: typeck.c (common_type): Use same_type_p.
revert:
	* typeck.c (common_type): Use same_type_p.

From-SVN: r28620
1999-08-09 04:46:20 -04:00
Jeff Law ae40dcb04f More web page & mail address updates.
From-SVN: r28614
1999-08-09 00:47:03 -06:00
Jeff Law d3aca5a5dd Bump version # to 2.95.1 prerelease.
From-SVN: r28612
1999-08-09 00:29:14 -06:00
Jeffrey A Law 1a9f601e1b rs6000.h (struct rs6000_args): Add sysv_gregno.
Tue Jul 20 17:07:54 1999  Richard Henderson  <rth@cygnus.com>
        * rs6000.h (struct rs6000_args): Add sysv_gregno.
        * rs6000.c (init_cumulative_args): Init sysv_gregno.
        (function_arg_boundary): Align DFmode.
        (function_arg_advance): Restructure for ABI_V4; use sysv_gregno
        to get fp reg and stack overflow correct.
        (function_arg): Likewise.
        (function_arg_pass_by_reference): True for TFmode for ABI_V4.
        (setup_incoming_varargs): Restructure for ABI_V4; use
        function_arg_advance to skip final named argument.
        (expand_builtin_saveregs): Properly unskip the last integer arg
        when doing varargs.  Adjust overflow location calculation.
        * ginclude/va-ppc.h (struct __va_list_tag): Make gpr and fpr
        explicitly unsigned.
        (__VA_FP_REGSAVE): Use new OFS argument instead of AP->fpr directly.
        (__VA_GP_REGSAVE): Similarly.
        (__va_longlong_p): Delete.
        (__va_arg_type_violation): New declaration.
        (va_arg): Restructure.  Flag promotion errors.  Align double.
        TFmode passed by reference.
        * rs6000.md (movdi_32+1): Use GEN_INT after arithmetic
        in the HOST_BITS_PER_WIDE_INT > 32 case.

From-SVN: r28611
1999-08-08 23:55:17 -06:00
Jason Merrill 982ede750d typeck.c (common_type): Use same_type_p.
* typeck.c (common_type): Use same_type_p.

and revert:
 	* decl.c (bad_specifiers): It's OK to have an EH spec on a function
	pointer.

From-SVN: r28607
1999-08-08 20:28:35 -04:00
Alexandre Oliva 7b82095e19 pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as template parameter instead.
* pthread_alloc: Solaris' ctype.h defines _U to 01; use _Up as
template parameter instead.

From-SVN: r28603
1999-08-09 00:07:05 +00:00
Alexandre Oliva baeab0af95 streambuf.h (ios::streamsize): Declare as _IO_ssize_t, as in the global scope.
* streambuf.h (ios::streamsize): Declare as _IO_ssize_t, as in the
global scope.

From-SVN: r28602
1999-08-09 00:07:01 +00:00
Jason Merrill 2fc5a85565 fix thinko in last change
From-SVN: r28600
1999-08-08 17:03:59 -04:00
Jason Merrill 6e27991d57 revert
From-SVN: r28586
1999-08-07 17:28:09 -04:00
Jeffrey A Law c2cc3f1b1a * gcc.texi: Update bug reporting text.
From-SVN: r28575
1999-08-07 00:09:44 -06:00
Andreas Schwab 968467ebed iostream.cc: Add missing calls to isfx and setup a cleanup region for the locked stream.
* iostream.cc: Add missing calls to isfx and setup a cleanup
	region for the locked stream.
	* iostream.h: Likewise.
	* isgetline.cc: Likewise.
	* isgetsb.cc: Likewise.
	* isscan.cc: Likewise.

From-SVN: r28572
1999-08-07 00:01:46 -06:00
Herman A.J. ten Brugge 620b72bc91 * reg-stack.c (change_stack) Fixed problem with negative array index.
From-SVN: r28571
1999-08-06 23:58:29 -06:00
Daniel Jacobowitz 52441de3a1 Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix, libdir, libsubdir and tooldir.
* Makefile.in (FLAGS_TO_PASS): Include prefix, exec_prefix,
        libdir, libsubdir and tooldir.
Applied in the libchill, libiberty, libobjc, and libf2c subdirs

From-SVN: r28568
1999-08-06 23:36:11 -06:00
Jeffrey A Law 525068394a rs6000.md (arithmetic, [...]): Disable patterns performing SImode comparisons with SImode values if...
* rs6000.md (arithmetic, logical, and shift Rc combiner patterns):
        Disable patterns performing SImode comparisons with SImode values
        if TARGET_POWERPC64 and instruction does not sign-extend or does
        not mask to narrower than SImode, i.e. where bit 31 and bit 63 may
        differ for signed quantities.
        (indirect_jump): Add expander to choose RTL based on TARGET_64BIT.
        (tablejump): Patterns contingent on TARGET_64BIT not TARGET_POWERPC64.
        (decrement_and_branch_on_count): Add 64-bit variant.

From-SVN: r28564
1999-08-06 20:46:25 -06:00
Jason Merrill 92410ebf67 decl.c (bad_specifiers): It's OK to have an EH spec on a function pointer.
* decl.c (bad_specifiers): It's OK to have an EH spec on a function
	pointer.

	* pt.c (maybe_get_template_decl_from_type_decl): Make sure that
	we're looking at a class.

	* decl.c (lookup_name_real): Set the complain flag if we're
	looking for a namespace member.

	* decl.c (pushdecl): Only give an error for shadowing a parm
	from *this* function.

	* decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Only
	build_expr_from_tree on the args of a TEMPLATE_ID_EXPR.

	* class.c (mark_overriders): Fix order of args to overrides.
	(warn_hidden): Likewise.  Fix for having virtual and non-virtual
	functions with the same name.

	* cp-tree.h (DECL_VIRTUAL_CONTEXT): New macro.
	* typeck.c (expand_ptrmemfunc_cst): Calculate delta correctly for
	virtual functions and MI.  Simplify.

	* typeck.c (c_expand_return): Downgrade pedwarn about returning NULL
	from op new to warning.

	* decl2.c (reparse_absdcl_as_casts): Don't warn about old-style
	casts in system headers or extern "C" blocks.

	* pt.c (do_decl_instantiation): Downgrade duplicate instantiation
	errors to pedwarn.

	* error.c (dump_type_real): Handle TREE_LIST again.

	* typeck.c (comp_target_parms): Don't complain about
	converting from () to (...) if !flag_strict_prototype.

	* class.c (instantiate_type): Downgrade errors for object-dependent
	memfn refs to pedwarn.

From-SVN: r28563
1999-08-06 21:31:58 -04:00
Alexandre Oliva 8652729818 pt.c (tsubst): Use build_index_type to build in-template array index type.
* pt.c (tsubst): Use build_index_type to build in-template array
index type.  Fixes g++.oliva/dwarf1.C.
* decl.c (grokdeclarator): Likewise, just for consistency, as it
doesn't seem to trigger the bug without it.

From-SVN: r28555
1999-08-06 20:42:55 +00:00
Alexandre Oliva 17f3d156dd Missing doubled @s in e-mail address
From-SVN: r28540
1999-08-05 21:02:48 +00:00
Jeffrey A Law 41532336d2 g77spec.c: Update URLS and mail addresses.
* g77spec.c: Update URLS and mail addresses.
        * root.texi: Update URLS and mail addresses.

From-SVN: r28534
1999-08-05 03:03:27 -06:00
Jeff Law b20a307a8c * typeck2.c: Update URLs and mail addresses.
From-SVN: r28533
1999-08-05 03:02:22 -06:00
Jeffrey A Law 08678e1863 gcc.c: Update URLs and mail addresses.
* gcc.c: Update URLs and mail addresses.
        * gcc.texi: Likewise.

From-SVN: r28532
1999-08-05 02:44:14 -06:00
Loren J. Rittle c33e316b26 Makefile.in (MARLINK, MSHLINK): Handle library version number components with more than one numeric digit.
* Makefile.in (MARLINK, MSHLINK): Handle library version
        number components with more than one numeric digit.

From-SVN: r28530
1999-08-05 02:00:40 -06:00
Daniel Jacobowitz 4e55b3386b rs6000.c (current_file_function_operand): Return zero for weak functions.
* rs6000.c (current_file_function_operand): Return zero for
        weak functions.
        (rs6000_encode_section_info): Do not set SYMBOL_REF_FLAG for
        weak symbols.
        * rs6000.h (ENCODE_SECTION_NIFO): Do not set SYMBOL_REF_FLAG
        for weak symbols.

From-SVN: r28528
1999-08-05 01:19:18 -06:00
Geoff Keating 0c268803f5 rs6000.c (rs6000_stack_info): For ABI_V4/ABI_SOLARIS -fpic...
* rs6000.c (rs6000_stack_info): For ABI_V4/ABI_SOLARIS -fpic, always
        allocate space in the stack frame for the PIC register.

From-SVN: r28526
1999-08-05 01:00:52 -06:00
Jeffrey A Law 83a57af40a m68k.md (xordi3, anddi3): These patterns are not available on the coldfire.
* m68k.md (xordi3, anddi3): These patterns are not available on
        the coldfire.

From-SVN: r28523
1999-08-05 00:22:05 -06:00
Mark Mitchell cbc234ddf1 real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules.
Wed Aug  4 23:39:20 1999  Mark Mitchell  <mark@codesourcery.com>

        * real.c (GET_REAL): Don't violate ANSI/ISO aliasing rules.
        (PUT_REAL): Likewise.

From-SVN: r28522
1999-08-04 23:42:43 -06:00
Richard Henderson c9e1197ed6 * jump.c (delete_insn): Delete the addr_vec when deleting a tablejump.
From-SVN: r28491
1999-08-04 02:16:46 -06:00
Jeffrey A Law 8f6c971794 * config.sub (vxworks case): Use os=-vxworks, not os=vxworks.
From-SVN: r28490
1999-08-04 02:09:26 -06:00
Jeffrey A Law 276916011a flow.c (delete_unreachable_blocks): Do not call merge_blocks or tidy_fallthru_edge if...
* flow.c (delete_unreachable_blocks): Do not call merge_blocks
        or tidy_fallthru_edge if the last insn in the block is not
        an unconditional jump or a simple conditional jump.

From-SVN: r28482
1999-08-04 01:09:48 -06:00
Jeffrey A Law fabb911e8a * cse.c (cse_insn): Fix dumb thinko in last change.
From-SVN: r28465
1999-08-03 03:58:45 -06:00
Jeff Law 5ab50a100c Delete questionable files.
From-SVN: r28464
1999-08-03 03:41:18 -06:00
Jeff Law 38456ed40e Delete questionable files
From-SVN: r28461
1999-08-03 03:34:50 -06:00
Jeff Law 53a747ffa0 delete questionable tests
From-SVN: r28458
1999-08-03 03:25:50 -06:00
Jeff Law 239ce3ce5b Delete questionable files
From-SVN: r28455
1999-08-03 03:10:35 -06:00
Jeff Law 63f66a1078 Delete questionable tests
From-SVN: r28454
1999-08-03 03:00:44 -06:00
Jeff Law 16c536900e Remove questionable tests.
From-SVN: r28452
1999-08-03 02:29:14 -06:00
Jeff Law d4c618db1c Remove questionable files
From-SVN: r28450
1999-08-03 02:19:04 -06:00
Jeff Law e9306a702d Delete questionable tests.
From-SVN: r28449
1999-08-03 02:05:29 -06:00
Jeff Law 541749e262 Delete copyrighted test
From-SVN: r28446
1999-08-03 01:53:43 -06:00
Hans-Peter Nilsson 23b9aef48b dwarf2out.c (add_location_or_const_value_attribute): Correct test for sizes of passed and declared parameter types.
* dwarf2out.c (add_location_or_const_value_attribute): Correct
	test for sizes of passed and declared parameter types.

From-SVN: r28444
1999-08-03 03:04:37 -04:00
Mumit Khan b18d82b63b * decl.c (start_decl): Set attributes before duplicate_decls call.
From-SVN: r28443
1999-08-03 03:03:56 -04:00
Richard Henderson f0c6f282ed * alpha.c (override_options): Don't force ALPHA_TP_PROG for ev6.
From-SVN: r28405
1999-08-02 12:46:08 -07:00
Jeffrey A Law 71afd6a794 fix-header.c (main): When testing for CONTINUED, use string equality, not pointer equality.
* fix-header.c (main): When testing for CONTINUED, use string
        equality, not pointer equality.

From-SVN: r28397
1999-08-02 01:38:04 -06:00
Dan Nicolaescu 82ab3b3c69 * sparc.c (sparc_block_profiler): Use the %g2 register, not %o0.
From-SVN: r28394
1999-08-02 01:30:10 -06:00
Jeffrey A Law ad8d7fbe42 stdexcepti.cc (__out_of_range): Use std:: qualifier for names in std.
1999-07-16  Markus Gyger (mgyger@gmu.edu)
        * stdexcepti.cc (__out_of_range): Use std:: qualifier for names
        in std.
        (__length_error): Likewise.

From-SVN: r28392
1999-08-02 00:41:14 -06:00
Jeffrey A Law 06ec3ad86f cse.c (cse_insn): Fix loop which deletes insns after a jump that has become an unconditional jump.
* cse.c (cse_insn): Fix loop which deletes insns after a jump
        that has become an unconditional jump.

From-SVN: r28387
1999-08-01 23:51:32 -06:00
Jeffrey A Law ca74e2857a dwarf2out.c (output_abbrev_section): Terminate with a zero.
Tue Jul 20 12:37:30 1999  Hans-Peter Nilsson  <hp@bitrange.com>
        * dwarf2out.c (output_abbrev_section): Terminate with a zero.

From-SVN: r28386
1999-08-01 23:18:14 -06:00
Jeffrey A Law 65cd8f24f4 tree.c (build_type_attribute_variant): Move current_obstack restore after build_qualified_type call.
Thu Jul 15 15:40:09 1999  Jim Wilson  <wilson@cygnus.com>
        * tree.c (build_type_attribute_variant): Move current_obstack restore
        after build_qualified_type call.
Brought over from the mainline sources.  Fixes spurious core dumps/aborts.

From-SVN: r28385
1999-08-01 23:07:23 -06:00
Jeffrey A Law 76b9cdc8ab sh.c (fixup_addr_diff_vecs): Emit braf reference label.
Fri Jun  4 03:20:40 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
        * sh.c (fixup_addr_diff_vecs): Emit braf reference label.
        (braf_label_ref_operand): Delete.
        * sh.h (PREDICATE_CODES): Remove braf_label_ref_operand.
        * sh.md (casesi_jump_2): Operand1 is now the inside of a
        label_ref, and has no predicate.
        The patten has a predicate to guard against invalid substitutions.
        (dummy_jump): Delete.
        (casesi): Update use of casesi_jump_2.
Bring over from the mainline tree.

From-SVN: r28384
1999-08-01 23:02:55 -06:00
Jeffrey A Law 89d3aec6da m68k.c (output_function_prologue): Fix typo in CPU32 case.
* m68k.c (output_function_prologue): Fix typo in CPU32 case.
        (output_function_epilogue): Similarly.

From-SVN: r28383
1999-08-01 22:51:08 -06:00
Joe Buck 0d015cc1ba gcc.texi: Use terms "GNU Compiler Collection" and "GCC".
* gcc.texi: Use terms "GNU Compiler Collection" and "GCC".
        Also update copyright.

From-SVN: r28358
1999-07-31 07:27:31 -06:00
Jeffrey A Law 1a3dd88d4a * verison.c: No longer a prerelease.
From-SVN: r28337
1999-07-29 03:41:31 -06:00
Jeffrey A Law c1ece1f657 * version.c: No longer a prerelease.
From-SVN: r28336
1999-07-29 03:39:12 -06:00
Jeffrey A Law 1d8ade1d1a Version.c: No longer a prerelease.
* libF77/Version.c: No longer a prerelease.
        * libI77/Version.c: No longer a prerelease.
        * libU77/Version.c: No longer a prerelease.

From-SVN: r28335
1999-07-29 03:37:34 -06:00
Jeff Law 26c151a516 Stamp ChangeLogs for release
From-SVN: r28330
1999-07-28 22:39:51 -06:00
Jeff Law 3789f31703 fix typo.
From-SVN: r28325
1999-07-28 13:51:11 -06:00
Jeffrey A Law 0ca980bb49 * README: Update.
From-SVN: r28323
1999-07-28 13:50:19 -06:00
Jeff Law a437ad9b2c Daily bump.
From-SVN: r28308
1999-07-28 01:46:45 -06:00
Jeff Law b6eacfd898 Ensure file ends with a newline.
From-SVN: r28293
1999-07-27 04:34:30 -06:00
Jeff Law 8977a305f6 Daily bump.
From-SVN: r28289
1999-07-27 01:45:43 -06:00
Jeff Law 359b2ce309 Daily bump.
From-SVN: r28260
1999-07-26 01:45:08 -06:00
Jeff Law 86723d9ab9 Stamp ChangeLogs for release
From-SVN: r28255
1999-07-26 00:43:09 -06:00
Jeffrey A Law 5c0df79891 * README: More listname related changes.
From-SVN: r28248
1999-07-25 21:43:06 -06:00
Jeffrey A Law 38b75142a2 gcc.texi: More changes related to list conversion.
* gcc.texi: More changes related to list conversion.
        * invoke.texi: Likewise.

From-SVN: r28247
1999-07-25 21:42:59 -06:00
Jeffrey A Law f8760622b5 g++FAQ.texi: Deleted per Joe Buck's request.
* g++FAQ.texi: Deleted per Joe Buck's request.
        * Makefile.in: Corresponding changes.

From-SVN: r28239
1999-07-25 15:27:38 -06:00
Jeff Law 341ba78991 Daily bump.
From-SVN: r28234
1999-07-25 01:45:38 -06:00
Jeff Law 5335306f5c Daily bump.
From-SVN: r28232
1999-07-24 01:45:40 -06:00
Jeff Law b90e6bf0eb Daily bump.
From-SVN: r28226
1999-07-23 01:45:38 -06:00
Jeff Law 5065900bd2 Daily bump.
From-SVN: r28215
1999-07-22 01:45:43 -06:00
Jeff Law d64a153f8e Daily bump.
From-SVN: r28202
1999-07-21 01:45:08 -06:00
Jeff Law 93b60861e8 Daily bump.
From-SVN: r28186
1999-07-20 01:45:08 -06:00
Jeff Law f524a24177 Daily bump.
From-SVN: r28168
1999-07-19 01:46:09 -06:00
Jeff Law a470d3f6b8 Daily bump.
From-SVN: r28164
1999-07-18 01:45:37 -06:00
David Edelsohn 8c36c4b64a rs6000.md (insv, extzv): Remove SImode dependence in named patterns.
* rs6000.md (insv, extzv): Remove SImode dependence in named
        patterns.  Explicitly generate DImode RTL if PowerPC64 and
        operand is DImode.
        (insvdi): Reverse start and size in instruction template.

From-SVN: r28162
1999-07-17 23:59:52 -06:00
Jeffrey A Law 2767d6e7b0 * Makefile.in (INTERFACE): Bump to 2.
From-SVN: r28159
1999-07-17 23:51:51 -06:00
Jeffrey A Law 9b9e64563a Makefile.in (INTERFACE): Bump to 3.
* Makefile.in (INTERFACE): Bump to 3.
To be safe.

From-SVN: r28158
1999-07-17 23:50:47 -06:00
Jeffrey A Law a46ef9e0f2 * root.texi: Clear DEVEOPMENT per Craig's instructions.
From-SVN: r28156
1999-07-17 21:59:09 -06:00
Alexandre Oliva d5403c201b root.texi: Update e-mail addresses to gcc.gnu.org.
* root.texi: Update e-mail addresses to gcc.gnu.org.
        * g77spec.c (lang_specific_driver): Updated URL with bug reporting
        instructions to gcc.gnu.org.  Removed e-mail address.

From-SVN: r28154
1999-07-17 21:50:49 -06:00
Alexandre Oliva 853a9dbf1a typeck2.c (my_friendly_abort): Updated URL with bug reporting instructions to gcc.gnu.org.
* typeck2.c (my_friendly_abort): Updated URL with bug reporting
        instructions to gcc.gnu.org.  Removed e-mail address.

From-SVN: r28152
1999-07-17 21:48:56 -06:00
Alexandre Oliva 3b8fc855d9 gcc.texi: Update e-mail addresses and URLs to gcc.gnu.org.
* gcc.texi: Update e-mail addresses and URLs to gcc.gnu.org.
        Removed paragraph about compression of files and size limitation,
        duplicated in the FAQ.  Use gcc-patches for posting patches.
        * gcc.c (main): Updated URL with bug reporting instructions to
        gcc.gnu.org.  Removed e-mail address.
        * system.h (abort): Likewise.

From-SVN: r28150
1999-07-17 21:47:41 -06:00
Alexandre Oliva 9888124c22 * test_summary: Replace egcs with gcc. Update e-mail address.
From-SVN: r28149
1999-07-17 21:45:57 -06:00
Kaveh R. Ghazi 9a2574589d Makefile.in (stmp-multilib-sub): Make the files extracted from $(LIBGCC1) writable.
* Makefile.in (stmp-multilib-sub): Make the files extracted
        from $(LIBGCC1) writable.

From-SVN: r28146
1999-07-17 19:23:41 -06:00
Craig Burley 8ededbc172 updated derived files
From-SVN: r28142
1999-07-17 11:41:22 -04:00
Craig Burley 904f523561 root.texi, [...]: Switchover to GCC terminology.
Sat Jul 17 11:28:43 1999  Craig Burley  <craig@jcb-sc.com>

* root.texi, g77install.texi: Switchover to GCC terminology.
Also, FSF-G77 had been mistakenly set at some point.

From-SVN: r28141
1999-07-17 11:37:45 -04:00
Jeff Law 8d66f91965 Daily bump.
From-SVN: r28135
1999-07-17 01:45:40 -06:00
Jeff Law e8964eae43 Daily bump.
From-SVN: r28120
1999-07-16 01:45:09 -06:00
Jeffrey A Law 04d718a07d m68k.c (output_function_prologue): Fix computation of save mask when generating PIC code.
* m68k.c (output_function_prologue): Fix computation of save mask
        when generating PIC code.

From-SVN: r28118
1999-07-16 01:41:30 -06:00
Mark Mitchell 79562fbcdc pt.c (check_default_tmpl_args): Handle friends defined in the class just like member functions defined in the class.
* pt.c (check_default_tmpl_args): Handle friends defined in the
        class just like member functions defined in the class.

From-SVN: r28111
1999-07-14 20:05:36 -06:00
Jeff Law c949358257 Daily bump.
From-SVN: r28110
1999-07-14 18:45:42 -06:00
H.J. Lu 77dbe50a01 decl.c (duplicate_decls): Relax restriction for exception checks on duplicate symbols.
* decl.c (duplicate_decls): Relax restriction for exception
        checks on duplicate symbols.

From-SVN: r28108
1999-07-14 18:29:16 -06:00
Joseph Myers ce42415282 * invoke.texi: Typo fixes.
From-SVN: r28106
1999-07-14 17:27:02 -06:00
Jeffrey A Law 94301c6b8a emit-rtl.c (gen_realpart): Issue an error for cases GCC can not handle at this time instead of silently...
* emit-rtl.c (gen_realpart): Issue an error for cases GCC can not
        handle at this time instead of silently generating incorrect code.
        (gen_imagpart): Likewise.

From-SVN: r28104
1999-07-14 17:03:52 -06:00
Jeff Law 8ab4cd1d5c reload.c (find_reloads): Emit a USE for a pseudo register without a hard register if...
�
        * reload.c (find_reloads): Emit a USE for a pseudo register without
        a hard register if we could not create an optional reload for the
        pseudo.

From-SVN: r28101
1999-07-14 16:29:48 -06:00
Jeff Law fdf9b49823 reload.c (find_reloads): Emit a USE for a pseudo register without a hard register if...
�
        * reload.c (find_reloads): Emit a USE for a pseudo register without
        a hard register if we could not create an optional reload for the
        pseudo.

From-SVN: r28100
1999-07-14 16:29:37 -06:00
Richard Henderson fbb7b16e53 regclass.c (scan_one_insn): Notice subregs that change the size of their operand.
�
        * regclass.c (scan_one_insn): Notice subregs that change the
        size of their operand.
        (record_reg_classes): Use that to obey CLASS_CANNOT_CHANGE_SIZE.

[[Split portion of a mixed commit.]]

From-SVN: r28094.1
1999-07-13 19:00:02 -06:00
Richard Henderson 4939c44a64 regclass.c (scan_one_insn): Notice subregs that change the size of their operand.
�
        * regclass.c (scan_one_insn): Notice subregs that change the
        size of their operand.
        (record_reg_classes): Use that to obey CLASS_CANNOT_CHANGE_SIZE.

From-SVN: r28093
1999-07-13 18:59:11 -06:00
Jeff Law 99207a7063 Daily bump.
From-SVN: r28091
1999-07-13 18:45:20 -06:00
Jeffrey A Law c00548f3ac configure.in (alpha*-*-*): Include alpha/t-ieee.
* configure.in (alpha*-*-*): Include alpha/t-ieee.
        * configure: Rebuilt.
        * alpha/t-ieee: New file.

From-SVN: r28089
1999-07-13 18:39:28 -06:00
Jeffrey A Law d440ca8d59 cse.c (cse_insn): Don't put hard register source into tables for the last insn of a libcall.
Wed Jun 16 20:29:00 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
        * cse.c (cse_insn): Don't put hard register source into tables for
        the last insn of a libcall.
Bring over from mainline sources.  Fixes various sparc lapack problems.

From-SVN: r28088
1999-07-13 11:03:22 -06:00
Jeffrey A Law ac691bc6ea rs6000.c (find_addr_reg): Do not select r0 as an address register.
* rs6000.c (find_addr_reg): Do not select r0 as an address
        register.

From-SVN: r28083
1999-07-13 03:47:07 -06:00
Jeff Law 6dae12c667 Daily bump.
From-SVN: r28080
1999-07-12 18:45:44 -06:00
Philippe De Muyter 38c1fa4817 x-mot3300 (XCFLAGS): List of big files now includes `cse.o'.
8
        * m68k/x-mot3300 (XCFLAGS): List of big files now includes `cse.o'.

[[Split portion of a mixed commit.]]

From-SVN: r28077.1
1999-07-12 17:49:28 -06:00
Philippe De Muyter b5cf505c84 x-mot3300 (XCFLAGS): List of big files now includes `cse.o'.
�
        * m68k/x-mot3300 (XCFLAGS): List of big files now includes `cse.o'.

From-SVN: r28076
1999-07-12 17:48:54 -06:00
Jeff Law 8cd85a0ab5 rs6000.md (movsf): Do not force easy FP constants into memory.
X
        * rs6000.md (movsf): Do not force easy FP constants into memory.

From-SVN: r28074
1999-07-12 16:42:19 -06:00
Jeff Law 453cc9def3 rs6000.md (movsf): Do not force easy FP constants into memory.
�
        * rs6000.md (movsf): Do not force easy FP constants into memory.

From-SVN: r28073
1999-07-12 16:42:11 -06:00
Jason Merrill 3ff5f637ea * Makefile.in (NEEDED): Add bcmp, bcopy, bzero.
From-SVN: r28070
1999-07-12 14:17:02 -04:00
Jason Merrill 06489e6667 tweak
From-SVN: r28068
1999-07-12 09:36:49 -04:00
Jeff Law ef539371b5 Daily bump.
From-SVN: r28061
1999-07-11 18:45:42 -06:00
Martin v. Löwis 971cf75066 stl_function.h (bind1st, bind2nd): Rename __opr to __oper, as __opr is used internally by egcs.
* stl_function.h (bind1st, bind2nd): Rename __opr to __oper,
        as __opr is used internally by egcs.
        * stl_numeric.h (__power, power): Likewise.

From-SVN: r28059
1999-07-11 16:24:28 -06:00
Jason Merrill ab34c94a73 * toplev.c (main): Don't complain about saying -gdwarf.
From-SVN: r28056
1999-07-11 04:23:03 -06:00
Jeff Law 984b073557 Daily bump.
From-SVN: r28054
1999-07-10 18:45:45 -06:00
Jeff Law 502f6581b7 Daily bump.
From-SVN: r28050
1999-07-09 18:45:12 -06:00
Jeffrey A Law 1a05574d6f version.c: Drop "gcc-" prefix from version #.
Fri Jul  9 03:51:52 1999  Jeffrey A Law  (law@cygnus.com)
        * version.c: Drop "gcc-" prefix from version #.

From-SVN: r28041
1999-07-08 20:53:20 -06:00
Jeff Law 649383a42f Daily bump.
From-SVN: r28040
1999-07-08 20:48:51 -06:00
Jeff Law d5af840bcd Daily bump.
From-SVN: r28037
1999-07-08 18:45:03 -06:00
Jeffrey A Law 41bedc5ea1 Makefile.in (VERSION): Bump to 2.10.0.
�
        * Makefile.in (VERSION): Bump to 2.10.0.

From-SVN: r28035
1999-07-08 18:21:01 -06:00
Jim Wilson 7c2d830d87 unroll.c (unroll_loops): Don't delete named CODE_LABEL or NOTE_INSN_DELETED_LABEL note.
�
	* unroll.c (unroll_loops): Don't delete named CODE_LABEL or
	NOTE_INSN_DELETED_LABEL note.
Reverted previous unroll patch.  Use this version instead.

From-SVN: r28034
1999-07-08 17:44:55 -06:00
Jim Wilson 166e8ff348 unroll.c (unroll_loops): Don't delete named CODE_LABEL or NOTE_INSN_DELETED_LABEL note.
�
	* unroll.c (unroll_loops): Don't delete named CODE_LABEL or
	NOTE_INSN_DELETED_LABEL note.
Reverted previous unroll patch.  Use this version instead.

From-SVN: r28033
1999-07-08 17:44:49 -06:00
Richard Henderson 818b1d5d56 m68k.c (output_function_prologue): Add pic register to mask if live and flag_pic.
�
        * m68k.c (output_function_prologue): Add pic register to mask
        if live and flag_pic.
        (output_function_epilogue): Likewise.

From-SVN: r28021
1999-07-08 07:20:37 -06:00
Richard Henderson 8e52cb0c1a m68k.c (output_function_prologue): Add pic register to mask if live and flag_pic.
�
        * m68k.c (output_function_prologue): Add pic register to mask
        if live and flag_pic.
        (output_function_epilogue): Likewise.

From-SVN: r28020
1999-07-08 07:20:31 -06:00
Craig Burley eb8a6081cf Remove spurious trailing space
From-SVN: r28017
1999-07-08 08:51:41 -04:00
Craig Burley ef5ac2ca1e update derived files
From-SVN: r28015
1999-07-08 08:43:56 -04:00
Craig Burley d13c8ba3af * news.texi: Describe DATE intrinsic fix.
From-SVN: r28014
1999-07-08 08:40:27 -04:00
Craig Burley 60c2b0f1f0 date_.c (G77_date_y2kbug_0): G77_time_0 returns longint...
* libU77/date_.c (G77_date_y2kbug_0): G77_time_0 returns
        longint, not integer, and G77_ctime_0 takes longint, not
        integer, argument.
        * libU77/Version.c: Bump version.

From-SVN: r28012
1999-07-08 06:19:58 -06:00
Jason Merrill 306db29921 Makefile.in (needed-list): Only include stuff we actually need for libstdc++.
* Makefile.in (needed-list): Only include stuff we actually need
        for libstdc++.

From-SVN: r28011
1999-07-08 06:18:18 -06:00
Craig Burley 222405c715 invoke.texi (DEC Alpha Options): Put @end table at beginning of line, to avoid confusing texi2html.
* invoke.texi (DEC Alpha Options): Put @end table at
        beginning of line, to avoid confusing texi2html.

From-SVN: r28006
1999-07-08 03:15:40 -06:00
Jeff Law ba10d17efe Daily bump.
From-SVN: r28001
1999-07-07 18:45:33 -06:00
Franz Sirl c0772678a9 reload1.c (gen_reload): When synthesizing a 3 operand add sequence...
* reload1.c (gen_reload): When synthesizing a 3 operand add
        sequence, improve test for when to reload OP1 into the reload
        register instead of OP0.

From-SVN: r27988
1999-07-06 19:05:39 -06:00
Jeff Law e3fb7eac06 Daily bump.
From-SVN: r27986
1999-07-06 18:45:33 -06:00
Jim Wilson 091a7c9486 unroll.c (unroll_loop): Don't delete NOTE_INSN_DELETED_LABEL notes.
8
        * unroll.c (unroll_loop): Don't delete NOTE_INSN_DELETED_LABEL notes.

From-SVN: r27982
1999-07-06 18:40:46 -06:00
Jim Wilson 28699ce436 unroll.c (unroll_loop): Don't delete NOTE_INSN_DELETED_LABEL notes.
�
        * unroll.c (unroll_loop): Don't delete NOTE_INSN_DELETED_LABEL notes.

From-SVN: r27981
1999-07-06 18:40:37 -06:00
Jason Merrill 54a8bce404 decl.c (grokdeclarator): Update the names of all variants when de-anonymizing.
* decl.c (grokdeclarator): Update the names of all variants when
        de-anonymizing.
Brought over from the mainline tree.

From-SVN: r27980
1999-07-06 18:35:59 -06:00
Alexandre Oliva ae1749fd17 decl2.c (mark_vtable_entries): Fix check for rtti offset.
8
        * decl2.c (mark_vtable_entries): Fix check for rtti offset.

From-SVN: r27979
1999-07-06 18:32:42 -06:00
Manfred Hollstein 449fb2c2e0 dguxbcs.h (CPP_SPEC): Add missing \ in multi-line string literal.
H
        * m88k/dguxbcs.h (CPP_SPEC): Add missing \ in multi-line
        string literal.

From-SVN: r27975
1999-07-06 18:23:32 -06:00
Manfred Hollstein efde9a1cab dguxbcs.h (CPP_SPEC): Add missing \ in multi-line string literal.
�
        * m88k/dguxbcs.h (CPP_SPEC): Add missing \ in multi-line
        string literal.

From-SVN: r27974
1999-07-06 18:23:18 -06:00
Richard Henderson 8cc9400159 varargs.h (__builtin_va_alist_t): New typedef.
X
        * ginclude/varargs.h (__builtin_va_alist_t): New typedef.
        (va_dcl): Use __builtin_va_alist_t.

From-SVN: r27973
1999-07-06 18:19:05 -06:00
Richard Henderson c4744540f4 varargs.h (__builtin_va_alist_t): New typedef.
�
        * ginclude/varargs.h (__builtin_va_alist_t): New typedef.
        (va_dcl): Use __builtin_va_alist_t.

From-SVN: r27972
1999-07-06 18:18:59 -06:00
Jason Merrill 616ee90134 dwarf2out.c (gen_struct_or_union_type_die): Only remember types on the permanent_obstack.
p
	* dwarf2out.c (gen_struct_or_union_type_die): Only remember types
	on the permanent_obstack.
	* dwarfout.c (output_type): Likewise.

From-SVN: r27967
1999-07-06 18:15:29 -06:00
Jason Merrill cceb8f0547 dwarf2out.c (gen_struct_or_union_type_die): Only remember types on the permanent_obstack.
�
	* dwarf2out.c (gen_struct_or_union_type_die): Only remember types
	on the permanent_obstack.
	* dwarfout.c (output_type): Likewise.

From-SVN: r27966
1999-07-06 18:15:20 -06:00
Jeff Law b18aa4cab0 Daily bump.
From-SVN: r27951
1999-07-05 18:47:03 -06:00
Jeff Law b01a5b5ca5 Daily bump.
From-SVN: r27941
1999-07-04 18:45:03 -06:00
Jeff Law eb354a69f1 Daily bump.
From-SVN: r27935
1999-07-03 18:46:04 -06:00
Jeff Law e2f913c1a9 Daily bump.
From-SVN: r27931
1999-07-02 18:45:33 -06:00
Jeffrey A Law d3386979cb dwarfout.c (field_byte_offset): Correctly compute the object's byte offset for the first bit of a field which...
* dwarfout.c (field_byte_offset): Correctly compute the object's
        byte offset for the first bit of a field which crosses an alignment
        boundary on a !BYTES_BIG_ENDIAN target.

From-SVN: r27920
1999-07-01 20:06:56 -06:00
Jeff Law 7bd66a4314 Daily bump.
From-SVN: r27919
1999-07-01 18:45:34 -06:00
Robert Lipe 05e0bcd354 fixinc.svr4: Fix <arpa/inet.h> by deleting protos for htons and ntohs.
P
        * fixinc.svr4: Fix <arpa/inet.h> by deleting protos for htons and
        ntohs.

From-SVN: r27917
1999-07-01 18:40:24 -06:00
Robert Lipe 72ba02b001 fixinc.svr4: Fix <arpa/inet.h> by deleting protos for htons and ntohs.
�
        * fixinc.svr4: Fix <arpa/inet.h> by deleting protos for htons and
        ntohs.

From-SVN: r27916
1999-07-01 18:40:18 -06:00
David Edelsohn 5e18fdc8d8 rs6000.md (movdf_hardfloat32): Handle PRE_INC and PRE_DEC the same as offsettable in cases 1 and 2.
`
        * rs6000.md (movdf_hardfloat32): Handle PRE_INC and PRE_DEC the
        same as offsettable in cases 1 and 2.

From-SVN: r27913
1999-07-01 18:36:48 -06:00
David Edelsohn b427b977a1 rs6000.md (movdf_hardfloat32): Handle PRE_INC and PRE_DEC the same as offsettable in cases 1 and 2.
�
        * rs6000.md (movdf_hardfloat32): Handle PRE_INC and PRE_DEC the
        same as offsettable in cases 1 and 2.

From-SVN: r27912
1999-07-01 18:36:38 -06:00
Richard Henderson 90b2d93f9d varargs.h (va_dcl): Use word_mode for type of __builtin_va_list.
* ginclude/varargs.h (va_dcl): Use word_mode for type of
        __builtin_va_list.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>

From-SVN: r27910
1999-07-01 18:23:25 -06:00
Richard Henderson 467d09dfc4 except.c: Include intl.h.
X
        * except.c: Include intl.h.
        (expand_eh_return): Set current_function_cannot_inline.
        (save_eh_status, restore_eh_status): Twiddle eh_return_stub_label.
        * function.h (struct function): Add eh_return_stub_label.
        * flow.c (delete_unreachable_blocks): Don't merge across EH edges.
        * Makefile.in (except.o): Depend on intl.h.

From-SVN: r27906
1999-07-01 17:49:47 -06:00
Richard Henderson 93153bc882 except.c: Include intl.h.
0
        * except.c: Include intl.h.
        (expand_eh_return): Set current_function_cannot_inline.
        (save_eh_status, restore_eh_status): Twiddle eh_return_stub_label.
        * function.h (struct function): Add eh_return_stub_label.
        * flow.c (delete_unreachable_blocks): Don't merge across EH edges.
        * Makefile.in (except.o): Depend on intl.h.

From-SVN: r27905
1999-07-01 17:49:41 -06:00
Richard Henderson 574c8aea2a except.c: Include intl.h.
�
        * except.c: Include intl.h.
        (expand_eh_return): Set current_function_cannot_inline.
        (save_eh_status, restore_eh_status): Twiddle eh_return_stub_label.
        * function.h (struct function): Add eh_return_stub_label.
        * flow.c (delete_unreachable_blocks): Don't merge across EH edges.
        * Makefile.in (except.o): Depend on intl.h.

From-SVN: r27904
1999-07-01 17:49:33 -06:00
Alexandre Oliva 34e133044b configure.in (zlib.h, libz): Disable checks.
* configure.in (zlib.h, libz): Disable checks.
* configure, config.h.in: Updated.

From-SVN: r27880
1999-07-01 11:47:14 +00:00
Mark Kettenis 42b9e9f2ee gnu.h (CPP_SPEC): Define __PIC__ and __pic__ if -fPIC or -fpic is specified.
X
        * config/i386/gnu.h (CPP_SPEC): Define __PIC__ and __pic__ if
        -fPIC or -fpic is specified.

From-SVN: r27870
1999-06-30 18:53:36 -06:00
Mark Kettenis a93bc9b4e7 gnu.h (CPP_SPEC): Define __PIC__ and __pic__ if -fPIC or -fpic is specified.
�
        * config/i386/gnu.h (CPP_SPEC): Define __PIC__ and __pic__ if
        -fPIC or -fpic is specified.

From-SVN: r27869
1999-06-30 18:53:30 -06:00
Jeff Law f5794e37ae Daily bump.
From-SVN: r27865
1999-06-30 18:45:03 -06:00
Philippe De Muyter 48c3f7b624 acconfig.h (_, N_): Macros removed.
h
	* acconfig.h (_, N_): Macros removed.
	* lib/system.h (_, N_): Macro definitions moved here.
	* config.h.in: File regenerated.

From-SVN: r27864
1999-06-30 18:44:57 -06:00
Philippe De Muyter 5ac8accbcc acconfig.h (_, N_): Macros removed.
�
	* acconfig.h (_, N_): Macros removed.
	* lib/system.h (_, N_): Macro definitions moved here.
	* config.h.in: File regenerated.

From-SVN: r27863
1999-06-30 18:44:54 -06:00
Jeffrey A Law 6a0bea0715 expr.c (emit_block_move): Use copy_to_mode_reg for !TARGET_MEM_FUNCTIONS case too.
* expr.c (emit_block_move): Use copy_to_mode_reg for
	!TARGET_MEM_FUNCTIONS case too.

From-SVN: r27861
1999-06-30 16:59:55 -06:00
Jeff Law 7b0284edc6 Fix typos in last change (missing commas).
From-SVN: r27848
1999-06-30 01:01:37 -06:00
Jeff Law c641c2b45e Daily bump.
From-SVN: r27841
1999-06-29 18:45:35 -06:00
Craig Burley 94055d0182 update derived files
From-SVN: r27839
1999-06-29 03:19:06 -04:00
Craig Burley b1b8255c10 doc NAMELIST fix
From-SVN: r27838
1999-06-29 03:15:55 -04:00
Hans-Peter Nilsson 2cd09533b3 configure.in (post-target): Use "$(topsrcdir)", not "$(srcdir)/..".
8
	* configure.in (post-target): Use "$(topsrcdir)", not "$(srcdir)/..".

From-SVN: r27834
1999-06-28 20:31:46 -06:00
Craig Burley 0e4e484370 com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs a temp even if -fno-f2c.
`
	* com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs
	a temp even if -fno-f2c.
	* version.c: Bump version.

From-SVN: r27833
1999-06-28 20:27:44 -06:00
Craig Burley cae39e4e23 com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs a temp even if -fno-f2c.
h
	* com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs
	a temp even if -fno-f2c.
	* version.c: Bump version.

From-SVN: r27832
1999-06-28 20:27:42 -06:00
Craig Burley d427c6ff0c com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs a temp even if -fno-f2c.
�
	* com.c (ffecom_prepare_expr_): A COMPLEX intrinsic needs
	a temp even if -fno-f2c.
	* version.c: Bump version.

From-SVN: r27831
1999-06-28 20:27:41 -06:00
Craig Burley b06af1cf82 rsne.c: Fix NAMELIST bug by applying 19990627 Netlib patch to release branch.
* libI77/rsne.c: Fix NAMELIST bug by applying 19990627
	Netlib patch to release branch.

From-SVN: r27830
1999-06-28 20:26:14 -06:00
Jeffrey A Law 167eeabe98 * config.h.in: Rebuilt.
From-SVN: r27829
1999-06-28 20:22:43 -06:00
Tom Tromey 4f56b6777f * jvspec.c (lang_specific_driver): Recognize --help.
From-SVN: r27828
1999-06-28 20:09:48 -06:00
Jeff Law 4ee667bfdf mips.md (leasi, leadi): New patterns.
�
        * mips.md (leasi, leadi): New patterns.

From-SVN: r27826
1999-06-28 19:59:20 -06:00
Jeff Law 13327e1817 mips.md (leasi, leadi): New patterns.
8
        * mips.md (leasi, leadi): New patterns.

From-SVN: r27825
1999-06-28 19:59:06 -06:00
Jeff Law fb207c60da Daily bump.
From-SVN: r27824
1999-06-28 18:46:34 -06:00
Jeff Law 80116ab289 expr.c (emit_block_move): Properly handle case where one of the block move arguments has a queued...
�
        * expr.c (emit_block_move): Properly handle case where one of the
        block move arguments has a queued increment or decrement.
        (clear_storage): Similarly.  Fix formatting goof.

From-SVN: r27820
1999-06-28 18:40:54 -06:00
Jeff Law f6f80d7154 expr.c (emit_block_move): Properly handle case where one of the block move arguments has a queued...
�
        * expr.c (emit_block_move): Properly handle case where one of the
        block move arguments has a queued increment or decrement.
        (clear_storage): Similarly.  Fix formatting goof.

From-SVN: r27819
1999-06-28 18:40:48 -06:00
Jeffrey A Law 67c50a6813 m68k.h (CONDITIONAL_REGISTER_USAGE): Define for !SUN_FPA case.
* m68k.h (CONDITIONAL_REGISTER_USAGE): Define for !SUN_FPA
        case.  Also make the PIC register call_used.

From-SVN: r27808
1999-06-27 23:09:08 -06:00
Jeffrey A Law 775f3406d4 m68k.h (FINALIZE_PIC): Delete.
* m68k.h (FINALIZE_PIC): Delete.
        * m68k.c (finalize_pic): Delete.
        * m68k.h (CONDITIONAL_REGISTER_USAGE): Make the PIC register fixed
        when -fpic/-fPIC.

From-SVN: r27806
1999-06-27 22:34:30 -06:00
Richard Henderson bc305e42e4 m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles to memory.
P
        * m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles
        to memory.

From-SVN: r27803
1999-06-27 22:18:34 -06:00
Richard Henderson 73d1bbd591 m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles to memory.
�
        * m68k.h (PREFERRED_RELOAD_CLASS): Don't force any FP const_doubles
        to memory.

From-SVN: r27802
1999-06-27 22:18:25 -06:00
Alexandre Petit-Bianco 624fc988a4 parse.c: Rebuilt.
* parse.c: Rebuilt.
        * parse.y (resolve_package): Fixed bogus return statement.
        (patch_method_invocation): Resolve method invocation beginning with
        a package name qualifier.
        * parse.y (java_complete_lhs): When doing cross referencing, don't
        try to keep file location on a WFL expanded as a CALL_EXPR.
        * parse.y (finish_method_declaration): Insert a RETURN_EXPR when
        compiling to class file a void method with an empty method body.
        As a side effect, the bytecode backend will generate the
        appropriate `return' instruction.
        * parse.y (lookup_package_type_and_set_next): New function prototype.
        (resolve_package): Search current and imported packages.
        (lookup_package_type_and_set_next): New function.

From-SVN: r27801
1999-06-27 21:56:29 -06:00
David Edelsohn 8c09ce11a2 rs6000.c (output_toc): Always use hex values for floating-point constants.
* rs6000.c (output_toc): Always use hex values for floating-point
	constants.  Store single-precision values in upper-half of TOC
	entry in 64-bit mode.
	* rs6000.md (floatsidf2, floatunssidf2): Add !TARGET_POWERPC64
	to final constraints.
	(fix_truncdfsi2 splitter): Change pattern matching fctiwz.
	(fctiwz): Improve accuracy of RTL for pattern.

From-SVN: r27800
1999-06-27 21:21:13 -06:00
David Edelsohn 58b5ca01ec * rs6000.c (print_operand, case 'L'): Use plus_constant_for_output.
From-SVN: r27799
1999-06-27 21:17:17 -06:00
Richard Henderson 1173058cbb * decl.c (cp_finish_decl): Fix typo in cp_warning_at call.
From-SVN: r27797
1999-06-27 21:12:22 -06:00
David Edelsohn 232473916d * expmed.c (expand_divmod): Ensure unsigned value fits in reg_note.
From-SVN: r27795
1999-06-27 21:09:17 -06:00
Jeff Law 904508d906 Daily bump.
From-SVN: r27794
1999-06-27 18:45:33 -06:00
Jeff Law 7ea81d85be Daily bump.
From-SVN: r27780
1999-06-26 18:45:03 -06:00
Jeff Law 335d029780 Daily bump.
From-SVN: r27778
1999-06-25 18:45:34 -06:00
Craig Burley 08151ccc6c update derived files
From-SVN: r27776
1999-06-25 20:21:21 -04:00
Craig Burley 6ede4bee5e Describe K(5)=10*3 NAMELIST-read bug
From-SVN: r27774
1999-06-25 19:58:59 -04:00
Kaveh R. Ghazi 91624bd051 SMP bootstrap fixes for chill:
* Make-lang.in (CHILL.stage1): Depend on stage1-start.
        (CHILL.stage2): Likewise for stage2-start.
        (CHILL.stage3): Likewise for stage3-start.
        (CHILL.stage4): Likewise for stage4-start.
SMP bootstrap fixes for java:
        * Make-lang.in (java.stage1): Depend on stage1-start.
        (java.stage2): Likewise for stage2-start.
        (java.stage3): Likewise for stage3-start.
        (java.stage4): Likewise for stage4-start.

From-SVN: r27767
1999-06-25 08:26:23 +00:00
Richard Henderson 42ceb22d89 alpha.h (MASK_SUPPORT_ARCH, [...]): Define such that MASK_SUPPORT_ARCH is not negative.
h
        * alpha.h (MASK_SUPPORT_ARCH, MASK_CPU_EV5, MASK_CPU_EV6): Define
        such that MASK_SUPPORT_ARCH is not negative.

From-SVN: r27762
1999-06-24 23:09:12 -06:00
Richard Henderson ac509789d2 alpha.h (MASK_SUPPORT_ARCH, [...]): Define such that MASK_SUPPORT_ARCH is not negative.
�
        * alpha.h (MASK_SUPPORT_ARCH, MASK_CPU_EV5, MASK_CPU_EV6): Define
        such that MASK_SUPPORT_ARCH is not negative.

From-SVN: r27761
1999-06-24 23:09:04 -06:00
Jeff Law feaab5aa09 loop.c (verify_dominator): Properly handle ADDR_VEC and ADDR_DIFF_VEC insns that appear inside loops.
h
        * loop.c (verify_dominator): Properly handle ADDR_VEC and
        ADDR_DIFF_VEC insns that appear inside loops.

From-SVN: r27758
1999-06-24 22:38:11 -06:00
Jeff Law 83a5f16fd5 loop.c (verify_dominator): Properly handle ADDR_VEC and ADDR_DIFF_VEC insns that appear inside loops.
�
        * loop.c (verify_dominator): Properly handle ADDR_VEC and
        ADDR_DIFF_VEC insns that appear inside loops.

From-SVN: r27757
1999-06-24 22:37:58 -06:00
Andrew Haley 6d4fd2d730 Incorrect checkin backed out.
From-SVN: r27755
1999-06-25 03:27:08 +00:00
Jeff Law f43c9ca678 Daily bump.
From-SVN: r27754
1999-06-24 18:45:32 -06:00
David Edelsohn cd37ed6e26 rs6000.md (movdf_hardfloat32): Revert previous patch.
�
        * rs6000.md (movdf_hardfloat32): Revert previous patch.
        Handle LO_SUM the same as offsettable in cases 1 and 2.
        * rs6000.c (find_addr_reg): Revert previous patch.

From-SVN: r27751
1999-06-24 15:56:38 -06:00
David Edelsohn 17c1c9a9eb rs6000.md (movdf_hardfloat32): Revert previous patch.
`
        * rs6000.md (movdf_hardfloat32): Revert previous patch.
        Handle LO_SUM the same as offsettable in cases 1 and 2.
        * rs6000.c (find_addr_reg): Revert previous patch.

From-SVN: r27750
1999-06-24 15:56:36 -06:00
David Edelsohn 7ef03298e9 rs6000.md (movdf_hardfloat32): Revert previous patch.
�
        * rs6000.md (movdf_hardfloat32): Revert previous patch.
        Handle LO_SUM the same as offsettable in cases 1 and 2.
        * rs6000.c (find_addr_reg): Revert previous patch.

From-SVN: r27749
1999-06-24 15:56:31 -06:00
Jeff Law bc8c397819 system.h (strstr): New external function declaration.
�
        * system.h (strstr): New external function declaration.
        * acconfig.h (NEED_DECLARATION_STRSTR): New define slot.
        * configure.in (GCC_NEED_DECLARATIONS): Check for strstr.
        * config.in, configure: Rebuilt.

From-SVN: r27745
1999-06-24 15:45:54 -06:00
Philippe De Muyter 730702f6be system.h (strstr): New external function declaration.
�
        * system.h (strstr): New external function declaration.
        * acconfig.h (NEED_DECLARATION_STRSTR): New define slot.
        * configure.in (GCC_NEED_DECLARATIONS): Check for strstr.
        * config.in, configure: Rebuilt.

From-SVN: r27744
1999-06-24 15:45:51 -06:00
Jeff Law 4a5a6d5d33 system.h (strstr): New external function declaration.
�
        * system.h (strstr): New external function declaration.
        * acconfig.h (NEED_DECLARATION_STRSTR): New define slot.
        * configure.in (GCC_NEED_DECLARATIONS): Check for strstr.
        * config.in, configure: Rebuilt.

From-SVN: r27743
1999-06-24 15:45:44 -06:00
Tom Tromey 107bcb6bff gcc.c (main): Read user-specified specs files after computing additional startfile_prefixes.
h
        * gcc.c (main): Read user-specified specs files after computing
        additional startfile_prefixes.

From-SVN: r27740
1999-06-24 15:33:23 -06:00
Tom Tromey 559299ff63 gcc.c (main): Read user-specified specs files after computing additional startfile_prefixes.
�
        * gcc.c (main): Read user-specified specs files after computing
        additional startfile_prefixes.

From-SVN: r27739
1999-06-24 15:33:18 -06:00
Philippe De Muyter acc6170a10 setenv.c (sys/types.h, stdio.h): Files included.
* setenv.c (sys/types.h, stdio.h): Files included.
        * xstrdup.c (sys/types.h): File included.
Branch patch only.

From-SVN: r27738
1999-06-24 15:31:25 -06:00
Jeffrey A Law 2ac6ff98c2 Makefile.am (SUBDIRS): Remove util again.
* Makefile.am (SUBDIRS): Remove util again.
        * Makefile.in: Rebuilt.

From-SVN: r27735
1999-06-24 15:05:57 -06:00
Bruce Korb 53fe21c946 inclhack.def (end_else_label): combined else_label and endif_label and fixed the sed expression.
*fixinc/inclhack.def(end_else_label): combined else_label
        and endif_label and fixed the sed expression.
        *fixinc/{fixincl.x|inclhack.sh}: regen

From-SVN: r27732
1999-06-24 14:28:47 -06:00
Andrew Haley 8ad0732695 class.c (finish_class): Whenever a deferred method is output...
1999-06-24  Andrew Haley  <aph@cygnus.com>
	* java/class.c (finish_class): Whenever a deferred method is
	output, rescan the list of methods to see if a new candidate for
	output can be found.

From-SVN: r27725
1999-06-24 10:21:59 +00:00
Jeff Law ae0287b6bc Daily bump.
From-SVN: r27724
1999-06-23 18:45:32 -06:00
Jeff Law 29727172c8 Daily bump.
From-SVN: r27713
1999-06-22 18:45:32 -06:00
Andrew Haley 798f3ef964 verify.c (verify_jvm_instructions): Check for pending blocks before invalid PC test and opcode switch, not after.
1999-06-22  Andrew Haley  <aph@cygnus.com>
	* verify.c (verify_jvm_instructions): Check for pending blocks
	before invalid PC test and opcode switch, not after.

From-SVN: r27711
1999-06-22 23:33:10 +00:00
Tom Tromey 9395bc469c configure.in (target_libs): Added target-zlib.
* configure.in (target_libs): Added target-zlib.
	* Makefile.in (ALL_TARGET_MODULES): Added zlib.
	(CONFIGURE_TARGET_MODULES): Likewise.
	(CHECK_TARGET_MODULES): Likewise.
	(INSTALL_TARGET_MODULES): Likewise.
	(CLEAN_TARGET_MODULES): Likewise.
	(configure-target-zlib): New target.
	(all-target-zlib): Likewise.
	(all-target-libjava): Depend on all-target-zlib.
	(configure-target-libjava): Depend on configure-target-zlib.
	* Makefile.in (configure-target-libjava): Depend on
	configure-target-newlib.
	(configure-target-boehm-gc): New target.
	(configure-target-qthreads): New target.
        * configure.in (host_tools): Added zip.
        * Makefile.in (all-target-libjava): Depend on all-zip.
        (all-zip): New target.
        (ALL_MODULES): Added all-zip.
        (NATIVE_CHECK_MODULES): Added check-zip.
        (INSTALL_MODULES): Added install-zip.
        (CLEAN_MODULES): Added clean-zip.
        * configure.in (target_libs): Added target-qthreads.
        * Makefile.in (ALL_TARGET_MODULES): Added qthreads.
        (CONFIGURE_TARGET_MODULES): Likewise.
        (CHECK_TARGET_MODULES): Likewise.
        (INSTALL_TARGET_MODULES): Likewise.
        (CLEAN_TARGET_MODULES): Likewise.
        (all-target-qthreads): New target.
        (configure-target-libjava): Depend on configure-target-qthreads.
        (all-target-libjava): Depend on all-target-qthreads.
	* Makefile.in (ALL_TARGET_MODULES): Added libjava, boehm-gc.
	(CONFIGURE_TARGET_MODULES): Likewise.
	(CHECK_TARGET_MODULES): Likewise.
	(INSTALL_TARGET_MODULES): Likewise.
	(CLEAN_TARGET_MODULES): Likewise.
	(all-target-libjava): New target.
	(all-target-boehm-gc): Likewise.
	* configure.in (target_libs): Added libjava, boehm-gc.

From-SVN: r27707
1999-06-22 16:44:42 -06:00
Mark Mitchell 6065e5e81c init.c (expand_aggr_vbase_init): Rename to construct_virtual_bases.
* init.c (expand_aggr_vbase_init): Rename to
	construct_virtual_bases.  Conditionalize construction here,
	rather than ...
	(emit_base_init): Here.

From-SVN: r27702
1999-06-22 07:23:30 +00:00
Stephen L Moshier 48b8bd155f Forgot to commit with libtool update.
From-SVN: r27700
1999-06-21 21:18:33 -06:00
Stephen L Moshier da4c866ee4 ltconfig, ltmain.sh: Update to libtool 1.2f.
�
        * ltconfig, ltmain.sh: Update to libtool 1.2f.

From-SVN: r27698
1999-06-21 20:35:14 -06:00
Jeff Law a599e57450 rs6000.md (movdf_hardfloat32): Use %X instead of always emitting 'x' when handling non-offsettable addresses
h
        * rs6000.md (movdf_hardfloat32): Use %X instead of always emitting
        'x' when handling non-offsettable addresses

From-SVN: r27695
1999-06-21 18:59:45 -06:00
Jeff Law 28fb97bc89 rs6000.md (movdf_hardfloat32): Use %X instead of always emitting 'x' when handling non-offsettable addresses
�
        * rs6000.md (movdf_hardfloat32): Use %X instead of always emitting
        'x' when handling non-offsettable addresses

From-SVN: r27694
1999-06-21 18:59:36 -06:00
Jeff Law 5c9a73cf5a Daily bump.
From-SVN: r27693
1999-06-21 18:45:33 -06:00
Richard Earnshaw f6289955fe final.c (shorten_branches): Don't try to split an insn that has been deleted.
Tue Jun 22 00:20:05 1999  Richard Earnshaw (rearnsha@arm.com)
        * final.c (shorten_branches): Don't try to split an insn that has
        been deleted.

From-SVN: r27689
1999-06-21 17:21:23 -06:00
Jeffrey A Law 30bcbf82c2 Thu Jun 17 15:07 1999 Bruce Korb <ddsinc09@ix.netcom.com>
Thu Jun 17 15:07 1999  Bruce Korb <ddsinc09@ix.netcom.com>
        * fixincludes: ISCNTL patch

From-SVN: r27687
1999-06-21 16:33:39 -06:00
Jeff Law dc56640e3d rs6000.c (find_addr_reg): Handle LO_SUM addresses.
* rs6000.c (find_addr_reg): Handle LO_SUM addresses.
        * rs6000.md (movdf_hardfloat32): Fix typo.

From-SVN: r27685
1999-06-21 15:20:52 -06:00
Richard Henderson c4dfad4b74 alpha.h (UNALIGNED_SHORT_ASM_OP): Define.
* alpha/alpha.h (UNALIGNED_SHORT_ASM_OP): Define.
        (UNALIGNED_INT_ASM_OP, UNALIGNED_DOUBLE_INT_ASM_OP): Define.
        * alpha/elf.h: Undef them again.
        * alpha/vms.h: Remove their definitions.

From-SVN: r27679
1999-06-21 13:15:14 -07:00
Richard Henderson 064b82ec17 collect2.c (main): Log frame table count.
* collect2.c (main): Log frame table count.
        (GCC_OK_SYMBOL) [ECOFF]: Accept stGlobal.
        (scan_prog_file) [COFF]: Handle frame tables.

From-SVN: r27678
1999-06-21 13:14:24 -07:00
Jakub Jelinek 1b067dd4c3 Jakub Jelinek <jj@ultra.linux.cz>
Jakub Jelinek  <jj@ultra.linux.cz>
        * real.c (ereal_from_double): Fix for 64-bit big endian hosts.
        * emit-rtl.c (gen_lowpart_common): Add case for hosts where double
        fits in HOST_WIDE_INT and one uses union to access a long constant
        as double.

From-SVN: r27674
1999-06-21 10:52:03 -07:00
Richard Henderson fae042baee sparc.c (sparc_override_options): Don't allow profiling for code models other than medlow.
* sparc.c (sparc_override_options): Don't allow profiling for
        code models other than medlow.
        (sparc_function_profiler): New function from old FUNCTION_PROFILER
        macro.  Use ASM_GENERATE_INTERNAL_LABEL and MCOUNT_FUNCTION.
        (sparc_function_block_profiler): Likewise.  Use user_label_prefix.
        (sparc_block_profiler): Likewise.
        (sparc_function_block_profiler_exit): Likewise.
        * sparc.h (FUNCTION_PROFILER): Call new sparc.c function.
        (FUNCTION_BLOCK_PROFILER): Likewise.
        (BLOCK_PROFILER): Likewise.
        (FUNCTION_BLOCK_PROFILER_EXIT): Likewise.
        (MCOUNT_FUNCTION): New.
        * sparc/pbd.h (FUNCTION_PROFILER): Delete.
        (FUNCTION_BLOCK_PROFILER, BLOCK_PROFILER): Delete.
        * sparc/sun4o3.h (FUNCTION_PROFILER): Delete.
        (MCOUNT_FUNCTION): New.
        * sparc/sysv4.h (FUNCTION_BLOCK_PROFILER): Delete.
        (BLOCK_PROFILER): Delete.
        (MCOUNT_FUNCTION): New.

From-SVN: r27673
1999-06-21 10:48:53 -07:00
Jason Merrill 1d8d1fcd6a up
From-SVN: r27665
1999-06-21 08:13:36 -04:00
Andrew Haley c56167522b More important patches from the trunk:
* except.c (find_handler_in_range): The upper limit for exception
        ranges is exclusive, not inclusive: (start <= pc < end).
        (link_handler): find child pointer which points to outer by
        searching sibling list: previous code incorrectly assumed that
        outer->outer->first_child must point to outer.
        * verify.c (verify_jvm_instructions): FIXME added to code for
        `athrow'.
        (verify_jvm_instructions): Do not assume that the last block
        processed in a subroutine is a block which ends with a `ret'
        instruction.  With some control flows it is possible that the last
        block ends with an `athrow'.

From-SVN: r27664
1999-06-21 12:09:20 +00:00
Gerald Pfeifer 4f58a86a63 * g77.texi: Update links.
From-SVN: r27663
1999-06-21 11:58:54 +00:00
Mark Elbrecht 29862e5ef8 djgpp.h (LIB_SPEC): New.
Mon Jun 21 06:22:21 1999  Mark Elbrecht <snowball3@bigfoot.com>
        * i386/djgpp.h (LIB_SPEC): New.
        (STARTFILE_SPEC): New.
        * i386/xm-djgpp.h (NO_SYS_SIGLIST): Deleted. Now obsolete.

From-SVN: r27656
1999-06-20 23:24:33 -06:00
Philippe De Muyter 68d14d30c7 Makefile.in (gnu-regex.o): Do not define STDC_HEADERS in compiler flags.
x
        * fixinc/Makefile.in (gnu-regex.o): Do not define STDC_HEADERS in
        compiler flags.
        * system.h (WSTOPSIG): New macro.

From-SVN: r27651
1999-06-20 23:20:58 -06:00
Philippe De Muyter 489107d01a Makefile.in (gnu-regex.o): Do not define STDC_HEADERS in compiler flags.
�
        * fixinc/Makefile.in (gnu-regex.o): Do not define STDC_HEADERS in
        compiler flags.
        * system.h (WSTOPSIG): New macro.

From-SVN: r27650
1999-06-20 23:20:47 -06:00
Mumit Khan 1b56b7aef5 c-pragma.c (push_alignment): Don't ignore alignments greater than 4 bytes.
* c-pragma.c (push_alignment): Don't ignore alignments greater than
        4 bytes.
        (insert_pack_attributes): Take into account member natural
        alignment.

From-SVN: r27649
1999-06-20 23:12:17 -06:00
Andreas Schwab 4119506c73 configure.in (checkfuncs): Add gettimeofday.
X
        * configure.in (checkfuncs): Add gettimeofday.
        * config.in, configure: Regenerated.

From-SVN: r27646
1999-06-20 23:00:27 -06:00
Andreas Schwab 594f64f9d4 configure.in (checkfuncs): Add gettimeofday.
�
        * configure.in (checkfuncs): Add gettimeofday.
        * config.in, configure: Regenerated.

From-SVN: r27645
1999-06-20 23:00:25 -06:00
Andreas Schwab b3f76e199f configure.in (checkfuncs): Add gettimeofday.
�
        * configure.in (checkfuncs): Add gettimeofday.
        * config.in, configure: Regenerated.

From-SVN: r27644
1999-06-20 23:00:22 -06:00
Mumit Khan 82e7abff05 configure.in (*-*-uwin*): UWIN has sys_{errlist,nerr} even if the test fails.
* configure.in (*-*-uwin*): UWIN has sys_{errlist,nerr} even if
        the test fails.
        * configure: Regenerate.

From-SVN: r27643
1999-06-20 22:57:21 -06:00
Mumit Khan 393bfdedde winnt.c (exports_head): New static variable.
* i386/winnt.c (exports_head): New static variable.
        (i386_pe_record_exported_symbol): New function.
        (i386_pe_asm_file_end): Use.
        * i386/cygwin.h (ASM_OUTPUT_COMMON): Record the exported
        symbols to be emitted at end of assembly.
        (ASM_DECLARE_OBJECT_NAME): Likewise.
        (ASM_DECLARE_FUNCTION_NAME): Likewise.

From-SVN: r27640
1999-06-20 22:54:45 -06:00
Jeff Law 4b03ba27b7 init.c (__objc_force_linking): Make global.
8
        * init.c (__objc_force_linking): Make global.

From-SVN: r27637
1999-06-20 22:41:26 -06:00
Jeff Law 2c9aec7321 init.c (__objc_force_linking): Make global.
�
        * init.c (__objc_force_linking): Make global.

From-SVN: r27636
1999-06-20 22:41:24 -06:00
Mumit Khan de3d4fd327 uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and -iwithprefix.
P
        * i386/uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and
        -iwithprefix.

From-SVN: r27635
1999-06-20 22:37:03 -06:00
Mumit Khan 11a6824170 uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and -iwithprefix.
�
        * i386/uwin.h (CPP_SPEC): Use -idirafter instead -iprefix and
        -iwithprefix.

From-SVN: r27634
1999-06-20 22:36:56 -06:00
David Edelsohn b514dbe538 rs6000.md (movdf_hardfloat32): Use worst case insn length attributes for cases 1 and 2.
* rs6000.md (movdf_hardfloat32): Use worst case insn length
        attributes for cases 1 and 2.
        * rs6000.c (find_addr_reg): New function.
        * rs6000.h (find_addr_reg): Declare.
        (offsettable_addr_operand): Delete.
        * rs6000.md (movdf_hardfloat32): Handle non-offsettable loads
        from and stores to GPRs.

From-SVN: r27629
1999-06-20 22:18:49 -06:00
Jeff Law 7e4f864f0a sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Fix paren error introduced in last change.
P
        * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Fix paren error introduced
        in last change.

From-SVN: r27628
1999-06-20 21:47:36 -06:00
Jeff Law fc5e551a3c sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Fix paren error introduced in last change.
�
        * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Fix paren error introduced
        in last change.

From-SVN: r27627
1999-06-20 21:47:29 -06:00
Jeff Law c3acf71407 Daily bump.
From-SVN: r27624
1999-06-20 18:45:33 -06:00
Richard Henderson 4b70fa01a3 * haifa-sched.c (sched_analyze): Don't clear reg_last_uses on calls.
From-SVN: r27621
1999-06-20 10:25:22 -07:00
Jeff Law 4f26f8cb2b Daily bump.
From-SVN: r27619
1999-06-19 18:45:33 -06:00
Mark Mitchell 697f7813c8 semantics.c (finish_asm_statement): Apply decay conversions to input operands.
* semantics.c (finish_asm_statement): Apply decay conversions to
        input operands.

From-SVN: r27616
1999-06-19 17:54:52 -06:00
Richard Henderson 87527d5264 haifa-sched.c (sched_analyze): Mark call-user regs as clobbered instead of set.
* haifa-sched.c (sched_analyze): Mark call-user regs as clobbered
        instead of set.

From-SVN: r27614
1999-06-19 15:53:34 -07:00
Mark Mitchell 5c4c5606ed decl.c (expand_static_init): When building an anonymous function for use with atexit...
* decl.c (expand_static_init): When building an anonymous function
	for use with atexit, compute its body before and after entering
	the function.

From-SVN: r27613
1999-06-19 11:17:56 +00:00
Richard Earnshaw 72afef24c8 arm.c (arm_override_options): Remove warning about PIC code not being supported.
* arm.c (arm_override_options): Remove warning about PIC code
not being supported.

From-SVN: r27611
1999-06-19 06:34:36 +00:00
Philip Blundell 63cf5e848b From Phil Blundell:
* arm.c (arm_reload_in_hi): Invert sense of test on BYTES_BIG_ENDIAN.

From-SVN: r27608
1999-06-19 05:57:31 +00:00
Richard Earnshaw e15abbde52 arm.h (CONDITIONAL_REGISTER_USAGE): If flag_pic, never use PIC_OFFSET_TABLE_REGNUM for general alloaction.
* arm.h (CONDITIONAL_REGISTER_USAGE): If flag_pic, never use
PIC_OFFSET_TABLE_REGNUM for general alloaction.
(INITIAL_ELIMINATION_OFFSET): Count the fact that the PIC register
must be stacked if it is used for PIC accesses.
* arm.c (use_return_insn): Handle PIC register specially.
(output_return_instruction): Likewise.
(output_func_{prologue,epilogue}): Likewise.
(output_expand_prologue): Likewise.

From-SVN: r27606
1999-06-19 05:37:07 +00:00
Jeff Law e24532cd44 Daily bump.
From-SVN: r27604
1999-06-18 18:45:33 -06:00
Mark Mitchell f683c50980 init.c (expand_aggr_vbase_init): Add flag parameter.
* init.c (expand_aggr_vbase_init): Add flag parameter.
	(build_partial_cleanup_for): Remove, inlining into ..
	(expand_cleanup_for_base): ... here.  Take flag parameter.
	(emit_base_init): Pass the in_chrg parameter to
	emit_aggr_vbase_init.
	(emit_aggr_vbase_init): Pass it to expand_cleanup_for_base.

From-SVN: r27601
1999-06-18 20:39:14 +00:00
Alexandre Petit-Bianco 2611667cb5 More important Java patches:
Mon Jun 14 13:13:39 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (qualify_ambiguous_name): Reorganized the post
 	evaluation of non WFL leading expression nodes.
Fri Jun 11 21:37:18 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (qualify_ambiguous_name): Handle ARRAY_REF after
 	CONVERT_EXPR.
Thu Jun 10 22:26:17 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (qualify_ambiguous_name): Handle qualified expression
 	beginning with a STRING_CST.
Thu Jun 10 20:27:25 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (register_fields): Set DECL_INITIAL on both
 	pre-initialized static and public fields.
	(resolve_field_access): Static field access expressions to always
 	use pointer types.
	(qualify_ambiguous_name): Work out buried CALL_EXPR for proper
 	qualification. CONVERT_EXPR to be resolved as an expression name.
	(java_complete_lhs): Identify and access qualified final
 	initialized field in switch statement case expression.
	(fold_constant_for_init): Pre-initialized field decl constant to
 	be folded.
Mon Jun  7 16:09:51 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
	* parse.y (note_possible_classname): Mark returned node with
 	QUALIFIED_P only if the original class name contained a '/'.

From-SVN: r27599
1999-06-18 18:05:33 +00:00
Richard Henderson b0aa1f25eb alpha.c (alpha_expand_block_move): Use get_insns rather than gen_sequence as argument to emit_no_conflict_block.
* alpha.c (alpha_expand_block_move): Use get_insns rather than
        gen_sequence as argument to emit_no_conflict_block.

From-SVN: r27597
1999-06-18 08:45:46 -07:00
Kaveh R. Ghazi 70715c67f7 Fix the definition of _*ISCTRL() macro
From-SVN: r27589
1999-06-18 07:00:07 +00:00
Jeff Law 70185355ea Daily bump.
From-SVN: r27584
1999-06-17 18:46:34 -06:00
Martin v. Löwis 3168e08d9e * stl_queue.h: Rename _M_c to c, and _M_comp to comp.
From-SVN: r27582
1999-06-18 00:00:11 +00:00
Jeffrey A Law c5a5303b3e * invoke.texi (ia32 options): Fix typo.
From-SVN: r27579
1999-06-17 16:37:29 -06:00
David O'Brien 415177981b * i386/freebsd-elf.h (LINK_SPEC): Fix typo.
From-SVN: r27571
1999-06-17 06:33:32 -06:00
David O'Brien 1a391dc9dd freebsd-elf.h (FUNCTION_PROFILER): labels are not needed and the reference to `mcount' was not correct for the ELF...
�
        * i386/freebsd-elf.h (FUNCTION_PROFILER): labels are not needed and
        the reference to `mcount' was not correct for the ELF on FreeBSD.

From-SVN: r27569
1999-06-17 06:30:53 -06:00
David O'Brien 9a9ea08827 freebsd-elf.h (FUNCTION_PROFILER): labels are not needed and the reference to `mcount' was not correct for the ELF...
�
        * i386/freebsd-elf.h (FUNCTION_PROFILER): labels are not needed and
        the reference to `mcount' was not correct for the ELF on FreeBSD.

From-SVN: r27568
1999-06-17 06:30:44 -06:00
Jeffrey A Law 2e9bf3452f emit-rtl.c (operand_subword): Tighten checks for when it is safe to safe to extract a subword out of a REG.
* emit-rtl.c (operand_subword): Tighten checks for when it is safe
        to safe to extract a subword out of a REG.

From-SVN: r27563
1999-06-16 19:55:57 -06:00
Jeff Law 9ac4aa4a47 Daily bump.
From-SVN: r27561
1999-06-16 18:45:32 -06:00
Alexandre Oliva 7c5d58de8f stl_algo.h (transform): Rename __opr to __oper, as __opr is used internally by egcs.
* stl_algo.h (transform): Rename __opr to __oper, as __opr is used
internally by egcs.
Reported by Harri Porten <porten@tu-harburg.de>

From-SVN: r27557
1999-06-16 22:22:07 +00:00
Mark Mitchell 571bcbba58 decl2.c (import_export_decl): Use same_type_p, rather than relying on pointer-equality for types.
* decl2.c (import_export_decl): Use same_type_p, rather than
	relying on pointer-equality for types.
	* method.c (do_build_copy_constructor): Simplify.

From-SVN: r27556
1999-06-16 17:49:59 +00:00
Gerald Pfeifer e8ed7a60df Remove obsolete file, whose contents has moved to the web pages as
projects.html.

From-SVN: r27553
1999-06-16 13:38:33 +00:00
Mark Mitchell 44a4822dac call.c (build_method_call): Remove bogus code for two-argument delete.
* call.c (build_method_call): Remove bogus code for two-argument
	delete.

From-SVN: r27548
1999-06-16 11:26:26 +00:00
Jason Merrill 4184bd2a2e dwarfout.c (add_incomplete_type): New fn.
* dwarfout.c (add_incomplete_type): New fn.
	(output_type): Call it.
	(retry_incomplete_types): New fn.
	(dwarfout_finish): Call it.
	From Eric Raskin <ehr@listworks.com>:
	(output_type): Output types for bases.

From-SVN: r27545
1999-06-16 06:38:19 -04:00
Mark Mitchell 5a452823e5 init.c (expand_cleanup_for_base): New function, split out from ...
* init.c (expand_cleanup_for_base): New function, split out
	from ...
	(emit_base_init): Here.
	(expand_aggr_vbase_init): Use it.

From-SVN: r27544
1999-06-16 10:27:16 +00:00
Craig Burley 69c3ab084c fix BACKSPACE, doc fix, update derived file
From-SVN: r27542
1999-06-16 05:03:30 -04:00
Jeff Law b29b0b76bf Daily bump.
From-SVN: r27539
1999-06-15 18:46:04 -06:00
Mark Mitchell ad8b2b1ea1 cp-tree.h (class_cache_firstobj): Declare.
* cp-tree.h (class_cache_firstobj): Declare.
	(maybe_push_cache_obstack): Rename to push_cache_obstack.
	* class.c (permanent_obstack): Remove declaration.
	(class_cache_firstobj): Make it global.
	(add_method): Don't use permanent_obstack directly.
	(pushclass): Only free the class_cache_obstack if we know how far
	back to free it.
	(maybe_push_cache_obstack): Rename to push_cache_obstack.
	* decl.c: Remove dead comment.
	(saved_scope): Add class_cache_firstobj.
	(push_to_top_level): Save it.
	(pop_from_top_level): Restore it.
	(push_class_level_binding): Use push_cache_obstack, not
	maybe_push_cache_obstack.
	* search.c (push_class_decls): Likewise.

From-SVN: r27535
1999-06-15 16:48:27 +00:00
David O'Brien 5a386d81c0 freebsd-elf.h (LINK_SPEC): clean up the linking library specifications and make it realistic.
�
        * i386/freebsd-elf.h (LINK_SPEC): clean up the linking library
        specifications and make it realistic.
        (LIB_SPEC): Likewise.

From-SVN: r27532
1999-06-14 18:58:11 -06:00
David O'Brien 0b0b1fcdf5 freebsd-elf.h (LINK_SPEC): clean up the linking library specifications and make it realistic.
�
        * i386/freebsd-elf.h (LINK_SPEC): clean up the linking library
        specifications and make it realistic.
        (LIB_SPEC): Likewise.

From-SVN: r27531
1999-06-14 18:58:04 -06:00
Jeff Law e3b3b3fe8c Daily bump.
From-SVN: r27528
1999-06-14 18:47:06 -06:00
Martin v. Löwis b0d052abc6 * ChangeLog, pt.c: Undo last change
From-SVN: r27526
1999-06-14 22:06:36 +00:00
Martin v. Löwis 19d3862024 pt.c (tsubst_friend_function): Push into namespace of friend function before pushdecl'ing it.
* pt.c (tsubst_friend_function): Push into namespace of friend
	function before pushdecl'ing it.

From-SVN: r27522
1999-06-14 16:13:10 +00:00
Nathan Sidwell 5776437dbf * call.c (build_new_op): Remove REF_BIND from all operands.
From-SVN: r27515
1999-06-14 03:19:21 +00:00
Jeff Law 5159d7a166 configure.in (rs6000-ibm-aix4.3*, [...]): Do not require a sub-version #.
p
        * configure.in (rs6000-ibm-aix4.3*, powerpc-ibm-aix4.3*): Do not
        require a sub-version #.
        * configure: Rebuilt.

From-SVN: r27512
1999-06-13 20:59:13 -06:00
Jeff Law 2c7a4bae53 configure.in (rs6000-ibm-aix4.3*, [...]): Do not require a sub-version #.
�
        * configure.in (rs6000-ibm-aix4.3*, powerpc-ibm-aix4.3*): Do not
        require a sub-version #.
        * configure: Rebuilt.

From-SVN: r27511
1999-06-13 20:58:51 -06:00
Robert Lipe 72a60d1c1a * svr4.h (DWARF2_DEBUGGING_INFO): Check for redefinition.
From-SVN: r27508
1999-06-13 20:41:38 -06:00
Andreas Jaeger 96ce37c517 * gcc.texi: Mention gcc 2.96 instead of egcs 1.00.
From-SVN: r27506
1999-06-13 20:37:29 -06:00
Jeff Law cf8b527079 Daily bump.
From-SVN: r27504
1999-06-13 18:46:03 -06:00
Mark Mitchell 99bbfb2fd0 * invoke.texi (node Option Summary): Add -fpermissive flag.
From-SVN: r27501
1999-06-13 01:09:03 +00:00
Jeff Law 79d4915cc9 Daily bump.
From-SVN: r27498
1999-06-12 18:45:34 -06:00
Alexandre Oliva a4e2adffca test_summary: Set default mail-address and version for egcs instead of relying on...
* test_summary: Set default mail-address and version for egcs
instead of relying on unpredictable pathnames.
Reported by Andreas Jaeger <aj@arthur.rhein-neckar.de>

From-SVN: r27497
1999-06-12 15:19:31 +00:00
Jeffrey A Law d9f77a641b sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Do nothing with operands that require PIC code sequences.
�
        * sparc.h (LEGITIMIZE_RELOAD_ADDRESS): Do nothing with operands
        that require PIC code sequences.
Fixes libstdc++ & libg++ failures on sparc platforms.

From-SVN: r27493
1999-06-11 20:42:16 -06:00
Jeff Law 82d3cadd89 Daily bump.
From-SVN: r27491
1999-06-11 18:45:03 -06:00
Jeffrey A Law 6f7e303116 Makefile.in (libgcc2): Pass MAYBE_USE_COLLECT2 as an argument.
* Makefile.in (libgcc2): Pass MAYBE_USE_COLLECT2 as an argument.
        * libgcc2.c (__CTOR_LIST, __DTOR_LIST); Do not provide
        initializers is some circumstances.

From-SVN: r27488
1999-06-10 21:11:43 -06:00
Jeffrey A Law 0264f41dc6 inclhack.def (endif_label): Add additional selector for more bogus stuff after #endif statements.
�
        * fixinc/inclhack.def (endif_label): Add additional selector for
        more bogus stuff after #endif statements.
        * fixinc/inclhack.sh, fixinc/fixincl.x: Rebuilt.
Fixes alphaosf & ibm-aix fixinc problems.

From-SVN: r27485
1999-06-10 20:18:44 -06:00
Jeff Law 3de9e91258 Daily bump.
From-SVN: r27483
1999-06-10 18:45:33 -06:00
Bruce Korb a3df2af7b6 inclhack.def (sun_auth_proto): We do not know how to test for the presence of valid prototypes.
* fixinc/inclhack.def(sun_auth_proto): We do not know how to
        test for the presence of valid prototypes.  Delete bypass expr.
        (ioctl_fix_ctrl): Correct the selection expression.
Bring over from the mainline tree.  Resync.

From-SVN: r27480
1999-06-10 16:23:02 -06:00
Mumit Khan 5b89421246 Mumit Khan <khan@xraylith.wisc.edu>
Mumit Khan  <khan@xraylith.wisc.edu>
        * i386/cygwin.h (SET_ASM_OP): Define.

From-SVN: r27479
1999-06-10 13:45:53 -07:00
Mike Stump 2f5f8402c7 Mike Stump <mrs@wrs.com>
Mike Stump  <mrs@wrs.com>
        * Makefile.in (setenv.o): Add config.h dep for setenv.o to fix
        parallel builds.

From-SVN: r27476
1999-06-10 13:43:07 -07:00
Richard Henderson 53d900f99f Mumit Khan <khan@xraylith.wisc.edu>
Mumit Khan  <khan@xraylith.wisc.edu>
        * reg-stack.c (stack_reg_life_analysis): Find all the RETURN insns.

From-SVN: r27474
1999-06-10 13:39:28 -07:00
Bruce Korb 5fdd7df9e0 Fixed string formations
From-SVN: r27472
1999-06-10 14:49:54 +00:00
Jeff Law 7f39df30ee Daily bump.
From-SVN: r27464
1999-06-09 18:45:04 -06:00
Jeffrey A Law c3d7bab515 loop.c (strength_reduce): Disable biv->giv translations and giv recombination.
* loop.c (strength_reduce): Disable biv->giv translations and
        giv recombination.  For the release branch only.
Should work around 990513-1.c regressions.  Possibly others.  I'll be
running some new tests soon :-)

From-SVN: r27463
1999-06-09 18:24:42 -06:00
J"orn Rennecke baee0a5374 loop.c (loop_insn_first_p): Don't compare LUIDs when P is a note...
* loop.c (loop_insn_first_p): Don't compare LUIDs when P
        is a note; use <= for the compare; advance P while it is
        a NOTE.
Bring bugfix over from mainline sources.

From-SVN: r27462
1999-06-09 16:39:44 -06:00
Bruce Korb f70de1a5b6 Wed Jun 9 06:50 1999 Bruce Korb <ddsinc09@ix.netcom.com>
Wed Jun  9 06:50 1999  Bruce Korb <ddsinc09@ix.netcom.com>
        *fixinc/inclhack.def(sun_auth_proto): bypass the patch if
        the typed arguments are not part of a comment
        (ioctl_fix_ctrl): Added a purpose comment
        *fixinc/fixincl.x: regenerate
        *fixinc/inclhack.sh: regenerate
Bring over from the mainline sources.

From-SVN: r27461
1999-06-09 16:23:37 -06:00
Jeffrey A Law 1b9e55e9fb inclhack.def (no_double_slash): Fix quoting for test.
* fixinc/inclhack.def (no_double_slash): Fix quoting for test.
        * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh; Rebuilt.
Fixes "//" problem with fixinc on alphas.

From-SVN: r27459
1999-06-09 16:16:33 -06:00
Franz Sirl ec33af3f8a Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
        * rs6000.md (movsi_got_internal_mem): Delete.
        * rs6000.h (CONDITIONAL_REGISTER_USAGE): Mark PIC_OFFSET_TABLE_REGNUM.
        (GOT_TOC_REGNUM): Delete.
        (PIC_OFFSET_TABLE_REGNUM): Define.
        (FINALIZE_PIC): Disable.
        * rs6000.c (rs6000_got_register): New code for fixed pic register.
        (rs6000_replace_regno): Delete.
        (rs6000_finalize_pic): Likewise.
        (output_prolog): Handle PIC_OFFSET_TABLE_REGNUM.

From-SVN: r27456
1999-06-09 08:59:39 -07:00
Jeff Law e48792aa77 varasm.c (remove_from_pending_weak_list): Verify t->name is non-NULL before passing it to strcmp.
h
        * varasm.c (remove_from_pending_weak_list): Verify t->name
        is non-NULL before passing it to strcmp.

From-SVN: r27452
1999-06-09 06:13:49 -06:00
Jeff Law 596bd8b94f varasm.c (remove_from_pending_weak_list): Verify t->name is non-NULL before passing it to strcmp.
�
        * varasm.c (remove_from_pending_weak_list): Verify t->name
        is non-NULL before passing it to strcmp.

From-SVN: r27451
1999-06-09 06:13:43 -06:00
Michael Hayes 0275b2cc0f * invoke.texi: Add C4x invocation docs.
From-SVN: r27446
1999-06-09 04:09:34 +00:00
Michael Hayes 69c2b67873 c4x.h (TARGET_EXPOSE_LDP, [...]): Define new macros.
* config/c4x/c4x.h (TARGET_EXPOSE_LDP, LEGITIMIZE_RELOAD_ADDRESS):
	Define new macros.
	* config/c4x/c4x.c (c4x_emit_move_sequence, src_operand): Use
	TARGET_EXPOSE_LDP.
	(c4x_legitimize_reload_address): New function.
	* config/c4x/c4x.md: Update docs.

From-SVN: r27444
1999-06-09 03:51:38 +00:00
Jeffrey A Law 9426ff6729 fixincludes: Avoid removing '.'.
�
        * fixincludes: Avoid removing '.'.
        * fixinc/fixinc.svr4: Likewise.
        * fixinc/fixinc.winnt: Likewise.
        * fixinc/inclhack.tpl: Likewise.
        * fixinc/fixincl.sh, fixinc/inclhack.sh: Rebuilt.

From-SVN: r27442
1999-06-08 21:22:09 -06:00
Jeff Law cb4469e7fb fixincludes: Avoid removing '.'.
�
        * fixincludes: Avoid removing '.'.
        * fixinc/fixinc.svr4: Likewise.
        * fixinc/fixinc.winnt: Likewise.
        * fixinc/inclhack.tpl: Likewise.
        * fixinc/fixincl.sh, fixinc/inclhack.sh: Rebuilt.

From-SVN: r27441
1999-06-08 21:21:59 -06:00
Jim Wilson 6f394837bf configure.in (rs6000-ibm-aix4.[12]*): Change rx6000 to rs6000.
* configure.in (rs6000-ibm-aix4.[12]*): Change rx6000 to rs6000.
        * configure: Regenerate.
        * configure.in (rs6000-ibm-aix4.[12]*): Delete use of aix41-gld.h.
        Add use of x-aix41-gld.
Bring over from the mainline tree to fix various problems building
aix4.1 --with-gnu-ld.

From-SVN: r27437
1999-06-08 21:03:18 -06:00
Kaveh R. Ghazi 04a4044da7 inclhack.def (sun_catmacro): Escape parens in the select pattern.
�
        * fixinc/inclhack.def (sun_catmacro): Escape parens in the select
        pattern.
        * fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt.

From-SVN: r27436
1999-06-08 20:53:32 -06:00
Kaveh R. Ghazi 0185f0a021 inclhack.def (sun_catmacro): Escape parens in the select pattern.
�
        * fixinc/inclhack.def (sun_catmacro): Escape parens in the select
        pattern.
        * fixinc/fixincl.x, fixinc/inclhack.sh: Rebuilt.

From-SVN: r27435
1999-06-08 20:53:19 -06:00
Mumit Khan 6d2570d730 c-pragma.c (handle_pragma_token): Handle `#pragma pack()' correctly.
* c-pragma.c (handle_pragma_token): Handle `#pragma pack()'
        correctly.

From-SVN: r27433
1999-06-08 20:17:44 -06:00
Jeff Law 93b52d8487 inclhack.def (bad_lval): Remove bogus selector.
* fixinc/inclhack.def (bad_lval): Remove bogus selector.
        * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh; Rebuilt.
Forgot to commit the ChangeLog entry

From-SVN: r27431
1999-06-08 20:11:20 -06:00
Jeff Law 7f88de5888 Daily bump.
From-SVN: r27430
1999-06-08 18:45:33 -06:00
Richard Earnshaw 1c3cfa7400 optabs.c (expand_cmplxdiv_wide): Use expand_abs to get the absolute values.
* optabs.c (expand_cmplxdiv_wide): Use expand_abs to get the absolute
values.

From-SVN: r27427
1999-06-08 05:51:49 +00:00
Jeff Law 4a7bc4cf97 inclhack.def (bad_lval): Remove bogus selector.
* fixinc/inclhack.def (bad_lval): Remove bogus selector.
        * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh; Rebuilt.

From-SVN: r27422
1999-06-07 19:50:56 -06:00
Jeff Law af425bd75c Daily bump.
From-SVN: r27420
1999-06-07 18:45:32 -06:00
Jeffrey A Law c7b8ab3403 inclhack.def (avoid_bool): Also catch "typedef [unsigned] int bool".
* fixinc/inclhack.def (avoid_bool): Also catch
        "typedef [unsigned] int bool".
        * fixinc/inclhack.sh, fixinc/fixincl.x, fixinc/fixincl.sh: Rebuilt.
Fixes libg++ build failure on aix4.2.

From-SVN: r27417
1999-06-07 18:09:52 -06:00
Jeffrey A Law 0df175e5ad configure.in (*-*-freebsd2*): Add missing '*' at end of configure string.
* configure.in (*-*-freebsd2*): Add missing '*' at end of configure
        string.

From-SVN: r27415
1999-06-07 17:28:10 -06:00
Jeffrey A Law 7ae3872634 x-hp3bsd44: Delete obsolete and incorrect file.
Mon Jun  7 22:30:37 1999  Jeffrey A Law  (law@cygnus.com)
        * m68k/x-hp3bsd44: Delete obsolete and incorrect file.
        * configure.in (m68k-hp-bsd4.4): No longer use x-hp3bsd44.
        * configure: Rebuilt.

From-SVN: r27409
1999-06-07 15:37:30 -06:00
Mark Kettenis 4bd88579ab gnu.h: Include <gnu.h> right after <i386/linux.h>...
�
        * config/i386/gnu.h: Include <gnu.h> right after <i386/linux.h>,
        such that we can override its definitions if necessary.
        (CPP_SPEC): New define.  Support processor specific predefines via
        %(cpp_cpu).
        (CC1_SPEC): New define.  Support processor specific compiler
        options via %(cc1_cpu).
        (STARTFILE_SPEC): New define.  Use crt0.o instead of crt1.o for
        -static.

From-SVN: r27408
1999-06-07 15:11:47 -06:00
Mark Kettenis 3cc1404499 gnu.h: Include <gnu.h> right after <i386/linux.h>...
�
        * config/i386/gnu.h: Include <gnu.h> right after <i386/linux.h>,
        such that we can override its definitions if necessary.
        (CPP_SPEC): New define.  Support processor specific predefines via
        %(cpp_cpu).
        (CC1_SPEC): New define.  Support processor specific compiler
        options via %(cc1_cpu).
        (STARTFILE_SPEC): New define.  Use crt0.o instead of crt1.o for
        -static.

From-SVN: r27407
1999-06-07 15:11:37 -06:00
Kaveh R. Ghazi 13255cf854 inclhack.def (math_gcc_ifndefs): Insert whitespace between sed's -e flag, and the open-quote following it.
* fixinc/inclhack.def (math_gcc_ifndefs): Insert whitespace
        between sed's -e flag, and the open-quote following it.
        * fixinc/fixincl.x, fixinc/fixincl.sh: Rebuilt.

From-SVN: r27404
1999-06-07 14:34:57 -06:00
Bruce Korb 63f987250f fixincl.c (global def): Add FD_SHELL_SCRIPT to mark fixes that need "file=xxx\n" prepended before...
* fixinc/fixincl.c(global def): Add FD_SHELL_SCRIPT to mark
        fixes that need "file=xxx\n" prepended before invocation
        (start_fixer - new): starting the fixer process is complex enough
        to warrent its own routine.  It prepends the "file=xxx\n" stuff.
        (process): uses the new routine; omit usage of putenv()
        * fixinc/fixincl.tpl: mark shell scripts with FD_SHELL_SCRIPT
        * fixinc/fixincl.x: regenerate
Bring over from the mainline tree.

From-SVN: r27403
1999-06-07 14:26:09 -06:00
Robert Lipe 1184c43a66 varasm.c (assemble_start_function): Remove the function from the pending weak decls list when we define a function.
* varasm.c (assemble_start_function): Remove the function
        from the pending weak decls list when we define a function.
        (assemble_variable): Similarly for variables.
        (weak_finish): Ignore items on the list with a NULL name.
        (remove_from_ending_weak_list); New function to "remove" an item
        from the pending weak declarations list.
Fixes various solaris & sco regressions.

Co-Authored-By: Jeffrey A Law <law@cygnus.com>

From-SVN: r27401
1999-06-07 13:46:11 -06:00
Jerry Quinn 708339f10b pa.md (fmpyfadd, [...]): New patterns.
(
        * pa.md (fmpyfadd, fmpynfadd, fnegabs): New patterns.

From-SVN: r27400
1999-06-07 13:37:47 -06:00
Jerry Quinn 399b54d5d4 pa.md (fmpyfadd, [...]): New patterns.
�
        * pa.md (fmpyfadd, fmpynfadd, fnegabs): New patterns.

From-SVN: r27399
1999-06-07 13:37:40 -06:00
Mark Mitchell d1a4ff1555 search.c (convert_pointer_to_single_level): Reimplement without using get_binfo.
* search.c (convert_pointer_to_single_level): Reimplement without
	using get_binfo.

From-SVN: r27395
1999-06-07 13:28:59 +00:00
Craig Burley 5c5b088851 Any target using libsubdir must depend on installdirs
From-SVN: r27390
1999-06-07 02:44:57 -04:00
Jeff Law bf6029c93d Daily bump.
From-SVN: r27388
1999-06-06 18:45:33 -06:00
Jakub Jelinek 16794d3a28 Jakub Jelinek <jj@ultra.linux.cz>
Jakub Jelinek  <jj@ultra.linux.cz>
        * sparc.md (abstf2): This should be an expand.
        (split after abstf2_notv9): Fix mode.
        (abstf2_hq_v9): New pattern.
        (abstf2_v9): Only use when no hard quad.
        (absdf2_v9): Fix if target is not the same as source.
        (ashrsi3_extend, ashrsi3_extend2, lshrsi3_extend, lshrsi3_extend2):
        Add correct output constraints.

From-SVN: r27385
1999-06-06 05:11:50 -07:00
Mark Mitchell a4c32195d3 method.c (is_back_referenceable_type): Back-reference bools when not squangling.
* method.c (is_back_referenceable_type): Back-reference bools when
	not squangling.

From-SVN: r27383
1999-06-06 11:06:58 +00:00
Mark Mitchell e7187d738b method.c (is_back_referenceable_type): Back-reference bools when not squangling.
* method.c (is_back_referenceable_type): Back-reference bools when
	not squangling.

[[Split portion of a mixed commit.]]

From-SVN: r27382.1
1999-06-06 11:06:53 +00:00
Jeff Law 48738758dc Daily bump.
From-SVN: r27381
1999-06-05 18:45:32 -06:00
Craig Burley c1d7e25449 update derived files
From-SVN: r27379
1999-06-05 18:08:13 -04:00
Craig Burley c7f353b629 describe more missing features
From-SVN: r27377
1999-06-05 17:54:13 -04:00
Craig Burley 29b0e20ac0 Dave Love's Intel-related doc fixes
From-SVN: r27374
1999-06-05 11:08:00 -04:00
Anthony Green 29d2d09d9b [multiple changes]
Sat Jun  5 11:46:59 1999  Anthony Green  <green@cygnus.com>
        * Make-lang.in (gcjh): More parallel build fixes.
1999-06-03  Mike Stump  <mrs@wrs.com>
        * Make-lang.in (JCF_DUMP_SOURCES, jvgenmain): Fix parallel builds.

From-SVN: r27372
1999-06-05 15:04:11 +00:00
Craig Burley 152b2f8694 replace with better test
From-SVN: r27371
1999-06-05 10:45:24 -04:00
Craig Burley 818944c63f Use libsubdir, not prefix, for lang-f77
From-SVN: r27366
1999-06-05 06:20:15 -04:00
Gabriel Dos Reis ff8b7430e6 * std/std_valarray.h: Don't #include unconditionally <alloca.h>
From-SVN: r27365
1999-06-05 09:44:56 +00:00
Anthony Green be62729610 [multiple changes]
Wed Jun  2 10:44:38 1999  Anthony Green  <green@cygnus.com>
        * except.c (link_handler): Chain exception handlers in order.
Wed Jun  2 10:41:24 1999  Anthony Green  <green@cygnus.com>
        * expr.c (expand_byte_code): Fill unreachable bytecode regions
        with nops and process as usual in order to always set correct EH
        ranges.  Emit detailed warnings about unreachable bytecodes.
Wed Jun  2 10:35:13 1999  Anthony Green  <green@cygnus.com>
        * class.c (build_utf8_ref): Mark cinit and utf8 tree nodes as
        constant.
Fri May 28 18:22:45 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (lookup_field_wrapper): Unified returned value to NULL
          or the searched field decl.
Fri May 28 11:34:05 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (fold_constant_for_init): Convert numerical constant
        values to the type of the assigned field.
Thu May 27 19:57:40 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * expr.c (lookup_field): Relaxed the test on class loading error
        detection.
        * parse.y (fold_constant_for_init): Enabeled old code.
Wed May 26 18:06:02 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (valid_ref_assignconv_cast_p): Let `_Jv_CheckCast'
        decide the validity of the cast of a java.lang.Cloneable reference
        to an array.
        (patch_conditional_expr): Fixed first argument passed to
        binary_numeric_promotion.
Wed May 26 15:33:06 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (qualify_ambiguous_name): Take into account that a
        CONVERT_EXPR might specify a type as a WFL.
Tue May 25 15:06:13 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (patch_assignment): Save the rhs before using it as an
        argument to _Jv_CheckArrayStore.
Tue May 25 11:23:59 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * lex.c (java_parse_doc_section): Fixed `tag' buffer size.
Mon May 24 13:26:00 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * lex.c (java_lex): Accepts `+' or `-' after the beginning of a
        floating point litteral only when the exponent indicator has been
        parsed.
Sat May 22 13:54:41 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (formal_parameter:): Construct argument tree list
        element even if a yet unsupported final parameter was encountered.
Tue May 18 00:28:58 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>
        * parse.y (finish_method_declaration): Issue errors for native or
        abstract methods declared with a method body, as well as for non
        native or non abstract methods with no method body.
1999-05-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
        * class.c (build_utf8_ref): Initialize variable `field'.
        * decl.c (init_decl_processing): Initialize variable `field'.
        * expr.c (build_known_method_ref): Mark parameters `method_type',
        `method_signature' and `arg_list' with ATTRIBUTE_UNUSED.
        (process_jvm_instruction): Likewise for parameter `length'.
        * jvspec.c (lang_specific_driver): Mark variables `saw_math',
        `saw_libc', `saw_gc', `saw_threadlib' and `saw_libgcj' with
        ATTRIBUTE_UNUSED.
        * parse.y (maybe_generate_clinit): Remove unused variable
        `has_non_primitive_fields'.
        (find_in_imports_on_demand): Initialize variables `node_to_use'
        and `cl'.
        (patch_binop): Likewise for variable `prom_type'.
        (patch_unaryop): Likewise for variable `prom_type'.
        * verify.c (verify_jvm_instructions): Likewise for variable `last'.
        * xref.c (xref_table): Add missing initializer.

From-SVN: r27363
1999-06-05 08:18:30 +00:00
Craig Burley b11f3769f1 bring internal-doc changes over to branch
From-SVN: r27361
1999-06-04 21:33:37 -04:00
Craig Burley 8ee0222dd4 bring internal-doc changes over to branch
From-SVN: r27360
1999-06-04 21:32:28 -04:00
Jeff Law 4aca7a80fb Daily bump.
From-SVN: r27357
1999-06-04 18:45:03 -06:00
Gabriel Dos Reis 09f25d4ab4 std_valarray.h: New file.
* std/std_valarray.h: New file.
 	* std/slice.h: New file.
	* std/slice_array.h: New file.
	* std/gslice.h: New file.
	* std/gslice_array.h: New file.
	* std/mask_array.h: New file.
	* std/indirect_array.h: New file.
	* std/valarray_array.h: New file.
	* std/valarray_array.tcc: New file.
	* std/valarray_meta.h: New file.
	* valarray.cc: New file.
	* valarray: New file
	* Makefile.in (OBJS): add valarray.o
	(HEADERS): add valarray
	(valarray.o): define dependency on valarray.cc
	(install): make it possible to install valarray file.

From-SVN: r27356
1999-06-04 21:17:47 +00:00
No Author c92277fd87 This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r27355
1999-06-04 21:17:47 +00:00
Rainer Orth 2efec87ab8 osf.h (CPP_SUBTARGET_SPEC): Handle -threads.
* alpha/osf.h (CPP_SUBTARGET_SPEC): Handle -threads.
        (LIB_SPEC): Likewise.
        Link with -lprof1_r for -g/-pg.

From-SVN: r27352
1999-06-04 06:31:18 -07:00
Craig Burley 244ce7bb5b Mention GCC 2.95, multlibbing
From-SVN: r27351
1999-06-04 04:26:26 -04:00
Craig Burley 8503e6f161 add item to missing features
From-SVN: r27349
1999-06-04 04:11:09 -04:00
Jason Merrill 5167ff8c28 semantics.c (finish_if_stmt_cond): Copy cond to permanent_obstack.
* semantics.c (finish_if_stmt_cond): Copy cond to permanent_obstack.
	(finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.

From-SVN: r27347
1999-06-03 23:44:36 -04:00
Andreas Schwab 7eba216e8a loop.c (check_dbra_loop): Fix change of Jan 19.
�
        * loop.c (check_dbra_loop): Fix change of Jan 19.

From-SVN: r27346
1999-06-03 19:33:20 -06:00
Jeff Law 62ef63b020 Daily bump.
From-SVN: r27342
1999-06-03 18:45:33 -06:00
Marc Espie 8931cc9fbb freebsd-elf.h (SWITCH_TAKES_ARG): Redefine, not define.
* freebsd-elf.h (SWITCH_TAKES_ARG):  Redefine, not define.
        (STARTFILE_SPEC):  Define, override the svr4.h version.
        (ENDFILE_SPEC):  Likewise.

From-SVN: r27339
1999-06-03 17:18:41 -06:00
Jeffrey A Law 6e6d7a9f70 inclhack.def (limits_ifndefs): Also apply to sys/limits.h
Thu Jun  3 23:58:55 1999  Jeffrey A Law  (law@cygnus.com)
        * fixinc/inclhack.def (limits_ifndefs): Also apply to sys/limits.h
        * fixinc/fixincl.x: Regenerated.
        * fixinc/inclhack.sh: Regenerated.

From-SVN: r27336
1999-06-03 17:01:37 -06:00
Bruce Korb 5ebd88f719 inclhack.def (Io_Def_Quotes): corrected sed expression
* fixinc/inclhack.def(Io_Def_Quotes): corrected sed expression
        * fixinc/fixincl.x: regenerate
        * fixinc/inclhack.sh: regenerate

From-SVN: r27335
1999-06-03 16:39:07 -06:00
Robert Lipe 36cea0f2c1 udk.h (LINK_SPEC): Correct linker search path for system libraries.
* i386/udk.h (LINK_SPEC): Correct linker search path for
        system libraries.

From-SVN: r27332
1999-06-03 15:28:47 -06:00
Jason Merrill 5dfb3010df dwarf2out.c (add_incomplete_type): New fn.
* dwarf2out.c (add_incomplete_type): New fn.
	(gen_struct_or_union_type_die): Call it.
	(retry_incomplete_types): New fn.
	(dwarf2out_finish): Call it.

From-SVN: r27324
1999-06-02 22:30:03 -04:00
Jeff Law df4520083b Daily bump.
From-SVN: r27323
1999-06-02 18:45:32 -06:00
Jeffrey A Law abb06a8e34 gcse.c (insert_insn_end_bb): Correct placement of insns when the current block starts with a CODE_LABEL and...
�
        * gcse.c (insert_insn_end_bb): Correct placement of insns when the
        current block starts with a CODE_LABEL and ends with a CALL and
        we can not find all the argument setup instructions for the CALL.

From-SVN: r27319
1999-06-02 18:19:26 -06:00
Richard Henderson de73e0a0f6 alpha.c (override_options): Thinko in last patch.
* alpha.c (override_options): Thinko in last patch.
        * alpha/osf.h (CPP_SUBTARGET_SPEC): Define.
        (LIB_SPEC): Recognize -pthread.

From-SVN: r27315
1999-06-02 05:28:04 -07:00
Richard Earnshaw 038d446b09 Release branch only:
* arm.md (zero_extendqidi2): Don't allow operand1 to be a memory
reference.  Temporary work-around for problems with constant
pool handling.

From-SVN: r27311
1999-06-02 06:43:14 +00:00
Jeffrey A Law c7f68ceb76 README, [...]: Update name (egcs -> gcc) and version #s (1.1 -> 2.95) as needed.
* README, configure.in, gcc.1, gcc.texi: Update name (egcs -> gcc)
        and version #s (1.1 -> 2.95) as needed.
        * README.g77: Kill way out of date file in the toplevel directory.

From-SVN: r27309
1999-06-01 19:41:54 -06:00
Jeff Law 081c2e00db Daily bump.
From-SVN: r27306
1999-06-01 18:45:03 -06:00
David O'Brien b32cc6d97b configure.in (i[34567]86-*-freebsdelf): Don't include linux.h, i386/freebsd-elf.h no longer requires it.
* configure.in (i[34567]86-*-freebsdelf): Don't include linux.h,
        i386/freebsd-elf.h no longer requires it.  Instead include svr4.h.
        * configure: Rebuilt.
        * i386/freebsd-elf.h (DEFAULT_VTABLE_THUNKS): Define.
        (ASM_COMMENT_START, ASM_APP_ON, ASM_APP_OFF, SET_ASM_OP): Likewise.
        (PREFERRED_DEBUGGING_TYPE, WCHAR_UNSIGNED): Likewise.
        (SWITCH_TAKES_ARG): Likewise.
        * i386/freebsd.h: Remove FREEBSD_NATIVE support.
        * config/t-freebsd: Moved from config/i386/ so it can used for all
        FreeBSD targets.

From-SVN: r27304
1999-06-01 18:02:39 -06:00
Philippe De Muyter ebe5b91399 acconfig.h (libintl.h): Does not include this file here because it will define `NULL' before the system...
�
        * acconfig.h (libintl.h): Does not include this file here because
        it will define `NULL' before the system files have got any chance
        to define it.
        * intl/explodename.c (stdlib.h): Include this file only if we have it.

From-SVN: r27303
1999-06-01 17:53:13 -06:00
Philippe De Muyter f852525a5b acconfig.h (libintl.h): Does not include this file here because it will define `NULL' before the system...
�
        * acconfig.h (libintl.h): Does not include this file here because
        it will define `NULL' before the system files have got any chance
        to define it.
        * intl/explodename.c (stdlib.h): Include this file only if we have it.

From-SVN: r27302
1999-06-01 17:53:11 -06:00
Philippe De Muyter 49cbf5d0a5 acconfig.h (libintl.h): Does not include this file here because it will define `NULL' before the system...
�
        * acconfig.h (libintl.h): Does not include this file here because
        it will define `NULL' before the system files have got any chance
        to define it.
        * intl/explodename.c (stdlib.h): Include this file only if we have it.

From-SVN: r27301
1999-06-01 17:53:10 -06:00
Philippe De Muyter 14c10cc32b x-mot3300 (XCFLAGS): Fixed to match stb.o, not f/stb.o.
�
        * m68k/x-mot3300 (XCFLAGS): Fixed to match stb.o, not f/stb.o.

From-SVN: r27297
1999-06-01 17:43:25 -06:00
Robert Lipe b767041641 bastring.h (class basic_string:Rep): Encode xlock opcode as .bytes instead of mnemonics.
�
        * std/bastring.h (class basic_string:Rep): Encode xlock opcode
        as .bytes instead of mnemonics.

From-SVN: r27296
1999-06-01 17:27:35 -06:00
Robert Lipe b8ab43f4cf configure.in (i[34567]86-*-udk*): Install headers with cpio.
h
        * configure.in (i[34567]86-*-udk*): Install headers with cpio.
        * configure: Rebuilt.

From-SVN: r27293
1999-06-01 17:17:17 -06:00
Robert Lipe 4eb5d6849b configure.in (i[34567]86-*-udk*): Install headers with cpio.
�
        * configure.in (i[34567]86-*-udk*): Install headers with cpio.
        * configure: Rebuilt.

From-SVN: r27292
1999-06-01 17:17:10 -06:00
John Wehle 7d9a24ab60 flow.c (mark_regs_live_at_end, [...]): Only give FRAME_POINTER_REGNUM and HARD_FRAME_POINTER_REGNUM special treatment...
* flow.c (mark_regs_live_at_end, insn_dead_p,
	mark_set_1, mark_used_regs): Only give FRAME_POINTER_REGNUM
	and HARD_FRAME_POINTER_REGNUM special treatment if reload
	hasn't run or the frame pointer is needed.
	* haifa-sched.c (attach_deaths): Likewise.
	* sched.c (attach_deaths): Likewise.

From-SVN: r27290
1999-06-01 21:49:31 +00:00
Mark Mitchell 48276009b2 cccp.c (handle_directive): Handle backslash-newlines in quoted strings correctly.
* cccp.c (handle_directive): Handle backslash-newlines in quoted
	strings correctly.

From-SVN: r27288
1999-06-01 17:10:05 +00:00
Jeff Law 80ac735885 Daily bump.
From-SVN: r27285
1999-05-31 18:45:08 -06:00
Jeffrey A Law 174255f573 * Remove this patch (from the branch only)
Wed May 26 09:53:05 1999  Mark Mitchell  <mark@codesourcery.com>
        * fold-const.c (fold): STRIP_NOPS when deciding whether or not
        something is a candidate for optimize_bit_field_compare.

From-SVN: r27284
1999-05-31 15:48:22 -06:00
Richard Henderson ca24b88858 alpha.md (reload_*_help): New patterns and splitters.
* alpha.md (reload_*_help): New patterns and splitters.
        (reload_*): Use them.
        (mov[qh]i): Likewise.

From-SVN: r27282
1999-05-31 08:24:57 -07:00
Jeffrey A Law ffe4b56d78 jump.c (jump_optimize_1): Only set CAN_REACH_END if calculate_can_reach_end returns nonzero.
* jump.c (jump_optimize_1): Only set CAN_REACH_END if
        calculate_can_reach_end returns nonzero.
Should fix the gcc.dg noreturn-1 and return-type-1 tests.

From-SVN: r27280
1999-05-31 07:30:06 -06:00
Cort Dougan 712d267d43 * rs6000/linux.h (LINK_SPEC): Use emulation elf32ppclinux.
From-SVN: r27277
1999-05-31 02:37:25 -07:00
Philip Blundell e2d76cbb0f Philip Blundell <philb@gnu.org>
Philip Blundell  <philb@gnu.org>
	* config/arm/aout.h (ASM_OUTPUT_ALIGN): Only define if not already
		defined.
			* config/arm/elf.h (ASM_OUTPUT_ALIGN): Define.
				(MAX_OFILE_ALIGNMENT): Likewise

From-SVN: r27275
1999-05-31 08:22:02 +00:00
Jeffrey A Law 25c7d10487 * tm.texi (MD_EXEC_PREFIX): Note need to update configure.in too.
From-SVN: r27272
1999-05-30 20:56:15 -06:00
Jeffrey A Law 2697f73604 Makefile.in (CFLAGS): Remove warning flags.
* Makefile.in (CFLAGS): Remove warning flags.
        (WARN_CFLAGS): Disable.
This is a release-branch only change!

From-SVN: r27271
1999-05-30 20:52:54 -06:00
Jeffrey A Law c472aab5d3 configure.in (native gas tests): Search for an assembler in the same manner that the installed compiler will.
* configure.in (native gas tests): Search for an assembler in the
        same manner that the installed compiler will.
        * configure: Rebuilt.

From-SVN: r27268
1999-05-30 20:21:17 -06:00
Jeff Law d2655d4b54 Daily bump.
From-SVN: r27266
1999-05-30 18:45:02 -06:00
Jeffrey A Law c4840e070e alias.c (find_base_term): Improve handling of addresses constructed from binary operations.
* alias.c (find_base_term): Improve handling of addresses
        constructed from binary operations.

From-SVN: r27262
1999-05-30 17:51:08 -06:00
Mark Mitchell b3c970f712 lex.c (make_lang_type): Create TYPE_BINFO for TEMPLATE_TYPE_PARMs just like for non-template types.
* lex.c (make_lang_type): Create TYPE_BINFO for
	TEMPLATE_TYPE_PARMs just like for non-template types.

[[Split portion of a mixed commit.]]

From-SVN: r27258.1
1999-05-30 21:50:49 +00:00
Richard Henderson edcf1982ba * config.guess, config.sub: Use toplevel file.
From-SVN: r27255
1999-05-30 09:12:40 -07:00
Cort Dougan d69afd7d88 Cort Dougan <cort@cs.nmt.edu>
Cort Dougan  <cort@cs.nmt.edu>
        * config.guess (ppc-*-linux-gnu): Also use ld emul elf32ppclinux.

From-SVN: r27253
1999-05-30 09:04:33 -07:00
Robert Lipe f8bc613916 fixincl.c: Replace local include scheme with #includes of gansidecl.h and system.h.
* fixincl.c: Replace local include scheme with #includes of
        gansidecl.h and system.h.
        * procopen.c:  Likewise.
        * server.c:  Likewise.

From-SVN: r27251
1999-05-30 07:45:17 -06:00
Kaveh R. Ghazi 019686731f putenv.c: Include ansidecl.h to define `const'.
* putenv.c: Include ansidecl.h to define `const'.
        * setenv.c: Likewise.

From-SVN: r27250
1999-05-30 07:38:35 -06:00
Jeffrey A Law 797559048e function.h (cleanup_label, [...]): Declare.
* function.h (cleanup_label, frame_offset): Declare.
        (tail_recursion_label, tail_recursion_reentry): Likewise.
        (arg_pointer_save_area, rtl_expr_chain): Likewise.
        * stmt.c (cleanup_label, frame_offset): Delete extern declarations.
        (tail_recursion_label, tail_recursion_reentry): Likewise.
        (arg_pointer_save_area, rtl_expr_chain): Likewise.

From-SVN: r27247
1999-05-30 07:19:44 -06:00
Jeff Law d001c13cd6 Daily bump.
From-SVN: r27243
1999-05-29 18:45:02 -06:00
Jeff Law 254141f4a9 Daily bump.
From-SVN: r27234
1999-05-28 18:45:03 -06:00
Craig Burley cc6726323b fix thinko
From-SVN: r27224
1999-05-28 10:54:33 -04:00
Eric Raskin 6ed0a3e9ab t-dgux (EXTRA_PARTS): Add crti.o
P
        * i386/t-dgux (EXTRA_PARTS): Add crti.o
        (crti.o): Add build rule and dependencies.

From-SVN: r27220
1999-05-27 20:55:14 -06:00
Eric Raskin 4bea2548b4 t-dgux (EXTRA_PARTS): Add crti.o
�
        * i386/t-dgux (EXTRA_PARTS): Add crti.o
        (crti.o): Add build rule and dependencies.

From-SVN: r27219
1999-05-27 20:54:51 -06:00
Franz Sirl b1c69ee12d sysv4.h (CC1_SPEC): Add support for -profile
* rs6000/sysv4.h (CC1_SPEC): Add support for -profile
        (LIB_LINUX_SPEC): Likewise.
        (LIB_LINUX_SPEC): Add support for -pthread
        (CPP_OS_LINUX_SPEC): Likewise.
        (CPP_SYSV_SPEC): Avoid redefinitions if both -fpic and -fPIC are
        specified

From-SVN: r27216
1999-05-27 20:46:56 -06:00
Franz Sirl ee261af314 * rs6000.c (output_mi_thunk): Enable full support again.
From-SVN: r27215
1999-05-27 20:41:43 -06:00
Nathan Sidwell 24072d900f decl.c (complete_array_type): Allocate off same obstack.
* decl.c (complete_array_type): Allocate off same obstack. Fix
	DO_DEFAULT comment to match reality.

From-SVN: r27214
1999-05-28 02:38:50 +00:00
Mark Klein 47cc417d6a * makeinfo/makeinfo.c: Add HAVE_LC_MESSAGES around setlocale call.
From-SVN: r27211
1999-05-27 20:10:10 -06:00
Jeff Law d8d3e624d4 Daily bump.
From-SVN: r27209
1999-05-27 18:45:33 -06:00
H.J. Lu 89b2cfcf5b i386.c (output_fp_cc0_set): Don't check the JUMP_INSN code for conditional move.
�
        * i386.c (output_fp_cc0_set): Don't check the JUMP_INSN code for
        conditional move.
        (notice_update_cc, output_float_compare): Enable TARGET_CMOVE support.
        (output_float_compare, output_fp_cc0_set): Fix the FLOAT comparison
        for IEEE math and CC_FCOMI.
        (put_jump_code): No IEEE if CC_FCOMI is set.

From-SVN: r27205
1999-05-27 06:11:59 -06:00
Andreas Schwab 482ab51ee9 fold-const.c (fold_truthop): Make the field reference unsigned when converting a single bit compare.
h
        * fold-const.c (fold_truthop): Make the field reference unsigned
        when converting a single bit compare.

From-SVN: r27200
1999-05-26 20:33:44 -06:00
Andreas Schwab f28e0f5492 fold-const.c (fold_truthop): Make the field reference unsigned when converting a single bit compare.
�
        * fold-const.c (fold_truthop): Make the field reference unsigned
        when converting a single bit compare.

From-SVN: r27199
1999-05-26 20:33:38 -06:00
Philip Blundell 3aaefdf84a Based on patch by Scott Bambrough and Pat Beirne:
* config/arm/arm.c (making_const_table): New variable.
        * config/arm/arm.h (making_const_table): Declare.
        (OUTPUT_INT_ADDR_CONST): Mark symbols as position independent if
        appropriate.
        * config/arm/arm.md (consttable_4, consttable_8, consttable_end):
        Keep track of when we are building the constant table.

From-SVN: r27198
1999-05-26 20:14:31 -06:00
Jeffrey A Law c20d02e0cd varasm.c (STRIP_NAME_ENCODING): Remove default definition.
* varasm.c (STRIP_NAME_ENCODING): Remove default definition.
        * output.h (STRIP_NAME_ENCODING): Strip '*' like the old varasm
        version did.

From-SVN: r27197
1999-05-26 20:02:14 -06:00
J"orn Rennecke 4449feea74 * loop.c (strength_reduce): Don't do biv->giv conversion on constants.
From-SVN: r27195
1999-05-26 19:48:07 -06:00
Jeff Law e3b3a1dd31 reload.c (push_reload): Do not call remove_address_replacements when...
p
        * reload.c (push_reload): Do not call remove_address_replacements
        when presented with identical optional reloads.

From-SVN: r27189
1999-05-26 19:16:21 -06:00
Jeff Law 96ad4091d2 reload.c (push_reload): Do not call remove_address_replacements when...
�
        * reload.c (push_reload): Do not call remove_address_replacements
        when presented with identical optional reloads.

From-SVN: r27188
1999-05-26 19:16:13 -06:00
Jeff Law 1780880f6a Daily bump.
From-SVN: r27186
1999-05-26 18:45:34 -06:00
Richard Henderson b0ee429eef alpha.h (MASK_FIX, TARGET_FIX): New.
* alpha.h (MASK_FIX, TARGET_FIX): New.
        (MASK_*): Reorganize constants.
        (CPP_AM_FIX_SPEC): New.
        (TARGET_SWITCHES): Add FIX.
        (EXTRA_SPECS): Likewise.
        (CPP_CPU_EV6_SPEC): Use FIX, not CIX.
        (SECONDARY_MEMORY_NEEDED): Likewise.
        (REGISTER_MOVE_COST): Likewise.
        * alpha.c (override_options): Add FIX support.  Always use
        ALPHA_TP_PROG for ev6.
        * alpha.md (sqrt and mov[sd]i patterns): Use FIX, not CIX.
        * alpha/elf.h (ASM_FILE_START): Look at FIX too.
        * configure.in (target_cpu_default2) [ev6]: Use FIX, not CIX.

From-SVN: r27182
1999-05-26 09:36:26 -07:00
Craig Burley 78590e580d update derived files
From-SVN: r27177
1999-05-26 08:54:39 -04:00
Craig Burley c225b6e0ec document Toon's patch, fix grammo
From-SVN: r27175
1999-05-26 08:51:38 -04:00
Craig Burley be8292e078 rename version numbers, etc
From-SVN: r27173
1999-05-26 08:44:48 -04:00
Mark Mitchell d118547251 fold-const.c (fold): STRIP_NOPS when deciding whether or not something is a candidate for...
* fold-const.c (fold): STRIP_NOPS when deciding whether or not
	something is a candidate for optimize_bit_field_compare.

From-SVN: r27171
1999-05-26 10:41:34 +00:00
Craig Burley f1e639b4dd rename -fsubscript-check to -fbounds-check
From-SVN: r27168
1999-05-26 05:49:11 -04:00
Jeff Law f024c4c846 Makefile.in (CFILES): Add putenv.c and setenv.c.
* Makefile.in (CFILES): Add putenv.c and setenv.c.
        * configure.in (funcs): Add putenv and setenv.
        (AC_CHECK_FUNCS): Check for putenv and setenv.
        * configure: Rebuilt.
        * putenv.c setenv.c: New files.

From-SVN: r27164
1999-05-25 21:13:23 -06:00
No Author d98abbc53a This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r27163
1999-05-26 03:13:23 +00:00
Jeff Law 9e5b507797 Makefile.in (CFILES): Add putenv.c and setenv.c.
* Makefile.in (CFILES): Add putenv.c and setenv.c.
        * configure.in (funcs): Add putenv and setenv.
        (AC_CHECK_FUNCS): Check for putenv and setenv.
        * configure: Rebuilt.
        * putenv.c setenv.c: New files.

[[Split portion of a mixed commit.]]

From-SVN: r27162.1
1999-05-25 21:13:18 -06:00
Melissa O'Neill 20bd05f26d getcwd.c (getcwd): If pathname is NULL, then obtain SIZE bytes of space using malloc.
P
        * getcwd.c (getcwd): If pathname is NULL, then obtain SIZE
        bytes of space using malloc.

From-SVN: r27159
1999-05-25 21:04:08 -06:00
Melissa O'Neill d2aad29c1c getcwd.c (getcwd): If pathname is NULL, then obtain SIZE bytes of space using malloc.
�
        * getcwd.c (getcwd): If pathname is NULL, then obtain SIZE
        bytes of space using malloc.

From-SVN: r27158
1999-05-25 21:04:07 -06:00
Melissa O'Neill 57a86b3a8e fixincl.c: (WIFSIGNALED): Define if not already defined.
* fixinc/fixincl.c: (WIFSIGNALED): Define if not already defined.
        (WTERMSIG, WIFEXITED, WEXITSTATUS, WIFSTOPPED, WSTOPSIG): Likewise.
        (S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP): Likewise.
        (S_IROTH, S_IWOTH, S_IXOTH, S_IRWXU, S_IRWXG, S_IRWXO): Likewise.

From-SVN: r27157
1999-05-25 21:03:28 -06:00
Philip Blundell 02c4baf3cb arm.h (NEED_PLT_GOT): Fix mistake in last change.
* arm.h (NEED_PLT_GOT): Fix mistake in last change.
        (GOT_PCREL): New macro.  Define to 1 if not already defined.
        * arm/elf.h (GOT_PCREL): Define to 0.
        * arm.c (arm_finalize_pic): Take into account the setting of
        GOT_PCREL.

From-SVN: r27155
1999-05-25 19:26:31 -06:00
Jeff Law 21fa39fe92 Daily bump.
From-SVN: r27154
1999-05-25 18:45:32 -06:00
Jeffrey A Law 14e5453435 output.h (STRIP_NAME_ENCODING): Provide default definition.
* output.h (STRIP_NAME_ENCODING): Provide default definition.
        * dwarf2out.c (ASM_NAME_TO_STRING): Use STRIP_NAME_ENCODING.

From-SVN: r27150
1999-05-25 15:31:40 -06:00
Craig Burley 4a03f58a5d Delete vestigial FFECOM_FASTER_ARRAY_REFS
From-SVN: r27148
1999-05-25 17:04:28 -04:00
Craig Burley f6c06a3006 Fix 19990525-0.f
From-SVN: r27146
1999-05-25 12:28:01 -04:00
Jeffrey A Law 6d2dbc00f3 flow.c (mark_set_1): Do not record BLKmode stores as dead store elimination candidates.
�
        * flow.c (mark_set_1): Do not record BLKmode stores as dead
        store elimination candidates.

From-SVN: r27141
1999-05-25 07:16:44 -06:00
Kaveh R. Ghazi b6cd591a63 optabs.c (expand_cmplxdiv_straight, [...]): Change function definitions to K&R style.
* optabs.c (expand_cmplxdiv_straight, expand_cmplxdiv_wide):
Change function definitions to K&R style.

From-SVN: r27135
1999-05-25 05:18:14 +00:00
Jeff Law 93010373d1 Daily bump.
From-SVN: r27133
1999-05-24 18:45:04 -06:00
Jeffrey A Law 64ae1c6f01 loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the last CODE_LABEL in a loop if...
* loop.c (strength_reduce): Do not clear NOT_EVERY_ITERATION at the
	last CODE_LABEL in a loop if we have previously passed a jump
	to the top of the loop.

From-SVN: r27123
1999-05-24 07:40:52 -06:00
Mark Mitchell b180111b6d stmt.c (expand_end_bindings): Ignore any elements of VARS that are not VAR_DECLs.
* stmt.c (expand_end_bindings): Ignore any elements of VARS that
	are not VAR_DECLs.

From-SVN: r27119
1999-05-24 01:01:40 +00:00
Jeff Law 6152422413 Daily bump.
From-SVN: r27115
1999-05-23 18:45:03 -06:00
Jeff Law c72618e531 [multiple changes]
Sun May 23 20:31:16 1999  Jeffrey A Law  (law@cygnus.com)
        * loop.c (strength_reduce): Grow reg_single_usage as needed.
Sun May 23 10:13:20 1999  David O'Brien <obrien@FreeBSD.org>
        * i386/freebsd-elf.h (LINK_SPEC): Change -static to -Bstatic.
        Also remove a useless comment.
Sun May 23 10:05:23 1999  Jerry Quinn <jquinn@nortelnetworks.com>
        * pa.md (negdf2,negsf2):  Use fneg instead of fsub on pa 2.0.

From-SVN: r27112
1999-05-23 13:42:53 -06:00
Jeff Law 637d865413 Daily bump.
From-SVN: r27110
1999-05-22 18:45:35 -06:00
Mark Mitchell d78194b959 * tree.c (mapcar): Handle NON_LVALUE_EXPR.
From-SVN: r27102
1999-05-22 11:25:40 +00:00
Mark Mitchell 2ddf18adeb * expr.h (lang_expand_constant): Guard with #ifdef TREE_CODE.
From-SVN: r27091
1999-05-22 01:25:51 +00:00
Jeff Law 833bc20faf Daily bump.
From-SVN: r27088
1999-05-21 18:45:04 -06:00
Mark Mitchell f2959cacda typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to reveal optimization opportunities.
* typeck.c (build_ptrmemfunc): Handle PTRMEM_CSTs carefully to
	reveal optimization opportunities.

From-SVN: r27085
1999-05-21 15:44:03 +00:00
Jeff Law b7ec2aca42 Daily bump.
From-SVN: r27078
1999-05-20 18:45:33 -06:00
Jeff Law c40fd788ff [multiple changes]
Thu May 20 10:00:42 1999   Stephen L Moshier  <moshier@world.std.com>
        * Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include.
Thu May 20 09:58:57 1999  Jan Hubicka <hubicka@freesoft.cz>
        * function.c (assign_stack_local): Align stack slot propertly.
        (assign_outer_stack_local): Likewise.

From-SVN: r27076
1999-05-20 16:26:35 -06:00
Stephen L Moshier 1dbc7acbe9 Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include.
Thu May 20 10:00:42 1999   Stephen L Moshier  <moshier@world.std.com>
         * Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include.

From-SVN: r27075
1999-05-20 16:26:18 -06:00
Mark Mitchell 4937f561b6 decl.c (grokdeclarator): Don't treat [] as indicating a zero-sized array in a typedef.
* decl.c (grokdeclarator): Don't treat [] as indicating a
	zero-sized array in a typedef.

From-SVN: r27071
1999-05-20 18:11:25 +00:00
Mark Mitchell b5e57900ad call.c (build_object_call): Don't look at DECL_NAME for a type.
* call.c (build_object_call): Don't look at DECL_NAME for a type.
	(pt.c): Or CP_TYPE_QUALS for an ERROR_MARK.
	(typeck.c): Or TYPE_MAIN_VARIANT for a type.

From-SVN: r27069
1999-05-20 17:31:04 +00:00
Jason Merrill 0f18f053ed tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
* tree.c (lvalue_p_1): A NOP_EXPR can be an lvalue.
	(build_cplus_new): Make sure that what we return is of the right type.

From-SVN: r27062
1999-05-20 08:17:29 -04:00
Mark Mitchell 2caf0a178a cp-tree.h (make_ptrmem_cst): New function.
* cp-tree.h (make_ptrmem_cst): New function.
	* expr.c (cplus_expand_constant): Split out from ...
	(cplus_expand_expr): Here.  Use cplus_expand_constant.
	(init_cplus_expand): Set lang_expand_constant.
	* pt.c (convert_nontype_argument): Use make_ptrmem_cst.
	* tree.c (make_ptrmem_cst): Define.
	* typeck.c (unary_complex_lvalue): Use make_ptrmem_cst.
	* typeck2.c (initializer_constant_valid_p): Use make_ptrmem_cst.

From-SVN: r27061
1999-05-20 10:48:48 +00:00
Mark Mitchell 5249b72d89 expr.h (lang_expand_constant): Declare.
* expr.h (lang_expand_constant): Declare.
	* toplev.c (lang_expand_constant): Define it.
	* varasm.c (output_constant): Use it.

From-SVN: r27059
1999-05-20 10:40:08 +00:00
Bruce Korb 616c178212 A fix for one breaks another :( - do not ignore SIGCLD!
From-SVN: r27054
1999-05-20 08:15:59 +00:00
Alexandre Oliva df89c5dd10 static initialization removal & K&R-ification
From-SVN: r27053
1999-05-20 07:15:14 +00:00
Jeff Law df118d7bcc libchill, libf2c, libobjc:
* configure.in (AC_PREREQ): Update to 2.13.
        (AC_EXEEXT): Call to find possible file extension.
        (compiler_name): Use.
        * configure: Regenerate.
libio, libstdc++
        * configure.in: Test for ${compiler_name}.exe as well.

From-SVN: r27051
1999-05-19 20:28:56 -06:00
Andreas Schwab 1fa14a88c3 dbxcoff.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Use asm_fprintf and %L to generate the label name.
* config/dbxcoff.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Use
        asm_fprintf and %L to generate the label name.
        * config/dbxelf.h (DBX_OUTPUT_MAIN_SOURCE_FILE_END): Likewise.
        (ASM_OUTPUT_SOURCE_LINE): Correct generation of internal labels.

From-SVN: r27049
1999-05-19 19:55:46 -06:00
Jeff Law e51b3ab8bf Daily bump.
From-SVN: r27047
1999-05-19 18:53:00 -06:00
Jeff Law c030199153 jump.c (can_reverse_comparison_p): Do not abort if the comparison insn for a conditional jump can not be found.
�
        * jump.c (can_reverse_comparison_p): Do not abort if the comparison
        insn for a conditional jump can not be found.
Fixes 980329-1.c regression on the ppc.

From-SVN: r27045
1999-05-19 18:43:21 -06:00
Jeff Law 0d799602e5 jump.c (can_reverse_comparison_p): Do not abort if the comparison insn for a conditional jump can not be found.
�
        * jump.c (can_reverse_comparison_p): Do not abort if the comparison
        insn for a conditional jump can not be found.
Fixes 980329-1.c regression on the ppc.

From-SVN: r27044
1999-05-19 18:43:16 -06:00
Tom Tromey fac09e5fa4 java-except.h (struct eh_range): Removed unused `next' member.
1999-05-14  Tom Tromey  <tromey@cygnus.com>
        * java-except.h (struct eh_range): Removed unused `next' member.
        * verify.c (verify_jvm_instructions): Call check_nested_ranges
        after adding all exception handlers.  Sort exception ranges in
        order of start PC.
        (struct pc_index): New structure.
        (start_pc_cmp): New function.
        * except.c (add_handler): Return `void'.  Don't call link_handler;
        instead construct an ordinary linked list and do range
        coalescing.
        (check_nested_ranges): New function.
        (link_handler): Changed interface to allow merging of eh_ranges.
        Split overlapping ranges.  Return `void'.
Bring over from the mainline tree at Tom's request.

From-SVN: r27041
1999-05-19 18:22:05 -06:00
Jason Merrill 2f41450012 call.c (joust): Compare the types of the conv ops, not the target types of the conversions.
1999-05-18  Jason Merrill  <jason@yorick.cygnus.com>
        * call.c (joust): Compare the types of the conv ops, not the
        target types of the conversions.
Bring over from the mainline tree at Jason's request.

From-SVN: r27039
1999-05-19 18:15:15 -06:00
Jeff Law b7bb0f5b77 mips.h (ENCODE_SECTION_INFO): Do not perform GP optimizations on variables in specific sections other than...
x
        * mips.h (ENCODE_SECTION_INFO): Do not perform GP optimizations
        on variables in specific sections other than .sbss and .sdata.

From-SVN: r27036
1999-05-19 17:05:45 -06:00
Jeff Law 0871840892 mips.h (ENCODE_SECTION_INFO): Do not perform GP optimizations on variables in specific sections other than...
�
        * mips.h (ENCODE_SECTION_INFO): Do not perform GP optimizations
        on variables in specific sections other than .sbss and .sdata.

From-SVN: r27035
1999-05-19 17:05:39 -06:00
Mark Mitchell 63a82d0625 decl2.c (start_static_storage_duration_function): Fix comment.
* decl2.c (start_static_storage_duration_function): Fix comment.
	(finish_file): Create static storage duration functions lazily.

From-SVN: r27032
1999-05-19 12:44:46 +00:00
Bruce Korb e87a7c4743 KandR-ification of fixincl.x
From-SVN: r27023
1999-05-19 08:29:50 +00:00
Mark Mitchell f77e909ffd stmt.c (expand_return): Call start_cleanup_deferral and end_cleanup_deferral around conditional code.
* stmt.c (expand_return): Call start_cleanup_deferral and
	end_cleanup_deferral around conditional code.

From-SVN: r27020
1999-05-19 04:04:51 +00:00
No Author 9029215b70 This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r27019
1999-05-19 04:04:51 +00:00
Bruce Korb 1402f3f0dc fixincl.tpl: Avoid depending on ANSI C features for filename lists.
x
        * fixinc/fixincl.tpl: Avoid depending on ANSI C features for
        filename lists.
        * fixinc/fixincl.x: Rebuilt.

From-SVN: r27015
1999-05-18 20:12:49 -06:00
Bruce Korb 5cd1bac0e4 fixincl.tpl: Avoid depending on ANSI C features for filename lists.
�
        * fixinc/fixincl.tpl: Avoid depending on ANSI C features for
        filename lists.
        * fixinc/fixincl.x: Rebuilt.

From-SVN: r27014
1999-05-18 20:12:40 -06:00
Raja R Harinath 5ff88c342e 990519-1.c: New test.
Wed May 19 02:56:18 1999  Raja R Harinath <harinath@cs.umn.edu>
        * gcc.c-torture/compile/990519-1.c: New test.

From-SVN: r27013
1999-05-18 20:02:35 -06:00
Raja R Harinath 4807dfc739 This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r27012
1999-05-19 02:02:35 +00:00
Jeff Law 2f3ff238af Avoid version # duplication.
From-SVN: r27008
1999-05-18 19:58:08 -06:00
Arvind Sankar e69b4dc16a * gxxint.texi: Fix typo.
From-SVN: r27007
1999-05-18 19:57:45 -06:00
Jan Hubicka b871028d01 i386.c (output_float_compare): Avoid GNU-C extensions.
�
        * i386.c (output_float_compare): Avoid GNU-C extensions.

From-SVN: r27004
1999-05-18 19:53:26 -06:00
Jeffrey A Law 820bb817cd opps. checked in on the mis-named branch. Get it right.
From-SVN: r27003
1999-05-18 19:02:57 -06:00
No Author fac563e0cd This commit was manufactured by cvs2svn to create branch
'gcc-2_95-branch'.

From-SVN: r27002
1999-05-19 01:02:57 +00:00
1019 changed files with 20435 additions and 309928 deletions

View File

@ -1,3 +1,84 @@
Wed Dec 6 22:03:04 PST 2000 Jeff Law (law@cygnus.com)
* gcc-2.95.2.1 Released.
Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95.2 Released.
Mon Aug 16 01:29:24 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95.1 Released.
Wed Aug 4 02:07:14 1999 Jeffrey A Law (law@cygnus.com)
* config.sub (vxworks case): Use os=-vxworks, not os=vxworks.
Wed Jul 28 21:39:31 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95 Released.
Sun Jul 25 23:40:51 PDT 1999 Jeff Law (law@cygnus.com)
* gcc-2.95 Released.
Tue Jun 22 23:39:29 1999 Tom Tromey <tromey@cygnus.com>
* configure.in (target_libs): Added target-zlib.
* Makefile.in (ALL_TARGET_MODULES): Added zlib.
(CONFIGURE_TARGET_MODULES): Likewise.
(CHECK_TARGET_MODULES): Likewise.
(INSTALL_TARGET_MODULES): Likewise.
(CLEAN_TARGET_MODULES): Likewise.
(configure-target-zlib): New target.
(all-target-zlib): Likewise.
(all-target-libjava): Depend on all-target-zlib.
(configure-target-libjava): Depend on configure-target-zlib.
* Makefile.in (configure-target-libjava): Depend on
configure-target-newlib.
(configure-target-boehm-gc): New target.
(configure-target-qthreads): New target.
* configure.in (host_tools): Added zip.
* Makefile.in (all-target-libjava): Depend on all-zip.
(all-zip): New target.
(ALL_MODULES): Added all-zip.
(NATIVE_CHECK_MODULES): Added check-zip.
(INSTALL_MODULES): Added install-zip.
(CLEAN_MODULES): Added clean-zip.
* configure.in (target_libs): Added target-qthreads.
* Makefile.in (ALL_TARGET_MODULES): Added qthreads.
(CONFIGURE_TARGET_MODULES): Likewise.
(CHECK_TARGET_MODULES): Likewise.
(INSTALL_TARGET_MODULES): Likewise.
(CLEAN_TARGET_MODULES): Likewise.
(all-target-qthreads): New target.
(configure-target-libjava): Depend on configure-target-qthreads.
(all-target-libjava): Depend on all-target-qthreads.
* Makefile.in (ALL_TARGET_MODULES): Added libjava, boehm-gc.
(CONFIGURE_TARGET_MODULES): Likewise.
(CHECK_TARGET_MODULES): Likewise.
(INSTALL_TARGET_MODULES): Likewise.
(CLEAN_TARGET_MODULES): Likewise.
(all-target-libjava): New target.
(all-target-boehm-gc): Likewise.
* configure.in (target_libs): Added libjava, boehm-gc.
Sun May 30 16:03:16 1999 Cort Dougan <cort@cs.nmt.edu>
* config.guess (ppc-*-linux-gnu): Also use ld emul elf32ppclinux.
Thu May 20 10:00:42 1999 Stephen L Moshier <moshier@world.std.com>
* Makefile.in (GCC_FOR_TARGET): Add -I$(build_tooldir)/include.
1999-04-23 Tom Tromey <tromey@cygnus.com>
* ltconfig, ltmain.sh: Update to libtool 1.2f.
Tue Apr 13 22:50:54 1999 Donn Terry (donn@interix.com)
Martin Heller (Ing.-Buero_Heller@t-online.de)

View File

@ -2,7 +2,7 @@ This directory has been obsoleted for egcs snapshots and CVS access.
Instead check out the toplevel "wwwdocs" as a sibling of your egcs
tree or read these files via the egcs web site
http://egcs.cygnus.com
http://www.gnu.org/software/gcc/
Copies of the relevant files will be copied into this directory for

View File

@ -55,6 +55,7 @@ caller-save.c Jeff Law law@cygnus.com
debugging code Jim Wilson wilson@cygnus.com
dwarf debugging code Jason Merrill jason@cygnus.com
c++ runtime libs Ulrich Drepper drepper@cygnus.com
C++ runtime libs Gabriel Dos Reis dosreis@cmla.ens-cachan.fr
*synthetic multiply Torbjorn Granlund tege@swox.com
*c-torture Torbjorn Granlund tege@swox.com
*f-torture Kate Hedstrom kate@ahab.rutgers.edu
@ -99,6 +100,7 @@ Andrew Haley aph@cygnus.com
Alexandre Petit-Bianco apbianco@cygnus.com
Anthony Green green@cygnus.com
Stu Grossman grossman@cygnus.com
Gabriel Dos Reis dosreis@cmla.ens-cachan.fr
* Indicates folks we need to get Kerberos/ssh accounts ready so they

View File

@ -233,7 +233,7 @@ CC_FOR_TARGET = ` \
# variable is passed down to the gcc Makefile, where it is used to
# build libgcc2.a. We define it here so that it can itself be
# overridden on the command line.
GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/
GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ -B$(build_tooldir)/bin/ -I$(build_tooldir)/include
CHILL_FOR_TARGET = ` \
if [ -f $$r/gcc/xgcc ] ; then \
@ -567,6 +567,7 @@ ALL_MODULES = \
all-time \
all-uudecode \
all-wdiff \
all-zip \
$(EXTRA_TARGET_HOST_ALL_MODULES)
# This is a list of the check targets for all of the modules which are
@ -578,7 +579,8 @@ ALL_MODULES = \
NATIVE_CHECK_MODULES = \
check-bison \
check-byacc \
check-flex
check-flex \
check-zip
CROSS_CHECK_MODULES = \
check-apache \
@ -710,6 +712,7 @@ INSTALL_MODULES = \
install-time \
install-uudecode \
install-wdiff \
install-zip \
$(EXTRA_TARGET_HOST_INSTALL_MODULES)
# This is a list of the targets for all of the modules which are compiled
@ -767,6 +770,10 @@ ALL_TARGET_MODULES = \
all-target-gperf \
all-target-examples \
all-target-libstub \
all-target-libjava \
all-target-zlib \
all-target-boehm-gc \
all-target-qthreads \
all-target-cygmon
# This is a list of the configure targets for all of the modules which
@ -786,6 +793,10 @@ CONFIGURE_TARGET_MODULES = \
configure-target-gperf \
configure-target-examples \
configure-target-libstub \
configure-target-libjava \
configure-target-zlib \
configure-target-boehm-gc \
configure-target-qthreads \
configure-target-cygmon
# This is a list of the check targets for all of the modules which are
@ -800,6 +811,10 @@ CHECK_TARGET_MODULES = \
check-target-libobjc \
check-target-winsup \
check-target-libiberty \
check-target-libjava \
check-target-zlib \
check-target-boehm-gc \
check-target-qthreads \
check-target-gperf
# This is a list of the install targets for all of the modules which are
@ -815,6 +830,11 @@ INSTALL_TARGET_MODULES = \
install-target-winsup \
install-target-libgloss \
install-target-libiberty \
install-target-bsp \
install-target-libjava \
install-target-zlib \
install-target-boehm-gc \
install-target-qthreads \
install-target-gperf
# This is a list of the targets for which we can do a clean-{target}.
@ -880,7 +900,9 @@ CLEAN_MODULES = \
clean-tgas \
clean-time \
clean-uudecode \
clean-wdiff
clean-wdiff \
clean-zip
# All of the target modules that can be cleaned
CLEAN_TARGET_MODULES = \
@ -898,6 +920,10 @@ CLEAN_TARGET_MODULES = \
clean-target-gperf \
clean-target-examples \
clean-target-libstub \
clean-target-libjava \
clean-target-zlib \
clean-target-boehm-gc \
clean-target-qthreads \
clean-target-cygmon
# All of the x11 modules that can be cleaned
@ -1535,6 +1561,8 @@ all-bash:
all-bfd: all-libiberty all-intl
all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc all-intl
all-bison: all-texinfo
configure-target-boehm-gc: configure-target-newlib configure-target-qthreads
all-target-boehm-gc: configure-target-boehm-gc
all-byacc:
all-bzip2:
all-cvssrc:
@ -1587,6 +1615,8 @@ all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libib
check-target-libio: all-target-libstdc++
all-libgui: all-tcl all-tk all-itcl
all-libiberty:
configure-target-libjava: $(ALL_GCC) configure-target-zlib configure-target-boehm-gc configure-target-qthreads configure-target-newlib
all-target-libjava: configure-target-libjava all-gcc all-zip all-target-newlib all-target-zlib all-target-boehm-gc all-target-qthreads
configure-target-librx: $(ALL_GCC) configure-target-newlib
all-target-librx: configure-target-librx
configure-target-libstdc++: $(ALL_GCC)
@ -1606,6 +1636,8 @@ all-opcodes: all-bfd all-libiberty
all-patch: all-libiberty
all-perl:
all-prms: all-libiberty
configure-target-qthreads: configure-target-newlib
all-target-qthreads: configure-target-qthreads
all-rcs:
all-readline:
all-recode: all-libiberty
@ -1627,6 +1659,9 @@ all-wdiff:
all-target-winsup: all-target-newlib all-target-libiberty all-target-libio configure-target-winsup
configure-target-winsup: configure-target-newlib
all-uudecode: all-libiberty
all-zip:
configure-target-zlib: $(ALL_GCC)
all-target-zlib: configure-target-zlib
configure-target-libiberty: $(ALL_GCC)
all-target-libiberty: configure-target-libiberty all-gcc all-ld all-target-newlib
all-target: $(ALL_TARGET_MODULES)

View File

@ -1,82 +0,0 @@
# Makefile for Borland C++ 4.5 on NT
# For Borland 5.0, replace bc45 by bc5.
# If you have the Borland assembler, remove "-DUSE_GENERIC"
#
bc= c:\bc45
bcbin= $(bc)\bin
bclib= $(bc)\lib
bcinclude= $(bc)\include
cc= $(bcbin)\bcc32
rc= $(bcbin)\brc32
lib= $(bcbin)\tlib
link= $(bcbin)\tlink32
cflags= -R -v -vi -H -H=gc.csm -I$(bcinclude);cord -L$(bclib) \
-w-pro -w-aus -w-par -w-ccc -w-rch -a4 -D__STDC__=0
#defines= -DSILENT
defines= -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS -DUSE_GENERIC
.c.obj:
$(cc) @&&|
$(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.c
|
.cpp.obj:
$(cc) @&&|
$(cdebug) $(cflags) $(cvars) $(defines) -o$* -c $*.cpp
|
.rc.res:
$(rc) -i$(bcinclude) -r -fo$* $*.rc
XXXOBJS= XXXalloc.obj XXXreclaim.obj XXXallchblk.obj XXXmisc.obj \
XXXmach_dep.obj XXXos_dep.obj XXXmark_rts.obj XXXheaders.obj XXXmark.obj \
XXXobj_map.obj XXXblacklst.obj XXXfinalize.obj XXXnew_hblk.obj \
XXXdbg_mlc.obj XXXmalloc.obj XXXstubborn.obj XXXdyn_load.obj \
XXXtypd_mlc.obj XXXptr_chck.obj XXXgc_cpp.obj XXXmallocx.obj
OBJS= $(XXXOBJS:XXX=)
all: gctest.exe cord\de.exe test_cpp.exe
$(OBJS) test.obj: gc_priv.h gc_hdrs.h gc.h config.h MAKEFILE
gc.lib: $(OBJS)
-del gc.lib
tlib $* @&&|
$(XXXOBJS:XXX=+)
|
gctest.exe: test.obj gc.lib
$(cc) @&&|
$(cflags) -W -e$* test.obj gc.lib
|
cord\de.obj cord\de_win.obj: cord\cord.h cord\private\cord_pos.h cord\de_win.h \
cord\de_cmds.h
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj \
cord\de_win.res gc.lib
$(cc) @&&|
$(cflags) -W -e$* cord\cordbscs.obj cord\cordxtra.obj \
cord\de.obj cord\de_win.obj gc.lib
|
$(rc) cord\de_win.res cord\de.exe
gc_cpp.obj: gc_cpp.h gc.h
gc_cpp.cpp: gc_cpp.cc
copy gc_cpp.cc gc_cpp.cpp
test_cpp.cpp: test_cpp.cc
copy test_cpp.cc test_cpp.cpp
test_cpp.exe: test_cpp.obj gc_cpp.h gc.h gc.lib
$(cc) @&&|
$(cflags) -W -e$* test_cpp.obj gc.lib
|
scratch:
-del *.obj *.res *.exe *.csm cord\*.obj cord\*.res cord\*.exe cord\*.csm

View File

@ -1,321 +0,0 @@
1999-05-05 Gilles Zunino <Gilles.Zunino@hei.fr>
* configure.in: Switch from irix threads to posix threads
Defined IRIX_THREADS. Put mips_sgi_mach_dep.lo into machdep
for mips architecture.
* configure: Regenerate.
1999-04-30 Tom Tromey <tromey@cygnus.com>
* linux_threads.c: Don't reference __pthread_initial_thread_bos.
1999-04-26 Tom Tromey <tromey@cygnus.com>
* dyn_load.c (GC_FirstDLOpenedLinkMap): Declare _DYNAMIC as
`weak'.
1999-04-23 Tom Tromey <tromey@cygnus.com>
* Makefile.in, configure: Rebuilt.
* Makefile.am (EXTRA_LIBRARIES): Mention libgcjgc.la.
(libgcjgc_la_SOURCES): Renamed.
(libgcjgc_la_LIBADD): Likewise.
(libgcjgc_la_DEPENDENCIES): Likewise.
(EXTRA_libgcjgc_la_SOURCES): Likewise.
(gctest_LDADD): Use libgcjgc.la.
(all_objs): Mention libgcj_la_OBJECTS.
(EXTRA_LTLIBRARIES): Renamed.
(toollib_LTLIBRARIES): Likewise.
(libgcjgc_la_LDFLAGS): New macro
(toolexecdir): Renamed.
(toolexeclibdir): Likewise.
(toolexeclib_LTLIBRARIES): Likewise.
(LTCOMPILE): Renamed; added libtool invocation.
(LINK): Added libtool invocation.
(.s.o): use LTCOMPILE.
* configure.in: Call AM_PROG_LIBTOOL.
(target_all): Set to libgcjgc.la.
Mention `.lo' forms of object files.
1999-04-21 Tom Tromey <tromey@cygnus.com>
* misc.c (GC_init_inner): If QUICK_THREADS defined, compute
GC_stackbottom.
* os_dep.c: glibc 2.1 requires asm/sigcontext.h, not
sigcontext.h. From Matthias Klose <doko@itso.de>.
1999-04-16 Tom Tromey <tromey@cygnus.com>
* config.h (__start): Declare as `int' in alpha/OSF1 case. From
David Pettersson <dapet@mai.liu.se>
1999-04-14 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Don't use sparc_mach_dep.o for Solaris. Reverts
incorrect patch of 199-04-09.
* configure: Rebuilt.
* configure.in: Added support for alpha.
From David Pettersson <dapet@mai.liu.se>.
1999-04-13 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (libgcjgc_a_SOURCES): Added solaris-threads.c and
solaris-threads.h.
1999-04-09 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Use sparc_mach_dep.s when building on Solaris.
1999-02-23 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: For Linux, define _REENTRANT. For Solaris, define
SOLARIS_THREADS and _SOLARIS_PTHREADS.
1999-02-18 Tom Tromey <tromey@cygnus.com>
* quick_threads.c (GC_push_all_stacks): Change order of arguments
to GC_push_all_stacks depending on STACK_GROWS_DOWN define. Check
for case where LO is NULL.
1999-02-10 Tom Tromey <tromey@cygnus.com>
* aclocal.m4, configure, Makefile.in: Rebuilt.
* acinclude.m4: Updated to be used with automake 1.4.
* configure.in: Renamed libgc to libgcjgc. Updated to be used
with automake 1.4.
* Makefile.am (EXTRA_LIBRARIES): Renamed libgc to libgcjgc.
(libgcjgc_a_SOURCES): Likewise.
(libgcjgc_a_LIBADD): Likewise.
(libgcjgc_a_DEPENDENCIES): Likewise.
(EXTRA_libgcjgc_a_SOURCES): Likewise.
(gctest_LDADD): Likewise.
(all_objs): Likewise.
1999-01-08 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Define LINUX_THREADS if using POSIX threads on
Linux.
* gc_priv.h (GC_test_and_set): Put return type into definition.
1998-11-24 Andrew Haley <aph@viagra.cygnus.co.uk>
* Makefile.am: add support for eCos. In particular, add C++
support for compiling the file ecos.cc.
* ecos.cc: new file.
* acinclude.m4: add C++ support.
* aclocal.m4: likewise
* config.h: add eCos support.
* configure: likewise
* configure.in: likewise
* misc.c (GC_write): add eCos support.
* os_dep.c (tiny_sbrk): add eCos support.
Thu Dec 10 18:24:34 1998 Warren Levy <warrenl@cygnus.com>
* misc.c (GC_init_inner): Moved STACKBASE code to os_dep.c.
* os_dep.c (GC_get_stack_base): Moved STACKBASE code from misc.c.
1998-11-23 Tom Tromey <tromey@cygnus.com>
* configure.host (boehm_gc_cflags): Don't add `-O2'.
1998-11-20 Andrew Haley <aph@viagra.cygnus.co.uk>
* Makefile.am, Makefile.in, configure.host: tx39 build option
"-G 0" added.
1998-11-17 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Switch on host, not target.
1998-11-16 Tom Tromey <tromey@cygnus.com>
* gc_priv.h (GC_debug_object_start): Declare.
* mark.c (GC_mark_from_mark_stack): Call GC_debug_object_start.
* gc.h (GC_debug_register_finalizer_no_order,
GC_register_finalizer_no_order): Declare.
(GC_REGISTER_FINALIZER_NO_ORDER): New macro.
* dbg_mlc.c (GC_debug_register_finalizer_no_order): New function.
(GC_debug_generic_malloc): Likewise.
(GC_debug_object_start): new function.
1998-11-11 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Recognize --enable-java-gc, not --enable-gc.
Tue Nov 3 18:01:12 1998 Tom Tromey <tromey@sanguine.cygnus.com>
* dyn_load.c: Handle QUICK_THREADS case.
1998-10-21 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Put cpp defines here, not in config.h. Recognize
--enable-threads. Set INCLUDES. Create boehm-cflags file. Don't
define PACKAGE or VERSION.
* config.h (SILENT, NO_SIGNALS, NO_DEBUGGING, JAVA_FINALIZATION):
Don't define.
* os_dep.c (GC_default_push_other_roots): Define when
QUICK_THREADS defined.
* misc.c: Added QUICK_THREADS case.
* gc_priv.h: Added QUICK_THREADS case to define LOCK and UNLOCK.
* config.h (THREADS): Define if QUICK_THREADS defined.
* Makefile.in: Rebuilt.
* Makefile.am (libgc_a_SOURCES): Added linux_threads.c,
quick_threads.c.
* quick_threads.c: New file.
1998-10-20 Tom Tromey <tromey@cygnus.com>
* aclocal.m4, configure: Rebuilt.
* acinclude.m4: Don't subst machine_dir or sys_dir.
* configure.host: Removed unused code.
Sun Oct 11 08:18:02 1998 Anthony Green <green@cygnus.com>
* configure: Rebuilt.
* configure.in: Fix typo in previous patch.
Sun Oct 11 08:06:11 1998 Anthony Green <green@cygnus.com>
* Makefile.in, aclocal.m4, configure: Rebuilt.
* Makefile.am, acinclude.m4, configure.in: Add multilib support.
* configure.host: Created.
Tue Sep 1 10:58:15 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (lib_LIBRARIES): Use target_all.
(EXTRA_LIBRARIES): New macro.
* configure: Rebuilt.
* configure.in: Recognize --enable-gc.
Thu Aug 13 10:52:45 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (COMPILE): Define.
(LINK): Likewise.
(.s.o): Use MY_CFLAGS.
* configure: Rebuilt.
* configure.in (MY_CFLAGS): Define and subst.
Wed Aug 12 11:41:43 1998 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Added --with-cross-host argument. Use
$with_cross_host to determine when cross-compiling.
* config.h (SMALL_CONFIG): Don't define.
* configure: Rebuilt.
* configure.in: Define SMALL_CONFIG when cross-compiling.
Tue Aug 11 11:41:25 1998 Tom Tromey <tromey@cygnus.com>
* solaris_pthreads.c, misc.c, gc_priv.h, config.h, alloc.c,
allchblk.c: Merged with 4.13a2 while preserving local changes.
* Makefile.orig: Updated from Makefile in 4.13a2.
* configure: Rebuilt.
* configure.in: Updated version number to 4.13a2. On Solaris,
don't build with -O when using gcc.
Merged in version 4.13alpha2:
* config.h (USE_MMAP): Re-enable on Solaris.
* solaris_pthreads.c: Removed RCS Id line.
* alpha_mach_dep.s: Removed RCS Id line.
Wed Jul 22 15:38:12 1998 Tom Tromey <tromey@cygnus.com>
* config.h (USE_MMAP): Don't define for Solaris.
Wed Jun 10 12:51:41 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (libgc_a_SOURCES): Removed setjmp_t.c.
* Makefile.in: Rebuilt.
* Makefile.am (libgc_a_SOURCES): Removed add_gc_prefix.c.
Thu May 14 15:32:58 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am ($(all_objs)): Depend on config.h.
* config.h: [MIPS] If DATASTART_IS_ETEXT defined then define
DATASTART as &_etext.
* misc.c (GC_init_inner): If STACKBASE defined, then use it.
* configure: Rebuilt.
* configure.in: Define STACKBASE and DATASTART_IS_ETEXT for the
tx39.
Tue May 12 13:15:45 1998 Tom Tromey <tromey@cygnus.com>
* alloc.c: Don't call GET_TIME if NO_CLOCK defined.
(GC_maybe_gc): Likewise.
* os_dep.c: If NO_SIGSET defined, then have empty
GC_disable_signals and GC_enable_signals.
* configure: Rebuilt.
* configure.in: Added --with-target-subdir option. If
cross-compiling, define NO_SIGSET and NO_CLOCK.
Wed May 6 16:40:28 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (.s.o): Directly use CC -x assembler-with-cpp.
(AS): Removed.
* aclocal.m4, configure: Rebuilt.
* acinclude.m4: New file.
* configure.in: Don't run AM_EXEEXT. Use LIB_AC_PROG_CC.
Thu Apr 30 14:51:12 1998 Tom Tromey <tromey@cygnus.com>
* configure: Rebuilt.
* configure.in: Link boehm-config.h to config.h.
* Makefile.in: Rebuilt.
* Makefile.am (INCLUDES): Removed.
* config.h (SILENT, SMALL_CONFIG, NO_SIGNALS, NO_DEBUGGING,
JAVA_FINALIZATION): Define
Wed Apr 29 11:03:14 1998 Tom Tromey <tromey@cygnus.com>
* Many files: Use GC_bool, not bool.
* gc_priv.h: Define GC_bool, not bool.
* misc.c (GC_dont_gc): Define as int.
(GC_quiet): Likewise.
* gc_priv.h (GC_never_stop_func): Declare as returning bool.
* alloc.c (GC_dont_expand): Define as int.
* gc_priv.h: For gcc, define bool as char.
Tue Apr 28 22:44:16 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (check_PROGRAMS): New macro.
(gctest_SOURCES): Likewise.
(gctest_LDADD): Likewise.
Mon Apr 27 23:53:24 1998 Tom Tromey <tromey@cygnus.com>
* Makefile.in: Rebuilt.
* Makefile.am (libgc_a_SOURCES): Added dyn_load.c.
* configure: Rebuilt.
* configure.in: Define SUNOS53_SHARED_LIB on Solaris 2.3.
Wed Apr 15 11:40:56 1998 Tom Tromey <tromey@sanguine.cygnus.com>
* Makefile.am, Makefile.in, configure.in, configure, aclocal.m4:
New files.
* Makefile.orig: Renamed from Makefile.

View File

@ -1,141 +0,0 @@
#
# OS/2 specific Makefile for the EMX environment
#
# You need GNU Make 3.71, gcc 2.5.7, emx 0.8h and GNU fileutils 3.9
# or similar tools. C++ interface and de.exe weren't tested.
#
# Rename this file "Makefile".
#
# Primary targets:
# gc.a - builds basic library
# c++ - adds C++ interface to library and include directory
# cords - adds cords (heavyweight strings) to library and include directory
# test - prints porting information, then builds basic version of gc.a, and runs
# some tests of collector and cords. Does not add cords or c++ interface to gc.a
# cord/de.exe - builds dumb editor based on cords.
CC= gcc
CXX=g++
# Needed only for "make c++", which adds the c++ interface
CFLAGS= -O -DALL_INTERIOR_POINTERS -DSILENT
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# -DFIND_LEAK causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions
# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
# (Clients should also define SOLARIS_THREADS and then include
# gc.h before performing thr_ or GC_ operations.)
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_private.h for consequences.)
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
# usually causing it to use less space in such situations.
# Incremental collection no longer works in this case.
# -DDONT_ADD_BYTE_AT_END is meaningful only with
# -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
# causes all objects to be padded so that pointers just past the end of
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
# -DDONT_ADD_BYTE_AT_END disables the padding.
AR= ar
RANLIB= ar s
# Redefining srcdir allows object code for the nonPCR version of the collector
# to be generated in different directories
srcdir = .
VPATH = $(srcdir)
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o mallocx.o
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
$(srcdir)/cord/cord_pos.h
# Libraries needed for curses applications. Only needed for de.
CURSES= -lcurses -ltermlib
# The following is irrelevant on most systems. But a few
# versions of make otherwise fork the shell specified in
# the SHELL environment variable.
SHELL= bash
SPECIALCFLAGS =
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
all: gc.a gctest.exe
$(OBJS) test.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
$(srcdir)/config.h $(srcdir)/gc_typed.h
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
gc.a: $(OBJS)
$(AR) ru gc.a $(OBJS)
$(RANLIB) gc.a
cords: $(CORD_OBJS) cord/cordtest.exe
$(AR) ru gc.a $(CORD_OBJS)
$(RANLIB) gc.a
cp $(srcdir)/cord/cord.h include/cord.h
cp $(srcdir)/cord/ec.h include/ec.h
cp $(srcdir)/cord/cord_pos.h include/cord_pos.h
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h
$(CXX) -c -O $(srcdir)/gc_cpp.cc
c++: gc_cpp.o $(srcdir)/gc_cpp.h
$(AR) ru gc.a gc_cpp.o
$(RANLIB) gc.a
cp $(srcdir)/gc_cpp.h include/gc_cpp.h
mach_dep.o: $(srcdir)/mach_dep.c
$(CC) -o mach_dep.o -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
mark_rts.o: $(srcdir)/mark_rts.c
$(CC) -o mark_rts.o -c $(CFLAGS) $(srcdir)/mark_rts.c
cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c -o cord/cordbscs.o
cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c -o cord/cordxtra.o
cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c -o cord/cordprnt.o
cord/cordtest.exe: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
$(CC) $(CFLAGS) -o cord/cordtest.exe $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
cord/de.exe: $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a
$(CC) $(CFLAGS) -o cord/de.exe $(srcdir)/cord/de.c $(srcdir)/cord/cordbscs.o $(srcdir)/cord/cordxtra.o gc.a $(CURSES)
clean:
rm -f gc.a test.o gctest.exe output-local output-diff $(OBJS) \
setjmp_test mon.out gmon.out a.out core \
$(CORD_OBJS) cord/cordtest.exe cord/de.exe
-rm -f *~
gctest.exe: test.o gc.a
$(CC) $(CFLAGS) -o gctest.exe test.o gc.a
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
setjmp_test.exe: $(srcdir)/setjmp_t.c $(srcdir)/gc.h
$(CC) $(CFLAGS) -o setjmp_test.exe $(srcdir)/setjmp_t.c
test: setjmp_test.exe gctest.exe
./setjmp_test
./gctest
make cord/cordtest.exe
cord/cordtest

View File

@ -1,137 +0,0 @@
/*
MacOS.c
Some routines for the Macintosh OS port of the Hans-J. Boehm, Alan J. Demers
garbage collector.
<Revision History>
11/22/94 pcb StripAddress the temporary memory handle for 24-bit mode.
11/30/94 pcb Tracking all memory usage so we can deallocate it all at once.
02/10/96 pcb Added routine to perform a final collection when
unloading shared library.
by Patrick C. Beard.
*/
/* Boehm, February 15, 1996 2:55 pm PST */
#include <Resources.h>
#include <Memory.h>
#include <LowMem.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gc.h"
#include "gc_priv.h"
// use 'CODE' resource 0 to get exact location of the beginning of global space.
typedef struct {
unsigned long aboveA5;
unsigned long belowA5;
unsigned long JTSize;
unsigned long JTOffset;
} *CodeZeroPtr, **CodeZeroHandle;
void* GC_MacGetDataStart()
{
CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0);
if (code0) {
long belowA5Size = (**code0).belowA5;
ReleaseResource((Handle)code0);
return (LMGetCurrentA5() - belowA5Size);
}
fprintf(stderr, "Couldn't load the jump table.");
exit(-1);
return 0;
}
/* track the use of temporary memory so it can be freed all at once. */
typedef struct TemporaryMemoryBlock TemporaryMemoryBlock, **TemporaryMemoryHandle;
struct TemporaryMemoryBlock {
TemporaryMemoryHandle nextBlock;
char data[];
};
static TemporaryMemoryHandle theTemporaryMemory = NULL;
static Boolean firstTime = true;
void GC_MacFreeTemporaryMemory(void);
Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory)
{
static Boolean firstTime = true;
OSErr result;
TemporaryMemoryHandle tempMemBlock;
Ptr tempPtr = nil;
tempMemBlock = (TemporaryMemoryHandle)TempNewHandle(size + sizeof(TemporaryMemoryBlock), &result);
if (tempMemBlock && result == noErr) {
HLockHi((Handle)tempMemBlock);
tempPtr = (**tempMemBlock).data;
if (clearMemory) memset(tempPtr, 0, size);
tempPtr = StripAddress(tempPtr);
// keep track of the allocated blocks.
(**tempMemBlock).nextBlock = theTemporaryMemory;
theTemporaryMemory = tempMemBlock;
}
# if !defined(SHARED_LIBRARY_BUILD)
// install an exit routine to clean up the memory used at the end.
if (firstTime) {
atexit(&GC_MacFreeTemporaryMemory);
firstTime = false;
}
# endif
return tempPtr;
}
extern word GC_fo_entries;
static void perform_final_collection()
{
unsigned i;
word last_fo_entries = 0;
/* adjust the stack bottom, because CFM calls us from another stack
location. */
GC_stackbottom = (ptr_t)&i;
/* try to collect and finalize everything in sight */
for (i = 0; i < 2 || GC_fo_entries < last_fo_entries; i++) {
last_fo_entries = GC_fo_entries;
GC_gcollect();
}
}
void GC_MacFreeTemporaryMemory()
{
# if defined(SHARED_LIBRARY_BUILD)
/* if possible, collect all memory, and invoke all finalizers. */
perform_final_collection();
# endif
if (theTemporaryMemory != NULL) {
long totalMemoryUsed = 0;
TemporaryMemoryHandle tempMemBlock = theTemporaryMemory;
while (tempMemBlock != NULL) {
TemporaryMemoryHandle nextBlock = (**tempMemBlock).nextBlock;
totalMemoryUsed += GetHandleSize((Handle)tempMemBlock);
DisposeHandle((Handle)tempMemBlock);
tempMemBlock = nextBlock;
}
theTemporaryMemory = NULL;
# if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD)
fprintf(stdout, "[total memory used: %ld bytes.]\n",
totalMemoryUsed);
fprintf(stdout, "[total collections: %ld.]\n", GC_gc_no);
# endif
}
}

View File

@ -1,886 +0,0 @@
(This file must be converted with BinHex 4.0)
:$deKBe"bEfTPBh4c,R0TG!"6594%8dP8)3#3"&)e!!!"4UiT8dP8)3!(!!"50A*
-BA8#ZJ#3!aB"#3d0#'GM,MBi5bkjBf038%-ZZ3#3%)Zi!*!8"@`!N!6rN!4069"
568e$3`%!UbqAD+X`19S!!!Ba!!!,*J!!!F%!!!-PfTmj1`#3"PET)d31)LTH6H4
#*AqG5b5HI*)QjY$IIb00%ReTJSi6rG$jG(bZ,"Rc,9Umf[IRj)6FZ-j`GfGR)#!
m-#qLqB#cj'G%46qffB3q8AppLXKc+P&*il4FMJMq3N32r[U,(PlSNdrQm-J(4!p
jK)NHmKJSHY!,&chS$4)pk%8mL3I)B0'$AU6S3'q)k%%[5[5J&ffa#68)0ZM&#T!
!*fHC-2dFZ3i83[Vr[4Xh'+DNQrm'J)rrpqe%ST`,FeVi6b,*qHH")4eQc28NFMN
ZT*m,L"Y%-`pdAk6RLHDaeVV0a,,@P(4UUK66rUM'8bf91llS("lTh81)MBQ+4*q
rfHENEhD)Ke#3!09'M%bL[P1+G88fa$3e)5Gpf0kARpBf*6eIH*0`ZBHR%ii"PbN
+D&*)688M)Sm$Bm[cCdDjh2YIjmAc`(TVpi*Vka((A*&Yl@'LTSH1M*AMP#,2[A$
(FHA@S"dL4dER#3b!EfBYem(C9P5iGH"a-bb-AL(F"bb-AL,F6)%a9pJUL,(hf%B
TeQb["X5ib4DQXV!-fa6&mZf&3,(C&UDd-((SpeMBEIB`8Zc,BcZR3A5'X+jYj$'
6)6HVV+R[!`#3!`X!(E@*MFQ%R4d"))`m[3JM[c)bBS54Tj'M(AP+MK&f%VD5SdG
SANFB@3Rqc$Am83(+)`"G(D%A'9!bBQ6!b)b4Sq3SH8D1NDGNX$)bBi54!51--$*
Kj0L!M"KKK"dC--,)-h+-6#KKC-$)-F)NamL!!Z06#X!!b&%bBUHp8RcN'%%6!b,
i!!kV"`"DLHFaK*!!"Ym4K,,2i2X4c[,`c5!GIPf!ZcNi'8'VfJFpSfdpq+CY$8j
-V'f-DZr2[36#1(ael5hmfT@1cSU66D5pqDSA89pdTP-`Z[jj6T&!PmZBFZjal"&
5iG6#blE$+&kLh#QZ118&(0T1J(hZ,9)5MJ9ic*qPI!ac'RJ96QMZjSbkMq()Ui6
B+f,,#'N1icbM4N"aaBr1`3Z9U'8RY'XAiVXFKp#&k2D5Be%VCdh4%,+2QS'b"Q2
%0PNT4rE#%kTUFqYDM56bVjfe!p8MqmL)1VmjVkJY`U[*$&*L3AMSpB@LCQ*U&l%
T+3890rL,V9klFN*4@f0UTf8Z&&afN!"4GC6G8p3fN9$4+4[-@DAeK%lej"@eAAL
eU@&4[Tm28%mqqUkS(F+VDa#lB&'rlRAllRP&l460Qc,)MHR$jMh@$8Y4Xc'e`cd
ZE2AUUiH+fK96feb$epq&'RAQeLG&lCDjmP+"Kr8k9#qp'eI8RPf[6R$dS+$UcqI
ELYSV[*ETFL&j[@lr803qd9I2A#bi4Vei3*d[+@Urk*!!&abe0HTVm%44"i4A6JN
c(2I!kjRl6a9e813DK"A6p(LjRZZGaGH+1L5SiBT[(6ekd2*ILMSXU(l)#m3QMDB
V+QTG!r*NG#RQai#DNh4,l0&!Ie`dYi98Y1%1A$5hKP4,`d9cHdKP'LkD@q4hYC*
%dfdLeCCNN@i9UIBNLh5l5(8N68qhM&4R`d9cfdKP'bkD@dHU+qe&XRfNZSqc10j
#8Me*&ZNfNZT0hSYd+dP&ri-FGM6G6P,p5D,rPNT0`dQLk5+6'NLb5"HDe'$L)Pe
X8N2bj-Z'$r$6-$NZjLGC)1lB-"jQSff@[ak%LJ[rI#%p2ddAGREN(@"V+,S6CI!
I!!!0$3KRBbj38%-ZZ@0M8&"$,VN!N"#$BJ#3%4B!!!d'!*!%rj!%68e38Ne33d-
"!+X[PfqV-$P*!!!'-3!!&UB!!!(&!!!&C80(jji!N!BMM#0%$L)UANhN3L9rV@9
B`f#c2p$XpAVVCc-[`k20Y5bJ+CTHPScj`Z'!lmr*#EPaRH(ZcR!J!!rqMKG"q)#
cj'G%46qffB3q8Aqp4R6FA83PM6`KUjaYD&IlZ@jDrY"pk[b&AZrdH*kFbb9PM*S
`4Kh$c8Lf0bVe+Y`Q$amM6mc%*C1(jF&1bFSdGIlLpc*04b#X&D8[&6R%+-#6HhJ
kX"#A+Bp6%6RGkB&kM%'jh$ZLmam[1Irq,r82rGM"5H4bh1ZB+b"Z%&-pD)5CL9(
AP(4UUK6$!(lkH+UPFXFARF-MIHHMXf!5Nd%SZYRQj'pfL)G3N!$94X#(q25G8U`
VXL'QU3Njk8[phV2@0Q92J#d6rA2N1["[!%c(M4X-8p,0IcYJf2lRBmD2c)*RQEF
68m'9jqq*MjHTji&GqDp$kh501r9fqVPJe4iQDRS)L!)ELqiX08i#@40jpP1+F@p
iC&))L)Qq4Bk-cK-i*h`cDlN1cMBUbZA3+beKhX*-&UD`X%ME%F91fHB3BaCC''Y
KNba-C@(,"-40Yl"l,#c8`YCDf%#"XGD%F4m3'*i'k"iah[Ddam+k"Xd3eV@02'B
bj'D90I9p!!!-q)[jAU2HhQ[NiCQC&f(Ne`JR!hlN1''4Sjc`)hcL5IK+f(@8(q&
(1&Nj2XreTBI[M!0dGB4'MK01#CFF2c,JK"*1MNZ1(q&(11@5ii5EKimF*ja``Np
#bA(#bBL6BpQ6jq5imT-m2mQ!dq2N'H&2RT2M%Nii'6$J,PF!#N#jGS3IS9Uba%G
'A-)*8[#%!j-9'#r3@EpUPQ9+NL6$ldj*kVS6INIK@`*q'q$hGRJCPb,`pUJm(fQ
3!#mGrdQqe$Nm22hkJ2cerNp"i3$m4Z62S5YA40V([V`MbHF@)QPT2IN@3@$ceHm
I&dT3GqF9K,'&&8[6LKMTbQ6@-*%bJE#4RM,b'FA*'VC5`0BBdTa"@aNXM#)mU'"
N@d@XSIKMMiMh#RbbLSjLT49GG9"F84)Q8QfN&![N1hK"A'V5F,,dJIF@+`iNJEb
H-(5Nar84j!"*Q54MH+j&08dYQc,(ipT9I+aFqIQc-XP313&803UUPPD4*+UAIlj
$U+jMAP1QUSfEYV2Qp4HKfZ#TYQTCT)hEaCbp+ZXH0"m5USfHDV1HbL4cCT@41rr
5+d+eL4&+'hR90)iLRp$LYcm)e5McQN@UMR#&$kKqr%eHU-DBejbUCC-k+P4N5r%
Iha+Uc5aj)kVfm*'ej*8Dali5ULfHDLah-l$Zfer1#G9@6l8TTf*r,RKTZ2#Q8'h
MA2&i%MYq(0aCicHKfPlfDYLeJ3*FFEG3l@"HmfJbqFrdHU&IU+jRHE95BmQFkJF
29)qp)93hX!aCGLfYP0!jSEU4HF9)-e8M9rADGfC4U(BbVVC66+8XR2Hj2RAmGk'
kLDNk8`@p0[6F"hrG,e3h`kmm(BhDMQjBm@`ejDH1pG)YbUXYM'Y'5aD`-H(VPZ)
,*i6A,Nqe)D1Y'5@UV@HM3VAE)a3$3MT+9jAGa)HI#%*E@9ie+jmf-PA9dY#66`Z
[fkMA!l&$eZ3)bP996crcal6`ZRdT$9NG0S#+V([`rRZ&eae,A%dMGB2V4H%9YPL
LfZ3B194,NC[ik!QKZSYlaE"deVc1$3[9(XVeFJIG0T,9**@'AVXJZ2Db$%'!,$a
e+d2+8SES`Z&RD1(C`m,VlM*Aj)cP#M@ZlJI#Djp(U28`fl)VL9dKY+IXeFM!HRJ
MVc0#YCpj6@!,M0VrHYh,CMQN!FBjl1ZVEPhjaCK)``"6,6JiU@@ekMjdmEEPI@M
3DpXKj3pi+f`LFFpIUPrF058)N4X)f4ZQ*P5c1[&!pGhC4i@Ue2BCE"bRL&haLRk
Thb#ZUK&ZK-Kc9k4Z-[QKhdaf&1KhN!#*#IdZ-XfJhdPQ)I6l#![SYjD'HXp$hdA
f$1LhNlN-r4DbV8$I8iS[RSEqj#URqY@$9b3dJG1XG))%khUHJMX,Vh896Z%"I%B
PFK1MejpP2[@,$LpbTe[Q%h#[hhai0BBHF+r-MrTeL9G6k!!IKHa1rmf2qMf,9c6
d)%I[5Hq$1hVVq60(`H@-9fb&cfkb$BBDc1-Ck@@#jrVH%0cXH$@cIK[C#F&2Q9X
[qpl(HTpEQ9F`KqVA3&iYS3Pl6#ARpIXMVpCP6[+ma`PkbJPkbJPkbJPkbJPkbJP
kbJPkbJPkbJPk1MHKTlbJTlbJpqGlF2RNe4CD`1XDTfUZEYjDHE@[F0T$,KbK"Vc
mA!9AAPiGS3Qjm[HQi+l-LraVj'p1i3&mcNKce1@eZ4pFX(PY@1(66rD18)Im"eF
YAJ1K#AYcK92peXpVBfM#AZAIKi*r&r$U$"h)dkhp2[JI!kp0S3GjhdZZV))A!43
jH4kk(TLQKF4pTXhHI!ITRb%hcX3KfeN#**1EI54a"'@Z8(9Dm%D@b"Y#qhm!N!-
0!!PRBfaTBLda,VPM8&"$,VN!N"#ah3#3%!9X!!!I``#3"2q3"&"56dT,38K-!3#
TY1))Uc!eD!!!@F-!N!B563#3"2$I!*!)22J1`2KbNQaPEr+hGEX``Jk!Vpa0&eT
RDl*eSGZ&%EEAc@iGG+hAYBDRapHZd6ETQH'lV2AbpMVJ4lN,ck0G4lMb)fcKAQi
*AeLhm1)VRfPGM,"Zi8pBG1%a3VYZi@m,@rM#2'iAfhjHacE,K"[bJGYB,ZcNP&#
"$cqJ[fRG`SmXR'aMC-H6r-)AXTaNHE+Fj"HkN!"0"R[G!H4jITB&`!(!dKX"PZ#
Z+PX+S(dCS&YGZI3,cN3L+P4H)V5R@D3p,54$JD"3'!j')mhRcl%mUJ)9e2PVUaF
j[6lNX)ll!4,jajb6UrZK!hSTX[caD`$ZIHl,pdeVm&EaLeKG-YjQB6AKT)84pF,
kB$+55%ID`b-4QF0T19ckfSl,d['15$X-4cTr0"2!dIR5%1j[S4JQa0,J4lT!pkc
"EjcQ2ZmmNDF36,1DH)X!8($N3ihbR+mcX1GC!E!0fi)+ra)rCUL`#HU&V9)ke`6
IhTB!b&RK%B!&4fA8Ecr8+8IBcr)4Z8L+$bmVaA0$-Lr)$3+SMf0Xkh!%1L(hiM$
H56i!P'Q(V3ZXrmCRE,f[6f'0N!"Z$E6%fl(AqCL20Ka-#kRdjh`qA&CRACe[!5i
+PSiKjh)6PJM4H$#5%&U%HF#GqF0F$MM6fH)T68dFSQ!hQ*["e3hGME'TS#e`Fmq
Sl`'0qRTZMfEcM@b8M`(hV,a,kqB4N8iZ[4Sh5b!9ddQpT9YP#5UK!NX`BDbr,"E
!TME)X#08Bm,*$)fP2Ci@G1bTGUbETe@@q%4QL60h[2d5)BQGX-U5,*6)q)99'NX
bP3a1pJZTH#BC&"!P%4'5XP`!Fm82LidDE@#h&eejC#m'cSQd"k1C&S(CD`*"Va"
S%C+TmmkE6aJ*6S3kTd8)4GS&PNjQ"#DY1419T&!JQT+cV-0*5@'9$$5+K-58Y"%
N8Ea'&)q3!*!!UeBZ'qd'!&14D",LQVJ'$qTI1DUU3$%0cAD!e9HMkl`KaGAASBj
TJ#pMhSb5Rq0c+LJ3l3LJkD2dcrJM2Q%3Kh&mZL-JR(&m+L$L-)j29b,%B4br8)j
X!Y$j4ZUh`)[eI!A!R(d!4AHG`LH[d[f@re6*b2mAI`)H5F0aI+2XYq2iC)+N`6M
qC$b5"Z2ij,N%KHI*24K!$k@Plm*Hm'Rd8-bci0h@*rK6m%JDM[-[aZ1Nhq+IKNH
UJA&mE-V&'KM(2a129!2Mq2,5(2qIrSHmNfTSR2rTH+3D'XHRfL81irM8FE,Ep4r
eTUeM[5Ra8bilkJJ6f!)lF0e(0'p*Cke+2Nq9ccEjh#UIZq6c&[RmM(3ZV*!!cL0
k&5l"Jp4$Ilc)-m$9BDMqeV0m$l6LhM(EAX9A,10lG,aR)2GNb6Sm29&b0@CfmMd
&Mr!pHLh'hX&p"qiPVV#h)jIcaN(YAHVY!-im,lH&lp&Fc$pX!KD$+,qKqbMQh",
@BjDAX[M-KFF0&bH!le%r'GC@E`LVXP9mKXdeG)3QcED[U18Vq4jY2c-fD8XFl$a
Jb0pEdXPRCYXVR!e1c(f%qF`GKAUQcPT3T6E-YjCF2GYHhq#[aqa0'*p@XJl4r*8
qM(Fa(e1(MAb2DUZDVTq-SD2mJ+kFAj*ldAQmX-KFQf"C5i,E1fA&P2jHj`!8*c4
Cbq,eU+LUqmriLrQ-H$8"RJ(GXC,YKXYCKk(M!EcN!3MV-HG3b@DB@MEAd"P5,9[
2CjDYplkH1ckr$1D5aNf'jH[,p0ehXaPCKe@(eI0#11SC',UQT)X9K3qD(G8hK#c
C@GQUfADhU*AQPE#2X"A&i-9KaAUdDe$"bpQU)@mfJNfL,U61YQ4RBFiKFac+[hC
Y@49Fi(Ye4UjKII9Fl[b`UM[(Ca+6ZhF[@mq`0Seer)R3*#Y$$IcK`pPc%EI6FKZ
I`IV"'%bLZK'Mdl!5jqQ+3J!feU'k*f(FZf(EGY@@N!!CGAmMqd9@CrDD68d'jf(
3TlQV6AYhAEJlGh4$epjV3bSqBiDXKA!BPjeTVUYp1pI,DPfESAK1"2eSD[B-elh
H#"KCEIFl0K-Um0E-CFr[,$HC6Hhc`fDr-eb-HmN5*`iSE-8)!#TL+mfKpUV"jrc
$X6fMXIlRYZ5'5$I94YXX-&C(`""L$Dkf)VmVe*%)GZr'mh(#3i3EqlYKNKblRf*
'9fi`h"aV43`ejERI0DPfA"MDB``XX)HHa#bYS3h1c!hCcPlQ0+mDh0Yr`mEU8Hk
YrAmUXCIMj8SFBkA%6iNVCjRI%C(IMj&E3@l3G[C&a#hGId-rBQbXrT)c0e6q'2p
eC)89`[fJmPd62,qrh"5fBCA-$%rb1d1R5hbj`ddQ1G,60%Q1l'T#EqB1)110@)h
%i!95M+ekEiM0HfqSHM1k9UQY&%V$jTQPB&VZFVm*4FmG"[Acbff$#qbZ,a3IKUr
B"VZ2A1J-[B%elK$paa&k8Z63JaakNVNdL$c1fP%+A`QGIJ'bm6iH0ZklkX(0S"E
8jP*3Mb,[3pbE@&fLD'2RS@ZY1`pG"kj1X1j#2R9*X*QX*TAMbYcVef*YX2)T6FA
Q@D$Hf'AE5@VBGSP+2*elSqN#9T4Gc"`I)"SMr!P3K8hPL)Se--@E+!*#j8qBAdA
F)f`H'*JMT!TSH@V*`'V2IZI1K@DpeEljYRXA2YJ9eU,IcfjLaVQJjXS%LTUELM'
UNU1Q*M@HTVX(FV[-AA`QqadqFr3i9[JU81PlSB$r%d$A3iqhZfXV+KG!GjBeeU(
[-cfI+9deX0(XqqDqeeCrEqGcqm6iUPf$i$#AQd`B@p0rSjJ6NR2d'hX'fX5-"MQ
MU,pRS%(-F-NCDZeUk[$*BA*h$2XG9RaZHj-D6bq3!1YJC6AD61@QEFZ@lXi09,[
#3r`40LMRE"V0'C!!FecYKJh1Q(D[`hN%90BLbX@@Y!c8C8j3QmY!ApD)[GhVGTJ
**CcApF6MTA!ZjkemqUrh9AKG,PI[cVeVI+q#h6`$QIm$kKcXmZ"@c&ph+[pbaRf
+-2[6I1-)JqV1YQR9UpZ-&Cd9Uc'6i5P6JCdV6"8c-TKV%$1eQ*@af2(L22GJCe"
VaTDFcfaEffcXh1Pef-$Pm$Vic)0VQmqbL$(+mRVQJpGcr8kVcZZakIJ-9F5"VJ2
A)XVacTfpDfd&ZhSY"9l2XleH6rpD3Epa6E1D10FlQJjH!G34SPGS&qM3*fC3Pe2
L`2L%lVY,CV!*T39qcpXH[fHHVQRU'%UAhk2&Qk`VKaD[,i2ZHk`cX2[6K&iQRrQ
lbPXmS@QX)1Y!&RH`da"Y"8BfPYDc4GPC#3lV4AhlG+E(2&HTGaMM!VD)&65CaPL
Dr4lQB&J09`k9kE(,mhf[0f[T[[2#[mfpH2-6*6k4bk,U5Z`kcd%Ia$UcfEZ2Z!G
1&'%PEF2B1aKl$'0hBH`R',X1BjX`pP1-h6AD-aHa8TJD0Z"T@[KdIJ$5L*0!R+1
)NmCi#mDEj(J5i`fS4KaV[49[Y[ASjjGJCfSIkdaR)f+)e-#cLpMMH4iTJQFE+B$
RFiN4RXfXNFpBZGXAc[3QM,G2Yh*CMh@3!(q8lFE6#ID-P'YZ"AefKT9M99N2Re%
Z5UJ[cKd0UjR$Y@%N5eQr[bVdDANH1X3[2[#XjcJ0%Se1!jKa'U#f[M%BE`p&`TC
@-mfEF*1J""c`J'Sc4b0!`0Q1cH9X!e(3aCl!)H`k4qIhpfYS1)*',+EMMLJR'JM
*XAVRp4,L3*6EFHJLENI+bThcfZ@BBX$BV8U1Sr-@+@iljX&F'M+D6*J-'5#(%1k
[1&EhlT'("@L3!%(&RA-a6V0,2#9X9%3D8*&8fT'k`V(k5V),NCZX$kh*MY@GDYV
4Y-8%c[bAlh!l-U6&69c*e@N4Mj-C)C2d+XbiMLZjUSJ3--Aq8HQ-$[R0RcMaPa8
e&lLqlpUj[TGS[iMVqri'VZr9AUl[KhZi[J-YA0r"GUl[d&eFhq'YA0rr0h*pEml
RqYlHa2Ap"212)[Ba!pGh2-6e$Gc+p3dqbr80[FMe`hbZAjA&I4IA2aN0'##DQ-I
F0B%8$M1bX*!!6V&dUi!$KD&N2-DNDAZFBic&F2BrKF2r6-!j%"D+4)8c'q,aD,f
3!-3j51B9SJP@RdlLA(j+(8X++A@L25E3BD9ki@,HV9l@i1F0$6KDbP$RC(bL'2*
%ikP8)(QCZL15MXe30%"dDAVbI)DMURqBCV&i5b4dfDrbrk!LN!!@@#SGL#9B+*j
N3JH#Y3HLV#@5r"fhhq@IS5Jp9LM&BLQF6+PSMTk2cbS%9c)KQ@5a90K#Sf4N5PN
S5M[3da4hiQK)k+XiA(ND$YpSYSe-m)LIZ,6N5rL%!p$M"e)Z2G@JJJ8FXU,((EM
pQ)@$C4*&(*ZN6`SqKSGP)q02Q+F@[iqA@RaFJFBHbCM4qfMF%h!%89`D('LN6e`
k'KDkIh4i5)XM8r4*4)JcM9hKZ+)%Kcj2Rl4%aj+pAcSALTmN,qQmF&6[3Z`$k*0
%H%M18RJEF-b22R&0qM&+6,@P[&-a!BIik*1U!BGKe64B611lY)`iBNHI9"S+Ab9
l)JjKd5HT3V25,H+!P%`9Z`rkT%9kNCS1THY!pHQ6Q&%@$8)T99L%Sfhd5H*hI$J
64C28Y,C`Djl#m$6b!XGfTmrR*X8$d@L`Y6QkdK+%4i(E8[b59GP&,"cqQPC3ih4
MlA''N6k&X1iVfl4IfC%6%hNG3kaD8[4Nmd+LGcpXR+[Xb-XNFZZYEkLS`Q4G+Yd
5L413!'S-T`$1NR'U9P55`+R)+U%aM8!K9-"b-+[Xk$GR5FTkh)hN*rJB5@-L'EP
%j(6IK+GdbSlH-e9"XT!!TkM$335*3-%BFqd`miD+#P4)M`VKJ,5STAS-5DFJ,A9
lRF6mdQ"V)#Q+K-c,[YUNl&M9XNEZ@PkXmY(k8'eCj+P3G[5T%69*)e+cY5@CqV"
#$%SP0969B)9`fR3N*L#-jAfF#50kqURL8%pU-)M3+FmipZBILqkTH!E9YJip)aj
%`mKhi"GMeDhkeqSZq1IU*VIi[,SeRcM3"dM$M['C$j!!BhcZ!m11mCN2&2k,$aK
qi32[Hr5%Rh[d,hX-I&T(k6&F2UIBBc4(!m'9d93k(d+2NBr*-djj`D*SpBJAZ,f
9j!86F'3iZ$+9LDAqShqJf[jh,cLPbr2V[SPKZ8BUA*j'UT'@jR"M,2UIAFerUC*
hbU&Hqqk24KaUB492qKV`$C4!&+Z"V#$rQ"GJ24rmKPrCa6X4KAZ0c$d@5+lmTal
hVejS(qNI[*91V#iSP&p#b,2@2paR1A6E52mJe6FBBMJ1dGJL*2+9p3qIhj!![Bp
M('C8fB"h)XK)5,I&%TpfThIZ`BHa&(9Vm2+9kL#QA,kQIZdYiIaLYrARRVV2f2q
YNG[k'UGr%8DeBN-EK0EmEAlarTd(p5,rIHIa&j&hIpETLXk#R@jbC@-b,9jkj$[
SG20dc3jaep#MG,*Rm*9,kClGd#jFfLM2Qq@TmibVrRcNcU2@95h1CX5Efl"&%5r
8mURGV@U5ZdHGS,k4EYRemG4[EPCrFjZ4PqYQYFV$Li`LB4cI%5Ak4CIabTc4cV5
Z`5pfTSPdXM(B'Xb,d*RQlCVl-6rbfNK(iUpddhemB9))4J14@"k%hM42efh'efl
%*i192U1qBE',qSa81Y2F(%qfjbIV-mbRlM2Dk!QiiGN-X@CeBXhQjHJG2R%#l)P
%*m$r!"'46R)DGS+2k[XNTp(qiGGq@r81$FI)IYZ`[)lZM!cTba)YbQKh2VHq(T'
iYATPahXMf583L9i#-b!5'SA3JP$LMk5FV"eL5P&e,)!2AM(fqq[&rAqqJEX3ZJ0
4GUAcq1#I[$MlrpXrj3jb$ZiY+2BkkdRM@qKR3r"mcb,mia%m2lM89dZ[Vqh!-,f
QqNbpVjjZ29qJCq04M`2d!b+N'UT5MqGLqX832%q[Aej$mA2Gr%)2D,J,T!VQVUK
`%6jhAB9V+HAI4,rjJHFl+Pb,m4eQEZZ5@KrPp5aF@N9GqC2+ql1S&YkPdTmG6Gr
!qEV`09U+&4c&223NLQNk-DpALZNdR1mDqVXNM'QAB`crlBKL%mp(M*G"*FCZ`&J
DZ&cZG*Ki-f,J@mmLMhX`*R29E-FB[Qe,XDNr4DlPFZc[1GrDKlkqQYkKeBBaYUl
YEqK(@E3aM+N[HKM14ThU%2X*Hb(-`McNHXhpB"3j2BDaPJB6I!Ne%&qEaD`r`V`
YU-G"k"3ar)MaKKaEKl'$NQC6hd1-Lq4B$Q0G-XB+e-BRajCJ,+'*V3bd4NrqAp,
B[bJT[kddmXG*R(e#AIa5)9RRT[cr!`!!$3!*Cf0XD@)Y-LkjBe"33bkj!*!3qL)
!N"!0"J!!,h3!N!6rN!438Np+5d&)6!%!UE6L#+X`0A!!!#*k!*!'$d%!N!43[J#
3#1j"$F$iCXbcEQ9ffFS2dS@*jbZl63NYVcACZY$0##1XPDZ$V[@ke[$dmVQ6K5h
FYGEmE+(Rmc@246PGf0D9hF)@VNAi`VhS`KGM(GQA+lmmdfiI)f`c`Tq`63P23V[
Y`VEH`KHqX)9f(@(E*!Zrf-)@IZi)AhKXi3[E,M3j*432"&!HrHaD@&$M#f(,qq3
@XL1hN!$"3Rk6AcKCb%+1%di@J&@""TeG+a&(42abSQ*m9@@VL(4[%29TUPEGj%S
NfN09'd1a&"q0T8,*F(-`0#85E)pZZ-eZrEB+Z[80G6A,A6ir2'5jYd$i*mlPdrI
-@8-1XA6I6r6dUG[h&cAjUSAPI(dbhQEPDb0*+mqX6fN-*U1*9$3@'8GN$c0%(%0
GelfTH&Fd4Q0)jLrR%MNc2aM&pcf8d``Y,Ak!B(cHb*GQH1E2Phb'JLQq0Yi5)P*
IZ&DMccNrDX`mDiN1BLbSE&MC!)B+3p!!(FM4Z3"pmf##5,64Fd39&fA9Eck6N4(
q-Kr+TK`qGQ`-&dGPAb51%'Q'J"dB3bK$iZYMHPIm%$'QJ`j8f2l6cq5j@TmTYD&
8Dh0,2)CCjkGqG*&J+Y5CqU@IDmIQUUrh9q!`X*4GG$59b(1#DBYLrXT3Hc`B6B4
D3NZ)Zr'(SNLFq4ETPX+0#01J@-c9Mci&E"ETe"lZK'B2D682F5pVpcl#6cM0`cF
VIh2RdI%LA6N'$6l@jXi1I@kfp+LX3395@i-*Bq1p(FdBDS-m*N)0#&FB@QXXRJV
TqHr&d$F[UDca!YiDjchaf-C3%T1`bTUFNM26%1V@@T1GbH#dKP"R2*d-KU#5L)D
5FVQ)&NXr0"XEY)Prh,6j`NN!Fk+aB(Zk*F3lDTZ$[P"c5bMC1Arq8UD4i#5T15f
KF$3@iP2*G)M2RB8&#LRFh0iTXfaMT'5S@aDD8))aK6DZ*"9[2BV(P+51c4hG,L+
c53S*k44Xa8Acmd49U9R$Xk-p6,4P'e,Rh4bZH3"e6"(G$Pjab5Ikh&MNk*3JKBH
am`[rd,p4KJ)IdrpGAkQ!SYrdArSB+K6p(4q-kaYR%DeiK@MHTTrT+airpFpf(!c
C6D6hMrH[fSGq[SpSi@NLdj2ApC8!q05rrM0pH5A%p,FGr*AqP!RpYPrTjl,kIr)
Mrc0p)kiXJcl9Cb(1%'6hP`BRQ0MP'EU4U`lF@CCrSLp0(%#3!"HAp98B52*lSGq
&ZrfkrM3CD5@kEp'%2R+m!*ldPFM#f(9p0R-`C#rdT5&)cLr`#Kk#rMULrlIXZ[j
d'6P$Y0N+!(Y!54rDdc&h'$"brDYqB3l4$[hhr$0$4PE$2eXNb2ieb2fErJLM)1T
RZCa*(rQIH68r2Xk[*I+#iKreEj!!r52r-kc1XRmYjSpI3ai@B(RaKIqI,BSqG$#
E'MkH69X[ckB'iJEe$Qi`RhhAFB-&cq&lKKZFKRc"-D9m50)#'Z6Fp%2+jFLffS0
N5Tj%4@C5"GI&cC(ZFcD,h$e838lFZmM*m-eX'F$dP%A,,mqff[SF8$&N-KPiM91
9NF2XSa0J@f1fH(J8"hGPCVYkTSRLJ,V55r6R486P'%J,"U5PdFrVi(p*UM20Z#1
AjGIGE[0r"EdLeqdcjp[mNSplX,Y)hCYJ5aj0I@@G*jb-Gm65lHf-'iiR1d+aG!I
M4Q-YACfKpTEfZ,40CpQLY-XkZ5B+lNFp6BS(cVppFXHLm)JE3biI%jRZ4TD29iR
SY!R1P$QEBbjeBD*lqi'1GccMbIje'bEC1H@a56dI1a@*I@9pEqBF-qYcdaaAM`b
5FjP9B(QLVT*e4Aa$'kXN*T*FX[j[jrbLXcJ8Me@X&Eh%AL-JTT!!Gd4B3#S&rjI
6(0UBDSje*M'BT4+G-9BhC9*@-5jcH$[1@!XpJKl'$ZGDCHXmRb03ICB4reapCC!
!(Mqj("6&rGSNfp+B@FQGKfZV'cfXb6ZLR8&V%2h"l5[mJ8hjJPR%eT0&kPUA"r-
MPcHq*D-)FI[,GTp4[[$$5jiqJ&BGP+G#UkjaI6!H#dFM9NbNa28pDebXI1(,,(N
ED'bUV!CChjPULFDCN!"U8NG00mXke@ZV@1Ge4VY$ke-3#PpeT"PAmJT`"+9)V,N
pTl6IHLkVI,'RZ6PAIkpR2HXM[+GCRdK'0dVZpqGr6kpmXC'CT5KCd3'NL33K%LA
eT(2pQ21Q5[3dR+GDX116UUkC9$)S5UXm2KGcINq`Y6NTP421bhiMS(ba5j&Vj+N
6f#aTQ1JNeElPhNVPLj`GVbDV%DYQDdZbmeS[j5Xpee4GLelLG+PS4`JbeUXka[&
k0V$H4$f6H2FMHFHjNP0bI"Sd(Fh4'2DERk5`R-%10TmaEFjrI`$I68b$mrG)kq6
aHBBP*&LlQC0%8Xl9HQQfr9b!L@&XcMHPT*eJ*QI3,1Ibj`$iNqZ&q@YbPJ1Ha&!
Tc3P+,rc(E-IjIaGE%9QEH@4l"'92bccba&FiN!#)&l6[jHikPAbI*GrYmVe9[[I
)phhbr86Z2U8bGeIk!)'b%TGV)mAiNDCMGeGHc9GI%IUT&GqZ"BjUSA+ed+mA[-2
LXC)(FAZaC"ZB'D&IrCc3Ep!"HarI&r!YF8GmAD,SLj2'YmVA4CaPLEK2k0IH*6a
V*Vk$fS9GI4I"H5aL!-[(@%*ka9$HA3N5qMA()VUDA4&9YPT)mi[cZX*6&cM@eJP
93VpZN!!h"R3P6RiqmI$[+mN)k3@15PH6#pcRH,qPD`T@&9NVUY3'[UeNf`)(%Um
4l0h!LdSHK&T$P4pi$qrR04'Md+mkS'(0E3aI&)EejF*+mAAAd"56T5l"Ckd*lZ6
dYG-("ec$9*M3CUehlN4&9Aer+0`PT+AR#H3GeRp3FMK[%pq9er8Y223JLKM!HEY
N,mdU@jbA#DY@la65UhIkhK'(PTE4BPEM30kDR@@'[UIiiUc6TNIh["CTp`k2hPr
5`jXLjbc1QSI$eZbmE28#KdHUPIB[)RkQV95-AKqV@,pZ+bUiLHmHp@@M''(eB8f
f*6X2R,FYF5Vrc4ePeE6)rfDaf,5cCM&h@d69*`VTa,5qikYhmZK0Ble`+6c9aU-
'$C(cf9ZKQl&q68LMIi$490Bh%PU%6PbL0f'aB1Hl9(X5aT1l$Kj@l3YE82GhXer
JkbdqLcQ3!1Fk6iB8YmemmZL+iq,&A6dRGi493YT#@5[6iERXA%YphBr&!El1[CF
+&dD44l1b0lLIpNA*b0Ie[@mhS`,[c9hpkT&bXm8F@aUa0,JLKIL@V(3KLJm!)8*
&l+8LDUmD1G8`KVdmJ3fHfLH1XVUTHZhcb&J6TE``hq4Z-c@i`ef*B0pah)HB(K3
H'HbMU6,f$BBChH*)C%0(+c3dM1IjL9Re`SV`bmEQ#NIi'&Lk[$Dk84behl,DCHN
H16RiF'r0K2I@`Gr,ZCIaFJ8(9XVm+EKbPreGN!$mr6@mUF84qbhVQ,I8i-1$d1L
YqD*,(#erAVJEVY!Kh&Y92c(6UfI+c4%lZQ4ZC'U$+c`cjjFl(c$,5(pJUS`F$5#
EZE0`h)YZC!jHBaAMZcmFjCGm1&U$M9+Ne&j+T4(,h&)bVh&lrSC-Tmk6jY8epT%
+KrZQ`[0dKhfNlm)+9rKGp,K6bKpRq*MNS4mHqT0LLL3I0lp35RH%Cbk#'pph)mE
6[h0S,fP#'NXTD5D86d2hbhap`Y5EHAZ(lFME$j!!1d1fSr"6Rb5lf@C@BB2jcJl
d"Pmq29"SQ8HDhKll%9B0qe'T%Lq*l`B@mDEXREcc)d9M9,K%USLj(+VSJHQqK)Q
BUR$*mLCd,r",+)phKPA01S'YCFRQb(lRkmXX"TYMlpHHARDS*k*$hLm)m'`$`C@
&''S*&!*9bDJjS-&YYQGB2'VT%G,Cl`MTLd2Sm'j5'3C),I`f)I@3!2%1,)HU+UJ
[bkq[4qlc"L&GfMhFDr(rrZQrf[,p)kG15hMhd4&b@XV0CQ"E"aq41''CBqMY(fk
6'%db`c6B2p`N-G`b3k2E`LC4PM$L%f0jKiiA$`FdZ,h'8JHGYGjZ,MFIA,hUZ$K
Fiik-#KIi%CQcHi)c,(2FXEaGVJlG5DIV!UPX*XE&5&T'QM)AD5aPC#KEMpRZ(3F
@d#@FcrhLGd[T9XjApG)IRkldZGhZJ5-RYrVI*)HP'-lr3A8KTMck#[J2AZG[`VV
Jha3@r)a[((G3NfNVUYR5CUc-9'i"NmFYABR*P@C*M$5iH4*6"eEDLVfl+"l+"(8
@M14#qZ$f$FE-%Cr66QkRcbQN$fhIF,09`KM,jee+2Zp$4fakRpHZ&p+X)mlfR0d
"PD(-NB(YG[A4!D[DjheP`1FGh"ibp'lGS''H'jf"FrF4Q`L4&ES+2A+LQ%dj*8l
JqAe2P46cqDAU"Zq2[3hH*IV!V%Q9RJD[$Y[IcD0hlLbM[MffBNarf[!E,'IqV1S
aElL)9fHGF2%%2`0UDi(dPMEbbl2c%Kck4I2iE0i!RV[80kDaL&r1U`2Q5CH@"Lr
[j0%0QdI,$*Mbr0mIb&Vl[VlL6mAA(hfaa#pj@9j6KDPc$R)3I@Chp&h`$&mbSC-
1!RXIf22!RJ6fYm!H!,BEf0m"Hh*LCMEaT63VNSGE8@5Q-%`Tk#5JFa%k+H!Y`!-
bRJ6HK'V%dHZYf,SBN!$R'c'C1LBRd`93$,0Ui1jQlR&I`LU#Zje9!2GEQ52F,Ia
k)@hM(PmfejF`2MlEaQ@pYK(Kfraah#la*h*F5bXCXX8fMUr1HS@dXLKKFl&i-D,
KRHjGikbVar'Y9la$l2RB6pmR,LdS'+0CVLaC,H`"dT@r%Z!F2cScr3P3LVMhU0$
RDQ6lXmIBIJ6h2FZaT-(pd#Tr(GX$[`!BEfIS4+1rNEepHBe0*1LCXfaR!QFkYKh
"[C!!E89`RpfiTTEKYhU%C9l5FSYb1eVZ[NShdqFHU(5[B[`[Xmd%lNp8ZZr%``V
Z`-Sk2q2e,eY9c6DeamCH2MPq""hf),AJ0Z`'mAk4BHU,`2"fN@(D$$6B3eKJHLe
ijh+BEJhfCmrNX"X@BR0iMP35pJI3b"!RLM2TKUm#`jj4mR%B@%X1Qrhh`&k8X3q
"I82'4(M5h,f&[F[64H#l[1e2f"XKA3FdhPMh,0f#,XX(PR*-SARJ23cXC6*+rTj
($GBeQHQ,U+Ad,JkXA`G[(hJpP*%d'S#PC1a"B'rNDPDX"RC'a[6!hT)eeX&I3XE
f-%rDMYpUEQfrmLafmJQYmYTfr+%XjmL[Mpm65YCl'2rr!!d!#'GMG'9cG#kjZ@0
38%-ZZ3#3%%0D!*!3(m-!!%+&!*!%rj!%8&*25NY"5%`"!+QdiJLV-$9B!!"5l3#
3"K+K!*!%$I3!N!Me"!i!pCQCc1abX2*Ef-,&mj8EA@KjV4fRQfkf--,fZP@[Eld
Z$dq2VmN'A5Bp-hbAY9lHAJFXfQdl+AG,Z2)ME*&GEJRrA-libQIDl@-,fic`*fc
6K5HKhAEKE`YIq-)mEQiRK(pXXmb@iapGq-+kKCfFELT3q1c,IZ&ZXPf1@pl#b%)
ffjdZC,)F@FK#&m,)B+r,!D4[CPq-FBbaqZ@-eH&@A,@%-I9,M(@V+THFE3i'I@,
PFV%p`R[E)f,)lA5*'SmV)SBMaKm`"H(DkkSAQQdeb1%*lP8%I"Kcj(3rX&H6m0M
IZTkaqjrj`UCT$PZ9X*!!V`m&fSamV5GNj#ReR!CAb"Z-H0XpDBqF`ePa(%eGaiT
)S-2EcP+HcTr1B+bXmm9Kh'q$6Mf`X[$"KF4R$RhYV2*CXk3m49H%V`fdL)`T"cl
J+-2j13Fpcq@-E8&E8'&IE%H%!Ne3,pZF#1HDf2Hf""Q,&l1('*Yr8%EphJ1GXSF
r%JrNr)3rGBV*(aq@mf,a)FC8Kq$ER2+`6KCr)B9h0"r'+0,%0Xm[rQdqSqFB2cQ
eBU69f4*S4krcbhc8LClZG$iIR'*cIAh0I"abUXM3iXkAEq$(ilQ,49r!j3f+,H)
maNhp56c112ejNK@"P6JkPXIB&fjK8aKcR!drZX6iG+jqq&li[TdQiqM4U(!CR@&
rGU+(,&FBA8QAdZJ+kKT@q*eSAPdm1Mm9!Sj'C"RE!a%aQhqm(IAaK-)B'-FE!ha
jS(fj'%,(Uc#'FK,*f-@9@FC3113DEaI$J@M)*3)Pk"9$i'!+Qm`pccf[0,(*#J2
h%ZcNS8*JE#k(6ij38,[0q$[cVaRB"FIjhRDA,pSLmUCDTmXQ1P[%8(M@V%X))mK
*81HhL'j[ZmK(3P'46jb,ab@$h%jI@)iU6J@&a*8bd!J5%NZ'TC%NDKY",5%K9lA
%%1kQ%f8Z9IE(4kQ5X*9Mq!UPK%dirih2+53-k[E(m!QELQ!-Rl#ccq$6B)6Z-I`
FQ(52iC0Hd6f'2a&QlKPm`YDG`5GX%V)aI-*'%r+rq)3prJ`qB9260)C2f"21i"-
feI!B2QRI@@I`#A[5'Ic*-1NH`dIV+GeMrFY8Q(52j8mG(mdXar#TGUKe(X1R`pq
T1G'EYSlfTT4IFZ446jL-RfpLA2G!eYX*@kf3!1dTXPdLfkfbh5AE'fAlbB5G8j'
`4rJkCZFXKT(SUhpj-0jKc0+KVIl1dd)2DmAG-GY8*93X&AUb"HYJr,'#0E!H,EJ
1NCe#Mr)KS8HMKZmGh)rJ,V"iE"haZ#h!9,BPYJl''HE&0`Sp@9F+$qSClfFqB9h
h3F6FlY%JbNC43[653pSVJdcS86hQ89H[mbKL98+8Rk[YF1I00PeH*e3+2HTqAYH
N,LMMCc%HqGX+1SASE&1&f@&'l%0mMD%M4m1VBND`e)EiiS,VCTXD(2B'40m'rl5
#08#c9pE!hmAAm#U26ZK4E&E48%VR2LJ-CTF+Lq-[Q!rPj"[UJRc-'14f6EKm3Rq
[HC!!63aQaBb,eS*44IHY`T9#9"TN-1YJpRX&fl4AmahDMZpMp-1B4i1Br38Ef*5
LZGT1Yf,T@L'kG+hYpILK5iVBA1+i5A[CfL*0plhmp&KCF6DUCir(CadF[VkJLmr
hl$189GrN0XCQaUTQQmSPVV*HpY33GT)apN++X4le+M"i0Epbf"EcSZR0GUYL,E'
CL0P[#,$5,pp39-AQe,`b2HjB@cfAZmLMk)i,dH$ilTe,er+S69fpF0LG9mb$!l[
R31a#i(BDla#LU"ri@"l9MH5GKNUFPjh[CUb%le$F&p6Y@VGPQf+Mf`$HhiaG`0F
EE!CpNpCmJ'NLh(AkA6XZh4NrZ+jVe`eZK4!eX*L4F(JZ0X03ArHcH#pICpR!*Pl
XK4j0L8ffh'rc-KeIere1L4i-[$eMkE2E5r8'IIXP(S2Gl*Q)Zf#a'@X,Qq&K$)b
8&-E"[@,S'A[+pp5)VrqCMI&KiNfa[Q3Qde9lQGE01baYqAD,Zb2SkYi*qa$K!H(
QrQk@*rZq5ckG*6lNDIDh!N0&FHA[kK@2A1Tq5ZHFEh)rKLLeYSe0M3qAR,I8E&J
jY+[rT[A9)lQhp[p4)R[CAjVd`eG)q5Ap59[1Ed$+lfq3!*Xb2P4bhK@8@k6rTRj
JV+rq[$NqA2U`m"9NK3VKAUem9mqHIDj8lbP"PFc`j0R0lNQ*I,N$6AVCdp18*hY
f0%'EZEh)H$fUN6,B3ica+pmIjZHp2ebp!DT9@&,)#Mf''B9-IjQPr#f@rm`"TRV
fXT+Kq5E,f4-2X#q@$(82A'Tf[iND,j2dTmcpQ*4$$h,S#F8M6-VMR%F+f4IGNqB
J'pZ22,VGhpLkJDP%PD'3!+P'N!"h!rF@[MkB[ljcr`h&frIIb#bGV(J(mUN2X4*
pX9j4GNhmp4Y3'hcTK+D*KTP-YEkVC$Za8E*$BZ+*q*Y0FrMmf#+ql$LLcLXFCJU
2[K5SU)%*YQ!q)e6KX1%9i!l`mjL@,h-VR'U"@M4@E)Vpm1i&"NfaDF-GpbrBfZ9
43qpR0r'kZ8c&&BRN0640K&FKHr90+PMRPJr'GaLkK'MXKd,di#&8q%UQd23bTI"
9"Y@$aT[+kbSUjl2Z'0pB$phR08+dF1AJHN20YhDrGZhcfjrC,IPAlKKLCBC5[4k
q9Idh5c&Z18Dc[QH`6BT`b"(jr6f$$LR#)NHSe0H#a(a5Q2KG+Ee$aFHh0DPJl5(
93@8ePZK,p9Z@,YNC(kbfH)D&!Aj)MVPY*'C3MV'dDpHCrHTGCHB"TLM1TeLdU%9
-9@4Q+N-4da3eSVGlhF4QX!,1CRRd4iAX3Xj@qF4Il+k`@5b@hZfl9Y@m`Nb'kFM
m(e%[4TI(rJ6aDdl'AmecRb,-rM4HPmkJZV0Y@[@eEEU+cSTV%FR$LPDJFf96T)J
SBV95T"T4851Qcr(ieNkAfS!@ABKZ@GfXkpaZ+bYKPM*EQ4$GZVVj(+2NSbLEp4*
QXhjcHh'fc9U5,85T)[CflEd"+)FkYrHZ,P(Zk$8UEGDRHfh@rY@LC[fUCKAPh&$
@Y1rVM$T#D)9kIMCdBMTe139Pm1GfheX`RFmY90UY2l2DVI1bQkD-SR6CVHVV',Y
QH0(D)YCpAr&dG(pClTG)CrkkmRDVHaU[M*8KLl[iXi"f16cV#a[iKE'C33leSVV
cA&k$1%ZK,B8aKer)+j[dSeNDl&DqM%FeA$0FT%'A9r0mEmcBIIHPIa9riGZ2&Y4
)Z5bXVN6AH6jd%(9@BZSH+"mmR)p+fJ,I1r!p$0mpm2dGI$I#GaYmI`rI25-pFcj
Ib+CiY,#QH5B*Jb`#R#"`$J)R!Rm,r%fb2`5r!f`%81ZYQ*CVS1I,dCQD4M[6f8"
d%aZ`,C3pl(R%#1`5BJ$fKC34E!2I+%5,Z6XAc,!&GAHH@mc&V-9$`JriRE!1mdm
QBJfY6"1EAXca96'V%%d15UJ[MKrdU2JbblTde+I(r2fRV)GU*0F[GKFZ'6FZ&@C
!@&e$S`1V*BfZ3,[Ekc'f'QM#1TGaI6mfFAd[dRd&lTYa2mhe[DcQqPkGarAYVFD
pRq[EGj!!kh[Gb2@pdFVerHebVZqYjlLqJ6bZladIehI`(Ul[(a4Fhf(J[@rMqRk
qJHZ,jh2ph!,FAqIkPGrNqY@YA,rQDG`$A2piD5R$)dE#I+49a0+%1a6`miQp3Qa
bq2hBFJaMcC%A-H[Lh9kI1084#2JDa"!f3ALEk![b$C%30K$$+Rp)$+Z#lAk4M'@
U"BZ%FY95Keh3%Y-m5!m&aNNZUbm3$MY$+e3GhSKrHRQY-ib9%UaRb2XM&r&Bb[Q
$#1m2Y(MG+riPr[FUR"'4$dHFrL$[$S4iX30Jl8iIhq)0r5khhm926M)p@LJ6T9)
i'P,4l,[)jI1kP[&L+-6l`aiMMHaaP!k@(kR(!$5jIF64)2HV9c"fkm2Bb8M[NA,
5*ahe$KKB9T9'TSPBKI4**`H4UR2Kk*+M&9J[`FHC*Q&NUD#pVUA83F[45Jadk'0
F3Yf1$dpTM65,Hfl&AGM3!#1U'a&eQabGKF82I&eA%c-D$%HjjT%"U4TMFAb*[&A
h)@)HETXFRBf&$h`V0NVHj1U3!,`K#cY(qL511H*j`3MI14L%iN0H')LU%pY@kEb
e@+I!ap@!&jDr$K6[395bNR+a,%&ISM6!LST@Uj*V5MUX3Y#A)"$4+kM@NKY`il$
S30pF$R`T#q@S*(BHeKMSieHp#Flf)`,0AQTaDcb@&2)PHQQ)5fb5Xdb1cXF+!Vj
N8DB2,Ic5f4Kjid'T!M!XRlE0,$48%8&NcjVeLhiPLG[pfVbedR#BF'qX0CFl+(-
SP#2N$)DCki1*FLTMEYAMF%qMfLlECUkT+5IZR$kIUlACYmcS)YhC12(&iZ3YB9'
@5Q5*+ZHdkID)X$BCAmp+hXKTKT6AHm#U3r4C*hSQB(BrU*ZE[*&EJ[hH"NF&f1H
b`j%@Ei"`&+-i5TRYhSDUbbZ*lE"hTGJB!9#%@0JA5pj3Yh-5l&V,'fQFRq0a03C
$hZ956TYb(mp1hP#k+8NN)bQBbZ-#L*FT4c0ATc*h9&5!)3dB`XSCTF08SdMC5D3
Pj6BcCAk9Up8CNNK#jN9IDNVH8!QCSr)k39+0G(N`aFD&eSVN$99-XdNF%CZY,D(
`"a@L69D5SkS@&F+T)ekr#"MM-CcF0*pfUMM`5Hd-*A450pjlk`mPT8VU"Y9h0R3
Mi#,4b)#J'D-9V[Mh#PIqZX**-8jAH0BrUp"aT*4UR0)#8Sh6@T!!8Se6@T!!maX
Yd(kN"FGd1[HIG2TA[3DH,8Mf'TBDXp4V02ZFVQ8q2,U3!#'KemM%T"XRp@#KVcU
Y"q@f5Y+$A#aMZCD&Srj`4S3qiL3hckljPY445pa8@+b09#FYcCj'[bpc@BGcr'Q
!%69iq@)m[C*8URU(RG4!'ib%'PfYVS`*8j,-6"h[aReIXbG[D8k5c,e@cYh[$#h
lT)pilFFr65[(JLU"+N',p`QF2Y40KM[Pq2-plHN1e&CT4R@a((P61@0C"rU4'Q`
blVmMh8FNDTaTr9MRD@`4JjR-qSM6-pGM1,T84T8160L3!*%BDI-(2jh'hIh8YR5
r8BZ42Y@"2cR5GhfQ,m$+0,B(FZ(*qFCchdR[JG5Dl3[K98[0EFBhc6Jf!k'Hj$p
R)(rUIIG)ebZT#lVHd,,'8%3DJQ5UfdlEP"@LKiU5A8P9!ff@U2hH-(@biF`FQ[(
KV+6++NJeiI9JS(a#A@K@FPTGe,p@Pj4QR&)AdSc6kT,5M&2U3T15dqU5QT4mULl
T5FPrl#eaeipXJ`L95k4YN!"fmDV'M(FlXp`hrMJpBDZc9%XlCB(Q0M6#dJJhdpT
%2bZdFd30'KTT[d-6#2rA22prCQFCZHEjar[pNj2C69PYp)K@DM)V+8'fT!3C%RU
0$!Sc%%F&0K8NII&jQb@NScQPp1@%DKc0DD4,rDbV-ccd@PV(lCAPY$H4%a*G2UI
ARl'MdM)(c3+5MpDF8)f1Rr4*kNc)faB*9I4DMcVDlZfJPej1UXfAEck8RMde1"C
Ci0@')p(QjN#S(A*Mr%a[J*8"E)T3G!%pL5YhHBl+"RVj4bhpa)5,Y@G#d)*M[FH
rp@3IGap(N9*kF+TlbrUSQrlA5IIaD[aidXeYj&CVNMH83&CM+!&9RaC+%&Q"[`%
!PM5C'9(,)ph(*fUTr9!YMqT9DV2iP&iGfErj4+r'r8D[mMkHFibb02iMPNjf1PA
[d("$VLh(CI8d(p1LX&VN*cJbP(8k[pfF2kE#ZPqTX(51-%LC%ZXU[a22)[*i8[E
rZJ[cIcUGL4G#pHMBk,e2kCF0VX,2PP#E5Iik[#T1$qmHrqXJc[6'Fa2`XLUETTM
$*YV-$D3cYp12%m#qEb(qhJ$feL8eGE5PqJMF0!YqXU&'QZAY39+9b(8[r8`"-MX
Ah$6![T!!ITF!pTb'bfV*EbNA&PMaKL[H#UA+i@kTX"!qGeH&C3R&EkCI&X"$k6d
9PN9@f#m[VUY"R%+aB%N90%@4PhahPUZj([c3IkY-$A%eUr''+[Q8"m(LQS3[kcE
1G+!PiF[1j8b6mBiYqG4I![EZK'rFji"Ab"55leDmdYV+9*,[$[MHa&2kj,XIH(K
90KkIa-Ep'I$!Tj5(&h&2b4cN`,G2pSf$$kqZ5Vi*m(hh+pHLCV(B#pqMEAp*2`L
K$S-ce482X[1!F4&mDd`jE#EL`-(e-DD6q,X(FCd12IXm1+#IdU#-2SFi1q)HB*d
54KI`ANVie'C`8jVJFZTNa%85A%ip'ebqP1"bkZr$jj-acJ0'8-Di!,i@'@-Q-2E
*q68KTiMXZ`ja[9RqCFj@hp%rG"RpQjINMlqNrpQ&-qA@"ki53rAP&2rr!!!0$3p
YGbpRBh4PFh3Z0MK,,VN!N""453#3%#pd!!"+8`#3"2q3"%e08&*0680$!3#V,jH
ZUc!jB!!!"M%!!"R%!!!"V3!!"E(*MaZS!*!'[VXM4!iL+Pj0j%)PIdhl9fbRBC!
!DR1(JAFp3hUJ2KNcZ@(k&LeHlIYc*cMM1X2GRCf"!*`N(81C&iAQNTm4&Ifii1"
EpGII4h6#PiP+'R-jb[e$&IeM12rA3hh-XBk+D2XK9#@U!P9e!@eRU22XRT!!%ar
%6jaP3[FjFKhiIjQ@hidE$&25cAm$`-IrIXai*1U*jZd88q%pXX1%F$M`RNJbAQS
ih%%N0J*@A""6p[pE#%1,cL9X%K8j[Z%i38$F)*'R%8!QpTQQT&06TCMf4amme9+
jii[1iC(HE43E%aa#QlrCjZ4[GSL(8*!!e8D-E"#r6LR@&GN3aF6F'028K*cdTGk
aT$fkUhhK6F,P(Tj11!CFTLJ+QQSXDINp,M$RL-+Cm9q6j"VK+Hr'rhrjXB16b1@
iec&AC&Z,)bAP)A[QZNkT`brFF9bj0@L(b*(4H3)$i*YCbh9`YK90aj%$0a!Gm&!
,de[B3!XlC'%$"-Eme,D0'(Z229-8DlB`9Q$FC!Y6@9L'KA%@PQm[")V0YM#PKBP
$[mI#m!L#i#MfjAH50i4eE512Q3bj@@90I4m!N!--!'XcXfpJlh2Ij$4lRaZHF-P
a`Tr-D)4&@%FjIAiV9hi5rZ3i@3NqRhV5`hI'm8m[3MNjENHi%AjN`!NMR"`rbB$
bTrc)FA,m$%r*F51Fm*03FTa`FTa`-Q#%%hlN'4R`Pa`RA(+FF+mMamRa)mq2m$2
#bB!#GjN8B'@Y6-+0iUpN*rl)-F)*2m)*8[#%!j-9H"9SN!!()1QkKK#+`Hm@K$S
HJ&m,rN[#E`hmIJLEJ,q0bk)PQTCS@&q4J@q@4d"9U,FU)md-(0Yrf-'kLSC3Ech
QTZ6PDfM!,6kXTJh48"8c3%-B$Af2ZR8CG9Ip2$-35k-p#&9[4Zd)$4`EE%%G46!
,R0"9-23T99CN34j4,-#2%@HJ4P(6T'aDQa#N[iMDX5G2a3J5j8hqU`G8AI)J-HU
[2pc+8DXTel3Q5K1DDDe`rC'MeMLS#5QV5"2QC-jFKV@(Y,XiDUf$'TI6Q941+fY
NIrEXmabeMLSdTZC&6Ae8m48krm8h(,@HFXdUSU`BRMk!q[lRHBlD3,RQ4#QENT@
#"cXRI2X+4ie6jif)dMfM+mkEUadrc9%E(G5'h+TKlGFqRHHS#3He,LFDrPe`h($
QCBlDa(3e*P+'jG["RP9riDM0,PI9V"`8d09SikJYP'YH1C5kHVfHlZ'SDkKIpI4
i+LIkaJ28)bpbe,88e9!N694cCG6ZNqFjkMUUN!"T6DE6ZT(h&AViKGmikRVU"NX
TAdR(H9q1FY4@bY@D,XL9SfF2rY6286HiPp,*+'9G,aJIFG50p#Uce14Gj3Y'd81
Ek"h5cFV&)blrQ+1f8B8b8UTJU&0#eN-9cVh+8GXGe*U-j!-kU)P6p4b9*UB'dj*
PCDb-E#IIrF$K4qBkCkfIRK)eFi@ZrFEXr4ae-h@$T1I(e%`C&K,!AUi3T&L#1U`
I'P&bCG3h(rRp#Fje+d8&50fBrKHeFp&j@4Q5M3GV$pea1eGSfk+(0$9pa80R1GF
ZCkfce*a5FDbGI1mKMRSpifUSq482fFRj!BlD6Id+#UPkaDr(MfcMU0YGVSSeRLY
8Z0V[F05H43q4)19lk0aM"lL(GMKViS"LkT1'T(MH+rPeTkZ3!*U"!([&H8FjkLl
+0@RS306mKfX[64ZJ+`31D"5@fGUaCaUiVRd8Y@!C+5NVP42Ef6h&a0E[S,D5e*Z
k$e*4k[,4R"1qUq@S0cKV-k$Hk86c@fiEqT2V*rYSlLHcfePEppip1YM9Hl2Del9
2!&`"@TQ,U#F1&[Z''jdelZ4b1(ZHmdimH"0(45eR)(&!*q9f)f6q6PCX0VTUBad
IAd$pf!@`[ik1Br'KUlR)+fakrN"cHF(H36)2h%jb&H(+NrX0&jMF9VMIj$*$&L)
T"p)0cLf`Yq1%"AXR6JQ`Yq'FKMf0GB,GdbRXPYLiZ+lq4#IBL8k`%jeJ*cV"6R5
#RHJ%1p%*GU)6l%3Rf)P1h%qc#+[@Y15RS-eL8qhT&"fJcd&k4dVkK,dC'pb'AVi
MRZjKXmB'HccD3(IrcJ8G(KYmfk)&p1R"5Hkrqa'fKQc`$Bdfm0&Ek'dF5*Cm&25
6E"T+qQc(16M5i"iI4FpKHCCb3p#-XSR6I3[1YF$(e@dVrAm(hAhGA,f#1a4fVQ`
D)a0bM1IcX19PNiJXd-QrQrjp$rTP0Nh4$ljDEE6C0*GdfSPEQNJ$[AaI"9dkQjE
)"&rjZ5PSlpQXL6c)65I42'&jkHi((6HE659pGY(F%GhJrk#CBp-AQC!!QcfG`RF
BE0C'2GbTm18(Qh@4"hI+cbI"'a-fkb-2I05,Qq*VI86`ZS90Dq6"IEUNPpZrZ6d
IkmP@hp@`f9$5UmK,"LjZ2dGjKIdd'pTRSrf,Re6[[[HdcbYXX0R3aK[KcVI)#mr
A-dm"R8jJFcLjAc2T0r!1Xr%Ph(NRKdhm"Y1PM9qd9#9(PFc#![X)[SNKr!e@jAm
!N!-0$3pYGbpRBh4PFh3Z8&"$,VN!N"!4c!#3%%+&!*!)rj!%68e38Ne33d-"!+X
[PkkV-$P&!!!'-3!!'Z!!!!'T!!!&bE5F%03!N!B"fL0%$L)UANhN3L9r6IYAE+G
KN!"UFiH"Gce$HU!q'61jBIV#iB$[cjhJM1X-GhH'!`%ib6Q'-Lm+c58r)bVkFF(
"YqU[[irS4$#9MENFjIkKL[iaR2rVS6lQ@%G&Y2d3UK*9JDUkJ,Bce(Pf6fJm&6R
b2Z8HRJiXa'A+ir""h#2TreqK*11PKX-G4'@dI[MrP@fl(cXiL9b1Haec4BbeKmP
aeJj"iNA$iL1d#Y1J+HR89#QQrG%86l98l[LLFhLNlhad)NaL2JK&0pZFr-d1m4!
+XYS)fcSm[diTeKAC%-A8h"M6e)5Fp+AHXD3p1ZNm1FY%rabj$[`E!$0bi`E$P26
rG@!p"$aQr-JXH*CjLX,-Um9UPGj1-5VH)fY@`*(4VHaDSf,&r6CPrlq&--R1K6X
*#r!9a`Q#"HZ@0$hdcLR&Z$Fm-LN%a%6I)NG'j`NF&EkCY9`(CaX9iFL4(fpK!IC
B8#c-*P,XP1dG-@D4KE%@0XR#9"C'PcdhhF,ZXE"3#eYVB3-&a[CDHNU"FB-@YXI
#PPJD!bcX5f0T(aH0)DaV'hR-C-M0+Q[Uq``!Da0l'f3fmMSr"jhCCQZ%N3NRNdf
14LJRP"rPR[a@3Sqr%8D1NjAJmk5Hp2#G-Ic6Le"1MJm)Pachb(2###I(6c*J%8k
j%8k1RiHRj,J46[K*+$P11$P11"P3`JNrmS`-q)!-Z'6!D6eKj2L4C`f-F$+J`(8
Q"D$m9QE4e,T1r"&qK,q%%k6J#3FQ+c!qS%%HJ+LU#N)S",rE%'S`i2Fjq"D$ha,
iI4qf+2P[K53BJQi)Q['&0I#IjBQL)Y4CP"42pjcUHm,'ZSf'8'HBF--Ck@qdLS0
b3K-d'HXH'L*+S#ZS9C93Dp(hThY##E32SH*'Y!@KRP2p0@MV!TJ"6QM*DZUi,'%
T+JeJ!r"$PM03TD!SBLUKM%E&Qd60d0-c)3Z*mVDqK3&9&I13!!6eTfr[iUM&P'Y
#%F4446G@Z(l(88YXe)LB`Z+S2TE@Pf(0!mTp(,A84Uf3!",*H&STD'4qmZcc(,@
-+M3XC`4&IJbl#Phql%Z1'UCF8eL3!,#@e`G3hrdd`e(,+GHd)+EL%XlQBDHLAlh
-85ZSm`B%mB'K&HG0PBjFj+L90QTjHXf`jUXI6h28L)eDPKBdpblBE[Mm*BjDaA6
94Z1DiGV"R*4rj+M9$PGCAcdSS+ZfQD2@8+iCI$4qqhSpdmj4DkPIeF4)2#fiaJ2
8Bbpbe(889F1L)XMT!QVVKFXFYBiUT"YMLB5UC9b&(RhKCikkRVV"`)8VDEQKZf-
V4kfRA)f*V,4kp-cqUedFGB0c+Hf-8Y$eQ[B"4pe)Vc*,6IQVI%eEm0!QHSG8IIA
L@5lrN!#MEUCQhhrr8(p,Ec3@kie#4,V"pIbK)a`9-T!!GBlk-`E@KJ84,f%LG'i
f[T!!!'KLUKNie$XiPM(N0&lQH[KU'dGYS"j+L['X*Sp(8hPGSl0R1'UMM9U5&&e
!'c8b%qDSN!"L,3rTKL6Ki3+b'A[l2CZI0G[Y06`a,LMk#PhcpFQ(1'S6pDZSCSE
PC!&fUR[r&Uj3-eASS(Td!+F,U1H1r2)8jpT#83&5e5EZS1kBGej+JZb9Kc82h(-
h9kKehN1+R,MPS8ZFDjZpPPPABF@aCZbG`abeRA(9j-b+KmcBG!p(lD"q"B9NGG@
[CimeFp5G$PGXM+5cUec0YcMUVRN2@9(2pG$Xii2F3jhf'KR%ZMUQL6M[[CaIGcX
+b8Q)f,HFGj+MGP'Z-8d&S[SrA2I32!5k3L5#cQ1CV4NkAXjer4pehS"JT*BMJmh
eq+jHMVUAFXdD@Pa-LB8NHQRI3K)PI3p-0D6jHqhb!-,0lkJIrAq#kpTYIkZh1S$
iJj!!%H0,"hSUqR8TjiTU6d$LH!3qd"l'QVp5(*Z0MQj%N5IR8$IK#2YVk#b4%AU
KAhRjVG*[D*cA0T*HB1mJp`hf9R+*B@mR9a,f0R*MBGp1mJVX655"`0j)XK,X1mL
pKlf"*+irG2*l,$B1E[#"6T2S$,#X@[56ejba+FlV&"bJcm2dMZ6dm6Xk0U4jAES
MHGhp&Sp0DH#"lZkGmrT#0Q@"!rVX)TRXhr[K0j4X`S%(2RS$[3RXDKCpj(@KE-T
cqZ`NL6E3i"kI4160319LE["D@$B9G'mQ#4Ai1,Ued1qGG(GeFr6blT!!hqqbU3a
-b$&jRrZ0-TY)B)&1lYedll[ACE1T#Rl`e9TlcUBkTp0ZdVF%-H4Z[lGR8a1Bi#X
h0hN["GM8"KlNTJYSfQ*jrHjlI6UE66PpZQMZ#'l`[pH@XGNEQ*!!Qr-kq@mqf+`
,HVK6rLX60R@""hI+c5IHHaBfk`-2I,5(G,jrpK(H5aSfpB%(pqQkANlrj[4mV#G
EHm2$CN01V`9H%R"aqMR+bhpj`iDqe%&p8bAIR!qTj%[4$kpFY(MK'lcmYcPXk&Z
H1lcmlTi0lIT[mPVbJIFUL!elGjRM4BM8c8"+#$@"@kr%qK5GrJGH8d5JeDSp%6Z
S`aY94TZmpLQ+$H(Nh"cl%r`RK-KrL#Vr!3#3!aq$!!!"!*!$!43!N!-8!*!$-Tr
lRLe!rr#`!,K[$#eZd!6rm2rdd"lm`FAKdkSV8FY+$deKBe"bEfTPBh4c,R0TG!)
!N!06594%8dP8)3#3"P0*9%46593K!*!BUc!jI3!!8M8!!!&'"1"2l'mDG@6JrHc
K@5U#NI*HN@GK!Z"2kQ`FG&2UN!"S!!,L@5[48(adA`CdC!EJ6qj[8hJS!!EJEHl
LEe5!)D$!FJC1ANl!*IrX51FI-#D`jL63G!*&0K!+1Li!&Ri!)VX-S"lbUKQJ(Z`
3!+SDI!$!#3ZT8,aIE!!!Q$!'8!6"aG!!N!-3!#X!"3%B!J#3"`-!N!-"!*!$!43
!N!-8!*!$-J$j(l!@#J#3!a`!-J!!8f9dC`#3!`S!!2rr!*!&q@G%'@B:

View File

@ -1,91 +0,0 @@
/*
MacOS_Test_config.h
Configuration flags for Macintosh development systems.
Test version.
<Revision History>
11/16/95 pcb Updated compilation flags to reflect latest 4.6 Makefile.
by Patrick C. Beard.
*/
/* Boehm, November 17, 1995 12:05 pm PST */
#ifdef __MWERKS__
// for CodeWarrior Pro with Metrowerks Standard Library (MSL).
// #define MSL_USE_PRECOMPILED_HEADERS 0
#include <ansi_prefix.mac.h>
#ifndef __STDC__
#define __STDC__ 0
#endif
#endif
// these are defined again in gc_priv.h.
#undef TRUE
#undef FALSE
#define ALL_INTERIOR_POINTERS // follows interior pointers.
//#define SILENT // want collection messages.
//#define DONT_ADD_BYTE_AT_END // no padding.
//#define SMALL_CONFIG // whether to a smaller heap.
#define NO_SIGNALS // signals aren't real on the Macintosh.
#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
// CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT
//
//LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
// -DREDIRECT_MALLOC=GC_malloc_uncollectable \
// -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
// Flags for building libgc.a -- the last two are required.
//
// Setjmp_test may yield overly optimistic results when compiled
// without optimization.
// -DSILENT disables statistics printing, and improves performance.
// -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
// altered stubborn objects, at substantial performance cost.
// Use only for incremental collector debugging.
// -DFIND_LEAK causes the collector to assume that all inaccessible
// objects should have been explicitly deallocated, and reports exceptions.
// Finalization and the test program are not usable in this mode.
// -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
// (Clients should also define SOLARIS_THREADS and then include
// gc.h before performing thr_ or GC_ operations.)
// This is broken on nonSPARC machines.
// -DALL_INTERIOR_POINTERS allows all pointers to the interior
// of objects to be recognized. (See gc_priv.h for consequences.)
// -DSMALL_CONFIG tries to tune the collector for small heap sizes,
// usually causing it to use less space in such situations.
// Incremental collection no longer works in this case.
// -DLARGE_CONFIG tunes the collector for unusually large heaps.
// Necessary for heaps larger than about 500 MB on most machines.
// Recommended for heaps larger than about 64 MB.
// -DDONT_ADD_BYTE_AT_END is meaningful only with
// -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
// causes all objects to be padded so that pointers just past the end of
// an object can be recognized. This can be expensive. (The padding
// is normally more than one byte due to alignment constraints.)
// -DDONT_ADD_BYTE_AT_END disables the padding.
// -DNO_SIGNALS does not disable signals during critical parts of
// the GC process. This is no less correct than many malloc
// implementations, and it sometimes has a significant performance
// impact. However, it is dangerous for many not-quite-ANSI C
// programs that call things like printf in asynchronous signal handlers.
// -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
// new syntax "operator new[]" for allocating and deleting arrays.
// See gc_cpp.h for details. No effect on the C part of the collector.
// This is defined implicitly in a few environments.
// -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
// as aliases for X, GC_realloc, and GC_free, respectively.
// Calloc is redefined in terms of the new malloc. X should
// be either GC_malloc or GC_malloc_uncollectable.
// The former is occasionally useful for working around leaks in code
// you don't want to (or can't) look at. It may not work for
// existing code, but it often does. Neither works on all platforms,
// since some ports use malloc or calloc to obtain system memory.
// (Probably works for UNIX, and win32.)
// -DNO_DEBUG removes GC_dump and the debugging routines it calls.
// Reduces code size slightly at the expense of debuggability.

View File

@ -1,89 +0,0 @@
/*
MacOS_config.h
Configuration flags for Macintosh development systems.
<Revision History>
11/16/95 pcb Updated compilation flags to reflect latest 4.6 Makefile.
by Patrick C. Beard.
*/
/* Boehm, November 17, 1995 12:10 pm PST */
#ifdef __MWERKS__
// for CodeWarrior Pro with Metrowerks Standard Library (MSL).
// #define MSL_USE_PRECOMPILED_HEADERS 0
#include <ansi_prefix.mac.h>
#ifndef __STDC__
#define __STDC__ 0
#endif
#endif /* __MWERKS__ */
// these are defined again in gc_priv.h.
#undef TRUE
#undef FALSE
#define ALL_INTERIOR_POINTERS // follows interior pointers.
#define SILENT // no collection messages.
//#define DONT_ADD_BYTE_AT_END // no padding.
//#define SMALL_CONFIG // whether to use a smaller heap.
#define NO_SIGNALS // signals aren't real on the Macintosh.
#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
// CFLAGS= -O -DNO_SIGNALS -DSILENT -DALL_INTERIOR_POINTERS
//
//LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
// -DREDIRECT_MALLOC=GC_malloc_uncollectable \
// -DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
// Flags for building libgc.a -- the last two are required.
//
// Setjmp_test may yield overly optimistic results when compiled
// without optimization.
// -DSILENT disables statistics printing, and improves performance.
// -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
// altered stubborn objects, at substantial performance cost.
// Use only for incremental collector debugging.
// -DFIND_LEAK causes the collector to assume that all inaccessible
// objects should have been explicitly deallocated, and reports exceptions.
// Finalization and the test program are not usable in this mode.
// -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
// (Clients should also define SOLARIS_THREADS and then include
// gc.h before performing thr_ or GC_ operations.)
// This is broken on nonSPARC machines.
// -DALL_INTERIOR_POINTERS allows all pointers to the interior
// of objects to be recognized. (See gc_priv.h for consequences.)
// -DSMALL_CONFIG tries to tune the collector for small heap sizes,
// usually causing it to use less space in such situations.
// Incremental collection no longer works in this case.
// -DLARGE_CONFIG tunes the collector for unusually large heaps.
// Necessary for heaps larger than about 500 MB on most machines.
// Recommended for heaps larger than about 64 MB.
// -DDONT_ADD_BYTE_AT_END is meaningful only with
// -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
// causes all objects to be padded so that pointers just past the end of
// an object can be recognized. This can be expensive. (The padding
// is normally more than one byte due to alignment constraints.)
// -DDONT_ADD_BYTE_AT_END disables the padding.
// -DNO_SIGNALS does not disable signals during critical parts of
// the GC process. This is no less correct than many malloc
// implementations, and it sometimes has a significant performance
// impact. However, it is dangerous for many not-quite-ANSI C
// programs that call things like printf in asynchronous signal handlers.
// -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
// new syntax "operator new[]" for allocating and deleting arrays.
// See gc_cpp.h for details. No effect on the C part of the collector.
// This is defined implicitly in a few environments.
// -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
// as aliases for X, GC_realloc, and GC_free, respectively.
// Calloc is redefined in terms of the new malloc. X should
// be either GC_malloc or GC_malloc_uncollectable.
// The former is occasionally useful for working around leaks in code
// you don't want to (or can't) look at. It may not work for
// existing code, but it often does. Neither works on all platforms,
// since some ports use malloc or calloc to obtain system memory.
// (Probably works for UNIX, and win32.)
// -DNO_DEBUG removes GC_dump and the debugging routines it calls.
// Reduces code size slightly at the expense of debuggability.

View File

@ -1,9 +0,0 @@
/*
dataend.c
A hack to get the extent of global data for the Macintosh.
by Patrick C. Beard.
*/
long __dataend;

View File

@ -1,9 +0,0 @@
/*
datastart.c
A hack to get the extent of global data for the Macintosh.
by Patrick C. Beard.
*/
long __datastart;

View File

@ -1,107 +0,0 @@
#-----------------------------------------------------------------------------#
# Makefile.DLLs, version 0.4.
# Contributed by Fergus Henderson.
# This Makefile contains rules for creating DLLs on Windows using gnu-win32.
#-----------------------------------------------------------------------------#
# This rule creates a `.def' file, which lists the symbols that are exported
# from the DLL. We use `nm' to get a list of all the exported text (`T')
# symbols and data symbols -- including uninitialized data (`B'),
# initialized data (`D'), read-only data (`R'), and common blocks (`C').
%.def: %.a
echo EXPORTS > $@
nm $< | grep '^........ [BCDRT] _' | sed 's/[^_]*_//' >> $@
# We need to use macros to access global data:
# the user of the DLL must refer to `foo' as `(*__imp_foo)'.
# This rule creates a `_globals.h' file, which contains macros
# for doing this.
SYM_PREFIX = $(firstword $(SYM_PREFIX-$*) $*)
DLL_MACRO = $(SYM_PREFIX)_USE_DLL
IMP_MACRO = $(SYM_PREFIX)_IMP
GLOBAL_MACRO = $(SYM_PREFIX)_GLOBAL
%_globals.h: %.a
echo "/* automatically generated by Makefile.DLLs */" > $@
echo "#if defined(__GNUC__) && defined(_WIN32) \\" >> $@
echo " && defined($(DLL_MACRO))" >> $@
echo "# define $(IMP_MACRO)(name) __imp_##name" >> $@
echo "# define $(GLOBAL_MACRO)(name) (*$(IMP_MACRO)(name))" >> $@
echo "#else" >> $@
echo "# define $(GLOBAL_MACRO)(name) name" >> $@
echo "#endif" >> $@
echo "" >> $@
for sym in `nm $< | grep '^........ [BCDR] _' | sed 's/[^_]*_//'`; do \
echo "#define $$sym $(GLOBAL_MACRO)($$sym)" >> $@; \
done
# This rule creates the export object file (`foo.exp') which contains the
# jump table array; this export object file becomes part of the DLL.
# This rule also creates the import library (`foo_dll.a') which contains small
# stubs for all the functions exported by the DLL which jump to them via the
# jump table. Executables that will use the DLL must be linked against this
# stub library.
%.exp %_dll.a : %.def
dlltool $(DLLTOOLFLAGS) $(DLLTOOLFLAGS-$*) \
--def $< \
--dllname $*.dll \
--output-exp $*.exp \
--output-lib $*_dll.a
# The `sed' commands below are to convert DOS-style `C:\foo\bar'
# pathnames into Unix-style `//c/foo/bar' pathnames.
CYGWIN32_LIBS = $(shell echo \
-L`dirname \`gcc -print-file-name=libgcc.a | \
sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
-L`dirname \`gcc -print-file-name=libcygwin.a | \
sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
-L`dirname \`gcc -print-file-name=libkernel32.a | \
sed -e 's@^\\\\([A-Za-z]\\\\):@//\\\\1@g' -e 's@\\\\\\\\@/@g' \` ` \
-lgcc -lcygwin -lkernel32 -lgcc)
RELOCATABLE=yes
ifeq "$(strip $(RELOCATABLE))" "yes"
# to create relocatable DLLs, we need to do two passes
%.dll: %.exp %.a dll_fixup.o dll_init.o
$(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $*.base \
-e _dll_entry@12 dll_init.o \
dll_fixup.o $*.exp $*.a \
$(LDLIBS) $(LDLIBS-$*) \
$(CYGWIN32_LIBS)
$(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll --base-file $*.base -o $@ \
-e _dll_entry@12 dll_init.o \
dll_fixup.o $*.exp $*.a \
$(LDLIBS) $(LDLIBS-$*) \
$(CYGWIN32_LIBS)
rm -f $*.base
else
%.dll: %.exp %.a dll_fixup.o dll_init.o
$(LD) $(LDFLAGS) $(LDFLAGS-$*) --dll -o $@ \
-e _dll_entry@12 dll_init.o \
dll_fixup.o $*.exp $*.a \
$(LDLIBS) $(LDLIBS-$*) \
$(CYGWIN32_LIBS)
endif
# This black magic piece of assembler needs to be linked in in order to
# properly terminate the list of imported DLLs.
dll_fixup.s:
echo '.section .idata$$3' > dll_fixup.s
echo '.long 0,0,0,0, 0,0,0,0' >> dll_fixup.s
# This bit is necessary to provide an initialization function for the DLL.
dll_init.c:
echo '__attribute__((stdcall))' > dll_init.c
echo 'int dll_entry(int handle, int reason, void *ptr)' >> dll_init.c
echo '{return 1; }' >> dll_init.c
dont_throw_away: dll_fixup.o dll_init.o

View File

@ -1,130 +0,0 @@
## Process this file with automake to produce Makefile.in.
## FIXME: `make dist' in this directory will not currently work. Many
## files that should be in the distribution are not mentioned in this
## Makefile.am.
AUTOMAKE_OPTIONS = cygnus
# Multilib support variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
toolexecdir = $(exec_prefix)/$(target_alias)
toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
toolexeclib_LTLIBRARIES = $(target_all)
EXTRA_LTLIBRARIES = libgcjgc.la
libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c \
config.h dbg_mlc.c dyn_load.c finalize.c gc.h gc_alloc.h gc_cpp.h \
gc_hdrs.h gc_mark.h gc_priv.h gc_private.h gc_typed.h headers.c \
irix_threads.c linux_threads.c malloc.c mallocx.c mark.c mark_rts.c \
misc.c new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c \
quick_threads.c real_malloc.c reclaim.c solaris_pthreads.c \
solaris_threads.c solaris_threads.h stubborn.c typd_mlc.c version.h \
weakpointer.h
libgcjgc_la_LIBADD = @addobjs@
libgcjgc_la_DEPENDENCIES = @addobjs@
libgcjgc_la_LDFLAGS = -release $(VERSION) -rpath $(toolexeclibdir)
EXTRA_libgcjgc_la_SOURCES = alpha_mach_dep.s mips_sgi_mach_dep.s \
mips_ultrix_mach_dep.s rs6000_mach_dep.s sparc_mach_dep.s \
sparc_sunos4_mach_dep.s mach_dep.c ecos.cc
AM_CXXFLAGS = @BOEHM_GC_CFLAGS@
AM_CFLAGS = @BOEHM_GC_CFLAGS@
check_PROGRAMS = gctest
gctest_SOURCES = test.c
gctest_LDADD = ./libgcjgc.la
## FIXME: relies on internal code generated by automake.
all_objs = @addobjs@ $(libgcjgc_la_OBJECTS)
$(all_objs) : config.h gc_priv.h gc_hdrs.h gc.h gc_mark.h
## FIXME: we shouldn't have to do this, but automake forces us to.
.s.o:
$(LTCOMPILE) -x assembler-with-cpp -c $<
## We have our own definition of LTCOMPILE because we want to use our
## CFLAGS, not those passed in from the top level make.
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(MY_CFLAGS) $(BOEHM_GC_CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(MY_CFLAGS) $(LDFLAGS) -o $@
AM_CFLAGS = @BOEHM_GC_CFLAGS@
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
CONFIG_STATUS_DEPENDENCIES = $(boehm_gc_basedir)/configure.host
# Multilib support.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
maintainer-clean-multi
all-recursive: all-multi
install-recursive: install-multi
mostlyclean-recursive: mostlyclean-multi
clean-recursive: clean-multi
distclean-recursive: distclean-multi
maintainer-clean-recursive: maintainer-clean-multi
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
MAKEOVERRIDES=

View File

@ -1,296 +0,0 @@
# Primary targets:
# gc.a - builds basic library
# libgc.a - builds library for use with g++ "-fgc-keyword" extension
# c++ - adds C++ interface to library
# cords - adds cords (heavyweight strings) to library
# test - prints porting information, then builds basic version of gc.a,
# and runs some tests of collector and cords. Does not add cords or
# c++ interface to gc.a
# cord/de$(EXE_SUFFIX) - builds dumb editor based on cords.
CC=gcc
CXX=gcc -x c++
CXXLD=gxx
RM=rm -f
MV=mv
EXE_SUFFIX=.exe
RANLIB=ranlib
CFLAGS= -O -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DSILENT -DATOMIC_UNCOLLECTABLE
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# Use only for incremental collector debugging.
# -DFIND_LEAK causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
# Finalization and the test program are not usable in this mode.
# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
# (Clients should also define SOLARIS_THREADS and then include
# gc.h before performing thr_ or dl* or GC_ operations.)
# This is broken on nonSPARC machines.
# -DIRIX_THREADS enables support for Irix pthreads. See README.irix.
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_priv.h for consequences.)
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
# usually causing it to use less space in such situations.
# Incremental collection no longer works in this case.
# -DLARGE_CONFIG tunes the collector for unusually large heaps.
# Necessary for heaps larger than about 500 MB on most machines.
# Recommended for heaps larger than about 64 MB.
# -DDONT_ADD_BYTE_AT_END is meaningful only with
# -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
# causes all objects to be padded so that pointers just past the end of
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
# -DDONT_ADD_BYTE_AT_END disables the padding.
# -DNO_SIGNALS does not disable signals during critical parts of
# the GC process. This is no less correct than many malloc
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
# collector on UNIX machines. It may greatly improve its performance,
# since this may avoid some expensive cache synchronization.
# -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
# new syntax "operator new[]" for allocating and deleting arrays.
# See gc_cpp.h for details. No effect on the C part of the collector.
# This is defined implicitly in a few environments.
# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
# as aliases for X, GC_realloc, and GC_free, respectively.
# Calloc is redefined in terms of the new malloc. X should
# be either GC_malloc or GC_malloc_uncollectable.
# The former is occasionally useful for working around leaks in code
# you don't want to (or can't) look at. It may not work for
# existing code, but it often does. Neither works on all platforms,
# since some ports use malloc or calloc to obtain system memory.
# (Probably works for UNIX, and win32.)
# -DIGNORE_FREE turns calls to free into a noop. Only useful with
# -DREDIRECT_MALLOC.
# -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
# Reduces code size slightly at the expense of debuggability.
# -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
# order by specifying a nonstandard finalization mark procedure (see
# finalize.c). Objects reachable from finalizable objects will be marked
# in a sepearte postpass, and hence their memory won't be reclaimed.
# Not recommended unless you are implementing a language that specifies
# these semantics.
# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
# This is useful if either the vendor malloc implementation is poor,
# or if REDIRECT_MALLOC is used.
LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
-DREDIRECT_MALLOC=GC_malloc_uncollectable \
-DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
# Flags for building libgc.a -- the last two are required.
CXXFLAGS= $(CFLAGS) -DOPERATOR_NEW_ARRAY
AR= ar
RANLIB= ranlib
# Redefining srcdir allows object code for the nonPCR version of the collector
# to be generated in different directories. In this case, the destination directory
# should contain a copy of the original include directory.
srcdir = .
VPATH = $(srcdir)
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o typd_mlc.o ptr_chck.o mallocx.o
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c typd_mlc.c ptr_chck.c mallocx.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h \
config.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man \
threadlibs.c if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h weakpointer.h \
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h gc_alloc.h \
$(CORD_SRCS)
OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
SCoptions.amiga README.amiga README.win32 cord/README \
cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
include/ec.h include/private/cord_pos.h include/private/config.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/gc_cpp.h README.rs6000 \
include/weakpointer.h README.QUICK callprocs pc_excludes \
barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
include/gc_cpp.h Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj
CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
$(srcdir)/cord/private/cord_pos.h
UTILS= if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) threadlibs$(EXE_SUFFIX)
# Libraries needed for curses applications. Only needed for de.
CURSES= -lcurses -ltermlib
# The following is irrelevant on most systems. But a few
# versions of make otherwise fork the shell specified in
# the SHELL environment variable.
SHELL= /bin/sh
SPECIALCFLAGS =
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
# Set SPECIALCFLAGS to -q nodirect_code on Encore.
all: gc.a gctest$(EXE_SUFFIX)
pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h config.h mach_dep.o $(SRCS)
make -f PCR-Makefile depend
make -f PCR-Makefile
$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
$(srcdir)/config.h $(srcdir)/gc_typed.h Makefile
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
echo > base_lib
$(RM) on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(OBJS) dyn_load.o
-./if_not_there on_sparc_sunos5 $(RANLIB) gc.a
# ignore ranlib failure; that usually means it doesn't exist, and isn't needed
libgc.a:
make CFLAGS="$(LIBGC_CFLAGS)" clean gc.a gcc_support.o
$(MV) gc.a libgc.a
-$(RM) on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus libgc.a gcc_support.o
./if_not_there on_sparc_sunos5 $(AR) ru libgc.a gcc_support.o
-./if_not_there on_sparc_sunos5 $(RANLIB) libgc.a
cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS)
-$(RM) on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(CORD_OBJS)
-./if_not_there on_sparc_sunos5 $(RANLIB) gc.a
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
test_cpp: $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h \
base_lib $(UTILS)
-$(RM) test_cpp test_cpp$(EXE_SUFFIX)
./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
./if_not_there test_cpp$(EXE_SUFFIX) $(CXXLD) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a
$(RM) test_cpp
c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp
-$(RM) on_sparc_sunos5
$(AR) ru gc.a gc_cpp.o
$(RANLIB) gc.a
./test_cpp$(EXE_SUFFIX) 1
echo > c++
dyn_load_sunos53.o: dyn_load.c
$(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
mach_dep.o: $(srcdir)/mach_dep.c
-$(RM) mach_dep.o
$(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
mark_rts.o: $(srcdir)/mark_rts.c
-$(RM) mark_rts.o
$(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c
$(MV) cordbscs.o cord/cordbscs.o
# not all compilers understand -o filename
cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c
$(MV) cordxtra.o cord/cordxtra.o
cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c
$(MV) cordprnt.o cord/cordprnt.o
cord/cordtest$(EXE_SUFFIX): $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
-$(RM) cord/cordtest$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o cordtest $(srcdir)/cord/cordtest.c\
$(CORD_OBJS) gc.a
./if_not_there cord/cordtest$(EXE_SUFFIX) \
$(MV) cordtest$(EXE_SUFFIX) cord/cordtest$(EXE_SUFFIX)
cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
-$(RM) cord/de$(EXE_SUFFIX)
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c\
cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb
./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c\
cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld
./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c\
cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c\
cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c\
cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES)
./if_not_there cord/de$(EXE_SUFFIX) \
$(MV) de$(EXE_SUFFIX) cord/de$(EXE_SUFFIX)
if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/config.h
$(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
-$(RM) if_mach
threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)/config.h Makefile
$(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
-$(RM) threadlibs
if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c
$(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
-$(RM) if_not_there
clean:
-$(RM) gc.a *.o
-$(RM) *.o
-$(RM) gctest gctest_dyn_link test_cpp \
setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
$(CORD_OBJS) cordtest cord/cordtest de cord/de
-$(RM) gctest$(EXE_SUFFIX) gctest_dyn_link$(EXE_SUFFIX) test_cpp$(EXE_SUFFIX) \
setjmp_test$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) if_mach$(EXE_SUFFIX) \
cord/cordtest$(EXE_SUFFIX)
-$(RM) *~
gctest$(EXE_SUFFIX): test.o gc.a
-$(RM) gctest$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o gctest test.o gc.a
$(RM) gctest
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
setjmp_test$(EXE_SUFFIX): $(srcdir)/setjmp_t.c $(srcdir)/gc.h \
if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
-$(RM) setjmp_test$(EXE_SUFFIX)
$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
$(RM) setjmp_test
test: KandRtest cord/cordtest$(EXE_SUFFIX)
./cord/cordtest$(EXE_SUFFIX)
# Those tests that work even with a K&R C compiler:
KandRtest: setjmp_test$(EXE_SUFFIX) gctest$(EXE_SUFFIX)
./setjmp_test$(EXE_SUFFIX)
./gctest$(EXE_SUFFIX)

View File

@ -1,514 +0,0 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AR = @AR@
AS = @AS@
BOEHM_GC_CFLAGS = @BOEHM_GC_CFLAGS@
CC = @CC@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXINCLUDES = @CXXINCLUDES@
DLLTOOL = @DLLTOOL@
EXEEXT = @EXEEXT@
INCLUDES = @INCLUDES@
LD = @LD@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MY_CFLAGS = @MY_CFLAGS@
NM = @NM@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
addobjs = @addobjs@
boehm_gc_basedir = @boehm_gc_basedir@
target_all = @target_all@
AUTOMAKE_OPTIONS = cygnus
# Multilib support variables.
MULTISRCTOP =
MULTIBUILDTOP =
MULTIDIRS =
MULTISUBDIR =
MULTIDO = true
MULTICLEAN = true
toolexecdir = $(exec_prefix)/$(target_alias)
toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
toolexeclib_LTLIBRARIES = $(target_all)
EXTRA_LTLIBRARIES = libgcjgc.la
libgcjgc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c \
config.h dbg_mlc.c dyn_load.c finalize.c gc.h gc_alloc.h gc_cpp.h \
gc_hdrs.h gc_mark.h gc_priv.h gc_private.h gc_typed.h headers.c \
irix_threads.c linux_threads.c malloc.c mallocx.c mark.c mark_rts.c \
misc.c new_hblk.c obj_map.c os_dep.c pcr_interface.c ptr_chck.c \
quick_threads.c real_malloc.c reclaim.c solaris_pthreads.c \
solaris_threads.c solaris_threads.h stubborn.c typd_mlc.c version.h \
weakpointer.h
libgcjgc_la_LIBADD = @addobjs@
libgcjgc_la_DEPENDENCIES = @addobjs@
libgcjgc_la_LDFLAGS = -release $(VERSION) -rpath $(toolexeclibdir)
EXTRA_libgcjgc_la_SOURCES = alpha_mach_dep.s mips_sgi_mach_dep.s \
mips_ultrix_mach_dep.s rs6000_mach_dep.s sparc_mach_dep.s \
sparc_sunos4_mach_dep.s mach_dep.c ecos.cc
AM_CXXFLAGS = @BOEHM_GC_CFLAGS@
AM_CFLAGS = @BOEHM_GC_CFLAGS@
check_PROGRAMS = gctest
gctest_SOURCES = test.c
gctest_LDADD = ./libgcjgc.la
all_objs = @addobjs@ $(libgcjgc_la_OBJECTS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(MY_CFLAGS) $(BOEHM_GC_CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(MY_CFLAGS) $(LDFLAGS) -o $@
# Work around what appears to be a GNU make bug handling MAKEFLAGS
# values defined in terms of make variables, as is the case for CC and
# friends when we are called from the top level Makefile.
AM_MAKEFLAGS = \
"AR_FLAGS=$(AR_FLAGS)" \
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
"CFLAGS=$(CFLAGS)" \
"CXXFLAGS=$(CXXFLAGS)" \
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
"INSTALL=$(INSTALL)" \
"INSTALL_DATA=$(INSTALL_DATA)" \
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
"LDFLAGS=$(LDFLAGS)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
"MAKE=$(MAKE)" \
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
"PICFLAG=$(PICFLAG)" \
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
"SHELL=$(SHELL)" \
"EXPECT=$(EXPECT)" \
"RUNTEST=$(RUNTEST)" \
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
"exec_prefix=$(exec_prefix)" \
"infodir=$(infodir)" \
"libdir=$(libdir)" \
"prefix=$(prefix)" \
"tooldir=$(tooldir)" \
"AR=$(AR)" \
"AS=$(AS)" \
"CC=$(CC)" \
"CXX=$(CXX)" \
"LD=$(LD)" \
"LIBCFLAGS=$(LIBCFLAGS)" \
"NM=$(NM)" \
"PICFLAG=$(PICFLAG)" \
"RANLIB=$(RANLIB)" \
"DESTDIR=$(DESTDIR)"
CONFIG_STATUS_DEPENDENCIES = $(boehm_gc_basedir)/configure.host
MAKEOVERRIDES =
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libgcjgc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo checksums.lo \
dbg_mlc.lo dyn_load.lo finalize.lo headers.lo irix_threads.lo \
linux_threads.lo malloc.lo mallocx.lo mark.lo mark_rts.lo misc.lo \
new_hblk.lo obj_map.lo os_dep.lo pcr_interface.lo ptr_chck.lo \
quick_threads.lo real_malloc.lo reclaim.lo solaris_pthreads.lo \
solaris_threads.lo stubborn.lo typd_mlc.lo
check_PROGRAMS = gctest$(EXEEXT)
gctest_OBJECTS = test.o
gctest_DEPENDENCIES = ./libgcjgc.la
gctest_LDFLAGS =
CXXFLAGS = @CXXFLAGS@
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
DIST_COMMON = README ChangeLog Makefile.am Makefile.in acinclude.m4 \
aclocal.m4 configure configure.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(libgcjgc_la_SOURCES) $(EXTRA_libgcjgc_la_SOURCES) $(gctest_SOURCES)
OBJECTS = $(libgcjgc_la_OBJECTS) $(gctest_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .cc .lo .o .s
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4
cd $(srcdir) && $(ACLOCAL)
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
mostlyclean-toolexeclibLTLIBRARIES:
clean-toolexeclibLTLIBRARIES:
-test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
distclean-toolexeclibLTLIBRARIES:
maintainer-clean-toolexeclibLTLIBRARIES:
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
@list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(toolexeclibdir)/$$p; \
else :; fi; \
done
uninstall-toolexeclibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(toolexeclibdir)/$$p; \
done
.c.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libgcjgc.la: $(libgcjgc_la_OBJECTS) $(libgcjgc_la_DEPENDENCIES)
$(LINK) $(libgcjgc_la_LDFLAGS) $(libgcjgc_la_OBJECTS) $(libgcjgc_la_LIBADD) $(LIBS)
mostlyclean-checkPROGRAMS:
clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
distclean-checkPROGRAMS:
maintainer-clean-checkPROGRAMS:
gctest$(EXEEXT): $(gctest_OBJECTS) $(gctest_DEPENDENCIES)
@rm -f gctest$(EXEEXT)
$(LINK) $(gctest_LDFLAGS) $(gctest_OBJECTS) $(gctest_LDADD) $(LIBS)
.cc.o:
$(CXXCOMPILE) -c $<
.cc.lo:
$(LTCXXCOMPILE) -c $<
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
-rm -rf $(distdir)
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) dist
-rm -rf $(distdir)
@banner="$(distdir).tar.gz is ready for distribution"; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"
dist: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
dist-all: distdir
-chmod -R a+r $(distdir)
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
-rm -rf $(distdir)
distdir: $(DISTFILES)
-rm -rf $(distdir)
mkdir $(distdir)
-chmod 777 $(distdir)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: $(check_PROGRAMS)
check: check-am
installcheck-am:
installcheck: installcheck-am
install-info-am:
install-info: install-info-am
install-exec-am: install-toolexeclibLTLIBRARIES
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-toolexeclibLTLIBRARIES
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(toolexeclibdir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-checkPROGRAMS \
mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
clean-checkPROGRAMS clean-tags clean-generic \
mostlyclean-am
clean: clean-am
distclean-am: distclean-toolexeclibLTLIBRARIES distclean-compile \
distclean-libtool distclean-checkPROGRAMS \
distclean-tags distclean-generic clean-am
-rm -f libtool
distclean: distclean-am
-rm -f config.status
maintainer-clean-am: maintainer-clean-toolexeclibLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-checkPROGRAMS maintainer-clean-tags \
maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
-rm -f config.status
.PHONY: mostlyclean-toolexeclibLTLIBRARIES \
distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
maintainer-clean-toolexeclibLTLIBRARIES \
uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool mostlyclean-checkPROGRAMS \
distclean-checkPROGRAMS clean-checkPROGRAMS \
maintainer-clean-checkPROGRAMS tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-info-am install-info \
install-exec-am install-exec install-data-am install-data install-am \
install uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
$(all_objs) : config.h gc_priv.h gc_hdrs.h gc.h gc_mark.h
.s.o:
$(LTCOMPILE) -x assembler-with-cpp -c $<
# Multilib support.
.PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
maintainer-clean-multi
all-recursive: all-multi
install-recursive: install-multi
mostlyclean-recursive: mostlyclean-multi
clean-recursive: clean-multi
distclean-recursive: distclean-multi
maintainer-clean-recursive: maintainer-clean-multi
all-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
install-multi:
$(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do
mostlyclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean
clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean
distclean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean
maintainer-clean-multi:
$(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,400 +0,0 @@
# Primary targets:
# gc.a - builds basic library
# libgc.a - builds library for use with g++ "-fgc-keyword" extension
# c++ - adds C++ interface to library
# cords - adds cords (heavyweight strings) to library
# test - prints porting information, then builds basic version of gc.a,
# and runs some tests of collector and cords. Does not add cords or
# c++ interface to gc.a
# cord/de - builds dumb editor based on cords.
ABI_FLAG=
CC=cc $(ABI_FLAG)
CXX=CC $(ABI_FLAG)
AS=as $(ABI_FLAG)
# The above doesn't work with gas, which doesn't run cpp.
# Define AS as `gcc -c -x assembler-with-cpp' instead.
# Under Irix 6, you will have to specify the ABI for as if you specify
# it for the C compiler.
CFLAGS= -O -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION -DSILENT
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
# -DSILENT disables statistics printing, and improves performance.
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
# altered stubborn objects, at substantial performance cost.
# Use only for incremental collector debugging.
# -DFIND_LEAK causes the collector to assume that all inaccessible
# objects should have been explicitly deallocated, and reports exceptions.
# Finalization and the test program are not usable in this mode.
# -DSOLARIS_THREADS enables support for Solaris (thr_) threads.
# (Clients should also define SOLARIS_THREADS and then include
# gc.h before performing thr_ or dl* or GC_ operations.)
# Must also define -D_REENTRANT
# -D_SOLARIS_PTHREADS enables support for Solaris pthreads.
# Define SOLARIS_THREADS as well.
# -DIRIX_THREADS enables support for Irix pthreads. See README.irix.
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
# of objects to be recognized. (See gc_priv.h for consequences.)
# -DSMALL_CONFIG tries to tune the collector for small heap sizes,
# usually causing it to use less space in such situations.
# Incremental collection no longer works in this case.
# -DLARGE_CONFIG tunes the collector for unusually large heaps.
# Necessary for heaps larger than about 500 MB on most machines.
# Recommended for heaps larger than about 64 MB.
# -DDONT_ADD_BYTE_AT_END is meaningful only with
# -DALL_INTERIOR_POINTERS. Normally -DALL_INTERIOR_POINTERS
# causes all objects to be padded so that pointers just past the end of
# an object can be recognized. This can be expensive. (The padding
# is normally more than one byte due to alignment constraints.)
# -DDONT_ADD_BYTE_AT_END disables the padding.
# -DNO_SIGNALS does not disable signals during critical parts of
# the GC process. This is no less correct than many malloc
# implementations, and it sometimes has a significant performance
# impact. However, it is dangerous for many not-quite-ANSI C
# programs that call things like printf in asynchronous signal handlers.
# -DNO_EXECUTE_PERMISSION may cause some or all of the heap to not
# have execute permission, i.e. it may be impossible to execute
# code from the heap. Currently this only affects the incremental
# collector on UNIX machines. It may greatly improve its performance,
# since this may avoid some expensive cache synchronization.
# -DOPERATOR_NEW_ARRAY declares that the C++ compiler supports the
# new syntax "operator new[]" for allocating and deleting arrays.
# See gc_cpp.h for details. No effect on the C part of the collector.
# This is defined implicitly in a few environments.
# -DREDIRECT_MALLOC=X causes malloc, realloc, and free to be defined
# as aliases for X, GC_realloc, and GC_free, respectively.
# Calloc is redefined in terms of the new malloc. X should
# be either GC_malloc or GC_malloc_uncollectable.
# The former is occasionally useful for working around leaks in code
# you don't want to (or can't) look at. It may not work for
# existing code, but it often does. Neither works on all platforms,
# since some ports use malloc or calloc to obtain system memory.
# (Probably works for UNIX, and win32.)
# -DIGNORE_FREE turns calls to free into a noop. Only useful with
# -DREDIRECT_MALLOC.
# -DNO_DEBUGGING removes GC_dump and the debugging routines it calls.
# Reduces code size slightly at the expense of debuggability.
# -DJAVA_FINALIZATION makes it somewhat safer to finalize objects out of
# order by specifying a nonstandard finalization mark procedure (see
# finalize.c). Objects reachable from finalizable objects will be marked
# in a sepearte postpass, and hence their memory won't be reclaimed.
# Not recommended unless you are implementing a language that specifies
# these semantics.
# -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
# to explicit GC_invoke_finalizers() calls.
# -DATOMIC_UNCOLLECTABLE includes code for GC_malloc_atomic_uncollectable.
# This is useful if either the vendor malloc implementation is poor,
# or if REDIRECT_MALLOC is used.
# -DHBLKSIZE=ddd, where ddd is a power of 2 between 512 and 16384, explicitly
# sets the heap block size. Each heap block is devoted to a single size and
# kind of object. For the incremental collector it makes sense to match
# the most likely page size. Otherwise large values result in more
# fragmentation, but generally better performance for large heaps.
# -DUSE_MMAP use MMAP instead of sbrk to get new memory.
# Works for Solaris and Irix.
# -DMMAP_STACKS (for Solaris threads) Use mmap from /dev/zero rather than
# GC_scratch_alloc() to get stack memory.
# -DPRINT_BLACK_LIST Whenever a black list entry is added, i.e. whenever
# the garbage collector detects a value that looks almost, but not quite,
# like a pointer, print both the address containing the value, and the
# value of the near-bogus-pointer. Can be used to identifiy regions of
# memory that are likely to contribute misidentified pointers.
# -DOLD_BLOCK_ALLOC Use the old, possibly faster, large block
# allocation strategy. The new strategy tries harder to minimize
# fragmentation, sometimes at the expense of spending more time in the
# large block allocator and/or collecting more frequently.
#
LIBGC_CFLAGS= -O -DNO_SIGNALS -DSILENT \
-DREDIRECT_MALLOC=GC_malloc_uncollectable \
-DDONT_ADD_BYTE_AT_END -DALL_INTERIOR_POINTERS
# Flags for building libgc.a -- the last two are required.
CXXFLAGS= $(CFLAGS)
AR= ar
RANLIB= ranlib
# Redefining srcdir allows object code for the nonPCR version of the collector
# to be generated in different directories. In this case, the destination directory
# should contain a copy of the original include directory.
srcdir = .
VPATH = $(srcdir)
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o irix_threads.o linux_threads.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o
CSRCS= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c irix_threads.c linux_threads.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c cord/cord.h cord/ec.h cord/private/cord_pos.h cord/de_win.c cord/de_win.h cord/de_cmds.h cord/de_win.ICO cord/de_win.RC cord/SCOPTIONS.amiga cord/SMakefile.amiga
CORD_OBJS= cord/cordbscs.o cord/cordxtra.o cord/cordprnt.o
SRCS= $(CSRCS) mips_sgi_mach_dep.s rs6000_mach_dep.s alpha_mach_dep.s \
sparc_mach_dep.s gc.h gc_typed.h gc_hdrs.h gc_priv.h gc_private.h \
config.h gc_mark.h include/gc_inl.h include/gc_inline.h gc.man \
threadlibs.c if_mach.c if_not_there.c gc_cpp.cc gc_cpp.h weakpointer.h \
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h gc_alloc.h \
sparc_sunos4_mach_dep.s solaris_threads.h $(CORD_SRCS)
OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
README test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
SCoptions.amiga README.amiga README.win32 cord/README \
cord/gc.h include/gc.h include/gc_typed.h include/cord.h \
include/ec.h include/private/cord_pos.h include/private/config.h \
include/private/gc_hdrs.h include/private/gc_priv.h \
include/gc_cpp.h README.rs6000 \
include/weakpointer.h README.QUICK callprocs pc_excludes \
barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
MacOS.c EMX_MAKEFILE makefile.depend README.debugging \
include/gc_cpp.h Mac_files/datastart.c Mac_files/dataend.c \
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
add_gc_prefix.c README.solaris2 README.sgi README.hp README.uts \
win32_threads.c NT_THREADS_MAKEFILE gc.mak README.dj Makefile.dj \
README.alpha README.linux version.h Makefile.DLLs gc_watcom.asm \
WCC_MAKEFILE
CORD_INCLUDE_FILES= $(srcdir)/gc.h $(srcdir)/cord/cord.h $(srcdir)/cord/ec.h \
$(srcdir)/cord/private/cord_pos.h
UTILS= if_mach if_not_there threadlibs
# Libraries needed for curses applications. Only needed for de.
CURSES= -lcurses -ltermlib
# The following is irrelevant on most systems. But a few
# versions of make otherwise fork the shell specified in
# the SHELL environment variable.
SHELL= /bin/sh
SPECIALCFLAGS =
# Alternative flags to the C compiler for mach_dep.c.
# Mach_dep.c often doesn't like optimization, and it's
# not time-critical anyway.
# Set SPECIALCFLAGS to -q nodirect_code on Encore.
all: gc.a gctest
pcr: PCR-Makefile gc_private.h gc_hdrs.h gc.h config.h mach_dep.o $(SRCS)
make -f PCR-Makefile depend
make -f PCR-Makefile
$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: $(srcdir)/gc_priv.h $(srcdir)/gc_hdrs.h $(srcdir)/gc.h \
$(srcdir)/config.h $(srcdir)/gc_typed.h Makefile
# The dependency on Makefile is needed. Changing
# options such as -DSILENT affects the size of GC_arrays,
# invalidating all .o files that rely on gc_priv.h
mark.o typd_mlc.o finalize.o: $(srcdir)/gc_mark.h
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
echo > base_lib
rm -f on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(OBJS) dyn_load.o
./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
# ignore ranlib failure; that usually means it doesn't exist, and isn't needed
libgc.a:
make CFLAGS="$(LIBGC_CFLAGS)" clean gc.a gcc_support.o
mv gc.a libgc.a
rm -f on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus libgc.a gcc_support.o
./if_not_there on_sparc_sunos5 $(AR) ru libgc.a gcc_support.o
./if_not_there on_sparc_sunos5 $(RANLIB) libgc.a || cat /dev/null
cords: $(CORD_OBJS) cord/cordtest $(UTILS)
rm -f on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
./if_not_there on_sparc_sunos5 $(AR) ru gc.a $(CORD_OBJS)
./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/gc_cpp.h $(srcdir)/gc.h Makefile
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
test_cpp: $(srcdir)/test_cpp.cc $(srcdir)/gc_cpp.h gc_cpp.o $(srcdir)/gc.h \
base_lib $(UTILS)
rm -f test_cpp
./if_mach HP_PA "" $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a -ldld
./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
c++: gc_cpp.o $(srcdir)/gc_cpp.h test_cpp
rm -f on_sparc_sunos5
./if_mach SPARC SUNOS5 touch on_sparc_sunos5
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
./if_not_there on_sparc_sunos5 $(AR) ru gc.a gc_cpp.o
./if_not_there on_sparc_sunos5 $(RANLIB) gc.a || cat /dev/null
./test_cpp 1
echo > c++
dyn_load_sunos53.o: dyn_load.c
$(CC) $(CFLAGS) -DSUNOS53_SHARED_LIB -c $(srcdir)/dyn_load.c -o $@
# SunOS5 shared library version of the collector
libgc.so: $(OBJS) dyn_load_sunos53.o
$(CC) -G -o libgc.so $(OBJS) dyn_load_sunos53.o -ldl
# Alpha/OSF shared library version of the collector
libalphagc.so: $(OBJS)
ld -shared -o libalphagc.so $(OBJS) dyn_load.o -lc
ln libalphagc.so libgc.so
# IRIX shared library version of the collector
libirixgc.so: $(OBJS) dyn_load.o
ld -shared $(ABI_FLAG) -o libirixgc.so $(OBJS) dyn_load.o -lc
ln libirixgc.so libgc.so
mach_dep.o: $(srcdir)/mach_dep.c $(srcdir)/mips_sgi_mach_dep.s $(srcdir)/mips_ultrix_mach_dep.s $(srcdir)/rs6000_mach_dep.s $(UTILS)
rm -f mach_dep.o
./if_mach MIPS IRIX5 $(AS) -o mach_dep.o $(srcdir)/mips_sgi_mach_dep.s
./if_mach MIPS RISCOS $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach MIPS ULTRIX $(AS) -o mach_dep.o $(srcdir)/mips_ultrix_mach_dep.s
./if_mach RS6000 "" $(AS) -o mach_dep.o $(srcdir)/rs6000_mach_dep.s
./if_mach ALPHA "" $(AS) -o mach_dep.o $(srcdir)/alpha_mach_dep.s
./if_mach SPARC SUNOS5 $(AS) -o mach_dep.o $(srcdir)/sparc_mach_dep.s
./if_mach SPARC SUNOS4 $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
mark_rts.o: $(srcdir)/mark_rts.c if_mach if_not_there $(UTILS)
rm -f mark_rts.o
-./if_mach ALPHA OSF1 $(CC) -c $(CFLAGS) -Wo,-notail $(srcdir)/mark_rts.c
./if_not_there mark_rts.o $(CC) -c $(CFLAGS) $(srcdir)/mark_rts.c
# Work-around for DEC optimizer tail recursion elimination bug.
# The ALPHA-specific line should be removed if gcc is used.
alloc.o: version.h
cord/cordbscs.o: $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordbscs.c
mv cordbscs.o cord/cordbscs.o
# not all compilers understand -o filename
cord/cordxtra.o: $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordxtra.c
mv cordxtra.o cord/cordxtra.o
cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
$(CC) $(CFLAGS) -c $(srcdir)/cord/cordprnt.c
mv cordprnt.o cord/cordprnt.o
cord/cordtest: $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS)
rm -f cord/cordtest
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld
./if_not_there cord/cordtest $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
cord/de: $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
rm -f cord/de
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -lucb
./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld
./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
./if_not_there cord/de $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) `./threadlibs`
if_mach: $(srcdir)/if_mach.c $(srcdir)/config.h
$(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
threadlibs: $(srcdir)/threadlibs.c $(srcdir)/config.h Makefile
$(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
if_not_there: $(srcdir)/if_not_there.c
$(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
clean:
rm -f gc.a *.o gctest gctest_dyn_link test_cpp \
setjmp_test mon.out gmon.out a.out core if_not_there if_mach \
threadlibs $(CORD_OBJS) cord/cordtest cord/de
-rm -f *~
gctest: test.o gc.a if_mach if_not_there
rm -f gctest
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest test.o gc.a -lucb
./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest test.o gc.a -ldld
./if_not_there gctest $(CC) $(CFLAGS) -o gctest test.o gc.a `./threadlibs`
# If an optimized setjmp_test generates a segmentation fault,
# odds are your compiler is broken. Gctest may still work.
# Try compiling setjmp_t.c unoptimized.
setjmp_test: $(srcdir)/setjmp_t.c $(srcdir)/gc.h if_mach if_not_there
$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
test: KandRtest cord/cordtest
cord/cordtest
# Those tests that work even with a K&R C compiler:
KandRtest: setjmp_test gctest
./setjmp_test
./gctest
add_gc_prefix: add_gc_prefix.c
$(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c
gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
./add_gc_prefix $(SRCS) $(OTHER_FILES) > /tmp/gc.tar-files
(cd $(srcdir)/.. ; tar cvfh - `cat /tmp/gc.tar-files`) > gc.tar
pc_gc.tar: $(SRCS) $(OTHER_FILES)
tar cvfX pc_gc.tar pc_excludes $(SRCS) $(OTHER_FILES)
floppy: pc_gc.tar
-mmd a:/cord
-mmd a:/cord/private
-mmd a:/include
-mmd a:/include/private
mkdir /tmp/pc_gc
cat pc_gc.tar | (cd /tmp/pc_gc; tar xvf -)
-mcopy -tmn /tmp/pc_gc/* a:
-mcopy -tmn /tmp/pc_gc/cord/* a:/cord
-mcopy -mn /tmp/pc_gc/cord/de_win.ICO a:/cord
-mcopy -tmn /tmp/pc_gc/cord/private/* a:/cord/private
-mcopy -tmn /tmp/pc_gc/include/* a:/include
-mcopy -tmn /tmp/pc_gc/include/private/* a:/include/private
rm -r /tmp/pc_gc
gc.tar.Z: gc.tar
compress gc.tar
gc.tar.gz: gc.tar
gzip gc.tar
lint: $(CSRCS) test.c
lint -DLINT $(CSRCS) test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall"
# BTL: added to test shared library version of collector.
# Currently works only under SunOS5. Requires GC_INIT call from statically
# loaded client code.
ABSDIR = `pwd`
gctest_dyn_link: test.o libgc.so
$(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link test.o -lgc -ldl -lthread
gctest_irix_dyn_link: test.o libirixgc.so
$(CC) -L$(ABSDIR) -o gctest_irix_dyn_link test.o -lirixgc
test_dll.o: test.c libgc_globals.h
$(CC) $(CFLAGS) -DGC_USE_DLL -c test.c -o test_dll.o
test_dll: test_dll.o libgc_dll.a libgc.dll
$(CC) test_dll.o -L$(ABSDIR) -lgc_dll -o test_dll
SYM_PREFIX-libgc=GC
# Uncomment the following line to build a GNU win32 DLL
# include Makefile.DLLs
reserved_namespace: $(SRCS)
for file in $(SRCS) test.c test_cpp.cc; do \
sed s/GC_/_GC_/g < $$file > tmp; \
cp tmp $$file; \
done
user_namespace: $(SRCS)
for file in $(SRCS) test.c test_cpp.cc; do \
sed s/_GC_/GC_/g < $$file > tmp; \
cp tmp $$file; \
done

View File

@ -1,59 +0,0 @@
# Makefile for Windows NT. Assumes Microsoft compiler, and a single thread.
# DLLs are included in the root set under NT, but not under win32S.
# Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor.
CPU= i386
!include <ntwin32.mak>
OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj
all: gctest.exe cord\de.exe test_cpp.exe
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ $*.c /Fo$*.obj
.cpp.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -DSMALL_CONFIG -DSILENT -DALL_INTERIOR_POINTERS $*.CPP /Fo$*.obj
$(OBJS) test.obj: gc_priv.h gc_hdrs.h gc.h
gc.lib: $(OBJS)
lib /MACHINE:i386 /out:gc.lib $(OBJS)
# The original NT SDK used lib32 instead of lib
gctest.exe: test.obj gc.lib
# The following works for win32 debugging. For win32s debugging use debugtype:coff
# and add mapsympe line.
# This produces a "GUI" applications that opens no windows and writes to the log file
# "gc.log". This is done to make the result runnable under win32s.
$(link) -debug:full -debugtype:cv $(guiflags) -stack:131072 -out:$*.exe test.obj $(guilibs) gc.lib
# mapsympe -n -o gctest.sym gctest.exe
cord\de_win.rbj: cord\de_win.res
cvtres -$(CPU) cord\de_win.res -o cord\de_win.rbj
cord\de.obj cord\de_win.obj: cord\cord.h cord\private\cord_pos.h cord\de_win.h cord\de_cmds.h
cord\de_win.res: cord\de_win.rc cord\de_win.h cord\de_cmds.h
$(rc) $(rcvars) -r -fo cord\de_win.res $(cvars) cord\de_win.rc
# Cord/de is a real win32 gui application.
cord\de.exe: cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc.lib $(guilibs)
gc_cpp.obj: gc_cpp.h gc.h
gc_cpp.cpp: gc_cpp.cc
copy gc_cpp.cc gc_cpp.cpp
test_cpp.cpp: test_cpp.cc
copy test_cpp.cc test_cpp.cpp
# This generates the C++ test executable. The executable expects
# a single numeric argument, which is the number of iterations.
# The output appears in the file "gc.log".
test_cpp.exe: test_cpp.obj gc_cpp.h gc.h gc.lib
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs)

View File

@ -1,45 +0,0 @@
# Makefile for OS/2. Assumes IBM's compiler, static linking, and a single thread.
# Adding dynamic linking support seems easy, but takes a little bit of work.
# Adding thread support may be nontrivial, since we haven't yet figured out how to
# look at another thread's registers.
# Significantly revised for GC version 4.4 by Mark Boulter (Jan 1994).
OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj obj_map.obj blacklst.obj finalize.obj new_hblk.obj dbg_mlc.obj malloc.obj stubborn.obj typd_mlc.obj ptr_chck.obj mallocx.obj
CORDOBJS= cord\cordbscs.obj cord\cordxtra.obj cord\cordprnt.obj
CC= icc
CFLAGS= /O /Q /DSILENT /DSMALL_CONFIG /DALL_INTERIOR_POINTERS
# Use /Ti instead of /O for debugging
# Setjmp_test may yield overly optimistic results when compiled
# without optimization.
all: $(OBJS) gctest.exe cord\cordtest.exe
$(OBJS) test.obj: gc_priv.h gc_hdrs.h gc.h
## ERASE THE LIB FIRST - if it is already there then this command will fail
## (make sure its there or erase will fail!)
gc.lib: $(OBJS)
echo . > gc.lib
erase gc.lib
LIB gc.lib $(OBJS), gc.lst
mach_dep.obj: mach_dep.c
$(CC) $(CFLAGS) /C mach_dep.c
gctest.exe: test.obj gc.lib
$(CC) $(CFLAGS) /B"/STACK:524288" /Fegctest test.obj gc.lib
cord\cordbscs.obj: cord\cordbscs.c cord\cord.h cord\private\cord_pos.h
$(CC) $(CFLAGS) /C /Focord\cordbscs cord\cordbscs.c
cord\cordxtra.obj: cord\cordxtra.c cord\cord.h cord\private\cord_pos.h cord\ec.h
$(CC) $(CFLAGS) /C /Focord\cordxtra cord\cordxtra.c
cord\cordprnt.obj: cord\cordprnt.c cord\cord.h cord\private\cord_pos.h cord\ec.h
$(CC) $(CFLAGS) /C /Focord\cordprnt cord\cordprnt.c
cord\cordtest.exe: cord\cordtest.c cord\cord.h cord\private\cord_pos.h cord\ec.h $(CORDOBJS) gc.lib
$(CC) $(CFLAGS) /B"/STACK:65536" /Fecord\cordtest cord\cordtest.c gc.lib $(CORDOBJS)

View File

@ -1,68 +0,0 @@
#
# Default target
#
default: gc.o
include ../config/common.mk
#
# compilation flags, etc.
#
CPPFLAGS = $(INCLUDE) $(CONFIG_CPPFLAGS) \
-DPCR_NO_RENAME -DPCR_NO_HOSTDEP_ERR
#CFLAGS = -DPCR -DSILENT $(CONFIG_CFLAGS)
CFLAGS = -DPCR $(CONFIG_CFLAGS)
SPECIALCFLAGS = # For code involving asm's
ASPPFLAGS = $(INCLUDE) $(CONFIG_ASPPFLAGS) \
-DPCR_NO_RENAME -DPCR_NO_HOSTDEP_ERR -DASM
ASFLAGS = $(CONFIG_ASFLAGS)
LDRFLAGS = $(CONFIG_LDRFLAGS)
LDFLAGS = $(CONFIG_LDFLAGS)
#
#
#
#
# BEGIN PACKAGE-SPECIFIC PART
#
#
#
#
# Fix to point to local pcr installation directory.
PCRDIR= ..
COBJ= alloc.o reclaim.o allchblk.o misc.o os_dep.o mark_rts.o headers.o mark.o obj_map.o pcr_interface.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o solaris_threads.o typd_mlc.o ptr_chck.o mallocx.o
CSRC= reclaim.c allchblk.c misc.c alloc.c mach_dep.c os_dep.c mark_rts.c headers.c mark.c obj_map.c pcr_interface.c blacklst.c finalize.c new_hblk.c real_malloc.c dyn_load.c dbg_mlc.c malloc.c stubborn.c checksums.c solaris_threads.c typd_mlc.c ptr_chck.c mallocx.c
SHELL= /bin/sh
default: gc.o
gc.o: $(COBJ) mach_dep.o
$(LDR) $(CONFIG_LDRFLAGS) -o gc.o $(COBJ) mach_dep.o
mach_dep.o: mach_dep.c mips_mach_dep.s rs6000_mach_dep.s if_mach if_not_there
rm -f mach_dep.o
./if_mach MIPS "" as -o mach_dep.o mips_mach_dep.s
./if_mach RS6000 "" as -o mach_dep.o rs6000_mach_dep.s
./if_mach ALPHA "" as -o mach_dep.o alpha_mach_dep.s
./if_mach SPARC SUNOS5 as -o mach_dep.o sparc_mach_dep.s
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) mach_dep.c
if_mach: if_mach.c config.h
$(CC) $(CFLAGS) -o if_mach if_mach.c
if_not_there: if_not_there.c
$(CC) $(CFLAGS) -o if_not_there if_not_there.c

File diff suppressed because it is too large Load Diff

View File

@ -1,385 +0,0 @@
Patrick Beard's Notes for building GC v4.12 with CodeWarrior Pro 2:
----------------------------------------------------------------------------
The current build environment for the collector is CodeWarrior Pro 2.
Projects for CodeWarrior Pro 2 (and for quite a few older versions)
are distributed in the file Mac_projects.sit.hqx. The project file
:Mac_projects:gc.prj builds static library versions of the collector.
:Mac_projects:gctest.prj builds the GC test suite.
Configuring the collector is still done by editing the files
:Mac_files:MacOS_config.h and :Mac_files:MacOS_Test_config.h.
Lars Farm's suggestions on building the collector:
----------------------------------------------------------------------------
Garbage Collection on MacOS - a manual 'MakeFile'
-------------------------------------------------
Project files and IDE's are great on the Macintosh, but they do have
problems when used as distribution media. This note tries to provide
porting instructions in pure TEXT form to avoid those problems. A manual
'makefile' if you like.
GC version: 4.12a2
Codewarrior: CWPro1
date: 18 July 1997
The notes may or may not apply to earlier or later versions of the
GC/CWPro. Actually, they do apply to earlier versions of both except that
until recently a project could only build one target so each target was a
separate project. The notes will most likely apply to future versions too.
Possibly with minor tweaks.
This is just to record my experiences. These notes do not mean I now
provide a supported port of the GC to MacOS. It works for me. If it works
for you, great. If it doesn't, sorry, try again...;-) Still, if you find
errors, please let me know.
mailto: lars.farm@ite.mh.se
address: Lars Farm
Krönvägen 33b
856 44 Sundsvall
Sweden
Porting to MacOS is a bit more complex than it first seems. Which MacOS?
68K/PowerPC? Which compiler? Each supports both 68K and PowerPC and offer a
large number of (unique to each environment) compiler settings. Each
combination of compiler/68K/PPC/settings require a unique combination of
standard libraries. And the IDE's does not select them for you. They don't
even check that the library is built with compatible setting and this is
the major source of problems when porting the GC (and otherwise too).
You will have to make choices when you configure the GC. I've made some
choices here, but there are other combinations of settings and #defines
that work too.
As for target settings the major obstacles may be:
- 68K Processor: check "4-byte Ints".
- PPC Processor: uncheck "Store Static Data in TOC".
What you need to do:
===================
1) Build the GC as a library
2) Test that the library works with 'test.c'.
3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
1) The Libraries:
=================
I made one project with four targets (68K/PPC tempmem or appheap). One target
will suffice if you're able to decide which one you want. I wasn't...
Codewarrior allows a large number of compiler/linker settings. I used these:
Settings shared by all targets:
------------------------------
o Access Paths:
- User Paths: the GC folder
- System Paths: {Compiler}:Metrowerks Standard Library:
{Compiler}:MacOS Support:Headers:
{Compiler}:MacOS Support:MacHeaders:
o C/C++ language:
- inlining: normal
- direct to SOM: off
- enable/check: exceptions, RTTI, bool (and if you like pool strings)
PowerPC target settings
-----------------------
o Target Settings:
- name of target
- MacOS PPC Linker
o PPC Target
- name of library
o C/C++ language
- prefix file as described below
o PPC Processor
- Struct Alignment: PowerPC
- uncheck "Store Static Data in TOC" -- important!
I don't think the others matter, I use full optimization and its ok
o PPC Linker
- Factory Settings (SYM file with full paths, faster linking, dead-strip
static init, Main: __start)
68K target settings
-------------------
o Target Settings:
- name of target
- MacOS 68K Linker
o 68K Target
- name of library
- A5 relative data
o C/C++ language
- prefix file as described below
o 68K Processor
- Code model: smart
- Struct alignment: 68K
- FP: SANE
- enable 4-Byte Ints -- important!
I don't think the others matter. I selected...
- enable: 68020
- enable: global register allocation
o IR Optimizer
- enable: Optimize Space, Optimize Speed
I suppose the others would work too, but haven't tried...
o 68K Linker
- Factory Settings (New Style MacsBug,SYM file with full paths,
A6 Frames, fast link, Merge compiler glue into segment 1,
dead-strip static init)
Prefix Files to configure the GC sources
----------------------------------------
The Codewarrior equivalent of commandline compilers -DNAME=X is to use
prefix-files. A TEXT file that is automatically #included before the first byte
of every source file. I used these:
---- ( cut here ) ---- gc_prefix_tempmem.h -- 68K and PPC -----
#include "gc_prefix_common.h"
#undef USE_TEMPORARY_MEMORY
#define USE_TEMPORARY_MEMORY
---- ( cut here ) ---- gc_prefix_appmem.h -- 68K and PPC -----
#include "gc_prefix_common.h"
#undef USE_TEMPORARY_MEMORY
// #define USE_TEMPORARY_MEMORY
---- ( cut here ) ---- gc_prefix_common.h --------------------
// gc_prefix_common.h
// ------------------
// Codewarrior prefix file to configure the GC libraries
//
// prefix files are the Codewarrior equivalent of the
// command line option -Dname=x frequently seen in makefiles
#if !__MWERKS__
#error only tried this with Codewarrior
#endif
#if macintosh
#define MSL_USE_PRECOMPILED_HEADERS 0
#include <ansi_prefix.mac.h>
#ifndef __STDC__
#define __STDC__ 0
#endif
// See list of #defines to configure the library in: 'MakeFile'
// see also README
#define SILENT // no collection messages. In case
// of trouble you might want this off
#define ALL_INTERIOR_POINTERS // follows interior pointers.
//#define DONT_ADD_BYTE_AT_END // disables the padding if defined.
//#define SMALL_CONFIG // whether to use a smaller heap.
#define NO_SIGNALS // signals aren't real on the Macintosh.
#define ATOMIC_UNCOLLECTABLE // GC_malloc_atomic_uncollectable()
// define either or none as per personal preference
// used in malloc.c
#define REDIRECT_MALLOC GC_malloc
//#define REDIRECT_MALLOC GC_malloc_uncollectable
// if REDIRECT_MALLOC is #defined make sure that the GC library
// is listed before the ANSI/ISO libs in the Codewarrior
// 'Link order' panel
//#define IGNORE_FREE
// mac specific configs
//#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory.
//#define SHARED_LIBRARY_BUILD // build for use in a shared library.
#else
// could build Win32 here too, or in the future
// Rhapsody PPC-mach, Rhapsody PPC-MacOS,
// Rhapsody Intel-mach, Rhapsody Intel-Win32,...
// ... ugh this will get messy ...
#endif
// make sure ints are at least 32-bit
// ( could be set to 16-bit by compiler settings (68K) )
struct gc_private_assert_intsize_{ char x[ sizeof(int)>=4 ? 1 : 0 ]; };
#if __powerc
#if __option(toc_data)
#error turn off "store static data in TOC" when using GC
// ... or find a way to add TOC to the root set...(?)
#endif
#endif
---- ( cut here ) ---- end of gc_prefix_common.h -----------------
Files to build the GC libraries:
--------------------------------
allchblk.c
alloc.c
blacklst.c
checksums.c
dbg_mlc.c
finalize.c
headers.c
mach_dep.c
MacOS.c -- contains MacOS code
malloc.c
mallocx.c
mark.c
mark_rts.c
misc.c
new_hblk.c
obj_map.c
os_dep.c -- contains MacOS code
ptr_chck.c
reclaim.c
stubborn.c
typd_mlc.c
gc++.cc -- this is 'gc_cpp.cc' with less 'inline' and
-- throw std::bad_alloc when out of memory
-- gc_cpp.cc works just fine too
2) Test that the library works with 'test.c'.
=============================================
The test app is just an ordinary ANSI-C console app. Make sure settings
match the library you're testing.
Files
-----
test.c
the GC library to test -- link order before ANSI libs
suitable Mac+ANSI libraries
prefix:
------
---- ( cut here ) ---- gc_prefix_testlib.h -- all libs -----
#define MSL_USE_PRECOMPILED_HEADERS 0
#include <ansi_prefix.mac.h>
#undef NDEBUG
#define ALL_INTERIOR_POINTERS /* for GC_priv.h */
---- ( cut here ) ----
3) Test that the C++ interface 'gc_cpp.cc/h' works with 'test_cpp.cc'.
The test app is just an ordinary ANSI-C console app. Make sure settings match
the library you're testing.
Files
-----
test_cpp.cc
the GC library to test -- link order before ANSI libs
suitable Mac+ANSI libraries
prefix:
------
same as for test.c
For convenience I used one test-project with several targets so that all
test apps are build at once. Two for each library to test: test.c and
gc_app.cc. When I was satisfied that the libraries were ok. I put the
libraries + gc.h + the c++ interface-file in a folder that I then put into
the MSL hierarchy so that I don't have to alter access-paths in projects
that use the GC.
After that, just add the proper GC library to your project and the GC is in
action! malloc will call GC_malloc and free GC_free, new/delete too. You
don't have to call free or delete. You may have to be a bit cautious about
delete if you're freeing other resources than RAM. See gc_cpp.h. You can
also keep coding as always with delete/free. That works too. If you want,
"include <gc.h> and tweak it's use a bit.
Symantec SPM
============
It has been a while since I tried the GC in SPM, but I think that the above
instructions should be sufficient to guide you through in SPM too. SPM
needs to know where the global data is. Use the files 'datastart.c' and
'dataend.c'. Put 'datastart.c' at the top of your project and 'dataend.c'
at the bottom of your project so that all data is surrounded. This is not
needed in Codewarrior because it provides intrinsic variables
__datastart__, __data_end__ that wraps all globals.
Source Changes (GC 4.12a2)
==========================
Very few. Just one tiny in the GC, not strictly needed.
- MacOS.c line 131 in routine GC_MacFreeTemporaryMemory()
change # if !defined(SHARED_LIBRARY_BUILD)
to # if !defined(SILENT) && !defined(SHARED_LIBRARY_BUILD)
To turn off a message when the application quits (actually, I faked
this change by #defining SHARED_LIBRARY_BUILD in a statically linked
library for more than a year without ill effects but perhaps this is
better).
- test_cpp.cc
made the first lines of main() look like this:
------------
int main( int argc, char* argv[] ) {
#endif
#if macintosh // MacOS
char* argv_[] = {"test_cpp","10"}; // doesn't
argv=argv_; // have a
argc = sizeof(argv_)/sizeof(argv_[0]); // commandline
#endif //
int i, iters, n;
# ifndef __GNUC__
alloc dummy_to_fool_the_compiler_into_doing_things_it_currently_cant_handle;
------------
- config.h
__MWERKS__ does not have to mean MACOS. You can use Codewarrior to
build a Win32 or BeOS library and soon a Rhapsody library. You may
have to change that #if...
It worked for me, hope it works for you.
Lars Farm
18 July 1997
----------------------------------------------------------------------------
Patrick Beard's instructions (may be dated):
v4.3 of the collector now runs under Symantec C++/THINK C v7.0.4, and
Metrowerks C/C++ v4.5 both 68K and PowerPC. Project files are provided
to build and test the collector under both development systems.
Configuration
-------------
To configure the collector, under both development systems, a prefix file
is used to set preprocessor directives. This file is called "MacOS_config.h".
Also to test the collector, "MacOS_Test_config.h" is provided.
Testing
-------
To test the collector (always a good idea), build one of the gctest projects,
gctest.¹ (Symantec C++/THINK C), mw/gctest.68K.¹, or mw/gctest.PPC.¹. The
test will ask you how many times to run; 1 should be sufficient.
Building
--------
For your convenience project files for the major Macintosh development
systems are provided.
For Symantec C++/THINK C, you must build the two projects gclib-1.¹ and
gclib-2.¹. It has to be split up because the collector has more than 32k
of static data and no library can have more than this in the Symantec
environment. (Future versions will probably fix this.)
For Metrowerks C/C++ 4.5 you build gc.68K.¹/gc.PPC.¹ and the result will
be a library called gc.68K.lib/gc.PPC.lib.
Using
-----
Under Symantec C++/THINK C, you can just add the gclib-1.¹ and gclib-2.¹
projects to your own project. Under Metrowerks, you add gc.68K.lib or
gc.PPC.lib and two additional files. You add the files called datastart.c
and dataend.c to your project, bracketing all files that use the collector.
See mw/gctest.¹ for an example.
Include the projects/libraries you built above into your own project,
#include "gc.h", and call GC_malloc. You don't have to call GC_free.
Patrick C. Beard
January 4, 1995

View File

@ -1,6 +0,0 @@
The code assumes static linking, and a single thread. The editor de has
not been ported. The cord test program has. The supplied OS2_MAKEFILE
assumes the IBM C Set/2 environment, but the code shouldn't.
Since we haven't figured out hoe to do perform partial links or to build static
libraries, clients currently need to link against a long list of executables.

View File

@ -1,41 +0,0 @@
Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program
for any purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
For more details and the names of other contributors, see the
README file and gc.h. This file describes typical use of
the collector on a machine that is already supported.
INSTALLATION:
Under UN*X, type "make test". Under OS/2 or Windows NT, copy the
appropriate makefile to MAKEFILE, read it, and type "nmake test".
Read the machine specific README if one exists. The only way to
develop code with the collector for Windows 3.1 is to develop under
Windows NT, and then to use win32S.
If you wish to use the cord (structured string) library type
"make cords". (This requires an ANSI C compiler. You may need
to redefine CC in the Makefile.)
If you wish to use the collector from C++, type
"make c++". These add further files to gc.a and to the include
subdirectory. See cord/cord.h and gc_c++.h.
TYPICAL USE:
Include "gc.h" from this directory. Link against the appropriate library
("gc.a" under UN*X). Replace calls to malloc by calls to GC_MALLOC,
and calls to realloc by calls to GC_REALLOC. If the object is known
to never contain pointers, use GC_MALLOC_ATOMIC instead of
GC_MALLOC.
Define GC_DEBUG before including gc.h for additional checking.

View File

@ -1,15 +0,0 @@
Should work under OSF/1 and Linux. Currently no VMS or NT support, though
the latter shouldn't be hard.
Incremental gc not yet supported under Linux because signal handler
for SIGSEGV can't get a hold of fault address. Dynamic library support
is also missing from Linux/alpha, probably for no good reason.
From Philippe Queinnec:
System: DEC/Alpha OSF1 v3.2, vendor cc
Problem: can't link if libgc has been compiled with "cc -std1".
It works if the library has been compiled with either gcc or "cc"
alone. The problem is because the variable "end" is not defined if
compiling in std1 mode (see man ld).
Proposed fix: none. Don't use cc -std1 !

View File

@ -1,133 +0,0 @@
===========================================================================
Michel Schinz's notes
===========================================================================
WHO DID WHAT
The original Amiga port was made by Jesper Peterson. I (Michel Schinz)
modified it slightly to reflect the changes made in the new official
distributions, and to take advantage of the new SAS/C 6.x features. I also
created a makefile to compile the "cord" package (see the cord
subdirectory).
TECHNICAL NOTES
In addition to Jesper's notes, I have the following to say:
- Starting with version 4.3, gctest checks to see if the code segment is
added to the root set or not, and complains if it is. Previous versions
of this Amiga port added the code segment to the root set, so I tried to
fix that. The only problem is that, as far as I know, it is impossible to
know which segments are code segments and which are data segments (there
are indeed solutions to this problem, like scanning the program on disk
or patch the LoadSeg functions, but they are rather complicated). The
solution I have chosen (see os_dep.c) is to test whether the program
counter is in the segment we are about to add to the root set, and if it
is, to skip the segment. The problems are that this solution is rather
awkward and that it works only for one code segment. This means that if
your program has more than one code segment, all of them but one will be
added to the root set. This isn't a big problem in fact, since the
collector will continue to work correctly, but it may be slower.
Anyway, the code which decides whether to skip a segment or not can be
removed simply by not defining AMIGA_SKIP_SEG. But notice that if you do
so, gctest will complain (it will say that "GC_is_visible produced wrong
failure indication"). However, it may be useful if you happen to have
pointers stored in a code segment (you really shouldn't).
If anyone has a good solution to the problem of finding, when a program
is loaded in memory, whether a segment is a code or a data segment,
please let me know.
PROBLEMS
If you have any problem with this version, please contact me at
schinz@alphanet.ch (but do *not* send long files, since we pay for
every mail!).
===========================================================================
Jesper Peterson's notes
===========================================================================
ADDITIONAL NOTES FOR AMIGA PORT
These notes assume some familiarity with Amiga internals.
WHY I PORTED TO THE AMIGA
The sole reason why I made this port was as a first step in getting
the Sather(*) language on the Amiga. A port of this language will
be done as soon as the Sather 1.0 sources are made available to me.
Given this motivation, the garbage collection (GC) port is rather
minimal.
(*) For information on Sather read the comp.lang.sather newsgroup.
LIMITATIONS
This port assumes that the startup code linked with target programs
is that supplied with SAS/C versions 6.0 or later. This allows
assumptions to be made about where to find the stack base pointer
and data segments when programs are run from WorkBench, as opposed
to running from the CLI. The compiler dependent code is all in the
GC_get_stack_base() and GC_register_data_segments() functions, but
may spread as I add Amiga specific features.
Given that SAS/C was assumed, the port is set up to be built with
"smake" using the "SMakefile". Compiler options in "SCoptions" can
be set with "scopts" program. Both "smake" and "scopts" are part of
the SAS/C commercial development system.
In keeping with the porting philosophy outlined above, this port
will not behave well with Amiga specific code. Especially not inter-
process comms via messages, and setting up public structures like
Intuition objects or anything else in the system lists. For the
time being the use of this library is limited to single threaded
ANSI/POSIX compliant or near-complient code. (ie. Stick to stdio
for now). Given this limitation there is currently no mechanism for
allocating "CHIP" or "PUBLIC" memory under the garbage collector.
I'll add this after giving it considerable thought. The major
problem is the entire physical address space may have to me scanned,
since there is no telling who we may have passed memory to.
If you allocate your own stack in client code, you will have to
assign the pointer plus stack size to GC_stackbottom.
The initial stack size of the target program can be compiled in by
setting the __stack symbol (see SAS documentaion). It can be over-
ridden from the CLI by running the AmigaDOS "stack" program, or from
the WorkBench by setting the stack size in the tool types window.
SAS/C COMPILER OPTIONS (SCoptions)
You may wish to check the "CPU" code option is appropriate for your
intended target system.
Under no circumstances set the "StackExtend" code option in either
compiling the library or *ANY* client code.
All benign compiler warnings have been suppressed. These mainly
involve lack of prototypes in the code, and dead assignments
detected by the optimizer.
THE GOOD NEWS
The library as it stands is compatible with the GigaMem commercial
virtual memory software, and probably similar PD software.
The performance of "gctest" on an Amiga 2630 (68030 @ 25Mhz)
compares favourably with an HP9000 with similar architecture (a 325
with a 68030 I think).
-----------------------------------------------------------------------
The Amiga port has been brought to you by:
Jesper Peterson.
jep@mtiame.mtia.oz.au (preferred, but 1 week turnaround)
jep@orca1.vic.design.telecom.au (that's orca<one>, 1 day turnaround)
At least one of these addresses should be around for a while, even
though I don't work for either of the companies involved.

View File

@ -1,58 +0,0 @@
Debugging suggestions:
****If you get a segmentation fault or bus error while debugging with a debugger:
If the fault occurred in GC_find_limit, or with incremental collection enabled, this is probably normal. The collector installs handlers to take care of these. You will not see these unless you are using a debugger. Your debugger should allow you to continue. It's preferable to tell the debugger to ignore SIGBUS and SIGSEGV ("handle" in gdb, "ignore" in most versions of dbx) and set a breakpoint in abort. The collector will call abort if the signal had another cause, and there was not other handler previously installed. I recommend debugging without incremental collection if possible. (This applies directly to UNIX systems. Debugging with incremental collection under win32 is worse. See README.win32.)
****If you get warning messages informing you that the collector needed to allocate blacklisted blocks:
0) Ignore these warnings while you are using GC_DEBUG. Some of the routines mentioned below don't have debugging equivalents. (Alternatively, write the missing routines and send them to me.)
1) Replace allocator calls that request large blocks with calls to GC_malloc_ignore_off_page or GC_malloc_atomic_ignore_off_page. You may want to set a breakpoint in GC_default_warn_proc to help you identify such calls. Make sure that a pointer to somewhere near the beginning of the resulting block is maintained in a (preferably volatile) variable as long as the block is needed.
2) If the large blocks are allocated with realloc, I suggest instead allocating them with something like the following. Note that the realloc size increment should be fairly large (e.g. a factor of 3/2) for this to exhibit reasonable performance. But we all know we should do that anyway.
void * big_realloc(void *p, size_t new_size)
{
size_t old_size = GC_size(p);
void * result;
if (new_size <= 10000) return(GC_realloc(p, new_size));
if (new_size <= old_size) return(p);
result = GC_malloc_ignore_off_page(new_size);
if (result == 0) return(0);
memcpy(result,p,old_size);
GC_free(p);
return(result);
}
3) In the unlikely case that even relatively small object (<20KB) allocations are triggering these warnings, then your address space contains lots of "bogus pointers", i.e. values that appear to be pointers but aren't. Usually this can be solved by using GC_malloc_atomic or the routines in gc_typed.h to allocate large pointerfree regions of bitmaps, etc. Sometimes the problem can be solved with trivial changes of encoding in certain values. It is possible, though not pleasant, to identify the source of the bogus pointers by setting a breakpoint in GC_add_to_black_list_stack, and looking at the value of current_p in the GC_mark_from_mark_stack frame. Current_p contains the address of the bogus pointer.
4) If you get only a fixed number of these warnings, you are probably only introducing a bounded leak by ignoring them. If the data structures being allocated are intended to be permanent, then it is also safe to ignore them. The warnings can be turned off by calling GC_set_warn_proc with a procedure that ignores these warnings (e.g. by doing absolutely nothing).
****If the collector dies in GC_malloc while trying to remove a free list element:
1) With > 99% probability, you wrote past the end of an allocated object. Try setting GC_DEBUG and using the debugging facilities in gc.h.
****If the heap grows too much:
1) Consider using GC_malloc_atomic for objects containing nonpointers. This is especially important for large arrays containg compressed data, pseudo-random numbers, and the like. (This isn't all that likely to solve your problem, but it's a useful and easy optimization anyway, and this is a good time to try it.) If you allocate large objects containg only one or two pointers at the beginning, either try the typed allocation primitives is gc.h, or separate out the pointerfree component.
2) If you are using the collector in its default mode, with interior pointer recognition enabled, consider using GC_malloc_ignore_off_page to allocate large objects. (See gc.h and above for details. Large means > 100K in most environments.)
3) GC_print_block_list() will print a list of all currently allocated heap blocks and what size objects they contain. GC_print_hblkfreelist() will print a list of free heap blocks, and whether they are blacklisted. GC_dump calls both of these, and also prints information about heap sections, and root segments.
4) Write a tool that traces back references to the appropriate root. Send me the code. (I have code that does this for old PCR.)
****If the collector appears to be losing objects:
1) Replace all calls to GC_malloc_atomic and typed allocation by GC_malloc calls. If this fixes the problem, gradually reinsert your optimizations.
2) You may also want to try the safe(r) pointer manipulation primitives in gc.h. But those are hard to use until the preprocessor becomes available.
3) Try using the GC_DEBUG facilities. This is less likely to be successful here than if the collector crashes.
[The rest of these are primarily for wizards. You shouldn't need them unless you're doing something really strange, or debugging a collector port.]
4) Don't turn on incremental collection. If that fixes the problem, suspect a bug in the dirty bit implementation. Try compiling with -DCHECKSUMS to check for modified, but supposedly clean, pages.
5) On a SPARC, in a single-threaded environment, GC_print_callers(GC_arrays._last_stack) prints a cryptic stack trace as of the time of the last collection. (You will need a debugger to decipher the result.) The question to ask then is "why should this object have been accessible at the time of the last collection? Where was a pointer to it stored?". This facility should be easy to add for some other collector ports (namely if it's easy to traverse stack frames), but will be hard for others.
6) "print *GC_find_header(p)" in dbx or gdb will print the garbage collector block header information associated with the object p (e.g. object size, etc.)
7) GC_is_marked(p) determines whether p is the base address of a marked object. Note that objects allocated since the last collection should not be marked, and that unmarked objects are reclaimed incrementally. It's usually most interesting to set a breakpoint in GC_finish_collection and then to determine how much of the damaged data structure is marked at that point.
8) Look at the tracing facility in mark.c. (Ignore this suggestion unless you are very familiar with collector internals.)

View File

@ -1,12 +0,0 @@
[Original version supplied by Xiaokun Zhu <xiaokun@aero.gla.ac.uk>]
[This version came mostly from Gary Leavens. ]
Look first at Makefile.dj, and possibly change the definitions of
RM and MV if you don't have rm and mv installed.
Then use Makefile.dj to compile the garbage collector.
For example, you can do:
make -f Makefile.dj test
All the tests should work fine.

View File

@ -1,9 +0,0 @@
Dynamic loading support requires that executables be linked with -ldld.
The alternative is to build the collector without defining DYNAMIC_LOADING
in config.h and ensuring that all garbage collectable objects are
accessible without considering statically allocated variables in dynamic
libraries.
The collector should compile with either plain cc or cc -Ae. CC -Aa
fails to define _HPUX_SOURCE and thus will not configure the collector
correctly.

View File

@ -1,39 +0,0 @@
See README.alpha for Linux on DEC AXP info. This file applies to
Linux/Intel.
Incremental GC is supported.
Dynamic libraries are supported on an ELF system. A static executable
should be linked with the gcc option "-Wl,-defsym,_DYNAMIC=0".
The collector appears to work with Linux threads. We have seen
intermittent hangs in sem_wait. So far we have been unable to reproduce
these unless the process was being debugged or traced. Thus it's
possible that the only real issue is that the debugger loses
signals on rare occasions.
The garbage collector uses SIGPWR and SIGXCPU if it is used with
Linux threads. These should not be touched by the client program.
To use threads, you need to abide by the following requirements:
1) You need to use LinuxThreads (which are included in libc6).
The collector relies on some implementation details of the LinuxThreads
package. It is unlikely that this code will work on other
pthread implementations (in particular it will *not* work with
MIT pthreads).
2) You must compile the collector with -DLINUX_THREADS and -D_REENTRANT
specified in the Makefile.
3) Every file that makes thread calls should define LINUX_THREADS and
_REENTRANT and then include gc.h. Gc.h redefines some of the
pthread primitives as macros which also provide the collector with
information it requires.
4) Currently dlopen() is probably not safe. The collector must traverse
the list of libraries maintained by the runtime loader. That can
probably be an inconsistent state when a thread calling the loader is
is stopped for GC. (It's possible that this is fixable in the
same way it is handled for SOLARIS_THREADS, with GC_dlopen.)

View File

@ -1,6 +0,0 @@
We have so far failed to find a good way to determine the stack base.
It is highly recommended that GC_stackbottom be set explicitly on program
startup. The supplied value sometimes causes failure under AIX 4.1, though
it appears to work under 3.X. HEURISTIC2 seems to work under 4.1, but
involves a substantial performance penalty, and will fail if there is
no limit on stack size.

View File

@ -1,37 +0,0 @@
Performance of the incremental collector can be greatly enhanced with
-DNO_EXECUTE_PERMISSION.
The collector should run with all of the -32, -n32 and -64 ABIs. Remember to
define the AS macro in the Makefile to be "as -64", or "as -n32".
If you use -DREDIRECT_MALLOC=GC_malloc with C++ code, your code should make
at least one explicit call to malloc instead of new to ensure that the proper
version of malloc is linked in.
Sproc threads are not supported in this version, though there may exist other
ports.
Pthreads support is provided. This requires that:
1) You compile the collector with -DIRIX_THREADS specified in the Makefile.
2) You have the latest pthreads patches installed.
(Though the collector makes only documented pthread calls,
it relies on signal/threads interactions working just right in ways
that are not required by the standard. It is unlikely that this code
will run on other pthreads platforms. But please tell me if it does.)
3) Every file that makes thread calls should define IRIX_THREADS and then
include gc.h. Gc.h redefines some of the pthread primitives as macros which
also provide the collector with information it requires.
4) pthread_cond_wait and pthread_cond_timed_wait should be prepared for
premature wakeups. (I believe the pthreads and realted standards require this
anyway. Irix pthreads often terminate a wait if a signal arrives.
The garbage collector uses signals to stop threads.)
5) It is expensive to stop a thread waiting in IO at the time the request is
initiated. Applications with many such threads may not exhibit acceptable
performance with the collector. (Increasing the heap size may help.)

View File

@ -1,65 +0,0 @@
The collector supports both incremental collection and threads under
Solaris 2. The incremental collector normally retrieves page dirty information
through the appropriate /proc calls. But it can also be configured
(by defining MPROTECT_VDB instead of PROC_VDB in config.h) to use mprotect
and signals. This may result in shorter pause times, but it is no longer
safe to issue arbitrary system calls that write to the heap.
Under other UNIX versions,
the collector normally obtains memory through sbrk. There is some reason
to expect that this is not safe if the client program also calls the system
malloc, or especially realloc. The sbrk man page strongly suggests this is
not safe: "Many library routines use malloc() internally, so use brk()
and sbrk() only when you know that malloc() definitely will not be used by
any library routine." This doesn't make a lot of sense to me, since there
seems to be no documentation as to which routines can transitively call malloc.
Nonetheless, under Solaris2, the collector now (since 4.12) allocates
memory using mmap by default. (It defines USE_MMAP in config.h.)
You may want to reverse this decisions if you use -DREDIRECT_MALLOC=...
SOLARIS THREADS:
The collector must be compiled with -DSOLARIS_THREADS to be thread safe.
It is also essential that gc.h be included in files that call thr_create,
thr_join, thr_suspend, thr_continue, or dlopen. Gc.h macro defines
these to also do GC bookkeeping, etc. Gc.h must be included with
SOLARIS_THREADS defined, otherwise these replacements are not visible.
A collector built in this way way only be used by programs that are
linked with the threads library.
If you are using the Pthreads interface, also define _SOLARIS_PTHREADS.
In this mode, the collector contains various workarounds for older Solaris
bugs. Mostly, these should not be noticeable unless you look at system
call traces. However, it cannot protect a guard page at the end of
a thread stack. If you know that you will only be running Solaris2.5
or later, it should be possible to fix this by compiling the collector
with -DSOLARIS23_MPROTECT_BUG_FIXED.
Jeremy Fitzhardinge points out that there is a problem with the dlopen
replacement, in that startup code in the library is run while the allocation
lock is held. This appears to be difficult to fix, since the collector does
look at data structures maintained by dlopen, and hence some locking is needed
around the dlopen call. Defining USE_PROC_FOR_LIBRARIES will get address
space layout information from /proc avoiding the dlopen lock. But this has
other disadvanatages, e.g. mmapped files may be scanned.
If solaris_threads are used on an X86 processor with malloc redirected to
GC_malloc, it is necessary to call GC_thr_init explicitly before forking the
first thread. (This avoids a deadlock arising from calling GC_thr_init
with the allocation lock held.)
It appears that there is a problem in using gc_cpp.h in conjunction with
Solaris threads and Sun's C++ runtime. Apparently the overloaded new operator
is invoked by some iostream initialization code before threads are correctly
initialized. As a result, call to thr_self() in garbage collector
initialization segfaults. Currently the only known workaround is to not
invoke the garbage collector from a user defined global operator new, or to
have it invoke the garbage-collector's allocators only after main has started.
(Note that the latter requires a moderately expensive test in operator
delete.)
Hans-J. Boehm
(The above contains my personal opinions, which are probably not shared
by anyone else.)

View File

@ -1,2 +0,0 @@
Alistair Crooks supplied the port. He used Lexa C version 2.1.3 with
-Xa to compile.

View File

@ -1,163 +0,0 @@
The collector has only been compiled under Windows NT, with the
original Microsoft SDK, with Visual C++ 2.0 and later, with
the GNU win32 environment, with Borland 4.5, and recently with
Watcom C.
It runs under both win32s and win32, but with different semantics.
Under win32, all writable pages outside of the heaps and stack are
scanned for roots. Thus the collector sees pointers in DLL data
segments. Under win32s, only the main data segment is scanned.
(The main data segment should always be scanned. Under some
versions of win32s, other regions may also be scanned.)
Thus all accessible objects should be accessible from local variables
or variables in the main data segment. Alternatively, other data
segments (e.g. in DLLs) may be registered with the collector by
calling GC_init() and then GC_register_root_section(a), where
a is the address of some variable inside the data segment. (Duplicate
registrations are ignored, but not terribly quickly.)
(There are two reasons for this. We didn't want to see many 16:16
pointers. And the VirtualQuery call has different semantics under
the two systems, and under different versions of win32s.)
The collector test program "gctest" is linked as a GUI application,
but does not open any windows. Its output appears in the file
"gc.log". It may be started from the file manager. The hour glass
cursor will appear as long as it's running.
The cord test program has not been ported (but should port
easily). A toy editor (cord/de.exe) based on cords (heavyweight
strings represented as trees) has been ported and is included.
It runs fine under either win32 or win32S. It serves as an example
of a true Windows application, except that it was written by a
nonexpert Windows programmer. (There are some peculiarities
in the way files are displayed. The <cr> is displayed explicitly
for standard DOS text files. As in the UNIX version, control
characters are displayed explicitly, but in this case as red text.
This may be suboptimal for some tastes and/or sets of default
window colors.)
For Microsoft development tools, rename NT_MAKEFILE as
MAKEFILE. (Make sure that the CPU environment variable is defined
to be i386.)
For GNU-win32, use the regular makefile, possibly after uncommenting
the line "include Makefile.DLLs". The latter should be necessary only
if you want to package the collector as a DLL. The GNU-win32 port is
believed to work only for b18, not b19, probably dues to linker changes
in b19. This is probably fixable with a different definition of
DATASTART and DATAEND in config.h.
For Borland tools, use BCC_MAKEFILE. Note that
Borland's compiler defaults to 1 byte alignment in structures (-a1),
whereas Visual C++ appears to default to 8 byte alignment (/Zp8).
The garbage collector in its default configuration EXPECTS AT
LEAST 4 BYTE ALIGNMENT. Thus the BORLAND DEFAULT MUST
BE OVERRIDDEN. (In my opinion, it should usually be anyway.
I expect that -a1 introduces major performance penalties on a
486 or Pentium.) Note that this changes structure layouts. (As a last
resort, config.h can be changed to allow 1 byte alignment. But
this has significant negative performance implications.)
The Makefile is set up to assume Borland 4.5. If you have another
version, change the line near the top. By default, it does not
require the assembler. If you do have the assembler, I recommend
removing the -DUSE_GENERIC.
Incremental collection support was recently added. This is
currently pretty simpleminded. Pages are protected. Protection
faults are caught by a handler installed at the bottom of the handler
stack. This is both slow and interacts poorly with a debugger.
Whenever possible, I recommend adding a call to
GC_enable_incremental at the last possible moment, after most
debugging is complete. Unlike the UNIX versions, no system
calls are wrapped by the collector itself. It may be necessary
to wrap ReadFile calls that use a buffer in the heap, so that the
call does not encounter a protection fault while it's running.
(As usual, none of this is an issue unless GC_enable_incremental
is called.)
Note that incremental collection is disabled with -DSMALL_CONFIG,
which is the default for win32. If you need incremental collection,
undefine SMALL_CONFIG.
Incremental collection is not supported under win32s, and it may not
be possible to do so. However, win32 applications that attempt to use
incremental collection should continue to run, since the
collector detects if it's running under win32s and turns calls to
GC_enable_incremental() into noops.
James Clark has contributed the necessary code to support win32 threads.
This code is known to exhibit some problems with incremental collection
enabled. Use NT_THREADS_MAKEFILE (a.k.a gc.mak) instead of NT_MAKEFILE
to build this version. Note that this requires some files whose names
are more than 8 + 3 characters long. Thus you should unpack the tar file
so that long file names are preserved. To build the garbage collector
test with VC++ from the command line, use
nmake /F ".\gc.mak" CFG="gctest - Win32 Release"
This requires that the subdirectory gctest\Release exist.
This version relies on the collector residing in a dll.
This version currently supports incremental collection only if it is
enabled before any additional threads are created.
It is known to not be completely solid. At a minimum it can deadlock
if a thread starts in the middle of an allocation. There may be
other problems. If you need solid support for win32 threads, you
check with Geodesic Systems. I haven't tried it, but they claim
to support it.
Hans
Ivan V. Demakov's README for the Watcom port:
[ He points out in a later message that there may be a problem compiling
under Windows-3.11 for Windows NT. ]
Watcom C/C++ 10.5, 10.6, 11.0 tested.
The collector runs on WIN32 and DOS4GW dos-extender with both
stack and register based calling conventions (options -5r and -5s).
Incremental collection not supported.
OS/2 not tested, but should work (only some #ifdef's added for OS/2 port).
cord not ported. Watcom C fails to compile it, from first attempt.
Since I don't use it, I don't try to fix it.
cpp_test succeeds, but not compiled automaticaly with WCC_MAKEFILE.
My changes:
* config.h Added definitions for Watcom C/C++.
Undefined MPROTECT_VDB for Watcom C/C++ MSWIN32,
I don't have idea why it not work.
* gc.h Explicitly declared GC_noop. This prevents
program crash, compiled with -5r option.
* gc_priv.h Changed declaration for GC_push_one to make
compiler happy.
Added GC_dos4gw_get_mem declaration and
GET_MEM uses it in DOS4GW environment.
* os_dep.c Added __WATCOMC__ and DOS4GW #ifdef's.
Added GC_dos4gw_get_mem.
* mach_dep.c For Watcom used setjmp method of marking registers.
* WCC_MAKEFILE New file. Makefile for Watcom C/C++.
* gc_watcom.asm New file. Some functions for DOS4GW.
This functions may (probably) be done in C,
but I can't figure out how do this for all
possible options of compiler.
* README.watcom This file.
Ivan Demakov (email: dem@tgrad.nsk.su)

View File

@ -1,16 +0,0 @@
CPU=68030
NOSTACKCHECK
OPTIMIZE
VERBOSE
MAPHUNK
NOVERSION
NOICONS
OPTIMIZERTIME
DEFINE SILENT
DEFINE AMIGA_SKIP_SEG
IGNORE=85
IGNORE=154
IGNORE=161
IGNORE=100
OPTIMIZERCOMPLEXITY=4
OPTIMIZERDEPTH=3

View File

@ -1,48 +0,0 @@
OBJS= alloc.o reclaim.o allchblk.o misc.o mach_dep.o os_dep.o mark_rts.o headers.o mark.o obj_map.o blacklst.o finalize.o new_hblk.o real_malloc.o dyn_load.o dbg_mlc.o malloc.o stubborn.o checksums.o typd_mlc.o ptr_chck.o
INC= gc_private.h gc_hdrs.h gc.h config.h
all: gctest setjmp_t
alloc.o : alloc.c $(INC)
reclaim.o : reclaim.c $(INC)
allchblk.o : allchblk.c $(INC)
misc.o : misc.c $(INC)
os_dep.o : os_dep.c $(INC)
mark_rts.o : mark_rts.c $(INC)
headers.o : headers.c $(INC)
mark.o : mark.c $(INC)
obj_map.o : obj_map.c $(INC)
blacklst.o : blacklst.c $(INC)
finalize.o : finalize.c $(INC)
sc noopt finalize.c # There seems to be a bug in the optimizer (V6.51).
# gctest won't work if you remove this...
new_hblk.o : new_hblk.c $(INC)
real_malloc.o : real_malloc.c $(INC)
dyn_load.o : dyn_load.c $(INC)
dbg_mlc.o : dbg_mlc.c $(INC)
malloc.o : malloc.c $(INC)
mallocx.o : malloc.c $(INC)
stubborn.o : stubborn.c $(INC)
checksums.o : checksums.c $(INC)
typd_mlc.o: typd_mlc.c $(INC)
mach_dep.o : mach_dep.c $(INC)
ptr_chck.o: ptr_chck.c $(INC)
test.o : test.c $(INC)
gc.lib: $(OBJS)
oml gc.lib r $(OBJS)
clean:
delete gc.lib gctest setjmp_t \#?.o
gctest: gc.lib test.o
slink LIB:c.o test.o to $@ lib gc.lib LIB:sc.lib LIB:scm.lib
setjmp_t: setjmp_t.c gc.h
sc setjmp_t.c
slink LIB:c.o $@.o to $@ lib LIB:sc.lib
test: setjmp_t gctest
setjmp_t
gctest

View File

@ -1,123 +0,0 @@
# Makefile for Watcom C/C++ 10.5, 10.6, 11.0 on NT, OS2 and DOS4GW .
# May work with Watcom 10.0 .
#
#
# Uncoment one of line for cross compiling
#SYSTEM=DOS4GW
#SYSTEM=MSWIN32
#SYSTEM=OS2
!ifndef SYSTEM
!ifdef __MSDOS__
SYSTEM=DOS4GW
!endif
!ifdef __NT__
SYSTEM=MSWIN32
!endif
!ifdef __OS2__
SYSTEM=OS2
!endif
D_SYSTEM=
!else
D_SYSTEM=-D$(SYSTEM)
!endif
!define $(SYSTEM)
CC=wcc386
CXX=wpp386
AS=wasm
# Watcom before 11.0 not support option -oh
# Remove it if you get error
OPTIM=-oneatxh -s
CALLING=-5s
DEFS=-DALL_INTERIOR_POINTERS -DSILENT #-DSMALL_CONFIG #-DGC_DEBUG
# ! -DUSE_GENERIC required !
CFLAGS=$(OPTIM) -zp4 $(CALLING) -zc -DUSE_GENERIC $(D_SYSTEM) $(DEFS)
CXXFLAGS= $(CFLAGS)
ASFLAGS=$(CALLING)
OBJS= alloc.obj reclaim.obj allchblk.obj misc.obj &
mach_dep.obj os_dep.obj mark_rts.obj headers.obj mark.obj &
obj_map.obj blacklst.obj finalize.obj new_hblk.obj &
dbg_mlc.obj malloc.obj stubborn.obj dyn_load.obj &
typd_mlc.obj ptr_chck.obj gc_cpp.obj mallocx.obj
all: gc.lib gctest.exe
# this file required for DOS4GW only
gc_watcom.obj: gc_watcom.asm WCC_MAKEFILE
$(AS) $(ASFLAGS) gc_watcom.asm
!ifdef DOS4GW
gc.lib: $(OBJS) gc_watcom.obj
@%create $*.lb1
@for %i in ($(OBJS)) do @%append $*.lb1 +'%i'
@@%append $*.lb1 +'gc_watcom.obj'
*wlib -b -c -n -p=512 $@ @$*.lb1
!else
gc.lib: $(OBJS)
@%create $*.lb1
@for %i in ($(OBJS)) do @%append $*.lb1 +'%i'
*wlib -b -c -n -p=512 $@ @$*.lb1
!endif
test.obj: test.c
$(CC) $(CFLAGS) $*.c
gctest.exe: test.obj gc.lib
%create $*.lnk
!ifdef DOS4GW
@%append $*.lnk sys dos4g
!endif
!ifdef MSWIN32
@%append $*.lnk sys nt
!endif
!ifdef OS2
@%append $*.lnk sys os2v2
!endif
@%append $*.lnk op case
@%append $*.lnk op stack=256K
@%append $*.lnk name $*
@%append $*.lnk file test.obj
@%append $*.lnk library gc.lib
*wlink @$*.lnk
.c.obj: .AUTODEPEND
$(CC) $(CFLAGS) $*.c
.cc.obj: .AUTODEPEND
$(CXX) $(CXXFLAGS) $*.cc
.cpp.obj: .AUTODEPEND
$(CXX) $(CXXFLAGS) $*.cpp
clean : .SYMBOLIC
@if exist *.obj del *.obj
@if exist *.map del *.map
@if exist *.lnk del *.lnk
@if exist *.lb1 del *.lb1
@if exist *.sym del *.sym
@if exist *.err del *.err
@if exist *.tmp del *.tmp
@if exist *.lst del *.lst
@if exist *.exe del *.exe
@if exist *.log del *.log

View File

@ -1,153 +0,0 @@
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(BOEHM_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
boehm_gc_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(boehm_gc_basedir)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(boehm-gc, 4.13a2, no-define)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
# run it explicitly here, it will be run implicitly before
# NEWLIB_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which can't create executables. So we include AC_EXEEXT to keep
# automake happy, but we don't execute it, since we don't care about
# the result.
if false; then
AC_EXEEXT
fi
. [$]{boehm_gc_basedir}/configure.host
case [$]{boehm_gc_basedir} in
/* | [A-Za-z]:[/\\]*) boehm_gc_flagbasedir=[$]{boehm_gc_basedir} ;;
*) boehm_gc_flagbasedir='[$](top_builddir)/'[$]{boehm_gc_basedir} ;;
esac
boehm_gc_cflags="[$]{boehm_gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{boehm_gc_flagbasedir}/libc/include"
case "${host}" in
*-*-cygwin32*)
boehm_gc_cflags="[$]{boehm_gc_cflags} -I[$]{boehm_gc_flagbasedir}/../winsup/include"
;;
esac
boehm_gc_cflags="[$]{boehm_gc_cflags} -fno-builtin"
BOEHM_GC_CFLAGS=${boehm_gc_cflags}
AC_SUBST(BOEHM_GC_CFLAGS)
]))
))))

542
boehm-gc/aclocal.m4 vendored
View File

@ -1,542 +0,0 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(BOEHM_CONFIGURE,
[
dnl Default to --enable-multilib
AC_ARG_ENABLE(multilib,
[ --enable-multilib build many library versions (default)],
[case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
esac], [multilib=yes])dnl
dnl We may get other options which we don't document:
dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
if test "[$]{srcdir}" = "."; then
if test "[$]{with_target_subdir}" != "."; then
boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
else
boehm_gc_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
fi
else
boehm_gc_basedir="[$]{srcdir}/$1"
fi
AC_SUBST(boehm_gc_basedir)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE(boehm-gc, 4.13a2, no-define)
# FIXME: We temporarily define our own version of AC_PROG_CC. This is
# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
# are probably using a cross compiler, which will not be able to fully
# link an executable. This should really be fixed in autoconf
# itself.
AC_DEFUN(LIB_AC_PROG_CC,
[AC_BEFORE([$0], [AC_PROG_CPP])dnl
AC_CHECK_PROG(CC, gcc, gcc)
if test -z "$CC"; then
AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
fi
AC_PROG_CC_GNU
if test $ac_cv_prog_gcc = yes; then
GCC=yes
dnl Check whether -g works, even if CFLAGS is set, in case the package
dnl plays around with CFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
AC_PROG_CC_G
if test "$ac_test_CFLAGS" = set; then
CFLAGS="$ac_save_CFLAGS"
elif test $ac_cv_prog_cc_g = yes; then
CFLAGS="-g -O2"
else
CFLAGS="-O2"
fi
else
GCC=
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
])
LIB_AC_PROG_CC
# Likewise for AC_PROG_CXX.
AC_DEFUN(LIB_AC_PROG_CXX,
[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
AC_PROG_CXX_GNU
if test $ac_cv_prog_gxx = yes; then
GXX=yes
dnl Check whether -g works, even if CXXFLAGS is set, in case the package
dnl plays around with CXXFLAGS (such as to build both debugging and
dnl normal versions of a library), tasteless as that idea is.
ac_test_CXXFLAGS="${CXXFLAGS+set}"
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS=
AC_PROG_CXX_G
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-O2"
fi
else
GXX=
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
fi
])
LIB_AC_PROG_CXX
# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we don't
# run it explicitly here, it will be run implicitly before
# NEWLIB_CONFIGURE, which doesn't work because that means that it will
# be run before AC_CANONICAL_HOST.
AC_CANONICAL_BUILD
AC_CHECK_TOOL(AS, as)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
AM_MAINTAINER_MODE
# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
# at least currently, we never actually build a program, so we never
# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
# fails, because we are probably configuring with a cross compiler
# which can't create executables. So we include AC_EXEEXT to keep
# automake happy, but we don't execute it, since we don't care about
# the result.
if false; then
AC_EXEEXT
fi
. [$]{boehm_gc_basedir}/configure.host
case [$]{boehm_gc_basedir} in
/* | [A-Za-z]:[/\\]*) boehm_gc_flagbasedir=[$]{boehm_gc_basedir} ;;
*) boehm_gc_flagbasedir='[$](top_builddir)/'[$]{boehm_gc_basedir} ;;
esac
boehm_gc_cflags="[$]{boehm_gc_cflags} -I"'[$](top_builddir)'"/$1/targ-include -I[$]{boehm_gc_flagbasedir}/libc/include"
case "${host}" in
*-*-cygwin32*)
boehm_gc_cflags="[$]{boehm_gc_cflags} -I[$]{boehm_gc_flagbasedir}/../winsup/include"
;;
esac
boehm_gc_cflags="[$]{boehm_gc_cflags} -fno-builtin"
BOEHM_GC_CFLAGS=${boehm_gc_cflags}
AC_SUBST(BOEHM_GC_CFLAGS)
]))
))))
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
# serial 1
AC_DEFUN(AM_MAINTAINER_MODE,
[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode is disabled by default
AC_ARG_ENABLE(maintainer-mode,
[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
USE_MAINTAINER_MODE=$enableval,
USE_MAINTAINER_MODE=no)
AC_MSG_RESULT($USE_MAINTAINER_MODE)
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST(MAINT)dnl
]
)
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
# serial 25 AM_PROG_LIBTOOL
AC_DEFUN(AM_PROG_LIBTOOL,
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
AC_REQUIRE([AM_ENABLE_STATIC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AM_PROG_LD])dnl
AC_REQUIRE([AM_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Check for any special flags to pass to ltconfig.
libtool_flags=
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$host" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
CFLAGS="$CFLAGS -belf"
;;
*-*-cygwin32*)
AM_SYS_LIBTOOL_CYGWIN32
;;
esac
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
DLLTOOL="$DLLTOOL" AS="$AS" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|| AC_MSG_ERROR([libtool configure failed])
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
# AM_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AM_ENABLE_SHARED,
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
])
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AM_DISABLE_SHARED,
[AM_ENABLE_SHARED(no)])
# AM_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AM_DISABLE_STATIC,
[AM_ENABLE_STATIC(no)])
# AM_ENABLE_STATIC - implement the --enable-static flag
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AM_ENABLE_STATIC,
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
])
# AM_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AM_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
/* | [A-Za-z]:\\*)
changequote([,])dnl
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_SUBST(LD)
AM_PROG_LD_GNU
])
AC_DEFUN(AM_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AM_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AM_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
else
ac_cv_path_NM="$ac_dir/nm"
fi
break
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
AC_SUBST(NM)
])
# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
])

View File

@ -1,14 +0,0 @@
# include <stdio.h>
int main(argc, argv, envp)
int argc;
char ** argv;
char ** envp;
{
int i;
for (i = 1; i < argc; i++) {
printf("gc/%s ", argv[i]);
}
return(0);
}

View File

@ -1,408 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1998 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, August 9, 1995 5:08 pm PDT */
#define DEBUG
#undef DEBUG
#include <stdio.h>
#include "gc_priv.h"
/*
* allocate/free routines for heap blocks
* Note that everything called from outside the garbage collector
* should be prepared to abort at any point as the result of a signal.
*/
/*
* Free heap blocks are kept on a list sorted by address.
* The hb_hdr.hbh_sz field of a free heap block contains the length
* (in bytes) of the entire block.
* Neighbors are coalesced.
*/
# define MAX_BLACK_LIST_ALLOC (2*HBLKSIZE)
/* largest block we will allocate starting on a black */
/* listed block. Must be >= HBLKSIZE. */
struct hblk * GC_hblkfreelist = 0;
struct hblk *GC_savhbp = (struct hblk *)0; /* heap block preceding next */
/* block to be examined by */
/* GC_allochblk. */
# if !defined(NO_DEBUGGING)
void GC_print_hblkfreelist()
{
struct hblk * h = GC_hblkfreelist;
word total_free = 0;
hdr * hhdr = HDR(h);
word sz;
while (h != 0) {
sz = hhdr -> hb_sz;
GC_printf2("0x%lx size %lu ", (unsigned long)h, (unsigned long)sz);
total_free += sz;
if (GC_is_black_listed(h, HBLKSIZE) != 0) {
GC_printf0("start black listed\n");
} else if (GC_is_black_listed(h, hhdr -> hb_sz) != 0) {
GC_printf0("partially black listed\n");
} else {
GC_printf0("not black listed\n");
}
h = hhdr -> hb_next;
hhdr = HDR(h);
}
GC_printf1("Total of %lu bytes on free list\n", (unsigned long)total_free);
}
# endif /* NO_DEBUGGING */
/* Initialize hdr for a block containing the indicated size and */
/* kind of objects. */
/* Return FALSE on failure. */
static GC_bool setup_header(hhdr, sz, kind, flags)
register hdr * hhdr;
word sz; /* object size in words */
int kind;
unsigned char flags;
{
register word descr;
/* Add description of valid object pointers */
if (!GC_add_map_entry(sz)) return(FALSE);
hhdr -> hb_map = GC_obj_map[sz > MAXOBJSZ? 0 : sz];
/* Set size, kind and mark proc fields */
hhdr -> hb_sz = sz;
hhdr -> hb_obj_kind = kind;
hhdr -> hb_flags = flags;
descr = GC_obj_kinds[kind].ok_descriptor;
if (GC_obj_kinds[kind].ok_relocate_descr) descr += WORDS_TO_BYTES(sz);
hhdr -> hb_descr = descr;
/* Clear mark bits */
GC_clear_hdr_marks(hhdr);
hhdr -> hb_last_reclaimed = (unsigned short)GC_gc_no;
return(TRUE);
}
#ifdef EXACT_FIRST
# define LAST_TRIP 2
#else
# define LAST_TRIP 1
#endif
/*
* Allocate (and return pointer to) a heap block
* for objects of size sz words.
*
* NOTE: We set obj_map field in header correctly.
* Caller is resposnsible for building an object freelist in block.
*
* We clear the block if it is destined for large objects, and if
* kind requires that newly allocated objects be cleared.
*/
struct hblk *
GC_allochblk(sz, kind, flags)
word sz;
int kind;
unsigned char flags; /* IGNORE_OFF_PAGE or 0 */
{
register struct hblk *thishbp;
register hdr * thishdr; /* Header corr. to thishbp */
register struct hblk *hbp;
register hdr * hhdr; /* Header corr. to hbp */
struct hblk *prevhbp;
register hdr * phdr; /* Header corr. to prevhbp */
signed_word size_needed; /* number of bytes in requested objects */
signed_word size_avail; /* bytes available in this block */
int trip_count = 0;
size_needed = HBLKSIZE * OBJ_SZ_TO_BLOCKS(sz);
/* search for a big enough block in free list */
hbp = GC_savhbp;
hhdr = HDR(hbp);
for(;;) {
prevhbp = hbp;
phdr = hhdr;
hbp = (prevhbp == 0? GC_hblkfreelist : phdr->hb_next);
hhdr = HDR(hbp);
if( prevhbp == GC_savhbp) {
if (trip_count == LAST_TRIP) return(0);
++trip_count;
}
if( hbp == 0 ) continue;
size_avail = hhdr->hb_sz;
# ifdef EXACT_FIRST
if (trip_count <= 1 && size_avail != size_needed) continue;
# endif
if (size_avail < size_needed) continue;
# ifdef PRESERVE_LAST
if (size_avail != size_needed
&& !GC_incremental
&& GC_in_last_heap_sect(hbp) && GC_should_collect()) {
continue;
}
# endif
/* If the next heap block is obviously better, go on. */
/* This prevents us from disassembling a single large block */
/* to get tiny blocks. */
{
signed_word next_size;
thishbp = hhdr -> hb_next;
if (thishbp == 0) thishbp = GC_hblkfreelist;
thishdr = HDR(thishbp);
next_size = (signed_word)(thishdr -> hb_sz);
if (next_size < size_avail
&& next_size >= size_needed
&& !GC_is_black_listed(thishbp, (word)size_needed)) {
continue;
}
}
if ( !IS_UNCOLLECTABLE(kind) &&
(kind != PTRFREE || size_needed > MAX_BLACK_LIST_ALLOC)) {
struct hblk * lasthbp = hbp;
ptr_t search_end = (ptr_t)hbp + size_avail - size_needed;
signed_word orig_avail = size_avail;
signed_word eff_size_needed = ((flags & IGNORE_OFF_PAGE)?
HBLKSIZE
: size_needed);
while ((ptr_t)lasthbp <= search_end
&& (thishbp = GC_is_black_listed(lasthbp,
(word)eff_size_needed))) {
lasthbp = thishbp;
}
size_avail -= (ptr_t)lasthbp - (ptr_t)hbp;
thishbp = lasthbp;
if (size_avail >= size_needed) {
if (thishbp != hbp && GC_install_header(thishbp)) {
/* Split the block at thishbp */
thishdr = HDR(thishbp);
/* GC_invalidate_map not needed, since we will */
/* allocate this block. */
thishdr -> hb_next = hhdr -> hb_next;
thishdr -> hb_sz = size_avail;
hhdr -> hb_sz = (ptr_t)thishbp - (ptr_t)hbp;
hhdr -> hb_next = thishbp;
/* Advance to thishbp */
prevhbp = hbp;
phdr = hhdr;
hbp = thishbp;
hhdr = thishdr;
}
} else if (size_needed > (signed_word)BL_LIMIT
&& orig_avail - size_needed
> (signed_word)BL_LIMIT) {
/* Punt, since anything else risks unreasonable heap growth. */
WARN("Needed to allocate blacklisted block at 0x%lx\n",
(word)hbp);
thishbp = hbp;
size_avail = orig_avail;
} else if (size_avail == 0
&& size_needed == HBLKSIZE
&& prevhbp != 0) {
# ifndef FIND_LEAK
static unsigned count = 0;
/* The block is completely blacklisted. We need */
/* to drop some such blocks, since otherwise we spend */
/* all our time traversing them if pointerfree */
/* blocks are unpopular. */
/* A dropped block will be reconsidered at next GC. */
if ((++count & 3) == 0) {
/* Allocate and drop the block in small chunks, to */
/* maximize the chance that we will recover some */
/* later. */
struct hblk * limit = hbp + (hhdr->hb_sz/HBLKSIZE);
struct hblk * h;
GC_words_wasted += hhdr->hb_sz;
phdr -> hb_next = hhdr -> hb_next;
for (h = hbp; h < limit; h++) {
if (h == hbp || GC_install_header(h)) {
hhdr = HDR(h);
(void) setup_header(
hhdr,
BYTES_TO_WORDS(HBLKSIZE - HDR_BYTES),
PTRFREE, 0); /* Cant fail */
if (GC_debugging_started) {
BZERO(hbp + HDR_BYTES, HBLKSIZE - HDR_BYTES);
}
}
}
/* Restore hbp to point at free block */
if (GC_savhbp == hbp) GC_savhbp = prevhbp;
hbp = prevhbp;
hhdr = phdr;
if (hbp == GC_savhbp) --trip_count;
}
# endif
}
}
if( size_avail >= size_needed ) {
/* found a big enough block */
/* let thishbp --> the block */
/* set prevhbp, hbp to bracket it */
thishbp = hbp;
thishdr = hhdr;
if( size_avail == size_needed ) {
hbp = hhdr->hb_next;
hhdr = HDR(hbp);
} else {
hbp = (struct hblk *)
(((word)thishbp) + size_needed);
if (!GC_install_header(hbp)) {
hbp = thishbp;
continue;
}
hhdr = HDR(hbp);
GC_invalidate_map(hhdr);
hhdr->hb_next = thishdr->hb_next;
hhdr->hb_sz = size_avail - size_needed;
}
/* remove *thishbp from hblk freelist */
if( prevhbp == 0 ) {
GC_hblkfreelist = hbp;
} else {
phdr->hb_next = hbp;
}
/* save current list search position */
GC_savhbp = hbp;
break;
}
}
/* Notify virtual dirty bit implementation that we are about to write. */
GC_write_hint(thishbp);
/* Add it to map of valid blocks */
if (!GC_install_counts(thishbp, (word)size_needed)) return(0);
/* This leaks memory under very rare conditions. */
/* Set up header */
if (!setup_header(thishdr, sz, kind, flags)) {
GC_remove_counts(thishbp, (word)size_needed);
return(0); /* ditto */
}
/* Clear block if necessary */
if (GC_debugging_started
|| sz > MAXOBJSZ && GC_obj_kinds[kind].ok_init) {
BZERO(thishbp + HDR_BYTES, size_needed - HDR_BYTES);
}
/* We just successfully allocated a block. Restart count of */
/* consecutive failures. */
{
extern unsigned GC_fail_count;
GC_fail_count = 0;
}
return( thishbp );
}
struct hblk * GC_freehblk_ptr = 0; /* Search position hint for GC_freehblk */
/*
* Free a heap block.
*
* Coalesce the block with its neighbors if possible.
*
* All mark words are assumed to be cleared.
*/
void
GC_freehblk(p)
register struct hblk *p;
{
register hdr *phdr; /* Header corresponding to p */
register struct hblk *hbp, *prevhbp;
register hdr *hhdr, *prevhdr;
register signed_word size;
/* GC_savhbp may become invalid due to coalescing. Clear it. */
GC_savhbp = (struct hblk *)0;
phdr = HDR(p);
size = phdr->hb_sz;
size = HBLKSIZE * OBJ_SZ_TO_BLOCKS(size);
GC_remove_counts(p, (word)size);
phdr->hb_sz = size;
GC_invalidate_map(phdr);
prevhbp = 0;
/* The following optimization was suggested by David Detlefs. */
/* Note that the header cannot be NIL, since there cannot be an */
/* intervening call to GC_freehblk without resetting */
/* GC_freehblk_ptr. */
if (GC_freehblk_ptr != 0 &&
HDR(GC_freehblk_ptr)->hb_map == GC_invalid_map &&
(ptr_t)GC_freehblk_ptr < (ptr_t)p) {
hbp = GC_freehblk_ptr;
} else {
hbp = GC_hblkfreelist;
};
hhdr = HDR(hbp);
while( (hbp != 0) && (hbp < p) ) {
prevhbp = hbp;
prevhdr = hhdr;
hbp = hhdr->hb_next;
hhdr = HDR(hbp);
}
GC_freehblk_ptr = prevhbp;
/* Check for duplicate deallocation in the easy case */
if (hbp != 0 && (ptr_t)p + size > (ptr_t)hbp
|| prevhbp != 0 && (ptr_t)prevhbp + prevhdr->hb_sz > (ptr_t)p) {
GC_printf1("Duplicate large block deallocation of 0x%lx\n",
(unsigned long) p);
GC_printf2("Surrounding free blocks are 0x%lx and 0x%lx\n",
(unsigned long) prevhbp, (unsigned long) hbp);
}
/* Coalesce with successor, if possible */
if( (((word)p)+size) == ((word)hbp) ) {
phdr->hb_next = hhdr->hb_next;
phdr->hb_sz += hhdr->hb_sz;
GC_remove_header(hbp);
} else {
phdr->hb_next = hbp;
}
if( prevhbp == 0 ) {
GC_hblkfreelist = p;
} else if( (((word)prevhbp) + prevhdr->hb_sz)
== ((word)p) ) {
/* Coalesce with predecessor */
prevhdr->hb_next = phdr->hb_next;
prevhdr->hb_sz += phdr->hb_sz;
GC_remove_header(p);
} else {
prevhdr->hb_next = p;
}
}

View File

@ -1,853 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* Boehm, February 16, 1996 2:26 pm PST */
# include "gc_priv.h"
# include <stdio.h>
# ifndef MACOS
# include <signal.h>
# include <sys/types.h>
# endif
/*
* Separate free lists are maintained for different sized objects
* up to MAXOBJSZ.
* The call GC_allocobj(i,k) ensures that the freelist for
* kind k objects of size i points to a non-empty
* free list. It returns a pointer to the first entry on the free list.
* In a single-threaded world, GC_allocobj may be called to allocate
* an object of (small) size i as follows:
*
* opp = &(GC_objfreelist[i]);
* if (*opp == 0) GC_allocobj(i, NORMAL);
* ptr = *opp;
* *opp = obj_link(ptr);
*
* Note that this is very fast if the free list is non-empty; it should
* only involve the execution of 4 or 5 simple instructions.
* All composite objects on freelists are cleared, except for
* their first word.
*/
/*
* The allocator uses GC_allochblk to allocate large chunks of objects.
* These chunks all start on addresses which are multiples of
* HBLKSZ. Each allocated chunk has an associated header,
* which can be located quickly based on the address of the chunk.
* (See headers.c for details.)
* This makes it possible to check quickly whether an
* arbitrary address corresponds to an object administered by the
* allocator.
*/
word GC_non_gc_bytes = 0; /* Number of bytes not intended to be collected */
word GC_gc_no = 0;
int GC_incremental = 0; /* By default, stop the world. */
int GC_full_freq = 4; /* Every 5th collection is a full */
/* collection. */
char * GC_copyright[] =
{"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ",
"Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ",
"Copyright (c) 1996-1997 by Silicon Graphics. All rights reserved. ",
"THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY",
" EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.",
"See source code for details." };
# include "version.h"
/* some more variables */
extern signed_word GC_mem_found; /* Number of reclaimed longwords */
/* after garbage collection */
GC_bool GC_dont_expand = 0;
word GC_free_space_divisor = 4;
extern GC_bool GC_collection_in_progress();
int GC_never_stop_func GC_PROTO((void)) { return(0); }
CLOCK_TYPE GC_start_time;
int GC_timeout_stop_func GC_PROTO((void))
{
CLOCK_TYPE current_time;
static unsigned count = 0;
unsigned long time_diff;
if ((count++ & 3) != 0) return(0);
#ifndef NO_CLOCK
GET_TIME(current_time);
time_diff = MS_TIME_DIFF(current_time,GC_start_time);
if (time_diff >= TIME_LIMIT) {
# ifdef PRINTSTATS
GC_printf0("Abandoning stopped marking after ");
GC_printf1("%lu msecs\n", (unsigned long)time_diff);
# endif
return(1);
}
#endif
return(0);
}
/* Return the minimum number of words that must be allocated between */
/* collections to amortize the collection cost. */
static word min_words_allocd()
{
# ifdef THREADS
/* We punt, for now. */
register signed_word stack_size = 10000;
# else
int dummy;
register signed_word stack_size = (ptr_t)(&dummy) - GC_stackbottom;
# endif
register word total_root_size; /* includes double stack size, */
/* since the stack is expensive */
/* to scan. */
if (stack_size < 0) stack_size = -stack_size;
total_root_size = 2 * stack_size + GC_root_size;
if (GC_incremental) {
return(BYTES_TO_WORDS(GC_heapsize + total_root_size)
/ (2 * GC_free_space_divisor));
} else {
return(BYTES_TO_WORDS(GC_heapsize + total_root_size)
/ GC_free_space_divisor);
}
}
/* Return the number of words allocated, adjusted for explicit storage */
/* management, etc.. This number is used in deciding when to trigger */
/* collections. */
word GC_adj_words_allocd()
{
register signed_word result;
register signed_word expl_managed =
BYTES_TO_WORDS((long)GC_non_gc_bytes
- (long)GC_non_gc_bytes_at_gc);
/* Don't count what was explicitly freed, or newly allocated for */
/* explicit management. Note that deallocating an explicitly */
/* managed object should not alter result, assuming the client */
/* is playing by the rules. */
result = (signed_word)GC_words_allocd
- (signed_word)GC_mem_freed - expl_managed;
if (result > (signed_word)GC_words_allocd) {
result = GC_words_allocd;
/* probably client bug or unfortunate scheduling */
}
result += GC_words_finalized;
/* We count objects enqueued for finalization as though they */
/* had been reallocated this round. Finalization is user */
/* visible progress. And if we don't count this, we have */
/* stability problems for programs that finalize all objects. */
result += GC_words_wasted;
/* This doesn't reflect useful work. But if there is lots of */
/* new fragmentation, the same is probably true of the heap, */
/* and the collection will be correspondingly cheaper. */
if (result < (signed_word)(GC_words_allocd >> 3)) {
/* Always count at least 1/8 of the allocations. We don't want */
/* to collect too infrequently, since that would inhibit */
/* coalescing of free storage blocks. */
/* This also makes us partially robust against client bugs. */
return(GC_words_allocd >> 3);
} else {
return(result);
}
}
/* Clear up a few frames worth of garbage left at the top of the stack. */
/* This is used to prevent us from accidentally treating garbade left */
/* on the stack by other parts of the collector as roots. This */
/* differs from the code in misc.c, which actually tries to keep the */
/* stack clear of long-lived, client-generated garbage. */
void GC_clear_a_few_frames()
{
# define NWORDS 64
word frames[NWORDS];
register int i;
for (i = 0; i < NWORDS; i++) frames[i] = 0;
}
/* Have we allocated enough to amortize a collection? */
GC_bool GC_should_collect()
{
return(GC_adj_words_allocd() >= min_words_allocd());
}
void GC_notify_full_gc()
{
if (GC_start_call_back != (void (*)())0) {
(*GC_start_call_back)();
}
}
/*
* Initiate a garbage collection if appropriate.
* Choose judiciously
* between partial, full, and stop-world collections.
* Assumes lock held, signals disabled.
*/
void GC_maybe_gc()
{
static int n_partial_gcs = 0;
if (GC_should_collect()) {
if (!GC_incremental) {
GC_notify_full_gc();
GC_gcollect_inner();
n_partial_gcs = 0;
return;
} else if (n_partial_gcs >= GC_full_freq) {
# ifdef PRINTSTATS
GC_printf2(
"***>Full mark for collection %lu after %ld allocd bytes\n",
(unsigned long) GC_gc_no+1,
(long)WORDS_TO_BYTES(GC_words_allocd));
# endif
GC_promote_black_lists();
(void)GC_reclaim_all((GC_stop_func)0, TRUE);
GC_clear_marks();
n_partial_gcs = 0;
GC_notify_full_gc();
} else {
n_partial_gcs++;
}
/* We try to mark with the world stopped. */
/* If we run out of time, this turns into */
/* incremental marking. */
#ifndef NO_CLOCK
GET_TIME(GC_start_time);
#endif
if (GC_stopped_mark(GC_timeout_stop_func)) {
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
GC_finish_collection();
}
}
}
/*
* Stop the world garbage collection. Assumes lock held, signals disabled.
* If stop_func is not GC_never_stop_func, then abort if stop_func returns TRUE.
*/
GC_bool GC_try_to_collect_inner(stop_func)
GC_stop_func stop_func;
{
if (GC_collection_in_progress()) {
# ifdef PRINTSTATS
GC_printf0(
"GC_try_to_collect_inner: finishing collection in progress\n");
# endif /* PRINTSTATS */
/* Just finish collection already in progress. */
while(GC_collection_in_progress()) {
if (stop_func()) return(FALSE);
GC_collect_a_little_inner(1);
}
}
# ifdef PRINTSTATS
GC_printf2(
"Initiating full world-stop collection %lu after %ld allocd bytes\n",
(unsigned long) GC_gc_no+1,
(long)WORDS_TO_BYTES(GC_words_allocd));
# endif
GC_promote_black_lists();
/* Make sure all blocks have been reclaimed, so sweep routines */
/* don't see cleared mark bits. */
/* If we're guaranteed to finish, then this is unnecessary. */
if (stop_func != GC_never_stop_func
&& !GC_reclaim_all(stop_func, FALSE)) {
/* Aborted. So far everything is still consistent. */
return(FALSE);
}
GC_invalidate_mark_state(); /* Flush mark stack. */
GC_clear_marks();
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
if (!GC_stopped_mark(stop_func)) {
if (!GC_incremental) {
/* We're partially done and have no way to complete or use */
/* current work. Reestablish invariants as cheaply as */
/* possible. */
GC_invalidate_mark_state();
GC_unpromote_black_lists();
} /* else we claim the world is already still consistent. We'll */
/* finish incrementally. */
return(FALSE);
}
GC_finish_collection();
return(TRUE);
}
/*
* Perform n units of garbage collection work. A unit is intended to touch
* roughly a GC_RATE pages. Every once in a while, we do more than that.
*/
# define GC_RATE 8
int GC_deficit = 0; /* The number of extra calls to GC_mark_some */
/* that we have made. */
/* Negative values are equivalent to 0. */
void GC_collect_a_little_inner(n)
int n;
{
register int i;
if (GC_collection_in_progress()) {
for (i = GC_deficit; i < GC_RATE*n; i++) {
if (GC_mark_some()) {
/* Need to finish a collection */
# ifdef SAVE_CALL_CHAIN
GC_save_callers(GC_last_stack);
# endif
(void) GC_stopped_mark(GC_never_stop_func);
GC_finish_collection();
break;
}
}
if (GC_deficit > 0) GC_deficit -= GC_RATE*n;
} else {
GC_maybe_gc();
}
}
int GC_collect_a_little GC_PROTO(())
{
int result;
DCL_LOCK_STATE;
DISABLE_SIGNALS();
LOCK();
GC_collect_a_little_inner(1);
result = (int)GC_collection_in_progress();
UNLOCK();
ENABLE_SIGNALS();
return(result);
}
/*
* Assumes lock is held, signals are disabled.
* We stop the world.
* If final is TRUE, then we finish the collection, no matter how long
* it takes.
* Otherwise we may fail and return FALSE if this takes too long.
* Increment GC_gc_no if we succeed.
*/
GC_bool GC_stopped_mark(stop_func)
GC_stop_func stop_func;
{
register int i;
# ifdef PRINTSTATS
CLOCK_TYPE start_time, current_time;
# endif
STOP_WORLD();
# ifdef PRINTSTATS
GET_TIME(start_time);
GC_printf1("--> Marking for collection %lu ",
(unsigned long) GC_gc_no + 1);
GC_printf2("after %lu allocd bytes + %lu wasted bytes\n",
(unsigned long) WORDS_TO_BYTES(GC_words_allocd),
(unsigned long) WORDS_TO_BYTES(GC_words_wasted));
# endif
/* Mark from all roots. */
/* Minimize junk left in my registers and on the stack */
GC_clear_a_few_frames();
GC_noop(0,0,0,0,0,0);
GC_initiate_gc();
for(i = 0;;i++) {
if ((*stop_func)()) {
# ifdef PRINTSTATS
GC_printf0("Abandoned stopped marking after ");
GC_printf1("%lu iterations\n",
(unsigned long)i);
# endif
GC_deficit = i; /* Give the mutator a chance. */
START_WORLD();
return(FALSE);
}
if (GC_mark_some()) break;
}
GC_gc_no++;
# ifdef PRINTSTATS
GC_printf2("Collection %lu reclaimed %ld bytes",
(unsigned long) GC_gc_no - 1,
(long)WORDS_TO_BYTES(GC_mem_found));
GC_printf1(" ---> heapsize = %lu bytes\n",
(unsigned long) GC_heapsize);
/* Printf arguments may be pushed in funny places. Clear the */
/* space. */
GC_printf0("");
# endif
/* Check all debugged objects for consistency */
if (GC_debugging_started) {
(*GC_check_heap)();
}
# ifdef PRINTTIMES
GET_TIME(current_time);
GC_printf1("World-stopped marking took %lu msecs\n",
MS_TIME_DIFF(current_time,start_time));
# endif
START_WORLD();
return(TRUE);
}
/* Finish up a collection. Assumes lock is held, signals are disabled, */
/* but the world is otherwise running. */
void GC_finish_collection()
{
# ifdef PRINTTIMES
CLOCK_TYPE start_time;
CLOCK_TYPE finalize_time;
CLOCK_TYPE done_time;
GET_TIME(start_time);
finalize_time = start_time;
# endif
# ifdef GATHERSTATS
GC_mem_found = 0;
# endif
# ifdef FIND_LEAK
/* Mark all objects on the free list. All objects should be */
/* marked when we're done. */
{
register word size; /* current object size */
register ptr_t p; /* pointer to current object */
register struct hblk * h; /* pointer to block containing *p */
register hdr * hhdr;
register int word_no; /* "index" of *p in *q */
int kind;
for (kind = 0; kind < GC_n_kinds; kind++) {
for (size = 1; size <= MAXOBJSZ; size++) {
for (p= GC_obj_kinds[kind].ok_freelist[size];
p != 0; p=obj_link(p)){
h = HBLKPTR(p);
hhdr = HDR(h);
word_no = (((word *)p) - ((word *)h));
set_mark_bit_from_hdr(hhdr, word_no);
}
}
}
}
/* Check that everything is marked */
GC_start_reclaim(TRUE);
# else
GC_finalize();
# ifdef STUBBORN_ALLOC
GC_clean_changing_list();
# endif
# ifdef PRINTTIMES
GET_TIME(finalize_time);
# endif
/* Clear free list mark bits, in case they got accidentally marked */
/* Note: HBLKPTR(p) == pointer to head of block containing *p */
/* Also subtract memory remaining from GC_mem_found count. */
/* Note that composite objects on free list are cleared. */
/* Thus accidentally marking a free list is not a problem; only */
/* objects on the list itself will be marked, and that's fixed here. */
{
register word size; /* current object size */
register ptr_t p; /* pointer to current object */
register struct hblk * h; /* pointer to block containing *p */
register hdr * hhdr;
register int word_no; /* "index" of *p in *q */
int kind;
for (kind = 0; kind < GC_n_kinds; kind++) {
for (size = 1; size <= MAXOBJSZ; size++) {
for (p= GC_obj_kinds[kind].ok_freelist[size];
p != 0; p=obj_link(p)){
h = HBLKPTR(p);
hhdr = HDR(h);
word_no = (((word *)p) - ((word *)h));
clear_mark_bit_from_hdr(hhdr, word_no);
# ifdef GATHERSTATS
GC_mem_found -= size;
# endif
}
}
}
}
# ifdef PRINTSTATS
GC_printf1("Bytes recovered before sweep - f.l. count = %ld\n",
(long)WORDS_TO_BYTES(GC_mem_found));
# endif
/* Reconstruct free lists to contain everything not marked */
GC_start_reclaim(FALSE);
# endif /* !FIND_LEAK */
# ifdef PRINTSTATS
GC_printf2(
"Immediately reclaimed %ld bytes in heap of size %lu bytes\n",
(long)WORDS_TO_BYTES(GC_mem_found),
(unsigned long)GC_heapsize);
GC_printf2("%lu (atomic) + %lu (composite) collectable bytes in use\n",
(unsigned long)WORDS_TO_BYTES(GC_atomic_in_use),
(unsigned long)WORDS_TO_BYTES(GC_composite_in_use));
# endif
/* Reset or increment counters for next cycle */
GC_words_allocd_before_gc += GC_words_allocd;
GC_non_gc_bytes_at_gc = GC_non_gc_bytes;
GC_words_allocd = 0;
GC_words_wasted = 0;
GC_mem_freed = 0;
# ifdef PRINTTIMES
GET_TIME(done_time);
GC_printf2("Finalize + initiate sweep took %lu + %lu msecs\n",
MS_TIME_DIFF(finalize_time,start_time),
MS_TIME_DIFF(done_time,finalize_time));
# endif
}
/* Externally callable routine to invoke full, stop-world collection */
# if defined(__STDC__) || defined(__cplusplus)
int GC_try_to_collect(GC_stop_func stop_func)
# else
int GC_try_to_collect(stop_func)
GC_stop_func stop_func;
# endif
{
int result;
DCL_LOCK_STATE;
GC_INVOKE_FINALIZERS();
DISABLE_SIGNALS();
LOCK();
ENTER_GC();
if (!GC_is_initialized) GC_init_inner();
/* Minimize junk left in my registers */
GC_noop(0,0,0,0,0,0);
result = (int)GC_try_to_collect_inner(stop_func);
EXIT_GC();
UNLOCK();
ENABLE_SIGNALS();
if(result) GC_INVOKE_FINALIZERS();
return(result);
}
void GC_gcollect GC_PROTO(())
{
GC_notify_full_gc();
(void)GC_try_to_collect(GC_never_stop_func);
}
word GC_n_heap_sects = 0; /* Number of sections currently in heap. */
/*
* Use the chunk of memory starting at p of syze bytes as part of the heap.
* Assumes p is HBLKSIZE aligned, and bytes is a multiple of HBLKSIZE.
*/
void GC_add_to_heap(p, bytes)
struct hblk *p;
word bytes;
{
word words;
if (GC_n_heap_sects >= MAX_HEAP_SECTS) {
ABORT("Too many heap sections: Increase MAXHINCR or MAX_HEAP_SECTS");
}
if (!GC_install_header(p)) {
/* This is extremely unlikely. Can't add it. This will */
/* almost certainly result in a 0 return from the allocator, */
/* which is entirely appropriate. */
return;
}
GC_heap_sects[GC_n_heap_sects].hs_start = (ptr_t)p;
GC_heap_sects[GC_n_heap_sects].hs_bytes = bytes;
GC_n_heap_sects++;
words = BYTES_TO_WORDS(bytes - HDR_BYTES);
HDR(p) -> hb_sz = words;
GC_freehblk(p);
GC_heapsize += bytes;
if ((ptr_t)p <= GC_least_plausible_heap_addr
|| GC_least_plausible_heap_addr == 0) {
GC_least_plausible_heap_addr = (ptr_t)p - sizeof(word);
/* Making it a little smaller than necessary prevents */
/* us from getting a false hit from the variable */
/* itself. There's some unintentional reflection */
/* here. */
}
if ((ptr_t)p + bytes >= GC_greatest_plausible_heap_addr) {
GC_greatest_plausible_heap_addr = (ptr_t)p + bytes;
}
}
#ifdef PRESERVE_LAST
GC_bool GC_in_last_heap_sect(p)
ptr_t p;
{
struct HeapSect * last_heap_sect = &(GC_heap_sects[GC_n_heap_sects-1]);
ptr_t start = last_heap_sect -> hs_start;
ptr_t end;
if (p < start) return FALSE;
end = start + last_heap_sect -> hs_bytes;
if (p >= end) return FALSE;
return TRUE;
}
#endif
# if !defined(NO_DEBUGGING)
void GC_print_heap_sects()
{
register unsigned i;
GC_printf1("Total heap size: %lu\n", (unsigned long) GC_heapsize);
for (i = 0; i < GC_n_heap_sects; i++) {
unsigned long start = (unsigned long) GC_heap_sects[i].hs_start;
unsigned long len = (unsigned long) GC_heap_sects[i].hs_bytes;
struct hblk *h;
unsigned nbl = 0;
GC_printf3("Section %ld from 0x%lx to 0x%lx ", (unsigned long)i,
start, (unsigned long)(start + len));
for (h = (struct hblk *)start; h < (struct hblk *)(start + len); h++) {
if (GC_is_black_listed(h, HBLKSIZE)) nbl++;
}
GC_printf2("%lu/%lu blacklisted\n", (unsigned long)nbl,
(unsigned long)(len/HBLKSIZE));
}
}
# endif
ptr_t GC_least_plausible_heap_addr = (ptr_t)ONES;
ptr_t GC_greatest_plausible_heap_addr = 0;
ptr_t GC_max(x,y)
ptr_t x, y;
{
return(x > y? x : y);
}
ptr_t GC_min(x,y)
ptr_t x, y;
{
return(x < y? x : y);
}
# if defined(__STDC__) || defined(__cplusplus)
void GC_set_max_heap_size(GC_word n)
# else
void GC_set_max_heap_size(n)
GC_word n;
# endif
{
GC_max_heapsize = n;
}
GC_word GC_max_retries = 0;
/*
* this explicitly increases the size of the heap. It is used
* internally, but may also be invoked from GC_expand_hp by the user.
* The argument is in units of HBLKSIZE.
* Tiny values of n are rounded up.
* Returns FALSE on failure.
*/
GC_bool GC_expand_hp_inner(n)
word n;
{
word bytes;
struct hblk * space;
word expansion_slop; /* Number of bytes by which we expect the */
/* heap to expand soon. */
if (n < MINHINCR) n = MINHINCR;
bytes = n * HBLKSIZE;
/* Make sure bytes is a multiple of GC_page_size */
{
word mask = GC_page_size - 1;
bytes += mask;
bytes &= ~mask;
}
if (GC_max_heapsize != 0 && GC_heapsize + bytes > GC_max_heapsize) {
/* Exceeded self-imposed limit */
return(FALSE);
}
space = GET_MEM(bytes);
if( space == 0 ) {
return(FALSE);
}
# ifdef PRINTSTATS
GC_printf2("Increasing heap size by %lu after %lu allocated bytes\n",
(unsigned long)bytes,
(unsigned long)WORDS_TO_BYTES(GC_words_allocd));
# ifdef UNDEFINED
GC_printf1("Root size = %lu\n", GC_root_size);
GC_print_block_list(); GC_print_hblkfreelist();
GC_printf0("\n");
# endif
# endif
expansion_slop = 8 * WORDS_TO_BYTES(min_words_allocd());
if (5 * HBLKSIZE * MAXHINCR > expansion_slop) {
expansion_slop = 5 * HBLKSIZE * MAXHINCR;
}
if (GC_last_heap_addr == 0 && !((word)space & SIGNB)
|| GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space) {
/* Assume the heap is growing up */
GC_greatest_plausible_heap_addr =
GC_max(GC_greatest_plausible_heap_addr,
(ptr_t)space + bytes + expansion_slop);
} else {
/* Heap is growing down */
GC_least_plausible_heap_addr =
GC_min(GC_least_plausible_heap_addr,
(ptr_t)space - expansion_slop);
}
GC_prev_heap_addr = GC_last_heap_addr;
GC_last_heap_addr = (ptr_t)space;
GC_add_to_heap(space, bytes);
return(TRUE);
}
/* Really returns a bool, but it's externally visible, so that's clumsy. */
/* Arguments is in bytes. */
# if defined(__STDC__) || defined(__cplusplus)
int GC_expand_hp(size_t bytes)
# else
int GC_expand_hp(bytes)
size_t bytes;
# endif
{
int result;
DCL_LOCK_STATE;
DISABLE_SIGNALS();
LOCK();
if (!GC_is_initialized) GC_init_inner();
result = (int)GC_expand_hp_inner(divHBLKSZ((word)bytes));
UNLOCK();
ENABLE_SIGNALS();
return(result);
}
unsigned GC_fail_count = 0;
/* How many consecutive GC/expansion failures? */
/* Reset by GC_allochblk. */
GC_bool GC_collect_or_expand(needed_blocks, ignore_off_page)
word needed_blocks;
GC_bool ignore_off_page;
{
if (!GC_incremental && !GC_dont_gc && GC_should_collect()) {
GC_notify_full_gc();
GC_gcollect_inner();
} else {
word blocks_to_get = GC_heapsize/(HBLKSIZE*GC_free_space_divisor)
+ needed_blocks;
if (blocks_to_get > MAXHINCR) {
word slop;
if (ignore_off_page) {
slop = 4;
} else {
slop = 2*divHBLKSZ(BL_LIMIT);
if (slop > needed_blocks) slop = needed_blocks;
}
if (needed_blocks + slop > MAXHINCR) {
blocks_to_get = needed_blocks + slop;
} else {
blocks_to_get = MAXHINCR;
}
}
if (!GC_expand_hp_inner(blocks_to_get)
&& !GC_expand_hp_inner(needed_blocks)) {
if (GC_fail_count++ < GC_max_retries) {
WARN("Out of Memory! Trying to continue ...\n", 0);
GC_notify_full_gc();
GC_gcollect_inner();
} else {
WARN("Out of Memory! Returning NIL!\n", 0);
return(FALSE);
}
} else if (GC_fail_count) {
# ifdef PRINTSTATS
GC_printf0("Memory available again ...\n");
# endif
}
}
return(TRUE);
}
/*
* Make sure the object free list for sz is not empty.
* Return a pointer to the first object on the free list.
* The object MUST BE REMOVED FROM THE FREE LIST BY THE CALLER.
* Assumes we hold the allocator lock and signals are disabled.
*
*/
ptr_t GC_allocobj(sz, kind)
word sz;
int kind;
{
register ptr_t * flh = &(GC_obj_kinds[kind].ok_freelist[sz]);
if (sz == 0) return(0);
while (*flh == 0) {
ENTER_GC();
/* Do our share of marking work */
if(GC_incremental && !GC_dont_gc) GC_collect_a_little_inner(1);
/* Sweep blocks for objects of this size */
GC_continue_reclaim(sz, kind);
EXIT_GC();
if (*flh == 0) {
GC_new_hblk(sz, kind);
}
if (*flh == 0) {
ENTER_GC();
if (!GC_collect_or_expand((word)1,FALSE)) {
EXIT_GC();
return(0);
}
EXIT_GC();
}
}
return(*flh);
}

View File

@ -1,59 +0,0 @@
# define call_push(x) \
lda $16, 0(x); /* copy x to first argument register */ \
jsr $26, GC_push_one; /* call GC_push_one, ret addr in $26 */ \
ldgp $gp, 0($26) /* restore $gp register from $ra */
.text
.align 4
.globl GC_push_regs
.ent GC_push_regs 2
GC_push_regs:
ldgp $gp, 0($27) # set gp from the procedure value reg
lda $sp, -32($sp) # make stack frame
stq $26, 8($sp) # save return address
.mask 0x04000000, -8
.frame $sp, 16, $26, 0
# call_push($0) # expression eval and int func result
# call_push($1) # temp regs - not preserved cross calls
# call_push($2)
# call_push($3)
# call_push($4)
# call_push($5)
# call_push($6)
# call_push($7)
# call_push($8)
call_push($9) # Saved regs
call_push($10)
call_push($11)
call_push($12)
call_push($13)
call_push($14)
call_push($15) # frame ptr or saved reg
# call_push($16) # argument regs - not preserved cross calls
# call_push($17)
# call_push($18)
# call_push($19)
# call_push($20)
# call_push($21)
# call_push($22) # temp regs - not preserved cross calls
# call_push($23)
# call_push($24)
# call_push($25)
# call_push($26) # return address - expression eval
# call_push($27) # procedure value or temporary reg
# call_push($28) # assembler temp - not presrved
call_push($29) # Global Pointer
# call_push($30) # Stack Pointer
ldq $26, 8($sp) # restore return address
lda $sp, 32($sp) # pop stack frame
ret $31, ($26), 1 # return ($31 == hardwired zero)
.end GC_push_regs

View File

@ -1,106 +0,0 @@
This is an ASCII diagram of the data structure used to check pointer
validity. It was provided by Dave Barrett <barrett@asgard.cs.colorado.edu>,
and should be of use to others attempting to understand the code.
The data structure in GC4.X is essentially the same. -HB
Data Structure used by GC_base in gc3.7:
21-Apr-94
63 LOG_TOP_SZ[11] LOG_BOTTOM_SZ[10] LOG_HBLKSIZE[13]
+------------------+----------------+------------------+------------------+
p:| | TL_HASH(hi) | | HBLKDISPL(p) |
+------------------+----------------+------------------+------------------+
\-----------------------HBLKPTR(p)-------------------/
\------------hi-------------------/
\______ ________/ \________ _______/ \________ _______/
V V V
| | |
GC_top_index[] | | |
--- +--------------+ | | |
^ | | | | |
| | | | | |
TOP +--------------+<--+ | |
_SZ +-<| [] | * | |
(items)| +--------------+ if 0 < bi< HBLKSIZE | |
| | | | then large object | |
| | | | starts at the bi'th | |
v | | | HBLK before p. | i |
--- | +--------------+ | (word- |
v | aligned) |
bi= |GET_BI(p){->hash_link}->key==hi | |
v | |
| (bottom_index) \ scratch_alloc'd | |
| ( struct bi ) / by get_index() | |
--- +->+--------------+ | |
^ | | | |
^ | | | |
BOTTOM | | ha=GET_HDR_ADDR(p) | |
_SZ(items)+--------------+<----------------------+ +-------+
| +--<| index[] | |
| | +--------------+ GC_obj_map: v
| | | | from / +-+-+-----+-+-+-+-+ ---
v | | | GC_add < 0| | | | | | | | ^
--- | +--------------+ _map_entry \ +-+-+-----+-+-+-+-+ |
| | asc_link | +-+-+-----+-+-+-+-+ MAXOBJSZ
| +--------------+ +-->| | | j | | | | | +1
| | key | | +-+-+-----+-+-+-+-+ |
| +--------------+ | +-+-+-----+-+-+-+-+ |
| | hash_link | | | | | | | | | | v
| +--------------+ | +-+-+-----+-+-+-+-+ ---
| | |<--MAX_OFFSET--->|
| | (bytes)
HDR(p)| GC_find_header(p) | |<--MAP_ENTRIES-->|
| \ from | =HBLKSIZE/WORDSZ
| (hdr) (struct hblkhdr) / alloc_hdr() | (1024 on Alpha)
+-->+----------------------+ | (8/16 bits each)
GET_HDR(p)| word hb_sz (words) | |
+----------------------+ |
| struct hblk *hb_next | |
+----------------------+ |
|mark_proc hb_mark_proc| |
+----------------------+ |
| char * hb_map |>-------------+
+----------------------+
| ushort hb_obj_kind |
+----------------------+
| hb_last_reclaimed |
--- +----------------------+
^ | |
MARK_BITS| hb_marks[] | *if hdr is free, hb_sz + DISCARD_WORDS
_SZ(words)| | is the size of a heap chunk (struct hblk)
v | | of at least MININCR*HBLKSIZE bytes (below),
--- +----------------------+ otherwise, size of each object in chunk.
Dynamic data structures above are interleaved throughout the heap in blocks of
size MININCR * HBLKSIZE bytes as done by gc_scratch_alloc which cannot be
freed; free lists are used (e.g. alloc_hdr). HBLKs's below are collected.
(struct hblk)
--- +----------------------+ < HBLKSIZE --- --- DISCARD_
^ |garbage[DISCARD_WORDS]| aligned ^ ^ HDR_BYTES WORDS
| | | | v (bytes) (words)
| +-----hb_body----------+ < WORDSZ | --- ---
| | | aligned | ^ ^
| | Object 0 | | hb_sz |
| | | i |(word- (words)|
| | | (bytes)|aligned) v |
| + - - - - - - - - - - -+ --- | --- |
| | | ^ | ^ |
n * | | j (words) | hb_sz BODY_SZ
HBLKSIZE | Object 1 | v v | (words)
(bytes) | |--------------- v MAX_OFFSET
| + - - - - - - - - - - -+ --- (bytes)
| | | !All_INTERIOR_PTRS ^ |
| | | sets j only for hb_sz |
| | Object N | valid object offsets. | |
v | | All objects WORDSZ v v
--- +----------------------+ aligned. --- ---
DISCARD_WORDS is normally zero. Indeed the collector has not been tested
with another value in ages.

View File

@ -1,286 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, August 9, 1995 6:09 pm PDT */
# include "gc_priv.h"
/*
* We maintain several hash tables of hblks that have had false hits.
* Each contains one bit per hash bucket; If any page in the bucket
* has had a false hit, we assume that all of them have.
* See the definition of page_hash_table in gc_private.h.
* False hits from the stack(s) are much more dangerous than false hits
* from elsewhere, since the former can pin a large object that spans the
* block, eventhough it does not start on the dangerous block.
*/
/*
* Externally callable routines are:
* GC_add_to_black_list_normal
* GC_add_to_black_list_stack
* GC_promote_black_lists
* GC_is_black_listed
*
* All require that the allocator lock is held.
*/
/* Pointers to individual tables. We replace one table by another by */
/* switching these pointers. */
word * GC_old_normal_bl;
/* Nonstack false references seen at last full */
/* collection. */
word * GC_incomplete_normal_bl;
/* Nonstack false references seen since last */
/* full collection. */
word * GC_old_stack_bl;
word * GC_incomplete_stack_bl;
word GC_total_stack_black_listed;
word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* Initial rough guess */
void GC_clear_bl();
void GC_default_print_heap_obj_proc(p)
ptr_t p;
{
ptr_t base = GC_base(p);
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base));
}
void (*GC_print_heap_obj)(/* char * s, ptr_t p */) =
GC_default_print_heap_obj_proc;
void GC_print_source_ptr(ptr_t p)
{
ptr_t base = GC_base(p);
if (0 == base) {
GC_err_printf0("in root set");
} else {
GC_err_printf0("in object at ");
(*GC_print_heap_obj)(base);
}
}
void GC_bl_init()
{
# ifndef ALL_INTERIOR_POINTERS
GC_old_normal_bl = (word *)
GC_scratch_alloc((word)(sizeof (page_hash_table)));
GC_incomplete_normal_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) {
GC_err_printf0("Insufficient memory for black list\n");
EXIT();
}
GC_clear_bl(GC_old_normal_bl);
GC_clear_bl(GC_incomplete_normal_bl);
# endif
GC_old_stack_bl = (word *)GC_scratch_alloc((word)(sizeof(page_hash_table)));
GC_incomplete_stack_bl = (word *)GC_scratch_alloc
((word)(sizeof(page_hash_table)));
if (GC_old_stack_bl == 0 || GC_incomplete_stack_bl == 0) {
GC_err_printf0("Insufficient memory for black list\n");
EXIT();
}
GC_clear_bl(GC_old_stack_bl);
GC_clear_bl(GC_incomplete_stack_bl);
}
void GC_clear_bl(doomed)
word *doomed;
{
BZERO(doomed, sizeof(page_hash_table));
}
void GC_copy_bl(old, new)
word *new, *old;
{
BCOPY(old, new, sizeof(page_hash_table));
}
static word total_stack_black_listed();
/* Signal the completion of a collection. Turn the incomplete black */
/* lists into new black lists, etc. */
void GC_promote_black_lists()
{
word * very_old_normal_bl = GC_old_normal_bl;
word * very_old_stack_bl = GC_old_stack_bl;
GC_old_normal_bl = GC_incomplete_normal_bl;
GC_old_stack_bl = GC_incomplete_stack_bl;
# ifndef ALL_INTERIOR_POINTERS
GC_clear_bl(very_old_normal_bl);
# endif
GC_clear_bl(very_old_stack_bl);
GC_incomplete_normal_bl = very_old_normal_bl;
GC_incomplete_stack_bl = very_old_stack_bl;
GC_total_stack_black_listed = total_stack_black_listed();
# ifdef PRINTSTATS
GC_printf1("%ld bytes in heap blacklisted for interior pointers\n",
(unsigned long)GC_total_stack_black_listed);
# endif
if (GC_total_stack_black_listed != 0) {
GC_black_list_spacing =
HBLKSIZE*(GC_heapsize/GC_total_stack_black_listed);
}
if (GC_black_list_spacing < 3 * HBLKSIZE) {
GC_black_list_spacing = 3 * HBLKSIZE;
}
}
void GC_unpromote_black_lists()
{
# ifndef ALL_INTERIOR_POINTERS
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl);
# endif
GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl);
}
# ifndef ALL_INTERIOR_POINTERS
/* P is not a valid pointer reference, but it falls inside */
/* the plausible heap bounds. */
/* Add it to the normal incomplete black list if appropriate. */
#ifdef PRINT_BLACK_LIST
void GC_add_to_black_list_normal(p, source)
ptr_t source;
#else
void GC_add_to_black_list_normal(p)
#endif
word p;
{
if (!(GC_modws_valid_offsets[p & (sizeof(word)-1)])) return;
{
register int index = PHT_HASH(p);
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_normal_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
GC_err_printf2(
"Black listing (normal) 0x%lx referenced from 0x%lx ",
(unsigned long) p, (unsigned long) source);
GC_print_source_ptr(source);
GC_err_puts("\n");
}
# endif
set_pht_entry_from_index(GC_incomplete_normal_bl, index);
} /* else this is probably just an interior pointer to an allocated */
/* object, and isn't worth black listing. */
}
}
# endif
/* And the same for false pointers from the stack. */
#ifdef PRINT_BLACK_LIST
void GC_add_to_black_list_stack(p, source)
ptr_t source;
#else
void GC_add_to_black_list_stack(p)
#endif
word p;
{
register int index = PHT_HASH(p);
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_stack_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
GC_err_printf2(
"Black listing (stack) 0x%lx referenced from 0x%lx ",
(unsigned long)p, (unsigned long)source);
GC_print_source_ptr(source);
GC_err_puts("\n");
}
# endif
set_pht_entry_from_index(GC_incomplete_stack_bl, index);
}
}
/*
* Is the block starting at h of size len bytes black listed? If so,
* return the address of the next plausible r such that (r, len) might not
* be black listed. (R may not actually be in the heap. We guarantee only
* that every smaller value of r after h is also black listed.)
* If (h,len) is not black listed, return 0.
* Knows about the structure of the black list hash tables.
*/
struct hblk * GC_is_black_listed(h, len)
struct hblk * h;
word len;
{
register int index = PHT_HASH((word)h);
register word i;
word nblocks = divHBLKSZ(len);
# ifndef ALL_INTERIOR_POINTERS
if (get_pht_entry_from_index(GC_old_normal_bl, index)
|| get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
return(h+1);
}
# endif
for (i = 0; ; ) {
if (GC_old_stack_bl[divWORDSZ(index)] == 0
&& GC_incomplete_stack_bl[divWORDSZ(index)] == 0) {
/* An easy case */
i += WORDSZ - modWORDSZ(index);
} else {
if (get_pht_entry_from_index(GC_old_stack_bl, index)
|| get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
return(h+i+1);
}
i++;
}
if (i >= nblocks) break;
index = PHT_HASH((word)(h+i));
}
return(0);
}
/* Return the number of blacklisted blocks in a given range. */
/* Used only for statistical purposes. */
/* Looks only at the GC_incomplete_stack_bl. */
word GC_number_stack_black_listed(start, endp1)
struct hblk *start, *endp1;
{
register struct hblk * h;
word result = 0;
for (h = start; h < endp1; h++) {
register int index = PHT_HASH((word)h);
if (get_pht_entry_from_index(GC_old_stack_bl, index)) result++;
}
return(result);
}
/* Return the total number of (stack) black-listed bytes. */
static word total_stack_black_listed()
{
register unsigned i;
word total = 0;
for (i = 0; i < GC_n_heap_sects; i++) {
struct hblk * start = (struct hblk *) GC_heap_sects[i].hs_start;
word len = (word) GC_heap_sects[i].hs_bytes;
struct hblk * endp1 = start + len/HBLKSIZE;
total += GC_number_stack_black_listed(start, endp1);
}
return(total * HBLKSIZE);
}

View File

@ -1,4 +0,0 @@
#!/bin/sh
GC_DEBUG=1
export GC_DEBUG
$* 2>&1 | awk '{print "0x3e=c\""$0"\""};/^\t##PC##=/ {if ($2 != 0) {print $2"?i"}}' | adb $1 | sed "s/^ >/>/"

View File

@ -1,201 +0,0 @@
/*
* Copyright (c) 1992-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, March 29, 1995 12:51 pm PST */
# ifdef CHECKSUMS
# include "gc_priv.h"
/* This is debugging code intended to verify the results of dirty bit */
/* computations. Works only in a single threaded environment. */
/* We assume that stubborn objects are changed only when they are */
/* enabled for writing. (Certain kinds of writing are actually */
/* safe under other conditions.) */
# define NSUMS 2000
# define OFFSET 0x10000
typedef struct {
GC_bool new_valid;
word old_sum;
word new_sum;
struct hblk * block; /* Block to which this refers + OFFSET */
/* to hide it from colector. */
} page_entry;
page_entry GC_sums [NSUMS];
word GC_checksum(h)
struct hblk *h;
{
register word *p = (word *)h;
register word *lim = (word *)(h+1);
register word result = 0;
while (p < lim) {
result += *p++;
}
return(result | 0x80000000 /* doesn't look like pointer */);
}
# ifdef STUBBORN_ALLOC
/* Check whether a stubborn object from the given block appears on */
/* the appropriate free list. */
GC_bool GC_on_free_list(h)
struct hblk *h;
{
register hdr * hhdr = HDR(h);
register int sz = hhdr -> hb_sz;
ptr_t p;
if (sz > MAXOBJSZ) return(FALSE);
for (p = GC_sobjfreelist[sz]; p != 0; p = obj_link(p)) {
if (HBLKPTR(p) == h) return(TRUE);
}
return(FALSE);
}
# endif
int GC_n_dirty_errors;
int GC_n_changed_errors;
int GC_n_clean;
int GC_n_dirty;
void GC_update_check_page(h, index)
struct hblk *h;
int index;
{
page_entry *pe = GC_sums + index;
register hdr * hhdr = HDR(h);
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
pe -> old_sum = pe -> new_sum;
pe -> new_sum = GC_checksum(h);
# ifndef MSWIN32
if (pe -> new_sum != 0 && !GC_page_was_ever_dirty(h)) {
GC_printf1("GC_page_was_ever_dirty(0x%lx) is wrong\n",
(unsigned long)h);
}
# endif
if (GC_page_was_dirty(h)) {
GC_n_dirty++;
} else {
GC_n_clean++;
}
if (pe -> new_valid && pe -> old_sum != pe -> new_sum) {
if (!GC_page_was_dirty(h) || !GC_page_was_ever_dirty(h)) {
/* Set breakpoint here */GC_n_dirty_errors++;
}
# ifdef STUBBORN_ALLOC
if (!IS_FORWARDING_ADDR_OR_NIL(hhdr)
&& hhdr -> hb_map != GC_invalid_map
&& hhdr -> hb_obj_kind == STUBBORN
&& !GC_page_was_changed(h)
&& !GC_on_free_list(h)) {
/* if GC_on_free_list(h) then reclaim may have touched it */
/* without any allocations taking place. */
/* Set breakpoint here */GC_n_changed_errors++;
}
# endif
}
pe -> new_valid = TRUE;
pe -> block = h + OFFSET;
}
word GC_bytes_in_used_blocks;
void GC_add_block(h, dummy)
struct hblk *h;
word dummy;
{
register hdr * hhdr = HDR(h);
register bytes = WORDS_TO_BYTES(hhdr -> hb_sz);
bytes += HDR_BYTES + HBLKSIZE-1;
bytes &= ~(HBLKSIZE-1);
GC_bytes_in_used_blocks += bytes;
}
void GC_check_blocks()
{
word bytes_in_free_blocks = 0;
struct hblk * h = GC_hblkfreelist;
hdr * hhdr = HDR(h);
word sz;
GC_bytes_in_used_blocks = 0;
GC_apply_to_all_blocks(GC_add_block, (word)0);
while (h != 0) {
sz = hhdr -> hb_sz;
bytes_in_free_blocks += sz;
h = hhdr -> hb_next;
hhdr = HDR(h);
}
GC_printf2("GC_bytes_in_used_blocks = %ld, bytes_in_free_blocks = %ld ",
GC_bytes_in_used_blocks, bytes_in_free_blocks);
GC_printf1("GC_heapsize = %ld\n", GC_heapsize);
if (GC_bytes_in_used_blocks + bytes_in_free_blocks != GC_heapsize) {
GC_printf0("LOST SOME BLOCKS!!\n");
}
}
/* Should be called immediately after GC_read_dirty and GC_read_changed. */
void GC_check_dirty()
{
register int index;
register unsigned i;
register struct hblk *h;
register ptr_t start;
GC_check_blocks();
GC_n_dirty_errors = 0;
GC_n_changed_errors = 0;
GC_n_clean = 0;
GC_n_dirty = 0;
index = 0;
for (i = 0; i < GC_n_heap_sects; i++) {
start = GC_heap_sects[i].hs_start;
for (h = (struct hblk *)start;
h < (struct hblk *)(start + GC_heap_sects[i].hs_bytes);
h++) {
GC_update_check_page(h, index);
index++;
if (index >= NSUMS) goto out;
}
}
out:
GC_printf2("Checked %lu clean and %lu dirty pages\n",
(unsigned long) GC_n_clean, (unsigned long) GC_n_dirty);
if (GC_n_dirty_errors > 0) {
GC_printf1("Found %lu dirty bit errors\n",
(unsigned long)GC_n_dirty_errors);
}
if (GC_n_changed_errors > 0) {
GC_printf1("Found %lu changed bit errors\n",
(unsigned long)GC_n_changed_errors);
GC_printf0("These may be benign (provoked by nonpointer changes)\n");
# ifdef THREADS
GC_printf0(
"Also expect 1 per thread currently allocating a stubborn obj.\n");
# endif
}
}
# else
extern int GC_quiet;
/* ANSI C doesn't allow translation units to be empty. */
/* So we guarantee this one is nonempty. */
# endif /* CHECKSUMS */

View File

@ -1,985 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
#ifndef CONFIG_H
# define CONFIG_H
/* Machine dependent parameters. Some tuning parameters can be found */
/* near the top of gc_private.h. */
/* Machine specific parts contributed by various people. See README file. */
/* Determine the machine type: */
# if defined(sun) && defined(mc68000)
# define M68K
# define SUNOS4
# define mach_type_known
# endif
# if defined(hp9000s300)
# define M68K
# define HP
# define mach_type_known
# endif
# if defined(__NetBSD__) && defined(m68k)
# define M68K
# define NETBSD
# define mach_type_known
# endif
# if defined(vax)
# define VAX
# ifdef ultrix
# define ULTRIX
# else
# define BSD
# endif
# define mach_type_known
# endif
# if defined(mips) || defined(__mips)
# define MIPS
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
# define ULTRIX
# else
# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
# define IRIX5 /* or IRIX 6.X */
# else
# define RISCOS /* or IRIX 4.X */
# endif
# endif
# define mach_type_known
# endif
# if defined(sequent) && defined(i386)
# define I386
# define SEQUENT
# define mach_type_known
# endif
# if defined(sun) && defined(i386)
# define I386
# define SUNOS5
# define mach_type_known
# endif
# if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
# define I386
# define OS2
# define mach_type_known
# endif
# if defined(ibm032)
# define RT
# define mach_type_known
# endif
# if defined(sun) && (defined(sparc) || defined(__sparc))
# define SPARC
/* Test for SunOS 5.x */
# include <errno.h>
# ifdef ECHRNG
# define SUNOS5
# else
# define SUNOS4
# endif
# define mach_type_known
# endif
# if defined(sparc) && defined(unix) && !defined(sun)
# define SPARC
# define DRSNX
# define mach_type_known
# endif
# if defined(_IBMR2)
# define RS6000
# define mach_type_known
# endif
# if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
/* The above test may need refinement */
# define I386
# if defined(_SCO_ELF)
# define SCO_ELF
# else
# define SCO
# endif
# define mach_type_known
# endif
# if defined(_AUX_SOURCE)
# define M68K
# define SYSV
# define mach_type_known
# endif
# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1)
# define HP_PA
# define mach_type_known
# endif
# if defined(linux) && defined(i386)
# define I386
# define LINUX
# define mach_type_known
# endif
# if defined(linux) && defined(powerpc)
# define POWERPC
# define LINUX
# define mach_type_known
# endif
# if defined(__alpha) || defined(__alpha__)
# define ALPHA
# if defined(linux) || defined(__linux__)
# define LINUX
# else
# define OSF1 /* a.k.a Digital Unix */
# endif
# define mach_type_known
# endif
# if defined(_AMIGA)
# define M68K
# define AMIGA
# define mach_type_known
# endif
# if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
# define M68K
# define MACOS
# define mach_type_known
# endif
# if defined(__MWERKS__) && defined(__powerc)
# define POWERPC
# define MACOS
# define mach_type_known
# endif
# if defined(NeXT) && defined(mc68000)
# define M68K
# define NEXT
# define mach_type_known
# endif
# if defined(NeXT) && defined(i386)
# define I386
# define NEXT
# define mach_type_known
# endif
# if defined(__FreeBSD__) && defined(i386)
# define I386
# define FREEBSD
# define mach_type_known
# endif
# if defined(__NetBSD__) && defined(i386)
# define I386
# define NETBSD
# define mach_type_known
# endif
# if defined(bsdi) && defined(i386)
# define I386
# define BSDI
# define mach_type_known
# endif
# if !defined(mach_type_known) && defined(__386BSD__)
# define I386
# define THREE86BSD
# define mach_type_known
# endif
# if defined(_CX_UX) && defined(_M88K)
# define M88K
# define CX_UX
# define mach_type_known
# endif
# if defined(DGUX)
# define M88K
/* DGUX defined */
# define mach_type_known
# endif
# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300)
# define I386
# define MSWIN32 /* or Win32s */
# define mach_type_known
# endif
# if defined(__DJGPP__)
# define I386
# ifndef DJGPP
# define DJGPP /* MSDOS running the DJGPP port of GCC */
# endif
# define mach_type_known
# endif
# if defined(__CYGWIN32__)
# define I386
# define CYGWIN32
# define mach_type_known
# endif
# if defined(__BORLANDC__)
# define I386
# define MSWIN32
# define mach_type_known
# endif
# if defined(_UTS) && !defined(mach_type_known)
# define S370
# define UTS4
# define mach_type_known
# endif
/* Ivan Demakov */
# if defined(__WATCOMC__) && defined(__386__)
# define I386
# if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
# if defined(__OS2__)
# define OS2
# else
# if defined(__WINDOWS_386__) || defined(__NT__)
# define MSWIN32
# else
# define DOS4GW
# endif
# endif
# endif
# define mach_type_known
# endif
/* Feel free to add more clauses here */
/* Or manually define the machine type here. A machine type is */
/* characterized by the architecture. Some */
/* machine types are further subdivided by OS. */
/* the macros ULTRIX, RISCOS, and BSD to distinguish. */
/* Note that SGI IRIX is treated identically to RISCOS. */
/* SYSV on an M68K actually means A/UX. */
/* The distinction in these cases is usually the stack starting address */
# ifndef mach_type_known
--> unknown machine type
# endif
/* Mapping is: M68K ==> Motorola 680X0 */
/* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
/* MACOS and AMIGA variants) */
/* I386 ==> Intel 386 */
/* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
/* FREEBSD, THREE86BSD, MSWIN32, */
/* BSDI, SUNOS5, NEXT variants) */
/* NS32K ==> Encore Multimax */
/* MIPS ==> R2000 or R3000 */
/* (RISCOS, ULTRIX variants) */
/* VAX ==> DEC VAX */
/* (BSD, ULTRIX variants) */
/* RS6000 ==> IBM RS/6000 AIX3.X */
/* RT ==> IBM PC/RT */
/* HP_PA ==> HP9000/700 & /800 */
/* HP/UX */
/* SPARC ==> SPARC under SunOS */
/* (SUNOS4, SUNOS5, */
/* DRSNX variants) */
/* ALPHA ==> DEC Alpha */
/* (OSF1 and LINUX variants) */
/* M88K ==> Motorola 88XX0 */
/* (CX_UX and DGUX) */
/* S370 ==> 370-like machine */
/* running Amdahl UTS4 */
/*
* For each architecture and OS, the following need to be defined:
*
* CPP_WORD_SZ is a simple integer constant representing the word size.
* in bits. We assume byte addressibility, where a byte has 8 bits.
* We also assume CPP_WORD_SZ is either 32 or 64.
* (We care about the length of pointers, not hardware
* bus widths. Thus a 64 bit processor with a C compiler that uses
* 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
*
* MACH_TYPE is a string representation of the machine type.
* OS_TYPE is analogous for the OS.
*
* ALIGNMENT is the largest N, such that
* all pointer are guaranteed to be aligned on N byte boundaries.
* defining it to be 1 will always work, but perform poorly.
*
* DATASTART is the beginning of the data segment.
* On UNIX systems, the collector will scan the area between DATASTART
* and DATAEND for root pointers.
*
* DATAEND, if not &end.
*
* ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
* the pointer size.
*
* STACKBOTTOM is the cool end of the stack, which is usually the
* highest address in the stack.
* Under PCR or OS/2, we have other ways of finding thread stacks.
* For each machine, the following should:
* 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
* 2) define exactly one of
* STACKBOTTOM (should be defined to be an expression)
* HEURISTIC1
* HEURISTIC2
* If either of the last two macros are defined, then STACKBOTTOM is computed
* during collector startup using one of the following two heuristics:
* HEURISTIC1: Take an address inside GC_init's frame, and round it up to
* the next multiple of STACK_GRAN.
* HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
* in small steps (decrement if STACK_GROWS_UP), and read the value
* at each location. Remember the value when the first
* Segmentation violation or Bus error is signalled. Round that
* to the nearest plausible page boundary, and use that instead
* of STACKBOTTOM.
*
* If no expression for STACKBOTTOM can be found, and neither of the above
* heuristics are usable, the collector can still be used with all of the above
* undefined, provided one of the following is done:
* 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
* without reference to STACKBOTTOM. This is appropriate for use in
* conjunction with thread packages, since there will be multiple stacks.
* (Allocating thread stacks in the heap, and treating them as ordinary
* heap data objects is also possible as a last resort. However, this is
* likely to introduce significant amounts of excess storage retention
* unless the dead parts of the thread stacks are periodically cleared.)
* 2) Client code may set GC_stackbottom before calling any GC_ routines.
* If the author of the client code controls the main program, this is
* easily accomplished by introducing a new main program, setting
* GC_stackbottom to the address of a local variable, and then calling
* the original main program. The new main program would read something
* like:
*
* # include "gc_private.h"
*
* main(argc, argv, envp)
* int argc;
* char **argv, **envp;
* {
* int dummy;
*
* GC_stackbottom = (ptr_t)(&dummy);
* return(real_main(argc, argv, envp));
* }
*
*
* Each architecture may also define the style of virtual dirty bit
* implementation to be used:
* MPROTECT_VDB: Write protect the heap and catch faults.
* PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
*
* An architecture may define DYNAMIC_LOADING if dynamic_load.c
* defined GC_register_dynamic_libraries() for the architecture.
*/
# define STACK_GRAN 0x1000000
# ifdef M68K
# define MACH_TYPE "M68K"
# define ALIGNMENT 2
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# define HEURISTIC2
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef SUNOS4
# define OS_TYPE "SUNOS4"
extern char etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
# define HEURISTIC1 /* differs */
# define DYNAMIC_LOADING
# endif
# ifdef HP
# define OS_TYPE "HP"
extern char etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t) 0xffeffffc)
/* empirically determined. seems to work. */
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
# endif
# ifdef SYSV
# define OS_TYPE "SYSV"
extern etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
& ~0x3fffff) \
+((word)&etext & 0x1fff))
/* This only works for shared-text binaries with magic number 0413.
The other sorts of SysV binaries put the data at the end of the text,
in which case the default of &etext would work. Unfortunately,
handling both would require having the magic-number available.
-- Parag
*/
# define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
/* The stack starts at the top of memory, but */
/* 0x0 cannot be used as setjump_test complains */
/* that the stack direction is incorrect. Two */
/* bytes down from 0x0 should be safe enough. */
/* --Parag */
# include <sys/mmu.h>
# define GETPAGESIZE() PAGESIZE /* Is this still right? */
# endif
# ifdef AMIGA
# define OS_TYPE "AMIGA"
/* STACKBOTTOM and DATASTART handled specially */
/* in os_dep.c */
# define DATAEND /* not needed */
# define GETPAGESIZE() 4096
# endif
# ifdef MACOS
# ifndef __LOWMEM__
# include <LowMem.h>
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
# define DATAEND /* not needed */
# define GETPAGESIZE() 4096
# endif
# ifdef NEXT
# define OS_TYPE "NEXT"
# define DATASTART ((ptr_t) get_etext())
# define STACKBOTTOM ((ptr_t) 0x4000000)
# define DATAEND /* not needed */
# endif
# endif
# ifdef POWERPC
# define MACH_TYPE "POWERPC"
# define ALIGNMENT 2
# ifdef MACOS
# ifndef __LOWMEM__
# include <LowMem.h>
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
# define DATAEND /* not needed */
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define STACKBOTTOM ((ptr_t)0x80000000)
# define DATASTART GC_data_start
extern int _end;
# define DATAEND (&_end)
# endif
# endif
# ifdef VAX
# define MACH_TYPE "VAX"
# define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# ifdef BSD
# define OS_TYPE "BSD"
# define HEURISTIC1
/* HEURISTIC2 may be OK, but it's hard to test. */
# endif
# ifdef ULTRIX
# define OS_TYPE "ULTRIX"
# define STACKBOTTOM ((ptr_t) 0x7fffc800)
# endif
# endif
# ifdef RT
# define MACH_TYPE "RT"
# define ALIGNMENT 4
# define DATASTART ((ptr_t) 0x10000000)
# define STACKBOTTOM ((ptr_t) 0x1fffd800)
# endif
# ifdef SPARC
# define MACH_TYPE "SPARC"
# define ALIGNMENT 4 /* Required by hardware */
# define ALIGN_DOUBLE
extern int etext;
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int _etext;
extern int _end;
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
# ifndef USE_MMAP
# define USE_MMAP
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# define PROC_VDB
# define HEURISTIC1
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
/* getpagesize() appeared to be missing from at least one */
/* Solaris 5.4 installation. Weird. */
# endif
# ifdef SUNOS4
# define OS_TYPE "SUNOS4"
/* [If you have a weak stomach, don't read this.] */
/* We would like to use: */
/* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
/* This fails occasionally, due to an ancient, but very */
/* persistent ld bug. &etext is set 32 bytes too high. */
/* We instead read the text segment size from the a.out */
/* header, which happens to be mapped into our address space */
/* at the start of the text segment. The detective work here */
/* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
/* Serpette of INRIA. */
/* This assumes ZMAGIC, i.e. demand-loadable executables. */
# define TEXTSTART 0x2000
# define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
# define MPROTECT_VDB
# define HEURISTIC1
# endif
# ifdef DRSNX
# define CPP_WORDSZ 32
# define OS_TYPE "DRSNX"
extern char * GC_SysVGetDataStart();
extern int etext;
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
# define MPROTECT_VDB
# define STACKBOTTOM ((ptr_t) 0xdfff0000)
# endif
# define DYNAMIC_LOADING
# endif
# ifdef I386
# define MACH_TYPE "I386"
# define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
/* except Borland. The -a4 option fixes */
/* Borland. */
/* Ivan Demakov: For Watcom the option is -zp4. */
# ifndef SMALL_CONFIG
# define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
/* improvement on Pentiums. */
# endif
# ifdef SEQUENT
# define OS_TYPE "SEQUENT"
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t) 0x3ffff000)
# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int etext, _start;
extern char * GC_SysVGetDataStart();
# define DATASTART GC_SysVGetDataStart(0x1000, &etext)
# define STACKBOTTOM ((ptr_t)(&_start))
/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
/*# define PROC_VDB*/
# define DYNAMIC_LOADING
# ifndef USE_MMAP
# define USE_MMAP
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# endif
# ifdef SCO
# define OS_TYPE "SCO"
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
& ~0x3fffff) \
+((word)&etext & 0xfff))
# define STACKBOTTOM ((ptr_t) 0x7ffffffc)
# endif
# ifdef SCO_ELF
# define OS_TYPE "SCO_ELF"
extern int etext;
# define DATASTART ((ptr_t)(&etext))
# define STACKBOTTOM ((ptr_t) 0x08048000)
# define DYNAMIC_LOADING
# define ELF_CLASS ELFCLASS32
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define STACKBOTTOM ((ptr_t)0xc0000000)
/* Appears to be 0xe0000000 for at least one 2.1.91 kernel. */
/* Probably needs to be more flexible, but I don't yet */
/* fully understand how flexible. */
# define MPROTECT_VDB
# ifdef __ELF__
# define DYNAMIC_LOADING
# ifdef UNDEFINED /* includes ro data */
extern int _etext;
# define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
# endif
# include <linux/version.h>
# include <features.h>
# if LINUX_VERSION_CODE >= 0x20000 && defined(__GLIBC__) && __GLIBC__ >= 2
extern int __data_start;
# define DATASTART ((ptr_t)(&__data_start))
# else
extern char **__environ;
# define DATASTART ((ptr_t)(&__environ))
/* hideous kludge: __environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
/* ld options were passed through. */
/* We could use _etext instead, but that */
/* would include .rodata, which may */
/* contain large read-only data tables */
/* that we'd rather not scan. */
# endif
extern int _end;
# define DATAEND (&_end)
# else
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# endif
# endif
# ifdef CYGWIN32
extern int _data_start__;
extern int _data_end__;
extern int _bss_start__;
extern int _bss_end__;
/* For binutils 2.9.1, we have */
/* DATASTART = _data_start__ */
/* DATAEND = _bss_end__ */
/* whereas for some earlier versions it was */
/* DATASTART = _bss_start__ */
/* DATAEND = _data_end__ */
/* To get it right for both, we take the */
/* minumum/maximum of the two. */
# define MAX(x,y) ((x) > (y) ? (x) : (y))
# define MIN(x,y) ((x) < (y) ? (x) : (y))
# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))
# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))
# undef STACK_GRAN
# define STACK_GRAN 0x10000
# define HEURISTIC1
# endif
# ifdef OS2
# define OS_TYPE "OS2"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. OS2 actually has the right */
/* system call! */
# define DATAEND /* not needed */
# endif
# ifdef MSWIN32
# define OS_TYPE "MSWIN32"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. */
# ifndef __WATCOMC__
# define MPROTECT_VDB
# endif
# define DATAEND /* not needed */
# endif
# ifdef DJGPP
# define OS_TYPE "DJGPP"
# include "stubinfo.h"
extern int etext;
extern int _stklen;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
# define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
+ _stklen))
/* This may not be right. */
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# define MPROTECT_VDB
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# endif
# ifdef THREE86BSD
# define OS_TYPE "THREE86BSD"
# endif
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
# if defined(FREEBSD) || defined(NETBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef NEXT
# define OS_TYPE "NEXT"
# define DATASTART ((ptr_t) get_etext())
# define STACKBOTTOM ((ptr_t)0xc0000000)
# define DATAEND /* not needed */
# endif
# ifdef DOS4GW
# define OS_TYPE "DOS4GW"
/* Get_DATASTART, Get_DATAEND, Get_STACKBOTTOM
* Defined in gc-watcom.asm
*/
extern char* Get_DATASTART (void);
extern char* Get_DATAEND (void);
extern char* Get_STACKBOTTOM (void);
# pragma aux Get_DATASTART "*" value [eax];
# pragma aux Get_DATAEND "*" value [eax];
# pragma aux Get_STACKBOTTOM "*" value [eax];
# define DATASTART ((ptr_t) Get_DATASTART())
# define STACKBOTTOM ((ptr_t) Get_STACKBOTTOM())
# define DATAEND ((ptr_t) Get_DATAEND())
# endif
# endif
# ifdef NS32K
# define MACH_TYPE "NS32K"
# define ALIGNMENT 4
extern char **environ;
# define DATASTART ((ptr_t)(&environ))
/* hideous kludge: environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
/* ld options were passed through. */
# define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
# endif
# ifdef MIPS
# ifndef ECOS
# define MACH_TYPE "MIPS"
/* CYGNUS LOCAL: respect predefined DATASTART_IS_ETEXT. */
# ifdef DATASTART_IS_ETEXT
extern int _etext;
# define DATASTART ((ptr_t)(&_etext))
# else
# ifndef IRIX5
# define DATASTART (ptr_t)0x10000000
/* Could probably be slightly higher since */
/* startup code allocates lots of stuff. */
# else
extern int _fdata;
# define DATASTART ((ptr_t)(&_fdata))
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x30000000
# else
# define HEAP_START DATASTART
# endif
/* Lowest plausible heap address. */
/* In the MMAP case, we map there. */
/* In either case it is used to identify */
/* heap sections so they're not */
/* considered as roots. */
# endif /* IRIX5 */
# endif /* DATASTART_IS_ETEXT */
# define HEURISTIC2
/* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
# ifdef ULTRIX
# define OS_TYPE "ULTRIX"
# define ALIGNMENT 4
# endif
# ifdef RISCOS
# define OS_TYPE "RISCOS"
# define ALIGNMENT 4 /* Required by hardware */
# endif
# ifdef IRIX5
# define OS_TYPE "IRIX5"
# define MPROTECT_VDB
# ifdef _MIPS_SZPTR
# define CPP_WORDSZ _MIPS_SZPTR
# define ALIGNMENT (_MIPS_SZPTR/8)
# if CPP_WORDSZ != 64
# define ALIGN_DOUBLE
# endif
# else
# define ALIGNMENT 4
# define ALIGN_DOUBLE
# endif
# define DYNAMIC_LOADING
# endif
# endif /* ECOS */
# ifdef ECOS
extern char __ram_data_start;
extern char __ram_data_end;
# define MACH_TYPE "MIPS"
# define DATASTART (ptr_t)(&__ram_data_start)
# define DATAEND (ptr_t)(&__ram_data_end)
# define HEURISTIC2
# define ALIGNMENT 4
# define ALIGN_DOUBLE
# endif /* ECOS */
# endif
# ifdef RS6000
# define MACH_TYPE "RS6000"
# define ALIGNMENT 4
# define DATASTART ((ptr_t)0x20000000)
extern int errno;
# define STACKBOTTOM ((ptr_t)((ulong)&errno))
# define DYNAMIC_LOADING
/* For really old versions of AIX, this may have to be removed. */
# endif
# ifdef HP_PA
# define MACH_TYPE "HP_PA"
# define ALIGNMENT 4
# define ALIGN_DOUBLE
extern int __data_start;
# define DATASTART ((ptr_t)(&__data_start))
# if 0
/* The following appears to work for 7xx systems running HP/UX */
/* 9.xx Furthermore, it might result in much faster */
/* collections than HEURISTIC2, which may involve scanning */
/* segments that directly precede the stack. It is not the */
/* default, since it may not work on older machine/OS */
/* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
/* this.) */
# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
# else
# define HEURISTIC2
# endif
# define STACK_GROWS_UP
# define DYNAMIC_LOADING
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
/* They misspelled the Posix macro? */
# endif
# ifdef ALPHA
# define MACH_TYPE "ALPHA"
# define ALIGNMENT 8
# ifdef OSF1
# define OS_TYPE "OSF1"
# define DATASTART ((ptr_t) 0x140000000)
# define HEURISTIC2
/* Normally HEURISTIC2 is too conervative, since */
/* the text segment immediately follows the stack. */
/* Hence we give an upper pound. */
extern int __start;
# define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
# define CPP_WORDSZ 64
# define MPROTECT_VDB
# define DYNAMIC_LOADING
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define CPP_WORDSZ 64
# define STACKBOTTOM ((ptr_t) 0x120000000)
# ifdef __ELF__
extern int __data_start;
# define DATASTART &__data_start
# define DYNAMIC_LOADING
# else
# define DATASTART ((ptr_t) 0x140000000)
# endif
extern int _end;
# define DATAEND (&_end)
/* As of 1.3.90, I couldn't find a way to retrieve the correct */
/* fault address from a signal handler. */
/* Hence MPROTECT_VDB is broken. */
# endif
# endif
# ifdef M88K
# define MACH_TYPE "M88K"
# define ALIGNMENT 4
# define ALIGN_DOUBLE
extern int etext;
# ifdef CX_UX
# define OS_TYPE "CX_UX"
# define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
# endif
# ifdef DGUX
# define OS_TYPE "DGUX"
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
# endif
# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
# endif
# ifdef S370
# define MACH_TYPE "S370"
# define OS_TYPE "UTS4"
# define ALIGNMENT 4 /* Required by hardware */
extern int etext;
extern int _etext;
extern int _end;
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
# define HEURISTIC2
# endif
# ifndef STACK_GROWS_UP
# define STACK_GROWS_DOWN
# endif
# ifndef CPP_WORDSZ
# define CPP_WORDSZ 32
# endif
# ifndef OS_TYPE
# define OS_TYPE ""
# endif
# ifndef DATAEND
extern int end;
# define DATAEND (&end)
# endif
# if defined(SVR4) && !defined(GETPAGESIZE)
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
# endif
# ifndef GETPAGESIZE
# if defined(SUNOS5) || defined(IRIX5)
# include <unistd.h>
# endif
# define GETPAGESIZE() getpagesize()
# endif
# if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
/* OS has SVR4 generic features. Probably others also qualify. */
# define SVR4
# endif
# if defined(SUNOS5) || defined(DRSNX)
/* OS has SUNOS5 style semi-undocumented interface to dynamic */
/* loader. */
# define SUNOS5DL
/* OS has SUNOS5 style signal handlers. */
# define SUNOS5SIGS
# endif
# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
-> bad word size
# endif
# ifdef PCR
# undef DYNAMIC_LOADING
# undef STACKBOTTOM
# undef HEURISTIC1
# undef HEURISTIC2
# undef PROC_VDB
# undef MPROTECT_VDB
# define PCR_VDB
# endif
# ifdef SRC_M3
/* Postponed for now. */
# undef PROC_VDB
# undef MPROTECT_VDB
# endif
# ifdef SMALL_CONFIG
/* Presumably not worth the space it takes. */
# undef PROC_VDB
# undef MPROTECT_VDB
# endif
# if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
# define DEFAULT_VDB
# endif
# if defined(IRIX_THREADS) && !defined(IRIX5)
--> inconsistent configuration
# endif
# if defined(LINUX_THREADS) && !defined(LINUX)
--> inconsistent configuration
# endif
# if defined(SOLARIS_THREADS) && !defined(SUNOS5)
--> inconsistent configuration
# endif
# if defined(PCR) || defined(SRC_M3) || \
defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
defined(IRIX_THREADS) || defined(LINUX_THREADS) || \
defined(QUICK_THREADS)
# define THREADS
# endif
# if defined(SPARC)
# define SAVE_CALL_CHAIN
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */
# endif
# endif

2848
boehm-gc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +0,0 @@
# configure.host
# This shell script handles all host based configuration for boehm_gc.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# target_optspace --enable-target-optspace ("yes", "no", "")
# It sets the following shell variables:
# boehm_gc_cflags Special CFLAGS to use when building
boehm_gc_cflags=
case "${target_optspace}:${host}" in
yes:*)
boehm_gc_cflags="${boehm_gc_cflags} -Os"
;;
:m32r-* | :d10v-* | :d30v-*)
boehm_gc_cflags="${boehm_gc_cflags} -Os"
;;
no:* | :*)
# Nothing.
;;
esac
# Set any host dependent compiler flags.
# THIS TABLE IS SORTED. KEEP IT THAT WAY.
case "${host}" in
mips-tx39-*|mipstx39-unknown-*)
boehm_gc_cflags="${boehm_gc_cflags} -G 0"
;;
*)
;;
esac

View File

@ -1,230 +0,0 @@
dnl Process this file with autoconf to produce configure.
AC_INIT(gc_mark.h)
dnl Can't be done in BOEHM_CONFIGURE because that confuses automake.
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_SYSTEM
BOEHM_CONFIGURE(.)
AM_PROG_LIBTOOL
dnl We use these options to decide which functions to include.
AC_ARG_WITH(target-subdir,
[ --with-target-subdir=SUBDIR Configuring with a cross compiler])
AC_ARG_WITH(cross-host,
[ --with-cross-host=HOST Configuring with a cross compiler])
AM_MAINTAINER_MODE
# automake wants to see AC_EXEEXT. But we don't need it. And having
# it is actually a problem, because the compiler we're passed can't
# necessarily do a full link. So we fool automake here.
if test "x" = "y"; then
AC_EXEEXT
fi
AC_MSG_CHECKING([for threads package to use])
AC_ARG_ENABLE(threads, [ --enable-threads=TYPE choose threading package],
THREADS=$enableval,
dnl FIXME: figure out native threads to use here.
THREADS=no)
if test "$THREADS" = yes; then
case "$host" in
*-*-vxworks*)
THREADS=vxworks
;;
*-*-linux*)
# FIXME: this isn't correct in all cases.
THREADS=posix
;;
*-*-win*)
THREADS=win32
;;
*-*-irix*)
# FIXME: for now, choose POSIX, because we implement that.
# Later, choose irix threads.
THREADS=posix
;;
*-*-solaris*)
# FIXME: for now, choose POSIX, because we implement that.
# Later, choose solaris threads.
THREADS=posix
;;
*)
# For now.
THREADS=none
;;
esac
fi
INCLUDES=
case "$THREADS" in
no | none | single)
THREADS=none
;;
posix | pthreads)
THREADS=posix
case "$host" in
*-*-linux*)
AC_DEFINE(LINUX_THREADS)
AC_DEFINE(_REENTRANT)
;;
*-*-solaris*)
AC_DEFINE(SOLARIS_THREADS)
AC_DEFINE(_SOLARIS_PTHREADS)
;;
*-*-irix*)
AC_DEFINE(IRIX_THREADS)
;;
esac
;;
qt)
AC_DEFINE(QUICK_THREADS)
INCLUDES="-I${boehm_gc_basedir}/../qthreads"
;;
decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
AC_MSG_ERROR(thread package $THREADS not yet supported)
;;
*)
AC_MSG_ERROR($THREADS is an unknown thread package)
;;
esac
AC_MSG_RESULT($THREADS)
AC_ARG_ENABLE(java-gc,
changequote(<<,>>)dnl
<< --enable-java-gc=TYPE choose garbage collector [boehm]>>,
changequote([,])
GC=$enableval,
GC=boehm)
target_all=
if test "$GC" = "boehm"; then
target_all=libgcjgc.la
fi
AC_SUBST(target_all)
dnl If the target is an eCos system, use the appropriate eCos
dnl I/O routines.
dnl FIXME: this should not be a local option but a global target
dnl system; at present there is no eCos target.
TARGET_ECOS="no"
AC_ARG_WITH(ecos,
[ --with-ecos Enable runtime eCos target support.],
TARGET_ECOS="$with_ecos"
)
addobjs=
CXXINCLUDES=
case "$TARGET_ECOS" in
no)
;;
*)
AC_DEFINE(ECOS)
CXXINCLUDES="-I${TARGET_ECOS}/include"
addobjs="$addobjs ecos.lo"
;;
esac
AC_SUBST(CXX)
AC_SUBST(INCLUDES)
AC_SUBST(CXXINCLUDES)
machdep=
case "$host" in
alpha-*-*)
machdep="alpha_mach_dep.lo"
;;
mips-*-*)
machdep="mips_sgi_mach_dep.lo"
AC_DEFINE(NO_EXECUTE_PERMISSION)
;;
mipstx39-*-elf*)
machdep="mips_ultrix_mach_dep.lo"
AC_DEFINE(STACKBASE, __stackbase)
AC_DEFINE(DATASTART_IS_ETEXT)
;;
sparc-sun-solaris2.3*)
AC_DEFINE(SUNOS53_SHARED_LIB)
;;
esac
if test x"$machdep" = x; then
machdep="mach_dep.lo"
fi
addobjs="$addobjs $machdep"
AC_SUBST(addobjs)
dnl As of 4.13a2, the collector will not properly work on Solaris when
dnl built with gcc and -O. So we remove -O in the appropriate case.
case "$host" in
sparc-sun-solaris2*)
if test "$GCC" = yes; then
new_CFLAGS=
for i in $CFLAGS; do
case "$i" in
-O*)
;;
*)
new_CFLAGS="$new_CFLAGS $i"
;;
esac
done
CFLAGS="$new_CFLAGS"
fi
;;
esac
dnl We need to override the top-level CFLAGS. This is how we do it.
MY_CFLAGS="$CFLAGS"
AC_SUBST(MY_CFLAGS)
dnl Define a few things to retarget the library towards
dnl embedded Java.
AC_DEFINE(SILENT)
AC_DEFINE(NO_SIGNALS)
AC_DEFINE(NO_DEBUGGING)
AC_DEFINE(JAVA_FINALIZATION)
dnl Create boehm-config.h so that libjava can find it.
dnl It is required to use gc_priv.h, which is required to write
dnl a new marking function. So config.h in this package is
dnl poorly named.
AC_LINK_FILES(config.h, boehm-config.h)
dnl This is something of a hack. When cross-compiling we turn off
dnl some functionality. We also enable the "small" configuration.
dnl These is only correct when targetting an embedded system. FIXME.
if test -n "${with_cross_host}"; then
AC_DEFINE(NO_SIGSET)
AC_DEFINE(NO_CLOCK)
AC_DEFINE(SMALL_CONFIG)
fi
if test "${multilib}" = "yes"; then
multilib_arg="--enable-multilib"
else
multilib_arg=
fi
AC_OUTPUT(Makefile,
[
dnl Put all the -D options in a file. These are required before
dnl boehm-config.h can be included. This is a huge hack brought
dnl about by overall poor structuring of this entire library.
echo "$DEFS" > boehm-cflags
if test -n "$CONFIG_FILES"; then
ac_file=Makefile . ${boehm_gc_basedir}/../config-ml.in
fi],
srcdir=${srcdir}
host=${host}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${multilib_arg} ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
boehm_gc_basedir=${boehm_gc_basedir}
CC="${CC}"
DEFS="$DEFS"
)

View File

@ -1,31 +0,0 @@
Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program
for any purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
Please send bug reports to Hans-J. Boehm (boehm@sgi.com).
This is a string packages that uses a tree-based representation.
See cord.h for a description of the functions provided. Ec.h describes
"extensible cords", which are essentially output streams that write
to a cord. These allow for efficient construction of cords without
requiring a bound on the size of a cord.
de.c is a very dumb text editor that illustrates the use of cords.
It maintains a list of file versions. Each version is simply a
cord representing the file contents. Nonetheless, standard
editing operations are efficient, even on very large files.
(Its 3 line "user manual" can be obtained by invoking it without
arguments. Note that ^R^N and ^R^P move the cursor by
almost a screen. It does not understand tabs, which will show
up as highlighred "I"s. Use the UNIX "expand" program first.)
To build the editor, type "make cord/de" in the gc directory.
This package assumes an ANSI C compiler such as gcc. It will
not compile with an old-style K&R compiler.

View File

@ -1,14 +0,0 @@
MATH=STANDARD
CPU=68030
NOSTACKCHECK
OPTIMIZE
VERBOSE
NOVERSION
NOICONS
OPTIMIZERTIME
INCLUDEDIR=/
DEFINE AMIGA
LIBRARY=cord.lib
LIBRARY=/gc.lib
IGNORE=100
IGNORE=161

View File

@ -1,20 +0,0 @@
# Makefile for cord.lib
# Michel Schinz 1994/07/20
OBJS = cordbscs.o cordprnt.o cordxtra.o
all: cord.lib cordtest
cordbscs.o: cordbscs.c
cordprnt.o: cordprnt.c
cordxtra.o: cordxtra.c
cordtest.o: cordtest.c
cord.lib: $(OBJS)
oml cord.lib r $(OBJS)
cordtest: cordtest.o cord.lib
sc cordtest.o link
clean:
delete cord.lib cordtest \#?.o \#?.lnk

View File

@ -1,327 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Author: Hans-J. Boehm (boehm@parc.xerox.com)
*/
/* Boehm, October 5, 1995 4:20 pm PDT */
/*
* Cords are immutable character strings. A number of operations
* on long cords are much more efficient than their strings.h counterpart.
* In particular, concatenation takes constant time independent of the length
* of the arguments. (Cords are represented as trees, with internal
* nodes representing concatenation and leaves consisting of either C
* strings or a functional description of the string.)
*
* The following are reasonable applications of cords. They would perform
* unacceptably if C strings were used:
* - A compiler that produces assembly language output by repeatedly
* concatenating instructions onto a cord representing the output file.
* - A text editor that converts the input file to a cord, and then
* performs editing operations by producing a new cord representing
* the file after echa character change (and keeping the old ones in an
* edit history)
*
* For optimal performance, cords should be built by
* concatenating short sections.
* This interface is designed for maximum compatibility with C strings.
* ASCII NUL characters may be embedded in cords using CORD_from_fn.
* This is handled correctly, but CORD_to_char_star will produce a string
* with embedded NULs when given such a cord.
*
* This interface is fairly big, largely for performance reasons.
* The most basic constants and functions:
*
* CORD - the type fo a cord;
* CORD_EMPTY - empty cord;
* CORD_len(cord) - length of a cord;
* CORD_cat(cord1,cord2) - concatenation of two cords;
* CORD_substr(cord, start, len) - substring (or subcord);
* CORD_pos i; CORD_FOR(i, cord) { ... CORD_pos_fetch(i) ... } -
* examine each character in a cord. CORD_pos_fetch(i) is the char.
* CORD_fetch(int i) - Retrieve i'th character (slowly).
* CORD_cmp(cord1, cord2) - compare two cords.
* CORD_from_file(FILE * f) - turn a read-only file into a cord.
* CORD_to_char_star(cord) - convert to C string.
* (Non-NULL C constant strings are cords.)
* CORD_printf (etc.) - cord version of printf. Use %r for cords.
*/
# ifndef CORD_H
# define CORD_H
# include <stddef.h>
# include <stdio.h>
/* Cords have type const char *. This is cheating quite a bit, and not */
/* 100% portable. But it means that nonempty character string */
/* constants may be used as cords directly, provided the string is */
/* never modified in place. The empty cord is represented by, and */
/* can be written as, 0. */
typedef const char * CORD;
/* An empty cord is always represented as nil */
# define CORD_EMPTY 0
/* Is a nonempty cord represented as a C string? */
#define CORD_IS_STRING(s) (*(s) != '\0')
/* Concatenate two cords. If the arguments are C strings, they may */
/* not be subsequently altered. */
CORD CORD_cat(CORD x, CORD y);
/* Concatenate a cord and a C string with known length. Except for the */
/* empty string case, this is a special case of CORD_cat. Since the */
/* length is known, it can be faster. */
/* The string y is shared with the resulting CORD. Hence it should */
/* not be altered by the caller. */
CORD CORD_cat_char_star(CORD x, const char * y, size_t leny);
/* Compute the length of a cord */
size_t CORD_len(CORD x);
/* Cords may be represented by functions defining the ith character */
typedef char (* CORD_fn)(size_t i, void * client_data);
/* Turn a functional description into a cord. */
CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len);
/* Return the substring (subcord really) of x with length at most n, */
/* starting at position i. (The initial character has position 0.) */
CORD CORD_substr(CORD x, size_t i, size_t n);
/* Return the argument, but rebalanced to allow more efficient */
/* character retrieval, substring operations, and comparisons. */
/* This is useful only for cords that were built using repeated */
/* concatenation. Guarantees log time access to the result, unless */
/* x was obtained through a large number of repeated substring ops */
/* or the embedded functional descriptions take longer to evaluate. */
/* May reallocate significant parts of the cord. The argument is not */
/* modified; only the result is balanced. */
CORD CORD_balance(CORD x);
/* The following traverse a cord by applying a function to each */
/* character. This is occasionally appropriate, especially where */
/* speed is crucial. But, since C doesn't have nested functions, */
/* clients of this sort of traversal are clumsy to write. Consider */
/* the functions that operate on cord positions instead. */
/* Function to iteratively apply to individual characters in cord. */
typedef int (* CORD_iter_fn)(char c, void * client_data);
/* Function to apply to substrings of a cord. Each substring is a */
/* a C character string, not a general cord. */
typedef int (* CORD_batched_iter_fn)(const char * s, void * client_data);
# define CORD_NO_FN ((CORD_batched_iter_fn)0)
/* Apply f1 to each character in the cord, in ascending order, */
/* starting at position i. If */
/* f2 is not CORD_NO_FN, then multiple calls to f1 may be replaced by */
/* a single call to f2. The parameter f2 is provided only to allow */
/* some optimization by the client. This terminates when the right */
/* end of this string is reached, or when f1 or f2 return != 0. In the */
/* latter case CORD_iter returns != 0. Otherwise it returns 0. */
/* The specified value of i must be < CORD_len(x). */
int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1,
CORD_batched_iter_fn f2, void * client_data);
/* A simpler version that starts at 0, and without f2: */
int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data);
# define CORD_iter(x, f1, cd) CORD_iter5(x, 0, f1, CORD_NO_FN, cd)
/* Similar to CORD_iter5, but end-to-beginning. No provisions for */
/* CORD_batched_iter_fn. */
int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data);
/* A simpler version that starts at the end: */
int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data);
/* Functions that operate on cord positions. The easy way to traverse */
/* cords. A cord position is logically a pair consisting of a cord */
/* and an index into that cord. But it is much faster to retrieve a */
/* charcter based on a position than on an index. Unfortunately, */
/* positions are big (order of a few 100 bytes), so allocate them with */
/* caution. */
/* Things in cord_pos.h should be treated as opaque, except as */
/* described below. Also note that */
/* CORD_pos_fetch, CORD_next and CORD_prev have both macro and function */
/* definitions. The former may evaluate their argument more than once. */
# include "private/cord_pos.h"
/*
Visible definitions from above:
typedef <OPAQUE but fairly big> CORD_pos[1];
* Extract the cord from a position:
CORD CORD_pos_to_cord(CORD_pos p);
* Extract the current index from a position:
size_t CORD_pos_to_index(CORD_pos p);
* Fetch the character located at the given position:
char CORD_pos_fetch(CORD_pos p);
* Initialize the position to refer to the given cord and index.
* Note that this is the most expensive function on positions:
void CORD_set_pos(CORD_pos p, CORD x, size_t i);
* Advance the position to the next character.
* P must be initialized and valid.
* Invalidates p if past end:
void CORD_next(CORD_pos p);
* Move the position to the preceding character.
* P must be initialized and valid.
* Invalidates p if past beginning:
void CORD_prev(CORD_pos p);
* Is the position valid, i.e. inside the cord?
int CORD_pos_valid(CORD_pos p);
*/
# define CORD_FOR(pos, cord) \
for (CORD_set_pos(pos, cord, 0); CORD_pos_valid(pos); CORD_next(pos))
/* An out of memory handler to call. May be supplied by client. */
/* Must not return. */
extern void (* CORD_oom_fn)(void);
/* Dump the representation of x to stdout in an implementation defined */
/* manner. Intended for debugging only. */
void CORD_dump(CORD x);
/* The following could easily be implemented by the client. They are */
/* provided in cordxtra.c for convenience. */
/* Concatenate a character to the end of a cord. */
CORD CORD_cat_char(CORD x, char c);
/* Concatenate n cords. */
CORD CORD_catn(int n, /* CORD */ ...);
/* Return the character in CORD_substr(x, i, 1) */
char CORD_fetch(CORD x, size_t i);
/* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y */
int CORD_cmp(CORD x, CORD y);
/* A generalization that takes both starting positions for the */
/* comparison, and a limit on the number of characters to be compared. */
int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len);
/* Find the first occurrence of s in x at position start or later. */
/* Return the position of the first character of s in x, or */
/* CORD_NOT_FOUND if there is none. */
size_t CORD_str(CORD x, size_t start, CORD s);
/* Return a cord consisting of i copies of (possibly NUL) c. Dangerous */
/* in conjunction with CORD_to_char_star. */
/* The resulting representation takes constant space, independent of i. */
CORD CORD_chars(char c, size_t i);
# define CORD_nul(i) CORD_chars('\0', (i))
/* Turn a file into cord. The file must be seekable. Its contents */
/* must remain constant. The file may be accessed as an immediate */
/* result of this call and/or as a result of subsequent accesses to */
/* the cord. Short files are likely to be immediately read, but */
/* long files are likely to be read on demand, possibly relying on */
/* stdio for buffering. */
/* We must have exclusive access to the descriptor f, i.e. we may */
/* read it at any time, and expect the file pointer to be */
/* where we left it. Normally this should be invoked as */
/* CORD_from_file(fopen(...)) */
/* CORD_from_file arranges to close the file descriptor when it is no */
/* longer needed (e.g. when the result becomes inaccessible). */
/* The file f must be such that ftell reflects the actual character */
/* position in the file, i.e. the number of characters that can be */
/* or were read with fread. On UNIX systems this is always true. On */
/* MS Windows systems, f must be opened in binary mode. */
CORD CORD_from_file(FILE * f);
/* Equivalent to the above, except that the entire file will be read */
/* and the file pointer will be closed immediately. */
/* The binary mode restriction from above does not apply. */
CORD CORD_from_file_eager(FILE * f);
/* Equivalent to the above, except that the file will be read on demand.*/
/* The binary mode restriction applies. */
CORD CORD_from_file_lazy(FILE * f);
/* Turn a cord into a C string. The result shares no structure with */
/* x, and is thus modifiable. */
char * CORD_to_char_star(CORD x);
/* Turn a C string into a CORD. The C string is copied, and so may */
/* subsequently be modified. */
CORD CORD_from_char_star(const char *s);
/* Identical to the above, but the result may share structure with */
/* the argument and is thus not modifiable. */
const char * CORD_to_const_char_star(CORD x);
/* Write a cord to a file, starting at the current position. No */
/* trailing NULs are newlines are added. */
/* Returns EOF if a write error occurs, 1 otherwise. */
int CORD_put(CORD x, FILE * f);
/* "Not found" result for the following two functions. */
# define CORD_NOT_FOUND ((size_t)(-1))
/* A vague analog of strchr. Returns the position (an integer, not */
/* a pointer) of the first occurrence of (char) c inside x at position */
/* i or later. The value i must be < CORD_len(x). */
size_t CORD_chr(CORD x, size_t i, int c);
/* A vague analog of strrchr. Returns index of the last occurrence */
/* of (char) c inside x at position i or earlier. The value i */
/* must be < CORD_len(x). */
size_t CORD_rchr(CORD x, size_t i, int c);
/* The following are also not primitive, but are implemented in */
/* cordprnt.c. They provide functionality similar to the ANSI C */
/* functions with corresponding names, but with the following */
/* additions and changes: */
/* 1. A %r conversion specification specifies a CORD argument. Field */
/* width, precision, etc. have the same semantics as for %s. */
/* (Note that %c,%C, and %S were already taken.) */
/* 2. The format string is represented as a CORD. */
/* 3. CORD_sprintf and CORD_vsprintf assign the result through the 1st */ /* argument. Unlike their ANSI C versions, there is no need to guess */
/* the correct buffer size. */
/* 4. Most of the conversions are implement through the native */
/* vsprintf. Hence they are usually no faster, and */
/* idiosyncracies of the native printf are preserved. However, */
/* CORD arguments to CORD_sprintf and CORD_vsprintf are NOT copied; */
/* the result shares the original structure. This may make them */
/* very efficient in some unusual applications. */
/* The format string is copied. */
/* All functions return the number of characters generated or -1 on */
/* error. This complies with the ANSI standard, but is inconsistent */
/* with some older implementations of sprintf. */
/* The implementation of these is probably less portable than the rest */
/* of this package. */
#ifndef CORD_NO_IO
#include <stdarg.h>
int CORD_sprintf(CORD * out, CORD format, ...);
int CORD_vsprintf(CORD * out, CORD format, va_list args);
int CORD_fprintf(FILE * f, CORD format, ...);
int CORD_vfprintf(FILE * f, CORD format, va_list args);
int CORD_printf(CORD format, ...);
int CORD_vprintf(CORD format, va_list args);
#endif /* CORD_NO_IO */
# endif /* CORD_H */

View File

@ -1,916 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Author: Hans-J. Boehm (boehm@parc.xerox.com)
*/
/* Boehm, October 3, 1994 5:19 pm PDT */
# include "gc.h"
# include "cord.h"
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
/* An implementation of the cord primitives. These are the only */
/* Functions that understand the representation. We perform only */
/* minimal checks on arguments to these functions. Out of bounds */
/* arguments to the iteration functions may result in client functions */
/* invoked on garbage data. In most cases, client functions should be */
/* programmed defensively enough that this does not result in memory */
/* smashes. */
typedef void (* oom_fn)(void);
oom_fn CORD_oom_fn = (oom_fn) 0;
# define OUT_OF_MEMORY { if (CORD_oom_fn != (oom_fn) 0) (*CORD_oom_fn)(); \
ABORT("Out of memory\n"); }
# define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); }
typedef unsigned long word;
typedef union {
struct Concatenation {
char null;
char header;
char depth; /* concatenation nesting depth. */
unsigned char left_len;
/* Length of left child if it is sufficiently */
/* short; 0 otherwise. */
# define MAX_LEFT_LEN 255
word len;
CORD left; /* length(left) > 0 */
CORD right; /* length(right) > 0 */
} concatenation;
struct Function {
char null;
char header;
char depth; /* always 0 */
char left_len; /* always 0 */
word len;
CORD_fn fn;
void * client_data;
} function;
struct Generic {
char null;
char header;
char depth;
char left_len;
word len;
} generic;
char string[1];
} CordRep;
# define CONCAT_HDR 1
# define FN_HDR 4
# define SUBSTR_HDR 6
/* Substring nodes are a special case of function nodes. */
/* The client_data field is known to point to a substr_args */
/* structure, and the function is either CORD_apply_access_fn */
/* or CORD_index_access_fn. */
/* The following may be applied only to function and concatenation nodes: */
#define IS_CONCATENATION(s) (((CordRep *)s)->generic.header == CONCAT_HDR)
#define IS_FUNCTION(s) ((((CordRep *)s)->generic.header & FN_HDR) != 0)
#define IS_SUBSTR(s) (((CordRep *)s)->generic.header == SUBSTR_HDR)
#define LEN(s) (((CordRep *)s) -> generic.len)
#define DEPTH(s) (((CordRep *)s) -> generic.depth)
#define GEN_LEN(s) (CORD_IS_STRING(s) ? strlen(s) : LEN(s))
#define LEFT_LEN(c) ((c) -> left_len != 0? \
(c) -> left_len \
: (CORD_IS_STRING((c) -> left) ? \
(c) -> len - GEN_LEN((c) -> right) \
: LEN((c) -> left)))
#define SHORT_LIMIT (sizeof(CordRep) - 1)
/* Cords shorter than this are C strings */
/* Dump the internal representation of x to stdout, with initial */
/* indentation level n. */
void CORD_dump_inner(CORD x, unsigned n)
{
register size_t i;
for (i = 0; i < (size_t)n; i++) {
fputs(" ", stdout);
}
if (x == 0) {
fputs("NIL\n", stdout);
} else if (CORD_IS_STRING(x)) {
for (i = 0; i <= SHORT_LIMIT; i++) {
if (x[i] == '\0') break;
putchar(x[i]);
}
if (x[i] != '\0') fputs("...", stdout);
putchar('\n');
} else if (IS_CONCATENATION(x)) {
register struct Concatenation * conc =
&(((CordRep *)x) -> concatenation);
printf("Concatenation: %p (len: %d, depth: %d)\n",
x, (int)(conc -> len), (int)(conc -> depth));
CORD_dump_inner(conc -> left, n+1);
CORD_dump_inner(conc -> right, n+1);
} else /* function */{
register struct Function * func =
&(((CordRep *)x) -> function);
if (IS_SUBSTR(x)) printf("(Substring) ");
printf("Function: %p (len: %d): ", x, (int)(func -> len));
for (i = 0; i < 20 && i < func -> len; i++) {
putchar((*(func -> fn))(i, func -> client_data));
}
if (i < func -> len) fputs("...", stdout);
putchar('\n');
}
}
/* Dump the internal representation of x to stdout */
void CORD_dump(CORD x)
{
CORD_dump_inner(x, 0);
fflush(stdout);
}
CORD CORD_cat_char_star(CORD x, const char * y, size_t leny)
{
register size_t result_len;
register size_t lenx;
register int depth;
if (x == CORD_EMPTY) return(y);
if (leny == 0) return(x);
if (CORD_IS_STRING(x)) {
lenx = strlen(x);
result_len = lenx + leny;
if (result_len <= SHORT_LIMIT) {
register char * result = GC_MALLOC_ATOMIC(result_len+1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, x, lenx);
memcpy(result + lenx, y, leny);
result[result_len] = '\0';
return((CORD) result);
} else {
depth = 1;
}
} else {
register CORD right;
register CORD left;
register char * new_right;
register size_t right_len;
lenx = LEN(x);
if (leny <= SHORT_LIMIT/2
&& IS_CONCATENATION(x)
&& CORD_IS_STRING(right = ((CordRep *)x) -> concatenation.right)) {
/* Merge y into right part of x. */
if (!CORD_IS_STRING(left = ((CordRep *)x) -> concatenation.left)) {
right_len = lenx - LEN(left);
} else if (((CordRep *)x) -> concatenation.left_len != 0) {
right_len = lenx - ((CordRep *)x) -> concatenation.left_len;
} else {
right_len = strlen(right);
}
result_len = right_len + leny; /* length of new_right */
if (result_len <= SHORT_LIMIT) {
new_right = GC_MALLOC_ATOMIC(result_len + 1);
memcpy(new_right, right, right_len);
memcpy(new_right + right_len, y, leny);
new_right[result_len] = '\0';
y = new_right;
leny = result_len;
x = left;
lenx -= right_len;
/* Now fall through to concatenate the two pieces: */
}
if (CORD_IS_STRING(x)) {
depth = 1;
} else {
depth = DEPTH(x) + 1;
}
} else {
depth = DEPTH(x) + 1;
}
result_len = lenx + leny;
}
{
/* The general case; lenx, result_len is known: */
register struct Concatenation * result;
result = GC_NEW(struct Concatenation);
if (result == 0) OUT_OF_MEMORY;
result->header = CONCAT_HDR;
result->depth = depth;
if (lenx <= MAX_LEFT_LEN) result->left_len = lenx;
result->len = result_len;
result->left = x;
result->right = y;
if (depth > MAX_DEPTH) {
return(CORD_balance((CORD)result));
} else {
return((CORD) result);
}
}
}
CORD CORD_cat(CORD x, CORD y)
{
register size_t result_len;
register int depth;
register size_t lenx;
if (x == CORD_EMPTY) return(y);
if (y == CORD_EMPTY) return(x);
if (CORD_IS_STRING(y)) {
return(CORD_cat_char_star(x, y, strlen(y)));
} else if (CORD_IS_STRING(x)) {
lenx = strlen(x);
depth = DEPTH(y) + 1;
} else {
register int depthy = DEPTH(y);
lenx = LEN(x);
depth = DEPTH(x) + 1;
if (depthy >= depth) depth = depthy + 1;
}
result_len = lenx + LEN(y);
{
register struct Concatenation * result;
result = GC_NEW(struct Concatenation);
if (result == 0) OUT_OF_MEMORY;
result->header = CONCAT_HDR;
result->depth = depth;
if (lenx <= MAX_LEFT_LEN) result->left_len = lenx;
result->len = result_len;
result->left = x;
result->right = y;
return((CORD) result);
}
}
CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len)
{
if (len <= 0) return(0);
if (len <= SHORT_LIMIT) {
register char * result;
register size_t i;
char buf[SHORT_LIMIT+1];
register char c;
for (i = 0; i < len; i++) {
c = (*fn)(i, client_data);
if (c == '\0') goto gen_case;
buf[i] = c;
}
buf[i] = '\0';
result = GC_MALLOC_ATOMIC(len+1);
if (result == 0) OUT_OF_MEMORY;
strcpy(result, buf);
result[len] = '\0';
return((CORD) result);
}
gen_case:
{
register struct Function * result;
result = GC_NEW(struct Function);
if (result == 0) OUT_OF_MEMORY;
result->header = FN_HDR;
/* depth is already 0 */
result->len = len;
result->fn = fn;
result->client_data = client_data;
return((CORD) result);
}
}
size_t CORD_len(CORD x)
{
if (x == 0) {
return(0);
} else {
return(GEN_LEN(x));
}
}
struct substr_args {
CordRep * sa_cord;
size_t sa_index;
};
char CORD_index_access_fn(size_t i, void * client_data)
{
register struct substr_args *descr = (struct substr_args *)client_data;
return(((char *)(descr->sa_cord))[i + descr->sa_index]);
}
char CORD_apply_access_fn(size_t i, void * client_data)
{
register struct substr_args *descr = (struct substr_args *)client_data;
register struct Function * fn_cord = &(descr->sa_cord->function);
return((*(fn_cord->fn))(i + descr->sa_index, fn_cord->client_data));
}
/* A version of CORD_substr that simply returns a function node, thus */
/* postponing its work. The fourth argument is a function that may */
/* be used for efficient access to the ith character. */
/* Assumes i >= 0 and i + n < length(x). */
CORD CORD_substr_closure(CORD x, size_t i, size_t n, CORD_fn f)
{
register struct substr_args * sa = GC_NEW(struct substr_args);
CORD result;
if (sa == 0) OUT_OF_MEMORY;
sa->sa_cord = (CordRep *)x;
sa->sa_index = i;
result = CORD_from_fn(f, (void *)sa, n);
((CordRep *)result) -> function.header = SUBSTR_HDR;
return (result);
}
# define SUBSTR_LIMIT (10 * SHORT_LIMIT)
/* Substrings of function nodes and flat strings shorter than */
/* this are flat strings. Othewise we use a functional */
/* representation, which is significantly slower to access. */
/* A version of CORD_substr that assumes i >= 0, n > 0, and i + n < length(x).*/
CORD CORD_substr_checked(CORD x, size_t i, size_t n)
{
if (CORD_IS_STRING(x)) {
if (n > SUBSTR_LIMIT) {
return(CORD_substr_closure(x, i, n, CORD_index_access_fn));
} else {
register char * result = GC_MALLOC_ATOMIC(n+1);
register char * p = result;
if (result == 0) OUT_OF_MEMORY;
strncpy(result, x+i, n);
result[n] = '\0';
return(result);
}
} else if (IS_CONCATENATION(x)) {
register struct Concatenation * conc
= &(((CordRep *)x) -> concatenation);
register size_t left_len;
register size_t right_len;
left_len = LEFT_LEN(conc);
right_len = conc -> len - left_len;
if (i >= left_len) {
if (n == right_len) return(conc -> right);
return(CORD_substr_checked(conc -> right, i - left_len, n));
} else if (i+n <= left_len) {
if (n == left_len) return(conc -> left);
return(CORD_substr_checked(conc -> left, i, n));
} else {
/* Need at least one character from each side. */
register CORD left_part;
register CORD right_part;
register size_t left_part_len = left_len - i;
if (i == 0) {
left_part = conc -> left;
} else {
left_part = CORD_substr_checked(conc -> left, i, left_part_len);
}
if (i + n == right_len + left_len) {
right_part = conc -> right;
} else {
right_part = CORD_substr_checked(conc -> right, 0,
n - left_part_len);
}
return(CORD_cat(left_part, right_part));
}
} else /* function */ {
if (n > SUBSTR_LIMIT) {
if (IS_SUBSTR(x)) {
/* Avoid nesting substring nodes. */
register struct Function * f = &(((CordRep *)x) -> function);
register struct substr_args *descr =
(struct substr_args *)(f -> client_data);
return(CORD_substr_closure((CORD)descr->sa_cord,
i + descr->sa_index,
n, f -> fn));
} else {
return(CORD_substr_closure(x, i, n, CORD_apply_access_fn));
}
} else {
char * result;
register struct Function * f = &(((CordRep *)x) -> function);
char buf[SUBSTR_LIMIT+1];
register char * p = buf;
register char c;
register int j;
register int lim = i + n;
for (j = i; j < lim; j++) {
c = (*(f -> fn))(j, f -> client_data);
if (c == '\0') {
return(CORD_substr_closure(x, i, n, CORD_apply_access_fn));
}
*p++ = c;
}
*p = '\0';
result = GC_MALLOC_ATOMIC(n+1);
if (result == 0) OUT_OF_MEMORY;
strcpy(result, buf);
return(result);
}
}
}
CORD CORD_substr(CORD x, size_t i, size_t n)
{
register size_t len = CORD_len(x);
if (i >= len || n <= 0) return(0);
/* n < 0 is impossible in a correct C implementation, but */
/* quite possible under SunOS 4.X. */
if (i + n > len) n = len - i;
# ifndef __STDC__
if (i < 0) ABORT("CORD_substr: second arg. negative");
/* Possible only if both client and C implementation are buggy. */
/* But empirically this happens frequently. */
# endif
return(CORD_substr_checked(x, i, n));
}
/* See cord.h for definition. We assume i is in range. */
int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1,
CORD_batched_iter_fn f2, void * client_data)
{
if (x == 0) return(0);
if (CORD_IS_STRING(x)) {
register const char *p = x+i;
if (*p == '\0') ABORT("2nd arg to CORD_iter5 too big");
if (f2 != CORD_NO_FN) {
return((*f2)(p, client_data));
} else {
while (*p) {
if ((*f1)(*p, client_data)) return(1);
p++;
}
return(0);
}
} else if (IS_CONCATENATION(x)) {
register struct Concatenation * conc
= &(((CordRep *)x) -> concatenation);
if (i > 0) {
register size_t left_len = LEFT_LEN(conc);
if (i >= left_len) {
return(CORD_iter5(conc -> right, i - left_len, f1, f2,
client_data));
}
}
if (CORD_iter5(conc -> left, i, f1, f2, client_data)) {
return(1);
}
return(CORD_iter5(conc -> right, 0, f1, f2, client_data));
} else /* function */ {
register struct Function * f = &(((CordRep *)x) -> function);
register size_t j;
register size_t lim = f -> len;
for (j = i; j < lim; j++) {
if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) {
return(1);
}
}
return(0);
}
}
#undef CORD_iter
int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data)
{
return(CORD_iter5(x, 0, f1, CORD_NO_FN, client_data));
}
int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data)
{
if (x == 0) return(0);
if (CORD_IS_STRING(x)) {
register const char *p = x + i;
register char c;
for(;;) {
c = *p;
if (c == '\0') ABORT("2nd arg to CORD_riter4 too big");
if ((*f1)(c, client_data)) return(1);
if (p == x) break;
p--;
}
return(0);
} else if (IS_CONCATENATION(x)) {
register struct Concatenation * conc
= &(((CordRep *)x) -> concatenation);
register CORD left_part = conc -> left;
register size_t left_len;
left_len = LEFT_LEN(conc);
if (i >= left_len) {
if (CORD_riter4(conc -> right, i - left_len, f1, client_data)) {
return(1);
}
return(CORD_riter4(left_part, left_len - 1, f1, client_data));
} else {
return(CORD_riter4(left_part, i, f1, client_data));
}
} else /* function */ {
register struct Function * f = &(((CordRep *)x) -> function);
register size_t j;
for (j = i; ; j--) {
if ((*f1)((*(f -> fn))(j, f -> client_data), client_data)) {
return(1);
}
if (j == 0) return(0);
}
}
}
int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data)
{
return(CORD_riter4(x, CORD_len(x) - 1, f1, client_data));
}
/*
* The following functions are concerned with balancing cords.
* Strategy:
* Scan the cord from left to right, keeping the cord scanned so far
* as a forest of balanced trees of exponentialy decreasing length.
* When a new subtree needs to be added to the forest, we concatenate all
* shorter ones to the new tree in the appropriate order, and then insert
* the result into the forest.
* Crucial invariants:
* 1. The concatenation of the forest (in decreasing order) with the
* unscanned part of the rope is equal to the rope being balanced.
* 2. All trees in the forest are balanced.
* 3. forest[i] has depth at most i.
*/
typedef struct {
CORD c;
size_t len; /* Actual length of c */
} ForestElement;
static size_t min_len [ MAX_DEPTH ];
static int min_len_init = 0;
int CORD_max_len;
typedef ForestElement Forest [ MAX_DEPTH ];
/* forest[i].len >= fib(i+1) */
/* The string is the concatenation */
/* of the forest in order of DECREASING */
/* indices. */
void CORD_init_min_len()
{
register int i;
register size_t last, previous, current;
min_len[0] = previous = 1;
min_len[1] = last = 2;
for (i = 2; i < MAX_DEPTH; i++) {
current = last + previous;
if (current < last) /* overflow */ current = last;
min_len[i] = current;
previous = last;
last = current;
}
CORD_max_len = last - 1;
min_len_init = 1;
}
void CORD_init_forest(ForestElement * forest, size_t max_len)
{
register int i;
for (i = 0; i < MAX_DEPTH; i++) {
forest[i].c = 0;
if (min_len[i] > max_len) return;
}
ABORT("Cord too long");
}
/* Add a leaf to the appropriate level in the forest, cleaning */
/* out lower levels as necessary. */
/* Also works if x is a balanced tree of concatenations; however */
/* in this case an extra concatenation node may be inserted above x; */
/* This node should not be counted in the statement of the invariants. */
void CORD_add_forest(ForestElement * forest, CORD x, size_t len)
{
register int i = 0;
register CORD sum = CORD_EMPTY;
register size_t sum_len = 0;
while (len > min_len[i + 1]) {
if (forest[i].c != 0) {
sum = CORD_cat(forest[i].c, sum);
sum_len += forest[i].len;
forest[i].c = 0;
}
i++;
}
/* Sum has depth at most 1 greter than what would be required */
/* for balance. */
sum = CORD_cat(sum, x);
sum_len += len;
/* If x was a leaf, then sum is now balanced. To see this */
/* consider the two cases in which forest[i-1] either is or is */
/* not empty. */
while (sum_len >= min_len[i]) {
if (forest[i].c != 0) {
sum = CORD_cat(forest[i].c, sum);
sum_len += forest[i].len;
/* This is again balanced, since sum was balanced, and has */
/* allowable depth that differs from i by at most 1. */
forest[i].c = 0;
}
i++;
}
i--;
forest[i].c = sum;
forest[i].len = sum_len;
}
CORD CORD_concat_forest(ForestElement * forest, size_t expected_len)
{
register int i = 0;
CORD sum = 0;
size_t sum_len = 0;
while (sum_len != expected_len) {
if (forest[i].c != 0) {
sum = CORD_cat(forest[i].c, sum);
sum_len += forest[i].len;
}
i++;
}
return(sum);
}
/* Insert the frontier of x into forest. Balanced subtrees are */
/* treated as leaves. This potentially adds one to the depth */
/* of the final tree. */
void CORD_balance_insert(CORD x, size_t len, ForestElement * forest)
{
register int depth;
if (CORD_IS_STRING(x)) {
CORD_add_forest(forest, x, len);
} else if (IS_CONCATENATION(x)
&& ((depth = DEPTH(x)) >= MAX_DEPTH
|| len < min_len[depth])) {
register struct Concatenation * conc
= &(((CordRep *)x) -> concatenation);
size_t left_len = LEFT_LEN(conc);
CORD_balance_insert(conc -> left, left_len, forest);
CORD_balance_insert(conc -> right, len - left_len, forest);
} else /* function or balanced */ {
CORD_add_forest(forest, x, len);
}
}
CORD CORD_balance(CORD x)
{
Forest forest;
register size_t len;
if (x == 0) return(0);
if (CORD_IS_STRING(x)) return(x);
if (!min_len_init) CORD_init_min_len();
len = LEN(x);
CORD_init_forest(forest, len);
CORD_balance_insert(x, len, forest);
return(CORD_concat_forest(forest, len));
}
/* Position primitives */
/* Private routines to deal with the hard cases only: */
/* P contains a prefix of the path to cur_pos. Extend it to a full */
/* path and set up leaf info. */
/* Return 0 if past the end of cord, 1 o.w. */
void CORD__extend_path(register CORD_pos p)
{
register struct CORD_pe * current_pe = &(p[0].path[p[0].path_len]);
register CORD top = current_pe -> pe_cord;
register size_t pos = p[0].cur_pos;
register size_t top_pos = current_pe -> pe_start_pos;
register size_t top_len = GEN_LEN(top);
/* Fill in the rest of the path. */
while(!CORD_IS_STRING(top) && IS_CONCATENATION(top)) {
register struct Concatenation * conc =
&(((CordRep *)top) -> concatenation);
register size_t left_len;
left_len = LEFT_LEN(conc);
current_pe++;
if (pos >= top_pos + left_len) {
current_pe -> pe_cord = top = conc -> right;
current_pe -> pe_start_pos = top_pos = top_pos + left_len;
top_len -= left_len;
} else {
current_pe -> pe_cord = top = conc -> left;
current_pe -> pe_start_pos = top_pos;
top_len = left_len;
}
p[0].path_len++;
}
/* Fill in leaf description for fast access. */
if (CORD_IS_STRING(top)) {
p[0].cur_leaf = top;
p[0].cur_start = top_pos;
p[0].cur_end = top_pos + top_len;
} else {
p[0].cur_end = 0;
}
if (pos >= top_pos + top_len) p[0].path_len = CORD_POS_INVALID;
}
char CORD__pos_fetch(register CORD_pos p)
{
/* Leaf is a function node */
struct CORD_pe * pe = &((p)[0].path[(p)[0].path_len]);
CORD leaf = pe -> pe_cord;
register struct Function * f = &(((CordRep *)leaf) -> function);
if (!IS_FUNCTION(leaf)) ABORT("CORD_pos_fetch: bad leaf");
return ((*(f -> fn))(p[0].cur_pos - pe -> pe_start_pos, f -> client_data));
}
void CORD__next(register CORD_pos p)
{
register size_t cur_pos = p[0].cur_pos + 1;
register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]);
register CORD leaf = current_pe -> pe_cord;
/* Leaf is not a string or we're at end of leaf */
p[0].cur_pos = cur_pos;
if (!CORD_IS_STRING(leaf)) {
/* Function leaf */
register struct Function * f = &(((CordRep *)leaf) -> function);
register size_t start_pos = current_pe -> pe_start_pos;
register size_t end_pos = start_pos + f -> len;
if (cur_pos < end_pos) {
/* Fill cache and return. */
register size_t i;
register size_t limit = cur_pos + FUNCTION_BUF_SZ;
register CORD_fn fn = f -> fn;
register void * client_data = f -> client_data;
if (limit > end_pos) {
limit = end_pos;
}
for (i = cur_pos; i < limit; i++) {
p[0].function_buf[i - cur_pos] =
(*fn)(i - start_pos, client_data);
}
p[0].cur_start = cur_pos;
p[0].cur_leaf = p[0].function_buf;
p[0].cur_end = limit;
return;
}
}
/* End of leaf */
/* Pop the stack until we find two concatenation nodes with the */
/* same start position: this implies we were in left part. */
{
while (p[0].path_len > 0
&& current_pe[0].pe_start_pos != current_pe[-1].pe_start_pos) {
p[0].path_len--;
current_pe--;
}
if (p[0].path_len == 0) {
p[0].path_len = CORD_POS_INVALID;
return;
}
}
p[0].path_len--;
CORD__extend_path(p);
}
void CORD__prev(register CORD_pos p)
{
register struct CORD_pe * pe = &(p[0].path[p[0].path_len]);
if (p[0].cur_pos == 0) {
p[0].path_len = CORD_POS_INVALID;
return;
}
p[0].cur_pos--;
if (p[0].cur_pos >= pe -> pe_start_pos) return;
/* Beginning of leaf */
/* Pop the stack until we find two concatenation nodes with the */
/* different start position: this implies we were in right part. */
{
register struct CORD_pe * current_pe = &((p)[0].path[(p)[0].path_len]);
while (p[0].path_len > 0
&& current_pe[0].pe_start_pos == current_pe[-1].pe_start_pos) {
p[0].path_len--;
current_pe--;
}
}
p[0].path_len--;
CORD__extend_path(p);
}
#undef CORD_pos_fetch
#undef CORD_next
#undef CORD_prev
#undef CORD_pos_to_index
#undef CORD_pos_to_cord
#undef CORD_pos_valid
char CORD_pos_fetch(register CORD_pos p)
{
if (p[0].cur_start <= p[0].cur_pos && p[0].cur_pos < p[0].cur_end) {
return(p[0].cur_leaf[p[0].cur_pos - p[0].cur_start]);
} else {
return(CORD__pos_fetch(p));
}
}
void CORD_next(CORD_pos p)
{
if (p[0].cur_pos < p[0].cur_end - 1) {
p[0].cur_pos++;
} else {
CORD__next(p);
}
}
void CORD_prev(CORD_pos p)
{
if (p[0].cur_end != 0 && p[0].cur_pos > p[0].cur_start) {
p[0].cur_pos--;
} else {
CORD__prev(p);
}
}
size_t CORD_pos_to_index(CORD_pos p)
{
return(p[0].cur_pos);
}
CORD CORD_pos_to_cord(CORD_pos p)
{
return(p[0].path[0].pe_cord);
}
int CORD_pos_valid(CORD_pos p)
{
return(p[0].path_len != CORD_POS_INVALID);
}
void CORD_set_pos(CORD_pos p, CORD x, size_t i)
{
if (x == CORD_EMPTY) {
p[0].path_len = CORD_POS_INVALID;
return;
}
p[0].path[0].pe_cord = x;
p[0].path[0].pe_start_pos = 0;
p[0].path_len = 0;
p[0].cur_pos = i;
CORD__extend_path(p);
}

View File

@ -1,389 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* An sprintf implementation that understands cords. This is probably */
/* not terribly portable. It assumes an ANSI stdarg.h. It further */
/* assumes that I can make copies of va_list variables, and read */
/* arguments repeatedly by applyting va_arg to the copies. This */
/* could be avoided at some performance cost. */
/* We also assume that unsigned and signed integers of various kinds */
/* have the same sizes, and can be cast back and forth. */
/* We assume that void * and char * have the same size. */
/* All this cruft is needed because we want to rely on the underlying */
/* sprintf implementation whenever possible. */
/* Boehm, September 21, 1995 6:00 pm PDT */
#include "cord.h"
#include "ec.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "gc.h"
#define CONV_SPEC_LEN 50 /* Maximum length of a single */
/* conversion specification. */
#define CONV_RESULT_LEN 50 /* Maximum length of any */
/* conversion with default */
/* width and prec. */
static int ec_len(CORD_ec x)
{
return(CORD_len(x[0].ec_cord) + (x[0].ec_bufptr - x[0].ec_buf));
}
/* Possible nonumeric precision values. */
# define NONE -1
# define VARIABLE -2
/* Copy the conversion specification from CORD_pos into the buffer buf */
/* Return negative on error. */
/* Source initially points one past the leading %. */
/* It is left pointing at the conversion type. */
/* Assign field width and precision to *width and *prec. */
/* If width or prec is *, VARIABLE is assigned. */
/* Set *left to 1 if left adjustment flag is present. */
/* Set *long_arg to 1 if long flag ('l' or 'L') is present, or to */
/* -1 if 'h' is present. */
static int extract_conv_spec(CORD_pos source, char *buf,
int * width, int *prec, int *left, int * long_arg)
{
register int result = 0;
register int current_number = 0;
register int saw_period = 0;
register int saw_number;
register int chars_so_far = 0;
register char current;
*width = NONE;
buf[chars_so_far++] = '%';
while(CORD_pos_valid(source)) {
if (chars_so_far >= CONV_SPEC_LEN) return(-1);
current = CORD_pos_fetch(source);
buf[chars_so_far++] = current;
switch(current) {
case '*':
saw_number = 1;
current_number = VARIABLE;
break;
case '0':
if (!saw_number) {
/* Zero fill flag; ignore */
break;
} /* otherwise fall through: */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
saw_number = 1;
current_number *= 10;
current_number += current - '0';
break;
case '.':
saw_period = 1;
if(saw_number) {
*width = current_number;
saw_number = 0;
}
current_number = 0;
break;
case 'l':
case 'L':
*long_arg = 1;
current_number = 0;
break;
case 'h':
*long_arg = -1;
current_number = 0;
break;
case ' ':
case '+':
case '#':
current_number = 0;
break;
case '-':
*left = 1;
current_number = 0;
break;
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
case 'f':
case 'e':
case 'E':
case 'g':
case 'G':
case 'c':
case 'C':
case 's':
case 'S':
case 'p':
case 'n':
case 'r':
goto done;
default:
return(-1);
}
CORD_next(source);
}
return(-1);
done:
if (saw_number) {
if (saw_period) {
*prec = current_number;
} else {
*prec = NONE;
*width = current_number;
}
} else {
*prec = NONE;
}
buf[chars_so_far] = '\0';
return(result);
}
int CORD_vsprintf(CORD * out, CORD format, va_list args)
{
CORD_ec result;
register int count;
register char current;
CORD_pos pos;
char conv_spec[CONV_SPEC_LEN + 1];
CORD_ec_init(result);
for (CORD_set_pos(pos, format, 0); CORD_pos_valid(pos); CORD_next(pos)) {
current = CORD_pos_fetch(pos);
if (current == '%') {
CORD_next(pos);
if (!CORD_pos_valid(pos)) return(-1);
current = CORD_pos_fetch(pos);
if (current == '%') {
CORD_ec_append(result, current);
} else {
int width, prec;
int left_adj = 0;
int long_arg = 0;
CORD arg;
size_t len;
if (extract_conv_spec(pos, conv_spec,
&width, &prec,
&left_adj, &long_arg) < 0) {
return(-1);
}
current = CORD_pos_fetch(pos);
switch(current) {
case 'n':
/* Assign length to next arg */
if (long_arg == 0) {
int * pos_ptr;
pos_ptr = va_arg(args, int *);
*pos_ptr = ec_len(result);
} else if (long_arg > 0) {
long * pos_ptr;
pos_ptr = va_arg(args, long *);
*pos_ptr = ec_len(result);
} else {
short * pos_ptr;
pos_ptr = va_arg(args, short *);
*pos_ptr = ec_len(result);
}
goto done;
case 'r':
/* Append cord and any padding */
if (width == VARIABLE) width = va_arg(args, int);
if (prec == VARIABLE) prec = va_arg(args, int);
arg = va_arg(args, CORD);
len = CORD_len(arg);
if (prec != NONE && len > prec) {
if (prec < 0) return(-1);
arg = CORD_substr(arg, 0, prec);
len = prec;
}
if (width != NONE && len < width) {
char * blanks = GC_MALLOC_ATOMIC(width-len+1);
memset(blanks, ' ', width-len);
blanks[width-len] = '\0';
if (left_adj) {
arg = CORD_cat(arg, blanks);
} else {
arg = CORD_cat(blanks, arg);
}
}
CORD_ec_append_cord(result, arg);
goto done;
case 'c':
if (width == NONE && prec == NONE) {
register char c = va_arg(args, char);
CORD_ec_append(result, c);
goto done;
}
break;
case 's':
if (width == NONE && prec == NONE) {
char * str = va_arg(args, char *);
register char c;
while (c = *str++) {
CORD_ec_append(result, c);
}
goto done;
}
break;
default:
break;
}
/* Use standard sprintf to perform conversion */
{
register char * buf;
va_list vsprintf_args = args;
/* The above does not appear to be sanctioned */
/* by the ANSI C standard. */
int max_size = 0;
int res;
if (width == VARIABLE) width = va_arg(args, int);
if (prec == VARIABLE) prec = va_arg(args, int);
if (width != NONE) max_size = width;
if (prec != NONE && prec > max_size) max_size = prec;
max_size += CONV_RESULT_LEN;
if (max_size >= CORD_BUFSZ) {
buf = GC_MALLOC_ATOMIC(max_size + 1);
} else {
if (CORD_BUFSZ - (result[0].ec_bufptr-result[0].ec_buf)
< max_size) {
CORD_ec_flush_buf(result);
}
buf = result[0].ec_bufptr;
}
switch(current) {
case 'd':
case 'i':
case 'o':
case 'u':
case 'x':
case 'X':
case 'c':
if (long_arg <= 0) {
(void) va_arg(args, int);
} else if (long_arg > 0) {
(void) va_arg(args, long);
}
break;
case 's':
case 'p':
(void) va_arg(args, char *);
break;
case 'f':
case 'e':
case 'E':
case 'g':
case 'G':
(void) va_arg(args, double);
break;
default:
return(-1);
}
res = vsprintf(buf, conv_spec, vsprintf_args);
len = (size_t)res;
if ((char *)(GC_word)res == buf) {
/* old style vsprintf */
len = strlen(buf);
} else if (res < 0) {
return(-1);
}
if (buf != result[0].ec_bufptr) {
register char c;
while (c = *buf++) {
CORD_ec_append(result, c);
}
} else {
result[0].ec_bufptr = buf + len;
}
}
done:;
}
} else {
CORD_ec_append(result, current);
}
}
count = ec_len(result);
*out = CORD_balance(CORD_ec_to_cord(result));
return(count);
}
int CORD_sprintf(CORD * out, CORD format, ...)
{
va_list args;
int result;
va_start(args, format);
result = CORD_vsprintf(out, format, args);
va_end(args);
return(result);
}
int CORD_fprintf(FILE * f, CORD format, ...)
{
va_list args;
int result;
CORD out;
va_start(args, format);
result = CORD_vsprintf(&out, format, args);
va_end(args);
if (result > 0) CORD_put(out, f);
return(result);
}
int CORD_vfprintf(FILE * f, CORD format, va_list args)
{
int result;
CORD out;
result = CORD_vsprintf(&out, format, args);
if (result > 0) CORD_put(out, f);
return(result);
}
int CORD_printf(CORD format, ...)
{
va_list args;
int result;
CORD out;
va_start(args, format);
result = CORD_vsprintf(&out, format, args);
va_end(args);
if (result > 0) CORD_put(out, stdout);
return(result);
}
int CORD_vprintf(CORD format, va_list args)
{
int result;
CORD out;
result = CORD_vsprintf(&out, format, args);
if (result > 0) CORD_put(out, stdout);
return(result);
}

View File

@ -1,228 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, August 24, 1994 11:58 am PDT */
# include "cord.h"
# include <string.h>
# include <stdio.h>
/* This is a very incomplete test of the cord package. It knows about */
/* a few internals of the package (e.g. when C strings are returned) */
/* that real clients shouldn't rely on. */
# define ABORT(string) \
{ int x = 0; fprintf(stderr, "FAILED: %s\n", string); x = 1 / x; abort(); }
int count;
int test_fn(char c, void * client_data)
{
if (client_data != (void *)13) ABORT("bad client data");
if (count < 64*1024+1) {
if ((count & 1) == 0) {
if (c != 'b') ABORT("bad char");
} else {
if (c != 'a') ABORT("bad char");
}
count++;
return(0);
} else {
if (c != 'c') ABORT("bad char");
count++;
return(1);
}
}
char id_cord_fn(size_t i, void * client_data)
{
return((char)i);
}
void test_basics()
{
CORD x = CORD_from_char_star("ab");
register int i;
char c;
CORD y;
CORD_pos p;
x = CORD_cat(x,x);
if (!CORD_IS_STRING(x)) ABORT("short cord should usually be a string");
if (strcmp(x, "abab") != 0) ABORT("bad CORD_cat result");
for (i = 1; i < 16; i++) {
x = CORD_cat(x,x);
}
x = CORD_cat(x,"c");
if (CORD_len(x) != 128*1024+1) ABORT("bad length");
count = 0;
if (CORD_iter5(x, 64*1024-1, test_fn, CORD_NO_FN, (void *)13) == 0) {
ABORT("CORD_iter5 failed");
}
if (count != 64*1024 + 2) ABORT("CORD_iter5 failed");
count = 0;
CORD_set_pos(p, x, 64*1024-1);
while(CORD_pos_valid(p)) {
(void) test_fn(CORD_pos_fetch(p), (void *)13);
CORD_next(p);
}
if (count != 64*1024 + 2) ABORT("Position based iteration failed");
y = CORD_substr(x, 1023, 5);
if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string");
if (strcmp(y, "babab") != 0) ABORT("bad CORD_substr result");
y = CORD_substr(x, 1024, 8);
if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string");
if (strcmp(y, "abababab") != 0) ABORT("bad CORD_substr result");
y = CORD_substr(x, 128*1024-1, 8);
if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string");
if (strcmp(y, "bc") != 0) ABORT("bad CORD_substr result");
x = CORD_balance(x);
if (CORD_len(x) != 128*1024+1) ABORT("bad length");
count = 0;
if (CORD_iter5(x, 64*1024-1, test_fn, CORD_NO_FN, (void *)13) == 0) {
ABORT("CORD_iter5 failed");
}
if (count != 64*1024 + 2) ABORT("CORD_iter5 failed");
y = CORD_substr(x, 1023, 5);
if (!CORD_IS_STRING(y)) ABORT("short cord should usually be a string");
if (strcmp(y, "babab") != 0) ABORT("bad CORD_substr result");
y = CORD_from_fn(id_cord_fn, 0, 13);
i = 0;
CORD_set_pos(p, y, i);
while(CORD_pos_valid(p)) {
c = CORD_pos_fetch(p);
if(c != i) ABORT("Traversal of function node failed");
CORD_next(p); i++;
}
if (i != 13) ABORT("Bad apparent length for function node");
}
void test_extras()
{
# if defined(__OS2__)
# define FNAME1 "tmp1"
# define FNAME2 "tmp2"
# elif defined(AMIGA)
# define FNAME1 "T:tmp1"
# define FNAME2 "T:tmp2"
# else
# define FNAME1 "/tmp/cord_test"
# define FNAME2 "/tmp/cord_test2"
# endif
register int i;
CORD y = "abcdefghijklmnopqrstuvwxyz0123456789";
CORD x = "{}";
CORD w, z;
FILE *f;
FILE *f1a, *f1b, *f2;
w = CORD_cat(CORD_cat(y,y),y);
z = CORD_catn(3,y,y,y);
if (CORD_cmp(w,z) != 0) ABORT("CORD_catn comparison wrong");
for (i = 1; i < 100; i++) {
x = CORD_cat(x, y);
}
z = CORD_balance(x);
if (CORD_cmp(x,z) != 0) ABORT("balanced string comparison wrong");
if (CORD_cmp(x,CORD_cat(z, CORD_nul(13))) >= 0) ABORT("comparison 2");
if (CORD_cmp(CORD_cat(x, CORD_nul(13)), z) <= 0) ABORT("comparison 3");
if (CORD_cmp(x,CORD_cat(z, "13")) >= 0) ABORT("comparison 4");
if ((f = fopen(FNAME1, "w")) == 0) ABORT("open failed");
if (CORD_put(z,f) == EOF) ABORT("CORD_put failed");
if (fclose(f) == EOF) ABORT("fclose failed");
w = CORD_from_file(f1a = fopen(FNAME1, "rb"));
if (CORD_len(w) != CORD_len(z)) ABORT("file length wrong");
if (CORD_cmp(w,z) != 0) ABORT("file comparison wrong");
if (CORD_cmp(CORD_substr(w, 50*36+2, 36), y) != 0)
ABORT("file substr wrong");
z = CORD_from_file_lazy(f1b = fopen(FNAME1, "rb"));
if (CORD_cmp(w,z) != 0) ABORT("File conversions differ");
if (CORD_chr(w, 0, '9') != 37) ABORT("CORD_chr failed 1");
if (CORD_chr(w, 3, 'a') != 38) ABORT("CORD_chr failed 2");
if (CORD_rchr(w, CORD_len(w) - 1, '}') != 1) ABORT("CORD_rchr failed");
x = y;
for (i = 1; i < 14; i++) {
x = CORD_cat(x,x);
}
if ((f = fopen(FNAME2, "w")) == 0) ABORT("2nd open failed");
if (CORD_put(x,f) == EOF) ABORT("CORD_put failed");
if (fclose(f) == EOF) ABORT("fclose failed");
w = CORD_from_file(f2 = fopen(FNAME2, "rb"));
if (CORD_len(w) != CORD_len(x)) ABORT("file length wrong");
if (CORD_cmp(w,x) != 0) ABORT("file comparison wrong");
if (CORD_cmp(CORD_substr(w, 1000*36, 36), y) != 0)
ABORT("file substr wrong");
if (strcmp(CORD_to_char_star(CORD_substr(w, 1000*36, 36)), y) != 0)
ABORT("char * file substr wrong");
if (strcmp(CORD_substr(w, 1000*36, 2), "ab") != 0)
ABORT("short file substr wrong");
if (CORD_str(x,1,"9a") != 35) ABORT("CORD_str failed 1");
if (CORD_str(x,0,"9abcdefghijk") != 35) ABORT("CORD_str failed 2");
if (CORD_str(x,0,"9abcdefghijx") != CORD_NOT_FOUND)
ABORT("CORD_str failed 3");
if (CORD_str(x,0,"9>") != CORD_NOT_FOUND) ABORT("CORD_str failed 4");
if (remove(FNAME1) != 0) {
/* On some systems, e.g. OS2, this may fail if f1 is still open. */
if ((fclose(f1a) == EOF) & (fclose(f1b) == EOF))
ABORT("fclose(f1) failed");
if (remove(FNAME1) != 0) ABORT("remove 1 failed");
}
if (remove(FNAME2) != 0) {
if (fclose(f2) == EOF) ABORT("fclose(f2) failed");
if (remove(FNAME2) != 0) ABORT("remove 2 failed");
}
}
void test_printf()
{
CORD result;
char result2[200];
long l;
short s;
CORD x;
if (CORD_sprintf(&result, "%7.2f%ln", 3.14159F, &l) != 7)
ABORT("CORD_sprintf failed 1");
if (CORD_cmp(result, " 3.14") != 0)ABORT("CORD_sprintf goofed 1");
if (l != 7) ABORT("CORD_sprintf goofed 2");
if (CORD_sprintf(&result, "%-7.2s%hn%c%s", "abcd", &s, 'x', "yz") != 10)
ABORT("CORD_sprintf failed 2");
if (CORD_cmp(result, "ab xyz") != 0)ABORT("CORD_sprintf goofed 3");
if (s != 7) ABORT("CORD_sprintf goofed 4");
x = "abcdefghij";
x = CORD_cat(x,x);
x = CORD_cat(x,x);
x = CORD_cat(x,x);
if (CORD_sprintf(&result, "->%-120.78r!\n", x) != 124)
ABORT("CORD_sprintf failed 3");
(void) sprintf(result2, "->%-120.78s!\n", CORD_to_char_star(x));
if (CORD_cmp(result, result2) != 0)ABORT("CORD_sprintf goofed 5");
}
main()
{
# ifdef THINK_C
printf("cordtest:\n");
# endif
test_basics();
test_extras();
test_printf();
CORD_fprintf(stderr, "SUCCEEDED\n");
return(0);
}

View File

@ -1,621 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Author: Hans-J. Boehm (boehm@parc.xerox.com)
*/
/*
* These are functions on cords that do not need to understand their
* implementation. They serve also serve as example client code for
* cord_basics.
*/
/* Boehm, December 8, 1995 1:53 pm PST */
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <stdarg.h>
# include "cord.h"
# include "ec.h"
# define I_HIDE_POINTERS /* So we get access to allocation lock. */
/* We use this for lazy file reading, */
/* so that we remain independent */
/* of the threads primitives. */
# include "gc.h"
/* For now we assume that pointer reads and writes are atomic, */
/* i.e. another thread always sees the state before or after */
/* a write. This might be false on a Motorola M68K with */
/* pointers that are not 32-bit aligned. But there probably */
/* aren't too many threads packages running on those. */
# define ATOMIC_WRITE(x,y) (x) = (y)
# define ATOMIC_READ(x) (*(x))
/* The standard says these are in stdio.h, but they aren't always: */
# ifndef SEEK_SET
# define SEEK_SET 0
# endif
# ifndef SEEK_END
# define SEEK_END 2
# endif
# define BUFSZ 2048 /* Size of stack allocated buffers when */
/* we want large buffers. */
typedef void (* oom_fn)(void);
# define OUT_OF_MEMORY { if (CORD_oom_fn != (oom_fn) 0) (*CORD_oom_fn)(); \
ABORT("Out of memory\n"); }
# define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); }
CORD CORD_cat_char(CORD x, char c)
{
register char * string;
if (c == '\0') return(CORD_cat(x, CORD_nul(1)));
string = GC_MALLOC_ATOMIC(2);
if (string == 0) OUT_OF_MEMORY;
string[0] = c;
string[1] = '\0';
return(CORD_cat_char_star(x, string, 1));
}
CORD CORD_catn(int nargs, ...)
{
register CORD result = CORD_EMPTY;
va_list args;
register int i;
va_start(args, nargs);
for (i = 0; i < nargs; i++) {
register CORD next = va_arg(args, CORD);
result = CORD_cat(result, next);
}
va_end(args);
return(result);
}
typedef struct {
size_t len;
size_t count;
char * buf;
} CORD_fill_data;
int CORD_fill_proc(char c, void * client_data)
{
register CORD_fill_data * d = (CORD_fill_data *)client_data;
register size_t count = d -> count;
(d -> buf)[count] = c;
d -> count = ++count;
if (count >= d -> len) {
return(1);
} else {
return(0);
}
}
int CORD_batched_fill_proc(const char * s, void * client_data)
{
register CORD_fill_data * d = (CORD_fill_data *)client_data;
register size_t count = d -> count;
register size_t max = d -> len;
register char * buf = d -> buf;
register const char * t = s;
while((buf[count] = *t++) != '\0') {
count++;
if (count >= max) {
d -> count = count;
return(1);
}
}
d -> count = count;
return(0);
}
/* Fill buf with len characters starting at i. */
/* Assumes len characters are available. */
void CORD_fill_buf(CORD x, size_t i, size_t len, char * buf)
{
CORD_fill_data fd;
fd.len = len;
fd.buf = buf;
fd.count = 0;
(void)CORD_iter5(x, i, CORD_fill_proc, CORD_batched_fill_proc, &fd);
}
int CORD_cmp(CORD x, CORD y)
{
CORD_pos xpos;
CORD_pos ypos;
register size_t avail, yavail;
if (y == CORD_EMPTY) return(x != CORD_EMPTY);
if (x == CORD_EMPTY) return(-1);
if (CORD_IS_STRING(y) && CORD_IS_STRING(x)) return(strcmp(x,y));
CORD_set_pos(xpos, x, 0);
CORD_set_pos(ypos, y, 0);
for(;;) {
if (!CORD_pos_valid(xpos)) {
if (CORD_pos_valid(ypos)) {
return(-1);
} else {
return(0);
}
}
if (!CORD_pos_valid(ypos)) {
return(1);
}
if ((avail = CORD_pos_chars_left(xpos)) <= 0
|| (yavail = CORD_pos_chars_left(ypos)) <= 0) {
register char xcurrent = CORD_pos_fetch(xpos);
register char ycurrent = CORD_pos_fetch(ypos);
if (xcurrent != ycurrent) return(xcurrent - ycurrent);
CORD_next(xpos);
CORD_next(ypos);
} else {
/* process as many characters as we can */
register int result;
if (avail > yavail) avail = yavail;
result = strncmp(CORD_pos_cur_char_addr(xpos),
CORD_pos_cur_char_addr(ypos), avail);
if (result != 0) return(result);
CORD_pos_advance(xpos, avail);
CORD_pos_advance(ypos, avail);
}
}
}
int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len)
{
CORD_pos xpos;
CORD_pos ypos;
register size_t count;
register long avail, yavail;
CORD_set_pos(xpos, x, x_start);
CORD_set_pos(ypos, y, y_start);
for(count = 0; count < len;) {
if (!CORD_pos_valid(xpos)) {
if (CORD_pos_valid(ypos)) {
return(-1);
} else {
return(0);
}
}
if (!CORD_pos_valid(ypos)) {
return(1);
}
if ((avail = CORD_pos_chars_left(xpos)) <= 0
|| (yavail = CORD_pos_chars_left(ypos)) <= 0) {
register char xcurrent = CORD_pos_fetch(xpos);
register char ycurrent = CORD_pos_fetch(ypos);
if (xcurrent != ycurrent) return(xcurrent - ycurrent);
CORD_next(xpos);
CORD_next(ypos);
count++;
} else {
/* process as many characters as we can */
register int result;
if (avail > yavail) avail = yavail;
count += avail;
if (count > len) avail -= (count - len);
result = strncmp(CORD_pos_cur_char_addr(xpos),
CORD_pos_cur_char_addr(ypos), (size_t)avail);
if (result != 0) return(result);
CORD_pos_advance(xpos, (size_t)avail);
CORD_pos_advance(ypos, (size_t)avail);
}
}
return(0);
}
char * CORD_to_char_star(CORD x)
{
register size_t len = CORD_len(x);
char * result = GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
CORD_fill_buf(x, 0, len, result);
result[len] = '\0';
return(result);
}
CORD CORD_from_char_star(const char *s)
{
char * result;
size_t len = strlen(s);
if (0 == len) return(CORD_EMPTY);
result = GC_MALLOC_ATOMIC(len + 1);
if (result == 0) OUT_OF_MEMORY;
memcpy(result, s, len+1);
return(result);
}
const char * CORD_to_const_char_star(CORD x)
{
if (x == 0) return("");
if (CORD_IS_STRING(x)) return((const char *)x);
return(CORD_to_char_star(x));
}
char CORD_fetch(CORD x, size_t i)
{
CORD_pos xpos;
CORD_set_pos(xpos, x, i);
if (!CORD_pos_valid(xpos)) ABORT("bad index?");
return(CORD_pos_fetch(xpos));
}
int CORD_put_proc(char c, void * client_data)
{
register FILE * f = (FILE *)client_data;
return(putc(c, f) == EOF);
}
int CORD_batched_put_proc(const char * s, void * client_data)
{
register FILE * f = (FILE *)client_data;
return(fputs(s, f) == EOF);
}
int CORD_put(CORD x, FILE * f)
{
if (CORD_iter5(x, 0, CORD_put_proc, CORD_batched_put_proc, f)) {
return(EOF);
} else {
return(1);
}
}
typedef struct {
size_t pos; /* Current position in the cord */
char target; /* Character we're looking for */
} chr_data;
int CORD_chr_proc(char c, void * client_data)
{
register chr_data * d = (chr_data *)client_data;
if (c == d -> target) return(1);
(d -> pos) ++;
return(0);
}
int CORD_rchr_proc(char c, void * client_data)
{
register chr_data * d = (chr_data *)client_data;
if (c == d -> target) return(1);
(d -> pos) --;
return(0);
}
int CORD_batched_chr_proc(const char *s, void * client_data)
{
register chr_data * d = (chr_data *)client_data;
register char * occ = strchr(s, d -> target);
if (occ == 0) {
d -> pos += strlen(s);
return(0);
} else {
d -> pos += occ - s;
return(1);
}
}
size_t CORD_chr(CORD x, size_t i, int c)
{
chr_data d;
d.pos = i;
d.target = c;
if (CORD_iter5(x, i, CORD_chr_proc, CORD_batched_chr_proc, &d)) {
return(d.pos);
} else {
return(CORD_NOT_FOUND);
}
}
size_t CORD_rchr(CORD x, size_t i, int c)
{
chr_data d;
d.pos = i;
d.target = c;
if (CORD_riter4(x, i, CORD_rchr_proc, &d)) {
return(d.pos);
} else {
return(CORD_NOT_FOUND);
}
}
/* Find the first occurrence of s in x at position start or later. */
/* This uses an asymptotically poor algorithm, which should typically */
/* perform acceptably. We compare the first few characters directly, */
/* and call CORD_ncmp whenever there is a partial match. */
/* This has the advantage that we allocate very little, or not at all. */
/* It's very fast if there are few close misses. */
size_t CORD_str(CORD x, size_t start, CORD s)
{
CORD_pos xpos;
size_t xlen = CORD_len(x);
size_t slen;
register size_t start_len;
const char * s_start;
unsigned long s_buf = 0; /* The first few characters of s */
unsigned long x_buf = 0; /* Start of candidate substring. */
/* Initialized only to make compilers */
/* happy. */
unsigned long mask = 0;
register size_t i;
register size_t match_pos;
if (s == CORD_EMPTY) return(start);
if (CORD_IS_STRING(s)) {
s_start = s;
slen = strlen(s);
} else {
s_start = CORD_to_char_star(CORD_substr(s, 0, sizeof(unsigned long)));
slen = CORD_len(s);
}
if (xlen < start || xlen - start < slen) return(CORD_NOT_FOUND);
start_len = slen;
if (start_len > sizeof(unsigned long)) start_len = sizeof(unsigned long);
CORD_set_pos(xpos, x, start);
for (i = 0; i < start_len; i++) {
mask <<= 8;
mask |= 0xff;
s_buf <<= 8;
s_buf |= s_start[i];
x_buf <<= 8;
x_buf |= CORD_pos_fetch(xpos);
CORD_next(xpos);
}
for (match_pos = start; ; match_pos++) {
if ((x_buf & mask) == s_buf) {
if (slen == start_len ||
CORD_ncmp(x, match_pos + start_len,
s, start_len, slen - start_len) == 0) {
return(match_pos);
}
}
if ( match_pos == xlen - slen ) {
return(CORD_NOT_FOUND);
}
x_buf <<= 8;
x_buf |= CORD_pos_fetch(xpos);
CORD_next(xpos);
}
}
void CORD_ec_flush_buf(CORD_ec x)
{
register size_t len = x[0].ec_bufptr - x[0].ec_buf;
char * s;
if (len == 0) return;
s = GC_MALLOC_ATOMIC(len+1);
memcpy(s, x[0].ec_buf, len);
s[len] = '\0';
x[0].ec_cord = CORD_cat_char_star(x[0].ec_cord, s, len);
x[0].ec_bufptr = x[0].ec_buf;
}
void CORD_ec_append_cord(CORD_ec x, CORD s)
{
CORD_ec_flush_buf(x);
x[0].ec_cord = CORD_cat(x[0].ec_cord, s);
}
/*ARGSUSED*/
char CORD_nul_func(size_t i, void * client_data)
{
return((char)(unsigned long)client_data);
}
CORD CORD_chars(char c, size_t i)
{
return(CORD_from_fn(CORD_nul_func, (void *)(unsigned long)c, i));
}
CORD CORD_from_file_eager(FILE * f)
{
register int c;
CORD_ec ecord;
CORD_ec_init(ecord);
for(;;) {
c = getc(f);
if (c == 0) {
/* Append the right number of NULs */
/* Note that any string of NULs is rpresented in 4 words, */
/* independent of its length. */
register size_t count = 1;
CORD_ec_flush_buf(ecord);
while ((c = getc(f)) == 0) count++;
ecord[0].ec_cord = CORD_cat(ecord[0].ec_cord, CORD_nul(count));
}
if (c == EOF) break;
CORD_ec_append(ecord, c);
}
(void) fclose(f);
return(CORD_balance(CORD_ec_to_cord(ecord)));
}
/* The state maintained for a lazily read file consists primarily */
/* of a large direct-mapped cache of previously read values. */
/* We could rely more on stdio buffering. That would have 2 */
/* disadvantages: */
/* 1) Empirically, not all fseek implementations preserve the */
/* buffer whenever they could. */
/* 2) It would fail if 2 different sections of a long cord */
/* were being read alternately. */
/* We do use the stdio buffer for read ahead. */
/* To guarantee thread safety in the presence of atomic pointer */
/* writes, cache lines are always replaced, and never modified in */
/* place. */
# define LOG_CACHE_SZ 14
# define CACHE_SZ (1 << LOG_CACHE_SZ)
# define LOG_LINE_SZ 9
# define LINE_SZ (1 << LOG_LINE_SZ)
typedef struct {
size_t tag;
char data[LINE_SZ];
/* data[i%LINE_SZ] = ith char in file if tag = i/LINE_SZ */
} cache_line;
typedef struct {
FILE * lf_file;
size_t lf_current; /* Current file pointer value */
cache_line * volatile lf_cache[CACHE_SZ/LINE_SZ];
} lf_state;
# define MOD_CACHE_SZ(n) ((n) & (CACHE_SZ - 1))
# define DIV_CACHE_SZ(n) ((n) >> LOG_CACHE_SZ)
# define MOD_LINE_SZ(n) ((n) & (LINE_SZ - 1))
# define DIV_LINE_SZ(n) ((n) >> LOG_LINE_SZ)
# define LINE_START(n) ((n) & ~(LINE_SZ - 1))
typedef struct {
lf_state * state;
size_t file_pos; /* Position of needed character. */
cache_line * new_cache;
} refill_data;
/* Executed with allocation lock. */
static char refill_cache(client_data)
refill_data * client_data;
{
register lf_state * state = client_data -> state;
register size_t file_pos = client_data -> file_pos;
FILE *f = state -> lf_file;
size_t line_start = LINE_START(file_pos);
size_t line_no = DIV_LINE_SZ(MOD_CACHE_SZ(file_pos));
cache_line * new_cache = client_data -> new_cache;
if (line_start != state -> lf_current
&& fseek(f, line_start, SEEK_SET) != 0) {
ABORT("fseek failed");
}
if (fread(new_cache -> data, sizeof(char), LINE_SZ, f)
<= file_pos - line_start) {
ABORT("fread failed");
}
new_cache -> tag = DIV_LINE_SZ(file_pos);
/* Store barrier goes here. */
ATOMIC_WRITE(state -> lf_cache[line_no], new_cache);
state -> lf_current = line_start + LINE_SZ;
return(new_cache->data[MOD_LINE_SZ(file_pos)]);
}
char CORD_lf_func(size_t i, void * client_data)
{
register lf_state * state = (lf_state *)client_data;
register cache_line * volatile * cl_addr =
&(state -> lf_cache[DIV_LINE_SZ(MOD_CACHE_SZ(i))]);
register cache_line * cl = (cache_line *)ATOMIC_READ(cl_addr);
if (cl == 0 || cl -> tag != DIV_LINE_SZ(i)) {
/* Cache miss */
refill_data rd;
rd.state = state;
rd.file_pos = i;
rd.new_cache = GC_NEW_ATOMIC(cache_line);
if (rd.new_cache == 0) OUT_OF_MEMORY;
return((char)(GC_word)
GC_call_with_alloc_lock((GC_fn_type) refill_cache, &rd));
}
return(cl -> data[MOD_LINE_SZ(i)]);
}
/*ARGSUSED*/
void CORD_lf_close_proc(void * obj, void * client_data)
{
if (fclose(((lf_state *)obj) -> lf_file) != 0) {
ABORT("CORD_lf_close_proc: fclose failed");
}
}
CORD CORD_from_file_lazy_inner(FILE * f, size_t len)
{
register lf_state * state = GC_NEW(lf_state);
register int i;
if (state == 0) OUT_OF_MEMORY;
if (len != 0) {
/* Dummy read to force buffer allocation. */
/* This greatly increases the probability */
/* of avoiding deadlock if buffer allocation */
/* is redirected to GC_malloc and the */
/* world is multithreaded. */
char buf[1];
(void) fread(buf, 1, 1, f);
rewind(f);
}
state -> lf_file = f;
for (i = 0; i < CACHE_SZ/LINE_SZ; i++) {
state -> lf_cache[i] = 0;
}
state -> lf_current = 0;
GC_register_finalizer(state, CORD_lf_close_proc, 0, 0, 0);
return(CORD_from_fn(CORD_lf_func, state, len));
}
CORD CORD_from_file_lazy(FILE * f)
{
register long len;
if (fseek(f, 0l, SEEK_END) != 0) {
ABORT("Bad fd argument - fseek failed");
}
if ((len = ftell(f)) < 0) {
ABORT("Bad fd argument - ftell failed");
}
rewind(f);
return(CORD_from_file_lazy_inner(f, (size_t)len));
}
# define LAZY_THRESHOLD (128*1024 + 1)
CORD CORD_from_file(FILE * f)
{
register long len;
if (fseek(f, 0l, SEEK_END) != 0) {
ABORT("Bad fd argument - fseek failed");
}
if ((len = ftell(f)) < 0) {
ABORT("Bad fd argument - ftell failed");
}
rewind(f);
if (len < LAZY_THRESHOLD) {
return(CORD_from_file_eager(f));
} else {
return(CORD_from_file_lazy_inner(f, (size_t)len));
}
}

View File

@ -1,604 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Author: Hans-J. Boehm (boehm@parc.xerox.com)
*/
/*
* A really simple-minded text editor based on cords.
* Things it does right:
* No size bounds.
* Inbounded undo.
* Shouldn't crash no matter what file you invoke it on (e.g. /vmunix)
* (Make sure /vmunix is not writable before you try this.)
* Scrolls horizontally.
* Things it does wrong:
* It doesn't handle tabs reasonably (use "expand" first).
* The command set is MUCH too small.
* The redisplay algorithm doesn't let curses do the scrolling.
* The rule for moving the window over the file is suboptimal.
*/
/* Boehm, February 6, 1995 12:27 pm PST */
/* Boehm, May 19, 1994 2:20 pm PDT */
#include <stdio.h>
#include "gc.h"
#include "cord.h"
#ifdef THINK_C
#define MACINTOSH
#include <ctype.h>
#endif
#if defined(__BORLANDC__) && !defined(WIN32)
/* If this is DOS or win16, we'll fail anyway. */
/* Might as well assume win32. */
# define WIN32
#endif
#if defined(WIN32)
# include <windows.h>
# include "de_win.h"
#elif defined(MACINTOSH)
# include <console.h>
/* curses emulation. */
# define initscr()
# define endwin()
# define nonl()
# define noecho() csetmode(C_NOECHO, stdout)
# define cbreak() csetmode(C_CBREAK, stdout)
# define refresh()
# define addch(c) putchar(c)
# define standout() cinverse(1, stdout)
# define standend() cinverse(0, stdout)
# define move(line,col) cgotoxy(col + 1, line + 1, stdout)
# define clrtoeol() ccleol(stdout)
# define de_error(s) { fprintf(stderr, s); getchar(); }
# define LINES 25
# define COLS 80
#else
# include <curses.h>
# define de_error(s) { fprintf(stderr, s); sleep(2); }
#endif
#include "de_cmds.h"
/* List of line number to position mappings, in descending order. */
/* There may be holes. */
typedef struct LineMapRep {
int line;
size_t pos;
struct LineMapRep * previous;
} * line_map;
/* List of file versions, one per edit operation */
typedef struct HistoryRep {
CORD file_contents;
struct HistoryRep * previous;
line_map map; /* Invalid for first record "now" */
} * history;
history now = 0;
CORD current; /* == now -> file_contents. */
size_t current_len; /* Current file length. */
line_map current_map = 0; /* Current line no. to pos. map */
size_t current_map_size = 0; /* Number of current_map entries. */
/* Not always accurate, but reset */
/* by prune_map. */
# define MAX_MAP_SIZE 3000
/* Current display position */
int dis_line = 0;
int dis_col = 0;
# define ALL -1
# define NONE - 2
int need_redisplay = 0; /* Line that needs to be redisplayed. */
/* Current cursor position. Always within file. */
int line = 0;
int col = 0;
size_t file_pos = 0; /* Character position corresponding to cursor. */
/* Invalidate line map for lines > i */
void invalidate_map(int i)
{
while(current_map -> line > i) {
current_map = current_map -> previous;
current_map_size--;
}
}
/* Reduce the number of map entries to save space for huge files. */
/* This also affects maps in histories. */
void prune_map()
{
line_map map = current_map;
int start_line = map -> line;
current_map_size = 0;
for(; map != 0; map = map -> previous) {
current_map_size++;
if (map -> line < start_line - LINES && map -> previous != 0) {
map -> previous = map -> previous -> previous;
}
}
}
/* Add mapping entry */
void add_map(int line, size_t pos)
{
line_map new_map = GC_NEW(struct LineMapRep);
if (current_map_size >= MAX_MAP_SIZE) prune_map();
new_map -> line = line;
new_map -> pos = pos;
new_map -> previous = current_map;
current_map = new_map;
current_map_size++;
}
/* Return position of column *c of ith line in */
/* current file. Adjust *c to be within the line.*/
/* A 0 pointer is taken as 0 column. */
/* Returns CORD_NOT_FOUND if i is too big. */
/* Assumes i > dis_line. */
size_t line_pos(int i, int *c)
{
int j;
size_t cur;
size_t next;
line_map map = current_map;
while (map -> line > i) map = map -> previous;
if (map -> line < i - 2) /* rebuild */ invalidate_map(i);
for (j = map -> line, cur = map -> pos; j < i;) {
cur = CORD_chr(current, cur, '\n');
if (cur == current_len-1) return(CORD_NOT_FOUND);
cur++;
if (++j > current_map -> line) add_map(j, cur);
}
if (c != 0) {
next = CORD_chr(current, cur, '\n');
if (next == CORD_NOT_FOUND) next = current_len - 1;
if (next < cur + *c) {
*c = next - cur;
}
cur += *c;
}
return(cur);
}
void add_hist(CORD s)
{
history new_file = GC_NEW(struct HistoryRep);
new_file -> file_contents = current = s;
current_len = CORD_len(s);
new_file -> previous = now;
if (now != 0) now -> map = current_map;
now = new_file;
}
void del_hist(void)
{
now = now -> previous;
current = now -> file_contents;
current_map = now -> map;
current_len = CORD_len(current);
}
/* Current screen_contents; a dynamically allocated array of CORDs */
CORD * screen = 0;
int screen_size = 0;
# ifndef WIN32
/* Replace a line in the curses stdscr. All control characters are */
/* displayed as upper case characters in standout mode. This isn't */
/* terribly appropriate for tabs. */
void replace_line(int i, CORD s)
{
register int c;
CORD_pos p;
size_t len = CORD_len(s);
if (screen == 0 || LINES > screen_size) {
screen_size = LINES;
screen = (CORD *)GC_MALLOC(screen_size * sizeof(CORD));
}
# if !defined(MACINTOSH)
/* A gross workaround for an apparent curses bug: */
if (i == LINES-1 && len == COLS) {
s = CORD_substr(s, 0, CORD_len(s) - 1);
}
# endif
if (CORD_cmp(screen[i], s) != 0) {
move(i, 0); clrtoeol(); move(i,0);
CORD_FOR (p, s) {
c = CORD_pos_fetch(p) & 0x7f;
if (iscntrl(c)) {
standout(); addch(c + 0x40); standend();
} else {
addch(c);
}
}
screen[i] = s;
}
}
#else
# define replace_line(i,s) invalidate_line(i)
#endif
/* Return up to COLS characters of the line of s starting at pos, */
/* returning only characters after the given column. */
CORD retrieve_line(CORD s, size_t pos, unsigned column)
{
CORD candidate = CORD_substr(s, pos, column + COLS);
/* avoids scanning very long lines */
int eol = CORD_chr(candidate, 0, '\n');
int len;
if (eol == CORD_NOT_FOUND) eol = CORD_len(candidate);
len = (int)eol - (int)column;
if (len < 0) len = 0;
return(CORD_substr(s, pos + column, len));
}
# ifdef WIN32
# define refresh();
CORD retrieve_screen_line(int i)
{
register size_t pos;
invalidate_map(dis_line + LINES); /* Prune search */
pos = line_pos(dis_line + i, 0);
if (pos == CORD_NOT_FOUND) return(CORD_EMPTY);
return(retrieve_line(current, pos, dis_col));
}
# endif
/* Display the visible section of the current file */
void redisplay(void)
{
register int i;
invalidate_map(dis_line + LINES); /* Prune search */
for (i = 0; i < LINES; i++) {
if (need_redisplay == ALL || need_redisplay == i) {
register size_t pos = line_pos(dis_line + i, 0);
if (pos == CORD_NOT_FOUND) break;
replace_line(i, retrieve_line(current, pos, dis_col));
if (need_redisplay == i) goto done;
}
}
for (; i < LINES; i++) replace_line(i, CORD_EMPTY);
done:
refresh();
need_redisplay = NONE;
}
int dis_granularity;
/* Update dis_line, dis_col, and dis_pos to make cursor visible. */
/* Assumes line, col, dis_line, dis_pos are in bounds. */
void normalize_display()
{
int old_line = dis_line;
int old_col = dis_col;
dis_granularity = 1;
if (LINES > 15 && COLS > 15) dis_granularity = 2;
while (dis_line > line) dis_line -= dis_granularity;
while (dis_col > col) dis_col -= dis_granularity;
while (line >= dis_line + LINES) dis_line += dis_granularity;
while (col >= dis_col + COLS) dis_col += dis_granularity;
if (old_line != dis_line || old_col != dis_col) {
need_redisplay = ALL;
}
}
# if defined(WIN32)
# elif defined(MACINTOSH)
# define move_cursor(x,y) cgotoxy(x + 1, y + 1, stdout)
# else
# define move_cursor(x,y) move(y,x)
# endif
/* Adjust display so that cursor is visible; move cursor into position */
/* Update screen if necessary. */
void fix_cursor(void)
{
normalize_display();
if (need_redisplay != NONE) redisplay();
move_cursor(col - dis_col, line - dis_line);
refresh();
# ifndef WIN32
fflush(stdout);
# endif
}
/* Make sure line, col, and dis_pos are somewhere inside file. */
/* Recompute file_pos. Assumes dis_pos is accurate or past eof */
void fix_pos()
{
int my_col = col;
if ((size_t)line > current_len) line = current_len;
file_pos = line_pos(line, &my_col);
if (file_pos == CORD_NOT_FOUND) {
for (line = current_map -> line, file_pos = current_map -> pos;
file_pos < current_len;
line++, file_pos = CORD_chr(current, file_pos, '\n') + 1);
line--;
file_pos = line_pos(line, &col);
} else {
col = my_col;
}
}
#if defined(WIN32)
# define beep() Beep(1000 /* Hz */, 300 /* msecs */)
#elif defined(MACINTOSH)
# define beep() SysBeep(1)
#else
/*
* beep() is part of some curses packages and not others.
* We try to match the type of the builtin one, if any.
*/
#ifdef __STDC__
int beep(void)
#else
int beep()
#endif
{
putc('\007', stderr);
return(0);
}
#endif
# define NO_PREFIX -1
# define BARE_PREFIX -2
int repeat_count = NO_PREFIX; /* Current command prefix. */
int locate_mode = 0; /* Currently between 2 ^Ls */
CORD locate_string = CORD_EMPTY; /* Current search string. */
char * arg_file_name;
#ifdef WIN32
/* Change the current position to whatever is currently displayed at */
/* the given SCREEN coordinates. */
void set_position(int c, int l)
{
line = l + dis_line;
col = c + dis_col;
fix_pos();
move_cursor(col - dis_col, line - dis_line);
}
#endif /* WIN32 */
/* Perform the command associated with character c. C may be an */
/* integer > 256 denoting a windows command, one of the above control */
/* characters, or another ASCII character to be used as either a */
/* character to be inserted, a repeat count, or a search string, */
/* depending on the current state. */
void do_command(int c)
{
int i;
int need_fix_pos;
FILE * out;
if ( c == '\r') c = '\n';
if (locate_mode) {
size_t new_pos;
if (c == LOCATE) {
locate_mode = 0;
locate_string = CORD_EMPTY;
return;
}
locate_string = CORD_cat_char(locate_string, (char)c);
new_pos = CORD_str(current, file_pos - CORD_len(locate_string) + 1,
locate_string);
if (new_pos != CORD_NOT_FOUND) {
need_redisplay = ALL;
new_pos += CORD_len(locate_string);
for (;;) {
file_pos = line_pos(line + 1, 0);
if (file_pos > new_pos) break;
line++;
}
col = new_pos - line_pos(line, 0);
file_pos = new_pos;
fix_cursor();
} else {
locate_string = CORD_substr(locate_string, 0,
CORD_len(locate_string) - 1);
beep();
}
return;
}
if (c == REPEAT) {
repeat_count = BARE_PREFIX; return;
} else if (c < 0x100 && isdigit(c)){
if (repeat_count == BARE_PREFIX) {
repeat_count = c - '0'; return;
} else if (repeat_count != NO_PREFIX) {
repeat_count = 10 * repeat_count + c - '0'; return;
}
}
if (repeat_count == NO_PREFIX) repeat_count = 1;
if (repeat_count == BARE_PREFIX && (c == UP || c == DOWN)) {
repeat_count = LINES - dis_granularity;
}
if (repeat_count == BARE_PREFIX) repeat_count = 8;
need_fix_pos = 0;
for (i = 0; i < repeat_count; i++) {
switch(c) {
case LOCATE:
locate_mode = 1;
break;
case TOP:
line = col = file_pos = 0;
break;
case UP:
if (line != 0) {
line--;
need_fix_pos = 1;
}
break;
case DOWN:
line++;
need_fix_pos = 1;
break;
case LEFT:
if (col != 0) {
col--; file_pos--;
}
break;
case RIGHT:
if (CORD_fetch(current, file_pos) == '\n') break;
col++; file_pos++;
break;
case UNDO:
del_hist();
need_redisplay = ALL; need_fix_pos = 1;
break;
case BS:
if (col == 0) {
beep();
break;
}
col--; file_pos--;
/* fall through: */
case DEL:
if (file_pos == current_len-1) break;
/* Can't delete trailing newline */
if (CORD_fetch(current, file_pos) == '\n') {
need_redisplay = ALL; need_fix_pos = 1;
} else {
need_redisplay = line - dis_line;
}
add_hist(CORD_cat(
CORD_substr(current, 0, file_pos),
CORD_substr(current, file_pos+1, current_len)));
invalidate_map(line);
break;
case WRITE:
{
CORD name = CORD_cat(CORD_from_char_star(arg_file_name),
".new");
if ((out = fopen(CORD_to_const_char_star(name), "wb")) == NULL
|| CORD_put(current, out) == EOF) {
de_error("Write failed\n");
need_redisplay = ALL;
} else {
fclose(out);
}
}
break;
default:
{
CORD left_part = CORD_substr(current, 0, file_pos);
CORD right_part = CORD_substr(current, file_pos, current_len);
add_hist(CORD_cat(CORD_cat_char(left_part, (char)c),
right_part));
invalidate_map(line);
if (c == '\n') {
col = 0; line++; file_pos++;
need_redisplay = ALL;
} else {
col++; file_pos++;
need_redisplay = line - dis_line;
}
break;
}
}
}
if (need_fix_pos) fix_pos();
fix_cursor();
repeat_count = NO_PREFIX;
}
/* OS independent initialization */
void generic_init(void)
{
FILE * f;
CORD initial;
if ((f = fopen(arg_file_name, "rb")) == NULL) {
initial = "\n";
} else {
initial = CORD_from_file(f);
if (initial == CORD_EMPTY
|| CORD_fetch(initial, CORD_len(initial)-1) != '\n') {
initial = CORD_cat(initial, "\n");
}
}
add_map(0,0);
add_hist(initial);
now -> map = current_map;
now -> previous = now; /* Can't back up further: beginning of the world */
need_redisplay = ALL;
fix_cursor();
}
#ifndef WIN32
main(argc, argv)
int argc;
char ** argv;
{
int c;
CORD initial;
#if defined(MACINTOSH)
console_options.title = "\pDumb Editor";
cshow(stdout);
GC_init();
argc = ccommand(&argv);
#endif
if (argc != 2) goto usage;
arg_file_name = argv[1];
setvbuf(stdout, GC_MALLOC_ATOMIC(8192), _IOFBF, 8192);
initscr();
noecho(); nonl(); cbreak();
generic_init();
while ((c = getchar()) != QUIT) {
if (c == EOF) break;
do_command(c);
}
done:
move(LINES-1, 0);
clrtoeol();
refresh();
nl();
echo();
endwin();
exit(0);
usage:
fprintf(stderr, "Usage: %s file\n", argv[0]);
fprintf(stderr, "Cursor keys: ^B(left) ^F(right) ^P(up) ^N(down)\n");
fprintf(stderr, "Undo: ^U Write to <file>.new: ^W");
fprintf(stderr, "Quit:^D Repeat count: ^R[n]\n");
fprintf(stderr, "Top: ^T Locate (search, find): ^L text ^L\n");
exit(1);
}
#endif /* !WIN32 */

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, May 19, 1994 2:24 pm PDT */
#ifndef DE_CMDS_H
# define DE_CMDS_H
# define UP 16 /* ^P */
# define DOWN 14 /* ^N */
# define LEFT 2 /* ^B */
# define RIGHT 6 /* ^F */
# define DEL 127 /* ^? */
# define BS 8 /* ^H */
# define UNDO 21 /* ^U */
# define WRITE 23 /* ^W */
# define QUIT 4 /* ^D */
# define REPEAT 18 /* ^R */
# define LOCATE 12 /* ^L */
# define TOP 20 /* ^T */
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

View File

@ -1,78 +0,0 @@
/*
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to copy this garbage collector for any purpose,
* provided the above notices are retained on all copies.
*/
/* Boehm, May 13, 1994 9:50 am PDT */
#include "windows.h"
#include "de_cmds.h"
#include "de_win.h"
ABOUTBOX DIALOG 19, 21, 163, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About Demonstration Text Editor"
BEGIN
ICON "DE", -1, 8, 8, 13, 13, WS_CHILD | WS_VISIBLE
LTEXT "Demonstration Text Editor", -1, 44, 8, 118, 8, WS_CHILD | WS_VISIBLE | WS_GROUP
LTEXT "Version 4.1", -1, 44, 16, 60, 8, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "OK", IDOK, 118, 27, 24, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
DE MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Save\t^W", IDM_FILESAVE
MENUITEM "E&xit\t^D", IDM_FILEEXIT
END
POPUP "&Edit"
BEGIN
MENUITEM "Page &Down\t^R^N", IDM_EDITPDOWN
MENUITEM "Page &Up\t^R^P", IDM_EDITPUP
MENUITEM "U&ndo\t^U", IDM_EDITUNDO
MENUITEM "&Locate\t^L ... ^L", IDM_EDITLOCATE
MENUITEM "D&own\t^N", IDM_EDITDOWN
MENUITEM "U&p\t^P", IDM_EDITUP
MENUITEM "Le&ft\t^B", IDM_EDITLEFT
MENUITEM "&Right\t^F", IDM_EDITRIGHT
MENUITEM "Delete &Backward\tBS", IDM_EDITBS
MENUITEM "Delete F&orward\tDEL", IDM_EDITDEL
MENUITEM "&Top\t^T", IDM_EDITTOP
END
POPUP "&Help"
BEGIN
MENUITEM "&Contents", IDM_HELPCONTENTS
MENUITEM "&About...", IDM_HELPABOUT
END
MENUITEM "Page_&Down", IDM_EDITPDOWN
MENUITEM "Page_&Up", IDM_EDITPUP
END
DE ACCELERATORS
BEGIN
"^R", IDM_EDITREPEAT
"^N", IDM_EDITDOWN
"^P", IDM_EDITUP
"^L", IDM_EDITLOCATE
"^B", IDM_EDITLEFT
"^F", IDM_EDITRIGHT
"^T", IDM_EDITTOP
VK_DELETE, IDM_EDITDEL, VIRTKEY
VK_BACK, IDM_EDITBS, VIRTKEY
END
DE ICON cord\de_win.ICO

View File

@ -1,365 +0,0 @@
/*
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, February 6, 1995 12:29 pm PST */
/*
* The MS Windows specific part of de.
* This started as the generic Windows application template
* made available by Rob Haack (rhaack@polaris.unm.edu), but
* significant parts didn't survive to the final version.
*
* This was written by a nonexpert windows programmer.
*/
#include "windows.h"
#include "gc.h"
#include "cord.h"
#include "de_cmds.h"
#include "de_win.h"
int LINES = 0;
int COLS = 0;
char szAppName[] = "DE";
char FullAppName[] = "Demonstration Editor";
HWND hwnd;
void de_error(char *s)
{
MessageBox( hwnd, (LPSTR) s,
(LPSTR) FullAppName,
MB_ICONINFORMATION | MB_OK );
InvalidateRect(hwnd, NULL, TRUE);
}
int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR command_line, int nCmdShow)
{
MSG msg;
WNDCLASS wndclass;
HANDLE hAccel;
if (!hPrevInstance)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = DLGWINDOWEXTRA;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (hInstance, szAppName);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = "DE";
wndclass.lpszClassName = szAppName;
if (RegisterClass (&wndclass) == 0) {
char buf[50];
sprintf(buf, "RegisterClass: error code: 0x%X", GetLastError());
de_error(buf);
return(0);
}
}
/* Empirically, the command line does not include the command name ...
if (command_line != 0) {
while (isspace(*command_line)) command_line++;
while (*command_line != 0 && !isspace(*command_line)) command_line++;
while (isspace(*command_line)) command_line++;
} */
if (command_line == 0 || *command_line == 0) {
de_error("File name argument required");
return( 0 );
} else {
char *p = command_line;
while (*p != 0 && !isspace(*p)) p++;
arg_file_name = CORD_to_char_star(
CORD_substr(command_line, 0, p - command_line));
}
hwnd = CreateWindow (szAppName,
FullAppName,
WS_OVERLAPPEDWINDOW | WS_CAPTION, /* Window style */
CW_USEDEFAULT, 0, /* default pos. */
CW_USEDEFAULT, 0, /* default width, height */
NULL, /* No parent */
NULL, /* Window class menu */
hInstance, NULL);
if (hwnd == NULL) {
char buf[50];
sprintf(buf, "CreateWindow: error code: 0x%X", GetLastError());
de_error(buf);
return(0);
}
ShowWindow (hwnd, nCmdShow);
hAccel = LoadAccelerators( hInstance, szAppName );
while (GetMessage (&msg, NULL, 0, 0))
{
if( !TranslateAccelerator( hwnd, hAccel, &msg ) )
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
}
return msg.wParam;
}
/* Return the argument with all control characters replaced by blanks. */
char * plain_chars(char * text, size_t len)
{
char * result = GC_MALLOC_ATOMIC(len + 1);
register size_t i;
for (i = 0; i < len; i++) {
if (iscntrl(text[i])) {
result[i] = ' ';
} else {
result[i] = text[i];
}
}
result[len] = '\0';
return(result);
}
/* Return the argument with all non-control-characters replaced by */
/* blank, and all control characters c replaced by c + 32. */
char * control_chars(char * text, size_t len)
{
char * result = GC_MALLOC_ATOMIC(len + 1);
register size_t i;
for (i = 0; i < len; i++) {
if (iscntrl(text[i])) {
result[i] = text[i] + 0x40;
} else {
result[i] = ' ';
}
}
result[len] = '\0';
return(result);
}
int char_width;
int char_height;
void get_line_rect(int line, int win_width, RECT * rectp)
{
rectp -> top = line * char_height;
rectp -> bottom = rectp->top + char_height;
rectp -> left = 0;
rectp -> right = win_width;
}
int caret_visible = 0; /* Caret is currently visible. */
int screen_was_painted = 0;/* Screen has been painted at least once. */
void update_cursor(void);
LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
static FARPROC lpfnAboutBox;
static HANDLE hInstance;
HDC dc;
PAINTSTRUCT ps;
RECT client_area;
RECT this_line;
RECT dummy;
TEXTMETRIC tm;
register int i;
int id;
switch (message)
{
case WM_CREATE:
hInstance = ( (LPCREATESTRUCT) lParam)->hInstance;
lpfnAboutBox = MakeProcInstance( (FARPROC) AboutBox, hInstance );
dc = GetDC(hwnd);
SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
GetTextMetrics(dc, &tm);
ReleaseDC(hwnd, dc);
char_width = tm.tmAveCharWidth;
char_height = tm.tmHeight + tm.tmExternalLeading;
GetClientRect(hwnd, &client_area);
COLS = (client_area.right - client_area.left)/char_width;
LINES = (client_area.bottom - client_area.top)/char_height;
generic_init();
return(0);
case WM_CHAR:
if (wParam == QUIT) {
SendMessage( hwnd, WM_CLOSE, 0, 0L );
} else {
do_command(wParam);
}
return(0);
case WM_SETFOCUS:
CreateCaret(hwnd, NULL, char_width, char_height);
ShowCaret(hwnd);
caret_visible = 1;
update_cursor();
return(0);
case WM_KILLFOCUS:
HideCaret(hwnd);
DestroyCaret();
caret_visible = 0;
return(0);
case WM_LBUTTONUP:
{
unsigned xpos = LOWORD(lParam); /* From left */
unsigned ypos = HIWORD(lParam); /* from top */
set_position( xpos/char_width, ypos/char_height );
return(0);
}
case WM_COMMAND:
id = LOWORD(wParam);
if (id & EDIT_CMD_FLAG) {
if (id & REPEAT_FLAG) do_command(REPEAT);
do_command(CHAR_CMD(id));
return( 0 );
} else {
switch(id) {
case IDM_FILEEXIT:
SendMessage( hwnd, WM_CLOSE, 0, 0L );
return( 0 );
case IDM_HELPABOUT:
if( DialogBox( hInstance, "ABOUTBOX",
hwnd, lpfnAboutBox ) );
InvalidateRect( hwnd, NULL, TRUE );
return( 0 );
case IDM_HELPCONTENTS:
de_error(
"Cursor keys: ^B(left) ^F(right) ^P(up) ^N(down)\n"
"Undo: ^U Write: ^W Quit:^D Repeat count: ^R[n]\n"
"Top: ^T Locate (search, find): ^L text ^L\n");
return( 0 );
}
}
break;
case WM_CLOSE:
DestroyWindow( hwnd );
return 0;
case WM_DESTROY:
PostQuitMessage (0);
return 0;
case WM_PAINT:
dc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &client_area);
COLS = (client_area.right - client_area.left)/char_width;
LINES = (client_area.bottom - client_area.top)/char_height;
SelectObject(dc, GetStockObject(SYSTEM_FIXED_FONT));
for (i = 0; i < LINES; i++) {
get_line_rect(i, client_area.right, &this_line);
if (IntersectRect(&dummy, &this_line, &ps.rcPaint)) {
CORD raw_line = retrieve_screen_line(i);
size_t len = CORD_len(raw_line);
char * text = CORD_to_char_star(raw_line);
/* May contain embedded NULLs */
char * plain = plain_chars(text, len);
char * blanks = CORD_to_char_star(CORD_chars(' ',
COLS - len));
char * control = control_chars(text, len);
# define RED RGB(255,0,0)
SetBkMode(dc, OPAQUE);
SetTextColor(dc, GetSysColor(COLOR_WINDOWTEXT));
TextOut(dc, this_line.left, this_line.top,
plain, len);
TextOut(dc, this_line.left + len * char_width, this_line.top,
blanks, COLS - len);
SetBkMode(dc, TRANSPARENT);
SetTextColor(dc, RED);
TextOut(dc, this_line.left, this_line.top,
control, strlen(control));
}
}
EndPaint(hwnd, &ps);
screen_was_painted = 1;
return 0;
}
return DefWindowProc (hwnd, message, wParam, lParam);
}
int last_col;
int last_line;
void move_cursor(int c, int l)
{
last_col = c;
last_line = l;
if (caret_visible) update_cursor();
}
void update_cursor(void)
{
SetCaretPos(last_col * char_width, last_line * char_height);
ShowCaret(hwnd);
}
void invalidate_line(int i)
{
RECT line;
if (!screen_was_painted) return;
/* Invalidating a rectangle before painting seems result in a */
/* major performance problem. */
get_line_rect(i, COLS*char_width, &line);
InvalidateRect(hwnd, &line, FALSE);
}
LRESULT CALLBACK AboutBox( HWND hDlg, UINT message,
WPARAM wParam, LPARAM lParam )
{
switch( message )
{
case WM_INITDIALOG:
SetFocus( GetDlgItem( hDlg, IDOK ) );
break;
case WM_COMMAND:
switch( wParam )
{
case IDOK:
EndDialog( hDlg, TRUE );
break;
}
break;
case WM_CLOSE:
EndDialog( hDlg, TRUE );
return TRUE;
}
return FALSE;
}

View File

@ -1,103 +0,0 @@
/*
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, May 19, 1994 2:25 pm PDT */
/* cord.h, de_cmds.h, and windows.h should be included before this. */
# define OTHER_FLAG 0x100
# define EDIT_CMD_FLAG 0x200
# define REPEAT_FLAG 0x400
# define CHAR_CMD(i) ((i) & 0xff)
/* MENU: DE */
#define IDM_FILESAVE (EDIT_CMD_FLAG + WRITE)
#define IDM_FILEEXIT (OTHER_FLAG + 1)
#define IDM_HELPABOUT (OTHER_FLAG + 2)
#define IDM_HELPCONTENTS (OTHER_FLAG + 3)
#define IDM_EDITPDOWN (REPEAT_FLAG + EDIT_CMD_FLAG + DOWN)
#define IDM_EDITPUP (REPEAT_FLAG + EDIT_CMD_FLAG + UP)
#define IDM_EDITUNDO (EDIT_CMD_FLAG + UNDO)
#define IDM_EDITLOCATE (EDIT_CMD_FLAG + LOCATE)
#define IDM_EDITDOWN (EDIT_CMD_FLAG + DOWN)
#define IDM_EDITUP (EDIT_CMD_FLAG + UP)
#define IDM_EDITLEFT (EDIT_CMD_FLAG + LEFT)
#define IDM_EDITRIGHT (EDIT_CMD_FLAG + RIGHT)
#define IDM_EDITBS (EDIT_CMD_FLAG + BS)
#define IDM_EDITDEL (EDIT_CMD_FLAG + DEL)
#define IDM_EDITREPEAT (EDIT_CMD_FLAG + REPEAT)
#define IDM_EDITTOP (EDIT_CMD_FLAG + TOP)
/* Windows UI stuff */
LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
UINT wParam, LONG lParam);
LRESULT CALLBACK AboutBox( HWND hDlg, UINT message,
UINT wParam, LONG lParam );
/* Screen dimensions. Maintained by de_win.c. */
extern int LINES;
extern int COLS;
/* File being edited. */
extern char * arg_file_name;
/* Current display position in file. Maintained by de.c */
extern int dis_line;
extern int dis_col;
/* Current cursor position in file. */
extern int line;
extern int col;
/*
* Calls from de_win.c to de.c
*/
CORD retrieve_screen_line(int i);
/* Get the contents of i'th screen line. */
/* Relies on COLS. */
void set_position(int x, int y);
/* Set column, row. Upper left of window = (0,0). */
void do_command(int);
/* Execute an editor command. */
/* Agument is a command character or one */
/* of the IDM_ commands. */
void generic_init(void);
/* OS independent initialization */
/*
* Calls from de.c to de_win.c
*/
void move_cursor(int column, int line);
/* Physically move the cursor on the display, */
/* so that it appears at */
/* (column, line). */
void invalidate_line(int line);
/* Invalidate line i on the screen. */
void de_error(char *s);
/* Display error message. */

View File

@ -1,70 +0,0 @@
# ifndef EC_H
# define EC_H
# ifndef CORD_H
# include "cord.h"
# endif
/* Extensible cords are strings that may be destructively appended to. */
/* They allow fast construction of cords from characters that are */
/* being read from a stream. */
/*
* A client might look like:
*
* {
* CORD_ec x;
* CORD result;
* char c;
* FILE *f;
*
* ...
* CORD_ec_init(x);
* while(...) {
* c = getc(f);
* ...
* CORD_ec_append(x, c);
* }
* result = CORD_balance(CORD_ec_to_cord(x));
*
* If a C string is desired as the final result, the call to CORD_balance
* may be replaced by a call to CORD_to_char_star.
*/
# ifndef CORD_BUFSZ
# define CORD_BUFSZ 128
# endif
typedef struct CORD_ec_struct {
CORD ec_cord;
char * ec_bufptr;
char ec_buf[CORD_BUFSZ+1];
} CORD_ec[1];
/* This structure represents the concatenation of ec_cord with */
/* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */
/* Flush the buffer part of the extended chord into ec_cord. */
/* Note that this is almost the only real function, and it is */
/* implemented in 6 lines in cordxtra.c */
void CORD_ec_flush_buf(CORD_ec x);
/* Convert an extensible cord to a cord. */
# define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)
/* Initialize an extensible cord. */
# define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf)
/* Append a character to an extensible cord. */
# define CORD_ec_append(x, c) \
{ \
if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \
CORD_ec_flush_buf(x); \
} \
*((x)[0].ec_bufptr)++ = (c); \
}
/* Append a cord to an extensible cord. Structure remains shared with */
/* original. */
void CORD_ec_append_cord(CORD_ec x, CORD s);
# endif /* EC_H */

View File

@ -1,698 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
* Copyright 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Note that this defines a large number of tuning hooks, which can
* safely be ignored in nearly all cases. For normal use it suffices
* to call only GC_MALLOC and perhaps GC_REALLOC.
* For better performance, also look at GC_MALLOC_ATOMIC, and
* GC_enable_incremental. If you need an action to be performed
* immediately before an object is collected, look at GC_register_finalizer.
* If you are using Solaris threads, look at the end of this file.
* Everything else is best ignored unless you encounter performance
* problems.
*/
#ifndef _GC_H
# define _GC_H
# define __GC
# include <stddef.h>
#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
#include "libgc_globals.h"
#endif
#if defined(_MSC_VER) && defined(_DLL)
#ifdef GC_BUILD
#define GC_API __declspec(dllexport)
#else
#define GC_API __declspec(dllimport)
#endif
#endif
#ifndef GC_API
#define GC_API extern
#endif
# if defined(__STDC__) || defined(__cplusplus)
# define GC_PROTO(args) args
typedef void * GC_PTR;
# else
# define GC_PROTO(args) ()
typedef char * GC_PTR;
# endif
# ifdef __cplusplus
extern "C" {
# endif
/* Define word and signed_word to be unsigned and signed types of the */
/* size as char * or void *. There seems to be no way to do this */
/* even semi-portably. The following is probably no better/worse */
/* than almost anything else. */
/* The ANSI standard suggests that size_t and ptr_diff_t might be */
/* better choices. But those appear to have incorrect definitions */
/* on may systems. Notably "typedef int size_t" seems to be both */
/* frequent and WRONG. */
typedef unsigned long GC_word;
typedef long GC_signed_word;
/* Public read-only variables */
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
/* Public R/W variables */
GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
/* When there is insufficient memory to satisfy */
/* an allocation request, we return */
/* (*GC_oom_fn)(). By default this just */
/* returns 0. */
/* If it returns, it must return 0 or a valid */
/* pointer to a previously allocated heap */
/* object. */
GC_API int GC_quiet; /* Disable statistics output. Only matters if */
/* collector has been compiled with statistics */
/* enabled. This involves a performance cost, */
/* and is thus not the default. */
GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
/* because it's not safe. */
GC_API int GC_dont_expand;
/* Dont expand heap unless explicitly requested */
/* or forced to. */
GC_API int GC_full_freq; /* Number of partial collections between */
/* full collections. Matters only if */
/* GC_incremental is set. */
GC_API GC_word GC_non_gc_bytes;
/* Bytes not considered candidates for collection. */
/* Used only to control scheduling of collections. */
GC_API GC_word GC_free_space_divisor;
/* We try to make sure that we allocate at */
/* least N/GC_free_space_divisor bytes between */
/* collections, where N is the heap size plus */
/* a rough estimate of the root set size. */
/* Initially, GC_free_space_divisor = 4. */
/* Increasing its value will use less space */
/* but more collection time. Decreasing it */
/* will appreciably decrease collection time */
/* at the expense of space. */
/* GC_free_space_divisor = 1 will effectively */
/* disable collections. */
GC_API GC_word GC_max_retries;
/* The maximum number of GCs attempted before */
/* reporting out of memory after heap */
/* expansion fails. Initially 0. */
/* Public procedures */
/*
* general purpose allocation routines, with roughly malloc calling conv.
* The atomic versions promise that no relevant pointers are contained
* in the object. The nonatomic versions guarantee that the new object
* is cleared. GC_malloc_stubborn promises that no changes to the object
* will occur after GC_end_stubborn_change has been called on the
* result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
* that is scanned for pointers to collectable objects, but is not itself
* collectable. GC_malloc_uncollectable and GC_free called on the resulting
* object implicitly update GC_non_gc_bytes appropriately.
*/
GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
/* The following is only defined if the library has been suitably */
/* compiled: */
GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
/* Explicitly deallocate an object. Dangerous if used incorrectly. */
/* Requires a pointer to the base of an object. */
/* If the argument is stubborn, it should not be changeable when freed. */
/* An object should not be enable for finalization when it is */
/* explicitly deallocated. */
/* GC_free(0) is a no-op, as required by ANSI C for free. */
GC_API void GC_free GC_PROTO((GC_PTR object_addr));
/*
* Stubborn objects may be changed only if the collector is explicitly informed.
* The collector is implicitly informed of coming change when such
* an object is first allocated. The following routines inform the
* collector that an object will no longer be changed, or that it will
* once again be changed. Only nonNIL pointer stores into the object
* are considered to be changes. The argument to GC_end_stubborn_change
* must be exacly the value returned by GC_malloc_stubborn or passed to
* GC_change_stubborn. (In the second case it may be an interior pointer
* within 512 bytes of the beginning of the objects.)
* There is a performance penalty for allowing more than
* one stubborn object to be changed at once, but it is acceptable to
* do so. The same applies to dropping stubborn objects that are still
* changeable.
*/
GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
/* Return 0 if displaced_pointer doesn't point to within a valid */
/* object. */
GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
/* Given a pointer to the base of an object, return its size in bytes. */
/* The returned size may be slightly larger than what was originally */
/* requested. */
GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
/* For compatibility with C library. This is occasionally faster than */
/* a malloc followed by a bcopy. But if you rely on that, either here */
/* or with the standard C library, your code is broken. In my */
/* opinion, it shouldn't have been invented, but now we're stuck. -HB */
/* The resulting object has the same kind as the original. */
/* If the argument is stubborn, the result will have changes enabled. */
/* It is an error to have changes enabled for the original object. */
/* Follows ANSI comventions for NULL old_object. */
GC_API GC_PTR GC_realloc GC_PROTO((GC_PTR old_object,
size_t new_size_in_bytes));
/* Explicitly increase the heap size. */
/* Returns 0 on failure, 1 on success. */
GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
/* Limit the heap size to n bytes. Useful when you're debugging, */
/* especially on systems that don't handle running out of memory well. */
/* n == 0 ==> unbounded. This is the default. */
GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
/* Inform the collector that a certain section of statically allocated */
/* memory contains no pointers to garbage collected memory. Thus it */
/* need not be scanned. This is sometimes important if the application */
/* maps large read/write files into the address space, which could be */
/* mistaken for dynamic library data segments on some systems. */
GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
/* Clear the set of root segments. Wizards only. */
GC_API void GC_clear_roots GC_PROTO((void));
/* Add a root segment. Wizards only. */
GC_API void GC_add_roots GC_PROTO((char * low_address,
char * high_address_plus_1));
/* Add a displacement to the set of those considered valid by the */
/* collector. GC_register_displacement(n) means that if p was returned */
/* by GC_malloc, then (char *)p + n will be considered to be a valid */
/* pointer to n. N must be small and less than the size of p. */
/* (All pointers to the interior of objects from the stack are */
/* considered valid in any case. This applies to heap objects and */
/* static data.) */
/* Preferably, this should be called before any other GC procedures. */
/* Calling it later adds to the probability of excess memory */
/* retention. */
/* This is a no-op if the collector was compiled with recognition of */
/* arbitrary interior pointers enabled, which is now the default. */
GC_API void GC_register_displacement GC_PROTO((GC_word n));
/* The following version should be used if any debugging allocation is */
/* being done. */
GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
/* Explicitly trigger a full, world-stop collection. */
GC_API void GC_gcollect GC_PROTO((void));
/* Trigger a full world-stopped collection. Abort the collection if */
/* and when stop_func returns a nonzero value. Stop_func will be */
/* called frequently, and should be reasonably fast. This works even */
/* if virtual dirty bits, and hence incremental collection is not */
/* available for this architecture. Collections can be aborted faster */
/* than normal pause times for incremental collection. However, */
/* aborted collections do no useful work; the next collection needs */
/* to start from the beginning. */
typedef int (* GC_stop_func) GC_PROTO((void));
GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
/* Return the number of bytes in the heap. Excludes collector private */
/* data structures. Includes empty blocks and fragmentation loss. */
/* Includes some pages that were allocated but never written. */
GC_API size_t GC_get_heap_size GC_PROTO((void));
/* Return the number of bytes allocated since the last collection. */
GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
/* available or most heap objects are */
/* pointerfree(atomic) or immutable. */
/* Don't use in leak finding mode. */
/* Ignored if GC_dont_gc is true. */
GC_API void GC_enable_incremental GC_PROTO((void));
/* Perform some garbage collection work, if appropriate. */
/* Return 0 if there is no more work to be done. */
/* Typically performs an amount of work corresponding roughly */
/* to marking from one page. May do more work if further */
/* progress requires it, e.g. if incremental collection is */
/* disabled. It is reasonable to call this in a wait loop */
/* until it returns 0. */
GC_API int GC_collect_a_little GC_PROTO((void));
/* Allocate an object of size lb bytes. The client guarantees that */
/* as long as the object is live, it will be referenced by a pointer */
/* that points to somewhere within the first 256 bytes of the object. */
/* (This should normally be declared volatile to prevent the compiler */
/* from invalidating this assertion.) This routine is only useful */
/* if a large array is being allocated. It reduces the chance of */
/* accidentally retaining such an array as a result of scanning an */
/* integer that happens to be an address inside the array. (Actually, */
/* it reduces the chance of the allocator not finding space for such */
/* an array, since it will try hard to avoid introducing such a false */
/* reference.) On a SunOS 4.X or MS Windows system this is recommended */
/* for arrays likely to be larger than 100K or so. For other systems, */
/* or if the collector is not configured to recognize all interior */
/* pointers, the threshold is normally much higher. */
GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
# define GC_ADD_CALLER
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
#ifdef GC_ADD_CALLER
# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
#else
# define GC_EXTRAS __FILE__, __LINE__
# define GC_EXTRA_PARAMS char * descr_string, int descr_int
#endif
/* Debugging (annotated) allocation. GC_gcollect will check */
/* objects allocated in this way for overwrites, etc. */
GC_API GC_PTR GC_debug_malloc
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_atomic
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_uncollectable
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_stubborn
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
GC_API GC_PTR GC_debug_realloc
GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
GC_EXTRA_PARAMS));
GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
# ifdef GC_DEBUG
# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
# define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_debug_malloc_uncollectable(sz, \
GC_EXTRAS)
# define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
# define GC_FREE(p) GC_debug_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_debug_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, GC_base(obj))
# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
# else
# define GC_MALLOC(sz) GC_malloc(sz)
# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
# define GC_REALLOC(old, sz) GC_realloc(old, sz)
# define GC_FREE(p) GC_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, obj)
# define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
# endif
/* The following are included because they are often convenient, and */
/* reduce the chance for a misspecifed size argument. But calls may */
/* expand to something syntactically incorrect if t is a complicated */
/* type expression. */
# define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
# define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
# define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
# define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
/* Finalization. Some of these primitives are grossly unsafe. */
/* The idea is to make them both cheap, and sufficient to build */
/* a safer layer, closer to PCedar finalization. */
/* The interface represents my conclusions from a long discussion */
/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */
typedef void (*GC_finalization_proc)
GC_PROTO((GC_PTR obj, GC_PTR client_data));
GC_API void GC_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* When obj is no longer accessible, invoke */
/* (*fn)(obj, cd). If a and b are inaccessible, and */
/* a points to b (after disappearing links have been */
/* made to disappear), then only a will be */
/* finalized. (If this does not create any new */
/* pointers to b, then b will be finalized after the */
/* next collection.) Any finalizable object that */
/* is reachable from itself by following one or more */
/* pointers will not be finalized (or collected). */
/* Thus cycles involving finalizable objects should */
/* be avoided, or broken by disappearing links. */
/* All but the last finalizer registered for an object */
/* is ignored. */
/* Finalization may be removed by passing 0 as fn. */
/* Finalizers are implicitly unregistered just before */
/* they are invoked. */
/* The old finalizer and client data are stored in */
/* *ofn and *ocd. */
/* Fn is never invoked on an accessible object, */
/* provided hidden pointers are converted to real */
/* pointers only if the allocation lock is held, and */
/* such conversions are not performed by finalization */
/* routines. */
/* If GC_register_finalizer is aborted as a result of */
/* a signal, the object may be left with no */
/* finalization, even if neither the old nor new */
/* finalizer were NULL. */
/* Obj should be the nonNULL starting address of an */
/* object allocated by GC_malloc or friends. */
/* Note that any garbage collectable object referenced */
/* by cd will be considered accessible until the */
/* finalizer is invoked. */
/* Another versions of the above follow. It ignores */
/* self-cycles, i.e. pointers from a finalizable object to */
/* itself. There is a stylistic argument that this is wrong, */
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
/* case. */
GC_API void GC_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* The following routine may be used to break cycles between */
/* finalizable objects, thus causing cyclic finalizable */
/* objects to be finalized in the correct order. Standard */
/* use involves calling GC_register_disappearing_link(&p), */
/* where p is a pointer that is not followed by finalization */
/* code, and should not be considered in determining */
/* finalization order. */
GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Link should point to a field of a heap allocated */
/* object obj. *link will be cleared when obj is */
/* found to be inaccessible. This happens BEFORE any */
/* finalization code is invoked, and BEFORE any */
/* decisions about finalization order are made. */
/* This is useful in telling the finalizer that */
/* some pointers are not essential for proper */
/* finalization. This may avoid finalization cycles. */
/* Note that obj may be resurrected by another */
/* finalizer, and thus the clearing of *link may */
/* be visible to non-finalization code. */
/* There's an argument that an arbitrary action should */
/* be allowed here, instead of just clearing a pointer. */
/* But this causes problems if that action alters, or */
/* examines connectivity. */
/* Returns 1 if link was already registered, 0 */
/* otherwise. */
/* Only exists for backward compatibility. See below: */
GC_API int GC_general_register_disappearing_link
GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
/* A slight generalization of the above. *link is */
/* cleared when obj first becomes inaccessible. This */
/* can be used to implement weak pointers easily and */
/* safely. Typically link will point to a location */
/* holding a disguised pointer to obj. (A pointer */
/* inside an "atomic" object is effectively */
/* disguised.) In this way soft */
/* pointers are broken before any object */
/* reachable from them are finalized. Each link */
/* May be registered only once, i.e. with one obj */
/* value. This was added after a long email discussion */
/* with John Ellis. */
/* Obj must be a pointer to the first word of an object */
/* we allocated. It is unsafe to explicitly deallocate */
/* the object containing link. Explicitly deallocating */
/* obj may or may not cause link to eventually be */
/* cleared. */
GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Returns 0 if link was not actually registered. */
/* Undoes a registration by either of the above two */
/* routines. */
/* Auxiliary fns to make finalization work correctly with displaced */
/* pointers introduced by the debugging allocators. */
GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
GC_API int GC_invoke_finalizers GC_PROTO((void));
/* Run finalizers for all objects that are ready to */
/* be finalized. Return the number of finalizers */
/* that were run. Normally this is also called */
/* implicitly during some allocations. If */
/* FINALIZE_ON_DEMAND is defined, it must be called */
/* explicitly. */
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
/* The following is intended to be used by a higher level */
/* (e.g. cedar-like) finalization facility. It is expected */
/* that finalization code will arrange for hidden pointers to */
/* disappear. Otherwise objects can be accessed after they */
/* have been collected. */
/* Note that putting pointers in atomic objects or in */
/* nonpointer slots of "typed" objects is equivalent to */
/* disguising them in this way, and may have other advantages. */
# if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
typedef GC_word GC_hidden_pointer;
# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
/* Converting a hidden pointer to a real pointer requires verifying */
/* that the object still exists. This involves acquiring the */
/* allocator lock to avoid a race with the collector. */
# endif /* I_HIDE_POINTERS */
typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
/* Check that p and q point to the same object. */
/* Fail conspicuously if they don't. */
/* Returns the first argument. */
/* Succeeds if neither p nor q points to the heap. */
/* May succeed if both p and q point to between heap objects. */
GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
/* Checked pointer pre- and post- increment operations. Note that */
/* the second argument is in units of bytes, not multiples of the */
/* object size. This should either be invoked from a macro, or the */
/* call should be automatically generated. */
GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
/* Check that p is visible */
/* to the collector as a possibly pointer containing location. */
/* If it isn't fail conspicuously. */
/* Returns the argument in all cases. May erroneously succeed */
/* in hard cases. (This is intended for debugging use with */
/* untyped allocations. The idea is that it should be possible, though */
/* slow, to add such a call to all indirect pointer stores.) */
/* Currently useless for multithreaded worlds. */
GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
/* Fail conspicuously if this property does not hold. */
/* Uninteresting with ALL_INTERIOR_POINTERS. */
/* Always returns its argument. */
GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
/* Safer, but slow, pointer addition. Probably useful mainly with */
/* a preprocessor. Useful only for heap pointers. */
#ifdef GC_DEBUG
# define GC_PTR_ADD3(x, n, type_of_result) \
((type_of_result)GC_same_obj((x)+(n), (x)))
# define GC_PRE_INCR3(x, n, type_of_result) \
((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
# define GC_POST_INCR2(x, type_of_result) \
((type_of_result)GC_post_incr(&(x), sizeof(*x))
# ifdef __GNUC__
# define GC_PTR_ADD(x, n) \
GC_PTR_ADD3(x, n, typeof(x))
# define GC_PRE_INCR(x, n) \
GC_PRE_INCR3(x, n, typeof(x))
# define GC_POST_INCR(x, n) \
GC_POST_INCR3(x, typeof(x))
# else
/* We can't do this right without typeof, which ANSI */
/* decided was not sufficiently useful. Repeatedly */
/* mentioning the arguments seems too dangerous to be */
/* useful. So does not casting the result. */
# define GC_PTR_ADD(x, n) ((x)+(n))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
# define GC_PTR_ADD(x, n) ((x)+(n))
# define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
# define GC_PRE_INCR(x, n) ((x) += (n))
# define GC_POST_INCR2(x, n, type_of_result) ((x)++)
# define GC_POST_INCR(x, n) ((x)++)
#endif
/* Safer assignment of a pointer to a nonstack location. */
#ifdef GC_DEBUG
# ifdef __STDC__
# define GC_PTR_STORE(p, q) \
(*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
# else
# define GC_PTR_STORE(p, q) \
(*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_STORE(p, q) *((p) = (q))
#endif
/* Fynctions called to report pointer checking errors */
GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
GC_API void (*GC_is_valid_displacement_print_proc)
GC_PROTO((GC_PTR p));
GC_API void (*GC_is_visible_print_proc)
GC_PROTO((GC_PTR p));
#ifdef SOLARIS_THREADS
/* We need to intercept calls to many of the threads primitives, so */
/* that we can locate thread stacks and stop the world. */
/* Note also that the collector cannot see thread specific data. */
/* Thread specific data should generally consist of pointers to */
/* uncollectable objects, which are deallocated using the destructor */
/* facility in thr_keycreate. */
# include <thread.h>
# include <signal.h>
int GC_thr_create(void *stack_base, size_t stack_size,
void *(*start_routine)(void *), void *arg, long flags,
thread_t *new_thread);
int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
int GC_thr_suspend(thread_t target_thread);
int GC_thr_continue(thread_t target_thread);
void * GC_dlopen(const char *path, int mode);
# ifdef _SOLARIS_PTHREADS
# include <pthread.h>
extern int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void * (*thread_execp)(void *), void *arg);
extern int GC_pthread_join(pthread_t wait_for, void **status);
# undef thread_t
# define pthread_join GC_pthread_join
# define pthread_create GC_pthread_create
#endif
# define thr_create GC_thr_create
# define thr_join GC_thr_join
# define thr_suspend GC_thr_suspend
# define thr_continue GC_thr_continue
# define dlopen GC_dlopen
# endif /* SOLARIS_THREADS */
#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
/* We treat these similarly. */
# include <pthread.h>
# include <signal.h>
int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
int GC_pthread_join(pthread_t thread, void **retval);
# define pthread_create GC_pthread_create
# define pthread_sigmask GC_pthread_sigmask
# define pthread_join GC_pthread_join
#endif /* IRIX_THREADS || LINUX_THREADS */
#if defined(THREADS) && !defined(SRC_M3)
/* This returns a list of objects, linked through their first */
/* word. Its use can greatly reduce lock contention problems, since */
/* the allocation lock can be acquired and released many fewer times. */
GC_PTR GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
/* in returned list. */
extern void GC_thr_init(); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
/*
* If you are planning on putting
* the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
* from the statically loaded program section.
* This circumvents a Solaris 2.X (X<=4) linker bug.
*/
#if defined(sparc) || defined(__sparc)
# define GC_INIT() { extern end, etext; \
GC_noop(&end, &etext); }
#else
# if defined(__CYGWIN32__) && defined(GC_USE_DLL)
/*
* Similarly gnu-win32 DLLs need explicit initialization
*/
# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
# else
# define GC_INIT()
# endif
#endif
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* _GC_H */

View File

@ -1,118 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, May 19, 1994 2:23 pm PDT */
# ifndef CORD_POSITION_H
/* The representation of CORD_position. This is private to the */
/* implementation, but the size is known to clients. Also */
/* the implementation of some exported macros relies on it. */
/* Don't use anything defined here and not in cord.h. */
# define MAX_DEPTH 48
/* The maximum depth of a balanced cord + 1. */
/* We don't let cords get deeper than MAX_DEPTH. */
struct CORD_pe {
CORD pe_cord;
size_t pe_start_pos;
};
/* A structure describing an entry on the path from the root */
/* to current position. */
typedef struct CORD_Pos {
size_t cur_pos;
int path_len;
# define CORD_POS_INVALID (0x55555555)
/* path_len == INVALID <==> position invalid */
const char *cur_leaf; /* Current leaf, if it is a string. */
/* If the current leaf is a function, */
/* then this may point to function_buf */
/* containing the next few characters. */
/* Always points to a valid string */
/* containing the current character */
/* unless cur_end is 0. */
size_t cur_start; /* Start position of cur_leaf */
size_t cur_end; /* Ending position of cur_leaf */
/* 0 if cur_leaf is invalid. */
struct CORD_pe path[MAX_DEPTH + 1];
/* path[path_len] is the leaf corresponding to cur_pos */
/* path[0].pe_cord is the cord we point to. */
# define FUNCTION_BUF_SZ 8
char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */
/* from function node. */
} CORD_pos[1];
/* Extract the cord from a position: */
CORD CORD_pos_to_cord(CORD_pos p);
/* Extract the current index from a position: */
size_t CORD_pos_to_index(CORD_pos p);
/* Fetch the character located at the given position: */
char CORD_pos_fetch(CORD_pos p);
/* Initialize the position to refer to the give cord and index. */
/* Note that this is the most expensive function on positions: */
void CORD_set_pos(CORD_pos p, CORD x, size_t i);
/* Advance the position to the next character. */
/* P must be initialized and valid. */
/* Invalidates p if past end: */
void CORD_next(CORD_pos p);
/* Move the position to the preceding character. */
/* P must be initialized and valid. */
/* Invalidates p if past beginning: */
void CORD_prev(CORD_pos p);
/* Is the position valid, i.e. inside the cord? */
int CORD_pos_valid(CORD_pos p);
char CORD__pos_fetch(CORD_pos);
void CORD__next(CORD_pos);
void CORD__prev(CORD_pos);
#define CORD_pos_fetch(p) \
(((p)[0].cur_end != 0)? \
(p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \
: CORD__pos_fetch(p))
#define CORD_next(p) \
(((p)[0].cur_pos + 1 < (p)[0].cur_end)? \
(p)[0].cur_pos++ \
: (CORD__next(p), 0))
#define CORD_prev(p) \
(((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \
(p)[0].cur_pos-- \
: (CORD__prev(p), 0))
#define CORD_pos_to_index(p) ((p)[0].cur_pos)
#define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord)
#define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID)
/* Some grubby stuff for performance-critical friends: */
#define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos))
/* Number of characters in cache. <= 0 ==> none */
#define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p))
/* Advance position by n characters */
/* 0 < n < CORD_pos_chars_left(p) */
#define CORD_pos_cur_char_addr(p) \
(p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start)
/* address of current character in cache. */
#endif

View File

@ -1,693 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
* Copyright (c) 1997 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, October 9, 1995 1:16 pm PDT */
# include "gc_priv.h"
/* Do we want to and know how to save the call stack at the time of */
/* an allocation? How much space do we want to use in each object? */
# define START_FLAG ((word)0xfedcedcb)
# define END_FLAG ((word)0xbcdecdef)
/* Stored both one past the end of user object, and one before */
/* the end of the object as seen by the allocator. */
/* Object header */
typedef struct {
char * oh_string; /* object descriptor string */
word oh_int; /* object descriptor integers */
# ifdef NEED_CALLINFO
struct callinfo oh_ci[NFRAMES];
# endif
word oh_sz; /* Original malloc arg. */
word oh_sf; /* start flag */
} oh;
/* The size of the above structure is assumed not to dealign things, */
/* and to be a multiple of the word length. */
#define DEBUG_BYTES (sizeof (oh) + sizeof (word))
#undef ROUNDED_UP_WORDS
#define ROUNDED_UP_WORDS(n) BYTES_TO_WORDS((n) + WORDS_TO_BYTES(1) - 1)
#ifdef SAVE_CALL_CHAIN
# define ADD_CALL_CHAIN(base, ra) GC_save_callers(((oh *)(base)) -> oh_ci)
# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
#else
# ifdef GC_ADD_CALLER
# define ADD_CALL_CHAIN(base, ra) ((oh *)(base)) -> oh_ci[0].ci_pc = (ra)
# define PRINT_CALL_CHAIN(base) GC_print_callers(((oh *)(base)) -> oh_ci)
# else
# define ADD_CALL_CHAIN(base, ra)
# define PRINT_CALL_CHAIN(base)
# endif
#endif
/* Check whether object with base pointer p has debugging info */
/* p is assumed to point to a legitimate object in our part */
/* of the heap. */
GC_bool GC_has_debug_info(p)
ptr_t p;
{
register oh * ohdr = (oh *)p;
register ptr_t body = (ptr_t)(ohdr + 1);
register word sz = GC_size((ptr_t) ohdr);
if (HBLKPTR((ptr_t)ohdr) != HBLKPTR((ptr_t)body)
|| sz < sizeof (oh)) {
return(FALSE);
}
if (ohdr -> oh_sz == sz) {
/* Object may have had debug info, but has been deallocated */
return(FALSE);
}
if (ohdr -> oh_sf == (START_FLAG ^ (word)body)) return(TRUE);
if (((word *)ohdr)[BYTES_TO_WORDS(sz)-1] == (END_FLAG ^ (word)body)) {
return(TRUE);
}
return(FALSE);
}
/* Return start of object that might have debugging info. */
ptr_t GC_debug_object_start(p)
ptr_t p;
{
register word * result = (word *)((oh *)p + 1);
if (! GC_has_debug_info(p))
return(p);
return((ptr_t)result);
}
/* Store debugging info into p. Return displaced pointer. */
/* Assumes we don't hold allocation lock. */
ptr_t GC_store_debug_info(p, sz, string, integer)
register ptr_t p; /* base pointer */
word sz; /* bytes */
char * string;
word integer;
{
register word * result = (word *)((oh *)p + 1);
DCL_LOCK_STATE;
/* There is some argument that we should dissble signals here. */
/* But that's expensive. And this way things should only appear */
/* inconsistent while we're in the handler. */
LOCK();
((oh *)p) -> oh_string = string;
((oh *)p) -> oh_int = integer;
((oh *)p) -> oh_sz = sz;
((oh *)p) -> oh_sf = START_FLAG ^ (word)result;
((word *)p)[BYTES_TO_WORDS(GC_size(p))-1] =
result[ROUNDED_UP_WORDS(sz)] = END_FLAG ^ (word)result;
UNLOCK();
return((ptr_t)result);
}
/* Check the object with debugging info at p */
/* return NIL if it's OK. Else return clobbered */
/* address. */
ptr_t GC_check_annotated_obj(ohdr)
register oh * ohdr;
{
register ptr_t body = (ptr_t)(ohdr + 1);
register word gc_sz = GC_size((ptr_t)ohdr);
if (ohdr -> oh_sz + DEBUG_BYTES > gc_sz) {
return((ptr_t)(&(ohdr -> oh_sz)));
}
if (ohdr -> oh_sf != (START_FLAG ^ (word)body)) {
return((ptr_t)(&(ohdr -> oh_sf)));
}
if (((word *)ohdr)[BYTES_TO_WORDS(gc_sz)-1] != (END_FLAG ^ (word)body)) {
return((ptr_t)((word *)ohdr + BYTES_TO_WORDS(gc_sz)-1));
}
if (((word *)body)[ROUNDED_UP_WORDS(ohdr -> oh_sz)]
!= (END_FLAG ^ (word)body)) {
return((ptr_t)((word *)body + ROUNDED_UP_WORDS(ohdr -> oh_sz)));
}
return(0);
}
void GC_print_obj(p)
ptr_t p;
{
register oh * ohdr = (oh *)GC_base(p);
GC_err_printf1("0x%lx (", (unsigned long)ohdr + sizeof(oh));
GC_err_puts(ohdr -> oh_string);
GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
(unsigned long)(ohdr -> oh_sz));
PRINT_CALL_CHAIN(ohdr);
}
void GC_debug_print_heap_obj_proc(p)
ptr_t p;
{
if (GC_has_debug_info(p)) {
GC_print_obj(p);
} else {
GC_default_print_heap_obj_proc(p);
}
}
void GC_print_smashed_obj(p, clobbered_addr)
ptr_t p, clobbered_addr;
{
register oh * ohdr = (oh *)GC_base(p);
GC_err_printf2("0x%lx in object at 0x%lx(", (unsigned long)clobbered_addr,
(unsigned long)p);
if (clobbered_addr <= (ptr_t)(&(ohdr -> oh_sz))
|| ohdr -> oh_string == 0) {
GC_err_printf1("<smashed>, appr. sz = %ld)\n",
GC_size((ptr_t)ohdr) - DEBUG_BYTES);
} else {
if (ohdr -> oh_string[0] == '\0') {
GC_err_puts("EMPTY(smashed?)");
} else {
GC_err_puts(ohdr -> oh_string);
}
GC_err_printf2(":%ld, sz=%ld)\n", (unsigned long)(ohdr -> oh_int),
(unsigned long)(ohdr -> oh_sz));
PRINT_CALL_CHAIN(ohdr);
}
}
void GC_check_heap_proc();
void GC_start_debugging()
{
GC_check_heap = GC_check_heap_proc;
GC_print_heap_obj = GC_debug_print_heap_obj_proc;
GC_debugging_started = TRUE;
GC_register_displacement((word)sizeof(oh));
}
# if defined(__STDC__) || defined(__cplusplus)
void GC_debug_register_displacement(GC_word offset)
# else
void GC_debug_register_displacement(offset)
GC_word offset;
# endif
{
GC_register_displacement(offset);
GC_register_displacement((word)sizeof(oh) + offset);
}
# ifdef GC_ADD_CALLER
# define EXTRA_ARGS word ra, char * s, int i
# define OPT_RA ra,
# else
# define EXTRA_ARGS char * s, int i
# define OPT_RA
# endif
# ifdef __STDC__
GC_PTR GC_debug_malloc(size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc(lb, s, i)
size_t lb;
char * s;
int i;
# ifdef GC_ADD_CALLER
--> GC_ADD_CALLER not implemented for K&R C
# endif
# endif
{
GC_PTR result = GC_malloc(lb + DEBUG_BYTES);
if (result == 0) {
GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
# ifdef __STDC__
GC_PTR GC_debug_generic_malloc(size_t lb, int k, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc(lb, k, s, i)
size_t lb;
int k;
char * s;
int i;
# ifdef GC_ADD_CALLER
--> GC_ADD_CALLER not implemented for K&R C
# endif
# endif
{
GC_PTR result = GC_generic_malloc(lb + DEBUG_BYTES, k);
if (result == 0) {
GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
#ifdef STUBBORN_ALLOC
# ifdef __STDC__
GC_PTR GC_debug_malloc_stubborn(size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc_stubborn(lb, s, i)
size_t lb;
char * s;
int i;
# endif
{
GC_PTR result = GC_malloc_stubborn(lb + DEBUG_BYTES);
if (result == 0) {
GC_err_printf1("GC_debug_malloc(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
void GC_debug_change_stubborn(p)
GC_PTR p;
{
register GC_PTR q = GC_base(p);
register hdr * hhdr;
if (q == 0) {
GC_err_printf1("Bad argument: 0x%lx to GC_debug_change_stubborn\n",
(unsigned long) p);
ABORT("GC_debug_change_stubborn: bad arg");
}
hhdr = HDR(q);
if (hhdr -> hb_obj_kind != STUBBORN) {
GC_err_printf1("GC_debug_change_stubborn arg not stubborn: 0x%lx\n",
(unsigned long) p);
ABORT("GC_debug_change_stubborn: arg not stubborn");
}
GC_change_stubborn(q);
}
void GC_debug_end_stubborn_change(p)
GC_PTR p;
{
register GC_PTR q = GC_base(p);
register hdr * hhdr;
if (q == 0) {
GC_err_printf1("Bad argument: 0x%lx to GC_debug_end_stubborn_change\n",
(unsigned long) p);
ABORT("GC_debug_end_stubborn_change: bad arg");
}
hhdr = HDR(q);
if (hhdr -> hb_obj_kind != STUBBORN) {
GC_err_printf1("debug_end_stubborn_change arg not stubborn: 0x%lx\n",
(unsigned long) p);
ABORT("GC_debug_end_stubborn_change: arg not stubborn");
}
GC_end_stubborn_change(q);
}
#endif /* STUBBORN_ALLOC */
# ifdef __STDC__
GC_PTR GC_debug_malloc_atomic(size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc_atomic(lb, s, i)
size_t lb;
char * s;
int i;
# endif
{
GC_PTR result = GC_malloc_atomic(lb + DEBUG_BYTES);
if (result == 0) {
GC_err_printf1("GC_debug_malloc_atomic(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
# ifdef __STDC__
GC_PTR GC_debug_malloc_uncollectable(size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc_uncollectable(lb, s, i)
size_t lb;
char * s;
int i;
# endif
{
GC_PTR result = GC_malloc_uncollectable(lb + DEBUG_BYTES);
if (result == 0) {
GC_err_printf1("GC_debug_malloc_uncollectable(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
#ifdef ATOMIC_UNCOLLECTABLE
# ifdef __STDC__
GC_PTR GC_debug_malloc_atomic_uncollectable(size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_malloc_atomic_uncollectable(lb, s, i)
size_t lb;
char * s;
int i;
# endif
{
GC_PTR result = GC_malloc_atomic_uncollectable(lb + DEBUG_BYTES);
if (result == 0) {
GC_err_printf1(
"GC_debug_malloc_atomic_uncollectable(%ld) returning NIL (",
(unsigned long) lb);
GC_err_puts(s);
GC_err_printf1(":%ld)\n", (unsigned long)i);
return(0);
}
if (!GC_debugging_started) {
GC_start_debugging();
}
ADD_CALL_CHAIN(result, ra);
return (GC_store_debug_info(result, (word)lb, s, (word)i));
}
#endif /* ATOMIC_UNCOLLECTABLE */
# ifdef __STDC__
void GC_debug_free(GC_PTR p)
# else
void GC_debug_free(p)
GC_PTR p;
# endif
{
register GC_PTR base = GC_base(p);
register ptr_t clobbered;
if (base == 0) {
GC_err_printf1("Attempt to free invalid pointer %lx\n",
(unsigned long)p);
if (p != 0) ABORT("free(invalid pointer)");
}
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
GC_err_printf1(
"GC_debug_free called on pointer %lx wo debugging info\n",
(unsigned long)p);
} else {
clobbered = GC_check_annotated_obj((oh *)base);
if (clobbered != 0) {
if (((oh *)base) -> oh_sz == GC_size(base)) {
GC_err_printf0(
"GC_debug_free: found previously deallocated (?) object at ");
} else {
GC_err_printf0("GC_debug_free: found smashed object at ");
}
GC_print_smashed_obj(p, clobbered);
}
/* Invalidate size */
((oh *)base) -> oh_sz = GC_size(base);
}
# ifdef FIND_LEAK
GC_free(base);
# else
{
register hdr * hhdr = HDR(p);
GC_bool uncollectable = FALSE;
if (hhdr -> hb_obj_kind == UNCOLLECTABLE) {
uncollectable = TRUE;
}
# ifdef ATOMIC_UNCOLLECTABLE
if (hhdr -> hb_obj_kind == AUNCOLLECTABLE) {
uncollectable = TRUE;
}
# endif
if (uncollectable) GC_free(base);
}
# endif
}
# ifdef __STDC__
GC_PTR GC_debug_realloc(GC_PTR p, size_t lb, EXTRA_ARGS)
# else
GC_PTR GC_debug_realloc(p, lb, s, i)
GC_PTR p;
size_t lb;
char *s;
int i;
# endif
{
register GC_PTR base = GC_base(p);
register ptr_t clobbered;
register GC_PTR result;
register size_t copy_sz = lb;
register size_t old_sz;
register hdr * hhdr;
if (p == 0) return(GC_debug_malloc(lb, OPT_RA s, i));
if (base == 0) {
GC_err_printf1(
"Attempt to reallocate invalid pointer %lx\n", (unsigned long)p);
ABORT("realloc(invalid pointer)");
}
if ((ptr_t)p - (ptr_t)base != sizeof(oh)) {
GC_err_printf1(
"GC_debug_realloc called on pointer %lx wo debugging info\n",
(unsigned long)p);
return(GC_realloc(p, lb));
}
hhdr = HDR(base);
switch (hhdr -> hb_obj_kind) {
# ifdef STUBBORN_ALLOC
case STUBBORN:
result = GC_debug_malloc_stubborn(lb, OPT_RA s, i);
break;
# endif
case NORMAL:
result = GC_debug_malloc(lb, OPT_RA s, i);
break;
case PTRFREE:
result = GC_debug_malloc_atomic(lb, OPT_RA s, i);
break;
case UNCOLLECTABLE:
result = GC_debug_malloc_uncollectable(lb, OPT_RA s, i);
break;
# ifdef ATOMIC_UNCOLLECTABLE
case AUNCOLLECTABLE:
result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i);
break;
# endif
default:
GC_err_printf0("GC_debug_realloc: encountered bad kind\n");
ABORT("bad kind");
}
clobbered = GC_check_annotated_obj((oh *)base);
if (clobbered != 0) {
GC_err_printf0("GC_debug_realloc: found smashed object at ");
GC_print_smashed_obj(p, clobbered);
}
old_sz = ((oh *)base) -> oh_sz;
if (old_sz < copy_sz) copy_sz = old_sz;
if (result == 0) return(0);
BCOPY(p, result, copy_sz);
GC_debug_free(p);
return(result);
}
/* Check all marked objects in the given block for validity */
/*ARGSUSED*/
void GC_check_heap_block(hbp, dummy)
register struct hblk *hbp; /* ptr to current heap block */
word dummy;
{
register struct hblkhdr * hhdr = HDR(hbp);
register word sz = hhdr -> hb_sz;
register int word_no;
register word *p, *plim;
p = (word *)(hbp->hb_body);
word_no = HDR_WORDS;
if (sz > MAXOBJSZ) {
plim = p;
} else {
plim = (word *)((((word)hbp) + HBLKSIZE) - WORDS_TO_BYTES(sz));
}
/* go through all words in block */
while( p <= plim ) {
if( mark_bit_from_hdr(hhdr, word_no)
&& GC_has_debug_info((ptr_t)p)) {
ptr_t clobbered = GC_check_annotated_obj((oh *)p);
if (clobbered != 0) {
GC_err_printf0(
"GC_check_heap_block: found smashed object at ");
GC_print_smashed_obj((ptr_t)p, clobbered);
}
}
word_no += sz;
p += sz;
}
}
/* This assumes that all accessible objects are marked, and that */
/* I hold the allocation lock. Normally called by collector. */
void GC_check_heap_proc()
{
# ifndef SMALL_CONFIG
if (sizeof(oh) & (2 * sizeof(word) - 1) != 0) {
ABORT("Alignment problem: object header has inappropriate size\n");
}
# endif
GC_apply_to_all_blocks(GC_check_heap_block, (word)0);
}
struct closure {
GC_finalization_proc cl_fn;
GC_PTR cl_data;
};
# ifdef __STDC__
void * GC_make_closure(GC_finalization_proc fn, void * data)
# else
GC_PTR GC_make_closure(fn, data)
GC_finalization_proc fn;
GC_PTR data;
# endif
{
struct closure * result =
(struct closure *) GC_malloc(sizeof (struct closure));
result -> cl_fn = fn;
result -> cl_data = data;
return((GC_PTR)result);
}
# ifdef __STDC__
void GC_debug_invoke_finalizer(void * obj, void * data)
# else
void GC_debug_invoke_finalizer(obj, data)
char * obj;
char * data;
# endif
{
register struct closure * cl = (struct closure *) data;
(*(cl -> cl_fn))((GC_PTR)((char *)obj + sizeof(oh)), cl -> cl_data);
}
# ifdef __STDC__
void GC_debug_register_finalizer(GC_PTR obj, GC_finalization_proc fn,
GC_PTR cd, GC_finalization_proc *ofn,
GC_PTR *ocd)
# else
void GC_debug_register_finalizer(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc *ofn;
GC_PTR *ocd;
# endif
{
ptr_t base = GC_base(obj);
if (0 == base || (ptr_t)obj - base != sizeof(oh)) {
GC_err_printf1(
"GC_register_finalizer called with non-base-pointer 0x%lx\n",
obj);
}
GC_register_finalizer(base, GC_debug_invoke_finalizer,
GC_make_closure(fn,cd), ofn, ocd);
}
# ifdef __STDC__
void GC_debug_register_finalizer_ignore_self
(GC_PTR obj, GC_finalization_proc fn,
GC_PTR cd, GC_finalization_proc *ofn,
GC_PTR *ocd)
# else
void GC_debug_register_finalizer_ignore_self
(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc *ofn;
GC_PTR *ocd;
# endif
{
ptr_t base = GC_base(obj);
if (0 == base || (ptr_t)obj - base != sizeof(oh)) {
GC_err_printf1(
"GC_register_finalizer_ignore_self called with non-base-pointer 0x%lx\n",
obj);
}
GC_register_finalizer_ignore_self(base, GC_debug_invoke_finalizer,
GC_make_closure(fn,cd), ofn, ocd);
}
# ifdef __STDC__
void GC_debug_register_finalizer_no_order
(GC_PTR obj, GC_finalization_proc fn,
GC_PTR cd, GC_finalization_proc *ofn,
GC_PTR *ocd)
# else
void GC_debug_register_finalizer_no_order
(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc *ofn;
GC_PTR *ocd;
# endif
{
ptr_t base = GC_base(obj);
if (0 == base || (ptr_t)obj - base != sizeof(oh)) {
GC_err_printf1(
"GC_register_finalizer_no_order called with non-base-pointer 0x%lx\n",
obj);
}
GC_register_finalizer_no_order(base, GC_debug_invoke_finalizer,
GC_make_closure(fn,cd), ofn, ocd);
}

View File

@ -1,797 +0,0 @@
/*
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1997 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Original author: Bill Janssen
* Heavily modified by Hans Boehm and others
*/
/*
* This is incredibly OS specific code for tracking down data sections in
* dynamic libraries. There appears to be no way of doing this quickly
* without groveling through undocumented data structures. We would argue
* that this is a bug in the design of the dlopen interface. THIS CODE
* MAY BREAK IN FUTURE OS RELEASES. If this matters to you, don't hesitate
* to let your vendor know ...
*
* None of this is safe with dlclose and incremental collection.
* But then not much of anything is safe in the presence of dlclose.
*/
#ifndef MACOS
# include <sys/types.h>
#endif
#include "gc_priv.h"
/* BTL: avoid circular redefinition of dlopen if SOLARIS_THREADS defined */
# if defined(SOLARIS_THREADS) && defined(dlopen)
/* To support threads in Solaris, gc.h interposes on dlopen by */
/* defining "dlopen" to be "GC_dlopen", which is implemented below. */
/* However, both GC_FirstDLOpenedLinkMap() and GC_dlopen() use the */
/* real system dlopen() in their implementation. We first remove */
/* gc.h's dlopen definition and restore it later, after GC_dlopen(). */
# undef dlopen
# define GC_must_restore_redefined_dlopen
# else
# undef GC_must_restore_redefined_dlopen
# endif
#if (defined(DYNAMIC_LOADING) || defined(MSWIN32)) && !defined(PCR)
#if !defined(SUNOS4) && !defined(SUNOS5DL) && !defined(IRIX5) && \
!defined(MSWIN32) && !(defined(ALPHA) && defined(OSF1)) && \
!defined(HP_PA) && (!defined(LINUX) && !defined(__ELF__)) && \
!defined(RS6000) && !defined(SCO_ELF)
--> We only know how to find data segments of dynamic libraries for the
--> above. Additional SVR4 variants might not be too
--> hard to add.
#endif
#include <stdio.h>
#ifdef SUNOS5DL
# include <sys/elf.h>
# include <dlfcn.h>
# include <link.h>
#endif
#ifdef SUNOS4
# include <dlfcn.h>
# include <link.h>
# include <a.out.h>
/* struct link_map field overrides */
# define l_next lm_next
# define l_addr lm_addr
# define l_name lm_name
#endif
#if defined(SUNOS5DL) && !defined(USE_PROC_FOR_LIBRARIES)
#ifdef LINT
Elf32_Dyn _DYNAMIC;
#endif
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
extern Elf32_Dyn _DYNAMIC;
Elf32_Dyn *dp;
struct r_debug *r;
static struct link_map * cachedResult = 0;
static Elf32_Dyn *dynStructureAddr = 0;
/* BTL: added to avoid Solaris 5.3 ld.so _DYNAMIC bug */
# ifdef SUNOS53_SHARED_LIB
/* BTL: Avoid the Solaris 5.3 bug that _DYNAMIC isn't being set */
/* up properly in dynamically linked .so's. This means we have */
/* to use its value in the set of original object files loaded */
/* at program startup. */
if( dynStructureAddr == 0 ) {
void* startupSyms = dlopen(0, RTLD_LAZY);
dynStructureAddr = (Elf32_Dyn*)dlsym(startupSyms, "_DYNAMIC");
}
# else
dynStructureAddr = &_DYNAMIC;
# endif
if( dynStructureAddr == 0) {
return(0);
}
if( cachedResult == 0 ) {
int tag;
for( dp = ((Elf32_Dyn *)(&_DYNAMIC)); (tag = dp->d_tag) != 0; dp++ ) {
if( tag == DT_DEBUG ) {
struct link_map *lm
= ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
if( lm != 0 ) cachedResult = lm->l_next; /* might be NIL */
break;
}
}
}
return cachedResult;
}
#endif /* SUNOS5DL ... */
#if defined(SUNOS4) && !defined(USE_PROC_FOR_LIBRARIES)
#ifdef LINT
struct link_dynamic _DYNAMIC;
#endif
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
extern struct link_dynamic _DYNAMIC;
if( &_DYNAMIC == 0) {
return(0);
}
return(_DYNAMIC.ld_un.ld_1->ld_loaded);
}
/* Return the address of the ld.so allocated common symbol */
/* with the least address, or 0 if none. */
static ptr_t GC_first_common()
{
ptr_t result = 0;
extern struct link_dynamic _DYNAMIC;
struct rtc_symb * curr_symbol;
if( &_DYNAMIC == 0) {
return(0);
}
curr_symbol = _DYNAMIC.ldd -> ldd_cp;
for (; curr_symbol != 0; curr_symbol = curr_symbol -> rtc_next) {
if (result == 0
|| (ptr_t)(curr_symbol -> rtc_sp -> n_value) < result) {
result = (ptr_t)(curr_symbol -> rtc_sp -> n_value);
}
}
return(result);
}
#endif /* SUNOS4 ... */
# if defined(SUNOS4) || defined(SUNOS5DL)
/* Add dynamic library data sections to the root set. */
# if !defined(PCR) && !defined(SOLARIS_THREADS) \
&& !defined(QUICK_THREADS) && defined(THREADS)
# ifndef SRC_M3
--> fix mutual exclusion with dlopen
# endif /* We assume M3 programs don't call dlopen for now */
# endif
# ifdef SOLARIS_THREADS
/* Redefine dlopen to guarantee mutual exclusion with */
/* GC_register_dynamic_libraries. */
/* assumes that dlopen doesn't need to call GC_malloc */
/* and friends. */
# include <thread.h>
# include <synch.h>
void * GC_dlopen(const char *path, int mode)
{
void * result;
# ifndef USE_PROC_FOR_LIBRARIES
mutex_lock(&GC_allocate_ml);
# endif
result = dlopen(path, mode);
# ifndef USE_PROC_FOR_LIBRARIES
mutex_unlock(&GC_allocate_ml);
# endif
return(result);
}
# endif /* SOLARIS_THREADS */
/* BTL: added to fix circular dlopen definition if SOLARIS_THREADS defined */
# if defined(GC_must_restore_redefined_dlopen)
# define dlopen GC_dlopen
# endif
# ifndef USE_PROC_FOR_LIBRARIES
void GC_register_dynamic_libraries()
{
struct link_map *lm = GC_FirstDLOpenedLinkMap();
for (lm = GC_FirstDLOpenedLinkMap();
lm != (struct link_map *) 0; lm = lm->l_next)
{
# ifdef SUNOS4
struct exec *e;
e = (struct exec *) lm->lm_addr;
GC_add_roots_inner(
((char *) (N_DATOFF(*e) + lm->lm_addr)),
((char *) (N_BSSADDR(*e) + e->a_bss + lm->lm_addr)),
TRUE);
# endif
# ifdef SUNOS5DL
Elf32_Ehdr * e;
Elf32_Phdr * p;
unsigned long offset;
char * start;
register int i;
e = (Elf32_Ehdr *) lm->l_addr;
p = ((Elf32_Phdr *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
case PT_LOAD:
{
if( !(p->p_flags & PF_W) ) break;
start = ((char *)(p->p_vaddr)) + offset;
GC_add_roots_inner(
start,
start + p->p_memsz,
TRUE
);
}
break;
default:
break;
}
}
# endif
}
# ifdef SUNOS4
{
static ptr_t common_start = 0;
ptr_t common_end;
extern ptr_t GC_find_limit();
if (common_start == 0) common_start = GC_first_common();
if (common_start != 0) {
common_end = GC_find_limit(common_start, TRUE);
GC_add_roots_inner((char *)common_start, (char *)common_end, TRUE);
}
}
# endif
}
# endif /* !USE_PROC ... */
# endif /* SUNOS */
#if defined(LINUX) && defined(__ELF__) || defined(SCO_ELF)
/* Dynamic loading code for Linux running ELF. Somewhat tested on
* Linux/x86, untested but hopefully should work on Linux/Alpha.
* This code was derived from the Solaris/ELF support. Thanks to
* whatever kind soul wrote that. - Patrick Bridges */
#include <elf.h>
#include <link.h>
/* Newer versions of Linux/Alpha and Linux/x86 define this macro. We
* define it for those older versions that don't. */
# ifndef ElfW
# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32
# define ElfW(type) Elf32_##type
# else
# define ElfW(type) Elf64_##type
# endif
# endif
static struct link_map *
GC_FirstDLOpenedLinkMap()
{
#ifdef __GNUC__
/* On some Linux systems, `_DYNAMIC' will not be defined when a
static link is done. */
# pragma weak _DYNAMIC
#endif
extern ElfW(Dyn) _DYNAMIC[];
ElfW(Dyn) *dp;
struct r_debug *r;
static struct link_map *cachedResult = 0;
if( _DYNAMIC == 0) {
return(0);
}
if( cachedResult == 0 ) {
int tag;
for( dp = _DYNAMIC; (tag = dp->d_tag) != 0; dp++ ) {
if( tag == DT_DEBUG ) {
struct link_map *lm
= ((struct r_debug *)(dp->d_un.d_ptr))->r_map;
if( lm != 0 ) cachedResult = lm->l_next; /* might be NIL */
break;
}
}
}
return cachedResult;
}
void GC_register_dynamic_libraries()
{
struct link_map *lm = GC_FirstDLOpenedLinkMap();
for (lm = GC_FirstDLOpenedLinkMap();
lm != (struct link_map *) 0; lm = lm->l_next)
{
ElfW(Ehdr) * e;
ElfW(Phdr) * p;
unsigned long offset;
char * start;
register int i;
e = (ElfW(Ehdr) *) lm->l_addr;
p = ((ElfW(Phdr) *)(((char *)(e)) + e->e_phoff));
offset = ((unsigned long)(lm->l_addr));
for( i = 0; i < (int)(e->e_phnum); ((i++),(p++)) ) {
switch( p->p_type ) {
case PT_LOAD:
{
if( !(p->p_flags & PF_W) ) break;
start = ((char *)(p->p_vaddr)) + offset;
GC_add_roots_inner(start, start + p->p_memsz, TRUE);
}
break;
default:
break;
}
}
}
}
#endif
#if defined(IRIX5) || defined(USE_PROC_FOR_LIBRARIES)
#include <sys/procfs.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <elf.h>
#include <errno.h>
extern void * GC_roots_present();
extern ptr_t GC_scratch_last_end_ptr; /* End of GC_scratch_alloc arena */
/* We use /proc to track down all parts of the address space that are */
/* mapped by the process, and throw out regions we know we shouldn't */
/* worry about. This may also work under other SVR4 variants. */
void GC_register_dynamic_libraries()
{
static int fd = -1;
char buf[30];
static prmap_t * addr_map = 0;
static int current_sz = 0; /* Number of records currently in addr_map */
static int needed_sz; /* Required size of addr_map */
register int i;
register long flags;
register ptr_t start;
register ptr_t limit;
ptr_t heap_start = (ptr_t)HEAP_START;
ptr_t heap_end = heap_start;
# ifdef SUNOS5DL
# define MA_PHYS 0
# endif /* SUNOS5DL */
if (fd < 0) {
sprintf(buf, "/proc/%d", getpid());
fd = open(buf, O_RDONLY);
if (fd < 0) {
ABORT("/proc open failed");
}
}
if (ioctl(fd, PIOCNMAP, &needed_sz) < 0) {
GC_err_printf2("fd = %d, errno = %d\n", fd, errno);
ABORT("/proc PIOCNMAP ioctl failed");
}
if (needed_sz >= current_sz) {
current_sz = needed_sz * 2 + 1;
/* Expansion, plus room for 0 record */
addr_map = (prmap_t *)GC_scratch_alloc(current_sz * sizeof(prmap_t));
}
if (ioctl(fd, PIOCMAP, addr_map) < 0) {
GC_err_printf4("fd = %d, errno = %d, needed_sz = %d, addr_map = 0x%X\n",
fd, errno, needed_sz, addr_map);
ABORT("/proc PIOCMAP ioctl failed");
};
if (GC_n_heap_sects > 0) {
heap_end = GC_heap_sects[GC_n_heap_sects-1].hs_start
+ GC_heap_sects[GC_n_heap_sects-1].hs_bytes;
if (heap_end < GC_scratch_last_end_ptr) heap_end = GC_scratch_last_end_ptr;
}
for (i = 0; i < needed_sz; i++) {
flags = addr_map[i].pr_mflags;
if ((flags & (MA_BREAK | MA_STACK | MA_PHYS)) != 0) goto irrelevant;
if ((flags & (MA_READ | MA_WRITE)) != (MA_READ | MA_WRITE))
goto irrelevant;
/* The latter test is empirically useless. Other than the */
/* main data and stack segments, everything appears to be */
/* mapped readable, writable, executable, and shared(!!). */
/* This makes no sense to me. - HB */
start = (ptr_t)(addr_map[i].pr_vaddr);
if (GC_roots_present(start)) goto irrelevant;
if (start < heap_end && start >= heap_start)
goto irrelevant;
# ifdef MMAP_STACKS
if (GC_is_thread_stack(start)) goto irrelevant;
# endif /* MMAP_STACKS */
limit = start + addr_map[i].pr_size;
if (addr_map[i].pr_off == 0 && strncmp(start, ELFMAG, 4) == 0) {
/* Discard text segments, i.e. 0-offset mappings against */
/* executable files which appear to have ELF headers. */
caddr_t arg;
int obj;
# define MAP_IRR_SZ 10
static ptr_t map_irr[MAP_IRR_SZ];
/* Known irrelevant map entries */
static int n_irr = 0;
struct stat buf;
register int i;
for (i = 0; i < n_irr; i++) {
if (map_irr[i] == start) goto irrelevant;
}
arg = (caddr_t)start;
obj = ioctl(fd, PIOCOPENM, &arg);
if (obj >= 0) {
fstat(obj, &buf);
close(obj);
if ((buf.st_mode & 0111) != 0) {
if (n_irr < MAP_IRR_SZ) {
map_irr[n_irr++] = start;
}
goto irrelevant;
}
}
}
GC_add_roots_inner(start, limit, TRUE);
irrelevant: ;
}
/* Dont keep cached descriptor, for now. Some kernels don't like us */
/* to keep a /proc file descriptor around during kill -9. */
if (close(fd) < 0) ABORT("Couldnt close /proc file");
fd = -1;
}
# endif /* USE_PROC || IRIX5 */
# ifdef MSWIN32
# define WIN32_LEAN_AND_MEAN
# define NOSERVICE
# include <windows.h>
# include <stdlib.h>
/* We traverse the entire address space and register all segments */
/* that could possibly have been written to. */
DWORD GC_allocation_granularity;
extern GC_bool GC_is_heap_base (ptr_t p);
# ifdef WIN32_THREADS
extern void GC_get_next_stack(char *start, char **lo, char **hi);
# endif
void GC_cond_add_roots(char *base, char * limit)
{
char dummy;
char * stack_top
= (char *) ((word)(&dummy) & ~(GC_allocation_granularity-1));
if (base == limit) return;
# ifdef WIN32_THREADS
{
char * curr_base = base;
char * next_stack_lo;
char * next_stack_hi;
for(;;) {
GC_get_next_stack(curr_base, &next_stack_lo, &next_stack_hi);
if (next_stack_lo >= limit) break;
GC_add_roots_inner(curr_base, next_stack_lo, TRUE);
curr_base = next_stack_hi;
}
if (curr_base < limit) GC_add_roots_inner(curr_base, limit, TRUE);
}
# else
if (limit > stack_top && base < GC_stackbottom) {
/* Part of the stack; ignore it. */
return;
}
GC_add_roots_inner(base, limit, TRUE);
# endif
}
extern GC_bool GC_win32s;
void GC_register_dynamic_libraries()
{
MEMORY_BASIC_INFORMATION buf;
SYSTEM_INFO sysinfo;
DWORD result;
DWORD protect;
LPVOID p;
char * base;
char * limit, * new_limit;
if (GC_win32s) return;
GetSystemInfo(&sysinfo);
base = limit = p = sysinfo.lpMinimumApplicationAddress;
GC_allocation_granularity = sysinfo.dwAllocationGranularity;
while (p < sysinfo.lpMaximumApplicationAddress) {
result = VirtualQuery(p, &buf, sizeof(buf));
if (result != sizeof(buf)) {
ABORT("Weird VirtualQuery result");
}
new_limit = (char *)p + buf.RegionSize;
protect = buf.Protect;
if (buf.State == MEM_COMMIT
&& (protect == PAGE_EXECUTE_READWRITE
|| protect == PAGE_READWRITE)
&& !GC_is_heap_base(buf.AllocationBase)) {
if ((char *)p == limit) {
limit = new_limit;
} else {
GC_cond_add_roots(base, limit);
base = p;
limit = new_limit;
}
}
if (p > (LPVOID)new_limit /* overflow */) break;
p = (LPVOID)new_limit;
}
GC_cond_add_roots(base, limit);
}
#endif /* MSWIN32 */
#if defined(ALPHA) && defined(OSF1)
#include <loader.h>
void GC_register_dynamic_libraries()
{
int status;
ldr_process_t mypid;
/* module */
ldr_module_t moduleid = LDR_NULL_MODULE;
ldr_module_info_t moduleinfo;
size_t moduleinfosize = sizeof(moduleinfo);
size_t modulereturnsize;
/* region */
ldr_region_t region;
ldr_region_info_t regioninfo;
size_t regioninfosize = sizeof(regioninfo);
size_t regionreturnsize;
/* Obtain id of this process */
mypid = ldr_my_process();
/* For each module */
while (TRUE) {
/* Get the next (first) module */
status = ldr_next_module(mypid, &moduleid);
/* Any more modules? */
if (moduleid == LDR_NULL_MODULE)
break; /* No more modules */
/* Check status AFTER checking moduleid because */
/* of a bug in the non-shared ldr_next_module stub */
if (status != 0 ) {
GC_printf1("dynamic_load: status = %ld\n", (long)status);
{
extern char *sys_errlist[];
extern int sys_nerr;
extern int errno;
if (errno <= sys_nerr) {
GC_printf1("dynamic_load: %s\n", (long)sys_errlist[errno]);
} else {
GC_printf1("dynamic_load: %d\n", (long)errno);
}
}
ABORT("ldr_next_module failed");
}
/* Get the module information */
status = ldr_inq_module(mypid, moduleid, &moduleinfo,
moduleinfosize, &modulereturnsize);
if (status != 0 )
ABORT("ldr_inq_module failed");
/* is module for the main program (i.e. nonshared portion)? */
if (moduleinfo.lmi_flags & LDR_MAIN)
continue; /* skip the main module */
# ifdef VERBOSE
GC_printf("---Module---\n");
GC_printf("Module ID = %16ld\n", moduleinfo.lmi_modid);
GC_printf("Count of regions = %16d\n", moduleinfo.lmi_nregion);
GC_printf("flags for module = %16lx\n", moduleinfo.lmi_flags);
GC_printf("pathname of module = \"%s\"\n", moduleinfo.lmi_name);
# endif
/* For each region in this module */
for (region = 0; region < moduleinfo.lmi_nregion; region++) {
/* Get the region information */
status = ldr_inq_region(mypid, moduleid, region, &regioninfo,
regioninfosize, &regionreturnsize);
if (status != 0 )
ABORT("ldr_inq_region failed");
/* only process writable (data) regions */
if (! (regioninfo.lri_prot & LDR_W))
continue;
# ifdef VERBOSE
GC_printf("--- Region ---\n");
GC_printf("Region number = %16ld\n",
regioninfo.lri_region_no);
GC_printf("Protection flags = %016x\n", regioninfo.lri_prot);
GC_printf("Virtual address = %16p\n", regioninfo.lri_vaddr);
GC_printf("Mapped address = %16p\n", regioninfo.lri_mapaddr);
GC_printf("Region size = %16ld\n", regioninfo.lri_size);
GC_printf("Region name = \"%s\"\n", regioninfo.lri_name);
# endif
/* register region as a garbage collection root */
GC_add_roots_inner (
(char *)regioninfo.lri_mapaddr,
(char *)regioninfo.lri_mapaddr + regioninfo.lri_size,
TRUE);
}
}
}
#endif
#if defined(HP_PA)
#include <errno.h>
#include <dl.h>
extern int errno;
extern char *sys_errlist[];
extern int sys_nerr;
void GC_register_dynamic_libraries()
{
int status;
int index = 1; /* Ordinal position in shared library search list */
struct shl_descriptor *shl_desc; /* Shared library info, see dl.h */
/* For each dynamic library loaded */
while (TRUE) {
/* Get info about next shared library */
status = shl_get(index, &shl_desc);
/* Check if this is the end of the list or if some error occured */
if (status != 0) {
if (errno == EINVAL) {
break; /* Moved past end of shared library list --> finished */
} else {
if (errno <= sys_nerr) {
GC_printf1("dynamic_load: %s\n", (long) sys_errlist[errno]);
} else {
GC_printf1("dynamic_load: %d\n", (long) errno);
}
ABORT("shl_get failed");
}
}
# ifdef VERBOSE
GC_printf0("---Shared library---\n");
GC_printf1("\tfilename = \"%s\"\n", shl_desc->filename);
GC_printf1("\tindex = %d\n", index);
GC_printf1("\thandle = %08x\n",
(unsigned long) shl_desc->handle);
GC_printf1("\ttext seg. start = %08x\n", shl_desc->tstart);
GC_printf1("\ttext seg. end = %08x\n", shl_desc->tend);
GC_printf1("\tdata seg. start = %08x\n", shl_desc->dstart);
GC_printf1("\tdata seg. end = %08x\n", shl_desc->dend);
GC_printf1("\tref. count = %lu\n", shl_desc->ref_count);
# endif
/* register shared library's data segment as a garbage collection root */
GC_add_roots_inner((char *) shl_desc->dstart,
(char *) shl_desc->dend, TRUE);
index++;
}
}
#endif /* HP_PA */
#ifdef RS6000
#pragma alloca
#include <sys/ldr.h>
#include <sys/errno.h>
void GC_register_dynamic_libraries()
{
int len;
char *ldibuf;
int ldibuflen;
struct ld_info *ldi;
ldibuf = alloca(ldibuflen = 8192);
while ( (len = loadquery(L_GETINFO,ldibuf,ldibuflen)) < 0) {
if (errno != ENOMEM) {
ABORT("loadquery failed");
}
ldibuf = alloca(ldibuflen *= 2);
}
ldi = (struct ld_info *)ldibuf;
while (ldi) {
len = ldi->ldinfo_next;
GC_add_roots_inner(
ldi->ldinfo_dataorg,
(unsigned long)ldi->ldinfo_dataorg
+ ldi->ldinfo_datasize,
TRUE);
ldi = len ? (struct ld_info *)((char *)ldi + len) : 0;
}
}
#endif /* RS6000 */
#else /* !DYNAMIC_LOADING */
#ifdef PCR
# include "il/PCR_IL.h"
# include "th/PCR_ThCtl.h"
# include "mm/PCR_MM.h"
void GC_register_dynamic_libraries()
{
/* Add new static data areas of dynamically loaded modules. */
{
PCR_IL_LoadedFile * p = PCR_IL_GetLastLoadedFile();
PCR_IL_LoadedSegment * q;
/* Skip uncommited files */
while (p != NIL && !(p -> lf_commitPoint)) {
/* The loading of this file has not yet been committed */
/* Hence its description could be inconsistent. */
/* Furthermore, it hasn't yet been run. Hence its data */
/* segments can't possibly reference heap allocated */
/* objects. */
p = p -> lf_prev;
}
for (; p != NIL; p = p -> lf_prev) {
for (q = p -> lf_ls; q != NIL; q = q -> ls_next) {
if ((q -> ls_flags & PCR_IL_SegFlags_Traced_MASK)
== PCR_IL_SegFlags_Traced_on) {
GC_add_roots_inner
((char *)(q -> ls_addr),
(char *)(q -> ls_addr) + q -> ls_bytes,
TRUE);
}
}
}
}
}
#else /* !PCR */
void GC_register_dynamic_libraries(){}
int GC_no_dynamic_loading;
#endif /* !PCR */
#endif /* !DYNAMIC_LOADING */

View File

@ -1,734 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, February 1, 1996 1:19 pm PST */
# define I_HIDE_POINTERS
# include "gc_priv.h"
# include "gc_mark.h"
/* Type of mark procedure used for marking from finalizable object. */
/* This procedure normally does not mark the object, only its */
/* descendents. */
typedef void finalization_mark_proc(/* ptr_t finalizable_obj_ptr */);
# define HASH3(addr,size,log_size) \
((((word)(addr) >> 3) ^ ((word)(addr) >> (3+(log_size)))) \
& ((size) - 1))
#define HASH2(addr,log_size) HASH3(addr, 1 << log_size, log_size)
struct hash_chain_entry {
word hidden_key;
struct hash_chain_entry * next;
};
unsigned GC_finalization_failures = 0;
/* Number of finalization requests that failed for lack of memory. */
static struct disappearing_link {
struct hash_chain_entry prolog;
# define dl_hidden_link prolog.hidden_key
/* Field to be cleared. */
# define dl_next(x) (struct disappearing_link *)((x) -> prolog.next)
# define dl_set_next(x,y) (x) -> prolog.next = (struct hash_chain_entry *)(y)
word dl_hidden_obj; /* Pointer to object base */
} **dl_head = 0;
static signed_word log_dl_table_size = -1;
/* Binary log of */
/* current size of array pointed to by dl_head. */
/* -1 ==> size is 0. */
word GC_dl_entries = 0; /* Number of entries currently in disappearing */
/* link table. */
static struct finalizable_object {
struct hash_chain_entry prolog;
# define fo_hidden_base prolog.hidden_key
/* Pointer to object base. */
/* No longer hidden once object */
/* is on finalize_now queue. */
# define fo_next(x) (struct finalizable_object *)((x) -> prolog.next)
# define fo_set_next(x,y) (x) -> prolog.next = (struct hash_chain_entry *)(y)
GC_finalization_proc fo_fn; /* Finalizer. */
ptr_t fo_client_data;
word fo_object_size; /* In bytes. */
finalization_mark_proc * fo_mark_proc; /* Mark-through procedure */
} **fo_head = 0;
struct finalizable_object * GC_finalize_now = 0;
/* LIst of objects that should be finalized now. */
static signed_word log_fo_table_size = -1;
word GC_fo_entries = 0;
# ifdef SRC_M3
void GC_push_finalizer_structures()
{
GC_push_all((ptr_t)(&dl_head), (ptr_t)(&dl_head) + sizeof(word));
GC_push_all((ptr_t)(&fo_head), (ptr_t)(&fo_head) + sizeof(word));
}
# endif
/* Double the size of a hash table. *size_ptr is the log of its current */
/* size. May be a noop. */
/* *table is a pointer to an array of hash headers. If we succeed, we */
/* update both *table and *log_size_ptr. */
/* Lock is held. Signals are disabled. */
void GC_grow_table(table, log_size_ptr)
struct hash_chain_entry ***table;
signed_word * log_size_ptr;
{
register word i;
register struct hash_chain_entry *p;
int log_old_size = *log_size_ptr;
register int log_new_size = log_old_size + 1;
word old_size = ((log_old_size == -1)? 0: (1 << log_old_size));
register word new_size = 1 << log_new_size;
struct hash_chain_entry **new_table = (struct hash_chain_entry **)
GC_generic_malloc_inner_ignore_off_page(
(size_t)new_size * sizeof(struct hash_chain_entry *), NORMAL);
if (new_table == 0) {
if (table == 0) {
ABORT("Insufficient space for initial table allocation");
} else {
return;
}
}
for (i = 0; i < old_size; i++) {
p = (*table)[i];
while (p != 0) {
register ptr_t real_key = (ptr_t)REVEAL_POINTER(p -> hidden_key);
register struct hash_chain_entry *next = p -> next;
register int new_hash = HASH3(real_key, new_size, log_new_size);
p -> next = new_table[new_hash];
new_table[new_hash] = p;
p = next;
}
}
*log_size_ptr = log_new_size;
*table = new_table;
}
# if defined(__STDC__) || defined(__cplusplus)
int GC_register_disappearing_link(GC_PTR * link)
# else
int GC_register_disappearing_link(link)
GC_PTR * link;
# endif
{
ptr_t base;
base = (ptr_t)GC_base((GC_PTR)link);
if (base == 0)
ABORT("Bad arg to GC_register_disappearing_link");
return(GC_general_register_disappearing_link(link, base));
}
# if defined(__STDC__) || defined(__cplusplus)
int GC_general_register_disappearing_link(GC_PTR * link,
GC_PTR obj)
# else
int GC_general_register_disappearing_link(link, obj)
GC_PTR * link;
GC_PTR obj;
# endif
{
struct disappearing_link *curr_dl;
int index;
struct disappearing_link * new_dl;
DCL_LOCK_STATE;
if ((word)link & (ALIGNMENT-1))
ABORT("Bad arg to GC_general_register_disappearing_link");
# ifdef THREADS
DISABLE_SIGNALS();
LOCK();
# endif
if (log_dl_table_size == -1
|| GC_dl_entries > ((word)1 << log_dl_table_size)) {
# ifndef THREADS
DISABLE_SIGNALS();
# endif
GC_grow_table((struct hash_chain_entry ***)(&dl_head),
&log_dl_table_size);
# ifdef PRINTSTATS
GC_printf1("Grew dl table to %lu entries\n",
(unsigned long)(1 << log_dl_table_size));
# endif
# ifndef THREADS
ENABLE_SIGNALS();
# endif
}
index = HASH2(link, log_dl_table_size);
curr_dl = dl_head[index];
for (curr_dl = dl_head[index]; curr_dl != 0; curr_dl = dl_next(curr_dl)) {
if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) {
curr_dl -> dl_hidden_obj = HIDE_POINTER(obj);
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
# endif
return(1);
}
}
# ifdef THREADS
new_dl = (struct disappearing_link *)
GC_generic_malloc_inner(sizeof(struct disappearing_link),NORMAL);
# else
new_dl = (struct disappearing_link *)
GC_malloc(sizeof(struct disappearing_link));
# endif
if (new_dl != 0) {
new_dl -> dl_hidden_obj = HIDE_POINTER(obj);
new_dl -> dl_hidden_link = HIDE_POINTER(link);
dl_set_next(new_dl, dl_head[index]);
dl_head[index] = new_dl;
GC_dl_entries++;
} else {
GC_finalization_failures++;
}
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
# endif
return(0);
}
# if defined(__STDC__) || defined(__cplusplus)
int GC_unregister_disappearing_link(GC_PTR * link)
# else
int GC_unregister_disappearing_link(link)
GC_PTR * link;
# endif
{
struct disappearing_link *curr_dl, *prev_dl;
int index;
DCL_LOCK_STATE;
DISABLE_SIGNALS();
LOCK();
index = HASH2(link, log_dl_table_size);
if (((unsigned long)link & (ALIGNMENT-1))) goto out;
prev_dl = 0; curr_dl = dl_head[index];
while (curr_dl != 0) {
if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) {
if (prev_dl == 0) {
dl_head[index] = dl_next(curr_dl);
} else {
dl_set_next(prev_dl, dl_next(curr_dl));
}
GC_dl_entries--;
UNLOCK();
ENABLE_SIGNALS();
GC_free((GC_PTR)curr_dl);
return(1);
}
prev_dl = curr_dl;
curr_dl = dl_next(curr_dl);
}
out:
UNLOCK();
ENABLE_SIGNALS();
return(0);
}
/* Possible finalization_marker procedures. Note that mark stack */
/* overflow is handled by the caller, and is not a disaster. */
void GC_normal_finalize_mark_proc(p)
ptr_t p;
{
hdr * hhdr = HDR(p);
PUSH_OBJ((word *)p, hhdr, GC_mark_stack_top,
&(GC_mark_stack[GC_mark_stack_size]));
}
/* This only pays very partial attention to the mark descriptor. */
/* It does the right thing for normal and atomic objects, and treats */
/* most others as normal. */
void GC_ignore_self_finalize_mark_proc(p)
ptr_t p;
{
hdr * hhdr = HDR(p);
word descr = hhdr -> hb_descr;
ptr_t q, r;
ptr_t scan_limit;
ptr_t target_limit = p + WORDS_TO_BYTES(hhdr -> hb_sz) - 1;
if ((descr & DS_TAGS) == DS_LENGTH) {
scan_limit = p + descr - sizeof(word);
} else {
scan_limit = target_limit + 1 - sizeof(word);
}
for (q = p; q <= scan_limit; q += ALIGNMENT) {
r = *(ptr_t *)q;
if (r < p || r > target_limit) {
GC_PUSH_ONE_HEAP((word)r);
}
}
}
/*ARGSUSED*/
void GC_null_finalize_mark_proc(p)
ptr_t p;
{
}
/* Register a finalization function. See gc.h for details. */
/* in the nonthreads case, we try to avoid disabling signals, */
/* since it can be expensive. Threads packages typically */
/* make it cheaper. */
void GC_register_finalizer_inner(obj, fn, cd, ofn, ocd, mp)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc * ofn;
GC_PTR * ocd;
finalization_mark_proc * mp;
{
ptr_t base;
struct finalizable_object * curr_fo, * prev_fo;
int index;
struct finalizable_object *new_fo;
DCL_LOCK_STATE;
# ifdef THREADS
DISABLE_SIGNALS();
LOCK();
# endif
if (log_fo_table_size == -1
|| GC_fo_entries > ((word)1 << log_fo_table_size)) {
# ifndef THREADS
DISABLE_SIGNALS();
# endif
GC_grow_table((struct hash_chain_entry ***)(&fo_head),
&log_fo_table_size);
# ifdef PRINTSTATS
GC_printf1("Grew fo table to %lu entries\n",
(unsigned long)(1 << log_fo_table_size));
# endif
# ifndef THREADS
ENABLE_SIGNALS();
# endif
}
/* in the THREADS case signals are disabled and we hold allocation */
/* lock; otherwise neither is true. Proceed carefully. */
base = (ptr_t)obj;
index = HASH2(base, log_fo_table_size);
prev_fo = 0; curr_fo = fo_head[index];
while (curr_fo != 0) {
if (curr_fo -> fo_hidden_base == HIDE_POINTER(base)) {
/* Interruption by a signal in the middle of this */
/* should be safe. The client may see only *ocd */
/* updated, but we'll declare that to be his */
/* problem. */
if (ocd) *ocd = (GC_PTR) curr_fo -> fo_client_data;
if (ofn) *ofn = curr_fo -> fo_fn;
/* Delete the structure for base. */
if (prev_fo == 0) {
fo_head[index] = fo_next(curr_fo);
} else {
fo_set_next(prev_fo, fo_next(curr_fo));
}
if (fn == 0) {
GC_fo_entries--;
/* May not happen if we get a signal. But a high */
/* estimate will only make the table larger than */
/* necessary. */
# ifndef THREADS
GC_free((GC_PTR)curr_fo);
# endif
} else {
curr_fo -> fo_fn = fn;
curr_fo -> fo_client_data = (ptr_t)cd;
curr_fo -> fo_mark_proc = mp;
/* Reinsert it. We deleted it first to maintain */
/* consistency in the event of a signal. */
if (prev_fo == 0) {
fo_head[index] = curr_fo;
} else {
fo_set_next(prev_fo, curr_fo);
}
}
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
# endif
return;
}
prev_fo = curr_fo;
curr_fo = fo_next(curr_fo);
}
if (ofn) *ofn = 0;
if (ocd) *ocd = 0;
if (fn == 0) {
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
# endif
return;
}
# ifdef THREADS
new_fo = (struct finalizable_object *)
GC_generic_malloc_inner(sizeof(struct finalizable_object),NORMAL);
# else
new_fo = (struct finalizable_object *)
GC_malloc(sizeof(struct finalizable_object));
# endif
if (new_fo != 0) {
new_fo -> fo_hidden_base = (word)HIDE_POINTER(base);
new_fo -> fo_fn = fn;
new_fo -> fo_client_data = (ptr_t)cd;
new_fo -> fo_object_size = GC_size(base);
new_fo -> fo_mark_proc = mp;
fo_set_next(new_fo, fo_head[index]);
GC_fo_entries++;
fo_head[index] = new_fo;
} else {
GC_finalization_failures++;
}
# ifdef THREADS
UNLOCK();
ENABLE_SIGNALS();
# endif
}
# if defined(__STDC__)
void GC_register_finalizer(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
# else
void GC_register_finalizer(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc * ofn;
GC_PTR * ocd;
# endif
{
GC_register_finalizer_inner(obj, fn, cd, ofn,
ocd, GC_normal_finalize_mark_proc);
}
# if defined(__STDC__)
void GC_register_finalizer_ignore_self(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
# else
void GC_register_finalizer_ignore_self(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc * ofn;
GC_PTR * ocd;
# endif
{
GC_register_finalizer_inner(obj, fn, cd, ofn,
ocd, GC_ignore_self_finalize_mark_proc);
}
# if defined(__STDC__)
void GC_register_finalizer_no_order(void * obj,
GC_finalization_proc fn, void * cd,
GC_finalization_proc *ofn, void ** ocd)
# else
void GC_register_finalizer_no_order(obj, fn, cd, ofn, ocd)
GC_PTR obj;
GC_finalization_proc fn;
GC_PTR cd;
GC_finalization_proc * ofn;
GC_PTR * ocd;
# endif
{
GC_register_finalizer_inner(obj, fn, cd, ofn,
ocd, GC_null_finalize_mark_proc);
}
/* Called with world stopped. Cause disappearing links to disappear, */
/* and invoke finalizers. */
void GC_finalize()
{
struct disappearing_link * curr_dl, * prev_dl, * next_dl;
struct finalizable_object * curr_fo, * prev_fo, * next_fo;
ptr_t real_ptr, real_link;
register int i;
int dl_size = (log_dl_table_size == -1 ) ? 0 : (1 << log_dl_table_size);
int fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size);
/* Make disappearing links disappear */
for (i = 0; i < dl_size; i++) {
curr_dl = dl_head[i];
prev_dl = 0;
while (curr_dl != 0) {
real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj);
real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link);
if (!GC_is_marked(real_ptr)) {
*(word *)real_link = 0;
next_dl = dl_next(curr_dl);
if (prev_dl == 0) {
dl_head[i] = next_dl;
} else {
dl_set_next(prev_dl, next_dl);
}
GC_clear_mark_bit((ptr_t)curr_dl);
GC_dl_entries--;
curr_dl = next_dl;
} else {
prev_dl = curr_dl;
curr_dl = dl_next(curr_dl);
}
}
}
/* Mark all objects reachable via chains of 1 or more pointers */
/* from finalizable objects. */
# ifdef PRINTSTATS
if (GC_mark_state != MS_NONE) ABORT("Bad mark state");
# endif
for (i = 0; i < fo_size; i++) {
for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) {
real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
if (!GC_is_marked(real_ptr)) {
GC_MARK_FO(real_ptr, curr_fo -> fo_mark_proc);
if (GC_is_marked(real_ptr)) {
WARN("Finalization cycle involving %lx\n", real_ptr);
}
}
}
}
/* Enqueue for finalization all objects that are still */
/* unreachable. */
GC_words_finalized = 0;
for (i = 0; i < fo_size; i++) {
curr_fo = fo_head[i];
prev_fo = 0;
while (curr_fo != 0) {
real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
if (!GC_is_marked(real_ptr)) {
# ifndef JAVA_FINALIZATION
GC_set_mark_bit(real_ptr);
# endif
/* Delete from hash table */
next_fo = fo_next(curr_fo);
if (prev_fo == 0) {
fo_head[i] = next_fo;
} else {
fo_set_next(prev_fo, next_fo);
}
GC_fo_entries--;
/* Add to list of objects awaiting finalization. */
fo_set_next(curr_fo, GC_finalize_now);
GC_finalize_now = curr_fo;
/* unhide object pointer so any future collections will */
/* see it. */
curr_fo -> fo_hidden_base =
(word) REVEAL_POINTER(curr_fo -> fo_hidden_base);
GC_words_finalized +=
ALIGNED_WORDS(curr_fo -> fo_object_size)
+ ALIGNED_WORDS(sizeof(struct finalizable_object));
# ifdef PRINTSTATS
if (!GC_is_marked((ptr_t)curr_fo)) {
ABORT("GC_finalize: found accessible unmarked object\n");
}
# endif
curr_fo = next_fo;
} else {
prev_fo = curr_fo;
curr_fo = fo_next(curr_fo);
}
}
}
# ifdef JAVA_FINALIZATION
/* make sure we mark everything reachable from objects finalized
using the no_order mark_proc */
for (curr_fo = GC_finalize_now;
curr_fo != NULL; curr_fo = fo_next(curr_fo)) {
real_ptr = (ptr_t)curr_fo -> fo_hidden_base;
if (!GC_is_marked(real_ptr)) {
if (curr_fo -> fo_mark_proc == GC_null_finalize_mark_proc) {
GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc);
}
GC_set_mark_bit(real_ptr);
}
}
# endif
/* Remove dangling disappearing links. */
for (i = 0; i < dl_size; i++) {
curr_dl = dl_head[i];
prev_dl = 0;
while (curr_dl != 0) {
real_link = GC_base((ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link));
if (real_link != 0 && !GC_is_marked(real_link)) {
next_dl = dl_next(curr_dl);
if (prev_dl == 0) {
dl_head[i] = next_dl;
} else {
dl_set_next(prev_dl, next_dl);
}
GC_clear_mark_bit((ptr_t)curr_dl);
GC_dl_entries--;
curr_dl = next_dl;
} else {
prev_dl = curr_dl;
curr_dl = dl_next(curr_dl);
}
}
}
}
#ifdef JAVA_FINALIZATION
/* Enqueue all remaining finalizers to be run - Assumes lock is
* held, and signals are disabled */
void GC_enqueue_all_finalizers()
{
struct finalizable_object * curr_fo, * prev_fo, * next_fo;
ptr_t real_ptr, real_link;
register int i;
int fo_size;
fo_size = (log_fo_table_size == -1 ) ? 0 : (1 << log_fo_table_size);
GC_words_finalized = 0;
for (i = 0; i < fo_size; i++) {
curr_fo = fo_head[i];
prev_fo = 0;
while (curr_fo != 0) {
real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base);
GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc);
GC_set_mark_bit(real_ptr);
/* Delete from hash table */
next_fo = fo_next(curr_fo);
if (prev_fo == 0) {
fo_head[i] = next_fo;
} else {
fo_set_next(prev_fo, next_fo);
}
GC_fo_entries--;
/* Add to list of objects awaiting finalization. */
fo_set_next(curr_fo, GC_finalize_now);
GC_finalize_now = curr_fo;
/* unhide object pointer so any future collections will */
/* see it. */
curr_fo -> fo_hidden_base =
(word) REVEAL_POINTER(curr_fo -> fo_hidden_base);
GC_words_finalized +=
ALIGNED_WORDS(curr_fo -> fo_object_size)
+ ALIGNED_WORDS(sizeof(struct finalizable_object));
curr_fo = next_fo;
}
}
return;
}
/* Invoke all remaining finalizers that haven't yet been run.
* This is needed for strict compliance with the Java standard,
* which can make the runtime guarantee that all finalizers are run.
* Unfortunately, the Java standard implies we have to keep running
* finalizers until there are no more left, a potential infinite loop.
* YUCK. * This routine is externally callable, so is called without
* the allocation lock
*/
void GC_finalize_all()
{
DCL_LOCK_STATE;
DISABLE_SIGNALS();
LOCK();
while (GC_fo_entries > 0) {
GC_enqueue_all_finalizers();
UNLOCK();
ENABLE_SIGNALS();
GC_INVOKE_FINALIZERS();
DISABLE_SIGNALS();
LOCK();
}
UNLOCK();
ENABLE_SIGNALS();
}
#endif
/* Invoke finalizers for all objects that are ready to be finalized. */
/* Should be called without allocation lock. */
int GC_invoke_finalizers()
{
register struct finalizable_object * curr_fo;
register int count = 0;
DCL_LOCK_STATE;
while (GC_finalize_now != 0) {
# ifdef THREADS
DISABLE_SIGNALS();
LOCK();
# endif
curr_fo = GC_finalize_now;
# ifdef THREADS
if (curr_fo != 0) GC_finalize_now = fo_next(curr_fo);
UNLOCK();
ENABLE_SIGNALS();
if (curr_fo == 0) break;
# else
GC_finalize_now = fo_next(curr_fo);
# endif
fo_set_next(curr_fo, 0);
(*(curr_fo -> fo_fn))((ptr_t)(curr_fo -> fo_hidden_base),
curr_fo -> fo_client_data);
curr_fo -> fo_client_data = 0;
++count;
# ifdef UNDEFINED
/* This is probably a bad idea. It throws off accounting if */
/* nearly all objects are finalizable. O.w. it shouldn't */
/* matter. */
GC_free((GC_PTR)curr_fo);
# endif
}
return count;
}
# ifdef __STDC__
GC_PTR GC_call_with_alloc_lock(GC_fn_type fn,
GC_PTR client_data)
# else
GC_PTR GC_call_with_alloc_lock(fn, client_data)
GC_fn_type fn;
GC_PTR client_data;
# endif
{
GC_PTR result;
DCL_LOCK_STATE;
# ifdef THREADS
DISABLE_SIGNALS();
LOCK();
SET_LOCK_HOLDER();
# endif
result = (*fn)(client_data);
# ifdef THREADS
UNSET_LOCK_HOLDER();
UNLOCK();
ENABLE_SIGNALS();
# endif
return(result);
}

View File

@ -1,711 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
* Copyright 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Note that this defines a large number of tuning hooks, which can
* safely be ignored in nearly all cases. For normal use it suffices
* to call only GC_MALLOC and perhaps GC_REALLOC.
* For better performance, also look at GC_MALLOC_ATOMIC, and
* GC_enable_incremental. If you need an action to be performed
* immediately before an object is collected, look at GC_register_finalizer.
* If you are using Solaris threads, look at the end of this file.
* Everything else is best ignored unless you encounter performance
* problems.
*/
#ifndef _GC_H
# define _GC_H
# define __GC
# include <stddef.h>
#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
#include "libgc_globals.h"
#endif
#if defined(_MSC_VER) && defined(_DLL)
#ifdef GC_BUILD
#define GC_API __declspec(dllexport)
#else
#define GC_API __declspec(dllimport)
#endif
#endif
#ifndef GC_API
#define GC_API extern
#endif
# if defined(__STDC__) || defined(__cplusplus)
# define GC_PROTO(args) args
typedef void * GC_PTR;
# else
# define GC_PROTO(args) ()
typedef char * GC_PTR;
# endif
# ifdef __cplusplus
extern "C" {
# endif
/* Define word and signed_word to be unsigned and signed types of the */
/* size as char * or void *. There seems to be no way to do this */
/* even semi-portably. The following is probably no better/worse */
/* than almost anything else. */
/* The ANSI standard suggests that size_t and ptr_diff_t might be */
/* better choices. But those appear to have incorrect definitions */
/* on may systems. Notably "typedef int size_t" seems to be both */
/* frequent and WRONG. */
typedef unsigned long GC_word;
typedef long GC_signed_word;
/* Public read-only variables */
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
/* Public R/W variables */
GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
/* When there is insufficient memory to satisfy */
/* an allocation request, we return */
/* (*GC_oom_fn)(). By default this just */
/* returns 0. */
/* If it returns, it must return 0 or a valid */
/* pointer to a previously allocated heap */
/* object. */
GC_API int GC_quiet; /* Disable statistics output. Only matters if */
/* collector has been compiled with statistics */
/* enabled. This involves a performance cost, */
/* and is thus not the default. */
GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
/* because it's not safe. */
GC_API int GC_dont_expand;
/* Dont expand heap unless explicitly requested */
/* or forced to. */
GC_API int GC_full_freq; /* Number of partial collections between */
/* full collections. Matters only if */
/* GC_incremental is set. */
GC_API GC_word GC_non_gc_bytes;
/* Bytes not considered candidates for collection. */
/* Used only to control scheduling of collections. */
GC_API GC_word GC_free_space_divisor;
/* We try to make sure that we allocate at */
/* least N/GC_free_space_divisor bytes between */
/* collections, where N is the heap size plus */
/* a rough estimate of the root set size. */
/* Initially, GC_free_space_divisor = 4. */
/* Increasing its value will use less space */
/* but more collection time. Decreasing it */
/* will appreciably decrease collection time */
/* at the expense of space. */
/* GC_free_space_divisor = 1 will effectively */
/* disable collections. */
GC_API GC_word GC_max_retries;
/* The maximum number of GCs attempted before */
/* reporting out of memory after heap */
/* expansion fails. Initially 0. */
/* Public procedures */
/*
* general purpose allocation routines, with roughly malloc calling conv.
* The atomic versions promise that no relevant pointers are contained
* in the object. The nonatomic versions guarantee that the new object
* is cleared. GC_malloc_stubborn promises that no changes to the object
* will occur after GC_end_stubborn_change has been called on the
* result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
* that is scanned for pointers to collectable objects, but is not itself
* collectable. GC_malloc_uncollectable and GC_free called on the resulting
* object implicitly update GC_non_gc_bytes appropriately.
*/
GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
/* The following is only defined if the library has been suitably */
/* compiled: */
GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
/* Explicitly deallocate an object. Dangerous if used incorrectly. */
/* Requires a pointer to the base of an object. */
/* If the argument is stubborn, it should not be changeable when freed. */
/* An object should not be enable for finalization when it is */
/* explicitly deallocated. */
/* GC_free(0) is a no-op, as required by ANSI C for free. */
GC_API void GC_free GC_PROTO((GC_PTR object_addr));
/*
* Stubborn objects may be changed only if the collector is explicitly informed.
* The collector is implicitly informed of coming change when such
* an object is first allocated. The following routines inform the
* collector that an object will no longer be changed, or that it will
* once again be changed. Only nonNIL pointer stores into the object
* are considered to be changes. The argument to GC_end_stubborn_change
* must be exacly the value returned by GC_malloc_stubborn or passed to
* GC_change_stubborn. (In the second case it may be an interior pointer
* within 512 bytes of the beginning of the objects.)
* There is a performance penalty for allowing more than
* one stubborn object to be changed at once, but it is acceptable to
* do so. The same applies to dropping stubborn objects that are still
* changeable.
*/
GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
/* Return 0 if displaced_pointer doesn't point to within a valid */
/* object. */
GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
/* Given a pointer to the base of an object, return its size in bytes. */
/* The returned size may be slightly larger than what was originally */
/* requested. */
GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
/* For compatibility with C library. This is occasionally faster than */
/* a malloc followed by a bcopy. But if you rely on that, either here */
/* or with the standard C library, your code is broken. In my */
/* opinion, it shouldn't have been invented, but now we're stuck. -HB */
/* The resulting object has the same kind as the original. */
/* If the argument is stubborn, the result will have changes enabled. */
/* It is an error to have changes enabled for the original object. */
/* Follows ANSI comventions for NULL old_object. */
GC_API GC_PTR GC_realloc GC_PROTO((GC_PTR old_object,
size_t new_size_in_bytes));
/* Explicitly increase the heap size. */
/* Returns 0 on failure, 1 on success. */
GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
/* Limit the heap size to n bytes. Useful when you're debugging, */
/* especially on systems that don't handle running out of memory well. */
/* n == 0 ==> unbounded. This is the default. */
GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
/* Inform the collector that a certain section of statically allocated */
/* memory contains no pointers to garbage collected memory. Thus it */
/* need not be scanned. This is sometimes important if the application */
/* maps large read/write files into the address space, which could be */
/* mistaken for dynamic library data segments on some systems. */
GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
/* Clear the set of root segments. Wizards only. */
GC_API void GC_clear_roots GC_PROTO((void));
/* Add a root segment. Wizards only. */
GC_API void GC_add_roots GC_PROTO((char * low_address,
char * high_address_plus_1));
/* Add a displacement to the set of those considered valid by the */
/* collector. GC_register_displacement(n) means that if p was returned */
/* by GC_malloc, then (char *)p + n will be considered to be a valid */
/* pointer to n. N must be small and less than the size of p. */
/* (All pointers to the interior of objects from the stack are */
/* considered valid in any case. This applies to heap objects and */
/* static data.) */
/* Preferably, this should be called before any other GC procedures. */
/* Calling it later adds to the probability of excess memory */
/* retention. */
/* This is a no-op if the collector was compiled with recognition of */
/* arbitrary interior pointers enabled, which is now the default. */
GC_API void GC_register_displacement GC_PROTO((GC_word n));
/* The following version should be used if any debugging allocation is */
/* being done. */
GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
/* Explicitly trigger a full, world-stop collection. */
GC_API void GC_gcollect GC_PROTO((void));
/* Trigger a full world-stopped collection. Abort the collection if */
/* and when stop_func returns a nonzero value. Stop_func will be */
/* called frequently, and should be reasonably fast. This works even */
/* if virtual dirty bits, and hence incremental collection is not */
/* available for this architecture. Collections can be aborted faster */
/* than normal pause times for incremental collection. However, */
/* aborted collections do no useful work; the next collection needs */
/* to start from the beginning. */
typedef int (* GC_stop_func) GC_PROTO((void));
GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
/* Return the number of bytes in the heap. Excludes collector private */
/* data structures. Includes empty blocks and fragmentation loss. */
/* Includes some pages that were allocated but never written. */
GC_API size_t GC_get_heap_size GC_PROTO((void));
/* Return the number of bytes allocated since the last collection. */
GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
/* available or most heap objects are */
/* pointerfree(atomic) or immutable. */
/* Don't use in leak finding mode. */
/* Ignored if GC_dont_gc is true. */
GC_API void GC_enable_incremental GC_PROTO((void));
/* Perform some garbage collection work, if appropriate. */
/* Return 0 if there is no more work to be done. */
/* Typically performs an amount of work corresponding roughly */
/* to marking from one page. May do more work if further */
/* progress requires it, e.g. if incremental collection is */
/* disabled. It is reasonable to call this in a wait loop */
/* until it returns 0. */
GC_API int GC_collect_a_little GC_PROTO((void));
/* Allocate an object of size lb bytes. The client guarantees that */
/* as long as the object is live, it will be referenced by a pointer */
/* that points to somewhere within the first 256 bytes of the object. */
/* (This should normally be declared volatile to prevent the compiler */
/* from invalidating this assertion.) This routine is only useful */
/* if a large array is being allocated. It reduces the chance of */
/* accidentally retaining such an array as a result of scanning an */
/* integer that happens to be an address inside the array. (Actually, */
/* it reduces the chance of the allocator not finding space for such */
/* an array, since it will try hard to avoid introducing such a false */
/* reference.) On a SunOS 4.X or MS Windows system this is recommended */
/* for arrays likely to be larger than 100K or so. For other systems, */
/* or if the collector is not configured to recognize all interior */
/* pointers, the threshold is normally much higher. */
GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
# define GC_ADD_CALLER
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
#ifdef GC_ADD_CALLER
# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
#else
# define GC_EXTRAS __FILE__, __LINE__
# define GC_EXTRA_PARAMS char * descr_string, int descr_int
#endif
/* Debugging (annotated) allocation. GC_gcollect will check */
/* objects allocated in this way for overwrites, etc. */
GC_API GC_PTR GC_debug_malloc
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_atomic
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_uncollectable
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_stubborn
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
GC_API GC_PTR GC_debug_realloc
GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
GC_EXTRA_PARAMS));
GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
# ifdef GC_DEBUG
# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
# define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_debug_malloc_uncollectable(sz, \
GC_EXTRAS)
# define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
# define GC_FREE(p) GC_debug_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_debug_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
GC_debug_register_finalizer_no_order(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, GC_base(obj))
# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
# else
# define GC_MALLOC(sz) GC_malloc(sz)
# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
# define GC_REALLOC(old, sz) GC_realloc(old, sz)
# define GC_FREE(p) GC_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
GC_register_finalizer_no_order(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, obj)
# define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
# endif
/* The following are included because they are often convenient, and */
/* reduce the chance for a misspecifed size argument. But calls may */
/* expand to something syntactically incorrect if t is a complicated */
/* type expression. */
# define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
# define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
# define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
# define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
/* Finalization. Some of these primitives are grossly unsafe. */
/* The idea is to make them both cheap, and sufficient to build */
/* a safer layer, closer to PCedar finalization. */
/* The interface represents my conclusions from a long discussion */
/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */
typedef void (*GC_finalization_proc)
GC_PROTO((GC_PTR obj, GC_PTR client_data));
GC_API void GC_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* When obj is no longer accessible, invoke */
/* (*fn)(obj, cd). If a and b are inaccessible, and */
/* a points to b (after disappearing links have been */
/* made to disappear), then only a will be */
/* finalized. (If this does not create any new */
/* pointers to b, then b will be finalized after the */
/* next collection.) Any finalizable object that */
/* is reachable from itself by following one or more */
/* pointers will not be finalized (or collected). */
/* Thus cycles involving finalizable objects should */
/* be avoided, or broken by disappearing links. */
/* All but the last finalizer registered for an object */
/* is ignored. */
/* Finalization may be removed by passing 0 as fn. */
/* Finalizers are implicitly unregistered just before */
/* they are invoked. */
/* The old finalizer and client data are stored in */
/* *ofn and *ocd. */
/* Fn is never invoked on an accessible object, */
/* provided hidden pointers are converted to real */
/* pointers only if the allocation lock is held, and */
/* such conversions are not performed by finalization */
/* routines. */
/* If GC_register_finalizer is aborted as a result of */
/* a signal, the object may be left with no */
/* finalization, even if neither the old nor new */
/* finalizer were NULL. */
/* Obj should be the nonNULL starting address of an */
/* object allocated by GC_malloc or friends. */
/* Note that any garbage collectable object referenced */
/* by cd will be considered accessible until the */
/* finalizer is invoked. */
/* Another versions of the above follow. It ignores */
/* self-cycles, i.e. pointers from a finalizable object to */
/* itself. There is a stylistic argument that this is wrong, */
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
/* case. */
GC_API void GC_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* Another version of the above. It ignores all cycles. */
/* It should probably only be used by Java implementations. */
GC_API void GC_register_finalizer_no_order
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer_no_order
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* The following routine may be used to break cycles between */
/* finalizable objects, thus causing cyclic finalizable */
/* objects to be finalized in the correct order. Standard */
/* use involves calling GC_register_disappearing_link(&p), */
/* where p is a pointer that is not followed by finalization */
/* code, and should not be considered in determining */
/* finalization order. */
GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Link should point to a field of a heap allocated */
/* object obj. *link will be cleared when obj is */
/* found to be inaccessible. This happens BEFORE any */
/* finalization code is invoked, and BEFORE any */
/* decisions about finalization order are made. */
/* This is useful in telling the finalizer that */
/* some pointers are not essential for proper */
/* finalization. This may avoid finalization cycles. */
/* Note that obj may be resurrected by another */
/* finalizer, and thus the clearing of *link may */
/* be visible to non-finalization code. */
/* There's an argument that an arbitrary action should */
/* be allowed here, instead of just clearing a pointer. */
/* But this causes problems if that action alters, or */
/* examines connectivity. */
/* Returns 1 if link was already registered, 0 */
/* otherwise. */
/* Only exists for backward compatibility. See below: */
GC_API int GC_general_register_disappearing_link
GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
/* A slight generalization of the above. *link is */
/* cleared when obj first becomes inaccessible. This */
/* can be used to implement weak pointers easily and */
/* safely. Typically link will point to a location */
/* holding a disguised pointer to obj. (A pointer */
/* inside an "atomic" object is effectively */
/* disguised.) In this way soft */
/* pointers are broken before any object */
/* reachable from them are finalized. Each link */
/* May be registered only once, i.e. with one obj */
/* value. This was added after a long email discussion */
/* with John Ellis. */
/* Obj must be a pointer to the first word of an object */
/* we allocated. It is unsafe to explicitly deallocate */
/* the object containing link. Explicitly deallocating */
/* obj may or may not cause link to eventually be */
/* cleared. */
GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Returns 0 if link was not actually registered. */
/* Undoes a registration by either of the above two */
/* routines. */
/* Auxiliary fns to make finalization work correctly with displaced */
/* pointers introduced by the debugging allocators. */
GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
GC_API int GC_invoke_finalizers GC_PROTO((void));
/* Run finalizers for all objects that are ready to */
/* be finalized. Return the number of finalizers */
/* that were run. Normally this is also called */
/* implicitly during some allocations. If */
/* FINALIZE_ON_DEMAND is defined, it must be called */
/* explicitly. */
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
/* The following is intended to be used by a higher level */
/* (e.g. cedar-like) finalization facility. It is expected */
/* that finalization code will arrange for hidden pointers to */
/* disappear. Otherwise objects can be accessed after they */
/* have been collected. */
/* Note that putting pointers in atomic objects or in */
/* nonpointer slots of "typed" objects is equivalent to */
/* disguising them in this way, and may have other advantages. */
# if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
typedef GC_word GC_hidden_pointer;
# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
/* Converting a hidden pointer to a real pointer requires verifying */
/* that the object still exists. This involves acquiring the */
/* allocator lock to avoid a race with the collector. */
# endif /* I_HIDE_POINTERS */
typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
/* Check that p and q point to the same object. */
/* Fail conspicuously if they don't. */
/* Returns the first argument. */
/* Succeeds if neither p nor q points to the heap. */
/* May succeed if both p and q point to between heap objects. */
GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
/* Checked pointer pre- and post- increment operations. Note that */
/* the second argument is in units of bytes, not multiples of the */
/* object size. This should either be invoked from a macro, or the */
/* call should be automatically generated. */
GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
/* Check that p is visible */
/* to the collector as a possibly pointer containing location. */
/* If it isn't fail conspicuously. */
/* Returns the argument in all cases. May erroneously succeed */
/* in hard cases. (This is intended for debugging use with */
/* untyped allocations. The idea is that it should be possible, though */
/* slow, to add such a call to all indirect pointer stores.) */
/* Currently useless for multithreaded worlds. */
GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
/* Fail conspicuously if this property does not hold. */
/* Uninteresting with ALL_INTERIOR_POINTERS. */
/* Always returns its argument. */
GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
/* Safer, but slow, pointer addition. Probably useful mainly with */
/* a preprocessor. Useful only for heap pointers. */
#ifdef GC_DEBUG
# define GC_PTR_ADD3(x, n, type_of_result) \
((type_of_result)GC_same_obj((x)+(n), (x)))
# define GC_PRE_INCR3(x, n, type_of_result) \
((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
# define GC_POST_INCR2(x, type_of_result) \
((type_of_result)GC_post_incr(&(x), sizeof(*x))
# ifdef __GNUC__
# define GC_PTR_ADD(x, n) \
GC_PTR_ADD3(x, n, typeof(x))
# define GC_PRE_INCR(x, n) \
GC_PRE_INCR3(x, n, typeof(x))
# define GC_POST_INCR(x, n) \
GC_POST_INCR3(x, typeof(x))
# else
/* We can't do this right without typeof, which ANSI */
/* decided was not sufficiently useful. Repeatedly */
/* mentioning the arguments seems too dangerous to be */
/* useful. So does not casting the result. */
# define GC_PTR_ADD(x, n) ((x)+(n))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
# define GC_PTR_ADD(x, n) ((x)+(n))
# define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
# define GC_PRE_INCR(x, n) ((x) += (n))
# define GC_POST_INCR2(x, n, type_of_result) ((x)++)
# define GC_POST_INCR(x, n) ((x)++)
#endif
/* Safer assignment of a pointer to a nonstack location. */
#ifdef GC_DEBUG
# ifdef __STDC__
# define GC_PTR_STORE(p, q) \
(*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
# else
# define GC_PTR_STORE(p, q) \
(*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_STORE(p, q) *((p) = (q))
#endif
/* Fynctions called to report pointer checking errors */
GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
GC_API void (*GC_is_valid_displacement_print_proc)
GC_PROTO((GC_PTR p));
GC_API void (*GC_is_visible_print_proc)
GC_PROTO((GC_PTR p));
#ifdef SOLARIS_THREADS
/* We need to intercept calls to many of the threads primitives, so */
/* that we can locate thread stacks and stop the world. */
/* Note also that the collector cannot see thread specific data. */
/* Thread specific data should generally consist of pointers to */
/* uncollectable objects, which are deallocated using the destructor */
/* facility in thr_keycreate. */
# include <thread.h>
# include <signal.h>
int GC_thr_create(void *stack_base, size_t stack_size,
void *(*start_routine)(void *), void *arg, long flags,
thread_t *new_thread);
int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
int GC_thr_suspend(thread_t target_thread);
int GC_thr_continue(thread_t target_thread);
void * GC_dlopen(const char *path, int mode);
# ifdef _SOLARIS_PTHREADS
# include <pthread.h>
extern int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void * (*thread_execp)(void *), void *arg);
extern int GC_pthread_join(pthread_t wait_for, void **status);
# undef thread_t
# define pthread_join GC_pthread_join
# define pthread_create GC_pthread_create
#endif
# define thr_create GC_thr_create
# define thr_join GC_thr_join
# define thr_suspend GC_thr_suspend
# define thr_continue GC_thr_continue
# define dlopen GC_dlopen
# endif /* SOLARIS_THREADS */
#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
/* We treat these similarly. */
# include <pthread.h>
# include <signal.h>
int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
int GC_pthread_join(pthread_t thread, void **retval);
# define pthread_create GC_pthread_create
# define pthread_sigmask GC_pthread_sigmask
# define pthread_join GC_pthread_join
#endif /* IRIX_THREADS || LINUX_THREADS */
#if defined(THREADS) && !defined(SRC_M3)
/* This returns a list of objects, linked through their first */
/* word. Its use can greatly reduce lock contention problems, since */
/* the allocation lock can be acquired and released many fewer times. */
GC_PTR GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
/* in returned list. */
extern void GC_thr_init(); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
/*
* If you are planning on putting
* the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
* from the statically loaded program section.
* This circumvents a Solaris 2.X (X<=4) linker bug.
*/
#if defined(sparc) || defined(__sparc)
# define GC_INIT() { extern end, etext; \
GC_noop(&end, &etext); }
#else
# if defined(__CYGWIN32__) && defined(GC_USE_DLL)
/*
* Similarly gnu-win32 DLLs need explicit initialization
*/
# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
# else
# define GC_INIT()
# endif
#endif
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* _GC_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
.TH GC_MALLOC 1L "12 February 1996"
.SH NAME
GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_malloc_atomic_ignore_off_page, GC_set_warn_proc \- Garbage collecting malloc replacement
.SH SYNOPSIS
#include "gc.h"
.br
# define malloc(n) GC_malloc(n)
.br
... malloc(...) ...
.br
.sp
cc ... gc.a
.LP
.SH DESCRIPTION
.I GC_malloc
and
.I GC_free
are plug-in replacements for standard malloc and free. However,
.I
GC_malloc
will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by
.I
GC_malloc
or friends.
.LP
See the documentation in the include file gc_cpp.h for an alternate, C++ specific interface to the garbage collector.
.LP
Unlike the standard implementations of malloc,
.I
GC_malloc
clears the newly allocated storage.
.I
GC_malloc_atomic
does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector.
.LP
.I
GC_free
can be used to deallocate objects, but its use is optional, and generally discouraged.
.I
GC_realloc
has the standard realloc semantics. It preserves pointer-free-ness.
.I
GC_register_finalizer
allows for registration of functions that are invoked when an object becomes inaccessible.
.LP
The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning.
.LP
.I
GC_malloc_ignore_off_page
and
.I
GC_malloc_atomic_ignore_off_page
inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.)
.LP
It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed.
.LP
The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with
.I
GC_set_warn_proc.
This is recommended for production code. See gc.h for details.
.LP
Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capital letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions.
.LP
On some machines, collection will be performed incrementally after a call to
.I
GC_enable_incremental.
This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap.
.LP
Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM support, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc.
.LP
.SH "SEE ALSO"
The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.)
.LP
Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
\fISoftware Practice & Experience\fP, September 1988, pp. 807-820.
.LP
The malloc(3) man page.
.LP
.SH AUTHOR
Hans-J. Boehm (boehm@parc.xerox.com). Some of the code was written by others, most notably Alan Demers.

View File

@ -1,380 +0,0 @@
/*
* Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
//
// This is a C++ header file that is intended to replace the SGI STL
// alloc.h.
//
// This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE
// and -DALL_INTERIOR_POINTERS. We also recommend
// -DREDIRECT_MALLOC=GC_uncollectable_malloc.
//
// Some of this could be faster in the explicit deallocation case. In particular,
// we spend too much time clearing objects on the free lists. That could be avoided.
//
// This uses template classes with static members, and hence does not work
// with g++ 2.7.2 and earlier.
//
#include "gc.h"
#ifndef GC_ALLOC_H
#define GC_ALLOC_H
#define __ALLOC_H // Prevent inclusion of the default version. Ugly.
#define __SGI_STL_ALLOC_H
#define __SGI_STL_INTERNAL_ALLOC_H
#ifndef __ALLOC
# define __ALLOC alloc
#endif
#include <stddef.h>
#include <string.h>
// The following is just replicated from the conventional SGI alloc.h:
template<class T, class alloc>
class simple_alloc {
public:
static T *allocate(size_t n)
{ return 0 == n? 0 : (T*) alloc::allocate(n * sizeof (T)); }
static T *allocate(void)
{ return (T*) alloc::allocate(sizeof (T)); }
static void deallocate(T *p, size_t n)
{ if (0 != n) alloc::deallocate(p, n * sizeof (T)); }
static void deallocate(T *p)
{ alloc::deallocate(p, sizeof (T)); }
};
#include "gc.h"
// The following need to match collector data structures.
// We can't include gc_priv.h, since that pulls in way too much stuff.
// This should eventually be factored out into another include file.
extern "C" {
extern void ** const GC_objfreelist_ptr;
extern void ** const GC_aobjfreelist_ptr;
extern void ** const GC_uobjfreelist_ptr;
extern void ** const GC_auobjfreelist_ptr;
extern void GC_incr_words_allocd(size_t words);
extern void GC_incr_mem_freed(size_t words);
extern char * GC_generic_malloc_words_small(size_t word, int kind);
}
// Object kinds; must match PTRFREE, NORMAL, UNCOLLECTABLE, and
// AUNCOLLECTABLE in gc_priv.h.
enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2,
GC_AUNCOLLECTABLE = 3 };
enum { GC_max_fast_bytes = 255 };
enum { GC_bytes_per_word = sizeof(char *) };
enum { GC_byte_alignment = 8 };
enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word };
inline void * &GC_obj_link(void * p)
{ return *(void **)p; }
// Compute a number of words >= n+1 bytes.
// The +1 allows for pointers one past the end.
inline size_t GC_round_up(size_t n)
{
return ((n + GC_byte_alignment)/GC_byte_alignment)*GC_word_alignment;
}
// The same but don't allow for extra byte.
inline size_t GC_round_up_uncollectable(size_t n)
{
return ((n + GC_byte_alignment - 1)/GC_byte_alignment)*GC_word_alignment;
}
template <int dummy>
class GC_aux_template {
public:
// File local count of allocated words. Occasionally this is
// added into the global count. A separate count is necessary since the
// real one must be updated with a procedure call.
static size_t GC_words_recently_allocd;
// Same for uncollectable mmory. Not yet reflected in either
// GC_words_recently_allocd or GC_non_gc_bytes.
static size_t GC_uncollectable_words_recently_allocd;
// Similar counter for explicitly deallocated memory.
static size_t GC_mem_recently_freed;
// Again for uncollectable memory.
static size_t GC_uncollectable_mem_recently_freed;
static void * GC_out_of_line_malloc(size_t nwords, int kind);
};
template <int dummy>
size_t GC_aux_template<dummy>::GC_words_recently_allocd = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_uncollectable_words_recently_allocd = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_mem_recently_freed = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_uncollectable_mem_recently_freed = 0;
template <int dummy>
void * GC_aux_template<dummy>::GC_out_of_line_malloc(size_t nwords, int kind)
{
GC_words_recently_allocd += GC_uncollectable_words_recently_allocd;
GC_non_gc_bytes +=
GC_bytes_per_word * GC_uncollectable_words_recently_allocd;
GC_uncollectable_words_recently_allocd = 0;
GC_mem_recently_freed += GC_uncollectable_mem_recently_freed;
GC_non_gc_bytes -=
GC_bytes_per_word * GC_uncollectable_mem_recently_freed;
GC_uncollectable_mem_recently_freed = 0;
GC_incr_words_allocd(GC_words_recently_allocd);
GC_words_recently_allocd = 0;
GC_incr_mem_freed(GC_mem_recently_freed);
GC_mem_recently_freed = 0;
return GC_generic_malloc_words_small(nwords, kind);
}
typedef GC_aux_template<0> GC_aux;
// A fast, single-threaded, garbage-collected allocator
// We assume the first word will be immediately overwritten.
// In this version, deallocation is not a noop, and explicit
// deallocation is likely to help performance.
template <int dummy>
class single_client_gc_alloc_template {
public:
static void * allocate(size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc(n);
flh = GC_objfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_NORMAL);
}
*flh = GC_obj_link(op);
GC_aux::GC_words_recently_allocd += nwords;
return op;
}
static void * ptr_free_allocate(size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_atomic(n);
flh = GC_aobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_PTRFREE);
}
*flh = GC_obj_link(op);
GC_aux::GC_words_recently_allocd += nwords;
return op;
}
static void deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_objfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
memset((char *)p + GC_bytes_per_word, 0,
GC_bytes_per_word * (nwords - 1));
*flh = p;
GC_aux::GC_mem_recently_freed += nwords;
}
}
static void ptr_free_deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_aobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_mem_recently_freed += nwords;
}
}
};
typedef single_client_gc_alloc_template<0> single_client_gc_alloc;
// Once more, for uncollectable objects.
template <int dummy>
class single_client_alloc_template {
public:
static void * allocate(size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_uncollectable(n);
flh = GC_uobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_UNCOLLECTABLE);
}
*flh = GC_obj_link(op);
GC_aux::GC_uncollectable_words_recently_allocd += nwords;
return op;
}
static void * ptr_free_allocate(size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_atomic_uncollectable(n);
flh = GC_auobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_AUNCOLLECTABLE);
}
*flh = GC_obj_link(op);
GC_aux::GC_uncollectable_words_recently_allocd += nwords;
return op;
}
static void deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_uobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_uncollectable_mem_recently_freed += nwords;
}
}
static void ptr_free_deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_auobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_uncollectable_mem_recently_freed += nwords;
}
}
};
typedef single_client_alloc_template<0> single_client_alloc;
template < int dummy >
class gc_alloc_template {
public:
static void * allocate(size_t n) { return GC_malloc(n); }
static void * ptr_free_allocate(size_t n)
{ return GC_malloc_atomic(n); }
static void deallocate(void *, size_t) { }
static void ptr_free_deallocate(void *, size_t) { }
};
typedef gc_alloc_template < 0 > gc_alloc;
template < int dummy >
class alloc_template {
public:
static void * allocate(size_t n) { return GC_malloc_uncollectable(n); }
static void * ptr_free_allocate(size_t n)
{ return GC_malloc_atomic_uncollectable(n); }
static void deallocate(void *p, size_t) { GC_free(p); }
static void ptr_free_deallocate(void *p, size_t) { GC_free(p); }
};
typedef alloc_template < 0 > alloc;
#ifdef _SGI_SOURCE
// We want to specialize simple_alloc so that it does the right thing
// for all pointerfree types. At the moment there is no portable way to
// even approximate that. The following approximation should work for
// SGI compilers, and perhaps some others.
# define __GC_SPECIALIZE(T,alloc) \
class simple_alloc<T, alloc> { \
public: \
static T *allocate(size_t n) \
{ return 0 == n? 0 : \
(T*) alloc::ptr_free_allocate(n * sizeof (T)); } \
static T *allocate(void) \
{ return (T*) alloc::ptr_free_allocate(sizeof (T)); } \
static void deallocate(T *p, size_t n) \
{ if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \
static void deallocate(T *p) \
{ alloc::ptr_free_deallocate(p, sizeof (T)); } \
};
__GC_SPECIALIZE(char, gc_alloc)
__GC_SPECIALIZE(int, gc_alloc)
__GC_SPECIALIZE(unsigned, gc_alloc)
__GC_SPECIALIZE(float, gc_alloc)
__GC_SPECIALIZE(double, gc_alloc)
__GC_SPECIALIZE(char, alloc)
__GC_SPECIALIZE(int, alloc)
__GC_SPECIALIZE(unsigned, alloc)
__GC_SPECIALIZE(float, alloc)
__GC_SPECIALIZE(double, alloc)
__GC_SPECIALIZE(char, single_client_gc_alloc)
__GC_SPECIALIZE(int, single_client_gc_alloc)
__GC_SPECIALIZE(unsigned, single_client_gc_alloc)
__GC_SPECIALIZE(float, single_client_gc_alloc)
__GC_SPECIALIZE(double, single_client_gc_alloc)
__GC_SPECIALIZE(char, single_client_alloc)
__GC_SPECIALIZE(int, single_client_alloc)
__GC_SPECIALIZE(unsigned, single_client_alloc)
__GC_SPECIALIZE(float, single_client_alloc)
__GC_SPECIALIZE(double, single_client_alloc)
#ifdef __STL_USE_STD_ALLOCATORS
???copy stuff from stl_alloc.h or remove it to a different file ???
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* _SGI_SOURCE */
#endif /* GC_ALLOC_H */

View File

@ -1,46 +0,0 @@
/*************************************************************************
Copyright (c) 1994 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Last modified on Sat Nov 19 19:31:14 PST 1994 by ellis
on Sat Jun 8 15:10:00 PST 1994 by boehm
Permission is hereby granted to copy this code for any purpose,
provided the above notices are retained on all copies.
This implementation module for gc_c++.h provides an implementation of
the global operators "new" and "delete" that calls the Boehm
allocator. All objects allocated by this implementation will be
non-collectable but part of the root set of the collector.
You should ensure (using implementation-dependent techniques) that the
linker finds this module before the library that defines the default
built-in "new" and "delete".
Authors: John R. Ellis and Jesse Hull
**************************************************************************/
/* Boehm, December 20, 1994 7:26 pm PST */
#include "gc_cpp.h"
void* operator new( size_t size ) {
return GC_MALLOC_UNCOLLECTABLE( size );}
void operator delete( void* obj ) {
GC_FREE( obj );}
#ifdef OPERATOR_NEW_ARRAY
void* operator new[]( size_t size ) {
return GC_MALLOC_UNCOLLECTABLE( size );}
void operator delete[]( void* obj ) {
GC_FREE( obj );}
#endif /* OPERATOR_NEW_ARRAY */

View File

@ -1,287 +0,0 @@
#ifndef GC_CPP_H
#define GC_CPP_H
/****************************************************************************
Copyright (c) 1994 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program for any
purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is
granted, provided the above notices are retained, and a notice that
the code was modified is included with the above copyright notice.
****************************************************************************
C++ Interface to the Boehm Collector
John R. Ellis and Jesse Hull
Last modified on Mon Jul 24 15:43:42 PDT 1995 by ellis
This interface provides access to the Boehm collector. It provides
basic facilities similar to those described in "Safe, Efficient
Garbage Collection for C++", by John R. Elis and David L. Detlefs
(ftp.parc.xerox.com:/pub/ellis/gc).
All heap-allocated objects are either "collectable" or
"uncollectable". Programs must explicitly delete uncollectable
objects, whereas the garbage collector will automatically delete
collectable objects when it discovers them to be inaccessible.
Collectable objects may freely point at uncollectable objects and vice
versa.
Objects allocated with the built-in "::operator new" are uncollectable.
Objects derived from class "gc" are collectable. For example:
class A: public gc {...};
A* a = new A; // a is collectable.
Collectable instances of non-class types can be allocated using the GC
placement:
typedef int A[ 10 ];
A* a = new (GC) A;
Uncollectable instances of classes derived from "gc" can be allocated
using the NoGC placement:
class A: public gc {...};
A* a = new (NoGC) A; // a is uncollectable.
Both uncollectable and collectable objects can be explicitly deleted
with "delete", which invokes an object's destructors and frees its
storage immediately.
A collectable object may have a clean-up function, which will be
invoked when the collector discovers the object to be inaccessible.
An object derived from "gc_cleanup" or containing a member derived
from "gc_cleanup" has a default clean-up function that invokes the
object's destructors. Explicit clean-up functions may be specified as
an additional placement argument:
A* a = ::new (GC, MyCleanup) A;
An object is considered "accessible" by the collector if it can be
reached by a path of pointers from static variables, automatic
variables of active functions, or from some object with clean-up
enabled; pointers from an object to itself are ignored.
Thus, if objects A and B both have clean-up functions, and A points at
B, B is considered accessible. After A's clean-up is invoked and its
storage released, B will then become inaccessible and will have its
clean-up invoked. If A points at B and B points to A, forming a
cycle, then that's considered a storage leak, and neither will be
collectable. See the interface gc.h for low-level facilities for
handling such cycles of objects with clean-up.
The collector cannot guarrantee that it will find all inaccessible
objects. In practice, it finds almost all of them.
Cautions:
1. Be sure the collector has been augmented with "make c++".
2. If your compiler supports the new "operator new[]" syntax, then
add -DOPERATOR_NEW_ARRAY to the Makefile.
If your compiler doesn't support "operator new[]", beware that an
array of type T, where T is derived from "gc", may or may not be
allocated as a collectable object (it depends on the compiler). Use
the explicit GC placement to make the array collectable. For example:
class A: public gc {...};
A* a1 = new A[ 10 ]; // collectable or uncollectable?
A* a2 = new (GC) A[ 10 ]; // collectable
3. The destructors of collectable arrays of objects derived from
"gc_cleanup" will not be invoked properly. For example:
class A: public gc_cleanup {...};
A* a = new (GC) A[ 10 ]; // destructors not invoked correctly
Typically, only the destructor for the first element of the array will
be invoked when the array is garbage-collected. To get all the
destructors of any array executed, you must supply an explicit
clean-up function:
A* a = new (GC, MyCleanUp) A[ 10 ];
(Implementing clean-up of arrays correctly, portably, and in a way
that preserves the correct exception semantics requires a language
extension, e.g. the "gc" keyword.)
4. Compiler bugs:
* Solaris 2's CC (SC3.0) doesn't implement t->~T() correctly, so the
destructors of classes derived from gc_cleanup won't be invoked.
You'll have to explicitly register a clean-up function with
new-placement syntax.
* Evidently cfront 3.0 does not allow destructors to be explicitly
invoked using the ANSI-conforming syntax t->~T(). If you're using
cfront 3.0, you'll have to comment out the class gc_cleanup, which
uses explicit invocation.
****************************************************************************/
#include "gc.h"
#ifndef THINK_CPLUS
#define _cdecl
#endif
#if ! defined( OPERATOR_NEW_ARRAY ) \
&& (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6))
# define OPERATOR_NEW_ARRAY
#endif
enum GCPlacement {GC, NoGC, PointerFreeGC};
class gc {public:
inline void* operator new( size_t size );
inline void* operator new( size_t size, GCPlacement gcp );
inline void operator delete( void* obj );
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[]( size_t size );
inline void* operator new[]( size_t size, GCPlacement gcp );
inline void operator delete[]( void* obj );
#endif /* OPERATOR_NEW_ARRAY */
};
/*
Instances of classes derived from "gc" will be allocated in the
collected heap by default, unless an explicit NoGC placement is
specified. */
class gc_cleanup: virtual public gc {public:
inline gc_cleanup();
inline virtual ~gc_cleanup();
private:
inline static void _cdecl cleanup( void* obj, void* clientData );};
/*
Instances of classes derived from "gc_cleanup" will be allocated
in the collected heap by default. When the collector discovers an
inaccessible object derived from "gc_cleanup" or containing a
member derived from "gc_cleanup", its destructors will be
invoked. */
extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
inline void* operator new(
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup = 0,
void* clientData = 0 );
/*
Allocates a collectable or uncollected object, according to the
value of "gcp".
For collectable objects, if "cleanup" is non-null, then when the
allocated object "obj" becomes inaccessible, the collector will
invoke the function "cleanup( obj, clientData )" but will not
invoke the object's destructors. It is an error to explicitly
delete an object allocated with a non-null "cleanup".
It is an error to specify a non-null "cleanup" with NoGC or for
classes derived from "gc_cleanup" or containing members derived
from "gc_cleanup". */
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[](
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup = 0,
void* clientData = 0 );
/*
The operator new for arrays, identical to the above. */
#endif /* OPERATOR_NEW_ARRAY */
/****************************************************************************
Inline implementation
****************************************************************************/
inline void* gc::operator new( size_t size ) {
return GC_MALLOC( size );}
inline void* gc::operator new( size_t size, GCPlacement gcp ) {
if (gcp == GC)
return GC_MALLOC( size );
else
return GC_MALLOC_UNCOLLECTABLE( size );}
inline void gc::operator delete( void* obj ) {
GC_FREE( obj );}
#ifdef OPERATOR_NEW_ARRAY
inline void* gc::operator new[]( size_t size ) {
return gc::operator new( size );}
inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
return gc::operator new( size, gcp );}
inline void gc::operator delete[]( void* obj ) {
gc::operator delete( obj );}
#endif /* OPERATOR_NEW_ARRAY */
inline gc_cleanup::~gc_cleanup() {
GC_REGISTER_FINALIZER_IGNORE_SELF( this, 0, 0, 0, 0 );}
inline void gc_cleanup::cleanup( void* obj, void* displ ) {
((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
inline gc_cleanup::gc_cleanup() {
GC_finalization_proc oldProc;
void* oldData;
void* base = GC_base( (void *) this );
if (0 == base) return;
GC_REGISTER_FINALIZER_IGNORE_SELF(
base, cleanup, (void*) ((char*) this - (char*) base),
&oldProc, &oldData );
if (0 != oldProc) {
GC_REGISTER_FINALIZER_IGNORE_SELF( base, oldProc, oldData, 0, 0 );}}
inline void* operator new(
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup,
void* clientData )
{
void* obj;
if (gcp == GC) {
obj = GC_MALLOC( size );
if (cleanup != 0)
GC_REGISTER_FINALIZER_IGNORE_SELF(
obj, cleanup, clientData, 0, 0 );}
else if (gcp == PointerFreeGC) {
obj = GC_MALLOC_ATOMIC( size );}
else {
obj = GC_MALLOC_UNCOLLECTABLE( size );};
return obj;}
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[](
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup,
void* clientData )
{
return ::operator new( size, gcp, cleanup, clientData );}
#endif /* OPERATOR_NEW_ARRAY */
#endif /* GC_CPP_H */

View File

@ -1,133 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, July 11, 1995 11:54 am PDT */
# ifndef GC_HEADERS_H
# define GC_HEADERS_H
typedef struct hblkhdr hdr;
# if CPP_WORDSZ != 32 && CPP_WORDSZ < 36
--> Get a real machine.
# endif
/*
* The 2 level tree data structure that is used to find block headers.
* If there are more than 32 bits in a pointer, the top level is a hash
* table.
*/
# if CPP_WORDSZ > 32
# define HASH_TL
# endif
/* Define appropriate out-degrees for each of the two tree levels */
# ifdef SMALL_CONFIG
# define LOG_BOTTOM_SZ 11
/* Keep top index size reasonable with smaller blocks. */
# else
# define LOG_BOTTOM_SZ 10
# endif
# ifndef HASH_TL
# define LOG_TOP_SZ (WORDSZ - LOG_BOTTOM_SZ - LOG_HBLKSIZE)
# else
# define LOG_TOP_SZ 11
# endif
# define TOP_SZ (1 << LOG_TOP_SZ)
# define BOTTOM_SZ (1 << LOG_BOTTOM_SZ)
typedef struct bi {
hdr * index[BOTTOM_SZ];
/*
* The bottom level index contains one of three kinds of values:
* 0 means we're not responsible for this block.
* 1 < (long)X <= MAX_JUMP means the block starts at least
* X * HBLKSIZE bytes before the current address.
* A valid pointer points to a hdr structure. (The above can't be
* valid pointers due to the GET_MEM return convention.)
*/
struct bi * asc_link; /* All indices are linked in */
/* ascending order. */
word key; /* high order address bits. */
# ifdef HASH_TL
struct bi * hash_link; /* Hash chain link. */
# endif
} bottom_index;
/* extern bottom_index GC_all_nils; - really part of GC_arrays */
/* extern bottom_index * GC_top_index []; - really part of GC_arrays */
/* Each entry points to a bottom_index. */
/* On a 32 bit machine, it points to */
/* the index for a set of high order */
/* bits equal to the index. For longer */
/* addresses, we hash the high order */
/* bits to compute the index in */
/* GC_top_index, and each entry points */
/* to a hash chain. */
/* The last entry in each chain is */
/* GC_all_nils. */
# define MAX_JUMP (HBLKSIZE - 1)
# define HDR_FROM_BI(bi, p) \
((bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)])
# ifndef HASH_TL
# define BI(p) (GC_top_index \
[(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE)])
# define HDR_INNER(p) HDR_FROM_BI(BI(p),p)
# ifdef SMALL_CONFIG
# define HDR(p) GC_find_header((ptr_t)(p))
# else
# define HDR(p) HDR_INNER(p)
# endif
# define GET_BI(p, bottom_indx) (bottom_indx) = BI(p)
# define GET_HDR(p, hhdr) (hhdr) = HDR(p)
# define SET_HDR(p, hhdr) HDR_INNER(p) = (hhdr)
# define GET_HDR_ADDR(p, ha) (ha) = &(HDR_INNER(p))
# else /* hash */
/* Hash function for tree top level */
# define TL_HASH(hi) ((hi) & (TOP_SZ - 1))
/* Set bottom_indx to point to the bottom index for address p */
# define GET_BI(p, bottom_indx) \
{ \
register word hi = \
(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
\
while (_bi -> key != hi && _bi != GC_all_nils) \
_bi = _bi -> hash_link; \
(bottom_indx) = _bi; \
}
# define GET_HDR_ADDR(p, ha) \
{ \
register bottom_index * bi; \
\
GET_BI(p, bi); \
(ha) = &(HDR_FROM_BI(bi, p)); \
}
# define GET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
(hhdr) = *_ha; }
# define SET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
*_ha = (hhdr); }
# define HDR(p) GC_find_header((ptr_t)(p))
# endif
/* Is the result a forwarding address to someplace closer to the */
/* beginning of the block or NIL? */
# define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((unsigned long) (hhdr) <= MAX_JUMP)
/* Get an HBLKSIZE aligned address closer to the beginning of the block */
/* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */
# define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (unsigned long)(hhdr))
# endif /* GC_HEADERS_H */

View File

@ -1,267 +0,0 @@
/*
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
/* Boehm, November 7, 1994 4:56 pm PST */
/*
* Declarations of mark stack. Needed by marker and client supplied mark
* routines. To be included after gc_priv.h.
*/
#ifndef GC_MARK_H
# define GC_MARK_H
/* A client supplied mark procedure. Returns new mark stack pointer. */
/* Primary effect should be to push new entries on the mark stack. */
/* Mark stack pointer values are passed and returned explicitly. */
/* Global variables decribing mark stack are not necessarily valid. */
/* (This usually saves a few cycles by keeping things in registers.) */
/* Assumed to scan about PROC_BYTES on average. If it needs to do */
/* much more work than that, it should do it in smaller pieces by */
/* pushing itself back on the mark stack. */
/* Note that it should always do some work (defined as marking some */
/* objects) before pushing more than one entry on the mark stack. */
/* This is required to ensure termination in the event of mark stack */
/* overflows. */
/* This procedure is always called with at least one empty entry on the */
/* mark stack. */
/* Currently we require that mark procedures look for pointers in a */
/* subset of the places the conservative marker would. It must be safe */
/* to invoke the normal mark procedure instead. */
# define PROC_BYTES 100
typedef struct ms_entry * (*mark_proc)(/* word * addr, mark_stack_ptr,
mark_stack_limit, env */);
# define LOG_MAX_MARK_PROCS 6
# define MAX_MARK_PROCS (1 << LOG_MAX_MARK_PROCS)
extern mark_proc GC_mark_procs[MAX_MARK_PROCS];
extern word GC_n_mark_procs;
/* Object descriptors on mark stack or in objects. Low order two */
/* bits are tags distinguishing among the following 4 possibilities */
/* for the high order 30 bits. */
#define DS_TAG_BITS 2
#define DS_TAGS ((1 << DS_TAG_BITS) - 1)
#define DS_LENGTH 0 /* The entire word is a length in bytes that */
/* must be a multiple of 4. */
#define DS_BITMAP 1 /* 30 bits are a bitmap describing pointer */
/* fields. The msb is 1 iff the first word */
/* is a pointer. */
/* (This unconventional ordering sometimes */
/* makes the marker slightly faster.) */
/* Zeroes indicate definite nonpointers. Ones */
/* indicate possible pointers. */
/* Only usable if pointers are word aligned. */
# define BITMAP_BITS (WORDSZ - DS_TAG_BITS)
#define DS_PROC 2
/* The objects referenced by this object can be */
/* pushed on the mark stack by invoking */
/* PROC(descr). ENV(descr) is passed as the */
/* last argument. */
# define PROC(descr) \
(GC_mark_procs[((descr) >> DS_TAG_BITS) & (MAX_MARK_PROCS-1)])
# define ENV(descr) \
((descr) >> (DS_TAG_BITS + LOG_MAX_MARK_PROCS))
# define MAX_ENV \
(((word)1 << (WORDSZ - DS_TAG_BITS - LOG_MAX_MARK_PROCS)) - 1)
# define MAKE_PROC(proc_index, env) \
(((((env) << LOG_MAX_MARK_PROCS) | (proc_index)) << DS_TAG_BITS) \
| DS_PROC)
#define DS_PER_OBJECT 3 /* The real descriptor is at the */
/* byte displacement from the beginning of the */
/* object given by descr & ~DS_TAGS */
typedef struct ms_entry {
word * mse_start; /* First word of object */
word mse_descr; /* Descriptor; low order two bits are tags, */
/* identifying the upper 30 bits as one of the */
/* following: */
} mse;
extern word GC_mark_stack_size;
extern mse * GC_mark_stack_top;
extern mse * GC_mark_stack;
word GC_find_start();
mse * GC_signal_mark_stack_overflow();
# ifdef GATHERSTATS
# define ADD_TO_ATOMIC(sz) GC_atomic_in_use += (sz)
# define ADD_TO_COMPOSITE(sz) GC_composite_in_use += (sz)
# else
# define ADD_TO_ATOMIC(sz)
# define ADD_TO_COMPOSITE(sz)
# endif
/* Push the object obj with corresponding heap block header hhdr onto */
/* the mark stack. */
# define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \
{ \
register word _descr = (hhdr) -> hb_descr; \
\
if (_descr == 0) { \
ADD_TO_ATOMIC((hhdr) -> hb_sz); \
} else { \
ADD_TO_COMPOSITE((hhdr) -> hb_sz); \
mark_stack_top++; \
if (mark_stack_top >= mark_stack_limit) { \
mark_stack_top = GC_signal_mark_stack_overflow(mark_stack_top); \
} \
mark_stack_top -> mse_start = (obj); \
mark_stack_top -> mse_descr = _descr; \
} \
}
#ifdef PRINT_BLACK_LIST
# define GC_FIND_START(current, hhdr, source) \
GC_find_start(current, hhdr, source)
#else
# define GC_FIND_START(current, hhdr, source) \
GC_find_start(current, hhdr)
#endif
/* Push the contents of current onto the mark stack if it is a valid */
/* ptr to a currently unmarked object. Mark it. */
/* If we assumed a standard-conforming compiler, we could probably */
/* generate the exit_label transparently. */
# define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \
source, exit_label) \
{ \
register int displ; /* Displacement in block; first bytes, then words */ \
register hdr * hhdr; \
register map_entry_type map_entry; \
\
GET_HDR(current,hhdr); \
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) { \
current = GC_FIND_START(current, hhdr, (word)source); \
if (current == 0) goto exit_label; \
hhdr = HDR(current); \
} \
displ = HBLKDISPL(current); \
map_entry = MAP_ENTRY((hhdr -> hb_map), displ); \
if (map_entry == OBJ_INVALID) { \
GC_ADD_TO_BLACK_LIST_NORMAL(current, source); goto exit_label; \
} \
displ = BYTES_TO_WORDS(displ); \
displ -= map_entry; \
\
{ \
register word * mark_word_addr = hhdr -> hb_marks + divWORDSZ(displ); \
register word mark_word = *mark_word_addr; \
register word mark_bit = (word)1 << modWORDSZ(displ); \
\
if (mark_word & mark_bit) { \
/* Mark bit is already set */ \
goto exit_label; \
} \
*mark_word_addr = mark_word | mark_bit; \
} \
PUSH_OBJ(((word *)(HBLKPTR(current)) + displ), hhdr, \
mark_stack_top, mark_stack_limit) \
exit_label: ; \
}
/*
* Push a single value onto mark stack. Mark from the object pointed to by p.
* GC_push_one is normally called by GC_push_regs, and thus must be defined.
* P is considered valid even if it is an interior pointer.
* Previously marked objects are not pushed. Hence we make progress even
* if the mark stack overflows.
*/
# define GC_PUSH_ONE_STACK(p) \
if ((ptr_t)(p) >= GC_least_plausible_heap_addr \
&& (ptr_t)(p) < GC_greatest_plausible_heap_addr) { \
GC_push_one_checked(p,TRUE); \
}
/*
* As above, but interior pointer recognition as for
* normal for heap pointers.
*/
# ifdef ALL_INTERIOR_POINTERS
# define AIP TRUE
# else
# define AIP FALSE
# endif
# define GC_PUSH_ONE_HEAP(p) \
if ((ptr_t)(p) >= GC_least_plausible_heap_addr \
&& (ptr_t)(p) < GC_greatest_plausible_heap_addr) { \
GC_push_one_checked(p,AIP); \
}
/*
* Mark from one finalizable object using the specified
* mark proc. May not mark the object pointed to by
* real_ptr. That is the job of the caller, if appropriate
*/
# define GC_MARK_FO(real_ptr, mark_proc) \
{ \
(*(mark_proc))(real_ptr); \
while (!GC_mark_stack_empty()) GC_mark_from_mark_stack(); \
if (GC_mark_state != MS_NONE) { \
GC_set_mark_bit(real_ptr); \
while (!GC_mark_some()); \
} \
}
extern GC_bool GC_mark_stack_too_small;
/* We need a larger mark stack. May be */
/* set by client supplied mark routines.*/
typedef int mark_state_t; /* Current state of marking, as follows:*/
/* Used to remember where we are during */
/* concurrent marking. */
/* We say something is dirty if it was */
/* written since the last time we */
/* retrieved dirty bits. We say it's */
/* grungy if it was marked dirty in the */
/* last set of bits we retrieved. */
/* Invariant I: all roots and marked */
/* objects p are either dirty, or point */
/* objects q that are either marked or */
/* a pointer to q appears in a range */
/* on the mark stack. */
# define MS_NONE 0 /* No marking in progress. I holds. */
/* Mark stack is empty. */
# define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */
/* being pushed. I holds, except */
/* that grungy roots may point to */
/* unmarked objects, as may marked */
/* grungy objects above scan_ptr. */
# define MS_PUSH_UNCOLLECTABLE 2
/* I holds, except that marked */
/* uncollectable objects above scan_ptr */
/* may point to unmarked objects. */
/* Roots may point to unmarked objects */
# define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */
# define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */
/* overflow. However marked heap */
/* objects below scan_ptr point to */
/* marked or stacked objects. */
# define MS_INVALID 5 /* I may not hold. */
extern mark_state_t GC_mark_state;
#endif /* GC_MARK_H */

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
# include "gc_priv.h"

View File

@ -1,91 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright 1996 Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Some simple primitives for allocation with explicit type information.
* Facilities for dynamic type inference may be added later.
* Should be used only for extremely performance critical applications,
* or if conservative collector leakage is otherwise a problem (unlikely).
* Note that this is implemented completely separately from the rest
* of the collector, and is not linked in unless referenced.
* This does not currently support GC_DEBUG in any interesting way.
*/
/* Boehm, May 19, 1994 2:13 pm PDT */
#ifndef _GC_TYPED_H
# define _GC_TYPED_H
# ifndef _GC_H
# include "gc.h"
# endif
typedef GC_word * GC_bitmap;
/* The least significant bit of the first word is one if */
/* the first word in the object may be a pointer. */
# define GC_get_bit(bm, index) \
(((bm)[divWORDSZ(index)] >> modWORDSZ(index)) & 1)
# define GC_set_bit(bm, index) \
(bm)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
typedef GC_word GC_descr;
GC_API GC_descr GC_make_descriptor GC_PROTO((GC_bitmap bm, size_t len));
/* Return a type descriptor for the object whose layout */
/* is described by the argument. */
/* The least significant bit of the first word is one */
/* if the first word in the object may be a pointer. */
/* The second argument specifies the number of */
/* meaningful bits in the bitmap. The actual object */
/* may be larger (but not smaller). Any additional */
/* words in the object are assumed not to contain */
/* pointers. */
/* Returns a conservative approximation in the */
/* (unlikely) case of insufficient memory to build */
/* the descriptor. Calls to GC_make_descriptor */
/* may consume some amount of a finite resource. This */
/* is intended to be called once per type, not once */
/* per allocation. */
GC_API GC_PTR GC_malloc_explicitly_typed
GC_PROTO((size_t size_in_bytes, GC_descr d));
/* Allocate an object whose layout is described by d. */
/* The resulting object MAY NOT BE PASSED TO REALLOC. */
GC_API GC_PTR GC_malloc_explicitly_typed_ignore_off_page
GC_PROTO((size_t size_in_bytes, GC_descr d));
GC_API GC_PTR GC_calloc_explicitly_typed
GC_PROTO((size_t nelements,
size_t element_size_in_bytes,
GC_descr d));
/* Allocate an array of nelements elements, each of the */
/* given size, and with the given descriptor. */
/* The elemnt size must be a multiple of the byte */
/* alignment required for pointers. E.g. on a 32-bit */
/* machine with 16-bit aligned pointers, size_in_bytes */
/* must be a multiple of 2. */
#ifdef GC_DEBUG
# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) GC_MALLOC(bytes)
# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes)
#else
# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) \
GC_malloc_explicitly_typed(bytes, d)
# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) \
GC_calloc_explicitly_typed(n, bytes, d)
#endif /* !GC_DEBUG */
#endif /* _GC_TYPED_H */

View File

@ -1,51 +0,0 @@
name gc_watcom
.386p
extrn _edata : byte ; end of DATA (start of BSS)
extrn _end : byte ; end of BSS (start of STACK)
extrn __nullarea : word
extrn "C",_STACKLOW : dword
extrn "C",_STACKTOP : dword
DGROUP group _DATA
_DATA segment dword public 'DATA'
_DATA ends
_TEXT segment para public use32 'CODE'
assume cs:_TEXT, ds:DGROUP, ss:DGROUP
public Get_DATASTART
align 4
Get_DATASTART proc near
mov eax,offset DGROUP:__nullarea
ret
Get_DATASTART endp
public Get_DATAEND
align 4
Get_DATAEND proc near
mov eax,offset DGROUP:_end
ret
Get_DATAEND endp
public Get_STACKBOTTOM
align 4
Get_STACKBOTTOM proc near
mov eax,_STACKTOP
ret
Get_STACKBOTTOM endp
_TEXT ends
end

View File

@ -1,516 +0,0 @@
/***************************************************************************
Interface between g++ and Boehm GC
Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to copy this code for any purpose,
provided the above notices are retained on all copies.
Last modified on Sun Jul 16 23:21:14 PDT 1995 by ellis
This module provides runtime support for implementing the
Ellis/Detlefs GC proposal, "Safe, Efficient Garbage Collection for
C++", within g++, using its -fgc-keyword extension. It defines
versions of __builtin_new, __builtin_new_gc, __builtin_vec_new,
__builtin_vec_new_gc, __builtin_delete, and __builtin_vec_delete that
invoke the Bohem GC. It also implements the WeakPointer.h interface.
This module assumes the following configuration options of the Boehm GC:
-DALL_INTERIOR_POINTERS
-DDONT_ADD_BYTE_AT_END
This module adds its own required padding to the end of objects to
support C/C++ "one-past-the-object" pointer semantics.
****************************************************************************/
#include <stddef.h>
#include "gc.h"
#if defined(__STDC__)
# define PROTO( args ) args
#else
# define PROTO( args ) ()
# endif
#define BITSPERBYTE 8
/* What's the portable way to do this? */
typedef void (*vfp) PROTO(( void ));
extern vfp __new_handler;
extern void __default_new_handler PROTO(( void ));
/* A destructor_proc is the compiler generated procedure representing a
C++ destructor. The "flag" argument is a hidden argument following some
compiler convention. */
typedef (*destructor_proc) PROTO(( void* this, int flag ));
/***************************************************************************
A BI_header is the header the compiler adds to the front of
new-allocated arrays of objects with destructors. The header is
padded out to a double, because that's what the compiler does to
ensure proper alignment of array elements on some architectures.
int NUM_ARRAY_ELEMENTS (void* o)
returns the number of array elements for array object o.
char* FIRST_ELEMENT_P (void* o)
returns the address of the first element of array object o.
***************************************************************************/
typedef struct BI_header {
int nelts;
char padding [sizeof( double ) - sizeof( int )];
/* Better way to do this? */
} BI_header;
#define NUM_ARRAY_ELEMENTS( o ) \
(((BI_header*) o)->nelts)
#define FIRST_ELEMENT_P( o ) \
((char*) o + sizeof( BI_header ))
/***************************************************************************
The __builtin_new routines add a descriptor word to the end of each
object. The descriptor serves two purposes.
First, the descriptor acts as padding, implementing C/C++ pointer
semantics. C and C++ allow a valid array pointer to be incremented
one past the end of an object. The extra padding ensures that the
collector will recognize that such a pointer points to the object and
not the next object in memory.
Second, the descriptor stores three extra pieces of information,
whether an object has a registered finalizer (destructor), whether it
may have any weak pointers referencing it, and for collectible arrays,
the element size of the array. The element size is required for the
array's finalizer to iterate through the elements of the array. (An
alternative design would have the compiler generate a finalizer
procedure for each different array type. But given the overhead of
finalization, there isn't any efficiency to be gained by that.)
The descriptor must be added to non-collectible as well as collectible
objects, since the Ellis/Detlefs proposal allows "pointer to gc T" to
be assigned to a "pointer to T", which could then be deleted. Thus,
__builtin_delete must determine at runtime whether an object is
collectible, whether it has weak pointers referencing it, and whether
it may have a finalizer that needs unregistering. Though
GC_REGISTER_FINALIZER doesn't care if you ask it to unregister a
finalizer for an object that doesn't have one, it is a non-trivial
procedure that does a hash look-up, etc. The descriptor trades a
little extra space for a significant increase in time on the fast path
through delete. (A similar argument applies to
GC_UNREGISTER_DISAPPEARING_LINK).
For non-array types, the space for the descriptor could be shrunk to a
single byte for storing the "has finalizer" flag. But this would save
space only on arrays of char (whose size is not a multiple of the word
size) and structs whose largest member is less than a word in size
(very infrequent). And it would require that programmers actually
remember to call "delete[]" instead of "delete" (which they should,
but there are probably lots of buggy programs out there). For the
moment, the space savings seems not worthwhile, especially considering
that the Boehm GC is already quite space competitive with other
malloc's.
Given a pointer o to the base of an object:
Descriptor* DESCRIPTOR (void* o)
returns a pointer to the descriptor for o.
The implementation of descriptors relies on the fact that the GC
implementation allocates objects in units of the machine's natural
word size (e.g. 32 bits on a SPARC, 64 bits on an Alpha).
**************************************************************************/
typedef struct Descriptor {
unsigned has_weak_pointers: 1;
unsigned has_finalizer: 1;
unsigned element_size: BITSPERBYTE * sizeof( unsigned ) - 2;
} Descriptor;
#define DESCRIPTOR( o ) \
((Descriptor*) ((char*)(o) + GC_size( o ) - sizeof( Descriptor )))
/**************************************************************************
Implementations of global operator new() and operator delete()
***************************************************************************/
void* __builtin_new( size )
size_t size;
/*
For non-gc non-array types, the compiler generates calls to
__builtin_new, which allocates non-collected storage via
GC_MALLOC_UNCOLLECTABLE. This ensures that the non-collected
storage will be part of the collector's root set, required by the
Ellis/Detlefs semantics. */
{
vfp handler = __new_handler ? __new_handler : __default_new_handler;
while (1) {
void* o = GC_MALLOC_UNCOLLECTABLE( size + sizeof( Descriptor ) );
if (o != 0) return o;
(*handler) ();}}
void* __builtin_vec_new( size )
size_t size;
/*
For non-gc array types, the compiler generates calls to
__builtin_vec_new. */
{
return __builtin_new( size );}
void* __builtin_new_gc( size )
size_t size;
/*
For gc non-array types, the compiler generates calls to
__builtin_new_gc, which allocates collected storage via
GC_MALLOC. */
{
vfp handler = __new_handler ? __new_handler : __default_new_handler;
while (1) {
void* o = GC_MALLOC( size + sizeof( Descriptor ) );
if (o != 0) return o;
(*handler) ();}}
void* __builtin_new_gc_a( size )
size_t size;
/*
For non-pointer-containing gc non-array types, the compiler
generates calls to __builtin_new_gc_a, which allocates collected
storage via GC_MALLOC_ATOMIC. */
{
vfp handler = __new_handler ? __new_handler : __default_new_handler;
while (1) {
void* o = GC_MALLOC_ATOMIC( size + sizeof( Descriptor ) );
if (o != 0) return o;
(*handler) ();}}
void* __builtin_vec_new_gc( size )
size_t size;
/*
For gc array types, the compiler generates calls to
__builtin_vec_new_gc. */
{
return __builtin_new_gc( size );}
void* __builtin_vec_new_gc_a( size )
size_t size;
/*
For non-pointer-containing gc array types, the compiler generates
calls to __builtin_vec_new_gc_a. */
{
return __builtin_new_gc_a( size );}
static void call_destructor( o, data )
void* o;
void* data;
/*
call_destructor is the GC finalizer proc registered for non-array
gc objects with destructors. Its client data is the destructor
proc, which it calls with the magic integer 2, a special flag
obeying the compiler convention for destructors. */
{
((destructor_proc) data)( o, 2 );}
void* __builtin_new_gc_dtor( o, d )
void* o;
destructor_proc d;
/*
The compiler generates a call to __builtin_new_gc_dtor to register
the destructor "d" of a non-array gc object "o" as a GC finalizer.
The destructor is registered via
GC_REGISTER_FINALIZER_IGNORE_SELF, which causes the collector to
ignore pointers from the object to itself when determining when
the object can be finalized. This is necessary due to the self
pointers used in the internal representation of multiply-inherited
objects. */
{
Descriptor* desc = DESCRIPTOR( o );
GC_REGISTER_FINALIZER_IGNORE_SELF( o, call_destructor, d, 0, 0 );
desc->has_finalizer = 1;}
static void call_array_destructor( o, data )
void* o;
void* data;
/*
call_array_destructor is the GC finalizer proc registered for gc
array objects whose elements have destructors. Its client data is
the destructor proc. It iterates through the elements of the
array in reverse order, calling the destructor on each. */
{
int num = NUM_ARRAY_ELEMENTS( o );
Descriptor* desc = DESCRIPTOR( o );
size_t size = desc->element_size;
char* first_p = FIRST_ELEMENT_P( o );
char* p = first_p + (num - 1) * size;
if (num > 0) {
while (1) {
((destructor_proc) data)( p, 2 );
if (p == first_p) break;
p -= size;}}}
void* __builtin_vec_new_gc_dtor( first_elem, d, element_size )
void* first_elem;
destructor_proc d;
size_t element_size;
/*
The compiler generates a call to __builtin_vec_new_gc_dtor to
register the destructor "d" of a gc array object as a GC
finalizer. "first_elem" points to the first element of the array,
*not* the beginning of the object (this makes the generated call
to this function smaller). The elements of the array are of size
"element_size". The destructor is registered as in
_builtin_new_gc_dtor. */
{
void* o = (char*) first_elem - sizeof( BI_header );
Descriptor* desc = DESCRIPTOR( o );
GC_REGISTER_FINALIZER_IGNORE_SELF( o, call_array_destructor, d, 0, 0 );
desc->element_size = element_size;
desc->has_finalizer = 1;}
void __builtin_delete( o )
void* o;
/*
The compiler generates calls to __builtin_delete for operator
delete(). The GC currently requires that any registered
finalizers be unregistered before explicitly freeing an object.
If the object has any weak pointers referencing it, we can't
actually free it now. */
{
if (o != 0) {
Descriptor* desc = DESCRIPTOR( o );
if (desc->has_finalizer) GC_REGISTER_FINALIZER( o, 0, 0, 0, 0 );
if (! desc->has_weak_pointers) GC_FREE( o );}}
void __builtin_vec_delete( o )
void* o;
/*
The compiler generates calls to __builitn_vec_delete for operator
delete[](). */
{
__builtin_delete( o );}
/**************************************************************************
Implementations of the template class WeakPointer from WeakPointer.h
***************************************************************************/
typedef struct WeakPointer {
void* pointer;
} WeakPointer;
void* _WeakPointer_New( t )
void* t;
{
if (t == 0) {
return 0;}
else {
void* base = GC_base( t );
WeakPointer* wp =
(WeakPointer*) GC_MALLOC_ATOMIC( sizeof( WeakPointer ) );
Descriptor* desc = DESCRIPTOR( base );
wp->pointer = t;
desc->has_weak_pointers = 1;
GC_general_register_disappearing_link( &wp->pointer, base );
return wp;}}
static void* PointerWithLock( wp )
WeakPointer* wp;
{
if (wp == 0 || wp->pointer == 0) {
return 0;}
else {
return (void*) wp->pointer;}}
void* _WeakPointer_Pointer( wp )
WeakPointer* wp;
{
return (void*) GC_call_with_alloc_lock( PointerWithLock, wp );}
typedef struct EqualClosure {
WeakPointer* wp1;
WeakPointer* wp2;
} EqualClosure;
static void* EqualWithLock( ec )
EqualClosure* ec;
{
if (ec->wp1 == 0 || ec->wp2 == 0) {
return (void*) (ec->wp1 == ec->wp2);}
else {
return (void*) (ec->wp1->pointer == ec->wp2->pointer);}}
int _WeakPointer_Equal( wp1, wp2 )
WeakPointer* wp1;
WeakPointer* wp2;
{
EqualClosure ec;
ec.wp1 = wp1;
ec.wp2 = wp2;
return (int) GC_call_with_alloc_lock( EqualWithLock, &ec );}
int _WeakPointer_Hash( wp )
WeakPointer* wp;
{
return (int) _WeakPointer_Pointer( wp );}
/**************************************************************************
Implementations of the template class CleanUp from WeakPointer.h
***************************************************************************/
typedef struct Closure {
void (*c) PROTO(( void* d, void* t ));
ptrdiff_t t_offset;
void* d;
} Closure;
static void _CleanUp_CallClosure( obj, data )
void* obj;
void* data;
{
Closure* closure = (Closure*) data;
closure->c( closure->d, (char*) obj + closure->t_offset );}
void _CleanUp_Set( t, c, d )
void* t;
void (*c) PROTO(( void* d, void* t ));
void* d;
{
void* base = GC_base( t );
Descriptor* desc = DESCRIPTOR( t );
if (c == 0) {
GC_REGISTER_FINALIZER_IGNORE_SELF( base, 0, 0, 0, 0 );
desc->has_finalizer = 0;}
else {
Closure* closure = (Closure*) GC_MALLOC( sizeof( Closure ) );
closure->c = c;
closure->t_offset = (char*) t - (char*) base;
closure->d = d;
GC_REGISTER_FINALIZER_IGNORE_SELF( base, _CleanUp_CallClosure,
closure, 0, 0 );
desc->has_finalizer = 1;}}
void _CleanUp_Call( t )
void* t;
{
/* ? Aren't we supposed to deactivate weak pointers to t too?
Why? */
void* base = GC_base( t );
void* d;
GC_finalization_proc f;
GC_REGISTER_FINALIZER( base, 0, 0, &f, &d );
f( base, d );}
typedef struct QueueElem {
void* o;
GC_finalization_proc f;
void* d;
struct QueueElem* next;
} QueueElem;
void* _CleanUp_Queue_NewHead()
{
return GC_MALLOC( sizeof( QueueElem ) );}
static void _CleanUp_Queue_Enqueue( obj, data )
void* obj;
void* data;
{
QueueElem* q = (QueueElem*) data;
QueueElem* head = q->next;
q->o = obj;
q->next = head->next;
head->next = q;}
void _CleanUp_Queue_Set( h, t )
void* h;
void* t;
{
QueueElem* head = (QueueElem*) h;
void* base = GC_base( t );
void* d;
GC_finalization_proc f;
QueueElem* q = (QueueElem*) GC_MALLOC( sizeof( QueueElem ) );
GC_REGISTER_FINALIZER( base, _CleanUp_Queue_Enqueue, q, &f, &d );
q->f = f;
q->d = d;
q->next = head;}
int _CleanUp_Queue_Call( h )
void* h;
{
QueueElem* head = (QueueElem*) h;
QueueElem* q = head->next;
if (q == 0) {
return 0;}
else {
head->next = q->next;
q->next = 0;
if (q->f != 0) q->f( q->o, q->d );
return 1;}}

View File

@ -1,296 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* This implements:
* 1. allocation of heap block headers
* 2. A map from addresses to heap block addresses to heap block headers
*
* Access speed is crucial. We implement an index structure based on a 2
* level tree.
*/
# include "gc_priv.h"
bottom_index * GC_all_bottom_indices = 0;
/* Non-macro version of header location routine */
hdr * GC_find_header(h)
ptr_t h;
{
# ifdef HASH_TL
register hdr * result;
GET_HDR(h, result);
return(result);
# else
return(HDR_INNER(h));
# endif
}
/* Routines to dynamically allocate collector data structures that will */
/* never be freed. */
static ptr_t scratch_free_ptr = 0;
ptr_t GC_scratch_end_ptr = 0;
ptr_t GC_scratch_last_end_ptr = 0;
/* End point of last obtained scratch area */
ptr_t GC_scratch_alloc(bytes)
register word bytes;
{
register ptr_t result = scratch_free_ptr;
register word bytes_needed = bytes;
# ifdef ALIGN_DOUBLE
# define GRANULARITY (2 * sizeof(word))
# else
# define GRANULARITY sizeof(word)
# endif
bytes += GRANULARITY-1;
bytes &= ~(GRANULARITY-1);
scratch_free_ptr += bytes;
if (scratch_free_ptr <= GC_scratch_end_ptr) {
return(result);
}
{
word bytes_to_get = MINHINCR * HBLKSIZE;
if (bytes_to_get <= bytes) {
/* Undo the damage, and get memory directly */
bytes_to_get = bytes;
# ifdef USE_MMAP
bytes_to_get += GC_page_size - 1;
bytes_to_get &= ~(GC_page_size - 1);
# endif
result = (ptr_t)GET_MEM(bytes_to_get);
scratch_free_ptr -= bytes;
GC_scratch_last_end_ptr = result + bytes;
return(result);
}
result = (ptr_t)GET_MEM(bytes_to_get);
if (result == 0) {
# ifdef PRINTSTATS
GC_printf0("Out of memory - trying to allocate less\n");
# endif
scratch_free_ptr -= bytes;
bytes_to_get = bytes;
# ifdef USE_MMAP
bytes_to_get += GC_page_size - 1;
bytes_to_get &= (GC_page_size - 1);
# endif
return((ptr_t)GET_MEM(bytes_to_get));
}
scratch_free_ptr = result;
GC_scratch_end_ptr = scratch_free_ptr + bytes_to_get;
GC_scratch_last_end_ptr = GC_scratch_end_ptr;
return(GC_scratch_alloc(bytes));
}
}
static hdr * hdr_free_list = 0;
/* Return an uninitialized header */
static hdr * alloc_hdr()
{
register hdr * result;
if (hdr_free_list == 0) {
result = (hdr *) GC_scratch_alloc((word)(sizeof(hdr)));
} else {
result = hdr_free_list;
hdr_free_list = (hdr *) (result -> hb_next);
}
return(result);
}
static void free_hdr(hhdr)
hdr * hhdr;
{
hhdr -> hb_next = (struct hblk *) hdr_free_list;
hdr_free_list = hhdr;
}
void GC_init_headers()
{
register int i;
GC_all_nils = (bottom_index *)GC_scratch_alloc((word)sizeof(bottom_index));
BZERO(GC_all_nils, sizeof(bottom_index));
for (i = 0; i < TOP_SZ; i++) {
GC_top_index[i] = GC_all_nils;
}
}
/* Make sure that there is a bottom level index block for address addr */
/* Return FALSE on failure. */
static GC_bool get_index(addr)
register word addr;
{
register word hi =
(word)(addr) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
register bottom_index * r;
register bottom_index * p;
register bottom_index ** prev;
# ifdef HASH_TL
register unsigned i = TL_HASH(hi);
register bottom_index * old;
old = p = GC_top_index[i];
while(p != GC_all_nils) {
if (p -> key == hi) return(TRUE);
p = p -> hash_link;
}
r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index)));
if (r == 0) return(FALSE);
BZERO(r, sizeof (bottom_index));
r -> hash_link = old;
GC_top_index[i] = r;
# else
if (GC_top_index[hi] != GC_all_nils) return(TRUE);
r = (bottom_index*)GC_scratch_alloc((word)(sizeof (bottom_index)));
if (r == 0) return(FALSE);
GC_top_index[hi] = r;
BZERO(r, sizeof (bottom_index));
# endif
r -> key = hi;
/* Add it to the list of bottom indices */
prev = &GC_all_bottom_indices;
while ((p = *prev) != 0 && p -> key < hi) prev = &(p -> asc_link);
r -> asc_link = p;
*prev = r;
return(TRUE);
}
/* Install a header for block h. */
/* The header is uninitialized. */
/* Returns FALSE on failure. */
GC_bool GC_install_header(h)
register struct hblk * h;
{
hdr * result;
if (!get_index((word) h)) return(FALSE);
result = alloc_hdr();
SET_HDR(h, result);
return(result != 0);
}
/* Set up forwarding counts for block h of size sz */
GC_bool GC_install_counts(h, sz)
register struct hblk * h;
register word sz; /* bytes */
{
register struct hblk * hbp;
register int i;
for (hbp = h; (char *)hbp < (char *)h + sz; hbp += BOTTOM_SZ) {
if (!get_index((word) hbp)) return(FALSE);
}
if (!get_index((word)h + sz - 1)) return(FALSE);
for (hbp = h + 1; (char *)hbp < (char *)h + sz; hbp += 1) {
i = HBLK_PTR_DIFF(hbp, h);
SET_HDR(hbp, (hdr *)(i > MAX_JUMP? MAX_JUMP : i));
}
return(TRUE);
}
/* Remove the header for block h */
void GC_remove_header(h)
register struct hblk * h;
{
hdr ** ha;
GET_HDR_ADDR(h, ha);
free_hdr(*ha);
*ha = 0;
}
/* Remove forwarding counts for h */
void GC_remove_counts(h, sz)
register struct hblk * h;
register word sz; /* bytes */
{
register struct hblk * hbp;
for (hbp = h+1; (char *)hbp < (char *)h + sz; hbp += 1) {
SET_HDR(hbp, 0);
}
}
/* Apply fn to all allocated blocks */
/*VARARGS1*/
void GC_apply_to_all_blocks(fn, client_data)
void (*fn)(/* struct hblk *h, word client_data */);
word client_data;
{
register int j;
register bottom_index * index_p;
for (index_p = GC_all_bottom_indices; index_p != 0;
index_p = index_p -> asc_link) {
for (j = BOTTOM_SZ-1; j >= 0;) {
if (!IS_FORWARDING_ADDR_OR_NIL(index_p->index[j])) {
if (index_p->index[j]->hb_map != GC_invalid_map) {
(*fn)(((struct hblk *)
(((index_p->key << LOG_BOTTOM_SZ) + (word)j)
<< LOG_HBLKSIZE)),
client_data);
}
j--;
} else if (index_p->index[j] == 0) {
j--;
} else {
j -= (word)(index_p->index[j]);
}
}
}
}
/* Get the next valid block whose address is at least h */
/* Return 0 if there is none. */
struct hblk * GC_next_block(h)
struct hblk * h;
{
register bottom_index * bi;
register word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1);
GET_BI(h, bi);
if (bi == GC_all_nils) {
register word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
bi = GC_all_bottom_indices;
while (bi != 0 && bi -> key < hi) bi = bi -> asc_link;
j = 0;
}
while(bi != 0) {
while (j < BOTTOM_SZ) {
if (IS_FORWARDING_ADDR_OR_NIL(bi -> index[j])) {
j++;
} else {
if (bi->index[j]->hb_map != GC_invalid_map) {
return((struct hblk *)
(((bi -> key << LOG_BOTTOM_SZ) + j)
<< LOG_HBLKSIZE));
} else {
j += divHBLKSZ(bi->index[j] -> hb_sz);
}
}
}
j = 0;
bi = bi -> asc_link;
}
return(0);
}

View File

@ -1,25 +0,0 @@
/* Conditionally execute a command based on machine and OS from config.h */
/* Boehm, November 21, 1994 1:40 pm PST */
# include "config.h"
# include <stdio.h>
int main(argc, argv, envp)
int argc;
char ** argv;
char ** envp;
{
if (argc < 4) goto Usage;
if (strcmp(MACH_TYPE, argv[1]) != 0) return(0);
if (strcmp(OS_TYPE, "") != 0 && strcmp(argv[2], "") != 0
&& strcmp(OS_TYPE, argv[2]) != 0) return(0);
printf("^^^^Starting command^^^^\n");
execvp(argv[3], argv+3);
perror("Couldn't execute");
Usage:
fprintf(stderr, "Usage: %s mach_type os_type command\n", argv[0]);
fprintf(stderr, "Currently mach_type = %s, os_type = %s\n",
MACH_TYPE, OS_TYPE);
return(1);
}

View File

@ -1,26 +0,0 @@
/* Conditionally execute a command based if the file argv[1] doesn't exist */
/* Except for execvp, we stick to ANSI C. */
# include "config.h"
# include <stdio.h>
int main(argc, argv, envp)
int argc;
char ** argv;
char ** envp;
{
FILE * f;
if (argc < 3) goto Usage;
if ((f = fopen(argv[1], "rb")) != 0
|| (f = fopen(argv[1], "r")) != 0) {
fclose(f);
return(0);
}
printf("^^^^Starting command^^^^\n");
execvp(argv[2], argv+2);
exit(1);
Usage:
fprintf(stderr, "Usage: %s file_name command\n", argv[0]);
return(1);
}

View File

@ -1,327 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
* Author: Hans-J. Boehm (boehm@parc.xerox.com)
*/
/* Boehm, October 5, 1995 4:20 pm PDT */
/*
* Cords are immutable character strings. A number of operations
* on long cords are much more efficient than their strings.h counterpart.
* In particular, concatenation takes constant time independent of the length
* of the arguments. (Cords are represented as trees, with internal
* nodes representing concatenation and leaves consisting of either C
* strings or a functional description of the string.)
*
* The following are reasonable applications of cords. They would perform
* unacceptably if C strings were used:
* - A compiler that produces assembly language output by repeatedly
* concatenating instructions onto a cord representing the output file.
* - A text editor that converts the input file to a cord, and then
* performs editing operations by producing a new cord representing
* the file after echa character change (and keeping the old ones in an
* edit history)
*
* For optimal performance, cords should be built by
* concatenating short sections.
* This interface is designed for maximum compatibility with C strings.
* ASCII NUL characters may be embedded in cords using CORD_from_fn.
* This is handled correctly, but CORD_to_char_star will produce a string
* with embedded NULs when given such a cord.
*
* This interface is fairly big, largely for performance reasons.
* The most basic constants and functions:
*
* CORD - the type fo a cord;
* CORD_EMPTY - empty cord;
* CORD_len(cord) - length of a cord;
* CORD_cat(cord1,cord2) - concatenation of two cords;
* CORD_substr(cord, start, len) - substring (or subcord);
* CORD_pos i; CORD_FOR(i, cord) { ... CORD_pos_fetch(i) ... } -
* examine each character in a cord. CORD_pos_fetch(i) is the char.
* CORD_fetch(int i) - Retrieve i'th character (slowly).
* CORD_cmp(cord1, cord2) - compare two cords.
* CORD_from_file(FILE * f) - turn a read-only file into a cord.
* CORD_to_char_star(cord) - convert to C string.
* (Non-NULL C constant strings are cords.)
* CORD_printf (etc.) - cord version of printf. Use %r for cords.
*/
# ifndef CORD_H
# define CORD_H
# include <stddef.h>
# include <stdio.h>
/* Cords have type const char *. This is cheating quite a bit, and not */
/* 100% portable. But it means that nonempty character string */
/* constants may be used as cords directly, provided the string is */
/* never modified in place. The empty cord is represented by, and */
/* can be written as, 0. */
typedef const char * CORD;
/* An empty cord is always represented as nil */
# define CORD_EMPTY 0
/* Is a nonempty cord represented as a C string? */
#define CORD_IS_STRING(s) (*(s) != '\0')
/* Concatenate two cords. If the arguments are C strings, they may */
/* not be subsequently altered. */
CORD CORD_cat(CORD x, CORD y);
/* Concatenate a cord and a C string with known length. Except for the */
/* empty string case, this is a special case of CORD_cat. Since the */
/* length is known, it can be faster. */
/* The string y is shared with the resulting CORD. Hence it should */
/* not be altered by the caller. */
CORD CORD_cat_char_star(CORD x, const char * y, size_t leny);
/* Compute the length of a cord */
size_t CORD_len(CORD x);
/* Cords may be represented by functions defining the ith character */
typedef char (* CORD_fn)(size_t i, void * client_data);
/* Turn a functional description into a cord. */
CORD CORD_from_fn(CORD_fn fn, void * client_data, size_t len);
/* Return the substring (subcord really) of x with length at most n, */
/* starting at position i. (The initial character has position 0.) */
CORD CORD_substr(CORD x, size_t i, size_t n);
/* Return the argument, but rebalanced to allow more efficient */
/* character retrieval, substring operations, and comparisons. */
/* This is useful only for cords that were built using repeated */
/* concatenation. Guarantees log time access to the result, unless */
/* x was obtained through a large number of repeated substring ops */
/* or the embedded functional descriptions take longer to evaluate. */
/* May reallocate significant parts of the cord. The argument is not */
/* modified; only the result is balanced. */
CORD CORD_balance(CORD x);
/* The following traverse a cord by applying a function to each */
/* character. This is occasionally appropriate, especially where */
/* speed is crucial. But, since C doesn't have nested functions, */
/* clients of this sort of traversal are clumsy to write. Consider */
/* the functions that operate on cord positions instead. */
/* Function to iteratively apply to individual characters in cord. */
typedef int (* CORD_iter_fn)(char c, void * client_data);
/* Function to apply to substrings of a cord. Each substring is a */
/* a C character string, not a general cord. */
typedef int (* CORD_batched_iter_fn)(const char * s, void * client_data);
# define CORD_NO_FN ((CORD_batched_iter_fn)0)
/* Apply f1 to each character in the cord, in ascending order, */
/* starting at position i. If */
/* f2 is not CORD_NO_FN, then multiple calls to f1 may be replaced by */
/* a single call to f2. The parameter f2 is provided only to allow */
/* some optimization by the client. This terminates when the right */
/* end of this string is reached, or when f1 or f2 return != 0. In the */
/* latter case CORD_iter returns != 0. Otherwise it returns 0. */
/* The specified value of i must be < CORD_len(x). */
int CORD_iter5(CORD x, size_t i, CORD_iter_fn f1,
CORD_batched_iter_fn f2, void * client_data);
/* A simpler version that starts at 0, and without f2: */
int CORD_iter(CORD x, CORD_iter_fn f1, void * client_data);
# define CORD_iter(x, f1, cd) CORD_iter5(x, 0, f1, CORD_NO_FN, cd)
/* Similar to CORD_iter5, but end-to-beginning. No provisions for */
/* CORD_batched_iter_fn. */
int CORD_riter4(CORD x, size_t i, CORD_iter_fn f1, void * client_data);
/* A simpler version that starts at the end: */
int CORD_riter(CORD x, CORD_iter_fn f1, void * client_data);
/* Functions that operate on cord positions. The easy way to traverse */
/* cords. A cord position is logically a pair consisting of a cord */
/* and an index into that cord. But it is much faster to retrieve a */
/* charcter based on a position than on an index. Unfortunately, */
/* positions are big (order of a few 100 bytes), so allocate them with */
/* caution. */
/* Things in cord_pos.h should be treated as opaque, except as */
/* described below. Also note that */
/* CORD_pos_fetch, CORD_next and CORD_prev have both macro and function */
/* definitions. The former may evaluate their argument more than once. */
# include "private/cord_pos.h"
/*
Visible definitions from above:
typedef <OPAQUE but fairly big> CORD_pos[1];
* Extract the cord from a position:
CORD CORD_pos_to_cord(CORD_pos p);
* Extract the current index from a position:
size_t CORD_pos_to_index(CORD_pos p);
* Fetch the character located at the given position:
char CORD_pos_fetch(CORD_pos p);
* Initialize the position to refer to the given cord and index.
* Note that this is the most expensive function on positions:
void CORD_set_pos(CORD_pos p, CORD x, size_t i);
* Advance the position to the next character.
* P must be initialized and valid.
* Invalidates p if past end:
void CORD_next(CORD_pos p);
* Move the position to the preceding character.
* P must be initialized and valid.
* Invalidates p if past beginning:
void CORD_prev(CORD_pos p);
* Is the position valid, i.e. inside the cord?
int CORD_pos_valid(CORD_pos p);
*/
# define CORD_FOR(pos, cord) \
for (CORD_set_pos(pos, cord, 0); CORD_pos_valid(pos); CORD_next(pos))
/* An out of memory handler to call. May be supplied by client. */
/* Must not return. */
extern void (* CORD_oom_fn)(void);
/* Dump the representation of x to stdout in an implementation defined */
/* manner. Intended for debugging only. */
void CORD_dump(CORD x);
/* The following could easily be implemented by the client. They are */
/* provided in cordxtra.c for convenience. */
/* Concatenate a character to the end of a cord. */
CORD CORD_cat_char(CORD x, char c);
/* Concatenate n cords. */
CORD CORD_catn(int n, /* CORD */ ...);
/* Return the character in CORD_substr(x, i, 1) */
char CORD_fetch(CORD x, size_t i);
/* Return < 0, 0, or > 0, depending on whether x < y, x = y, x > y */
int CORD_cmp(CORD x, CORD y);
/* A generalization that takes both starting positions for the */
/* comparison, and a limit on the number of characters to be compared. */
int CORD_ncmp(CORD x, size_t x_start, CORD y, size_t y_start, size_t len);
/* Find the first occurrence of s in x at position start or later. */
/* Return the position of the first character of s in x, or */
/* CORD_NOT_FOUND if there is none. */
size_t CORD_str(CORD x, size_t start, CORD s);
/* Return a cord consisting of i copies of (possibly NUL) c. Dangerous */
/* in conjunction with CORD_to_char_star. */
/* The resulting representation takes constant space, independent of i. */
CORD CORD_chars(char c, size_t i);
# define CORD_nul(i) CORD_chars('\0', (i))
/* Turn a file into cord. The file must be seekable. Its contents */
/* must remain constant. The file may be accessed as an immediate */
/* result of this call and/or as a result of subsequent accesses to */
/* the cord. Short files are likely to be immediately read, but */
/* long files are likely to be read on demand, possibly relying on */
/* stdio for buffering. */
/* We must have exclusive access to the descriptor f, i.e. we may */
/* read it at any time, and expect the file pointer to be */
/* where we left it. Normally this should be invoked as */
/* CORD_from_file(fopen(...)) */
/* CORD_from_file arranges to close the file descriptor when it is no */
/* longer needed (e.g. when the result becomes inaccessible). */
/* The file f must be such that ftell reflects the actual character */
/* position in the file, i.e. the number of characters that can be */
/* or were read with fread. On UNIX systems this is always true. On */
/* MS Windows systems, f must be opened in binary mode. */
CORD CORD_from_file(FILE * f);
/* Equivalent to the above, except that the entire file will be read */
/* and the file pointer will be closed immediately. */
/* The binary mode restriction from above does not apply. */
CORD CORD_from_file_eager(FILE * f);
/* Equivalent to the above, except that the file will be read on demand.*/
/* The binary mode restriction applies. */
CORD CORD_from_file_lazy(FILE * f);
/* Turn a cord into a C string. The result shares no structure with */
/* x, and is thus modifiable. */
char * CORD_to_char_star(CORD x);
/* Turn a C string into a CORD. The C string is copied, and so may */
/* subsequently be modified. */
CORD CORD_from_char_star(const char *s);
/* Identical to the above, but the result may share structure with */
/* the argument and is thus not modifiable. */
const char * CORD_to_const_char_star(CORD x);
/* Write a cord to a file, starting at the current position. No */
/* trailing NULs are newlines are added. */
/* Returns EOF if a write error occurs, 1 otherwise. */
int CORD_put(CORD x, FILE * f);
/* "Not found" result for the following two functions. */
# define CORD_NOT_FOUND ((size_t)(-1))
/* A vague analog of strchr. Returns the position (an integer, not */
/* a pointer) of the first occurrence of (char) c inside x at position */
/* i or later. The value i must be < CORD_len(x). */
size_t CORD_chr(CORD x, size_t i, int c);
/* A vague analog of strrchr. Returns index of the last occurrence */
/* of (char) c inside x at position i or earlier. The value i */
/* must be < CORD_len(x). */
size_t CORD_rchr(CORD x, size_t i, int c);
/* The following are also not primitive, but are implemented in */
/* cordprnt.c. They provide functionality similar to the ANSI C */
/* functions with corresponding names, but with the following */
/* additions and changes: */
/* 1. A %r conversion specification specifies a CORD argument. Field */
/* width, precision, etc. have the same semantics as for %s. */
/* (Note that %c,%C, and %S were already taken.) */
/* 2. The format string is represented as a CORD. */
/* 3. CORD_sprintf and CORD_vsprintf assign the result through the 1st */ /* argument. Unlike their ANSI C versions, there is no need to guess */
/* the correct buffer size. */
/* 4. Most of the conversions are implement through the native */
/* vsprintf. Hence they are usually no faster, and */
/* idiosyncracies of the native printf are preserved. However, */
/* CORD arguments to CORD_sprintf and CORD_vsprintf are NOT copied; */
/* the result shares the original structure. This may make them */
/* very efficient in some unusual applications. */
/* The format string is copied. */
/* All functions return the number of characters generated or -1 on */
/* error. This complies with the ANSI standard, but is inconsistent */
/* with some older implementations of sprintf. */
/* The implementation of these is probably less portable than the rest */
/* of this package. */
#ifndef CORD_NO_IO
#include <stdarg.h>
int CORD_sprintf(CORD * out, CORD format, ...);
int CORD_vsprintf(CORD * out, CORD format, va_list args);
int CORD_fprintf(FILE * f, CORD format, ...);
int CORD_vfprintf(FILE * f, CORD format, va_list args);
int CORD_printf(CORD format, ...);
int CORD_vprintf(CORD format, va_list args);
#endif /* CORD_NO_IO */
# endif /* CORD_H */

View File

@ -1,70 +0,0 @@
# ifndef EC_H
# define EC_H
# ifndef CORD_H
# include "cord.h"
# endif
/* Extensible cords are strings that may be destructively appended to. */
/* They allow fast construction of cords from characters that are */
/* being read from a stream. */
/*
* A client might look like:
*
* {
* CORD_ec x;
* CORD result;
* char c;
* FILE *f;
*
* ...
* CORD_ec_init(x);
* while(...) {
* c = getc(f);
* ...
* CORD_ec_append(x, c);
* }
* result = CORD_balance(CORD_ec_to_cord(x));
*
* If a C string is desired as the final result, the call to CORD_balance
* may be replaced by a call to CORD_to_char_star.
*/
# ifndef CORD_BUFSZ
# define CORD_BUFSZ 128
# endif
typedef struct CORD_ec_struct {
CORD ec_cord;
char * ec_bufptr;
char ec_buf[CORD_BUFSZ+1];
} CORD_ec[1];
/* This structure represents the concatenation of ec_cord with */
/* ec_buf[0 ... (ec_bufptr-ec_buf-1)] */
/* Flush the buffer part of the extended chord into ec_cord. */
/* Note that this is almost the only real function, and it is */
/* implemented in 6 lines in cordxtra.c */
void CORD_ec_flush_buf(CORD_ec x);
/* Convert an extensible cord to a cord. */
# define CORD_ec_to_cord(x) (CORD_ec_flush_buf(x), (x)[0].ec_cord)
/* Initialize an extensible cord. */
# define CORD_ec_init(x) ((x)[0].ec_cord = 0, (x)[0].ec_bufptr = (x)[0].ec_buf)
/* Append a character to an extensible cord. */
# define CORD_ec_append(x, c) \
{ \
if ((x)[0].ec_bufptr == (x)[0].ec_buf + CORD_BUFSZ) { \
CORD_ec_flush_buf(x); \
} \
*((x)[0].ec_bufptr)++ = (c); \
}
/* Append a cord to an extensible cord. Structure remains shared with */
/* original. */
void CORD_ec_append_cord(CORD_ec x, CORD s);
# endif /* EC_H */

View File

@ -1,698 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
* Copyright 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Note that this defines a large number of tuning hooks, which can
* safely be ignored in nearly all cases. For normal use it suffices
* to call only GC_MALLOC and perhaps GC_REALLOC.
* For better performance, also look at GC_MALLOC_ATOMIC, and
* GC_enable_incremental. If you need an action to be performed
* immediately before an object is collected, look at GC_register_finalizer.
* If you are using Solaris threads, look at the end of this file.
* Everything else is best ignored unless you encounter performance
* problems.
*/
#ifndef _GC_H
# define _GC_H
# define __GC
# include <stddef.h>
#if defined(__CYGWIN32__) && defined(GC_USE_DLL)
#include "libgc_globals.h"
#endif
#if defined(_MSC_VER) && defined(_DLL)
#ifdef GC_BUILD
#define GC_API __declspec(dllexport)
#else
#define GC_API __declspec(dllimport)
#endif
#endif
#ifndef GC_API
#define GC_API extern
#endif
# if defined(__STDC__) || defined(__cplusplus)
# define GC_PROTO(args) args
typedef void * GC_PTR;
# else
# define GC_PROTO(args) ()
typedef char * GC_PTR;
# endif
# ifdef __cplusplus
extern "C" {
# endif
/* Define word and signed_word to be unsigned and signed types of the */
/* size as char * or void *. There seems to be no way to do this */
/* even semi-portably. The following is probably no better/worse */
/* than almost anything else. */
/* The ANSI standard suggests that size_t and ptr_diff_t might be */
/* better choices. But those appear to have incorrect definitions */
/* on may systems. Notably "typedef int size_t" seems to be both */
/* frequent and WRONG. */
typedef unsigned long GC_word;
typedef long GC_signed_word;
/* Public read-only variables */
GC_API GC_word GC_gc_no;/* Counter incremented per collection. */
/* Includes empty GCs at startup. */
/* Public R/W variables */
GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
/* When there is insufficient memory to satisfy */
/* an allocation request, we return */
/* (*GC_oom_fn)(). By default this just */
/* returns 0. */
/* If it returns, it must return 0 or a valid */
/* pointer to a previously allocated heap */
/* object. */
GC_API int GC_quiet; /* Disable statistics output. Only matters if */
/* collector has been compiled with statistics */
/* enabled. This involves a performance cost, */
/* and is thus not the default. */
GC_API int GC_dont_gc; /* Dont collect unless explicitly requested, e.g. */
/* because it's not safe. */
GC_API int GC_dont_expand;
/* Dont expand heap unless explicitly requested */
/* or forced to. */
GC_API int GC_full_freq; /* Number of partial collections between */
/* full collections. Matters only if */
/* GC_incremental is set. */
GC_API GC_word GC_non_gc_bytes;
/* Bytes not considered candidates for collection. */
/* Used only to control scheduling of collections. */
GC_API GC_word GC_free_space_divisor;
/* We try to make sure that we allocate at */
/* least N/GC_free_space_divisor bytes between */
/* collections, where N is the heap size plus */
/* a rough estimate of the root set size. */
/* Initially, GC_free_space_divisor = 4. */
/* Increasing its value will use less space */
/* but more collection time. Decreasing it */
/* will appreciably decrease collection time */
/* at the expense of space. */
/* GC_free_space_divisor = 1 will effectively */
/* disable collections. */
GC_API GC_word GC_max_retries;
/* The maximum number of GCs attempted before */
/* reporting out of memory after heap */
/* expansion fails. Initially 0. */
/* Public procedures */
/*
* general purpose allocation routines, with roughly malloc calling conv.
* The atomic versions promise that no relevant pointers are contained
* in the object. The nonatomic versions guarantee that the new object
* is cleared. GC_malloc_stubborn promises that no changes to the object
* will occur after GC_end_stubborn_change has been called on the
* result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
* that is scanned for pointers to collectable objects, but is not itself
* collectable. GC_malloc_uncollectable and GC_free called on the resulting
* object implicitly update GC_non_gc_bytes appropriately.
*/
GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
/* The following is only defined if the library has been suitably */
/* compiled: */
GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
/* Explicitly deallocate an object. Dangerous if used incorrectly. */
/* Requires a pointer to the base of an object. */
/* If the argument is stubborn, it should not be changeable when freed. */
/* An object should not be enable for finalization when it is */
/* explicitly deallocated. */
/* GC_free(0) is a no-op, as required by ANSI C for free. */
GC_API void GC_free GC_PROTO((GC_PTR object_addr));
/*
* Stubborn objects may be changed only if the collector is explicitly informed.
* The collector is implicitly informed of coming change when such
* an object is first allocated. The following routines inform the
* collector that an object will no longer be changed, or that it will
* once again be changed. Only nonNIL pointer stores into the object
* are considered to be changes. The argument to GC_end_stubborn_change
* must be exacly the value returned by GC_malloc_stubborn or passed to
* GC_change_stubborn. (In the second case it may be an interior pointer
* within 512 bytes of the beginning of the objects.)
* There is a performance penalty for allowing more than
* one stubborn object to be changed at once, but it is acceptable to
* do so. The same applies to dropping stubborn objects that are still
* changeable.
*/
GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
/* Return a pointer to the base (lowest address) of an object given */
/* a pointer to a location within the object. */
/* Return 0 if displaced_pointer doesn't point to within a valid */
/* object. */
GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
/* Given a pointer to the base of an object, return its size in bytes. */
/* The returned size may be slightly larger than what was originally */
/* requested. */
GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
/* For compatibility with C library. This is occasionally faster than */
/* a malloc followed by a bcopy. But if you rely on that, either here */
/* or with the standard C library, your code is broken. In my */
/* opinion, it shouldn't have been invented, but now we're stuck. -HB */
/* The resulting object has the same kind as the original. */
/* If the argument is stubborn, the result will have changes enabled. */
/* It is an error to have changes enabled for the original object. */
/* Follows ANSI comventions for NULL old_object. */
GC_API GC_PTR GC_realloc GC_PROTO((GC_PTR old_object,
size_t new_size_in_bytes));
/* Explicitly increase the heap size. */
/* Returns 0 on failure, 1 on success. */
GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
/* Limit the heap size to n bytes. Useful when you're debugging, */
/* especially on systems that don't handle running out of memory well. */
/* n == 0 ==> unbounded. This is the default. */
GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
/* Inform the collector that a certain section of statically allocated */
/* memory contains no pointers to garbage collected memory. Thus it */
/* need not be scanned. This is sometimes important if the application */
/* maps large read/write files into the address space, which could be */
/* mistaken for dynamic library data segments on some systems. */
GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
/* Clear the set of root segments. Wizards only. */
GC_API void GC_clear_roots GC_PROTO((void));
/* Add a root segment. Wizards only. */
GC_API void GC_add_roots GC_PROTO((char * low_address,
char * high_address_plus_1));
/* Add a displacement to the set of those considered valid by the */
/* collector. GC_register_displacement(n) means that if p was returned */
/* by GC_malloc, then (char *)p + n will be considered to be a valid */
/* pointer to n. N must be small and less than the size of p. */
/* (All pointers to the interior of objects from the stack are */
/* considered valid in any case. This applies to heap objects and */
/* static data.) */
/* Preferably, this should be called before any other GC procedures. */
/* Calling it later adds to the probability of excess memory */
/* retention. */
/* This is a no-op if the collector was compiled with recognition of */
/* arbitrary interior pointers enabled, which is now the default. */
GC_API void GC_register_displacement GC_PROTO((GC_word n));
/* The following version should be used if any debugging allocation is */
/* being done. */
GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
/* Explicitly trigger a full, world-stop collection. */
GC_API void GC_gcollect GC_PROTO((void));
/* Trigger a full world-stopped collection. Abort the collection if */
/* and when stop_func returns a nonzero value. Stop_func will be */
/* called frequently, and should be reasonably fast. This works even */
/* if virtual dirty bits, and hence incremental collection is not */
/* available for this architecture. Collections can be aborted faster */
/* than normal pause times for incremental collection. However, */
/* aborted collections do no useful work; the next collection needs */
/* to start from the beginning. */
typedef int (* GC_stop_func) GC_PROTO((void));
GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
/* Return the number of bytes in the heap. Excludes collector private */
/* data structures. Includes empty blocks and fragmentation loss. */
/* Includes some pages that were allocated but never written. */
GC_API size_t GC_get_heap_size GC_PROTO((void));
/* Return the number of bytes allocated since the last collection. */
GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
/* Enable incremental/generational collection. */
/* Not advisable unless dirty bits are */
/* available or most heap objects are */
/* pointerfree(atomic) or immutable. */
/* Don't use in leak finding mode. */
/* Ignored if GC_dont_gc is true. */
GC_API void GC_enable_incremental GC_PROTO((void));
/* Perform some garbage collection work, if appropriate. */
/* Return 0 if there is no more work to be done. */
/* Typically performs an amount of work corresponding roughly */
/* to marking from one page. May do more work if further */
/* progress requires it, e.g. if incremental collection is */
/* disabled. It is reasonable to call this in a wait loop */
/* until it returns 0. */
GC_API int GC_collect_a_little GC_PROTO((void));
/* Allocate an object of size lb bytes. The client guarantees that */
/* as long as the object is live, it will be referenced by a pointer */
/* that points to somewhere within the first 256 bytes of the object. */
/* (This should normally be declared volatile to prevent the compiler */
/* from invalidating this assertion.) This routine is only useful */
/* if a large array is being allocated. It reduces the chance of */
/* accidentally retaining such an array as a result of scanning an */
/* integer that happens to be an address inside the array. (Actually, */
/* it reduces the chance of the allocator not finding space for such */
/* an array, since it will try hard to avoid introducing such a false */
/* reference.) On a SunOS 4.X or MS Windows system this is recommended */
/* for arrays likely to be larger than 100K or so. For other systems, */
/* or if the collector is not configured to recognize all interior */
/* pointers, the threshold is normally much higher. */
GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
#if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
# define GC_ADD_CALLER
# define GC_RETURN_ADDR (GC_word)__return_address
#endif
#ifdef GC_ADD_CALLER
# define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
# define GC_EXTRA_PARAMS GC_word ra, char * descr_string, int descr_int
#else
# define GC_EXTRAS __FILE__, __LINE__
# define GC_EXTRA_PARAMS char * descr_string, int descr_int
#endif
/* Debugging (annotated) allocation. GC_gcollect will check */
/* objects allocated in this way for overwrites, etc. */
GC_API GC_PTR GC_debug_malloc
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_atomic
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_uncollectable
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API GC_PTR GC_debug_malloc_stubborn
GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
GC_API GC_PTR GC_debug_realloc
GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
GC_EXTRA_PARAMS));
GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
# ifdef GC_DEBUG
# define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
# define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_debug_malloc_uncollectable(sz, \
GC_EXTRAS)
# define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
# define GC_FREE(p) GC_debug_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_debug_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
# define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, GC_base(obj))
# define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
# else
# define GC_MALLOC(sz) GC_malloc(sz)
# define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
# define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
# define GC_REALLOC(old, sz) GC_realloc(old, sz)
# define GC_FREE(p) GC_free(p)
# define GC_REGISTER_FINALIZER(p, f, d, of, od) \
GC_register_finalizer(p, f, d, of, od)
# define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
GC_register_finalizer_ignore_self(p, f, d, of, od)
# define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
# define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
# define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
# define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
GC_general_register_disappearing_link(link, obj)
# define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
# endif
/* The following are included because they are often convenient, and */
/* reduce the chance for a misspecifed size argument. But calls may */
/* expand to something syntactically incorrect if t is a complicated */
/* type expression. */
# define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
# define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
# define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
# define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
/* Finalization. Some of these primitives are grossly unsafe. */
/* The idea is to make them both cheap, and sufficient to build */
/* a safer layer, closer to PCedar finalization. */
/* The interface represents my conclusions from a long discussion */
/* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes, */
/* Christian Jacobi, and Russ Atkinson. It's not perfect, and */
/* probably nobody else agrees with it. Hans-J. Boehm 3/13/92 */
typedef void (*GC_finalization_proc)
GC_PROTO((GC_PTR obj, GC_PTR client_data));
GC_API void GC_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* When obj is no longer accessible, invoke */
/* (*fn)(obj, cd). If a and b are inaccessible, and */
/* a points to b (after disappearing links have been */
/* made to disappear), then only a will be */
/* finalized. (If this does not create any new */
/* pointers to b, then b will be finalized after the */
/* next collection.) Any finalizable object that */
/* is reachable from itself by following one or more */
/* pointers will not be finalized (or collected). */
/* Thus cycles involving finalizable objects should */
/* be avoided, or broken by disappearing links. */
/* All but the last finalizer registered for an object */
/* is ignored. */
/* Finalization may be removed by passing 0 as fn. */
/* Finalizers are implicitly unregistered just before */
/* they are invoked. */
/* The old finalizer and client data are stored in */
/* *ofn and *ocd. */
/* Fn is never invoked on an accessible object, */
/* provided hidden pointers are converted to real */
/* pointers only if the allocation lock is held, and */
/* such conversions are not performed by finalization */
/* routines. */
/* If GC_register_finalizer is aborted as a result of */
/* a signal, the object may be left with no */
/* finalization, even if neither the old nor new */
/* finalizer were NULL. */
/* Obj should be the nonNULL starting address of an */
/* object allocated by GC_malloc or friends. */
/* Note that any garbage collectable object referenced */
/* by cd will be considered accessible until the */
/* finalizer is invoked. */
/* Another versions of the above follow. It ignores */
/* self-cycles, i.e. pointers from a finalizable object to */
/* itself. There is a stylistic argument that this is wrong, */
/* but it's unavoidable for C++, since the compiler may */
/* silently introduce these. It's also benign in that specific */
/* case. */
GC_API void GC_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
GC_API void GC_debug_register_finalizer_ignore_self
GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
GC_finalization_proc *ofn, GC_PTR *ocd));
/* The following routine may be used to break cycles between */
/* finalizable objects, thus causing cyclic finalizable */
/* objects to be finalized in the correct order. Standard */
/* use involves calling GC_register_disappearing_link(&p), */
/* where p is a pointer that is not followed by finalization */
/* code, and should not be considered in determining */
/* finalization order. */
GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Link should point to a field of a heap allocated */
/* object obj. *link will be cleared when obj is */
/* found to be inaccessible. This happens BEFORE any */
/* finalization code is invoked, and BEFORE any */
/* decisions about finalization order are made. */
/* This is useful in telling the finalizer that */
/* some pointers are not essential for proper */
/* finalization. This may avoid finalization cycles. */
/* Note that obj may be resurrected by another */
/* finalizer, and thus the clearing of *link may */
/* be visible to non-finalization code. */
/* There's an argument that an arbitrary action should */
/* be allowed here, instead of just clearing a pointer. */
/* But this causes problems if that action alters, or */
/* examines connectivity. */
/* Returns 1 if link was already registered, 0 */
/* otherwise. */
/* Only exists for backward compatibility. See below: */
GC_API int GC_general_register_disappearing_link
GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
/* A slight generalization of the above. *link is */
/* cleared when obj first becomes inaccessible. This */
/* can be used to implement weak pointers easily and */
/* safely. Typically link will point to a location */
/* holding a disguised pointer to obj. (A pointer */
/* inside an "atomic" object is effectively */
/* disguised.) In this way soft */
/* pointers are broken before any object */
/* reachable from them are finalized. Each link */
/* May be registered only once, i.e. with one obj */
/* value. This was added after a long email discussion */
/* with John Ellis. */
/* Obj must be a pointer to the first word of an object */
/* we allocated. It is unsafe to explicitly deallocate */
/* the object containing link. Explicitly deallocating */
/* obj may or may not cause link to eventually be */
/* cleared. */
GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
/* Returns 0 if link was not actually registered. */
/* Undoes a registration by either of the above two */
/* routines. */
/* Auxiliary fns to make finalization work correctly with displaced */
/* pointers introduced by the debugging allocators. */
GC_API GC_PTR GC_make_closure GC_PROTO((GC_finalization_proc fn, GC_PTR data));
GC_API void GC_debug_invoke_finalizer GC_PROTO((GC_PTR obj, GC_PTR data));
GC_API int GC_invoke_finalizers GC_PROTO((void));
/* Run finalizers for all objects that are ready to */
/* be finalized. Return the number of finalizers */
/* that were run. Normally this is also called */
/* implicitly during some allocations. If */
/* FINALIZE_ON_DEMAND is defined, it must be called */
/* explicitly. */
/* GC_set_warn_proc can be used to redirect or filter warning messages. */
/* p may not be a NULL pointer. */
typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
/* Returns old warning procedure. */
/* The following is intended to be used by a higher level */
/* (e.g. cedar-like) finalization facility. It is expected */
/* that finalization code will arrange for hidden pointers to */
/* disappear. Otherwise objects can be accessed after they */
/* have been collected. */
/* Note that putting pointers in atomic objects or in */
/* nonpointer slots of "typed" objects is equivalent to */
/* disguising them in this way, and may have other advantages. */
# if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
typedef GC_word GC_hidden_pointer;
# define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
# define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
/* Converting a hidden pointer to a real pointer requires verifying */
/* that the object still exists. This involves acquiring the */
/* allocator lock to avoid a race with the collector. */
# endif /* I_HIDE_POINTERS */
typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
GC_API GC_PTR GC_call_with_alloc_lock
GC_PROTO((GC_fn_type fn, GC_PTR client_data));
/* Check that p and q point to the same object. */
/* Fail conspicuously if they don't. */
/* Returns the first argument. */
/* Succeeds if neither p nor q points to the heap. */
/* May succeed if both p and q point to between heap objects. */
GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
/* Checked pointer pre- and post- increment operations. Note that */
/* the second argument is in units of bytes, not multiples of the */
/* object size. This should either be invoked from a macro, or the */
/* call should be automatically generated. */
GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
/* Check that p is visible */
/* to the collector as a possibly pointer containing location. */
/* If it isn't fail conspicuously. */
/* Returns the argument in all cases. May erroneously succeed */
/* in hard cases. (This is intended for debugging use with */
/* untyped allocations. The idea is that it should be possible, though */
/* slow, to add such a call to all indirect pointer stores.) */
/* Currently useless for multithreaded worlds. */
GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
/* Check that if p is a pointer to a heap page, then it points to */
/* a valid displacement within a heap object. */
/* Fail conspicuously if this property does not hold. */
/* Uninteresting with ALL_INTERIOR_POINTERS. */
/* Always returns its argument. */
GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
/* Safer, but slow, pointer addition. Probably useful mainly with */
/* a preprocessor. Useful only for heap pointers. */
#ifdef GC_DEBUG
# define GC_PTR_ADD3(x, n, type_of_result) \
((type_of_result)GC_same_obj((x)+(n), (x)))
# define GC_PRE_INCR3(x, n, type_of_result) \
((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
# define GC_POST_INCR2(x, type_of_result) \
((type_of_result)GC_post_incr(&(x), sizeof(*x))
# ifdef __GNUC__
# define GC_PTR_ADD(x, n) \
GC_PTR_ADD3(x, n, typeof(x))
# define GC_PRE_INCR(x, n) \
GC_PRE_INCR3(x, n, typeof(x))
# define GC_POST_INCR(x, n) \
GC_POST_INCR3(x, typeof(x))
# else
/* We can't do this right without typeof, which ANSI */
/* decided was not sufficiently useful. Repeatedly */
/* mentioning the arguments seems too dangerous to be */
/* useful. So does not casting the result. */
# define GC_PTR_ADD(x, n) ((x)+(n))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
# define GC_PTR_ADD(x, n) ((x)+(n))
# define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
# define GC_PRE_INCR(x, n) ((x) += (n))
# define GC_POST_INCR2(x, n, type_of_result) ((x)++)
# define GC_POST_INCR(x, n) ((x)++)
#endif
/* Safer assignment of a pointer to a nonstack location. */
#ifdef GC_DEBUG
# ifdef __STDC__
# define GC_PTR_STORE(p, q) \
(*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
# else
# define GC_PTR_STORE(p, q) \
(*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
# endif
#else /* !GC_DEBUG */
# define GC_PTR_STORE(p, q) *((p) = (q))
#endif
/* Fynctions called to report pointer checking errors */
GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
GC_API void (*GC_is_valid_displacement_print_proc)
GC_PROTO((GC_PTR p));
GC_API void (*GC_is_visible_print_proc)
GC_PROTO((GC_PTR p));
#ifdef SOLARIS_THREADS
/* We need to intercept calls to many of the threads primitives, so */
/* that we can locate thread stacks and stop the world. */
/* Note also that the collector cannot see thread specific data. */
/* Thread specific data should generally consist of pointers to */
/* uncollectable objects, which are deallocated using the destructor */
/* facility in thr_keycreate. */
# include <thread.h>
# include <signal.h>
int GC_thr_create(void *stack_base, size_t stack_size,
void *(*start_routine)(void *), void *arg, long flags,
thread_t *new_thread);
int GC_thr_join(thread_t wait_for, thread_t *departed, void **status);
int GC_thr_suspend(thread_t target_thread);
int GC_thr_continue(thread_t target_thread);
void * GC_dlopen(const char *path, int mode);
# ifdef _SOLARIS_PTHREADS
# include <pthread.h>
extern int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void * (*thread_execp)(void *), void *arg);
extern int GC_pthread_join(pthread_t wait_for, void **status);
# undef thread_t
# define pthread_join GC_pthread_join
# define pthread_create GC_pthread_create
#endif
# define thr_create GC_thr_create
# define thr_join GC_thr_join
# define thr_suspend GC_thr_suspend
# define thr_continue GC_thr_continue
# define dlopen GC_dlopen
# endif /* SOLARIS_THREADS */
#if defined(IRIX_THREADS) || defined(LINUX_THREADS)
/* We treat these similarly. */
# include <pthread.h>
# include <signal.h>
int GC_pthread_create(pthread_t *new_thread,
const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset);
int GC_pthread_join(pthread_t thread, void **retval);
# define pthread_create GC_pthread_create
# define pthread_sigmask GC_pthread_sigmask
# define pthread_join GC_pthread_join
#endif /* IRIX_THREADS || LINUX_THREADS */
#if defined(THREADS) && !defined(SRC_M3)
/* This returns a list of objects, linked through their first */
/* word. Its use can greatly reduce lock contention problems, since */
/* the allocation lock can be acquired and released many fewer times. */
GC_PTR GC_malloc_many(size_t lb);
#define GC_NEXT(p) (*(GC_PTR *)(p)) /* Retrieve the next element */
/* in returned list. */
extern void GC_thr_init(); /* Needed for Solaris/X86 */
#endif /* THREADS && !SRC_M3 */
/*
* If you are planning on putting
* the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
* from the statically loaded program section.
* This circumvents a Solaris 2.X (X<=4) linker bug.
*/
#if defined(sparc) || defined(__sparc)
# define GC_INIT() { extern end, etext; \
GC_noop(&end, &etext); }
#else
# if defined(__CYGWIN32__) && defined(GC_USE_DLL)
/*
* Similarly gnu-win32 DLLs need explicit initialization
*/
# define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
# else
# define GC_INIT()
# endif
#endif
#ifdef __cplusplus
} /* end of extern "C" */
#endif
#endif /* _GC_H */

View File

@ -1,380 +0,0 @@
/*
* Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
//
// This is a C++ header file that is intended to replace the SGI STL
// alloc.h.
//
// This assumes the collector has been compiled with -DATOMIC_UNCOLLECTABLE
// and -DALL_INTERIOR_POINTERS. We also recommend
// -DREDIRECT_MALLOC=GC_uncollectable_malloc.
//
// Some of this could be faster in the explicit deallocation case. In particular,
// we spend too much time clearing objects on the free lists. That could be avoided.
//
// This uses template classes with static members, and hence does not work
// with g++ 2.7.2 and earlier.
//
#include "gc.h"
#ifndef GC_ALLOC_H
#define GC_ALLOC_H
#define __ALLOC_H // Prevent inclusion of the default version. Ugly.
#define __SGI_STL_ALLOC_H
#define __SGI_STL_INTERNAL_ALLOC_H
#ifndef __ALLOC
# define __ALLOC alloc
#endif
#include <stddef.h>
#include <string.h>
// The following is just replicated from the conventional SGI alloc.h:
template<class T, class alloc>
class simple_alloc {
public:
static T *allocate(size_t n)
{ return 0 == n? 0 : (T*) alloc::allocate(n * sizeof (T)); }
static T *allocate(void)
{ return (T*) alloc::allocate(sizeof (T)); }
static void deallocate(T *p, size_t n)
{ if (0 != n) alloc::deallocate(p, n * sizeof (T)); }
static void deallocate(T *p)
{ alloc::deallocate(p, sizeof (T)); }
};
#include "gc.h"
// The following need to match collector data structures.
// We can't include gc_priv.h, since that pulls in way too much stuff.
// This should eventually be factored out into another include file.
extern "C" {
extern void ** const GC_objfreelist_ptr;
extern void ** const GC_aobjfreelist_ptr;
extern void ** const GC_uobjfreelist_ptr;
extern void ** const GC_auobjfreelist_ptr;
extern void GC_incr_words_allocd(size_t words);
extern void GC_incr_mem_freed(size_t words);
extern char * GC_generic_malloc_words_small(size_t word, int kind);
}
// Object kinds; must match PTRFREE, NORMAL, UNCOLLECTABLE, and
// AUNCOLLECTABLE in gc_priv.h.
enum { GC_PTRFREE = 0, GC_NORMAL = 1, GC_UNCOLLECTABLE = 2,
GC_AUNCOLLECTABLE = 3 };
enum { GC_max_fast_bytes = 255 };
enum { GC_bytes_per_word = sizeof(char *) };
enum { GC_byte_alignment = 8 };
enum { GC_word_alignment = GC_byte_alignment/GC_bytes_per_word };
inline void * &GC_obj_link(void * p)
{ return *(void **)p; }
// Compute a number of words >= n+1 bytes.
// The +1 allows for pointers one past the end.
inline size_t GC_round_up(size_t n)
{
return ((n + GC_byte_alignment)/GC_byte_alignment)*GC_word_alignment;
}
// The same but don't allow for extra byte.
inline size_t GC_round_up_uncollectable(size_t n)
{
return ((n + GC_byte_alignment - 1)/GC_byte_alignment)*GC_word_alignment;
}
template <int dummy>
class GC_aux_template {
public:
// File local count of allocated words. Occasionally this is
// added into the global count. A separate count is necessary since the
// real one must be updated with a procedure call.
static size_t GC_words_recently_allocd;
// Same for uncollectable mmory. Not yet reflected in either
// GC_words_recently_allocd or GC_non_gc_bytes.
static size_t GC_uncollectable_words_recently_allocd;
// Similar counter for explicitly deallocated memory.
static size_t GC_mem_recently_freed;
// Again for uncollectable memory.
static size_t GC_uncollectable_mem_recently_freed;
static void * GC_out_of_line_malloc(size_t nwords, int kind);
};
template <int dummy>
size_t GC_aux_template<dummy>::GC_words_recently_allocd = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_uncollectable_words_recently_allocd = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_mem_recently_freed = 0;
template <int dummy>
size_t GC_aux_template<dummy>::GC_uncollectable_mem_recently_freed = 0;
template <int dummy>
void * GC_aux_template<dummy>::GC_out_of_line_malloc(size_t nwords, int kind)
{
GC_words_recently_allocd += GC_uncollectable_words_recently_allocd;
GC_non_gc_bytes +=
GC_bytes_per_word * GC_uncollectable_words_recently_allocd;
GC_uncollectable_words_recently_allocd = 0;
GC_mem_recently_freed += GC_uncollectable_mem_recently_freed;
GC_non_gc_bytes -=
GC_bytes_per_word * GC_uncollectable_mem_recently_freed;
GC_uncollectable_mem_recently_freed = 0;
GC_incr_words_allocd(GC_words_recently_allocd);
GC_words_recently_allocd = 0;
GC_incr_mem_freed(GC_mem_recently_freed);
GC_mem_recently_freed = 0;
return GC_generic_malloc_words_small(nwords, kind);
}
typedef GC_aux_template<0> GC_aux;
// A fast, single-threaded, garbage-collected allocator
// We assume the first word will be immediately overwritten.
// In this version, deallocation is not a noop, and explicit
// deallocation is likely to help performance.
template <int dummy>
class single_client_gc_alloc_template {
public:
static void * allocate(size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc(n);
flh = GC_objfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_NORMAL);
}
*flh = GC_obj_link(op);
GC_aux::GC_words_recently_allocd += nwords;
return op;
}
static void * ptr_free_allocate(size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_atomic(n);
flh = GC_aobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_PTRFREE);
}
*flh = GC_obj_link(op);
GC_aux::GC_words_recently_allocd += nwords;
return op;
}
static void deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_objfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
memset((char *)p + GC_bytes_per_word, 0,
GC_bytes_per_word * (nwords - 1));
*flh = p;
GC_aux::GC_mem_recently_freed += nwords;
}
}
static void ptr_free_deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_aobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_mem_recently_freed += nwords;
}
}
};
typedef single_client_gc_alloc_template<0> single_client_gc_alloc;
// Once more, for uncollectable objects.
template <int dummy>
class single_client_alloc_template {
public:
static void * allocate(size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_uncollectable(n);
flh = GC_uobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_UNCOLLECTABLE);
}
*flh = GC_obj_link(op);
GC_aux::GC_uncollectable_words_recently_allocd += nwords;
return op;
}
static void * ptr_free_allocate(size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
void * op;
if (n > GC_max_fast_bytes) return GC_malloc_atomic_uncollectable(n);
flh = GC_auobjfreelist_ptr + nwords;
if (0 == (op = *flh)) {
return GC_aux::GC_out_of_line_malloc(nwords, GC_AUNCOLLECTABLE);
}
*flh = GC_obj_link(op);
GC_aux::GC_uncollectable_words_recently_allocd += nwords;
return op;
}
static void deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_uobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_uncollectable_mem_recently_freed += nwords;
}
}
static void ptr_free_deallocate(void *p, size_t n)
{
size_t nwords = GC_round_up_uncollectable(n);
void ** flh;
if (n > GC_max_fast_bytes) {
GC_free(p);
} else {
flh = GC_auobjfreelist_ptr + nwords;
GC_obj_link(p) = *flh;
*flh = p;
GC_aux::GC_uncollectable_mem_recently_freed += nwords;
}
}
};
typedef single_client_alloc_template<0> single_client_alloc;
template < int dummy >
class gc_alloc_template {
public:
static void * allocate(size_t n) { return GC_malloc(n); }
static void * ptr_free_allocate(size_t n)
{ return GC_malloc_atomic(n); }
static void deallocate(void *, size_t) { }
static void ptr_free_deallocate(void *, size_t) { }
};
typedef gc_alloc_template < 0 > gc_alloc;
template < int dummy >
class alloc_template {
public:
static void * allocate(size_t n) { return GC_malloc_uncollectable(n); }
static void * ptr_free_allocate(size_t n)
{ return GC_malloc_atomic_uncollectable(n); }
static void deallocate(void *p, size_t) { GC_free(p); }
static void ptr_free_deallocate(void *p, size_t) { GC_free(p); }
};
typedef alloc_template < 0 > alloc;
#ifdef _SGI_SOURCE
// We want to specialize simple_alloc so that it does the right thing
// for all pointerfree types. At the moment there is no portable way to
// even approximate that. The following approximation should work for
// SGI compilers, and perhaps some others.
# define __GC_SPECIALIZE(T,alloc) \
class simple_alloc<T, alloc> { \
public: \
static T *allocate(size_t n) \
{ return 0 == n? 0 : \
(T*) alloc::ptr_free_allocate(n * sizeof (T)); } \
static T *allocate(void) \
{ return (T*) alloc::ptr_free_allocate(sizeof (T)); } \
static void deallocate(T *p, size_t n) \
{ if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \
static void deallocate(T *p) \
{ alloc::ptr_free_deallocate(p, sizeof (T)); } \
};
__GC_SPECIALIZE(char, gc_alloc)
__GC_SPECIALIZE(int, gc_alloc)
__GC_SPECIALIZE(unsigned, gc_alloc)
__GC_SPECIALIZE(float, gc_alloc)
__GC_SPECIALIZE(double, gc_alloc)
__GC_SPECIALIZE(char, alloc)
__GC_SPECIALIZE(int, alloc)
__GC_SPECIALIZE(unsigned, alloc)
__GC_SPECIALIZE(float, alloc)
__GC_SPECIALIZE(double, alloc)
__GC_SPECIALIZE(char, single_client_gc_alloc)
__GC_SPECIALIZE(int, single_client_gc_alloc)
__GC_SPECIALIZE(unsigned, single_client_gc_alloc)
__GC_SPECIALIZE(float, single_client_gc_alloc)
__GC_SPECIALIZE(double, single_client_gc_alloc)
__GC_SPECIALIZE(char, single_client_alloc)
__GC_SPECIALIZE(int, single_client_alloc)
__GC_SPECIALIZE(unsigned, single_client_alloc)
__GC_SPECIALIZE(float, single_client_alloc)
__GC_SPECIALIZE(double, single_client_alloc)
#ifdef __STL_USE_STD_ALLOCATORS
???copy stuff from stl_alloc.h or remove it to a different file ???
#endif /* __STL_USE_STD_ALLOCATORS */
#endif /* _SGI_SOURCE */
#endif /* GC_ALLOC_H */

View File

@ -1,287 +0,0 @@
#ifndef GC_CPP_H
#define GC_CPP_H
/****************************************************************************
Copyright (c) 1994 by Xerox Corporation. All rights reserved.
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program for any
purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is
granted, provided the above notices are retained, and a notice that
the code was modified is included with the above copyright notice.
****************************************************************************
C++ Interface to the Boehm Collector
John R. Ellis and Jesse Hull
Last modified on Mon Jul 24 15:43:42 PDT 1995 by ellis
This interface provides access to the Boehm collector. It provides
basic facilities similar to those described in "Safe, Efficient
Garbage Collection for C++", by John R. Elis and David L. Detlefs
(ftp.parc.xerox.com:/pub/ellis/gc).
All heap-allocated objects are either "collectable" or
"uncollectable". Programs must explicitly delete uncollectable
objects, whereas the garbage collector will automatically delete
collectable objects when it discovers them to be inaccessible.
Collectable objects may freely point at uncollectable objects and vice
versa.
Objects allocated with the built-in "::operator new" are uncollectable.
Objects derived from class "gc" are collectable. For example:
class A: public gc {...};
A* a = new A; // a is collectable.
Collectable instances of non-class types can be allocated using the GC
placement:
typedef int A[ 10 ];
A* a = new (GC) A;
Uncollectable instances of classes derived from "gc" can be allocated
using the NoGC placement:
class A: public gc {...};
A* a = new (NoGC) A; // a is uncollectable.
Both uncollectable and collectable objects can be explicitly deleted
with "delete", which invokes an object's destructors and frees its
storage immediately.
A collectable object may have a clean-up function, which will be
invoked when the collector discovers the object to be inaccessible.
An object derived from "gc_cleanup" or containing a member derived
from "gc_cleanup" has a default clean-up function that invokes the
object's destructors. Explicit clean-up functions may be specified as
an additional placement argument:
A* a = ::new (GC, MyCleanup) A;
An object is considered "accessible" by the collector if it can be
reached by a path of pointers from static variables, automatic
variables of active functions, or from some object with clean-up
enabled; pointers from an object to itself are ignored.
Thus, if objects A and B both have clean-up functions, and A points at
B, B is considered accessible. After A's clean-up is invoked and its
storage released, B will then become inaccessible and will have its
clean-up invoked. If A points at B and B points to A, forming a
cycle, then that's considered a storage leak, and neither will be
collectable. See the interface gc.h for low-level facilities for
handling such cycles of objects with clean-up.
The collector cannot guarrantee that it will find all inaccessible
objects. In practice, it finds almost all of them.
Cautions:
1. Be sure the collector has been augmented with "make c++".
2. If your compiler supports the new "operator new[]" syntax, then
add -DOPERATOR_NEW_ARRAY to the Makefile.
If your compiler doesn't support "operator new[]", beware that an
array of type T, where T is derived from "gc", may or may not be
allocated as a collectable object (it depends on the compiler). Use
the explicit GC placement to make the array collectable. For example:
class A: public gc {...};
A* a1 = new A[ 10 ]; // collectable or uncollectable?
A* a2 = new (GC) A[ 10 ]; // collectable
3. The destructors of collectable arrays of objects derived from
"gc_cleanup" will not be invoked properly. For example:
class A: public gc_cleanup {...};
A* a = new (GC) A[ 10 ]; // destructors not invoked correctly
Typically, only the destructor for the first element of the array will
be invoked when the array is garbage-collected. To get all the
destructors of any array executed, you must supply an explicit
clean-up function:
A* a = new (GC, MyCleanUp) A[ 10 ];
(Implementing clean-up of arrays correctly, portably, and in a way
that preserves the correct exception semantics requires a language
extension, e.g. the "gc" keyword.)
4. Compiler bugs:
* Solaris 2's CC (SC3.0) doesn't implement t->~T() correctly, so the
destructors of classes derived from gc_cleanup won't be invoked.
You'll have to explicitly register a clean-up function with
new-placement syntax.
* Evidently cfront 3.0 does not allow destructors to be explicitly
invoked using the ANSI-conforming syntax t->~T(). If you're using
cfront 3.0, you'll have to comment out the class gc_cleanup, which
uses explicit invocation.
****************************************************************************/
#include "gc.h"
#ifndef THINK_CPLUS
#define _cdecl
#endif
#if ! defined( OPERATOR_NEW_ARRAY ) \
&& (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6))
# define OPERATOR_NEW_ARRAY
#endif
enum GCPlacement {GC, NoGC, PointerFreeGC};
class gc {public:
inline void* operator new( size_t size );
inline void* operator new( size_t size, GCPlacement gcp );
inline void operator delete( void* obj );
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[]( size_t size );
inline void* operator new[]( size_t size, GCPlacement gcp );
inline void operator delete[]( void* obj );
#endif /* OPERATOR_NEW_ARRAY */
};
/*
Instances of classes derived from "gc" will be allocated in the
collected heap by default, unless an explicit NoGC placement is
specified. */
class gc_cleanup: virtual public gc {public:
inline gc_cleanup();
inline virtual ~gc_cleanup();
private:
inline static void _cdecl cleanup( void* obj, void* clientData );};
/*
Instances of classes derived from "gc_cleanup" will be allocated
in the collected heap by default. When the collector discovers an
inaccessible object derived from "gc_cleanup" or containing a
member derived from "gc_cleanup", its destructors will be
invoked. */
extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
inline void* operator new(
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup = 0,
void* clientData = 0 );
/*
Allocates a collectable or uncollected object, according to the
value of "gcp".
For collectable objects, if "cleanup" is non-null, then when the
allocated object "obj" becomes inaccessible, the collector will
invoke the function "cleanup( obj, clientData )" but will not
invoke the object's destructors. It is an error to explicitly
delete an object allocated with a non-null "cleanup".
It is an error to specify a non-null "cleanup" with NoGC or for
classes derived from "gc_cleanup" or containing members derived
from "gc_cleanup". */
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[](
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup = 0,
void* clientData = 0 );
/*
The operator new for arrays, identical to the above. */
#endif /* OPERATOR_NEW_ARRAY */
/****************************************************************************
Inline implementation
****************************************************************************/
inline void* gc::operator new( size_t size ) {
return GC_MALLOC( size );}
inline void* gc::operator new( size_t size, GCPlacement gcp ) {
if (gcp == GC)
return GC_MALLOC( size );
else
return GC_MALLOC_UNCOLLECTABLE( size );}
inline void gc::operator delete( void* obj ) {
GC_FREE( obj );}
#ifdef OPERATOR_NEW_ARRAY
inline void* gc::operator new[]( size_t size ) {
return gc::operator new( size );}
inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
return gc::operator new( size, gcp );}
inline void gc::operator delete[]( void* obj ) {
gc::operator delete( obj );}
#endif /* OPERATOR_NEW_ARRAY */
inline gc_cleanup::~gc_cleanup() {
GC_REGISTER_FINALIZER_IGNORE_SELF( this, 0, 0, 0, 0 );}
inline void gc_cleanup::cleanup( void* obj, void* displ ) {
((gc_cleanup*) ((char*) obj + (ptrdiff_t) displ))->~gc_cleanup();}
inline gc_cleanup::gc_cleanup() {
GC_finalization_proc oldProc;
void* oldData;
void* base = GC_base( (void *) this );
if (0 == base) return;
GC_REGISTER_FINALIZER_IGNORE_SELF(
base, cleanup, (void*) ((char*) this - (char*) base),
&oldProc, &oldData );
if (0 != oldProc) {
GC_REGISTER_FINALIZER_IGNORE_SELF( base, oldProc, oldData, 0, 0 );}}
inline void* operator new(
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup,
void* clientData )
{
void* obj;
if (gcp == GC) {
obj = GC_MALLOC( size );
if (cleanup != 0)
GC_REGISTER_FINALIZER_IGNORE_SELF(
obj, cleanup, clientData, 0, 0 );}
else if (gcp == PointerFreeGC) {
obj = GC_MALLOC_ATOMIC( size );}
else {
obj = GC_MALLOC_UNCOLLECTABLE( size );};
return obj;}
#ifdef OPERATOR_NEW_ARRAY
inline void* operator new[](
size_t size,
GCPlacement gcp,
GCCleanUpFunc cleanup,
void* clientData )
{
return ::operator new( size, gcp, cleanup, clientData );}
#endif /* OPERATOR_NEW_ARRAY */
#endif /* GC_CPP_H */

View File

@ -1,103 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, October 3, 1995 2:07 pm PDT */
# ifndef GC_PRIVATE_H
# include "private/gc_priv.h"
# endif
/* USE OF THIS FILE IS NOT RECOMMENDED unless the collector has been */
/* compiled without -DALL_INTERIOR_POINTERS or with */
/* -DDONT_ADD_BYTE_AT_END, or the specified size includes a pointerfree */
/* word at the end. In the standard collector configuration, */
/* the final word of each object may not be scanned. */
/* This is most useful for compilers that generate C. */
/* Manual use is hereby discouraged. */
/* Allocate n words (NOT BYTES). X is made to point to the result. */
/* It is assumed that n < MAXOBJSZ, and */
/* that n > 0. On machines requiring double word alignment of some */
/* data, we also assume that n is 1 or even. This bypasses the */
/* MERGE_SIZES mechanism. In order to minimize the number of distinct */
/* free lists that are maintained, the caller should ensure that a */
/* small number of distinct values of n are used. (The MERGE_SIZES */
/* mechanism normally does this by ensuring that only the leading three */
/* bits of n may be nonzero. See misc.c for details.) We really */
/* recommend this only in cases in which n is a constant, and no */
/* locking is required. */
/* In that case it may allow the compiler to perform substantial */
/* additional optimizations. */
# define GC_MALLOC_WORDS(result,n) \
{ \
register ptr_t op; \
register ptr_t *opp; \
DCL_LOCK_STATE; \
\
opp = &(GC_objfreelist[n]); \
FASTLOCK(); \
if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \
FASTUNLOCK(); \
(result) = GC_generic_malloc_words_small((n), NORMAL); \
} else { \
*opp = obj_link(op); \
obj_link(op) = 0; \
GC_words_allocd += (n); \
FASTUNLOCK(); \
(result) = (GC_PTR) op; \
} \
}
/* The same for atomic objects: */
# define GC_MALLOC_ATOMIC_WORDS(result,n) \
{ \
register ptr_t op; \
register ptr_t *opp; \
DCL_LOCK_STATE; \
\
opp = &(GC_aobjfreelist[n]); \
FASTLOCK(); \
if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \
FASTUNLOCK(); \
(result) = GC_generic_malloc_words_small((n), PTRFREE); \
} else { \
*opp = obj_link(op); \
obj_link(op) = 0; \
GC_words_allocd += (n); \
FASTUNLOCK(); \
(result) = (GC_PTR) op; \
} \
}
/* And once more for two word initialized objects: */
# define GC_CONS(result, first, second) \
{ \
register ptr_t op; \
register ptr_t *opp; \
DCL_LOCK_STATE; \
\
opp = &(GC_objfreelist[2]); \
FASTLOCK(); \
if( !FASTLOCK_SUCCEEDED() || (op = *opp) == 0 ) { \
FASTUNLOCK(); \
op = GC_generic_malloc_words_small(2, NORMAL); \
} else { \
*opp = obj_link(op); \
GC_words_allocd += 2; \
FASTUNLOCK(); \
} \
((word *)op)[0] = (word)(first); \
((word *)op)[1] = (word)(second); \
(result) = (GC_PTR) op; \
}

View File

@ -1 +0,0 @@
# include "gc_inl.h"

View File

@ -1,91 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright 1996 Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/*
* Some simple primitives for allocation with explicit type information.
* Facilities for dynamic type inference may be added later.
* Should be used only for extremely performance critical applications,
* or if conservative collector leakage is otherwise a problem (unlikely).
* Note that this is implemented completely separately from the rest
* of the collector, and is not linked in unless referenced.
* This does not currently support GC_DEBUG in any interesting way.
*/
/* Boehm, May 19, 1994 2:13 pm PDT */
#ifndef _GC_TYPED_H
# define _GC_TYPED_H
# ifndef _GC_H
# include "gc.h"
# endif
typedef GC_word * GC_bitmap;
/* The least significant bit of the first word is one if */
/* the first word in the object may be a pointer. */
# define GC_get_bit(bm, index) \
(((bm)[divWORDSZ(index)] >> modWORDSZ(index)) & 1)
# define GC_set_bit(bm, index) \
(bm)[divWORDSZ(index)] |= (word)1 << modWORDSZ(index)
typedef GC_word GC_descr;
GC_API GC_descr GC_make_descriptor GC_PROTO((GC_bitmap bm, size_t len));
/* Return a type descriptor for the object whose layout */
/* is described by the argument. */
/* The least significant bit of the first word is one */
/* if the first word in the object may be a pointer. */
/* The second argument specifies the number of */
/* meaningful bits in the bitmap. The actual object */
/* may be larger (but not smaller). Any additional */
/* words in the object are assumed not to contain */
/* pointers. */
/* Returns a conservative approximation in the */
/* (unlikely) case of insufficient memory to build */
/* the descriptor. Calls to GC_make_descriptor */
/* may consume some amount of a finite resource. This */
/* is intended to be called once per type, not once */
/* per allocation. */
GC_API GC_PTR GC_malloc_explicitly_typed
GC_PROTO((size_t size_in_bytes, GC_descr d));
/* Allocate an object whose layout is described by d. */
/* The resulting object MAY NOT BE PASSED TO REALLOC. */
GC_API GC_PTR GC_malloc_explicitly_typed_ignore_off_page
GC_PROTO((size_t size_in_bytes, GC_descr d));
GC_API GC_PTR GC_calloc_explicitly_typed
GC_PROTO((size_t nelements,
size_t element_size_in_bytes,
GC_descr d));
/* Allocate an array of nelements elements, each of the */
/* given size, and with the given descriptor. */
/* The elemnt size must be a multiple of the byte */
/* alignment required for pointers. E.g. on a 32-bit */
/* machine with 16-bit aligned pointers, size_in_bytes */
/* must be a multiple of 2. */
#ifdef GC_DEBUG
# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) GC_MALLOC(bytes)
# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes)
#else
# define GC_MALLOC_EXPLICTLY_TYPED(bytes, d) \
GC_malloc_explicitly_typed(bytes, d)
# define GC_CALLOC_EXPLICTLY_TYPED(n, bytes, d) \
GC_calloc_explicitly_typed(n, bytes, d)
#endif /* !GC_DEBUG */
#endif /* _GC_TYPED_H */

View File

@ -1,965 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
* Copyright (c) 1996 by Silicon Graphics. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
#ifndef CONFIG_H
# define CONFIG_H
/* Machine dependent parameters. Some tuning parameters can be found */
/* near the top of gc_private.h. */
/* Machine specific parts contributed by various people. See README file. */
/* Determine the machine type: */
# if defined(sun) && defined(mc68000)
# define M68K
# define SUNOS4
# define mach_type_known
# endif
# if defined(hp9000s300)
# define M68K
# define HP
# define mach_type_known
# endif
# if defined(__NetBSD__) && defined(m68k)
# define M68K
# define NETBSD
# define mach_type_known
# endif
# if defined(vax)
# define VAX
# ifdef ultrix
# define ULTRIX
# else
# define BSD
# endif
# define mach_type_known
# endif
# if defined(mips) || defined(__mips)
# define MIPS
# if defined(ultrix) || defined(__ultrix) || defined(__NetBSD__)
# define ULTRIX
# else
# if defined(_SYSTYPE_SVR4) || defined(SYSTYPE_SVR4) || defined(__SYSTYPE_SVR4__)
# define IRIX5 /* or IRIX 6.X */
# else
# define RISCOS /* or IRIX 4.X */
# endif
# endif
# define mach_type_known
# endif
# if defined(sequent) && defined(i386)
# define I386
# define SEQUENT
# define mach_type_known
# endif
# if defined(sun) && defined(i386)
# define I386
# define SUNOS5
# define mach_type_known
# endif
# if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__)
# define I386
# define OS2
# define mach_type_known
# endif
# if defined(ibm032)
# define RT
# define mach_type_known
# endif
# if defined(sun) && (defined(sparc) || defined(__sparc))
# define SPARC
/* Test for SunOS 5.x */
# include <errno.h>
# ifdef ECHRNG
# define SUNOS5
# else
# define SUNOS4
# endif
# define mach_type_known
# endif
# if defined(sparc) && defined(unix) && !defined(sun)
# define SPARC
# define DRSNX
# define mach_type_known
# endif
# if defined(_IBMR2)
# define RS6000
# define mach_type_known
# endif
# if defined(_M_XENIX) && defined(_M_SYSV) && defined(_M_I386)
/* The above test may need refinement */
# define I386
# if defined(_SCO_ELF)
# define SCO_ELF
# else
# define SCO
# endif
# define mach_type_known
# endif
# if defined(_AUX_SOURCE)
# define M68K
# define SYSV
# define mach_type_known
# endif
# if defined(_PA_RISC1_0) || defined(_PA_RISC1_1)
# define HP_PA
# define mach_type_known
# endif
# if defined(linux) && defined(i386)
# define I386
# define LINUX
# define mach_type_known
# endif
# if defined(linux) && defined(powerpc)
# define POWERPC
# define LINUX
# define mach_type_known
# endif
# if defined(__alpha) || defined(__alpha__)
# define ALPHA
# if defined(linux) || defined(__linux__)
# define LINUX
# else
# define OSF1 /* a.k.a Digital Unix */
# endif
# define mach_type_known
# endif
# if defined(_AMIGA)
# define M68K
# define AMIGA
# define mach_type_known
# endif
# if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
# define M68K
# define MACOS
# define mach_type_known
# endif
# if defined(__MWERKS__) && defined(__powerc)
# define POWERPC
# define MACOS
# define mach_type_known
# endif
# if defined(NeXT) && defined(mc68000)
# define M68K
# define NEXT
# define mach_type_known
# endif
# if defined(NeXT) && defined(i386)
# define I386
# define NEXT
# define mach_type_known
# endif
# if defined(__FreeBSD__) && defined(i386)
# define I386
# define FREEBSD
# define mach_type_known
# endif
# if defined(__NetBSD__) && defined(i386)
# define I386
# define NETBSD
# define mach_type_known
# endif
# if defined(bsdi) && defined(i386)
# define I386
# define BSDI
# define mach_type_known
# endif
# if !defined(mach_type_known) && defined(__386BSD__)
# define I386
# define THREE86BSD
# define mach_type_known
# endif
# if defined(_CX_UX) && defined(_M88K)
# define M88K
# define CX_UX
# define mach_type_known
# endif
# if defined(DGUX)
# define M88K
/* DGUX defined */
# define mach_type_known
# endif
# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300)
# define I386
# define MSWIN32 /* or Win32s */
# define mach_type_known
# endif
# if defined(__DJGPP__)
# define I386
# ifndef DJGPP
# define DJGPP /* MSDOS running the DJGPP port of GCC */
# endif
# define mach_type_known
# endif
# if defined(__CYGWIN32__)
# define I386
# define CYGWIN32
# define mach_type_known
# endif
# if defined(__BORLANDC__)
# define I386
# define MSWIN32
# define mach_type_known
# endif
# if defined(_UTS) && !defined(mach_type_known)
# define S370
# define UTS4
# define mach_type_known
# endif
/* Ivan Demakov */
# if defined(__WATCOMC__) && defined(__386__)
# define I386
# if !defined(OS2) && !defined(MSWIN32) && !defined(DOS4GW)
# if defined(__OS2__)
# define OS2
# else
# if defined(__WINDOWS_386__) || defined(__NT__)
# define MSWIN32
# else
# define DOS4GW
# endif
# endif
# endif
# define mach_type_known
# endif
/* Feel free to add more clauses here */
/* Or manually define the machine type here. A machine type is */
/* characterized by the architecture. Some */
/* machine types are further subdivided by OS. */
/* the macros ULTRIX, RISCOS, and BSD to distinguish. */
/* Note that SGI IRIX is treated identically to RISCOS. */
/* SYSV on an M68K actually means A/UX. */
/* The distinction in these cases is usually the stack starting address */
# ifndef mach_type_known
--> unknown machine type
# endif
/* Mapping is: M68K ==> Motorola 680X0 */
/* (SUNOS4,HP,NEXT, and SYSV (A/UX), */
/* MACOS and AMIGA variants) */
/* I386 ==> Intel 386 */
/* (SEQUENT, OS2, SCO, LINUX, NETBSD, */
/* FREEBSD, THREE86BSD, MSWIN32, */
/* BSDI, SUNOS5, NEXT variants) */
/* NS32K ==> Encore Multimax */
/* MIPS ==> R2000 or R3000 */
/* (RISCOS, ULTRIX variants) */
/* VAX ==> DEC VAX */
/* (BSD, ULTRIX variants) */
/* RS6000 ==> IBM RS/6000 AIX3.X */
/* RT ==> IBM PC/RT */
/* HP_PA ==> HP9000/700 & /800 */
/* HP/UX */
/* SPARC ==> SPARC under SunOS */
/* (SUNOS4, SUNOS5, */
/* DRSNX variants) */
/* ALPHA ==> DEC Alpha */
/* (OSF1 and LINUX variants) */
/* M88K ==> Motorola 88XX0 */
/* (CX_UX and DGUX) */
/* S370 ==> 370-like machine */
/* running Amdahl UTS4 */
/*
* For each architecture and OS, the following need to be defined:
*
* CPP_WORD_SZ is a simple integer constant representing the word size.
* in bits. We assume byte addressibility, where a byte has 8 bits.
* We also assume CPP_WORD_SZ is either 32 or 64.
* (We care about the length of pointers, not hardware
* bus widths. Thus a 64 bit processor with a C compiler that uses
* 32 bit pointers should use CPP_WORD_SZ of 32, not 64. Default is 32.)
*
* MACH_TYPE is a string representation of the machine type.
* OS_TYPE is analogous for the OS.
*
* ALIGNMENT is the largest N, such that
* all pointer are guaranteed to be aligned on N byte boundaries.
* defining it to be 1 will always work, but perform poorly.
*
* DATASTART is the beginning of the data segment.
* On UNIX systems, the collector will scan the area between DATASTART
* and DATAEND for root pointers.
*
* DATAEND, if not &end.
*
* ALIGN_DOUBLE of GC_malloc should return blocks aligned to twice
* the pointer size.
*
* STACKBOTTOM is the cool end of the stack, which is usually the
* highest address in the stack.
* Under PCR or OS/2, we have other ways of finding thread stacks.
* For each machine, the following should:
* 1) define STACK_GROWS_UP if the stack grows toward higher addresses, and
* 2) define exactly one of
* STACKBOTTOM (should be defined to be an expression)
* HEURISTIC1
* HEURISTIC2
* If either of the last two macros are defined, then STACKBOTTOM is computed
* during collector startup using one of the following two heuristics:
* HEURISTIC1: Take an address inside GC_init's frame, and round it up to
* the next multiple of STACK_GRAN.
* HEURISTIC2: Take an address inside GC_init's frame, increment it repeatedly
* in small steps (decrement if STACK_GROWS_UP), and read the value
* at each location. Remember the value when the first
* Segmentation violation or Bus error is signalled. Round that
* to the nearest plausible page boundary, and use that instead
* of STACKBOTTOM.
*
* If no expression for STACKBOTTOM can be found, and neither of the above
* heuristics are usable, the collector can still be used with all of the above
* undefined, provided one of the following is done:
* 1) GC_mark_roots can be changed to somehow mark from the correct stack(s)
* without reference to STACKBOTTOM. This is appropriate for use in
* conjunction with thread packages, since there will be multiple stacks.
* (Allocating thread stacks in the heap, and treating them as ordinary
* heap data objects is also possible as a last resort. However, this is
* likely to introduce significant amounts of excess storage retention
* unless the dead parts of the thread stacks are periodically cleared.)
* 2) Client code may set GC_stackbottom before calling any GC_ routines.
* If the author of the client code controls the main program, this is
* easily accomplished by introducing a new main program, setting
* GC_stackbottom to the address of a local variable, and then calling
* the original main program. The new main program would read something
* like:
*
* # include "gc_private.h"
*
* main(argc, argv, envp)
* int argc;
* char **argv, **envp;
* {
* int dummy;
*
* GC_stackbottom = (ptr_t)(&dummy);
* return(real_main(argc, argv, envp));
* }
*
*
* Each architecture may also define the style of virtual dirty bit
* implementation to be used:
* MPROTECT_VDB: Write protect the heap and catch faults.
* PROC_VDB: Use the SVR4 /proc primitives to read dirty bits.
*
* An architecture may define DYNAMIC_LOADING if dynamic_load.c
* defined GC_register_dynamic_libraries() for the architecture.
*/
# define STACK_GRAN 0x1000000
# ifdef M68K
# define MACH_TYPE "M68K"
# define ALIGNMENT 2
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# define HEURISTIC2
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef SUNOS4
# define OS_TYPE "SUNOS4"
extern char etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ffff) & ~0x1ffff))
# define HEURISTIC1 /* differs */
# define DYNAMIC_LOADING
# endif
# ifdef HP
# define OS_TYPE "HP"
extern char etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t) 0xffeffffc)
/* empirically determined. seems to work. */
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
# endif
# ifdef SYSV
# define OS_TYPE "SYSV"
extern etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
& ~0x3fffff) \
+((word)&etext & 0x1fff))
/* This only works for shared-text binaries with magic number 0413.
The other sorts of SysV binaries put the data at the end of the text,
in which case the default of &etext would work. Unfortunately,
handling both would require having the magic-number available.
-- Parag
*/
# define STACKBOTTOM ((ptr_t)0xFFFFFFFE)
/* The stack starts at the top of memory, but */
/* 0x0 cannot be used as setjump_test complains */
/* that the stack direction is incorrect. Two */
/* bytes down from 0x0 should be safe enough. */
/* --Parag */
# include <sys/mmu.h>
# define GETPAGESIZE() PAGESIZE /* Is this still right? */
# endif
# ifdef AMIGA
# define OS_TYPE "AMIGA"
/* STACKBOTTOM and DATASTART handled specially */
/* in os_dep.c */
# define DATAEND /* not needed */
# define GETPAGESIZE() 4096
# endif
# ifdef MACOS
# ifndef __LOWMEM__
# include <LowMem.h>
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
# define DATAEND /* not needed */
# define GETPAGESIZE() 4096
# endif
# ifdef NEXT
# define OS_TYPE "NEXT"
# define DATASTART ((ptr_t) get_etext())
# define STACKBOTTOM ((ptr_t) 0x4000000)
# define DATAEND /* not needed */
# endif
# endif
# ifdef POWERPC
# define MACH_TYPE "POWERPC"
# define ALIGNMENT 2
# ifdef MACOS
# ifndef __LOWMEM__
# include <LowMem.h>
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# define STACKBOTTOM ((ptr_t) LMGetCurStackBase())
# define DATAEND /* not needed */
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define STACKBOTTOM ((ptr_t)0x80000000)
# define DATASTART GC_data_start
extern int _end;
# define DATAEND (&_end)
# endif
# endif
# ifdef VAX
# define MACH_TYPE "VAX"
# define ALIGNMENT 4 /* Pointers are longword aligned by 4.2 C compiler */
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# ifdef BSD
# define OS_TYPE "BSD"
# define HEURISTIC1
/* HEURISTIC2 may be OK, but it's hard to test. */
# endif
# ifdef ULTRIX
# define OS_TYPE "ULTRIX"
# define STACKBOTTOM ((ptr_t) 0x7fffc800)
# endif
# endif
# ifdef RT
# define MACH_TYPE "RT"
# define ALIGNMENT 4
# define DATASTART ((ptr_t) 0x10000000)
# define STACKBOTTOM ((ptr_t) 0x1fffd800)
# endif
# ifdef SPARC
# define MACH_TYPE "SPARC"
# define ALIGNMENT 4 /* Required by hardware */
# define ALIGN_DOUBLE
extern int etext;
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int _etext;
extern int _end;
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
# ifndef USE_MMAP
# define USE_MMAP
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# define PROC_VDB
# define HEURISTIC1
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
/* getpagesize() appeared to be missing from at least one */
/* Solaris 5.4 installation. Weird. */
# endif
# ifdef SUNOS4
# define OS_TYPE "SUNOS4"
/* [If you have a weak stomach, don't read this.] */
/* We would like to use: */
/* # define DATASTART ((ptr_t)((((word) (&etext)) + 0x1fff) & ~0x1fff)) */
/* This fails occasionally, due to an ancient, but very */
/* persistent ld bug. &etext is set 32 bytes too high. */
/* We instead read the text segment size from the a.out */
/* header, which happens to be mapped into our address space */
/* at the start of the text segment. The detective work here */
/* was done by Robert Ehrlich, Manuel Serrano, and Bernard */
/* Serpette of INRIA. */
/* This assumes ZMAGIC, i.e. demand-loadable executables. */
# define TEXTSTART 0x2000
# define DATASTART ((ptr_t)(*(int *)(TEXTSTART+0x4)+TEXTSTART))
# define MPROTECT_VDB
# define HEURISTIC1
# endif
# ifdef DRSNX
# define CPP_WORDSZ 32
# define OS_TYPE "DRSNX"
extern char * GC_SysVGetDataStart();
extern int etext;
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
# define MPROTECT_VDB
# define STACKBOTTOM ((ptr_t) 0xdfff0000)
# endif
# define DYNAMIC_LOADING
# endif
# ifdef I386
# define MACH_TYPE "I386"
# define ALIGNMENT 4 /* Appears to hold for all "32 bit" compilers */
/* except Borland. The -a4 option fixes */
/* Borland. */
/* Ivan Demakov: For Watcom the option is -zp4. */
# ifndef SMALL_CONFIG
# define ALIGN_DOUBLE /* Not strictly necessary, but may give speed */
/* improvement on Pentiums. */
# endif
# ifdef SEQUENT
# define OS_TYPE "SEQUENT"
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# define STACKBOTTOM ((ptr_t) 0x3ffff000)
# endif
# ifdef SUNOS5
# define OS_TYPE "SUNOS5"
extern int etext, _start;
extern char * GC_SysVGetDataStart();
# define DATASTART GC_SysVGetDataStart(0x1000, &etext)
# define STACKBOTTOM ((ptr_t)(&_start))
/** At least in Solaris 2.5, PROC_VDB gives wrong values for dirty bits. */
/*# define PROC_VDB*/
# define DYNAMIC_LOADING
# ifndef USE_MMAP
# define USE_MMAP
# endif
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x40000000
# else
# define HEAP_START DATAEND
# endif
# endif
# ifdef SCO
# define OS_TYPE "SCO"
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x3fffff) \
& ~0x3fffff) \
+((word)&etext & 0xfff))
# define STACKBOTTOM ((ptr_t) 0x7ffffffc)
# endif
# ifdef SCO_ELF
# define OS_TYPE "SCO_ELF"
extern int etext;
# define DATASTART ((ptr_t)(&etext))
# define STACKBOTTOM ((ptr_t) 0x08048000)
# define DYNAMIC_LOADING
# define ELF_CLASS ELFCLASS32
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define STACKBOTTOM ((ptr_t)0xc0000000)
/* Appears to be 0xe0000000 for at least one 2.1.91 kernel. */
/* Probably needs to be more flexible, but I don't yet */
/* fully understand how flexible. */
# define MPROTECT_VDB
# ifdef __ELF__
# define DYNAMIC_LOADING
# ifdef UNDEFINED /* includes ro data */
extern int _etext;
# define DATASTART ((ptr_t)((((word) (&_etext)) + 0xfff) & ~0xfff))
# endif
# include <linux/version.h>
# include <features.h>
# if LINUX_VERSION_CODE >= 0x20000 && defined(__GLIBC__) && __GLIBC__ >= 2
extern int __data_start;
# define DATASTART ((ptr_t)(&__data_start))
# else
extern char **__environ;
# define DATASTART ((ptr_t)(&__environ))
/* hideous kludge: __environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
/* ld options were passed through. */
/* We could use _etext instead, but that */
/* would include .rodata, which may */
/* contain large read-only data tables */
/* that we'd rather not scan. */
# endif
extern int _end;
# define DATAEND (&_end)
# else
extern int etext;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0xfff) & ~0xfff))
# endif
# endif
# ifdef CYGWIN32
extern int _data_start__;
extern int _data_end__;
extern int _bss_start__;
extern int _bss_end__;
/* For binutils 2.9.1, we have */
/* DATASTART = _data_start__ */
/* DATAEND = _bss_end__ */
/* whereas for some earlier versions it was */
/* DATASTART = _bss_start__ */
/* DATAEND = _data_end__ */
/* To get it right for both, we take the */
/* minumum/maximum of the two. */
# define MAX(x,y) ((x) > (y) ? (x) : (y))
# define MIN(x,y) ((x) < (y) ? (x) : (y))
# define DATASTART ((ptr_t) MIN(_data_start__, _bss_start__))
# define DATAEND ((ptr_t) MAX(_data_end__, _bss_end__))
# undef STACK_GRAN
# define STACK_GRAN 0x10000
# define HEURISTIC1
# endif
# ifdef OS2
# define OS_TYPE "OS2"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. OS2 actually has the right */
/* system call! */
# define DATAEND /* not needed */
# endif
# ifdef MSWIN32
# define OS_TYPE "MSWIN32"
/* STACKBOTTOM and DATASTART are handled specially in */
/* os_dep.c. */
# ifndef __WATCOMC__
# define MPROTECT_VDB
# endif
# define DATAEND /* not needed */
# endif
# ifdef DJGPP
# define OS_TYPE "DJGPP"
# include "stubinfo.h"
extern int etext;
extern int _stklen;
# define DATASTART ((ptr_t)((((word) (&etext)) + 0x1ff) & ~0x1ff))
# define STACKBOTTOM ((ptr_t)((word) _stubinfo + _stubinfo->size \
+ _stklen))
/* This may not be right. */
# endif
# ifdef FREEBSD
# define OS_TYPE "FREEBSD"
# define MPROTECT_VDB
# endif
# ifdef NETBSD
# define OS_TYPE "NETBSD"
# endif
# ifdef THREE86BSD
# define OS_TYPE "THREE86BSD"
# endif
# ifdef BSDI
# define OS_TYPE "BSDI"
# endif
# if defined(FREEBSD) || defined(NETBSD) \
|| defined(THREE86BSD) || defined(BSDI)
# define HEURISTIC2
extern char etext;
# define DATASTART ((ptr_t)(&etext))
# endif
# ifdef NEXT
# define OS_TYPE "NEXT"
# define DATASTART ((ptr_t) get_etext())
# define STACKBOTTOM ((ptr_t)0xc0000000)
# define DATAEND /* not needed */
# endif
# ifdef DOS4GW
# define OS_TYPE "DOS4GW"
/* Get_DATASTART, Get_DATAEND, Get_STACKBOTTOM
* Defined in gc-watcom.asm
*/
extern char* Get_DATASTART (void);
extern char* Get_DATAEND (void);
extern char* Get_STACKBOTTOM (void);
# pragma aux Get_DATASTART "*" value [eax];
# pragma aux Get_DATAEND "*" value [eax];
# pragma aux Get_STACKBOTTOM "*" value [eax];
# define DATASTART ((ptr_t) Get_DATASTART())
# define STACKBOTTOM ((ptr_t) Get_STACKBOTTOM())
# define DATAEND ((ptr_t) Get_DATAEND())
# endif
# endif
# ifdef NS32K
# define MACH_TYPE "NS32K"
# define ALIGNMENT 4
extern char **environ;
# define DATASTART ((ptr_t)(&environ))
/* hideous kludge: environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
/* ld options were passed through. */
# define STACKBOTTOM ((ptr_t) 0xfffff000) /* for Encore */
# endif
# ifdef MIPS
# define MACH_TYPE "MIPS"
# ifndef IRIX5
# define DATASTART (ptr_t)0x10000000
/* Could probably be slightly higher since */
/* startup code allocates lots of stuff. */
# else
extern int _fdata;
# define DATASTART ((ptr_t)(&_fdata))
# ifdef USE_MMAP
# define HEAP_START (ptr_t)0x30000000
# else
# define HEAP_START DATASTART
# endif
/* Lowest plausible heap address. */
/* In the MMAP case, we map there. */
/* In either case it is used to identify */
/* heap sections so they're not */
/* considered as roots. */
# endif /* IRIX5 */
# define HEURISTIC2
/* # define STACKBOTTOM ((ptr_t)0x7fff8000) sometimes also works. */
# ifdef ULTRIX
# define OS_TYPE "ULTRIX"
# define ALIGNMENT 4
# endif
# ifdef RISCOS
# define OS_TYPE "RISCOS"
# define ALIGNMENT 4 /* Required by hardware */
# endif
# ifdef IRIX5
# define OS_TYPE "IRIX5"
# define MPROTECT_VDB
# ifdef _MIPS_SZPTR
# define CPP_WORDSZ _MIPS_SZPTR
# define ALIGNMENT (_MIPS_SZPTR/8)
# if CPP_WORDSZ != 64
# define ALIGN_DOUBLE
# endif
# else
# define ALIGNMENT 4
# define ALIGN_DOUBLE
# endif
# define DYNAMIC_LOADING
# endif
# endif
# ifdef RS6000
# define MACH_TYPE "RS6000"
# define ALIGNMENT 4
# define DATASTART ((ptr_t)0x20000000)
extern int errno;
# define STACKBOTTOM ((ptr_t)((ulong)&errno))
# define DYNAMIC_LOADING
/* For really old versions of AIX, this may have to be removed. */
# endif
# ifdef HP_PA
# define MACH_TYPE "HP_PA"
# define ALIGNMENT 4
# define ALIGN_DOUBLE
extern int __data_start;
# define DATASTART ((ptr_t)(&__data_start))
# if 0
/* The following appears to work for 7xx systems running HP/UX */
/* 9.xx Furthermore, it might result in much faster */
/* collections than HEURISTIC2, which may involve scanning */
/* segments that directly precede the stack. It is not the */
/* default, since it may not work on older machine/OS */
/* combinations. (Thanks to Raymond X.T. Nijssen for uncovering */
/* this.) */
# define STACKBOTTOM ((ptr_t) 0x7b033000) /* from /etc/conf/h/param.h */
# else
# define HEURISTIC2
# endif
# define STACK_GROWS_UP
# define DYNAMIC_LOADING
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE)
/* They misspelled the Posix macro? */
# endif
# ifdef ALPHA
# define MACH_TYPE "ALPHA"
# define ALIGNMENT 8
# ifdef OSF1
# define OS_TYPE "OSF1"
# define DATASTART ((ptr_t) 0x140000000)
# define HEURISTIC2
/* Normally HEURISTIC2 is too conervative, since */
/* the text segment immediately follows the stack. */
/* Hence we give an upper pound. */
extern __start;
# define HEURISTIC2_LIMIT ((ptr_t)((word)(&__start) & ~(getpagesize()-1)))
# define CPP_WORDSZ 64
# define MPROTECT_VDB
# define DYNAMIC_LOADING
# endif
# ifdef LINUX
# define OS_TYPE "LINUX"
# define CPP_WORDSZ 64
# define STACKBOTTOM ((ptr_t) 0x120000000)
# ifdef __ELF__
extern int __data_start;
# define DATASTART &__data_start
# define DYNAMIC_LOADING
# else
# define DATASTART ((ptr_t) 0x140000000)
# endif
extern int _end;
# define DATAEND (&_end)
/* As of 1.3.90, I couldn't find a way to retrieve the correct */
/* fault address from a signal handler. */
/* Hence MPROTECT_VDB is broken. */
# endif
# endif
# ifdef M88K
# define MACH_TYPE "M88K"
# define ALIGNMENT 4
# define ALIGN_DOUBLE
extern int etext;
# ifdef CX_UX
# define OS_TYPE "CX_UX"
# define DATASTART ((((word)&etext + 0x3fffff) & ~0x3fffff) + 0x10000)
# endif
# ifdef DGUX
# define OS_TYPE "DGUX"
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &etext)
# endif
# define STACKBOTTOM ((char*)0xf0000000) /* determined empirically */
# endif
# ifdef S370
# define MACH_TYPE "S370"
# define OS_TYPE "UTS4"
# define ALIGNMENT 4 /* Required by hardware */
extern int etext;
extern int _etext;
extern int _end;
extern char * GC_SysVGetDataStart();
# define DATASTART (ptr_t)GC_SysVGetDataStart(0x10000, &_etext)
# define DATAEND (&_end)
# define HEURISTIC2
# endif
# ifndef STACK_GROWS_UP
# define STACK_GROWS_DOWN
# endif
# ifndef CPP_WORDSZ
# define CPP_WORDSZ 32
# endif
# ifndef OS_TYPE
# define OS_TYPE ""
# endif
# ifndef DATAEND
extern int end;
# define DATAEND (&end)
# endif
# if defined(SVR4) && !defined(GETPAGESIZE)
# include <unistd.h>
# define GETPAGESIZE() sysconf(_SC_PAGESIZE)
# endif
# ifndef GETPAGESIZE
# if defined(SUNOS5) || defined(IRIX5)
# include <unistd.h>
# endif
# define GETPAGESIZE() getpagesize()
# endif
# if defined(SUNOS5) || defined(DRSNX) || defined(UTS4)
/* OS has SVR4 generic features. Probably others also qualify. */
# define SVR4
# endif
# if defined(SUNOS5) || defined(DRSNX)
/* OS has SUNOS5 style semi-undocumented interface to dynamic */
/* loader. */
# define SUNOS5DL
/* OS has SUNOS5 style signal handlers. */
# define SUNOS5SIGS
# endif
# if CPP_WORDSZ != 32 && CPP_WORDSZ != 64
-> bad word size
# endif
# ifdef PCR
# undef DYNAMIC_LOADING
# undef STACKBOTTOM
# undef HEURISTIC1
# undef HEURISTIC2
# undef PROC_VDB
# undef MPROTECT_VDB
# define PCR_VDB
# endif
# ifdef SRC_M3
/* Postponed for now. */
# undef PROC_VDB
# undef MPROTECT_VDB
# endif
# ifdef SMALL_CONFIG
/* Presumably not worth the space it takes. */
# undef PROC_VDB
# undef MPROTECT_VDB
# endif
# if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB)
# define DEFAULT_VDB
# endif
# if defined(IRIX_THREADS) && !defined(IRIX5)
--> inconsistent configuration
# endif
# if defined(LINUX_THREADS) && !defined(LINUX)
--> inconsistent configuration
# endif
# if defined(SOLARIS_THREADS) && !defined(SUNOS5)
--> inconsistent configuration
# endif
# if defined(PCR) || defined(SRC_M3) || \
defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || \
defined(IRIX_THREADS) || defined(LINUX_THREADS)
# define THREADS
# endif
# if defined(SPARC)
# define SAVE_CALL_CHAIN
# define ASM_CLEAR_CODE /* Stack clearing is crucial, and we */
/* include assembly code to do it well. */
# endif
# endif

View File

@ -1,118 +0,0 @@
/*
* Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, May 19, 1994 2:23 pm PDT */
# ifndef CORD_POSITION_H
/* The representation of CORD_position. This is private to the */
/* implementation, but the size is known to clients. Also */
/* the implementation of some exported macros relies on it. */
/* Don't use anything defined here and not in cord.h. */
# define MAX_DEPTH 48
/* The maximum depth of a balanced cord + 1. */
/* We don't let cords get deeper than MAX_DEPTH. */
struct CORD_pe {
CORD pe_cord;
size_t pe_start_pos;
};
/* A structure describing an entry on the path from the root */
/* to current position. */
typedef struct CORD_Pos {
size_t cur_pos;
int path_len;
# define CORD_POS_INVALID (0x55555555)
/* path_len == INVALID <==> position invalid */
const char *cur_leaf; /* Current leaf, if it is a string. */
/* If the current leaf is a function, */
/* then this may point to function_buf */
/* containing the next few characters. */
/* Always points to a valid string */
/* containing the current character */
/* unless cur_end is 0. */
size_t cur_start; /* Start position of cur_leaf */
size_t cur_end; /* Ending position of cur_leaf */
/* 0 if cur_leaf is invalid. */
struct CORD_pe path[MAX_DEPTH + 1];
/* path[path_len] is the leaf corresponding to cur_pos */
/* path[0].pe_cord is the cord we point to. */
# define FUNCTION_BUF_SZ 8
char function_buf[FUNCTION_BUF_SZ]; /* Space for next few chars */
/* from function node. */
} CORD_pos[1];
/* Extract the cord from a position: */
CORD CORD_pos_to_cord(CORD_pos p);
/* Extract the current index from a position: */
size_t CORD_pos_to_index(CORD_pos p);
/* Fetch the character located at the given position: */
char CORD_pos_fetch(CORD_pos p);
/* Initialize the position to refer to the give cord and index. */
/* Note that this is the most expensive function on positions: */
void CORD_set_pos(CORD_pos p, CORD x, size_t i);
/* Advance the position to the next character. */
/* P must be initialized and valid. */
/* Invalidates p if past end: */
void CORD_next(CORD_pos p);
/* Move the position to the preceding character. */
/* P must be initialized and valid. */
/* Invalidates p if past beginning: */
void CORD_prev(CORD_pos p);
/* Is the position valid, i.e. inside the cord? */
int CORD_pos_valid(CORD_pos p);
char CORD__pos_fetch(CORD_pos);
void CORD__next(CORD_pos);
void CORD__prev(CORD_pos);
#define CORD_pos_fetch(p) \
(((p)[0].cur_end != 0)? \
(p)[0].cur_leaf[(p)[0].cur_pos - (p)[0].cur_start] \
: CORD__pos_fetch(p))
#define CORD_next(p) \
(((p)[0].cur_pos + 1 < (p)[0].cur_end)? \
(p)[0].cur_pos++ \
: (CORD__next(p), 0))
#define CORD_prev(p) \
(((p)[0].cur_end != 0 && (p)[0].cur_pos > (p)[0].cur_start)? \
(p)[0].cur_pos-- \
: (CORD__prev(p), 0))
#define CORD_pos_to_index(p) ((p)[0].cur_pos)
#define CORD_pos_to_cord(p) ((p)[0].path[0].pe_cord)
#define CORD_pos_valid(p) ((p)[0].path_len != CORD_POS_INVALID)
/* Some grubby stuff for performance-critical friends: */
#define CORD_pos_chars_left(p) ((long)((p)[0].cur_end) - (long)((p)[0].cur_pos))
/* Number of characters in cache. <= 0 ==> none */
#define CORD_pos_advance(p,n) ((p)[0].cur_pos += (n) - 1, CORD_next(p))
/* Advance position by n characters */
/* 0 < n < CORD_pos_chars_left(p) */
#define CORD_pos_cur_char_addr(p) \
(p)[0].cur_leaf + ((p)[0].cur_pos - (p)[0].cur_start)
/* address of current character in cache. */
#endif

View File

@ -1,133 +0,0 @@
/*
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
*
* THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
* OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
*
* Permission is hereby granted to use or copy this program
* for any purpose, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*/
/* Boehm, July 11, 1995 11:54 am PDT */
# ifndef GC_HEADERS_H
# define GC_HEADERS_H
typedef struct hblkhdr hdr;
# if CPP_WORDSZ != 32 && CPP_WORDSZ < 36
--> Get a real machine.
# endif
/*
* The 2 level tree data structure that is used to find block headers.
* If there are more than 32 bits in a pointer, the top level is a hash
* table.
*/
# if CPP_WORDSZ > 32
# define HASH_TL
# endif
/* Define appropriate out-degrees for each of the two tree levels */
# ifdef SMALL_CONFIG
# define LOG_BOTTOM_SZ 11
/* Keep top index size reasonable with smaller blocks. */
# else
# define LOG_BOTTOM_SZ 10
# endif
# ifndef HASH_TL
# define LOG_TOP_SZ (WORDSZ - LOG_BOTTOM_SZ - LOG_HBLKSIZE)
# else
# define LOG_TOP_SZ 11
# endif
# define TOP_SZ (1 << LOG_TOP_SZ)
# define BOTTOM_SZ (1 << LOG_BOTTOM_SZ)
typedef struct bi {
hdr * index[BOTTOM_SZ];
/*
* The bottom level index contains one of three kinds of values:
* 0 means we're not responsible for this block.
* 1 < (long)X <= MAX_JUMP means the block starts at least
* X * HBLKSIZE bytes before the current address.
* A valid pointer points to a hdr structure. (The above can't be
* valid pointers due to the GET_MEM return convention.)
*/
struct bi * asc_link; /* All indices are linked in */
/* ascending order. */
word key; /* high order address bits. */
# ifdef HASH_TL
struct bi * hash_link; /* Hash chain link. */
# endif
} bottom_index;
/* extern bottom_index GC_all_nils; - really part of GC_arrays */
/* extern bottom_index * GC_top_index []; - really part of GC_arrays */
/* Each entry points to a bottom_index. */
/* On a 32 bit machine, it points to */
/* the index for a set of high order */
/* bits equal to the index. For longer */
/* addresses, we hash the high order */
/* bits to compute the index in */
/* GC_top_index, and each entry points */
/* to a hash chain. */
/* The last entry in each chain is */
/* GC_all_nils. */
# define MAX_JUMP (HBLKSIZE - 1)
# define HDR_FROM_BI(bi, p) \
((bi)->index[((word)(p) >> LOG_HBLKSIZE) & (BOTTOM_SZ - 1)])
# ifndef HASH_TL
# define BI(p) (GC_top_index \
[(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE)])
# define HDR_INNER(p) HDR_FROM_BI(BI(p),p)
# ifdef SMALL_CONFIG
# define HDR(p) GC_find_header((ptr_t)(p))
# else
# define HDR(p) HDR_INNER(p)
# endif
# define GET_BI(p, bottom_indx) (bottom_indx) = BI(p)
# define GET_HDR(p, hhdr) (hhdr) = HDR(p)
# define SET_HDR(p, hhdr) HDR_INNER(p) = (hhdr)
# define GET_HDR_ADDR(p, ha) (ha) = &(HDR_INNER(p))
# else /* hash */
/* Hash function for tree top level */
# define TL_HASH(hi) ((hi) & (TOP_SZ - 1))
/* Set bottom_indx to point to the bottom index for address p */
# define GET_BI(p, bottom_indx) \
{ \
register word hi = \
(word)(p) >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE); \
register bottom_index * _bi = GC_top_index[TL_HASH(hi)]; \
\
while (_bi -> key != hi && _bi != GC_all_nils) \
_bi = _bi -> hash_link; \
(bottom_indx) = _bi; \
}
# define GET_HDR_ADDR(p, ha) \
{ \
register bottom_index * bi; \
\
GET_BI(p, bi); \
(ha) = &(HDR_FROM_BI(bi, p)); \
}
# define GET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
(hhdr) = *_ha; }
# define SET_HDR(p, hhdr) { register hdr ** _ha; GET_HDR_ADDR(p, _ha); \
*_ha = (hhdr); }
# define HDR(p) GC_find_header((ptr_t)(p))
# endif
/* Is the result a forwarding address to someplace closer to the */
/* beginning of the block or NIL? */
# define IS_FORWARDING_ADDR_OR_NIL(hhdr) ((unsigned long) (hhdr) <= MAX_JUMP)
/* Get an HBLKSIZE aligned address closer to the beginning of the block */
/* h. Assumes hhdr == HDR(h) and IS_FORWARDING_ADDR(hhdr). */
# define FORWARDED_ADDR(h, hhdr) ((struct hblk *)(h) - (unsigned long)(hhdr))
# endif /* GC_HEADERS_H */

Some files were not shown because too many files have changed in this diff Show More