Closed Bug 516226 Opened 15 years ago Closed 14 years ago

Storing external string type in JSString::length

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: igor, Assigned: igor)

Details

Attachments

(1 file)

Currently for external strings their type type is stored using GC thing flags allocated for the string. This leads to extra checks during the finalization of the string. It also prevents shrinking GC flags down to 1 or 2 bits per thing with the type stored in the arena header. The latter would allow to minimize farther the amount of indirection during the marking and finalization.

Thus the idea is to store the external string type directly in JSString using the length bits. Inevitably this will restrict the maximum string length to 2**26 compared with the current 2*29 limit if 3 bits will be designated to the external type. But such limit is still rather generous since it means that a script would be able allocate strings with 128MB of data.
Attached patch v1Splinter Review
The patch moves the storage for external strings into JSString. As a consequence it shrinks the maximum string length from 256MB down to 32MB.
I think a much better approach of solving this is having external strings in a separate GC pool for each type. That avoids the virtual dispatch in the finalizer too. So separate GC pools for <double, object, function, regexp, internal-string, external-string-0, external-string-1>.
(In reply to comment #2)
> I think a much better approach of solving this is having external strings in a
> separate GC pool for each type. That avoids the virtual dispatch in the
> finalizer too. So separate GC pools for <double, object, function, regexp,
> internal-string, external-string-0, external-string-1>.

Right, I have filed bug 517199 about this. I still keep this bug open as using separated free lists for external strings may cause excessive fragmentation especially if bugger GC arenas would be chosen. In that case we may opt for shared free list for all strings.

For example, for a browser run with GMail and few more sites I have 2 external string types taking 1%-4% and 0.1% - 0.3% of all allocated strings.
This have not been relevant since introduction of typed GC free lists.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: