-
Notifications
You must be signed in to change notification settings - Fork 691
Add operational mode for jerry_gc API call. #2385
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
Conversation
|
|
||
| - `mode` - operational mode, see [jerry_gc_mode_t](#jerry_gc_mode_t) | ||
|
|
||
| **Example** |
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.
Please update the example as well.
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. It runs with doctest as well now.
|
|
||
| ## jerry_gc_mode_t | ||
|
|
||
| Set garbage collection operational mode |
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.
I'm no native English speaker but isn't this "operation mode" or "operating mode"?
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.
According to google, operation mode is used 262M sites, while operational mode 117M sites. Both are used by high profile (e.g. microsoft or google technical docs) sites. I think both are ok, so I don't want to change unless you insist on it.
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.
I checked Cambridge dictionary:
operation - noun
operational - adjective
operating - present participle
I would prefer operational here.
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.
Google: The present participle is a participle that ends in ing. It can be used with the auxilliary verb 'to be' to form the continuous tense. It always takes the 'ing' form of the verb, even irregular verbs have an '...ing' form, in fact virtually all English words that end with 'ing' are present participles.
I think operating mode is also correct, if we emphasize doing the garbage collection in specific a way. The operational mode simply emphasize the behavior.
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.
E.g:
operating system - a system which is running (emphasizing continuity)
operational system - a system which is capable of running (not relevant if it is doing it now)
operation system - double noun, usually a phrase or not used at all. I think the latter is true here.
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.
As you've said, saying something is 'operational' means it is capable of running. Saying that the mode is operational means that the thing that is running will be able to run in that mode, but also implies that a 'not operational' mode exists, which 'won't be able to run'. This is not the case, as the mode here means a specific a way of operation, and not whether the GC can actually run, or is running.
I'm not sure what behavior you'd like to emphasize by using operational mode, yet it feels instinctively wrong to me, and I'd say the suggestions made by @akosthekiss would be the the correct way to go.
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.
I didn't exactly say that. Tricky way of turning my words :)
Adjectives extends the meaning of words, while nouns do not. Think about the difference of "wooden house" and "tree house". The former uses an adjective to extend a noun, while the latter is simply a phrase.
I found "operational mode" in a well known English dictionary:
https://en.oxforddictionaries.com/definition/standby
An operational mode of an electrical appliance in which the power is switched on but the appliance is not actually functioning.
I could not find the same thing with "operation mode".
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.
I've consulted an English teacher and operation was preferred over operational. But still no native speaker chiming in on either side. As this is no API function name but a doc text only, I wont be pushing further.
docs/02.API-REFERENCE.md
Outdated
|
|
||
| jerry_cleanup (); | ||
| } | ||
|
|
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.
Extra empty line.
jerry-ext/handler/handler-gc.c
Outdated
| jerry_gc (); | ||
| jerry_gc_mode_t mode = JERRY_GC_SEVERITY_LOW; | ||
|
|
||
| if (args_cnt > 0 && jerry_value_to_boolean (args_p[0])) |
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.
Because of this change, neither args_cnt nor args_p are unused anymore. (See above.)
jerry-ext/handler/handler-gc.c
Outdated
| if (args_cnt > 0 && jerry_value_to_boolean (args_p[0])) | ||
| { | ||
| mode = JERRY_GC_SEVERITY_HIGH; | ||
| } |
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 all could go into a ?: expression to avoid making the initialization of mode potentially a dead expression.
jerry_gc_mode_t mode = args_cnt > 0 && jerry_value_to_boolean (args_p[0]) ? JERRY_GC_SEVERITY_HIGH
: JERRY_GC_SEVERITY_LOW;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.
BTW, the doc string of the function should be updated describing how it deals with its arguments. Something like:
The routine invokes the GC with high severity if it has at least one argument and the first argument is equivalent to boolean true; it calls the GC with low severity otherwise.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
|
Patch updated. |
|
Any more comments for this patch? |
LaszloLango
left a comment
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.
LGTM
akosthekiss
left a comment
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.
LGTM
No description provided.