Explicitly store the names for each function that should have a static
authorIan Romanick <idr@us.ibm.com>
Sat, 26 Aug 2006 21:26:55 +0000 (21:26 +0000)
committerIan Romanick <idr@us.ibm.com>
Sat, 26 Aug 2006 21:26:55 +0000 (21:26 +0000)
entry point generated.  This allows us to do things like generate a
static entry point for glPointParameterfvARB but not for
glPointParameterfvSGIS.

src/mesa/glapi/gl_SPARC_asm.py
src/mesa/glapi/gl_XML.py
src/mesa/glapi/gl_apitemp.py
src/mesa/glapi/gl_procs.py
src/mesa/glapi/gl_x86-64_asm.py
src/mesa/glapi/gl_x86_asm.py

index 1368e24a08731eb263512c7db846ab2f9025f757..14db678210b900b7c8e8f74b4f4b0828aed16878 100644 (file)
@@ -82,7 +82,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
        def printBody(self, api):
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                name = f.name
                        else:
                                name = "_dispatch_stub_%u" % (f.offset)
@@ -94,7 +94,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                print ''
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                name = f.name
                        else:
                                name = "_dispatch_stub_%u" % (f.offset)
@@ -108,9 +108,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
-                               for n in f.entry_points:
-                                       if n != f.name:
+                       for n in f.entry_points:
+                               if n != f.name:
+                                       if f.is_static_entry_point(n):
                                                print '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
 
                return
index eef29072572102579ee6865900ca0634861950f7..868a7cd1bda404d1c13dc4adcbd9cc6297997f29 100644 (file)
@@ -614,6 +614,8 @@ class gl_function( gl_item ):
 
                self.assign_offset = 0
 
+               self.static_entry_points = []
+
                # Track the parameter string (for the function prototype)
                # for each entry-point.  This is done because some functions
                # change their prototype slightly when promoted from extension
@@ -634,7 +636,8 @@ class gl_function( gl_item ):
                name = element.nsProp( "name", None )
                alias = element.nsProp( "alias", None )
 
-               self.static_dispatch = is_attr_true(element, "static_dispatch")
+               if is_attr_true(element, "static_dispatch"):
+                       self.static_entry_points.append(name)
 
                self.entry_points.append( name )
                if alias:
@@ -731,6 +734,9 @@ class gl_function( gl_item ):
                
                return create_parameter_string( self.parameters, 1 )
 
+       def is_static_entry_point(self, name):
+               return name in self.static_entry_points
+
 
 class gl_item_factory:
        """Factory to create objects derived from gl_item."""
index 30ee6596ed386381ce54cb1c6507a00cb440677c..04a3ff32555f9863d48635e38ab4fd3c9372611a 100644 (file)
@@ -55,7 +55,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                t_string = ""
                comma = ""
 
-               if f.static_dispatch:
+               if f.is_static_entry_point(name):
                        n = name
                        keyword = "KEYWORD1"
                else:
@@ -79,7 +79,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                else:
                        dispatch = "DISPATCH"
 
-               if not f.static_dispatch:
+               if not f.is_static_entry_point(name):
                        print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.return_type, n, f.get_parameter_string(name))
                        print ''
 
@@ -166,7 +166,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 
 static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                n = f.name
                        else:
                                n = "_dispatch_stub_%u" % (f.offset)
