The Source for Java Technology Collaboration

Home » java.net Forums » Phone ME » phoneME Advanced software

Thread: Don't preload system classes

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 1. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 9 - Last Post: Oct 9, 2007 3:48 AM by: barteo Threads: [ Previous | Next ]
barteo

Posts: 11
Don't preload system classes
Posted: Sep 27, 2007 5:14 AM
 
  Click to reply to this thread Reply

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

cjplummer

Posts: 343
Re: Don't preload system classes
Posted: Sep 27, 2007 7:30 AM   in response to: barteo
Helpful
  Click to reply to this thread Reply

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

Posts: 11
Re: Don't preload system classes
Posted: Sep 28, 2007 1:42 AM   in response to: cjplummer
 
  Click to reply to this thread Reply

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

Posts: 343
Re: Don't preload system classes
Posted: Sep 28, 2007 8:36 AM   in response to: barteo
 
  Click to reply to this thread Reply

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

mlam

Posts: 44
Re: Don't preload system classes
Posted: Sep 28, 2007 8:48 AM   in response to: barteo
 
  Click to reply to this thread Reply

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=<your path>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=<output file> profiling option instead.

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

Mark

barteo

Posts: 11
Re: Don't preload system classes
Posted: Oct 3, 2007 12:54 AM   in response to: mlam
 
  Click to reply to this thread Reply

With CVM_CLASSLIB_JCOV=true enabled and -Xbootclasspath/p=<your path>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

Posts: 44
Re: Don't preload system classes
Posted: Oct 3, 2007 7:27 AM   in response to: barteo
 
  Click to reply to this thread Reply

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

Posts: 11
Re: Don't preload system classes
Posted: Oct 5, 2007 3:21 AM   in response to: mlam
 
  Click to reply to this thread Reply

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

Bartek

mlam

Posts: 44
Re: Don't preload system classes
Posted: Oct 5, 2007 8:13 AM   in response to: barteo
 
  Click to reply to this thread Reply

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

Posts: 11
Re: Don't preload system classes
Posted: Oct 9, 2007 3:48 AM   in response to: mlam
 
  Click to reply to this thread Reply

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

Bartek




 XML java.net RSS