Curious: What does NPT stand for? On 4 apr 2014, at 18:52, Kelly O'Hair <kellyoh...@gmail.com> wrote:
> Just as background information... > > The serviceability team should do what they think is right here, I'll just > provide some history... ;) > > The original purpose of this library was to provide some generic native > platform tools for dealing with things that will happen BEFORE the JVM is > started and Java code can be called. > > This was necessary for JVM agents (hprof, debugger backend, jvmti demo > agents) and any native code that was executed before the JVM had gotten off > the ground. > Doing arbitrary character encoding conversions to/from the various flavors > of UTF-8 is a nightmare outside Java. > And since the characters typed in on a java commandline is in the OS's > default platform encoding, and not in UTF-8, they need to be converted. > Since this native code was not part of hotspot, and was written in C, using > the hotspot functionality for this was not possible at the time. > > This logic was isolated because it was so OS specific and ugly, and we (maybe > just me) had visions of needed more in this library, and that maybe we could > limit the ifdef-mania to this library rather than scatter the same > ifdef-mania all over the rest of the JDK native code that lives outside > hotspot. > So it seemed natural to isolate it as a separate little library that could be > unit tested on it's own. > > It's extremely likely that it could be trimmed down, and as more and more OS > default encodings become UTF-8, maybe it' will eventually become obsolete. > > Hope this helps. > > -kto > > On Apr 4, 2014, at 9:28 AM, Dmitry Samersoff wrote: > >> Hi Everybody, >> >> We have an libnpt.so[1] in JDK. This library contains bunch of UTF >> related functions. On a brief investigation it looks like most of these >> functions are not used. Six functions below called one time each from >> share/back/* and hprof_init.c [2] >> >> Should I file a CR to have it cleaned up - remove npt library as a >> separate entity and move few utf functions that really used to place >> where it actually called. >> >> >> [1] Library sources location >> >> src/share/npt >> src/solaris/npt >> src/windows/npt >> >> [2] Library usage >> >> src/share/back/transport.c: >> >> utf8FromPlatform >> utf8ToPlatform >> >> src/share/back/inStream.c: >> >> utf8sToUtf8m >> utf8sToUtf8mLength >> >> src/share/back/outStream.c: >> >> utf8mToUtf8s >> utf8mToUtf8sLength >> >> >> src/share/demo/jvmti/hprof/hprof_init.c >> >> utf8ToPlatform >> >> >> -Dmitry >> >> -- >> Dmitry Samersoff >> Oracle Java development team, Saint Petersburg, Russia >> * I would love to change the world, but they won't give me the sources. >