Author: dgilmore
Date: 2011-03-12 19:41:50 -0500 (Sat, 12 Mar 2011)
New Revision: 3515
Modified:
trunk/osprey/be/be/omp_lower.cxx
trunk/osprey/be/com/privatize_common.cxx
trunk/osprey/be/com/privatize_common.h
Log:
Fix bug 743 - OpenMP: problem with file static variables that are
thread_private.
CR: Jian-Xin Lai
Modified: trunk/osprey/be/be/omp_lower.cxx
===================================================================
--- trunk/osprey/be/be/omp_lower.cxx 2011-03-13 00:36:28 UTC (rev 3514)
+++ trunk/osprey/be/be/omp_lower.cxx 2011-03-13 00:41:50 UTC (rev 3515)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010 Advanced Micro Devices, Inc. All Rights Reserved.
+ * Copyright (C) 2009-2011 Advanced Micro Devices, Inc. All Rights Reserved.
*/
/*
@@ -296,17 +296,31 @@
Is_True(rename_common_stack.Elements() == 1,
("OMP_Prelower(): rename_common_stack.Elements() != 1"));
-# ifdef KEY
RENAMING_SCOPE rename_common(NULL, &omp_pool);
- RENAMING_SCOPE rename_common_blk(NULL, &omp_pool);
+
+ // Note that rename_common_blk renaming scope needs to provide
+ // mappings that are valid through the entire compilation.
+ static RENAMING_SCOPE *rename_common_blk;
+ if (rename_common_blk == NULL) {
+ rename_common_blk = CXX_NEW(RENAMING_SCOPE(NULL, Malloc_Mem_Pool),
+ Malloc_Mem_Pool);
+ }
+ else {
+ std::list<ST*>::const_iterator cit =
rename_common_blk->local_mappings.begin();
+
+ // Remove any mappings local symbols for previously processed PU.
+ for( ; cit != rename_common_blk->local_mappings.end(); cit++ )
+ rename_common_blk->map.Remove(*cit);
+ rename_common_blk->local_mappings.clear();
+ }
+
RENAMING_STACK rename_scope_stack(&omp_pool);
rename_scope_stack.Push(CXX_NEW(RENAMING_SCOPE(NULL, &omp_pool),
&omp_pool));
Rename_Threadprivate_COMMON(pu, pu, pu,
&rename_scope_stack,
&rename_common,
- &rename_common_blk);
-# endif
+ rename_common_blk);
// create parent map
Omp_Parent_Map = WN_MAP_Create(&omp_pool);
Modified: trunk/osprey/be/com/privatize_common.cxx
===================================================================
--- trunk/osprey/be/com/privatize_common.cxx 2011-03-13 00:36:28 UTC (rev
3514)
+++ trunk/osprey/be/com/privatize_common.cxx 2011-03-13 00:41:50 UTC (rev
3515)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Advanced Micro Devices, Inc. All Rights Reserved.
+ * Copyright (C) 2010-2011 Advanced Micro Devices, Inc. All Rights Reserved.
*/
/*
* Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved.
@@ -431,7 +431,7 @@
static ST *Create_Local_Threadprivate_Symbol(ST *old_st)
{
ST_SCLASS sclass = ST_sclass(old_st);
- Is_True(SCLASS_Is_Not_PU_Local(sclass),
+ Is_True(sclass != SCLASS_AUTO,
("Create_Local_Symbol() called for ST with sclass %d",
(INT) sclass ) );
@@ -473,8 +473,9 @@
ST *new_thdprv_st = New_ST(GLOBAL_SYMTAB);
- ST_SCLASS sclass = (ST_sclass (old_st) == SCLASS_FSTATIC) ?
- SCLASS_FSTATIC : SCLASS_COMMON;
+ ST_SCLASS sclass = ((ST_sclass (old_st) == SCLASS_FSTATIC
+ || ST_sclass (old_st) == SCLASS_PSTATIC) ?
+ SCLASS_FSTATIC : SCLASS_COMMON);
TY_IDX old_ty_idx, new_ty_idx;
@@ -522,6 +523,10 @@
if (!new_st_for_common_blk) {
new_st_for_common_blk =
Create_Global_Threadprivate_Symbol(common_block);
common_blk_scope->map.Enter(common_block, new_st_for_common_blk);
+ // Keep track of local symbols, whose mappings need to be removed before
+ // processing the next PU.
+ if (ST_IDX_level(ST_st_idx(common_block)) != GLOBAL_SYMTAB)
+ common_blk_scope->local_mappings.push_front(common_block);
}
new_st = scope->map.Find(common_block);
Modified: trunk/osprey/be/com/privatize_common.h
===================================================================
--- trunk/osprey/be/com/privatize_common.h 2011-03-13 00:36:28 UTC (rev
3514)
+++ trunk/osprey/be/com/privatize_common.h 2011-03-13 00:41:50 UTC (rev
3515)
@@ -1,4 +1,7 @@
/*
+ * Copyright (C) 2011 Advanced Micro Devices, Inc. All Rights Reserved.
+ */
+/*
* Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved.
*/
@@ -80,6 +83,7 @@
#include "cxx_hash.h"
#endif
+#include <list>
typedef HASH_TABLE<ST *, ST *> RENAMING_MAP;
@@ -96,6 +100,8 @@
ST_SET ignore; // ST's that don't need to be renamed
HASH_TABLE<WN *, BOOL> old_prags; // original PRIVATE pragmas in priv_list
// for STs that must be renamed
+ std::list<ST*> local_mappings; // Local symtab table mappings, which need
+ // to be removed when processing a new PU.
RENAMING_SCOPE(WN *_priv_list, MEM_POOL *_pool)
: priv_list(_priv_list), pool(_pool), map(NUM_HASH_ELEMENTS, _pool),
ignore(NUM_HASH_ELEMENTS, _pool), old_prags(NUM_HASH_ELEMENTS, _pool)
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel