Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Load Time Weaving + INPATH



David,

When using LTW the weaver is attached to a particular class loader not the
JVM as a whole. The weaver can only weave classes defined by the loader to
which it is attached and all those classes must be available to the weaver
so -inpath is implied i.e. the classpath of the loader. For the LTW support
in 1.2.1 we use the java.system.class.loader property (introduced in 1.4
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html) to
replace the System class loader with our own so the hierarchy looks like
this:

+ Bootstrap loader (-Xbootclasspath / sun.boot.class.path)
|
+ Extensions loader (ext.dirs)
|
+ System loader (aspectjweaver.jar)
|
+ Weaving loader (aj.class.path + aj.aspect.path)

We cannot attach to any existing loaders as we do not control their
creation and the Bootstrap loader is implemented in native code anyway.
However Java 5.0 introduces the java.lang.instrument package which gives
the opportunity to weave classes loaded by any class loader. We are
investigating using this in future versions of the LTW support.

WRT memory usage we found in recent tests that ajc needs about twice as
much memory to binary weave a JAR than was originally needed to compile the
classes it contains. This is something we will be looking at in the future.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

David Pearce <david.pearce@xxxxxxxxxxxxx>@eclipse.org on 03/11/2004
07:21:13

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    aspectj-users@xxxxxxxxxxx
cc:
Subject:    [aspectj-users] Load Time Weaving + INPATH


Hi all,

I finally got around to investigating whether I could weave against
rt.jar.  Following Adrian's blog, it seems that INPATH is the thing to
use for this.  But, my application uses the load time weaver and I find
there is no way of setting this information as an argument.  I would
have expected something like "-Daj.weaving.inpath=".  But, looking at
the source code, I can't find anything along these lines.  So, i'm just
wondering if there are any known work arounds for this?  (or indeed, if
I missed something completely?)

Also, I tried weaving statically using ajc, but sadly my machine ran out
of memory!!  I could only ramp up the -Xmx value to 128M, so I'm going
to try on a bigger machine at some point :-)

Cheers,

David J. Pearce
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top