[gcjx] Patch: FYI: class object creation fixes
Tom Tromey
tromey@redhat.com
Sun Feb 13 04:11:00 GMT 2005
I'm checking this in on the gcjx branch.
This fixes a few bugs when creating the Class object:
- we now properly register some missing fields with the Class type
- we stub map_utf8const so it doesn't simply crash
Tom
#
# patch "gcc/gcc/java/ChangeLog"
# from [f66993e80757d0bca17c5c4668ed64eda858df02]
# to [1e921377e1dfe6a6b40dcd60b91880c37cc0905c]
#
# patch "gcc/gcc/java/builtins.cc"
# from [63397b4659e7efa93355142b3c333b3236ae71f1]
# to [ca6ba9642408e40ddf9602ca9bd90c24476fe971]
#
# patch "gcc/gcc/java/builtins.hh"
# from [24ce1917e0b9152e3d716dbf2aa75af2bf56de74]
# to [c3d1aefd52cba4b6a2f9a3d165e9b8951527340f]
#
# patch "gcc/gcc/java/classobj.cc"
# from [e87b717200dad29abaf83b7550a7bb67e07eee23]
# to [f61c32620667b37790ad1c5760c9c88e73b51d8a]
#
# patch "gcc/gcc/java/decl.cc"
# from [e41b966b7da6e8a2abe96eda9eaad2b12bd9e3d1]
# to [7d914f40358ad4dbea1b2cfc18247365d558068c]
#
--- gcc/gcc/java/ChangeLog
+++ gcc/gcc/java/ChangeLog
@@ -1,5 +1,11 @@
2005-02-09 Tom Tromey <tromey@redhat.com>
+ * decl.cc (build_class_type): Register itable, itable_syms,
+ assertion_table, engine.
+ * builtins.cc (map_utf8const): New method.
+ * builtins.hh (tree_builtins::utf8map): New field.
+ (tree_builtins::map_utf8const): Moved body to .cc file.
+
* hooks.hh (gcj_abi_version): Declare.
* classobj.cc (create_class_instance): Rename 'next' field.
and initialize it properly.
--- gcc/gcc/java/builtins.cc
+++ gcc/gcc/java/builtins.cc
@@ -351,6 +351,18 @@
map_type (klass), constructor, arguments);
}
+tree
+tree_builtins::map_utf8const (const std::string &value)
+{
+ std::map<std::string, tree>::const_iterator it = utf8map.find (value);
+ if (it == utf8map.end ())
+ {
+ // FIXME
+ utf8map[value] = NULL;
+ }
+ return utf8map[value];
+}
+
void
tree_builtins::lay_out_vtable (model_class *mklass)
{
--- gcc/gcc/java/builtins.hh
+++ gcc/gcc/java/builtins.hh
@@ -38,6 +38,10 @@
// This maps a variable or parameter to its corresponding gcc tree.
std::map<model_variable_decl *, tree> varmap;
+ // This maps a string to a gcc tree representing the corresponding
+ // Utf8Const.
+ std::map<std::string, tree> utf8map;
+
// ABI instances.
cxx_abi old_abi;
bc_abi new_abi;
@@ -74,12 +78,8 @@
tree map_method_call (aot_class *, tree, tree, model_method *, bool);
tree map_new (model_class *, tree, tree);
- // Memoize a utf8const.
- tree map_utf8const (const std::string &)
- {
- // FIXME.
- abort ();
- }
+ /// Memoize a utf8const.
+ tree map_utf8const (const std::string &);
tree lay_out_class (model_class *);
--- gcc/gcc/java/classobj.cc
+++ gcc/gcc/java/classobj.cc
@@ -321,7 +321,7 @@
inst.set_field ("arrayclass", null_pointer_node);
inst.set_field ("protectionDomain", null_pointer_node);
inst.set_field ("assertion_table", null_pointer_node); // FIXME
- inst.set_field ("signers", null_pointer_node);
+ inst.set_field ("hack_signers", null_pointer_node);
inst.set_field ("chain", null_pointer_node);
inst.set_field ("aux_info", null_pointer_node);
inst.set_field ("engine", null_pointer_node);
--- gcc/gcc/java/decl.cc
+++ gcc/gcc/java/decl.cc
@@ -322,6 +322,9 @@
push_field (type_class, field, "atable", type_atable_ptr, true);
push_field (type_class, field, "atable_syms",
build_pointer_type (type_method_symbol_array), true);
+ push_field (type_class, field, "itable", type_atable_ptr, true);
+ push_field (type_class, field, "itable_syms",
+ build_pointer_type (type_method_symbol_array), true);
push_field (type_class, field, "catch_classes", ptr_type_node, true);
push_field (type_class, field, "interfaces",
build_pointer_type (type_class_ptr), true);
@@ -334,9 +337,12 @@
push_field (type_class, field, "idt", ptr_type_node, true);
push_field (type_class, field, "arrayclass", ptr_type_node, true);
push_field (type_class, field, "protectionDomain", ptr_type_node, true);
+ // FIXME: type of assertion_table field is wrong.
+ push_field (type_class, field, "assertion_table", ptr_type_node, true);
push_field (type_class, field, "hack_signers", ptr_type_node, true);
push_field (type_class, field, "chain", ptr_type_node, true);
push_field (type_class, field, "aux_info", ptr_type_node, true);
+ push_field (type_class, field, "engine", ptr_type_node, true);
push_super_field (type_class, type_object);
layout_type (type_class);
}
More information about the Java-patches
mailing list