Bug 170135 - WebAssembly: JSWebAssemblyCallee should not be a JSCell
Summary: WebAssembly: JSWebAssemblyCallee should not be a JSCell
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on: 169773 170185
Blocks: 170136
  Show dependency treegraph
 
Reported: 2017-03-27 13:31 PDT by Saam Barati
Modified: 2017-04-04 15:24 PDT (History)
11 users (show)

See Also:


Attachments
WIP (144.26 KB, patch)
2017-03-27 19:22 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (169.58 KB, patch)
2017-03-27 20:13 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (182.54 KB, patch)
2017-03-27 20:31 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (61.44 KB, patch)
2017-04-03 15:27 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (77.31 KB, patch)
2017-04-03 17:11 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (79.27 KB, patch)
2017-04-03 18:38 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
WIP (82.84 KB, patch)
2017-04-03 19:26 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch (118.02 KB, patch)
2017-04-03 22:07 PDT, Saam Barati
no flags Details | Formatted Diff | Diff
patch (117.63 KB, patch)
2017-04-04 12:08 PDT, Saam Barati
msaboff: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-03-27 13:31:06 PDT
This will make PIC easier.
However, in the future, when we move to a baseline compilation, we need to find a way to throw away baseline code while it's executing in parallel in multiple workers.
Comment 1 JF Bastien 2017-03-27 13:35:01 PDT
I think this is done in bug #169773?
Comment 2 Saam Barati 2017-03-27 13:39:15 PDT
(In reply to JF Bastien from comment #1)
> I think this is done in bug #169773?

That patch does not make callee not a JSCell.
Comment 3 Saam Barati 2017-03-27 19:22:17 PDT
Created attachment 305542 [details]
WIP

Doesn't compile yet
Comment 4 Saam Barati 2017-03-27 19:29:11 PDT
I'm also decoupling CCallHelpers/AssemblyHelpers from a VM in this patch. Any function that does VM-y things, will take a VM& as a parameter.
Comment 5 Saam Barati 2017-03-27 20:13:11 PDT
Created attachment 305549 [details]
WIP

Still doesn't compile
Comment 6 Saam Barati 2017-03-27 20:31:44 PDT
Created attachment 305555 [details]
WIP
Comment 7 Saam Barati 2017-04-03 11:19:11 PDT
I think everything else is in place for this to happen.
Comment 8 Saam Barati 2017-04-03 15:27:55 PDT
Created attachment 306124 [details]
WIP

It's still crashing on some wasm tests.
I'm re-writing the various runtime bits that wasm uses to make sure they don't use exec->vm() because that assumes we have a JSCell Callee
Comment 9 Saam Barati 2017-04-03 17:11:20 PDT
Created attachment 306143 [details]
WIP

passes wasm tests.
Comment 10 Saam Barati 2017-04-03 18:38:46 PDT
Created attachment 306152 [details]
WIP

Catching an exception w/ web inspector open no longer crashes. But it still doesn't show any wasm frames. We should fix that soon.
Comment 11 Saam Barati 2017-04-03 19:26:42 PDT
Created attachment 306157 [details]
WIP

Almost done, just need to rename some files.
Comment 12 Saam Barati 2017-04-03 22:07:23 PDT
Created attachment 306164 [details]
patch
Comment 13 Build Bot 2017-04-03 22:09:29 PDT
Attachment 306164 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/jsc.cpp:59:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp:36:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:190:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/interpreter/CalleeBits.h:41:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
ERROR: Source/JavaScriptCore/wasm/WasmPlan.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
ERROR: Source/JavaScriptCore/wasm/WasmContext.h:31:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 7 in 47 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 14 JF Bastien 2017-04-03 23:18:01 PDT
Comment on attachment 306164 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=306164&action=review

Some tests are sad. Looks good overall, thought I'm not familiar with some of the code so it would be good to have another set of eyes looking.

> Source/JavaScriptCore/jsc.cpp:3206
> +    Vector<Ref<Wasm::Callee>> keepAlive;

It's not obvious what the difference is between these two from just their name. I know it's pre-existing, but still confusing IMO.

> Source/JavaScriptCore/wasm/WasmCallee.cpp:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

2017

> Source/JavaScriptCore/wasm/WasmCallee.h:2
> + * Copyright (C) 2016 Apple Inc. All rights reserved.

2017

> Source/JavaScriptCore/wasm/WasmPlanInlines.h:43
> +            return bitwise_cast<void*>(bitwise_cast<uintptr_t>(callee) | 1);

Could you keep the | 1 with the same code that does & ~1 ? That would prevent it from ever diverging, or being missed in a copy-paste tragedy.

> Source/JavaScriptCore/wasm/WasmThunks.cpp:76
> +        // this since it is compiled with a constant VM pointer.) We could make the calling convetion

Typo "convention"

> Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.h:79
> +    // These two callee getters are only valid once the fields have been polulated.

Typo "populated"

> Source/JavaScriptCore/wasm/js/JSWebAssemblyRuntimeError.cpp:35
> +const ClassInfo JSWebAssemblyRuntimeError::s_info = { "WebAssembly.RuntimeError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWebAssemblyRuntimeError) };

The other two wasm error types were auto-generated together and should have the same position as here. I'd rather update all or none.
Comment 15 Michael Saboff 2017-04-04 09:59:33 PDT
Looks like there are some 32 bit build errors.
Comment 16 Saam Barati 2017-04-04 11:08:23 PDT
Comment on attachment 306164 [details]
patch

Will work on 32-bit
Comment 17 Saam Barati 2017-04-04 11:47:45 PDT
Comment on attachment 306164 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=306164&action=review

>> Source/JavaScriptCore/jsc.cpp:3206
>> +    Vector<Ref<Wasm::Callee>> keepAlive;
> 
> It's not obvious what the difference is between these two from just their name. I know it's pre-existing, but still confusing IMO.

Ok. I'll name them better.

>> Source/JavaScriptCore/wasm/WasmCallee.h:2
>> + * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
> 
> 2017

Why? This file was "svn mv"ed.

>> Source/JavaScriptCore/wasm/WasmPlanInlines.h:43
>> +            return bitwise_cast<void*>(bitwise_cast<uintptr_t>(callee) | 1);
> 
> Could you keep the | 1 with the same code that does & ~1 ? That would prevent it from ever diverging, or being missed in a copy-paste tragedy.

Yeah definitely. Will fix this.
Comment 18 Saam Barati 2017-04-04 12:08:54 PDT
Created attachment 306184 [details]
patch
Comment 19 Build Bot 2017-04-04 12:10:37 PDT
Attachment 306184 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/interpreter/CallFrame.cpp:190:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/interpreter/CalleeBits.h:42:  Should be indented on a separate line, with the colon or comma first on that line.  [whitespace/indent] [4]
Total errors found: 2 in 46 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 20 Michael Saboff 2017-04-04 14:30:27 PDT
Comment on attachment 306184 [details]
patch

r=me
Comment 21 Saam Barati 2017-04-04 15:24:23 PDT
landed in:
https://trac.webkit.org/changeset/214905/webkit