From patchwork Fri Aug 16 22:49:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1148493 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-507160-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=golang.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="HLjrfYQ2"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=golang-org.20150623.gappssmtp.com header.i=@golang-org.20150623.gappssmtp.com header.b="A5s+/ZBd"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 469JRz6gl3z9sBF for ; Sat, 17 Aug 2019 08:50:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=RUub8LtmxXX1hUghwVZBktQRZrZdR5xzi5HbKkGSLiURe/ IDbpgVm84BtEjNxn9stoXz4eOiT14C4e8y8s12Tc8QuIvFnCkFRgRPLJReq9BOpQ 1cIF77CUATXGIvasF1EA+9mDrnBhy8G7mTBeGkGATwmLcDt71m+f6QiKXwqyo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=50ONGhZvm0BC/z87z2spSJyHosY=; b=HLjrfYQ2lhK/hVulDEnv zk6Xp4BTXTAdFW8WEv7HJqYTA0+s+Mx0+i0ugiZj7r/xBmFI5LZYtCBBLpkp75lU baXouCEjnNiIo5Q46G/DC3LxC35K802UwiEk8nSOXHdncTpYvgDWj0yYQ5IiZYk7 iw7gK8uWKOkbYGHE8azyNew= Received: (qmail 14742 invoked by alias); 16 Aug 2019 22:49:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14732 invoked by uid 89); 16 Aug 2019 22:49:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=integer_type X-HELO: mail-lj1-f174.google.com Received: from mail-lj1-f174.google.com (HELO mail-lj1-f174.google.com) (209.85.208.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 16 Aug 2019 22:49:55 +0000 Received: by mail-lj1-f174.google.com with SMTP id x3so2571225lji.5 for ; Fri, 16 Aug 2019 15:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=lKkUU8nYN1GuWYy4SGF0WP8VS2z2InSuesJPxpUFHMo=; b=A5s+/ZBdhH0VA0tPR6ZRR+NmmCPrphHvZuV8sMEeTCAHNn5k9TKs9HOMRniEF1iER4 /JUzZZbXesUAHeX/nb1QzQQ8g+ejm4fB52HmCvdNoPkEyt9oYy7M24f0/DhSU//2JMJ0 8Yno2ARFqyFHq1vuX5/4flIR+V6WomRg9eFX0rhwD2rVyJDXIW65tsGLXSBiJIOWtX4c C49K0Fw1yIXKz9lCD9/7Osl2ZoYVrUrOlElxG60s3rQqKdn4dEhE48CRcHhGwy021IH4 6T/VDmXBT4xwqYTaZZJIGOhlUgM9CRS7WuZUkOGzjSfUyflOcXHLL1j7ekoYDMB/1Aqr mDmQ== MIME-Version: 1.0 From: Ian Lance Taylor Date: Fri, 16 Aug 2019 15:49:40 -0700 Message-ID: Subject: Go patch committed: Print runtime.hex in hex To: gcc-patches , gofrontend-dev This is a patch to the Go frontend by Cherry Zhang. The gc compiler recognizes the type runtime.hex and prints values in this type as hex. Do the same in the Go frontend. This makes debugging runtime crashes slightly better. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 274169) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -480477ca64c3001b9c7e92ef8b978dc92a5912d2 +0f6d673d5b1a3474c3424cb6994ae8ff9baed255 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 274169) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -10294,7 +10294,13 @@ Builtin_call_expression::do_get_backend( { Type* itype = Type::lookup_integer_type("uint64"); arg = Expression::make_cast(itype, arg, location); - code = Runtime::PRINTUINT; + if (gogo->compiling_runtime() + && type->named_type() != NULL + && gogo->unpack_hidden_name(type->named_type()->name()) + == "hex") + code = Runtime::PRINTHEX; + else + code = Runtime::PRINTUINT; } else if (type->integer_type() != NULL) { Index: gcc/go/gofrontend/runtime.def =================================================================== --- gcc/go/gofrontend/runtime.def (revision 274169) +++ gcc/go/gofrontend/runtime.def (working copy) @@ -384,6 +384,9 @@ DEF_GO_RUNTIME(PRINTSTRING, "runtime.pri // Print a uint64 (for print/println). DEF_GO_RUNTIME(PRINTUINT, "runtime.printuint", P1(UINT64), R0()) +// Print a uint64 in hex (for print/println, used for runtime.hex type). +DEF_GO_RUNTIME(PRINTHEX, "runtime.printhex", P1(UINT64), R0()) + // Print a int64 (for print/println). DEF_GO_RUNTIME(PRINTINT, "runtime.printint", P1(INT64), R0())