From owner-svn-src-head@freebsd.org Sat Jan 18 02:39:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D127224A28; Sat, 18 Jan 2020 02:39:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4802Fl0jRgz4QZ6; Sat, 18 Jan 2020 02:39:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 138DE1AF75; Sat, 18 Jan 2020 02:39:39 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00I2dcpi001813; Sat, 18 Jan 2020 02:39:38 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00I2dc3D001810; Sat, 18 Jan 2020 02:39:38 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202001180239.00I2dc3D001810@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 18 Jan 2020 02:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356860 - in head/sys: powerpc/aim powerpc/powerpc tools X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: powerpc/aim powerpc/powerpc tools X-SVN-Commit-Revision: 356860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2020 02:39:39 -0000 Author: jhibbits Date: Sat Jan 18 02:39:38 2020 New Revision: 356860 URL: https://svnweb.freebsd.org/changeset/base/356860 Log: Add a 'SINGLETON' directive to kobj interface definition Summary: This makes the interface described in the definition file act like a pseudo-IFUNC service, by caching the found method locally. Applying this to the PowerPC MMU definitions, it yields a significant (15-20%) performance improvement, seen in both a 'make buildworld' and a parallel build of LLVM, on a POWER9 system. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D23245 Modified: head/sys/powerpc/aim/moea64_if.m head/sys/powerpc/powerpc/mmu_if.m head/sys/tools/makeobjops.awk Modified: head/sys/powerpc/aim/moea64_if.m ============================================================================== --- head/sys/powerpc/aim/moea64_if.m Sat Jan 18 01:29:02 2020 (r356859) +++ head/sys/powerpc/aim/moea64_if.m Sat Jan 18 02:39:38 2020 (r356860) @@ -43,6 +43,7 @@ */ INTERFACE moea64; +SINGLETON; CODE { static moea64_pte_replace_t moea64_pte_replace_default; Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Sat Jan 18 01:29:02 2020 (r356859) +++ head/sys/powerpc/powerpc/mmu_if.m Sat Jan 18 02:39:38 2020 (r356860) @@ -46,6 +46,7 @@ */ INTERFACE mmu; +SINGLETON; # # Default implementations of some methods Modified: head/sys/tools/makeobjops.awk ============================================================================== --- head/sys/tools/makeobjops.awk Sat Jan 18 01:29:02 2020 (r356859) +++ head/sys/tools/makeobjops.awk Sat Jan 18 02:39:38 2020 (r356860) @@ -325,13 +325,18 @@ function handle_method (static, doc) line_width, length(prototype))); } printh("{"); - printh("\tkobjop_t _m;"); + if (singleton) + printh("\tstatic kobjop_t _m;"); + else + printh("\tkobjop_t _m;"); if (ret != "void") printh("\t" ret " rc;"); if (!static) firstvar = "((kobj_t)" firstvar ")"; if (prolog != "") printh(prolog); + if (singleton) + printh("\tif (_m == NULL)"); printh("\tKOBJOPLOOKUP(" firstvar "->ops," mname ");"); rceq = (ret != "void") ? "rc = " : ""; printh("\t" rceq "((" mname "_t *) _m)(" varname_list ");"); @@ -453,6 +458,7 @@ for (file_i = 0; file_i < num_files; file_i++) { lastdoc = ""; prolog = ""; epilog = ""; + singleton = 0; while (!error && (getline < src) > 0) { lineno++; @@ -497,6 +503,8 @@ for (file_i = 0; file_i < num_files; file_i++) { prolog = handle_code(); else if (/^EPILOG[ ]*{$/) epilog = handle_code(); + else if (/^SINGLETON/) + singleton = 1; else { debug($0); warnsrc("Invalid line encountered");