google/protobuf/stubs/hash.h already contains some hacks for hash_map.  To
support unordered_map, all we'd have to do is add another hack there which
defines hash_map to be a subclass of unordered_map.  Subclassing effectively
functions as a template typedef here.
I would rather not replace the identifier "hash_map" with "unordered_map" in
the actual code until the Google style guide rules on the issue.  I suspect
that Google code will go on using hash_map with a similar hack because
updating our entire code base is just not worth the effort.

On Mon, Jul 13, 2009 at 5:13 PM, Monty Taylor <mord...@inaugust.com> wrote:

>
> vikram wrote:
> > I have found out that with new xlC versions like 8.X onwards hash_map
> > like functionality is supported but different name as unordered_map.
> > So it there any way you can to use this container without modifying
> > much of the code.  In the code hash_map is used in many places. So it
> > needs to be replaced with unordered_map with
> > xlC compiler on AIX.   Please provide some idea. I was trying to do
> > template typedef but seems like I can not have all typenames while
> > doing that.
>
> I was actually just working on making an update to the m4 to detect
> unordered_map in Drizzle. (We swiped the hash_map detection macro)
>
> unordered_map is the name it's apparently going to land in C++0x as, and
> is the name that it exists as in gcc 4.3 and 4.4. gcc still has hash_map
> as well, but it throws a deprecated warning.
>
> Might not be a terrible idea to go ahead and shift to unordered_map and
> then put in a mapping/typedef for hash_map if something doesn't have u_m?
>
> (Kenton - would you be interested in a patch doing that?)
>
> > On Jul 1, 12:00 pm, Kenton Varda <ken...@google.com> wrote:
> >> Well, it looks like all of these are stuck in the same place -- in the
> same
> >> call to hash_map::find().  This would seem to indicate that your STL
> >> implementation is broken.  It's also possible that the infinite loop is
> >> actually in protobuf code, and the only reason we see it always breaking
> in
> >> the same find() call is because that's the most expensive part of the
> loop.
> >>  You could test this by breaking under gdb again, and then repeatedly
> typing
> >> "finish" to make it run to completion of the current function call.  If
> it
> >> eventually gets back to protobuf code, then the problem is there,
> otherwise
> >> it's in the STL code.  (Actually, I should have told you to do this
> >> originally, rather than the "collect multiple stack traces" idea...)
> >>
> >> On Tue, Jun 30, 2009 at 7:36 PM, vikram <patilvik...@gmail.com> wrote:
> >>
> >>> Hey Kenton,
> >>>        This is compilation without STL implementation . I am assuming
> >>> that if hash_map does not exist , google protocol buffer emulates
> >>> hash_map.   I am pasting 3-4 instances of stack where protoc is in
> >>> infinite loop
> >>> #0  0xd1cfdc60 in
> >>>
> _Node::_Right__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__FPQ3_3std9_Tree_nodXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0
> >>> (_P=0xf04ca4e0) at /usr/vacpp/include/xtree:154
> >>> #1  0xd1d1bbdc in
> >>>
> _Lbound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, _...@0x2ff2222c) at /usr/vacpp/include/xtree.t:377
> >>> #2  0xd1d22878 in
> >>>
> lower_bound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, __classretu...@0x2ff21d70, _...@0x2ff2222c) at /usr/
> >>> vacpp/include/xtree:377
> >>> #3  0xd1d28f34 in
> >>>
> find__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, __classretu...@0x2ff21dd0, _...@0x2ff2222c) at /usr/
> >>> vacpp/include/xtree:365
> >>> #4  0xd1d2fd34 in
> >>>
> ParseType__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf25FieldDescriptorProto_TypePQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0x2ff22278,
> >>>    type=0x2ff21e24, type_name=0x2ff21e28) at google/protobuf/compiler/
> >>> parser.cc:1000
> >>> #5  0xd1d31438 in
> >>>
> ParseMessageField__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf20FieldDescriptorProtoPQ3_6google8protobuf16RepeatedPtrFieldXTQ3_6google8protobuf15DescriptorProto_
> >>> (
> >>>     this=0x2ff22278, field=0x2000f918, messages=0x2000f808) at google/
> >>> protobuf/compiler/parser.cc:443
> >>> #6  0xd1d30f50 in
> >>> google::protobuf::compiler::Parser::ParseMessageStatement
> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/
> >>> parser.cc:428
> >>> #7  0xd1d310c4 in
> >>> google::protobuf::compiler::Parser::ParseMessageBlock
> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/
> >>> parser.cc:402
> >>> #8  0xd1d30c80 in
> >>> google::protobuf::compiler::Parser::ParseMessageDefinition
> >>> (this=0x2ff22278, message=0x2000f7a8) at google/protobuf/compiler/
> >>> parser.cc:389
> >>> #9  0xd1d30e28 in
> >>> google::protobuf::compiler::Parser::ParseMessageStatement
> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/
> >>> parser.cc:417
> >>> #10 0xd1d310c4 in
> >>> google::protobuf::compiler::Parser::ParseMessageBlock
> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/
> >>> parser.cc:402
> >>> #11 0xd1d30c80 in
> >>> google::protobuf::compiler::Parser::ParseMessageDefinition
> >>> (this=0x2ff22278, message=0x2000f668) at google/protobuf/compiler/
> >>> parser.cc:389
> >>> #12 0xd1d3250c in
> >>> google::protobuf::compiler::Parser::ParseTopLevelStatement
> >>> (this=0x2ff22278, file=0x2ff22320) at google/protobuf/compiler/
> >>> parser.cc:362
> >>> #13 0xd1d32c80 in google::protobuf::compiler::Parser::Parse
> >>> (this=0x2ff22278, input=0x2ff22228, file=0x2ff22320) at google/
> >>> protobuf/compiler/parser.cc:321
> >>> #14 0xd1d4965c in
> >>>
> FindFileByName__Q4_6google8protobuf8compiler28SourceTreeDescriptorDatabaseFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc
> >>> (this=0x2ff22548, filena...@0x2000bce8,
> >>>    output=0x2ff22320) at google/protobuf/compiler/importer.cc:145
> >>> #15 0xd1b4a4f0 in
> >>>
> TryFindFileInFallbackDatabase__Q3_6google8protobuf14DescriptorPoolCFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0x2ff2256c, na...@0x2000bce8)
> >>>     at google/protobuf/descriptor.cc:1230
> >>> #16 0xd1b4a844 in
> >>>
> FindFileByName__Q3_6google8protobuf14DescriptorPoolCFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0x2ff2256c, na...@0x2000bce8)
> >>>     at google/protobuf/descriptor.cc:875
> >>> #17 0xd1d47ad4 in
> >>>
> Import__Q4_6google8protobuf8compiler8ImporterFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0x2ff22548, filena...@0x2000bce8)
> >>>     at google/protobuf/compiler/importer.cc:194
> >>> #18 0xd1757ea0 in
> >>> google::protobuf::compiler::CommandLineInterface::Run
> >>> (this=0x2ff22750, argc=3, argv=0x2ff228f0) at google/protobuf/compiler/
> >>> command_line_interface.cc:352
> >>> #19 0x10002894 in main (argc=3, argv=0x2ff228f0) at google/protobuf/
> >>> compiler/main.cc:59
> >>> #20 0x100001ec in __start ()
> >>> #0  0xd1afa384 in
> >>>
> __cl__Q3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__RCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, a...@0xc, b...@0x2ff2222c) at ./google/protobuf/stubs/
> >>> hash.h:178
> >>> #1  0xd1d1bbc8 in
> >>>
> _Lbound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, _...@0x2ff2222c) at /usr/vacpp/include/xtree.t:376
> >>> #2  0xd1d22878 in
> >>>
> lower_bound__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, __classretu...@0x2ff21d70, _...@0x2ff2222c) at /usr/
> >>> vacpp/include/xtree:377
> >>> #3  0xd1d28f34 in
> >>>
> find__Q2_3std5_TreeXTQ2_3std12_Tmap_traitsXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_TypeTQ3_6google8protobuf4hashXTQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc___TQ2_3std9allocatorXTQ2_3std4pairXTCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__TQ3_6google8protobuf25FieldDescriptorProto_Type__SP0__CFRCQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0xf04ca4e0, __classretu...@0x2ff21dd0, _...@0x2ff2222c) at /usr/
> >>> vacpp/include/xtree:365
> >>> #4  0xd1d2fd34 in
> >>>
> ParseType__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf25FieldDescriptorProto_TypePQ2_3std12basic_stringXTcTQ2_3std11char_traitsXTc_TQ2_3std9allocatorXTc__
> >>> (this=0x2ff22278,
> >>>    type=0x2ff21e24, type_name=0x2ff21e28) at google/protobuf/compiler/
> >>> parser.cc:1000
> >>> #5  0xd1d31438 in
> >>>
> ParseMessageField__Q4_6google8protobuf8compiler6ParserFPQ3_6google8protobuf20FieldDescriptorProtoPQ3_6google8protobuf16RepeatedPtrFieldXTQ3_6google8protobuf15DescriptorProto_
> >>> (
> >>>     this=0x2ff22278, field=0x2000f918, messages=0x2000f808) at
> >> ...
> >>
> >> read more ยป
> > >
> >
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to