This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gcjx] Patch: FYI: parameter types
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: 24 Mar 2005 18:51:21 -0700
- Subject: [gcjx] Patch: FYI: parameter types
- Reply-to: tromey at redhat dot com
I'm checking this in on the gcjx branch.
You are required to set DECL_ARG_TYPE for a PARM_DECL, which I didn't
realize. This fixes a lot of crashes.
Tom
2005-03-24 Tom Tromey <tromey@redhat.com>
* glue.hh: Include target.h.
* builtins.cc (add): Set DECL_ARG_TYPE on PARM_DECL.
(map_param_or_var): Likewise.
Index: builtins.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/builtins.cc,v
retrieving revision 1.1.2.24
diff -u -r1.1.2.24 builtins.cc
--- builtins.cc 24 Mar 2005 20:02:03 -0000 1.1.2.24
+++ builtins.cc 25 Mar 2005 01:51:43 -0000
@@ -119,6 +119,7 @@
tree this_decl = build_decl (PARM_DECL, get_identifier ("this"),
klass_ptr);
DECL_CONTEXT (this_decl) = result;
+ DECL_ARG_TYPE (this_decl) = TREE_TYPE (this_decl);
TREE_CHAIN (this_decl) = formals;
formals = this_decl;
}
@@ -291,6 +292,17 @@
map_identifier (var->get_name ()),
map_type (var->type ()));
DECL_CONTEXT (result) = context;
+ if (type == PARM_DECL)
+ {
+ // Promote argument types here. I think this assumes that
+ // 'jint' and the ABI 'int' are the same... FIXME?
+ tree argtype = TREE_TYPE (result);
+ if (targetm.calls.promote_prototypes (argtype)
+ && TYPE_PRECISION (argtype) < TYPE_PRECISION (type_jint)
+ && INTEGRAL_TYPE_P (argtype))
+ argtype = type_jint;
+ DECL_ARG_TYPE (result) = argtype;
+ }
varmap[var] = result;
}
return varmap[var];
Index: glue.hh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/glue.hh,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 glue.hh
--- glue.hh 8 Mar 2005 01:22:00 -0000 1.1.2.9
+++ glue.hh 25 Mar 2005 01:51:43 -0000
@@ -77,6 +77,7 @@
#include "ggc.h"
#include "debug.h"
#include "version.h"
+#include "target.h"
// This gets us alloc_stmt_list(). Shouldn't that be in
// tree-iterator.h?