Merge branch 'dump_rta'
authorJean Privat <jean@pryen.org>
Thu, 13 Mar 2014 12:37:28 +0000 (08:37 -0400)
committerJean Privat <jean@pryen.org>
Thu, 13 Mar 2014 12:37:28 +0000 (08:37 -0400)
20 files changed:
lib/a_star.nit
lib/mnit/opengles1.nit
lib/mnit_android/android_app.nit
lib/mnit_android/android_opengles1.nit
lib/mnit_linux/linux_opengles1.nit
src/abstract_compiler.nit
src/android_platform.nit
src/collect_super_sends.nit [deleted file]
src/metrics/metrics_base.nit
src/model/mmodule.nit
src/model_viz.nit
src/modelize_property.nit
src/naive_interpreter.nit
src/nitni/nitni_callbacks.nit
src/rapid_type_analysis.nit
src/separate_compiler.nit
src/typing.nit
tests/nitmetrics.args
tests/sav/nitmetrics_args1.res
tests/tests.sh

index 3d8112d..32a5f8c 100644 (file)
@@ -82,28 +82,27 @@ class Node
        private var last_pathfinding_evocation: Int = 0
 
        # cost up to in current evocation
-       # lifetime limited to evocation of path_to
+       # lifetime limited to evocation of `path_to`
        private var best_cost_up_to: Int = 0
 
        # source node
-       # lifetime limited to evocation of path_to
+       # lifetime limited to evocation of `path_to`
        private var best_source: nullable N = null
 
        # is in frontier or buckets
-       # lifetime limited to evocation of path_to
+       # lifetime limited to evocation of `path_to`
        private var open: Bool = false
 
-
        # Main functionnality, returns path from `self` to `dest`
-       fun path_to(dest: Node, max_cost: Int, context: PathContext): nullable Path[N]
+       fun path_to(dest: N, max_cost: Int, context: PathContext): nullable Path[N]
        do
                var cost = 0
 
                var nbr_buckets = context.worst_cost + context.worst_heuristic_cost + 1
-               var buckets = new Array[List[Node]].with_capacity(nbr_buckets)
+               var buckets = new Array[List[N]].with_capacity(nbr_buckets)
 
                for i in [0 .. nbr_buckets[ do
-                       buckets.add(new List[Node])
+                       buckets.add(new List[N])
                end
 
                graph.pathfinding_current_evocation += 1
@@ -115,7 +114,7 @@ class Node
                self.best_cost_up_to = 0
 
                loop
-                       var frontier_node: nullable Node = null
+                       var frontier_node: nullable N = null
 
                        var bucket_searched: Int = 0
 
index fda5a3f..347613f 100644 (file)
@@ -26,13 +26,6 @@ in "C header" `{
        #include <GLES/glext.h>
        #include <errno.h>
 
-       #define LOGW(...) ((void)fprintf(stderr, "# warn: %s", __VA_ARGS__))
-       #ifdef DEBUG
-               #define LOGI(...) ((void)fprintf(stderr, "# info: %s", __VA_ARGS__))
-       #else
-               #define LOGI(...) (void)0
-       #endif
-
        EGLDisplay mnit_display;
        EGLSurface mnit_surface;
        EGLContext mnit_context;
@@ -70,6 +63,13 @@ in "C header" `{
 `}
 
 in "C" `{
+       #define LOGW(...) ((void)fprintf(stderr, "# warn: %s (%i)\n", __VA_ARGS__))
+       #ifdef DEBUG
+               #define LOGI(...) ((void)fprintf(stderr, "# info: %s (%i)\n", __VA_ARGS__))
+       #else
+               #define LOGI(...) (void)0
+       #endif
+
        extern NativeWindowType mnit_window;
        extern EGLNativeDisplayType mnit_native_display;
 
@@ -107,35 +107,33 @@ in "C" `{
                image->src_xi = 1.0;
                image->src_yi = 1.0;
 
-
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                       LOGW ("a error loading image: %i\n", mnit_opengles_error_code);
-                       printf( "%i\n", mnit_opengles_error_code );
+                       LOGW("error loading image after malloc", mnit_opengles_error_code);
                }
+
                glGenTextures(1, &image->texture);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                       LOGW ("b error loading image: %i\n", mnit_opengles_error_code);
-                       printf( "%i\n", mnit_opengles_error_code );
+                       LOGW("error loading image after glGenTextures", mnit_opengles_error_code);
                }
+
                glBindTexture(GL_TEXTURE_2D, image->texture);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                       LOGW ("c error loading image: %i\n", mnit_opengles_error_code);
-                       printf( "%i\n", mnit_opengles_error_code );
+                       LOGW("error loading image glBindTexture", mnit_opengles_error_code);
                }
+
                glTexImage2D(   GL_TEXTURE_2D, 0, format, width, height,
                                                0, format, GL_UNSIGNED_BYTE, (GLvoid*)pixels);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                       LOGW ("d error loading image: %i\n", mnit_opengles_error_code);
-                       printf( "%i\n", mnit_opengles_error_code );
+                       LOGW("error loading image after glTexImage2D", mnit_opengles_error_code);
                }
+
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                       LOGW ("e error loading image: %i\n", mnit_opengles_error_code);
-                       printf( "%i\n", mnit_opengles_error_code );
+                       LOGW("error loading image after gtTexParameter", mnit_opengles_error_code);
                }
 
                return image;
@@ -168,27 +166,27 @@ class Opengles1Display
 
                EGLDisplay display = eglGetDisplay(mnit_native_display);
                if ( display == EGL_NO_DISPLAY) {
-                       LOGW("Unable to eglGetDisplay");
+                       LOGW("Unable to eglGetDisplay", 0);
                        return -1;
                }
 
                if ( eglInitialize(display, 0, 0) == EGL_FALSE) {
-                       LOGW("Unable to eglInitialize");
+                       LOGW("Unable to eglInitialize", 0);
                        return -1;
                }
 
                if ( eglChooseConfig(display, attribs, &config, 1, &numConfigs) == EGL_FALSE) {
-                       LOGW("Unable to eglChooseConfig");
+                       LOGW("Unable to eglChooseConfig", 0);
                        return -1;
                }
 
                if ( numConfigs == 0 ) {
-                       LOGW("No configs available for egl");
+                       LOGW("No configs available for egl", 0);
                        return -1;
                }
 
                if ( eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format) == EGL_FALSE) {
-                       LOGW("Unable to eglGetConfigAttrib");
+                       LOGW("Unable to eglGetConfigAttrib", 0);
                        return -1;
                }
 
@@ -199,7 +197,7 @@ class Opengles1Display
                context = eglCreateContext(display, config, NULL, NULL);
 
                if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) {
-                       LOGW("Unable to eglMakeCurrent");
+                       LOGW("Unable to eglMakeCurrent", 0);
                        return -1;
                }
 
@@ -214,7 +212,10 @@ class Opengles1Display
                mnit_height = h;
                mnit_zoom = 1.0f;
 
-               LOGI( "surface: %i, display: %i, w %i, h %i", (int)surface, (int)display, w, h );
+               LOGI("surface", (int)surface);
+               LOGI("display", (int)display);
+               LOGI("width", w);
+               LOGI("height", h);
 
                glViewport(0, 0, mnit_width, mnit_height);
                glMatrixMode(GL_PROJECTION);
@@ -311,7 +312,7 @@ class Opengles1Display
                glDisable(GL_TEXTURE_2D);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                  LOGW ("error drawing: %i", mnit_opengles_error_code);
+                  LOGW("error drawing", mnit_opengles_error_code);
                }
        `}
 
@@ -359,7 +360,7 @@ class Opengles1Display
                glDisable(GL_TEXTURE_2D);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                  LOGW ("error drawing: %i", mnit_opengles_error_code);
+                  LOGW("error drawing", mnit_opengles_error_code);
                }
        `}
 
@@ -407,7 +408,7 @@ class Opengles1Display
                glDisable(GL_TEXTURE_2D);
 
                if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
-                  LOGW ("error drawing: %i", mnit_opengles_error_code);
+                  LOGW("error drawing", mnit_opengles_error_code);
                }
        `}
 
@@ -511,15 +512,8 @@ extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
 
                if ( glCheckFramebufferStatusOES( GL_FRAMEBUFFER_OES ) != GL_FRAMEBUFFER_COMPLETE_OES )
                {
-                       LOGW( "framebuffer not set" );
-                       if ( glCheckFramebufferStatusOES( GL_FRAMEBUFFER_OES ) == GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES )
-                               LOGW( "framebuffer not set a" );
-                       else if ( glCheckFramebufferStatusOES( GL_FRAMEBUFFER_OES ) == GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES )
-                               LOGW( "framebuffer not set b" );
-                       else if ( glCheckFramebufferStatusOES( GL_FRAMEBUFFER_OES ) == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES )
-                               LOGW( "framebuffer not set c" );
-                       else if ( glCheckFramebufferStatusOES( GL_FRAMEBUFFER_OES ) == GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES )
-                               LOGW( "framebuffer not set d" );
+                       LOGW("framebuffer not set", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES));
+                       exit(1);
                }
 
                image->super.width = w;
@@ -529,7 +523,10 @@ extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
                image->super.scale = 1.0f;
                image->super.blended = 0;
 
-               if (glGetError() != GL_NO_ERROR) LOGW( "gl error");
+               if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) {
+                  LOGW("gl error in Opengles1DrawableImage::init", mnit_opengles_error_code);
+                  exit(1);
+               }
 
                return image;
        `}
@@ -537,7 +534,7 @@ extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
     fun set_as_target is extern `{
                LOGI( "sat %i", recv->fbo );
                glBindFramebufferOES(GL_FRAMEBUFFER_OES, recv->fbo);
-               if (glGetError() != GL_NO_ERROR) LOGW( "gl error 0");
+               if (glGetError() != GL_NO_ERROR) LOGW("gl error", 0);
                /*glGetIntegerv(GL_FRAMEBUFFER_BINDING_OES,&recv->fbo);
                if (glGetError() != GL_NO_ERROR) LOGW( "gl error a");*/
                glViewport(0, 0, recv->super.width, recv->super.height);
@@ -558,7 +555,7 @@ extern Opengles1DrawableImage in "C" `{struct mnit_opengles_DrawableTexture*`}
                glGenerateMipmapOES(GL_TEXTURE_2D);
                glBindTexture(GL_TEXTURE_2D, 0);*/
                glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
