changeset 20041:9cf91ecdc6f7

Rename jit_failure_count() to jit_failcnt(). * vectorize.txi: Rename in documentation. * pt-jit.cc: Rename in C++ implementation. * jit.tst: Rename in test files.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 17:01:02 -0800
parents 7239100e8570
children 9b90c6003362
files doc/interpreter/vectorize.txi libinterp/corefcn/pt-jit.cc test/jit.tst
diffstat 3 files changed, 97 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/vectorize.txi
+++ b/doc/interpreter/vectorize.txi
@@ -540,13 +540,15 @@
 function @code{jit_enable} is used to turn compilation on or off.  The
 function @code{jit_startcnt} sets the threshold for acceleration.  Loops
 with iteration counts above @code{jit_startcnt} will be accelerated.  The
-function @code{debug_jit} is not likely to be of use to anyone not working
-directly on the implementation of the JIT compiler.
+functions @code{jit_failcnt} and @code{debug_jit} are not likely to be of use
+to anyone not working directly on the implementation of the JIT compiler.
 
 @DOCSTRING(jit_enable)
 
 @DOCSTRING(jit_startcnt)
 
+@DOCSTRING(jit_failcnt)
+
 @DOCSTRING(debug_jit)
 
 @node Miscellaneous Techniques
--- a/libinterp/corefcn/pt-jit.cc
+++ b/libinterp/corefcn/pt-jit.cc
@@ -46,7 +46,7 @@
 
 static int Vjit_startcnt = 1000;
 
-static int Vjit_failure_count = 0;
+static int Vjit_failcnt = 0;
 
 #include <llvm/Analysis/CallGraph.h>
 #include <llvm/Analysis/Passes.h>
@@ -2312,7 +2312,7 @@
             std::cout << "jit fail: " << e.what () << std::endl;
         }
 
-      Vjit_failure_count++;
+      Vjit_failcnt++;
 
       wrapper.erase ();
       raw_fn.erase ();
@@ -2471,7 +2471,7 @@
             std::cout << "jit fail: " << e.what () << std::endl;
         }
 
-      Vjit_failure_count++;
+      Vjit_failcnt++;
 
     }
 
@@ -2514,12 +2514,12 @@
 #define UNUSED_WITHOUT_LLVM(x) x GCC_ATTR_UNUSED
 #endif
 
