GC: Simplify use of GC lock

RESOLVED FIXED in mozilla16

Status

()

Core
JavaScript Engine
--
enhancement
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jonco, Assigned: jonco)

Tracking

Trunk
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [js:t])

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
There's quite a bit of code scattered throughout jsgc.cpp to take/release the GC lock, but this is mostly unnecessary now that only a single thread per runtime is allowed.

The locking code can be mostly factored into the functions which interact with the background thread, simplifying the code.
(Assignee)

Comment 1

5 years ago
Created attachment 638386 [details] [diff] [review]
Possible fix

Possible fix.

The GC lock is still used for DecommitArenas, and which I think is necessary but I'm not sure about.
Attachment #638386 - Flags: review?(wmccloskey)
(Assignee)

Updated

5 years ago
Assignee: general → jcoppeard
That seems wrong. The lock is still needed because it's used for synchronization with the helperThread.
Comment on attachment 638386 [details] [diff] [review]
Possible fix

Review of attachment 638386 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, Jon. This looks great to me.

Gregor, the lock isn't being removed here. We're just simplifying how it's acquired and released. For example, the patch acquires the lock in waitBackgroundSweepEnd, instead of in all its callers.
Attachment #638386 - Flags: review?(wmccloskey) → review+
Whiteboard: [js:t]
Oh right. I should have looked closer.
(Assignee)

Comment 5

5 years ago
Created attachment 638768 [details] [diff] [review]
Fix for test failure on try

Fix for the following failure on the try server:

PROCESS-CRASH | file:///home/cltbld/talos-slave/test/build/jsreftest/tests/jsreftest.html?test=js1_5/extensions/regress-336409-2.js | application crashed (minidump found)

This was because JSRuntime::onOutOfMemory takes the GC lock before calling waitBackgroundSweepOrAllocEnd().
Attachment #638386 - Attachment is obsolete: true
Blocks: 729760
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/ed582ea30746
https://hg.mozilla.org/mozilla-central/rev/ed582ea30746
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.