There are my thoughts about VM properties. I observe some problem with
current VM properties implementation:
1) The current VM properties initialization is rather chaotic:
   * Some properties stored into two places: Properties class and array of
     VmStandardProperty structure. A certain algorithms use properties from
     first place. But other algorithms use properties from second place.
   * There are plenty of functions working with properties (on
initialization stage,
      see create_vm function of vm_main.cpp). Number of it may be reduced
      (and I see some ways to do that).
   * There are two arrays contain predefined properties.
   * There is very interesting implementation of
InsertSystemProperties function
      (see java_lang_VMExecutionEngine.cpp). Properties described in this
      function should be defined earlier. This function should read their from
      Properties table.
2) Redefining by user (through command line option –D<key>=<value>)
   some properties (i.e. "vm.other_natives_dlls") crashed VM.
3) VM properties table is not thread safe.

So, I propose the following:
1) Redevelop VM properties module according to attached proposal. This
implementation:
   * May be based on apr hashtable.
   * Thread safe.
   * Introduces public (for java and VM side) and private (for VM side only)
     properties. It allows us to avoid VM crashes when some key properties
     (i.e. "vm.other_natives_dlls") redefined by user.
2) Do "deep" source code refactoring. After that we should have clear and
   strong algorithms of property initialization and usage. Some redundant VM
   properties and arrays of predefined properties should be throw out
on this stage.

Dmitry

2006/10/6, Geir Magnusson Jr. <[EMAIL PROTECTED]>:
So one of the interesting things that jumped out of me is the number of
various library and boot classpath properties that we have floating
around, and I'd like to

1) understand this
2) get rid of all the ones that we don't need

Is there a defined set we need to support?  Anyone have suggestions?

geir
                       VM properties proposal
                       ======================

    The general purpose of VM Properties subcomponent is to provide
centralized access to a common properties table. A property is meant
as a pair of <key> and <value>. The properties stored in VM Properties
table represent configuration settings for a separate component (such
as VMCore, GC, JIT etc) or for the whole system. Another use case for
the properties is communication between different components.

                            Requirements
                            ============

    1) The <key> and <value> are represented as string (i.e. char*). 
    2) NULL values are allowed.
    3) VM Properties subcomponent exports its interface as part of VM
       Core.
    4) There are two kind of properties
          * Public properties are properties visible both to all VM
            components and to Java applications (by means of
            java.lang.System.getProperties() method). 
          * Hidden properties are used for VM components communication
            only, not accessible from Java side. 
    5) There is a way to set hidden properties through non standard
       command line option (   -XDefine<key>=<value>).
    6) There is a way to get a list of defined properties which keys
       begin with a particular prefix.
    7) Properties table should be thread safe.

                      VM Properties usage scenario
                      ============================

    Components can define properties and lookup them by name. When
setting the property it can be marked either public or hidden. A
property should be marked as hidden if it is intended internal usage
only. Public properties are supposed to be visible from Java side also.
In the same time it is possible to obtain a list of all public properties
to pass them to Java side. 

                       Defined Interface functions
                       ===========================

    void set_property(const char * key, const char * value) - Sets the
    public property. NULL values are supported.

    void set_hidden_property(const char * key, const char * value) - Sets
    the hidden property. NULL values are supported.

    const char * get_property(const char * key) - Returns the value of the
    property if it has been set by set_property function. Otherwise returns
    NULL.

    const char * get_hidden_property(const char * key) - Returns the value
    of the property if it has been set by set_hidden_property function.
    Otherwise returns NULL.

    bool is_property_set(const char * key, bool hidden) - Checks if the
    property is set.

    void unset_property(const char * key, bool hidden) - Unsets the property.

    char * * get_public_property_keys() - Returns an array of keys for all
    public properties set.

    char * * get_properties_staring_with(const char * prefix, bool hidden) -
    Returns an array of keys for all properties set whose keys start with
    the prefix specified.
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to