Author: zhuqing
Date: 2011-03-10 23:05:43 -0500 (Thu, 10 Mar 2011)
New Revision: 3513

Modified:
   trunk/osprey/be/cg/cgemit.cxx
   trunk/osprey/be/cg/hb.cxx
   trunk/osprey/be/cg/hb.h
Log:
The fix solve two problems:
1. It is not appropriate to use a char* to record a string recorded in STR 
table, because memory area of STR table could change when it enlarge itself. We 
should use STR table index instead.Those code from LOONGSON is almost right, 
except it has no need to copy the string.
2. The function HB_Form_Hyperblocks should take a BB_REGION* instead of 
BB_REGION& as parameter, because BB_REGION& would lead to REGION construction 
when we pass NULL as this parameter, and this could cause failure with some 
STL. 

Code Review: Jian-xin


Modified: trunk/osprey/be/cg/cgemit.cxx
===================================================================
--- trunk/osprey/be/cg/cgemit.cxx       2011-03-09 19:37:50 UTC (rev 3512)
+++ trunk/osprey/be/cg/cgemit.cxx       2011-03-11 04:05:43 UTC (rev 3513)
@@ -8381,12 +8381,7 @@
 static Dwarf_Unsigned  prev_pu_base_elfsym = 0;
 static PU_IDX          prev_pu_pu_idx      = (PU_IDX) 0;
 static Dwarf_Unsigned  prev_pu_end_offset_from_last_label = 0;
-#ifdef TARG_LOONGSON
- /* We'd better use str_idx, not the str itself to avoid access trouble after 
alloc*/ 
 static STR_IDX prev_pu_last_label_name_idx = 0;
-#else
-static char           *prev_pu_last_label_name = NULL;
-#endif
 static Dwarf_Unsigned  prev_pu_last_offset = 0;
 
 static void
@@ -8399,11 +8394,7 @@
   prev_pu_base_elfsym = base_elf_idx;
   prev_pu_pu_idx      = pu_idx;
   prev_pu_end_offset_from_last_label = end_offset;
-#ifdef TARG_LOONGSON
-  prev_pu_last_label_name_idx = Save_Str(LABEL_name(label_idx));
-#else
-  prev_pu_last_label_name = LABEL_name(label_idx);
-#endif
+  prev_pu_last_label_name_idx = LABEL_name_idx(label_idx);
   prev_pu_last_offset = Get_Label_Offset(label_idx);
 }
 
@@ -8417,11 +8408,7 @@
                                                               
prev_pu_last_label,
                                                               
prev_pu_base_elfsym,
                                                               prev_pu_pu_idx,
-#ifdef TARG_LOONGSON
                                                               
Index_To_Str(prev_pu_last_label_name_idx),
-#else
-                                                              
prev_pu_last_label_name,
-#endif
                                                               
prev_pu_last_offset),
                                         prev_pu_end_offset_from_last_label);
 }

Modified: trunk/osprey/be/cg/hb.cxx
===================================================================
--- trunk/osprey/be/cg/hb.cxx   2011-03-09 19:37:50 UTC (rev 3512)
+++ trunk/osprey/be/cg/hb.cxx   2011-03-11 04:05:43 UTC (rev 3513)
@@ -581,7 +581,7 @@
 
 /////////////////////////////////////
 void
-HB_Form_Hyperblocks(RID *rid, const BB_REGION& bb_region)
+HB_Form_Hyperblocks(RID *rid, const BB_REGION* bb_region)
 /////////////////////////////////////
 //  See interface description.
 /////////////////////////////////////

Modified: trunk/osprey/be/cg/hb.h
===================================================================
--- trunk/osprey/be/cg/hb.h     2011-03-09 19:37:50 UTC (rev 3512)
+++ trunk/osprey/be/cg/hb.h     2011-03-11 04:05:43 UTC (rev 3513)
@@ -451,7 +451,7 @@
 extern HB* HB_Alloc(MEM_POOL* pool);
 
 extern void HB_Init(void);
-extern void HB_Form_Hyperblocks(RID* rid, const BB_REGION& bb_region);
+extern void HB_Form_Hyperblocks(RID* rid, const BB_REGION* bb_region);
 //
 // Some typedefs to make using STL lists easier
 //


------------------------------------------------------------------------------
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
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to