-               if (glGetError() != GL_NO_ERROR) LOGW( "gl error");
+               if (glGetError() != GL_NO_ERROR) LOGW("gl error", 0);
        `}
 end
 
index 63645ef..c7d4792 100644 (file)
@@ -17,7 +17,7 @@
 # Impements the services of `mnit:app` using the API from the Android ndk
 module android_app
 
-import android_opengles1
+import mnit
 import android
 
 in "C header" `{
@@ -25,6 +25,13 @@ in "C header" `{
        #include <errno.h>
        #include <android/log.h>
        #include <android_native_app_glue.h>
+
+       #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "mnit", __VA_ARGS__))
+       #ifdef DEBUG
+               #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "mnit", __VA_ARGS__))
+       #else
+               #define LOGI(...) (void)0
+       #endif
 `}
 
 in "C" `{
@@ -34,13 +41,6 @@ in "C" `{
        #include <GLES/glext.h>
        #include <errno.h>
 
-       #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "mnit", __VA_ARGS__))
-       #ifdef DEBUG
-               #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "mnit", __VA_ARGS__))
-       #else
-               #define LOGI(...) (void)0
-       #endif
-
        extern EGLDisplay mnit_display;
        extern EGLSurface mnit_surface;
        extern EGLContext mnit_context;
@@ -255,6 +255,19 @@ extern InnerAndroidMotionEvent in "C" `{AInputEvent *`}
                return (a & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
        else return -1;
        `}
+
+       private fun action: AMotionEventAction `{ return AMotionEvent_getAction(recv); `}
+end
+
+extern class AMotionEventAction `{ int32_t `}
+       protected fun action: Int `{ return recv & AMOTION_EVENT_ACTION_MASK; `}
+       fun is_down: Bool do return action == 0
+       fun is_up: Bool do return action == 1
+       fun is_move: Bool do return action == 2
+       fun is_cancel: Bool do return action == 3
+       fun is_outside: Bool do return action == 4
+       fun is_pointer_down: Bool do return action == 5
+       fun is_pointer_up: Bool do return action == 6
 end
 
 interface AndroidInputEvent
@@ -321,8 +334,13 @@ class AndroidPointerEvent
                return AMotionEvent_getPressure(motion_event, pointer_id);
        `}
 
-       redef fun pressed do return true
-       redef fun depressed do return false
+       redef fun pressed
+       do
+               var action = motion_event.inner_event.action
+               return action.is_down or action.is_move
+       end
+
+       redef fun depressed do return not pressed
 end
 
 extern AndroidKeyEvent in "C" `{AInputEvent *`}
@@ -356,7 +374,7 @@ end
 redef class Object
        # Uses Android logs for every print
        redef fun print(text: Object) is extern import Object.to_s, String.to_cstring `{
-               __android_log_print(ANDROID_LOG_INFO, "mnit print", "%s", String_to_cstring(Object_to_s(object)));
+               __android_log_print(ANDROID_LOG_INFO, "mnit print", "%s", String_to_cstring(Object_to_s(text)));
        `}
 end
 
@@ -397,7 +415,7 @@ redef class App
                return handled
        end
        
-       redef fun main_loop is extern import full_frame, save, pause, resume, gained_focus, lost_focus, init_window, term_window, extern_input_key, extern_input_motion `{
+       redef fun main_loop is extern import full_frame, generate_input `{
                LOGI("nitni loop");
                
                nit_app = recv;
@@ -407,24 +425,9 @@ redef class App
                mnit_java_app->onInputEvent = mnit_handle_input;
                
                while (1) {
-                       int ident;
-                       int events;
-                       static int block = 0;
-                       struct android_poll_source* source;
-
-                       while ((ident=ALooper_pollAll(0, NULL, &events,
-                                       (void**)&source)) >= 0) { /* first 0 is for non-blocking */ 
-
-                               // Process this event.
-                               if (source != NULL)
-                                       source->process(mnit_java_app, source);
-
-                               // Check if we are exiting.
-                               if (mnit_java_app->destroyRequested != 0) {
-                                       mnit_term_display();
-                                       return;
-                               }
-                       }
+                       App_generate_input(recv);
+
+                       if (mnit_java_app->destroyRequested != 0) return;
                        
                        if (mnit_animating == 1) {
                                mnit_frame();
@@ -434,5 +437,26 @@ redef class App
                
           /* App_exit(); // this is unreachable anyway*/
        `}
+
+       redef fun generate_input import save, pause, resume, gained_focus, lost_focus, init_window, term_window, extern_input_key, extern_input_motion `{
+               int ident;
+               int events;
+               static int block = 0;
+               struct android_poll_source* source;
+
+               while ((ident=ALooper_pollAll(0, NULL, &events,
+                               (void**)&source)) >= 0) { /* first 0 is for non-blocking */ 
+
+                       // Process this event.
+                       if (source != NULL)
+                               source->process(mnit_java_app, source);
+
+                       // Check if we are exiting.
+                       if (mnit_java_app->destroyRequested != 0) {
+                               mnit_term_display();
+                               return;
+                       }
+               }
+       `}
 end
 
index e443e39..aa28b10 100644 (file)
@@ -19,6 +19,7 @@
 module android_opengles1
 
 import mnit
+import android_app
 
 in "C" `{
        #include <android_native_app_glue.h>
@@ -36,4 +37,3 @@ redef class Opengles1Display
                }
        `}
 end
-
index 93058fc..00a037f 100644 (file)
@@ -25,15 +25,6 @@ import mnit # for
 
 import sdl
 
-in "C Header" `{
-       #define LOGW(...) ((void)fprintf(stderr, "# warn: %s", __VA_ARGS__))
-       #ifdef DEBUG
-               #define LOGI(...) ((void)fprintf(stderr, "# info: %s", __VA_ARGS__))
-       #else
-               #define LOGI(...) (void)0
-       #endif
-`}
-
 in "C" `{
        NativeWindowType mnit_window;
        EGLNativeDisplayType mnit_native_display;
@@ -102,7 +93,7 @@ redef extern Opengles1Image
 
                sdl_image = IMG_Load( String_to_cstring( path ) );
                if ( !sdl_image ) {
-                       LOGW( "SDL failed to load image <%s>: %s\n", String_to_cstring( path ), IMG_GetError() );
+                       fprintf(stderr, "SDL failed to load image <%s>: %s\n", String_to_cstring(path), IMG_GetError());
                        return NULL;
                } else {
                        opengles_image = mnit_opengles_load_image( sdl_image->pixels, sdl_image->w, sdl_image->h, sdl_image->format->Amask );
index b4d0779..a472d8f 100644 (file)
@@ -236,7 +236,12 @@ class MakefileToolchain
                        hfile.write "#include \"{hfilename}\"\n"
                        for key in f.required_declarations do
                                if not compiler.provided_declarations.has_key(key) then
-                                       print "No provided declaration for {key}"
+                                       var node = compiler.requirers_of_declarations.get_or_null(key)
+                                       if node != null then
+                                               node.debug "No provided declaration for {key}"
+                                       else
+                                               print "No provided declaration for {key}"
+                                       end
                                        abort
                                end
                                hfile.write compiler.provided_declarations[key]
@@ -422,6 +427,8 @@ abstract class AbstractCompiler
 
        private var provided_declarations = new HashMap[String, String]
 
+       private var requirers_of_declarations = new HashMap[String, ANode]
+
        # Builds the .c and .h files to be used when generating a Stack Trace
        # Binds the generated C function names to Nit function names
        fun build_c_to_nit_bindings
@@ -1071,7 +1078,11 @@ abstract class AbstractCompilerVisitor
        # Request the presence of a global declaration
        fun require_declaration(key: String)
        do
-               self.writer.file.required_declarations.add(key)
+               var reqs = self.writer.file.required_declarations
+               if reqs.has(key) then return
+               reqs.add(key)
+               var node = current_node
+               if node != null then compiler.requirers_of_declarations[key] = node
        end
 
        # Add a declaration in the local-header
@@ -2499,7 +2510,7 @@ redef class ASuperExpr
                end
 
                # stantard call-next-method
-               return v.supercall(v.frame.mpropdef.as(MMethodDef), recv.mtype.as(MClassType), args)
+               return v.supercall(mpropdef.as(not null), recv.mtype.as(MClassType), args)
        end
 end
 
index d888a32..8971696 100644 (file)
@@ -145,7 +145,8 @@ $(call import-module,android/native_app_glue)
              This will take care of integrating with our NDK code. -->
         <activity android:name="android.app.NativeActivity"
                 android:label="@string/app_name"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="orientation|keyboardHidden"
+                android:screenOrientation="portrait">
             <!-- Tell NativeActivity the name of or .so -->
             <meta-data android:name=\"{{{app_package}}}\"
                     android:value=\"{{{app_name}}}\" />
@@ -199,7 +200,7 @@ $(call import-module,android/native_app_glue)
                var assets_dir = "{mainmodule_dir}/../assets"
                if not assets_dir.file_exists then assets_dir = "{mainmodule_dir}/assets"
                if assets_dir.file_exists then
-                       assets_dir = share_dir.realpath
+                       assets_dir = assets_dir.realpath
                        var target_assets_dir = "{android_project_root}/assets"
                        if not target_assets_dir.file_exists then
                                toolcontext.exec_and_check(["ln", "-s", assets_dir, target_assets_dir])
diff --git a/src/collect_super_sends.nit b/src/collect_super_sends.nit
deleted file mode 100644 (file)
index 32bfb6a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Collect super sends
-module collect_super_sends
-
-import modelbuilder
-private import modelize_property
-private import typing
-
-private class CollectSuperSends
-       super Visitor
-       var modelbuilder: ModelBuilder
-       var res = new ArraySet[MMethodDef]
-       var mpropdef: nullable MMethodDef
-
-       # Get a new visitor on a classef to add type count in `typecount`.
-       init(modelbuilder: ModelBuilder)
-       do
-               self.modelbuilder = modelbuilder
-       end
-
-       redef fun visit(n)
-       do
-               if n isa AMethPropdef then
-                       assert mpropdef == null
-                       mpropdef = n.mpropdef
-                       n.visit_all(self)
-                       mpropdef = null
-                       return
-               end
-               n.visit_all(self)
-               if (n isa ASuperExpr and n.callsite == null) or n isa ASuperExternCall then
-                       var mprop = mpropdef
-                       assert mprop != null
-                       res.add(mprop)
-               end
-       end
-end
-
-redef class ModelBuilder
-       # Visit the AST and return all method definitions that performs a `super`.
-       fun collect_super_sends: Set[MMethodDef]
-       do
-               var visitor = new CollectSuperSends(self)
-
-               # Visit all the source code to collect data
-               for nmodule in self.nmodules do
-                       visitor.enter_visit(nmodule)
-               end
-
-               return visitor.res
-       end
-end
index 056aba4..64770df 100644 (file)
@@ -170,6 +170,15 @@ interface Metric
 
        # Pretty print the metric results in console
        fun to_console(indent: Int, colors: Bool) do
+               if values.is_empty then
+                       if colors then
+                               print "{"\t" * indent}{name}: {desc} -- nothing".green
+                       else
+                               print "{"\t" * indent}{name}: {desc} -- nothing"
+                       end
+                       return
+               end
+
                var max = self.max
                var min = self.min
                if colors then
index 96779cc..d2750ed 100644 (file)
@@ -57,6 +57,14 @@ end
 redef class MGroup
        # The loaded modules of this group
        var mmodules = new Array[MModule]
+
+       # Placebo stuff to find the owner (module with same name)
+       # null is returned if there is no owner, or if it is not loaded yet
+       fun fuzzy_owner: nullable MModule
+       do
+               for m in mmodules do if m.name == name then return m
+               return null
+       end
 end
 
 # A Nit module is usually associated with a Nit source file.
@@ -116,11 +124,18 @@ class MModule
                if mgroup != null then
                        mgroup.mmodules.add(self)
                        # placebo for old module nesting hierarchy
-                       var direct_owner = mgroup.mmodules.first
-                       if direct_owner == self and mgroup.parent != null and not mgroup.parent.mmodules.is_empty then
-                               direct_owner = mgroup.parent.mmodules.first
+                       var direct_owner = mgroup.fuzzy_owner
+                       if direct_owner == self then
+                               # The module is the new owner of its own group, thus adopt the other modules
+                               for m in mgroup.mmodules do
+                                       if m == self then continue
+                                       m.direct_owner = self
+                                       model.mmodule_nesting_hierarchy.add_edge(self, m)
+                               end
+                               # The potential owner is the the fuzzy_owner of the parent group
+                               if mgroup.parent != null then direct_owner = mgroup.parent.fuzzy_owner
                        end
-                       if direct_owner != self then
+                       if direct_owner != self and direct_owner != null then
                                self.direct_owner = direct_owner
                                model.mmodule_nesting_hierarchy.add_edge(direct_owner, self)
                        end
@@ -183,7 +198,7 @@ class MModule
                if mgroup == null then return null
                mgroup = mgroup.mproject.root
                if mgroup.mmodules.is_empty then return null
-               var res = mgroup.mmodules.first
+               var res = mgroup.fuzzy_owner
                if res == self then return null
                return res
        end
index b89e549..ba851e8 100644 (file)
@@ -216,6 +216,7 @@ class MProjectDot
                # Collect interessing nodes
                for m in model.mmodules do
                        # filter out modules outside wanted projects
+                       if m.mgroup == null then continue
                        if not mprojects.has(m.mgroup.mproject) then continue
 
                        mmodules.add(m)
index 89eb0f3..980dfc7 100644 (file)
@@ -162,6 +162,12 @@ redef class MClassDef
        private var propdef_names = new HashSet[String]
 end
 
+redef class MPropDef
+       # Does the MPropDef contains a call to super or a call of a super-constructor?
+       # Subsequent phases of the frontend (esp. typing) set it if required
+       var has_supercall: Bool writable = false
+end
+
 redef class AClassdef
        var build_properties_is_done: Bool = false
        # The list of super-constructor to call at the start of the free constructor
index 688d675..afa3fd9 100644 (file)
@@ -1598,9 +1598,8 @@ redef class ASuperExpr
                end
 
                # stantard call-next-method
-               var mpropdef = v.frame.mpropdef
+               var mpropdef = self.mpropdef
                mpropdef = mpropdef.lookup_next_definition(v.mainmodule, recv.mtype)
-               assert mpropdef isa MMethodDef
                var res = v.call_without_varargs(mpropdef, args)
                return res
        end
index 5cf389f..efe3667 100644 (file)
@@ -362,6 +362,7 @@ redef class ASuperExternCall
        do
                callback_set.supers.add( new MExplicitSuper( npropdef.mpropdef.as(not null) ) )
                callback_set.types.add( npropdef.mpropdef.mclassdef.mclass.mclass_type )
+               npropdef.mpropdef.has_supercall = true
        end
 end
 
index 00cb5b7..ff72fac 100644 (file)
@@ -598,7 +598,7 @@ redef class ASuperExpr
                        return
                end
 
-               v.analysis.add_super_send(v.receiver, v.mpropdef.as(MMethodDef))
+               v.analysis.add_super_send(v.receiver, mpropdef.as(not null))
        end
 end
 
index 4122fdd..f5dd05d 100644 (file)
@@ -18,7 +18,6 @@ module separate_compiler
 import abstract_compiler
 import layout_builders
 import rapid_type_analysis
-import collect_super_sends
 import compiler_ffi
 
 # Add separate compiler specific options
@@ -275,13 +274,27 @@ class SeparateCompiler
                        end
                end
 
+               # Collect all super calls (dead or not)
+               var all_super_calls = new HashSet[MMethodDef]
+               for mmodule in self.mainmodule.in_importation.greaters do
+                       for mclassdef in mmodule.mclassdefs do
+                               for mpropdef in mclassdef.mpropdefs do
+                                       if not mpropdef isa MMethodDef then continue
+                                       if mpropdef.has_supercall then
+                                               all_super_calls.add(mpropdef)
+                                       end
+                               end
+                       end
+               end
+
                # lookup super calls and add it to the list of mmethods to build layout with
                var super_calls
                if runtime_type_analysis != null then
                        super_calls = runtime_type_analysis.live_super_sends
                else
-                       super_calls = modelbuilder.collect_super_sends
+                       super_calls = all_super_calls
                end
+
                for mmethoddef in super_calls do
                        var mclass = mmethoddef.mclassdef.mclass
                        mmethods[mclass].add(mmethoddef)
@@ -296,14 +309,9 @@ class SeparateCompiler
                self.compile_color_consts(method_layout.pos)
 
                # attribute null color to dead supercalls
-               for mmodule in self.mainmodule.in_importation.greaters do
-                       for mclassdef in mmodule.mclassdefs do
-                               for mpropdef in mclassdef.mpropdefs do
-                                       if mpropdef.has_supercall then
-                                               compile_color_const(new_visitor, mpropdef, -1)
-                                       end
-                               end
-                       end
+               for mpropdef in all_super_calls do
+                       if super_calls.has(mpropdef) then continue
+                       compile_color_const(new_visitor, mpropdef, -1)
                end
 
                # attributes coloration
index 6838784..03df217 100644 (file)
@@ -27,11 +27,6 @@ redef class ToolContext
        var typing_phase: Phase = new TypingPhase(self, [flow_phase, modelize_property_phase, local_var_init_phase])
 end
 
-redef class MPropDef
-       # Does the MPropDef contains a call to super or a call of a super-constructor?
-       var has_supercall: Bool = false
-end
-
 private class TypingPhase
        super Phase
        redef fun process_npropdef(npropdef) do npropdef.do_typing(toolcontext.modelbuilder)
@@ -529,7 +524,7 @@ end
 
 redef class AExpr
        # The static type of the expression.
-       # null if self is a statement of in case of error
+       # null if self is a statement or in case of error
        var mtype: nullable MType = null
 
        # Is the statement correctly typed?
@@ -1425,6 +1420,10 @@ redef class ASuperExpr
        # Note: if the super is a normal call-next-method, then this attribute is null
        var callsite: nullable CallSite
 
+       # The method to call is the super is a standard `call-next-method` super-call
+       # Note: if the super is a special super-init-call, then this attribute is null
+       var mpropdef: nullable MMethodDef
+
        redef fun accept_typing(v)
        do
                var recvtype = v.nclassdef.mclassdef.bound_mtype
@@ -1453,6 +1452,7 @@ redef class ASuperExpr
                self.mtype = msignature.return_mtype
                self.is_typed = true
                v.mpropdef.has_supercall = true
+               mpropdef = v.mpropdef.as(MMethodDef)
        end
 
        private fun process_superinit(v: TypeVisitor)
index f5d9c95..7cf3e1e 100644 (file)
@@ -1 +1 @@
---no-colors --all base_simple3.nit -d $WRITE
+--no-colors --all --csv base_simple3.nit base_empty_module.nit -d $WRITE
index 287cb4c..ec635ed 100644 (file)
@@ -1,4 +1,3 @@
-Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
 *** METRICS ***
 
 # MModules metrics
@@ -16,14 +15,14 @@ Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
          min: base_simple3 (0)
          std: 0.0
        mnoc: number of child modules
-         avg: 0.0
-         max: base_simple3 (0)
-         min: base_simple3 (0)
+         avg: 1.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
          std: 0.0
        mnod: number of descendant modules
-         avg: 0.0
-         max: base_simple3 (0)
-         min: base_simple3 (0)
+         avg: 1.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
          std: 0.0
        mdit: depth in module tree
          avg: 0.0
@@ -56,7 +55,8 @@ Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
          min: base_simple3 (2)
          std: 0.0
 
- ## global metrics
+ ## project base_empty_module
+  `- group base_empty_module
        mnoa: number of ancestor modules
          avg: 0.0
          max: base_simple3 (0)
@@ -68,45 +68,97 @@ Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
          min: base_simple3 (0)
          std: 0.0
        mnoc: number of child modules
+         avg: 1.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
+         std: 0.0
+       mnod: number of descendant modules
+         avg: 1.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
+         std: 0.0
+       mdit: depth in module tree
          avg: 0.0
          max: base_simple3 (0)
          min: base_simple3 (0)
          std: 0.0
-       mnod: number of descendant modules
+       mnbi: number of introduction in module
+         avg: 4.0
+         max: base_simple3 (7)
+         min: base_empty_module (1)
+         std: 3.0
+       mnbr: number of refinement in module
+         avg: 0.0
+         max: base_simple3 (1)
+         min: base_empty_module (0)
+         std: 0.707
+       mnbcc: number of concrete class in module (intro + redef)
+         avg: 2.0
+         max: base_simple3 (4)
+         min: base_empty_module (1)
+         std: 1.581
+       mnbac: number of abstract class in module (intro + redef)
          avg: 0.0
          max: base_simple3 (0)
          min: base_simple3 (0)
          std: 0.0
+       mnbic: number of interface in module (intro + redef)
+         avg: 1.0
+         max: base_simple3 (2)
+         min: base_empty_module (0)
+         std: 1.0
+
+ ## global metrics
+       mnoa: number of ancestor modules
+         avg: 0.0
+         max: base_simple3 (0)
+         min: base_simple3 (0)
+         std: 0.0
+       mnop: number of parent modules
+         avg: 0.0
+         max: base_simple3 (0)
+         min: base_simple3 (0)
+         std: 0.0
+       mnoc: number of child modules
+         avg: 2.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
+         std: 1.0
+       mnod: number of descendant modules
+         avg: 2.0
+         max: base_simple3 (1)
+         min: base_simple3 (1)
+         std: 1.0
        mdit: depth in module tree
          avg: 0.0
          max: base_simple3 (0)
          min: base_simple3 (0)
          std: 0.0
        mnbi: number of introduction in module
-         avg: 14.0
+         avg: 8.0
          max: base_simple3 (7)
-         min: base_simple3 (7)
-         std: 7.0
+         min: base_empty_module (1)
+         std: 5.0
        mnbr: number of refinement in module
-         avg: 2.0
+         avg: 1.0
          max: base_simple3 (1)
-         min: base_simple3 (1)
-         std: 1.0
+         min: base_empty_module (0)
+         std: 0.707
        mnbcc: number of concrete class in module (intro + redef)
-         avg: 8.0
+         avg: 5.0
          max: base_simple3 (4)
-         min: base_simple3 (4)
-         std: 4.0
+         min: base_empty_module (1)
+         std: 2.915
        mnbac: number of abstract class in module (intro + redef)
          avg: 0.0
          max: base_simple3 (0)
          min: base_simple3 (0)
          std: 0.0
        mnbic: number of interface in module (intro + redef)
-         avg: 4.0
+         avg: 2.0
          max: base_simple3 (2)
-         min: base_simple3 (2)
-         std: 2.0
+         min: base_empty_module (0)
+         std: 1.414
 
 # MClasses metrics
 
@@ -153,37 +205,80 @@ Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
          min: Object (0)
          std: 1.195
 
+ ## project base_empty_module
+  `- group base_empty_module
+       cnoa: number of ancestor classes
+         avg: 0.0
+         max: Bool (1)
+         min: Object (0)
+         std: 0.866
+       cnop: number of parent classes
+         avg: 0.0
+         max: Bool (1)
+         min: Object (0)
+         std: 0.866
+       cnoc: number of child classes
+         avg: 0.0
+         max: Object (6)
+         min: Bool (0)
+         std: 2.121
+       cnod: number of descendant classes
+         avg: 0.0
+         max: Object (6)
+         min: Bool (0)
+         std: 2.121
+       cdit: depth in class tree
+         avg: 0.0
+         max: Bool (1)
+         min: Object (0)
+         std: 0.866
+       cnbip: number of introduced properties
+         avg: 2.0
+         max: C (7)
+         min: Bool (0)
+         std: 2.291
+       cnbrp: number of redefined properties
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cnbhp: number of inherited properties
+         avg: 2.0
+         max: Bool (3)
+         min: Object (0)
+         std: 1.323
+
  ## global metrics
        cnoa: number of ancestor classes
          avg: 0.0
          max: Bool (1)
          min: Object (0)
-         std: 0.926
+         std: 0.866
        cnop: number of parent classes
          avg: 0.0
          max: Bool (1)
          min: Object (0)
-         std: 0.926
+         std: 0.866
        cnoc: number of child classes
          avg: 0.0
          max: Object (6)
          min: Bool (0)
-         std: 2.268
+         std: 2.121
        cnod: number of descendant classes
          avg: 0.0
          max: Object (6)
          min: Bool (0)
-         std: 2.268
+         std: 2.121
        cdit: depth in class tree
          avg: 0.0
          max: Bool (1)
          min: Object (0)
-         std: 0.926
+         std: 0.866
        cnbip: number of introduced properties
          avg: 2.0
          max: C (7)
          min: Bool (0)
-         std: 2.42
+         std: 2.291
        cnbrp: number of redefined properties
          avg: 0.0
          max: Object (0)
@@ -193,212 +288,217 @@ Runtime error: Assert failed (../src/metrics/metrics_base.nit:223)
          avg: 2.0
          max: Bool (3)
          min: Object (0)
-         std: 1.195
+         std: 1.323
 --- Poset metrics ---
 ## Module importation hierarchy
-Number of nodes: 1
-Number of edges: 1 (1.00 per node)
-Number of direct edges: 0 (0.0 per node)
+Number of nodes: 3
+Number of edges: 5 (1.66 per node)
+Number of direct edges: 2 (0.66 per node)
 Distribution of greaters
- population: 1
+ population: 3
  minimum value: 1
- maximum value: 1
- total value: 1
- average value: 1.00
+ maximum value: 3
+ total value: 5
+ average value: 1.66
  distribution:
-  <=1: sub-population=1 (100.00%); cumulated value=1 (100.00%)
+  <=1: sub-population=2 (66.66%); cumulated value=2 (40.00%)
+  <=4: sub-population=1 (33.33%); cumulated value=3 (60.00%)
 Distribution of direct greaters
- population: 1
+ population: 3
  minimum value: 0
- maximum value: 0
- total value: 0
- average value: 0.0
+ maximum value: 2
+ total value: 2
+ average value: 0.66
  distribution:
-  <=0: sub-population=1 (100.00%); cumulated value=0 (na%)
+  <=0: sub-population=2 (66.66%); cumulated value=0 (0.0%)
+  <=2: sub-population=1 (33.33%); cumulated value=2 (100.00%)
 Distribution of smallers
- population: 1
+ population: 3
  minimum value: 1
- maximum value: 1
- total value: 1
- average value: 1.00
+ maximum value: 2
+ total value: 5
+ average value: 1.66
  distribution:
-  <=1: sub-population=1 (100.00%); cumulated value=1 (100.00%)
+  <=1: sub-population=1 (33.33%); cumulated value=1 (20.00%)
+  <=2: sub-population=2 (66.66%); cumulated value=4 (80.00%)
 Distribution of direct smallers
- population: 1
+ population: 3
  minimum value: 0
- maximum value: 0
- total value: 0
- average value: 0.0
+ maximum value: 1
+ total value: 2
+ average value: 0.66
  distribution:
-  <=0: sub-population=1 (100.00%); cumulated value=0 (na%)
+  <=0: sub-population=1 (33.33%); cumulated value=0 (0.0%)
+  <=1: sub-population=2 (66.66%); cumulated value=2 (100.00%)
 ## Classdef hierarchy
-Number of nodes: 8
-Number of edges: 22 (2.75 per node)
-Number of direct edges: 7 (0.87 per node)
+Number of nodes: 9
+Number of edges: 23 (2.55 per node)
+Number of direct edges: 7 (0.77 per node)
 Distribution of greaters
- population: 8
- minimum value: 2
+ population: 9
+ minimum value: 1
  maximum value: 3
- total value: 22
- average value: 2.75
+ total value: 23
+ average value: 2.55
  distribution:
-  <=2: sub-population=2 (25.00%); cumulated value=4 (18.18%)
-  <=4: sub-population=6 (75.00%); cumulated value=18 (81.81%)
+  <=1: sub-population=1 (11.11%); cumulated value=1 (4.34%)
+  <=2: sub-population=2 (22.22%); cumulated value=4 (17.39%)
+  <=4: sub-population=6 (66.66%); cumulated value=18 (78.26%)
 Distribution of direct greaters
- population: 8
+ population: 9
  minimum value: 0
  maximum value: 1
  total value: 7
- average value: 0.87
+ average value: 0.77
  distribution:
-  <=0: sub-population=1 (12.50%); cumulated value=0 (0.0%)
-  <=1: sub-population=7 (87.50%); cumulated value=7 (100.00%)
+  <=0: sub-population=2 (22.22%); cumulated value=0 (0.0%)
+  <=1: sub-population=7 (77.77%); cumulated value=7 (100.00%)
 Distribution of smallers
- population: 8
+ population: 9
  minimum value: 1
  maximum value: 8
- total value: 22
- average value: 2.75
+ total value: 23
+ average value: 2.55
  distribution:
-  <=1: sub-population=6 (75.00%); cumulated value=6 (27.27%)
-  <=8: sub-population=2 (25.00%); cumulated value=16 (72.72%)
+  <=1: sub-population=7 (77.77%); cumulated value=7 (30.43%)
+  <=8: sub-population=2 (22.22%); cumulated value=16 (69.56%)
 Distribution of direct smallers
- population: 8
+ population: 9
  minimum value: 0
  maximum value: 6
  total value: 7
- average value: 0.87
+ average value: 0.77
  distribution:
-  <=0: sub-population=6 (75.00%); cumulated value=0 (0.0%)
-  <=1: sub-population=1 (12.50%); cumulated value=1 (14.28%)
-  <=8: sub-population=1 (12.50%); cumulated value=6 (85.71%)
+  <=0: sub-population=7 (77.77%); cumulated value=0 (0.0%)
+  <=1: sub-population=1 (11.11%); cumulated value=1 (14.28%)
+  <=8: sub-population=1 (11.11%); cumulated value=6 (85.71%)
 ## Class hierarchy
-Number of nodes: 7
-Number of edges: 13 (1.85 per node)
-Number of direct edges: 6 (0.85 per node)
+Number of nodes: 8
+Number of edges: 14 (1.75 per node)
+Number of direct edges: 6 (0.75 per node)
 Distribution of greaters
- population: 7
+ population: 8
  minimum value: 1
  maximum value: 2
- total value: 13
- average value: 1.85
+ total value: 14
+ average value: 1.75
  distribution:
-  <=1: sub-population=1 (14.28%); cumulated value=1 (7.69%)
-  <=2: sub-population=6 (85.71%); cumulated value=12 (92.30%)
+  <=1: sub-population=2 (25.00%); cumulated value=2 (14.28%)
+  <=2: sub-population=6 (75.00%); cumulated value=12 (85.71%)
 Distribution of direct greaters
- population: 7
+ population: 8
  minimum value: 0
  maximum value: 1
  total value: 6
- average value: 0.85
+ average value: 0.75
  distribution:
-  <=0: sub-population=1 (14.28%); cumulated value=0 (0.0%)
-  <=1: sub-population=6 (85.71%); cumulated value=6 (100.00%)
+  <=0: sub-population=2 (25.00%); cumulated value=0 (0.0%)
+  <=1: sub-population=6 (75.00%); cumulated value=6 (100.00%)
 Distribution of smallers
- population: 7
+ population: 8
  minimum value: 1
  maximum value: 7
- total value: 13
- average value: 1.85
+ total value: 14
+ average value: 1.75
  distribution:
-  <=1: sub-population=6 (85.71%); cumulated value=6 (46.15%)
-  <=8: sub-population=1 (14.28%); cumulated value=7 (53.84%)
+  <=1: sub-population=7 (87.50%); cumulated value=7 (50.00%)
+  <=8: sub-population=1 (12.50%); cumulated value=7 (50.00%)
 Distribution of direct smallers
- population: 7
+ population: 8
  minimum value: 0
  maximum value: 6
  total value: 6
- average value: 0.85
+ average value: 0.75
  distribution:
-  <=0: sub-population=6 (85.71%); cumulated value=0 (0.0%)
-  <=8: sub-population=1 (14.28%); cumulated value=6 (100.00%)
+  <=0: sub-population=7 (87.50%); cumulated value=0 (0.0%)
+  <=8: sub-population=1 (12.50%); cumulated value=6 (100.00%)
 --- AST Metrics ---
 ## All nodes of the AST
  population: 47
  minimum value: 1
  maximum value: 39
- total value: 254
- average value: 5.40
+ total value: 265
+ average value: 5.63
  distribution:
-  <=1: sub-population=14 (29.78%); cumulated value=14 (5.51%)
-  <=2: sub-population=6 (12.76%); cumulated value=12 (4.72%)
-  <=4: sub-population=9 (19.14%); cumulated value=29 (11.41%)
-  <=8: sub-population=10 (21.27%); cumulated value=61 (24.01%)
-  <=16: sub-population=4 (8.51%); cumulated value=44 (17.32%)
-  <=32: sub-population=3 (6.38%); cumulated value=55 (21.65%)
-  <=64: sub-population=1 (2.12%); cumulated value=39 (15.35%)
+  <=1: sub-population=11 (23.40%); cumulated value=11 (4.15%)
+  <=2: sub-population=9 (19.14%); cumulated value=18 (6.79%)
+  <=4: sub-population=9 (19.14%); cumulated value=31 (11.69%)
+  <=8: sub-population=9 (19.14%); cumulated value=54 (20.37%)
+  <=16: sub-population=5 (10.63%); cumulated value=55 (20.75%)
+  <=32: sub-population=3 (6.38%); cumulated value=57 (21.50%)
+  <=64: sub-population=1 (2.12%); cumulated value=39 (14.71%)
  list:
-  TId: 39 (15.35%)
-  AListExprs: 19 (7.48%)
-  APublicVisibility: 18 (7.08%)
-  ACallExpr: 18 (7.08%)
-  TClassid: 15 (5.90%)
-  TNumber: 10 (3.93%)
-  AIntExpr: 10 (3.93%)
-  AType: 9 (3.54%)
-  TKwend: 8 (3.14%)
-  ASignature: 8 (3.14%)
+  TId: 39 (14.71%)
+  APublicVisibility: 20 (7.54%)
+  AListExprs: 19 (7.16%)
+  ACallExpr: 18 (6.79%)
+  TClassid: 16 (6.03%)
+  TKwend: 10 (3.77%)
+  TNumber: 10 (3.77%)
+  AIntExpr: 10 (3.77%)
+  AType: 9 (3.39%)
+  ASignature: 8 (3.01%)
   ...
-  AModule: 1 (0.39%)
-  AMainClassdef: 1 (0.39%)
-  ATopClassdef: 1 (0.39%)
-  TKwreturn: 1 (0.39%)
-  AReturnExpr: 1 (0.39%)
-  TKwinterface: 1 (0.39%)
-  ANoImport: 1 (0.39%)
-  AInterfaceClasskind: 1 (0.39%)
-  AMainMethPropdef: 1 (0.39%)
-  TKwimport: 1 (0.39%)
+  ACallAssignExpr: 1 (0.37%)
+  TKwreturn: 1 (0.37%)
+  AInternMethPropdef: 1 (0.37%)
+  ATopClassdef: 1 (0.37%)
+  AInterfaceClasskind: 1 (0.37%)
+  TKwinterface: 1 (0.37%)
+  AReturnExpr: 1 (0.37%)
+  TKwself: 1 (0.37%)
+  AMainMethPropdef: 1 (0.37%)
+  AMainClassdef: 1 (0.37%)
 ## All identifiers of the AST
  population: 19
  minimum value: 1
  maximum value: 11
- total value: 54
- average value: 2.84
+ total value: 55
+ average value: 2.89
  distribution:
-  <=1: sub-population=2 (10.52%); cumulated value=2 (3.70%)
-  <=2: sub-population=12 (63.15%); cumulated value=24 (44.44%)
-  <=4: sub-population=3 (15.78%); cumulated value=10 (18.51%)
-  <=8: sub-population=1 (5.26%); cumulated value=7 (12.96%)
-  <=16: sub-population=1 (5.26%); cumulated value=11 (20.37%)
+  <=1: sub-population=1 (5.26%); cumulated value=1 (1.81%)
+  <=2: sub-population=13 (68.42%); cumulated value=26 (47.27%)
+  <=4: sub-population=3 (15.78%); cumulated value=10 (18.18%)
+  <=8: sub-population=1 (5.26%); cumulated value=7 (12.72%)
+  <=16: sub-population=1 (5.26%); cumulated value=11 (20.00%)
  list:
-  output: 11 (20.37%)
-  Int: 7 (12.96%)
-  run: 4 (7.40%)
-  c: 3 (5.55%)
-  val: 3 (5.55%)
-  i: 2 (3.70%)
-  bar: 2 (3.70%)
-  foo: 2 (3.70%)
-  val2: 2 (3.70%)
-  val1: 2 (3.70%)
-  C: 2 (3.70%)
-  v: 2 (3.70%)
-  baz: 2 (3.70%)
-  a: 2 (3.70%)
-  A: 2 (3.70%)
-  B: 2 (3.70%)
-  b: 2 (3.70%)
-  Object: 1 (1.85%)
-  Bool: 1 (1.85%)
+  output: 11 (20.00%)
+  Int: 7 (12.72%)
+  run: 4 (7.27%)
+  c: 3 (5.45%)
+  val: 3 (5.45%)
+  i: 2 (3.63%)
+  bar: 2 (3.63%)
+  foo: 2 (3.63%)
+  val2: 2 (3.63%)
+  val1: 2 (3.63%)
+  C: 2 (3.63%)
+  v: 2 (3.63%)
+  baz: 2 (3.63%)
+  a: 2 (3.63%)
+  A: 2 (3.63%)
+  B: 2 (3.63%)
+  b: 2 (3.63%)
+  Object: 2 (3.63%)
+  Bool: 1 (1.81%)
 --- Metrics of refinement usage ---
-Number of modules: 1
+Number of modules: 3
 
-Number of classes: 7
-  Number of interface kind: 1 (14.28%)
-  Number of enum kind: 2 (28.57%)
-  Number of class kind: 4 (57.14%)
+Number of classes: 8
+  Number of interface kind: 1 (12.50%)
+  Number of enum kind: 2 (25.00%)
+  Number of class kind: 5 (62.50%)
 
-Number of class definitions: 8
-Number of refined classes: 1 (14.28%)
-Average number of class refinments by classes: 0.14
+Number of class definitions: 9
+Number of refined classes: 1 (12.50%)
+Average number of class refinments by classes: 0.12
 Average number of class refinments by refined classes: 1.00
 
-Number of properties: 19
-  Number of MAttribute: 3 (15.78%)
-  Number of MMethod: 16 (84.21%)
+Number of properties: 20
+  Number of MAttribute: 3 (15.00%)
+  Number of MMethod: 17 (85.00%)
 
-Number of property definitions: 19
+Number of property definitions: 20
 Number of redefined properties: 0 (0.0%)
 Average number of property redefinitions by property: 0.0
 Average number of property redefinitions by redefined property: na
@@ -426,23 +526,23 @@ Number of buggy sends (cannot determine the type of the receiver): 0 (0.0%)
 Total number of self: 5
 Total number of implicit self: 4 (80.00%)
 --- Construction of tables ---
-Number of runtime classes: 6 (excluding interfaces and abstract classes)
-Average number of composing class definition by runtime class: 3.00
-Total size of tables (classes and instances): 34 (not including stuff like info for subtyping or call-next-method)
-Average size of table by runtime class: 5.66
-Values never redefined: 34 (100.00%)
+Number of runtime classes: 7 (excluding interfaces and abstract classes)
+Average number of composing class definition by runtime class: 2.71
+Total size of tables (classes and instances): 35 (not including stuff like info for subtyping or call-next-method)
+Average size of table by runtime class: 5.00
+Values never redefined: 35 (100.00%)
 
 # Mendel metrics
-       large mclasses (threshold: 2.291)
+       large mclasses (threshold: 2.195)
           B: 3
           C: 3
-       budding mclasses (threshold: 0.924)
+       budding mclasses (threshold: 0.869)
           B: 1.0
           C: 1.0
-       blooming mclasses (threshold: 2.581)
+       blooming mclasses (threshold: 2.388)
           B: 3.0
           C: 3.0
-       blooming mclasses (threshold: 2.581)
+       blooming mclasses (threshold: 2.388)
           B: 3.0
           C: 3.0
 generating out/nitmetrics_args1.write/project_hierarchy.dot
@@ -528,6 +628,84 @@ generating out/nitmetrics_args1.write/module_hierarchy.dot
          min: base_simple3 (0.143)
          std: 0.0
 
+ ## project base_empty_module
+  `- group base_empty_module
+       cnoac: number of class_kind ancestor
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cnopc: number of class_kind parent
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cnocc: number of class_kind children
+         avg: 0.0
+         max: Object (4)
+         min: Bool (0)
+         std: 1.414
+       cnodc: number of class_kind descendants
+         avg: 0.0
+         max: Object (4)
+         min: Bool (0)
+         std: 1.414
+       cnopi: number of interface_kind parent
+         avg: 0.0
+         max: Bool (1)
+         min: Object (0)
+         std: 0.866
+       cnoci: number of interface_kind children
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cnodi: number of interface_kind descendants
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cditc: depth in class tree following only class, abstract, extern kind
+         avg: 0.0
+         max: Object (0)
+         min: Object (0)
+         std: 0.0
+       cditi: depth in class tree following only interface_kind
+         avg: 0.0
+         max: Bool (1)
+         min: Object (0)
+         std: 0.866
+       mdui: proportion of mclass defined using inheritance (has other parent than Object)
+         avg: 0.0
+         max: base_simple3 (0.0)
+         min: base_simple3 (0.0)
+         std: 0.0
+       mduic: proportion of class_kind defined using inheritance
+         avg: 0.0
+         max: base_simple3 (0.0)
+         min: base_simple3 (0.0)
+         std: 0.0
+       mduii: proportion of interface_kind defined using inheritance
+         avg: 0.0
+         max: base_simple3 (0.0)
+         min: base_simple3 (0.0)
+         std: 0.0
+       mif: proportion of mclass inherited from
+         avg: 0.071
+         max: base_simple3 (0.143)
+         min: base_empty_module (0.0)
+         std: 0.071
+       mifc: proportion of class_kind inherited from
+         avg: 0.0
+         max: base_simple3 (0.0)
+         min: base_simple3 (0.0)
+         std: 0.0
+       mifi: proportion of interface_kind inherited from
+         avg: 0.071
+         max: base_simple3 (0.143)
+         min: base_empty_module (0.0)
+         std: 0.071
+
  ## global metrics
        cnoac: number of class_kind ancestor
          avg: 0.0
@@ -543,17 +721,17 @@ generating out/nitmetrics_args1.write/module_hierarchy.dot
          avg: 1.0
          max: Object (4)
          min: Bool (0)
-         std: 1.464
+         std: 1.414
        cnodc: number of class_kind descendants
          avg: 1.0
          max: Object (4)
          min: Bool (0)
-         std: 1.464
+         std: 1.414
        cnopi: number of interface_kind parent
          avg: 1.0
          max: Bool (1)
          min: Object (0)
-         std: 0.378
+         std: 0.5
        cnoci: number of interface_kind children
          avg: 0.0
          max: Object (0)
@@ -573,7 +751,7 @@ generating out/nitmetrics_args1.write/module_hierarchy.dot
          avg: 1.0
          max: Bool (1)
          min: Object (0)
-         std: 0.378
+         std: 0.5
        mdui: proportion of mclass defined using inheritance (has other parent than Object)
          avg: 0.0
          max: base_simple3 (0.0)
@@ -590,58 +768,58 @@ generating out/nitmetrics_args1.write/module_hierarchy.dot
          min: base_simple3 (0.0)
          std: 0.0
        mif: proportion of mclass inherited from
-         avg: 0.143
+         avg: 0.071
          max: base_simple3 (0.143)
-         min: base_simple3 (0.143)
-         std: 0.0
+         min: base_empty_module (0.0)
+         std: 0.071
        mifc: proportion of class_kind inherited from
          avg: 0.0
          max: base_simple3 (0.0)
          min: base_simple3 (0.0)
          std: 0.0
        mifi: proportion of interface_kind inherited from
-         avg: 0.143
+         avg: 0.071
          max: base_simple3 (0.143)
-         min: base_simple3 (0.143)
-         std: 0.0
+         min: base_empty_module (0.0)
+         std: 0.071
 
 # RTA metrics
 
  ## Live instances by mainmodules
        mnlc: number of live mclasses in a mmodule
          avg: 6.0
-         max: base_simple3 (6)
-         min: base_simple3 (6)
+         max: <main> (6)
+         min: <main> (6)
          std: 0.0
        mnlt: number of live mtypes in a mmodule
          avg: 6.0
-         max: base_simple3 (6)
-         min: base_simple3 (6)
+         max: <main> (6)
+         min: <main> (6)
          std: 0.0
        mnct: number of live cast mtypes in a mmodule
          avg: 0.0
-         max: base_simple3 (0)
-         min: base_simple3 (0)
+         max: <main> (0)
+         min: <main> (0)
          std: 0.0
        mnli: number of live instances in a mmodule
          avg: 17.0
-         max: base_simple3 (17)
-         min: base_simple3 (17)
+         max: <main> (17)
+         min: <main> (17)
          std: 0.0
        mnlm: number of live methods in a mmodule
          avg: 14.0
-         max: base_simple3 (14)
-         min: base_simple3 (14)
+         max: <main> (14)
+         min: <main> (14)
          std: 0.0
        mnlmd: number of live method definitions in a mmodule
          avg: 14.0
-         max: base_simple3 (14)
-         min: base_simple3 (14)
+         max: <main> (14)
+         min: <main> (14)
          std: 0.0
        mnldd: number of dead method definitions in a mmodule
          avg: 0.0
-         max: base_simple3 (0)
-         min: base_simple3 (0)
+         max: <main> (0)
+         min: <main> (0)
          std: 0.0
 
  ## Total live instances by mclasses
@@ -650,6 +828,27 @@ generating out/nitmetrics_args1.write/module_hierarchy.dot
          max: Int (12)
          min: Sys (1)
          std: 4.183
+       cnlc: number of live cast for a mclass type -- nothing
+
+ ## Total live instances by mtypes
+       tnli: number of live instances for a mtype
+         avg: 2.0
+         max: Int (12)
+         min: Sys (1)
+         std: 4.183
+       tnlc: number of live casts to a mtype -- nothing
+
+ ## MType complexity
+       tags: arity of generic signature
+         avg: 0.0
+         max: Sys (0)
+         min: Sys (0)
+         std: 0.0
+       tdos: depth of generic signature
+         avg: 0.0
+         max: Sys (0)
+         min: Sys (0)
+         std: 0.0
 class_hierarchy.dot
 classdef_hierarchy.dot
 inheritance/
index 7f291d0..87e4db1 100755 (executable)
@@ -451,6 +451,13 @@ END
                                        # Sould we skip the input for this engine?
                                        need_skip $bff "  $name" $pack && continue
 
+                                       # use a specific inputs file, if required
+                                       if [ -f "$bff.inputs" ]; then
+                                               ffinputs="$bff.inputs"
+                                       else
+                                               ffinputs=$inputs
+                                       fi
+
                                        rm -rf "$fff.res" "$fff.err" "$fff.write" 2> /dev/null
                                        if [ "x$verbose" = "xtrue" ]; then
                                                echo ""
@@ -459,7 +466,7 @@ END
                                        test -z "$tap" && echo -n "==> $name "
                                        echo "./$ff.bin $args" > "./$fff.bin"
                                        chmod +x "./$fff.bin"
-                                       WRITE="$fff.write" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $inputs > $fff.res 2>$fff.err"
+                                       WRITE="$fff.write" sh -c "NIT_NO_STACK=1 $TIMEOUT ./$fff.bin < $ffinputs > $fff.res 2>$fff.err"
                                        if [ "x$verbose" = "xtrue" ]; then
                                                cat "$fff.res"
                                                cat >&2 "$fff.err"