Peter Wang
6be2fe20ee
The Java backend was sometimes generating code like this to initialise RTTI
...
Branches: main
The Java backend was sometimes generating code like this to initialise RTTI
data structures:
foo_type_info.init(...,
/* cast */ new TypeInfo_Struct(bar_type_ctor_info), ...);
bar_type_ctor_info.init(...);
where `bar_type_ctor_info' is actually a type_info.
The problem is that the fields of the non-initialised `bar_type_ctor_info'
would be copied into the new TypeInfo_Struct object. The "cast" is of course
also unnecessary as the bar is already a TypeInfo_Struct.
This patch attempts to fix the problem in two ways:
1. Don't allocate a new TypeInfo_Struct object to emulate the "cast" unless the
value is actually a TypeCtorInfo_Struct, avoiding the problem of copying
uninitialised fields. Currently this is implemented by a runtime check because
the MLDS `cast' operation doesn't record the original type of the value being
cast.
2. Instead of relying on mlds_to_rtti.m to return a list of RTTI data
structures where sub-structures appear before the structures that reference
them, explicitly perform a topological sort. This should be more robust.
Unrelated change: use pre-allocated PseudoTypeInfo instances for common
variable numbers (1 through 5).
compiler/rtti_to_mlds.m:
Add a function to order a list of RTTI definitions as above.
Use cons instead of list.append in some places now that we can.
compiler/mlds_to_java.m:
Call the function to order RTTI definitions before outputing
the initialisations.
Call TypeInfo_Struct.maybe_new instead of allocating new
TypeInfo_Structs.
Generate code that uses pre-allocated PseudoTypeInfo instances.
java/runtime/TypeInfo_Struct.java:
Add a `maybe_new' method for "casting" TypeCtorInfo_Structs to
TypeInfos or returning the argument unchanged.
Delete a copy constructor; now unused.
Add some assertions.
java/runtime/PseudoTypeInfo.java:
Add static instances of PseudoTypeInfo.
tests/hard_coded/Mmakefile:
tests/hard_coded/java_rtti_bug.exp:
tests/hard_coded/java_rtti_bug.m:
Add test case.
2009-06-26 01:12:00 +00:00
..
2007-07-25 06:40:21 +00:00
2007-07-25 06:40:21 +00:00
2007-11-14 03:45:14 +00:00
2007-12-13 08:40:35 +00:00
2007-10-19 05:18:28 +00:00
2004-03-24 00:39:36 +00:00
2004-03-24 00:39:36 +00:00
2004-03-24 00:39:36 +00:00
2006-03-29 08:09:58 +00:00
2006-09-07 05:51:48 +00:00
2006-03-29 08:09:58 +00:00
2006-06-30 12:51:55 +00:00
2007-11-14 03:45:14 +00:00
2007-11-14 03:45:14 +00:00
2007-02-27 02:12:37 +00:00
2007-02-27 02:12:37 +00:00
2005-03-10 02:36:04 +00:00
2005-03-10 02:36:04 +00:00
2005-09-02 09:27:34 +00:00
2008-03-09 09:39:25 +00:00
2008-03-09 09:39:25 +00:00
2004-01-07 05:47:46 +00:00
2004-01-08 04:49:47 +00:00
2008-07-30 02:57:55 +00:00
2008-07-30 02:57:55 +00:00
2008-04-21 05:15:31 +00:00
2008-04-21 05:15:31 +00:00
2008-04-23 05:16:50 +00:00
2008-04-23 05:16:50 +00:00
2008-04-21 05:15:31 +00:00
2008-04-21 05:15:31 +00:00
2008-04-21 05:15:31 +00:00
2008-04-21 05:15:31 +00:00
2007-03-12 02:19:31 +00:00
2007-03-12 02:19:31 +00:00
2006-03-29 08:09:58 +00:00
2007-08-29 02:53:13 +00:00
2007-08-29 02:53:13 +00:00
2006-03-29 08:09:58 +00:00
2005-03-07 04:01:32 +00:00
2005-03-07 04:01:32 +00:00
2007-05-30 02:47:10 +00:00
2007-05-31 02:23:06 +00:00
2007-05-30 02:47:10 +00:00
2007-05-30 02:47:10 +00:00
2007-05-30 02:47:10 +00:00
2007-05-30 02:47:10 +00:00
2007-02-13 01:59:04 +00:00
2006-12-15 00:05:31 +00:00
2005-09-12 09:22:52 +00:00
2009-02-04 23:10:50 +00:00
2009-02-04 23:10:50 +00:00
2004-04-08 03:51:46 +00:00
2007-01-15 02:50:58 +00:00
2007-01-15 02:50:58 +00:00
2006-04-05 05:06:58 +00:00
2004-07-26 03:19:28 +00:00
2004-07-26 03:19:28 +00:00
2007-02-15 00:41:59 +00:00
2004-07-14 05:39:14 +00:00
2006-03-29 08:09:58 +00:00
2006-03-29 08:09:58 +00:00
2007-02-15 00:41:59 +00:00
2004-02-10 13:13:11 +00:00
2004-02-19 07:17:31 +00:00
2006-03-24 04:40:59 +00:00
2007-06-06 01:48:15 +00:00
2007-12-13 08:40:35 +00:00
2004-02-16 02:28:09 +00:00
2007-12-13 08:40:35 +00:00
2004-12-14 01:07:32 +00:00
2007-01-05 02:19:46 +00:00
2007-08-30 05:46:02 +00:00
2007-08-30 05:46:02 +00:00
2004-08-25 08:21:34 +00:00
2004-11-06 05:28:10 +00:00
2007-06-06 01:48:15 +00:00
2007-06-06 01:48:15 +00:00
2006-03-29 08:09:58 +00:00
2003-12-05 05:15:14 +00:00
2009-05-07 07:42:16 +00:00
2004-08-25 08:21:34 +00:00
2004-08-25 08:21:34 +00:00
2006-04-04 02:39:23 +00:00
2006-04-26 03:06:29 +00:00
2007-02-15 00:41:59 +00:00
2007-02-22 05:35:31 +00:00
2006-03-29 08:09:58 +00:00
2006-04-05 05:06:58 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2007-06-25 00:58:14 +00:00
2007-06-25 00:58:14 +00:00
2007-06-25 00:58:14 +00:00
2007-06-25 00:58:14 +00:00
2007-02-15 00:41:59 +00:00
2006-03-30 02:46:08 +00:00
2006-03-30 02:46:08 +00:00
2006-03-30 02:46:08 +00:00
2007-02-15 00:41:59 +00:00
2006-04-26 03:06:29 +00:00
2006-03-29 08:09:58 +00:00
2007-09-21 03:21:36 +00:00
2007-10-01 05:40:43 +00:00
2007-10-01 05:40:43 +00:00
2007-09-21 03:21:36 +00:00
2006-04-07 01:32:58 +00:00
2006-04-07 01:32:58 +00:00
2005-09-07 08:30:02 +00:00
2005-09-07 08:30:02 +00:00
2003-12-17 05:32:16 +00:00
2006-03-29 08:09:58 +00:00
2008-08-27 03:58:44 +00:00
2008-08-27 03:58:44 +00:00
2008-08-27 03:58:44 +00:00
2005-11-19 07:43:49 +00:00
2005-11-19 07:43:49 +00:00
2007-06-07 07:26:23 +00:00
2007-07-25 06:12:32 +00:00
2007-07-25 06:12:32 +00:00
2007-07-25 06:12:32 +00:00
2007-07-25 06:12:32 +00:00
2009-06-16 07:48:56 +00:00
2009-06-16 07:48:56 +00:00
2006-03-29 08:09:58 +00:00
2003-12-01 22:31:36 +00:00
2007-08-23 01:14:19 +00:00
2007-06-06 06:46:39 +00:00
2007-06-06 06:46:39 +00:00
2006-03-29 08:09:58 +00:00
2006-03-22 02:56:44 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2007-08-24 07:56:27 +00:00
2007-08-24 07:56:27 +00:00
2006-03-29 08:09:58 +00:00
2006-03-29 08:09:58 +00:00
2006-03-29 08:09:58 +00:00
2007-02-15 00:41:59 +00:00
2007-01-05 02:19:46 +00:00
2007-01-05 02:19:46 +00:00
2003-12-01 15:56:15 +00:00
2004-01-01 05:57:13 +00:00
2007-07-09 04:49:25 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2003-12-03 16:12:10 +00:00
2007-06-06 01:48:15 +00:00
2006-03-29 08:09:58 +00:00
2008-12-03 05:06:07 +00:00
2007-02-22 11:39:27 +00:00
2007-02-11 03:28:04 +00:00
2005-09-29 06:33:17 +00:00
2005-10-04 07:20:24 +00:00
2008-09-22 01:23:54 +00:00
2008-09-22 01:23:54 +00:00
2007-02-15 00:41:59 +00:00
2007-02-15 00:41:59 +00:00
2007-06-12 06:53:59 +00:00
2007-02-15 00:41:59 +00:00
2007-02-15 00:41:59 +00:00
2008-03-26 11:02:16 +00:00
2008-03-26 11:02:16 +00:00
2008-03-26 11:02:16 +00:00
2008-03-26 11:02:16 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-08-20 03:39:31 +00:00
2007-09-07 09:56:05 +00:00
2007-09-07 09:56:05 +00:00
2007-09-17 07:16:09 +00:00
2007-09-17 07:16:09 +00:00
2005-09-28 09:02:17 +00:00
2005-09-28 09:02:17 +00:00
2007-07-14 02:33:27 +00:00
2006-03-22 02:56:44 +00:00
2007-06-06 01:48:15 +00:00
2004-05-12 14:24:35 +00:00
2004-05-12 14:24:35 +00:00
2006-03-29 08:09:58 +00:00
2004-08-25 08:21:34 +00:00
2005-09-12 09:22:52 +00:00
2004-08-25 08:21:34 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2006-03-22 02:56:44 +00:00
2004-08-25 08:21:34 +00:00
2006-03-29 08:09:58 +00:00
2006-03-29 08:09:58 +00:00
2007-06-06 01:48:15 +00:00
2007-06-06 01:48:15 +00:00
2008-04-03 05:26:48 +00:00
2008-04-03 05:26:48 +00:00
2008-04-03 05:26:48 +00:00
2008-04-04 04:57:00 +00:00
2008-04-03 05:26:48 +00:00
2009-04-16 02:09:09 +00:00
2008-06-27 07:27:07 +00:00
2004-08-25 08:21:34 +00:00
2007-08-23 01:14:19 +00:00
2005-10-04 07:20:24 +00:00
2007-06-08 00:47:52 +00:00
2007-08-23 01:14:19 +00:00
2007-02-22 05:56:45 +00:00
2007-02-08 01:08:11 +00:00
2005-08-31 12:40:18 +00:00
2005-10-04 07:20:24 +00:00
2006-03-29 08:09:58 +00:00
2004-04-10 13:05:59 +00:00
2006-04-05 05:06:58 +00:00
2004-11-11 06:41:52 +00:00
2007-08-23 01:14:19 +00:00
2007-06-06 01:48:15 +00:00
2007-06-06 01:48:15 +00:00
2005-11-03 07:03:16 +00:00
2005-11-03 07:03:16 +00:00
2006-01-04 07:14:35 +00:00
2006-01-04 07:14:35 +00:00
2006-01-04 07:14:35 +00:00
2006-08-31 04:12:21 +00:00
2007-02-11 04:05:45 +00:00
2009-06-26 01:12:00 +00:00
2009-06-26 01:12:00 +00:00
2003-12-05 05:15:14 +00:00
2009-05-07 07:42:16 +00:00
2008-10-07 05:27:44 +00:00
2008-10-07 05:27:44 +00:00
2004-12-20 05:26:05 +00:00
2004-12-20 05:26:05 +00:00
2006-12-11 04:10:46 +00:00
2007-06-06 01:48:15 +00:00
2004-02-09 08:32:59 +00:00
2004-02-10 09:33:06 +00:00
2007-06-07 07:26:23 +00:00
2004-02-09 08:32:59 +00:00
2004-02-09 08:32:59 +00:00
2004-02-09 08:32:59 +00:00
2007-06-07 07:26:23 +00:00
2007-08-23 01:14:19 +00:00
2007-07-30 06:03:08 +00:00
2007-07-30 06:03:08 +00:00
2006-09-16 10:46:41 +00:00
2006-09-16 10:46:41 +00:00
2009-06-16 07:48:56 +00:00
2005-09-12 09:22:52 +00:00
2009-02-19 03:49:20 +00:00
2009-06-26 01:12:00 +00:00
2005-05-23 03:15:49 +00:00
2006-03-29 08:09:58 +00:00
2007-08-23 01:14:19 +00:00
2008-08-29 05:33:51 +00:00
2008-08-29 05:33:51 +00:00
2008-08-29 05:33:51 +00:00
2008-04-28 00:50:56 +00:00
2008-04-28 00:50:56 +00:00
2007-06-06 01:48:15 +00:00
2007-01-15 02:24:28 +00:00
2007-01-15 02:24:28 +00:00
2007-02-22 11:39:27 +00:00
2007-02-11 03:28:04 +00:00
2007-02-11 03:28:04 +00:00
2007-02-11 03:28:04 +00:00
2006-04-05 02:12:58 +00:00
2007-06-06 01:48:15 +00:00
2007-06-06 01:48:15 +00:00
2004-11-05 03:09:35 +00:00
2004-11-05 03:09:35 +00:00
2004-11-05 03:09:35 +00:00
2006-03-29 08:09:58 +00:00
2007-09-04 03:12:21 +00:00
2007-09-04 03:12:21 +00:00
2006-04-04 02:39:23 +00:00
2007-03-18 23:35:04 +00:00
2007-03-19 23:00:23 +00:00
2007-03-18 23:35:04 +00:00
2006-03-22 02:56:44 +00:00
2006-03-21 22:25:39 +00:00
2006-03-30 00:42:01 +00:00
2006-11-14 21:36:27 +00:00
2006-11-14 21:36:27 +00:00
2004-12-02 07:51:28 +00:00
2005-10-06 08:26:12 +00:00
2006-04-05 02:12:58 +00:00
2005-09-12 09:22:52 +00:00
2006-07-19 15:19:09 +00:00
2007-06-06 01:48:15 +00:00
2007-02-15 00:41:59 +00:00
2004-04-01 04:51:21 +00:00
2005-09-12 09:22:52 +00:00
2006-04-05 02:12:58 +00:00
2006-04-20 04:05:26 +00:00
2006-04-20 04:05:26 +00:00
2007-02-15 00:41:59 +00:00
2006-04-20 04:05:26 +00:00
2006-10-09 06:40:29 +00:00
2006-10-09 06:40:29 +00:00
2007-04-13 04:56:46 +00:00
2007-04-13 04:56:46 +00:00
2005-04-14 06:51:03 +00:00
2005-04-14 06:51:03 +00:00
2006-03-08 02:25:43 +00:00
2006-04-04 02:39:23 +00:00
2005-03-24 05:34:41 +00:00
2005-03-24 05:34:41 +00:00
2007-01-15 02:24:28 +00:00
2007-01-15 02:24:28 +00:00
2004-12-02 08:03:57 +00:00
2004-12-08 08:05:50 +00:00
2005-09-12 09:22:52 +00:00
2005-09-12 09:02:30 +00:00
2004-07-07 07:11:22 +00:00
2005-09-12 09:02:30 +00:00
2005-09-12 13:00:15 +00:00
2005-09-12 13:00:15 +00:00
2004-08-25 08:21:34 +00:00
2004-08-25 08:21:34 +00:00
2005-01-15 11:41:40 +00:00
2003-12-22 22:59:42 +00:00
2003-12-22 22:59:42 +00:00
2003-12-22 22:59:42 +00:00
2007-07-14 02:33:27 +00:00
2005-01-21 03:32:20 +00:00
2006-03-29 08:09:58 +00:00
2007-06-22 04:42:23 +00:00
2004-08-25 08:21:34 +00:00
2008-06-16 04:52:32 +00:00
2008-06-17 03:57:08 +00:00
2008-06-16 04:52:32 +00:00
2007-06-06 01:48:15 +00:00
2006-03-29 08:09:58 +00:00
2006-04-05 07:07:46 +00:00
2006-04-05 07:07:46 +00:00
2006-10-04 23:59:46 +00:00
2006-10-04 23:59:46 +00:00
2006-08-28 10:13:23 +00:00
2007-06-25 00:47:35 +00:00
2007-06-22 04:42:23 +00:00
2007-06-22 04:42:23 +00:00
2007-12-30 04:09:26 +00:00
2007-12-30 04:09:26 +00:00
2008-05-22 04:11:30 +00:00
2008-05-22 04:11:30 +00:00
2005-10-26 03:04:25 +00:00
2007-10-31 03:58:33 +00:00
2005-03-15 02:51:26 +00:00
2005-03-15 02:51:26 +00:00
2008-02-01 05:45:30 +00:00
2008-02-01 05:45:30 +00:00
2005-03-18 01:18:17 +00:00
2005-03-18 01:18:17 +00:00
2005-03-18 01:18:17 +00:00
2005-03-18 01:18:17 +00:00
2006-04-04 02:39:23 +00:00
2004-06-28 04:50:10 +00:00
2004-06-28 04:50:10 +00:00
2008-01-16 08:34:54 +00:00
2008-01-16 08:34:54 +00:00
2006-11-09 00:47:27 +00:00
2006-12-21 11:11:37 +00:00
2006-11-09 00:47:27 +00:00
2006-11-09 00:47:27 +00:00
2006-11-09 00:47:27 +00:00
2006-10-26 07:56:11 +00:00
2006-10-26 07:56:11 +00:00
2006-10-26 07:56:11 +00:00
2007-11-19 05:45:01 +00:00
2006-03-29 08:09:58 +00:00
2007-04-20 05:18:40 +00:00
2007-04-20 05:18:40 +00:00
2007-03-18 23:35:04 +00:00
2007-06-06 02:09:45 +00:00
2007-06-06 02:09:45 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2006-09-20 09:42:28 +00:00
2003-10-26 12:43:34 +00:00
2006-09-20 09:42:28 +00:00
2007-02-02 05:39:58 +00:00
2007-02-02 05:39:58 +00:00
2006-06-20 08:48:51 +00:00
2006-06-20 08:48:51 +00:00
2007-06-01 12:54:15 +00:00
2007-06-01 12:54:15 +00:00
2005-09-28 09:32:03 +00:00
2005-09-02 05:00:29 +00:00
2006-05-26 04:03:12 +00:00
2004-01-14 05:08:36 +00:00
2004-01-14 05:08:36 +00:00
2004-01-14 05:08:36 +00:00
2006-07-10 04:41:00 +00:00
2006-03-07 01:03:46 +00:00
2006-03-07 01:03:46 +00:00
2006-03-07 01:03:46 +00:00
2006-03-29 08:09:58 +00:00
2009-01-02 03:12:09 +00:00
2009-01-02 03:12:09 +00:00
2004-03-19 09:06:56 +00:00
2006-04-04 02:39:23 +00:00
2005-09-12 09:02:30 +00:00
2006-03-07 22:23:58 +00:00
2006-12-21 11:11:37 +00:00
2007-09-02 22:43:03 +00:00
2007-10-19 05:17:18 +00:00
2009-05-18 05:55:14 +00:00
2009-05-18 05:55:14 +00:00
2007-10-24 00:50:01 +00:00
2007-10-24 00:50:01 +00:00
2006-12-22 05:44:29 +00:00
2006-12-22 05:44:29 +00:00
2007-10-24 00:50:01 +00:00
2007-10-24 00:50:01 +00:00
2004-08-25 08:21:34 +00:00
2004-08-25 08:21:34 +00:00
2004-08-25 08:21:34 +00:00
2006-03-29 08:09:58 +00:00
2008-03-19 05:30:01 +00:00
2008-03-19 05:30:01 +00:00
2008-03-19 05:30:01 +00:00
2006-07-27 05:03:54 +00:00
2006-07-27 05:03:54 +00:00
2006-07-27 05:03:54 +00:00
2006-07-27 05:03:54 +00:00
2006-11-06 07:56:21 +00:00
2006-11-06 07:56:21 +00:00
2006-07-27 05:03:54 +00:00
2006-08-14 09:09:22 +00:00
2006-07-27 05:03:54 +00:00
2006-08-14 09:09:22 +00:00
2007-02-22 03:50:38 +00:00
2007-02-22 03:50:38 +00:00
2005-01-13 11:04:38 +00:00
2005-01-13 11:04:38 +00:00
2006-12-22 05:44:29 +00:00
2005-08-31 03:08:11 +00:00
2005-08-31 03:08:11 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2009-03-10 05:00:34 +00:00
2006-04-04 02:39:23 +00:00
2006-03-22 02:56:44 +00:00
2005-09-09 07:00:57 +00:00
2005-09-09 07:00:57 +00:00
2006-03-22 02:56:44 +00:00
2006-10-01 04:57:41 +00:00
2008-02-27 09:46:08 +00:00
2008-02-27 09:46:08 +00:00
2008-05-19 01:03:46 +00:00
2008-05-19 01:03:46 +00:00
2008-05-19 01:03:46 +00:00
2008-05-19 01:03:46 +00:00
2008-05-22 09:06:23 +00:00
2006-08-01 23:37:00 +00:00
2006-08-01 23:37:00 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2005-09-28 09:02:17 +00:00
2006-08-14 09:09:22 +00:00
2007-08-23 01:14:19 +00:00
2009-05-25 02:29:20 +00:00
2009-05-25 02:29:20 +00:00
2007-05-30 02:42:46 +00:00
2007-05-30 02:42:46 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2009-03-26 06:32:19 +00:00
2008-07-11 06:01:50 +00:00
2009-03-26 06:32:19 +00:00
2007-02-15 00:41:59 +00:00
2005-09-12 09:02:30 +00:00
2007-02-15 00:41:59 +00:00
2007-02-22 05:35:31 +00:00
2006-03-29 08:09:58 +00:00
2006-03-29 08:09:58 +00:00
2007-02-15 00:41:59 +00:00
2007-02-22 05:35:31 +00:00
2007-09-17 07:16:09 +00:00
2007-02-15 00:41:59 +00:00
2006-03-29 08:09:58 +00:00
2005-08-22 03:55:23 +00:00
2006-10-30 07:20:57 +00:00