From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id C05E31F4C0 for ; Fri, 25 Oct 2019 02:10:09 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id CC331120AC7; Fri, 25 Oct 2019 11:09:59 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 57B13120A9F for ; Fri, 25 Oct 2019 11:09:58 +0900 (JST) Received: by filter0081p3las1.sendgrid.net with SMTP id filter0081p3las1-29055-5DB2597B-A 2019-10-25 02:10:03.154926583 +0000 UTC m=+273894.287178880 Received: from herokuapp.com (unknown [18.208.173.77]) by ismtpd0030p1mdw1.sendgrid.net (SG) with ESMTP id imw2YSv5TCKHJZLcfYM-Jg for ; Fri, 25 Oct 2019 02:10:02.918 +0000 (UTC) Date: Fri, 25 Oct 2019 02:10:03 +0000 (UTC) From: s.wanabe@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71128 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16161 X-Redmine-Issue-Author: wanabe X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: wanabe 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-SG-EID: =?us-ascii?Q?FsuGSN1PD4adq4aDFRSSBF8ffe=2F4plpeX9T+dOtlSNZdoQPqebKZrMppNNnQwl?= =?us-ascii?Q?rwJ+7MLIlen=2FeVJkqqlsiQzjjDsu5yoKN+zX=2FZp?= =?us-ascii?Q?XO7BQzJbA2NxRPQyHDaDm+6hMvaMeFgrXLofBzz?= =?us-ascii?Q?=2F3QY2M8t3fjKzv15JOr8ycsrgjMgZ5akdM0WMJH?= =?us-ascii?Q?EWk7w2y7VztJKKHKCEkOtffZ7=2FXyfwN3KGg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95536 Subject: [ruby-core:95536] [Ruby master Bug#16161] tailcall_optimization may be disabled after r67315 X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16161 has been updated by wanabe (_ wanabe). Status changed from Open to Closed Thank you to merge https://github.com/ruby/ruby/pull/2529 on 4ff2c58f919153b9a47f69f855a0b9d2bb0e0bbe. I confirmed this issue is fixed now. ``` $ ./miniruby -v -e 'iseq = RubyVM::InstructionSequence.compile("def foo(n, s = 0);return s if n < 1;foo(n - 1, n + s); end", tailcall_optimization: true); iseq.eval; p foo(900_000)' ruby 2.7.0dev (2019-10-25T01:45:46Z master a7ec88ad61) [x86_64-linux] 405000450000 ``` ---------------------------------------- Bug #16161: tailcall_optimization may be disabled after r67315 https://bugs.ruby-lang.org/issues/16161#change-82312 * Author: wanabe (_ wanabe) * Status: Closed * Priority: Normal * Assignee: ko1 (Koichi Sasada) * Target version: * ruby -v: ruby 2.7.0dev (2019-09-09T23:18:03Z master 3678c37119) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Before r67315: ``` $ ./miniruby -v -e 'iseq = RubyVM::InstructionSequence.compile("def foo(n, s = 0);return s if n < 1;foo(n - 1, n + s); end", tailcall_optimization: true); iseq.eval; p foo(900_000)' ruby 2.7.0dev (2019-03-20 trunk 67314) [x86_64-linux] 405000450000 ``` After r67315: ``` $ ./miniruby -v -e 'iseq = RubyVM::InstructionSequence.compile("def foo(n, s = 0);return s if n < 1;foo(n - 1, n + s); end", tailcall_optimization: true); iseq.eval; p foo(900_000)' ruby 2.7.0dev (2019-03-20 trunk 67315) [x86_64-linux] Traceback (most recent call last): 10080: from -e:1:in `
' 10079: from :1:in `foo' 10078: from :1:in `foo' 10077: from :1:in `foo' 10076: from :1:in `foo' 10075: from :1:in `foo' 10074: from :1:in `foo' 10073: from :1:in `foo' ... 10068 levels... 4: from :1:in `foo' 3: from :1:in `foo' 2: from :1:in `foo' 1: from :1:in `foo' :1:in `foo': stack level too deep (SystemStackError) ``` master: ``` $ ./miniruby -v -e 'iseq = RubyVM::InstructionSequence.compile("def foo(n, s = 0);return s if n < 1;foo(n - 1, n + s); end", tailcall_optimization: true); iseq.eval; p foo(900_000)' ruby 2.7.0dev (2019-09-09T23:18:03Z master 3678c37119) [x86_64-linux] Traceback (most recent call last): 10080: from -e:1:in `
' 10079: from :1:in `foo' 10078: from :1:in `foo' 10077: from :1:in `foo' 10076: from :1:in `foo' 10075: from :1:in `foo' 10074: from :1:in `foo' 10073: from :1:in `foo' ... 10068 levels... 4: from :1:in `foo' 3: from :1:in `foo' 2: from :1:in `foo' 1: from :1:in `foo' :1:in `foo': stack level too deep (SystemStackError) ``` I think ruby should not raise SystemStackError with tailcall_optimization, should it? -- https://bugs.ruby-lang.org/