This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: set last line for java methods
- From: Tom Tromey <tromey at redhat dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: GCJ-patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 29 Feb 2008 05:04:46 -0700
- Subject: Patch: FYI: set last line for java methods
- Reply-to: Tom Tromey <tromey at redhat dot com>
This patch removes the last reference to USE_MAPPED_LOCATION.
This mention occurs in a comment in java/java-tree.h.
The last_line member of struct lang_decl_func was never set by gcj.
I suppose it must have been set by the .java parser, in the past.
This patch changes gcj to properly set this field while parsing a
.class file.
Bootstrapped & regtested on x86 FC-6.
Tom
ChangeLog:
2008-02-28 Tom Tromey <tromey@redhat.com>
* expr.c (expand_byte_code): Set DECL_FUNCTION_LAST_LINE on
method.
* java-tree.h (struct lang_decl_func): Remove obsolete comment.
Index: expr.c
===================================================================
--- expr.c (revision 132721)
+++ expr.c (working copy)
@@ -3132,6 +3132,7 @@
int dead_code_index = -1;
unsigned char* byte_ops;
long length = DECL_CODE_LENGTH (method);
+ location_t max_location = input_location;
stack_pointer = 0;
JCF_SEEK (jcf, DECL_CODE_OFFSET (method));
@@ -3219,6 +3220,8 @@
{
int line = GET_u2 (linenumber_pointer - 2);
input_location = linemap_line_start (line_table, line, 1);
+ if (input_location > max_location)
+ max_location = input_location;
if (!(instruction_bits[PC] & BCODE_HAS_MULTI_LINENUMBERS))
break;
}
@@ -3238,6 +3241,8 @@
warning (0, "unreachable bytecode from %d to the end of the method",
dead_code_index);
}
+
+ DECL_FUNCTION_LAST_LINE (method) = max_location;
}
static void
Index: java-tree.h
===================================================================
--- java-tree.h (revision 132721)
+++ java-tree.h (working copy)
@@ -1,7 +1,7 @@
/* Definitions for parsing and type checking for the GNU compiler for
the Java(TM) language.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC.
@@ -793,8 +793,6 @@
int max_locals;
int max_stack;
int arg_slot_count;
- /* A temporary lie for the sake of ggc. Actually, last_line is
- only a source_location if USE_MAPPED_LOCATION. FIXME. */
source_location last_line; /* End line number for a function decl */
tree throws_list; /* Exception specified by `throws' */