Dmitry, Great job. I wonder if you can switch to any supported system (Windows XP, or Linux). This would save a good amount of your time. Otherwise you may use mt.exe to bundle your executable with a manifest [1].
Thanks for a wonderful analysis. It worth to be added to your thesis. [1] http://msdn2.microsoft.com/en-us/library/ms235560(VS.80).aspx On Tue, Apr 8, 2008 at 2:18 PM, Dmitry Egorov <[EMAIL PROTECTED]> wrote: > Hello, Alexei! > > I finally figured out, whats going on there. There are 2 zlib's. > The first one is downloaded as a zlib1.dll and zdll.lib and used in vm. > zdll.lib is not a static version of zlib, as I thought, but rather it is the > import library for zlib1.dll, which means that if we include this lib in a > linkage - we get implicit dependency (at a compile/link time) on the .dll > and all it's functions exported to the code. And that's how it works. I > still don't know why vm is dynamically connects to hyzlib.dll and never > exports any functions from it, maybe it makes sense under Linux, but under > Windows it's redundant. > > Another zlib is called hyzlib.dll and it's downloaded in source codes and > built in classlib. It is dynamically loaded by hyarchive.dll. It also builds > its import library hyzlib.lib. > "working_classlib\modules\archive\src\main\native\zip\shared\zipsup.c" > explicitly exports 3 functions in the code under different names > (inflateInit2Func, inflateFunc, inflateEndFunc). That's unnecessary, because > hyzlib.lib is included in linkage and we have all hyzlib's functions in the > code. As an evidence > "working_classlib\modules\archive\src\main\native\archive\shared\inflater.c" > uses inflate functions as is, without exporting. Again, maybe it makes sense > under Linux. > > So what I'm doing now is trying to replace zlib1.dll and zdll.lib with my > optimized ones. But I have some difficulties with building dll. First of all > MSVC 9.0 is a default compiler/linker on my machine. So when I link a dll I > get a dependency on msvcr90.dll. Well, ok, I can place it next to my dll for > now. Furthermore I get a runtime error R6034 when trying to connect my dll > with anything else. It has something to do with manifest, but I couldn't > find anything like it in a zlib's standard makefiles or hyzlib's makefiles. > Maybe switching to another compiler will be the best option. > > > > Alexei Fedotov wrote: > > > Dmitry, > > What happens if you delete (add <delete file="<path to zlib1.dll>" /> > > to working_vm/build.xml at setup target) > > this library right before the compilation starts? > > > > Thanks. > > > > > > On Mon, Apr 7, 2008 at 8:25 PM, Dmitry Egorov <[EMAIL PROTECTED]> wrote: > > > > > > > Hello, Mark. > > > > > > > > > > > > > > > > > > > I'm curious to know whether you plan to make zlib optimisations that > are > > > > harmony specific. If not, then it would be much better to contribute > > > > them back to the zlib project directly and not maintain them in the > > > > harmony project. > > > > > > > > > > > > > > > No, this optimizations are not Harmony specific, but uses external > > > optimization library, which is not free. I already have optimized zlib, > so I > > > just need to build it into Harmony. > > > > > > My current goal is to make a small step - integrate my zlib into vm > build > > > system on my computer and see if I get considerable Harmony's > performance > > > increase. Based on results I can therefore think of integrating it in a > > > "good way", which means searching for the optimization library's > presence on > > > the system and loading alternative zlib in case it is found. > > > > > > For that goal I just need to be sure that vm is using zlib1.dll, > downloaded > > > from the internet. Dependency walker says it is, but what confuses me is > > > zdll.lib. Is it just redundunt or used somewhere? > > > > > > > > > > > > Mark Hindess wrote: > > > > > > > > > > > > > HY_LOCAL_ZLIB is set by the ant option -Dhy.local.zlib=true. It is > > > > intended for use on unix machines where libz.so is typically already > > > > available (and in memory). This option is not enabled by default but > > > > since the zlib api is pretty stable this would seem to be a reasonable > > > > default for unix machines. I do set this option when building the > > > > debian packages (which is why I noticed/reported that the harmony > > > > version was not using the most effective compiler optimisations on > linux > > > > x86/x86_64). > > > > > > > > I'm curious to know whether you plan to make zlib optimisations that > are > > > > harmony specific. If not, then it would be much better to contribute > > > > them back to the zlib project directly and not maintain them in the > > > > harmony project. > > > > > > > > -Mark. > > > > > > > > > > > > On 5 April 2008 at 16:41, Dmitry Egorov <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > > > Hello, everyone! > > > > > I'm now working on zlib optimization using external performance > library. > > > > > > > > > > > > > > > > > For now my goal is to make Harmony use my modified zlib code instead of > the > > > one downloaded from the internet. > > > > > > > > > > > > > > > So I've been struggling with build system for quite a long time. As > far > > > > > > > > > > > > > > > > > as I can understand now, both vm and classlib use hyzlib.dll (i'm > currently > > > working in Windows), which is made by downloading and compiling zlib's > > > sources in classlib's buildfiles. > > > > > > > > > > > > > > > But I'm not sure, because there's code in vm's build files which > > > > > > > > > > > > > > > > > downloads zlib1.dll and zdll.lib. But I can't figure out whether vm is > using > > > it or not. On the other side, I found that vm has code related to > > > > > > > > > > > > > > > hyzlib.dll in working_vm\vm\vmcore\src\init\vm_properties.cpp: > > > > > static const char *api_dll_files[] = > > > > > { > > > > > "harmonyvm", > > > > > "hythr", > > > > > #if !defined(HY_NO_SIG) > > > > > "hysig", > > > > > #endif > > > > > "hyprt", > > > > > #if defined(HY_LOCAL_ZLIB) > > > > > "z", > > > > > #else > > > > > "hyzlib", > > > > > #endif > > > > > "hynio", > > > > > "vmi", > > > > > "hyluni", > > > > > "hyarchive" > > > > > }; ... > > > > > > > > > > My primary goal is to optimize vm's zlib performance to boost start > up > > > > > > > > > > > > > > > > > time. So my question is whether vm is using hyzlib.dll or not? > > > > > > > > > > > > > > > Tim Ellison wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > Dmitry Egorov wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hello Mark, Tim, > > > > > > > Thank you for your idea! We have discussed possible native > > > > > > > optimizations of jar and zip code with Alexei Fedotov and I'm > > > > > > > currently looking into this. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Great. Looking through the JIRAs I see Alexei raised a 'double > read' > > > > > > > > > > > > > > > > > > > > > > > > issue. You still have outstanding questions about this Alexei? > > > > > > > > > > > > > > > > > > > > > [1] http://issues.apache.org/jira/browse/HARMONY-5526 > > > > > > > > > > > > Regards, > > > > > > Tim > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- With best regards, Alexei
