Partial fix for PR gcj/1202
Joerg Brunsmann
joerg_brunsmann@yahoo.de
Fri Apr 6 09:36:00 GMT 2001
Hi,
the attached patch partially fixes PR gcj/1202.
After applying the patch the command
$ jvgenmain -DA -DB -MX=300m -MS=400k -DC f
gives:
extern const char **_Jv_Compiler_Properties;
static const char *props[] ={
"A",
"B",
"C",
0};
extern int _ZN1f6class$E;
int main (int argc, const char **argv)
{
_Jv_Compiler_Properties = props;
_Jv_SetMaximumHeapSize ("300m");
_Jv_SetInitialHeapSize ("400k");
JvRunMain (&_ZN1f6class$E, argc, argv);
}
Can someone please check it in.
Thanks,
Jörg
2001-04-06 Joerg Brunsmann <joerg_brunsmann@yahoo.de>
* jvgenmain.c (heap_command): New function.
(main): Use it.
Partial fix for PR gcj/1202.
Index: gcc/gcc/java/jvgenmain.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jvgenmain.c,v
retrieving revision 1.25
diff -u -r1.25 jvgenmain.c
--- jvgenmain.c 2001/04/04 00:46:27 1.25
+++ jvgenmain.c 2001/04/06 16:29:31
@@ -56,6 +56,8 @@
(void (*) PARAMS ((void *))) OBSTACK_CHUNK_FREE);
}
+static char heap_str[200];
+
static void usage (const char *) ATTRIBUTE_NORETURN;
static void
@@ -65,6 +67,24 @@
exit (1);
}
+static void
+heap_command(const char **argv,
+ int i,
+ const char *command,
+ const char *what)
+{
+ char buffer[100];
+ const char *p;
+ if (! strncasecmp(argv[i], command, 3))
+ {
+ p = &argv[i][3];
+ if (*p == '=')
+ p++;
+ sprintf (buffer, " _Jv_Set%sHeapSize (\"%s\");\n", what, p);
+ strcat (heap_str, buffer);
+ }
+}
+
int
main (int argc, const char **argv)
{
@@ -78,7 +98,9 @@
for (i = 1; i < argc; ++i)
{
- if (! strncmp (argv[i], "-D", 2))
+ if (! strncmp (argv[i], "-D", 2)
+ || ! strncasecmp(argv[i], "-MX", 3)
+ || ! strncasecmp(argv[i], "-MS", 3) )
{
/* Handled later. */
}
@@ -109,24 +131,34 @@
else
stream = stdout;
+ heap_str[0] = '\0';
+
/* At this point every element of ARGV from 1 to LAST_ARG is a `-D'
option. Process them appropriately. */
fprintf (stream, "extern const char **_Jv_Compiler_Properties;\n");
fprintf (stream, "static const char *props[] =\n{\n");
for (i = 1; i < last_arg; ++i)
{
- const char *p;
- fprintf (stream, " \"");
- for (p = &argv[i][2]; *p; ++p)
- {
- if (! ISPRINT (*p))
- fprintf (stream, "\\%o", *p);
- else if (*p == '\\' || *p == '"')
- fprintf (stream, "\\%c", *p);
- else
- putc (*p, stream);
- }
- fprintf (stream, "\",\n");
+ if (! strncmp (argv[i], "-D", 2))
+ {
+ const char *p;
+ fprintf (stream, " \"");
+ for (p = &argv[i][2]; *p; ++p)
+ {
+ if (! ISPRINT (*p))
+ fprintf (stream, "\\%o", *p);
+ else if (*p == '\\' || *p == '"')
+ fprintf (stream, "\\%c", *p);
+ else
+ putc (*p, stream);
+ }
+ fprintf (stream, "\",\n");
+ }
+ else
+ {
+ heap_command (argv, i, "-MX", "Maximum");
+ heap_command (argv, i, "-MS", "Initial");
+ }
}
fprintf (stream, " 0\n};\n\n");
@@ -134,6 +166,7 @@
fprintf (stream, "int main (int argc, const char **argv)\n");
fprintf (stream, "{\n");
fprintf (stream, " _Jv_Compiler_Properties = props;\n");
+ fprintf (stream, heap_str);
fprintf (stream, " JvRunMain (&%s, argc, argv);\n", mangled_classname);
fprintf (stream, "}\n");
if (stream != stdout && fclose (stream) != 0)
__________________________________________________________________
Do You Yahoo!?
Gesendet von Yahoo! Mail - http://mail.yahoo.de
More information about the Gcc-patches
mailing list