Skip to main content

Don't preload system classes

9 replies [Last post]
barteo
Offline
Joined: 2006-09-22
Points: 0

Hi,

Documentation states that even if CVM_PRELOAD_LIB is set to false, the CDC build system still uses JavaCodeCompact to preload a certain number of system classes. Is it possible to disable preloading at all?

Thanks,
Bartek Teodorczyk

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mlam
Offline
Joined: 2006-10-13
Points: 0

Bartek,

Your problem isn't due to obsfucation. It's because JVMPI never saw the romized classes being loaded since they are by definition already loaded before JVMPI started. Here's one thing you can try just for a profiling run:
1. Build CVM with CVM_CLASSLIB_JCOV=true
2. Run CVM with -Xbootclasspath/p=btclasses.zip

You should be able to find btclasses.zip in CVM's build directory. The CVM_CLASSLIB_JCOV option is a hack to get CVM to send simulated classload events for all romized classes (by loading them from btclasses.zip) to the JVMPI agent (in this case, hprof). CVM_CLASSLIB_JCOV (and CVM_JVMPI) is not an option that you will want to use in your deployed system because they have an impact on performance.

Note also that JVMPI on CVM will only allow you to gather profiling stats on interpreted runs. If you are running with the JIT, you should consider using the -Xjit:profile= profiling option instead.

Let me know if the CVM_CLASSLIB_JCOV hack does what you need.

Mark

barteo
Offline
Joined: 2006-09-22
Points: 0

With CVM_CLASSLIB_JCOV=true enabled and -Xbootclasspath/p=btclasses.zip set, the hprof output seems to be unchanged. I'm getting the same log warnings with Java 6 jhat:

Reading from java.hprof...Dump file created Tue Oct 02 17:41:55 CEST 2007
WARNING: Stack trace not found for serial # 0
Snapshot read, resolving...
Resolving 1767 objects...
WARNING: hprof file does not include java.lang.Class!
WARNING: hprof file does not include java.lang.String!
WARNING: hprof file does not include java.lang.ClassLoader!
WARNING: Failed to resolve object id 0x30b77308
Warning! Superclass of sun.net.www.URLConnection is Unresolved object 0x30b77308
WARNING: Failed to resolve object id 0x689a7e08 for field LAST_MODIFIED (signature L)
WARNING: Failed to resolve object id 0x809e7f08 for field CONTENT_TYPE (signature L)
WARNING: Failed to resolve object id 0xd88b7f08 for field CONTENT_LENGTH (signature L)
WARNING: Failed to resolve object id 0x50297108
Warning! Superclass of sun.io.ByteToCharUTF8 is Unresolved object 0x50297108
WARNING: Failed to resolve object id 0xf06d6d08
Warning! Superclass of sun.net.www.MessageHeader is Unresolved object 0xf06d6d08
WARNING: Failed to resolve object id 0x8857308
Warning! Superclass of sun.net.www.protocol.file.Handler is Unresolved object 0x8857308
WARNING: Failed to resolve object id 0x8857308
Warning! Superclass of sun.net.www.protocol.jar.Handler is Unresolved object 0x8857308
WARNING: Failed to resolve object id 0x18cf7e08 for field separator (signature L)
WARNING: Failed to resolve object id 0xf06d6d08
Warning! Superclass of HelloWorld is Unresolved object 0xf06d6d08
WARNING: Class c83d7208 not found, adding fake class!
WARNING: Class 70ba6b08 not found, adding fake class!
WARNING: Class 58aa6e08 not found, adding fake class!
WARNING: Class 60db7908 not found, adding fake class!
WARNING: Class 40576f08 not found, adding fake class!
WARNING: Class 88597808 not found, adding fake class!
WARNING: Class e0267908 not found, adding fake class!
[...]

But it might be some incompatibility with phoneME hprof format and Java 6 jhat tool here as well.

Anyway, I can work with text format hprof data easily so it is not an issue anymore for me :)

Thanks,
Bartek

mlam
Offline
Joined: 2006-10-13
Points: 0

Bartek,

It could be some incompatibility with Java 6's hprof format. Just to check, can you please try running with 1.4 and Java 5's jhat if available? Let me know if you get the same problems there. If this is a formatting problem, then the solution will be something different altogether. Let me know what you find. Thanks.

Mark

barteo
Offline
Joined: 2006-09-22
Points: 0

Unfortunately, there is no jhat tool included with Java 1.4 or Java 5.

Bartek

mlam
Offline
Joined: 2006-10-13
Points: 0

Bartek,
OK. Sorry to hear about that. At this point, I can't help you much more, except to tell you that there'll be a JVMTI commit that we're working on right now. Hopefully, it will be in the repository soon. That commit will come with a new JVMTI hprof. I suggest that you try this again after that code commit happens. We're aiming to get that done in less than a week from now.

Mark

barteo
Offline
Joined: 2006-09-22
Points: 0

So, I'm looking forward to seeing new JVMTI code.

Bartek

cjplummer
Offline
Joined: 2006-10-16
Points: 0

No, it is not possible. Some classes have to be romized because there are direct (symbolic) references to them from C code. This was done as an optimization to avoid having to check if certain system classes are loaded, and also so we don't have to deal with errors if they can't be loaded. If these classes were not romized, you would get link errors at build time. Also, the set of classes that are romized needs to form a transitive closure, which pulls in even more classes to the minimal romized set.

Chris

barteo
Offline
Joined: 2006-09-22
Points: 0

Actually, I wanted to exclude system classes from prelinking because I have trouble with analyzing profile hprof data produced by phoneME CVM. All romized classes have obfuscated names and eg. jhat shows a lot of warning messages in startup (other profilers fails on hprof file import):

Reading from java.hprof...
Dump file created Thu Sep 27 13:02:56 CEST 2007
WARNING: Stack trace not found for serial # 0
WARNING: Stack trace not found for serial # 0
WARNING: Stack trace not found for serial # 0
WARNING: Stack trace not found for serial # 0
WARNING: Stack trace not found for serial # 0
Snapshot read, resolving...
Resolving 12866 objects...
WARNING: hprof file does not include java.lang.Class!
WARNING: hprof file does not include java.lang.String!
WARNING: hprof file does not include java.lang.ClassLoader!
WARNING: Failed to resolve object id 0xf86f6d08
Warning! Superclass of com.sun.midp.chameleon.skins.resources.ProgressBarResources is Unresolved object 0xf86f6d08
WARNING: Failed to resolve object id 0xf86f6d08
Warning! Superclass of com.sun.midp.chameleon.skins.resources.ImageItemResources is Unresolved object 0xf86f6d08
WARNING: Failed to resolve object id 0xf86f6d08
[...]

Is there maybe another way to expose real names to the profiler?

Bartek

cjplummer
Offline
Joined: 2006-10-16
Points: 0

I'm not familiar with how hprof works, but I can tell you that romized classes do not have obfuscated names in CDC/CVM. However, it's possible that since they are not dynamically loaded, they never get registered with JVMPI.

Chris