GrowableArray<JavaVMOption> - how it works?

Dmitry Samersoff dms at samersoff.net
Tue Dec 1 18:31:23 UTC 2020


Hello Everybody,

While experimenting with the use of templates within hotspot in order to 
reduce VM size, I found a thing that I can't understand.

What I'm missing here?

arguments.cpp:

  GrowableArray<JavaVMOption> *options = new (ResourceObj::C_HEAP, 
mtArguments)

Where JavaVMOption is the plain C structure {char*, void*} that comes 
from jni.h

but

template<class E>
class GrowableArray : public GenericGrowableArray {

contains couple of functions like one below:

   int  find_from_end(const E& elem) const {
     for (int i = _len-1; i >= 0; i--) {
       if (_data[i] == elem) return i;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     }
     return -1;
   }

How it supposed to work?

If I instantiate GrowableArray<JavaVMOption> explicitly it can't be 
compiled at al.

Thank you!
-Dmitry






More information about the hotspot-dev mailing list