Compiling XML parsers (xerces, Dom4j, etc...)

Andrew Haley aph@redhat.com
Thu Nov 4 15:20:00 GMT 2004


Bryce McKinlay writes:
 > Andrew Haley wrote:
 > 
 > > > How about a class name --> foo.so mapping? 
 > >
 > >That's not a good idea, because the same class name can exist in
 > >multiple jars, so in order to keep things straight we'd need to have
 > >multiple databases for multiple verions of packages. This would be a
 > >bad thing.
 > >
 > >If we always map .jar -> .so or byte[] -> .so, the same database can
 > >be shared by every gcj app that's installed on a system, regardless of
 > >how many instances of foo.bar.baz we have compiled. 
 > >
 > >Also, mapping class name -> .so runs into problems of version skew.
 > > 
 > >
 > Good point, but doesn't this (version skew) problem exist regardless of 
 > whether we're mapping .jar's or class files?
No, because multiple versions of the same .class can exist, as long as
they're in different .jar files -- which version you get at runtime
depends on the classpath. 
Now there *is* a version skew problem if you use a .so made from a
different versions the jarfile in your classpath. But that's another
problem entirely.
 > In either case, some kind of classpath setting is presumably
 > required to determine the search order for classes, if an
 > application cares.
Absolutely.
 > > > That way the .jars won't have to exist at runtime (for sane
 > > > applications, at least).
 > >
 > >They won't have to exist: the .so will be searched first, and if the
 > >classes or resources are found the .jar will never be opened.
 > >
 > But, assuming the application can't/doesn't explicitly link all the
 > .so's it uses, how do we find the .so's? For performance reasons,
 > we don't want to have to dlopen every .so we see on the chance that
 > it might contain a required class.
OK, to avoid the overhead of opening .so files I'll try creating a
mapping of
 "jarname:classname" -> "soname"
That will be pretty neat, because it'll avoid searching .so files
unless we know the search will succeed.
I don't know if in practice it will make a huge difference unless
there's a ton of unused jarfiles on the classpath.
Andrew.


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /