mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-15 17:10:51 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f71a4bfc2 | ||
|
|
394ed52275 | ||
|
|
8a2d0cb8a7 | ||
|
|
670e1ea3cb | ||
|
|
c759092277 | ||
|
|
93e46c687b | ||
|
|
cc137237d8 | ||
|
|
0fed03ed63 | ||
|
|
5fedc42ccf | ||
|
|
9e1d59b8cc | ||
|
|
ecd67a91c4 | ||
|
|
6a5c44b15e | ||
|
|
202cb6a648 | ||
|
|
dadc3d3117 | ||
|
|
9e00330af3 | ||
|
|
058d157648 | ||
|
|
b6e4ddd73c | ||
|
|
2c20649539 | ||
|
|
4961d411e7 | ||
|
|
27e6e812f1 | ||
|
|
0396037d31 | ||
|
|
a6db160596 | ||
|
|
0c3ffb9cc9 | ||
|
|
b8fe43da3e | ||
|
|
0269f7b479 | ||
|
|
e2ccdac3f4 | ||
|
|
965efade84 | ||
|
|
6785b27567 | ||
|
|
18dd48cad8 | ||
|
|
92dd4d3883 | ||
|
|
3ceecb8db0 | ||
|
|
d3fbf4a1d3 | ||
|
|
00b0170bdc | ||
|
|
c93801d458 | ||
|
|
5645032fc6 | ||
|
|
adcaf88db0 | ||
|
|
1f2f9b929b | ||
|
|
3242b5f354 | ||
|
|
35d94dc8ff | ||
|
|
2a108e958f | ||
|
|
25b7e6bd42 | ||
|
|
805c7f5436 | ||
|
|
19a44cd32b | ||
|
|
1d81534d27 | ||
|
|
a0fcc29d5d | ||
|
|
73431403c7 | ||
|
|
dd18ec40dd | ||
|
|
fe0f824db5 | ||
|
|
eaf895f2d0 | ||
|
|
bd278dd00d | ||
|
|
4728cec01f | ||
|
|
8bceb40878 | ||
|
|
8683fa6db7 | ||
|
|
2b4801d9f1 | ||
|
|
61811075ca | ||
|
|
9eb0bcae57 | ||
|
|
c256fc86b6 | ||
|
|
722c6f7dd5 | ||
|
|
594bbbef25 | ||
|
|
d90030d273 | ||
|
|
9664df7eb3 | ||
|
|
e46f29313d | ||
|
|
5bf661d7f9 | ||
|
|
ae02b6677b | ||
|
|
f9b3b5276d | ||
|
|
ed2d5f69e0 | ||
|
|
73b50890cc | ||
|
|
5b0a822afb | ||
|
|
d5b6cf33b3 | ||
|
|
68d142912d | ||
|
|
23f2baa71e | ||
|
|
3948a065af | ||
|
|
fad91a1c1e | ||
|
|
759a8c1847 | ||
|
|
771b5fb18d | ||
|
|
229d3cc097 | ||
|
|
c0a9d6bf76 | ||
|
|
8637912a99 | ||
|
|
4d579d00ff | ||
|
|
b924ffa5e0 | ||
|
|
2c22d0de2e | ||
|
|
8cc0402967 | ||
|
|
fe69f5b699 | ||
|
|
c1c483cef8 | ||
|
|
d0d779b8d9 | ||
|
|
71b78536ad | ||
|
|
b61263e994 | ||
|
|
9e6b57ce5a | ||
|
|
2c56ac54c0 | ||
|
|
4bdacea237 | ||
|
|
3c84633c7c | ||
|
|
0886ddb3a0 | ||
|
|
7b4b5e72d9 | ||
|
|
0680073b87 | ||
|
|
bda239f44c | ||
|
|
1a6c092019 | ||
|
|
965beadc1e | ||
|
|
e506008ebb | ||
|
|
29ba75c154 |
No files matched your search
+1
-1
@@ -34,7 +34,7 @@
|
||||
/external/corefx @akoeplinger @marek-safar @egorbo @steveisok
|
||||
/external/corert @akoeplinger @marek-safar @egorbo @steveisok
|
||||
/external/linker @marek-safar
|
||||
/external/llvm @SamMonoRT @vargaz @imhameed
|
||||
/external/llvm-project @SamMonoRT @vargaz @imhameed
|
||||
/external/nuget-buildtasks @radical @akoeplinger
|
||||
/external/roslyn-binaries @kg @marek-safar @akoeplinger @lewing
|
||||
|
||||
|
||||
+7
-8
@@ -58,17 +58,16 @@
|
||||
[submodule "external/api-snapshot"]
|
||||
path = external/api-snapshot
|
||||
url = git://github.com/mono/api-snapshot.git
|
||||
[submodule "external/llvm"]
|
||||
path = external/llvm
|
||||
url = git://github.com/mono/llvm.git
|
||||
branch = release_60
|
||||
[submodule "external/helix-binaries"]
|
||||
path = external/helix-binaries
|
||||
url = git://github.com/mono/helix-binaries.git
|
||||
[submodule "external/illinker-test-assets"]
|
||||
path = external/illinker-test-assets
|
||||
url = git://github.com/mono/illinker-test-assets.git
|
||||
[submodule "coreclr"]
|
||||
path = external/coreclr
|
||||
url = git://github.com/mono/coreclr.git
|
||||
branch = mono-coregc
|
||||
[submodule "external/llvm-project"]
|
||||
path = external/llvm-project
|
||||
url = git://github.com/dotnet/llvm-project.git
|
||||
branch = release/6.x
|
||||
[submodule "external/bdwgc"]
|
||||
path = external/bdwgc
|
||||
url = git://github.com/Unity-Technologies/bdwgc.git
|
||||
@@ -67,6 +67,9 @@ dist-hook:
|
||||
rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'`
|
||||
rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*' -not -path '*/helix-binaries/*'`
|
||||
rm -rf "$(top_distdir)/external/linker/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/lldb/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/libcxx/test"
|
||||
rm -rf "$(top_distdir)/external/llvm-project/clang/test"
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
noinst_DATA = mono-uninstalled.pc
|
||||
|
||||
+4
-4
@@ -150,10 +150,10 @@ automake $am_opt ||
|
||||
echo "Running autoconf ..."
|
||||
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
|
||||
|
||||
if test -d $srcdir/libgc; then
|
||||
echo Running libgc/autogen.sh ...
|
||||
(cd $srcdir/libgc ; NOCONFIGURE=1 ./autogen.sh "$@")
|
||||
echo Done running libgc/autogen.sh ...
|
||||
if test -d $srcdir/external/bdwgc; then
|
||||
echo Running external/bdwgc/autogen.sh ...
|
||||
(cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
|
||||
echo Done running external/bdwgc/autogen.sh ...
|
||||
fi
|
||||
|
||||
if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
|
||||
|
||||
+28
-59
@@ -17,7 +17,7 @@ AC_CANONICAL_HOST
|
||||
# The extra brackets are to foil regex-based scans.
|
||||
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 dist-xz tar-ustar no-dist-gzip foreign]
|
||||
AM_INIT_AUTOMAKE([1.9 dist-xz tar-ustar no-dist-gzip foreign subdir-objects]
|
||||
m4_esyscmd([case `automake --version | head -n 1` in # parallel-tests is default in automake 1.13+, we need to explicitly enable it
|
||||
*1.11*|*1.12*) echo parallel-tests;; # for 1.11 and 1.12 but not below as those versions don't recognize the flag
|
||||
esac])) # TODO: remove this hack once we require automake 1.11+
|
||||
@@ -63,7 +63,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
MONO_CORLIB_VERSION=4e2d4257-1f2b-418c-9829-dd006fe09df5
|
||||
MONO_CORLIB_VERSION=423e7794-9279-49a3-a477-f1cb2432e9f4
|
||||
|
||||
#
|
||||
# Put a quoted #define in config.h.
|
||||
@@ -148,7 +148,7 @@ case "$host" in
|
||||
platform_wasm=yes
|
||||
# FIXME:
|
||||
RID="osx-x64"
|
||||
COREARCH="x64"
|
||||
COREARCH="wasm32"
|
||||
CORETARGETS="-p:TargetsUnix=true -p:TargetsOSX=true"
|
||||
build_darwin=yes
|
||||
;;
|
||||
@@ -173,7 +173,6 @@ case "$host" in
|
||||
# Boehm not supported on 64-bit Windows.
|
||||
case "$host" in
|
||||
x86_64-*-* | amd64-*-*)
|
||||
support_boehm=no
|
||||
with_gc=sgen
|
||||
RID="win-x64"
|
||||
COREARCH="x64"
|
||||
@@ -192,9 +191,6 @@ case "$host" in
|
||||
with_tls=pthread
|
||||
with_sgen_default_concurrent=yes
|
||||
LN_S=cp
|
||||
|
||||
# This forces libgc to use the DllMain based thread registration code on win32
|
||||
libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
|
||||
;;
|
||||
*-*-*netbsd*)
|
||||
CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
|
||||
@@ -1351,7 +1347,7 @@ enable_cooperative_suspend_default=no
|
||||
enable_hybrid_suspend_default=no
|
||||
|
||||
# For the sake of clearer error messages, these numbers should all be different from each other.
|
||||
INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=10000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4400,nftnptr-arg-trampolines=4000
|
||||
INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=10000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4400,nftnptr-arg-trampolines=4000,nrgctx-trampolines=21000
|
||||
|
||||
AOT_BUILD_ATTRS=$INVARIANT_AOT_OPTIONS
|
||||
|
||||
@@ -2039,14 +2035,14 @@ if test "x$support_boehm" = "xyes"; then
|
||||
case "x$libgc" in
|
||||
xincluded)
|
||||
if test "x$support_boehm" = "xyes"; then
|
||||
libgc_dir=libgc
|
||||
libgc_dir=external/bdwgc
|
||||
fi
|
||||
|
||||
LIBGC_CPPFLAGS='-I$(top_srcdir)/libgc/include'
|
||||
LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
|
||||
LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
|
||||
LIBGC_CPPFLAGS='-I$(top_srcdir)/external/bdwgc/include -I$(top_srcdir)/external/bdwgc/libatomic_ops/src'
|
||||
LIBGC_LIBS='$(top_builddir)/external/bdwgc/libgc.la'
|
||||
LIBGC_STATIC_LIBS='$(top_builddir)/external/bdwgc/libgc-static.la'
|
||||
|
||||
BOEHM_DEFINES="-DHAVE_BOEHM_GC"
|
||||
BOEHM_DEFINES="-DHAVE_BOEHM_GC -DGC_THREADS"
|
||||
|
||||
if test x$target_win32 = xyes; then
|
||||
BOEHM_DEFINES="$BOEHM_DEFINES -DGC_NOT_DLL"
|
||||
@@ -2179,25 +2175,6 @@ if test x$host_win32 = xno; then
|
||||
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||
AC_CHECK_FUNCS(clock_nanosleep)
|
||||
|
||||
AC_MSG_CHECKING(for _SC_AVPHYS_PAGES)
|
||||
AC_TRY_COMPILE([#include <unistd.h>], [
|
||||
const int foo = _SC_AVPHYS_PAGES;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE__SC_AVPHYS_PAGES, 1, [_SC_AVPHYS_PAGES])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
AC_MSG_CHECKING(for _SC_PHYS_PAGES)
|
||||
AC_TRY_COMPILE([#include <unistd.h>], [
|
||||
const int foo = _SC_PHYS_PAGES;
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE__SC_PHYS_PAGES, 1, [_SC_PHYS_PAGES])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl dynamic loader support
|
||||
AC_CHECK_FUNC(dlopen, DL_LIB="",
|
||||
AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", dl_support=no)
|
||||
@@ -2794,7 +2771,6 @@ if test x$host_win32 = xno; then
|
||||
AC_CHECK_FUNCS(pthread_attr_setstacksize)
|
||||
AC_CHECK_FUNCS(pthread_attr_getstack pthread_attr_getstacksize)
|
||||
AC_CHECK_FUNCS(pthread_get_stacksize_np pthread_get_stackaddr_np)
|
||||
AC_CHECK_FUNCS(pthread_condattr_setclock)
|
||||
dnl check that pthread_mutexattr_setprotocol is declared
|
||||
AC_CHECK_DECLS([pthread_mutexattr_setprotocol], [], [], [[#include <pthread.h>]])
|
||||
AC_CHECK_FUNCS(mincore mlock munlock)
|
||||
@@ -3429,6 +3405,15 @@ if test x$host_win32 = xno; then
|
||||
AC_CHECK_DECL(ICANON, [AC_DEFINE(HAVE_ICANON, 1, [ICANON])], [], [[#include <termios.h>]])
|
||||
AC_CHECK_DECL(TCSANOW, [AC_DEFINE(HAVE_TCSANOW, 1, [TCSANOW])], [], [[#include <termios.h>]])
|
||||
|
||||
AC_CHECK_DECL(lchflags, [AC_DEFINE(HAVE_LCHFLAGS, 1, [lchflags])], [],
|
||||
[[#include <sys/types.h>
|
||||
#include <sys/stat.h>]])
|
||||
AC_CHECK_MEMBER(struct stat.st_flags,
|
||||
[AC_DEFINE(HAVE_STAT_FLAGS, 1, [struct stat.st_flags])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/stat.h>])
|
||||
|
||||
AC_CHECK_MEMBER(struct stat.st_birthtimespec,
|
||||
[AC_DEFINE(HAVE_STAT_BIRTHTIME, 1, [struct stat.st_birthtimespec])],
|
||||
[],
|
||||
@@ -4960,23 +4945,6 @@ fi
|
||||
AC_SUBST(SGEN_DEFINES)
|
||||
AM_CONDITIONAL(SUPPORT_SGEN, test x$buildsgen = xyes)
|
||||
|
||||
dnl
|
||||
dnl CoreCLR GC checks (coregc)
|
||||
dnl
|
||||
COREGC_DEFINES=
|
||||
AC_ARG_WITH(coregc, [ --with-coregc=yes,no CoreCLR GC, default=yes],[buildcoregc=$with_coregc],[buildcoregc=yes])
|
||||
if test x$buildcoregc = xyes; then
|
||||
AC_DEFINE(HAVE_MOVING_COLLECTOR, 1, [Moving collector])
|
||||
COREGC_DEFINES="-DHAVE_CORE_GC --std=gnu++11"
|
||||
if test "x$gc_msg" = "x"; then
|
||||
gc_msg="coregc"
|
||||
else
|
||||
gc_msg="coregc and $gc_msg"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(COREGC_DEFINES)
|
||||
AM_CONDITIONAL(SUPPORT_COREGC, test x$buildcoregc = xyes)
|
||||
|
||||
jit_status="Building and using the JIT"
|
||||
|
||||
libsuffix=".so"
|
||||
@@ -5181,7 +5149,12 @@ AC_SEARCH_LIBS(dlopen, dl)
|
||||
# Apple -bind_at_load
|
||||
# The rest GNU.
|
||||
#
|
||||
AX_APPEND_LINK_FLAGS([-Wl,--export-dynamic -Wl,-Bsymbolic -bsymbolic -Wl,-z,now -Wl,-bind_at_load])
|
||||
export_link_flags=--export-dynamic
|
||||
case $host_os in
|
||||
mingw*|cygwin*)
|
||||
export_link_flags=--export-all-symbols
|
||||
esac
|
||||
AX_APPEND_LINK_FLAGS([-Wl,$export_link_flags -Wl,-Bsymbolic -bsymbolic -Wl,-z,now -Wl,-bind_at_load])
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h sys/types.h sys/resource.h)
|
||||
dnl giconv.c will check on HAVE_ICONV_H but we need this for link time
|
||||
@@ -5633,9 +5606,9 @@ case "x$libgc" in
|
||||
# if these are instrumented it will be very bad news
|
||||
# (infinite recursion, undefined parking behavior, etc)
|
||||
TMP_CPPFLAGS=`echo $TMP_CPPFLAGS | sed -e 's/-finstrument-for-thread-suspension//g'`
|
||||
ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads $libgc_configure_args \"CPPFLAGS_FOR_LIBGC=$TMP_CPPFLAGS\" \"CFLAGS_FOR_LIBGC=$CFLAGS_FOR_LIBGC\""
|
||||
ac_configure_args="$ac_configure_args --enable-single-obj-compilation --disable-embed-check --with-libgc-threads=$libgc_threads $libgc_configure_args \"CPPFLAGS_FOR_LIBGC=$TMP_CPPFLAGS\" \"CFLAGS_FOR_LIBGC=$CFLAGS_FOR_LIBGC\""
|
||||
if test "x$support_boehm" = "xyes"; then
|
||||
AC_CONFIG_SUBDIRS(libgc)
|
||||
AC_CONFIG_SUBDIRS(external/bdwgc)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -6071,10 +6044,6 @@ fi
|
||||
AM_CONDITIONAL(ENABLE_MSVC, test x$enable_msvc = xyes)
|
||||
|
||||
if test "x$enable_msvc" = "xyes"; then
|
||||
if test "x$support_boehm" = "xyes"; then
|
||||
echo "Error, Boehm GC is not supported when using --enable-msvc."
|
||||
exit 1
|
||||
fi
|
||||
mono_msvc_build_dir='$(top_srcdir)'/msvc/build/sgen
|
||||
if test "x$host_cpu" = "xi686"; then
|
||||
mono_msvc_build_lib_dir='$(mono_msvc_build_dir)'/Win32/lib/Release
|
||||
@@ -6666,7 +6635,7 @@ AC_SUBST(MONO_NATIVE_PLATFORM_TYPE_UNIFIED)
|
||||
# mono/mini/Makefile.am.in we have CCLD=$MONO_CXXLD and CXXLD=$MONO_CXXLD which bypasses
|
||||
# automake's autodetection and lets us use the linker that we want.
|
||||
#
|
||||
if test "x$enable_llvm_runtime" = "xyes" || test "x$buildcoregc" = "xyes"; then
|
||||
if test "x$enable_llvm_runtime" = "xyes"; then
|
||||
AC_SUBST(MONO_CXXLD, [$CXX])
|
||||
else
|
||||
AC_SUBST(MONO_CXXLD, [$CC])
|
||||
@@ -6744,6 +6713,7 @@ mono/native/Makefile
|
||||
mono/utils/Makefile
|
||||
mono/utils/jemalloc/Makefile
|
||||
mono/metadata/Makefile
|
||||
mono/zlib/Makefile
|
||||
mono/dis/Makefile
|
||||
mono/cil/Makefile
|
||||
mono/arch/Makefile
|
||||
@@ -6757,7 +6727,6 @@ mono/arch/arm64/Makefile
|
||||
mono/arch/mips/Makefile
|
||||
mono/arch/riscv/Makefile
|
||||
mono/sgen/Makefile
|
||||
mono/coregc/Makefile
|
||||
mono/native/platform-type.c
|
||||
mono/native/platform-type-compat.c
|
||||
mono/native/platform-type-unified.c
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Dependencies>
|
||||
<ProductDependencies>
|
||||
<Dependency Name="Microsoft.Private.CoreFx.NETCoreApp" Version="5.0.0-alpha.1.19527.5">
|
||||
<Dependency Name="Microsoft.Private.CoreFx.NETCoreApp" Version="5.0.0-alpha.1.19563.3">
|
||||
<Uri>https://github.com/dotnet/corefx</Uri>
|
||||
<Sha>17c14aa2b50cfb5920d03ea8835c9a4932b5359c</Sha>
|
||||
<Sha>5cee7c97d602f294e27c582d4dab81ec388f1d7b</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.NETCore.App" Version="5.0.0-alpha1.19527.2">
|
||||
<Dependency Name="Microsoft.NETCore.App" Version="5.0.0-alpha.1.19564.1">
|
||||
<Uri>https://github.com/dotnet/core-setup</Uri>
|
||||
<Sha>b3749864f47f38599a94070497225c665124fe82</Sha>
|
||||
<Sha>c77948d92a2f950140f09384f057cb893ec3955a</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.Net.Compilers" Version="3.3.1-beta4-19476-06">
|
||||
<Uri>https://github.com/dotnet/roslyn</Uri>
|
||||
@@ -15,13 +15,13 @@
|
||||
</Dependency>
|
||||
</ProductDependencies>
|
||||
<ToolsetDependencies>
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.19527.3">
|
||||
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="5.0.0-beta.19567.2">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>5ce0aaed2f8df9cd2fe0221a426c021efe37f655</Sha>
|
||||
<Sha>928efaa081ffd17b37f6c662fee44775f2d0b90f</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.19527.3">
|
||||
<Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="5.0.0-beta.19567.2">
|
||||
<Uri>https://github.com/dotnet/arcade</Uri>
|
||||
<Sha>5ce0aaed2f8df9cd2fe0221a426c021efe37f655</Sha>
|
||||
<Sha>928efaa081ffd17b37f6c662fee44775f2d0b90f</Sha>
|
||||
</Dependency>
|
||||
</ToolsetDependencies>
|
||||
</Dependencies>
|
||||
+2
-2
@@ -5,9 +5,9 @@
|
||||
<PreReleaseVersionLabel>prerelease</PreReleaseVersionLabel>
|
||||
<!-- Package versions -->
|
||||
<!-- corefx -->
|
||||
<MicrosoftPrivateCoreFxNETCoreAppVersion>5.0.0-alpha.1.19527.5</MicrosoftPrivateCoreFxNETCoreAppVersion>
|
||||
<MicrosoftPrivateCoreFxNETCoreAppVersion>5.0.0-alpha.1.19563.3</MicrosoftPrivateCoreFxNETCoreAppVersion>
|
||||
<!-- core-setup -->
|
||||
<MicrosoftNETCoreAppVersion>5.0.0-alpha1.19527.2</MicrosoftNETCoreAppVersion>
|
||||
<MicrosoftNETCoreAppVersion>5.0.0-alpha.1.19564.1</MicrosoftNETCoreAppVersion>
|
||||
<!-- roslyn -->
|
||||
<MicrosoftNetCompilersVersion>3.3.1-beta4-19476-06</MicrosoftNetCompilersVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
<PropertyGroup>
|
||||
<DotNetSymbolExpirationInDays Condition="'$(DotNetSymbolExpirationInDays)' == ''">3650</DotNetSymbolExpirationInDays>
|
||||
<PublishToSymbolServer>true</PublishToSymbolServer>
|
||||
<PublishToSymWeb Condition="'$(PublishToSymWeb)' == ''">true</PublishToSymWeb>
|
||||
<PublishToMSDL Condition="'$(PublishToMSDL)' == ''">true</PublishToMSDL>
|
||||
<PublishToSymbolServer Condition="'@(FilesToPublishToSymbolServer)' == '' and '@(PackagesToPublishToSymbolServer)' == ''">false</PublishToSymbolServer>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -56,7 +58,7 @@
|
||||
DryRun="false"
|
||||
ConvertPortablePdbsToWindowsPdbs="false"
|
||||
PdbConversionTreatAsWarning=""
|
||||
Condition="$(PublishToSymbolServer)"/>
|
||||
Condition="$(PublishToSymbolServer) and $(PublishToMSDL)"/>
|
||||
|
||||
<!--
|
||||
Symbol Uploader: SymWeb
|
||||
@@ -73,7 +75,7 @@
|
||||
DryRun="false"
|
||||
ConvertPortablePdbsToWindowsPdbs="false"
|
||||
PdbConversionTreatAsWarning=""
|
||||
Condition="$(PublishToSymbolServer)"/>
|
||||
Condition="$(PublishToSymbolServer) and $(PublishToSymWeb)"/>
|
||||
</Target>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds.
|
||||
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
|
||||
#
|
||||
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
|
||||
# under <packageSourceCredentials> for each Maestro managed private feed. Two additional credential
|
||||
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
|
||||
#
|
||||
# This script needs to be called in every job that will restore packages and which the base repo has
|
||||
# private AzDO feeds in the NuGet.config.
|
||||
#
|
||||
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
|
||||
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
|
||||
#
|
||||
# - task: PowerShell@2
|
||||
# displayName: Setup Private Feeds Credentials
|
||||
# condition: eq(variables['Agent.OS'], 'Windows_NT')
|
||||
# inputs:
|
||||
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
|
||||
# arguments: -ConfigFile ${Env:BUILD_SOURCESDIRECTORY}/NuGet.config -Password $Env:Token
|
||||
# env:
|
||||
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)][string]$ConfigFile,
|
||||
[Parameter(Mandatory = $true)][string]$Password
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version 2.0
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
. $PSScriptRoot\tools.ps1
|
||||
|
||||
# Add source entry to PackageSources
|
||||
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) {
|
||||
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")
|
||||
|
||||
if ($packageSource -eq $null)
|
||||
{
|
||||
$packageSource = $doc.CreateElement("add")
|
||||
$packageSource.SetAttribute("key", $SourceName)
|
||||
$packageSource.SetAttribute("value", $SourceEndPoint)
|
||||
$sources.AppendChild($packageSource) | Out-Null
|
||||
}
|
||||
else {
|
||||
Write-Host "Package source $SourceName already present."
|
||||
}
|
||||
|
||||
AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password
|
||||
}
|
||||
|
||||
# Add a credential node for the specified source
|
||||
function AddCredential($creds, $source, $username, $password) {
|
||||
# Looks for credential configuration for the given SourceName. Create it if none is found.
|
||||
$sourceElement = $creds.SelectSingleNode($Source)
|
||||
if ($sourceElement -eq $null)
|
||||
{
|
||||
$sourceElement = $doc.CreateElement($Source)
|
||||
$creds.AppendChild($sourceElement) | Out-Null
|
||||
}
|
||||
|
||||
# Add the <Username> node to the credential if none is found.
|
||||
$usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']")
|
||||
if ($usernameElement -eq $null)
|
||||
{
|
||||
$usernameElement = $doc.CreateElement("add")
|
||||
$usernameElement.SetAttribute("key", "Username")
|
||||
$sourceElement.AppendChild($usernameElement) | Out-Null
|
||||
}
|
||||
$usernameElement.SetAttribute("value", $Username)
|
||||
|
||||
# Add the <ClearTextPassword> to the credential if none is found.
|
||||
# Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs.
|
||||
# -> https://github.com/NuGet/Home/issues/5526
|
||||
$passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']")
|
||||
if ($passwordElement -eq $null)
|
||||
{
|
||||
$passwordElement = $doc.CreateElement("add")
|
||||
$passwordElement.SetAttribute("key", "ClearTextPassword")
|
||||
$sourceElement.AppendChild($passwordElement) | Out-Null
|
||||
}
|
||||
$passwordElement.SetAttribute("value", $Password)
|
||||
}
|
||||
|
||||
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Password) {
|
||||
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
|
||||
|
||||
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."
|
||||
|
||||
ForEach ($PackageSource in $maestroPrivateSources) {
|
||||
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
|
||||
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password
|
||||
}
|
||||
}
|
||||
|
||||
if (!(Test-Path $ConfigFile -PathType Leaf)) {
|
||||
Write-Host "Couldn't find the file NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
}
|
||||
|
||||
# Load NuGet.config
|
||||
$doc = New-Object System.Xml.XmlDocument
|
||||
$filename = (Get-Item $ConfigFile).FullName
|
||||
$doc.Load($filename)
|
||||
|
||||
# Get reference to <PackageSources> or create one if none exist already
|
||||
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
|
||||
if ($sources -eq $null) {
|
||||
$sources = $doc.CreateElement("packageSources")
|
||||
$doc.DocumentElement.AppendChild($sources) | Out-Null
|
||||
}
|
||||
|
||||
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
|
||||
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
|
||||
if ($creds -eq $null) {
|
||||
$creds = $doc.CreateElement("packageSourceCredentials")
|
||||
$doc.DocumentElement.AppendChild($creds) | Out-Null
|
||||
}
|
||||
|
||||
# Insert credential nodes for Maestro's private feeds
|
||||
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Password $Password
|
||||
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
AddPackageSource -Sources $sources -SourceName "dotnet3-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2" -Creds $creds -Username "dn-bot" -Password $Password
|
||||
|
||||
$doc.Save($filename)
|
||||
@@ -0,0 +1,117 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This file is a temporary workaround for internal builds to be able to restore from private AzDO feeds.
|
||||
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
|
||||
#
|
||||
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
|
||||
# under <packageSourceCredentials> for each Maestro's managed private feed. Two additional credential
|
||||
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
|
||||
#
|
||||
# This script needs to be called in every job that will restore packages and which the base repo has
|
||||
# private AzDO feeds in the NuGet.config.
|
||||
#
|
||||
# See example YAML call for this script below. Note the use of the variable `$(dn-bot-dnceng-artifact-feeds-rw)`
|
||||
# from the AzureDevOps-Artifact-Feeds-Pats variable group.
|
||||
#
|
||||
# - task: Bash@3
|
||||
# displayName: Setup Private Feeds Credentials
|
||||
# inputs:
|
||||
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
|
||||
# arguments: $BUILD_SOURCESDIRECTORY/NuGet.config $Token
|
||||
# condition: ne(variables['Agent.OS'], 'Windows_NT')
|
||||
# env:
|
||||
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
ConfigFile=$1
|
||||
CredToken=$2
|
||||
NL='\n'
|
||||
TB=' '
|
||||
|
||||
source="${BASH_SOURCE[0]}"
|
||||
|
||||
# resolve $source until the file is no longer a symlink
|
||||
while [[ -h "$source" ]]; do
|
||||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
|
||||
source="$(readlink "$source")"
|
||||
# if $source was a relative symlink, we need to resolve it relative to the path where the
|
||||
# symlink file was located
|
||||
[[ $source != /* ]] && source="$scriptroot/$source"
|
||||
done
|
||||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
|
||||
|
||||
. "$scriptroot/tools.sh"
|
||||
|
||||
if [ ! -f "$ConfigFile" ]; then
|
||||
echo "Couldn't find the file NuGet config file: $ConfigFile"
|
||||
ExitWithExitCode 1
|
||||
fi
|
||||
|
||||
if [[ `uname -s` == "Darwin" ]]; then
|
||||
NL=$'\\\n'
|
||||
TB=''
|
||||
fi
|
||||
|
||||
# Ensure there is a <packageSources>...</packageSources> section.
|
||||
grep -i "<packageSources>" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding <packageSources>...</packageSources> section."
|
||||
ConfigNodeHeader="<configuration>"
|
||||
PackageSourcesTemplate="${TB}<packageSources>${NL}${TB}</packageSources>"
|
||||
|
||||
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" NuGet.config
|
||||
fi
|
||||
|
||||
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
|
||||
grep -i "<packageSourceCredentials>" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
|
||||
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceCredentialsTemplate="${TB}<packageSourceCredentials>${NL}${TB}</packageSourceCredentials>"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourcesNodeFooter${NL}$PackageSourceCredentialsTemplate|" NuGet.config
|
||||
fi
|
||||
|
||||
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
|
||||
grep -i "<add key=\"dotnet3-internal\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal to the packageSources."
|
||||
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v2\" />"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
|
||||
fi
|
||||
|
||||
# Ensure dotnet3-internal and dotnet3-internal-transport is in the packageSources
|
||||
grep -i "<add key=\"dotnet3-internal-transport\">" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding dotnet3-internal-transport to the packageSources."
|
||||
|
||||
PackageSourcesNodeFooter="</packageSources>"
|
||||
PackageSourceTemplate="${TB}<add key=\"dotnet3-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v2\" />"
|
||||
|
||||
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" NuGet.config
|
||||
fi
|
||||
|
||||
# I want things split line by line
|
||||
PrevIFS=$IFS
|
||||
IFS=$'\n'
|
||||
PackageSources=$(grep -oh '"darc-int-[^"]*"' $ConfigFile | tr -d '"')
|
||||
IFS=$PrevIFS
|
||||
|
||||
PackageSources+=('dotnet3-internal')
|
||||
PackageSources+=('dotnet3-internal-transport')
|
||||
|
||||
for FeedName in ${PackageSources[@]} ; do
|
||||
# Check if there is no existing credential for this FeedName
|
||||
grep -i "<$FeedName>" $ConfigFile
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "Adding credentials for $FeedName."
|
||||
|
||||
PackageSourceCredentialsNodeFooter="</packageSourceCredentials>"
|
||||
NewCredential="${TB}${TB}<$FeedName>${NL}<add key=\"Username\" value=\"dn-bot\" />${NL}<add key=\"ClearTextPassword\" value=\"$CredToken\" />${NL}</$FeedName>"
|
||||
|
||||
sed -i.bak "s|$PackageSourceCredentialsNodeFooter|$NewCredential${NL}$PackageSourceCredentialsNodeFooter|" NuGet.config
|
||||
fi
|
||||
done
|
||||
@@ -31,6 +31,10 @@ else()
|
||||
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!")
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{TOOLCHAIN})
|
||||
set(TOOLCHAIN $ENV{TOOLCHAIN})
|
||||
endif()
|
||||
|
||||
# Specify include paths
|
||||
if(TARGET_ARCH_NAME STREQUAL "armel")
|
||||
if(DEFINED TIZEN_TOOLCHAIN)
|
||||
@@ -39,48 +43,25 @@ if(TARGET_ARCH_NAME STREQUAL "armel")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add_compile_param - adds only new options without duplicates.
|
||||
# arg0 - list with result options, arg1 - list with new options.
|
||||
# arg2 - optional argument, quick summary string for optional using CACHE FORCE mode.
|
||||
macro(add_compile_param)
|
||||
if(NOT ${ARGC} MATCHES "^(2|3)$")
|
||||
message(FATAL_ERROR "Wrong using add_compile_param! Two or three parameters must be given! See add_compile_param description.")
|
||||
endif()
|
||||
foreach(OPTION ${ARGV1})
|
||||
if(NOT ${ARGV0} MATCHES "${OPTION}($| )")
|
||||
set(${ARGV0} "${${ARGV0}} ${OPTION}")
|
||||
if(${ARGC} EQUAL "3") # CACHE FORCE mode
|
||||
set(${ARGV0} "${${ARGV0}}" CACHE STRING "${ARGV2}" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
|
||||
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
|
||||
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
|
||||
set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
|
||||
|
||||
# Specify link flags
|
||||
add_compile_param(CROSS_LINK_FLAGS "--sysroot=${CROSS_ROOTFS}")
|
||||
add_compile_param(CROSS_LINK_FLAGS "--gcc-toolchain=${CROSS_ROOTFS}/usr")
|
||||
add_compile_param(CROSS_LINK_FLAGS "--target=${TOOLCHAIN}")
|
||||
add_compile_param(CROSS_LINK_FLAGS "-fuse-ld=gold")
|
||||
|
||||
if(TARGET_ARCH_NAME STREQUAL "armel")
|
||||
if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only
|
||||
add_compile_param(CROSS_LINK_FLAGS "-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
|
||||
add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/lib")
|
||||
add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib")
|
||||
add_compile_param(CROSS_LINK_FLAGS "-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
|
||||
add_link_options("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
|
||||
add_link_options("-L${CROSS_ROOTFS}/lib")
|
||||
add_link_options("-L${CROSS_ROOTFS}/usr/lib")
|
||||
add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
|
||||
endif()
|
||||
elseif(TARGET_ARCH_NAME STREQUAL "x86")
|
||||
add_compile_param(CROSS_LINK_FLAGS "-m32")
|
||||
add_link_options(-m32)
|
||||
endif()
|
||||
|
||||
add_compile_param(CMAKE_EXE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
|
||||
add_compile_param(CMAKE_SHARED_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
|
||||
add_compile_param(CMAKE_MODULE_LINKER_FLAGS "${CROSS_LINK_FLAGS}" "TOOLCHAIN_EXE_LINKER_FLAGS")
|
||||
|
||||
# Specify compile options
|
||||
add_compile_options("--sysroot=${CROSS_ROOTFS}")
|
||||
add_compile_options("--target=${TOOLCHAIN}")
|
||||
add_compile_options("--gcc-toolchain=${CROSS_ROOTFS}/usr")
|
||||
|
||||
if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$")
|
||||
set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
|
||||
@@ -103,7 +84,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
|
||||
add_compile_options(-Wno-error=unused-command-line-argument)
|
||||
endif()
|
||||
|
||||
# Set LLDB include and library paths
|
||||
# Set LLDB include and library paths for builds that need lldb.
|
||||
if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$")
|
||||
if(TARGET_ARCH_NAME STREQUAL "x86")
|
||||
set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}")
|
||||
@@ -131,7 +112,7 @@ if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
@@ -6,6 +6,11 @@ parameters:
|
||||
# This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter
|
||||
sdlContinueOnError: false # optional: determines whether to continue the build if the step errors;
|
||||
dependsOn: '' # Optional: dependencies of the job
|
||||
artifactNames: '' # Optional: patterns supplied to DownloadBuildArtifacts
|
||||
# Usage:
|
||||
# artifactNames:
|
||||
# - 'BlobArtifacts'
|
||||
# - 'Artifacts_Windows_NT_Release'
|
||||
|
||||
jobs:
|
||||
- job: Run_SDL
|
||||
@@ -18,13 +23,22 @@ jobs:
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
downloadType: specific files
|
||||
matchingPattern: "**"
|
||||
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
|
||||
- ${{ if ne(parameters.artifactNames, '') }}:
|
||||
- ${{ each artifactName in parameters.artifactNames }}:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: ${{ artifactName }}
|
||||
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
|
||||
- ${{ if eq(parameters.artifactNames, '') }}:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Build Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
downloadType: specific files
|
||||
itemPattern: "**"
|
||||
downloadPath: $(Build.ArtifactStagingDirectory)\artifacts
|
||||
- powershell: eng/common/sdl/extract-artifact-packages.ps1
|
||||
-InputPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts
|
||||
-ExtractPath $(Build.ArtifactStagingDirectory)\artifacts\BlobArtifacts
|
||||
|
||||
+30
-11
@@ -2,21 +2,28 @@ parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
stageName: ''
|
||||
channelName: ''
|
||||
channelId: ''
|
||||
transportFeed: ''
|
||||
shippingFeed: ''
|
||||
symbolsFeed: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_30_Internal_Servicing_Publishing
|
||||
- stage: ${{ parameters.stageName }}
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Core 3.0 Internal Servicing Publishing
|
||||
displayName: ${{ parameters.channelName }} Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
- job: publish_symbols
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.InternalServicing_30_Channel_Id))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
@@ -57,19 +64,23 @@ stages:
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
/p:PublishToMSDL=false
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'SymbolPublishing'
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.InternalServicing_30_Channel_Id))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
@@ -78,12 +89,14 @@ stages:
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
@@ -128,14 +141,20 @@ stages:
|
||||
/p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey)
|
||||
/p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(InternalInstallersBlobFeedKey)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:PublishToMSDL=false
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'AssetsPublishing'
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.InternalServicing_30_Channel_Id }}
|
||||
ChannelId: ${{ parameters.channelId }}
|
||||
+40
-11
@@ -4,20 +4,26 @@ parameters:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
stageName: ''
|
||||
channelName: ''
|
||||
channelId: ''
|
||||
transportFeed: ''
|
||||
shippingFeed: ''
|
||||
symbolsFeed: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_Release31_Publish
|
||||
- stage: ${{ parameters.stageName }}
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Core 3.1 Release Publishing
|
||||
displayName: ${{ parameters.channelName }} Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
- job: publish_symbols
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }} ))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
@@ -35,6 +41,18 @@ stages:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
# otherwise it'll complain about accessing a private feed.
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
@@ -48,17 +66,21 @@ stages:
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'SymbolPublishing'
|
||||
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_31_Channel_Id))
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', ${{ parameters.channelId }}))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
@@ -67,12 +89,14 @@ stages:
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
@@ -118,14 +142,19 @@ stages:
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: '${{ parameters.stageName }}'
|
||||
JobLabel: 'AssetsPublishing'
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.PublicRelease_31_Channel_Id }}
|
||||
ChannelId: ${{ parameters.channelId }}
|
||||
@@ -1,96 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
|
||||
stages:
|
||||
- stage: NetCore_3_Tools_Validation_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET 3 Tools - Validation Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NETCore_3_Tools_Validation_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.NETCore_3_Tools_Validation_Channel_Id }}
|
||||
@@ -1,131 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_3_Tools_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET 3 Tools Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_3_Tools_Channel_Id))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
/p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_3_Tools_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.NetCore_3_Tools_Channel_Id }}
|
||||
@@ -1,131 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_Dev31_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Core 3.1 Dev Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
/p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicDevRelease_31_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.PublicDevRelease_31_Channel_Id }}
|
||||
@@ -1,131 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_Dev5_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Core 5 Dev Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_5_Dev_Channel_Id))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
/p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_5_Dev_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.NetCore_5_Dev_Channel_Id }}
|
||||
@@ -1,131 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_Release30_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Core 3.0 Release Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
/p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.PublicRelease_30_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.PublicRelease_30_Channel_Id }}
|
||||
@@ -1,131 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
symbolPublishingAdditionalParameters: ''
|
||||
|
||||
stages:
|
||||
- stage: NetCore_Tools_Latest_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Tools - Latest Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job:
|
||||
displayName: Symbol Publishing
|
||||
dependsOn: setupMaestroVars
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Latest_Channel_Id))
|
||||
variables:
|
||||
- group: DotNet-Symbol-Server-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
artifactName: 'BlobArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download PDB Artifacts
|
||||
inputs:
|
||||
artifactName: 'PDBArtifacts'
|
||||
continueOnError: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
|
||||
/p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
|
||||
/p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
|
||||
/p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Latest_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.NetCore_Tools_Latest_Channel_Id }}
|
||||
@@ -1,96 +0,0 @@
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ''
|
||||
dependsOn:
|
||||
- Validate
|
||||
publishInstallersAndChecksums: false
|
||||
|
||||
stages:
|
||||
- stage: PVR_Publish
|
||||
dependsOn: ${{ parameters.dependsOn }}
|
||||
variables:
|
||||
- template: ../common-variables.yml
|
||||
displayName: .NET Tools - Validation Publishing
|
||||
jobs:
|
||||
- template: ../setup-maestro-vars.yml
|
||||
|
||||
- job: publish_assets
|
||||
displayName: Publish Assets
|
||||
dependsOn: setupMaestroVars
|
||||
variables:
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- name: BARBuildId
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
|
||||
- name: IsStableBuild
|
||||
value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
|
||||
condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.InitialChannels'], format('[{0}]', variables.NetCore_Tools_Validation_Channel_Id))
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Package Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: PackageArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Blob Artifacts
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: BlobArtifacts
|
||||
|
||||
- task: DownloadBuildArtifacts@0
|
||||
displayName: Download Asset Manifests
|
||||
inputs:
|
||||
buildType: current
|
||||
artifactName: AssetManifests
|
||||
|
||||
- task: NuGetToolInstaller@1
|
||||
displayName: 'Install NuGet.exe'
|
||||
|
||||
# This is necessary whenever we want to publish/restore to an AzDO private feed
|
||||
- task: NuGetAuthenticate@0
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Enable cross-org publishing
|
||||
inputs:
|
||||
filePath: eng\common\enable-cross-org-publishing.ps1
|
||||
arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: Publish Assets
|
||||
inputs:
|
||||
filePath: eng\common\sdk-task.ps1
|
||||
arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
|
||||
/p:ArtifactsCategory=$(_DotNetValidationArtifactsCategory)
|
||||
/p:IsStableBuild=$(IsStableBuild)
|
||||
/p:IsInternalBuild=$(IsInternalBuild)
|
||||
/p:RepositoryName=$(Build.Repository.Name)
|
||||
/p:CommitSha=$(Build.SourceVersion)
|
||||
/p:NugetPath=$(NuGetExeToolPath)
|
||||
/p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
|
||||
/p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
|
||||
/p:BARBuildId=$(BARBuildId)
|
||||
/p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
|
||||
/p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
|
||||
/p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
|
||||
/p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
|
||||
/p:Configuration=Release
|
||||
/p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
|
||||
/p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
|
||||
/p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
|
||||
/p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
|
||||
/p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
|
||||
/p:AzureDevOpsStaticShippingFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticTransportFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
/p:AzureDevOpsStaticSymbolsFeed='https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
/p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
|
||||
${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
|
||||
- template: ../../steps/promote-build.yml
|
||||
parameters:
|
||||
ChannelId: ${{ variables.NetCore_Tools_Validation_Channel_Id }}
|
||||
@@ -1,7 +1,9 @@
|
||||
variables:
|
||||
- group: Publish-Build-Assets
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
- group: DotNet-Blob-Feed
|
||||
- group: DotNet-DotNetCli-Storage
|
||||
- group: DotNet-MSRC-Storage
|
||||
- group: Publish-Build-Assets
|
||||
|
||||
# .NET Core 3.1 Dev
|
||||
- name: PublicDevRelease_31_Channel_Id
|
||||
@@ -39,6 +41,14 @@ variables:
|
||||
- name: PublicRelease_31_Channel_Id
|
||||
value: 129
|
||||
|
||||
# General Testing
|
||||
- name: GeneralTesting_Channel_Id
|
||||
value: 529
|
||||
|
||||
# .NET Core 3.1 Blazor Features
|
||||
- name: NetCore_31_Blazor_Features_Channel_Id
|
||||
value: 531
|
||||
|
||||
# Whether the build is internal or not
|
||||
- name: IsInternalBuild
|
||||
value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }}
|
||||
|
||||
@@ -8,6 +8,7 @@ parameters:
|
||||
enable: false
|
||||
continueOnError: false
|
||||
params: ''
|
||||
artifactNames: ''
|
||||
|
||||
# These parameters let the user customize the call to sdk-task.ps1 for publishing
|
||||
# symbols & general artifacts as well as for signing validation
|
||||
@@ -50,7 +51,6 @@ stages:
|
||||
displayName: Signing Validation
|
||||
variables:
|
||||
- template: common-variables.yml
|
||||
- group: AzureDevOps-Artifact-Feeds-Pats
|
||||
pool:
|
||||
vmImage: 'windows-2019'
|
||||
steps:
|
||||
@@ -64,7 +64,6 @@ stages:
|
||||
# Since sdk-task.ps1 tries to restore packages we need to do this authentication here
|
||||
# otherwise it'll complain about accessing a private feed.
|
||||
- task: NuGetAuthenticate@0
|
||||
condition: eq(variables['IsInternalBuild'], 'true')
|
||||
displayName: 'Authenticate to AzDO Feeds'
|
||||
|
||||
- task: PowerShell@2
|
||||
@@ -80,9 +79,13 @@ stages:
|
||||
arguments: -task SigningValidation -restore -msbuildEngine dotnet
|
||||
/p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts'
|
||||
/p:SignCheckExclusionsFile='$(Build.SourcesDirectory)/eng/SignCheckExclusionsFile.txt'
|
||||
/p:Configuration=Release
|
||||
${{ parameters.signingValidationAdditionalParameters }}
|
||||
|
||||
- template: ../steps/publish-logs.yml
|
||||
parameters:
|
||||
StageLabel: 'Validation'
|
||||
JobLabel: 'Signing'
|
||||
|
||||
- ${{ if eq(parameters.enableSourceLinkValidation, 'true') }}:
|
||||
- job:
|
||||
displayName: SourceLink Validation
|
||||
@@ -113,63 +116,173 @@ stages:
|
||||
parameters:
|
||||
additionalParameters: ${{ parameters.SDLValidationParameters.params }}
|
||||
continueOnError: ${{ parameters.SDLValidationParameters.continueOnError }}
|
||||
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-dev-5.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-dev-31.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Dev5_Publish'
|
||||
channelName: '.NET Core 5 Dev'
|
||||
channelId: 131
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-tools-latest.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Dev31_Publish'
|
||||
channelName: '.NET Core 3.1 Dev'
|
||||
channelId: 128
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-tools-validation.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Tools_Latest_Publish'
|
||||
channelName: '.NET Tools - Latest'
|
||||
channelId: 2
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-3-tools-validation.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-3-tools.yml
|
||||
parameters:
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-release-30.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'PVR_Publish'
|
||||
channelName: '.NET Tools - Validation'
|
||||
channelId: 9
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-release-31.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_3_Tools_Validation_Publish'
|
||||
channelName: '.NET 3 Tools - Validation'
|
||||
channelId: 390
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\netcore-internal-30.yml
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_3_Tools_Publish'
|
||||
channelName: '.NET 3 Tools'
|
||||
channelId: 344
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Release30_Publish'
|
||||
channelName: '.NET Core 3.0 Release'
|
||||
channelId: 19
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-transport/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Release31_Publish'
|
||||
channelName: '.NET Core 3.1 Release'
|
||||
channelId: 129
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_Blazor31_Features_Publish'
|
||||
channelName: '.NET Core 3.1 Blazor Features'
|
||||
channelId: 531
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-blazor/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-blazor/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-blazor-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-internal-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NetCore_30_Internal_Servicing_Publishing'
|
||||
channelName: '.NET Core 3.0 Internal Servicing'
|
||||
channelId: 184
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-transport/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3-internal-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'General_Testing_Publish'
|
||||
channelName: 'General Testing'
|
||||
channelId: 529
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NETCore_Tooling_Dev_Publishing'
|
||||
channelName: '.NET Core Tooling Dev'
|
||||
channelId: 548
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
|
||||
- template: \eng\common\templates\post-build\channels\generic-public-channel.yml
|
||||
parameters:
|
||||
artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
|
||||
dependsOn: ${{ parameters.publishDependsOn }}
|
||||
publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
|
||||
symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
|
||||
stageName: 'NETCore_Tooling_Release_Publishing'
|
||||
channelName: '.NET Core Tooling Release'
|
||||
channelId: 549
|
||||
transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
|
||||
symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
|
||||
@@ -0,0 +1,23 @@
|
||||
parameters:
|
||||
StageLabel: ''
|
||||
JobLabel: ''
|
||||
|
||||
steps:
|
||||
- task: Powershell@2
|
||||
displayName: Prepare Binlogs to Upload
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
New-Item -ItemType Directory $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
|
||||
Move-Item -Path $(Build.SourcesDirectory)/artifacts/log/Debug/* $(Build.SourcesDirectory)/PostBuildLogs/${{parameters.StageLabel}}/${{parameters.JobLabel}}/
|
||||
continueOnError: true
|
||||
condition: always()
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish Logs
|
||||
inputs:
|
||||
PathtoPublish: '$(Build.SourcesDirectory)/PostBuildLogs'
|
||||
PublishLocation: Container
|
||||
ArtifactName: PostBuilLogs
|
||||
continueOnError: true
|
||||
condition: always()
|
||||
@@ -446,10 +446,7 @@ function GetSdkTaskProject([string]$taskName) {
|
||||
}
|
||||
|
||||
function InitializeNativeTools() {
|
||||
if ($env:DisableNativeToolsetInstalls) {
|
||||
return
|
||||
}
|
||||
if (Get-Member -InputObject $GlobalJson -Name "native-tools") {
|
||||
if (-Not (Test-Path variable:DisableNativeToolsetInstalls) -And (Get-Member -InputObject $GlobalJson -Name "native-tools")) {
|
||||
$nativeArgs= @{}
|
||||
if ($ci) {
|
||||
$nativeArgs = @{
|
||||
|
||||
+3
-3
@@ -4,7 +4,7 @@
|
||||
|
||||
# CI mode - set to true on CI server for PR validation build or official build.
|
||||
ci=${ci:-false}
|
||||
disable_configure_toolset_import=${disable_configure_toolset_import:-null}
|
||||
disable_configure_toolset_import=${disable_configure_toolset_import:-}
|
||||
|
||||
# Set to true to use the pipelines logger which will enable Azure logging output.
|
||||
# https://github.com/Microsoft/azure-pipelines-tasks/blob/master/docs/authoring/commands.md
|
||||
@@ -273,7 +273,7 @@ function GetNuGetPackageCachePath {
|
||||
}
|
||||
|
||||
function InitializeNativeTools() {
|
||||
if [[ -z "${DisableNativeToolsetInstalls:-}" ]]; then
|
||||
if [[ -n "${DisableNativeToolsetInstalls:-}" ]]; then
|
||||
return
|
||||
fi
|
||||
if grep -Fq "native-tools" $global_json_file
|
||||
@@ -437,7 +437,7 @@ Write-PipelineSetVariable -name "Temp" -value "$temp_dir"
|
||||
Write-PipelineSetVariable -name "TMP" -value "$temp_dir"
|
||||
|
||||
# Import custom tools configuration, if present in the repo.
|
||||
if [[ "$disable_configure_toolset_import" != null ]]; then
|
||||
if [[ -z "$disable_configure_toolset_import" ]]; then
|
||||
configure_toolset_script="$eng_root/configure-toolset.sh"
|
||||
if [[ -a "$configure_toolset_script" ]]; then
|
||||
. "$configure_toolset_script"
|
||||
|
||||
Vendored
+1
-1
Submodule external/api-snapshot updated: 3f261a6c67...46c93c66be.
+1
Submodule external/bdwgc added at 6e8db07c8d.
Vendored
-1
Submodule external/coreclr deleted from b1f16cf71f.
Vendored
+1
-1
Submodule external/corefx updated: 6e65509a17...1cdb9c2094.
Vendored
-1
Submodule external/llvm deleted from 29f36fd315.
+1
Submodule external/llvm-project added at 0a3f49c40d.
+2
-2
@@ -3,7 +3,7 @@
|
||||
"dotnet": "5.0.100-alpha1-014854"
|
||||
},
|
||||
"msbuild-sdks": {
|
||||
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19527.3",
|
||||
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19527.3"
|
||||
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.19567.2",
|
||||
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.19567.2"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
ltconfig crlf=input
|
||||
install-sh crlf=input
|
||||
/BCC_MAKEFILE -crlf
|
||||
/digimars.mak -crlf
|
||||
@@ -1,25 +0,0 @@
|
||||
/aclocal.m4
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/ltconfig
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
/stamp-h
|
||||
/stamp-h.in
|
||||
/*.lo
|
||||
/.deps
|
||||
/.libs
|
||||
/*.la
|
||||
/*.o
|
||||
/autom4te.cache
|
||||
/libgc-mono.pc
|
||||
/libgc-mono-*.tar.gz
|
||||
dolt*
|
||||
-623
@@ -1,623 +0,0 @@
|
||||
|
||||
|
||||
/******************************************************************
|
||||
|
||||
AmigaOS-spesific routines for GC.
|
||||
This file is normally included from os_dep.c
|
||||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#if !defined(GC_AMIGA_DEF) && !defined(GC_AMIGA_SB) && !defined(GC_AMIGA_DS) && !defined(GC_AMIGA_AM)
|
||||
# include "gc_priv.h"
|
||||
# include <stdio.h>
|
||||
# include <signal.h>
|
||||
# define GC_AMIGA_DEF
|
||||
# define GC_AMIGA_SB
|
||||
# define GC_AMIGA_DS
|
||||
# define GC_AMIGA_AM
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GC_AMIGA_DEF
|
||||
|
||||
# ifndef __GNUC__
|
||||
# include <exec/exec.h>
|
||||
# endif
|
||||
# include <proto/exec.h>
|
||||
# include <proto/dos.h>
|
||||
# include <dos/dosextens.h>
|
||||
# include <workbench/startup.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef GC_AMIGA_SB
|
||||
|
||||
/******************************************************************
|
||||
Find the base of the stack.
|
||||
******************************************************************/
|
||||
|
||||
ptr_t GC_get_stack_base()
|
||||
{
|
||||
struct Process *proc = (struct Process*)SysBase->ThisTask;
|
||||
|
||||
/* Reference: Amiga Guru Book Pages: 42,567,574 */
|
||||
if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS
|
||||
&& proc->pr_CLI != NULL) {
|
||||
/* first ULONG is StackSize */
|
||||
/*longPtr = proc->pr_ReturnAddr;
|
||||
size = longPtr[0];*/
|
||||
|
||||
return (char *)proc->pr_ReturnAddr + sizeof(ULONG);
|
||||
} else {
|
||||
return (char *)proc->pr_Task.tc_SPUpper;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 /* old version */
|
||||
ptr_t GC_get_stack_base()
|
||||
{
|
||||
extern struct WBStartup *_WBenchMsg;
|
||||
extern long __base;
|
||||
extern long __stack;
|
||||
struct Task *task;
|
||||
struct Process *proc;
|
||||
struct CommandLineInterface *cli;
|
||||
long size;
|
||||
|
||||
if ((task = FindTask(0)) == 0) {
|
||||
GC_err_puts("Cannot find own task structure\n");
|
||||
ABORT("task missing");
|
||||
}
|
||||
proc = (struct Process *)task;
|
||||
cli = BADDR(proc->pr_CLI);
|
||||
|
||||
if (_WBenchMsg != 0 || cli == 0) {
|
||||
size = (char *)task->tc_SPUpper - (char *)task->tc_SPLower;
|
||||
} else {
|
||||
size = cli->cli_DefaultStack * 4;
|
||||
}
|
||||
return (ptr_t)(__base + GC_max(size, __stack));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GC_AMIGA_DS
|
||||
/******************************************************************
|
||||
Register data segments.
|
||||
******************************************************************/
|
||||
|
||||
void GC_register_data_segments()
|
||||
{
|
||||
struct Process *proc;
|
||||
struct CommandLineInterface *cli;
|
||||
BPTR myseglist;
|
||||
ULONG *data;
|
||||
|
||||
int num;
|
||||
|
||||
|
||||
# ifdef __GNUC__
|
||||
ULONG dataSegSize;
|
||||
GC_bool found_segment = FALSE;
|
||||
extern char __data_size[];
|
||||
|
||||
dataSegSize=__data_size+8;
|
||||
/* Can`t find the Location of __data_size, because
|
||||
it`s possible that is it, inside the segment. */
|
||||
|
||||
# endif
|
||||
|
||||
proc= (struct Process*)SysBase->ThisTask;
|
||||
|
||||
/* Reference: Amiga Guru Book Pages: 538ff,565,573
|
||||
and XOper.asm */
|
||||
if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS) {
|
||||
if (proc->pr_CLI == NULL) {
|
||||
myseglist = proc->pr_SegList;
|
||||
} else {
|
||||
/* ProcLoaded 'Loaded as a command: '*/
|
||||
cli = BADDR(proc->pr_CLI);
|
||||
myseglist = cli->cli_Module;
|
||||
}
|
||||
} else {
|
||||
ABORT("Not a Process.");
|
||||
}
|
||||
|
||||
if (myseglist == NULL) {
|
||||
ABORT("Arrrgh.. can't find segments, aborting");
|
||||
}
|
||||
|
||||
/* xoper hunks Shell Process */
|
||||
|
||||
num=0;
|
||||
for (data = (ULONG *)BADDR(myseglist); data != NULL;
|
||||
data = (ULONG *)BADDR(data[0])) {
|
||||
if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
|
||||
((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
|
||||
# ifdef __GNUC__
|
||||
if (dataSegSize == data[-1]) {
|
||||
found_segment = TRUE;
|
||||
}
|
||||
# endif
|
||||
GC_add_roots_inner((char *)&data[1],
|
||||
((char *)&data[1]) + data[-1], FALSE);
|
||||
}
|
||||
++num;
|
||||
} /* for */
|
||||
# ifdef __GNUC__
|
||||
if (!found_segment) {
|
||||
ABORT("Can`t find correct Segments.\nSolution: Use an newer version of ixemul.library");
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
#if 0 /* old version */
|
||||
void GC_register_data_segments()
|
||||
{
|
||||
extern struct WBStartup *_WBenchMsg;
|
||||
struct Process *proc;
|
||||
struct CommandLineInterface *cli;
|
||||
BPTR myseglist;
|
||||
ULONG *data;
|
||||
|
||||
if ( _WBenchMsg != 0 ) {
|
||||
if ((myseglist = _WBenchMsg->sm_Segment) == 0) {
|
||||
GC_err_puts("No seglist from workbench\n");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if ((proc = (struct Process *)FindTask(0)) == 0) {
|
||||
GC_err_puts("Cannot find process structure\n");
|
||||
return;
|
||||
}
|
||||
if ((cli = BADDR(proc->pr_CLI)) == 0) {
|
||||
GC_err_puts("No CLI\n");
|
||||
return;
|
||||
}
|
||||
if ((myseglist = cli->cli_Module) == 0) {
|
||||
GC_err_puts("No seglist from CLI\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (data = (ULONG *)BADDR(myseglist); data != 0;
|
||||
data = (ULONG *)BADDR(data[0])) {
|
||||
# ifdef AMIGA_SKIP_SEG
|
||||
if (((ULONG) GC_register_data_segments < (ULONG) &data[1]) ||
|
||||
((ULONG) GC_register_data_segments > (ULONG) &data[1] + data[-1])) {
|
||||
# else
|
||||
{
|
||||
# endif /* AMIGA_SKIP_SEG */
|
||||
GC_add_roots_inner((char *)&data[1],
|
||||
((char *)&data[1]) + data[-1], FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* old version */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef GC_AMIGA_AM
|
||||
|
||||
#ifndef GC_AMIGA_FASTALLOC
|
||||
|
||||
void *GC_amiga_allocwrapper(size_t size,void *(*AllocFunction)(size_t size2)){
|
||||
return (*AllocFunction)(size);
|
||||
}
|
||||
|
||||
void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2))
|
||||
=GC_amiga_allocwrapper;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
|
||||
|
||||
void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2));
|
||||
|
||||
void *(*GC_amiga_allocwrapper_do)(size_t size,void *(*AllocFunction)(size_t size2))
|
||||
=GC_amiga_allocwrapper_firsttime;
|
||||
|
||||
|
||||
/******************************************************************
|
||||
Amiga-spesific routines to obtain memory, and force GC to give
|
||||
back fast-mem whenever possible.
|
||||
These hacks makes gc-programs go many times faster when
|
||||
the amiga is low on memory, and are therefore strictly necesarry.
|
||||
|
||||
-Kjetil S. Matheussen, 2000.
|
||||
******************************************************************/
|
||||
|
||||
|
||||
|
||||
/* List-header for all allocated memory. */
|
||||
|
||||
struct GC_Amiga_AllocedMemoryHeader{
|
||||
ULONG size;
|
||||
struct GC_Amiga_AllocedMemoryHeader *next;
|
||||
};
|
||||
struct GC_Amiga_AllocedMemoryHeader *GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(int)~(NULL);
|
||||
|
||||
|
||||
|
||||
/* Type of memory. Once in the execution of a program, this might change to MEMF_ANY|MEMF_CLEAR */
|
||||
|
||||
ULONG GC_AMIGA_MEMF = MEMF_FAST | MEMF_CLEAR;
|
||||
|
||||
|
||||
/* Prevents GC_amiga_get_mem from allocating memory if this one is TRUE. */
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
BOOL GC_amiga_dontalloc=FALSE;
|
||||
#endif
|
||||
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
int succ=0,succ2=0;
|
||||
int nsucc=0,nsucc2=0;
|
||||
int nullretries=0;
|
||||
int numcollects=0;
|
||||
int chipa=0;
|
||||
int allochip=0;
|
||||
int allocfast=0;
|
||||
int cur0=0;
|
||||
int cur1=0;
|
||||
int cur10=0;
|
||||
int cur50=0;
|
||||
int cur150=0;
|
||||
int cur151=0;
|
||||
int ncur0=0;
|
||||
int ncur1=0;
|
||||
int ncur10=0;
|
||||
int ncur50=0;
|
||||
int ncur150=0;
|
||||
int ncur151=0;
|
||||
#endif
|
||||
|
||||
/* Free everything at program-end. */
|
||||
|
||||
void GC_amiga_free_all_mem(void){
|
||||
struct GC_Amiga_AllocedMemoryHeader *gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(GC_AMIGAMEM));
|
||||
struct GC_Amiga_AllocedMemoryHeader *temp;
|
||||
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
printf("\n\n"
|
||||
"%d bytes of chip-mem, and %d bytes of fast-mem where allocated from the OS.\n",
|
||||
allochip,allocfast
|
||||
);
|
||||
printf(
|
||||
"%d bytes of chip-mem were returned from the GC_AMIGA_FASTALLOC supported allocating functions.\n",
|
||||
chipa
|
||||
);
|
||||
printf("\n");
|
||||
printf("GC_gcollect was called %d times to avoid returning NULL or start allocating with the MEMF_ANY flag.\n",numcollects);
|
||||
printf("%d of them was a success. (the others had to use allocation from the OS.)\n",nullretries);
|
||||
printf("\n");
|
||||
printf("Succeded forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",succ,succ2);
|
||||
printf("Failed forcing %d gc-allocations (%d bytes) of chip-mem to be fast-mem.\n",nsucc,nsucc2);
|
||||
printf("\n");
|
||||
printf(
|
||||
"Number of retries before succeding a chip->fast force:\n"
|
||||
"0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n",
|
||||
cur0,cur1,cur10,cur50,cur150,cur151
|
||||
);
|
||||
printf(
|
||||
"Number of retries before giving up a chip->fast force:\n"
|
||||
"0: %d, 1: %d, 2-9: %d, 10-49: %d, 50-149: %d, >150: %d\n",
|
||||
ncur0,ncur1,ncur10,ncur50,ncur150,ncur151
|
||||
);
|
||||
#endif
|
||||
|
||||
while(gc_am!=NULL){
|
||||
temp=gc_am->next;
|
||||
FreeMem(gc_am,gc_am->size);
|
||||
gc_am=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(temp));
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
|
||||
/* All memory with address lower than this one is chip-mem. */
|
||||
|
||||
char *chipmax;
|
||||
|
||||
|
||||
/*
|
||||
* Allways set to the last size of memory tried to be allocated.
|
||||
* Needed to ensure allocation when the size is bigger than 100000.
|
||||
*
|
||||
*/
|
||||
size_t latestsize;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The actual function that is called with the GET_MEM macro.
|
||||
*
|
||||
*/
|
||||
|
||||
void *GC_amiga_get_mem(size_t size){
|
||||
struct GC_Amiga_AllocedMemoryHeader *gc_am;
|
||||
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
if(GC_amiga_dontalloc==TRUE){
|
||||
// printf("rejected, size: %d, latestsize: %d\n",size,latestsize);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// We really don't want to use chip-mem, but if we must, then as little as possible.
|
||||
if(GC_AMIGA_MEMF==(MEMF_ANY|MEMF_CLEAR) && size>100000 && latestsize<50000) return NULL;
|
||||
#endif
|
||||
|
||||
gc_am=AllocMem((ULONG)(size + sizeof(struct GC_Amiga_AllocedMemoryHeader)),GC_AMIGA_MEMF);
|
||||
if(gc_am==NULL) return NULL;
|
||||
|
||||
gc_am->next=GC_AMIGAMEM;
|
||||
gc_am->size=size + sizeof(struct GC_Amiga_AllocedMemoryHeader);
|
||||
GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(gc_am));
|
||||
|
||||
// printf("Allocated %d (%d) bytes at address: %x. Latest: %d\n",size,tot,gc_am,latestsize);
|
||||
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
if((char *)gc_am<chipmax){
|
||||
allochip+=size;
|
||||
}else{
|
||||
allocfast+=size;
|
||||
}
|
||||
#endif
|
||||
|
||||
return gc_am+1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
|
||||
/* Tries very hard to force GC to find fast-mem to return. Done recursively
|
||||
* to hold the rejected memory-pointers reachable from the collector in an
|
||||
* easy way.
|
||||
*
|
||||
*/
|
||||
#ifdef GC_AMIGA_RETRY
|
||||
void *GC_amiga_rec_alloc(size_t size,void *(*AllocFunction)(size_t size2),const int rec){
|
||||
void *ret;
|
||||
|
||||
ret=(*AllocFunction)(size);
|
||||
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
if((char *)ret>chipmax || ret==NULL){
|
||||
if(ret==NULL){
|
||||
nsucc++;
|
||||
nsucc2+=size;
|
||||
if(rec==0) ncur0++;
|
||||
if(rec==1) ncur1++;
|
||||
if(rec>1 && rec<10) ncur10++;
|
||||
if(rec>=10 && rec<50) ncur50++;
|
||||
if(rec>=50 && rec<150) ncur150++;
|
||||
if(rec>=150) ncur151++;
|
||||
}else{
|
||||
succ++;
|
||||
succ2+=size;
|
||||
if(rec==0) cur0++;
|
||||
if(rec==1) cur1++;
|
||||
if(rec>1 && rec<10) cur10++;
|
||||
if(rec>=10 && rec<50) cur50++;
|
||||
if(rec>=50 && rec<150) cur150++;
|
||||
if(rec>=150) cur151++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((char *)ret)<=chipmax && ret!=NULL && (rec<(size>500000?9:size/5000))){
|
||||
ret=GC_amiga_rec_alloc(size,AllocFunction,rec+1);
|
||||
// GC_free(ret2);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* The allocating-functions defined inside the amiga-blocks in gc.h is called
|
||||
* via these functions.
|
||||
*/
|
||||
|
||||
|
||||
void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2)){
|
||||
void *ret,*ret2;
|
||||
|
||||
GC_amiga_dontalloc=TRUE; // Pretty tough thing to do, but its indeed necesarry.
|
||||
latestsize=size;
|
||||
|
||||
ret=(*AllocFunction)(size);
|
||||
|
||||
if(((char *)ret) <= chipmax){
|
||||
if(ret==NULL){
|
||||
//Give GC access to allocate memory.
|
||||
#ifdef GC_AMIGA_GC
|
||||
if(!GC_dont_gc){
|
||||
GC_gcollect();
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
numcollects++;
|
||||
#endif
|
||||
ret=(*AllocFunction)(size);
|
||||
}
|
||||
#endif
|
||||
if(ret==NULL){
|
||||
GC_amiga_dontalloc=FALSE;
|
||||
ret=(*AllocFunction)(size);
|
||||
if(ret==NULL){
|
||||
WARN("Out of Memory! Returning NIL!\n", 0);
|
||||
}
|
||||
}
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
else{
|
||||
nullretries++;
|
||||
}
|
||||
if(ret!=NULL && (char *)ret<=chipmax) chipa+=size;
|
||||
#endif
|
||||
}
|
||||
#ifdef GC_AMIGA_RETRY
|
||||
else{
|
||||
/* We got chip-mem. Better try again and again and again etc., we might get fast-mem sooner or later... */
|
||||
/* Using gctest to check the effectiviness of doing this, does seldom give a very good result. */
|
||||
/* However, real programs doesn't normally rapidly allocate and deallocate. */
|
||||
// printf("trying to force... %d bytes... ",size);
|
||||
if(
|
||||
AllocFunction!=GC_malloc_uncollectable
|
||||
#ifdef ATOMIC_UNCOLLECTABLE
|
||||
&& AllocFunction!=GC_malloc_atomic_uncollectable
|
||||
#endif
|
||||
){
|
||||
ret2=GC_amiga_rec_alloc(size,AllocFunction,0);
|
||||
}else{
|
||||
ret2=(*AllocFunction)(size);
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
if((char *)ret2<chipmax || ret2==NULL){
|
||||
nsucc++;
|
||||
nsucc2+=size;
|
||||
ncur0++;
|
||||
}else{
|
||||
succ++;
|
||||
succ2+=size;
|
||||
cur0++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(((char *)ret2)>chipmax){
|
||||
// printf("Succeeded.\n");
|
||||
GC_free(ret);
|
||||
ret=ret2;
|
||||
}else{
|
||||
GC_free(ret2);
|
||||
// printf("But did not succeed.\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
GC_amiga_dontalloc=FALSE;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void (*GC_amiga_toany)(void)=NULL;
|
||||
|
||||
void GC_amiga_set_toany(void (*func)(void)){
|
||||
GC_amiga_toany=func;
|
||||
}
|
||||
|
||||
#endif // !GC_AMIGA_ONLYFAST
|
||||
|
||||
|
||||
void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2)){
|
||||
void *ret;
|
||||
|
||||
ret=(*AllocFunction)(size);
|
||||
|
||||
if(ret==NULL){
|
||||
// Enable chip-mem allocation.
|
||||
// printf("ret==NULL\n");
|
||||
#ifdef GC_AMIGA_GC
|
||||
if(!GC_dont_gc){
|
||||
GC_gcollect();
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
numcollects++;
|
||||
#endif
|
||||
ret=(*AllocFunction)(size);
|
||||
}
|
||||
#endif
|
||||
if(ret==NULL){
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR;
|
||||
if(GC_amiga_toany!=NULL) (*GC_amiga_toany)();
|
||||
GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any;
|
||||
return GC_amiga_allocwrapper_any(size,AllocFunction);
|
||||
#endif
|
||||
}
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
else{
|
||||
nullretries++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2)){
|
||||
atexit(&GC_amiga_free_all_mem);
|
||||
chipmax=(char *)SysBase->MaxLocMem; // For people still having SysBase in chip-mem, this might speed up a bit.
|
||||
GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_fast;
|
||||
return GC_amiga_allocwrapper_fast(size,AllocFunction);
|
||||
}
|
||||
|
||||
|
||||
#endif //GC_AMIGA_FASTALLOC
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The wrapped realloc function.
|
||||
*
|
||||
*/
|
||||
void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes){
|
||||
#ifndef GC_AMIGA_FASTALLOC
|
||||
return GC_realloc(old_object,new_size_in_bytes);
|
||||
#else
|
||||
void *ret;
|
||||
latestsize=new_size_in_bytes;
|
||||
ret=GC_realloc(old_object,new_size_in_bytes);
|
||||
if(ret==NULL && GC_AMIGA_MEMF==(MEMF_FAST | MEMF_CLEAR)){
|
||||
/* Out of fast-mem. */
|
||||
#ifdef GC_AMIGA_GC
|
||||
if(!GC_dont_gc){
|
||||
GC_gcollect();
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
numcollects++;
|
||||
#endif
|
||||
ret=GC_realloc(old_object,new_size_in_bytes);
|
||||
}
|
||||
#endif
|
||||
if(ret==NULL){
|
||||
#ifndef GC_AMIGA_ONLYFAST
|
||||
GC_AMIGA_MEMF=MEMF_ANY | MEMF_CLEAR;
|
||||
if(GC_amiga_toany!=NULL) (*GC_amiga_toany)();
|
||||
GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_any;
|
||||
ret=GC_realloc(old_object,new_size_in_bytes);
|
||||
#endif
|
||||
}
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
else{
|
||||
nullretries++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if(ret==NULL){
|
||||
WARN("Out of Memory! Returning NIL!\n", 0);
|
||||
}
|
||||
#ifdef GC_AMIGA_PRINTSTATS
|
||||
if(((char *)ret)<chipmax && ret!=NULL){
|
||||
chipa+=new_size_in_bytes;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //GC_AMIGA_AM
|
||||
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
# Makefile for Borland C++ 5.5 on NT
|
||||
# If you have the Borland assembler, remove "-DUSE_GENERIC"
|
||||
#
|
||||
bc= c:\Borland\BCC55
|
||||
bcbin= $(bc)\bin
|
||||
bclib= $(bc)\lib
|
||||
bcinclude= $(bc)\include
|
||||
|
||||
gcinclude1 = $(bc)\gc6.2\include
|
||||
gcinclude2 = $(bc)\gc6.2\cord
|
||||
|
||||
cc= $(bcbin)\bcc32
|
||||
rc= $(bcbin)\brc32
|
||||
lib= $(bcbin)\tlib
|
||||
link= $(bcbin)\ilink32
|
||||
cflags= -O2 -R -v- -vi -H -H=gc.csm -I$(bcinclude);$(gcinclude1);$(gcinclude2) -L$(bclib) \
|
||||
-w-pro -w-aus -w-par -w-ccc -w-rch -a4 -D__STDC__=0
|
||||
#defines= -DSILENT
|
||||
defines= -DSILENT -DALL_INTERIOR_POINTERS -DUSE_GENERIC -DNO_GETENV -DJAVA_FINALIZATION -DGC_OPERATOR_NEW_ARRAY
|
||||
|
||||
.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: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h MAKEFILE
|
||||
|
||||
gc.lib: $(OBJS)
|
||||
del gc.lib
|
||||
$(lib) $* @&&|
|
||||
$(XXXOBJS:XXX=+)
|
||||
|
|
||||
|
||||
gctest.exe: tests\test.obj gc.lib
|
||||
$(cc) @&&|
|
||||
$(cflags) -W -e$* tests\test.obj gc.lib
|
||||
|
|
||||
|
||||
cord\de.obj cord\de_win.obj: include\cord.h include\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: include\gc_cpp.h include\gc.h
|
||||
|
||||
gc_cpp.cpp: gc_cpp.cc
|
||||
copy gc_cpp.cc gc_cpp.cpp
|
||||
|
||||
test_cpp.cpp: tests\test_cpp.cc
|
||||
copy tests\test_cpp.cc test_cpp.cpp
|
||||
|
||||
test_cpp.exe: test_cpp.obj include\gc_cpp.h include\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
|
||||
|
||||
clean:
|
||||
del gc.lib
|
||||
del *.obj
|
||||
del tests\test.obj
|
||||
|
||||
@@ -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)/gcconfig.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)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.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 tests/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: tests/test.o gc.a
|
||||
$(CC) $(CFLAGS) -o gctest.exe tests/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
|
||||
-154
@@ -1,154 +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
|
||||
}
|
||||
}
|
||||
|
||||
#if __option(far_data)
|
||||
|
||||
void* GC_MacGetDataEnd()
|
||||
{
|
||||
CodeZeroHandle code0 = (CodeZeroHandle)GetResource('CODE', 0);
|
||||
if (code0) {
|
||||
long aboveA5Size = (**code0).aboveA5;
|
||||
ReleaseResource((Handle)code0);
|
||||
return (LMGetCurrentA5() + aboveA5Size);
|
||||
}
|
||||
fprintf(stderr, "Couldn't load the jump table.");
|
||||
exit(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __option(far_data) */
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
// -DGC_OPERATOR_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.
|
||||
@@ -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.
|
||||
// -DGC_OPERATOR_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.
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
dataend.c
|
||||
|
||||
A hack to get the extent of global data for the Macintosh.
|
||||
|
||||
by Patrick C. Beard.
|
||||
*/
|
||||
|
||||
long __dataend;
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
datastart.c
|
||||
|
||||
A hack to get the extent of global data for the Macintosh.
|
||||
|
||||
by Patrick C. Beard.
|
||||
*/
|
||||
|
||||
long __datastart;
|
||||
@@ -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
|
||||
@@ -1,190 +0,0 @@
|
||||
# Copyright (c) 1999-2001 by Red Hat, Inc. 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: Tom Tromey
|
||||
# Severely truncated by Hans-J. Boehm
|
||||
|
||||
## 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.
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = m4 include doc
|
||||
|
||||
AM_CPPFLAGS = -I$(top_builddir)/.. -I$(top_srcdir)/..
|
||||
|
||||
#
|
||||
# libtool is not capable of creating shared/static versions of a convenience
|
||||
# library, so we have to do it ourselves
|
||||
#
|
||||
|
||||
noinst_LTLIBRARIES = libmonogc.la libmonogc-static.la
|
||||
|
||||
EXTRA_DIST =
|
||||
## more items will be succesively added below
|
||||
|
||||
if POWERPC_DARWIN
|
||||
asm_libgc_sources = powerpc_darwin_mach_dep.s
|
||||
endif
|
||||
|
||||
if TARGET_IA64
|
||||
asm_libgc_sources = ia64_save_regs_in_stack.s
|
||||
endif
|
||||
|
||||
libmonogc_la_SOURCES = allchblk.c alloc.c blacklst.c checksums.c dbg_mlc.c \
|
||||
dyn_load.c finalize.c gc_dlopen.c gcj_mlc.c headers.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 real_malloc.c reclaim.c \
|
||||
solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \
|
||||
backgraph.c win32_threads.c \
|
||||
pthread_support.c pthread_stop_world.c darwin_stop_world.c \
|
||||
mach_dep.c $(asm_libgc_sources)
|
||||
|
||||
# Include THREADDLLIBS here to ensure that the correct versions of
|
||||
# linuxthread semaphore functions get linked:
|
||||
libmonogc_la_LIBADD = $(THREADDLLIBS) $(UNWINDLIBS)
|
||||
libmonogc_la_DEPENDENCIES =
|
||||
libmonogc_la_LDFLAGS = -version-info 1:2:0
|
||||
|
||||
EXTRA_libmonogc_la_SOURCES = alpha_mach_dep.S \
|
||||
mips_sgi_mach_dep.s mips_ultrix_mach_dep.s powerpc_darwin_mach_dep.s \
|
||||
rs6000_mach_dep.s sparc_mach_dep.S sparc_netbsd_mach_dep.s \
|
||||
sparc_sunos4_mach_dep.s ia64_save_regs_in_stack.s
|
||||
|
||||
libmonogc_static_la_SOURCES = $(libmonogc_la_SOURCES)
|
||||
libmonogc_static_la_LIBADD = $(libmonogc_la_LIBADD)
|
||||
libmonogc_static_la_LDFLAGS = -static
|
||||
|
||||
EXTRA_DIST += alpha_mach_dep.S mips_sgi_mach_dep.s sparc_mach_dep.S
|
||||
|
||||
AM_CFLAGS = $(WERROR_CFLAGS) @GC_CFLAGS@
|
||||
|
||||
if CPLUSPLUS
|
||||
extra_checks = test_cpp
|
||||
else
|
||||
extra_checks =
|
||||
endif
|
||||
|
||||
#check_PROGRAMS = gctest $(extra_checks)
|
||||
|
||||
#test.o: $(srcdir)/tests/test.c
|
||||
# $(COMPILE) -c $(srcdir)/tests/test.c
|
||||
# Using $< in the above seems to fail with the HP/UX on Itanium make.
|
||||
#test_cpp.o: $(srcdir)/tests/test_cpp.cc
|
||||
# $(CXXCOMPILE) -c $(srcdir)/tests/test_cpp.cc
|
||||
|
||||
## FIXME: this is probably the reason why some files from BUILT_SOURCES
|
||||
## are included in the distribution
|
||||
# gctest_OBJECTS = test.o
|
||||
#gctest_SOURCES = tests/test.c
|
||||
#gctest_LDADD = ./libgc.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
|
||||
#test_cpp_SOURCES = tests/test_cpp.cc
|
||||
#test_cpp_LDADD = ./libgc.la ./libgccpp.la $(THREADDLLIBS) $(UNWINDLIBS) $(EXTRA_TEST_LIBS)
|
||||
|
||||
#TESTS = gctest $(extra_checks)
|
||||
|
||||
## FIXME: relies on internal code generated by automake.
|
||||
all_objs = $(libgc_la_OBJECTS)
|
||||
$(all_objs) : include/private/gcconfig.h include/private/gc_priv.h \
|
||||
include/private/gc_hdrs.h include/gc.h include/gc_gcj.h include/gc_mark.h
|
||||
|
||||
## FIXME: we shouldn't have to do this, but automake forces us to.
|
||||
if COMPILER_XLC
|
||||
## XLC neither requires nor tolerates the unnecessary assembler goop
|
||||
ASM_CPP_OPTIONS =
|
||||
else
|
||||
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
|
||||
## these.
|
||||
ASM_CPP_OPTIONS = -Wp,-P -x assembler-with-cpp
|
||||
endif
|
||||
.s.lo:
|
||||
## We use -Wp,-P to strip #line directives. Irix `as' chokes on
|
||||
## these.
|
||||
$(LTCOMPILE) $(ASM_CPP_OPTIONS) -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 --tag=CC $(CC) $(DEFS) \
|
||||
-I$(top_srcdir)/include $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(MY_CFLAGS) $(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)"
|
||||
|
||||
MAKEOVERRIDES=
|
||||
|
||||
# files used by makefiles other than Makefile.am
|
||||
#
|
||||
EXTRA_DIST += add_gc_prefix.c gcname.c if_mach.c if_not_there.c hpux_test_and_clear.s pc_excludes gc.mak MacOS.c MacProjects.sit.hqx mach_dep.c setjmp_t.c threadlibs.c AmigaOS.c version.h Mac_files/datastart.c Mac_files/dataend.c Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h
|
||||
|
||||
# cord package
|
||||
#
|
||||
EXTRA_DIST += cord cord/cordbscs.c cord/cordtest.c cord/de.c cord/de_win.c cord/de_win.ICO cord/cordprnt.c cord/cordxtra.c cord/de_cmds.h cord/de_win.h cord/de_win.RC
|
||||
|
||||
# this is an auxiliary shell file used by Makefile and Makefile.direct
|
||||
#
|
||||
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.host
|
||||
|
||||
# :FIXME: why do we distribute this one???
|
||||
#
|
||||
EXTRA_DIST += configure.host
|
||||
|
||||
#
|
||||
# :GOTCHA: GNU make rule for making .s out of .S is flawed,
|
||||
# it will not remove dest if building fails
|
||||
.S.s:
|
||||
if $(CPP) $< >$@ ; then :; else rm -f $@; fi
|
||||
|
||||
test:
|
||||
|
||||
test-bundle:
|
||||
@@ -1,685 +0,0 @@
|
||||
# This is the original manually generated Makefile. It may still be used
|
||||
# to build the collector.
|
||||
#
|
||||
# Primary targets:
|
||||
# gc.a - builds basic library
|
||||
# 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=
|
||||
# ABI_FLAG should be the cc flag that specifies the ABI. On most
|
||||
# platforms this will be the empty string. Possible values:
|
||||
# +DD64 for 64-bit executable on HP/UX.
|
||||
# -n32, -n64, -o32 for SGI/MIPS ABIs.
|
||||
|
||||
AS_ABI_FLAG=$(ABI_FLAG)
|
||||
# ABI flag for assembler. On HP/UX this is +A64 for 64 bit
|
||||
# executables.
|
||||
|
||||
CC=cc $(ABI_FLAG)
|
||||
CXX=g++ $(ABI_FLAG)
|
||||
AS=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.
|
||||
|
||||
# Redefining srcdir allows object code for the nonPCR version of the collector
|
||||
# to be generated in different directories.
|
||||
srcdir= .
|
||||
VPATH= $(srcdir)
|
||||
|
||||
CFLAGS= -O -I$(srcdir)/include -DATOMIC_UNCOLLECTABLE -DNO_SIGNALS -DNO_EXECUTE_PERMISSION -DSILENT -DALL_INTERIOR_POINTERS
|
||||
|
||||
# To build the parallel collector on Linux, add to the above:
|
||||
# -DGC_LINUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC
|
||||
# To build the parallel collector in a static library on HP/UX,
|
||||
# add to the above:
|
||||
# -DGC_HPUX_THREADS -DPARALLEL_MARK -DTHREAD_LOCAL_ALLOC -D_POSIX_C_SOURCE=199506L -mt
|
||||
# To build the thread-safe collector on Tru64, add to the above:
|
||||
# -pthread -DGC_OSF1_THREADS
|
||||
|
||||
# HOSTCC and HOSTCFLAGS are used to build executables that will be run as
|
||||
# part of the build process, i.e. on the build machine. These will usually
|
||||
# be the same as CC and CFLAGS, except in a cross-compilation environment.
|
||||
# Note that HOSTCFLAGS should include any -D flags that affect thread support.
|
||||
HOSTCC=$(CC)
|
||||
HOSTCFLAGS=$(CFLAGS)
|
||||
|
||||
# For dynamic library builds, it may be necessary to add flags to generate
|
||||
# PIC code, e.g. -fPIC on Linux.
|
||||
|
||||
# Setjmp_test may yield overly optimistic results when compiled
|
||||
# without optimization.
|
||||
|
||||
# These define arguments influence the collector configuration:
|
||||
# -DSILENT disables statistics printing, and improves performance.
|
||||
# -DFIND_LEAK causes GC_find_leak to be initially set.
|
||||
# This 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.
|
||||
# -DGC_SOLARIS_THREADS enables support for Solaris (thr_) threads.
|
||||
# (Clients should also define GC_SOLARIS_THREADS and then include
|
||||
# gc.h before performing thr_ or dl* or GC_ operations.)
|
||||
# Must also define -D_REENTRANT.
|
||||
# -DGC_SOLARIS_PTHREADS enables support for Solaris pthreads.
|
||||
# (Internally this define GC_SOLARIS_THREADS as well.)
|
||||
# -DGC_IRIX_THREADS enables support for Irix pthreads. See README.irix.
|
||||
# -DGC_HPUX_THREADS enables support for HP/UX 11 pthreads.
|
||||
# Also requires -D_REENTRANT or -D_POSIX_C_SOURCE=199506L. See README.hp.
|
||||
# -DGC_LINUX_THREADS enables support for Xavier Leroy's Linux threads.
|
||||
# see README.linux. -D_REENTRANT may also be required.
|
||||
# -DGC_OSF1_THREADS enables support for Tru64 pthreads.
|
||||
# -DGC_FREEBSD_THREADS enables support for FreeBSD pthreads.
|
||||
# Appeared to run into some underlying thread problems.
|
||||
# -DGC_DARWIN_THREADS enables support for Mac OS X pthreads.
|
||||
# -DGC_AIX_THREADS enables support for IBM AIX threads.
|
||||
# -DGC_DGUX386_THREADS enables support for DB/UX on I386 threads.
|
||||
# See README.DGUX386.
|
||||
# -DGC_WIN32_THREADS enables support for win32 threads. That makes sense
|
||||
# for this Makefile only under Cygwin.
|
||||
# -DGC_THREADS should set the appropriate one of the above macros.
|
||||
# It assumes pthreads for Solaris.
|
||||
# -DALL_INTERIOR_POINTERS allows all pointers to the interior
|
||||
# of objects to be recognized. (See gc_priv.h for consequences.)
|
||||
# Alternatively, GC_all_interior_pointers can be set at process
|
||||
# initialization time.
|
||||
# -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 or
|
||||
# GC_all_interior_pointers = 1. 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.
|
||||
# This is on by default. Turning it off has not been extensively tested with
|
||||
# compilers that reorder stores. It should have been.
|
||||
# -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.
|
||||
# -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
|
||||
# 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. Must also be defined
|
||||
# by clients that use gc_cpp.h.
|
||||
# -DREDIRECT_MALLOC=X causes malloc to be defined as alias for X.
|
||||
# Unless the following macros are defined, realloc is also redirected
|
||||
# to GC_realloc, and free is redirected to GC_free.
|
||||
# Calloc and strdup are redefined in terms of the new malloc. X should
|
||||
# be either GC_malloc or GC_malloc_uncollectable, or
|
||||
# GC_debug_malloc_replacement. (The latter invokes GC_debug_malloc
|
||||
# with dummy source location information, but still results in
|
||||
# properly remembered call stacks on Linux/X86 and Solaris/SPARC.
|
||||
# It requires that the following two macros also be used.)
|
||||
# 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.) If you build with DBG_HDRS_ALL,
|
||||
# you should only use GC_debug_malloc_replacement as a malloc
|
||||
# replacement.
|
||||
# -DREDIRECT_REALLOC=X causes GC_realloc to be redirected to X.
|
||||
# The canonical use is -DREDIRECT_REALLOC=GC_debug_realloc_replacement,
|
||||
# together with -DREDIRECT_MALLOC=GC_debug_malloc_replacement to
|
||||
# generate leak reports with call stacks for both malloc and realloc.
|
||||
# This also requires the following:
|
||||
# -DREDIRECT_FREE=X causes free to be redirected to X. The
|
||||
# canonical use is -DREDIRECT_FREE=GC_debug_free.
|
||||
# -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. Since 5.0, determines only only the initial value
|
||||
# of GC_java_finalization variable.
|
||||
# -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
|
||||
# to explicit GC_invoke_finalizers() calls.
|
||||
# In 5.0 this became runtime adjustable, and this only determines the
|
||||
# initial value of GC_finalize_on_demand.
|
||||
# -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.
|
||||
# -DUSE_MUNMAP causes memory to be returned to the OS under the right
|
||||
# circumstances. This currently disables VM-based incremental collection.
|
||||
# This is currently experimental, and works only under some Unix,
|
||||
# Linux and Windows versions.
|
||||
# -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.
|
||||
# -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
|
||||
# for objects allocated with the debugging allocator. If all objects
|
||||
# through GC_MALLOC with GC_DEBUG defined, this allows the client
|
||||
# to determine how particular or randomly chosen objects are reachable
|
||||
# for debugging/profiling purposes. The gc_backptr.h interface is
|
||||
# implemented only if this is defined.
|
||||
# -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
|
||||
# this facility is only used in a few places. It is intended primarily
|
||||
# for debugging of the garbage collector itself, but could also
|
||||
# -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
|
||||
# the reliability (from 99.9999% to 100% mod. bugs) of some of the debugging
|
||||
# code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
|
||||
# Assumes that all client allocation is done through debugging
|
||||
# allocators.
|
||||
# -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
|
||||
# the headers to minimize object size, at the expense of checking for
|
||||
# writes past the end of an object. This is intended for environments
|
||||
# in which most client code is written in a "safe" language, such as
|
||||
# Scheme or Java. Assumes that all client allocation is done using
|
||||
# the GC_debug_ functions, or through the macros that expand to these,
|
||||
# or by redirecting malloc to GC_debug_malloc_replacement.
|
||||
# (Also eliminates the field for the requested object size.)
|
||||
# occasionally be useful for debugging of client code. Slows down the
|
||||
# collector somewhat, but not drastically.
|
||||
# -DSAVE_CALL_COUNT=<n> Set the number of call frames saved with objects
|
||||
# allocated through the debugging interface. Affects the amount of
|
||||
# information generated in leak reports. Only matters on platforms
|
||||
# on which we can quickly generate call stacks, currently Linux/(X86 & SPARC)
|
||||
# and Solaris/SPARC and platforms that provide execinfo.h.
|
||||
# Default is zero. On X86, client
|
||||
# code should NOT be compiled with -fomit-frame-pointer.
|
||||
# -DSAVE_CALL_NARGS=<n> Set the number of functions arguments to be
|
||||
# saved with each call frame. Default is zero. Ignored if we
|
||||
# don't know how to retrieve arguments on the platform.
|
||||
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
|
||||
# altered stubborn objects, at substantial performance cost.
|
||||
# Use only for debugging of the incremental collector.
|
||||
# -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
|
||||
# that include a pointer to a type descriptor in each allocated object).
|
||||
# Building this way requires an ANSI C compiler.
|
||||
# -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
|
||||
# prefetch instructions. No effect except on X86 Linux platforms.
|
||||
# Assumes a very recent gcc-compatible compiler and assembler.
|
||||
# (Gas prefetcht0 support was added around May 1999.)
|
||||
# Empirically the code appears to still run correctly on Pentium II
|
||||
# processors, though with no performance benefit. May not run on other
|
||||
# X86 processors? In some cases this improves performance by
|
||||
# 15% or so.
|
||||
# -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
|
||||
# prefetch instructions. Same restrictions as USE_I686_PREFETCH.
|
||||
# Minimally tested. Didn't appear to be an obvious win on a K6-2/500.
|
||||
# -DUSE_PPC_PREFETCH causes the collector to issue PowerPC style
|
||||
# prefetch instructions. No effect except on PowerPC OS X platforms.
|
||||
# Performance impact untested.
|
||||
# -DGC_USE_LD_WRAP in combination with the old flags listed in README.linux
|
||||
# causes the collector some system and pthread calls in a more transparent
|
||||
# fashion than the usual macro-based approach. Requires GNU ld, and
|
||||
# currently probably works only with Linux.
|
||||
# -DTHREAD_LOCAL_ALLOC defines GC_local_malloc(), GC_local_malloc_atomic()
|
||||
# and GC_local_gcj_malloc(). Needed for gc_gcj.h interface. These allocate
|
||||
# in a way that usually does not involve acquisition of a global lock.
|
||||
# Currently works only on platforms such as Linux which use pthread_support.c.
|
||||
# Recommended for multiprocessors.
|
||||
# -DUSE_COMPILER_TLS causes thread local allocation to use compiler-supported
|
||||
# "__thread" thread-local variables. This is the default in HP/UX. It
|
||||
# may help performance on recent Linux installations. (It failed for
|
||||
# me on RedHat 8, but appears to work on RedHat 9.)
|
||||
# -DPARALLEL_MARK allows the marker to run in multiple threads. Recommended
|
||||
# for multiprocessors. Currently requires Linux on X86 or IA64, though
|
||||
# support for other Posix platforms should be fairly easy to add,
|
||||
# if the thread implementation is otherwise supported.
|
||||
# -DNO_GETENV prevents the collector from looking at environment variables.
|
||||
# These may otherwise alter its configuration, or turn off GC altogether.
|
||||
# I don't know of a reason to disable this, except possibly if the
|
||||
# resulting process runs as a privileged user?
|
||||
# -DUSE_GLOBAL_ALLOC. Win32 only. Use GlobalAlloc instead of
|
||||
# VirtualAlloc to allocate the heap. May be needed to work around
|
||||
# a Windows NT/2000 issue. Incompatible with USE_MUNMAP.
|
||||
# See README.win32 for details.
|
||||
# -DMAKE_BACK_GRAPH. Enable GC_PRINT_BACK_HEIGHT environment variable.
|
||||
# See README.environment for details. Experimental. Limited platform
|
||||
# support. Implies DBG_HDRS_ALL. All allocation should be done using
|
||||
# the debug interface.
|
||||
# -DSTUBBORN_ALLOC allows allocation of "hard to change" objects, and thus
|
||||
# makes incremental collection easier. Was enabled by default until 6.0.
|
||||
# Rarely used, to my knowledge.
|
||||
# -DHANDLE_FORK attempts to make GC_malloc() work in a child process fork()ed
|
||||
# from a multithreaded parent. Currently only supported by pthread_support.c.
|
||||
# (Similar code should work on Solaris or Irix, but it hasn't been tried.)
|
||||
# -DTEST_WITH_SYSTEM_MALLOC causes gctest to allocate (and leak) large chunks
|
||||
# of memory with the standard system malloc. This will cause the root
|
||||
# set and collected heap to grow significantly if malloced memory is
|
||||
# somehow getting traced by the collector. This has no impact on the
|
||||
# generated library; it only affects the test.
|
||||
# -DPOINTER_MASK=0x... causes candidate pointers to be ANDed with the
|
||||
# given mask before being considered. If either this or the following
|
||||
# macro is defined, it will be assumed that all pointers stored in
|
||||
# the heap need to be processed this way. Stack and register pointers
|
||||
# will be considered both with and without processing.
|
||||
# These macros are normally needed only to support systems that use
|
||||
# high-order pointer tags. EXPERIMENTAL.
|
||||
# -DPOINTER_SHIFT=n causes the collector to left shift candidate pointers
|
||||
# by the indicated amount before trying to interpret them. Applied
|
||||
# after POINTER_MASK. EXPERIMENTAL. See also the preceding macro.
|
||||
# -DDARWIN_DONT_PARSE_STACK Causes the Darwin port to discover thread
|
||||
# stack bounds in the same way as other pthread ports, without trying to
|
||||
# walk the frames onthe stack. This is recommended only as a fallback
|
||||
# for applications that don't support proper stack unwinding.
|
||||
#
|
||||
|
||||
CXXFLAGS= $(CFLAGS)
|
||||
AR= ar
|
||||
RANLIB= ranlib
|
||||
|
||||
|
||||
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 pthread_support.o pthread_stop_world.o darwin_stop_world.o typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.o gc_dlopen.o backgraph.o win32_threads.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 pthread_support.c pthread_stop_world.c darwin_stop_world.c typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c gc_dlopen.c backgraph.c win32_threads.c
|
||||
|
||||
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/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_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 include/gc.h include/gc_typed.h \
|
||||
include/private/gc_hdrs.h include/private/gc_priv.h \
|
||||
include/private/gcconfig.h include/private/gc_pmark.h \
|
||||
include/gc_inl.h include/gc_inline.h include/gc_mark.h \
|
||||
threadlibs.c if_mach.c if_not_there.c gc_cpp.cc include/gc_cpp.h \
|
||||
gcname.c include/weakpointer.h include/private/gc_locks.h \
|
||||
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
|
||||
include/new_gc_alloc.h include/gc_allocator.h \
|
||||
include/javaxfc.h sparc_sunos4_mach_dep.s sparc_netbsd_mach_dep.s \
|
||||
include/private/solaris_threads.h include/gc_backptr.h \
|
||||
hpux_test_and_clear.s include/gc_gcj.h \
|
||||
include/gc_local_alloc.h include/private/dbg_mlc.h \
|
||||
include/private/specific.h powerpc_darwin_mach_dep.s \
|
||||
include/leak_detector.h include/gc_amiga_redirects.h \
|
||||
include/gc_pthread_redirects.h ia64_save_regs_in_stack.s \
|
||||
include/gc_config_macros.h include/private/pthread_support.h \
|
||||
include/private/pthread_stop_world.h include/private/darwin_semaphore.h \
|
||||
include/private/darwin_stop_world.h $(CORD_SRCS)
|
||||
|
||||
DOC_FILES= README.QUICK doc/README.Mac doc/README.MacOSX doc/README.OS2 \
|
||||
doc/README.amiga doc/README.cords doc/debugging.html \
|
||||
doc/README.dj doc/README.hp doc/README.linux doc/README.rs6000 \
|
||||
doc/README.sgi doc/README.solaris2 doc/README.uts \
|
||||
doc/README.win32 doc/barrett_diagram doc/README \
|
||||
doc/README.contributors doc/README.changes doc/gc.man \
|
||||
doc/README.environment doc/tree.html doc/gcdescr.html \
|
||||
doc/README.autoconf doc/README.macros doc/README.ews4800 \
|
||||
doc/README.DGUX386 doc/README.arm.cross doc/leak.html \
|
||||
doc/scale.html doc/gcinterface.html doc/README.darwin \
|
||||
doc/simple_example.html
|
||||
|
||||
TESTS= tests/test.c tests/test_cpp.cc tests/trace_test.c \
|
||||
tests/leak_test.c tests/thread_leak_test.c tests/middle.c
|
||||
|
||||
GNU_BUILD_FILES= configure.ac Makefile.am configure acinclude.m4 \
|
||||
libtool.m4 install-sh configure.host Makefile.in \
|
||||
aclocal.m4 config.sub config.guess \
|
||||
include/Makefile.am include/Makefile.in \
|
||||
doc/Makefile.am doc/Makefile.in \
|
||||
ltmain.sh mkinstalldirs depcomp missing
|
||||
|
||||
OTHER_MAKEFILES= OS2_MAKEFILE NT_MAKEFILE NT_THREADS_MAKEFILE gc.mak \
|
||||
BCC_MAKEFILE EMX_MAKEFILE WCC_MAKEFILE Makefile.dj \
|
||||
PCR-Makefile SMakefile.amiga Makefile.DLLs \
|
||||
digimars.mak Makefile.direct NT_STATIC_THREADS_MAKEFILE
|
||||
# Makefile and Makefile.direct are copies of each other.
|
||||
|
||||
OTHER_FILES= Makefile setjmp_t.c callprocs pc_excludes \
|
||||
MacProjects.sit.hqx MacOS.c \
|
||||
Mac_files/datastart.c Mac_files/dataend.c \
|
||||
Mac_files/MacOS_config.h Mac_files/MacOS_Test_config.h \
|
||||
add_gc_prefix.c gc_cpp.cpp \
|
||||
version.h AmigaOS.c \
|
||||
$(TESTS) $(GNU_BUILD_FILES) $(OTHER_MAKEFILES)
|
||||
|
||||
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
|
||||
$(srcdir)/include/ec.h $(srcdir)/include/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 = -I$(srcdir)/include
|
||||
# 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
|
||||
|
||||
LEAKFLAGS=$(CFLAGS) -DFIND_LEAK
|
||||
|
||||
BSD-pkg-all: bsd-libgc.a bsd-libleak.a
|
||||
|
||||
bsd-libgc.a:
|
||||
$(MAKE) CFLAGS="$(CFLAGS)" clean c++-t
|
||||
mv gc.a bsd-libgc.a
|
||||
|
||||
bsd-libleak.a:
|
||||
$(MAKE) -f Makefile.direct CFLAGS="$(LEAKFLAGS)" clean c++-nt
|
||||
mv gc.a bsd-libleak.a
|
||||
|
||||
BSD-pkg-install: BSD-pkg-all
|
||||
${CP} bsd-libgc.a libgc.a
|
||||
${INSTALL_DATA} libgc.a ${PREFIX}/lib
|
||||
${INSTALL_DATA} gc.h gc_cpp.h ${PREFIX}/include
|
||||
${INSTALL_MAN} doc/gc.man ${PREFIX}/man/man3/gc.3
|
||||
|
||||
pcr: PCR-Makefile include/private/gc_private.h include/private/gc_hdrs.h \
|
||||
include/private/gc_locks.h include/gc.h include/private/gcconfig.h \
|
||||
mach_dep.o $(SRCS)
|
||||
$(MAKE) -f PCR-Makefile depend
|
||||
$(MAKE) -f PCR-Makefile
|
||||
|
||||
$(OBJS) tests/test.o dyn_load.o dyn_load_sunos53.o: \
|
||||
$(srcdir)/include/private/gc_priv.h \
|
||||
$(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
|
||||
$(srcdir)/include/gc.h $(srcdir)/include/gc_pthread_redirects.h \
|
||||
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/gc_typed.h \
|
||||
$(srcdir)/include/gc_config_macros.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 ptr_chck.o: $(srcdir)/include/gc_mark.h $(srcdir)/include/private/gc_pmark.h
|
||||
|
||||
specific.o pthread_support.o: $(srcdir)/include/private/specific.h
|
||||
|
||||
solaris_threads.o solaris_pthreads.o: $(srcdir)/include/private/solaris_threads.h
|
||||
|
||||
dbg_mlc.o gcj_mlc.o: $(srcdir)/include/private/dbg_mlc.h
|
||||
|
||||
tests/test.o: tests $(srcdir)/tests/test.c
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/tests/test.c
|
||||
mv test.o tests/test.o
|
||||
|
||||
tests:
|
||||
mkdir tests
|
||||
|
||||
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
|
||||
echo > base_lib
|
||||
rm -f dont_ar_1
|
||||
./if_mach SPARC SUNOS5 touch dont_ar_1
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
|
||||
./if_mach M68K AMIGA touch dont_ar_1
|
||||
./if_mach M68K AMIGA $(AR) -vrus gc.a $(OBJS) dyn_load.o
|
||||
./if_not_there dont_ar_1 $(AR) ru gc.a $(OBJS) dyn_load.o
|
||||
./if_not_there dont_ar_1 $(RANLIB) gc.a || cat /dev/null
|
||||
# ignore ranlib failure; that usually means it doesn't exist, and isn't needed
|
||||
|
||||
cords: $(CORD_OBJS) cord/cordtest $(UTILS)
|
||||
rm -f dont_ar_3
|
||||
./if_mach SPARC SUNOS5 touch dont_ar_3
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
|
||||
./if_mach M68K AMIGA touch dont_ar_3
|
||||
./if_mach M68K AMIGA $(AR) -vrus gc.a $(CORD_OBJS)
|
||||
./if_not_there dont_ar_3 $(AR) ru gc.a $(CORD_OBJS)
|
||||
./if_not_there dont_ar_3 $(RANLIB) gc.a || cat /dev/null
|
||||
|
||||
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
|
||||
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
|
||||
|
||||
test_cpp: $(srcdir)/tests/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
|
||||
base_lib $(UTILS)
|
||||
rm -f test_cpp
|
||||
./if_mach HP_PA HPUX $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a -ldld `./threadlibs`
|
||||
./if_not_there test_cpp $(CXX) $(CXXFLAGS) -o test_cpp $(srcdir)/tests/test_cpp.cc gc_cpp.o gc.a `./threadlibs`
|
||||
|
||||
c++-t: c++
|
||||
./test_cpp 1
|
||||
|
||||
c++-nt: c++
|
||||
@echo "Use ./test_cpp 1 to test the leak library"
|
||||
|
||||
c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp
|
||||
rm -f dont_ar_4
|
||||
./if_mach SPARC SUNOS5 touch dont_ar_4
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
|
||||
./if_mach M68K AMIGA touch dont_ar_4
|
||||
./if_mach M68K AMIGA $(AR) -vrus gc.a gc_cpp.o
|
||||
./if_not_there dont_ar_4 $(AR) ru gc.a gc_cpp.o
|
||||
./if_not_there dont_ar_4 $(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
|
||||
sunos5gc.so: $(OBJS) dyn_load_sunos53.o
|
||||
$(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
|
||||
ln sunos5gc.so libgc.so
|
||||
|
||||
# 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
|
||||
|
||||
# Linux shared library version of the collector
|
||||
liblinuxgc.so: $(OBJS) dyn_load.o
|
||||
gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o
|
||||
ln liblinuxgc.so libgc.so
|
||||
|
||||
# Alternative Linux rule. This is preferable, but is likely to break the
|
||||
# Makefile for some non-linux platforms.
|
||||
# LIBOBJS= $(patsubst %.o, %.lo, $(OBJS))
|
||||
#
|
||||
#.SUFFIXES: .lo $(SUFFIXES)
|
||||
#
|
||||
#.c.lo:
|
||||
# $(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c $< -o $@
|
||||
#
|
||||
# liblinuxgc.so: $(LIBOBJS) dyn_load.lo
|
||||
# gcc -shared -Wl,-soname=libgc.so.0 -o libgc.so.0 $(LIBOBJS) dyn_load.lo
|
||||
# touch liblinuxgc.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 $(srcdir)/powerpc_darwin_mach_dep.s \
|
||||
$(srcdir)/sparc_mach_dep.S $(srcdir)/sparc_sunos4_mach_dep.s \
|
||||
$(srcdir)/ia64_save_regs_in_stack.s \
|
||||
$(srcdir)/sparc_netbsd_mach_dep.s $(UTILS)
|
||||
rm -f mach_dep.o
|
||||
./if_mach MIPS IRIX5 $(CC) -c -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 POWERPC DARWIN $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_mach_dep.s
|
||||
./if_mach ALPHA LINUX $(CC) -c -o mach_dep.o $(srcdir)/alpha_mach_dep.S
|
||||
./if_mach SPARC SUNOS5 $(CC) -c -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_mach SPARC OPENBSD $(AS) -o mach_dep.o $(srcdir)/sparc_sunos4_mach_dep.s
|
||||
./if_mach SPARC NETBSD $(AS) -o mach_dep.o $(srcdir)/sparc_netbsd_mach_dep.s
|
||||
./if_mach IA64 "" as $(AS_ABI_FLAG) -o ia64_save_regs_in_stack.o $(srcdir)/ia64_save_regs_in_stack.s
|
||||
./if_mach IA64 "" $(CC) -c -o mach_dep1.o $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
|
||||
./if_mach IA64 "" ld -r -o mach_dep.o mach_dep1.o ia64_save_regs_in_stack.o
|
||||
./if_not_there mach_dep.o $(CC) -c $(SPECIALCFLAGS) $(srcdir)/mach_dep.c
|
||||
|
||||
mark_rts.o: $(srcdir)/mark_rts.c $(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:
|
||||
mkdir cord
|
||||
|
||||
cord/cordbscs.o: cord $(srcdir)/cord/cordbscs.c $(CORD_INCLUDE_FILES)
|
||||
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordbscs.c
|
||||
mv cordbscs.o cord/cordbscs.o
|
||||
# not all compilers understand -o filename
|
||||
|
||||
cord/cordxtra.o: cord $(srcdir)/cord/cordxtra.c $(CORD_INCLUDE_FILES)
|
||||
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordxtra.c
|
||||
mv cordxtra.o cord/cordxtra.o
|
||||
|
||||
cord/cordprnt.o: cord $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
|
||||
$(CC) $(CFLAGS) -c -I$(srcdir) $(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 HPUX $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld `./threadlibs`
|
||||
./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a `./threadlibs`
|
||||
./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 `./threadlibs`
|
||||
./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES) -ldld `./threadlibs`
|
||||
./if_mach RS6000 "" $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses
|
||||
./if_mach POWERPC DARWIN $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a
|
||||
./if_mach I386 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
|
||||
./if_mach ALPHA LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
|
||||
./if_mach IA64 LINUX $(CC) $(CFLAGS) -o cord/de $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a -lcurses `./threadlibs`
|
||||
./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -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)/include/private/gcconfig.h
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o if_mach $(srcdir)/if_mach.c
|
||||
|
||||
threadlibs: $(srcdir)/threadlibs.c $(srcdir)/include/private/gcconfig.h Makefile
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o threadlibs $(srcdir)/threadlibs.c
|
||||
|
||||
if_not_there: $(srcdir)/if_not_there.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) -o if_not_there $(srcdir)/if_not_there.c
|
||||
|
||||
clean:
|
||||
rm -f gc.a *.o *.exe tests/*.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: tests/test.o gc.a $(UTILS)
|
||||
rm -f gctest
|
||||
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
|
||||
./if_mach HP_PA HPUX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld `./threadlibs`
|
||||
./if_mach M68K AMIGA $(CC) $(CFLAGS) -UGC_AMIGA_MAKINGLIB -o gctest tests/test.o gc.a `./threadlibs`
|
||||
./if_not_there gctest $(CC) $(CFLAGS) -o gctest tests/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)/include/gc.h $(UTILS)
|
||||
$(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: $(srcdir)/add_gc_prefix.c $(srcdir)/version.h
|
||||
$(CC) -o add_gc_prefix $(srcdir)/add_gc_prefix.c
|
||||
|
||||
gcname: $(srcdir)/gcname.c $(srcdir)/version.h
|
||||
$(CC) -o gcname $(srcdir)/gcname.c
|
||||
|
||||
gc.tar: $(SRCS) $(DOC_FILES) $(OTHER_FILES) add_gc_prefix gcname
|
||||
cp Makefile Makefile.old
|
||||
cp Makefile.direct Makefile
|
||||
rm -f `./gcname`
|
||||
ln -s . `./gcname`
|
||||
./add_gc_prefix $(SRCS) $(DOC_FILES) $(OTHER_FILES) > /tmp/gc.tar-files
|
||||
tar cvfh gc.tar `cat /tmp/gc.tar-files`
|
||||
cp gc.tar `./gcname`.tar
|
||||
gzip `./gcname`.tar
|
||||
rm `./gcname`
|
||||
|
||||
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) tests/test.c
|
||||
lint -DLINT $(CSRCS) tests/test.c | egrep -v "possible pointer alignment problem|abort|exit|sbrk|mprotect|syscall|change in ANSI|improper alignment"
|
||||
|
||||
# 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: tests/test.o libgc.so
|
||||
$(CC) -L$(ABSDIR) -R$(ABSDIR) -o gctest_dyn_link tests/test.o -lgc -ldl -lthread
|
||||
|
||||
gctest_irix_dyn_link: tests/test.o libirixgc.so
|
||||
$(CC) -L$(ABSDIR) -o gctest_irix_dyn_link tests/test.o -lirixgc
|
||||
|
||||
# The following appear to be dead, especially since libgc_globals.h
|
||||
# is apparently lost.
|
||||
test_dll.o: tests/test.c libgc_globals.h
|
||||
$(CC) $(CFLAGS) -DGC_USE_DLL -c tests/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) tests/test.c tests/test_cpp.cc; do \
|
||||
sed s/GC_/_GC_/g < $$file > tmp; \
|
||||
cp tmp $$file; \
|
||||
done
|
||||
|
||||
user_namespace: $(SRCS)
|
||||
for file in $(SRCS) tests/test.c tests/test_cpp.cc; do \
|
||||
sed s/_GC_/GC_/g < $$file > tmp; \
|
||||
cp tmp $$file; \
|
||||
done
|
||||
@@ -1,430 +0,0 @@
|
||||
# This Makefile is intended only for DJGPP use.
|
||||
# It is mainly a copy of the main Makefile, but tends to get out of sync
|
||||
# with it. A merge would probably be appropriate.
|
||||
|
||||
# Primary targets:
|
||||
# gc.a - builds basic library
|
||||
# libgc.a - builds library for use with g++ "-fgc-keyword" extension
|
||||
# -fgc-keyword was never really available. Historical
|
||||
# interest only.
|
||||
# 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.
|
||||
ABI_FLAG=
|
||||
CC=gcc $(ABI_FLAG)
|
||||
CXX=gxx $(ABI_FLAG)
|
||||
AS=gcc -c -x assembler-with-cpp $(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 (-o32, -n32, or -64)
|
||||
# if you use something other than the default ABI on your machine.
|
||||
|
||||
# special defines for DJGPP
|
||||
CXXLD=gxx $(ABI_FLAG)
|
||||
EXE_SUFFIX=.exe
|
||||
|
||||
srcdir= .
|
||||
VPATH= $(srcdir)
|
||||
|
||||
CFLAGS= -gstabs+ -O2 -I$(srcdir)/include -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.
|
||||
# -DFIND_LEAK causes GC_find_leak to be initially set.
|
||||
# This 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.
|
||||
# -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.
|
||||
# This is on by default. Turning it off has not been extensively tested with
|
||||
# compilers that reorder stores. It should have been.
|
||||
# -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.
|
||||
# -DGC_NO_OPERATOR_NEW_ARRAY declares that the C++ compiler does not support
|
||||
# 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. Must also be defined
|
||||
# by clients that use gc_cpp.h.
|
||||
# -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. Since 5.0, determines only only the initial value
|
||||
# of GC_java_finalization variable.
|
||||
# -DFINALIZE_ON_DEMAND causes finalizers to be run only in response
|
||||
# to explicit GC_invoke_finalizers() calls.
|
||||
# In 5.0 this became runtime adjustable, and this only determines the
|
||||
# initial value of GC_finalize_on_demand.
|
||||
# -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.
|
||||
# -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.
|
||||
# -DKEEP_BACK_PTRS Add code to save back pointers in debugging headers
|
||||
# for objects allocated with the debugging allocator. If all objects
|
||||
# through GC_MALLOC with GC_DEBUG defined, this allows the client
|
||||
# to determine how particular or randomly chosen objects are reachable
|
||||
# for debugging/profiling purposes. The gc_backptr.h interface is
|
||||
# implemented only if this is defined.
|
||||
# -DGC_ASSERTIONS Enable some internal GC assertion checking. Currently
|
||||
# this facility is only used in a few places. It is intended primarily
|
||||
# for debugging of the garbage collector itself, but could also
|
||||
# -DDBG_HDRS_ALL Make sure that all objects have debug headers. Increases
|
||||
# the reliability (from 99.9999% to 100%) of some of the debugging
|
||||
# code (especially KEEP_BACK_PTRS). Makes -DSHORT_DBG_HDRS possible.
|
||||
# Assumes that all client allocation is done through debugging
|
||||
# allocators.
|
||||
# -DSHORT_DBG_HDRS Assume that all objects have debug headers. Shorten
|
||||
# the headers to minimize object size, at the expense of checking for
|
||||
# writes past the end of an object. This is intended for environments
|
||||
# in which most client code is written in a "safe" language, such as
|
||||
# Scheme or Java. Assumes that all client allocation is done using
|
||||
# the GC_debug_ functions (or through the macros that expand to these.
|
||||
# (Also eliminates the field for the requested object size.)
|
||||
# occasionally be useful for debugging of client code. Slows down the
|
||||
# collector somewhat, but not drastically.
|
||||
# -DCHECKSUMS reports on erroneously clear dirty bits, and unexpectedly
|
||||
# altered stubborn objects, at substantial performance cost.
|
||||
# Use only for debugging of the incremental collector.
|
||||
# -DGC_GCJ_SUPPORT includes support for gcj (and possibly other systems
|
||||
# that include a pointer to a type descriptor in each allocated object).
|
||||
# Building this way requires an ANSI C compiler.
|
||||
# -DUSE_I686_PREFETCH causes the collector to issue Pentium III style
|
||||
# prefetch instructions. No effect except on X86 Linux platforms.
|
||||
# Assumes a very recent gcc-compatible compiler and assembler.
|
||||
# (Gas prefetcht0 support was added around May 1999.)
|
||||
# Empirically the code appears to still run correctly on Pentium II
|
||||
# processors, though with no performance benefit. May not run on other
|
||||
# X86 processors? In some cases this improves performance by
|
||||
# 15% or so.
|
||||
# -DUSE_3DNOW_PREFETCH causes the collector to issue AMD 3DNow style
|
||||
# prefetch instructions. Same restrictions as USE_I686_PREFETCH.
|
||||
# UNTESTED!!
|
||||
# -DGC_USE_LD_WRAP in combination with the gld flags listed in README.linux
|
||||
# causes the collector some system and pthread calls in a more transparent
|
||||
# fashion than the usual macro-based approach. Requires GNU ld, and
|
||||
# currently probably works only with Linux.
|
||||
|
||||
|
||||
CXXFLAGS= $(CFLAGS) -DGC_OPERATOR_NEW_ARRAY
|
||||
AR= ar
|
||||
RANLIB= ranlib
|
||||
|
||||
|
||||
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 typd_mlc.o ptr_chck.o mallocx.o solaris_pthreads.o gcj_mlc.o specific.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 typd_mlc.c ptr_chck.c mallocx.c solaris_pthreads.c gcj_mlc.c specific.c
|
||||
|
||||
CORD_SRCS= cord/cordbscs.c cord/cordxtra.c cord/cordprnt.c cord/de.c cord/cordtest.c include/cord.h include/ec.h include/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 include/gc.h include/gc_typed.h \
|
||||
include/private/gc_hdrs.h include/private/gc_priv.h \
|
||||
include/private/gcconfig.h include/private/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 include/gc_cpp.h \
|
||||
include/weakpointer.h include/private/gc_locks.h \
|
||||
gcc_support.c mips_ultrix_mach_dep.s include/gc_alloc.h \
|
||||
include/new_gc_alloc.h include/javaxfc.h sparc_sunos4_mach_dep.s \
|
||||
include/private/solaris_threads.h include/gc_backptr.h \
|
||||
hpux_test_and_clear.s include/gc_gcj.h \
|
||||
include/gc_local_alloc.h include/private/dbg_mlc.h \
|
||||
include/private/specific.h powerpc_darwin_mach_dep.s \
|
||||
include/leak_detector.h $(CORD_SRCS)
|
||||
|
||||
OTHER_FILES= Makefile PCR-Makefile OS2_MAKEFILE NT_MAKEFILE BCC_MAKEFILE \
|
||||
README tests/test.c test_cpp.cc setjmp_t.c SMakefile.amiga \
|
||||
SCoptions.amiga README.amiga README.win32 cord/README \
|
||||
README.rs6000 README.QUICK callprocs pc_excludes \
|
||||
barrett_diagram README.OS2 README.Mac MacProjects.sit.hqx \
|
||||
MacOS.c EMX_MAKEFILE README.debugging \
|
||||
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 README.MacOSX version.h Makefile.DLLs \
|
||||
WCC_MAKEFILE nursery.c include/gc_nursery.h include/gc_copy_descr.h
|
||||
|
||||
CORD_INCLUDE_FILES= $(srcdir)/include/gc.h $(srcdir)/include/cord.h \
|
||||
$(srcdir)/include/ec.h $(srcdir)/include/private/cord_pos.h
|
||||
|
||||
UTILS= if_mach$(EXE_SUFFIX) if_not_there$(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 = -I$(srcdir)/include
|
||||
# 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)
|
||||
|
||||
$(OBJS) test.o dyn_load.o dyn_load_sunos53.o: \
|
||||
$(srcdir)/include/private/gc_priv.h \
|
||||
$(srcdir)/include/private/gc_hdrs.h $(srcdir)/include/private/gc_locks.h \
|
||||
$(srcdir)/include/gc.h \
|
||||
$(srcdir)/include/private/gcconfig.h $(srcdir)/include/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)/include/gc_mark.h
|
||||
|
||||
base_lib gc.a: $(OBJS) dyn_load.o $(UTILS)
|
||||
echo > base_lib
|
||||
rm -f on_sparc_sunos5_1
|
||||
./if_mach SPARC SUNOS5 touch on_sparc_sunos5_1
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(OBJS) dyn_load.o
|
||||
./if_not_there on_sparc_sunos5_1 $(AR) ru gc.a $(OBJS) dyn_load.o
|
||||
-./if_not_there on_sparc_sunos5_1 $(RANLIB) gc.a
|
||||
# ignore ranlib failure; that usually means it doesn't exist, and isn't needed
|
||||
|
||||
cords: $(CORD_OBJS) cord/cordtest$(EXE_SUFFIX) $(UTILS)
|
||||
rm -f on_sparc_sunos5_3
|
||||
./if_mach SPARC SUNOS5 touch on_sparc_sunos5_3
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a $(CORD_OBJS)
|
||||
./if_not_there on_sparc_sunos5_3 $(AR) ru gc.a $(CORD_OBJS)
|
||||
-./if_not_there on_sparc_sunos5_3 $(RANLIB) gc.a
|
||||
|
||||
gc_cpp.o: $(srcdir)/gc_cpp.cc $(srcdir)/include/gc_cpp.h $(srcdir)/include/gc.h Makefile
|
||||
$(CXX) -c $(CXXFLAGS) $(srcdir)/gc_cpp.cc
|
||||
|
||||
test_cpp$(EXE_SUFFIX): $(srcdir)/test_cpp.cc $(srcdir)/include/gc_cpp.h gc_cpp.o $(srcdir)/include/gc.h \
|
||||
base_lib $(UTILS)
|
||||
rm -f 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$(EXE_SUFFIX) $(srcdir)/test_cpp.cc gc_cpp.o gc.a
|
||||
rm -f test_cpp
|
||||
|
||||
c++: gc_cpp.o $(srcdir)/include/gc_cpp.h test_cpp$(EXE_SUFFIX)
|
||||
rm -f on_sparc_sunos5_4
|
||||
./if_mach SPARC SUNOS5 touch on_sparc_sunos5_4
|
||||
./if_mach SPARC SUNOS5 $(AR) rus gc.a gc_cpp.o
|
||||
./if_not_there on_sparc_sunos5_4 $(AR) ru gc.a gc_cpp.o
|
||||
-./if_not_there on_sparc_sunos5_4 $(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 $@
|
||||
|
||||
# SunOS5 shared library version of the collector
|
||||
sunos5gc.so: $(OBJS) dyn_load_sunos53.o
|
||||
$(CC) -G -o sunos5gc.so $(OBJS) dyn_load_sunos53.o -ldl
|
||||
ln sunos5gc.so libgc.so
|
||||
|
||||
# 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
|
||||
|
||||
# Linux shared library version of the collector
|
||||
liblinuxgc.so: $(OBJS) dyn_load.o
|
||||
gcc -shared -o liblinuxgc.so $(OBJS) dyn_load.o -lo
|
||||
ln liblinuxgc.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 $(srcdir)/powerpc_darwin_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 POWERPC MACOSX $(AS) -o mach_dep.o $(srcdir)/powerpc_darwin_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 -I$(srcdir) $(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 -I$(srcdir) $(srcdir)/cord/cordxtra.c
|
||||
mv cordxtra.o cord/cordxtra.o
|
||||
|
||||
cord/cordprnt.o: $(srcdir)/cord/cordprnt.c $(CORD_INCLUDE_FILES)
|
||||
$(CC) $(CFLAGS) -c -I$(srcdir) $(srcdir)/cord/cordprnt.c
|
||||
mv cordprnt.o cord/cordprnt.o
|
||||
|
||||
cord/cordtest$(EXE_SUFFIX): $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a $(UTILS) /tmp
|
||||
rm -f cord/cordtest$(EXE_SUFFIX)
|
||||
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -lucb
|
||||
./if_mach HP_PA "" $(CC) $(CFLAGS) -o cord/cordtest$(EXE_SUFFIX) $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a -ldld
|
||||
./if_not_there cord/cordtest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/cordtest $(srcdir)/cord/cordtest.c $(CORD_OBJS) gc.a
|
||||
rm -f cord/cordtest cordtest
|
||||
-mv cordtest$(EXE_SUFFIX) cord/
|
||||
|
||||
/tmp: $(UTILS)
|
||||
./if_not_there /tmp mkdir /tmp
|
||||
|
||||
cord/de$(EXE_SUFFIX): $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(UTILS)
|
||||
rm -f cord/de 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 `./threadlibs`
|
||||
./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 `./threadlibs`
|
||||
./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$(EXE_SUFFIX) $(CC) $(CFLAGS) -o cord/de$(EXE_SUFFIX) $(srcdir)/cord/de.c cord/cordbscs.o cord/cordxtra.o gc.a $(CURSES)
|
||||
|
||||
if_mach$(EXE_SUFFIX): $(srcdir)/if_mach.c $(srcdir)/include/private/gcconfig.h
|
||||
rm -f if_mach if_mach$(EXE_SUFFIX)
|
||||
$(CC) $(CFLAGS) -o if_mach $(srcdir)/if_mach.c
|
||||
|
||||
threadlibs$(EXE_SUFFIX): $(srcdir)/threadlibs.c $(srcdir)include/private/gcconfig.h Makefile
|
||||
rm -f threadlibs threadlibs$(EXE_SUFFIX)
|
||||
$(CC) $(CFLAGS) -o threadlibs $(srcdir)/threadlibs.c
|
||||
|
||||
if_not_there$(EXE_SUFFIX): $(srcdir)/if_not_there.c
|
||||
rm -f if_not_there if_not_there$(EXE_SUFFIX)
|
||||
$(CC) $(CFLAGS) -o if_not_there $(srcdir)/if_not_there.c
|
||||
|
||||
# Clean removes *.o several times,
|
||||
# because as the first one doesn't seem to get them all!
|
||||
clean:
|
||||
rm -f gc.a *.o
|
||||
rm -f *.o
|
||||
rm -f *.o
|
||||
rm -f cord/*.o
|
||||
rm -f gctest gctest_dyn_link test_cpp
|
||||
rm -f setjmp_test mon.out gmon.out a.out core if_not_there if_mach
|
||||
rm -f threadlibs $(CORD_OBJS) cordtest cord/cordtest de cord/de
|
||||
rm -f gctest$(EXE_SUFFIX) gctest_dyn_link$(EXE_SUFFIX) test_cpp$(EXE_SUFFIX)
|
||||
rm -f setjmp_test$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX) if_mach$(EXE_SUFFIX)
|
||||
rm -f threadlibs$(EXE_SUFFIX) cord/cordtest$(EXE_SUFFIX)
|
||||
-rm -f *~
|
||||
|
||||
gctest$(EXE_SUFFIX): tests/test.o gc.a if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
|
||||
rm -f gctest gctest$(EXE_SUFFIX)
|
||||
./if_mach SPARC DRSNX $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -lucb
|
||||
./if_mach HP_PA "" $(CC) $(CFLAGS) -o gctest tests/test.o gc.a -ldld
|
||||
./if_not_there gctest$(EXE_SUFFIX) $(CC) $(CFLAGS) -o gctest$(EXE_SUFFIX) tests/test.o gc.a
|
||||
rm -f 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)/include/gc.h \
|
||||
if_mach$(EXE_SUFFIX) if_not_there$(EXE_SUFFIX)
|
||||
rm -f setjmp_test$(EXE_SUFFIX)
|
||||
$(CC) $(CFLAGS) -o setjmp_test $(srcdir)/setjmp_t.c
|
||||
rm -f 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)
|
||||
|
||||
add_gc_prefix$(EXE_SUFFIX): add_gc_prefix.c
|
||||
$(CC) -o add_gc_prefix$(EXE_SUFFIX) $(srcdir)/add_gc_prefix.c
|
||||
rm -f add_gc_prefix
|
||||
|
||||
gc.tar: $(SRCS) $(OTHER_FILES) add_gc_prefix
|
||||
./add_gc_prefix$(EXE_SUFFIX) $(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)
|
||||
|
||||
gc.tar.Z: gc.tar
|
||||
compress gc.tar
|
||||
|
||||
gc.tar.gz: gc.tar
|
||||
gzip gc.tar
|
||||
|
||||
lint: $(CSRCS) tests/test.c
|
||||
lint -DLINT $(CSRCS) tests/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
|
||||
|
||||
test_dll.o: tests/test.c libgc_globals.h
|
||||
$(CC) $(CFLAGS) -DGC_USE_DLL -c tests/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
|
||||
|
||||
@@ -1,60 +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.
|
||||
|
||||
MY_CPU=X86
|
||||
CPU=$(MY_CPU)
|
||||
!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) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_BUILD $*.c /Fo$*.obj
|
||||
|
||||
.cpp.obj:
|
||||
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL -DGC_BUILD $*.CPP /Fo$*.obj
|
||||
|
||||
$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h
|
||||
|
||||
gc.lib: $(OBJS)
|
||||
lib /MACHINE:i386 /out:gc.lib $(OBJS)
|
||||
# The original NT SDK used lib32 instead of lib
|
||||
|
||||
gctest.exe: tests\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 tests\test.obj $(guilibs) gc.lib
|
||||
# mapsympe -n -o gctest.sym gctest.exe
|
||||
|
||||
cord\de_win.rbj: cord\de_win.res
|
||||
cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res
|
||||
|
||||
cord\de.obj cord\de_win.obj: include\cord.h include\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: include\gc_cpp.h include\gc.h
|
||||
|
||||
gc_cpp.cpp: gc_cpp.cc
|
||||
copy gc_cpp.cc gc_cpp.cpp
|
||||
|
||||
test_cpp.cpp: tests\test_cpp.cc
|
||||
copy tests\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 include\gc_cpp.h include\gc.h gc.lib
|
||||
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs)
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
# Makefile for Windows NT. Assumes Microsoft compiler.
|
||||
# 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.
|
||||
|
||||
MY_CPU=X86
|
||||
CPU=$(MY_CPU)
|
||||
!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 win32_threads.obj
|
||||
|
||||
all: gctest.exe cord\de.exe test_cpp.exe
|
||||
|
||||
.c.obj:
|
||||
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -D__STDC__ -DGC_NOT_DLL -DGC_WIN32_THREADS $*.c /Fo$*.obj
|
||||
|
||||
.cpp.obj:
|
||||
$(cc) $(cdebug) $(cflags) $(cvars) -Iinclude -DSILENT -DALL_INTERIOR_POINTERS -DGC_NOT_DLL $*.CPP -DGC_WIN32_THREADS /Fo$*.obj
|
||||
|
||||
$(OBJS) tests\test.obj: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.h include\private\gc_locks.h include\private\gc_pmark.h include\gc_mark.h
|
||||
|
||||
gc.lib: $(OBJS)
|
||||
lib /MACHINE:i386 /out:gc.lib $(OBJS)
|
||||
# The original NT SDK used lib32 instead of lib
|
||||
|
||||
gctest.exe: tests\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 tests\test.obj $(guilibs) gc.lib
|
||||
# mapsympe -n -o gctest.sym gctest.exe
|
||||
|
||||
cord\de_win.rbj: cord\de_win.res
|
||||
cvtres /MACHINE:$(MY_CPU) /OUT:cord\de_win.rbj cord\de_win.res
|
||||
|
||||
cord\de.obj cord\de_win.obj: include\cord.h include\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: include\gc_cpp.h include\gc.h
|
||||
|
||||
gc_cpp.cpp: gc_cpp.cc
|
||||
copy gc_cpp.cc gc_cpp.cpp
|
||||
|
||||
test_cpp.cpp: tests\test_cpp.cc
|
||||
copy tests\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 include\gc_cpp.h include\gc.h gc.lib
|
||||
$(link) -debug:full -debugtype:cv $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc.lib $(guilibs)
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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: include\private\gc_priv.h include\private\gc_hdrs.h include\gc.h include\private\gcconfig.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 include\cord.h include\private\cord_pos.h
|
||||
$(CC) $(CFLAGS) /C /Focord\cordbscs cord\cordbscs.c
|
||||
|
||||
cord\cordxtra.obj: cord\cordxtra.c include\cord.h include\private\cord_pos.h include\ec.h
|
||||
$(CC) $(CFLAGS) /C /Focord\cordxtra cord\cordxtra.c
|
||||
|
||||
cord\cordprnt.obj: cord\cordprnt.c include\cord.h include\private\cord_pos.h include\ec.h
|
||||
$(CC) $(CFLAGS) /C /Focord\cordprnt cord\cordprnt.c
|
||||
|
||||
cord\cordtest.exe: cord\cordtest.c include\cord.h include\private\cord_pos.h include\ec.h $(CORDOBJS) gc.lib
|
||||
$(CC) $(CFLAGS) /B"/STACK:65536" /Fecord\cordtest cord\cordtest.c gc.lib $(CORDOBJS)
|
||||
@@ -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 gcconfig.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
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
This is a modified version of Boehm GC 6.1 for Mono.
|
||||
|
||||
* There are two main changes to the upstream version:
|
||||
|
||||
- Makefile changes:
|
||||
|
||||
libgc has a lot of configurable options which are AC_DEFINE()d in its
|
||||
configure.ac. To make it easier to build and bundle it with Mono, I
|
||||
replaced most of the orignal configure.ac and the makefiles with custom
|
||||
versions which just define what we actually need for Mono.
|
||||
|
||||
This means that you can just run configure in this directory and it'll
|
||||
do the right thing. Later on, we'll just include this package in Mono
|
||||
and use AC_CONFIG_SUBDIRS().
|
||||
|
||||
- Threading changes
|
||||
|
||||
The original libgc has several *_threads.c files for each possible threading
|
||||
implementation.
|
||||
|
||||
For Mono, we're using a vtable
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (* initialize) (void);
|
||||
void (* lock) (void);
|
||||
void (* unlock) (void);
|
||||
void (* stop_world) (void);
|
||||
void (* push_thread_structures) (void);
|
||||
void (* push_all_stacks) (void);
|
||||
void (* start_world) (void);
|
||||
} GCThreadFunctions;
|
||||
|
||||
extern GCThreadFunctions *gc_thread_vtable;
|
||||
|
||||
and a mono_threads.c file.
|
||||
|
||||
- Deleted files
|
||||
|
||||
Some files from the original distribution have been deleted in this version.
|
||||
These are files which weren't actually linked into the library so they were not
|
||||
needed. When importing a new upstream version, you can either keep them removed
|
||||
or just replace them with their new upstream versions.
|
||||
|
||||
- include/private/gc_locks.h
|
||||
|
||||
This file has been replaced with a custom version.
|
||||
|
||||
When importing a new upstream version, keep this custom version, ie. don't import the
|
||||
new upstream gc_locks.h.
|
||||
|
||||
* Importing a new upstream version
|
||||
|
||||
This is really simple. Just import the new version to the vendor branch (LIBGC) in CVS
|
||||
and then merge it into the main trunk.
|
||||
|
||||
To get a diff to the original version:
|
||||
|
||||
cvs diff -u -r LIBGC
|
||||
|
||||
When importing new upstream versions, don't import the new configure.ac or any of the
|
||||
Makefile.am's; they've been replaced by custom versions. Just import all the new source
|
||||
files and it should be fine.
|
||||
|
||||
|
||||
April 4th, 2003
|
||||
Martin Baulig <[email protected]>
|
||||
@@ -1,85 +0,0 @@
|
||||
Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
|
||||
Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
|
||||
Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
|
||||
Copyright (c) 1999-2001 by Hewlett-Packard. 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.
|
||||
|
||||
A few files have other copyright holders. A few of the files needed
|
||||
to use the GNU-style build procedure come with a modified GPL license
|
||||
that appears not to significantly restrict use of the collector, though
|
||||
use of those files for a purpose other than building the collector may
|
||||
require the resulting code to be covered by the GPL.
|
||||
|
||||
For more details and the names of other contributors, see the
|
||||
doc/README* files and include/gc.h. This file describes typical use of
|
||||
the collector on a machine that is already supported.
|
||||
|
||||
For the version number, see doc/README or version.h.
|
||||
|
||||
INSTALLATION:
|
||||
Under UN*X, Linux:
|
||||
Alternative 1 (the old way): type "make test" in this directory.
|
||||
Link against gc.a.
|
||||
|
||||
Alternative 2 (the new way): type
|
||||
"./configure --prefix=<dir>; make; make check; make install".
|
||||
Link against <dir>/lib/libgc.a or <dir>/lib/libgc.so.
|
||||
See README.autoconf for details
|
||||
|
||||
Under OS/2 or Windows 95, 98, Me, NT, or 2000:
|
||||
copy the appropriate makefile to MAKEFILE, read it, and type "nmake test".
|
||||
(Under Windows, this assumes you have Microsoft command-line tools
|
||||
installed, and have DOS configured with enough environment space to run them.)
|
||||
Read the machine specific README in the doc directory if one exists.
|
||||
The only way to develop code with the collector for Windows 3.1 is
|
||||
to develop under Windows NT or 95+, and then to use win32S.
|
||||
|
||||
If you need thread support, you will need to either follow the special
|
||||
platform-dependent instructions (win32), or add a suitable define
|
||||
option as described in Makefile.
|
||||
|
||||
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. The CORD_printf implementation in
|
||||
cordprnt.c is known to be less than perfectly portable. The rest
|
||||
of the package should still work.)
|
||||
|
||||
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 include/gc_cpp.h.
|
||||
|
||||
TYPICAL USE:
|
||||
Include "gc.h" from the include subdirectory. 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.
|
||||
|
||||
More documentation on the collector interface can be found at
|
||||
http://www.hpl.hp.com/personal/Hans_Boehm/gc/gcinterface.html,
|
||||
in doc/README, and in include/gc.h .
|
||||
|
||||
WARNINGS:
|
||||
|
||||
Do not store the only pointer to an object in memory allocated
|
||||
with system malloc, since the collector usually does not scan
|
||||
memory allocated in this way.
|
||||
|
||||
Use with threads may be supported on your system, but requires the
|
||||
collector to be built with thread support. See Makefile. The collector
|
||||
does not guarantee to scan thread-local storage (e.g. of the kind
|
||||
accessed with pthread_getspecific()). The collector does scan
|
||||
thread stacks though, so generally the best solution is to ensure that
|
||||
any pointers stored in thread-local storage are also stored on the
|
||||
thread's stack for the duration of their lifetime.
|
||||
|
||||
@@ -1,178 +0,0 @@
|
||||
|
||||
# Rewritten smakefile for amiga / sas/c. -Kjetil M.
|
||||
# Dont use the cord-package if you define parm=both or parm=reg.
|
||||
|
||||
|
||||
#----------------TOOLS--------------------------------
|
||||
CC=sc
|
||||
LINKER=slink
|
||||
LIBER=oml
|
||||
|
||||
#----------------CPU OPTIONS--------------------------
|
||||
|
||||
CPU=68060
|
||||
|
||||
#----------------FPU OPTIONS--------------------------
|
||||
|
||||
MATH=8
|
||||
MATHLIB=LIB:scm881.lib
|
||||
|
||||
#----------------COMPILER OPTIONS---------------------
|
||||
|
||||
IGNORE= IGNORE=85 IGNORE=154 IGNORE=161 IGNORE=100
|
||||
|
||||
OPTIMIZE=optimize optimizetime optglobal optimizerdepth=100 optimizerpeephole optloop OPTSCHED optimizerinlocal optimizerrecurdepth=100
|
||||
# optimizerinline optimizercomplexity=100
|
||||
|
||||
OPT= $(OPTIMIZE) CPU=$(CPU) math=$(MATH) NOSTACKCHECK VERBOSE \
|
||||
MAPHUNK NOVERSION NOICONS nodebug \
|
||||
DEFINE SILENT \
|
||||
parm=reg \
|
||||
DEFINE __USE_SYSBASE
|
||||
|
||||
|
||||
SOPT= $(OPT) $(IGNORE) \
|
||||
DEFINE AMIGA_SKIP_SEG \
|
||||
DEFINE ATOMIC_UNCOLLECTABLE \
|
||||
DEFINE GC_AMIGA_FASTALLOC \
|
||||
DEFINE GC_AMIGA_RETRY \
|
||||
DEFINE GC_AMIGA_PRINTSTATS \
|
||||
DEFINE GC_AMIGA_GC
|
||||
|
||||
|
||||
#DEFINE ALL_INTERIOR_POINTERS \
|
||||
|
||||
|
||||
SCOPT= $(SOPT) define GC_AMIGA_MAKINGLIB
|
||||
|
||||
CSCOPT= $(OPT) DEFINE AMIGA IGNORE=100 IGNORE=161
|
||||
|
||||
#------------------LINKING----------------------------
|
||||
|
||||
|
||||
all: gctest setjmp_t cord/cordtest
|
||||
|
||||
clean:
|
||||
delete *.lib gctest setjmp_t *.o *.lnk cord/*.o cord/*.lib cord/*.lnk cord/cordtest
|
||||
smake
|
||||
|
||||
test: setjmp_t gctest cord/cordtest
|
||||
setjmp_t
|
||||
gctest
|
||||
cord/cordtest
|
||||
|
||||
gctest: gc$(CPU).lib GCAmigaOS$(CPU).lib test.o
|
||||
$(LINKER) LIB:c.o test.o TO gctest LIB gc$(CPU).lib LIB:sc.lib $(MATHLIB)
|
||||
|
||||
setjmp_t: setjmp_t.o gc.h
|
||||
$(LINKER) LIB:c.o setjmp_t.o to setjmp_t lib LIB:sc.lib
|
||||
|
||||
cord/cordtest: cord/cordtest.o cord/cord$(CPU).lib gc$(CPU).lib
|
||||
slink LIB:c.o cord/cordtest.o LIB $(MATHLIB) gc$(CPU).lib cord/cord$(CPU).lib LIB:sc.lib TO cord/cordtest
|
||||
|
||||
|
||||
#------------------LIBBING----------------------------
|
||||
|
||||
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 mallocx.o
|
||||
|
||||
gc$(CPU).lib: $(OBJS)
|
||||
$(LIBER) gc$(CPU).lib r $(OBJS)
|
||||
|
||||
|
||||
COBJS = cord/cordbscs.o cord/cordprnt.o cord/cordxtra.o
|
||||
|
||||
cord/cord$(CPU).lib: $(COBJS)
|
||||
oml cord/cord$(CPU).lib r $(COBJS)
|
||||
|
||||
#------------------COMPILING--------------------------
|
||||
|
||||
INC= gc_private.h gc_hdrs.h gc.h gcconfig.h
|
||||
|
||||
alloc.o : alloc.c $(INC)
|
||||
$(CC) alloc.c $(SCOPT) ignore=7
|
||||
|
||||
reclaim.o : reclaim.c $(INC)
|
||||
$(CC) reclaim.c $(SCOPT)
|
||||
|
||||
allchblk.o : allchblk.c $(INC)
|
||||
$(CC) allchblk.c $(SCOPT)
|
||||
|
||||
misc.o : misc.c $(INC)
|
||||
$(CC) misc.c $(SCOPT)
|
||||
|
||||
os_dep.o : os_dep.c $(INC) AmigaOS.c
|
||||
$(CC) os_dep.c $(SCOPT)
|
||||
|
||||
mark_rts.o : mark_rts.c $(INC)
|
||||
$(CC) mark_rts.c $(SCOPT)
|
||||
|
||||
headers.o : headers.c $(INC)
|
||||
$(CC) headers.c $(SCOPT)
|
||||
|
||||
mark.o : mark.c $(INC)
|
||||
$(CC) mark.c $(SCOPT)
|
||||
|
||||
obj_map.o : obj_map.c $(INC)
|
||||
$(CC) obj_map.c $(SCOPT)
|
||||
|
||||
blacklst.o : blacklst.c $(INC)
|
||||
$(CC) blacklst.c $(SCOPT)
|
||||
|
||||
finalize.o : finalize.c $(INC)
|
||||
$(CC) finalize.c $(SCOPT) noopt #Could sas/c still have problems with this one? Gctest sometimes fails to finalize all.
|
||||
|
||||
new_hblk.o : new_hblk.c $(INC)
|
||||
$(CC) new_hblk.c $(SCOPT)
|
||||
|
||||
real_malloc.o : real_malloc.c $(INC)
|
||||
$(CC) real_malloc.c $(SCOPT)
|
||||
|
||||
dyn_load.o : dyn_load.c $(INC)
|
||||
$(CC) dyn_load.c $(SCOPT)
|
||||
|
||||
dbg_mlc.o : dbg_mlc.c $(INC)
|
||||
$(CC) dbg_mlc.c $(SCOPT)
|
||||
|
||||
malloc.o : malloc.c $(INC)
|
||||
$(CC) malloc.c $(SCOPT)
|
||||
|
||||
mallocx.o : mallocx.c $(INC)
|
||||
$(CC) mallocx.c $(SCOPT)
|
||||
|
||||
stubborn.o : stubborn.c $(INC)
|
||||
$(CC) stubborn.c $(SCOPT)
|
||||
|
||||
checksums.o : checksums.c $(INC)
|
||||
$(CC) checksums.c $(SCOPT)
|
||||
|
||||
typd_mlc.o: typd_mlc.c $(INC)
|
||||
$(CC) typd_mlc.c $(SCOPT)
|
||||
|
||||
mach_dep.o : mach_dep.c $(INC)
|
||||
$(CC) mach_dep.c $(SCOPT)
|
||||
|
||||
ptr_chck.o: ptr_chck.c $(INC)
|
||||
$(CC) ptr_chck.c $(SCOPT)
|
||||
|
||||
test.o : test.c $(INC)
|
||||
$(CC) test.c $(SOPT)
|
||||
|
||||
setjmp_t: setjmp_t.c gc.h
|
||||
$(CC) setjmp_t.c $(SOPT)
|
||||
|
||||
|
||||
# cords:
|
||||
|
||||
cord/cordbscs.o: cord/cordbscs.c
|
||||
sc cord/cordbscs.c $(CSCOPT)
|
||||
|
||||
cord/cordprnt.o: cord/cordprnt.c
|
||||
sc cord/cordprnt.c $(CSCOPT)
|
||||
|
||||
cord/cordxtra.o: cord/cordxtra.c
|
||||
sc cord/cordxtra.c $(CSCOPT)
|
||||
|
||||
cord/cordtest.o: cord/cordtest.c
|
||||
sc cord/cordtest.c $(CSCOPT)
|
||||
|
||||
|
||||
@@ -1,196 +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 the lines below for cross compilation.
|
||||
SYSTEM=MSWIN32
|
||||
#SYSTEM=DOS4GW
|
||||
#SYSTEM=OS2
|
||||
|
||||
# The collector can be built either as dynamic or as static library.
|
||||
# Select the library type you need.
|
||||
#MAKE_AS_DLL=1
|
||||
MAKE_AS_LIB=1
|
||||
|
||||
# Select calling conventions.
|
||||
# Possible choices are r and s.
|
||||
CALLING=s
|
||||
|
||||
# Select target CPU.
|
||||
# Possible choices are 3, 4, 5, and 6.
|
||||
# The last choice available only since version 11.0.
|
||||
CPU=5
|
||||
|
||||
# Set optimization options.
|
||||
# Watcom before 11.0 does not support option "-oh".
|
||||
OPTIM=-oneatx -s
|
||||
#OPTIM=-ohneatx -s
|
||||
|
||||
DEFS=-DALL_INTERIOR_POINTERS -DSILENT -DNO_SIGNALS #-DSMALL_CONFIG #-DGC_DEBUG
|
||||
|
||||
|
||||
#####
|
||||
|
||||
!ifndef SYSTEM
|
||||
!ifdef __MSDOS__
|
||||
SYSTEM=DOS4GW
|
||||
!else ifdef __NT__
|
||||
SYSTEM=MSWIN32
|
||||
!else ifdef __OS2__
|
||||
SYSTEM=OS2
|
||||
!else
|
||||
SYSTEM=Unknown
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!define $(SYSTEM)
|
||||
|
||||
!ifdef DOS4GW
|
||||
SYSFLAG=-DDOS4GW -bt=dos
|
||||
!else ifdef MSWIN32
|
||||
SYSFLAG=-DMSWIN32 -bt=nt
|
||||
!else ifdef OS2
|
||||
SYSFLAG=-DOS2 -bt=os2
|
||||
!else
|
||||
!error undefined or unsupported target platform: $(SYSTEM)
|
||||
!endif
|
||||
!ifdef MAKE_AS_DLL
|
||||
DLLFLAG=-bd -DGC_DLL
|
||||
TEST_DLLFLAG=-DGC_DLL
|
||||
!else ifdef MAKE_AS_LIB
|
||||
DLLFLAG=
|
||||
TEST_DLLFLAG=
|
||||
!else
|
||||
!error Either MAKE_AS_LIB or MAKE_AS_DLL should be defined
|
||||
!endif
|
||||
|
||||
CC=wcc386
|
||||
CXX=wpp386
|
||||
|
||||
# -DUSE_GENERIC is required !
|
||||
CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(DLLFLAG) -DGC_BUILD -DUSE_GENERIC $(DEFS)
|
||||
CXXFLAGS= $(CFLAGS)
|
||||
TEST_CFLAGS=-$(CPU)$(CALLING) $(OPTIM) -zp4 -zc $(SYSFLAG) $(TEST_DLLFLAG) $(DEFS)
|
||||
TEST_CXXFLAGS= $(TEST_CFLAGS)
|
||||
|
||||
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 mallocx.obj
|
||||
|
||||
all: gc.lib gctest.exe test_cpp.exe
|
||||
|
||||
!ifdef MAKE_AS_DLL
|
||||
|
||||
gc.lib: gc.dll gc_cpp.obj
|
||||
*wlib -b -c -n -p=512 $@ +gc.dll +gc_cpp.obj
|
||||
|
||||
gc.dll: $(OBJS) .AUTODEPEND
|
||||
@%create $*.lnk
|
||||
!ifdef DOS4GW
|
||||
@%append $*.lnk sys os2v2_dll
|
||||
!else ifdef MSWIN32
|
||||
@%append $*.lnk sys nt_dll
|
||||
!else ifdef OS2
|
||||
@%append $*.lnk sys os2v2_dll
|
||||
!endif
|
||||
@%append $*.lnk name $*
|
||||
@for %i in ($(OBJS)) do @%append $*.lnk file '%i'
|
||||
!ifeq CALLING s
|
||||
@%append $*.lnk export GC_is_marked
|
||||
@%append $*.lnk export GC_incr_words_allocd
|
||||
@%append $*.lnk export GC_incr_mem_freed
|
||||
@%append $*.lnk export GC_generic_malloc_words_small
|
||||
!else
|
||||
@%append $*.lnk export GC_is_marked_
|
||||
@%append $*.lnk export GC_incr_words_allocd_
|
||||
@%append $*.lnk export GC_incr_mem_freed_
|
||||
@%append $*.lnk export GC_generic_malloc_words_small_
|
||||
!endif
|
||||
*wlink @$*.lnk
|
||||
!else
|
||||
gc.lib: $(OBJS) gc_cpp.obj
|
||||
@%create $*.lb1
|
||||
@for %i in ($(OBJS)) do @%append $*.lb1 +'%i'
|
||||
@%append $*.lb1 +'gc_cpp.obj'
|
||||
*wlib -b -c -n -p=512 $@ @$*.lb1
|
||||
|
||||
!endif
|
||||
|
||||
|
||||
gctest.exe: test.obj gc.lib
|
||||
%create $*.lnk
|
||||
!ifdef DOS4GW
|
||||
@%append $*.lnk sys dos4g
|
||||
!else ifdef MSWIN32
|
||||
@%append $*.lnk sys nt
|
||||
!else 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
|
||||
!ifdef MAKE_AS_DLL
|
||||
!ifeq CALLING s
|
||||
@%append $*.lnk import GC_is_marked gc
|
||||
!else
|
||||
@%append $*.lnk import GC_is_marked_ gc
|
||||
!endif
|
||||
!endif
|
||||
*wlink @$*.lnk
|
||||
test_cpp.exe: test_cpp.obj gc.lib
|
||||
%create $*.lnk
|
||||
!ifdef DOS4GW
|
||||
@%append $*.lnk sys dos4g
|
||||
!else ifdef MSWIN32
|
||||
@%append $*.lnk sys nt
|
||||
!else ifdef OS2
|
||||
@%append $*.lnk sys os2v2
|
||||
!endif
|
||||
@%append $*.lnk op case
|
||||
@%append $*.lnk op stack=256K
|
||||
@%append $*.lnk name $*
|
||||
@%append $*.lnk file test_cpp.obj
|
||||
@%append $*.lnk library gc.lib
|
||||
!ifdef MAKE_AS_DLL
|
||||
!ifeq CALLING s
|
||||
@%append $*.lnk import GC_incr_words_allocd gc
|
||||
@%append $*.lnk import GC_incr_mem_freed gc
|
||||
@%append $*.lnk import GC_generic_malloc_words_small gc
|
||||
!else
|
||||
@%append $*.lnk import GC_incr_words_allocd_ gc
|
||||
@%append $*.lnk import GC_incr_mem_freed_ gc
|
||||
@%append $*.lnk import GC_generic_malloc_words_small_ gc
|
||||
!endif
|
||||
!endif
|
||||
*wlink @$*.lnk
|
||||
|
||||
gc_cpp.obj: gc_cpp.cc .AUTODEPEND
|
||||
$(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
|
||||
test.obj: tests\test.c .AUTODEPEND
|
||||
$(CC) $(TEST_CFLAGS) $*.c
|
||||
test_cpp.obj: tests\test_cpp.cc .AUTODEPEND
|
||||
$(CXX) $(TEST_CXXFLAGS) -iinclude $*.cc
|
||||
|
||||
|
||||
.c.obj: .AUTODEPEND
|
||||
$(CC) $(CFLAGS) $*.c
|
||||
|
||||
.cc.obj: .AUTODEPEND
|
||||
$(CXX) $(CXXFLAGS) $*.cc
|
||||
|
||||
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
|
||||
@if exist *.lib del *.lib
|
||||
@if exist *.dll del *.dll
|
||||
@@ -1,182 +0,0 @@
|
||||
dnl dolt, a replacement for libtool
|
||||
dnl Copyright © 2007-2008 Josh Triplett <[email protected]>
|
||||
dnl Copying and distribution of this file, with or without modification,
|
||||
dnl are permitted in any medium without royalty provided the copyright
|
||||
dnl notice and this notice are preserved.
|
||||
dnl
|
||||
dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
|
||||
dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
|
||||
dnl installed when running autoconf on your project.
|
||||
|
||||
AC_DEFUN([DOLT], [
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
# dolt, a replacement for libtool
|
||||
# Josh Triplett <[email protected]>
|
||||
AC_PATH_PROG(DOLT_BASH, bash)
|
||||
AC_MSG_CHECKING([if dolt supports this host])
|
||||
dolt_supported=yes
|
||||
if test x$DOLT_BASH = x; then
|
||||
dolt_supported=no
|
||||
fi
|
||||
if test x$GCC != xyes; then
|
||||
dolt_supported=no
|
||||
fi
|
||||
case $host in
|
||||
i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
|
||||
|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
|
||||
pic_options='-fPIC'
|
||||
;;
|
||||
?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
|
||||
pic_options='-DDLL_EXPORT'
|
||||
;;
|
||||
i?86-apple-darwin*|arm-apple-darwin*)
|
||||
pic_options='-fno-common'
|
||||
;;
|
||||
*)
|
||||
dolt_supported=no
|
||||
;;
|
||||
esac
|
||||
if test x$dolt_supported = xno ; then
|
||||
AC_MSG_RESULT([no, falling back to libtool])
|
||||
LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
|
||||
LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
|
||||
else
|
||||
AC_MSG_RESULT([yes, replacing libtool])
|
||||
|
||||
dnl Start writing out doltcompile.
|
||||
cat <<__DOLTCOMPILE__EOF__ >doltcompile
|
||||
#!$DOLT_BASH
|
||||
__DOLTCOMPILE__EOF__
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
args=("$[]@")
|
||||
for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
|
||||
if test x"${args@<:@$arg@:>@}" = x-o ; then
|
||||
objarg=$((arg+1))
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test x$objarg = x ; then
|
||||
echo 'Error: no -o on compiler command line' 1>&2
|
||||
exit 1
|
||||
fi
|
||||
lo="${args@<:@$objarg@:>@}"
|
||||
obj="${lo%.lo}"
|
||||
if test x"$lo" = x"$obj" ; then
|
||||
echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
objbase="${obj##*/}"
|
||||
__DOLTCOMPILE__EOF__
|
||||
|
||||
dnl Write out shared compilation code.
|
||||
if test x$enable_shared = xyes; then
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
libobjdir="${obj%$objbase}.libs"
|
||||
if test ! -d "$libobjdir" ; then
|
||||
mkdir_out="$(mkdir "$libobjdir" 2>&1)"
|
||||
mkdir_ret=$?
|
||||
if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
|
||||
echo "$mkdir_out" 1>&2
|
||||
exit $mkdir_ret
|
||||
fi
|
||||
fi
|
||||
pic_object="$libobjdir/$objbase.o"
|
||||
args@<:@$objarg@:>@="$pic_object"
|
||||
__DOLTCOMPILE__EOF__
|
||||
cat <<__DOLTCOMPILE__EOF__ >>doltcompile
|
||||
"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
|
||||
__DOLTCOMPILE__EOF__
|
||||
fi
|
||||
|
||||
dnl Write out static compilation code.
|
||||
dnl Avoid duplicate compiler output if also building shared objects.
|
||||
if test x$enable_static = xyes; then
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
non_pic_object="$obj.o"
|
||||
args@<:@$objarg@:>@="$non_pic_object"
|
||||
__DOLTCOMPILE__EOF__
|
||||
if test x$enable_shared = xyes; then
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
|
||||
__DOLTCOMPILE__EOF__
|
||||
else
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
"${args@<:@@@:>@}" || exit $?
|
||||
__DOLTCOMPILE__EOF__
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Write out the code to write the .lo file.
|
||||
dnl The second line of the .lo file must match "^# Generated by .*libtool"
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
{
|
||||
echo "# $lo - a libtool object file"
|
||||
echo "# Generated by doltcompile, not libtool"
|
||||
__DOLTCOMPILE__EOF__
|
||||
|
||||
if test x$enable_shared = xyes; then
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
echo "pic_object='.libs/${objbase}.o'"
|
||||
__DOLTCOMPILE__EOF__
|
||||
else
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
echo pic_object=none
|
||||
__DOLTCOMPILE__EOF__
|
||||
fi
|
||||
|
||||
if test x$enable_static = xyes; then
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
echo "non_pic_object='${objbase}.o'"
|
||||
__DOLTCOMPILE__EOF__
|
||||
else
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
echo non_pic_object=none
|
||||
__DOLTCOMPILE__EOF__
|
||||
fi
|
||||
|
||||
cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
|
||||
} > "$lo"
|
||||
__DOLTCOMPILE__EOF__
|
||||
|
||||
dnl Done writing out doltcompile; substitute it for libtool compilation.
|
||||
chmod +x doltcompile
|
||||
LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
|
||||
LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
|
||||
|
||||
dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for
|
||||
dnl a target, so write out a libtool wrapper to handle that case.
|
||||
dnl Note that doltlibtool does not handle inferred tags or option arguments
|
||||
dnl without '=', because automake does not use them.
|
||||
cat <<__DOLTLIBTOOL__EOF__ > doltlibtool
|
||||
#!$DOLT_BASH
|
||||
__DOLTLIBTOOL__EOF__
|
||||
cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool
|
||||
top_builddir_slash="${0%%doltlibtool}"
|
||||
: ${top_builddir_slash:=./}
|
||||
args=()
|
||||
modeok=false
|
||||
tagok=false
|
||||
for arg in "$[]@"; do
|
||||
case "$arg" in
|
||||
--silent) ;;
|
||||
--mode=compile) modeok=true ;;
|
||||
--tag=CC|--tag=CXX) tagok=true ;;
|
||||
--quiet) ;;
|
||||
*) args@<:@${#args[@]}@:>@="$arg" ;;
|
||||
esac
|
||||
done
|
||||
if $modeok && $tagok ; then
|
||||
. ${top_builddir_slash}doltcompile "${args@<:@@@:>@}"
|
||||
else
|
||||
exec ${top_builddir_slash}libtool "$[]@"
|
||||
fi
|
||||
__DOLTLIBTOOL__EOF__
|
||||
|
||||
dnl Done writing out doltlibtool; substitute it for libtool.
|
||||
chmod +x doltlibtool
|
||||
LIBTOOL='$(top_builddir)/doltlibtool'
|
||||
fi
|
||||
AC_SUBST(LTCOMPILE)
|
||||
AC_SUBST(LTCXXCOMPILE)
|
||||
# end dolt
|
||||
])
|
||||
@@ -1,20 +0,0 @@
|
||||
# include <stdio.h>
|
||||
# include "version.h"
|
||||
|
||||
int main(argc, argv, envp)
|
||||
int argc;
|
||||
char ** argv;
|
||||
char ** envp;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (GC_ALPHA_VERSION == GC_NOT_ALPHA) {
|
||||
printf("gc%d.%d/%s ", GC_VERSION_MAJOR, GC_VERSION_MINOR, argv[i]);
|
||||
} else {
|
||||
printf("gc%d.%dalpha%d/%s ", GC_VERSION_MAJOR,
|
||||
GC_VERSION_MINOR, GC_ALPHA_VERSION, argv[i]);
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -1,688 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved.
|
||||
* Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
|
||||
* Copyright (c) 1999-2003 by Hewlett-Packard Company. 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.
|
||||
*/
|
||||
/*
|
||||
* Support code for Irix (>=6.2) Pthreads and for AIX pthreads.
|
||||
* This relies on properties
|
||||
* not guaranteed by the Pthread standard. It may or may not be portable
|
||||
* to other implementations.
|
||||
*
|
||||
* Note that there is a lot of code duplication between this file and
|
||||
* (pthread_support.c, pthread_stop_world.c). They should be merged.
|
||||
* Pthread_support.c should be directly usable.
|
||||
*
|
||||
* Please avoid adding new ports here; use the generic pthread support
|
||||
* as a base instead.
|
||||
*/
|
||||
|
||||
# if defined(GC_IRIX_THREADS) || defined(GC_AIX_THREADS)
|
||||
|
||||
# include "private/gc_priv.h"
|
||||
# include <pthread.h>
|
||||
# include <assert.h>
|
||||
# include <semaphore.h>
|
||||
# include <time.h>
|
||||
# include <errno.h>
|
||||
# include <unistd.h>
|
||||
# include <sys/mman.h>
|
||||
# include <sys/time.h>
|
||||
|
||||
#undef pthread_create
|
||||
#undef pthread_sigmask
|
||||
#undef pthread_join
|
||||
|
||||
#if defined(GC_IRIX_THREADS) && !defined(MUTEX_RECURSIVE_NP)
|
||||
#define MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
|
||||
void GC_thr_init();
|
||||
|
||||
#if 0
|
||||
void GC_print_sig_mask()
|
||||
{
|
||||
sigset_t blocked;
|
||||
int i;
|
||||
|
||||
if (pthread_sigmask(SIG_BLOCK, NULL, &blocked) != 0)
|
||||
ABORT("pthread_sigmask");
|
||||
GC_printf0("Blocked: ");
|
||||
for (i = 1; i <= MAXSIG; i++) {
|
||||
if (sigismember(&blocked, i)) { GC_printf1("%ld ",(long) i); }
|
||||
}
|
||||
GC_printf0("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We use the allocation lock to protect thread-related data structures. */
|
||||
|
||||
/* The set of all known threads. We intercept thread creation and */
|
||||
/* joins. We never actually create detached threads. We allocate all */
|
||||
/* new thread stacks ourselves. These allow us to maintain this */
|
||||
/* data structure. */
|
||||
/* Protected by GC_thr_lock. */
|
||||
/* Some of this should be declared volatile, but that's incosnsistent */
|
||||
/* with some library routine declarations. */
|
||||
typedef struct GC_Thread_Rep {
|
||||
struct GC_Thread_Rep * next; /* More recently allocated threads */
|
||||
/* with a given pthread id come */
|
||||
/* first. (All but the first are */
|
||||
/* guaranteed to be dead, but we may */
|
||||
/* not yet have registered the join.) */
|
||||
pthread_t id;
|
||||
word stop;
|
||||
# define NOT_STOPPED 0
|
||||
# define PLEASE_STOP 1
|
||||
# define STOPPED 2
|
||||
word flags;
|
||||
# define FINISHED 1 /* Thread has exited. */
|
||||
# define DETACHED 2 /* Thread is intended to be detached. */
|
||||
ptr_t stack_cold; /* cold end of the stack */
|
||||
ptr_t stack_hot; /* Valid only when stopped. */
|
||||
/* But must be within stack region at */
|
||||
/* all times. */
|
||||
void * status; /* Used only to avoid premature */
|
||||
/* reclamation of any data it might */
|
||||
/* reference. */
|
||||
} * GC_thread;
|
||||
|
||||
GC_thread GC_lookup_thread(pthread_t id);
|
||||
|
||||
/*
|
||||
* The only way to suspend threads given the pthread interface is to send
|
||||
* signals. Unfortunately, this means we have to reserve
|
||||
* a signal, and intercept client calls to change the signal mask.
|
||||
*/
|
||||
#if 0 /* DOB: 6.1 */
|
||||
# if defined(GC_AIX_THREADS)
|
||||
# define SIG_SUSPEND SIGUSR1
|
||||
# else
|
||||
# define SIG_SUSPEND (SIGRTMIN + 6)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
pthread_mutex_t GC_suspend_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||
/* Number of threads stopped so far */
|
||||
pthread_cond_t GC_suspend_ack_cv = PTHREAD_COND_INITIALIZER;
|
||||
pthread_cond_t GC_continue_cv = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
void GC_suspend_handler(int sig)
|
||||
{
|
||||
int dummy;
|
||||
GC_thread me;
|
||||
sigset_t all_sigs;
|
||||
sigset_t old_sigs;
|
||||
int i;
|
||||
|
||||
if (sig != SIG_SUSPEND) ABORT("Bad signal in suspend_handler");
|
||||
me = GC_lookup_thread(pthread_self());
|
||||
/* The lookup here is safe, since I'm doing this on behalf */
|
||||
/* of a thread which holds the allocation lock in order */
|
||||
/* to stop the world. Thus concurrent modification of the */
|
||||
/* data structure is impossible. */
|
||||
if (PLEASE_STOP != me -> stop) {
|
||||
/* Misdirected signal. */
|
||||
pthread_mutex_unlock(&GC_suspend_lock);
|
||||
return;
|
||||
}
|
||||
pthread_mutex_lock(&GC_suspend_lock);
|
||||
me -> stack_hot = (ptr_t)(&dummy);
|
||||
me -> stop = STOPPED;
|
||||
pthread_cond_signal(&GC_suspend_ack_cv);
|
||||
pthread_cond_wait(&GC_continue_cv, &GC_suspend_lock);
|
||||
pthread_mutex_unlock(&GC_suspend_lock);
|
||||
/* GC_printf1("Continuing 0x%x\n", pthread_self()); */
|
||||
}
|
||||
|
||||
|
||||
GC_bool GC_thr_initialized = FALSE;
|
||||
|
||||
|
||||
# define THREAD_TABLE_SZ 128 /* Must be power of 2 */
|
||||
volatile GC_thread GC_threads[THREAD_TABLE_SZ];
|
||||
|
||||
void GC_push_thread_structures GC_PROTO((void))
|
||||
{
|
||||
GC_push_all((ptr_t)(GC_threads), (ptr_t)(GC_threads)+sizeof(GC_threads));
|
||||
}
|
||||
|
||||
/* Add a thread to GC_threads. We assume it wasn't already there. */
|
||||
/* Caller holds allocation lock. */
|
||||
GC_thread GC_new_thread(pthread_t id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
GC_thread result;
|
||||
static struct GC_Thread_Rep first_thread;
|
||||
static GC_bool first_thread_used = FALSE;
|
||||
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
if (!first_thread_used) {
|
||||
result = &first_thread;
|
||||
first_thread_used = TRUE;
|
||||
/* Dont acquire allocation lock, since we may already hold it. */
|
||||
} else {
|
||||
result = (struct GC_Thread_Rep *)
|
||||
GC_generic_malloc_inner(sizeof(struct GC_Thread_Rep), NORMAL);
|
||||
}
|
||||
if (result == 0) return(0);
|
||||
result -> id = id;
|
||||
result -> next = GC_threads[hv];
|
||||
GC_threads[hv] = result;
|
||||
/* result -> flags = 0; */
|
||||
/* result -> stop = 0; */
|
||||
return(result);
|
||||
}
|
||||
|
||||
/* Delete a thread from GC_threads. We assume it is there. */
|
||||
/* (The code intentionally traps if it wasn't.) */
|
||||
/* Caller holds allocation lock. */
|
||||
/* We explicitly pass in the GC_thread we're looking for, since */
|
||||
/* if a thread has been joined, but we have not yet */
|
||||
/* been notified, then there may be more than one thread */
|
||||
/* in the table with the same pthread id. */
|
||||
/* This is OK, but we need a way to delete a specific one. */
|
||||
void GC_delete_gc_thread(pthread_t id, GC_thread gc_id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
register GC_thread p = GC_threads[hv];
|
||||
register GC_thread prev = 0;
|
||||
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
while (p != gc_id) {
|
||||
prev = p;
|
||||
p = p -> next;
|
||||
}
|
||||
if (prev == 0) {
|
||||
GC_threads[hv] = p -> next;
|
||||
} else {
|
||||
prev -> next = p -> next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return a GC_thread corresponding to a given thread_t. */
|
||||
/* Returns 0 if it's not there. */
|
||||
/* Caller holds allocation lock or otherwise inhibits */
|
||||
/* updates. */
|
||||
/* If there is more than one thread with the given id we */
|
||||
/* return the most recent one. */
|
||||
GC_thread GC_lookup_thread(pthread_t id)
|
||||
{
|
||||
int hv = ((word)id) % THREAD_TABLE_SZ;
|
||||
register GC_thread p = GC_threads[hv];
|
||||
|
||||
/* I either hold the lock, or i'm being called from the stop-the-world
|
||||
* handler. */
|
||||
#if defined(GC_AIX_THREADS)
|
||||
GC_ASSERT(I_HOLD_LOCK()); /* no stop-the-world handler needed on AIX */
|
||||
#endif
|
||||
while (p != 0 && !pthread_equal(p -> id, id)) p = p -> next;
|
||||
return(p);
|
||||
}
|
||||
|
||||
#if defined(GC_AIX_THREADS)
|
||||
void GC_stop_world()
|
||||
{
|
||||
pthread_t my_thread = pthread_self();
|
||||
register int i;
|
||||
register GC_thread p;
|
||||
register int result;
|
||||
struct timespec timeout;
|
||||
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
if (p -> id != my_thread) {
|
||||
pthread_suspend_np(p->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* GC_printf1("World stopped 0x%x\n", pthread_self()); */
|
||||
}
|
||||
|
||||
void GC_start_world()
|
||||
{
|
||||
GC_thread p;
|
||||
unsigned i;
|
||||
pthread_t my_thread = pthread_self();
|
||||
|
||||
/* GC_printf0("World starting\n"); */
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
if (p -> id != my_thread) {
|
||||
pthread_continue_np(p->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else /* GC_AIX_THREADS */
|
||||
|
||||
/* Caller holds allocation lock. */
|
||||
void GC_stop_world()
|
||||
{
|
||||
pthread_t my_thread = pthread_self();
|
||||
register int i;
|
||||
register GC_thread p;
|
||||
register int result;
|
||||
struct timespec timeout;
|
||||
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
if (p -> id != my_thread) {
|
||||
if (p -> flags & FINISHED) {
|
||||
p -> stop = STOPPED;
|
||||
continue;
|
||||
}
|
||||
p -> stop = PLEASE_STOP;
|
||||
result = pthread_kill(p -> id, SIG_SUSPEND);
|
||||
/* GC_printf1("Sent signal to 0x%x\n", p -> id); */
|
||||
switch(result) {
|
||||
case ESRCH:
|
||||
/* Not really there anymore. Possible? */
|
||||
p -> stop = STOPPED;
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
ABORT("pthread_kill failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_lock(&GC_suspend_lock);
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
while (p -> id != my_thread && p -> stop != STOPPED) {
|
||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
timeout.tv_nsec += 50000000; /* 50 msecs */
|
||||
if (timeout.tv_nsec >= 1000000000) {
|
||||
timeout.tv_nsec -= 1000000000;
|
||||
++timeout.tv_sec;
|
||||
}
|
||||
result = pthread_cond_timedwait(&GC_suspend_ack_cv,
|
||||
&GC_suspend_lock,
|
||||
&timeout);
|
||||
if (result == ETIMEDOUT) {
|
||||
/* Signal was lost or misdirected. Try again. */
|
||||
/* Duplicate signals should be benign. */
|
||||
result = pthread_kill(p -> id, SIG_SUSPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&GC_suspend_lock);
|
||||
/* GC_printf1("World stopped 0x%x\n", pthread_self()); */
|
||||
}
|
||||
|
||||
/* Caller holds allocation lock. */
|
||||
void GC_start_world()
|
||||
{
|
||||
GC_thread p;
|
||||
unsigned i;
|
||||
|
||||
/* GC_printf0("World starting\n"); */
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
p -> stop = NOT_STOPPED;
|
||||
}
|
||||
}
|
||||
pthread_mutex_lock(&GC_suspend_lock);
|
||||
/* All other threads are at pthread_cond_wait in signal handler. */
|
||||
/* Otherwise we couldn't have acquired the lock. */
|
||||
pthread_mutex_unlock(&GC_suspend_lock);
|
||||
pthread_cond_broadcast(&GC_continue_cv);
|
||||
}
|
||||
|
||||
#endif /* GC_AIX_THREADS */
|
||||
|
||||
|
||||
/* We hold allocation lock. Should do exactly the right thing if the */
|
||||
/* world is stopped. Should not fail if it isn't. */
|
||||
void GC_push_all_stacks()
|
||||
{
|
||||
register int i;
|
||||
register GC_thread p;
|
||||
register ptr_t hot, cold;
|
||||
pthread_t me = pthread_self();
|
||||
|
||||
/* GC_init() should have been called before GC_push_all_stacks is
|
||||
* invoked, and GC_init calls GC_thr_init(), which sets
|
||||
* GC_thr_initialized. */
|
||||
GC_ASSERT(GC_thr_initialized);
|
||||
|
||||
/* GC_printf1("Pushing stacks from thread 0x%x\n", me); */
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
for (i = 0; i < THREAD_TABLE_SZ; i++) {
|
||||
for (p = GC_threads[i]; p != 0; p = p -> next) {
|
||||
if (p -> flags & FINISHED) continue;
|
||||
cold = p->stack_cold;
|
||||
if (!cold) cold=GC_stackbottom; /* 0 indicates 'original stack' */
|
||||
if (pthread_equal(p -> id, me)) {
|
||||
hot = GC_approx_sp();
|
||||
} else {
|
||||
# ifdef GC_AIX_THREADS
|
||||
/* AIX doesn't use signals to suspend, so we need to get an */
|
||||
/* accurate hot stack pointer. */
|
||||
/* See http://publib16.boulder.ibm.com/pseries/en_US/libs/basetrf1/pthread_getthrds_np.htm */
|
||||
pthread_t id = p -> id;
|
||||
struct __pthrdsinfo pinfo;
|
||||
int regbuf[64];
|
||||
int val = sizeof(regbuf);
|
||||
int retval = pthread_getthrds_np(&id, PTHRDSINFO_QUERY_ALL, &pinfo,
|
||||
sizeof(pinfo), regbuf, &val);
|
||||
if (retval != 0) {
|
||||
printf("ERROR: pthread_getthrds_np() failed in GC\n");
|
||||
abort();
|
||||
}
|
||||
/* according to the AIX ABI,
|
||||
"the lowest possible valid stack address is 288 bytes (144 + 144)
|
||||
less than the current value of the stack pointer. Functions may
|
||||
use this stack space as volatile storage which is not preserved
|
||||
across function calls."
|
||||
ftp://ftp.penguinppc64.org/pub/people/amodra/PPC-elf64abi.txt.gz
|
||||
*/
|
||||
hot = (ptr_t)(unsigned long)pinfo.__pi_ustk-288;
|
||||
cold = (ptr_t)pinfo.__pi_stackend; /* more precise */
|
||||
/* push the registers too, because they won't be on stack */
|
||||
GC_push_all_eager((ptr_t)&pinfo.__pi_context,
|
||||
(ptr_t)((&pinfo.__pi_context)+1));
|
||||
GC_push_all_eager((ptr_t)regbuf, ((ptr_t)regbuf)+val);
|
||||
# else
|
||||
hot = p -> stack_hot;
|
||||
# endif
|
||||
}
|
||||
# ifdef STACK_GROWS_UP
|
||||
GC_push_all_stack(cold, hot);
|
||||
# else
|
||||
/* printf("thread 0x%x: hot=0x%08x cold=0x%08x\n", p -> id, hot, cold); */
|
||||
GC_push_all_stack(hot, cold);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* We hold the allocation lock. */
|
||||
void GC_thr_init()
|
||||
{
|
||||
GC_thread t;
|
||||
struct sigaction act;
|
||||
|
||||
if (GC_thr_initialized) return;
|
||||
GC_ASSERT(I_HOLD_LOCK());
|
||||
GC_thr_initialized = TRUE;
|
||||
#ifndef GC_AIX_THREADS
|
||||
(void) sigaction(SIG_SUSPEND, 0, &act);
|
||||
if (act.sa_handler != SIG_DFL)
|
||||
ABORT("Previously installed SIG_SUSPEND handler");
|
||||
/* Install handler. */
|
||||
act.sa_handler = GC_suspend_handler;
|
||||
act.sa_flags = SA_RESTART;
|
||||
(void) sigemptyset(&act.sa_mask);
|
||||
if (0 != sigaction(SIG_SUSPEND, &act, 0))
|
||||
ABORT("Failed to install SIG_SUSPEND handler");
|
||||
#endif
|
||||
/* Add the initial thread, so we can stop it. */
|
||||
t = GC_new_thread(pthread_self());
|
||||
/* use '0' to indicate GC_stackbottom, since GC_init() has not
|
||||
* completed by the time we are called (from GC_init_inner()) */
|
||||
t -> stack_cold = 0; /* the original stack. */
|
||||
t -> stack_hot = (ptr_t)(&t);
|
||||
t -> flags = DETACHED;
|
||||
}
|
||||
|
||||
int GC_pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
|
||||
{
|
||||
sigset_t fudged_set;
|
||||
|
||||
#ifdef GC_AIX_THREADS
|
||||
return(pthread_sigmask(how, set, oset));
|
||||
#endif
|
||||
|
||||
if (set != NULL && (how == SIG_BLOCK || how == SIG_SETMASK)) {
|
||||
fudged_set = *set;
|
||||
sigdelset(&fudged_set, SIG_SUSPEND);
|
||||
set = &fudged_set;
|
||||
}
|
||||
return(pthread_sigmask(how, set, oset));
|
||||
}
|
||||
|
||||
struct start_info {
|
||||
void *(*start_routine)(void *);
|
||||
void *arg;
|
||||
word flags;
|
||||
pthread_mutex_t registeredlock;
|
||||
pthread_cond_t registered;
|
||||
int volatile registereddone;
|
||||
};
|
||||
|
||||
void GC_thread_exit_proc(void *arg)
|
||||
{
|
||||
GC_thread me;
|
||||
|
||||
LOCK();
|
||||
me = GC_lookup_thread(pthread_self());
|
||||
me -> flags |= FINISHED;
|
||||
/* reclaim DETACHED thread right away; otherwise wait until join() */
|
||||
if (me -> flags & DETACHED) {
|
||||
GC_delete_gc_thread(pthread_self(), me);
|
||||
}
|
||||
UNLOCK();
|
||||
}
|
||||
|
||||
int GC_pthread_join(pthread_t thread, void **retval)
|
||||
{
|
||||
int result;
|
||||
GC_thread thread_gc_id;
|
||||
|
||||
LOCK();
|
||||
thread_gc_id = GC_lookup_thread(thread);
|
||||
/* This is guaranteed to be the intended one, since the thread id */
|
||||
/* cant have been recycled by pthreads. */
|
||||
UNLOCK();
|
||||
GC_ASSERT(!(thread_gc_id->flags & DETACHED));
|
||||
result = pthread_join(thread, retval);
|
||||
/* Some versions of the Irix pthreads library can erroneously */
|
||||
/* return EINTR when the call succeeds. */
|
||||
if (EINTR == result) result = 0;
|
||||
GC_ASSERT(thread_gc_id->flags & FINISHED);
|
||||
LOCK();
|
||||
/* Here the pthread thread id may have been recycled. */
|
||||
GC_delete_gc_thread(thread, thread_gc_id);
|
||||
UNLOCK();
|
||||
return result;
|
||||
}
|
||||
|
||||
void * GC_start_routine(void * arg)
|
||||
{
|
||||
int dummy;
|
||||
struct start_info * si = arg;
|
||||
void * result;
|
||||
GC_thread me;
|
||||
pthread_t my_pthread;
|
||||
void *(*start)(void *);
|
||||
void *start_arg;
|
||||
|
||||
my_pthread = pthread_self();
|
||||
/* If a GC occurs before the thread is registered, that GC will */
|
||||
/* ignore this thread. That's fine, since it will block trying to */
|
||||
/* acquire the allocation lock, and won't yet hold interesting */
|
||||
/* pointers. */
|
||||
LOCK();
|
||||
/* We register the thread here instead of in the parent, so that */
|
||||
/* we don't need to hold the allocation lock during pthread_create. */
|
||||
/* Holding the allocation lock there would make REDIRECT_MALLOC */
|
||||
/* impossible. It probably still doesn't work, but we're a little */
|
||||
/* closer ... */
|
||||
/* This unfortunately means that we have to be careful the parent */
|
||||
/* doesn't try to do a pthread_join before we're registered. */
|
||||
me = GC_new_thread(my_pthread);
|
||||
me -> flags = si -> flags;
|
||||
me -> stack_cold = (ptr_t) &dummy; /* this now the 'start of stack' */
|
||||
me -> stack_hot = me->stack_cold;/* this field should always be sensible */
|
||||
UNLOCK();
|
||||
start = si -> start_routine;
|
||||
start_arg = si -> arg;
|
||||
|
||||
pthread_mutex_lock(&(si->registeredlock));
|
||||
si->registereddone = 1;
|
||||
pthread_cond_signal(&(si->registered));
|
||||
pthread_mutex_unlock(&(si->registeredlock));
|
||||
/* si went away as soon as we did this unlock */
|
||||
|
||||
pthread_cleanup_push(GC_thread_exit_proc, 0);
|
||||
result = (*start)(start_arg);
|
||||
me -> status = result;
|
||||
pthread_cleanup_pop(1);
|
||||
/* This involves acquiring the lock, ensuring that we can't exit */
|
||||
/* while a collection that thinks we're alive is trying to stop */
|
||||
/* us. */
|
||||
return(result);
|
||||
}
|
||||
|
||||
int
|
||||
GC_pthread_create(pthread_t *new_thread,
|
||||
const pthread_attr_t *attr,
|
||||
void *(*start_routine)(void *), void *arg)
|
||||
{
|
||||
int result;
|
||||
GC_thread t;
|
||||
int detachstate;
|
||||
word my_flags = 0;
|
||||
struct start_info * si;
|
||||
/* This is otherwise saved only in an area mmapped by the thread */
|
||||
/* library, which isn't visible to the collector. */
|
||||
|
||||
LOCK();
|
||||
/* GC_INTERNAL_MALLOC implicitly calls GC_init() if required */
|
||||
si = (struct start_info *)GC_INTERNAL_MALLOC(sizeof(struct start_info),
|
||||
NORMAL);
|
||||
GC_ASSERT(GC_thr_initialized); /* initialized by GC_init() */
|
||||
UNLOCK();
|
||||
if (0 == si) return(ENOMEM);
|
||||
pthread_mutex_init(&(si->registeredlock), NULL);
|
||||
pthread_cond_init(&(si->registered),NULL);
|
||||
pthread_mutex_lock(&(si->registeredlock));
|
||||
si -> start_routine = start_routine;
|
||||
si -> arg = arg;
|
||||
|
||||
pthread_attr_getdetachstate(attr, &detachstate);
|
||||
if (PTHREAD_CREATE_DETACHED == detachstate) my_flags |= DETACHED;
|
||||
si -> flags = my_flags;
|
||||
result = pthread_create(new_thread, attr, GC_start_routine, si);
|
||||
|
||||
/* Wait until child has been added to the thread table. */
|
||||
/* This also ensures that we hold onto si until the child is done */
|
||||
/* with it. Thus it doesn't matter whether it is otherwise */
|
||||
/* visible to the collector. */
|
||||
|
||||
if (0 == result) {
|
||||
si->registereddone = 0;
|
||||
while (!si->registereddone)
|
||||
pthread_cond_wait(&(si->registered), &(si->registeredlock));
|
||||
}
|
||||
pthread_mutex_unlock(&(si->registeredlock));
|
||||
|
||||
pthread_cond_destroy(&(si->registered));
|
||||
pthread_mutex_destroy(&(si->registeredlock));
|
||||
LOCK();
|
||||
GC_INTERNAL_FREE(si);
|
||||
UNLOCK();
|
||||
|
||||
return(result);
|
||||
}
|
||||
|
||||
/* For now we use the pthreads locking primitives on HP/UX */
|
||||
|
||||
VOLATILE GC_bool GC_collecting = 0; /* A hint that we're in the collector and */
|
||||
/* holding the allocation lock for an */
|
||||
/* extended period. */
|
||||
|
||||
/* Reasonably fast spin locks. Basically the same implementation */
|
||||
/* as STL alloc.h. */
|
||||
|
||||
#define SLEEP_THRESHOLD 3
|
||||
|
||||
volatile unsigned int GC_allocate_lock = 0;
|
||||
#define GC_TRY_LOCK() !GC_test_and_set(&GC_allocate_lock)
|
||||
#define GC_LOCK_TAKEN GC_allocate_lock
|
||||
|
||||
void GC_lock()
|
||||
{
|
||||
# define low_spin_max 30 /* spin cycles if we suspect uniprocessor */
|
||||
# define high_spin_max 1000 /* spin cycles for multiprocessor */
|
||||
static unsigned spin_max = low_spin_max;
|
||||
unsigned my_spin_max;
|
||||
static unsigned last_spins = 0;
|
||||
unsigned my_last_spins;
|
||||
volatile unsigned junk;
|
||||
# define PAUSE junk *= junk; junk *= junk; junk *= junk; junk *= junk
|
||||
int i;
|
||||
|
||||
if (GC_TRY_LOCK()) {
|
||||
return;
|
||||
}
|
||||
junk = 0;
|
||||
my_spin_max = spin_max;
|
||||
my_last_spins = last_spins;
|
||||
for (i = 0; i < my_spin_max; i++) {
|
||||
if (GC_collecting) goto yield;
|
||||
if (i < my_last_spins/2 || GC_LOCK_TAKEN) {
|
||||
PAUSE;
|
||||
continue;
|
||||
}
|
||||
if (GC_TRY_LOCK()) {
|
||||
/*
|
||||
* got it!
|
||||
* Spinning worked. Thus we're probably not being scheduled
|
||||
* against the other process with which we were contending.
|
||||
* Thus it makes sense to spin longer the next time.
|
||||
*/
|
||||
last_spins = i;
|
||||
spin_max = high_spin_max;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* We are probably being scheduled against the other process. Sleep. */
|
||||
spin_max = low_spin_max;
|
||||
yield:
|
||||
for (i = 0;; ++i) {
|
||||
if (GC_TRY_LOCK()) {
|
||||
return;
|
||||
}
|
||||
if (i < SLEEP_THRESHOLD) {
|
||||
sched_yield();
|
||||
} else {
|
||||
struct timespec ts;
|
||||
|
||||
if (i > 26) i = 26;
|
||||
/* Don't wait for more than about 60msecs, even */
|
||||
/* under extreme contention. */
|
||||
ts.tv_sec = 0;
|
||||
ts.tv_nsec = 1 << i;
|
||||
nanosleep(&ts, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# else /* !GC_IRIX_THREADS && !GC_AIX_THREADS */
|
||||
|
||||
#ifndef LINT
|
||||
int GC_no_Irix_threads;
|
||||
#endif
|
||||
|
||||
# endif /* IRIX_THREADS */
|
||||
|
||||
@@ -1,838 +0,0 @@
|
||||
/*
|
||||
* Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
|
||||
* Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
|
||||
* Copyright (c) 1998-1999 by Silicon Graphics. All rights reserved.
|
||||
* Copyright (c) 1999 by Hewlett-Packard Company. 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.
|
||||
*/
|
||||
|
||||
/* #define DEBUG */
|
||||
#include <stdio.h>
|
||||
#include "private/gc_priv.h"
|
||||
|
||||
GC_bool GC_use_entire_heap = 0;
|
||||
|
||||
/*
|
||||
* Free heap blocks are kept on one of several free lists,
|
||||
* depending on the size of the block. Each free list is doubly linked.
|
||||
* Adjacent free blocks are coalesced.
|
||||
*/
|
||||
|
||||
|
||||
# define MAX_BLACK_LIST_ALLOC (2*HBLKSIZE)
|
||||
/* largest block we will allocate starting on a black */
|
||||
/* listed block. Must be >= HBLKSIZE. */
|
||||
|
||||
|
||||
# define UNIQUE_THRESHOLD 32
|
||||
/* Sizes up to this many HBLKs each have their own free list */
|
||||
# define HUGE_THRESHOLD 256
|
||||
/* Sizes of at least this many heap blocks are mapped to a */
|
||||
/* single free list. */
|
||||
# define FL_COMPRESSION 8
|
||||
/* In between sizes map this many distinct sizes to a single */
|
||||
/* bin. */
|
||||
|
||||
# define N_HBLK_FLS (HUGE_THRESHOLD - UNIQUE_THRESHOLD)/FL_COMPRESSION \
|
||||
+ UNIQUE_THRESHOLD
|
||||
|
||||
struct hblk * GC_hblkfreelist[N_HBLK_FLS+1] = { 0 };
|
||||
|
||||
#ifndef USE_MUNMAP
|
||||
|
||||
word GC_free_bytes[N_HBLK_FLS+1] = { 0 };
|
||||
/* Number of free bytes on each list. */
|
||||
|
||||
/* Is bytes + the number of free bytes on lists n .. N_HBLK_FLS */
|
||||
/* > GC_max_large_allocd_bytes? */
|
||||
# ifdef __GNUC__
|
||||
__inline__
|
||||
# endif
|
||||
static GC_bool GC_enough_large_bytes_left(bytes,n)
|
||||
word bytes;
|
||||
int n;
|
||||
{
|
||||
int i;
|
||||
for (i = N_HBLK_FLS; i >= n; --i) {
|
||||
bytes += GC_free_bytes[i];
|
||||
if (bytes > GC_max_large_allocd_bytes) return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
# define INCR_FREE_BYTES(n, b) GC_free_bytes[n] += (b);
|
||||
|
||||
# define FREE_ASSERT(e) GC_ASSERT(e)
|
||||
|
||||
#else /* USE_MUNMAP */
|
||||
|
||||
# define INCR_FREE_BYTES(n, b)
|
||||
# define FREE_ASSERT(e)
|
||||
|
||||
#endif /* USE_MUNMAP */
|
||||
|
||||
/* Map a number of blocks to the appropriate large block free list index. */
|
||||
int GC_hblk_fl_from_blocks(blocks_needed)
|
||||
word blocks_needed;
|
||||
{
|
||||
if (blocks_needed <= UNIQUE_THRESHOLD) return blocks_needed;
|
||||
if (blocks_needed >= HUGE_THRESHOLD) return N_HBLK_FLS;
|
||||
return (blocks_needed - UNIQUE_THRESHOLD)/FL_COMPRESSION
|
||||
+ UNIQUE_THRESHOLD;
|
||||
|
||||
}
|
||||
|
||||
# define PHDR(hhdr) HDR(hhdr -> hb_prev)
|
||||
# define NHDR(hhdr) HDR(hhdr -> hb_next)
|
||||
|
||||
# ifdef USE_MUNMAP
|
||||
# define IS_MAPPED(hhdr) (((hhdr) -> hb_flags & WAS_UNMAPPED) == 0)
|
||||
# else /* !USE_MMAP */
|
||||
# define IS_MAPPED(hhdr) 1
|
||||
# endif /* USE_MUNMAP */
|
||||
|
||||
# if !defined(NO_DEBUGGING)
|
||||
void GC_print_hblkfreelist()
|
||||
{
|
||||
struct hblk * h;
|
||||
word total_free = 0;
|
||||
hdr * hhdr;
|
||||
word sz;
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= N_HBLK_FLS; ++i) {
|
||||
h = GC_hblkfreelist[i];
|
||||
# ifdef USE_MUNMAP
|
||||
if (0 != h) GC_printf1("Free list %ld:\n",
|
||||
(unsigned long)i);
|
||||
# else
|
||||
if (0 != h) GC_printf2("Free list %ld (Total size %ld):\n",
|
||||
(unsigned long)i,
|
||||
(unsigned long)GC_free_bytes[i]);
|
||||
# endif
|
||||
while (h != 0) {
|
||||
hhdr = HDR(h);
|
||||
sz = hhdr -> hb_sz;
|
||||
GC_printf2("\t0x%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;
|
||||
}
|
||||
}
|
||||
# ifndef USE_MUNMAP
|
||||
if (total_free != GC_large_free_bytes) {
|
||||
GC_printf1("GC_large_free_bytes = %lu (INCONSISTENT!!)\n",
|
||||
(unsigned long) GC_large_free_bytes);
|
||||
}
|
||||
# endif
|
||||
GC_printf1("Total of %lu bytes on free list\n", (unsigned long)total_free);
|
||||
}
|
||||
|
||||
/* Return the free list index on which the block described by the header */
|
||||
/* appears, or -1 if it appears nowhere. */
|
||||
int free_list_index_of(wanted)
|
||||
hdr * wanted;
|
||||
{
|
||||
struct hblk * h;
|
||||
hdr * hhdr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= N_HBLK_FLS; ++i) {
|
||||
h = GC_hblkfreelist[i];
|
||||
while (h != 0) {
|
||||
hhdr = HDR(h);
|
||||
if (hhdr == wanted) return i;
|
||||
h = hhdr -> hb_next;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void GC_dump_regions()
|
||||
{
|
||||
unsigned i;
|
||||
ptr_t start, end;
|
||||
ptr_t p;
|
||||
size_t bytes;
|
||||
hdr *hhdr;
|
||||
for (i = 0; i < GC_n_heap_sects; ++i) {
|
||||
start = GC_heap_sects[i].hs_start;
|
||||
bytes = GC_heap_sects[i].hs_bytes;
|
||||
end = start + bytes;
|
||||
/* Merge in contiguous sections. */
|
||||
while (i+1 < GC_n_heap_sects && GC_heap_sects[i+1].hs_start == end) {
|
||||
++i;
|
||||
end = GC_heap_sects[i].hs_start + GC_heap_sects[i].hs_bytes;
|
||||
}
|
||||
GC_printf2("***Section from 0x%lx to 0x%lx\n", start, end);
|
||||
for (p = start; p < end;) {
|
||||
hhdr = HDR(p);
|
||||
GC_printf1("\t0x%lx ", (unsigned long)p);
|
||||
if (IS_FORWARDING_ADDR_OR_NIL(hhdr)) {
|
||||
GC_printf1("Missing header!!(%ld)\n", hhdr);
|
||||
p += HBLKSIZE;
|
||||
continue;
|
||||
}
|
||||
if (HBLK_IS_FREE(hhdr)) {
|
||||
int correct_index = GC_hblk_fl_from_blocks(
|
||||
divHBLKSZ(hhdr -> hb_sz));
|
||||
int actual_index;
|
||||
|
||||
GC_printf1("\tfree block of size 0x%lx bytes",
|
||||
(unsigned long)(hhdr -> hb_sz));
|
||||
if (IS_MAPPED(hhdr)) {
|
||||
GC_printf0("\n");
|
||||
} else {
|
||||
GC_printf0("(unmapped)\n");
|
||||
}
|
||||
actual_index = free_list_index_of(hhdr);
|
||||
if (-1 == actual_index) {
|
||||
GC_printf1("\t\tBlock not on free list %ld!!\n",
|
||||
correct_index);
|
||||
} else if (correct_index != actual_index) {
|
||||
GC_printf2("\t\tBlock on list %ld, should be on %ld!!\n",
|
||||
actual_index, correct_index);
|
||||
}
|
||||
p += hhdr -> hb_sz;
|
||||
} else {
|
||||
GC_printf1("\tused for blocks of size 0x%lx bytes\n",
|
||||
(unsigned long)WORDS_TO_BYTES(hhdr -> hb_sz));
|
||||
p += HBLKSIZE * OBJ_SZ_TO_BLOCKS(hhdr -> hb_sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 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);
|
||||
}
|
||||
|
||||
#define FL_UNKNOWN -1
|
||||
/*
|
||||
* Remove hhdr from the appropriate free list.
|
||||
* We assume it is on the nth free list, or on the size
|
||||
* appropriate free list if n is FL_UNKNOWN.
|
||||
*/
|
||||
void GC_remove_from_fl(hhdr, n)
|
||||
hdr * hhdr;
|
||||
int n;
|
||||
{
|
||||
int index;
|
||||
|
||||
GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0);
|
||||
# ifndef USE_MUNMAP
|
||||
/* We always need index to mainatin free counts. */
|
||||
if (FL_UNKNOWN == n) {
|
||||
index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
|
||||
} else {
|
||||
index = n;
|
||||
}
|
||||
# endif
|
||||
if (hhdr -> hb_prev == 0) {
|
||||
# ifdef USE_MUNMAP
|
||||
if (FL_UNKNOWN == n) {
|
||||
index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
|
||||
} else {
|
||||
index = n;
|
||||
}
|
||||
# endif
|
||||
GC_ASSERT(HDR(GC_hblkfreelist[index]) == hhdr);
|
||||
GC_hblkfreelist[index] = hhdr -> hb_next;
|
||||
} else {
|
||||
hdr *phdr;
|
||||
GET_HDR(hhdr -> hb_prev, phdr);
|
||||
phdr -> hb_next = hhdr -> hb_next;
|
||||
}
|
||||
FREE_ASSERT(GC_free_bytes[index] >= hhdr -> hb_sz);
|
||||
INCR_FREE_BYTES(index, - (signed_word)(hhdr -> hb_sz));
|
||||
if (0 != hhdr -> hb_next) {
|
||||
hdr * nhdr;
|
||||
GC_ASSERT(!IS_FORWARDING_ADDR_OR_NIL(NHDR(hhdr)));
|
||||
GET_HDR(hhdr -> hb_next, nhdr);
|
||||
nhdr -> hb_prev = hhdr -> hb_prev;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Return a pointer to the free block ending just before h, if any.
|
||||
*/
|
||||
struct hblk * GC_free_block_ending_at(h)
|
||||
struct hblk *h;
|
||||
{
|
||||
struct hblk * p = h - 1;
|
||||
hdr * phdr;
|
||||
|
||||
GET_HDR(p, phdr);
|
||||
while (0 != phdr && IS_FORWARDING_ADDR_OR_NIL(phdr)) {
|
||||
p = FORWARDED_ADDR(p,phdr);
|
||||
phdr = HDR(p);
|
||||
}
|
||||
if (0 != phdr) {
|
||||
if(HBLK_IS_FREE(phdr)) {
|
||||
return p;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
p = GC_prev_block(h - 1);
|
||||
if (0 != p) {
|
||||
phdr = HDR(p);
|
||||
if (HBLK_IS_FREE(phdr) && (ptr_t)p + phdr -> hb_sz == (ptr_t)h) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add hhdr to the appropriate free list.
|
||||
* We maintain individual free lists sorted by address.
|
||||
*/
|
||||
void GC_add_to_fl(h, hhdr)
|
||||
struct hblk *h;
|
||||
hdr * hhdr;
|
||||
{
|
||||
int index = GC_hblk_fl_from_blocks(divHBLKSZ(hhdr -> hb_sz));
|
||||
struct hblk *second = GC_hblkfreelist[index];
|
||||
hdr * second_hdr;
|
||||
# ifdef GC_ASSERTIONS
|
||||
struct hblk *next = (struct hblk *)((word)h + hhdr -> hb_sz);
|
||||
hdr * nexthdr = HDR(next);
|
||||
struct hblk *prev = GC_free_block_ending_at(h);
|
||||
hdr * prevhdr = HDR(prev);
|
||||
GC_ASSERT(nexthdr == 0 || !HBLK_IS_FREE(nexthdr) || !IS_MAPPED(nexthdr));
|
||||
GC_ASSERT(prev == 0 || !HBLK_IS_FREE(prevhdr) || !IS_MAPPED(prevhdr));
|
||||
# endif
|
||||
GC_ASSERT(((hhdr -> hb_sz) & (HBLKSIZE-1)) == 0);
|
||||
GC_hblkfreelist[index] = h;
|
||||
INCR_FREE_BYTES(index, hhdr -> hb_sz);
|
||||
FREE_ASSERT(GC_free_bytes[index] <= GC_large_free_bytes)
|
||||
hhdr -> hb_next = second;
|
||||
hhdr -> hb_prev = 0;
|
||||
if (0 != second) {
|
||||
GET_HDR(second, second_hdr);
|
||||
second_hdr -> hb_prev = h;
|
||||
}
|
||||
GC_invalidate_map(hhdr);
|
||||
}
|
||||
|
||||
#ifdef USE_MUNMAP
|
||||
|
||||
/* Unmap blocks that haven't been recently touched. This is the only way */
|
||||
/* way blocks are ever unmapped. */
|
||||
void GC_unmap_old(void)
|
||||
{
|
||||
struct hblk * h;
|
||||
hdr * hhdr;
|
||||
word sz;
|
||||
unsigned short last_rec, threshold;
|
||||
int i;
|
||||
# define UNMAP_THRESHOLD 6
|
||||
|
||||
for (i = 0; i <= N_HBLK_FLS; ++i) {
|
||||
for (h = GC_hblkfreelist[i]; 0 != h; h = hhdr -> hb_next) {
|
||||
hhdr = HDR(h);
|
||||
if (!IS_MAPPED(hhdr)) continue;
|
||||
threshold = (unsigned short)(GC_gc_no - UNMAP_THRESHOLD);
|
||||
last_rec = hhdr -> hb_last_reclaimed;
|
||||
if ((last_rec > GC_gc_no || last_rec < threshold)
|
||||
&& threshold < GC_gc_no /* not recently wrapped */) {
|
||||
sz = hhdr -> hb_sz;
|
||||
GC_unmap((ptr_t)h, sz);
|
||||
hhdr -> hb_flags |= WAS_UNMAPPED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Merge all unmapped blocks that are adjacent to other free */
|
||||
/* blocks. This may involve remapping, since all blocks are either */
|
||||
/* fully mapped or fully unmapped. */
|
||||
void GC_merge_unmapped(void)
|
||||
{
|
||||
struct hblk * h, *next;
|
||||
hdr * hhdr, *nexthdr;
|
||||
word size, nextsize;
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= N_HBLK_FLS; ++i) {
|
||||
h = GC_hblkfreelist[i];
|
||||
while (h != 0) {
|
||||
GET_HDR(h, hhdr);
|
||||
size = hhdr->hb_sz;
|
||||
next = (struct hblk *)((word)h + size);
|
||||
GET_HDR(next, nexthdr);
|
||||
/* Coalesce with successor, if possible */
|
||||
if (0 != nexthdr && HBLK_IS_FREE(nexthdr)) {
|
||||
nextsize = nexthdr -> hb_sz;
|
||||
if (IS_MAPPED(hhdr)) {
|
||||
GC_ASSERT(!IS_MAPPED(nexthdr));
|
||||
/* make both consistent, so that we can merge */
|
||||
if (size > nextsize) {
|
||||
GC_remap((ptr_t)next, nextsize);
|
||||
} else {
|
||||
GC_unmap((ptr_t)h, size);
|
||||
hhdr -> hb_flags |= WAS_UNMAPPED;
|
||||
}
|
||||
} else if (IS_MAPPED(nexthdr)) {
|
||||
GC_ASSERT(!IS_MAPPED(hhdr));
|
||||
if (size > nextsize) {
|
||||
GC_unmap((ptr_t)next, nextsize);
|
||||
} else {
|
||||
GC_remap((ptr_t)h, size);
|
||||
hhdr -> hb_flags &= ~WAS_UNMAPPED;
|
||||
hhdr -> hb_last_reclaimed = nexthdr -> hb_last_reclaimed;
|
||||
}
|
||||
} else {
|
||||
/* Unmap any gap in the middle */
|
||||
GC_unmap_gap((ptr_t)h, size, (ptr_t)next, nexthdr -> hb_sz);
|
||||
}
|
||||
/* If they are both unmapped, we merge, but leave unmapped. */
|
||||
GC_remove_from_fl(hhdr, i);
|
||||
GC_remove_from_fl(nexthdr, FL_UNKNOWN);
|
||||
hhdr -> hb_sz += nexthdr -> hb_sz;
|
||||
GC_remove_header(next);
|
||||
GC_add_to_fl(h, hhdr);
|
||||
/* Start over at beginning of list */
|
||||
h = GC_hblkfreelist[i];
|
||||
} else /* not mergable with successor */ {
|
||||
h = hhdr -> hb_next;
|
||||
}
|
||||
} /* while (h != 0) ... */
|
||||
} /* for ... */
|
||||
}
|
||||
|
||||
#endif /* USE_MUNMAP */
|
||||
|
||||
/*
|
||||
* Return a pointer to a block starting at h of length bytes.
|
||||
* Memory for the block is mapped.
|
||||
* Remove the block from its free list, and return the remainder (if any)
|
||||
* to its appropriate free list.
|
||||
* May fail by returning 0.
|
||||
* The header for the returned block must be set up by the caller.
|
||||
* If the return value is not 0, then hhdr is the header for it.
|
||||
*/
|
||||
struct hblk * GC_get_first_part(h, hhdr, bytes, index)
|
||||
struct hblk *h;
|
||||
hdr * hhdr;
|
||||
word bytes;
|
||||
int index;
|
||||
{
|
||||
word total_size = hhdr -> hb_sz;
|
||||
struct hblk * rest;
|
||||
hdr * rest_hdr;
|
||||
|
||||
GC_ASSERT((total_size & (HBLKSIZE-1)) == 0);
|
||||
GC_remove_from_fl(hhdr, index);
|
||||
if (total_size == bytes) return h;
|
||||
rest = (struct hblk *)((word)h + bytes);
|
||||
rest_hdr = GC_install_header(rest);
|
||||
if (0 == rest_hdr) {
|
||||
/* This may be very bad news ... */
|
||||
WARN("Header allocation failed: Dropping block.\n", 0);
|
||||
return(0);
|
||||
}
|
||||
rest_hdr -> hb_sz = total_size - bytes;
|
||||
rest_hdr -> hb_flags = 0;
|
||||
# ifdef GC_ASSERTIONS
|
||||
/* Mark h not free, to avoid assertion about adjacent free blocks. */
|
||||
hhdr -> hb_map = 0;
|
||||
# endif
|
||||
GC_add_to_fl(rest, rest_hdr);
|
||||
return h;
|
||||
}
|
||||
|
||||
/*
|
||||
* H is a free block. N points at an address inside it.
|
||||
* A new header for n has already been set up. Fix up h's header
|
||||
* to reflect the fact that it is being split, move it to the
|
||||
* appropriate free list.
|
||||
* N replaces h in the original free list.
|
||||
*
|
||||
* Nhdr is not completely filled in, since it is about to allocated.
|
||||
* It may in fact end up on the wrong free list for its size.
|
||||
* (Hence adding it to a free list is silly. But this path is hopefully
|
||||
* rare enough that it doesn't matter. The code is cleaner this way.)
|
||||
*/
|
||||
void GC_split_block(h, hhdr, n, nhdr, index)
|
||||
struct hblk *h;
|
||||
hdr * hhdr;
|
||||
struct hblk *n;
|
||||
hdr * nhdr;
|
||||
int index; /* Index of free list */
|
||||
{
|
||||
word total_size = hhdr -> hb_sz;
|
||||
word h_size = (word)n - (word)h;
|
||||
struct hblk *prev = hhdr -> hb_prev;
|
||||
struct hblk *next = hhdr -> hb_next;
|
||||
|
||||
/* Replace h with n on its freelist */
|
||||
nhdr -> hb_prev = prev;
|
||||
nhdr -> hb_next = next;
|
||||
nhdr -> hb_sz = total_size - h_size;
|
||||
nhdr -> hb_flags = 0;
|
||||
if (0 != prev) {
|
||||
HDR(prev) -> hb_next = n;
|
||||
} else {
|
||||
GC_hblkfreelist[index] = n;
|
||||
}
|
||||
if (0 != next) {
|
||||
HDR(next) -> hb_prev = n;
|
||||
}
|
||||
INCR_FREE_BYTES(index, -(signed_word)h_size);
|
||||
FREE_ASSERT(GC_free_bytes[index] > 0);
|
||||
# ifdef GC_ASSERTIONS
|
||||
nhdr -> hb_map = 0; /* Don't fail test for consecutive */
|
||||
/* free blocks in GC_add_to_fl. */
|
||||
# endif
|
||||
# ifdef USE_MUNMAP
|
||||
hhdr -> hb_last_reclaimed = GC_gc_no;
|
||||
# endif
|
||||
hhdr -> hb_sz = h_size;
|
||||
GC_add_to_fl(h, hhdr);
|
||||
GC_invalidate_map(nhdr);
|
||||
}
|
||||
|
||||
struct hblk * GC_allochblk_nth();
|
||||
|
||||
/*
|
||||
* Allocate (and return pointer to) a heap block
|
||||
* for objects of size sz words, searching the nth free list.
|
||||
*
|
||||
* NOTE: We set obj_map field in header correctly.
|
||||
* Caller is responsible for building an object freelist in block.
|
||||
*
|
||||
* Unlike older versions of the collectors, the client is responsible
|
||||
* for clearing the block, if necessary.
|
||||
*/
|
||||
struct hblk *
|
||||
GC_allochblk(sz, kind, flags)
|
||||
word sz;
|
||||
int kind;
|
||||
unsigned flags; /* IGNORE_OFF_PAGE or 0 */
|
||||
{
|
||||
word blocks = OBJ_SZ_TO_BLOCKS(sz);
|
||||
int start_list = GC_hblk_fl_from_blocks(blocks);
|
||||
int i;
|
||||
for (i = start_list; i <= N_HBLK_FLS; ++i) {
|
||||
struct hblk * result = GC_allochblk_nth(sz, kind, flags, i);
|
||||
if (0 != result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* The same, but with search restricted to nth free list.
|
||||
*/
|
||||
struct hblk *
|
||||
GC_allochblk_nth(sz, kind, flags, n)
|
||||
word sz;
|
||||
int kind;
|
||||
unsigned char flags; /* IGNORE_OFF_PAGE or 0 */
|
||||
int n;
|
||||
{
|
||||
register struct hblk *hbp;
|
||||
register hdr * hhdr; /* Header corr. to hbp */
|
||||
register struct hblk *thishbp;
|
||||
register hdr * thishdr; /* Header corr. to hbp */
|
||||
signed_word size_needed; /* number of bytes in requested objects */
|
||||
signed_word size_avail; /* bytes available in this block */
|
||||
|
||||
size_needed = HBLKSIZE * OBJ_SZ_TO_BLOCKS(sz);
|
||||
|
||||
/* search for a big enough block in free list */
|
||||
hbp = GC_hblkfreelist[n];
|
||||
for(; 0 != hbp; hbp = hhdr -> hb_next) {
|
||||
GET_HDR(hbp, hhdr);
|
||||
size_avail = hhdr->hb_sz;
|
||||
if (size_avail < size_needed) continue;
|
||||
if (size_avail != size_needed
|
||||
&& !GC_use_entire_heap
|
||||
&& !GC_dont_gc
|
||||
&& USED_HEAP_SIZE >= GC_requested_heapsize
|
||||
&& !TRUE_INCREMENTAL && GC_should_collect()) {
|
||||
# ifdef USE_MUNMAP
|
||||
continue;
|
||||
# else
|
||||
/* If we have enough large blocks left to cover any */
|
||||
/* previous request for large blocks, we go ahead */
|
||||
/* and split. Assuming a steady state, that should */
|
||||
/* be safe. It means that we can use the full */
|
||||
/* heap if we allocate only small objects. */
|
||||
if (!GC_enough_large_bytes_left(GC_large_allocd_bytes, n)) {
|
||||
continue;
|
||||
}
|
||||
/* If we are deallocating lots of memory from */
|
||||
/* finalizers, fail and collect sooner rather */
|
||||
/* than later. */
|
||||
if (WORDS_TO_BYTES(GC_finalizer_mem_freed)
|
||||
> (GC_heapsize >> 4)) {
|
||||
continue;
|
||||
}
|
||||
# endif /* !USE_MUNMAP */
|
||||
}
|
||||
/* 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) {
|
||||
GET_HDR(thishbp, thishdr);
|
||||
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))
|
||||
!= 0) {
|
||||
lasthbp = thishbp;
|
||||
}
|
||||
size_avail -= (ptr_t)lasthbp - (ptr_t)hbp;
|
||||
thishbp = lasthbp;
|
||||
if (size_avail >= size_needed) {
|
||||
if (thishbp != hbp &&
|
||||
0 != (thishdr = GC_install_header(thishbp))) {
|
||||
/* Make sure it's mapped before we mangle it. */
|
||||
# ifdef USE_MUNMAP
|
||||
if (!IS_MAPPED(hhdr)) {
|
||||
GC_remap((ptr_t)hbp, hhdr -> hb_sz);
|
||||
hhdr -> hb_flags &= ~WAS_UNMAPPED;
|
||||
}
|
||||
# endif
|
||||
/* Split the block at thishbp */
|
||||
GC_split_block(hbp, hhdr, thishbp, thishdr, n);
|
||||
/* Advance to thishbp */
|
||||
hbp = thishbp;
|
||||
hhdr = thishdr;
|
||||
/* We must now allocate thishbp, since it may */
|
||||
/* be on the wrong free list. */
|
||||
}
|
||||
} else if (size_needed > (signed_word)BL_LIMIT
|
||||
&& orig_avail - size_needed
|
||||
> (signed_word)BL_LIMIT) {
|
||||
/* Punt, since anything else risks unreasonable heap growth. */
|
||||
if (++GC_large_alloc_warn_suppressed
|
||||
>= GC_large_alloc_warn_interval) {
|
||||
WARN("Repeated allocation of very large block "
|
||||
"(appr. size %ld):\n"
|
||||
"\tMay lead to memory leak and poor performance.\n",
|
||||
size_needed);
|
||||
GC_large_alloc_warn_suppressed = 0;
|
||||
}
|
||||
size_avail = orig_avail;
|
||||
} else if (size_avail == 0 && size_needed == HBLKSIZE
|
||||
&& IS_MAPPED(hhdr)) {
|
||||
if (!GC_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. */
|
||||
word total_size = hhdr -> hb_sz;
|
||||
struct hblk * limit = hbp + divHBLKSZ(total_size);
|
||||
struct hblk * h;
|
||||
struct hblk * prev = hhdr -> hb_prev;
|
||||
|
||||
GC_words_wasted += BYTES_TO_WORDS(total_size);
|
||||
GC_large_free_bytes -= total_size;
|
||||
GC_remove_from_fl(hhdr, n);
|
||||
for (h = hbp; h < limit; h++) {
|
||||
if (h == hbp || 0 != (hhdr = GC_install_header(h))) {
|
||||
(void) setup_header(
|
||||
hhdr,
|
||||
BYTES_TO_WORDS(HBLKSIZE),
|
||||
PTRFREE, 0); /* Cant fail */
|
||||
if (GC_debugging_started) {
|
||||
BZERO(h, HBLKSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Restore hbp to point at free block */
|
||||
hbp = prev;
|
||||
if (0 == hbp) {
|
||||
return GC_allochblk_nth(sz, kind, flags, n);
|
||||
}
|
||||
hhdr = HDR(hbp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( size_avail >= size_needed ) {
|
||||
# ifdef USE_MUNMAP
|
||||
if (!IS_MAPPED(hhdr)) {
|
||||
GC_remap((ptr_t)hbp, hhdr -> hb_sz);
|
||||
hhdr -> hb_flags &= ~WAS_UNMAPPED;
|
||||
}
|
||||
# endif
|
||||
/* hbp may be on the wrong freelist; the parameter n */
|
||||
/* is important. */
|
||||
hbp = GC_get_first_part(hbp, hhdr, size_needed, n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 == hbp) return 0;
|
||||
|
||||
/* Add it to map of valid blocks */
|
||||
if (!GC_install_counts(hbp, (word)size_needed)) return(0);
|
||||
/* This leaks memory under very rare conditions. */
|
||||
|
||||
/* Set up header */
|
||||
if (!setup_header(hhdr, sz, kind, flags)) {
|
||||
GC_remove_counts(hbp, (word)size_needed);
|
||||
return(0); /* ditto */
|
||||
}
|
||||
|
||||
/* Notify virtual dirty bit implementation that we are about to write. */
|
||||
/* Ensure that pointerfree objects are not protected if it's avoidable. */
|
||||
GC_remove_protection(hbp, divHBLKSZ(size_needed),
|
||||
(hhdr -> hb_descr == 0) /* pointer-free */);
|
||||
|
||||
/* We just successfully allocated a block. Restart count of */
|
||||
/* consecutive failures. */
|
||||
{
|
||||
extern unsigned GC_fail_count;
|
||||
|
||||
GC_fail_count = 0;
|
||||
}
|
||||
|
||||
GC_large_free_bytes -= size_needed;
|
||||
|
||||
GC_ASSERT(IS_MAPPED(hhdr));
|
||||
return( hbp );
|
||||
}
|
||||
|
||||
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(hbp)
|
||||
struct hblk *hbp;
|
||||
{
|
||||
struct hblk *next, *prev;
|
||||
hdr *hhdr, *prevhdr, *nexthdr;
|
||||
signed_word size;
|
||||
|
||||
|
||||
GET_HDR(hbp, hhdr);
|
||||
size = hhdr->hb_sz;
|
||||
size = HBLKSIZE * OBJ_SZ_TO_BLOCKS(size);
|
||||
GC_remove_counts(hbp, (word)size);
|
||||
hhdr->hb_sz = size;
|
||||
# ifdef USE_MUNMAP
|
||||
hhdr -> hb_last_reclaimed = GC_gc_no;
|
||||
# endif
|
||||
|
||||
/* Check for duplicate deallocation in the easy case */
|
||||
if (HBLK_IS_FREE(hhdr)) {
|
||||
GC_printf1("Duplicate large block deallocation of 0x%lx\n",
|
||||
(unsigned long) hbp);
|
||||
ABORT("Duplicate large block deallocation");
|
||||
}
|
||||
|
||||
GC_ASSERT(IS_MAPPED(hhdr));
|
||||
GC_invalidate_map(hhdr);
|
||||
next = (struct hblk *)((word)hbp + size);
|
||||
GET_HDR(next, nexthdr);
|
||||
prev = GC_free_block_ending_at(hbp);
|
||||
/* Coalesce with successor, if possible */
|
||||
if(0 != nexthdr && HBLK_IS_FREE(nexthdr) && IS_MAPPED(nexthdr)) {
|
||||
GC_remove_from_fl(nexthdr, FL_UNKNOWN);
|
||||
hhdr -> hb_sz += nexthdr -> hb_sz;
|
||||
GC_remove_header(next);
|
||||
}
|
||||
/* Coalesce with predecessor, if possible. */
|
||||
if (0 != prev) {
|
||||
prevhdr = HDR(prev);
|
||||
if (IS_MAPPED(prevhdr)) {
|
||||
GC_remove_from_fl(prevhdr, FL_UNKNOWN);
|
||||
prevhdr -> hb_sz += hhdr -> hb_sz;
|
||||
# ifdef USE_MUNMAP
|
||||
prevhdr -> hb_last_reclaimed = GC_gc_no;
|
||||
# endif
|
||||
GC_remove_header(hbp);
|
||||
hbp = prev;
|
||||
hhdr = prevhdr;
|
||||
}
|
||||
}
|
||||
/* FIXME: It is not clear we really always want to do these merges */
|
||||
/* with -DUSE_MUNMAP, since it updates ages and hence prevents */
|
||||
/* unmapping. */
|
||||
|
||||
GC_large_free_bytes += size;
|
||||
GC_add_to_fl(hbp, hhdr);
|
||||
}
|
||||
|
||||
-1145
File diff suppressed because it is too large.
Load diff
@@ -1,86 +0,0 @@
|
||||
.arch ev6
|
||||
|
||||
.text
|
||||
.align 4
|
||||
.globl GC_push_regs
|
||||
.ent GC_push_regs 2
|
||||
GC_push_regs:
|
||||
ldgp $gp, 0($27)
|
||||
lda $sp, -16($sp)
|
||||
stq $26, 0($sp)
|
||||
.mask 0x04000000, 0
|
||||
.frame $sp, 16, $26, 0
|
||||
|
||||
/* $0 integer result */
|
||||
/* $1-$8 temp regs - not preserved cross calls */
|
||||
/* $9-$15 call saved regs */
|
||||
/* $16-$21 argument regs - not preserved cross calls */
|
||||
/* $22-$28 temp regs - not preserved cross calls */
|
||||
/* $29 global pointer - not preserved cross calls */
|
||||
/* $30 stack pointer */
|
||||
|
||||
# define call_push(x) \
|
||||
mov x, $16; \
|
||||
jsr $26, GC_push_one; \
|
||||
ldgp $gp, 0($26)
|
||||
|
||||
call_push($9)
|
||||
call_push($10)
|
||||
call_push($11)
|
||||
call_push($12)
|
||||
call_push($13)
|
||||
call_push($14)
|
||||
call_push($15)
|
||||
|
||||
/* $f0-$f1 floating point results */
|
||||
/* $f2-$f9 call saved regs */
|
||||
/* $f10-$f30 temp regs - not preserved cross calls */
|
||||
|
||||
/* Use the most efficient transfer method for this hardware. */
|
||||
/* Bit 1 detects the FIX extension, which includes ftoit. */
|
||||
amask 2, $0
|
||||
bne $0, $use_stack
|
||||
|
||||
#undef call_push
|
||||
#define call_push(x) \
|
||||
ftoit x, $16; \
|
||||
jsr $26, GC_push_one; \
|
||||
ldgp $gp, 0($26)
|
||||
|
||||
call_push($f2)
|
||||
call_push($f3)
|
||||
call_push($f4)
|
||||
call_push($f5)
|
||||
call_push($f6)
|
||||
call_push($f7)
|
||||
call_push($f8)
|
||||
call_push($f9)
|
||||
|
||||
ldq $26, 0($sp)
|
||||
lda $sp, 16($sp)
|
||||
ret $31, ($26), 1
|
||||
|
||||
.align 4
|
||||
$use_stack:
|
||||
|
||||
#undef call_push
|
||||
#define call_push(x) \
|
||||
stt x, 8($sp); \
|
||||
ldq $16, 8($sp); \
|
||||
jsr $26, GC_push_one; \
|
||||
ldgp $gp, 0($26)
|
||||
|
||||
call_push($f2)
|
||||
call_push($f3)
|
||||
call_push($f4)
|
||||
call_push($f5)
|
||||
call_push($f6)
|
||||
call_push($f7)
|
||||
call_push($f8)
|
||||
call_push($f9)
|
||||
|
||||
ldq $26, 0($sp)
|
||||
lda $sp, 16($sp)
|
||||
ret $31, ($26), 1
|
||||
|
||||
.end GC_push_regs
|
||||
@@ -1,123 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
# Ripped off from GNOME macros version
|
||||
|
||||
DIE=0
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`autoconf' installed to compile Mono."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if [ -z "$LIBTOOLIZE" ]; then
|
||||
LIBTOOLIZE=`which glibtoolize 2>/dev/null`
|
||||
if [ ! -x "$LIBTOOLIZE" ]; then
|
||||
LIBTOOLIZE=`which libtoolize`
|
||||
fi
|
||||
fi
|
||||
|
||||
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
|
||||
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`libtoolize' installed to compile Mono."
|
||||
echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
}
|
||||
|
||||
grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
|
||||
grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
|
||||
(gettext --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`gettext' installed to compile Mono."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`automake' installed to compile Mono."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
NO_AUTOMAKE=yes
|
||||
}
|
||||
|
||||
|
||||
# if no automake, don't bother testing for aclocal
|
||||
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
|
||||
echo "installed doesn't appear recent enough."
|
||||
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test x$NOCONFIGURE = x && test -z "$*"; then
|
||||
echo "**Warning**: I am going to run \`configure' with no arguments."
|
||||
echo "If you wish to pass any to it, please specify them on the"
|
||||
echo \`$0\'" command line."
|
||||
echo
|
||||
fi
|
||||
|
||||
am_opt="--add-missing --copy --gnu -Wno-obsolete"
|
||||
|
||||
case $CC in
|
||||
xlc )
|
||||
am_opt="$am_opt --include-deps";;
|
||||
esac
|
||||
|
||||
if grep "^AC_PROG_LIBTOOL" configure.ac >/dev/null; then
|
||||
if test -z "$NO_LIBTOOLIZE" ; then
|
||||
echo "Running libtoolize..."
|
||||
$LIBTOOLIZE --force --copy
|
||||
fi
|
||||
fi
|
||||
|
||||
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -Wnone"
|
||||
echo "Running aclocal $ACLOCAL_FLAGS ..."
|
||||
aclocal $ACLOCAL_FLAGS || {
|
||||
echo
|
||||
echo "**Error**: aclocal failed. This may mean that you have not"
|
||||
echo "installed all of the packages you need, or you may need to"
|
||||
echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
|
||||
echo "for the prefix where you installed the packages whose"
|
||||
echo "macros were not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
|
||||
echo "Running autoheader..."
|
||||
autoheader || { echo "**Error**: autoheader failed."; exit 1; }
|
||||
fi
|
||||
|
||||
echo "Running automake $am_opt ..."
|
||||
automake $am_opt ||
|
||||
{ echo "**Error**: automake failed."; exit 1; }
|
||||
echo "Running autoconf ..."
|
||||
autoconf || { echo "**Error**: autoconf failed."; exit 1; }
|
||||
|
||||
|
||||
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||
|
||||
if test x$NOCONFIGURE = x; then
|
||||
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||
$srcdir/configure $conf_flags "$@" \
|
||||
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
|
||||
else
|
||||
echo Skipping configure process.
|
||||
fi
|
||||
@@ -1,467 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001 by Hewlett-Packard Company. 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 a full, though not well-tuned, representation of the
|
||||
* backwards points-to graph. This is used to test for non-GC-robust
|
||||
* data structures; the code is not used during normal garbage collection.
|
||||
*
|
||||
* One restriction is that we drop all back-edges from nodes with very
|
||||
* high in-degree, and simply add them add them to a list of such
|
||||
* nodes. They are then treated as permanent roots. Id this by itself
|
||||
* doesn't introduce a space leak, then such nodes can't contribute to
|
||||
* a growing space leak.
|
||||
*/
|
||||
|
||||
#ifdef MAKE_BACK_GRAPH
|
||||
|
||||
#define MAX_IN 10 /* Maximum in-degree we handle directly */
|
||||
|
||||
#include "private/dbg_mlc.h"
|
||||
#include <unistd.h>
|
||||
|
||||
#if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) || !defined(UNIX_LIKE)
|
||||
# error Configuration doesnt support MAKE_BACK_GRAPH
|
||||
#endif
|
||||
|
||||
/* We store single back pointers directly in the object's oh_bg_ptr field. */
|
||||
/* If there is more than one ptr to an object, we store q | FLAG_MANY, */
|
||||
/* where q is a pointer to a back_edges object. */
|
||||
/* Every once in a while we use a back_edges object even for a single */
|
||||
/* pointer, since we need the other fields in the back_edges structure to */
|
||||
/* be present in some fraction of the objects. Otherwise we get serious */
|
||||
/* performance issues. */
|
||||
#define FLAG_MANY 2
|
||||
|
||||
typedef struct back_edges_struct {
|
||||
word n_edges; /* Number of edges, including those in continuation */
|
||||
/* structures. */
|
||||
unsigned short flags;
|
||||
# define RETAIN 1 /* Directly points to a reachable object; */
|
||||
/* retain for next GC. */
|
||||
unsigned short height_gc_no;
|
||||
/* If height > 0, then the GC_gc_no value when it */
|
||||
/* was computed. If it was computed this cycle, then */
|
||||
/* it is current. If it was computed during the */
|
||||
/* last cycle, then it represents the old height, */
|
||||
/* which is only saved for live objects referenced by */
|
||||
/* dead ones. This may grow due to refs from newly */
|
||||
/* dead objects. */
|
||||
signed_word height;
|
||||
/* Longest path through unreachable nodes to this node */
|
||||
/* that we found using depth first search. */
|
||||
|
||||
# define HEIGHT_UNKNOWN ((signed_word)(-2))
|
||||
# define HEIGHT_IN_PROGRESS ((signed_word)(-1))
|
||||
ptr_t edges[MAX_IN];
|
||||
struct back_edges_struct *cont;
|
||||
/* Pointer to continuation structure; we use only the */
|
||||
/* edges field in the continuation. */
|
||||
/* also used as free list link. */
|
||||
} back_edges;
|
||||
|
||||
/* Allocate a new back edge structure. Should be more sophisticated */
|
||||
/* if this were production code. */
|
||||
#define MAX_BACK_EDGE_STRUCTS 100000
|
||||
static back_edges *back_edge_space = 0;
|
||||
int GC_n_back_edge_structs = 0; /* Serves as pointer to never used */
|
||||
/* back_edges space. */
|
||||
static back_edges *avail_back_edges = 0;
|
||||
/* Pointer to free list of deallocated */
|
||||
/* back_edges structures. */
|
||||
|
||||
static back_edges * new_back_edges(void)
|
||||
{
|
||||
if (0 == back_edge_space) {
|
||||
back_edge_space = (back_edges *)
|
||||
GET_MEM(MAX_BACK_EDGE_STRUCTS*sizeof(back_edges));
|
||||
}
|
||||
if (0 != avail_back_edges) {
|
||||
back_edges * result = avail_back_edges;
|
||||
avail_back_edges = result -> cont;
|
||||
result -> cont = 0;
|
||||
return result;
|
||||
}
|
||||
if (GC_n_back_edge_structs >= MAX_BACK_EDGE_STRUCTS - 1) {
|
||||
ABORT("needed too much space for back edges: adjust "
|
||||
"MAX_BACK_EDGE_STRUCTS");
|
||||
}
|
||||
return back_edge_space + (GC_n_back_edge_structs++);
|
||||
}
|
||||
|
||||
/* Deallocate p and its associated continuation structures. */
|
||||
static void deallocate_back_edges(back_edges *p)
|
||||
{
|
||||
back_edges *last = p;
|
||||
|
||||
while (0 != last -> cont) last = last -> cont;
|
||||
last -> cont = avail_back_edges;
|
||||
avail_back_edges = p;
|
||||
}
|
||||
|
||||
/* Table of objects that are currently on the depth-first search */
|
||||
/* stack. Only objects with in-degree one are in this table. */
|
||||
/* Other objects are identified using HEIGHT_IN_PROGRESS. */
|
||||
/* FIXME: This data structure NEEDS IMPROVEMENT. */
|
||||
#define INITIAL_IN_PROGRESS 10000
|
||||
static ptr_t * in_progress_space = 0;
|
||||
static size_t in_progress_size = 0;
|
||||
static size_t n_in_progress = 0;
|
||||
|
||||
static void push_in_progress(ptr_t p)
|
||||
{
|
||||
if (n_in_progress >= in_progress_size)
|
||||
if (in_progress_size == 0) {
|
||||
in_progress_size = INITIAL_IN_PROGRESS;
|
||||
in_progress_space = (ptr_t *)GET_MEM(in_progress_size * sizeof(ptr_t));
|
||||
} else {
|
||||
ptr_t * new_in_progress_space;
|
||||
in_progress_size *= 2;
|
||||
new_in_progress_space = (ptr_t *)
|
||||
GET_MEM(in_progress_size * sizeof(ptr_t));
|
||||
BCOPY(in_progress_space, new_in_progress_space,
|
||||
n_in_progress * sizeof(ptr_t));
|
||||
in_progress_space = new_in_progress_space;
|
||||
/* FIXME: This just drops the old space. */
|
||||
}
|
||||
if (in_progress_space == 0)
|
||||
ABORT("MAKE_BACK_GRAPH: Out of in-progress space: "
|
||||
"Huge linear data structure?");
|
||||
in_progress_space[n_in_progress++] = p;
|
||||
}
|
||||
|
||||
static GC_bool is_in_progress(ptr_t p)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < n_in_progress; ++i) {
|
||||
if (in_progress_space[i] == p) return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void pop_in_progress(ptr_t p)
|
||||
{
|
||||
--n_in_progress;
|
||||
GC_ASSERT(in_progress_space[n_in_progress] == p);
|
||||
}
|
||||
|
||||
#define GET_OH_BG_PTR(p) \
|
||||
(ptr_t)REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr)
|
||||
#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr) = HIDE_POINTER(q)
|
||||
|
||||
/* Execute s once for each predecessor q of p in the points-to graph. */
|
||||
/* s should be a bracketed statement. We declare q. */
|
||||
#define FOR_EACH_PRED(q, p, s) \
|
||||
{ \
|
||||
ptr_t q = GET_OH_BG_PTR(p); \
|
||||
if (!((word)q & FLAG_MANY)) { \
|
||||
if (q && !((word)q & 1)) s \
|
||||
/* !((word)q & 1) checks for a misnterpreted freelist link */ \
|
||||
} else { \
|
||||
back_edges *orig_be_ = (back_edges *)((word)q & ~FLAG_MANY); \
|
||||
back_edges *be_ = orig_be_; \
|
||||
int total_, local_; \
|
||||
int n_edges_ = be_ -> n_edges; \
|
||||
for (total_ = 0, local_ = 0; total_ < n_edges_; ++local_, ++total_) { \
|
||||
if (local_ == MAX_IN) { \
|
||||
be_ = be_ -> cont; \
|
||||
local_ = 0; \
|
||||
} \
|
||||
q = be_ -> edges[local_]; s \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/* Ensure that p has a back_edges structure associated with it. */
|
||||
static void ensure_struct(ptr_t p)
|
||||
{
|
||||
ptr_t old_back_ptr = GET_OH_BG_PTR(p);
|
||||
|
||||
if (!((word)old_back_ptr & FLAG_MANY)) {
|
||||
back_edges *be = new_back_edges();
|
||||
be -> flags = 0;
|
||||
if (0 == old_back_ptr) {
|
||||
be -> n_edges = 0;
|
||||
} else {
|
||||
be -> n_edges = 1;
|
||||
be -> edges[0] = old_back_ptr;
|
||||
}
|
||||
be -> height = HEIGHT_UNKNOWN;
|
||||
be -> height_gc_no = GC_gc_no - 1;
|
||||
GC_ASSERT(be >= back_edge_space);
|
||||
SET_OH_BG_PTR(p, (word)be | FLAG_MANY);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add the (forward) edge from p to q to the backward graph. Both p */
|
||||
/* q are pointers to the object base, i.e. pointers to an oh. */
|
||||
static void add_edge(ptr_t p, ptr_t q)
|
||||
{
|
||||
ptr_t old_back_ptr = GET_OH_BG_PTR(q);
|
||||
back_edges * be, *be_cont;
|
||||
word i;
|
||||
static unsigned random_number = 13;
|
||||
# define GOT_LUCKY_NUMBER (((++random_number) & 0x7f) == 0)
|
||||
/* A not very random number we use to occasionally allocate a */
|
||||
/* back_edges structure even for a single backward edge. This */
|
||||
/* prevents us from repeatedly tracing back through very long */
|
||||
/* chains, since we will have some place to store height and */
|
||||
/* in_progress flags along the way. */
|
||||
|
||||
GC_ASSERT(p == GC_base(p) && q == GC_base(q));
|
||||
if (!GC_HAS_DEBUG_INFO(q) || !GC_HAS_DEBUG_INFO(p)) {
|
||||
/* This is really a misinterpreted free list link, since we saw */
|
||||
/* a pointer to a free list. Dont overwrite it! */
|
||||
return;
|
||||
}
|
||||
if (0 == old_back_ptr) {
|
||||
SET_OH_BG_PTR(q, p);
|
||||
if (GOT_LUCKY_NUMBER) ensure_struct(q);
|
||||
return;
|
||||
}
|
||||
/* Check whether it was already in the list of predecessors. */
|
||||
FOR_EACH_PRED(pred, q, { if (p == pred) return; });
|
||||
ensure_struct(q);
|
||||
old_back_ptr = GET_OH_BG_PTR(q);
|
||||
be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY);
|
||||
for (i = be -> n_edges, be_cont = be; i > MAX_IN;
|
||||
be_cont = be_cont -> cont, i -= MAX_IN) {}
|
||||
if (i == MAX_IN) {
|
||||
be_cont -> cont = new_back_edges();
|
||||
be_cont = be_cont -> cont;
|
||||
i = 0;
|
||||
}
|
||||
be_cont -> edges[i] = p;
|
||||
be -> n_edges++;
|
||||
if (be -> n_edges == 100) {
|
||||
# if 0
|
||||
if (GC_print_stats) {
|
||||
GC_err_printf0("The following object has in-degree >= 100:\n");
|
||||
GC_print_heap_obj(q);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*per_object_func)(ptr_t p, word n_words, word gc_descr);
|
||||
|
||||
static void per_object_helper(struct hblk *h, word fn)
|
||||
{
|
||||
hdr * hhdr = HDR(h);
|
||||
word sz = hhdr -> hb_sz;
|
||||
word descr = hhdr -> hb_descr;
|
||||
per_object_func f = (per_object_func)fn;
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
f((ptr_t)(h -> hb_body + i), sz, descr);
|
||||
i += sz;
|
||||
} while (i + sz <= BYTES_TO_WORDS(HBLKSIZE));
|
||||
}
|
||||
|
||||
void GC_apply_to_each_object(per_object_func f)
|
||||
{
|
||||
GC_apply_to_all_blocks(per_object_helper, (word)f);
|
||||
}
|
||||
|
||||
static void reset_back_edge(ptr_t p, word n_words, word gc_descr)
|
||||
{
|
||||
/* Skip any free list links, or dropped blocks */
|
||||
if (GC_HAS_DEBUG_INFO(p)) {
|
||||
ptr_t old_back_ptr = GET_OH_BG_PTR(p);
|
||||
if ((word)old_back_ptr & FLAG_MANY) {
|
||||
back_edges *be = (back_edges *)((word)old_back_ptr & ~FLAG_MANY);
|
||||
if (!(be -> flags & RETAIN)) {
|
||||
deallocate_back_edges(be);
|
||||
SET_OH_BG_PTR(p, 0);
|
||||
} else {
|
||||
word *currentp;
|
||||
|
||||
GC_ASSERT(GC_is_marked(p));
|
||||
|
||||
/* Back edges may point to objects that will not be retained. */
|
||||
/* Delete them for now, but remember the height. */
|
||||
/* Some will be added back at next GC. */
|
||||
be -> n_edges = 0;
|
||||
if (0 != be -> cont) {
|
||||
deallocate_back_edges(be -> cont);
|
||||
be -> cont = 0;
|
||||
}
|
||||
|
||||
GC_ASSERT(GC_is_marked(p));
|
||||
|
||||
/* We only retain things for one GC cycle at a time. */
|
||||
be -> flags &= ~RETAIN;
|
||||
}
|
||||
} else /* Simple back pointer */ {
|
||||
/* Clear to avoid dangling pointer. */
|
||||
SET_OH_BG_PTR(p, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void add_back_edges(ptr_t p, word n_words, word gc_descr)
|
||||
{
|
||||
word *currentp = (word *)(p + sizeof(oh));
|
||||
|
||||
/* For now, fix up non-length descriptors conservatively. */
|
||||
if((gc_descr & GC_DS_TAGS) != GC_DS_LENGTH) {
|
||||
gc_descr = WORDS_TO_BYTES(n_words);
|
||||
}
|
||||
while (currentp < (word *)(p + gc_descr)) {
|
||||
word current = *currentp++;
|
||||
FIXUP_POINTER(current);
|
||||
if (current >= (word)GC_least_plausible_heap_addr &&
|
||||
current <= (word)GC_greatest_plausible_heap_addr) {
|
||||
ptr_t target = GC_base((GC_PTR)current);
|
||||
if (0 != target) {
|
||||
add_edge(p, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebuild the representation of the backward reachability graph. */
|
||||
/* Does not examine mark bits. Can be called before GC. */
|
||||
void GC_build_back_graph(void)
|
||||
{
|
||||
GC_apply_to_each_object(add_back_edges);
|
||||
}
|
||||
|
||||
/* Return an approximation to the length of the longest simple path */
|
||||
/* through unreachable objects to p. We refer to this as the height */
|
||||
/* of p. */
|
||||
static word backwards_height(ptr_t p)
|
||||
{
|
||||
word result;
|
||||
ptr_t back_ptr = GET_OH_BG_PTR(p);
|
||||
back_edges *be;
|
||||
|
||||
if (0 == back_ptr) return 1;
|
||||
if (!((word)back_ptr & FLAG_MANY)) {
|
||||
if (is_in_progress(p)) return 0; /* DFS back edge, i.e. we followed */
|
||||
/* an edge to an object already */
|
||||
/* on our stack: ignore */
|
||||
push_in_progress(p);
|
||||
result = backwards_height(back_ptr)+1;
|
||||
pop_in_progress(p);
|
||||
return result;
|
||||
}
|
||||
be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
|
||||
if (be -> height >= 0 && be -> height_gc_no == GC_gc_no)
|
||||
return be -> height;
|
||||
/* Ignore back edges in DFS */
|
||||
if (be -> height == HEIGHT_IN_PROGRESS) return 0;
|
||||
result = (be -> height > 0? be -> height : 1);
|
||||
be -> height = HEIGHT_IN_PROGRESS;
|
||||
FOR_EACH_PRED(q, p, {
|
||||
word this_height;
|
||||
if (GC_is_marked(q) && !(FLAG_MANY & (word)GET_OH_BG_PTR(p))) {
|
||||
if (GC_print_stats)
|
||||
GC_printf2("Found bogus pointer from 0x%lx to 0x%lx\n", q, p);
|
||||
/* Reachable object "points to" unreachable one. */
|
||||
/* Could be caused by our lax treatment of GC descriptors. */
|
||||
this_height = 1;
|
||||
} else {
|
||||
this_height = backwards_height(q);
|
||||
}
|
||||
if (this_height >= result) result = this_height + 1;
|
||||
});
|
||||
be -> height = result;
|
||||
be -> height_gc_no = GC_gc_no;
|
||||
return result;
|
||||
}
|
||||
|
||||
word GC_max_height;
|
||||
ptr_t GC_deepest_obj;
|
||||
|
||||
/* Compute the maximum height of every unreachable predecessor p of a */
|
||||
/* reachable object. Arrange to save the heights of all such objects p */
|
||||
/* so that they can be used in calculating the height of objects in the */
|
||||
/* next GC. */
|
||||
/* Set GC_max_height to be the maximum height we encounter, and */
|
||||
/* GC_deepest_obj to be the corresponding object. */
|
||||
static void update_max_height(ptr_t p, word n_words, word gc_descr)
|
||||
{
|
||||
if (GC_is_marked(p) && GC_HAS_DEBUG_INFO(p)) {
|
||||
int i;
|
||||
word p_height = 0;
|
||||
ptr_t p_deepest_obj = 0;
|
||||
ptr_t back_ptr;
|
||||
back_edges *be = 0;
|
||||
|
||||
/* If we remembered a height last time, use it as a minimum. */
|
||||
/* It may have increased due to newly unreachable chains pointing */
|
||||
/* to p, but it can't have decreased. */
|
||||
back_ptr = GET_OH_BG_PTR(p);
|
||||
if (0 != back_ptr && ((word)back_ptr & FLAG_MANY)) {
|
||||
be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
|
||||
if (be -> height != HEIGHT_UNKNOWN) p_height = be -> height;
|
||||
}
|
||||
FOR_EACH_PRED(q, p, {
|
||||
if (!GC_is_marked(q) && GC_HAS_DEBUG_INFO(q)) {
|
||||
word q_height;
|
||||
|
||||
q_height = backwards_height(q);
|
||||
if (q_height > p_height) {
|
||||
p_height = q_height;
|
||||
p_deepest_obj = q;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (p_height > 0) {
|
||||
/* Remember the height for next time. */
|
||||
if (be == 0) {
|
||||
ensure_struct(p);
|
||||
back_ptr = GET_OH_BG_PTR(p);
|
||||
be = (back_edges *)((word)back_ptr & ~FLAG_MANY);
|
||||
}
|
||||
be -> flags |= RETAIN;
|
||||
be -> height = p_height;
|
||||
be -> height_gc_no = GC_gc_no;
|
||||
}
|
||||
if (p_height > GC_max_height) {
|
||||
GC_max_height = p_height;
|
||||
GC_deepest_obj = p_deepest_obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
word GC_max_max_height = 0;
|
||||
|
||||
void GC_traverse_back_graph(void)
|
||||
{
|
||||
GC_max_height = 0;
|
||||
GC_apply_to_each_object(update_max_height);
|
||||
}
|
||||
|
||||
void GC_print_back_graph_stats(void)
|
||||
{
|
||||
GC_printf2("Maximum backwards height of reachable objects at GC %lu is %ld\n",
|
||||
(unsigned long) GC_gc_no, GC_max_height);
|
||||
if (GC_max_height > GC_max_max_height) {
|
||||
GC_max_max_height = GC_max_height;
|
||||
GC_printf0("The following unreachable object is last in a longest chain "
|
||||
"of unreachable objects:\n");
|
||||
GC_print_heap_obj(GC_deepest_obj);
|
||||
}
|
||||
if (GC_print_stats) {
|
||||
GC_printf1("Needed max total of %ld back-edge structs\n",
|
||||
GC_n_back_edge_structs);
|
||||
}
|
||||
GC_apply_to_each_object(reset_back_edge);
|
||||
GC_deepest_obj = 0;
|
||||
}
|
||||
|
||||
#endif /* MAKE_BACK_GRAPH */
|
||||
@@ -1,300 +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 "private/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, even though 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();
|
||||
|
||||
# if defined(__STDC__) || defined(__cplusplus)
|
||||
void GC_default_print_heap_obj_proc(ptr_t p)
|
||||
# else
|
||||
void GC_default_print_heap_obj_proc(p)
|
||||
ptr_t p;
|
||||
# endif
|
||||
{
|
||||
ptr_t base = GC_base(p);
|
||||
|
||||
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base));
|
||||
}
|
||||
|
||||
void (*GC_print_heap_obj) GC_PROTO((ptr_t p)) =
|
||||
GC_default_print_heap_obj_proc;
|
||||
|
||||
void GC_print_source_ptr(p)
|
||||
ptr_t p;
|
||||
{
|
||||
ptr_t base = GC_base(p);
|
||||
if (0 == base) {
|
||||
if (0 == p) {
|
||||
GC_err_printf0("in register");
|
||||
} else {
|
||||
GC_err_printf0("in root set");
|
||||
}
|
||||
} else {
|
||||
GC_err_printf0("in object at ");
|
||||
(*GC_print_heap_obj)(base);
|
||||
}
|
||||
}
|
||||
|
||||
void GC_bl_init()
|
||||
{
|
||||
if (!GC_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);
|
||||
}
|
||||
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;
|
||||
if (!GC_all_interior_pointers) {
|
||||
GC_clear_bl(very_old_normal_bl);
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (GC_black_list_spacing > MAXHINCR * HBLKSIZE) {
|
||||
GC_black_list_spacing = MAXHINCR * HBLKSIZE;
|
||||
/* Makes it easier to allocate really huge blocks, which otherwise */
|
||||
/* may have problems with nonuniform blacklist distributions. */
|
||||
/* This way we should always succeed immediately after growing the */
|
||||
/* heap. */
|
||||
}
|
||||
}
|
||||
|
||||
void GC_unpromote_black_lists()
|
||||
{
|
||||
if (!GC_all_interior_pointers) {
|
||||
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl);
|
||||
}
|
||||
GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl);
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
}
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
if (!GC_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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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/^ >/>/"
|
||||
@@ -1,199 +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 "private/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 10000
|
||||
|
||||
# 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 collector. */
|
||||
} 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);
|
||||
struct hblk *b;
|
||||
|
||||
if (pe -> block != 0 && pe -> block != h + OFFSET) ABORT("goofed");
|
||||
pe -> old_sum = pe -> new_sum;
|
||||
pe -> new_sum = GC_checksum(h);
|
||||
# if !defined(MSWIN32) && !defined(MSWINCE)
|
||||
if (pe -> new_sum != 0x80000000 && !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++;
|
||||
}
|
||||
b = h;
|
||||
while (IS_FORWARDING_ADDR_OR_NIL(hhdr) && hhdr != 0) {
|
||||
b -= (word)hhdr;
|
||||
hhdr = HDR(b);
|
||||
}
|
||||
if (pe -> new_valid
|
||||
&& hhdr != 0 && hhdr -> hb_descr != 0 /* may contain pointers */
|
||||
&& 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 ( 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 += HBLKSIZE-1;
|
||||
bytes &= ~(HBLKSIZE-1);
|
||||
GC_bytes_in_used_blocks += bytes;
|
||||
}
|
||||
|
||||
void GC_check_blocks()
|
||||
{
|
||||
word bytes_in_free_blocks = GC_large_free_bytes;
|
||||
|
||||
GC_bytes_in_used_blocks = 0;
|
||||
GC_apply_to_all_blocks(GC_add_block, (word)0);
|
||||
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 */
|
||||
@@ -1,569 +0,0 @@
|
||||
# Copyright (c) 1999-2001 by Red Hat, Inc. 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: Tom Tromey
|
||||
# Modified by: Grzegorz Jakacki <jakacki at acm dot org>
|
||||
|
||||
dnl Process this file with autoconf to produce configure.
|
||||
|
||||
AC_PREREQ([2.53])
|
||||
AC_INIT([libgc-mono], [6.6], [[email protected]])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 no-define foreign])
|
||||
AC_CONFIG_SRCDIR(gcj_mlc.c)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_SUBST(PACKAGE)
|
||||
AC_SUBST(GC_VERSION)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
dnl automake 1.6 and later need the AM_PROG_AS macro.
|
||||
ifdef([AM_PROG_AS],[AM_PROG_AS],[])
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :) # :)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
. [$]{srcdir}/configure.host
|
||||
|
||||
# We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
|
||||
# configure, because of autoconf brokeness
|
||||
if test "x$CPPFLAGS_FOR_LIBGC" != "x"; then
|
||||
CPPFLAGS=$CPPFLAGS_FOR_LIBGC
|
||||
fi
|
||||
if test "x$CFLAGS_FOR_LIBGC" != "x"; then
|
||||
CFLAGS=$CFLAGS_FOR_LIBGC
|
||||
fi
|
||||
|
||||
GC_CFLAGS=${gc_cflags}
|
||||
AC_SUBST(GC_CFLAGS)
|
||||
|
||||
case $enable_embed_check in
|
||||
no) ;;
|
||||
*) AC_MSG_ERROR([This module is now part of 'mono' and cannot be built as a stand-alone module any longer.]) ;;
|
||||
esac
|
||||
|
||||
THREADS=$with_libgc_threads
|
||||
|
||||
AC_ARG_ENABLE(win32-dllmain,
|
||||
[ --enable-win32-dllmain Define the DllMain function in win32_threads.c even if the collector is not built as a dll],
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(parallel-mark,
|
||||
[ --enable-parallel-mark parallelize marking and free list construction],
|
||||
[case "$THREADS" in
|
||||
no | none | single)
|
||||
AC_MSG_ERROR([Parallel mark requires --enable-threads=x spec])
|
||||
;;
|
||||
esac]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(cplusplus,
|
||||
[ --enable-cplusplus install C++ support],
|
||||
)
|
||||
|
||||
AM_CPPFLAGS=-I${srcdir}/include
|
||||
THREADDLLIBS=
|
||||
## Libraries needed to support dynamic loading and/or threads.
|
||||
case "$THREADS" in
|
||||
no | none | single)
|
||||
THREADS=none
|
||||
;;
|
||||
posix | pthreads)
|
||||
THREADS=posix
|
||||
AC_CHECK_LIB(pthread, pthread_self, THREADDLLIBS="-lpthread",,)
|
||||
case "$host" in
|
||||
x86-*-linux* | ia64-*-linux* | i386-*-linux* | i486-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* | alpha*-*-linux* | s390*-*-linux* | sparc*-*-linux* | powerpc-*-linux*)
|
||||
AC_DEFINE(GC_LINUX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
;;
|
||||
*-*-linux* | *-*-nacl*)
|
||||
AC_DEFINE(GC_LINUX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
*-*-aix*)
|
||||
AC_DEFINE(GC_AIX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
*-*-haiku*)
|
||||
AC_DEFINE(GC_HAIKU_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
*-*-hpux*)
|
||||
AC_MSG_WARN("Only HP/UX 11 threads are supported.")
|
||||
AC_DEFINE(GC_HPUX_THREADS)
|
||||
AC_DEFINE(_POSIX_C_SOURCE,199506L)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
THREADDLLIBS="-lpthread -lrt"
|
||||
;;
|
||||
*-*-kfreebsd*-gnu)
|
||||
AC_DEFINE(GC_FREEBSD_THREADS)
|
||||
INCLUDES="$INCLUDES -pthread"
|
||||
THREADDLLIBS=-pthread
|
||||
AC_DEFINE(_REENTRANT)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
AC_DEFINE(USE_COMPILER_TLS)
|
||||
;;
|
||||
*-*-freebsd*)
|
||||
AC_DEFINE(GC_FREEBSD_THREADS)
|
||||
if test "x$PTHREAD_CFLAGS" != "x"; then
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS $PTHREAD_CFLAGS"
|
||||
fi
|
||||
if test "x$PTHREAD_LIBS" = "x"; then
|
||||
THREADDLLIBS=-pthread
|
||||
else
|
||||
THREADDLLIBS="$PTHREAD_LIBS"
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
;;
|
||||
*-*-solaris*)
|
||||
AC_DEFINE(GC_SOLARIS_THREADS)
|
||||
AC_DEFINE(GC_SOLARIS_PTHREADS)
|
||||
;;
|
||||
*-*-irix*)
|
||||
AC_DEFINE(GC_IRIX_THREADS)
|
||||
;;
|
||||
*-*-cygwin*)
|
||||
AC_DEFINE(GC_WIN32_THREADS)
|
||||
;;
|
||||
*-*-darwin*)
|
||||
AC_DEFINE(GC_DARWIN_THREADS)
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
;;
|
||||
*-*-netbsd*)
|
||||
AC_DEFINE(GC_NETBSD_THREADS)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
;;
|
||||
*-*-openbsd*)
|
||||
AC_DEFINE(GC_OPENBSD_THREADS)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
;;
|
||||
*-*-osf*)
|
||||
AC_DEFINE(GC_OSF1_THREADS)
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
# May want to enable it in other cases, too.
|
||||
# Measurements havent yet been done.
|
||||
fi
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -pthread"
|
||||
THREADDLLIBS="-lpthread -lrt"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR("Pthreads not supported by the GC on this platform.")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
win32)
|
||||
AC_DEFINE(GC_WIN32_THREADS)
|
||||
dnl Wine getenv may not return NULL for missing entry
|
||||
AC_DEFINE(NO_GETENV)
|
||||
if test "${enable_win32_dllmain}" = yes; then
|
||||
AC_DEFINE(GC_INSIDE_DLL)
|
||||
fi
|
||||
;;
|
||||
dgux386)
|
||||
THREADS=dgux386
|
||||
AC_MSG_RESULT($THREADDLLIBS)
|
||||
# Use pthread GCC switch
|
||||
THREADDLLIBS=-pthread
|
||||
if test "${enable_parallel_mark}" = yes; then
|
||||
AC_DEFINE(PARALLEL_MARK)
|
||||
fi
|
||||
AC_DEFINE(THREAD_LOCAL_ALLOC)
|
||||
AC_DEFINE(GC_DGUX386_THREADS)
|
||||
AC_DEFINE(DGUX_THREADS)
|
||||
# Enable _POSIX4A_DRAFT10_SOURCE with flag -pthread
|
||||
AM_CPPFLAGS="-pthread $AM_CPPFLAGS"
|
||||
;;
|
||||
aix)
|
||||
THREADS=posix
|
||||
THREADDLLIBS=-lpthread
|
||||
AC_DEFINE(GC_AIX_THREADS)
|
||||
AC_DEFINE(_REENTRANT)
|
||||
;;
|
||||
decosf1 | irix | mach | os2 | solaris | dce | vxworks)
|
||||
AC_MSG_ERROR(thread package $THREADS not yet supported)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR($THREADS is an unknown thread package)
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(THREADDLLIBS)
|
||||
|
||||
case "$host" in
|
||||
powerpc-*-darwin*)
|
||||
powerpc_darwin=true
|
||||
;;
|
||||
esac
|
||||
AM_CONDITIONAL(POWERPC_DARWIN,test x$powerpc_darwin = xtrue)
|
||||
|
||||
# Check if the GCC builtin __sync_bool_compare_and_swap is available.
|
||||
# It is preferred in gc_locks.h for PPC as GCC 4.4 has a problem with the inline assembly there.
|
||||
AC_MSG_CHECKING(for __sync_bool_compare_and_swap)
|
||||
AC_TRY_COMPILE([],[
|
||||
volatile unsigned int foo = 0;
|
||||
unsigned int r1 = __sync_bool_compare_and_swap(&foo, 0, 1);
|
||||
return 0;
|
||||
], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAS___SYNC_BOOL_COMPARE_AND_SWAP)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING(for xlc)
|
||||
AC_TRY_COMPILE([],[
|
||||
#ifndef __xlC__
|
||||
# error
|
||||
#endif
|
||||
], [compiler_xlc=yes], [compiler_xlc=no])
|
||||
AC_MSG_RESULT($compiler_xlc)
|
||||
AM_CONDITIONAL(COMPILER_XLC,test $compiler_xlc = yes)
|
||||
if test $compiler_xlc = yes -a "$powerpc_darwin" = true; then
|
||||
# the darwin stack-frame-walking code is completely broken on xlc
|
||||
AC_DEFINE(DARWIN_DONT_PARSE_STACK)
|
||||
fi
|
||||
|
||||
# We never want libdl on darwin. It is a fake libdl that just ends up making
|
||||
# dyld calls anyway
|
||||
case "$host" in
|
||||
*-*-darwin*) ;;
|
||||
*)
|
||||
AC_CHECK_LIB(dl, dlopen, THREADDLLIBS="$THREADDLLIBS -ldl")
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_SUBST(EXTRA_TEST_LIBS)
|
||||
|
||||
target_all=libgc.la
|
||||
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=
|
||||
addlibs=
|
||||
addincludes=
|
||||
addtests=
|
||||
CXXAM_CPPFLAGS=
|
||||
case "$TARGET_ECOS" in
|
||||
no)
|
||||
;;
|
||||
*)
|
||||
AC_DEFINE(ECOS)
|
||||
CXXINCLUDES="-I${TARGET_ECOS}/include"
|
||||
addobjs="$addobjs ecos.lo"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "${enable_cplusplus}" = yes; then
|
||||
addincludes="$addincludes include/gc_cpp.h include/gc_allocator.h"
|
||||
addtests="$addtests test_cpp"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(CPLUSPLUS, test "${enable_cplusplus}" = yes)
|
||||
|
||||
AC_SUBST(CXX)
|
||||
|
||||
AC_SUBST(AM_CPPFLAGS)
|
||||
AC_SUBST(CXXINCLUDES)
|
||||
|
||||
# Configuration of shared libraries
|
||||
#
|
||||
AC_MSG_CHECKING(whether to build shared libraries)
|
||||
AC_ENABLE_SHARED
|
||||
|
||||
case "$host" in
|
||||
alpha-*-openbsd*)
|
||||
enable_shared=no
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac
|
||||
|
||||
# Configuration of machine-dependent code
|
||||
#
|
||||
AC_MSG_CHECKING(which machine-dependent code should be used)
|
||||
machdep=
|
||||
case "$host" in
|
||||
alpha-*-openbsd*)
|
||||
machdep="alpha_mach_dep.lo"
|
||||
if test x"${ac_cv_lib_dl_dlopen}" != xyes ; then
|
||||
AC_MSG_WARN(OpenBSD/Alpha without dlopen(). Shared library support is disabled)
|
||||
fi
|
||||
;;
|
||||
alpha*-*-linux*)
|
||||
machdep="alpha_mach_dep.lo"
|
||||
;;
|
||||
i?86-*-solaris2.[[89]] | i?86-*-solaris2.1?)
|
||||
AC_DEFINE(SOLARIS25_PROC_VDB_BUG_FIXED)
|
||||
;;
|
||||
mipstx39-*-elf*)
|
||||
machdep="mips_ultrix_mach_dep.lo"
|
||||
AC_DEFINE(STACKBASE, __stackbase)
|
||||
AC_DEFINE(DATASTART_IS_ETEXT)
|
||||
;;
|
||||
mips-dec-ultrix*)
|
||||
machdep="mips_ultrix_mach-dep.lo"
|
||||
;;
|
||||
mips-nec-sysv*|mips-unknown-sysv*)
|
||||
;;
|
||||
mips*-*-linux*)
|
||||
;;
|
||||
mips-*-*)
|
||||
machdep="mips_sgi_mach_dep.lo"
|
||||
AC_DEFINE(NO_EXECUTE_PERMISSION)
|
||||
;;
|
||||
sparc-*-netbsd*)
|
||||
machdep="sparc_netbsd_mach_dep.lo"
|
||||
;;
|
||||
sparc-sun-solaris2.3)
|
||||
machdep="sparc_mach_dep.lo"
|
||||
AC_DEFINE(SUNOS53_SHARED_LIB)
|
||||
;;
|
||||
sparc*-sun-solaris2.*)
|
||||
machdep="sparc_mach_dep.lo"
|
||||
;;
|
||||
ia64-*-*)
|
||||
machdep="mach_dep.lo ia64_save_regs_in_stack.lo"
|
||||
target_ia64=true
|
||||
;;
|
||||
*-*-nacl*)
|
||||
AC_DEFINE(NO_EXECUTE_PERMISSION)
|
||||
;;
|
||||
esac
|
||||
if test x"$machdep" = x; then
|
||||
AC_MSG_RESULT($machdep)
|
||||
machdep="mach_dep.lo"
|
||||
fi
|
||||
addobjs="$addobjs $machdep"
|
||||
#
|
||||
# Adding object files directly to _LIBADD breaks -j builds, so we need to add the sources
|
||||
# instead, but _SOURCES can't contain autoconf substitutions, so add them using automake
|
||||
# conditionals.
|
||||
#
|
||||
#AC_SUBST(addobjs)
|
||||
AC_SUBST(addincludes)
|
||||
AC_SUBST(addlibs)
|
||||
AC_SUBST(addtests)
|
||||
|
||||
AM_CONDITIONAL(TARGET_IA64,test x$target_ia64 = xtrue)
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
|
||||
DOLT
|
||||
|
||||
#
|
||||
# Check for AViiON Machines running DGUX
|
||||
#
|
||||
ac_is_dgux=no
|
||||
AC_CHECK_HEADER(sys/dg_sys_info.h,
|
||||
[ac_is_dgux=yes;])
|
||||
|
||||
## :GOTCHA: we do not check anything but sys/dg_sys_info.h
|
||||
if test $ac_is_dgux = yes; then
|
||||
if test "$enable_full_debug" = "yes"; then
|
||||
CFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
|
||||
CXXFLAGS="-g -mstandard -DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
|
||||
else
|
||||
CFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
|
||||
CXXFLAGS="-DDGUX -D_DGUX_SOURCE -Di386 -mno-legend -O2"
|
||||
fi
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CXXFLAGS)
|
||||
fi
|
||||
|
||||
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])
|
||||
|
||||
# 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 false; then
|
||||
# autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
|
||||
# to nothing, so nothing would remain between `then' and `fi' if it
|
||||
# were not for the `:' below.
|
||||
:
|
||||
AC_EXEEXT
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for threads package to use])
|
||||
AC_MSG_RESULT($THREADS)
|
||||
|
||||
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.
|
||||
dnl Not needed anymore on Solaris.
|
||||
AC_MSG_CHECKING(whether Solaris gcc optimization fix is necessary)
|
||||
case "$host" in
|
||||
*aix*)
|
||||
if test "$GCC" = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
new_CFLAGS=
|
||||
for i in $CFLAGS; do
|
||||
case "$i" in
|
||||
-O*)
|
||||
;;
|
||||
*)
|
||||
new_CFLAGS="$new_CFLAGS $i"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
CFLAGS="$new_CFLAGS"
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
*) AC_MSG_RESULT(no) ;;
|
||||
esac
|
||||
|
||||
dnl We need to override the top-level CFLAGS. This is how we do it.
|
||||
MY_CFLAGS="$CFLAGS"
|
||||
AC_SUBST(MY_CFLAGS)
|
||||
|
||||
dnl Include defines that have become de facto standard.
|
||||
dnl ALL_INTERIOR_POINTERS can be overridden in startup code.
|
||||
AC_DEFINE(SILENT)
|
||||
AC_DEFINE(NO_SIGNALS)
|
||||
AC_DEFINE(NO_EXECUTE_PERMISSION)
|
||||
dnl AC_DEFINE(ALL_INTERIOR_POINTERS)
|
||||
|
||||
dnl By default, make the library as general as possible.
|
||||
AC_DEFINE(JAVA_FINALIZATION)
|
||||
AC_DEFINE(GC_GCJ_SUPPORT)
|
||||
AC_DEFINE(ATOMIC_UNCOLLECTABLE)
|
||||
|
||||
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)
|
||||
AC_DEFINE(NO_DEBUGGING)
|
||||
fi
|
||||
|
||||
UNWINDLIBS=
|
||||
AC_ARG_ENABLE(full-debug,
|
||||
[ --enable-full-debug include full support for pointer backtracing etc.],
|
||||
[ if test "$enable_full_debug" = "yes"; then
|
||||
AC_MSG_WARN("Should define GC_DEBUG and use debug alloc. in clients.")
|
||||
AC_DEFINE(KEEP_BACK_PTRS)
|
||||
AC_DEFINE(DBG_HDRS_ALL)
|
||||
case $host in
|
||||
ia64-*-linux* )
|
||||
AC_DEFINE(MAKE_BACK_GRAPH)
|
||||
AC_DEFINE(SAVE_CALL_COUNT, 8)
|
||||
AC_CHECK_LIB(unwind, backtrace, [
|
||||
AC_DEFINE(GC_HAVE_BUILTIN_BACKTRACE)
|
||||
UNWINDLIBS=-lunwind
|
||||
AC_MSG_WARN("Client code may need to link against libunwind.")
|
||||
])
|
||||
;;
|
||||
x86-*-linux* | i586-*-linux* | i686-*-linux* | x86_64-*-linux* )
|
||||
AC_DEFINE(MAKE_BACK_GRAPH)
|
||||
AC_MSG_WARN("Client must not use -fomit-frame-pointer.")
|
||||
AC_DEFINE(SAVE_CALL_COUNT, 8)
|
||||
;;
|
||||
i[3456]86-*-dgux*)
|
||||
AC_DEFINE(MAKE_BACK_GRAPH)
|
||||
;;
|
||||
esac ]
|
||||
fi)
|
||||
|
||||
AC_SUBST(UNWINDLIBS)
|
||||
|
||||
AC_ARG_ENABLE(redirect-malloc,
|
||||
[ --enable-redirect-malloc redirect malloc and friends to GC routines])
|
||||
|
||||
if test "${enable_redirect_malloc}" = yes; then
|
||||
if test "${enable_full_debug}" = yes; then
|
||||
AC_DEFINE(REDIRECT_MALLOC, GC_debug_malloc_replacement)
|
||||
AC_DEFINE(REDIRECT_REALLOC, GC_debug_realloc_replacement)
|
||||
AC_DEFINE(REDIRECT_FREE, GC_debug_free)
|
||||
else
|
||||
AC_DEFINE(REDIRECT_MALLOC, GC_malloc)
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_DEFINE(_IN_LIBGC)
|
||||
|
||||
AC_ARG_ENABLE(gc-assertions,
|
||||
[ --enable-gc-assertions collector-internal assertion checking])
|
||||
if test "${enable_gc_assertions}" = yes; then
|
||||
AC_DEFINE(GC_ASSERTIONS)
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(quiet-build, [ --enable-quiet-build Enable quiet libgc build (on by default)], enable_quiet_build=$enableval, enable_quiet_build=yes)
|
||||
AM_CONDITIONAL(USE_LIBDIR, test -z "$with_cross_host")
|
||||
|
||||
AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
|
||||
if test x$werror_flag = xyes; then
|
||||
WERROR_CFLAGS="-Werror"
|
||||
fi
|
||||
AC_SUBST([WERROR_CFLAGS])
|
||||
|
||||
if test "${multilib}" = "yes"; then
|
||||
multilib_arg="--enable-multilib"
|
||||
else
|
||||
multilib_arg=
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile
|
||||
m4/Makefile
|
||||
include/Makefile
|
||||
include/private/Makefile
|
||||
doc/Makefile,,
|
||||
srcdir=${srcdir}
|
||||
host=${host}
|
||||
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
CC="${CC}"
|
||||
DEFS="$DEFS"
|
||||
)
|
||||
@@ -1,59 +0,0 @@
|
||||
# configure.host
|
||||
|
||||
# This shell script handles all host based configuration for the garbage
|
||||
# collector.
|
||||
# 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", "")
|
||||
# GCC should be "yes" if using gcc
|
||||
|
||||
# It sets the following shell variables:
|
||||
# gc_cflags Special CFLAGS to use when building
|
||||
|
||||
gc_cflags=""
|
||||
|
||||
if test :"$GCC": = :yes: ; then
|
||||
:
|
||||
else
|
||||
case "$host" in
|
||||
hppa*-*-hpux* )
|
||||
if test :$GCC: != :"yes": ; then
|
||||
gc_cflags="${gc_flags} +ESdbgasm"
|
||||
fi
|
||||
# :TODO: actaully we should check using Autoconf if
|
||||
# the compiler supports this option.
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "${target_optspace}:${host}" in
|
||||
yes:*)
|
||||
gc_cflags="${gc_cflags} -Os"
|
||||
;;
|
||||
:m32r-* | :d10v-* | :d30v-*)
|
||||
gc_cflags="${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-*)
|
||||
gc_cflags="${gc_cflags} -G 0"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
@@ -1,919 +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 ([email protected])
|
||||
*/
|
||||
/* 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;
|
||||
if (depth >= MAX_DEPTH) {
|
||||
return(CORD_balance((CORD)result));
|
||||
} else {
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1,396 +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 = 0;
|
||||
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;
|
||||
|
||||
c = (char)va_arg(args, int);
|
||||
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;
|
||||
int max_size = 0;
|
||||
int res;
|
||||
# ifdef __va_copy
|
||||
__va_copy(vsprintf_args, args);
|
||||
# else
|
||||
# if defined(__GNUC__) && !defined(__DJGPP__) /* and probably in other cases */
|
||||
va_copy(vsprintf_args, args);
|
||||
# else
|
||||
vsprintf_args = args;
|
||||
# endif
|
||||
# endif
|
||||
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);
|
||||
}
|
||||
@@ -1,235 +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 "gc.h" /* For GC_INIT() only */
|
||||
# include "cord.h"
|
||||
# include <string.h>
|
||||
# include <stdio.h>
|
||||
# include <stdlib.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__) || defined(__DJGPP__)
|
||||
# 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");
|
||||
# ifdef __DJGPP__
|
||||
/* FIXME: DJGPP workaround. Why does this help? */
|
||||
if (fflush(f) != 0) ABORT("fflush failed");
|
||||
# endif
|
||||
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");
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
# ifdef THINK_C
|
||||
printf("cordtest:\n");
|
||||
# endif
|
||||
GC_INIT();
|
||||
test_basics();
|
||||
test_extras();
|
||||
test_printf();
|
||||
CORD_fprintf(stderr, "SUCCEEDED\n");
|
||||
return(0);
|
||||
}
|
||||
@@ -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 ([email protected])
|
||||
*/
|
||||
/*
|
||||
* 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 |= (unsigned char)s_start[i];
|
||||
x_buf <<= 8;
|
||||
x_buf |= (unsigned char)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 |= (unsigned char)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));
|
||||
}
|
||||
}
|
||||
-603
@@ -1,603 +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 ([email protected])
|
||||
*/
|
||||
/*
|
||||
* 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;
|
||||
|
||||
#if defined(MACINTOSH)
|
||||
console_options.title = "\pDumb Editor";
|
||||
cshow(stdout);
|
||||
argc = ccommand(&argv);
|
||||
#endif
|
||||
GC_INIT();
|
||||
|
||||
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 */
|
||||
@@ -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 |
@@ -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
|
||||
|
||||
@@ -1,366 +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 ([email protected]), 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);
|
||||
GC_win32_free_heap();
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
@@ -1,736 +0,0 @@
|
||||
#include "private/pthread_support.h"
|
||||
|
||||
# if defined(GC_DARWIN_THREADS)
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include "mono/utils/mono-compiler.h"
|
||||
|
||||
/* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple
|
||||
Page 49:
|
||||
"The space beneath the stack pointer, where a new stack frame would normally
|
||||
be allocated, is called the red zone. This area as shown in Figure 3-2 may
|
||||
be used for any purpose as long as a new stack frame does not need to be
|
||||
added to the stack."
|
||||
|
||||
Page 50: "If a leaf procedure's red zone usage would exceed 224 bytes, then
|
||||
it must set up a stack frame just like routines that call other routines."
|
||||
*/
|
||||
#ifdef POWERPC
|
||||
# if CPP_WORDSZ == 32
|
||||
# define PPC_RED_ZONE_SIZE 224
|
||||
# elif CPP_WORDSZ == 64
|
||||
# define PPC_RED_ZONE_SIZE 320
|
||||
# endif
|
||||
#endif
|
||||
|
||||
typedef struct StackFrame {
|
||||
unsigned long savedSP;
|
||||
unsigned long savedCR;
|
||||
unsigned long savedLR;
|
||||
unsigned long reserved[2];
|
||||
unsigned long savedRTOC;
|
||||
} StackFrame;
|
||||
|
||||
unsigned long FindTopOfStack(unsigned int stack_start) {
|
||||
StackFrame *frame;
|
||||
|
||||
if (stack_start == 0) {
|
||||
# ifdef POWERPC
|
||||
# if CPP_WORDSZ == 32
|
||||
__asm__ volatile("lwz %0,0(r1)" : "=r" (frame));
|
||||
# else
|
||||
__asm__ volatile("ldz %0,0(r1)" : "=r" (frame));
|
||||
# endif
|
||||
# endif
|
||||
} else {
|
||||
frame = (StackFrame *)stack_start;
|
||||
}
|
||||
|
||||
# ifdef DEBUG_THREADS
|
||||
/* GC_printf1("FindTopOfStack start at sp = %p\n", frame); */
|
||||
# endif
|
||||
do {
|
||||
if (frame->savedSP == 0) break;
|
||||
/* if there are no more stack frames, stop */
|
||||
|
||||
frame = (StackFrame*)frame->savedSP;
|
||||
|
||||
/* we do these next two checks after going to the next frame
|
||||
because the LR for the first stack frame in the loop
|
||||
is not set up on purpose, so we shouldn't check it. */
|
||||
if ((frame->savedLR & ~3) == 0) break; /* if the next LR is bogus, stop */
|
||||
if ((~(frame->savedLR) & ~3) == 0) break; /* ditto */
|
||||
} while (1);
|
||||
|
||||
# ifdef DEBUG_THREADS
|
||||
/* GC_printf1("FindTopOfStack finish at sp = %p\n", frame); */
|
||||
# endif
|
||||
|
||||
return (unsigned long)frame;
|
||||
}
|
||||
|
||||
#ifdef DARWIN_DONT_PARSE_STACK
|
||||
void GC_push_all_stacks() {
|
||||
int i;
|
||||
kern_return_t r;
|
||||
GC_thread p;
|
||||
pthread_t me;
|
||||
ptr_t lo, hi, altstack_lo, altstack_hi;
|
||||
#if defined(POWERPC)
|
||||
ppc_thread_state_t state;
|
||||
mach_msg_type_number_t thread_state_count = PPC_THREAD_STATE_COUNT;
|
||||
#elif defined(I386)
|
||||
i386_thread_state_t state;
|
||||
mach_msg_type_number_t thread_state_count = i386_THREAD_STATE_COUNT;
|
||||
#elif defined(ARM)
|
||||
arm_thread_state_t state;
|
||||
mach_msg_type_number_t thread_state_count = ARM_THREAD_STATE_COUNT;
|
||||
#elif defined(X86_64)
|
||||
x86_thread_state64_t state;
|
||||
mach_msg_type_number_t thread_state_count = x86_THREAD_STATE64_COUNT;
|
||||
#else
|
||||
# error FIXME for non-x86 || ppc architectures
|
||||
mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT;
|
||||
#endif
|
||||
|
||||
me = pthread_self();
|
||||
if (!GC_thr_initialized) GC_thr_init();
|
||||
|
||||
for(i=0;i<THREAD_TABLE_SZ;i++) {
|
||||
for(p=GC_threads[i];p!=0;p=p->next) {
|
||||
if(p -> flags & FINISHED) continue;
|
||||
if(pthread_equal(p->id,me)) {
|
||||
lo = GC_approx_sp();
|
||||
} else {
|
||||
/* Get the thread state (registers, etc) */
|
||||
r = thread_get_state(
|
||||
p->stop_info.mach_thread,
|
||||
GC_MACH_THREAD_STATE_FLAVOR,
|
||||
(natural_t*)&state,
|
||||
&thread_state_count);
|
||||
if(r != KERN_SUCCESS) continue;
|
||||
|
||||
#if defined(I386)
|
||||
#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
|
||||
lo = state.__esp;
|
||||
|
||||
GC_push_one(state.__eax);
|
||||
GC_push_one(state.__ebx);
|
||||
GC_push_one(state.__ecx);
|
||||
GC_push_one(state.__edx);
|
||||
GC_push_one(state.__edi);
|
||||
GC_push_one(state.__esi);
|
||||
GC_push_one(state.__ebp);
|
||||
#else
|
||||
lo = state.esp;
|
||||
|
||||
GC_push_one(state.eax);
|
||||
GC_push_one(state.ebx);
|
||||
GC_push_one(state.ecx);
|
||||
GC_push_one(state.edx);
|
||||
GC_push_one(state.edi);
|
||||
GC_push_one(state.esi);
|
||||
GC_push_one(state.ebp);
|
||||
#endif
|
||||
#elif defined(X86_64)
|
||||
lo = state.__rsp;
|
||||
GC_push_one(state.__rax);
|
||||
GC_push_one(state.__rbx);
|
||||
GC_push_one(state.__rcx);
|
||||
GC_push_one(state.__rdx);
|
||||
GC_push_one(state.__rdi);
|
||||
GC_push_one(state.__rsi);
|
||||
GC_push_one(state.__rbp);
|
||||
GC_push_one(state.__r8);
|
||||
GC_push_one(state.__r9);
|
||||
GC_push_one(state.__r10);
|
||||
GC_push_one(state.__r11);
|
||||
GC_push_one(state.__r12);
|
||||
GC_push_one(state.__r13);
|
||||
GC_push_one(state.__r14);
|
||||
GC_push_one(state.__r15);
|
||||
#elif defined(POWERPC)
|
||||
#if defined(_STRUCT_PPC_EXCEPTION_STATE) && defined(__DARWIN_UNIX03)
|
||||
lo = (void*)(state.__r1 - PPC_RED_ZONE_SIZE);
|
||||
|
||||
GC_push_one(state.__r0);
|
||||
GC_push_one(state.__r2);
|
||||
GC_push_one(state.__r3);
|
||||
GC_push_one(state.__r4);
|
||||
GC_push_one(state.__r5);
|
||||
GC_push_one(state.__r6);
|
||||
GC_push_one(state.__r7);
|
||||
GC_push_one(state.__r8);
|
||||
GC_push_one(state.__r9);
|
||||
GC_push_one(state.__r10);
|
||||
GC_push_one(state.__r11);
|
||||
GC_push_one(state.__r12);
|
||||
GC_push_one(state.__r13);
|
||||
GC_push_one(state.__r14);
|
||||
GC_push_one(state.__r15);
|
||||
GC_push_one(state.__r16);
|
||||
GC_push_one(state.__r17);
|
||||
GC_push_one(state.__r18);
|
||||
GC_push_one(state.__r19);
|
||||
GC_push_one(state.__r20);
|
||||
GC_push_one(state.__r21);
|
||||
GC_push_one(state.__r22);
|
||||
GC_push_one(state.__r23);
|
||||
GC_push_one(state.__r24);
|
||||
GC_push_one(state.__r25);
|
||||
GC_push_one(state.__r26);
|
||||
GC_push_one(state.__r27);
|
||||
GC_push_one(state.__r28);
|
||||
GC_push_one(state.__r29);
|
||||
GC_push_one(state.__r30);
|
||||
GC_push_one(state.__r31);
|
||||
#else
|
||||
lo = (void*)(state.r1 - PPC_RED_ZONE_SIZE);
|
||||
|
||||
GC_push_one(state.r0);
|
||||
GC_push_one(state.r2);
|
||||
GC_push_one(state.r3);
|
||||
GC_push_one(state.r4);
|
||||
GC_push_one(state.r5);
|
||||
GC_push_one(state.r6);
|
||||
GC_push_one(state.r7);
|
||||
GC_push_one(state.r8);
|
||||
GC_push_one(state.r9);
|
||||
GC_push_one(state.r10);
|
||||
GC_push_one(state.r11);
|
||||
GC_push_one(state.r12);
|
||||
GC_push_one(state.r13);
|
||||
GC_push_one(state.r14);
|
||||
GC_push_one(state.r15);
|
||||
GC_push_one(state.r16);
|
||||
GC_push_one(state.r17);
|
||||
GC_push_one(state.r18);
|
||||
GC_push_one(state.r19);
|
||||
GC_push_one(state.r20);
|
||||
GC_push_one(state.r21);
|
||||
GC_push_one(state.r22);
|
||||
GC_push_one(state.r23);
|
||||
GC_push_one(state.r24);
|
||||
GC_push_one(state.r25);
|
||||
GC_push_one(state.r26);
|
||||
GC_push_one(state.r27);
|
||||
GC_push_one(state.r28);
|
||||
GC_push_one(state.r29);
|
||||
GC_push_one(state.r30);
|
||||
GC_push_one(state.r31);
|
||||
#endif
|
||||
#elif defined(ARM)
|
||||
lo = (void*)state.__sp;
|
||||
|
||||
GC_push_one(state.__r[0]);
|
||||
GC_push_one(state.__r[1]);
|
||||
GC_push_one(state.__r[2]);
|
||||
GC_push_one(state.__r[3]);
|
||||
GC_push_one(state.__r[4]);
|
||||
GC_push_one(state.__r[5]);
|
||||
GC_push_one(state.__r[6]);
|
||||
GC_push_one(state.__r[7]);
|
||||
GC_push_one(state.__r[8]);
|
||||
GC_push_one(state.__r[9]);
|
||||
GC_push_one(state.__r[10]);
|
||||
GC_push_one(state.__r[11]);
|
||||
GC_push_one(state.__r[12]);
|
||||
/* GC_push_one(state.__sp); */
|
||||
GC_push_one(state.__lr);
|
||||
GC_push_one(state.__pc);
|
||||
GC_push_one(state.__cpsr);
|
||||
#else
|
||||
# error FIXME for non-x86 || ppc architectures
|
||||
#endif
|
||||
} /* p != me */
|
||||
if(p->flags & MAIN_THREAD)
|
||||
hi = GC_stackbottom;
|
||||
else
|
||||
hi = p->stack_end;
|
||||
|
||||
if (p->altstack && lo >= p->altstack && lo <= p->altstack + p->altstack_size) {
|
||||
altstack_lo = lo;
|
||||
altstack_hi = p->altstack + p->altstack_size;
|
||||
lo = (char*)p->stack;
|
||||
hi = (char*)p->stack + p->stack_size;
|
||||
} else {
|
||||
altstack_lo = NULL;
|
||||
}
|
||||
|
||||
#if DEBUG_THREADS
|
||||
GC_printf3("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n",
|
||||
(unsigned long) p -> id,
|
||||
(unsigned long) lo,
|
||||
(unsigned long) hi
|
||||
);
|
||||
#endif
|
||||
if (lo)
|
||||
GC_push_all_stack(lo,hi);
|
||||
if (altstack_lo)
|
||||
GC_push_all_stack(altstack_lo,altstack_hi);
|
||||
} /* for(p=GC_threads[i]...) */
|
||||
} /* for(i=0;i<THREAD_TABLE_SZ...) */
|
||||
}
|
||||
|
||||
#else /* !DARWIN_DONT_PARSE_STACK; Use FindTopOfStack() */
|
||||
|
||||
void GC_push_all_stacks() {
|
||||
int i;
|
||||
task_t my_task;
|
||||
kern_return_t r;
|
||||
mach_port_t me;
|
||||
ptr_t lo, hi;
|
||||
thread_act_array_t act_list = 0;
|
||||
mach_msg_type_number_t listcount = 0;
|
||||
|
||||
me = mach_thread_self();
|
||||
if (!GC_thr_initialized) GC_thr_init();
|
||||
|
||||
my_task = current_task();
|
||||
r = task_threads(my_task, &act_list, &listcount);
|
||||
if(r != KERN_SUCCESS) ABORT("task_threads failed");
|
||||
for(i = 0; i < listcount; i++) {
|
||||
thread_act_t thread = act_list[i];
|
||||
if (thread == me) {
|
||||
lo = GC_approx_sp();
|
||||
hi = (ptr_t)FindTopOfStack(0);
|
||||
} else {
|
||||
# if defined(POWERPC)
|
||||
# if CPP_WORDSZ == 32
|
||||
ppc_thread_state_t info;
|
||||
# else
|
||||
ppc_thread_state64_t info;
|
||||
# endif
|
||||
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
|
||||
r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
|
||||
(natural_t *)&info, &outCount);
|
||||
if(r != KERN_SUCCESS) continue;
|
||||
|
||||
#if defined(_STRUCT_PPC_EXCEPTION_STATE)
|
||||
lo = (void*)(info.__r1 - PPC_RED_ZONE_SIZE);
|
||||
hi = (ptr_t)FindTopOfStack(info.__r1);
|
||||
|
||||
GC_push_one(info.__r0);
|
||||
GC_push_one(info.__r2);
|
||||
GC_push_one(info.__r3);
|
||||
GC_push_one(info.__r4);
|
||||
GC_push_one(info.__r5);
|
||||
GC_push_one(info.__r6);
|
||||
GC_push_one(info.__r7);
|
||||
GC_push_one(info.__r8);
|
||||
GC_push_one(info.__r9);
|
||||
GC_push_one(info.__r10);
|
||||
GC_push_one(info.__r11);
|
||||
GC_push_one(info.__r12);
|
||||
GC_push_one(info.__r13);
|
||||
GC_push_one(info.__r14);
|
||||
GC_push_one(info.__r15);
|
||||
GC_push_one(info.__r16);
|
||||
GC_push_one(info.__r17);
|
||||
GC_push_one(info.__r18);
|
||||
GC_push_one(info.__r19);
|
||||
GC_push_one(info.__r20);
|
||||
GC_push_one(info.__r21);
|
||||
GC_push_one(info.__r22);
|
||||
GC_push_one(info.__r23);
|
||||
GC_push_one(info.__r24);
|
||||
GC_push_one(info.__r25);
|
||||
GC_push_one(info.__r26);
|
||||
GC_push_one(info.__r27);
|
||||
GC_push_one(info.__r28);
|
||||
GC_push_one(info.__r29);
|
||||
GC_push_one(info.__r30);
|
||||
GC_push_one(info.__r31);
|
||||
#else
|
||||
lo = (void*)(info.r1 - PPC_RED_ZONE_SIZE);
|
||||
hi = (ptr_t)FindTopOfStack(info.r1);
|
||||
|
||||
GC_push_one(info.r0);
|
||||
GC_push_one(info.r2);
|
||||
GC_push_one(info.r3);
|
||||
GC_push_one(info.r4);
|
||||
GC_push_one(info.r5);
|
||||
GC_push_one(info.r6);
|
||||
GC_push_one(info.r7);
|
||||
GC_push_one(info.r8);
|
||||
GC_push_one(info.r9);
|
||||
GC_push_one(info.r10);
|
||||
GC_push_one(info.r11);
|
||||
GC_push_one(info.r12);
|
||||
GC_push_one(info.r13);
|
||||
GC_push_one(info.r14);
|
||||
GC_push_one(info.r15);
|
||||
GC_push_one(info.r16);
|
||||
GC_push_one(info.r17);
|
||||
GC_push_one(info.r18);
|
||||
GC_push_one(info.r19);
|
||||
GC_push_one(info.r20);
|
||||
GC_push_one(info.r21);
|
||||
GC_push_one(info.r22);
|
||||
GC_push_one(info.r23);
|
||||
GC_push_one(info.r24);
|
||||
GC_push_one(info.r25);
|
||||
GC_push_one(info.r26);
|
||||
GC_push_one(info.r27);
|
||||
GC_push_one(info.r28);
|
||||
GC_push_one(info.r29);
|
||||
GC_push_one(info.r30);
|
||||
GC_push_one(info.r31);
|
||||
#endif
|
||||
# elif defined(I386) /* !POWERPC */
|
||||
/* FIXME: Remove after testing: */
|
||||
WARN("This is completely untested and likely will not work\n", 0);
|
||||
i386_thread_state_t info;
|
||||
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
|
||||
r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
|
||||
(natural_t *)&info, &outCount);
|
||||
if(r != KERN_SUCCESS) continue;
|
||||
|
||||
#if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
|
||||
lo = (void*)info.__esp;
|
||||
hi = (ptr_t)FindTopOfStack(info.__esp);
|
||||
|
||||
GC_push_one(info.__eax);
|
||||
GC_push_one(info.__ebx);
|
||||
GC_push_one(info.__ecx);
|
||||
GC_push_one(info.__edx);
|
||||
GC_push_one(info.__edi);
|
||||
GC_push_one(info.__esi);
|
||||
GC_push_one(info.__ebp);
|
||||
/* GC_push_one(info.__esp); */
|
||||
GC_push_one(info.__ss);
|
||||
GC_push_one(info.__eip);
|
||||
GC_push_one(info.__cs);
|
||||
GC_push_one(info.__ds);
|
||||
GC_push_one(info.__es);
|
||||
GC_push_one(info.__fs);
|
||||
GC_push_one(info.__gs);
|
||||
#else
|
||||
lo = (void*)info.esp;
|
||||
hi = (ptr_t)FindTopOfStack(info.esp);
|
||||
|
||||
GC_push_one(info.eax);
|
||||
GC_push_one(info.ebx);
|
||||
GC_push_one(info.ecx);
|
||||
GC_push_one(info.edx);
|
||||
GC_push_one(info.edi);
|
||||
GC_push_one(info.esi);
|
||||
GC_push_one(info.ebp);
|
||||
/* GC_push_one(info.esp); */
|
||||
GC_push_one(info.ss);
|
||||
GC_push_one(info.eip);
|
||||
GC_push_one(info.cs);
|
||||
GC_push_one(info.ds);
|
||||
GC_push_one(info.es);
|
||||
GC_push_one(info.fs);
|
||||
GC_push_one(info.gs);
|
||||
#endif
|
||||
# elif defined(ARM) /* !I386 */
|
||||
arm_thread_state_t info;
|
||||
mach_msg_type_number_t outCount = THREAD_STATE_MAX;
|
||||
r = thread_get_state(thread, GC_MACH_THREAD_STATE_FLAVOR,
|
||||
(natural_t *)&info, &outCount);
|
||||
if(r != KERN_SUCCESS) continue;
|
||||
|
||||
lo = (void*)info.__sp;
|
||||
hi = (ptr_t)FindTopOfStack(info.__sp);
|
||||
|
||||
GC_push_one(info.__r[0]);
|
||||
GC_push_one(info.__r[1]);
|
||||
GC_push_one(info.__r[2]);
|
||||
GC_push_one(info.__r[3]);
|
||||
GC_push_one(info.__r[4]);
|
||||
GC_push_one(info.__r[5]);
|
||||
GC_push_one(info.__r[6]);
|
||||
GC_push_one(info.__r[7]);
|
||||
GC_push_one(info.__r[8]);
|
||||
GC_push_one(info.__r[9]);
|
||||
GC_push_one(info.__r[10]);
|
||||
GC_push_one(info.__r[11]);
|
||||
GC_push_one(info.__r[12]);
|
||||
/* GC_push_one(info.__sp); */
|
||||
GC_push_one(info.__lr);
|
||||
GC_push_one(info.__pc);
|
||||
GC_push_one(info.__cpsr);
|
||||
# endif /* !ARM */
|
||||
}
|
||||
# if DEBUG_THREADS
|
||||
GC_printf3("Darwin: Stack for thread 0x%lx = [%lx,%lx)\n",
|
||||
(unsigned long) thread,
|
||||
(unsigned long) lo,
|
||||
(unsigned long) hi
|
||||
);
|
||||
# endif
|
||||
GC_push_all_stack(lo, hi);
|
||||
mach_port_deallocate(my_task, thread);
|
||||
} /* for(p=GC_threads[i]...) */
|
||||
vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
|
||||
mach_port_deallocate(my_task, me);
|
||||
}
|
||||
#endif /* !DARWIN_DONT_PARSE_STACK */
|
||||
|
||||
static mach_port_t GC_mach_handler_thread;
|
||||
static int GC_use_mach_handler_thread = 0;
|
||||
|
||||
#define SUSPEND_THREADS_SIZE 2048
|
||||
static struct GC_mach_thread GC_mach_threads[SUSPEND_THREADS_SIZE];
|
||||
static int GC_mach_threads_count;
|
||||
|
||||
void GC_stop_init() {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SUSPEND_THREADS_SIZE; i++) {
|
||||
GC_mach_threads[i].thread = 0;
|
||||
GC_mach_threads[i].already_suspended = 0;
|
||||
}
|
||||
GC_mach_threads_count = 0;
|
||||
}
|
||||
|
||||
/* returns true if there's a thread in act_list that wasn't in old_list */
|
||||
int GC_suspend_thread_list(thread_act_array_t act_list, int count,
|
||||
thread_act_array_t old_list, int old_count) {
|
||||
mach_port_t my_thread = mach_thread_self();
|
||||
int i, j;
|
||||
|
||||
int changed = 0;
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
thread_act_t thread = act_list[i];
|
||||
# if DEBUG_THREADS
|
||||
GC_printf1("Attempting to suspend thread %p\n", thread);
|
||||
# endif
|
||||
/* find the current thread in the old list */
|
||||
int found = 0;
|
||||
for(j = 0; j < old_count; j++) {
|
||||
thread_act_t old_thread = old_list[j];
|
||||
if (old_thread == thread) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
/* add it to the GC_mach_threads list */
|
||||
GC_mach_threads[GC_mach_threads_count].thread = thread;
|
||||
/* default is not suspended */
|
||||
GC_mach_threads[GC_mach_threads_count].already_suspended = 0;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
if (thread != my_thread &&
|
||||
(!GC_use_mach_handler_thread
|
||||
|| (GC_use_mach_handler_thread
|
||||
&& GC_mach_handler_thread != thread))) {
|
||||
struct thread_basic_info info;
|
||||
mach_msg_type_number_t outCount = THREAD_INFO_MAX;
|
||||
kern_return_t kern_result = thread_info(thread, THREAD_BASIC_INFO,
|
||||
(thread_info_t)&info, &outCount);
|
||||
if(kern_result != KERN_SUCCESS) {
|
||||
/* the thread may have quit since the thread_threads () call
|
||||
* we mark already_suspended so it's not dealt with anymore later
|
||||
*/
|
||||
if (!found) {
|
||||
GC_mach_threads[GC_mach_threads_count].already_suspended = TRUE;
|
||||
GC_mach_threads_count++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
# if DEBUG_THREADS
|
||||
GC_printf2("Thread state for 0x%lx = %d\n", thread, info.run_state);
|
||||
# endif
|
||||
if (!found) {
|
||||
GC_mach_threads[GC_mach_threads_count].already_suspended = info.suspend_count;
|
||||
}
|
||||
if (info.suspend_count) continue;
|
||||
|
||||
# if DEBUG_THREADS
|
||||
GC_printf1("Suspending 0x%lx\n", thread);
|
||||
# endif
|
||||
/* Suspend the thread */
|
||||
kern_result = thread_suspend(thread);
|
||||
if(kern_result != KERN_SUCCESS) {
|
||||
/* the thread may have quit since the thread_threads () call
|
||||
* we mark already_suspended so it's not dealt with anymore later
|
||||
*/
|
||||
if (!found) {
|
||||
GC_mach_threads[GC_mach_threads_count].already_suspended = TRUE;
|
||||
GC_mach_threads_count++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!found) GC_mach_threads_count++;
|
||||
}
|
||||
|
||||
mach_port_deallocate(current_task(), my_thread);
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
/* Caller holds allocation lock. */
|
||||
void GC_stop_world()
|
||||
{
|
||||
int i, changes;
|
||||
GC_thread p;
|
||||
task_t my_task = current_task();
|
||||
mach_port_t my_thread = mach_thread_self();
|
||||
kern_return_t kern_result;
|
||||
thread_act_array_t act_list, prev_list;
|
||||
mach_msg_type_number_t listcount, prevcount;
|
||||
|
||||
if (GC_notify_event)
|
||||
GC_notify_event (GC_EVENT_PRE_STOP_WORLD);
|
||||
GC_process_togglerefs ();
|
||||
|
||||
# if DEBUG_THREADS
|
||||
GC_printf1("Stopping the world from 0x%lx\n", mach_thread_self());
|
||||
# endif
|
||||
|
||||
/* clear out the mach threads list table */
|
||||
GC_stop_init();
|
||||
|
||||
/* Make sure all free list construction has stopped before we start. */
|
||||
/* No new construction can start, since free list construction is */
|
||||
/* required to acquire and release the GC lock before it starts, */
|
||||
/* and we have the lock. */
|
||||
# ifdef PARALLEL_MARK
|
||||
GC_acquire_mark_lock();
|
||||
GC_ASSERT(GC_fl_builder_count == 0);
|
||||
/* We should have previously waited for it to become zero. */
|
||||
# endif /* PARALLEL_MARK */
|
||||
|
||||
/* Loop stopping threads until you have gone over the whole list
|
||||
twice without a new one appearing. thread_create() won't
|
||||
return (and thus the thread stop) until the new thread
|
||||
exists, so there is no window whereby you could stop a
|
||||
thread, recognise it is stopped, but then have a new thread
|
||||
it created before stopping show up later.
|
||||
*/
|
||||
|
||||
changes = 1;
|
||||
prev_list = NULL;
|
||||
prevcount = 0;
|
||||
do {
|
||||
int result;
|
||||
kern_result = task_threads(my_task, &act_list, &listcount);
|
||||
|
||||
if(kern_result == KERN_SUCCESS) {
|
||||
result = GC_suspend_thread_list(act_list, listcount,
|
||||
prev_list, prevcount);
|
||||
changes = result;
|
||||
|
||||
if(prev_list != NULL) {
|
||||
for(i = 0; i < prevcount; i++)
|
||||
mach_port_deallocate(my_task, prev_list[i]);
|
||||
|
||||
vm_deallocate(my_task, (vm_address_t)prev_list, sizeof(thread_t) * prevcount);
|
||||
}
|
||||
|
||||
prev_list = act_list;
|
||||
prevcount = listcount;
|
||||
}
|
||||
} while (changes);
|
||||
|
||||
for(i = 0; i < listcount; i++)
|
||||
mach_port_deallocate(my_task, act_list[i]);
|
||||
|
||||
vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
|
||||
|
||||
|
||||
# ifdef MPROTECT_VDB
|
||||
if(GC_incremental) {
|
||||
extern void GC_mprotect_stop();
|
||||
GC_mprotect_stop();
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef PARALLEL_MARK
|
||||
GC_release_mark_lock();
|
||||
# endif
|
||||
#if DEBUG_THREADS
|
||||
GC_printf1("World stopped from 0x%lx\n", my_thread);
|
||||
#endif
|
||||
|
||||
mach_port_deallocate(my_task, my_thread);
|
||||
|
||||
if (GC_notify_event)
|
||||
GC_notify_event (GC_EVENT_POST_STOP_WORLD);
|
||||
}
|
||||
|
||||
/* Caller holds allocation lock, and has held it continuously since */
|
||||
/* the world stopped. */
|
||||
void GC_start_world()
|
||||
{
|
||||
task_t my_task = current_task();
|
||||
mach_port_t my_thread = mach_thread_self();
|
||||
int i, j;
|
||||
GC_thread p;
|
||||
kern_return_t kern_result;
|
||||
thread_act_array_t act_list;
|
||||
mach_msg_type_number_t listcount;
|
||||
struct thread_basic_info info;
|
||||
mach_msg_type_number_t outCount = THREAD_INFO_MAX;
|
||||
|
||||
if (GC_notify_event)
|
||||
GC_notify_event (GC_EVENT_PRE_START_WORLD);
|
||||
|
||||
# if DEBUG_THREADS
|
||||
GC_printf0("World starting\n");
|
||||
# endif
|
||||
|
||||
# ifdef MPROTECT_VDB
|
||||
if(GC_incremental) {
|
||||
extern void GC_mprotect_resume();
|
||||
GC_mprotect_resume();
|
||||
}
|
||||
# endif
|
||||
|
||||
kern_result = task_threads(my_task, &act_list, &listcount);
|
||||
for(i = 0; i < listcount; i++) {
|
||||
thread_act_t thread = act_list[i];
|
||||
if (thread != my_thread &&
|
||||
(!GC_use_mach_handler_thread ||
|
||||
(GC_use_mach_handler_thread && GC_mach_handler_thread != thread))) {
|
||||
for(j = 0; j < GC_mach_threads_count; j++) {
|
||||
if (thread == GC_mach_threads[j].thread) {
|
||||
if (GC_mach_threads[j].already_suspended) {
|
||||
# if DEBUG_THREADS
|
||||
GC_printf1("Not resuming already suspended thread %p\n", thread);
|
||||
# endif
|
||||
continue;
|
||||
}
|
||||
kern_result = thread_info(thread, THREAD_BASIC_INFO,
|
||||
(thread_info_t)&info, &outCount);
|
||||
if(kern_result != KERN_SUCCESS) continue;
|
||||
# if DEBUG_THREADS
|
||||
GC_printf2("Thread state for 0x%lx = %d\n", thread,
|
||||
info.run_state);
|
||||
GC_printf1("Resuming 0x%lx\n", thread);
|
||||
# endif
|
||||
/* Resume the thread */
|
||||
kern_result = thread_resume(thread);
|
||||
if(kern_result != KERN_SUCCESS) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mach_port_deallocate(my_task, thread);
|
||||
}
|
||||
vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount);
|
||||
|
||||
mach_port_deallocate(my_task, my_thread);
|
||||
|
||||
if (GC_notify_event)
|
||||
GC_notify_event (GC_EVENT_POST_START_WORLD);
|
||||
|
||||
# if DEBUG_THREADS
|
||||
GC_printf0("World started\n");
|
||||
# endif
|
||||
}
|
||||
|
||||
void GC_darwin_register_mach_handler_thread(mach_port_t thread) {
|
||||
GC_mach_handler_thread = thread;
|
||||
GC_use_mach_handler_thread = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
-1185
File diff suppressed because it is too large.
Load diff
@@ -1,90 +0,0 @@
|
||||
# Makefile to build Hans Boehm garbage collector using the Digital Mars
|
||||
# compiler from www.digitalmars.com
|
||||
# Written by Walter Bright
|
||||
|
||||
|
||||
DEFINES=-DNDEBUG -DSILENT -DGC_BUILD -D_WINDOWS -DGC_DLL -DALL_INTERIOR_POINTERS -D__STDC__ -DWIN32_THREADS
|
||||
CFLAGS=-Iinclude $(DEFINES) -wx -g
|
||||
LFLAGS=/ma/implib/co
|
||||
CC=sc
|
||||
|
||||
.c.obj:
|
||||
$(CC) -c $(CFLAGS) $*
|
||||
|
||||
.cpp.obj:
|
||||
$(CC) -c $(CFLAGS) -Aa $*
|
||||
|
||||
OBJS= \
|
||||
allchblk.obj\
|
||||
alloc.obj\
|
||||
blacklst.obj\
|
||||
checksums.obj\
|
||||
dbg_mlc.obj\
|
||||
dyn_load.obj\
|
||||
finalize.obj\
|
||||
gc_cpp.obj\
|
||||
headers.obj\
|
||||
mach_dep.obj\
|
||||
malloc.obj\
|
||||
mallocx.obj\
|
||||
mark.obj\
|
||||
mark_rts.obj\
|
||||
misc.obj\
|
||||
new_hblk.obj\
|
||||
obj_map.obj\
|
||||
os_dep.obj\
|
||||
ptr_chck.obj\
|
||||
reclaim.obj\
|
||||
stubborn.obj\
|
||||
typd_mlc.obj\
|
||||
win32_threads.obj
|
||||
|
||||
targets: gc.dll gc.lib gctest.exe
|
||||
|
||||
gc.dll: $(OBJS) gc.def digimars.mak
|
||||
sc -ogc.dll $(OBJS) -L$(LFLAGS) gc.def kernel32.lib user32.lib
|
||||
|
||||
gc.def: digimars.mak
|
||||
echo LIBRARY GC >gc.def
|
||||
echo DESCRIPTION "Hans Boehm Garbage Collector" >>gc.def
|
||||
echo EXETYPE NT >>gc.def
|
||||
echo EXPORTS >>gc.def
|
||||
echo GC_is_visible_print_proc >>gc.def
|
||||
echo GC_is_valid_displacement_print_proc >>gc.def
|
||||
|
||||
clean:
|
||||
del gc.def
|
||||
del $(OBJS)
|
||||
|
||||
|
||||
gctest.exe : gc.lib tests\test.obj
|
||||
sc -ogctest.exe tests\test.obj gc.lib
|
||||
|
||||
tests\test.obj : tests\test.c
|
||||
$(CC) -c -g -DNDEBUG -DSILENT -DGC_BUILD -D_WINDOWS -DGC_DLL \
|
||||
-DALL_INTERIOR_POINTERS -DWIN32_THREADS \
|
||||
-Iinclude tests\test.c -otests\test.obj
|
||||
|
||||
allchblk.obj: allchblk.c
|
||||
alloc.obj: alloc.c
|
||||
blacklst.obj: blacklst.c
|
||||
checksums.obj: checksums.c
|
||||
dbg_mlc.obj: dbg_mlc.c
|
||||
dyn_load.obj: dyn_load.c
|
||||
finalize.obj: finalize.c
|
||||
gc_cpp.obj: gc_cpp.cpp
|
||||
headers.obj: headers.c
|
||||
mach_dep.obj: mach_dep.c
|
||||
malloc.obj: malloc.c
|
||||
mallocx.obj: mallocx.c
|
||||
mark.obj: mark.c
|
||||
mark_rts.obj: mark_rts.c
|
||||
misc.obj: misc.c
|
||||
new_hblk.obj: new_hblk.c
|
||||
obj_map.obj: obj_map.c
|
||||
os_dep.obj: os_dep.c
|
||||
ptr_chck.obj: ptr_chck.c
|
||||
reclaim.obj: reclaim.c
|
||||
stubborn.obj: stubborn.c
|
||||
typd_mlc.obj: typd_mlc.c
|
||||
win32_threads.obj: win32_threads.c
|
||||
@@ -1,2 +0,0 @@
|
||||
/Makefile
|
||||
/Makefile.in
|
||||
@@ -1,27 +0,0 @@
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Modified by: Grzegorz Jakacki <jakacki at acm dot org>
|
||||
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
# installed documentation
|
||||
#
|
||||
dist_pkgdata_DATA = barrett_diagram debugging.html gc.man \
|
||||
gcdescr.html README README.amiga README.arm.cross \
|
||||
README.autoconf README.changes README.contributors \
|
||||
README.cords README.DGUX386 README.dj README.environment \
|
||||
README.ews4800 README.hp README.linux README.Mac \
|
||||
README.MacOSX README.macros README.OS2 README.rs6000 \
|
||||
README.sgi README.solaris2 README.uts README.win32 \
|
||||
tree.html leak.html gcinterface.html scale.html \
|
||||
README.darwin simple_example.html
|
||||
|
||||
@@ -1,622 +0,0 @@
|
||||
Copyright (c) 1988, 1989 Hans-J. Boehm, Alan J. Demers
|
||||
Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
|
||||
Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
|
||||
Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
|
||||
|
||||
The file linux_threads.c is also
|
||||
Copyright (c) 1998 by Fergus Henderson. All rights reserved.
|
||||
|
||||
The files Makefile.am, and configure.ac are
|
||||
Copyright (c) 2001 by Red Hat Inc. All rights reserved.
|
||||
|
||||
Several files supporting GNU-style builds are copyrighted by the Free
|
||||
Software Foundation, and carry a different license from that given
|
||||
below.
|
||||
|
||||
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.
|
||||
|
||||
A few of the files needed to use the GNU-style build procedure come with
|
||||
slightly different licenses, though they are all similar in spirit. A few
|
||||
are GPL'ed, but with an exception that should cover all uses in the
|
||||
collector. (If you are concerned about such things, I recommend you look
|
||||
at the notice in config.guess or ltmain.sh.)
|
||||
|
||||
This is version 6.6 of a conservative garbage collector for C and C++.
|
||||
|
||||
You might find a more recent version of this at
|
||||
|
||||
http://www.hpl.hp.com/personal/Hans_Boehm/gc
|
||||
|
||||
OVERVIEW
|
||||
|
||||
This is intended to be a general purpose, garbage collecting storage
|
||||
allocator. The algorithms used are described in:
|
||||
|
||||
Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
|
||||
Software Practice & Experience, September 1988, pp. 807-820.
|
||||
|
||||
Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
|
||||
Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
|
||||
and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
|
||||
|
||||
Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
|
||||
of the ACM SIGPLAN '91 Conference on Programming Language Design and
|
||||
Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
|
||||
|
||||
Boehm H., "Reducing Garbage Collector Cache Misses", Proceedings of the
|
||||
2000 International Symposium on Memory Management.
|
||||
|
||||
Possible interactions between the collector and optimizing compilers are
|
||||
discussed in
|
||||
|
||||
Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
|
||||
The Journal of C Language Translation 4, 2 (December 1992).
|
||||
|
||||
and
|
||||
|
||||
Boehm H., "Simple GC-safe Compilation", Proceedings
|
||||
of the ACM SIGPLAN '96 Conference on Programming Language Design and
|
||||
Implementation.
|
||||
|
||||
(Some of these are also available from
|
||||
http://www.hpl.hp.com/personal/Hans_Boehm/papers/, among other places.)
|
||||
|
||||
Unlike the collector described in the second reference, this collector
|
||||
operates either with the mutator stopped during the entire collection
|
||||
(default) or incrementally during allocations. (The latter is supported
|
||||
on only a few machines.) On the most common platforms, it can be built
|
||||
with or without thread support. On a few platforms, it can take advantage
|
||||
of a multiprocessor to speed up garbage collection.
|
||||
|
||||
Many of the ideas underlying the collector have previously been explored
|
||||
by others. Notably, some of the run-time systems developed at Xerox PARC
|
||||
in the early 1980s conservatively scanned thread stacks to locate possible
|
||||
pointers (cf. Paul Rovner, "On Adding Garbage Collection and Runtime Types
|
||||
to a Strongly-Typed Statically Checked, Concurrent Language" Xerox PARC
|
||||
CSL 84-7). Doug McIlroy wrote a simpler fully conservative collector that
|
||||
was part of version 8 UNIX (tm), but appears to not have received
|
||||
widespread use.
|
||||
|
||||
Rudimentary tools for use of the collector as a leak detector are included
|
||||
(see http://www.hpl.hp.com/personal/Hans_Boehm/gc/leak.html),
|
||||
as is a fairly sophisticated string package "cord" that makes use of the
|
||||
collector. (See doc/README.cords and H.-J. Boehm, R. Atkinson, and M. Plass,
|
||||
"Ropes: An Alternative to Strings", Software Practice and Experience 25, 12
|
||||
(December 1995), pp. 1315-1330. This is very similar to the "rope" package
|
||||
in Xerox Cedar, or the "rope" package in the SGI STL or the g++ distribution.)
|
||||
|
||||
Further collector documantation can be found at
|
||||
|
||||
http://www.hpl.hp.com/personal/Hans_Boehm/gc
|
||||
|
||||
|
||||
GENERAL DESCRIPTION
|
||||
|
||||
This is a garbage collecting storage allocator that is intended to be
|
||||
used as a plug-in replacement for C's malloc.
|
||||
|
||||
Since the collector does not require pointers to be tagged, it does not
|
||||
attempt to ensure that all inaccessible storage is reclaimed. However,
|
||||
in our experience, it is typically more successful at reclaiming unused
|
||||
memory than most C programs using explicit deallocation. Unlike manually
|
||||
introduced leaks, the amount of unreclaimed memory typically stays
|
||||
bounded.
|
||||
|
||||
In the following, an "object" is defined to be a region of memory allocated
|
||||
by the routines described below.
|
||||
|
||||
Any objects not intended to be collected must be pointed to either
|
||||
from other such accessible objects, or from the registers,
|
||||
stack, data, or statically allocated bss segments. Pointers from
|
||||
the stack or registers may point to anywhere inside an object.
|
||||
The same is true for heap pointers if the collector is compiled with
|
||||
ALL_INTERIOR_POINTERS defined, as is now the default.
|
||||
|
||||
Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
|
||||
of garbage objects, by requiring pointers from the heap to to the beginning
|
||||
of an object. But this no longer appears to be a significant
|
||||
issue for most programs.
|
||||
|
||||
There are a number of routines which modify the pointer recognition
|
||||
algorithm. GC_register_displacement allows certain interior pointers
|
||||
to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
|
||||
GC_malloc_ignore_off_page allows some pointers into the middle of large objects
|
||||
to be disregarded, greatly reducing the probablility of accidental
|
||||
retention of large objects. For most purposes it seems best to compile
|
||||
with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
|
||||
you get collector warnings from allocations of very large objects.
|
||||
See README.debugging for details.
|
||||
|
||||
WARNING: pointers inside memory allocated by the standard "malloc" are not
|
||||
seen by the garbage collector. Thus objects pointed to only from such a
|
||||
region may be prematurely deallocated. It is thus suggested that the
|
||||
standard "malloc" be used only for memory regions, such as I/O buffers, that
|
||||
are guaranteed not to contain pointers to garbage collectable memory.
|
||||
Pointers in C language automatic, static, or register variables,
|
||||
are correctly recognized. (Note that GC_malloc_uncollectable has semantics
|
||||
similar to standard malloc, but allocates objects that are traced by the
|
||||
collector.)
|
||||
|
||||
WARNING: the collector does not always know how to find pointers in data
|
||||
areas that are associated with dynamic libraries. This is easy to
|
||||
remedy IF you know how to find those data areas on your operating
|
||||
system (see GC_add_roots). Code for doing this under SunOS, IRIX 5.X and 6.X,
|
||||
HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default. (See
|
||||
README.win32 for win32 details.) On other systems pointers from dynamic
|
||||
library data areas may not be considered by the collector.
|
||||
If you're writing a program that depends on the collector scanning
|
||||
dynamic library data areas, it may be a good idea to include at least
|
||||
one call to GC_is_visible() to ensure that those areas are visible
|
||||
to the collector.
|
||||
|
||||
Note that the garbage collector does not need to be informed of shared
|
||||
read-only data. However if the shared library mechanism can introduce
|
||||
discontiguous data areas that may contain pointers, then the collector does
|
||||
need to be informed.
|
||||
|
||||
Signal processing for most signals may be deferred during collection,
|
||||
and during uninterruptible parts of the allocation process.
|
||||
Like standard ANSI C mallocs, by default it is unsafe to invoke
|
||||
malloc (and other GC routines) from a signal handler while another
|
||||
malloc call may be in progress. Removing -DNO_SIGNALS from Makefile
|
||||
attempts to remedy that. But that may not be reliable with a compiler that
|
||||
substantially reorders memory operations inside GC_malloc.
|
||||
|
||||
The allocator/collector can also be configured for thread-safe operation.
|
||||
(Full signal safety can also be achieved, but only at the cost of two system
|
||||
calls per malloc, which is usually unacceptable.)
|
||||
WARNING: the collector does not guarantee to scan thread-local storage
|
||||
(e.g. of the kind accessed with pthread_getspecific()). The collector
|
||||
does scan thread stacks, though, so generally the best solution is to
|
||||
ensure that any pointers stored in thread-local storage are also
|
||||
stored on the thread's stack for the duration of their lifetime.
|
||||
(This is arguably a longstanding bug, but it hasn't been fixed yet.)
|
||||
|
||||
INSTALLATION AND PORTABILITY
|
||||
|
||||
As distributed, the macro SILENT is defined in Makefile.
|
||||
In the event of problems, this can be removed to obtain a moderate
|
||||
amount of descriptive output for each collection.
|
||||
(The given statistics exhibit a few peculiarities.
|
||||
Things don't appear to add up for a variety of reasons, most notably
|
||||
fragmentation losses. These are probably much more significant for the
|
||||
contrived program "test.c" than for your application.)
|
||||
|
||||
Note that typing "make test" will automatically build the collector
|
||||
and then run setjmp_test and gctest. Setjmp_test will give you information
|
||||
about configuring the collector, which is useful primarily if you have
|
||||
a machine that's not already supported. Gctest is a somewhat superficial
|
||||
test of collector functionality. Failure is indicated by a core dump or
|
||||
a message to the effect that the collector is broken. Gctest takes about
|
||||
35 seconds to run on a SPARCstation 2. It may use up to 8 MB of memory. (The
|
||||
multi-threaded version will use more. 64-bit versions may use more.)
|
||||
"Make test" will also, as its last step, attempt to build and test the
|
||||
"cord" string library. This will fail without an ANSI C compiler, but
|
||||
the garbage collector itself should still be usable.
|
||||
|
||||
The Makefile will generate a library gc.a which you should link against.
|
||||
Typing "make cords" will add the cord library to gc.a.
|
||||
Note that this requires an ANSI C compiler.
|
||||
|
||||
It is suggested that if you need to replace a piece of the collector
|
||||
(e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
|
||||
ld command line, rather than replacing the one in gc.a. (This will
|
||||
generate numerous warnings under some versions of AIX, but it still
|
||||
works.)
|
||||
|
||||
All include files that need to be used by clients will be put in the
|
||||
include subdirectory. (Normally this is just gc.h. "Make cords" adds
|
||||
"cord.h" and "ec.h".)
|
||||
|
||||
The collector currently is designed to run essentially unmodified on
|
||||
machines that use a flat 32-bit or 64-bit address space.
|
||||
That includes the vast majority of Workstations and X86 (X >= 3) PCs.
|
||||
(The list here was deleted because it was getting too long and constantly
|
||||
out of date.)
|
||||
It does NOT run under plain 16-bit DOS or Windows 3.X. There are however
|
||||
various packages (e.g. win32s, djgpp) that allow flat 32-bit address
|
||||
applications to run under those systemsif the have at least an 80386 processor,
|
||||
and several of those are compatible with the collector.
|
||||
|
||||
In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
|
||||
or equivalent is supplied. Many of these have separate README.system
|
||||
files.
|
||||
|
||||
Dynamic libraries are completely supported only under SunOS/Solaris,
|
||||
(and even that support is not functional on the last Sun 3 release),
|
||||
Linux, FreeBSD, NetBSD, IRIX 5&6, HP/UX, Win32 (not Win32S) and OSF/1
|
||||
on DEC AXP machines plus perhaps a few others listed near the top
|
||||
of dyn_load.c. On other machines we recommend that you do one of
|
||||
the following:
|
||||
|
||||
1) Add dynamic library support (and send us the code).
|
||||
2) Use static versions of the libraries.
|
||||
3) Arrange for dynamic libraries to use the standard malloc.
|
||||
This is still dangerous if the library stores a pointer to a
|
||||
garbage collected object. But nearly all standard interfaces
|
||||
prohibit this, because they deal correctly with pointers
|
||||
to stack allocated objects. (Strtok is an exception. Don't
|
||||
use it.)
|
||||
|
||||
In all cases we assume that pointer alignment is consistent with that
|
||||
enforced by the standard C compilers. If you use a nonstandard compiler
|
||||
you may have to adjust the alignment parameters defined in gc_priv.h.
|
||||
Note that this may also be an issue with packed records/structs, if those
|
||||
enforce less alignment for pointers.
|
||||
|
||||
A port to a machine that is not byte addressed, or does not use 32 bit
|
||||
or 64 bit addresses will require a major effort. A port to plain MSDOS
|
||||
or win16 is hard.
|
||||
|
||||
For machines not already mentioned, or for nonstandard compilers, the
|
||||
following are likely to require change:
|
||||
|
||||
1. The parameters in gcconfig.h.
|
||||
The parameters that will usually require adjustment are
|
||||
STACKBOTTOM, ALIGNMENT and DATASTART. Setjmp_test
|
||||
prints its guesses of the first two.
|
||||
DATASTART should be an expression for computing the
|
||||
address of the beginning of the data segment. This can often be
|
||||
&etext. But some memory management units require that there be
|
||||
some unmapped space between the text and the data segment. Thus
|
||||
it may be more complicated. On UNIX systems, this is rarely
|
||||
documented. But the adb "$m" command may be helpful. (Note
|
||||
that DATASTART will usually be a function of &etext. Thus a
|
||||
single experiment is usually insufficient.)
|
||||
STACKBOTTOM is used to initialize GC_stackbottom, which
|
||||
should be a sufficient approximation to the coldest stack address.
|
||||
On some machines, it is difficult to obtain such a value that is
|
||||
valid across a variety of MMUs, OS releases, etc. A number of
|
||||
alternatives exist for using the collector in spite of this. See the
|
||||
discussion in gcconfig.h immediately preceding the various
|
||||
definitions of STACKBOTTOM.
|
||||
|
||||
2. mach_dep.c.
|
||||
The most important routine here is one to mark from registers.
|
||||
The distributed file includes a generic hack (based on setjmp) that
|
||||
happens to work on many machines, and may work on yours. Try
|
||||
compiling and running setjmp_t.c to see whether it has a chance of
|
||||
working. (This is not correct C, so don't blame your compiler if it
|
||||
doesn't work. Based on limited experience, register window machines
|
||||
are likely to cause trouble. If your version of setjmp claims that
|
||||
all accessible variables, including registers, have the value they
|
||||
had at the time of the longjmp, it also will not work. Vanilla 4.2 BSD
|
||||
on Vaxen makes such a claim. SunOS does not.)
|
||||
If your compiler does not allow in-line assembly code, or if you prefer
|
||||
not to use such a facility, mach_dep.c may be replaced by a .s file
|
||||
(as we did for the MIPS machine and the PC/RT).
|
||||
At this point enough architectures are supported by mach_dep.c
|
||||
that you will rarely need to do more than adjust for assembler
|
||||
syntax.
|
||||
|
||||
3. os_dep.c (and gc_priv.h).
|
||||
Several kinds of operating system dependent routines reside here.
|
||||
Many are optional. Several are invoked only through corresponding
|
||||
macros in gc_priv.h, which may also be redefined as appropriate.
|
||||
The routine GC_register_data_segments is crucial. It registers static
|
||||
data areas that must be traversed by the collector. (User calls to
|
||||
GC_add_roots may sometimes be used for similar effect.)
|
||||
Routines to obtain memory from the OS also reside here.
|
||||
Alternatively this can be done entirely by the macro GET_MEM
|
||||
defined in gc_priv.h. Routines to disable and reenable signals
|
||||
also reside here if they are need by the macros DISABLE_SIGNALS
|
||||
and ENABLE_SIGNALS defined in gc_priv.h.
|
||||
In a multithreaded environment, the macros LOCK and UNLOCK
|
||||
in gc_priv.h will need to be suitably redefined.
|
||||
The incremental collector requires page dirty information, which
|
||||
is acquired through routines defined in os_dep.c. Unless directed
|
||||
otherwise by gcconfig.h, these are implemented as stubs that simply
|
||||
treat all pages as dirty. (This of course makes the incremental
|
||||
collector much less useful.)
|
||||
|
||||
4. dyn_load.c
|
||||
This provides a routine that allows the collector to scan data
|
||||
segments associated with dynamic libraries. Often it is not
|
||||
necessary to provide this routine unless user-written dynamic
|
||||
libraries are used.
|
||||
|
||||
For a different version of UN*X or different machines using the
|
||||
Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
|
||||
it should frequently suffice to change definitions in gcconfig.h.
|
||||
|
||||
|
||||
THE C INTERFACE TO THE ALLOCATOR
|
||||
|
||||
The following routines are intended to be directly called by the user.
|
||||
Note that usually only GC_malloc is necessary. GC_clear_roots and GC_add_roots
|
||||
calls may be required if the collector has to trace from nonstandard places
|
||||
(e.g. from dynamic library data areas on a machine on which the
|
||||
collector doesn't already understand them.) On some machines, it may
|
||||
be desirable to set GC_stacktop to a good approximation of the stack base.
|
||||
(This enhances code portability on HP PA machines, since there is no
|
||||
good way for the collector to compute this value.) Client code may include
|
||||
"gc.h", which defines all of the following, plus many others.
|
||||
|
||||
1) GC_malloc(nbytes)
|
||||
- allocate an object of size nbytes. Unlike malloc, the object is
|
||||
cleared before being returned to the user. Gc_malloc will
|
||||
invoke the garbage collector when it determines this to be appropriate.
|
||||
GC_malloc may return 0 if it is unable to acquire sufficient
|
||||
space from the operating system. This is the most probable
|
||||
consequence of running out of space. Other possible consequences
|
||||
are that a function call will fail due to lack of stack space,
|
||||
or that the collector will fail in other ways because it cannot
|
||||
maintain its internal data structures, or that a crucial system
|
||||
process will fail and take down the machine. Most of these
|
||||
possibilities are independent of the malloc implementation.
|
||||
|
||||
2) GC_malloc_atomic(nbytes)
|
||||
- allocate an object of size nbytes that is guaranteed not to contain any
|
||||
pointers. The returned object is not guaranteed to be cleared.
|
||||
(Can always be replaced by GC_malloc, but results in faster collection
|
||||
times. The collector will probably run faster if large character
|
||||
arrays, etc. are allocated with GC_malloc_atomic than if they are
|
||||
statically allocated.)
|
||||
|
||||
3) GC_realloc(object, new_size)
|
||||
- change the size of object to be new_size. Returns a pointer to the
|
||||
new object, which may, or may not, be the same as the pointer to
|
||||
the old object. The new object is taken to be atomic iff the old one
|
||||
was. If the new object is composite and larger than the original object,
|
||||
then the newly added bytes are cleared (we hope). This is very likely
|
||||
to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
|
||||
Even then, it is likely to recycle the old object only if the object
|
||||
is grown in small additive increments (which, we claim, is generally bad
|
||||
coding practice.)
|
||||
|
||||
4) GC_free(object)
|
||||
- explicitly deallocate an object returned by GC_malloc or
|
||||
GC_malloc_atomic. Not necessary, but can be used to minimize
|
||||
collections if performance is critical. Probably a performance
|
||||
loss for very small objects (<= 8 bytes).
|
||||
|
||||
5) GC_expand_hp(bytes)
|
||||
- Explicitly increase the heap size. (This is normally done automatically
|
||||
if a garbage collection failed to GC_reclaim enough memory. Explicit
|
||||
calls to GC_expand_hp may prevent unnecessarily frequent collections at
|
||||
program startup.)
|
||||
|
||||
6) GC_malloc_ignore_off_page(bytes)
|
||||
- identical to GC_malloc, but the client promises to keep a pointer to
|
||||
the somewhere within the first 256 bytes of the object while it is
|
||||
live. (This pointer should nortmally be declared volatile to prevent
|
||||
interference from compiler optimizations.) This is the recommended
|
||||
way to allocate anything that is likely to be larger than 100Kbytes
|
||||
or so. (GC_malloc may result in failure to reclaim such objects.)
|
||||
|
||||
7) GC_set_warn_proc(proc)
|
||||
- Can be used to redirect warnings from the collector. Such warnings
|
||||
should be rare, and should not be ignored during code development.
|
||||
|
||||
8) GC_enable_incremental()
|
||||
- Enables generational and incremental collection. Useful for large
|
||||
heaps on machines that provide access to page dirty information.
|
||||
Some dirty bit implementations may interfere with debugging
|
||||
(by catching address faults) and place restrictions on heap arguments
|
||||
to system calls (since write faults inside a system call may not be
|
||||
handled well).
|
||||
|
||||
9) Several routines to allow for registration of finalization code.
|
||||
User supplied finalization code may be invoked when an object becomes
|
||||
unreachable. To call (*f)(obj, x) when obj becomes inaccessible, use
|
||||
GC_register_finalizer(obj, f, x, 0, 0);
|
||||
For more sophisticated uses, and for finalization ordering issues,
|
||||
see gc.h.
|
||||
|
||||
The global variable GC_free_space_divisor may be adjusted up from its
|
||||
default value of 4 to use less space and more collection time, or down for
|
||||
the opposite effect. Setting it to 1 or 0 will effectively disable collections
|
||||
and cause all allocations to simply grow the heap.
|
||||
|
||||
The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
|
||||
the amount of memory allocated by the above routines that should not be
|
||||
considered as a candidate for collection. Careless use may, of course, result
|
||||
in excessive memory consumption.
|
||||
|
||||
Some additional tuning is possible through the parameters defined
|
||||
near the top of gc_priv.h.
|
||||
|
||||
If only GC_malloc is intended to be used, it might be appropriate to define:
|
||||
|
||||
#define malloc(n) GC_malloc(n)
|
||||
#define calloc(m,n) GC_malloc((m)*(n))
|
||||
|
||||
For small pieces of VERY allocation intensive code, gc_inl.h
|
||||
includes some allocation macros that may be used in place of GC_malloc
|
||||
and friends.
|
||||
|
||||
All externally visible names in the garbage collector start with "GC_".
|
||||
To avoid name conflicts, client code should avoid this prefix, except when
|
||||
accessing garbage collector routines or variables.
|
||||
|
||||
There are provisions for allocation with explicit type information.
|
||||
This is rarely necessary. Details can be found in gc_typed.h.
|
||||
|
||||
THE C++ INTERFACE TO THE ALLOCATOR:
|
||||
|
||||
The Ellis-Hull C++ interface to the collector is included in
|
||||
the collector distribution. If you intend to use this, type
|
||||
"make c++" after the initial build of the collector is complete.
|
||||
See gc_cpp.h for the definition of the interface. This interface
|
||||
tries to approximate the Ellis-Detlefs C++ garbage collection
|
||||
proposal without compiler changes.
|
||||
|
||||
Cautions:
|
||||
1. Arrays allocated without new placement syntax are
|
||||
allocated as uncollectable objects. They are traced by the
|
||||
collector, but will not be reclaimed.
|
||||
|
||||
2. Failure to use "make c++" in combination with (1) will
|
||||
result in arrays allocated using the default new operator.
|
||||
This is likely to result in disaster without linker warnings.
|
||||
|
||||
3. If your compiler supports an overloaded new[] operator,
|
||||
then gc_cpp.cc and gc_cpp.h should be suitably modified.
|
||||
|
||||
4. Many current C++ compilers have deficiencies that
|
||||
break some of the functionality. See the comments in gc_cpp.h
|
||||
for suggested workarounds.
|
||||
|
||||
USE AS LEAK DETECTOR:
|
||||
|
||||
The collector may be used to track down leaks in C programs that are
|
||||
intended to run with malloc/free (e.g. code with extreme real-time or
|
||||
portability constraints). To do so define FIND_LEAK in Makefile
|
||||
This will cause the collector to invoke the report_leak
|
||||
routine defined near the top of reclaim.c whenever an inaccessible
|
||||
object is found that has not been explicitly freed. Such objects will
|
||||
also be automatically reclaimed.
|
||||
Productive use of this facility normally involves redefining report_leak
|
||||
to do something more intelligent. This typically requires annotating
|
||||
objects with additional information (e.g. creation time stack trace) that
|
||||
identifies their origin. Such code is typically not very portable, and is
|
||||
not included here, except on SPARC machines.
|
||||
If all objects are allocated with GC_DEBUG_MALLOC (see next section),
|
||||
then the default version of report_leak will report the source file
|
||||
and line number at which the leaked object was allocated. This may
|
||||
sometimes be sufficient. (On SPARC/SUNOS4 machines, it will also report
|
||||
a cryptic stack trace. This can often be turned into a sympolic stack
|
||||
trace by invoking program "foo" with "callprocs foo". Callprocs is
|
||||
a short shell script that invokes adb to expand program counter values
|
||||
to symbolic addresses. It was largely supplied by Scott Schwartz.)
|
||||
Note that the debugging facilities described in the next section can
|
||||
sometimes be slightly LESS effective in leak finding mode, since in
|
||||
leak finding mode, GC_debug_free actually results in reuse of the object.
|
||||
(Otherwise the object is simply marked invalid.) Also note that the test
|
||||
program is not designed to run meaningfully in FIND_LEAK mode.
|
||||
Use "make gc.a" to build the collector.
|
||||
|
||||
DEBUGGING FACILITIES:
|
||||
|
||||
The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
|
||||
and GC_debug_free provide an alternate interface to the collector, which
|
||||
provides some help with memory overwrite errors, and the like.
|
||||
Objects allocated in this way are annotated with additional
|
||||
information. Some of this information is checked during garbage
|
||||
collections, and detected inconsistencies are reported to stderr.
|
||||
|
||||
Simple cases of writing past the end of an allocated object should
|
||||
be caught if the object is explicitly deallocated, or if the
|
||||
collector is invoked while the object is live. The first deallocation
|
||||
of an object will clear the debugging info associated with an
|
||||
object, so accidentally repeated calls to GC_debug_free will report the
|
||||
deallocation of an object without debugging information. Out of
|
||||
memory errors will be reported to stderr, in addition to returning
|
||||
NIL.
|
||||
|
||||
GC_debug_malloc checking during garbage collection is enabled
|
||||
with the first call to GC_debug_malloc. This will result in some
|
||||
slowdown during collections. If frequent heap checks are desired,
|
||||
this can be achieved by explicitly invoking GC_gcollect, e.g. from
|
||||
the debugger.
|
||||
|
||||
GC_debug_malloc allocated objects should not be passed to GC_realloc
|
||||
or GC_free, and conversely. It is however acceptable to allocate only
|
||||
some objects with GC_debug_malloc, and to use GC_malloc for other objects,
|
||||
provided the two pools are kept distinct. In this case, there is a very
|
||||
low probablility that GC_malloc allocated objects may be misidentified as
|
||||
having been overwritten. This should happen with probability at most
|
||||
one in 2**32. This probability is zero if GC_debug_malloc is never called.
|
||||
|
||||
GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
|
||||
additional trailing arguments, a string and an integer. These are not
|
||||
interpreted by the allocator. They are stored in the object (the string is
|
||||
not copied). If an error involving the object is detected, they are printed.
|
||||
|
||||
The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
|
||||
GC_REGISTER_FINALIZER are also provided. These require the same arguments
|
||||
as the corresponding (nondebugging) routines. If gc.h is included
|
||||
with GC_DEBUG defined, they call the debugging versions of these
|
||||
functions, passing the current file name and line number as the two
|
||||
extra arguments, where appropriate. If gc.h is included without GC_DEBUG
|
||||
defined, then all these macros will instead be defined to their nondebugging
|
||||
equivalents. (GC_REGISTER_FINALIZER is necessary, since pointers to
|
||||
objects with debugging information are really pointers to a displacement
|
||||
of 16 bytes form the object beginning, and some translation is necessary
|
||||
when finalization routines are invoked. For details, about what's stored
|
||||
in the header, see the definition of the type oh in debug_malloc.c)
|
||||
|
||||
INCREMENTAL/GENERATIONAL COLLECTION:
|
||||
|
||||
The collector normally interrupts client code for the duration of
|
||||
a garbage collection mark phase. This may be unacceptable if interactive
|
||||
response is needed for programs with large heaps. The collector
|
||||
can also run in a "generational" mode, in which it usually attempts to
|
||||
collect only objects allocated since the last garbage collection.
|
||||
Furthermore, in this mode, garbage collections run mostly incrementally,
|
||||
with a small amount of work performed in response to each of a large number of
|
||||
GC_malloc requests.
|
||||
|
||||
This mode is enabled by a call to GC_enable_incremental().
|
||||
|
||||
Incremental and generational collection is effective in reducing
|
||||
pause times only if the collector has some way to tell which objects
|
||||
or pages have been recently modified. The collector uses two sources
|
||||
of information:
|
||||
|
||||
1. Information provided by the VM system. This may be provided in
|
||||
one of several forms. Under Solaris 2.X (and potentially under other
|
||||
similar systems) information on dirty pages can be read from the
|
||||
/proc file system. Under other systems (currently SunOS4.X) it is
|
||||
possible to write-protect the heap, and catch the resulting faults.
|
||||
On these systems we require that system calls writing to the heap
|
||||
(other than read) be handled specially by client code.
|
||||
See os_dep.c for details.
|
||||
|
||||
2. Information supplied by the programmer. We define "stubborn"
|
||||
objects to be objects that are rarely changed. Such an object
|
||||
can be allocated (and enabled for writing) with GC_malloc_stubborn.
|
||||
Once it has been initialized, the collector should be informed with
|
||||
a call to GC_end_stubborn_change. Subsequent writes that store
|
||||
pointers into the object must be preceded by a call to
|
||||
GC_change_stubborn.
|
||||
|
||||
This mechanism performs best for objects that are written only for
|
||||
initialization, and such that only one stubborn object is writable
|
||||
at once. It is typically not worth using for short-lived
|
||||
objects. Stubborn objects are treated less efficiently than pointerfree
|
||||
(atomic) objects.
|
||||
|
||||
A rough rule of thumb is that, in the absence of VM information, garbage
|
||||
collection pauses are proportional to the amount of pointerful storage
|
||||
plus the amount of modified "stubborn" storage that is reachable during
|
||||
the collection.
|
||||
|
||||
Initial allocation of stubborn objects takes longer than allocation
|
||||
of other objects, since other data structures need to be maintained.
|
||||
|
||||
We recommend against random use of stubborn objects in client
|
||||
code, since bugs caused by inappropriate writes to stubborn objects
|
||||
are likely to be very infrequently observed and hard to trace.
|
||||
However, their use may be appropriate in a few carefully written
|
||||
library routines that do not make the objects themselves available
|
||||
for writing by client code.
|
||||
|
||||
|
||||
BUGS:
|
||||
|
||||
Any memory that does not have a recognizable pointer to it will be
|
||||
reclaimed. Exclusive-or'ing forward and backward links in a list
|
||||
doesn't cut it.
|
||||
Some C optimizers may lose the last undisguised pointer to a memory
|
||||
object as a consequence of clever optimizations. This has almost
|
||||
never been observed in practice. Send mail to [email protected]
|
||||
for suggestions on how to fix your compiler.
|
||||
This is not a real-time collector. In the standard configuration,
|
||||
percentage of time required for collection should be constant across
|
||||
heap sizes. But collection pauses will increase for larger heaps.
|
||||
(On SPARCstation 2s collection times will be on the order of 300 msecs
|
||||
per MB of accessible memory that needs to be scanned. Your mileage
|
||||
may vary.) The incremental/generational collection facility helps,
|
||||
but is portable only if "stubborn" allocation is used.
|
||||
Please address bug reports to [email protected]. If you are
|
||||
contemplating a major addition, you might also send mail to ask whether
|
||||
it's already been done (or whether we tried and discarded it).
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
Garbage Collector (parallel iversion) for ix86 DG/UX Release R4.20MU07
|
||||
|
||||
|
||||
*READ* the file README.QUICK.
|
||||
|
||||
You need the GCC-3.0.3 rev (DG/UX) compiler to build this tree.
|
||||
This compiler has the new "dgux386" threads package implemented.
|
||||
It also supports the switch "-pthread" needed to link correctly
|
||||
the DG/UX's -lrte -lthread with -lgcc and the system's -lc.
|
||||
Finally we support parralleli-mark for the SMP DG/UX machines.
|
||||
To build the garbage collector do:
|
||||
|
||||
./configure --enable-parallel-mark
|
||||
make
|
||||
make gctest
|
||||
|
||||
Before you run "gctest" you need to set your LD_LIBRARY_PATH
|
||||
correctly so that "gctest" can find the shared library libgc.
|
||||
Alternatively you can do a configuration
|
||||
|
||||
./configure --enable-parallel-mark --disable-shared
|
||||
|
||||
to build only the static version of libgc.
|
||||
|
||||
To enable debugging messages please do:
|
||||
1) Add the "--enable-full-debug" flag during configuration.
|
||||
2) Edit the file linux-threads.c and uncommnect the line:
|
||||
|
||||
/* #define DEBUG_THREADS 1 */ to --->
|
||||
|
||||
#define DEBUG_THREADS 1
|
||||
|
||||
Then give "make" as usual.
|
||||
|
||||
In a machine with 4 CPUs (my own machine) the option parallel
|
||||
mark (aka --enable-parallel-mark) makes a BIG difference.
|
||||
|
||||
Takis Psarogiannakopoulos
|
||||
University of Cambridge
|
||||
Centre for Mathematical Sciences
|
||||
Department of Pure Mathematics
|
||||
Wilberforce Road
|
||||
Cambridge CB3 0WB ,UK , <[email protected]>
|
||||
January 2002
|
||||
|
||||
|
||||
Note (HB):
|
||||
The integration of this patch is currently not complete.
|
||||
The following patches against 6.1alpha3 where hard to move
|
||||
to alpha4, and are not integrated. There may also be minor
|
||||
problems with stylistic corrections made by me.
|
||||
|
||||
|
||||
--- ltconfig.ORIG Mon Jan 28 20:22:18 2002
|
||||
+++ ltconfig Mon Jan 28 20:44:00 2002
|
||||
@@ -689,6 +689,11 @@
|
||||
pic_flag=-Kconform_pic
|
||||
fi
|
||||
;;
|
||||
+ dgux*)
|
||||
+ pic_flag='-fPIC'
|
||||
+ link_static='-Bstatic'
|
||||
+ wl='-Wl,'
|
||||
+ ;;
|
||||
*)
|
||||
pic_flag='-fPIC'
|
||||
;;
|
||||
@@ -718,6 +723,12 @@
|
||||
# We can build DLLs from non-PIC.
|
||||
;;
|
||||
|
||||
+ dgux*)
|
||||
+ pic_flag='-KPIC'
|
||||
+ link_static='-Bstatic'
|
||||
+ wl='-Wl,'
|
||||
+ ;;
|
||||
+
|
||||
osf3* | osf4* | osf5*)
|
||||
# All OSF/1 code is PIC.
|
||||
wl='-Wl,'
|
||||
@@ -1154,6 +1165,22 @@
|
||||
fi
|
||||
;;
|
||||
|
||||
+ dgux*)
|
||||
+ ld_shlibs=yes
|
||||
+ # For both C/C++ ommit the deplibs. This is because we relying on the fact
|
||||
+ # that compilation of execitables will put them in correct order
|
||||
+ # in any case and sometimes are wrong when listed as deplibs (or missing some deplibs)
|
||||
+ # However when GNU ld and --whole-archive needs to be used we have the problem
|
||||
+ # that if the -fPIC *_s.a archive is linked through deplibs list we ommiting crucial
|
||||
+ # .lo/.o files from the created shared lib. This I think is not the case here.
|
||||
+ archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts'
|
||||
+ thread_safe_flag_spec='-pthread'
|
||||
+ wlarc=
|
||||
+ hardcode_libdir_flag_spec='-L$libdir'
|
||||
+ hardcode_shlibpath_var=no
|
||||
+ ac_cv_archive_cmds_needs_lc=no
|
||||
+ ;;
|
||||
+
|
||||
cygwin* | mingw*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
@@ -1497,7 +1524,7 @@
|
||||
;;
|
||||
|
||||
dgux*)
|
||||
- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
|
||||
+ archive_cmds='$CC -shared -h $soname -o $lib $libobjs $linkopts'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
@@ -2092,12 +2119,17 @@
|
||||
;;
|
||||
|
||||
dgux*)
|
||||
- version_type=linux
|
||||
+ version_type=dgux
|
||||
need_lib_prefix=no
|
||||
need_version=no
|
||||
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
|
||||
- soname_spec='${libname}${release}.so$major'
|
||||
+ library_names_spec='$libname.so$versuffix'
|
||||
+ soname_spec='$libname.so$versuffix'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
+ thread_safe_flag_spec='-pthread'
|
||||
+ wlarc=
|
||||
+ hardcode_libdir_flag_spec='-L$libdir'
|
||||
+ hardcode_shlibpath_var=no
|
||||
+ ac_cv_archive_cmds_needs_lc=no
|
||||
;;
|
||||
|
||||
sysv4*MP*)
|
||||
|
||||
|
||||
--- ltmain.sh.ORIG Mon Jan 28 20:31:18 2002
|
||||
+++ ltmain.sh Tue Jan 29 00:11:29 2002
|
||||
@@ -1072,11 +1072,38 @@
|
||||
esac
|
||||
;;
|
||||
|
||||
+ -thread*)
|
||||
+ # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread
|
||||
+ # with the switch -threads
|
||||
+ if test "$arg" = "-threads"; then
|
||||
+ case "$host" in
|
||||
+ i[3456]86-*-dgux*)
|
||||
+ deplibs="$deplibs $arg"
|
||||
+ continue
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ ;;
|
||||
+
|
||||
+ -pthread*)
|
||||
+ # DG/UX GCC 2.95.x, 3.x.x rev (DG/UX) links -lthread
|
||||
+ # with the switch -pthread
|
||||
+ if test "$arg" = "-pthread"; then
|
||||
+ case "$host" in
|
||||
+ i[3456]86-*-dgux*)
|
||||
+ deplibs="$deplibs $arg"
|
||||
+ continue
|
||||
+ ;;
|
||||
+ esac
|
||||
+ fi
|
||||
+ ;;
|
||||
+
|
||||
-l*)
|
||||
if test "$arg" = "-lc"; then
|
||||
case "$host" in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
|
||||
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*)
|
||||
# These systems don't actually have c library (as such)
|
||||
+ # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
@@ -1248,6 +1275,12 @@
|
||||
temp_deplibs=
|
||||
for deplib in $dependency_libs; do
|
||||
case "$deplib" in
|
||||
+ -thread*)
|
||||
+ temp_deplibs="$temp_deplibs $deplib"
|
||||
+ ;;
|
||||
+ -pthread)
|
||||
+ temp_deplibs="$temp_deplibs $deplib"
|
||||
+ ;;
|
||||
-R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
|
||||
case " $rpath $xrpath " in
|
||||
*" $temp_xrpath "*) ;;
|
||||
@@ -1709,6 +1742,13 @@
|
||||
done
|
||||
;;
|
||||
|
||||
+ dgux)
|
||||
+ # Leave mostly blank for DG/UX
|
||||
+ major=
|
||||
+ versuffix=".$current.$revision";
|
||||
+ verstring=
|
||||
+ ;;
|
||||
+
|
||||
linux)
|
||||
major=.`expr $current - $age`
|
||||
versuffix="$major.$age.$revision"
|
||||
@@ -1792,8 +1832,9 @@
|
||||
|
||||
dependency_libs="$deplibs"
|
||||
case "$host" in
|
||||
- *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
|
||||
+ *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | i[3456]86-*-dgux*)
|
||||
# these systems don't actually have a c library (as such)!
|
||||
+ # It is wrong in DG/UX to add -lc when creating shared/dynamic objs/libs
|
||||
;;
|
||||
*)
|
||||
# Add libc to deplibs on all other systems.
|
||||
@@ -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: [email protected]
|
||||
|
||||
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 [now gcconfig.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
|
||||
@@ -1 +0,0 @@
|
||||
See README.darwin for the latest Darwin/MacOSX information.
|
||||
@@ -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.
|
||||
@@ -1,322 +0,0 @@
|
||||
===========================================================================
|
||||
Kjetil S. Matheussen's notes (28-11-2000)
|
||||
===========================================================================
|
||||
Compiles under SAS/C again. Should allso still compile under other
|
||||
amiga compilers without big changes. I haven't checked if it still
|
||||
works under gcc, because I don't have gcc for amiga. But I have
|
||||
updated 'Makefile', and hope it compiles fine.
|
||||
|
||||
|
||||
WHATS NEW:
|
||||
|
||||
1.
|
||||
Made a pretty big effort in preventing GCs allocating-functions from returning
|
||||
chip-mem.
|
||||
|
||||
The lower part of the new file AmigaOS.c does this in various ways, mainly by
|
||||
wrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable,
|
||||
GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_page
|
||||
and GC_malloc_atomic_ignore_off_page. GC_realloc is allso wrapped, but
|
||||
doesn't do the same effort in preventing to return chip-mem.
|
||||
Other allocating-functions (f.ex. GC_*_typed_) can probably be
|
||||
used without any problems, but beware that the warn hook will not be called.
|
||||
In case of problems, don't define GC_AMIGA_FASTALLOC.
|
||||
|
||||
Programs using more time actually using the memory allocated
|
||||
(instead of just allocate and free rapidly) have
|
||||
the most to earn on this, but even gctest now normally runs twice
|
||||
as fast and uses less memory, on my poor 8MB machine.
|
||||
|
||||
The changes have only effect when there is no more
|
||||
fast-mem left. But with the way GC works, it
|
||||
could happen quite often. Beware that an atexit handler had to be added,
|
||||
so using the abort() function will make a big memory-loss.
|
||||
If you absolutely must call abort() instead of exit(), try calling
|
||||
the GC_amiga_free_all_mem function before abort().
|
||||
|
||||
New amiga-spesific compilation flags:
|
||||
|
||||
GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before,
|
||||
it will not try to force fast-mem out of the OS, and
|
||||
it will use normal calloc for allocation, and the rest
|
||||
of the following flags will have no effect.
|
||||
|
||||
GC_AMIGA_ONLYFAST - Makes GC never to return chip-mem. GC_AMIGA_RETRY have
|
||||
no effect if this flag is set.
|
||||
|
||||
GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. This
|
||||
usually is a success with the standard GC configuration.
|
||||
It is allso the most important flag to set to prevent
|
||||
GC from returning chip-mem. Beware that it slows down a lot
|
||||
when a program is rapidly allocating/deallocating when
|
||||
theres either very little fast-memory left or verly little
|
||||
chip-memory left. Its not a very common situation, but gctest
|
||||
sometimes (very rare) use many minutes because of this.
|
||||
|
||||
GC_AMIGA_RETRY - If gc succeed allocating memory, but it is chip-mem,
|
||||
try again and see if it is fast-mem. Most of the time,
|
||||
it will actually return fast-mem for the second try.
|
||||
I have set max number of retries to 9 or size/5000. You
|
||||
can change this if you like. (see GC_amiga_rec_alloc())
|
||||
|
||||
GC_AMIGA_PRINTSTATS - Gather some statistics during the execution of a
|
||||
program, and prints out the info when the atexit-handler
|
||||
is called.
|
||||
|
||||
My reccomendation is to set all this flags, except GC_AMIGA_PRINTSTATS and
|
||||
GC_AMIGA_ONLYFAST.
|
||||
|
||||
If your program demands high response-time, you should
|
||||
not define GC_AMIGA_GC, and possible allso define GC_AMIGA_ONLYFAST.
|
||||
GC_AMIGA_RETRY does not seem to slow down much.
|
||||
|
||||
Allso, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when
|
||||
compilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation-
|
||||
functions wrapped. (see gc.h)
|
||||
|
||||
Note that GC_realloc must not be called before any of
|
||||
the other above mentioned allocating-functions have been called. (shouldn't be
|
||||
any programs doing so either, I hope).
|
||||
|
||||
Another note. The allocation-function is wrapped when defining
|
||||
GC_AMIGA_FASTALLOC by letting the function go thru the new
|
||||
GC_amiga_allocwrapper_do function-pointer (see gc.h). Means that
|
||||
sending function-pointers, such as GC_malloc, GC_malloc_atomic, etc.,
|
||||
for later to be called like f.ex this, (*GC_malloc_functionpointer)(size),
|
||||
will not wrap the function. This is normally not a big problem, unless
|
||||
all allocation function is called like this, which will cause the
|
||||
atexit un-allocating function never to be called. Then you either
|
||||
have to manually add the atexit handler, or call the allocation-
|
||||
functions function-pointer functions like this;
|
||||
(*GC_amiga_allocwrapper_do)(size,GC_malloc_functionpointer).
|
||||
There are probably better ways this problem could be handled, unfortunately,
|
||||
I didn't find any without rewriting or replacing a lot of the GC-code, which
|
||||
I really didn't want to. (Making new GC_malloc_* functions, and just
|
||||
define f.ex GC_malloc as GC_amiga_malloc should allso work).
|
||||
|
||||
|
||||
New amiga-spesific function:
|
||||
|
||||
void GC_amiga_set_toany(void (*func)(void));
|
||||
|
||||
'func' is a function that will be called right before gc has to change
|
||||
allocation-method from MEMF_FAST to MEMF_ANY. Ie. when it is likely
|
||||
it will return chip-mem.
|
||||
|
||||
|
||||
2. A few small compiler-spesific additions to make it compile with SAS/C again.
|
||||
|
||||
3. Updated and rewritten the smakefile, so that it works again and that
|
||||
the "unnecesarry" 'SCOPTIONS' files could be removed. Allso included
|
||||
the cord-smakefile stuff in the main smakefile, so that the cord smakefile
|
||||
could be removed too. By writing smake -f Smakefile.smk, both gc.lib and
|
||||
cord.lib will be made.
|
||||
|
||||
|
||||
|
||||
STILL MISSING:
|
||||
|
||||
Programs can not be started from workbench, at least not for SAS/C. (Martin
|
||||
Tauchmanns note about that it now works with workbench is definitely wrong
|
||||
when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code,
|
||||
but I haven't tested it. I think the reason for MT to replace the
|
||||
"#if 0'ed"-code was only because it was a bit to SAS/C-spesific. But I
|
||||
don't know. An iconx-script solves this problem anyway.
|
||||
|
||||
|
||||
BEWARE!
|
||||
|
||||
-To run gctest, set the stack to around 200000 bytes first.
|
||||
-SAS/C-spesific: cord will crash if you compile gc.lib with
|
||||
either parm=reg or parm=both. (missing legal prototypes for
|
||||
function-pointers someplace is the reason I guess.).
|
||||
|
||||
|
||||
tested with software: Radium, http://www.stud.ifi.uio.no/~ksvalast/radium/
|
||||
|
||||
tested with hardware: MC68060
|
||||
|
||||
|
||||
[email protected]
|
||||
|
||||
|
||||
===========================================================================
|
||||
Martin Tauchmann's notes (1-Apr-99)
|
||||
===========================================================================
|
||||
|
||||
Works now, also with the GNU-C compiler V2.7.2.1. <ftp://ftp.unina.it/pub/amiga/geekgadgets/amiga/m68k/snapshots/971125/amiga-bin/>
|
||||
Modify the `Makefile`
|
||||
CC=cc $(ABI_FLAG)
|
||||
to
|
||||
CC=gcc $(ABI_FLAG)
|
||||
|
||||
TECHNICAL NOTES
|
||||
|
||||
- `GC_get_stack_base()`, `GC_register_data_segments()` works now with every
|
||||
C compiler; also Workbench.
|
||||
|
||||
- Removed AMIGA_SKIP_SEG, but the Code-Segment must not be scanned by GC.
|
||||
|
||||
|
||||
PROBLEMS
|
||||
- When the Linker, does`t merge all Code-Segments to an single one. LD of GCC
|
||||
do it always.
|
||||
|
||||
- With ixemul.library V47.3, when an GC program launched from another program
|
||||
(example: `Make` or `if_mach M68K AMIGA gctest`), `GC_register_data_segments()`
|
||||
found the Segment-List of the caller program.
|
||||
Can be fixed, if the run-time initialization code (for C programs, usually *crt0*)
|
||||
support `__data` and `__bss`.
|
||||
|
||||
- PowerPC Amiga currently not supported.
|
||||
|
||||
- Dynamic libraries (dyn_load.c) not supported.
|
||||
|
||||
|
||||
TESTED WITH SOFTWARE
|
||||
|
||||
`Optimized Oberon 2 C` (oo2c) <http://cognac.informatik.uni-kl.de/download/index.html>
|
||||
|
||||
|
||||
TESTED WITH HARDWARE
|
||||
|
||||
MC68030
|
||||
|
||||
|
||||
CONTACT
|
||||
|
||||
Please, contact me at <[email protected]>, when you change the
|
||||
Amiga port. <http://martintauchmann.home.pages.de>
|
||||
|
||||
===========================================================================
|
||||
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
|
||||
[email protected] (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.
|
||||
|
||||
[email protected] (preferred, but 1 week turnaround)
|
||||
[email protected] (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.
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
From: Margaret Fleck
|
||||
|
||||
Here's the key details of what worked for me, in case anyone else needs them.
|
||||
There may well be better ways to do some of this, but ....
|
||||
-- Margaret
|
||||
|
||||
|
||||
The badge4 has a StrongArm-1110 processor and a StrongArm-1111 coprocessor.
|
||||
|
||||
Assume that the garbage collector distribution is unpacked into /home/arm/gc6.0,
|
||||
which is visible to both the ARM machine and a linux desktop (e.g. via NFS mounting).
|
||||
|
||||
Assume that you have a file /home/arm/config.site with contents something like the
|
||||
example attached below. Notice that our local ARM toolchain lives in
|
||||
/skiff/local.
|
||||
|
||||
Go to /home/arm/gc6.0 directory. Do
|
||||
CONFIG_SITE=/home/arm/config.site ./configure --target=arm-linux
|
||||
--prefix=/home/arm/gc6.0
|
||||
|
||||
On your desktop, do:
|
||||
make
|
||||
make install
|
||||
The main garbage collector library should now be in ../gc6.0/lib/libgc.so.
|
||||
|
||||
To test the garbage collector, first do the following on your desktop
|
||||
make gctest
|
||||
./gctest
|
||||
Then do the following on the ARM machine
|
||||
cd .libs
|
||||
./lt-gctest
|
||||
|
||||
Do not try to do "make test" (the usual way of running the test
|
||||
program). This does not work and seems to erase some of the important
|
||||
files.
|
||||
|
||||
The gctest program claims to have succeeded. Haven't run any further tests
|
||||
with it, though I'll be doing so in the near future.
|
||||
|
||||
-------------------------------
|
||||
# config.site for configure
|
||||
|
||||
# Modified from the one provided by Bradley D. LaRonde
|
||||
# Edited by Andrej Cedilnik <[email protected]>
|
||||
# Used some of solutions by Tilman Vogel <[email protected]>
|
||||
# Ported for iPAQ Familiar by Oliver Kurth <[email protected]>
|
||||
# Further modified by Margaret Fleck for the badge4
|
||||
|
||||
HOSTCC=gcc
|
||||
|
||||
# Names of the cross-compilers
|
||||
CC=/skiff/local/bin/arm-linux-gcc
|
||||
CXX=/skiff/local/bin/arm-linux-gcc
|
||||
|
||||
# The cross compiler specific options
|
||||
CFLAGS="-O2 -fno-exceptions"
|
||||
CXXFLAGS="-O2 -fno-exceptions"
|
||||
CPPFLAGS="-O2 -fno-exceptions"
|
||||
LDFLAGS=""
|
||||
|
||||
# Some other programs
|
||||
AR=/skiff/local/bin/arm-linux-ar
|
||||
RANLIB=/skiff/local/bin/arm-linux-ranlib
|
||||
NM=/skiff/local/bin/arm-linux-nm
|
||||
ac_cv_path_NM=/skiff/local/bin/arm-linux-nm
|
||||
ac_cv_func_setpgrp_void=yes
|
||||
x_includes=/skiff/local/arm-linux/include/X11
|
||||
x_libraries=/skiff/local/arm-linux/lib/X11
|
||||
@@ -1,59 +0,0 @@
|
||||
As of GC6.0alpha8, we attempt to support GNU-style builds based on automake,
|
||||
autoconf and libtool. This is based almost entirely on Tom Tromey's work
|
||||
with gcj.
|
||||
|
||||
To build and install libraries use
|
||||
|
||||
configure; make; make install
|
||||
|
||||
The advantages of this process are:
|
||||
|
||||
1) It should eventually do a better job of automatically determining the
|
||||
right compiler to use, etc. It probably already does in some cases.
|
||||
|
||||
2) It tries to automatically set a good set of default GC parameters for
|
||||
the platform (e.g. thread support). It provides an easier way to configure
|
||||
some of the others.
|
||||
|
||||
3) It integrates better with other projects using a GNU-style build process.
|
||||
|
||||
4) It builds both dynamic and static libraries.
|
||||
|
||||
The known disadvantages are:
|
||||
|
||||
1) The build scripts are much more complex and harder to debug (though largely
|
||||
standard). I don't understand them all, and there's probably lots of redundant
|
||||
stuff.
|
||||
|
||||
2) It probably doesn't work on all Un*x-like platforms yet. It probably will
|
||||
never work on the rest.
|
||||
|
||||
3) The scripts are not yet complete. Some of the standard GNU targets don't
|
||||
yet work. (Corrections/additions are very welcome.)
|
||||
|
||||
The distribution should contain all files needed to run "configure" and "make",
|
||||
as well as the sources needed to regenerate the derived files. (If I missed
|
||||
some, please let me know.)
|
||||
|
||||
Note that the distribution comes with a "Makefile" which will be overwritten
|
||||
by "configure" with one that is not at all equiavelent to the original. The
|
||||
distribution contains a copy of the original "Makefile" in "Makefile.direct".
|
||||
|
||||
Important options to configure:
|
||||
|
||||
--prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[/usr/local]
|
||||
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[same as prefix]
|
||||
--enable-threads=TYPE choose threading package
|
||||
--enable-parallel-mark parallelize marking and free list construction
|
||||
--enable-full-debug include full support for pointer backtracing etc.
|
||||
|
||||
Unless --prefix is set (or --exec-prefix or one of the more obscure options),
|
||||
make install will install libgc.a and libgc.so in /usr/local/bin, which
|
||||
would typically require the "make install" to be run as root.
|
||||
|
||||
Most commonly --enable-threads=posix or will be needed. --enable-parallel-mark
|
||||
is recommended for multiprocessors if it is supported on the platform.
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,57 +0,0 @@
|
||||
This is an attempt to acknowledge early contributions to the garbage
|
||||
collector. Later contributions should instead be mentioned in
|
||||
README.changes.
|
||||
|
||||
HISTORY -
|
||||
|
||||
Early versions of this collector were developed as a part of research
|
||||
projects supported in part by the National Science Foundation
|
||||
and the Defense Advance Research Projects Agency.
|
||||
|
||||
The garbage collector originated as part of the run-time system for
|
||||
the Russell programming language implementation. The first version of the
|
||||
garbage collector was written primarily by Al Demers. It was then refined
|
||||
and mostly rewritten, primarily by Hans-J. Boehm, at Cornell U.,
|
||||
the University of Washington, Rice University (where it was first used for
|
||||
C and assembly code), Xerox PARC, SGI, and HP Labs. However, significant
|
||||
contributions have also been made by many others.
|
||||
|
||||
Some other contributors:
|
||||
|
||||
More recent contributors are mentioned in the modification history in
|
||||
README.changes. My apologies for any omissions.
|
||||
|
||||
The SPARC specific code was originally contributed by Mark Weiser.
|
||||
The Encore Multimax modifications were supplied by
|
||||
Kevin Kenny ([email protected]). The adaptation to the IBM PC/RT is largely
|
||||
due to Vernon Lee, on machines made available to Rice by IBM.
|
||||
Much of the HP specific code and a number of good suggestions for improving the
|
||||
generic code are due to Walter Underwood.
|
||||
Robert Brazile ([email protected]) originally supplied the ULTRIX code.
|
||||
Al Dosser ([email protected]) and Regis Cridlig ([email protected])
|
||||
subsequently provided updates and information on variation between ULTRIX
|
||||
systems. Parag Patel ([email protected]) supplied the A/UX code.
|
||||
Jesper Peterson([email protected]), Michel Schinz, and
|
||||
Martin Tauchmann ([email protected]) supplied the Amiga port.
|
||||
Thomas Funke ([email protected](?)) and
|
||||
Brian D.Carlstrom ([email protected]) supplied the NeXT ports.
|
||||
Douglas Steel ([email protected]) provided ICL DRS6000 code.
|
||||
Bill Janssen ([email protected]) supplied the SunOS dynamic loader
|
||||
specific code. Manuel Serrano ([email protected]) supplied linux and
|
||||
Sony News specific code. Al Dosser provided Alpha/OSF/1 code. He and
|
||||
Dave Detlefs([email protected]) also provided several generic bug fixes.
|
||||
Alistair G. Crooks([email protected]) supplied the NetBSD and 386BSD ports.
|
||||
Jeffrey Hsu ([email protected]) provided the FreeBSD port.
|
||||
Brent Benson ([email protected]) ported the collector to
|
||||
a Motorola 88K processor running CX/UX (Harris NightHawk).
|
||||
Ari Huttunen ([email protected]) generalized the OS/2 port to
|
||||
nonIBM development environments (a nontrivial task).
|
||||
Patrick Beard ([email protected]) provided the initial MacOS port.
|
||||
David Chase, then at Olivetti Research, suggested several improvements.
|
||||
Scott Schwartz ([email protected]) supplied some of the
|
||||
code to save and print call stacks for leak detection on a SPARC.
|
||||
Jesse Hull and John Ellis supplied the C++ interface code.
|
||||
Zhong Shao performed much of the experimentation that led to the
|
||||
current typed allocation facility. (His dynamic type inference code hasn't
|
||||
made it into the released version of the collector, yet.)
|
||||
|
||||
@@ -1,53 +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 ([email protected] or
|
||||
[email protected]).
|
||||
|
||||
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.
|
||||
|
||||
More details on the data structure can be found in
|
||||
|
||||
Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings",
|
||||
Software Practice and Experience 25, 12, December 1995, pp. 1315-1330.
|
||||
|
||||
A fundamentally similar "rope" data structure is also part of SGI's standard
|
||||
template library implementation, and its descendents, which include the
|
||||
GNU C++ library. That uses reference counting by default.
|
||||
There is a short description of that data structure at
|
||||
http://reality.sgi.com/boehm/ropeimpl.html . (The more official location
|
||||
http://www.sgi.com/tech/stl/ropeimpl.html is missing a figure.)
|
||||
|
||||
All of these are descendents of the "ropes" in Xerox Cedar.
|
||||
|
||||
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.
|
||||
|
||||
Note that CORD_printf iand friends use C functions with variable numbers
|
||||
of arguments in non-standard-conforming ways. This code is known to
|
||||
break on some platforms, notably PowerPC. It should be possible to
|
||||
build the remainder of the library (everything but cordprnt.c) on
|
||||
any platform that supports the collector.
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
6.5 update:
|
||||
I disabled incremental GC on Darwin in this version, since I couldn't
|
||||
get gctest to pass when the GC was built as a dynamic library. Building
|
||||
with -DMPROTECT_VDB (and threads) on the command line should get you
|
||||
back to the old state. - HB
|
||||
|
||||
./configure --enable-cplusplus results in a "make check" failure, probably
|
||||
because the ::delete override ends up in a separate dl, and Darwin dynamic
|
||||
loader semantics appear to be such that this is not really visible to the
|
||||
main program, unlike on ELF systems. Someone who understands dynamic
|
||||
loading needs to lookat this. For now, gc_cpp.o needs to be linked
|
||||
statically, if needed. - HB
|
||||
|
||||
Darwin/MacOSX Support - December 16, 2003
|
||||
=========================================
|
||||
|
||||
Important Usage Notes
|
||||
=====================
|
||||
|
||||
GC_init() MUST be called before calling any other GC functions. This
|
||||
is necessary to properly register segments in dynamic libraries. This
|
||||
call is required even if you code does not use dynamic libraries as the
|
||||
dyld code handles registering all data segments.
|
||||
|
||||
When your use of the garbage collector is confined to dylibs and you
|
||||
cannot call GC_init() before your libraries' static initializers have
|
||||
run and perhaps called GC_malloc(), create an initialization routine
|
||||
for each library to call GC_init():
|
||||
|
||||
#include <gc/gc.h>
|
||||
extern "C" void my_library_init() { GC_init(); }
|
||||
|
||||
Compile this code into a my_library_init.o, and link it into your
|
||||
dylib. When you link the dylib, pass the -init argument with
|
||||
_my_library_init (e.g. gcc -dynamiclib -o my_library.dylib a.o b.o c.o
|
||||
my_library_init.o -init _my_library_init). This causes
|
||||
my_library_init() to be called before any static initializers, and
|
||||
will initialize the garbage collector properly.
|
||||
|
||||
Note: It doesn't hurt to call GC_init() more than once, so it's best,
|
||||
if you have an application or set of libraries that all use the
|
||||
garbage collector, to create an initialization routine for each of
|
||||
them that calls GC_init(). Better safe than sorry.
|
||||
|
||||
The incremental collector is still a bit flaky on darwin. It seems to
|
||||
work reliably with workarounds for a few possible bugs in place however
|
||||
these workaround may not work correctly in all cases. There may also
|
||||
be additional problems that I have not found.
|
||||
|
||||
Thread-local GC allocation will not work with threads that are not
|
||||
created using the GC-provided override of pthread_create(). Threads
|
||||
created without the GC-provided pthread_create() do not have the
|
||||
necessary data structures in the GC to store this data.
|
||||
|
||||
|
||||
Implementation Information
|
||||
==========================
|
||||
Darwin/MacOSX support is nearly complete. Thread support is reliable on
|
||||
Darwin 6.x (MacOSX 10.2) and there have been reports of success on older
|
||||
Darwin versions (MacOSX 10.1). Shared library support had also been
|
||||
added and the gc can be run from a shared library. There is currently only
|
||||
support for Darwin/PPC although adding x86 support should be trivial.
|
||||
|
||||
Thread support is implemented in terms of mach thread_suspend and
|
||||
thread_resume calls. These provide a very clean interface to thread
|
||||
suspension. This implementation doesn't rely on pthread_kill so the
|
||||
code works on Darwin < 6.0 (MacOSX 10.1). All the code to stop and
|
||||
start the world is located in darwin_stop_world.c.
|
||||
|
||||
Since not all uses of the GC enable clients to override pthread_create()
|
||||
before threads have been created, the code for stopping the world has
|
||||
been rewritten to look for threads using Mach kernel calls. Each
|
||||
thread identified in this way is suspended and resumed as above. In
|
||||
addition, since Mach kernel threads do not contain pointers to their
|
||||
stacks, a stack-walking function has been written to find the stack
|
||||
limits. Given an initial stack pointer (for the current thread, a
|
||||
pointer to a stack-allocated local variable will do; for a non-active
|
||||
thread, we grab the value of register 1 (on PowerPC)), it
|
||||
will walk the PPC Mach-O-ABI compliant stack chain until it reaches the
|
||||
top of the stack. This appears to work correctly for GCC-compiled C,
|
||||
C++, Objective-C, and Objective-C++ code, as well as for Java
|
||||
programs that use JNI. If you run code that does not follow the stack
|
||||
layout or stack pointer conventions laid out in the PPC Mach-O ABI,
|
||||
then this will likely crash the garbage collector.
|
||||
|
||||
The original incremental collector support unfortunatelly no longer works
|
||||
on recent Darwin versions. It also relied on some undocumented kernel
|
||||
structures. Mach, however, does have a very clean interface to exception
|
||||
handing. The current implementation uses Mach's exception handling.
|
||||
|
||||
Much thanks goes to Andrew Stone, Dietmar Planitzer, Andrew Begel,
|
||||
Jeff Sturm, and Jesse Rosenstock for all their work on the
|
||||
Darwin/OS X port.
|
||||
|
||||
-Brian Alliet
|
||||
[email protected]
|
||||
|
||||
|
||||
Older Information (Most of this no longer applies to the current code)
|
||||
======================================================================
|
||||
|
||||
While the GC should work on MacOS X Server, MacOS X and Darwin, I only tested
|
||||
it on MacOS X Server.
|
||||
I've added a PPC assembly version of GC_push_regs(), thus the setjmp() hack is
|
||||
no longer necessary. Incremental collection is supported via mprotect/signal.
|
||||
The current solution isn't really optimal because the signal handler must decode
|
||||
the faulting PPC machine instruction in order to find the correct heap address.
|
||||
Further, it must poke around in the register state which the kernel saved away
|
||||
in some obscure register state structure before it calls the signal handler -
|
||||
needless to say the layout of this structure is no where documented.
|
||||
Threads and dynamic libraries are not yet supported (adding dynamic library
|
||||
support via the low-level dyld API shouldn't be that hard).
|
||||
|
||||
The original MacOS X port was brought to you by Andrew Stone.
|
||||
|
||||
|
||||
June, 1 2000
|
||||
|
||||
Dietmar Planitzer
|
||||
[email protected]
|
||||
|
||||
Note from Andrew Begel:
|
||||
|
||||
One more fix to enable gc.a to link successfully into a shared library for
|
||||
MacOS X. You have to add -fno-common to the CFLAGS in the Makefile. MacOSX
|
||||
disallows common symbols in anything that eventually finds its way into a
|
||||
shared library. (I don't completely understand why, but -fno-common seems to
|
||||
work and doesn't mess up the garbage collector's functionality).
|
||||
|
||||
Feb 26, 2003
|
||||
|
||||
Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support.
|
||||
GC_MACOSX_THREADS should be defined in the build and in clients. Real
|
||||
dynamic library support is still missing, i.e. dynamic library data segments
|
||||
are still not scanned. Code that stores pointers to the garbage collected
|
||||
heap in statically allocated variables should not reside in a dynamic
|
||||
library. This still doesn't appear to be 100% reliable.
|
||||
|
||||
Mar 10, 2003
|
||||
Brian Alliet contributed dynamic library support for MacOSX. It could also
|
||||
use more testing.
|
||||
@@ -1,12 +0,0 @@
|
||||
[Original version supplied by Xiaokun Zhu <[email protected]>]
|
||||
[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.
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
The garbage collector looks at a number of environment variables which are
|
||||
then used to affect its operation. These are examined only on Un*x-like
|
||||
platforms and win32.
|
||||
|
||||
GC_INITIAL_HEAP_SIZE=<bytes> - Initial heap size in bytes. May speed up
|
||||
process start-up.
|
||||
|
||||
GC_MAXIMUM_HEAP_SIZE=<bytes> - Maximum collected heap size.
|
||||
|
||||
GC_LOOP_ON_ABORT - Causes the collector abort routine to enter a tight loop.
|
||||
This may make it easier to debug, such a process, especially
|
||||
for multithreaded platforms that don't produce usable core
|
||||
files, or if a core file would be too large. On some
|
||||
platforms, this also causes SIGSEGV to be caught and
|
||||
result in an infinite loop in a handler, allowing
|
||||
similar debugging techniques.
|
||||
|
||||
GC_PRINT_STATS - Turn on as much logging as is easily feasible without
|
||||
adding signifcant runtime overhead. Doesn't work if
|
||||
the collector is built with SMALL_CONFIG. Overridden
|
||||
by setting GC_quiet. On by default if the collector
|
||||
was built without -DSILENT.
|
||||
|
||||
GC_DUMP_REGULARLY - Generate a GC debugging dump GC_dump() on startup
|
||||
and during every collection. Very verbose. Useful
|
||||
if you have a bug to report, but please include only the
|
||||
last complete dump.
|
||||
|
||||
GC_BACKTRACES=<n> - Generate n random backtraces (for heap profiling) after
|
||||
each GC. Collector must have been built with
|
||||
KEEP_BACK_PTRS. This won't generate useful output unless
|
||||
most objects in the heap were allocated through debug
|
||||
allocators. This is intended to be only a statistical
|
||||
sample; individual traces may be erroneous due to
|
||||
concurrent heap mutation.
|
||||
|
||||
GC_PRINT_ADDRESS_MAP - Linux only. Dump /proc/self/maps, i.e. various address
|
||||
maps for the process, to stderr on every GC. Useful for
|
||||
mapping root addresses to source for deciphering leak
|
||||
reports.
|
||||
|
||||
GC_NPROCS=<n> - Linux w/threads only. Explicitly sets the number of processors
|
||||
that the GC should expect to use. Note that setting this to 1
|
||||
when multiple processors are available will preserve
|
||||
correctness, but may lead to really horrible performance,
|
||||
since the lock implementation will immediately yield without
|
||||
first spinning.
|
||||
|
||||
GC_MARKERS=<n> - Linux w/threads and parallel marker only. Set the number
|
||||
of marker threads. This is normaly set to the number of
|
||||
processors. It is safer to adjust GC_MARKERS than GC_NPROCS,
|
||||
since GC_MARKERS has no impact on the lock implementation.
|
||||
|
||||
GC_NO_BLACKLIST_WARNING - Prevents the collector from issuing
|
||||
warnings about allocations of very large blocks.
|
||||
Deprecated. Use GC_LARGE_ALLOC_WARN_INTERVAL instead.
|
||||
|
||||
GC_LARGE_ALLOC_WARN_INTERVAL=<n> - Print every nth warning about very large
|
||||
block allocations, starting with the nth one. Small values
|
||||
of n are generally benign, in that a bounded number of
|
||||
such warnings generally indicate at most a bounded leak.
|
||||
For best results it should be set at 1 during testing.
|
||||
Default is 5. Very large numbers effectively disable the
|
||||
warning.
|
||||
|
||||
GC_IGNORE_GCJ_INFO - Ignore the type descriptors implicitly supplied by
|
||||
GC_gcj_malloc and friends. This is useful for debugging
|
||||
descriptor generation problems, and possibly for
|
||||
temporarily working around such problems. It forces a
|
||||
fully conservative scan of all heap objects except
|
||||
those known to be pointerfree, and may thus have other
|
||||
adverse effects.
|
||||
|
||||
GC_PRINT_BACK_HEIGHT - Print max length of chain through unreachable objects
|
||||
ending in a reachable one. If this number remains
|
||||
bounded, then the program is "GC robust". This ensures
|
||||
that a fixed number of misidentified pointers can only
|
||||
result in a bounded space leak. This currently only
|
||||
works if debugging allocation is used throughout.
|
||||
It increases GC space and time requirements appreciably.
|
||||
This feature is still somewhat experimental, and requires
|
||||
that the collector have been built with MAKE_BACK_GRAPH
|
||||
defined. For details, see Boehm, "Bounding Space Usage
|
||||
of Conservative Garbage Collectors", POPL 2001, or
|
||||
http://lib.hpl.hp.com/techpubs/2001/HPL-2001-251.html .
|
||||
|
||||
GC_RETRY_SIGNALS, GC_NO_RETRY_SIGNALS - Try to compensate for lost
|
||||
thread suspend signals in linux_threads.c. On by
|
||||
default for GC_OSF1_THREADS, off otherwise. Note
|
||||
that this does not work around a possible loss of
|
||||
thread restart signals. This seems to be necessary for
|
||||
some versions of Tru64. Since we've previously seen
|
||||
similar issues on some other operating systems, it
|
||||
was turned into a runtime flag to enable last-minute
|
||||
work-arounds.
|
||||
|
||||
GC_IGNORE_FB[=<n>] - (Win32 only.) Try to avoid treating a mapped
|
||||
frame buffer as part of the root set. Certain (higher end?)
|
||||
graphics cards seems to result in the graphics memory mapped
|
||||
into the user address space as writable memory.
|
||||
Unfortunately, there seems to be no systematic way to
|
||||
identify such memory. Setting the environment variable to n
|
||||
causes the collector to ignore mappings longer than n MB.
|
||||
The default value of n is currently 15. (This should cover
|
||||
a 16 MB graphics card, since the mapping appears to be slightly
|
||||
shorter than all of graphics memory. It will fail if a dll
|
||||
writes pointers to collectable objects into a data segment
|
||||
whose length is >= 15MB. Empirically that's rare, but
|
||||
certainly possible.) WARNING: Security sensitive applications
|
||||
should probably disable this feature by setting
|
||||
GC_disallow_ignore_fb, or by building with -DNO_GETENV,
|
||||
since small values could force collection of reachable
|
||||
objects, which is conceivably a (difficult to exploit)
|
||||
security hole. GC_IGNORE_FB values less than 3 MB
|
||||
are never honored, eliminating this risk for most,
|
||||
but not all, applications. This feature is likely to disappear
|
||||
if/when we find a less disgusting "solution".
|
||||
IN VERSION 6.4 AND LATER, THIS SHOULD BE UNNECESSARY.
|
||||
|
||||
The following turn on runtime flags that are also program settable. Checked
|
||||
only during initialization. We expect that they will usually be set through
|
||||
other means, but this may help with debugging and testing:
|
||||
|
||||
GC_ENABLE_INCREMENTAL - Turn on incremental collection at startup. Note that,
|
||||
depending on platform and collector configuration, this
|
||||
may involve write protecting pieces of the heap to
|
||||
track modifications. These pieces may include pointerfree
|
||||
objects or not. Although this is intended to be
|
||||
transparent, it may cause unintended system call failures.
|
||||
Use with caution.
|
||||
|
||||
GC_PAUSE_TIME_TARGET - Set the desired garbage collector pause time in msecs.
|
||||
This only has an effect if incremental collection is
|
||||
enabled. If a collection requires appreciably more time
|
||||
than this, the client will be restarted, and the collector
|
||||
will need to do additional work to compensate. The
|
||||
special value "999999" indicates that pause time is
|
||||
unlimited, and the incremental collector will behave
|
||||
completely like a simple generational collector. If
|
||||
the collector is configured for parallel marking, and
|
||||
run on a multiprocessor, incremental collection should
|
||||
only be used with unlimited pause time.
|
||||
|
||||
GC_FIND_LEAK - Turns on GC_find_leak and thus leak detection. Forces a
|
||||
collection at program termination to detect leaks that would
|
||||
otherwise occur after the last GC.
|
||||
|
||||
GC_ALL_INTERIOR_POINTERS - Turns on GC_all_interior_pointers and thus interior
|
||||
pointer recognition.
|
||||
|
||||
GC_DONT_GC - Turns off garbage collection. Use cautiously.
|
||||
@@ -1,81 +0,0 @@
|
||||
GC on EWS4800
|
||||
-------------
|
||||
|
||||
1. About EWS4800
|
||||
EWS4800 is 32bit/64bit workstation.
|
||||
|
||||
Vender: NEC Corporation
|
||||
OS: UX/4800 R9.* - R13.* (SystemV R4.2)
|
||||
CPU: R4000, R4400, R10000 (MIPS)
|
||||
|
||||
2. Compiler
|
||||
|
||||
32bit:
|
||||
Use ANSI C compiler.
|
||||
CC = /usr/abiccs/bin/cc
|
||||
|
||||
64bit:
|
||||
Use 64bit ANSI C compiler.
|
||||
CC = /usr/ccs64/bin/cc
|
||||
AR = /usr/ccs64/bin/ar
|
||||
|
||||
3. ELF file format
|
||||
*** Caution: The following infomation is empirical. ***
|
||||
|
||||
32bit:
|
||||
ELF file has an unique format. (See a.out(4) and end(3C).)
|
||||
|
||||
&_start
|
||||
: text segment
|
||||
&etext
|
||||
DATASTART
|
||||
: data segment (initialized)
|
||||
&edata
|
||||
DATASTART2
|
||||
: data segment (uninitialized)
|
||||
&end
|
||||
|
||||
Here, DATASTART and DATASTART2 are macros of GC, and are defined as
|
||||
the following equations. (See include/private/gcconfig.h.)
|
||||
The algorithm for DATASTART is similar with the function
|
||||
GC_SysVGetDataStart() in os_dep.c.
|
||||
|
||||
DATASTART = ((&etext + 0x3ffff) & ~0x3ffff) + (&etext & 0xffff)
|
||||
|
||||
Dynamically linked:
|
||||
DATASTART2 = (&_gp + 0x8000 + 0x3ffff) & ~0x3ffff
|
||||
|
||||
Statically linked:
|
||||
DATASTART2 = &edata
|
||||
|
||||
GC has to check addresses both between DATASTART and &edata, and
|
||||
between DATASTART2 and &end. If a program accesses between &etext
|
||||
and DATASTART, or between &edata and DATASTART2, the segmentation
|
||||
error occurs and the program stops.
|
||||
|
||||
If a program is statically linked, there is not a gap between
|
||||
&edata and DATASTART2. The global symbol &_DYNAMIC_LINKING is used
|
||||
for the detection.
|
||||
|
||||
64bit:
|
||||
ELF file has a simple format. (See end(3C).)
|
||||
|
||||
_ftext
|
||||
: text segment
|
||||
_etext
|
||||
_fdata = DATASTART
|
||||
: data segment (initialized)
|
||||
_edata
|
||||
_fbss
|
||||
: data segment (uninitialized)
|
||||
_end = DATAEND
|
||||
|
||||
--
|
||||
Hironori SAKAMOTO <[email protected]>
|
||||
|
||||
|
||||
When using the new "configure; make" build process, please
|
||||
run configure with the --disable-shared option. "Make check" does not
|
||||
yet pass with dynamic libraries. Ther reasons for that are not yet
|
||||
understood. (HB, paraphrasing message from Hironori SAKAMOTO.)
|
||||
|
||||
Loaded 100 of 580 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user