Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Java code saved in a Class Data Sharing archive (classes.jsa) compiled natively or is it bytecode?

I'm trying to know whether creating a Class Data Sharing archive (by running java -Xshare:dump) compiles byte code into native code.

There is not a lot of documentation about the internals of Class Data Sharing. The page I linked says that java -Xshare:dump

loads a set of classes from the system jar file into a private internal representation, and dumps that representation to a file.

But says nothing about whether this code is compiled or not.

(Possibly related: Speed up application start by adding own application classes to classes.jsa)

like image 455
Jean-Philippe Pellet Avatar asked Feb 22 '13 12:02

Jean-Philippe Pellet


People also ask

What is class data sharing in Java?

The Class data sharing (CDS) feature helps reduce the startup time and memory footprint between multiple Java Virtual Machines (JVM). Starting from JDK 12, a default CDS archive is pre-packaged with the Oracle JDK binary.

What is class data sharing?

The class sharing feature offers the transparent and dynamic sharing of data between multiple Java™ Virtual Machines (JVMs).

What is application class data sharing?

Application Class-Data Sharing This feature allows application classes to be placed in a shared drive. The common class metadata is shared across different Java processes. AppCDS allows the built-in system class loader, built-in platform class loader, and custom class loaders to load the archived classes.


1 Answers

In both cases it's native code in the cache (see the discussion in the link you provided about regenerating the cache on machines of different architecture). The IBM JVM takes it further with more options and a nicer layout for clusters, but the Oracle one works too.

like image 69
WPrecht Avatar answered Oct 10 '22 04:10

WPrecht