public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/95415] New: Add support for thread-local variables
@ 2020-05-29 13:03 bouanto at zoho dot com
  2020-05-29 14:37 ` [Bug jit/95415] " dmalcolm at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bouanto at zoho dot com @ 2020-05-29 13:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

            Bug ID: 95415
           Summary: Add support for thread-local variables
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: bouanto at zoho dot com
  Target Milestone: ---

Hi.
Would it be possible to add thread-local variables?
Thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
@ 2020-05-29 14:37 ` dmalcolm at gcc dot gnu.org
  2021-04-21  1:13 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-05-29 14:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Perhaps, but it looks non-trivial.

Notes to self:

c/c-tree.h: struct c_declspecs has:
  /* Whether "__thread" or "_Thread_local" was specified.  */
  BOOL_BITFIELD thread_p : 1;
  /* Whether "__thread" rather than "_Thread_local" was specified.  */
  BOOL_BITFIELD thread_gnu_p : 1;

tree.h has:

/* In a VAR_DECL, the model to use if the data should be allocated from
   thread-local storage.  */
#define DECL_TLS_MODEL(NODE) decl_tls_model (NODE)

/* In a VAR_DECL, nonzero if the data should be allocated from
   thread-local storage.  */
#define DECL_THREAD_LOCAL_P(NODE) \
  ((TREE_STATIC (NODE) || DECL_EXTERNAL (NODE)) && decl_tls_model (NODE) >=
TLS_MODEL_REAL)

decl_tls_model/set_decl_tls_model get/set a field of the varpool_node, based on
this enum in coretypes.h:

/* The thread-local storage model associated with a given VAR_DECL
   or SYMBOL_REF.  This isn't used much, but both trees and RTL refer
   to it, so it's here.  */
enum tls_model {
  TLS_MODEL_NONE,
  TLS_MODEL_EMULATED,
  TLS_MODEL_REAL,
  TLS_MODEL_GLOBAL_DYNAMIC = TLS_MODEL_REAL,
  TLS_MODEL_LOCAL_DYNAMIC,
  TLS_MODEL_INITIAL_EXEC,
  TLS_MODEL_LOCAL_EXEC
};

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
  2020-05-29 14:37 ` [Bug jit/95415] " dmalcolm at gcc dot gnu.org
@ 2021-04-21  1:13 ` pinskia at gcc dot gnu.org
  2021-05-04 12:31 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-04-21  1:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-04-21
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
  2020-05-29 14:37 ` [Bug jit/95415] " dmalcolm at gcc dot gnu.org
  2021-04-21  1:13 ` pinskia at gcc dot gnu.org
@ 2021-05-04 12:31 ` rguenth at gcc dot gnu.org
  2021-05-19  0:44 ` bouanto at zoho dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-04 12:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
                   ` (2 preceding siblings ...)
  2021-05-04 12:31 ` rguenth at gcc dot gnu.org
@ 2021-05-19  0:44 ` bouanto at zoho dot com
  2021-11-20  0:30 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bouanto at zoho dot com @ 2021-05-19  0:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

--- Comment #3 from Antoni <bouanto at zoho dot com> ---
Created attachment 50842
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50842&action=edit
Patch to add this feature

I created a patch to add TLS variables.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
                   ` (3 preceding siblings ...)
  2021-05-19  0:44 ` bouanto at zoho dot com
@ 2021-11-20  0:30 ` dmalcolm at gcc dot gnu.org
  2021-12-12  0:07 ` cvs-commit at gcc dot gnu.org
  2021-12-12  0:10 ` bouanto at zoho dot com
  6 siblings, 0 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-11-20  0:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for working on this.

I think the current state is that I reviewed the patch here:
  https://gcc.gnu.org/pipermail/jit/2021q2/001306.html
and found some issues with it, so this is waiting on an updated patch.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
                   ` (4 preceding siblings ...)
  2021-11-20  0:30 ` dmalcolm at gcc dot gnu.org
@ 2021-12-12  0:07 ` cvs-commit at gcc dot gnu.org
  2021-12-12  0:10 ` bouanto at zoho dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-12  0:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Antoni Boucher <antoyo@gcc.gnu.org>:

https://gcc.gnu.org/g:c6b7f68bfd61fcd02842e672476f9924d5ba1d3c

commit r12-5913-gc6b7f68bfd61fcd02842e672476f9924d5ba1d3c
Author: Antoni Boucher <bouanto@zoho.com>
Date:   Sat Dec 11 19:01:15 2021 -0500

    libgccjit: Add support for TLS variable [PR95415]

    2021-12-11  Antoni Boucher  <bouanto@zoho.com>

    gcc/jit/
            PR target/95415
            * docs/topics/compatibility.rst (LIBGCCJIT_ABI_17): New ABI
            tag.
            * docs/topics/expressions.rst: Add document for the function
            gcc_jit_lvalue_set_tls_model.
            * jit-playback.h: New function (set_tls_model).
            * jit-recording.c: New function (set_tls_model), new
            variables (tls_models and tls_model_enum_strings) and support
            for setting the tls model.
            * jit-recording.h: New function (set_tls_model) and new
            field m_tls_model.
            * libgccjit.c: New function (gcc_jit_lvalue_set_tls_model).
            * libgccjit.h: New function (gcc_jit_lvalue_set_tls_model)
            and new enum (gcc_jit_tls_model).
            * libgccjit.map (LIBGCCJIT_ABI_17): New ABI tag.

    gcc/testsuite/
            PR target/95415
            * jit.dg/all-non-failing-tests.h: Add test-tls.c.
            * jit.dg/test-tls.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug jit/95415] Add support for thread-local variables
  2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
                   ` (5 preceding siblings ...)
  2021-12-12  0:07 ` cvs-commit at gcc dot gnu.org
@ 2021-12-12  0:10 ` bouanto at zoho dot com
  6 siblings, 0 replies; 8+ messages in thread
From: bouanto at zoho dot com @ 2021-12-12  0:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95415

Antoni <bouanto at zoho dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Antoni <bouanto at zoho dot com> ---
Merged in master.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-12  0:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 13:03 [Bug jit/95415] New: Add support for thread-local variables bouanto at zoho dot com
2020-05-29 14:37 ` [Bug jit/95415] " dmalcolm at gcc dot gnu.org
2021-04-21  1:13 ` pinskia at gcc dot gnu.org
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2021-05-19  0:44 ` bouanto at zoho dot com
2021-11-20  0:30 ` dmalcolm at gcc dot gnu.org
2021-12-12  0:07 ` cvs-commit at gcc dot gnu.org
2021-12-12  0:10 ` bouanto at zoho dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).