Bug 120033

Summary: Incorrect behavior on emscripten-compiled cube2hash
Product: WebKit Reporter: Alon Zakai <alonzakai>
Component: JavaScriptCoreAssignee: Filip Pizlo <fpizlo>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, buildbot, fpizlo, ggaren, mhahnenberg, msaboff, oliver, rniwa, sam, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
cube2hash
none
the patch
mhahnenberg: review+, buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 none

Description Alon Zakai 2013-08-19 16:10:30 PDT
Created attachment 209135 [details]
cube2hash

Attached is the cube2 hash function compiled from C using emscripten. In jsc it gives incorrect results, for example

$ jsc src.cpp.o.js  -- fleefl
hash value: 2912ECE742D4821CD4B778CEBEACD081E97D3F4CBEACD081
$ d8 src.cpp.o.js -- fleefl
hash value: 892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9
$ mozjs src.cpp.o.js fleefl
hash value: 892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9

(i.e. jsc differs from v8 and sm)

Sorry for the non-trivial size, almost all the emscripten test suite passes but for a few larger tests I am afraid, all the smaller ones do not fail.
Comment 1 Oliver Hunt 2013-08-19 16:29:18 PDT
32bit error
Comment 2 Oliver Hunt 2013-08-19 16:40:13 PDT
Repros in 32-bit only:

JSC_maximumFunctionForCallInlineCandidateInstructionCount=88  JSC_maximumFunctionForClosureCallInlineCandidateInstructionCount=0 JSC_maximumFunctionForConstructInlineCandidateInstructionCount=0 JSC_maximumInliningDepth=2 JSC_bytecodeRangeToDFGCompile=9128:9128  DYLD_FRAMEWORK_PATH=WebKitBuild/Debug WebKitBuild//Debug/jsc src.cpp.o.js   -- fleefl
Comment 3 Oliver Hunt 2013-08-19 16:45:40 PDT
Ooh, and 64-bit if you disable the concurrent jit
Comment 4 Radar WebKit Bug Importer 2013-08-19 16:47:06 PDT
<rdar://problem/14779298>
Comment 5 Filip Pizlo 2013-08-19 21:30:02 PDT
(In reply to comment #0)
> Created an attachment (id=209135) [details]
> cube2hash
> 
> Attached is the cube2 hash function compiled from C using emscripten. In jsc it gives incorrect results, for example
> 
> $ jsc src.cpp.o.js  -- fleefl
> hash value: 2912ECE742D4821CD4B778CEBEACD081E97D3F4CBEACD081
> $ d8 src.cpp.o.js -- fleefl
> hash value: 892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9
> $ mozjs src.cpp.o.js fleefl
> hash value: 892BDB6FD3F62E863D63DA55851700FDE3ACF30204798CE9
> 
> (i.e. jsc differs from v8 and sm)
> 
> Sorry for the non-trivial size, almost all the emscripten test suite passes but for a few larger tests I am afraid, all the smaller ones do not fail.

Fascinating.  Thanks for the bug report, I'll look.
Comment 6 Filip Pizlo 2013-08-19 21:55:08 PDT
This is an easy bug.  CSE for GetClosureVar is borked.
Comment 7 Filip Pizlo 2013-08-19 22:20:36 PDT
Created attachment 209157 [details]
the patch
Comment 8 Build Bot 2013-08-20 02:36:45 PDT
Comment on attachment 209157 [details]
the patch

Attachment 209157 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1510809

New failing tests:
fast/js/dfg-get-closure-var-put-closure-var-interference.html
fast/js/regress/emscripten-cube2hash.html
Comment 9 Build Bot 2013-08-20 02:36:47 PDT
Created attachment 209173 [details]
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-07  Port: mac-mountainlion  Platform: Mac OS X 10.8.4
Comment 10 Build Bot 2013-08-20 06:08:00 PDT
Comment on attachment 209157 [details]
the patch

Attachment 209157 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1518468

New failing tests:
fast/js/dfg-get-closure-var-put-closure-var-interference.html
fast/js/regress/emscripten-cube2hash.html
Comment 11 Build Bot 2013-08-20 06:08:03 PDT
Created attachment 209189 [details]
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-16  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.4
Comment 12 Mark Hahnenberg 2013-08-20 08:30:10 PDT
Comment on attachment 209157 [details]
the patch

r=me
Comment 13 Filip Pizlo 2013-08-20 11:21:18 PDT
Landed in http://trac.webkit.org/changeset/154344
Comment 15 Tim Horton 2013-08-20 13:44:23 PDT
(In reply to comment #14)
> The test (fast/js/regress/emscripten-cube2hash) added by this seems to be failing on the ML testers, with console.logs and exceptions and stuff:

I filed https://bugs.webkit.org/show_bug.cgi?id=120083