I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a default
value for instantiation of a module - so that a piece of code can be
loaded into memory with a parameter set at load time rather than when a function is invoked.
On 2021-11-23 15:36, James Harris wrote:
I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a default
value for instantiation of a module - so that a piece of code can be
loaded into memory with a parameter set at load time rather than when
a function is invoked.
... and the next instance overriding the first. Such a fun!
Shared generic bodies is a lot of joy to implement. GCC just blows up
the code copying each instance of a generic/template a whole.
But the real ecstasy begins with instances within instances, parameters passed from one instance to another and then you have to determine if a
thing within two instances visible along two different paths is same
thing or not.
On 23/11/2021 15:13, Dmitry A. Kazakov wrote:
On 2021-11-23 15:36, James Harris wrote:
I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a
default value for instantiation of a module - so that a piece of code
can be loaded into memory with a parameter set at load time rather
than when a function is invoked.
... and the next instance overriding the first. Such a fun!
:-)
Wouldn't each instance be separate? I can't see how one instance could override another.
AISI there are two forms of genericity: implicit and explicit.
"Two paths" suggests diamond pattern and an inheritance tree. I don't
think any kind of inheritance is required for the kind of genericity
needed in the above.
One thing I think you are saying and I would agree with you on in spades
is that there are many 'solutions' to these problems but no one clearly
best approach.
On 2021-11-23 21:21, James Harris wrote:
On 23/11/2021 15:13, Dmitry A. Kazakov wrote:
On 2021-11-23 15:36, James Harris wrote:
I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a
default value for instantiation of a module - so that a piece of
code can be loaded into memory with a parameter set at load time
rather than when a function is invoked.
... and the next instance overriding the first. Such a fun!
:-)
Wouldn't each instance be separate? I can't see how one instance could
override another.
If you share the code it must.
On 23/11/2021 22:06, Dmitry A. Kazakov wrote:
On 2021-11-23 21:21, James Harris wrote:
On 23/11/2021 15:13, Dmitry A. Kazakov wrote:
On 2021-11-23 15:36, James Harris wrote:
I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a
default value for instantiation of a module - so that a piece of
code can be loaded into memory with a parameter set at load time
rather than when a function is invoked.
... and the next instance overriding the first. Such a fun!
:-)
Wouldn't each instance be separate? I can't see how one instance
could override another.
If you share the code it must.
I wouldn't share the code! AISI the point of multiple instantiation is
that each instance would be different.
(As it happens, if the only thing which was different was the constants
and they were to be separated out from the code then it may be possible
to have one copy of the code but multiple rodata sections. But that's an implementation detail. In simple terms the point of different
instantiations would be that the loaded code would be different.)
On 2021-11-24 11:19, James Harris wrote:
On 23/11/2021 22:06, Dmitry A. Kazakov wrote:
On 2021-11-23 21:21, James Harris wrote:
On 23/11/2021 15:13, Dmitry A. Kazakov wrote:
On 2021-11-23 15:36, James Harris wrote:
I'm not too sure what's going on here but you guys might find the
following to be of interest. It seems to be a way to provide a
default value for instantiation of a module - so that a piece of
code can be loaded into memory with a parameter set at load time
rather than when a function is invoked.
... and the next instance overriding the first. Such a fun!
:-)
Wouldn't each instance be separate? I can't see how one instance
could override another.
If you share the code it must.
I wouldn't share the code! AISI the point of multiple instantiation is
that each instance would be different.
That by no means imply different code: sin(1.0) /= sin(0.5), same code
still.
You are confusing a lot of different things:
1. Equivalence. Named vs. structural. When two instances are considered logically same.
2. Shared bodies vs. macro expansions and all infinite points inbetween.
On 24/11/2021 11:34, Dmitry A. Kazakov wrote:
You are confusing a lot of different things:
1. Equivalence. Named vs. structural. When two instances are
considered logically same.
2. Shared bodies vs. macro expansions and all infinite points inbetween.
I am not sure what you are thinking of but AFAICS none of that is
relevant. Rather, the kind of instantiation being implemented by the aforementioned approach would customise modules as they are loaded into memory.
The initial case just loaded a custom constant but I could see it being
used to make customisations which were more general.
Some examples to illustrate how it might be used:
module_param(int, MAX_NICS, 8)
module_param(int, MAX_OPEN_FILES, 56)
module_param(float, PI, 3.141)
module_param(int, BITWIDTH, 64)
Multiple executable images could be created from one load module. Each
image would have the parameters set before it started.
On 2021-11-26 18:32, James Harris wrote:
Some examples to illustrate how it might be used:
module_param(int, MAX_NICS, 8)
module_param(int, MAX_OPEN_FILES, 56)
module_param(float, PI, 3.141)
module_param(int, BITWIDTH, 64)
Since this is untyped it makes no sense at all.
On 26/11/2021 20:22, Dmitry A. Kazakov wrote:
On 2021-11-26 18:32, James Harris wrote:
...
Some examples to illustrate how it might be used:
module_param(int, MAX_NICS, 8)
module_param(int, MAX_OPEN_FILES, 56)
module_param(float, PI, 3.141)
module_param(int, BITWIDTH, 64)
Since this is untyped it makes no sense at all.
The first argument - int or float - was meant to be the type.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 185 |
Nodes: | 16 (1 / 15) |
Uptime: | 11:56:36 |
Calls: | 3,678 |
Calls today: | 4 |
Files: | 11,151 |
Messages: | 3,447,953 |