@@ -196,9 +196,9 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
 static _glapi_proc UNUSED_TABLE_NAME[] = {"""
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
-                               for n in f.entry_points:
-                                       if n != f.name:
+                       for n in f.entry_points:
+                               if n != f.name:
+                                       if f.is_static_entry_point(n):
                                                print '   TABLE_ENTRY(%s),' % (n)
 
                print '};'
@@ -209,11 +209,13 @@ static _glapi_proc UNUSED_TABLE_NAME[] = {"""
 
        def printBody(self, api):
                for func in api.functionIterateByOffset():
-                       if func.static_dispatch:
-                               for n in func.entry_points:
-                                       self.printFunction( func, n )
-                       else:
-                               self.printFunction(func, func.name)
+                       got_stub = 0
+                       for n in func.entry_points:
+                               if func.is_static_entry_point(n):
+                                       self.printFunction(func, n)
+                               elif not got_stub:
+                                       self.printFunction(func, n)
+                                       got_stub = 1
 
                self.printInitDispatch(api)
                self.printAliasedTable(api)
index 145243ee0e98da145f16715c1ad66c5b7178a13f..4a540e2d3864e7c51f0ca23291c9d6dc17dadad9 100644 (file)
@@ -87,7 +87,7 @@ class PrintGlProcs(gl_XML.gl_print_base):
                base_offset = 0
                table = []
                for func in api.functionIterateByOffset():
-                       if func.static_dispatch:
+                       if func.is_static_entry_point(func.name):
                                name = func.name
                        else:
                                name = "_dispatch_stub_%u" % (func.offset)
@@ -104,7 +104,7 @@ class PrintGlProcs(gl_XML.gl_print_base):
                for func in api.functionIterateByOffset():
                        for n in func.entry_points:
                                if n != func.name:
-                                       if func.static_dispatch:
+                                       if func.is_static_entry_point(n):
                                                name = n
                                        else:
                                                name = "_dispatch_stub_%u" % (func.offset)
@@ -123,8 +123,11 @@ class PrintGlProcs(gl_XML.gl_print_base):
                print '/* FIXME: Having these (incorrect) prototypes here is ugly. */'
                print '#ifdef NEED_FUNCTION_POINTER'
                for func in api.functionIterateByOffset():
-                       if not func.static_dispatch:
-                               print 'extern void gl_dispatch_stub_%u(void);' % (func.offset)
+                       for n in func.entry_points:
+                               if not func.is_static_entry_point(n):
+                                       print 'extern void gl_dispatch_stub_%u(void);' % (func.offset)
+                                       break
+
                print '#endif /* NEED_FUNCTION_POINTER */'
 
                print ''
index eb440009b2f5b73fd32cf132c293ec589119f77b..33943bce9340ec3f87d9aeee7531064801840abf 100644 (file)
@@ -236,7 +236,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                        registers.append( ["%rbp", 0] )
 
 
-               if f.static_dispatch:
+               if f.is_static_entry_point(f.name):
                        name = f.name
                else:
                        name = "_dispatch_stub_%u" % (f.offset)
@@ -244,7 +244,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                print '\t.p2align\t4,,15'
                print '\t.globl\tGL_PREFIX(%s)' % (name)
                print '\t.type\tGL_PREFIX(%s), @function' % (name)
-               if not f.static_dispatch:
+               if not f.is_static_entry_point(f.name):
                        print '\tHIDDEN(GL_PREFIX(%s))' % (name)
                print 'GL_PREFIX(%s):' % (name)
                print '#if defined(GLX_USE_TLS)'
@@ -291,9 +291,9 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
-                               for n in f.entry_points:
-                                       if n != f.name:
+                       for n in f.entry_points:
+                               if n != f.name:
+                                       if f.is_static_entry_point(n):
                                                print '\t.globl GL_PREFIX(%s) ; .set GL_PREFIX(%s), GL_PREFIX(%s)' % (n, n, f.name)
 
                return
index 3ce8404f8c9984e827b6d40a316e5f7965e2144b..2ebe4e8b247eb5afd64a6b0debeb05b8d1298e5a 100644 (file)
@@ -197,7 +197,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
        def printBody(self, api):
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                name = f.name
                        else:
                                name = "_dispatch_stub_%u" % (f.offset)
@@ -207,12 +207,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                        alt = "%s@%u" % (name, stack)
                        print '\tGL_STUB(%s, _gloffset_%s, %s)' % (name, f.name, alt)
 
-                       if not f.static_dispatch:
+                       if not f.is_static_entry_point(f.name):
                                print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
 
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                name = f.name
                        else:
                                name = "_dispatch_stub_%u" % (f.offset)
@@ -221,7 +221,7 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
                        alt = "%s@%u" % (name, stack)
 
-                       if f.static_dispatch:
+                       if f.is_static_entry_point(f.name):
                                for n in f.entry_points:
                                        if n != f.name:
                                                alt2 = "%s@%u" % (n, stack)