logo       
Google Custom Search
    AddThis Social Bookmark Button

r9930 - in trunk/src: common/io/streams common/system/locators d2c/compiler: msg#00016

Subject: r9930 - in trunk/src: common/io/streams common/system/locators d2c/compiler/front d2c/compiler/optimize d2c/runtime/dylan
Author: housel
Date: Mon Aug 29 22:42:18 2005
New Revision: 9930

Modified:
   trunk/src/common/io/streams/native-speed.dylan
   trunk/src/common/system/locators/utilities.dylan
   trunk/src/d2c/compiler/front/fer-builder.dylan
   trunk/src/d2c/compiler/front/front-exports.dylan
   trunk/src/d2c/compiler/front/front.dylan
   trunk/src/d2c/compiler/front/primitives.dylan
   trunk/src/d2c/compiler/optimize/callopt.dylan
   trunk/src/d2c/compiler/optimize/primopt.dylan
   trunk/src/d2c/runtime/dylan/macros.dylan
Log:
Bug: 7191
Properly implement copy-down-method-definer.

* d2c/compiler/front/front-exports.dylan (front): Export want-inline?.

* d2c/compiler/front/front.dylan (<general-call>): Add a want-inline? slot,
  indicating that the call should be inlined if at all possible.

* d2c/compiler/front/fer-builder.dylan (make-unknown-call): Allow callers
  to specify the want-inline: keyword.

* d2c/compiler/front/primitives.dylan: Add a new #"inline-unknown-call"
  primitive.

* d2c/compiler/optimize/primopt.dylan
  (#"inline-unknown-call" primitive transformer): Expand the
  #"inline-unknown-call" into an <unknown-call> operation with
  want-inline: set.

* d2c/compiler/optimize/callopt.dylan
  (optimize, optimize-generic, convert-to-known-call): Preserve want-inline?
  when the type of call operation is changed.
  (inlining-candidate?): Return the inline function literal if the function
  call wants inlining to occur.
  (expand-next-method-call-ref): Take the call to optimize as a
  parameter instead of its dependencies, so that the want-inline? slot value
  can be preserved.
  (optimize-general-call-leaf): Adapt for the change in signature of
  the expand-next-method-call-ref() function.

* d2c/runtime/dylan/macros.dylan (copy-down-method-definer): Properly parse
  the parameter list so that the #next parameter is inserted after the fixed
  parameters and before any #key or #rest parameters.  Implement the body of
  the copy-down method as %%primitive(inline-unknown-call, next-method).

* common/io/streams/native-speed.dylan (copy-down-stream-definer): Restore
  commented-out invocations of copy-down-method-definer.

* common/system/locators/utilities.dylan (parse-path): Restore
  commented-out invocations of copy-down-method-definer.


Modified: trunk/src/common/io/streams/native-speed.dylan
==============================================================================
--- trunk/src/common/io/streams/native-speed.dylan      (original)
+++ trunk/src/common/io/streams/native-speed.dylan      Mon Aug 29 22:42:18 2005
@@ -27,7 +27,7 @@
         define sealed domain peek (?name);
         define sealed domain read (?name, <integer>);
         define sealed domain read-into!(?name, <integer>, ?seq);
-/*
+
         define sealed copy-down-method write-element
           (stream :: ?name, elt :: ?elt) => ();
 
@@ -71,9 +71,7 @@
         define sealed copy-down-method read-text-into!
             (stream :: ?name, n :: <integer>, seq :: ?seq,
              #key start :: <integer> = 0, on-end-of-stream = unsupplied())
-         => (n-read)
-*/
-                      }
+         => (n-read) }
 end macro;
 
 define copy-down-stream <byte-string-stream> 

Modified: trunk/src/common/system/locators/utilities.dylan
==============================================================================
--- trunk/src/common/system/locators/utilities.dylan    (original)
+++ trunk/src/common/system/locators/utilities.dylan    Mon Aug 29 22:42:18 2005
@@ -135,7 +135,6 @@
 end method parse-path;
 
 //---*** It is a pity that we need this for efficiency...
