[patch] make gij command-line compatible with java

Tom Tromey tromey@redhat.com
Fri Apr 1 20:45:00 GMT 2005


>>>>> "Tom" == Thomas Fitzsimmons <fitzsim@redhat.com> writes:

Tom> This patch makes gij command-line compatible with Sun's java command.

Excellent.  We've needed this for a long time.

Tom>  static void
Tom>  version ()
Tom>  {
Tom> +  printf ("java version \"1.4.2\"\n");

Could you add a new define for this and use it in natRuntime.cc as
well?  That way if/when we move to 1.5 we'll have one less place to
fix.  Hmm, looks like I added a duplicate of this as well... I'll fix
that one (VMClassLoader).

Tom> +  if (classpath)
Tom> +    {
Tom> +      char* darg = (char*) JvMalloc ((strlen (classpath)
Tom> +                                      + sizeof ("-Djava.class.path="))
Tom> +                                     * sizeof (char));

You don't need 'sizeof (char)' -- it is always 1.

Tom> +      if (! strcmp (arg, "-client"))
Tom> +        continue;
Tom> +      else if (! strcmp (arg, "-server"))
Tom> +        continue;
Tom> +      else if (! strcmp (arg, "-hotspot"))
Tom> +        continue;
Tom> +      else if (! strcmp (arg, "-jrockit"))
Tom> +        continue;

For things we ignore, how about a comment explaining why?  This batch
is pretty obvious to me, but I had never heard of agentlib, agentpath,
and some of the other ones.

Tom> +          printf ("java full version \"gcj-1.4.2\"\n");

Likewise about the define...

Tom>  static jint
Tom> +parse_x_arg (char* option_string)
Tom> +{

I guess the rationale for recognizing all of these is compatibility
with existing launch scripts?  What do you think of a comment to that
effect?

Tom> +extern inline void *
Tom> +JvRealloc (void *ptr, jsize size)
Tom> +{
Tom> +  return _Jv_Realloc (ptr, size);
Tom> +}

We only need a wrapper like this if we want to export it to the world.
I don't care either way in this case.

Hmm, JvMalloc and friends don't seem to be documented in the CNI part
of the manual :-(


I think the "invoking gij" part of the manual could use an update, at
least to explain that we recognize and ignore some options for
compatibility, and to note the -X options we actually support.

Tom



More information about the Java-patches mailing list