You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/08/20 14:56:15 UTC

svn commit: r1696783 - in /subversion/trunk: build.conf build/generator/gen_base.py build/generator/gen_vcnet_vcproj.py build/generator/gen_win.py build/generator/templates/vcnet_vcxproj.ezt

Author: rhuijben
Date: Thu Aug 20 12:56:15 2015
New Revision: 1696783

URL: http://svn.apache.org/r1696783
Log:
In the Windows build mark the DLLs of libsvn_ra, libsvn_fs_base, libsvn_fs_fs,
libsvn_fx as to be delayloaded.

Without this patch these DLLs and their dependencies are always loaded from
code that references them. After this patch the code is dynamically loaded
when first necessary. (In all supported compilers this is implemented as
a per DLL load via the import table, so there is no per function call
performance penalty)

The non-shared-library build is unaffected.

* build.conf
  (libsvn_fs_base,
   libsvn_fs_fs,
   libsvn_fs_x,
   libsvn_ra): Mark as delayload.

* build/generator/gen_base.py
  (TargetLib): Load property.

* build/generator/gen_vcnet_vcproj.py
  (write): Calculate dependency dlls to be delayloaded.

* build/generator/gen_win.py
  (create_dll_target): Copy property to right target.

* build/generator/templates/vcnet_vcxproj.ezt
  Extend linker arguments.

Modified:
    subversion/trunk/build.conf
    subversion/trunk/build/generator/gen_base.py
    subversion/trunk/build/generator/gen_vcnet_vcproj.py
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt

