I very strongly favor putting RelocInfo::None into the argument list.  It
should be clear
that a null pointer cannot be relocated, and it only makes things more
explicit.


On Fri, Jun 12, 2009 at 3:11 PM, Ben Leslie <[email protected]> wrote:

>
> On Fri, Jun 12, 2009 at 7:46 PM, Erik Corry<[email protected]> wrote:
> > 2009/6/12 Benno <[email protected]>:
> >>
> >> In follow up to my earlier post "Compile Errors" (sorry for such a
> >> crap subject), I have some others. Specifically there is a lot of code
> >> that calls the Operand method like so:
> >>
> >> Operand(0)
> >>
> >> Which produces the following:
> >>
> >> src/arm/codegen-arm.cc:4432: error: call of overloaded 'Operand(int)'
> >> is ambiguous
> >> src/arm/assembler-arm-inl.h:180: note: candidates are:
> >> v8::internal::Operand::Operand(v8::internal::Smi*)
> >> src/arm/assembler-arm.h:313: note:
> >> v8::internal::Operand::Operand
> >> (v8::internal::Handle<v8::internal::Object>)
> >> src/arm/assembler-arm-inl.h:173: note:
> >> v8::internal::Operand::Operand(v8::internal::Context**)
> >> src/arm/assembler-arm-inl.h:166: note:
> >> v8::internal::Operand::Operand(v8::internal::Object**)
> >> src/arm/assembler-arm-inl.h:152: note:
> >> v8::internal::Operand::Operand(const char*)
> >> src/arm/assembler-arm-inl.h:145: note:
> >> v8::internal::Operand::Operand(int32_t, v8::internal::RelocInfo::Mode)
> >>
> >> I'm guessing this is because '0' is special in C++ and can refer to a
> >> NULL pointer (I think, I'm not a C++ guru by any means!).
> >>
> >> I was able to fix this by explicitly casting:
> >>
> >> Operand((int32_t)0)
> >>
> >> Is there any problem with this? Should I create a patch for this
> >> change?
> >
> > Thanks for pointing out this problem.  The annoying thing is that the
> > same code is generated so it doesn't matter which one gets called.
>
> Got to love C++ ;)
>
> >We
> > don't use C-style casts in V8 so you would have to use one of the C++
> > casts.  It quickly gets ugly.  Are there a lot of call sites involved?
>
> Yeah, something around 20-35 or so.
>
> I guess another option would be providing a constant for Operand(0) --
> it is used quite often.
>
> Anyway, if someone lets me know the preferred approach I'm more than
> happy to put a patch together.
>
> Thanks,
>
> Benno
>
> >
>


-- 
William Hesse
Software Engineer
[email protected]

Google Denmark ApS
Frederiksborggade 20B, 1 sal
1360 København K
Denmark
CVR nr. 28 86 69 84

If you received this communication by mistake, please don't forward it to
anyone else (it may contain confidential or privileged information), please
erase all copies of it, including all attachments, and please let the sender
know it went to the wrong person. Thanks.

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to