-/*
 define sealed copy-down-method parse-path
     (string :: <byte-string>,
      #key start :: <integer> = 0,
@@ -143,7 +142,6 @@
           test :: <function> = curry(\==, $default-path-separator),
           separators :: <sequence> = #[])
  => (path :: <simple-object-vector>, relative? :: <boolean>);
-*/
 
 define method path-to-string
     (path :: <sequence>,

Modified: trunk/src/d2c/compiler/front/fer-builder.dylan
==============================================================================
--- trunk/src/d2c/compiler/front/fer-builder.dylan      (original)
+++ trunk/src/d2c/compiler/front/fer-builder.dylan      Mon Aug 29 22:42:18 2005
@@ -458,7 +458,8 @@
 define method make-unknown-call
     (builder :: <fer-builder>, function :: <leaf>,
      next-method-info :: false-or(<leaf>), arguments :: <list>,
-     #key ct-source-location :: false-or(<literal-constant>))
+     #key ct-source-location :: false-or(<literal-constant>),
+          want-inline :: <boolean>)
     => res :: <operation>;
   let operands = pair(function,
                      if (next-method-info)
@@ -468,7 +469,8 @@
                      end);
   make-operation(builder, <unknown-call>, operands,
                  use-generic-entry: next-method-info & #t,
-                 ct-source-location: ct-source-location);
+                 ct-source-location: ct-source-location,
+                 want-inline: want-inline);
 end;
 
 

Modified: trunk/src/d2c/compiler/front/front-exports.dylan
==============================================================================
--- trunk/src/d2c/compiler/front/front-exports.dylan    (original)
+++ trunk/src/d2c/compiler/front/front-exports.dylan    Mon Aug 29 22:42:18 2005
@@ -124,7 +124,8 @@
     <let-assignment>, let-next, <set-assignment>,
 
     <abstract-call>, <known-call>, <error-call>, <delayed-optimization-call>,
-    <general-call>, use-generic-entry?, ct-source-location, <unknown-call>, 
<mv-call>,
+    <general-call>, use-generic-entry?, want-inline?, ct-source-location,
+    <unknown-call>, <mv-call>,
     <primitive>, primitive-name, primitive-info,
     <prologue>, function, function-setter,
     preferred-names, preferred-names-setter,

Modified: trunk/src/d2c/compiler/front/front.dylan
==============================================================================
--- trunk/src/d2c/compiler/front/front.dylan    (original)
+++ trunk/src/d2c/compiler/front/front.dylan    Mon Aug 29 22:42:18 2005
@@ -157,6 +157,8 @@
 define abstract class <general-call> (<abstract-call>)
   constant slot use-generic-entry? :: <boolean>,
     required-init-keyword: use-generic-entry:;
+  constant slot want-inline? :: <boolean>,
+    init-value: #f, init-keyword: want-inline:;
 end;
 
 // An arbitrary function call where the function call might be computed and the

Modified: trunk/src/d2c/compiler/front/primitives.dylan
==============================================================================
--- trunk/src/d2c/compiler/front/primitives.dylan       (original)
+++ trunk/src/d2c/compiler/front/primitives.dylan       Mon Aug 29 22:42:18 2005
@@ -196,6 +196,11 @@
    #(values:, rest:, #"<object>"));
 
 define-primitive
