summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1998-12-13 15:24:48 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>1998-12-13 15:24:48 +0000
commit736e508e614db45017b90e9a66430d9b6840c4b8 (patch)
tree678d4fc66d8748a4b2002a45f61b96e7d26623de /gcc
parent53137e6a27e6f962d95e7f31d58b07ab7c36f9d9 (diff)
downloadgcc-736e508e614db45017b90e9a66430d9b6840c4b8.tar.gz
* gjavah.c (decompile_method): Handle all types of `return'
opcode. Decompile `return this' and `return'. (method_access): New global. (print_method_info): Set it. (decompile_method): Don't decompile a synchronized method. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24297 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/gjavah.c28
2 files changed, 34 insertions, 2 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index adf8787c9b4..1db8ce2ce00 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,5 +1,13 @@
1998-12-13 Tom Tromey <tromey@cygnus.com>
+ * gjavah.c (decompile_method): Handle all types of `return'
+ opcode. Decompile `return this' and `return'.
+ (method_access): New global.
+ (print_method_info): Set it.
+ (decompile_method): Don't decompile a synchronized method.
+
+1998-12-13 Tom Tromey <tromey@cygnus.com>
+
* jcf-reader.c (jcf_parse_one_method): Recognize
HANDLE_END_METHOD.
* gjavah.c (HANDLE_END_METHOD): New macro.
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index eec27b3dc34..5e879c75469 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -124,6 +124,7 @@ static int field_pass;
#define HANDLE_CONSTANTVALUE(VALUEINDEX) current_field_value = (VALUEINDEX)
+static int method_access = 0;
#define HANDLE_METHOD(ACCESS_FLAGS, NAME, SIGNATURE, ATTRIBUTE_COUNT) \
if (out) { decompiled = 0; \
print_method_info (out, jcf, NAME, SIGNATURE, ACCESS_FLAGS); \
@@ -398,6 +399,7 @@ DEFUN(print_method_info, (stream, jcf, name_index, sig_index, flags),
int length, is_init = 0;
char *override = NULL;
+ method_access = flags;
if (JPOOL_TAG (jcf, name_index) != CONSTANT_Utf8)
fprintf (stream, "<not a UTF8 constant>");
str = JPOOL_UTF_DATA (jcf, name_index);
@@ -465,12 +467,20 @@ decompile_method (out, jcf, code_len)
int index;
uint16 name_and_type, name;
+ /* If the method is synchronized, don't touch it. */
+ if ((method_access & ACC_SYNCHRONIZED))
+ return;
+
if (code_len == 5
&& codes[0] == OPCODE_aload_0
&& codes[1] == OPCODE_getfield
- && codes[4] == OPCODE_areturn)
+ && (codes[4] == OPCODE_areturn
+ || codes[4] == OPCODE_dreturn
+ || codes[4] == OPCODE_freturn
+ || codes[4] == OPCODE_ireturn
+ || codes[4] == OPCODE_lreturn))
{
- /* Found something useful to decompile. */
+ /* Found code like `return FIELD'. */
fputs (" { return ", out);
index = (codes[2] << 8) | codes[3];
/* FIXME: ensure that tag is CONSTANT_Fieldref. */
@@ -482,6 +492,20 @@ decompile_method (out, jcf, code_len)
fputs ("; }", out);
decompiled = 1;
}
+ else if (code_len == 2
+ && codes[0] == OPCODE_aload_0
+ && codes[1] == OPCODE_areturn)
+ {
+ /* Found `return this'. */
+ fputs (" { return this; }", out);
+ decompiled = 1;
+ }
+ else if (code_len == 1 && codes[0] == OPCODE_return)
+ {
+ /* Found plain `return'. */
+ fputs (" { }", out);
+ decompiled = 1;
+ }
}
/* Print one piece of a signature. Returns pointer to next parseable