2007-12-23 Hans Boehm <Hans.Boehm@hp.com> (Really mostly Friedrich Dominicus)
authorhboehm <hboehm>
Sun, 23 Dec 2007 22:00:43 +0000 (22:00 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:41 +0000 (21:06 +0400)
* NT_X64_STATIC_THREADS_MAKEFILE: Clean up obsolete comment.
* alloc.c: Add declaration for GC_add_current_malloc_heap.
* win32_threads.c (GC_beginthreadex): Clean up error
return code.
* doc/README.win64, NT_X64_THREADS_MAKEFILE, Makefile.direct:
Add NT_X64_THREADS_MAKEFILE.

ChangeLog
Makefile.direct
NT_X64_STATIC_THREADS_MAKEFILE
NT_X64_THREADS_MAKEFILE [new file with mode: 0644]
alloc.c
doc/README.win64
win32_threads.c

index 3f6e7ad..266e5fc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-12-23  Hans Boehm <Hans.Boehm@hp.com> (Really mostly Friedrich Dominicus)
+
+       * NT_X64_STATIC_THREADS_MAKEFILE: Clean up obsolete comment.
+       * alloc.c: Add declaration for GC_add_current_malloc_heap.
+       * win32_threads.c (GC_beginthreadex): Clean up error
+       return code.
+       * doc/README.win64, NT_X64_THREADS_MAKEFILE, Makefile.direct:
+       Add NT_X64_THREADS_MAKEFILE.
+
 2007-12-21  Hans Boehm <Hans.Boehm@hp.com>
 
        * alloc.c: Define GC_version instead of in version.h.
@@ -5,8 +14,8 @@
        * include/gc_version.h: Move most of version.h here.
        * include/gc.h: Include gc_version.h.
        * gcname.c, add_gc_prefix.c: include gc.h instead of version.h.
-       * Makefile.direct, Makefile.dj, Makefile.am, include/include.am: Adjust for
-       version.h rename.
+       * Makefile.direct, Makefile.dj, Makefile.am, include/include.am:
+       Adjust for version.h rename.
        * Makefile.in: Regenerate.
 
 2007-12-21  Hans Boehm <Hans.Boehm@hp.com> (Really mostly russ sludge dot net)
index 158f046..d9c5af1 100644 (file)
@@ -391,7 +391,8 @@ 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 \
-                NT_X64_STATIC_THREADS_MAKEFILE configure_atomic_ops.sh
+                NT_X64_STATIC_THREADS_MAKEFILE NT_X64_THREADS_MAKEFILE \
+                configure_atomic_ops.sh
 #      Makefile and Makefile.direct are copies of each other.
 
 OTHER_FILES= Makefile setjmp_t.c callprocs \
index 91a0f60..d0264b6 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile for Windows NT.  Assumes Microsoft compiler.
-# DLLs are included in the root set under NT, but not under win32S.
+# DLLs are included in the root set.
 # Use "nmake nodebug=1 all" for optimized versions of library, gctest and editor.
 
 MY_CPU=AMD64
diff --git a/NT_X64_THREADS_MAKEFILE b/NT_X64_THREADS_MAKEFILE
new file mode 100644 (file)
index 0000000..5a16aec
--- /dev/null
@@ -0,0 +1,90 @@
+# 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
diff --git a/alloc.c b/alloc.c
index 72d6550..426ab5a 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -440,6 +440,9 @@ int GC_collect_a_little(void)
     return(result);
 }
 
+# if !defined(REDIRECT_MALLOC) && (defined(MSWIN32) || defined(MSWINCE))
+  void GC_add_current_malloc_heap();
+# endif
 /*
  * Assumes lock is held, signals are disabled.
  * We stop the world.
index 9db0e78..2225fd4 100644 (file)
@@ -1,9 +1,9 @@
 64-bit Windows on AMD64/Intel EM64T is somewhat supported in the 7.0
-release.  A collector can be built with Microsoft Visual C++ 2005.
+and later release.  A collector can be built with Microsoft Visual C++ 2005.
 The resulting test programs have been known to work at least once.
 More testing would clearly be helpful.
 
-Currently only NT_X64_STATIC_THREADS_MAKEFILE has been used in
+NT_X64_STATIC_THREADS_MAKEFILE has been used in
 this environment.  Copy this file to MAKEFILE, and then type "nmake"
 in a Visual C++ command line window to build the static library
 and the usual test programs.  To verify that the colllector is
@@ -13,5 +13,10 @@ gctest.exe.log after a few seconds.
 This process is completely analogous to NT_STATIC_THREADS_MAKEFILE
 for the 32-bit version.
 
+A similar procedure using NT_X64_THREADS_MAKEFILE should be usable to
+build the dynamic library.  Test_cpp.exe did not seem to run correctly this
+way.  It seems that we're getting the wrong instances of operator new/delete
+in some cases.  The C tests seemed OK.
+
 Note that currently a few warnings are still generated by default,
 and a number of others have been explicitly turned off in the makefile.
index ac57971..4805a5b 100644 (file)
@@ -1078,7 +1078,7 @@ uintptr_t GC_beginthreadex(
     unsigned ( __stdcall *start_address )( void * ),
     void *arglist, unsigned initflag, unsigned *thrdaddr)
 {
-    uintptr_t thread_h = -1L;
+    uintptr_t thread_h;
 
     thread_args *args;
 
@@ -1097,7 +1097,7 @@ uintptr_t GC_beginthreadex(
        /* Handed off to and deallocated by child thread.       */
       if (0 == args) {
        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        return (uintptr_t)(-1);
+        return (uintptr_t)(-1L);
       }
 
       /* set up thread arguments */