Modified: subversion/trunk/build.conf
URL: http://svn.apache.org/viewvc/subversion/trunk/build.conf?rev=1696783&r1=1696782&r2=1696783&view=diff
==============================================================================
--- subversion/trunk/build.conf (original)
+++ subversion/trunk/build.conf Thu Aug 20 12:56:15 2015
@@ -283,6 +283,7 @@ sources = *.c bdb/*.c util/*.c
 install = bdb-lib
 libs = libsvn_delta libsvn_subr aprutil apriconv apr bdb libsvn_fs_util
 msvc-export = ../libsvn_fs_base/fs_init.h
+msvc-delayload = yes
 
 [libsvn_fs_fs]
 description = Subversion FSFS Repository Filesystem Library
@@ -291,6 +292,7 @@ path = subversion/libsvn_fs_fs
 install = fsmod-lib
 libs = libsvn_delta libsvn_subr aprutil apriconv apr libsvn_fs_util
 msvc-export = private/svn_fs_fs_private.h ../libsvn_fs_fs/fs_init.h
+msvc-delayload = yes
 
 [libsvn_fs_x]
 description = Subversion FSX Repository Filesystem Library
@@ -299,6 +301,7 @@ path = subversion/libsvn_fs_x
 install = fsmod-lib
 libs = libsvn_delta libsvn_subr aprutil apriconv apr libsvn_fs_util
 msvc-export = ../libsvn_fs_x/fs_init.h
+msvc-delayload = yes
 
 # Low-level grab bag of utilities
 [libsvn_fs_util]
@@ -321,6 +324,7 @@ add-deps = $(SVN_RA_LIB_DEPS)
 add-install-deps = $(SVN_RA_LIB_INSTALL_DEPS)
 install = lib
 msvc-export = svn_ra.h private\svn_ra_private.h
+msvc-delayload = yes
 
 # Accessing repositories via DAV through serf
 [libsvn_ra_serf]

Modified: subversion/trunk/build/generator/gen_base.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_base.py?rev=1696783&r1=1696782&r2=1696783&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_base.py (original)
+++ subversion/trunk/build/generator/gen_base.py Thu Aug 20 12:56:15 2015
@@ -590,6 +590,7 @@ class TargetLinked(Target):
     self.external_lib = options.get('external-lib')
     self.external_project = options.get('external-project')
     self.msvc_libs = options.get('msvc-libs', '').split()
+    self.msvc_delayload_targets = []
 
   def add_dependencies(self):
     if self.external_lib or self.external_project:
@@ -690,6 +691,7 @@ class TargetLib(TargetLinked):
     self.link_cmd = options.get('link-cmd', '$(LINK_LIB)')
 
     self.msvc_static = options.get('msvc-static') == 'yes' # is a static lib
+    self.msvc_delayload = options.get('msvc-delayload') == 'yes' # Delay dll load
     self.msvc_fake = options.get('msvc-fake') == 'yes' # has fake target
     self.msvc_export = options.get('msvc-export', '').split()
 

Modified: subversion/trunk/build/generator/gen_vcnet_vcproj.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_vcnet_vcproj.py?rev=1696783&r1=1696782&r2=1696783&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_vcnet_vcproj.py (original)
+++ subversion/trunk/build/generator/gen_vcnet_vcproj.py Thu Aug 20 12:56:15 2015
@@ -209,14 +209,22 @@ class Generator(gen_win.WinGeneratorBase
 
       deplist = [ ]
       for i in range(len(depends)):
-        if depends[i].fname.startswith(self.projfilesdir):
-          path = depends[i].fname[len(self.projfilesdir) + 1:]
+        dp = depends[i]
+        if dp.fname.startswith(self.projfilesdir):
+          path = dp.fname[len(self.projfilesdir) + 1:]
         else:
           path = os.path.join(os.path.relpath('.', self.projfilesdir),
-                              depends[i].fname)
+                              dp.fname)
+
+        if isinstance(dp, gen_base.TargetLib) and dp.msvc_delayload \
+           and isinstance(target, gen_base.TargetLinked):
+          delayload = self.get_output_name(dp)
+        else:
+          delayload = None
         deplist.append(gen_win.ProjectItem(guid=guids[depends[i].name],
                                            index=i,
                                            path=path,
+                                           delayload=delayload
                                            ))
 
       fname = self.get_external_project(target, self.vcproj_extension[1:])

Modified: subversion/trunk/build/generator/gen_win.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=1696783&r1=1696782&r2=1696783&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Thu Aug 20 12:56:15 2015
@@ -271,6 +271,7 @@ class WinGeneratorBase(gen_win_dependenc
                                   'msvc-name' : dep.name + "_dll" },
                                 self)
     target.msvc_export = dep.msvc_export
+    target.msvc_delayload = dep.msvc_delayload
 
     # move the description from the static library target to the dll.
     target.desc = dep.desc
@@ -279,6 +280,7 @@ class WinGeneratorBase(gen_win_dependenc
     # The dependency should now be static.
     dep.msvc_export = None
     dep.msvc_static = True
+    dep.msvc_delayload = False
 
     # Remove the 'lib' prefix, so that the static library will be called
     # svn_foo.lib

Modified: subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt?rev=1696783&r1=1696782&r2=1696783&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt (original)
+++ subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt Thu Aug 20 12:56:15 2015
@@ -75,6 +75,7 @@
       <AdditionalDependencies>[for configs.libs][configs.libs];[end]%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>[for configs.libdirs][configs.libdirs];[end]%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <DelayLoadDLLs>[for depends][if-any depends.delayload][depends.delayload];[end][end]</DelayLoadDLLs>
       <SubSystem>Console</SubSystem>
       <EnableUAC>true</EnableUAC>
       <OptimizeReferences>true</OptimizeReferences>
@@ -85,6 +86,7 @@
       <AdditionalDependencies>[for configs.libs][configs.libs];[end]%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>[for configs.libdirs][configs.libdirs];[end]%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <GenerateDebugInformation>true</GenerateDebugInformation>
+      <DelayLoadDLLs>[for depends][if-any depends.delayload][depends.delayload];[end][end]</DelayLoadDLLs>
       <IgnoreSpecificDefaultLibraries>[is configs.name "Debug"]msvcrt.lib[end][is configs.name "Release"]msvcrtd.lib[end]</IgnoreSpecificDefaultLibraries>
 [if-any def_file]      <ModuleDefinitionFile>[def_file]</ModuleDefinitionFile>
 [end]    </Link>