annotate libinterp/parse-tree/pt-vm-eval.cc @ 31167:92d897a2c1c3

New runtime function __enable_vm_eval__() to control use of VM evaluator. * libinterp/parse-tree/pt-vm-eval.cc (F__enable_vm_eval__): New file. New DEFUN for __enable_vm_eval__ protected by #ifdef on configuration variable OCTAVE_ENABLE_VM_EVALUATOR. * libinterp/parse-tree/module.mk: Add pt-vm-eval.cc to build system.
author Rik <rik@octave.org>
date Fri, 29 Jul 2022 10:41:22 -0700
parents
children e88a07dec498
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31167
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
1 ////////////////////////////////////////////////////////////////////////
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
2 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
3 // Copyright (C) 2022 The Octave Project Developers
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
4 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
6 // distribution or <https://octave.org/copyright/>.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
7 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
8 // This file is part of Octave.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
9 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
11 // under the terms of the GNU General Public License as published by
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
13 // (at your option) any later version.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
14 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
18 // GNU General Public License for more details.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
19 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
21 // along with Octave; see the file COPYING. If not, see
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
22 // <https://www.gnu.org/licenses/>.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
23 //
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
24 ////////////////////////////////////////////////////////////////////////
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
25
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
26 #if defined (HAVE_CONFIG_H)
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
27 # include "config.h"
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
28 #endif
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
29
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
30 #include "defun.h"
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
31 #include "variables.h"
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
32
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
33 OCTAVE_NAMESPACE_BEGIN
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
34
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
35 // If TRUE, use VM evaluator rather than tree walker.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
36
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
37 static bool V__enable_vm_eval__ = false;
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
38
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
39 DEFUN (__enable_vm_eval__, args, nargout,
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
40 doc: /* -*- texinfo -*-
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
41 @deftypefn {} {@var{val} =} __enable_vm_eval__ ()
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
42 @deftypefnx {} {@var{old_val} =} __enable_vm_eval__ (@var{new_val})
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
43 @deftypefnx {} {@var{old_val} =} __enable_vm_eval__ (@var{new_val}, "local")
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
44 Query or set whether Octave uses a virtual machine (VM) for evaluation of
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
45 parsed statements.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
46
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
47 The default value is false. When false, Octave uses a traditional tree walker
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
48 to evaluate statements parsed from m-code. When true, Octave translates parsed
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
49 statements to an intermediate representation that is then evaluated by a
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
50 virtual machine.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
51
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
52 When called from inside a function with the @qcode{"local"} option, the setting
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
53 is changed locally for the function and any subroutines it calls. The original
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
54 setting is restored when exiting the function.
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
55 @end deftypefn */)
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
56 {
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
57 #if defined (OCTAVE_ENABLE_VM_EVALUATOR)
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
58
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
59 return set_internal_variable (V__enable_vm_eval__, args, nargout,
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
60 "__enable_vm_eval__");
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
61
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
62 #else
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
63
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
64 octave_unused_parameter (args);
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
65
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
66 err_disabled_feature ("vm-evaluator",
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
67 "using a Virtual Machine for statement evaluation");
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
68
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
69 #endif
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
70 }
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
71
92d897a2c1c3 New runtime function __enable_vm_eval__() to control use of VM evaluator.
Rik <rik@octave.org>
parents:
diff changeset
72 OCTAVE_NAMESPACE_END