Bug 171554 - JSC C API should expose GC marking constraints and weak references
Summary: JSC C API should expose GC marking constraints and weak references
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Filip Pizlo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-02 10:19 PDT by Filip Pizlo
Modified: 2017-05-03 11:21 PDT (History)
9 users (show)

See Also:


Attachments
the patch (24.20 KB, patch)
2017-05-02 10:21 PDT, Filip Pizlo
ggaren: review+
Details | Formatted Diff | Diff
Windows build fix (1023 bytes, patch)
2017-05-02 15:13 PDT, Don Olmstead
fpizlo: review+
don.olmstead: commit-queue-
Details | Formatted Diff | Diff
Windows build fix (1.00 KB, patch)
2017-05-02 15:40 PDT, Don Olmstead
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filip Pizlo 2017-05-02 10:19:05 PDT
This lets you *almost* integrate JSC's GC with a foreign GC. It lets you implement lots of exotic reference types, way beyond weak references.
Comment 1 Filip Pizlo 2017-05-02 10:21:30 PDT
Created attachment 308829 [details]
the patch
Comment 2 Build Bot 2017-05-02 10:24:20 PDT
Attachment 308829 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/API/JSMarkingConstraintPrivate.h:26:  Use #pragma once instead of #ifndef for header guard.  [build/header_guard] [5]
ERROR: Source/JavaScriptCore/API/tests/testapi.c:1167:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
ERROR: Source/JavaScriptCore/API/JSMarkingConstraintPrivate.cpp:79:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/JavaScriptCore/API/JSWeakPrivate.h:26:  Use #pragma once instead of #ifndef for header guard.  [build/header_guard] [5]
Total errors found: 4 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Geoffrey Garen 2017-05-02 10:44:42 PDT
Comment on attachment 308829 [details]
the patch

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

r=me

> Source/JavaScriptCore/API/JSMarkingConstraintPrivate.h:47
> +JS_EXPORT void JSContextGroupRegisterMarkingConstraint(JSContextGroupRef, JSMarkingConstraint, void *userData);

Usually we would do this as a pair of add/remove APIs: JSContextGroupAddMarkingConstraint, JSContextGroupRemoveMarkingConstraint.
Comment 4 Filip Pizlo 2017-05-02 11:00:50 PDT
Landed in https://trac.webkit.org/changeset/216078/webkit
Comment 5 Ryan Haddad 2017-05-02 12:03:17 PDT
(In reply to Filip Pizlo from comment #4)
> Landed in https://trac.webkit.org/changeset/216078/webkit

This change broke the Windows build:

https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/1133
Comment 6 Filip Pizlo 2017-05-02 12:13:20 PDT
(In reply to Ryan Haddad from comment #5)
> (In reply to Filip Pizlo from comment #4)
> > Landed in https://trac.webkit.org/changeset/216078/webkit
> 
> This change broke the Windows build:
> 
> https://build.webkit.org/builders/Apple%20Win%20Release%20%28Build%29/builds/
> 1133

Hopefully fixed in r216085
Comment 7 Filip Pizlo 2017-05-02 12:15:17 PDT
And fixed for real in https://trac.webkit.org/changeset/216086/webkit
Comment 8 Don Olmstead 2017-05-02 14:56:19 PDT
There's still a problem with the Windows builds. The declaration of JSSynchronousGarbageCollectForDebugging in testapi.c should have an extern "C" in front of it.
Comment 9 Don Olmstead 2017-05-02 15:13:32 PDT
Created attachment 308855 [details]
Windows build fix
Comment 10 Filip Pizlo 2017-05-02 15:21:11 PDT
(In reply to Don Olmstead from comment #9)
> Created attachment 308855 [details]
> Windows build fix

That's weird that you need "extern "C"" in a C file.  It may be that your fix does not work on Mac, in which case the right fix is to #ifdef __cplusplus...
Comment 11 Don Olmstead 2017-05-02 15:40:28 PDT
Created attachment 308862 [details]
Windows build fix

Add __cplusplus guard
Comment 12 Filip Pizlo 2017-05-02 16:17:38 PDT
(In reply to Don Olmstead from comment #11)
> Created attachment 308862 [details]
> Windows build fix
> 
> Add __cplusplus guard

Thank you for doing this!
Comment 13 Don Olmstead 2017-05-02 19:07:06 PDT
Reopening so hopefully the patch will land
Comment 14 Don Olmstead 2017-05-02 19:08:32 PDT
(In reply to Filip Pizlo from comment #12)
> (In reply to Don Olmstead from comment #11)
> > Created attachment 308862 [details]
> > Windows build fix
> > 
> > Add __cplusplus guard
> 
> Thank you for doing this!

No problem!
Comment 15 WebKit Commit Bot 2017-05-02 19:48:52 PDT
Comment on attachment 308862 [details]
Windows build fix

Clearing flags on attachment: 308862

Committed r216109: <http://trac.webkit.org/changeset/216109>