[pypy-svn] r64376 - pypy/trunk/pypy/translator/jvm
antocuni at codespeak.net
antocuni at codespeak.net
Sun Apr 19 16:24:42 CEST 2009
Author: antocuni
Date: Sun Apr 19 16:24:42 2009
New Revision: 64376
Modified:
pypy/trunk/pypy/translator/jvm/database.py
pypy/trunk/pypy/translator/jvm/generator.py
pypy/trunk/pypy/translator/jvm/node.py
Log:
mark methods that are not overridden as "final". It doesn't seem to help
performances, though :-/
Modified: pypy/trunk/pypy/translator/jvm/database.py
==============================================================================
--- pypy/trunk/pypy/translator/jvm/database.py (original)
+++ pypy/trunk/pypy/translator/jvm/database.py Sun Apr 19 16:24:42 2009
@@ -229,6 +229,9 @@
if not ootype.isSubclass(OOTYPE, SELF): continue
mobj = self._function_for_graph(
clsobj, mname, False, mimpl.graph)
+ graphs = OOTYPE._lookup_graphs(mname)
+ if len(graphs) == 1:
+ mobj.is_final = True
clsobj.add_method(mobj)
# currently, we always include a special "dump" method for debugging
Modified: pypy/trunk/pypy/translator/jvm/generator.py
==============================================================================
--- pypy/trunk/pypy/translator/jvm/generator.py (original)
+++ pypy/trunk/pypy/translator/jvm/generator.py Sun Apr 19 16:24:42 2009
@@ -190,7 +190,7 @@
abstract=abstract)
def begin_function(self, funcname, argvars, argtypes, rettype,
- static=False, abstract=False):
+ static=False, abstract=False, final=False):
"""
funcname --- name of the function
argvars --- list of objects passed to load() that represent arguments;
@@ -198,6 +198,7 @@
argtypes --- JvmType for each argument [INCLUDING this]
rettype --- JvmType for the return value
static --- keyword, if true then a static func is generated
+ final --- keyword, if true then a final method is generated
This function also defines the scope for variables passed to
load()/store().
@@ -214,9 +215,9 @@
# Prepare a map for the local variable indices we will add
# Let the subclass do the rest of the work; note that it does
# not need to know the argvars parameter, so don't pass it
- self._begin_function(funcname, argtypes, rettype, static, abstract)
+ self._begin_function(funcname, argtypes, rettype, static, abstract, final)
- def _begin_function(self, funcname, argtypes, rettype, static, abstract):
+ def _begin_function(self, funcname, argtypes, rettype, static, abstract, final):
"""
Main implementation of begin_function. The begin_function()
does some generic handling of args.
@@ -864,7 +865,7 @@
self.curclass.out('.field %s %s %s\n' % (
" ".join(kw), fobj.field_name, fobj.jtype.descriptor))
- def _begin_function(self, funcname, argtypes, rettype, static, abstract):
+ def _begin_function(self, funcname, argtypes, rettype, static, abstract, final):
if not static: argtypes = argtypes[1:]
@@ -872,6 +873,8 @@
kw = ['public']
if static: kw.append('static')
if abstract: kw.append('abstract')
+ if final: kw.append('final')
+
self.curclass.out('.method %s %s(%s)%s\n' % (
" ".join(kw),
funcname,
Modified: pypy/trunk/pypy/translator/jvm/node.py
==============================================================================
--- pypy/trunk/pypy/translator/jvm/node.py (original)
+++ pypy/trunk/pypy/translator/jvm/node.py Sun Apr 19 16:24:42 2009
@@ -248,6 +248,8 @@
class GraphFunction(OOFunction, Function):
""" Represents a function that is generated from a graph. """
+
+ is_final = False
def __init__(self, db, classty, name, jargtypes,
jrettype, graph, is_static):
@@ -294,7 +296,8 @@
jrettype = lltype_to_cts(self.graph.getreturnvar().concretetype)
self.ilasm.begin_function(
- self.name, jargvars, jargtypes, jrettype, static=not self.is_method)
+ self.name, jargvars, jargtypes, jrettype, static=not self.is_method,
+ final=self.is_final)
def end_render(self):
self.ilasm.end_function()
More information about the Pypy-commit
mailing list