The techniques and mechanisms described herein are directed at sharing
objects between applications executing in a virtual runtime environment.
The techniques include compiling a cpu-independent file to create
executable instructions that are associated with an application that is
executable in a virtual runtime environment. A constructor associated
with a shareable class defined within the cpu-independent file is
executed to create an instance of a shareable object. The shareable
object is then persisted in a manner such that other applications
executing in the virtual runtime environment may access the shareable
object. The technique may be performed during pre-JIT compilation or
just-in-time compilation of the cpu-independent file. The execution of
the constructor is performed at a restricted security level that prevents
access to changeable information when generating static data for the
static members of the shareable object.