-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow programmatic override of the default runtime options #3342
Conversation
Prior to this commit, the only way to override the default pony runtime options was via the command line. This commit allows for programmatic override of the default pony runtime options via a specific bare function created on the Main actor: `fun @runtime_override_defaults(rto: RuntimeOptions) => None` In order to override the values, a programmer would replace the `None` with logic to directly set the various options on the `rto` variable. This bare function is limited in what is allowed and is only allowed to call functions on `primitive`s to ensure no memory allocation occurs as it is called before the runtime is fully initialized. This commit also renames the internal variable in `options_t` from `nopin` to `pin` to better align with how it is set from the command line so it is easier to programmatically change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clever solution.
Other than my small comment below, it looks good.
One other question, though - what's the best way to document that this feature exists? Should it maybe be mentioned in the pony help output where the runtime options are documented?
src/libponyc/verify/fun.c
Outdated
#include "../type/subtype.h" | ||
#include "ponyassert.h" | ||
#include <string.h> | ||
|
||
static bool verify_calls(pass_opt_t* opt, ast_t* ast) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be named something less generic than verify_calls
? It is very specific to the runtime_override_defaults
method, but that isn't clear at all from the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I feel like this should be documented somewhere. At a minimum, the runtime options Pony class should have documentation for what it does. I'm open to suggestions on documentation. |
Yeah, upon further thought I think for documentation it would be good to:
|
docstrings and help text added.
|
@dipinhora this is failing on Windows. |
@SeanTAllen Yes, it is. It's having troubling finding the new function during link time of Unfortunately, i know almost nothing about windows development or the tools available to debug the issue. Hopefully someone more knowledgeable can help or point me to a guide of some kind that might help me figure things out. |
I'll take a look tomorrow. |
😆 Sean uses "clever" as a criticism, but I use it as a compliment! |
On Windows everything is compiled as C++. Making the function declaration
|
@kulibali makes sense. thanks for the help. |
@dipinhora when this gets merged, can you add release notes to #3314? |
Also, can you include an |
When this passes CI, it is good to:
|
Thanks, @dipinhora. Please add release notes to #3314. |
Prior to this commit, the only way to override the default pony
runtime options was via the command line.
This commit allows for programmatic override of the default pony
runtime options via a specific bare function created on the Main
actor:
fun @runtime_override_defaults(rto: RuntimeOptions) => None
In order to override the values, a programmer would replace the
None
with logic to directly set the various options on therto
variable. This bare function is limited in what is allowed and
is only allowed to call functions on
primitive
s to ensure nomemory allocation occurs as it is called before the runtime is
fully initialized.
This commit also renames the internal variable in
options_t
fromnopin
topin
to better align with how it is set from thecommand line so it is easier to programmatically change.
Example that sets
--ponyhelp
totrue
: