bugGNU Octave - Bugs: bug #64677, VM Add support for nested functions


bug #64677: VM Add support for nested functions

Submitter:  Petter <petter>
Submitted:  Thu 14 Sep 2023 10:38:47 PM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 01 Oct 2023 04:37:36 PM UTC, comment #2: 

No complaints from CI. Closing as fixed.

Arun Giridhar <arungiridhar>
Group Member
Sun 17 Sep 2023 01:23:32 AM UTC, comment #1: 

Thanks. Tested and pushed to: https://hg.savannah.gnu.org/hgweb/octave/rev/822314643f50

Ready for test.

Arun Giridhar <arungiridhar>
Group Member
Thu 14 Sep 2023 10:38:47 PM UTC, original submission:  

Nested functions and functions with nested functions can be evaluated by the VM.

* libinterp/corefcn/call-stack.cc: Push bytecode frame for nested functions
* libinterp/corefcn/call-stack.h
* libinterp/corefcn/stack-frame.cc: Support saving bytecode frames, frameoffset ...
* libinterp/corefcn/stack-frame.h
* libinterp/octave-value/ov-fcn-handle.cc: Compile nested function handles
                                           Refactor VM call and is compiled check.
* libinterp/octave-value/ov-fcn.cc: Refactor compiled check and VM call
* libinterp/octave-value/ov-ref.cc: New ref octave_value_ref_ptr for nested frames
* libinterp/octave-value/ov-ref.h
* libinterp/octave-value/ov-usr-fcn.cc: Refactor vm call and compiled check
* libinterp/octave-value/ov.h: octave_value_ref_ptr friend to call is_ref() and ref_rep ()
* libinterp/parse-tree/pt-bytecode-vm.cc: Function caches might be written to refs
                                          New vm::call () and vm::maybe_compiled_or_compile ()
                                          Call bytecode for command functions.
* libinterp/parse-tree/pt-bytecode-vm.h
* libinterp/parse-tree/pt-bytecode-walk.cc: Compile nested functions, set up variables
* libinterp/parse-tree/pt-bytecode-walk.h
* libinterp/parse-tree/pt-bytecode.h: New opcode ENTER_NESTED
* libinterp/parse-tree/pt-eval.cc: Push nested frame, refactor how VM is called
* libinterp/parse-tree/pt-eval.h
* test/compile/bytecode.tst: Tests added
* test/compile/module.mk
* test/compile/bytecode_nested.m
* test/compile/cdef_bar.m: Self-counting test class

Petter <petter>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #55141:  octave_32353.patch added by petter (85KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by petter (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-01 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-09-17 arungiridhar StatusNone Ready For Test
    2023-09-14 petter Attached File- Added octave_32353.patch, #55141

    Back to the top

    Powered by Savane 3.13-ee12.
    Corresponding source code