You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/02 17:22:04 UTC

[3/3] git commit: Rename Class ivar 'method_ptrs' to 'vtable'

Rename Class ivar 'method_ptrs' to 'vtable'


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

Branch: refs/heads/rename-vtable
Commit: b8579190715c14d36c8e5ef6fc05a9994c295be0
Parents: 0c8e0f1
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 2 17:19:47 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Jul 2 17:19:47 2014 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/Class.c   | 9 +++++----
 runtime/core/Clownfish/Class.cfh | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b8579190/runtime/core/Clownfish/Class.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c
index 70fd483..4bfaad9 100644
--- a/runtime/core/Clownfish/Class.c
+++ b/runtime/core/Clownfish/Class.c
@@ -87,7 +87,7 @@ Class_bootstrap(const ClassSpec *specs, size_t num_specs)
 
         size_t novel_offset = parent
                               ? parent->class_alloc_size
-                              : offsetof(Class, method_ptrs);
+                              : offsetof(Class, vtable);
         size_t class_alloc_size = novel_offset
                                   + spec->num_novel_meths
                                     * sizeof(cfish_method_t);
@@ -100,9 +100,10 @@ Class_bootstrap(const ClassSpec *specs, size_t num_specs)
         klass->class_alloc_size = class_alloc_size;
 
         if (parent) {
-            size_t parent_ptrs_size = parent->class_alloc_size
-                                      - offsetof(Class, method_ptrs);
-            memcpy(klass->method_ptrs, parent->method_ptrs, parent_ptrs_size);
+            // Copy parent vtable.
+            size_t parent_vt_size = parent->class_alloc_size
+                                    - offsetof(Class, vtable);
+            memcpy(klass->vtable, parent->vtable, parent_vt_size);
         }
 
         for (size_t i = 0; i < spec->num_inherited_meths; ++i) {

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b8579190/runtime/core/Clownfish/Class.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Class.cfh b/runtime/core/Clownfish/Class.cfh
index fd4e183..2d07add 100644
--- a/runtime/core/Clownfish/Class.cfh
+++ b/runtime/core/Clownfish/Class.cfh
@@ -32,7 +32,7 @@ class Clownfish::Class inherits Clownfish::Obj {
     size_t             obj_alloc_size;
     size_t             class_alloc_size;
     VArray            *methods;
-    cfish_method_t[1]  method_ptrs; /* flexible array */
+    cfish_method_t[1]  vtable; /* flexible array */
 
     inert LockFreeRegistry *registry;
     inert size_t offset_of_parent;