lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [29/34] git commit: refs/heads/master - Cache some IVARS symbols within CFCClass.
Date Wed, 17 Jul 2013 14:12:49 GMT
Cache some IVARS symbols within CFCClass.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/a266a932
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/a266a932
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/a266a932

Branch: refs/heads/master
Commit: a266a932eff495fb2bab9f96406dca3be04ac339
Parents: bef4852
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Sat Jul 13 16:16:48 2013 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Tue Jul 16 16:08:44 2013 -0700

----------------------------------------------------------------------
 clownfish/compiler/src/CFCBindClass.c |  6 ++--
 clownfish/compiler/src/CFCClass.c     | 47 +++++++++++++++++++++++-------
 clownfish/compiler/src/CFCClass.h     | 25 ++++++++++++++--
 3 files changed, 62 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a266a932/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index 452b58f..e63b9d4 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -154,8 +154,8 @@ S_to_c_header_inert(CFCBindClass *self) {
 static char*
 S_ivars_hack(CFCBindClass *self) {
     const char *full_struct = CFCClass_full_struct_sym(self->client);
-    const char *full_ivars  = CFCClass_full_ivars_name(self->client);
-    const char *short_ivars = CFCClass_short_ivars_name(self->client);
+    const char *full_ivars  = CFCClass_full_ivars_struct(self->client);
+    const char *short_ivars = CFCClass_short_ivars_struct(self->client);
     const char *prefix      = CFCClass_get_prefix(self->client);
     const char *PREFIX      = CFCClass_get_PREFIX(self->client);
     const char *class_cnick = CFCClass_get_cnick(self->client);
@@ -367,7 +367,7 @@ S_struct_definition(CFCBindClass *self) {
         struct_sym = CFCClass_full_struct_sym(self->client);
     }
     else {
-        struct_sym = CFCClass_full_ivars_name(self->client);
+        struct_sym = CFCClass_full_ivars_struct(self->client);
     }
 
     CFCVariable **member_vars = CFCClass_member_vars(self->client);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a266a932/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index 790fd72..ea316cf 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -77,8 +77,11 @@ struct CFCClass {
     int is_inert;
     char *struct_sym;
     char *full_struct_sym;
-    char *ivars_name;
-    char *full_ivars_name;
+    char *ivars_struct;
+    char *full_ivars_struct;
+    char *ivars_func;
+    char *full_ivars_func;
+    char *full_ivars_offset;
     char *short_vtable_var;
     char *full_vtable_var;
     char *privacy_symbol;
@@ -175,9 +178,13 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
         self->short_vtable_var[i] = toupper(self->struct_sym[i]);
     }
     self->short_vtable_var[struct_sym_len] = '\0';
-    self->full_struct_sym = CFCUtil_sprintf("%s%s", prefix, self->struct_sym);
-    self->ivars_name      = CFCUtil_sprintf("%sIVARS", self->struct_sym);
-    self->full_ivars_name = CFCUtil_sprintf("%sIVARS", self->full_struct_sym);
+    self->full_struct_sym   = CFCUtil_sprintf("%s%s", prefix, self->struct_sym);
+    self->ivars_struct      = CFCUtil_sprintf("%sIVARS", self->struct_sym);
+    self->full_ivars_struct = CFCUtil_sprintf("%sIVARS", self->full_struct_sym);
+    self->ivars_func        = CFCUtil_sprintf("%s_IVARS", CFCClass_get_cnick(self));
+    self->full_ivars_func   = CFCUtil_sprintf("%s%s_IVARS", prefix,
+                                              CFCClass_get_cnick(self));
+    self->full_ivars_offset = CFCUtil_sprintf("%s_OFFSET", self->full_ivars_func);
     size_t full_struct_sym_len = strlen(self->full_struct_sym);
     self->full_vtable_var = (char*)MALLOCATE(full_struct_sym_len + 1);
     for (i = 0; self->full_struct_sym[i] != '\0'; i++) {
@@ -254,8 +261,11 @@ CFCClass_destroy(CFCClass *self) {
     FREEMEM(self->autocode);
     FREEMEM(self->parent_class_name);
     FREEMEM(self->struct_sym);
-    FREEMEM(self->ivars_name);
-    FREEMEM(self->full_ivars_name);
+    FREEMEM(self->ivars_struct);
+    FREEMEM(self->full_ivars_struct);
+    FREEMEM(self->ivars_func);
+    FREEMEM(self->full_ivars_func);
+    FREEMEM(self->full_ivars_offset);
     FREEMEM(self->short_vtable_var);
     FREEMEM(self->full_struct_sym);
     FREEMEM(self->full_vtable_var);
@@ -829,13 +839,28 @@ CFCClass_full_struct_sym(CFCClass *self) {
 }
 
 const char*
-CFCClass_short_ivars_name(CFCClass *self) {
-    return self->ivars_name;
+CFCClass_short_ivars_struct(CFCClass *self) {
+    return self->ivars_struct;
 }
 
 const char*
-CFCClass_full_ivars_name(CFCClass *self) {
-    return self->full_ivars_name;
+CFCClass_full_ivars_struct(CFCClass *self) {
+    return self->full_ivars_struct;
+}
+
+const char*
+CFCClass_short_ivars_func(CFCClass *self) {
+    return self->ivars_func;
+}
+
+const char*
+CFCClass_full_ivars_func(CFCClass *self) {
+    return self->full_ivars_func;
+}
+
+const char*
+CFCClass_full_ivars_offset(CFCClass *self) {
+    return self->full_ivars_offset;
 }
 
 const char*

http://git-wip-us.apache.org/repos/asf/lucy/blob/a266a932/clownfish/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.h b/clownfish/compiler/src/CFCClass.h
index d45e883..3d4d680 100644
--- a/clownfish/compiler/src/CFCClass.h
+++ b/clownfish/compiler/src/CFCClass.h
@@ -246,11 +246,32 @@ CFCClass_get_struct_sym(CFCClass *self);
 const char*
 CFCClass_full_struct_sym(CFCClass *self);
 
+/** IVARS struct name, not including parcel prefix.
+ */
+const char*
+CFCClass_short_ivars_struct(CFCClass *self);
+
+/** Fully qualified IVARS struct name including parcel prefix.
+ */
 const char*
-CFCClass_short_ivars_name(CFCClass *self);
+CFCClass_full_ivars_struct(CFCClass *self);
 
+/** Name of the function used to access IVARS, not including parcel prefix.
+ */
+const char*
+CFCClass_short_ivars_func(CFCClass *self);
+
+/** Fully qualified name of the function used to access IVARS including parcel
+ * prefix.
+ */
+const char*
+CFCClass_full_ivars_func(CFCClass *self);
+
+/** Fully qualified name of the offset variable at which the IVARS may be
+ * found, including parcel prefix.
+ */
 const char*
-CFCClass_full_ivars_name(CFCClass *self);
+CFCClass_full_ivars_offset(CFCClass *self);
 
 /** The short name of the global VTable object for this class.
  */


Mime
View raw message