JLang icon indicating copy to clipboard operation
JLang copied to clipboard

Using jclass objects for metadata

Open dz333 opened this issue 6 years ago • 0 comments

Currently our runtime representation for Class<?> objects contains no extra information over the Java-specified Class object information.

We save all of the class metadata (# fields, field names, object size in bytes, etc) in a HashMap<jclass,metadata>.

Therefore every metadata lookup requires a hash map lookup and we need to allocate some extra memory for the map itself.

It is reasonable to store this metadata in the jclass objects themselves, in front of the Class> objects so `*jclass == head of metadata` and `*(jclass + sizeof(metadata))` is a reference to the Class> object.

This is a performance optimization that requires some compiler and runtime restructuring.

dz333 avatar Oct 10 '18 18:10 dz333