2018-07-14 15:45:15 -04:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
2021-10-04 23:47:27 -07:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 16:41:20 -04:00
|
|
|
|
2020-07-28 01:39:05 -07:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
|
|
|
|
|
2021-07-08 20:42:47 -07:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
2020-09-13 19:49:52 -07:00
|
|
|
|
2021-01-16 22:51:01 -07:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
|
|
|
|
|
2020-04-23 18:58:47 -04:00
|
|
|
|
2022-03-26 14:33:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-08-02 21:28:06 -07:00
|
|
|
|
2021-07-13 20:38:55 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2020-05-14 16:34:04 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-13 19:17:58 -07:00
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
|
|
|
|
|
2020-07-17 09:33:56 -07:00
|
|
|
|
|
|
|
|
|
2021-11-21 19:39:32 -07:00
|
|
|
|
2020-07-17 09:33:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-03 18:24:42 +03:00
|
|
|
|
2022-03-30 11:03:50 +02:00
|
|
|
|
2021-08-29 15:11:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-29 17:25:18 -04:00
|
|
|
|
2021-08-29 15:11:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-29 17:25:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-29 15:11:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-29 17:25:18 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-29 15:11:01 -04:00
|
|
|
|
2020-09-03 18:24:42 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-13 20:38:55 -04:00
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
2021-11-07 09:38:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-27 19:15:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-02 17:18:54 +01:00
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
2022-05-13 22:59:06 +07:00
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-31 23:08:53 +01:00
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-06 17:54:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
2022-03-02 17:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2020-08-21 13:24:13 -07:00
|
|
|
|
2021-01-16 22:51:01 -07:00
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
|
|
|
|
|
2020-09-03 18:24:42 +03:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2020-07-17 09:33:56 -07:00
|
|
|
|
2020-06-18 19:03:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-08 18:05:54 +01:00
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 16:41:20 -04:00
|
|
|
|
|
|
|
|
|
2021-07-12 15:30:30 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-02 17:08:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2022-05-24 00:10:56 -07:00
|
|
|
|
2022-03-14 20:00:17 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 00:10:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-14 20:00:17 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-14 12:28:52 -07:00
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-14 20:00:17 -07:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 18:26:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2020-05-15 21:44:33 -04:00
|
|
|
|
2020-08-21 13:24:13 -07:00
|
|
|
|
2021-01-16 22:51:01 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-10 15:32:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2022-03-10 15:32:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2022-03-10 15:32:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2021-12-26 16:40:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2021-07-07 14:17:04 -07:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:51:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-03 00:03:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
|
|
|
|
|
2022-03-03 00:03:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-07 14:17:04 -07:00
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
2020-05-14 16:34:04 -04:00
|
|
|
|
2022-04-15 13:46:51 +02:00
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
2022-05-23 23:07:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
2020-05-14 16:34:04 -04:00
|
|
|
|
|
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
2022-04-15 13:46:51 +02:00
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-04-15 13:46:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-05-15 21:00:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-14 16:34:04 -04:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2021-11-24 22:27:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stage2: implement runtime pointer access to global constants
The main problem that motivated these changes is that global constants
which are referenced by pointer would not be emitted into the binary.
This happened because `semaDecl` did not add `codegen_decl` tasks for
global constants, instead relying on the constant values being copied as
necessary. However when the global constants are referenced by pointer,
they need to be sent to the linker to be emitted.
After making global const arrays, structs, and unions get emitted, this
uncovered a latent issue: the anonymous decls that they referenced would
get garbage collected (via `deleteUnusedDecl`) even though they would
later be referenced by the global const.
In order to solve this problem, I introduced `anon_work_queue` which is
the same as `work_queue` except a lower priority. The `codegen_decl`
task for anon decls goes into the `anon_work_queue` ensuring that the
owner decl gets a chance to mark its anon decls as alive before they are
possibly deleted.
This caused a few regressions, which I made the judgement call to add
workarounds for. Two steps forward, one step back, is still progress.
The regressions were:
* Two behavior tests having to do with unions. These tests were
intentionally exercising the LLVM constant value lowering, however,
due to the bug with garbage collection that was fixed in this commit,
the LLVM code was not getting exercised, and union types/values were
not implemented correctly, due to me forgetting that LLVM does not
allow bitcasting aggregate values.
- This is worked around by allowing those 2 test cases to regress,
moving them to the "passing for stage1 only" section.
* The test-stage2 test cases (in test/cases/*) for non-LLVM backends
previously did not have any calls to lower struct values, but now
they do. The code that was there was just `@panic("TODO")`. I
replaced that code with a stub that generates the wrong value. This
is an intentional miscompilation that will obviously need to get
fixed before any struct behavior tests pass. None of the current
tests we have exercise loading any values from these global const
structs, so there is not a problem until we try to improve these
backends.
2021-10-26 22:29:43 -07:00
|
|
|
|
2022-03-19 20:28:28 +01:00
|
|
|
|
2022-02-02 00:20:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-14 12:28:52 -07:00
|
|
|
|
2021-12-30 14:39:06 +01:00
|
|
|
|
|
|
|
|
|
2022-01-24 20:38:56 -07:00
|
|
|
|
2022-02-02 00:20:41 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-30 14:39:06 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-30 14:39:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-02 00:20:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-02-02 00:20:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-30 14:39:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
|
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-28 10:58:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-30 14:39:06 +01:00
|
|
|
|
stage2: implement runtime pointer access to global constants
The main problem that motivated these changes is that global constants
which are referenced by pointer would not be emitted into the binary.
This happened because `semaDecl` did not add `codegen_decl` tasks for
global constants, instead relying on the constant values being copied as
necessary. However when the global constants are referenced by pointer,
they need to be sent to the linker to be emitted.
After making global const arrays, structs, and unions get emitted, this
uncovered a latent issue: the anonymous decls that they referenced would
get garbage collected (via `deleteUnusedDecl`) even though they would
later be referenced by the global const.
In order to solve this problem, I introduced `anon_work_queue` which is
the same as `work_queue` except a lower priority. The `codegen_decl`
task for anon decls goes into the `anon_work_queue` ensuring that the
owner decl gets a chance to mark its anon decls as alive before they are
possibly deleted.
This caused a few regressions, which I made the judgement call to add
workarounds for. Two steps forward, one step back, is still progress.
The regressions were:
* Two behavior tests having to do with unions. These tests were
intentionally exercising the LLVM constant value lowering, however,
due to the bug with garbage collection that was fixed in this commit,
the LLVM code was not getting exercised, and union types/values were
not implemented correctly, due to me forgetting that LLVM does not
allow bitcasting aggregate values.
- This is worked around by allowing those 2 test cases to regress,
moving them to the "passing for stage1 only" section.
* The test-stage2 test cases (in test/cases/*) for non-LLVM backends
previously did not have any calls to lower struct values, but now
they do. The code that was there was just `@panic("TODO")`. I
replaced that code with a stub that generates the wrong value. This
is an intentional miscompilation that will obviously need to get
fixed before any struct behavior tests pass. None of the current
tests we have exercise loading any values from these global const
structs, so there is not a problem until we try to improve these
backends.
2021-10-26 22:29:43 -07:00
|
|
|
|
|
|
|
|
|
2022-01-01 12:51:29 +01:00
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
|
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-23 18:48:10 -07:00
|
|
|
|
2022-03-02 11:10:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-01 12:51:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-20 16:35:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
2022-05-23 22:06:27 +02:00
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-21 23:31:55 +01:00
|
|
|
|
|
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
|
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
|
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-20 16:35:24 +01:00
|
|
|
|
|
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
2022-05-23 22:06:27 +02:00
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-05-23 18:24:03 +02:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2022-02-20 16:35:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
|
|
|
|
|
2022-05-22 19:36:59 +04:30
|
|
|
|
2022-02-21 23:31:55 +01:00
|
|
|
|
2022-03-06 15:57:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-20 16:35:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-23 22:06:27 +02:00
|
|
|
|
2022-02-20 16:35:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
|
|
|
|
|
2020-05-15 21:44:33 -04:00
|
|
|
|
2020-08-21 13:24:13 -07:00
|
|
|
|
2021-01-16 22:51:01 -07:00
|
|
|
|
2020-11-26 13:19:30 +01:00
|
|
|
|
2020-05-14 13:20:27 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 16:41:20 -04:00
|
|
|
|
2018-07-15 00:04:12 -04:00
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-22 00:23:54 -07:00
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
Sema: fix pointer type hash and equality functions
Several issues with pointer types are fixed:
Prior to this commit, Zig would not canonicalize a pointer type with
an explicit alignment to alignment=0 if it matched the pointee ABI
alignment. In order to fix this, `Type.ptr` now takes a Target
parameter. I also moved the host_size canonicalization to `Type.ptr`
since target is now available. Similarly, is_allowzero in the case of
C pointers is now treated as a canonicalization done by the function
rather than a precondition.
in-memory coercion for pointers now properly checks ABI alignment
of pointee types instead of incorrectly treating the 0 value as an
alignment.
Type equality is completely reworked based on the tag() rather than the
zigTypeTag(). It's still semantically based on zigTypeTag() but that
knowledge is implied rather than dictating the control flow of the
logic. Importantly, this fixes cases for opaques, structs, tuples,
enums, and unions, where type equality was incorrectly returning based
on whether the tag() values were equal.
Additionally, pointer type equality now takes into account alignment.
Because we canonicalize non-zero alignment which equals pointee type ABI
alignment to alignment=0, this now can be a simple integer comparison.
Type hashing is implemented for pointers and floats. Array types now
additionally hash their sentinels.
This regressed some behavior tests that were passing but only because
of bugs regarding type equality.
The C backend has a noticeable problem with lowering differently-aligned
pointers (particularly slices) as the same type, causing C compilation
errors due to duplicate declarations.
2022-02-28 19:22:16 -07:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-08 20:33:45 +01:00
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
2022-02-08 18:05:54 +01:00
|
|
|
|
|
|
|
|
|
2022-02-08 20:33:45 +01:00
|
|
|
|
|
|
|
|
|
2022-02-08 18:05:54 +01:00
|
|
|
|
|
|
|
|
|
2022-04-19 21:51:08 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-01 22:03:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-02-08 20:33:45 +01:00
|
|
|
|
|
|
|
|
|
2021-12-28 22:00:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 19:23:33 +02:00
|
|
|
|
2022-05-24 15:10:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 19:23:33 +02:00
|
|
|
|
|
|
|
|
|
2022-05-24 15:10:18 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 19:23:33 +02:00
|
|
|
|