-DEFUN (jit_failure_count, UNUSED_WITHOUT_LLVM (args),
+DEFUN (jit_failcnt, UNUSED_WITHOUT_LLVM (args),
        UNUSED_WITHOUT_LLVM (nargout),
        "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {@var{val} =} jit_failure_count ()\n\
-@deftypefnx {Built-in Function} {@var{old_val} =} jit_failure_count (@var{new_val})\n\
-@deftypefnx {Built-in Function} {} jit_failure_count (@var{new_val}, \"local\")\n\
+@deftypefn  {Built-in Function} {@var{val} =} jit_failcnt ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} jit_failcnt (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} jit_failcnt (@var{new_val}, \"local\")\n\
 Query or set the internal variable that counts the number of\n\
 JIT fail exceptions for Octave's JIT compiler.\n\
 \n\
@@ -2530,9 +2530,9 @@
 @end deftypefn")
 {
 #if defined (HAVE_LLVM)
-  return SET_INTERNAL_VARIABLE (jit_failure_count);
+  return SET_INTERNAL_VARIABLE (jit_failcnt);
 #else
-  warning ("jit_failure_count: JIT compiling not available in this version of Octave");
+  warning ("jit_failcnt: JIT compiling not available in this version of Octave");
   return octave_value ();
 #endif
 }
--- a/test/jit.tst
+++ b/test/jit.tst
@@ -27,7 +27,7 @@
 
 ## Test some simple cases that compile.
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! for i=1:1e6
 %!   if (i < 5)
 %!     break;
@@ -36,10 +36,10 @@
 %!   endif
 %! endfor
 %! assert (i, 1);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! while (1)
 %!   if (1)
 %!     break;
@@ -47,85 +47,85 @@
 %!     break;
 %!   endif
 %! endwhile
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   break;
 %! until (0)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   if (1)
 %!     break;
 %!   end;
 %! until (0)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! i=1;
 %! do
 %!   continue;
 %!   i=i+1;
 %! until (1)
 %! assert (i, 1);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! for i=1:1e6
 %!   if (i == 100)
 %!     break;
 %!   endif
 %! endfor
 %! assert (i, 100);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 ## Also test parfor keyword
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! parfor i=1:1e6
 %!   if (i == 100)
 %!     break;
 %!   endif
 %! endparfor
 %! assert (i, 100);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 ## Test some switch statements
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   switch (1)
 %!   end;
 %! until(1)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   switch (1)
 %!   case 1
 %!     break;
 %!   end;
 %! until(1)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   switch (1)
 %!   otherwise
 %!     break;
 %!   end;
 %! until(1)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! do
 %!   switch (1)
 %!   case 1
@@ -134,10 +134,10 @@
 %!     break;
 %!   end;
 %! until(1)
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! i=0;
 %! a=0;
 %! b=0;
@@ -159,21 +159,21 @@
 %! assert (i, 4);
 %! assert (a, 6);
 %! assert (b, 1);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 ## Some more complex calculations
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! inc = 1e-5;
 %! result = 0;
 %! for ii = 0:inc:1
 %!   result = result + inc * (1/3 * ii * ii);
 %! endfor
 %! assert (abs (result - 1/9) < 1e-5);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! inc = 1e-5;
 %! result = 0;
 %! for ii = 0:inc:1
@@ -181,10 +181,10 @@
 %!   result = result + inc * (1/3 * ii ^ 2);
 %! endfor
 %! assert (abs (result - 1/9) < 1e-5);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! temp = 1+1i;
 %! nan = NaN;
 %! while (1)
@@ -193,10 +193,10 @@
 %!   break;
 %! endwhile
 %! assert (imag (temp), 0);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! temp = 1+1i;
 %! nan = NaN+1i;
 %! while (1)
@@ -206,30 +206,30 @@
 %!   break;
 %! endwhile
 %! assert (imag (temp), 0);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! temp = 1+1i;
 %! while (1)
 %!   temp = temp * 5;
 %!   break;
 %! endwhile
 %! assert (temp, 5+5i);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! nr = 1001;
 %! mat = zeros (1, nr);
 %! for i = 1:nr
 %!   mat(i) = i;
 %! endfor
 %! assert (mat == 1:nr);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! nr = 1001;
 %! mat = 1:nr;
 %! mat(end) = 0; # force mat to a matrix
@@ -238,10 +238,10 @@
 %!   total = mat(i) + total;
 %! endfor
 %! assert (sum (mat) == total);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! nr = 1001;
 %! mat = [3 1 5];
 %! try
@@ -255,7 +255,7 @@
 %! catch
 %! end_try_catch
 %! assert (result == 500);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!function result = gen_test (n)
 %!  result = double (rand (1, n) > .01);
@@ -291,23 +291,23 @@
 %!endfunction
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! test_set = gen_test (10000);
 %! assert (all (vectorized (test_set, 3) == loopy (test_set, 3)));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! niter = 1001;
 %! i = 0;
 %! while (i < niter)
 %!   i = i + 1;
 %! endwhile
 %! assert (i == niter);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! niter = 1001;
 %! result = 0;
 %! m = [5 10];
@@ -315,10 +315,10 @@
 %!   result = result + m(end);
 %! endfor
 %! assert (result == m(end) * niter);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! ndim = 100;
 %! result = 0;
 %! m = zeros (ndim);
@@ -331,10 +331,10 @@
 %!   i = i + 1;
 %! endwhile
 %! assert (result == sum (sum (m)));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! ndim = 100;
 %! m = zeros (ndim);
 %! i = 1;
@@ -347,10 +347,10 @@
 %! m2 = zeros (ndim);
 %! m2(:) = 1:(ndim^2);
 %! assert (all (m == m2));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! ndim = 2;
 %! m = zeros (ndim, ndim, ndim, ndim);
 %! result = 0;
@@ -370,7 +370,7 @@
 %! expected = ones (ndim, ndim, ndim, ndim);
 %! assert (all (m == expected));
 %! assert (result == sum (expected (:)));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!function test_divide ()
 %! state = warning ("query", "Octave:divide-by-zero").state;
@@ -386,26 +386,26 @@
 %!endfunction
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! lasterr ("");
 %! try
 %!   test_divide ();
 %! end_try_catch
 %! assert (strcmp (lasterr (), "division by zero"));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! while (1)
 %!   a = 0;
 %!   result = a / 1;
 %!   break;
 %! endwhile
 %! assert (result, 0);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! m = zeros (2, 1001);
 %! for i=1:1001
 %!   m(end, i) = i;
@@ -415,49 +415,49 @@
 %! m2(1, :) = fliplr (1:1001);
 %! m2(2, :) = 1:1001;
 %! assert (m, m2);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! m = [1 2 3];
 %! for i=1:1001
 %!   m = sin (m);
 %!   break;
 %! endfor
 %! assert (m == sin ([1  2 3]));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! i = 0;
 %! while i < 10
 %!   i += 1;
 %! endwhile
 %! assert (i == 10);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! i = 0;
 %! while i < 10
 %!   a = ++i;
 %! endwhile
 %! assert (i == 10);
 %! assert (a == 10);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! i = 0;
 %! while i < 10
 %!   a = i++;
 %! endwhile
 %! assert (i == 10);
 %! assert (a == 9);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! num = 2;
 %! a = zeros (1, num);
 %! i = 1;
@@ -466,7 +466,7 @@
 %!   ++i;
 %! endwhile
 %! assert (a, ones (1, num));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!function test_compute_idom ()
 %! while (li <= length (l1) && si <= length (s1))
@@ -481,13 +481,13 @@
 %! endwhile
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! lasterr ("");
 %! try
 %!   test_compute_idom ();
 %! end_try_catch
 %! assert (! isempty (lasterr ()));
-%! assert (jit_failure_count, 1);
+%! assert (jit_failcnt, 1);
 
 %!function x = test_overload (a)
 %!  while (1)
@@ -497,10 +497,10 @@
 %!endfunction
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! assert (test_overload (1), 1);
 %! assert (test_overload ([1 2]), [1 2]);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!function a = bubble (a = [3 2 1])
 %!  swapped = 1;
@@ -519,12 +519,12 @@
 %!endfunction
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! assert (bubble (), [1 2 3]);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! a = 0;
 %! b = 1;
 %! for i=1:1e3
@@ -534,12 +534,12 @@
 %! endfor
 %! assert (a, 2000);
 %! assert (b, 1);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!xtest
 %! ## FIXME: No support for functions with complex input prototypes
 %! ## testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! a = [1+1i 1+2i];
 %! b = 0;
 %! while (1)
@@ -547,7 +547,7 @@
 %!   break;
 %! endwhile
 %! assert (b, a(1));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!function test_undef ()
 %!  for i=1:1e7
@@ -556,13 +556,13 @@
 %!endfunction
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! lasterr ("");
 %! try
 %!   test_undef ();
 %! end_try_catch
 %! assert (strncmp (lasterr (), "'XXX' undefined near", 20));
-%! assert (jit_failure_count, 1);
+%! assert (jit_failcnt, 1);
 
 %!shared id
 %! id = @(x) x;
@@ -570,20 +570,20 @@
 %!xtest
 %! ## FIXME: No support for functions with complex input prototypes
 %! ## testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! assert (id (1), 1);
 %! assert (id (1+1i), 1+1i);
 %! assert (id (1, 2), 1);
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 %!testif HAVE_LLVM
-%! jit_failure_count (0)
+%! jit_failcnt (0)
 %! lasterr ("");
 %! try
 %!   id ();
 %! end_try_catch
 %! assert (strncmp (lasterr (), "'x' undefined near", 18));
-%! assert (jit_failure_count, 0);
+%! assert (jit_failcnt, 0);
 
 ## Restore JIT settings
 %!testif HAVE_LLVM