Bug 154749 - Remove the on demand executable allocator
Summary: Remove the on demand executable allocator
Status: RESOLVED DUPLICATE of bug 168754
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Oliver Hunt
URL:
Keywords:
Depends on: 154822 154910
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-26 13:55 PST by Oliver Hunt
Modified: 2017-02-23 08:59 PST (History)
6 users (show)

See Also:


Attachments
Patch (31.19 KB, patch)
2016-02-26 13:58 PST, Oliver Hunt
no flags Details | Formatted Diff | Diff
Patch (21.45 KB, patch)
2016-02-26 16:20 PST, Oliver Hunt
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Hunt 2016-02-26 13:55:42 PST
Remove the on demand executable allocator
Comment 1 Oliver Hunt 2016-02-26 13:58:00 PST
Created attachment 272366 [details]
Patch
Comment 2 Geoffrey Garen 2016-02-26 14:04:26 PST
Comment on attachment 272366 [details]
Patch

This patch (and its history) will be easier to read if you first make the changes necessary to remove the demand allocator, check that in, and then do any moves you want to do.
Comment 3 Saam Barati 2016-02-26 14:04:44 PST
Comment on attachment 272366 [details]
Patch

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

> Source/JavaScriptCore/jit/ExecutableAllocator.cpp:105
> +                RELEASE_ASSERT_NOT_REACHED(); // In debug mode, this should be a hard failure.

This comment isn't true.
Maybe it should just be ASSERT_NOT_REACHED?
Or we could remove the break on the next line.
Comment 4 Oliver Hunt 2016-02-26 16:20:16 PST
Created attachment 272380 [details]
Patch
Comment 5 Geoffrey Garen 2016-02-26 16:40:48 PST
Comment on attachment 272380 [details]
Patch

r=me
Comment 6 WebKit Commit Bot 2016-02-26 18:10:24 PST
Comment on attachment 272380 [details]
Patch

Clearing flags on attachment: 272380

