changeset 32399:2c3faf776bff

VM: Mark certain VM functions as internal use only. This changeset makes the following naming changes to the VM: * vm_enable, vm_compile, and vm_profile are retained as user-facing functions. * All other VM functions are marked as private / internal use only. Private functions are unlisted in `seealso` tags from `vm.m`, and are removed from the manual. Also `vm()` itself is only mentioned in the manual without the full docstring, which would otherwise mention internal functions as well.
author Arun Giridhar <arungiridhar@gmail.com>
date Mon, 09 Oct 2023 11:02:28 -0400
parents 4ae95cbbd1ab
children 3f48081aa034
files doc/interpreter/vectorize.txi libinterp/corefcn/compile.cc scripts/help/vm.m test/compile/bytecode_misc.m test/compile/bytecode_nested.m
diffstat 5 files changed, 21 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/vectorize.txi	Mon Oct 09 10:25:46 2023 -0400
+++ b/doc/interpreter/vectorize.txi	Mon Oct 09 11:02:28 2023 -0400
@@ -656,8 +656,6 @@
 A more comprehensive list of VM-related functions is given by the @code{vm}
 command.
 
-@DOCSTRING(vm)
-
 If broad-spectrum evaluation of all the user code with the VM is not desirable,
 then more advanced VM-related techniques are to selectively switch on or off
 VM compilation for specific functions as the user needs.  In general, these
@@ -665,15 +663,7 @@
 
 @DOCSTRING(vm_compile)
 
-@DOCSTRING(vm_clear_cache)
-
-@DOCSTRING(vm_is_compiled)
-
-@DOCSTRING(vm_is_executing)
-
-@DOCSTRING(vm_print_bytecode)
-
-@DOCSTRING(vm_print_trace)
+Profiling can be done with the @code{vm_profile} command.
 
 @DOCSTRING(vm_profile)
 
--- a/libinterp/corefcn/compile.cc	Mon Oct 09 10:25:46 2023 -0400
+++ b/libinterp/corefcn/compile.cc	Mon Oct 09 11:02:28 2023 -0400
@@ -81,9 +81,9 @@
   return {};
 }
 
-DEFUN (vm_clear_cache, , ,
+DEFUN (__vm_clear_cache__, , ,
   doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{val} =} vm_clear_cache ()
+@deftypefn  {} {@var{val} =} __vm_clear_cache__ ()
 
 Internal function.
 
@@ -94,9 +94,9 @@
   return octave_value {true};
 }
 
-DEFUN (vm_print_trace, , ,
+DEFUN (__vm_print_trace__, , ,
   doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{prints_trace} =} vm_print_trace ())
+@deftypefn  {} {@var{prints_trace} =} __vm_print_trace__ ())
 
 Internal function.
 
@@ -134,13 +134,13 @@
   return octave_value {ov.get_count ()};
 }
 
-DEFMETHOD (vm_is_executing, interp, , ,
+DEFMETHOD (__vm_is_executing__, interp, , ,
   doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{is_executing} =} vm_is_executing ())
+@deftypefn  {} {@var{is_executing} =} __vm_is_executing__ ())
 
 Internal function.
 
-Returns true if the VM is executing the function calling vm_is_executing ().
+Returns true if the VM is executing the function calling __vm_is_executing__ ().
 
 False otherwise.
 
@@ -272,10 +272,10 @@
   return octave_value {true};
 }
 
-DEFMETHOD (vm_print_bytecode, interp, args, ,
+DEFMETHOD (__vm_print_bytecode__, interp, args, ,
   doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{success} =} vm_print_bytecode (@var{fn_name}))
-@deftypefnx  {} {@var{success} =} vm_print_bytecode (@var{fn_handle}))
+@deftypefn  {} {@var{success} =} __vm_print_bytecode__ (@var{fn_name}))
+@deftypefnx  {} {@var{success} =} __vm_print_bytecode__ (@var{fn_handle}))
 
 Internal function.
 
@@ -347,10 +347,10 @@
   return octave_value {true};
 }
 
-DEFMETHOD (vm_is_compiled, interp, args, ,
+DEFMETHOD (__vm_is_compiled__, interp, args, ,
   doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{is_compiled} =} vm_is_compiled (@var{fn_name})
-@deftypefnx  {} {@var{is_compiled} =} vm_is_compiled (@var{fn_handle})
+@deftypefn  {} {@var{is_compiled} =} __vm_is_compiled__ (@var{fn_name})
+@deftypefnx  {} {@var{is_compiled} =} __vm_is_compiled__ (@var{fn_handle})
 
 Internal function.
 
--- a/scripts/help/vm.m	Mon Oct 09 10:25:46 2023 -0400
+++ b/scripts/help/vm.m	Mon Oct 09 11:02:28 2023 -0400
@@ -34,36 +34,19 @@
 ##
 ## @table @code
 ## @item vm_enable
-## Main VM user function.  Switch on or off the VM as a whole.
+## Switch on or off the VM as a whole.
 ##
 ## @item vm_compile
-## VM user function.  Compile a specified function to bytecode.
-##
-## @item vm_clear_cache
-## Internal function.  Clear the cache of already-processed code.
-##
-## @item vm_is_compiled
-## VM internal function.  Return true if the specified function is compiled.
-##
-## @item vm_is_executing
-## Internal function.  Return true if the VM is executing.
-##
-## @item vm_print_bytecode
-## Internal function.  Print bytecode of specified function.
-##
-## @item vm_print_trace
-## Internal function.  Print a debug trace from the VM.
+## Compile a specified function to bytecode.
 ##
 ## @item vm_profile
-## Internal function.  Profile the code running in the VM.
+## Profile the code running in the VM.
 ##
 ## @end table
 ##
 ## @noindent
 ##
-## @seealso{vm_enable, vm_compile, vm_clear_cache,
-## vm_is_compiled, vm_is_executing, vm_print_bytecode,
-## vm_print_trace, vm_profile}
+## @seealso{vm_enable, vm_compile, vm_profile}
 ## @end deftypefn
 
 function vm ()
--- a/test/compile/bytecode_misc.m	Mon Oct 09 10:25:46 2023 -0400
+++ b/test/compile/bytecode_misc.m	Mon Oct 09 11:02:28 2023 -0400
@@ -20,7 +20,7 @@
   % Try to run out of VM stack space
   % Assure that the VM is running, since we will disable the tree_evaluators
   % stack limit mechanism.
-  if vm_is_executing ()
+  if __vm_is_executing__ ()
     absurd_frame_limit = max_stack_depth * 10000;
     max_stack_depth (absurd_frame_limit, "local");
 
--- a/test/compile/bytecode_nested.m	Mon Oct 09 10:25:46 2023 -0400
+++ b/test/compile/bytecode_nested.m	Mon Oct 09 11:02:28 2023 -0400
@@ -338,8 +338,8 @@
   % Try some legacy inline functions
   h1i = inline ("x + 1");
   assert (h1i (2) == 3)
-  h2i = inline ("vm_is_executing()");
-  assert (h2i() == vm_is_executing);
+  h2i = inline ("__vm_is_executing__()");
+  assert (h2i() == __vm_is_executing__);
 end
 
 function subby