help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Realtime cost of call by value


From: Glenn Golden
Subject: Re: Realtime cost of call by value
Date: Thu, 30 Oct 2003 18:14:18 -0700

"John W. Eaton" writes:
>
> Yes.  Look at the way the corresponding matrix_value function is
> defined.
> 

I declared 

  virtual Matrix& matrix_reference (void) const
        { return rep->matrix_reference (); }

in ov.h, but now the DLD segfaults at

    Matrix& a = val.matrix_reference();

in what appears to be infinite recursion calling the inline in the
above virtual decl.  Or at least, it appears to _not_ be calling
Matrix::matrix_reference() in dMatrix.cc:

---
 octave-2.1.50G1:1> global foo; foo = rand(2);
 octave-2.1.50G1:2> 
 octave-2.1.50G1:2> hack

 Program received signal SIGSEGV, Segmentation fault.
 0x402d2677 in octave_value::matrix_reference (this=0x898bd10)
    at ov.h:474 { return rep->matrix_reference (); }

 (gdb) bt
 #0  0x402d2677 in octave_value::matrix_reference (this=0x898bd10) at ov.h:474

 #1  0x402d2681 in octave_value::matrix_reference (this=0x89eaa28) at ov.h:474

 #2  0x40d55411 in hmmm4 () at hack.cc:160

 #3  0x40d538e3 in Fhack (address@hidden) at hack.cc:42
---

(ov.h:474 is the inline from virtual matrix_reference () decl. above.)

In frames #0 and #1, the  "this"s  seem vaguely sensible:

  (gdb) p *(octave_value *)0x89eaa28

  $2 = {{rep = 0x898bd10, count = 144227600}, 
       static curr_print_indent_level = 0, static beginning_of_line = true, 
       static allocator = {head = 0x893ccc8, grow_size = 1024, item_size = 8}, 
       _vptr.octave_value = 0x403eb900}



  (gdb) p *(octave_matrix *)0x898bd10

  $4 = {<octave_base_matrix<Matrix>> =
       {<octave_base_value> = {<octave_value> = {
       {rep = 0x1, count = 1}, static curr_print_indent_level = 0, 
       static beginning_of_line = true, static allocator = {head = 0x893ccc8, 
       grow_size = 1024, item_size = 8}, _vptr.octave_value = 0x403e9ea0}, 
       static t_id = 0, static t_name = {static npos = 4294967295, 
       static nilRep = {len = 0, res = 0, ref = 16694, selfish = false}, 
       dat = 0x8056a78 "<unknown type>"}}, 
       matrix = {<MArray2<double>> = {<Array2<double>> = {<Array<double>> = {
       idx = 0x0, max_indices = 2, idx_count = 0, rep = 0x8a26930}, 
       d1 = 2, d2 = 2}, <No data fields>}, <No data fields>}}, 
       static allocator = {head = 0x898bd30, grow_size = 256, item_size = 32},
       static t_id = 4, static t_name = {static npos = 4294967295,
       static nilRep = { len = 0, res = 0, ref = 16694, selfish = false}, 
       dat = 0x80569f8 "matrix"}}


Doing my best, but the supply of bananas is running now.  At 25 min/build,
it's a slow go.  On the plus side, I'm learning a little more about C++... 

Glenn



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]