Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3E960200D27 for ; Tue, 10 Oct 2017 19:39:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3D2081609CB; Tue, 10 Oct 2017 17:39:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 84F79160BE0 for ; Tue, 10 Oct 2017 19:39:06 +0200 (CEST) Received: (qmail 62765 invoked by uid 500); 10 Oct 2017 17:39:05 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 62641 invoked by uid 99); 10 Oct 2017 17:39:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Oct 2017 17:39:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A7597183782 for ; Tue, 10 Oct 2017 17:39:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id I-Xq7AHU6qLA for ; Tue, 10 Oct 2017 17:39:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 0D94E5FE64 for ; Tue, 10 Oct 2017 17:39:03 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id D8982E0F35 for ; Tue, 10 Oct 2017 17:39:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id EF768253B2 for ; Tue, 10 Oct 2017 17:39:00 +0000 (UTC) Date: Tue, 10 Oct 2017 17:39:00 +0000 (UTC) From: "Gary Gregory (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (BCEL-295) Incorrect live range information in LocalVariableGen MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 10 Oct 2017 17:39:07 -0000 [ https://issues.apache.org/jira/browse/BCEL-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16199046#comment-16199046 ] Gary Gregory commented on BCEL-295: ----------------------------------- The patch is small and seems OK at first glance but I am not comfortable applying without a matching unit test. I do appreciate the low/no impact WRT compatibility. That's a plus :-) What do others think? > Incorrect live range information in LocalVariableGen > ---------------------------------------------------- > > Key: BCEL-295 > URL: https://issues.apache.org/jira/browse/BCEL-295 > Project: Commons BCEL > Issue Type: Bug > Reporter: Mark Roberts > Attachments: LocalVariableGen.diff > > > (Not sure of priority - blocker for me, but probably of little consequence for most clients.) > There is a design flaw with the treatment of local variable live ranges. In the .class file these are demarcated via byte code offsets into the method's instructions. The range is from start up to, but not including, the length. If the live range lasts through the end of the method, then length points to the first byte 'past' the end of the method. BCEL converts these offsets into InstructionHandles and in doing so can no longer differentiate between a live range that ends prior to the last instruction of the method or one that includes the last instruction of the method. > How to fix this is a bit of a problem. The 'correct' solution would seem to be to keep end as a null InstructionHandle as indicated by some of the comments. Unfortunately, LocalVariableGen does not have access to the method's InstructionList and thus cannot easily convert this null pointer back to the correct length for output. We could grab the InstructionHandle for start and then count the instruction bytes as we iterate to the end. > But all this still begs the question of the fact this would be a change in behavior - a client would now have to check for a null end handle before dereferencing. The proposed fix I have attached takes another approach. It sets a flag in the constructor if the initial value for end is null and then lets all else proceed unchanged. A client may test this flag to see if the special case is active. Also, the getLocalVariable method uses this flag to correctly set the length on output. > I believe this approach would have no effect on existing code. We would only need to document the new flag for clients that might care. -- This message was sent by Atlassian JIRA (v6.4.14#64029)