+  (#"inline-unknown-call", #(#(union:, #"<false>", #"<function>"),
+                             rest:, #"<object>"),
+   #(values:, rest:, #"<object>"));
+
+define-primitive
   (#"invoke-generic-entry", #(#"<method>", #"<list>", #"cluster"),
    #(values:, rest:, #"<object>"));
 

Modified: trunk/src/d2c/compiler/optimize/callopt.dylan
==============================================================================
--- trunk/src/d2c/compiler/optimize/callopt.dylan       (original)
+++ trunk/src/d2c/compiler/optimize/callopt.dylan       Mon Aug 29 22:42:18 2005
@@ -57,7 +57,8 @@
       end;
   if (maybe-expand-cluster(component, cluster))
     change-call-kind(component, call, <unknown-call>,
-                    use-generic-entry: call.use-generic-entry?);
+                    use-generic-entry: call.use-generic-entry?,
+                     want-inline: call.want-inline?);
   else
     optimize-general-call-leaf(component, call, call.depends-on.source-exp);
   end if;
@@ -107,7 +108,7 @@
        & func.primitive-name == #"make-next-method")
     assert(~call.use-generic-entry?);
     expand-next-method-call-ref
-      (component, call.dependents,
+      (component, call,
        select (call by instance?)
         <unknown-call> =>
           listify-dependencies(call.depends-on.dependent-next);
@@ -765,7 +766,8 @@
          let cluster = call.depends-on.dependent-next.source-exp;
          let new-call = make-operation(builder, <mv-call>,
                                        list(new-func, next-leaf, cluster),
-                                       use-generic-entry: #t);
+                                       use-generic-entry: #t,
+                                        want-inline: call.want-inline?);
          replace-expression(component, call.dependents, new-call);
        end unless;
 
@@ -1024,10 +1026,8 @@
   select (defn.method-defn-inline-type)
     #"not-inline" =>
       #f;
-    #"default-inline" =>
-      #f;
-    #"may-inline" =>
-      #f;
+    #"default-inline", #"may-inline" =>
+      call.want-inline? & defn.method-defn-inline-function;
     #"inline", #"inline-only" =>
       defn.method-defn-inline-function;
   end select;
@@ -1521,7 +1521,8 @@
   // Replace the call.
   replace-expression
     (component, call.dependents,
-     make-operation(builder, <known-call>, as(<list>, args)));
+     make-operation(builder, <known-call>, as(<list>, args),
+                    want-inline: call.want-inline?));
 end method convert-to-known-call;
     
 
@@ -1952,10 +1953,11 @@
 // next-method invocation magic.
 
 define method expand-next-method-call-ref
-    (component :: <component>, dep :: <dependency>,
+    (component :: <component>, call :: <general-call>,
      new-args :: type-union(<list>, <abstract-variable>),
      next-method-maker :: <primitive>)
     => ();
+  let dep :: <dependency> = call.dependents;
   let builder = make-builder(component);
   let assign = dep.dependent;
   let source = assign.source-location;
@@ -2078,7 +2080,8 @@
          make-operation
            (builder, <mv-call>,
             list(func-leaf, remaining-infos-leaf, cluster),
-            use-generic-entry: #t);
+            use-generic-entry: #t,
+             want-inline: call.want-inline?);
 
        else
          //
@@ -2087,7 +2090,8 @@
          make-operation
            (builder, <mv-call>,
             list(func-leaf, remaining-infos-leaf, new-args),
-            use-generic-entry: #t);
+            use-generic-entry: #t,
+             want-inline: call.want-inline?);
 
        end if;
       else
@@ -2107,10 +2111,12 @@
          make-operation
            (builder, <mv-call>,
             list(func-leaf, remaining-infos-leaf, cluster),
-            use-generic-entry: #t);
+            use-generic-entry: #t,
+             want-inline: call.want-inline?);
        else
          make-unknown-call
-           (builder, func-leaf, remaining-infos-leaf, new-args);
+           (builder, func-leaf, remaining-infos-leaf, new-args,
+             want-inline: call.want-inline?);
        end if;
       end if;
   

Modified: trunk/src/d2c/compiler/optimize/primopt.dylan
==============================================================================
--- trunk/src/d2c/compiler/optimize/primopt.dylan       (original)
+++ trunk/src/d2c/compiler/optimize/primopt.dylan       Mon Aug 29 22:42:18 2005
@@ -72,6 +72,17 @@
    end method);
 
 define-primitive-transformer
+  (#"inline-unknown-call",
+   method (component :: <component>, primitive :: <primitive>) => ();
+     let dep = primitive.depends-on;
+     replace-expression
+       (component, primitive.dependents,
+        make-unknown-call(make-builder(component), dep.source-exp, #f,
+                          listify-dependencies(dep.dependent-next),
+                          want-inline: #t));
+   end method);
+
+define-primitive-transformer
   (#"invoke-generic-entry",
    method (component :: <component>, primitive :: <primitive>) => ();
      replace-expression

Modified: trunk/src/d2c/runtime/dylan/macros.dylan
==============================================================================
--- trunk/src/d2c/runtime/dylan/macros.dylan    (original)
+++ trunk/src/d2c/runtime/dylan/macros.dylan    Mon Aug 29 22:42:18 2005
@@ -590,9 +590,14 @@
 
 define macro copy-down-method-definer
     { define ?adjectives:* copy-down-method ?:name ( ?params:* ) ?rest:* }
-      => { define ?adjectives method ?name ( ?params, #next next-method ) ?rest
-             next-method()
-         end }
+      => { define ?adjectives method ?name ( ?params ) ?rest
+             %%primitive(inline-unknown-call, next-method);
+           end }
+
+  params:
+    { } => { #next next-method }
+    { ?:variable, ... } => { ?variable, ... }
+    { ?other:* } => { #next next-method, ?other }
 
   adjectives:
     { } => { }
-- 
Gd-chatter mailing list
Gd-chatter@xxxxxxxxxxxxxxxx
https://gauss.gwydiondylan.org/mailman/listinfo/gd-chatter




Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>