Bug 216685 - Move some LLInt globals into JSC::Config.
Summary: Move some LLInt globals into JSC::Config.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords: InRadar
Depends on:
Blocks: 216772
  Show dependency treegraph
 
Reported: 2020-09-17 20:58 PDT by Mark Lam
Modified: 2020-09-21 15:02 PDT (History)
12 users (show)

See Also:


Attachments
proposed patch. (16.50 KB, patch)
2020-09-17 22:01 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
proposed patch. (18.21 KB, patch)
2020-09-17 22:32 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
proposed patch. (21.46 KB, patch)
2020-09-18 00:32 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
proposed patch. (21.48 KB, patch)
2020-09-18 00:40 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
proposed patch. (21.49 KB, patch)
2020-09-18 00:55 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
patch for EWS testing. (24.89 KB, patch)
2020-09-18 01:38 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test (24.90 KB, patch)
2020-09-18 01:50 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test. (24.91 KB, patch)
2020-09-18 01:54 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test. (26.19 KB, patch)
2020-09-18 02:50 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test. (26.35 KB, patch)
2020-09-18 11:33 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test. (26.28 KB, patch)
2020-09-18 11:41 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test (26.40 KB, patch)
2020-09-18 12:35 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
EWS test. (26.37 KB, patch)
2020-09-18 13:08 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
LowLevelInterpreterWin.asm without patch (5.11 MB, text/plain)
2020-09-18 21:56 PDT, Myles C. Maxfield
no flags Details
LowLevelInterpreterWin.asm with patch (5.13 MB, text/plain)
2020-09-18 21:57 PDT, Myles C. Maxfield
no flags Details
proposed patch. (32.83 KB, patch)
2020-09-19 16:04 PDT, Mark Lam
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
proposed patch. (32.84 KB, patch)
2020-09-19 16:20 PDT, Mark Lam
keith_miller: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2020-09-17 20:58:15 PDT
rdar://68964544
Comment 1 Mark Lam 2020-09-17 22:01:36 PDT
Created attachment 409103 [details]
proposed patch.
Comment 2 Mark Lam 2020-09-17 22:32:13 PDT
Created attachment 409105 [details]
proposed patch.
Comment 3 Mark Lam 2020-09-18 00:32:40 PDT
Created attachment 409108 [details]
proposed patch.
Comment 4 Mark Lam 2020-09-18 00:40:45 PDT
Created attachment 409109 [details]
proposed patch.
Comment 5 Mark Lam 2020-09-18 00:55:03 PDT
Created attachment 409112 [details]
proposed patch.
Comment 6 Mark Lam 2020-09-18 01:38:33 PDT
Created attachment 409113 [details]
patch for EWS testing.
Comment 7 Mark Lam 2020-09-18 01:50:50 PDT
Created attachment 409114 [details]
EWS test
Comment 8 Mark Lam 2020-09-18 01:54:26 PDT
Created attachment 409115 [details]
EWS test.
Comment 9 Mark Lam 2020-09-18 02:50:01 PDT
Created attachment 409121 [details]
EWS test.
Comment 10 Mark Lam 2020-09-18 11:33:27 PDT
Created attachment 409152 [details]
EWS test.
Comment 11 Mark Lam 2020-09-18 11:41:30 PDT
Created attachment 409155 [details]
EWS test.
Comment 12 Mark Lam 2020-09-18 12:35:43 PDT
Created attachment 409163 [details]
EWS test
Comment 13 Mark Lam 2020-09-18 13:08:00 PDT
Created attachment 409167 [details]
EWS test.
Comment 14 Myles C. Maxfield 2020-09-18 21:56:27 PDT
Created attachment 409194 [details]
LowLevelInterpreterWin.asm without patch
Comment 15 Myles C. Maxfield 2020-09-18 21:57:45 PDT
Created attachment 409195 [details]
LowLevelInterpreterWin.asm with patch
Comment 16 Mark Lam 2020-09-19 16:04:16 PDT
Created attachment 409212 [details]
proposed patch.
Comment 17 Mark Lam 2020-09-19 16:20:33 PDT
Created attachment 409213 [details]
proposed patch.
Comment 18 Mark Lam 2020-09-19 17:36:20 PDT
Comment on attachment 409213 [details]
proposed patch.

Ready for a review now.
Comment 19 Sam Weinig 2020-09-19 17:41:03 PDT
Comment on attachment 409213 [details]
proposed patch.

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

> Source/JavaScriptCore/ChangeLog:3
> +        Move some LLInt globals into JSC::Config.