Committed r197226: <http://trac.webkit.org/changeset/197226>
Comment 7 WebKit Commit Bot 2016-02-26 18:10:27 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Oliver Hunt 2016-02-27 10:14:46 PST
(In reply to comment #8)
> Looks like this broke LLINT Cloop build:
> https://build.webkit.org/builders/
> Apple%20El%20Capitan%20LLINT%20CLoop%20%28BuildAndTest%29/builds/3832/steps/
> compile-webkit/logs/stdio

Ugh I'm a muppet - will fix in a few minutes
Comment 10 Oliver Hunt 2016-02-27 11:28:40 PST
Uuid fux
Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	Source/JavaScriptCore/ChangeLog
	M	Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
Committed r197256
Comment 12 Carlos Alberto Lopez Perez 2016-02-29 10:49:24 PST
Why was this removed? It caused OOM crashes: see bug 154822
Comment 13 Csaba Osztrogonác 2016-03-01 21:35:03 PST
(In reply to comment #12)
> Why was this removed? It caused OOM crashes: see bug 154822

Ping
Comment 14 WebKit Commit Bot 2016-03-01 22:52:49 PST
Re-opened since this is blocked by bug 154910
Comment 15 Alexey Proskuryakov 2016-03-01 22:58:04 PST
Rolled out in <http://trac.webkit.org/changeset/197441>.
Comment 16 Csaba Osztrogonác 2016-03-08 01:20:31 PST
(In reply to comment #12)
> Why was this removed?

Do you still plan to remove on demand executable allocator?
If yes, could you explain what is the reason? If no, let's close this bug.
Comment 17 Oliver Hunt 2016-03-08 10:36:56 PST
(In reply to comment #16)
> (In reply to comment #12)
> > Why was this removed?
> 
> Do you still plan to remove on demand executable allocator?
> If yes, could you explain what is the reason? If no, let's close this bug.

Because multiple allocators with variable behaviour are bad? Because it makes a number of other features impossible?

You never answered my question in the other bug: does your ARM port support going back and forth between the LLINT and the JIT?
Comment 18 Csaba Osztrogonác 2016-03-08 10:51:43 PST
(In reply to comment #17)
> (In reply to comment #16)
> > (In reply to comment #12)
> > > Why was this removed?
> > 
> > Do you still plan to remove on demand executable allocator?
> > If yes, could you explain what is the reason? If no, let's close this bug.
> 
> Because multiple allocators with variable behaviour are bad? Because it
> makes a number of other features impossible?
> 
> You never answered my question in the other bug: does your ARM port support
> going back and forth between the LLINT and the JIT?

If you point me how to d(In reply to comment #17)
> (In reply to comment #16)
> > (In reply to comment #12)
> > > Why was this removed?
> > 
> > Do you still plan to remove on demand executable allocator?
> > If yes, could you explain what is the reason? If no, let's close this bug.
> 
> Because multiple allocators with variable behaviour are bad? Because it
> makes a number of other features impossible?

In this case it would have been better to ask before removing.
 
> You never answered my question in the other bug: does your ARM port support
> going back and forth between the LLINT and the JIT?

https://bugs.webkit.org/show_bug.cgi?id=154822#c7

I haven't found any option to enable fallback on OOM. 
Could you point me where can we switch this on? 

Is it possible to enable this fallback if LLINT is disabled during 
stress test running? (Tests failed only in JSC_useLLINT=false case.)
Comment 19 Oliver Hunt 2016-03-08 12:13:42 PST
> > You never answered my question in the other bug: does your ARM port support
> > going back and forth between the LLINT and the JIT?
> 
> If you point me how to d(In reply to comment #17)

Do you have the actual llint enabled? Because that should just happen automatically if it can't allocate executable memory.

> > (In reply to comment #16)
> > > (In reply to comment #12)
> > > > Why was this removed?
> > > 
> > > Do you still plan to remove on demand executable allocator?
> > > If yes, could you explain what is the reason? If no, let's close this bug.
> > 
> > Because multiple allocators with variable behaviour are bad? Because it
> > makes a number of other features impossible?
> 
> In this case it would have been better to ask before removing.

Yeah, i talked about it internally but didn't comment in the bug as I assumed it was an obviously worth while change.

>  
> > You never answered my question in the other bug: does your ARM port support
> > going back and forth between the LLINT and the JIT?
> 
> https://bugs.webkit.org/show_bug.cgi?id=154822#c7
> 
> I haven't found any option to enable fallback on OOM. 
> Could you point me where can we switch this on? 
> 
> Is it possible to enable this fallback if LLINT is disabled during 
> stress test running? (Tests failed only in JSC_useLLINT=false case.)

Wait, are you deliberately disabling the llint during stress testing? If you are then your stress test is _correct_ to crash. The LLINT design is deliberately intended to allow for running out of executable memory. That part of the value it provides.
Comment 20 Csaba Osztrogonác 2016-03-09 00:02:48 PST
(In reply to comment #19)
> Wait, are you deliberately disabling the llint during stress testing? If you
> are then your stress test is _correct_ to crash. The LLINT design is
> deliberately intended to allow for running out of executable memory. That
> part of the value it provides.

To make it clear, I'm not the one - the bad guy - who deliberately disables
LLINT during testing, but jsc-stress-tests script - wrote by Filip Pizlo - 
which runs all tests in different configurations. It's same on all platforms.

As you can see in the description of the other bug, tests fail only in no-llint
configuration: https://bugs.webkit.org/show_bug.cgi?id=154822#c0 .
Not only on Linux, but your own Apple's ARM platform too. But you guys simply
skipped these tests previously. Just read this comment again if you haven't 
do it: https://bugs.webkit.org/show_bug.cgi?id=154822#c1

Back to the different allocators, we should make it clear, it wasn't my
decision which one we use. You at Apple implemented both of them, enabled 
the fixed allocator only on X86_64, IOS and ARM64, other platforms uses
the on demand allocator.

Platform.h
-----------
#if CPU(X86_64) || PLATFORM(IOS) || CPU(ARM64)
#define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1
#else
#define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1
#endif

It means that the fixed allocator wasn't tested ever on other platforms.
In this case it isn't fair to switch to untested code path and remove
the current codepath without asking.

Now we know that the fixed allocator has at least three problems:
- The fixed sized 16Mb isn't enough to run all JSC stress tests.
  https://bugs.webkit.org/show_bug.cgi?id=154822
- Increasing the fixed size over 16Mb causes many crashes on the
  Apple owned Thumb2 ARMv7Assembler .
  https://bugs.webkit.org/show_bug.cgi?id=154822#c3
- There are crashed on Apple Mac x86 platforms too
  https://bugs.webkit.org/show_bug.cgi?id=154910
  https://build.webkit.org/builders/Apple%20El%20Capitan%2032-bit%20JSC%20%28BuildAndTest%29/builds/1607

I think it would be fair to fix the ARMv7Assembler issue and increase
the fixed size to 32 MB to make all stress tests pass _ before _ removing
the on demand allocator. But of course, it is just a suggestion. You can
do here whatever you want, because you are stronger.
Comment 21 Csaba Osztrogonác 2017-02-23 08:59:45 PST

*** This bug has been marked as a duplicate of bug 168754 ***