Bug 29354 - RVCT compile error in LiteralParser.cpp
Summary: RVCT compile error in LiteralParser.cpp
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Other
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-17 17:29 PDT by Kwang Yul Seo
Modified: 2010-02-03 09:04 PST (History)
2 users (show)

See Also:


Attachments
RVCT patch (2.14 KB, patch)
2009-09-17 17:42 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
RVCT patch with comments (2.28 KB, patch)
2009-09-17 17:54 PDT, Kwang Yul Seo
oliver: review-
Details | Formatted Diff | Diff
RVCT patch (2.07 KB, patch)
2009-09-17 18:17 PDT, Kwang Yul Seo
eric: review-
Details | Formatted Diff | Diff
SunSpider results (3.45 KB, text/plain)
2009-09-17 22:04 PDT, Kwang Yul Seo
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kwang Yul Seo 2009-09-17 17:29:46 PDT
RVCT emits erros in compiling LiteralParser.cpp: 

"..\JavaScriptCore\runtime\LiteralParser.cpp", line 140: Error:  #304: no instance of function template "JSC::isSafeStringCharacter" matches the argument list
            argument types are: (const UChar)
          while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
                                  ^
          detected during instantiation of "JSC::LiteralParser::TokenType JSC::LiteralParser::Lexer::lexString<parserMode>(JSC::LiteralParser::Lexer::LiteralParserToken &) [with parserMode=JSC::LiteralParser::StrictJSON]" at line 85
"..\JavaScriptCore\runtime\LiteralParser.cpp", line 140: Error:  #304: no instance of function template "JSC::isSafeStringCharacter" matches the argument list
            argument types are: (const UChar)
          while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
                                  ^
          detected during instantiation of "JSC::LiteralParser::TokenType JSC::LiteralParser::Lexer::lexString<parserMode>(JSC::LiteralParser::Lexer::LiteralParserToken &) [with parserMode=JSC::LiteralParser::NonStrictJSON]" at line 86


I am not sure what happens here. RVCT just can't find the instance of isSafeStringCharacter with the argumenmt type const UCHAR.

After I change isSafeStringCharacter to a macro, the problem is fixed.

#if COMPILER(RVCT)
#define isSafeStringCharacter(mode, c) \
    (((c) >= ' ' && (mode == LiteralParser::StrictJSON || (c) <= 0xff) && (c) != '\\' && (c) != '"') || (c) == '\t')
#else

...

#if COMPILER(RVCT)
        while (m_ptr < m_end && isSafeStringCharacter(mode, *m_ptr))
#else
Comment 1 Kwang Yul Seo 2009-09-17 17:42:03 PDT
Created attachment 39738 [details]
RVCT patch

Change isSafeStringCharacter to a macro.
Comment 2 Kwang Yul Seo 2009-09-17 17:54:25 PDT
Created attachment 39739 [details]
RVCT patch with comments

Add comments to code.
Comment 3 Oliver Hunt 2009-09-17 18:00:59 PDT
Comment on attachment 39739 [details]
RVCT patch with comments

A significant part of me wants to just reject this patch on the grounds that you really need to update your compiler -- for instance we basically don't accept patches to support gcc3 for instance.

That said, in its current form there's no question of accepting this patch as it basically results in two copies of the same code, and adds a platform ifdef to code that has no reason to have any ifdefs.  If we must use a macro then we should just replace the function with a macro, not maintain both a macro and function.
Comment 4 Kwang Yul Seo 2009-09-17 18:17:38 PDT
Created attachment 39742 [details]
RVCT patch

I see there is COMPILER(RVCT) in Platform.h, so I assumed that RVCT is suppoprted. What's the official position on this?

I removed the platform ifdefs and replaced the static inline function with macro.
Comment 5 Kwang Yul Seo 2009-09-17 18:19:51 PDT
I forgot to mention the version of RVCT. I use RVCT 4.0.
Comment 6 Oliver Hunt 2009-09-17 18:25:00 PDT
Comment on attachment 39742 [details]
RVCT patch

This looks okay, but i'd like performance tests to confirm that there isn't a regression.  Can you test with run-sunspider on a mac running leopard or snow leopard?
Comment 7 Kwang Yul Seo 2009-09-17 18:39:24 PDT
Yes, sure. I will run the sun-spider test and upload the result here. It will take a few hours because I need to setup the WebKit development environment for my MacBook.
Comment 8 Oliver Hunt 2009-09-17 19:41:13 PDT
(In reply to comment #5)
> I forgot to mention the version of RVCT. I use RVCT 4.0.

I am told that gcc for ARM is actually a good compiler, it would be simpler in the long term to just use that -- by and large GCC is a vastly more complete and correct compiler, and obviously webkit always builds with it.
Comment 9 Kwang Yul Seo 2009-09-17 22:04:41 PDT
Created attachment 39748 [details]
SunSpider results

I found no observable difference after applying the patch.
Comment 10 Kwang Yul Seo 2009-09-17 23:53:13 PDT
I found that the problem is resolved with RVCT option "--gnu --no_parse_templates".

QT port with RVCT exactly does this:

https://bugs.webkit.org/show_bug.cgi?id=27348


Without "--no_parse_templates" option, there are many compile errors because of the RVCT template instatiation issue discussed in:

http://lists.macosforge.org/pipermail/webkit-dev/2008-September/004799.html

I think this patch is not required anymore.
Comment 11 Eric Seidel (no email) 2009-09-23 17:19:40 PDT
Comment on attachment 39742 [details]
RVCT patch

Assuming I'm reading the last comment from Kwang correctly, this patch is no longer needed, and this bug can be closed as WONTFIX.  Is that correct?  Marking r- under that assumption.
Comment 12 Kwang Yul Seo 2009-09-23 17:40:16 PDT
Yes, this patch is not needed anymore.