What is the goal of doing this?
Comment 20 Mark Lam 2020-09-19 20:40:50 PDT
(In reply to Sam Weinig from comment #19)
> Comment on attachment 409213 [details]
> proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409213&action=review
> 
> > Source/JavaScriptCore/ChangeLog:3
> > +        Move some LLInt globals into JSC::Config.
> 
> What is the goal of doing this?

The opcodeMaps are supposed to be functionally constant.  They are meant to be initialized once and never changed thereafter.  This change enforces that invariant.
Comment 21 Sam Weinig 2020-09-20 07:37:34 PDT
Comment on attachment 409213 [details]
proposed patch.

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

>>> Source/JavaScriptCore/ChangeLog:3
>>> +        Move some LLInt globals into JSC::Config.
>> 
>> What is the goal of doing this?
> 
> The opcodeMaps are supposed to be functionally constant.  They are meant to be initialized once and never changed thereafter.  This change enforces that invariant.

It feels like an oddly named place, "Config", for an opcode map. Perhaps either JSC::Config needs a new name, or these should go somewhere else that can enforce that invariant?
Comment 22 Mark Lam 2020-09-20 12:25:44 PDT
(In reply to Sam Weinig from comment #21)
> Comment on attachment 409213 [details]
> proposed patch.
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409213&action=review
> 
> >>> Source/JavaScriptCore/ChangeLog:3
> >>> +        Move some LLInt globals into JSC::Config.
> >> 
> >> What is the goal of doing this?
> > 
> > The opcodeMaps are supposed to be functionally constant.  They are meant to be initialized once and never changed thereafter.  This change enforces that invariant.
> 
> It feels like an oddly named place, "Config", for an opcode map. Perhaps
> either JSC::Config needs a new name, or these should go somewhere else that
> can enforce that invariant?

It's not that odd.  In a sense, the opcode maps "configures" how the LLInt will behave (though this is a bit of a stretch).  But yeah, if we can come up with a better name for the Config, I would gladly adopt it.  No one has a better proposal yet.  When I first introduced it, I considered ConstData / ROData (for ReadOnlyData) but those are not accurate either (the data is only const/read-only after freezing, and not before).
Comment 23 Sam Weinig 2020-09-20 14:10:25 PDT
(In reply to Mark Lam from comment #22)
> (In reply to Sam Weinig from comment #21)
> > Comment on attachment 409213 [details]
> > proposed patch.
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=409213&action=review
> > 
> > >>> Source/JavaScriptCore/ChangeLog:3
> > >>> +        Move some LLInt globals into JSC::Config.
> > >> 
> > >> What is the goal of doing this?
> > > 
> > > The opcodeMaps are supposed to be functionally constant.  They are meant to be initialized once and never changed thereafter.  This change enforces that invariant.
> > 
> > It feels like an oddly named place, "Config", for an opcode map. Perhaps
> > either JSC::Config needs a new name, or these should go somewhere else that
> > can enforce that invariant?
> 
> It's not that odd.  In a sense, the opcode maps "configures" how the LLInt
> will behave (though this is a bit of a stretch).  But yeah, if we can come
> up with a better name for the Config, I would gladly adopt it.  No one has a
> better proposal yet.  When I first introduced it, I considered ConstData /
> ROData (for ReadOnlyData) but those are not accurate either (the data is
> only const/read-only after freezing, and not before).

I see, makes sense. We should definitely rename JSC::Config (or make it a member of a new thing) at some point. Not needed for this change.
Comment 24 Keith Miller 2020-09-21 13:03:53 PDT
Comment on attachment 409213 [details]
proposed patch.

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

r=me with nits

> Source/JavaScriptCore/ChangeLog:18
> +        2. Add a LLIntInitializeAssertScope to be used in LLInt::initialize() to ensure
> +           that it is only called during primodial initialization time.

It seems like this is unnecessary, since we will crash once the data has been made read only anyway, right?

> Source/JavaScriptCore/llint/LLIntData.cpp:65
> +    LLIntInitializeAssertScope assertScope;

Nit: if you want to keep this assert, make it a ScopeExit, you're only using it once anyway.

> Source/JavaScriptCore/offlineasm/arm.rb:269
> +                        newList << Instruction.new(codeOrigin, "move", [Immediate.new(node.codeOrigin, labelRef.offset), tmp])
> +                        newList << Instruction.new(codeOrigin, "addp", [tmp, node.operands[1]])

Can you put a FIXME to implement the logic to figure out which immediates are encodable inline here?
Comment 25 Mark Lam 2020-09-21 14:25:41 PDT
Comment on attachment 409213 [details]
proposed patch.

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

>> Source/JavaScriptCore/ChangeLog:18
>> +           that it is only called during primodial initialization time.
> 
> It seems like this is unnecessary, since we will crash once the data has been made read only anyway, right?

After thinking about this some more, I agree that this is redundant.  I'll remove it.

>> Source/JavaScriptCore/llint/LLIntData.cpp:65
>> +    LLIntInitializeAssertScope assertScope;
> 
> Nit: if you want to keep this assert, make it a ScopeExit, you're only using it once anyway.

The scope asserts on function entry (via the constructor) and on exit (via the destructor).  The exit scope solution is not the same.  But anyway, this is moot since I'll remove this.

>> Source/JavaScriptCore/offlineasm/arm.rb:269
>> +                        newList << Instruction.new(codeOrigin, "addp", [tmp, node.operands[1]])
> 
> Can you put a FIXME to implement the logic to figure out which immediates are encodable inline here?

255 is the basic (covered here already), but traditional 32-bit ARM instruction set does allow for encoding of some larger immediate via rotation tricks.  Not too sure about Thumb2 though.  I'll have the a FIXME just say that we can explore other encodings of immediate that fit in the add instruction.
Comment 26 Mark Lam 2020-09-21 15:02:30 PDT
Thanks for the review.  Landed in r267371: <http://trac.webkit.org/r267371>.