lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Thread-local data?


From: Paulo César Pereira de Andrade
Subject: Re: [Lightning] Thread-local data?
Date: Fri, 23 Sep 2016 12:09:35 -0300

2016-09-23 11:40 GMT-03:00 Sandro Magi <address@hidden>:
> How can a dynamically compiled program via GNU lightning, access
> thread-local variables that are annotated with  _Thread_local? If I
> understand correctly, thread-local storage is accessed via a privileged
> register, so does lightning identify this register in some way?

  There is no way to inject instructions, so, without a patched
lightning you need to call C functions to return the data.

  Maybe some example usage may be helpful...

  In my sample language using lightning, I use only one tls
variable, that is a pointer to the thread data, and its value is
kept in a register, JIT_V0.
  For example, it is set in jit at:
https://github.com/pcpa/owl/blob/master/lib/oemit.c#L440
  The main thread (compiler) is set at
https://github.com/pcpa/owl/blob/master/lib/othread.c#L70
and runtime for different threads is set at different functions in:
https://github.com/pcpa/owl/blob/master/lib/ovm.c
ovm() for the main thread, vm_builtin() for threads running
a builtin (C) function, and ovm_thread() for threads running
a jit function.

> Sandro

Thanks,
Paulo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]