Closed
Bug 521328
Opened 15 years ago
Closed 13 years ago
TM: make the arena code less ugh
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 684039
People
(Reporter: gal, Assigned: gal)
Details
Attachments
(3 obsolete files)
No description provided.
Assignee | ||
Comment 1•15 years ago
|
||
Assignee: general → gal
Assignee | ||
Comment 2•15 years ago
|
||
Attachment #405345 -
Attachment is obsolete: true
Assignee | ||
Comment 3•15 years ago
|
||
Attachment #405372 -
Attachment is obsolete: true
Assignee | ||
Updated•15 years ago
|
Attachment #405373 -
Flags: review?(igor)
Comment 4•15 years ago
|
||
Comment on attachment 405373 [details] [diff] [review]
patch
>+template <typename T>
>+static inline void
>+JS_ARENA_ALLOCATE_COMMON(T& p, JSArenaPool *pool, size_t nb)
>+{
I suggest to use standard camel case for all arena functions with few #defines for compatibility with the current code.
>+static inline jsuword
>+JS_UPTRDIFF(void *p, void *q)
>+{
>+ return ((jsuword)(p) - (jsuword)(q));
>+}
>+
>+static inline bool
>+JS_ARENA_MARK_MATCH(JSArena *a, void *mark)
>+{
>+ return JS_UPTRDIFF(mark, (void *)a->base) <= JS_UPTRDIFF((void *)a->avail, (void *)a->base);
>+}
The casts in UPTRDIFF users look ugly. I suggest to turn JSArena fields into uint8 * to minimize the amount of casts. r+ with that addressed.
Attachment #405373 -
Flags: review?(igor)
Assignee | ||
Comment 5•15 years ago
|
||
I will leave the ugly all caps names in there for now, but I agree they should go. I will make the arena a class with methods in a follow-up patch (and then fix the uses too).
I will fix the other nit as suggested.
Assignee | ||
Comment 6•15 years ago
|
||
Actually I would prefer to leave it at jsuword for now. Changing to uint8 causes a large number of changes all over the place (alignment code). A lot of it is in macros and pretty brittle. I would like to change this in smaller steps with the class-ification and method-ification patch. Are you ok with an r+ as is? This first patch really just tries to make most macros go away.
Assignee | ||
Updated•15 years ago
|
Attachment #405373 -
Flags: review?(igor)
Comment 7•15 years ago
|
||
(In reply to comment #6)
> Actually I would prefer to leave it at jsuword for now. Changing to uint8
> causes a large number of changes all over the place (alignment code). A lot of
> it is in macros and pretty brittle. I would like to change this in smaller
> steps with the class-ification and method-ification patch. Are you ok with an
> r+ as is?
Sorry I have missed that comment - bugzilla should have an option to auto CC for review comments.
I do not like extra casts due to turning JS_UPTRDIFF into an inline function which makes few its users more ugly. What about keeping that as a macro for now and adding an inline that does not require a cast in a followup bug?
Assignee | ||
Comment 8•15 years ago
|
||
Ok, I don't mind keeping it as a macro. I will upload a new patch.
Comment 9•13 years ago
|
||
jsarena was revamped in bug 684039. DUPE or WONTFIX this one?
Comment 10•13 years ago
|
||
Thanks Ryan!
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Updated•13 years ago
|
Attachment #405373 -
Attachment is obsolete: true
Attachment #405373 -
Flags: review?(igor)
You need to log in
before you can comment on or make changes to this bug.
Description
•