swarm-support
[Top][All Lists]
Advanced

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

Re: fewer Objective C messages within Swarm


From: Marcus G. Daniels
Subject: Re: fewer Objective C messages within Swarm
Date: 07 Jul 2001 19:06:12 -0600
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7

>>>>> "PJ" == pauljohn  <address@hidden> writes:

PJ> Question: Do you also have a patch for gcc 3.0 which makes the
PJ> compile/runtime warnings about objc_mesg_whatever go away?

Attached.

PJ> Question 2: How do you cut down the number of messages as you
PJ> describe below?

The implementation of every method is associated with a C function.
This is the the function that methodFor: returns.  The GCC patch I posted
makes it so these functions are global instead of local.  Thus, it is
easier to use them than having to do dozens of IMP ivars and methodFor:
lookups during initialization.

PJ> Question 3: Does this affect performace of models written in
PJ> objective C?

Yes.  It depends on how many Schedules and Swarms you have.  The more you
have the more Swarm ends up dispatching methods and the bigger difference
it makes.  In my experiments it ranged from 2% to 20%.

Here's an updated `class name' patch for GCC 3.0.  It includes the tweak
to tolerate long doubles, too.

*** objc-act.c-original Sat Jul  7 17:51:43 2001
--- objc-act.c  Sat Jul  7 18:37:36 2001
***************
*** 6807,6813 ****
        if (TYPE_MODE (type) == SFmode)
        obstack_1grow (&util_obstack, 'f');
        else if (TYPE_MODE (type) == DFmode
!              || TYPE_MODE (type) == TFmode)
        obstack_1grow (&util_obstack, 'd');
      }
  
--- 6807,6813 ----
        if (TYPE_MODE (type) == SFmode)
        obstack_1grow (&util_obstack, 'f');
        else if (TYPE_MODE (type) == DFmode
!              || TYPE_MODE (type) == TFmode || TYPE_MODE (type) == XFmode)
        obstack_1grow (&util_obstack, 'd');
      }
  
***************
*** 8362,8367 ****
--- 8362,8391 ----
        pushdecl (decl);
        rest_of_decl_compilation (decl, 0, 0, 0);
  
+ #if 1
+       {
+         char *string_ref = (char *) alloca (strlen (string) + 5);
+         tree refdecl;
+ 
+         sprintf (string_ref, "%s_ref", string);
+ 
+         refdecl = build_decl (VAR_DECL,
+                               get_identifier (string_ref),
+                               const_ptr_type_node);
+ 
+         TREE_PUBLIC (refdecl) = 0;
+         TREE_STATIC (refdecl) = 1;
+         TREE_READONLY (refdecl) = 1;
+         TREE_CONSTANT (refdecl) = 1;
+         DECL_CONTEXT (refdecl) = NULL_TREE;
+         DECL_ARTIFICIAL (refdecl) = 1;
+         exp = build1 (ADDR_EXPR, string_type_node, decl);
+         DECL_INITIAL (refdecl) = exp;
+ 
+         make_decl_rtl (refdecl, 0);
+         assemble_variable (refdecl, 1, 0, 0);
+       }
+ #else  
  #ifdef __hpux__
        /* Put the decl in the variable section.  It may need relocation.  */
        variable_section (decl, 1);
***************
*** 8380,8385 ****
--- 8404,8410 ----
  
        /* Output a constant to reference this address.  */
        output_constant (exp, int_size_in_bytes (string_type_node));
+ #endif
      }
    else
      {
***************
*** 8419,8424 ****
--- 8444,8450 ----
  
        else
        {
+ #if 0
          sprintf (string, "%sobjc_class_name_%s",
                   (flag_next_runtime ? "." : "__"), class_name);
  #ifdef __hpux__
***************
*** 8426,8431 ****
--- 8452,8475 ----
  #endif
          assemble_global (string);
          assemble_label (string);
+ #else
+           tree decl;
+           sprintf (string, "%sobjc_class_name_%s",
+                    (flag_next_runtime ? "." : "__"), class_name);
+ 
+           decl = build_decl (VAR_DECL,
+                              get_identifier (string),
+                              integer_type_node);
+ 
+           TREE_PUBLIC (decl) = 1;
+           TREE_READONLY (decl) = 1;
+           TREE_CONSTANT (decl) = 1;
+           DECL_CONTEXT (decl) = 0;
+           DECL_SIZE (decl) = 1;
+           DECL_ARTIFICIAL (decl) = 1;
+           make_decl_rtl (decl, 0);
+           assemble_variable (decl, 1, 0, 0); 
+ #endif
        }
      }
  
***************
*** 8455,8460 ****
--- 8499,8505 ----
  
        else
        {
+ #if 0
          sprintf (string, "%sobjc_category_name_%s_%s",
                   (flag_next_runtime ? "." : "__"),
                   class_name, class_super_name);
***************
*** 8463,8468 ****
--- 8508,8534 ----
  #endif
          assemble_global (string);
          assemble_label (string);
+ #else
+           tree decl;
+ 
+           sprintf (string, "%sobjc_category_name_%s_%s",
+                    (flag_next_runtime ? "." : "__"),
+                    class_name, class_super_name);
+ 
+           decl = build_decl (VAR_DECL,
+                              get_identifier (string),
+                              integer_type_node);
+ 
+           TREE_PUBLIC (decl) = 1;
+           TREE_READONLY (decl) = 1;
+           TREE_CONSTANT (decl) = 1;
+           DECL_CONTEXT (decl) = 0;
+         DECL_SIZE (decl) = 1;
+           DECL_ARTIFICIAL (decl) = 1;
+ 
+           make_decl_rtl (decl, 0);
+           assemble_variable (decl, 1, 0, 0);
+ #endif
        }
      }
  }

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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