* .hgignore: Added src/mm/boehm-gc/.dirstamp.
* src/mm/boehm-gc/NT_X64_THREADS_MAKEFILE: Added.
* src/mm/boehm-gc/include/extra/gc.h,
src/mm/boehm-gc/include/extra/gc_cpp.h,
src/mm/boehm-gc/include/gc_version.h,
src/mm/boehm-gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/armcc/arm_v6.h,
src/mm/boehm-gc/tests/huge_test.c,
src/mm/boehm-gc/tests/smash_test.c: Likewise.
* src/mm/boehm-gc/version.h: Removed.
--HG--
branch : gc7-branch
src/cacaoh/cacaoh
src/classes/classes/
src/classes/vm.zip
+src/mm/boehm-gc/.dirstamp
src/mm/boehm-gc/atomic_ops.c
src/mm/boehm-gc/atomic_ops_sysdeps.S
src/mm/boehm-gc/bdw-gc.pc
--- /dev/null
+# Makefile for Windows NT. Assumes Microsoft compiler.
+# modified 2007 August by Friedrich Dominicus:
+# - copied from NT_X64_STATIC_THREADS_MAKEFILES
+# - checked agaist NT_THREADS_MAKEFILE
+# - added changes to integrate the tools
+# - currently just with debug information
+# problems can be sent to
+# frido at q-software-solutions.de
+#
+# or the mailing list
+
+
+MY_CPU=AMD64
+CPU=$(MY_CPU)
+!include <ntwin32.mak>
+
+# Make sure that .cc is not viewed as a suffix. It is for VC++2005, but # not earlier versions. We can deal with either, but not inconsistency.
+.SUFFIXES:
+.SUFFIXES: .obj .cpp .c
+
+# Atomic_ops installation directory. For win32, the source directory
+# should do, since we only need the headers.
+# We assume this was manually unpacked, since I'm not sure there is
+# a Windows standard command line tool to do this.
+AO_VERSION=1.2
+AO_SRC_DIR=libatomic_ops-$(AO_VERSION)/src
+AO_INCLUDE_DIR=$(AO_SRC_DIR)
+
+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 msvc_dbg.obj thread_local_alloc.obj
+
+all: gc64_dll.dll gctest.exe cord\de.exe test_cpp.exe
+
+.c.obj:
+ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_DLL -D__STDC__ -DGC_BUILD -DGC_WIN32_THREADS $*.c /Fo$*.obj /wd4701 -D_CRT_SECURE_NO_DEPRECATE
+# Disable "may not be initialized" warnings. They're too approximate.
+# Disable crt security warnings, since unfortunately they warn about all sorts # of safe uses of strncpy. It would be nice to leave the rest enabled.
+
+.cpp.obj:
+ $(cc) $(cdebug) $(cflags) $(cvarsmt) -Iinclude -I$(AO_INCLUDE_DIR) -DALL_INTERIOR_POINTERS -DGC_NOT_DLL-DALL_INTERIOR_POINTERS -DGC_DLL -D__STDC__ -DGC_BUILD -DGC_WIN32_THREADS $*.CPP /Fo$*.obj -D_CRT_SECURE_NO_DEPRECATE
+
+$(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 include\private\msvc_dbg.h
+
+
+LINK64=link.exe
+LINK64_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib \
+shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo \
+/subsystem:windows /dll /incremental:no /pdb:"gc.pdb" /machine:X64 /out:"gc64_dll.dll" \
+/implib:"gc64_dll.lib"
+
+gc64_dll.dll : $(OBJS)
+ $(LINK64) $(ldebug) $(LINK64_FLAGS) $(OBJS)
+
+
+
+gctest.exe: tests\test.obj gc64_dll.lib
+# This produces a "GUI" applications that opens no windows and writes to the log file
+# "gc.log". This was done to make the result runnable under win32s and
+# should be fixed.
+ $(link) $(ldebug) $(guiflags) -stack:131072 -out:$*.exe tests\test.obj $(guilibs) gc64_dll.lib
+
+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 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 gc64_dll.lib
+ $(link) $(ldebug) $(guiflags) -stack:16384 -out:cord\de.exe cord\cordbscs.obj cord\cordxtra.obj cord\de.obj cord\de_win.obj cord\de_win.rbj gc64_dll.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 gc64_dll.lib
+ $(link) $(ldebug) $(guiflags) -stack:16384 -out:test_cpp.exe test_cpp.obj gc64_dll.lib $(guilibs)
+
+AO_SCR_DIR:
+ tar xvfz $(AO_SRC_DIR).tar.gz;
+
+clean:
+ del *.obj gc64_dll.lib gc64_dll.dll
--- /dev/null
+/* This file is installed for backward compatibility. */
+#include <gc/gc.h>
--- /dev/null
+/* This file is installed for backward compatibility. */
+#include <gc/gc_cpp.h>
--- /dev/null
+/* The version here should match that in configure/configure.ac */
+/* Eventually this one may become unnecessary. For now we need */
+/* it to keep the old-style build process working. */
+#define GC_TMP_VERSION_MAJOR 7
+#define GC_TMP_VERSION_MINOR 1
+#define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA
+
+#ifndef GC_NOT_ALPHA
+# define GC_NOT_ALPHA 0xff
+#endif
+
+#if defined(GC_VERSION_MAJOR)
+# if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR || \
+ GC_TMP_VERSION_MINOR != GC_VERSION_MINOR || \
+ defined(GC_ALPHA_VERSION) != (GC_TMP_ALPHA_VERSION != GC_NOT_ALPHA) || \
+ defined(GC_ALPHA_VERSION) && GC_TMP_ALPHA_VERSION != GC_ALPHA_VERSION
+# error Inconsistent version info. Check README, version.h, and configure.ac.
+# endif
+#else
+# define GC_VERSION_MAJOR GC_TMP_VERSION_MAJOR
+# define GC_VERSION_MINOR GC_TMP_VERSION_MINOR
+# define GC_ALPHA_VERSION GC_TMP_ALPHA_VERSION
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2007 by NEC LE-IT: All rights reserved.
+ * A transcription of ARMv6 atomic operations for the ARM Realview Toolchain.
+ * This code works with armcc from RVDS 3.1
+ * This is based on work in gcc/arm.h by
+ * Copyright (c) 1991-1994 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.
+ *
+ */
+#include "../read_ordered.h"
+#include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */
+
+#if __TARGET_ARCH_ARM < 6
+Dont use with ARM instruction sets lower than v6
+#endif
+
+/* NEC LE-IT: ARMv6 is the first architecture providing support for simple LL/SC
+ * A data memory barrier must be raised via CP15 command (see documentation).
+ *
+ * ARMv7 is compatible to ARMv6 but has a simpler command for issuing a
+ * memory barrier (DMB). Raising it via CP15 should still work as told me by the
+ * support engineers. If it turns out to be much quicker than we should implement
+ * custom code for ARMv7 using the asm { dmb } command.
+ *
+ * If only a single processor is used, we can define AO_UNIPROCESSOR
+ * and do not need to access CP15 for ensuring a DMB at all.
+*/
+
+AO_INLINE void
+AO_nop_full()
+{
+# ifndef AO_UNIPROCESSOR
+ unsigned int dest=0;
+ /* issue an data memory barrier (keeps ordering of memory transactions */
+ /* before and after this operation) */
+ __asm { mcr p15,0,dest,c7,c10,5 } ;
+# endif
+}
+
+#define AO_HAVE_nop_full
+
+AO_INLINE AO_t
+AO_load(volatile AO_t *addr)
+{
+ /* Cast away the volatile in case it adds fence semantics. */
+ return (*(AO_t *)addr);
+}
+#define AO_HAVE_load
+
+/* NEC LE-IT: atomic "store" - according to ARM documentation this is
+ * the only safe way to set variables also used in LL/SC environment.
+ * A direct write won't be recognized by the LL/SC construct in other CPUs.
+ *
+ * HB: Based on subsequent discussion, I think it would be OK to use an
+ * ordinary store here if we knew that interrupt handlers always cleared
+ * the reservation. They should, but there is some doubt that this is
+ * currently always the case for e.g. Linux.
+*/
+AO_INLINE void AO_store(volatile AO_t *addr, AO_t value)
+{
+ unsigned long tmp;
+
+retry:
+__asm {
+ ldrex tmp, [addr]
+ strex tmp, value, [addr]
+ teq tmp, #0
+ bne retry
+ };
+}
+#define AO_HAVE_store
+
+/* NEC LE-IT: replace the SWAP as recommended by ARM:
+
+ "Applies to: ARM11 Cores
+ Though the SWP instruction will still work with ARM V6 cores, it is recommended
+ to use the new V6 synchronization instructions. The SWP instruction produces
+ locked read and write accesses which are atomic, i.e. another operation cannot
+ be done between these locked accesses which ties up external bus (AHB,AXI)
+ bandwidth and can increase worst case interrupt latencies. LDREX,STREX are
+ more flexible, other instructions can be done between the LDREX and STREX accesses.
+ "
+*/
+AO_INLINE AO_TS_t
+AO_test_and_set(volatile AO_TS_t *addr) {
+
+ AO_TS_t oldval;
+ unsigned long tmp;
+ unsigned long one = 1;
+retry:
+__asm {
+ ldrex oldval, [addr]
+ strex tmp, one, [addr]
+ teq tmp, #0
+ bne retry
+ }
+
+ return oldval;
+}
+
+#define AO_HAVE_test_and_set
+
+/* NEC LE-IT: fetch and add for ARMv6 */
+AO_INLINE AO_t
+AO_fetch_and_add(volatile AO_t *p, AO_t incr)
+{
+ unsigned long tmp,tmp2;
+ AO_t result;
+
+retry:
+__asm {
+ ldrex result, [p]
+ add tmp, incr, result
+ strex tmp2, tmp, [p]
+ teq tmp2, #0
+ bne retry }
+
+ return result;
+}
+
+#define AO_HAVE_fetch_and_add
+
+/* NEC LE-IT: fetch and add1 for ARMv6 */
+AO_INLINE AO_t
+AO_fetch_and_add1(volatile AO_t *p)
+{
+ unsigned long tmp,tmp2;
+ AO_t result;
+
+retry:
+__asm {
+ ldrex result, [p]
+ add tmp, result, #1
+ strex tmp2, tmp, [p]
+ teq tmp2, #0
+ bne retry
+ }
+
+ return result;
+}
+
+#define AO_HAVE_fetch_and_add1
+
+/* NEC LE-IT: fetch and sub for ARMv6 */
+AO_INLINE AO_t
+AO_fetch_and_sub1(volatile AO_t *p)
+{
+ unsigned long tmp,tmp2;
+ AO_t result;
+
+retry:
+__asm {
+ ldrex result, [p]
+ sub tmp, result, #1
+ strex tmp2, tmp, [p]
+ teq tmp2, #0
+ bne retry
+ }
+
+ return result;
+}
+
+#define AO_HAVE_fetch_and_sub1
+
+/* NEC LE-IT: compare and swap */
+/* Returns nonzero if the comparison succeeded. */
+AO_INLINE int
+AO_compare_and_swap(volatile AO_t *addr,
+ AO_t old_val, AO_t new_val)
+{
+ AO_t result,tmp;
+
+retry:
+__asm__ {
+ ldrex tmp, [addr]
+ mov result, #2
+ teq tmp, old_val
+ strexeq result, new_val, [addr]
+ teq result, #1
+ beq retry
+ }
+
+ return (result^2)>>1;
+}
+#define AO_HAVE_compare_and_swap
+
+#endif // __TARGET_ARCH_ARM
--- /dev/null
+#include <stdlib.h>
+#include <limits.h>
+#include <stdio.h>
+#include <gc.h>
+
+/*
+ * Check that very large allocation requests fail. "Success" would usually
+ * indicate that the the size was somehow converted to a negative
+ * number. Clients shouldn't do this, but we should fail in the
+ * expected manner.
+ */
+
+
+main()
+{
+ GC_INIT();
+
+ GC_set_max_heap_size(100*1024*1024);
+ /* Otherwise heap expansion aborts when deallocating large block. */
+ /* That's OK. We test this corner case mostly to make sure that */
+ /* it fails predictably. */
+ GC_expand_hp(1024*1024*5);
+ if (sizeof(long) == sizeof(void *)) {
+ void *r = GC_MALLOC(LONG_MAX-1024);
+ if (0 != r) {
+ fprintf(stderr,
+ "Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
+ exit(1);
+ }
+ r = GC_MALLOC(LONG_MAX);
+ if (0 != r) {
+ fprintf(stderr,
+ "Size LONG_MAX allocation unexpectedly succeeded\n");
+ exit(1);
+ }
+ r = GC_MALLOC((size_t)LONG_MAX + 1024);
+ if (0 != r) {
+ fprintf(stderr,
+ "Size LONG_MAX+1024 allocation unexpectedly succeeded\n");
+ exit(1);
+ }
+ }
+ return 0;
+}
+
--- /dev/null
+/*
+ * Test that overwrite error detection works reasonably.
+ */
+#define GC_DEBUG
+#include <gc.h>
+#include <stdio.h>
+
+#define COUNT 7000
+#define SIZE 40
+
+char * A[COUNT];
+
+int main ()
+{
+ int i;
+ char *p;
+
+ GC_INIT();
+
+ for (i = 0; i < COUNT; ++i) {
+ A[i] = p = GC_MALLOC(SIZE);
+
+ if (i%3000 == 0) GC_gcollect();
+ if (i%5678 == 0) p[SIZE + i/2000] = 42;
+ }
+ return 0;
+}
+
+++ /dev/null
-/* The version here should match that in configure/configure.ac */
-/* Eventually this one may become unnecessary. For now we need */
-/* it to keep the old-style build process working. */
-#define GC_TMP_VERSION_MAJOR 7
-#define GC_TMP_VERSION_MINOR 0
-#define GC_TMP_ALPHA_VERSION GC_NOT_ALPHA
-
-#ifndef GC_NOT_ALPHA
-# define GC_NOT_ALPHA 0xff
-#endif
-
-#if defined(GC_VERSION_MAJOR)
-# if GC_TMP_VERSION_MAJOR != GC_VERSION_MAJOR || \
- GC_TMP_VERSION_MINOR != GC_VERSION_MINOR || \
- defined(GC_ALPHA_VERSION) != (GC_TMP_ALPHA_VERSION != GC_NOT_ALPHA) || \
- defined(GC_ALPHA_VERSION) && GC_TMP_ALPHA_VERSION != GC_ALPHA_VERSION
-# error Inconsistent version info. Check README, version.h, and configure.ac.
-# endif
-#else
-# define GC_VERSION_MAJOR GC_TMP_VERSION_MAJOR
-# define GC_VERSION_MINOR GC_TMP_VERSION_MINOR
-# define GC_ALPHA_VERSION GC_TMP_ALPHA_VERSION
-#endif
-
-
-#ifndef GC_NO_VERSION_VAR
-
-unsigned GC_version = ((GC_VERSION_MAJOR << 16) | (GC_VERSION_MINOR << 8) | GC_TMP_ALPHA_VERSION);
-
-#endif /* GC_NO_VERSION_VAR */