From nobody Sat Jun 25 07:43:30 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 71F418728B0; Sat, 25 Jun 2022 07:43:30 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LVQw2295lz4rMT; Sat, 25 Jun 2022 07:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656143010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bHt8BbKPSpPgFzOLBGY1cp7+NUtTAgryDWkz0RPKE2M=; b=VnSbFJl0u6vxGo+cNPme8j62lTHJ+NZum//0dYrbBwFy5uOYOdaWRrea0pY8PXIx8cGYin fCrpsGQ23kas3c5q20tX344mvlzxOJk50jMf/908CpcmBqbg35H62zZ8UBEzdXNV0XbpM+ 1qPTwgrCTWnaqzU7eg3h8cS537Ar8hqO0jyBzNr3G4ra291Ne9cRkT7Y0w1mknG1a5oMfX bnDnHhZoaIiOYev7Z791kEExxkF6nioVasTnlJmJowq0VSpH/djNnXc8XBaKmQIwZ89aMs Dx2gsGTA9xyWVOWQc+cuEghQYLf53HRW3xxm1RjiPTyAl1HoHtSF5Ko/24EP3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B04120733; Sat, 25 Jun 2022 07:43:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25P7hUjF077997; Sat, 25 Jun 2022 07:43:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25P7hUnQ077996; Sat, 25 Jun 2022 07:43:30 GMT (envelope-from git) Date: Sat, 25 Jun 2022 07:43:30 GMT Message-Id: <202206250743.25P7hUnQ077996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 61c74fb66f1b - main - rb_tree: optimize tree rotation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61c74fb66f1bef776923cbd5b2a62fb06b003f0c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656143010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bHt8BbKPSpPgFzOLBGY1cp7+NUtTAgryDWkz0RPKE2M=; b=anTOxFF9wDwH2w3ZsXE473+MhXVy/72txlg6wNHX4yC0hYhQPYbC1WSySgpdCUd+MMlJ6p 7yrjw7SkcplZ2/KTr3gMXl7tzb0FZ+FGBZMlTDBpRCrl/obuukzyrv86WgObvA2/e/mxAL OVLo+FyhSFWpENq/kuxhb4YcoTJh/I+LJ12FLaNihYPJ9/DifRmjkzClfmdxvtWctMKLhu h6w2Rr/8kXMjpkxyt9gzmDTsukndh7KPLEP3Zk/OFduTY8eI1qEwoUhBSQ6xdS9WqZFmiV 0nFeSL1JLlhzAXVnL62HzdP+NTbst005BsAojBVgrPgb9h2krdbqvCGtT8nzCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656143010; a=rsa-sha256; cv=none; b=CHetyfZOYA1M6HeXt/b+RvcqECttPpexA15pkafHZGn5g8isrvXjW9p3PHmlp7oFKVKvNu dPqUcutv5z+si2fM0qPXq7ySY42ZmbWATpxb2Mq21Wf8YYBOMcq9cTUmKgyyP+FLbNml5K j2t1etkfAOeK7RtIBrha/aABjitQMKYCceT+Ji5Nrz/diFB5c8hLNpAcuI7YjjJsyunksE KWmU4wiuzi4Kcg32k0ZSjEnuwYTRStA5p7Em1Cnp5aqwVx/cASlm57pshd8j2BKFZpbM2A yVGFGR/TEy3Nyw33kKpM5qZ3bJe9ctBvgf4sPEEbeeXI6QdzpWblixHZtBnbeQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=61c74fb66f1bef776923cbd5b2a62fb06b003f0c commit 61c74fb66f1bef776923cbd5b2a62fb06b003f0c Author: Doug Moore AuthorDate: 2022-06-25 07:40:16 +0000 Commit: Doug Moore CommitDate: 2022-06-25 07:40:16 +0000 rb_tree: optimize tree rotation The RB_ROTATE macros begin with fetching a field via a pointer. In most cases, that value is one that has already been pulled into a register, and the compiler cannot infer that. So, to eliminate those needless fetches, have the caller of the RB_ROTATE macros present the data in the third macro parameter, rather than having the macro fetch it. Differential Revision: https://reviews.freebsd.org/D35520 --- sys/sys/tree.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/sys/tree.h b/sys/sys/tree.h index 0403288d1d68..fb0136a0c69a 100644 --- a/sys/sys/tree.h +++ b/sys/sys/tree.h @@ -380,7 +380,6 @@ struct { \ } while (/*CONSTCOND*/ 0) #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ - (tmp) = RB_RIGHT(elm, field); \ if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) { \ RB_SET_PARENT(RB_RIGHT(elm, field), elm, field); \ } \ @@ -392,7 +391,6 @@ struct { \ } while (/*CONSTCOND*/ 0) #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ - (tmp) = RB_LEFT(elm, field); \ if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \ RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \ } \ @@ -473,6 +471,7 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ } \ RB_FLIP_RIGHT(parent, field); \ if (RB_RED_RIGHT(parent, field)) { \ + child = elm; \ elm = parent; \ continue; \ } \ @@ -493,6 +492,7 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) \ } \ RB_FLIP_LEFT(parent, field); \ if (RB_RED_LEFT(parent, field)) { \ + child = elm; \ elm = parent; \ continue; \ } \ @@ -548,6 +548,7 @@ name##_RB_REMOVE_COLOR(struct name *head, \ RB_FLIP_LEFT(parent, field); \ else if (!RB_RED_RIGHT(sib, field)) { \ RB_FLIP_LEFT(parent, field); \ + elm = RB_LEFT(sib, field); \ RB_ROTATE_RIGHT(head, sib, elm, field); \ if (RB_RED_RIGHT(elm, field)) \ RB_FLIP_LEFT(sib, field); \ @@ -578,6 +579,7 @@ name##_RB_REMOVE_COLOR(struct name *head, \ RB_FLIP_RIGHT(parent, field); \ else if (!RB_RED_LEFT(sib, field)) { \ RB_FLIP_RIGHT(parent, field); \ + elm = RB_RIGHT(sib, field); \ RB_ROTATE_LEFT(head, sib, elm, field); \ if (RB_RED_LEFT(elm, field)) \ RB_FLIP_RIGHT(sib, field); \