Closed
Bug 479888
Opened 15 years ago
Closed 15 years ago
TM: kill builtins.tbl
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: n.nethercote, Unassigned)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 2 obsolete files)
29.21 KB,
patch
|
Details | Diff | Splinter Review |
The declaration of built-in functions and their corresponding CallInfo struct is something of a mess. The builtins.tbl file has macros defining about half of them (those defined in jsbuiltins.cpp), but the ones in jsarray.cpp, jsstr.cpp, etc, aren't defined in builtins.tbl. Here's how the current macros work, for js_EqualStrings (one that is not named in builtins.tbl: // In jsbuiltins.h; macro-declares the CallInfo struct, making it public. JS_DECLARE_CALLINFO(js_EqualStrings) // In jsstr.h; hand-declares the function. extern JSBool JS_FASTCALL js_EqualStrings(JSString *str1, JSString *str2); // declares the func // In jsstr.cpp; macro-declares the function, macro-defines the Callinfo // struct, ensuring that they match. JS_DEFINE_CALLINFO_2(extern, BOOL, js_EqualStrings, STRING, STRING, 1, 1) // In jsstr.cpp: hand-declares/defines the function. JSBool JS_FASTCALL js_EqualStrings(JSString *str1, JSString *str2) { ... } (It's a lot of repeated typing, but I can't see a good way to make it more concise.) The ones in builtins.tbl are similar, except the JS_DECLARE_CALLINFO and JS_DEFINE_CALLINFO_<n> macros are generated from the builtins.tbl. Note that it's the JS_DEFINE_CALLINFO macro that's important for tying the function type to the CallInfo struct type, *not* builtins.tbl. So builtins.tbl is just obfuscation, really. The attached patch kills builtins.tbl; basically it just inlines it in the two places where it is currently #included. The duplication isn't bad because the JS_DECLARE_CALLINFO macros only take one argument, the function name. Half the builtins are already done this way, so this just makes things more consistent. It also corrects a couple of minor inaccuracies in the comments. It also moves a couple of CallInfo methods from Assembler.cpp to LIR.cpp, a better spot for them.
Attachment #363784 -
Flags: review?(jorendorff)
Updated•15 years ago
|
Attachment #363784 -
Flags: review?(jorendorff) → review+
Comment 1•15 years ago
|
||
Comment on attachment 363784 [details] [diff] [review] kill builtins.tbl Great. Thanks! If you want to, please feel free to put each of those JS_DEFINE_CALLINFO macros right below the function it describes. I think that wins in the long run. r=me with or without that change. You could go even further, moving functions from jsbuiltins.cpp into the files where they logically belong. Later, I guess.
Reporter | ||
Comment 2•15 years ago
|
||
I put each macro call below its corresponding function, like you suggested. One good thing about this is that previously some of the functions were within a "#ifdef JS_TRACER" but the corresponding macro call was not; that's no longer the case. I made the move for all of them, not just the ones in jsbuiltins.cpp. While at it I removed the extraneous whitespace in the macro calls -- there's no point having it if they're not all together in a table-like form. I didn't move the functions out of jsbuiltins.cpp -- for some of them it wasn't clear to me which file they would best be moved to.
Reporter | ||
Comment 3•15 years ago
|
||
ping?
Comment 4•15 years ago
|
||
What about the 2nd patch? Does it need review?
Reporter | ||
Updated•15 years ago
|
Attachment #364023 -
Flags: review?(jorendorff)
Reporter | ||
Comment 5•15 years ago
|
||
I put jorendorff down again...
Comment 6•15 years ago
|
||
Comment on attachment 364023 [details] [diff] [review] also move each JS_DEFINE_CALLINFO macro below its corresponding function The nanojit change at the end of that patch isn't related to this stuff, right? r=me with that part split out into a separate patch.
Attachment #364023 -
Flags: review?(jorendorff) → review+
Comment 7•15 years ago
|
||
I meant a separate changeset. No need to re-review or file a separate bug (unless you actually intended that part to be in a separate bug...)
Reporter | ||
Comment 8•15 years ago
|
||
From the original description: It also moves a couple of CallInfo methods from Assembler.cpp to LIR.cpp, a better spot for them. It's somewhat related in that the whole patch is cleaning up stuff related to CallInfos, which is why I included it. I can take it out if you like, but I'm unclear about the distinction between a patch and a changeset... and if it gets separated doesn't it need a separate bug?
Reporter | ||
Comment 9•15 years ago
|
||
I rebased the patch and removed the nanojit changes. I don't have commit permissions -- can somebody (jorendorff?) land this for me? Thanks.
Attachment #363784 -
Attachment is obsolete: true
Attachment #364023 -
Attachment is obsolete: true
Comment 11•15 years ago
|
||
Actually the output might be binary-identical so we probably don't have to worry about #10. I will land it.
Reporter | ||
Comment 12•15 years ago
|
||
Also, the nanojit changes can be dropped from consideration for this bug -- they'll clash with the widen-LIR bug (#488775) and they're only minor. I'll deal with them later in another bug.
Comment 13•15 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/3c7c755e8b48
Whiteboard: needs-checkin → fixed-in-tracemonkey
Comment 14•15 years ago
|
||
no-jit builds were burning http://hg.mozilla.org/tracemonkey/rev/a5e2cc9e4950
Reporter | ||
Comment 15•15 years ago
|
||
Thanks for fixing it. What testing should I have done to prevent that?
Status: NEW → ASSIGNED
Comment 16•15 years ago
|
||
configure --disable-jit and make with that
Comment 17•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/3c7c755e8b48
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•