sepcomp: shortcut an inline most intern methods of Object
authorJean Privat <jean@pryen.org>
Fri, 27 Feb 2015 14:02:54 +0000 (21:02 +0700)
committerJean Privat <jean@pryen.org>
Fri, 27 Feb 2015 14:02:54 +0000 (21:02 +0700)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/separate_compiler.nit

index 4321eb0..a33c098 100644 (file)
@@ -1163,6 +1163,12 @@ class SeparateCompilerVisitor
                                return direct_call(tgs.first, args)
                        end
                end
+               # Shortcut intern methods as they are not usually redefinable
+               if callsite.mpropdef.is_intern and callsite.mproperty.name != "object_id" then
+                       # `object_id` is the only redefined intern method, so it can not be directly called.
+                       # TODO find a less ugly approach?
+                       return direct_call(callsite.mpropdef, args)
+               end
                return super
        end