[19/32] global trees

Message ID e9b6c977-af51-3d35-a443-1071e2377cdb@acm.org
State Superseded
Headers show
Series
  • C++ 20 Modules
Related show

Commit Message

Nathan Sidwell Nov. 3, 2020, 9:16 p.m.
We directly reference global trees, and expect them to be immutable. 
This reorders the global tree arrays, moving the mutable ones after a 
High Water Mark.  Those after the HWM are not directly accessed in the 
module machinery (we'll reference by name or equivalent).


-- 
Nathan Sidwell

Comments

Jakub Jelinek via Gcc-patches Nov. 6, 2020, 8:29 p.m. | #1
On 11/3/20 2:16 PM, Nathan Sidwell wrote:
> We directly reference global trees, and expect them to be immutable.

> This reorders the global tree arrays, moving the mutable ones after a

> High Water Mark.  Those after the HWM are not directly accessed in the

> module machinery (we'll reference by name or equivalent).

>

>

>

> 19-global-trees.diff

>

OK

jeff

Patch

diff --git c/gcc/c-family/c-common.h w/gcc/c-family/c-common.h
index 18b489d55a3..eb9070b4c6c 100644
--- c/gcc/c-family/c-common.h
+++ w/gcc/c-family/c-common.h
@@ -357,13 +360,17 @@  enum c_tree_index
 
     CTI_DEFAULT_FUNCTION_TYPE,
 
+    CTI_NULL,
+
     /* These are not types, but we have to look them up all the time.  */
     CTI_FUNCTION_NAME_DECL,
     CTI_PRETTY_FUNCTION_NAME_DECL,
     CTI_C99_FUNCTION_NAME_DECL,
-    CTI_SAVED_FUNCTION_NAME_DECLS,
 
-    CTI_NULL,
+    CTI_MODULE_HWM,
+    /* Below here entities change during compilation.  */
+
+    CTI_SAVED_FUNCTION_NAME_DECLS,
 
     CTI_MAX
 };
diff --git c/gcc/cp/cp-tree.h w/gcc/cp/cp-tree.h
index fdb8ee57f0b..e8e4d0af2d8 100644
--- c/gcc/cp/cp-tree.h
+++ w/gcc/cp/cp-tree.h
@@ -127,12 +127,8 @@  enum cp_tree_index
     CPTI_INIT_LIST_TYPE,
     CPTI_VTBL_TYPE,
     CPTI_VTBL_PTR_TYPE,
-    CPTI_STD,
-    CPTI_ABI,
     CPTI_GLOBAL,
     CPTI_GLOBAL_TYPE,
-    CPTI_CONST_TYPE_INFO_TYPE,
-    CPTI_TYPE_INFO_PTR_TYPE,
     CPTI_ABORT_FNDECL,
     CPTI_AGGR_TAG,
     CPTI_CONV_OP_MARKER,
@@ -189,8 +185,28 @@  enum cp_tree_index
     CPTI_NOEXCEPT_FALSE_SPEC,
     CPTI_NOEXCEPT_DEFERRED_SPEC,
 
+    CPTI_NULLPTR,
+    CPTI_NULLPTR_TYPE,
+
+    CPTI_ANY_TARG,
+
+    CPTI_MODULE_HWM,
+    /* Nodes after here change during compilation, or should not be in
+       the module's global tree table.  */
+
+    /* We must find these via the global namespace.  */
+    CPTI_STD,
+    CPTI_ABI,
+
+    /* These are created at init time, but the library/headers provide
+       definitions.  */
+    CPTI_ALIGN_TYPE,
+    CPTI_CONST_TYPE_INFO_TYPE,
+    CPTI_TYPE_INFO_PTR_TYPE,
     CPTI_TERMINATE_FN,
     CPTI_CALL_UNEXPECTED_FN,
+
+    /* These are lazily inited.  */
     CPTI_GET_EXCEPTION_PTR_FN,
     CPTI_BEGIN_CATCH_FN,
     CPTI_END_CATCH_FN,
@@ -203,13 +219,6 @@  enum cp_tree_index
     CPTI_DSO_HANDLE,
     CPTI_DCAST,
 
-    CPTI_NULLPTR,
-    CPTI_NULLPTR_TYPE,
-
-    CPTI_ALIGN_TYPE,
-
-    CPTI_ANY_TARG,
-
     CPTI_SOURCE_LOCATION_IMPL,
 
     CPTI_FALLBACK_DFLOAT32_TYPE,