From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [IPv6:2a01:4f8:1c0c:6b10::1]) (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) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 1C2671F406 for ; Tue, 28 Nov 2023 18:46:27 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=rNwD/JFB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=dOImCY7u; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 7ADE381573; Tue, 28 Nov 2023 18:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1701197178; bh=s3HComuYVVsne/xySTjhVHqvxUv1gDgvnEqT12Eazp4=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=rNwD/JFBgP1VZNreQuUCMMNjgz8ORDVwTMRnMVdvUEnfd9HAkVcb18kKVPxfHoQmC LZ82Pf/2H5QHfmev3ggc0cYxTGaAcHptVmRnV39ebJOG9ryk1sLAUEAfFYcCqY6xG8 1S4Vrm36JZ1BTAZPVtApSxonJR+Il/ktiqlszO0I= Received: from csnrwnwx.outbound-mail.sendgrid.net (csnrwnwx.outbound-mail.sendgrid.net [198.37.146.154]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 3041F81562 for ; Tue, 28 Nov 2023 18:46:14 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=dOImCY7u; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=blSBdxcResR4nsxFTldnYBUEucMbgt3070TP+E3A+PE=; b=dOImCY7ubIdHwqeSq7REji4eaHh2xMoA+/SQ+ffvn3+x8YE+/4Kel7IKIe2v4kpcCwDr U+3jt4tgxxFzREbrwLYA3kZ9ufJCY2oEW33YND5Ozy/UPHu8oha0qgsqXmYCIH2eRBBxug FYB6xYPeJLQGqLLGYzViwyAIoO3XO8p+QOBAs7jw0ttnX32oRHd+FVe85A2U0iwJrIAFvz K5lU84vSmDDlhfHlPgnFhTxQajIZ/TL3oYCOy6we0DPo1rNDIJykxp1w5Olje8hzwH/5Nq TePIxsTdZFUM3/keAWqI5J5EHQa62X6f2xbcFqU43uDklwXLyVQRYTQiiwqch2gw== Received: by filterdrecv-6b68c9f446-kzvqf with SMTP id filterdrecv-6b68c9f446-kzvqf-1-65663575-2 2023-11-28 18:46:13.131368473 +0000 UTC m=+3629112.295456028 Received: from herokuapp.com (unknown) by geopod-ismtpd-57 (SG) with ESMTP id NDvnO34TRVG6VZPFldSQRQ for ; Tue, 28 Nov 2023 18:46:13.087 +0000 (UTC) Date: Tue, 28 Nov 2023 18:46:13 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 18886 X-Redmine-Issue-Author: ioquatix X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: jeremyevans0 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 92057 X-SG-EID: =?us-ascii?Q?zy3UxWTRryXcrjCh7SV39ZkShJ1PHkEOmoUEekBgd8G8RAJk=2FsUOlbLwuWEoNU?= =?us-ascii?Q?BxG3BBFmcsr21OPpQwa7zNRSwswJm1szgMd841w?= =?us-ascii?Q?HPqc4OU7tWZzdxbOnxpHChSqygNa7BF22fPZ7NZ?= =?us-ascii?Q?Lg3BcNVZMy0O3DsrriEwlL0RnE6GKdzw=2F3MVO8L?= =?us-ascii?Q?Q=2FJYkC+nC7QxIIWGurZveVcQmszUG7WTV07k2Et?= =?us-ascii?Q?045TwSht5URqPJsyHKGWayCNWVucBk3D4q1ZOGE?= =?us-ascii?Q?zuvKOtmXyOXHmrUj6ekeg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 2GUBUYN5TW4JVJAO3ZZVWNG3KYCXICFI X-Message-ID-Hash: 2GUBUYN5TW4JVJAO3ZZVWNG3KYCXICFI X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:115519] [Ruby master Bug#18886] Struct aref and aset don't trigger any tracepoints. List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "jeremyevans0 (Jeremy Evans) via ruby-core" Cc: "jeremyevans0 (Jeremy Evans)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #18886 has been updated by jeremyevans0 (Jeremy Evans). mame (Yusuke Endoh) wrote in #note-7: > @jeremyevans0 Could you measure the overhead? Using the benchmark in the pull request, the pull request seems reliably ~5% faster in my testing for the member reader method, but mixed for other cases (sometimes up to 3% faster/slower depending on run). I don't have any explanation as to why it would be faster, so I'm going to assume that the difference is still within the margin of error. I don't think this will affect performance unless TracePoint is used, because the same method caching is done in both cases. ---------------------------------------- Bug #18886: Struct aref and aset don't trigger any tracepoints. https://bugs.ruby-lang.org/issues/18886#change-105448 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Given the following program, `thing.name` and `thing.shape` don't trigger `c_call` trace points (or any trace points actually). ```ruby pp RUBY_VERSION trace_point = TracePoint.new(:line, :call, :c_call, :a_call) do |trace| puts trace.event if trace.event == :call # Ruby doesn't always mark call-sites in sub-expressions, so we use this approach to compute a call site and mark it: if location = caller_locations(2, 1).first and path = location.path puts "> #{path}:#{location.lineno}:#{trace.event}" end end if path = trace.path puts "= #{path}:#{trace.lineno}:#{trace.event}" end end trace_point.enable # This will trigger call trace points class Thing def name :cat end def shape :square end end thing = Thing.new # Thing = Struct.new(:name, :shape) # thing = Thing.new(:cat, :rectangle) [ name: thing.name, shape: thing.shape, ] ``` ## Current HEAD ``` = ../test.rb:30:line: = ../test.rb:30:c_call:new = ../test.rb:30:c_call:inherited = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:const_added = ../test.rb:31:line: = ../test.rb:31:c_call:new = ../test.rb:31:c_call:initialize = ../test.rb:34:line: ``` ## Proposed PR ``` = ../test.rb:30:line: = ../test.rb:30:c_call:new = ../test.rb:30:c_call:inherited = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:singleton_method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:method_added = ../test.rb:30:c_call:const_added = ../test.rb:31:line: = ../test.rb:31:c_call:new = ../test.rb:31:c_call:initialize = ../test.rb:34:line: = ../test.rb:34:c_call:name = ../test.rb:35:c_call:shape ``` The reason is the internal implementation of struct doesn't have trace point instrumentation in `vm_call_opt_struct_aset` or `vm_call_opt_struct_aref`. Proposed fix: https://github.com/ruby/ruby/pull/6071 but this would need a review, maybe @jeremyevans0 and @ko1 can help. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/