From owner-svn-src-vendor@freebsd.org Sun Jan 3 20:36:48 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76A5CA5F2B4; Sun, 3 Jan 2016 20:36:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C37D18F3; Sun, 3 Jan 2016 20:36:48 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u03KalIi035660; Sun, 3 Jan 2016 20:36:47 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u03Kal5m035656; Sun, 3 Jan 2016 20:36:47 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601032036.u03Kal5m035656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 3 Jan 2016 20:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293116 - in vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC: . AppleObjCRuntime X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 20:36:48 -0000 Author: emaste Date: Sun Jan 3 20:36:46 2016 New Revision: 293116 URL: https://svnweb.freebsd.org/changeset/base/293116 Log: Un-trim part of lldb trunk r256633 This was stripped in r292932 but is used in the regular configuration of LLDB. Obtained from: https://llvm.org/svn/llvm-project/lldb/trunk@256633 Added: vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp (contents, props changed) vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.h (contents, props changed) Added: vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Sun Jan 3 20:36:46 2016 (r293116) @@ -0,0 +1,573 @@ +//===-- AppleObjCClassDescriptorV2.cpp -----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "AppleObjCClassDescriptorV2.h" + +#include "lldb/Core/Log.h" +#include "lldb/Expression/FunctionCaller.h" + +using namespace lldb; +using namespace lldb_private; + +bool +ClassDescriptorV2::Read_objc_class (Process* process, std::unique_ptr &objc_class) const +{ + objc_class.reset(new objc_class_t); + + bool ret = objc_class->Read (process, m_objc_class_ptr); + + if (!ret) + objc_class.reset(); + + return ret; +} + +bool +ClassDescriptorV2::objc_class_t::Read(Process *process, lldb::addr_t addr) +{ + size_t ptr_size = process->GetAddressByteSize(); + + size_t objc_class_size = ptr_size // uintptr_t isa; + + ptr_size // Class superclass; + + ptr_size // void *cache; + + ptr_size // IMP *vtable; + + ptr_size; // uintptr_t data_NEVER_USE; + + DataBufferHeap objc_class_buf (objc_class_size, '\0'); + Error error; + + process->ReadMemory(addr, objc_class_buf.GetBytes(), objc_class_size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(objc_class_buf.GetBytes(), objc_class_size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_isa = extractor.GetAddress_unchecked(&cursor); // uintptr_t isa; + m_superclass = extractor.GetAddress_unchecked(&cursor); // Class superclass; + m_cache_ptr = extractor.GetAddress_unchecked(&cursor); // void *cache; + m_vtable_ptr = extractor.GetAddress_unchecked(&cursor); // IMP *vtable; + lldb::addr_t data_NEVER_USE = extractor.GetAddress_unchecked(&cursor); // uintptr_t data_NEVER_USE; + + m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3); + m_data_ptr = data_NEVER_USE & ~(lldb::addr_t)3; + + return true; +} + +bool +ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) +{ + size_t ptr_size = process->GetAddressByteSize(); + + size_t size = sizeof(uint32_t) // uint32_t flags; + + sizeof(uint32_t) // uint32_t version; + + ptr_size // const class_ro_t *ro; + + ptr_size // union { method_list_t **method_lists; method_list_t *method_list; }; + + ptr_size // struct chained_property_list *properties; + + ptr_size // const protocol_list_t **protocols; + + ptr_size // Class firstSubclass; + + ptr_size; // Class nextSiblingClass; + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_flags = extractor.GetU32_unchecked(&cursor); + m_version = extractor.GetU32_unchecked(&cursor); + m_ro_ptr = extractor.GetAddress_unchecked(&cursor); + m_method_list_ptr = extractor.GetAddress_unchecked(&cursor); + m_properties_ptr = extractor.GetAddress_unchecked(&cursor); + m_firstSubclass = extractor.GetAddress_unchecked(&cursor); + m_nextSiblingClass = extractor.GetAddress_unchecked(&cursor); + + return true; +} + +bool +ClassDescriptorV2::class_ro_t::Read(Process *process, lldb::addr_t addr) +{ + size_t ptr_size = process->GetAddressByteSize(); + + size_t size = sizeof(uint32_t) // uint32_t flags; + + sizeof(uint32_t) // uint32_t instanceStart; + + sizeof(uint32_t) // uint32_t instanceSize; + + (ptr_size == 8 ? sizeof(uint32_t) : 0) // uint32_t reserved; // __LP64__ only + + ptr_size // const uint8_t *ivarLayout; + + ptr_size // const char *name; + + ptr_size // const method_list_t *baseMethods; + + ptr_size // const protocol_list_t *baseProtocols; + + ptr_size // const ivar_list_t *ivars; + + ptr_size // const uint8_t *weakIvarLayout; + + ptr_size; // const property_list_t *baseProperties; + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_flags = extractor.GetU32_unchecked(&cursor); + m_instanceStart = extractor.GetU32_unchecked(&cursor); + m_instanceSize = extractor.GetU32_unchecked(&cursor); + if (ptr_size == 8) + m_reserved = extractor.GetU32_unchecked(&cursor); + else + m_reserved = 0; + m_ivarLayout_ptr = extractor.GetAddress_unchecked(&cursor); + m_name_ptr = extractor.GetAddress_unchecked(&cursor); + m_baseMethods_ptr = extractor.GetAddress_unchecked(&cursor); + m_baseProtocols_ptr = extractor.GetAddress_unchecked(&cursor); + m_ivars_ptr = extractor.GetAddress_unchecked(&cursor); + m_weakIvarLayout_ptr = extractor.GetAddress_unchecked(&cursor); + m_baseProperties_ptr = extractor.GetAddress_unchecked(&cursor); + + DataBufferHeap name_buf(1024, '\0'); + + process->ReadCStringFromMemory(m_name_ptr, (char*)name_buf.GetBytes(), name_buf.GetByteSize(), error); + + if (error.Fail()) + { + return false; + } + + m_name.assign((char*)name_buf.GetBytes()); + + return true; +} + +bool +ClassDescriptorV2::Read_class_row (Process* process, const objc_class_t &objc_class, std::unique_ptr &class_ro, std::unique_ptr &class_rw) const +{ + class_ro.reset(); + class_rw.reset(); + + Error error; + uint32_t class_row_t_flags = process->ReadUnsignedIntegerFromMemory(objc_class.m_data_ptr, sizeof(uint32_t), 0, error); + if (!error.Success()) + return false; + + if (class_row_t_flags & RW_REALIZED) + { + class_rw.reset(new class_rw_t); + + if (!class_rw->Read(process, objc_class.m_data_ptr)) + { + class_rw.reset(); + return false; + } + + class_ro.reset(new class_ro_t); + + if (!class_ro->Read(process, class_rw->m_ro_ptr)) + { + class_rw.reset(); + class_ro.reset(); + return false; + } + } + else + { + class_ro.reset(new class_ro_t); + + if (!class_ro->Read(process, objc_class.m_data_ptr)) + { + class_ro.reset(); + return false; + } + } + + return true; +} + +bool +ClassDescriptorV2::method_list_t::Read(Process *process, lldb::addr_t addr) +{ + size_t size = sizeof(uint32_t) // uint32_t entsize_NEVER_USE; + + sizeof(uint32_t); // uint32_t count; + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_entsize = extractor.GetU32_unchecked(&cursor) & ~(uint32_t)3; + m_count = extractor.GetU32_unchecked(&cursor); + m_first_ptr = addr + cursor; + + return true; +} + +bool +ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr) +{ + size_t size = GetSize(process); + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_name_ptr = extractor.GetAddress_unchecked(&cursor); + m_types_ptr = extractor.GetAddress_unchecked(&cursor); + m_imp_ptr = extractor.GetAddress_unchecked(&cursor); + + process->ReadCStringFromMemory(m_name_ptr, m_name, error); + if (error.Fail()) + { + return false; + } + + process->ReadCStringFromMemory(m_types_ptr, m_types, error); + if (error.Fail()) + { + return false; + } + + return true; +} + +bool +ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr) +{ + size_t size = sizeof(uint32_t) // uint32_t entsize; + + sizeof(uint32_t); // uint32_t count; + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_entsize = extractor.GetU32_unchecked(&cursor); + m_count = extractor.GetU32_unchecked(&cursor); + m_first_ptr = addr + cursor; + + return true; +} + +bool +ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) +{ + size_t size = GetSize(process); + + DataBufferHeap buffer (size, '\0'); + Error error; + + process->ReadMemory(addr, buffer.GetBytes(), size, error); + if (error.Fail()) + { + return false; + } + + DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize()); + + lldb::offset_t cursor = 0; + + m_offset_ptr = extractor.GetAddress_unchecked(&cursor); + m_name_ptr = extractor.GetAddress_unchecked(&cursor); + m_type_ptr = extractor.GetAddress_unchecked(&cursor); + m_alignment = extractor.GetU32_unchecked(&cursor); + m_size = extractor.GetU32_unchecked(&cursor); + + process->ReadCStringFromMemory(m_name_ptr, m_name, error); + if (error.Fail()) + { + return false; + } + + process->ReadCStringFromMemory(m_type_ptr, m_type, error); + if (error.Fail()) + { + return false; + } + + return true; +} + +bool +ClassDescriptorV2::Describe (std::function const &superclass_func, + std::function const &instance_method_func, + std::function const &class_method_func, + std::function const &ivar_func) const +{ + lldb_private::Process *process = m_runtime.GetProcess(); + + std::unique_ptr objc_class; + std::unique_ptr class_ro; + std::unique_ptr class_rw; + + if (!Read_objc_class(process, objc_class)) + return 0; + if (!Read_class_row(process, *objc_class, class_ro, class_rw)) + return 0; + + static ConstString NSObject_name("NSObject"); + + if (m_name != NSObject_name && superclass_func) + superclass_func(objc_class->m_superclass); + + if (instance_method_func) + { + std::unique_ptr base_method_list; + + base_method_list.reset(new method_list_t); + if (!base_method_list->Read(process, class_ro->m_baseMethods_ptr)) + return false; + + if (base_method_list->m_entsize != method_t::GetSize(process)) + return false; + + std::unique_ptr method; + method.reset(new method_t); + + for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i) + { + method->Read(process, base_method_list->m_first_ptr + (i * base_method_list->m_entsize)); + + if (instance_method_func(method->m_name.c_str(), method->m_types.c_str())) + break; + } + } + + if (class_method_func) + { + AppleObjCRuntime::ClassDescriptorSP metaclass(GetMetaclass()); + + // We don't care about the metaclass's superclass, or its class methods. Its instance methods are + // our class methods. + + if (metaclass) { + metaclass->Describe(std::function (nullptr), + class_method_func, + std::function (nullptr), + std::function (nullptr)); + } + } + + if (ivar_func) + { + if (class_ro->m_ivars_ptr != 0) + { + ivar_list_t ivar_list; + if (!ivar_list.Read(process, class_ro->m_ivars_ptr)) + return false; + + if (ivar_list.m_entsize != ivar_t::GetSize(process)) + return false; + + ivar_t ivar; + + for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i) + { + ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize)); + + if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size)) + break; + } + } + } + + return true; +} + +ConstString +ClassDescriptorV2::GetClassName () +{ + if (!m_name) + { + lldb_private::Process *process = m_runtime.GetProcess(); + + if (process) + { + std::unique_ptr objc_class; + std::unique_ptr class_ro; + std::unique_ptr class_rw; + + if (!Read_objc_class(process, objc_class)) + return m_name; + if (!Read_class_row(process, *objc_class, class_ro, class_rw)) + return m_name; + + m_name = ConstString(class_ro->m_name.c_str()); + } + } + return m_name; +} + +ObjCLanguageRuntime::ClassDescriptorSP +ClassDescriptorV2::GetSuperclass () +{ + lldb_private::Process *process = m_runtime.GetProcess(); + + if (!process) + return ObjCLanguageRuntime::ClassDescriptorSP(); + + std::unique_ptr objc_class; + + if (!Read_objc_class(process, objc_class)) + return ObjCLanguageRuntime::ClassDescriptorSP(); + + return m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(objc_class->m_superclass); +} + +ObjCLanguageRuntime::ClassDescriptorSP +ClassDescriptorV2::GetMetaclass () const +{ + lldb_private::Process *process = m_runtime.GetProcess(); + + if (!process) + return ObjCLanguageRuntime::ClassDescriptorSP(); + + std::unique_ptr objc_class; + + if (!Read_objc_class(process, objc_class)) + return ObjCLanguageRuntime::ClassDescriptorSP(); + + lldb::addr_t candidate_isa = m_runtime.GetPointerISA(objc_class->m_isa); + + return ObjCLanguageRuntime::ClassDescriptorSP(new ClassDescriptorV2(m_runtime, candidate_isa, nullptr)); +} + +uint64_t +ClassDescriptorV2::GetInstanceSize () +{ + lldb_private::Process *process = m_runtime.GetProcess(); + + if (process) + { + std::unique_ptr objc_class; + std::unique_ptr class_ro; + std::unique_ptr class_rw; + + if (!Read_objc_class(process, objc_class)) + return 0; + if (!Read_class_row(process, *objc_class, class_ro, class_rw)) + return 0; + + return class_ro->m_instanceSize; + } + + return 0; +} + +ClassDescriptorV2::iVarsStorage::iVarsStorage (): +m_filled(false), +m_ivars(), +m_mutex(Mutex::eMutexTypeRecursive) +{} + +size_t +ClassDescriptorV2::iVarsStorage::size () +{ + return m_ivars.size(); +} + +ClassDescriptorV2::iVarDescriptor& +ClassDescriptorV2::iVarsStorage::operator[] (size_t idx) +{ + return m_ivars[idx]; +} + +void +ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor) +{ + if (m_filled) + return; + Mutex::Locker lock(m_mutex); + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE)); + if (log) + log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString(" bool { + const bool for_expression = false; + const bool stop_loop = false; + if (log) + log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64, + name,type,offset_ptr,size); + CompilerType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression); + if (ivar_type) + { + if (log) + log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64 " , type_size = %" PRIu64, + name,type,offset_ptr,size,ivar_type.GetByteSize(nullptr)); + Scalar offset_scalar; + Error error; + const int offset_ptr_size = 4; + const bool is_signed = false; + size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, offset_ptr_size, is_signed, offset_scalar, error); + if (error.Success() && 4 == read) + { + if (log) + log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> %" PRIu32, + offset_ptr, offset_scalar.SInt()); + m_ivars.push_back({ ConstString(name), ivar_type, size, offset_scalar.SInt() }); + } + else if (log) + log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> read fail, read = %zu", + offset_ptr, read); + } + return stop_loop; + }); +} + +void +ClassDescriptorV2::GetIVarInformation () +{ + m_ivars_storage.fill(m_runtime, *this); +} Added: vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h Sun Jan 3 20:36:46 2016 (r293116) @@ -0,0 +1,411 @@ +//===-- AppleObjCClassDescriptorV2.h ----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_AppleObjCClassDescriptorV2_h_ +#define liblldb_AppleObjCClassDescriptorV2_h_ + +// C Includes +// C++ Includes +// Other libraries and framework includes +// Project includes +#include "lldb/lldb-private.h" +#include "lldb/Host/Mutex.h" +#include "lldb/Target/ObjCLanguageRuntime.h" +#include "AppleObjCRuntimeV2.h" + +namespace lldb_private { + +class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor +{ +public: + friend class lldb_private::AppleObjCRuntimeV2; + + ~ClassDescriptorV2() override = default; + + ConstString + GetClassName() override; + + ObjCLanguageRuntime::ClassDescriptorSP + GetSuperclass() override; + + ObjCLanguageRuntime::ClassDescriptorSP + GetMetaclass() const override; + + bool + IsValid() override + { + return true; // any Objective-C v2 runtime class descriptor we vend is valid + } + + // a custom descriptor is used for tagged pointers + bool + GetTaggedPointerInfo(uint64_t* info_bits = nullptr, + uint64_t* value_bits = nullptr, + uint64_t* payload = nullptr) override + { + return false; + } + + uint64_t + GetInstanceSize() override; + + ObjCLanguageRuntime::ObjCISA + GetISA() override + { + return m_objc_class_ptr; + } + + bool + Describe(std::function const &superclass_func, + std::function const &instance_method_func, + std::function const &class_method_func, + std::function const &ivar_func) const override; + + size_t + GetNumIVars() override + { + GetIVarInformation(); + return m_ivars_storage.size(); + } + + iVarDescriptor + GetIVarAtIndex(size_t idx) override + { + if (idx >= GetNumIVars()) + return iVarDescriptor(); + return m_ivars_storage[idx]; + } + +protected: + void + GetIVarInformation (); + +private: + static const uint32_t RW_REALIZED = (1 << 31); + + struct objc_class_t { + ObjCLanguageRuntime::ObjCISA m_isa; // The class's metaclass. + ObjCLanguageRuntime::ObjCISA m_superclass; + lldb::addr_t m_cache_ptr; + lldb::addr_t m_vtable_ptr; + lldb::addr_t m_data_ptr; + uint8_t m_flags; + + objc_class_t () : + m_isa (0), + m_superclass (0), + m_cache_ptr (0), + m_vtable_ptr (0), + m_data_ptr (0), + m_flags (0) + { + } + + void + Clear() + { + m_isa = 0; + m_superclass = 0; + m_cache_ptr = 0; + m_vtable_ptr = 0; + m_data_ptr = 0; + m_flags = 0; + } + + bool + Read(Process *process, lldb::addr_t addr); + }; + + struct class_ro_t { + uint32_t m_flags; + uint32_t m_instanceStart; + uint32_t m_instanceSize; + uint32_t m_reserved; + + lldb::addr_t m_ivarLayout_ptr; + lldb::addr_t m_name_ptr; + lldb::addr_t m_baseMethods_ptr; + lldb::addr_t m_baseProtocols_ptr; + lldb::addr_t m_ivars_ptr; + + lldb::addr_t m_weakIvarLayout_ptr; + lldb::addr_t m_baseProperties_ptr; + + std::string m_name; + + bool + Read(Process *process, lldb::addr_t addr); + }; + + struct class_rw_t { + uint32_t m_flags; + uint32_t m_version; + + lldb::addr_t m_ro_ptr; + union { + lldb::addr_t m_method_list_ptr; + lldb::addr_t m_method_lists_ptr; + }; + lldb::addr_t m_properties_ptr; + lldb::addr_t m_protocols_ptr; + + ObjCLanguageRuntime::ObjCISA m_firstSubclass; + ObjCLanguageRuntime::ObjCISA m_nextSiblingClass; + + bool + Read(Process *process, lldb::addr_t addr); + }; + + struct method_list_t + { + uint32_t m_entsize; + uint32_t m_count; + lldb::addr_t m_first_ptr; + + bool + Read(Process *process, lldb::addr_t addr); + }; + + struct method_t + { + lldb::addr_t m_name_ptr; + lldb::addr_t m_types_ptr; + lldb::addr_t m_imp_ptr; + + std::string m_name; + std::string m_types; + + static size_t GetSize(Process *process) + { + size_t ptr_size = process->GetAddressByteSize(); + + return ptr_size // SEL name; + + ptr_size // const char *types; + + ptr_size; // IMP imp; + } + + bool + Read(Process *process, lldb::addr_t addr); + }; + + struct ivar_list_t + { + uint32_t m_entsize; + uint32_t m_count; + lldb::addr_t m_first_ptr; + + bool Read(Process *process, lldb::addr_t addr); + }; + + struct ivar_t + { + lldb::addr_t m_offset_ptr; + lldb::addr_t m_name_ptr; + lldb::addr_t m_type_ptr; + uint32_t m_alignment; + uint32_t m_size; + + std::string m_name; + std::string m_type; + + static size_t GetSize(Process *process) + { + size_t ptr_size = process->GetAddressByteSize(); + + return ptr_size // uintptr_t *offset; + + ptr_size // const char *name; + + ptr_size // const char *type; + + sizeof(uint32_t) // uint32_t alignment; + + sizeof(uint32_t); // uint32_t size; + } + + bool + Read(Process *process, lldb::addr_t addr); + }; + + class iVarsStorage + { + public: + iVarsStorage (); + + size_t + size (); + + iVarDescriptor& + operator[] (size_t idx); + + void + fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor); + + private: + bool m_filled; + std::vector m_ivars; + Mutex m_mutex; + }; + + // The constructor should only be invoked by the runtime as it builds its caches + // or populates them. A ClassDescriptorV2 should only ever exist in a cache. + ClassDescriptorV2(AppleObjCRuntimeV2 &runtime, ObjCLanguageRuntime::ObjCISA isa, const char *name) : + m_runtime (runtime), + m_objc_class_ptr (isa), + m_name (name), + m_ivars_storage() + { + } + + bool + Read_objc_class (Process* process, std::unique_ptr &objc_class) const; + + bool + Read_class_row (Process* process, const objc_class_t &objc_class, std::unique_ptr &class_ro, std::unique_ptr &class_rw) const; + + AppleObjCRuntimeV2 &m_runtime; // The runtime, so we can read information lazily. + lldb::addr_t m_objc_class_ptr; // The address of the objc_class_t. (I.e., objects of this class type have this as their ISA) + ConstString m_name; // May be NULL + iVarsStorage m_ivars_storage; +}; + +// tagged pointer descriptor +class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor +{ +public: + ClassDescriptorV2Tagged (ConstString class_name, + uint64_t payload) + { + m_name = class_name; + if (!m_name) + { + m_valid = false; + return; + } + m_valid = true; + m_payload = payload; + m_info_bits = (m_payload & 0xF0ULL) >> 4; + m_value_bits = (m_payload & ~0x0000000000000000FFULL) >> 8; + } + + ClassDescriptorV2Tagged (ObjCLanguageRuntime::ClassDescriptorSP actual_class_sp, + uint64_t payload) + { + if (!actual_class_sp) + { + m_valid = false; + return; + } + m_name = actual_class_sp->GetClassName(); + if (!m_name) + { + m_valid = false; + return; + } + m_valid = true; + m_payload = payload; + m_info_bits = (m_payload & 0x0FULL); + m_value_bits = (m_payload & ~0x0FULL) >> 4; + } + + ~ClassDescriptorV2Tagged() override = default; + + ConstString + GetClassName() override + { + return m_name; + } + + ObjCLanguageRuntime::ClassDescriptorSP + GetSuperclass() override + { + // tagged pointers can represent a class that has a superclass, but since that information is not + // stored in the object itself, we would have to query the runtime to discover the hierarchy + // for the time being, we skip this step in the interest of static discovery + return ObjCLanguageRuntime::ClassDescriptorSP(); + } + + ObjCLanguageRuntime::ClassDescriptorSP + GetMetaclass() const override + { + return ObjCLanguageRuntime::ClassDescriptorSP(); + } + + bool + IsValid() override + { + return m_valid; + } + + bool + IsKVO() override + { + return false; // tagged pointers are not KVO'ed + } + + bool + IsCFType() override + { + return false; // tagged pointers are not CF objects + } + + bool + GetTaggedPointerInfo(uint64_t* info_bits = nullptr, + uint64_t* value_bits = nullptr, + uint64_t* payload = nullptr) override + { + if (info_bits) + *info_bits = GetInfoBits(); + if (value_bits) + *value_bits = GetValueBits(); + if (payload) + *payload = GetPayload(); + return true; + } + + uint64_t + GetInstanceSize() override + { + return (IsValid() ? m_pointer_size : 0); + } + + ObjCLanguageRuntime::ObjCISA + GetISA() override + { + return 0; // tagged pointers have no ISA + } + + // these calls are not part of any formal tagged pointers specification + virtual uint64_t + GetValueBits () + { + return (IsValid() ? m_value_bits : 0); + } + + virtual uint64_t + GetInfoBits () + { + return (IsValid() ? m_info_bits : 0); + } + + virtual uint64_t + GetPayload () + { + return (IsValid() ? m_payload : 0); + } + +private: + ConstString m_name; + uint8_t m_pointer_size; + bool m_valid; + uint64_t m_info_bits; + uint64_t m_value_bits; + uint64_t m_payload; +}; + +} // namespace lldb_private + +#endif // liblldb_AppleObjCClassDescriptorV2_h_ Added: vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Sun Jan 3 20:36:46 2016 (r293116) @@ -0,0 +1,665 @@ +//===-- AppleObjCDeclVendor.cpp ---------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Sun Jan 3 20:41:36 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C24AEA5F4F2; Sun, 3 Jan 2016 20:41:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78A581DA1; Sun, 3 Jan 2016 20:41:36 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u03KfZ7G038622; Sun, 3 Jan 2016 20:41:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u03KfZ4Q038621; Sun, 3 Jan 2016 20:41:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601032041.u03KfZ4Q038621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sun, 3 Jan 2016 20:41:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293117 - vendor/lldb/lldb-trunk-r256633/source/Plugins/LanguageRuntime/ObjC X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 20:41:36 -0000 Author: emaste Date: Sun Jan 3 20:41:35 2016 New Revision: 293117 URL: https://svnweb.freebsd.org/changeset/base/293117 Log: Tag addition to stripped lldb trunk r256633. Added: vendor/lldb/lldb-trunk-r256633/source/Plugins/LanguageRuntime/ObjC/ - copied from r293116, vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/ Modified: Directory Properties: vendor/lldb/lldb-trunk-r256633/ (props changed) From owner-svn-src-vendor@freebsd.org Mon Jan 4 00:22:36 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82ABDA60AA9; Mon, 4 Jan 2016 00:22:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CA4C111D; Mon, 4 Jan 2016 00:22:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u040MZgh005316; Mon, 4 Jan 2016 00:22:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u040MYN0005304; Mon, 4 Jan 2016 00:22:34 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201601040022.u040MYN0005304@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 4 Jan 2016 00:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293125 - vendor/less/dist X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2016 00:22:36 -0000 Author: delphij Date: Mon Jan 4 00:22:34 2016 New Revision: 293125 URL: https://svnweb.freebsd.org/changeset/base/293125 Log: Vendor import of less v481. Added: vendor/less/dist/compose.uni vendor/less/dist/mkutable (contents, props changed) vendor/less/dist/ubin.uni vendor/less/dist/wide.uni Modified: vendor/less/dist/LICENSE vendor/less/dist/Makefile.aut vendor/less/dist/Makefile.wnm vendor/less/dist/NEWS vendor/less/dist/README vendor/less/dist/brac.c vendor/less/dist/ch.c vendor/less/dist/charset.c vendor/less/dist/charset.h vendor/less/dist/cmd.h vendor/less/dist/cmdbuf.c vendor/less/dist/command.c vendor/less/dist/configure vendor/less/dist/cvt.c vendor/less/dist/decode.c vendor/less/dist/defines.ds vendor/less/dist/defines.h.in vendor/less/dist/defines.o2 vendor/less/dist/defines.o9 vendor/less/dist/defines.wn vendor/less/dist/edit.c vendor/less/dist/filename.c vendor/less/dist/forwback.c vendor/less/dist/funcs.h vendor/less/dist/help.c vendor/less/dist/ifile.c vendor/less/dist/input.c vendor/less/dist/jump.c vendor/less/dist/less.h vendor/less/dist/less.hlp vendor/less/dist/less.man vendor/less/dist/less.nro vendor/less/dist/lessecho.c vendor/less/dist/lessecho.man vendor/less/dist/lessecho.nro vendor/less/dist/lesskey.c vendor/less/dist/lesskey.h vendor/less/dist/lesskey.man vendor/less/dist/lesskey.nro vendor/less/dist/lglob.h vendor/less/dist/line.c vendor/less/dist/linenum.c vendor/less/dist/lsystem.c vendor/less/dist/main.c vendor/less/dist/mark.c vendor/less/dist/mkhelp.c vendor/less/dist/optfunc.c vendor/less/dist/option.c vendor/less/dist/option.h vendor/less/dist/opttbl.c vendor/less/dist/os.c vendor/less/dist/output.c vendor/less/dist/pattern.c vendor/less/dist/pattern.h vendor/less/dist/pckeys.h vendor/less/dist/position.c vendor/less/dist/position.h vendor/less/dist/prompt.c vendor/less/dist/regexp.c vendor/less/dist/screen.c vendor/less/dist/scrsize.c vendor/less/dist/search.c vendor/less/dist/signal.c vendor/less/dist/tags.c vendor/less/dist/ttyin.c vendor/less/dist/version.c Modified: vendor/less/dist/LICENSE ============================================================================== --- vendor/less/dist/LICENSE Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/LICENSE Mon Jan 4 00:22:34 2016 (r293125) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2012 Mark Nudelman +Copyright (C) 1984-2015 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: vendor/less/dist/Makefile.aut ============================================================================== --- vendor/less/dist/Makefile.aut Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/Makefile.aut Mon Jan 4 00:22:34 2016 (r293125) @@ -14,25 +14,29 @@ SRC = \ help.c ifile.c input.c jump.c line.c linenum.c \ lsystem.c mark.c optfunc.c option.c opttbl.c os.c \ output.c pattern.c position.c prompt.c search.c signal.c \ - tags.c ttyin.c version.c + tags.c ttyin.c version.c DISTFILES_W = \ defines.ds Makefile.dsb Makefile.dsg Makefile.dsu \ defines.o2 Makefile.o2e \ defines.o9 Makefile.o9c Makefile.o9u \ - defines.wn Makefile.wnm Makefile.wnb + defines.wn Makefile.wnm Makefile.wnb \ + configure +UNICODE_FILES = \ + compose.uni ubin.uni wide.uni DISTFILES = \ ${SRC} regexp.c regexp.h \ COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \ - configure configure.ac lesskey.c lessecho.c scrsize.c \ + configure.ac lesskey.c lessecho.c scrsize.c \ charset.h cmd.h funcs.h lglob.h less.h lesskey.h option.h \ pckeys.h pattern.h position.h \ install.sh defines.h.in mkinstalldirs \ less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ less.hlp \ mkfuncs.awk mkhelp.c \ + mkutable $(UNICODE_FILES) \ ${DISTFILES_W} -all: help.c funcs.h ${srcdir}/configure +all: help.c funcs.h $(UNICODE_FILES) ${srcdir}/configure release: .FORCE ${MAKE} -f Makefile.aut tagall @@ -46,7 +50,7 @@ help.c: less.hlp mkhelp -mv -f ${srcdir}/help.c ${srcdir}/help.c.old rm -rf help.c ./mkhelp < less.hlp > help.c - if cmp -s help.c help.c.old; then mv help.c.old help.c; fi + if cmp -s help.c help.c.old; then mv -f help.c.old help.c; fi mkhelp: mkhelp.c ${CC} -o mkhelp mkhelp.c @@ -58,7 +62,7 @@ ${srcdir}/configure: ${srcdir}/configure funcs.h: ${SRC:%=${srcdir}/%} -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h - if cmp -s funcs.h funcs.h.old; then mv funcs.h.old funcs.h; fi + if cmp -s funcs.h funcs.h.old; then mv -f funcs.h.old funcs.h; fi lint: lint -I. ${CPPFLAGS} ${SRC} @@ -75,6 +79,7 @@ REPLACE_VERSION = \ @REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q ${srcdir}/version.c`; \ DT=`date '+%d %h %Y'`; \ echo "Stuffing version number $$REL into $@"; \ + rm -f $@; \ sed \ -e "s;@@VERSION@@;$$REL;" \ -e "s;@@DATE@@;$$DT;" \ @@ -101,6 +106,12 @@ ${srcdir}/lesskey.man: ${srcdir}/lesskey ${srcdir}/lessecho.man: ${srcdir}/lessecho.nro ${NROFF} ${srcdir}/lessecho.nro >${srcdir}/lessecho.man +compose.uni: unicode/UnicodeData.txt + ./mkutable -f2 Mn Me -- unicode/UnicodeData.txt > $@ +ubin.uni: unicode/UnicodeData.txt + ./mkutable -f2 Cc Cf Cs Co Zl Zp -- unicode/UnicodeData.txt > $@ +wide.uni: unicode/EastAsianWidth.txt + ./mkutable -f1 W -- unicode/EastAsianWidth.txt > $@ distfiles: ${DISTFILES} @@ -114,7 +125,7 @@ dist: ${DISTFILES} for file in ${DISTFILES}; do \ ./add_copyright $$file $$REL; \ done; \ - cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \ + cd $$REL; chmod -w *; chmod +w ${DISTFILES_W}; chmod +x configure; cd ..; \ echo "Creating release/$$REL/$$REL.tar.gz"; \ tar -cf - $$REL | gzip -c >release/$$REL/$$REL.tar.gz; \ echo "Signing release/$$REL/$$REL.tar.gz"; \ Modified: vendor/less/dist/Makefile.wnm ============================================================================== --- vendor/less/dist/Makefile.wnm Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/Makefile.wnm Mon Jan 4 00:22:34 2016 (r293125) @@ -6,7 +6,7 @@ CC = cl # Normal flags -CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +CFLAGS = /nologo /MD /W3 /EHsc /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386 # Debugging flags Modified: vendor/less/dist/NEWS ============================================================================== --- vendor/less/dist/NEWS Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/NEWS Mon Jan 4 00:22:34 2016 (r293125) @@ -7,7 +7,44 @@ http://www.greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org. + To report bugs, suggestions or comments, send email to bug-less@gnu.org + +====================================================================== + + Major changes between "less" versions 458 and 481 + +* Don't overwrite history file; just append to it. + +* New command ESC-G goes to end of currently buffered data in a pipe. + +* Disable history feature when compiled with LESSHISTFILE set to "-". + +* In more-compatible mode, make the -p option apply to every file opened, + not just the first one. + +* In more-compatible mode, change the -e option to work like -E, not -EF. + +* Treat multiple CRs before LF are like one CR (all the CRs are hidden). + +* Allow "extra" string in lesskey file to append to a multi-char command + (like a search pattern), without executing the command. + +* Ignore -u/-U setting while viewing help file, so that + underline and bold chars are displayed correctly. + +* Improve detection of "binary" files in UTF-8 mode. + +* Fix bug with ++ commands. + +* Fix bug where prompt was sometimes not displayed with +G. + +* Fix possible memory corruption + +* Fix bugs and improve performance in ampersand filtering. + +* Automate construction of Unicode tables from Unicode database. + +* Allow %% escape sequence in LESSOPEN variable. ====================================================================== Modified: vendor/less/dist/README ============================================================================== --- vendor/less/dist/README Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/README Mon Jan 4 00:22:34 2016 (r293125) @@ -1,7 +1,7 @@ - Less, version 458 + Less, version 481 - This is the distribution of less, version 458, released 04 Apr 2013. + This is the distribution of less, version 481, released 31 Aug 2015. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -45,8 +45,9 @@ INSTALLATION (Unix systems only): Specifies the regular expression library used by less for pattern matching. The default is "auto", which means the configure program finds a regular expression library automatically. Other values are: - posix Use the POSIX-compatible regcomp. + gnu Use the GNU regex library. pcre Use the PCRE library. + posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. regcomp Use the V8-compatible regcomp. Modified: vendor/less/dist/brac.c ============================================================================== --- vendor/less/dist/brac.c Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/brac.c Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: vendor/less/dist/ch.c ============================================================================== --- vendor/less/dist/ch.c Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/ch.c Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -54,7 +54,7 @@ struct buf { * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ -#define BUFHASH_SIZE 64 +#define BUFHASH_SIZE 1024 struct filestate { struct bufnode buflist; struct bufnode hashtbl[BUFHASH_SIZE]; @@ -323,13 +323,16 @@ ch_get() #if HAVE_STAT_INO if (follow_mode == FOLLOW_NAME) { - /* See whether the file's i-number has changed. + /* See whether the file's i-number has changed, + * or the file has shrunk. * If so, force the file to be closed and * reopened. */ struct stat st; + POSITION curr_pos = ch_tell(); int r = stat(get_filename(curr_ifile), &st); if (r == 0 && (st.st_ino != curr_ino || - st.st_dev != curr_dev)) + st.st_dev != curr_dev || + (curr_pos != NULL_POSITION && st.st_size < curr_pos))) { /* screen_trashed=2 causes * make_display to reopen the file. */ @@ -536,6 +539,32 @@ ch_end_seek() } /* + * Seek to the last position in the file that is currently buffered. + */ + public int +ch_end_buffer_seek() +{ + register struct buf *bp; + register struct bufnode *bn; + POSITION buf_pos; + POSITION end_pos; + + if (thisfile == NULL || (ch_flags & CH_CANSEEK)) + return (ch_end_seek()); + + end_pos = 0; + FOR_BUFS(bn) + { + bp = bufnode_buf(bn); + buf_pos = (bp->block * LBUFSIZE) + bp->datasize; + if (buf_pos > end_pos) + end_pos = buf_pos; + } + + return (ch_seek(end_pos)); +} + +/* * Seek to the beginning of the file, or as close to it as we can get. * We may not be able to seek there if input is a pipe and the * beginning of the pipe is no longer buffered. Modified: vendor/less/dist/charset.c ============================================================================== --- vendor/less/dist/charset.c Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/charset.c Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -466,36 +466,15 @@ prutfchar(ch) else SNPRINTF1(buf, sizeof(buf), binfmt, (char) ch); } else if (is_ubin_char(ch)) + { SNPRINTF1(buf, sizeof(buf), utfbinfmt, ch); - else + } else { - int len; + char *p = buf; if (ch >= 0x80000000) - { - len = 3; - ch = 0xFFFD; - } else - { - len = (ch < 0x80) ? 1 - : (ch < 0x800) ? 2 - : (ch < 0x10000) ? 3 - : (ch < 0x200000) ? 4 - : (ch < 0x4000000) ? 5 - : 6; - } - buf[len] = '\0'; - if (len == 1) - *buf = (char) ch; - else - { - *buf = ((1 << len) - 1) << (8 - len); - while (--len > 0) - { - buf[len] = (char) (0x80 | (ch & 0x3F)); - ch >>= 6; - } - *buf |= ch; - } + ch = 0xFFFD; /* REPLACEMENT CHARACTER */ + put_wchar(&p, ch); + *p = '\0'; } return (buf); } @@ -524,11 +503,12 @@ utf_len(ch) } /* - * Is a UTF-8 character well-formed? + * Does the parameter point to the lead byte of a well-formed UTF-8 character? */ public int -is_utf8_well_formed(s) +is_utf8_well_formed(s, slen) unsigned char *s; + int slen; { int i; int len; @@ -537,6 +517,8 @@ is_utf8_well_formed(s) return (0); len = utf_len((char) s[0]); + if (len > slen) + return (0); if (len == 1) return (1); if (len == 2) @@ -558,6 +540,35 @@ is_utf8_well_formed(s) } /* + * Return number of invalid UTF-8 sequences found in a buffer. + */ + public int +utf_bin_count(data, len) + unsigned char *data; + int len; +{ + int bin_count = 0; + while (len > 0) + { + if (is_utf8_well_formed(data, len)) + { + int clen = utf_len(*data); + data += clen; + len -= clen; + } else + { + /* Skip to next lead byte. */ + bin_count++; + do { + ++data; + --len; + } while (len > 0 && !IS_UTF8_LEAD(*data)); + } + } + return (bin_count); +} + +/* * Get the value of a UTF-8 character. */ public LWCHAR @@ -706,411 +717,51 @@ step_char(pp, dir, limit) /* * Unicode characters data + * Actual data is in the generated *.uni files. */ -struct wchar_range { LWCHAR first, last; }; -/* - * Characters with general category values - * Mn: Mark, Nonspacing - * Me: Mark, Enclosing - * Last synched with - * - * dated 2005-11-30T00:58:48Z - */ -static struct wchar_range comp_table[] = { - { 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */, - { 0x0488, 0x0489} /* Me */, - { 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */, - { 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */, - { 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */, - { 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */, - { 0x06D6, 0x06DC} /* Mn */, - { 0x06DE, 0x06DE} /* Me */, - { 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */, - { 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */, - { 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */, - { 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */, - { 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */, - { 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */, - { 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */, - { 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */, - { 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */, - { 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */, - { 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */, - { 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */, - { 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */, - { 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */, - { 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */, - { 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */, - { 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */, - { 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */, - { 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */, - { 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */, - { 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */, - { 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */, - { 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */, - { 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */, - { 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */, - { 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */, - { 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */, - { 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */, - { 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */, - { 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */, - { 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */, - { 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */, - { 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */, - { 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */, - { 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */, - { 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */, - { 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */, - { 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */, - { 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */, - { 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */, - { 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */, - { 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */, - { 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */, - { 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */, - { 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */, - { 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */, - { 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */, - { 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */, - { 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */, - { 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */, - { 0x20DD, 0x20E0} /* Me */, - { 0x20E1, 0x20E1} /* Mn */, - { 0x20E2, 0x20E4} /* Me */, - { 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */, - { 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */, - { 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */, - { 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */, - { 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */, - { 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */, - { 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */, - { 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */, - { 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */, - { 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */, -}; +#define DECLARE_RANGE_TABLE_START(name) \ + static struct wchar_range name##_array[] = { +#define DECLARE_RANGE_TABLE_END(name) \ + }; struct wchar_range_table name##_table = { name##_array, sizeof(name##_array)/sizeof(*name##_array) }; -/* - * Special pairs, not ranges. - */ +DECLARE_RANGE_TABLE_START(compose) +#include "compose.uni" +DECLARE_RANGE_TABLE_END(compose) + +DECLARE_RANGE_TABLE_START(ubin) +#include "ubin.uni" +DECLARE_RANGE_TABLE_END(ubin) + +DECLARE_RANGE_TABLE_START(wide) +#include "wide.uni" +DECLARE_RANGE_TABLE_END(wide) + +/* comb_table is special pairs, not ranges. */ static struct wchar_range comb_table[] = { {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, }; -/* - * Characters with general category values - * Cc: Other, Control - * Cf: Other, Format - * Cs: Other, Surrogate - * Co: Other, Private Use - * Cn: Other, Not Assigned - * Zl: Separator, Line - * Zp: Separator, Paragraph - * Last synched with - * - * dated 2005-11-30T00:58:48Z - */ -static struct wchar_range ubin_table[] = { - { 0x0000, 0x0007} /* Cc */, - { 0x000B, 0x000C} /* Cc */, - { 0x000E, 0x001A} /* Cc */, - { 0x001C, 0x001F} /* Cc */, - { 0x007F, 0x009F} /* Cc */, -#if 0 - { 0x00AD, 0x00AD} /* Cf */, -#endif - { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, - { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */, - { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */, - { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */, - { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */, - { 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */, - { 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */, - { 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */, -#if 0 - { 0x0600, 0x0603} /* Cf */, -#endif - { 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */, - { 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */, - { 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */, -#if 0 - { 0x06DD, 0x06DD} /* Cf */, -#endif - { 0x070E, 0x070E} /* Cn */, -#if 0 - { 0x070F, 0x070F} /* Cf */, -#endif - { 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */, - { 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */, - { 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */, - { 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */, - { 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, - { 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */, - { 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */, - { 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */, - { 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */, - { 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */, - { 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */, - { 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */, - { 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */, - { 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */, - { 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */, - { 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */, - { 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */, - { 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */, - { 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */, - { 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */, - { 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */, - { 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */, - { 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */, - { 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */, - { 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */, - { 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */, - { 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */, - { 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */, - { 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */, - { 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */, - { 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */, - { 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */, - { 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */, - { 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */, - { 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */, - { 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */, - { 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */, - { 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */, - { 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */, - { 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */, - { 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */, - { 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */, - { 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */, - { 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */, - { 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */, - { 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */, - { 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */, - { 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */, - { 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */, - { 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */, - { 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */, - { 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */, - { 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */, - { 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */, - { 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */, - { 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */, - { 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */, - { 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */, - { 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */, - { 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */, - { 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */, - { 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */, - { 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */, - { 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */, - { 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */, - { 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */, - { 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */, - { 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */, - { 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */, - { 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */, - { 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */, - { 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */, - { 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */, - { 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */, - { 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */, - { 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */, - { 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */, - { 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */, - { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, - { 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */, - { 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */, - { 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */, - { 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */, - { 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */, - { 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */, - { 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */, - { 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */, - { 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */, - { 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */, - { 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */, - { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, - { 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */, - { 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */, - { 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */, - { 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */, - { 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */, - { 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */, - { 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */, -#if 0 - { 0x17B4, 0x17B5} /* Cf */, -#endif - { 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */, - { 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */, - { 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */, - { 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */, - { 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */, - { 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */, - { 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */, - { 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */, - { 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */, - { 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */, - { 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */, - { 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */, - { 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */, - { 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */, - { 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */, - { 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */, - { 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */, - { 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */, - { 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */, - { 0x1FFF, 0x1FFF} /* Cn */, - { 0x200B, 0x200F} /* Cf */, - { 0x2028, 0x2028} /* Zl */, - { 0x2029, 0x2029} /* Zp */, - { 0x202A, 0x202E} /* Cf */, - { 0x2060, 0x2063} /* Cf */, - { 0x2064, 0x2069} /* Cn */, - { 0x206A, 0x206F} /* Cf */, - { 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */, - { 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */, - { 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */, - { 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */, - { 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */, - { 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */, - { 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */, - { 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */, - { 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */, - { 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */, - { 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */, - { 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */, - { 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */, - { 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */, - { 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */, - { 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */, - { 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */, - { 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */, - { 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */, - { 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */, - { 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */, - { 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */, - { 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */, - { 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */, - { 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */, - { 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */, - { 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */, - { 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */, - { 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */, - { 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */, - { 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */, - { 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */, - { 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */, - { 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */, - { 0xD7A4, 0xD7FF} /* Cn */, - { 0xD800, 0xDFFF} /* Cs */, - { 0xE000, 0xF8FF} /* Co */, - { 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */, - { 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */, - { 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */, - { 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */, - { 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */, - { 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */, - { 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */, - { 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */, - { 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */, - { 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */, - { 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */, - { 0xFEFF, 0xFEFF} /* Cf */, - { 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */, - { 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */, - { 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */, - { 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */, - { 0xFFF9, 0xFFFB} /* Cf */, - { 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */, - { 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */, - { 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */, - { 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */, - { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, - { 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */, - { 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */, - { 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */, - { 0x103D6, 0x103FF} /* Cn */, - { 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */, - { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, - { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */, - { 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */, - { 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */, - { 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */, - { 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */, - { 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */, - { 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */, - { 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */, - { 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */, - { 0x1D127, 0x1D129} /* Cn */, - { 0x1D173, 0x1D17A} /* Cf */, - { 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */, - { 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */, - { 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */, - { 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */, - { 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */, - { 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */, - { 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */, - { 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */, - { 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */, - { 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */, - { 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */, - { 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */, - { 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */, - { 0x2FA1E, 0xE0000} /* Cn */, - { 0xE0001, 0xE0001} /* Cf */, - { 0xE0002, 0xE001F} /* Cn */, - { 0xE0020, 0xE007F} /* Cf */, - { 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */, - { 0xF0000, 0xFFFFD} /* Co */, - { 0xFFFFE, 0xFFFFF} /* Cn */, - {0x100000,0x10FFFD} /* Co */, - {0x10FFFE,0x10FFFF} /* Cn */, - {0x110000,0x7FFFFFFF} /* ISO 10646?? */ -}; - -/* - * Double width characters - * W: East Asian Wide - * F: East Asian Full-width - * Unassigned code points may be included when they allow ranges to be merged. - * Last synched with - * - * dated 2005-11-08T01:32:56Z - */ -static struct wchar_range wide_table[] = { - { 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */, - { 0x2E80, 0x2FFB} /* W */, - { 0x3000, 0x3000} /* F */, - { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, - { 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */, - { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */, - { 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */, - { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, - { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, -}; static int -is_in_table(ch, table, tsize) +is_in_table(ch, table) LWCHAR ch; - struct wchar_range table[]; - int tsize; + struct wchar_range_table *table; { int hi; int lo; /* Binary search in the table. */ - if (ch < table[0].first) + if (ch < table->table[0].first) return 0; lo = 0; - hi = tsize - 1; + hi = table->count - 1; while (lo <= hi) { int mid = (lo + hi) / 2; - if (ch > table[mid].last) + if (ch > table->table[mid].last) lo = mid + 1; - else if (ch < table[mid].first) + else if (ch < table->table[mid].first) hi = mid - 1; else return 1; @@ -1126,7 +777,7 @@ is_in_table(ch, table, tsize) is_composing_char(ch) LWCHAR ch; { - return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); + return is_in_table(ch, &compose_table); } /* @@ -1136,7 +787,7 @@ is_composing_char(ch) is_ubin_char(ch) LWCHAR ch; { - return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); + return is_in_table(ch, &ubin_table); } /* @@ -1146,7 +797,7 @@ is_ubin_char(ch) is_wide_char(ch) LWCHAR ch; { - return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); + return is_in_table(ch, &wide_table); } /* Modified: vendor/less/dist/charset.h ============================================================================== --- vendor/less/dist/charset.h Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/charset.h Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: vendor/less/dist/cmd.h ============================================================================== --- vendor/less/dist/cmd.h Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/cmd.h Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -66,6 +66,7 @@ #define A_PREV_TAG 54 #define A_FILTER 55 #define A_F_UNTIL_HILITE 56 +#define A_GOEND_BUF 57 #define A_INVALID 100 #define A_NOACTION 101 Modified: vendor/less/dist/cmdbuf.c ============================================================================== --- vendor/less/dist/cmdbuf.c Mon Jan 4 00:02:58 2016 (r293124) +++ vendor/less/dist/cmdbuf.c Mon Jan 4 00:22:34 2016 (r293125) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2012 Mark Nudelman + * Copyright (C) 1984-2015 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -203,7 +203,7 @@ cmd_step_common(p, ch, len, pwidth, bswi pr = prchar((int) ch); if (pwidth != NULL || bswidth != NULL) { - int len = strlen(pr); + int len = (int) strlen(pr); if (pwidth != NULL) *pwidth = len; if (bswidth != NULL) @@ -222,7 +222,7 @@ cmd_step_common(p, ch, len, pwidth, bswi *bswidth = 0; } else if (is_ubin_char(ch)) { - int len = strlen(pr); + int len = (int) strlen(pr); if (pwidth != NULL) *pwidth = len; if (bswidth != NULL) @@ -375,7 +375,7 @@ cmd_lshift() s = ns; } - cmd_offset = s - cmdbuf; + cmd_offset = (int) (s - cmdbuf); save_cp = cp; cmd_home(); cmd_repaint(save_cp); @@ -405,7 +405,7 @@ cmd_rshift() cols += width; } - cmd_offset = s - cmdbuf; + cmd_offset = (int) (s - cmdbuf); save_cp = cp; cmd_home(); cmd_repaint(save_cp); @@ -535,7 +535,7 @@ cmd_erase() */ s = cp; cmd_left(); - clen = s - cp; + clen = (int) (s - cp); /* * Remove the char from the buffer (shift the buffer left). @@ -701,7 +701,7 @@ cmd_updown(action) if (updown_match < 0) { - updown_match = cp - cmdbuf; + updown_match = (int) (cp - cmdbuf); } /* @@ -744,12 +744,13 @@ cmd_updown(action) #endif /* - * Add a string to a history list. + * Add a string to an mlist. */ public void -cmd_addhist(mlist, cmd) +cmd_addhist(mlist, cmd, modified) struct mlist *mlist; char *cmd; + int modified; { #if CMD_HISTORY struct mlist *ml; @@ -773,6 +774,7 @@ cmd_addhist(mlist, cmd) */ ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); + ml->modified = modified; ml->next = mlist; ml->prev = mlist->prev; mlist->prev->next = ml; @@ -799,7 +801,7 @@ cmd_accept() */ if (curr_mlist == NULL) return; - cmd_addhist(curr_mlist, cmdbuf); + cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; #endif } @@ -965,7 +967,7 @@ delimit_word() int delim_quoted = 0; int meta_quoted = 0; char *esc = get_meta_escape(); - int esclen = strlen(esc); + int esclen = (int) strlen(esc); #endif /* @@ -1262,7 +1264,7 @@ cmd_char(c) cmd_mbc_buf[cmd_mbc_buf_index++] = c; if (cmd_mbc_buf_index < cmd_mbc_buf_len) return (CC_OK); - if (!is_utf8_well_formed(cmd_mbc_buf)) + if (!is_utf8_well_formed(cmd_mbc_buf, cmd_mbc_buf_index)) { /* complete, but not well formed (non-shortest form), sequence */ cmd_mbc_buf_len = 0; @@ -1359,6 +1361,18 @@ cmd_lastpattern() #if CMD_HISTORY /* + */ + static int +mlist_size(ml) + struct mlist *ml; +{ + int size = 0; + for (ml = ml->next; ml->string != NULL; ml = ml->next) + ++size; + return size; +} + +/* * Get the name of the history file. */ static char * @@ -1378,6 +1392,10 @@ histfile_name() return (save(name)); } + /* See if history file is disabled in the build. */ + if (strcmp(LESSHISTFILE, "") == 0 || strcmp(LESSHISTFILE, "-") == 0) + return (NULL); + /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Mon Jan 4 00:23:28 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34B3BA60AFA; Mon, 4 Jan 2016 00:23:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF40312C7; Mon, 4 Jan 2016 00:23:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u040NQgS005385; Mon, 4 Jan 2016 00:23:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u040NQl8005384; Mon, 4 Jan 2016 00:23:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201601040023.u040NQl8005384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 4 Jan 2016 00:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293126 - vendor/less/v481 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2016 00:23:28 -0000 Author: delphij Date: Mon Jan 4 00:23:26 2016 New Revision: 293126 URL: https://svnweb.freebsd.org/changeset/base/293126 Log: Tag less v481. Added: vendor/less/v481/ - copied from r293125, vendor/less/dist/ From owner-svn-src-vendor@freebsd.org Mon Jan 4 21:30:56 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 386BEA622C4; Mon, 4 Jan 2016 21:30:56 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA0561E4E; Mon, 4 Jan 2016 21:30:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u04LUtbh051954; Mon, 4 Jan 2016 21:30:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u04LUs6q051948; Mon, 4 Jan 2016 21:30:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601042130.u04LUs6q051948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 4 Jan 2016 21:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293181 - vendor/llvm-libunwind/dist/src X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2016 21:30:56 -0000 Author: emaste Date: Mon Jan 4 21:30:54 2016 New Revision: 293181 URL: https://svnweb.freebsd.org/changeset/base/293181 Log: Import LLVM libunwind snapshot revision 256779 From https://llvm.org/svn/llvm-project/libunwind/trunk/ Modified: vendor/llvm-libunwind/dist/src/AddressSpace.hpp vendor/llvm-libunwind/dist/src/DwarfParser.hpp vendor/llvm-libunwind/dist/src/UnwindCursor.hpp vendor/llvm-libunwind/dist/src/UnwindRegistersSave.S vendor/llvm-libunwind/dist/src/config.h vendor/llvm-libunwind/dist/src/libunwind.cpp Modified: vendor/llvm-libunwind/dist/src/AddressSpace.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/AddressSpace.hpp Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/AddressSpace.hpp Mon Jan 4 21:30:54 2016 (r293181) @@ -35,7 +35,11 @@ namespace libunwind { #include "Registers.hpp" #if _LIBUNWIND_ARM_EHABI -#ifdef __linux__ +#if defined(__FreeBSD__) + +typedef void *_Unwind_Ptr; + +#elif defined(__linux__) typedef long unsigned int *_Unwind_Ptr; extern "C" _Unwind_Ptr __gnu_Unwind_Find_exidx(_Unwind_Ptr addr, int *len); Modified: vendor/llvm-libunwind/dist/src/DwarfParser.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/DwarfParser.hpp Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/DwarfParser.hpp Mon Jan 4 21:30:54 2016 (r293181) @@ -380,7 +380,9 @@ bool CFI_Parser::parseInstructions(A uint64_t length; uint8_t opcode = addressSpace.get8(p); uint8_t operand; +#if !defined(_LIBUNWIND_NO_HEAP) PrologInfoStackEntry *entry; +#endif ++p; switch (opcode) { case DW_CFA_nop: @@ -492,6 +494,7 @@ bool CFI_Parser::parseInstructions(A fprintf(stderr, "DW_CFA_register(reg=%" PRIu64 ", reg2=%" PRIu64 ")\n", reg, reg2); break; +#if !defined(_LIBUNWIND_NO_HEAP) case DW_CFA_remember_state: // avoid operator new, because that would be an upward dependency entry = (PrologInfoStackEntry *)malloc(sizeof(PrologInfoStackEntry)); @@ -517,6 +520,7 @@ bool CFI_Parser::parseInstructions(A if (logDwarf) fprintf(stderr, "DW_CFA_restore_state\n"); break; +#endif case DW_CFA_def_cfa: reg = addressSpace.getULEB128(p, instructionsEnd); offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd); Modified: vendor/llvm-libunwind/dist/src/UnwindCursor.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/UnwindCursor.hpp Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/UnwindCursor.hpp Mon Jan 4 21:30:54 2016 (r293181) @@ -114,6 +114,7 @@ typename A::pint_t DwarfFDECache::fin template void DwarfFDECache::add(pint_t mh, pint_t ip_start, pint_t ip_end, pint_t fde) { +#if !defined(_LIBUNWIND_NO_HEAP) _LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_wrlock(&_lock)); if (_bufferUsed >= _bufferEnd) { size_t oldSize = (size_t)(_bufferEnd - _buffer); @@ -139,6 +140,7 @@ void DwarfFDECache::add(pint_t mh, pi } #endif _LIBUNWIND_LOG_NON_ZERO(::pthread_rwlock_unlock(&_lock)); +#endif } template Modified: vendor/llvm-libunwind/dist/src/UnwindRegistersSave.S ============================================================================== --- vendor/llvm-libunwind/dist/src/UnwindRegistersSave.S Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/UnwindRegistersSave.S Mon Jan 4 21:30:54 2016 (r293181) @@ -87,6 +87,15 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext xorl %eax, %eax # return UNW_ESUCCESS ret +# elif defined(__mips__) + +# +# extern int unw_getcontext(unw_context_t* thread_state) +# +# Just trap for the time being. +DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) + teq $0, $0 + #elif defined(__ppc__) ; Modified: vendor/llvm-libunwind/dist/src/config.h ============================================================================== --- vendor/llvm-libunwind/dist/src/config.h Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/config.h Mon Jan 4 21:30:54 2016 (r293181) @@ -41,7 +41,8 @@ #define _LIBUNWIND_BUILD_ZERO_COST_APIS (defined(__i386__) || \ defined(__x86_64__) || \ - defined(__arm64__)) + defined(__arm64__) || \ + defined(__mips__)) #define _LIBUNWIND_BUILD_SJLJ_APIS defined(__arm__) #define _LIBUNWIND_SUPPORT_FRAME_APIS (defined(__i386__) || \ defined(__x86_64__)) Modified: vendor/llvm-libunwind/dist/src/libunwind.cpp ============================================================================== --- vendor/llvm-libunwind/dist/src/libunwind.cpp Mon Jan 4 21:16:49 2016 (r293180) +++ vendor/llvm-libunwind/dist/src/libunwind.cpp Mon Jan 4 21:30:54 2016 (r293181) @@ -64,6 +64,8 @@ _LIBUNWIND_EXPORT int unw_init_local(unw #elif defined(__or1k__) new ((void *)cursor) UnwindCursor( context, LocalAddressSpace::sThisAddressSpace); +#elif defined(__mips__) +#warning The MIPS architecture is not supported. #else #error Architecture not supported #endif From owner-svn-src-vendor@freebsd.org Mon Jan 4 21:32:00 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65AC2A623D4; Mon, 4 Jan 2016 21:32:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CDA61135; Mon, 4 Jan 2016 21:32:00 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u04LVxPC053963; Mon, 4 Jan 2016 21:31:59 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u04LVxSY053962; Mon, 4 Jan 2016 21:31:59 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201601042131.u04LVxSY053962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 4 Jan 2016 21:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293182 - vendor/llvm-libunwind/libunwind-r256779 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jan 2016 21:32:00 -0000 Author: emaste Date: Mon Jan 4 21:31:59 2016 New Revision: 293182 URL: https://svnweb.freebsd.org/changeset/base/293182 Log: Tag LLVM libunwind r256779 Added: vendor/llvm-libunwind/libunwind-r256779/ - copied from r293181, vendor/llvm-libunwind/dist/ From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:01:05 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E80E7A65641; Wed, 6 Jan 2016 20:01:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 85330185E; Wed, 6 Jan 2016 20:01:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K14IK082080; Wed, 6 Jan 2016 20:01:04 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K13xg082064; Wed, 6 Jan 2016 20:01:03 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062001.u06K13xg082064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:01:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293248 - in vendor/llvm/dist: docs include/llvm/Analysis include/llvm/CodeGen include/llvm/IR include/llvm/MC include/llvm/ProfileData include/llvm/Support include/llvm/TableGen includ... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:01:06 -0000 Author: dim Date: Wed Jan 6 20:01:02 2016 New Revision: 293248 URL: https://svnweb.freebsd.org/changeset/base/293248 Log: Vendor import of llvm trunk r256945: https://llvm.org/svn/llvm-project/llvm/trunk@256945 Added: vendor/llvm/dist/lib/Fuzzer/test/ThreadedTest.cpp (contents, props changed) vendor/llvm/dist/lib/Fuzzer/test/fuzzer-threaded.test vendor/llvm/dist/lib/Target/Hexagon/HexagonSystemInst.td vendor/llvm/dist/lib/Target/X86/X86ShuffleDecodeConstantPool.cpp (contents, props changed) vendor/llvm/dist/lib/Target/X86/X86ShuffleDecodeConstantPool.h (contents, props changed) vendor/llvm/dist/test/Analysis/GlobalsModRef/inaccessiblememonly.ll vendor/llvm/dist/test/Analysis/ValueTracking/known-power-of-two.ll vendor/llvm/dist/test/CodeGen/AMDGPU/spill-alloc-sgpr-init-bug.ll vendor/llvm/dist/test/CodeGen/X86/copy-eflags.ll vendor/llvm/dist/test/CodeGen/X86/insertelement-zero.ll vendor/llvm/dist/test/CodeGen/X86/insertps-combine.ll vendor/llvm/dist/test/CodeGen/X86/materialize-one.ll vendor/llvm/dist/test/CodeGen/X86/pku.ll vendor/llvm/dist/test/CodeGen/X86/x86-64-flags-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/x86-flags-intrinsics.ll vendor/llvm/dist/test/Transforms/LICM/funclet.ll vendor/llvm/dist/test/Transforms/MemCpyOpt/fca2memcpy.ll vendor/llvm/dist/test/Transforms/PlaceSafepoints/leaf-function.ll vendor/llvm/dist/test/Transforms/Reassociate/factorize-again.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/empty-catchpad.ll Deleted: vendor/llvm/dist/test/Analysis/GlobalsModRef/argmemonly-escape.ll vendor/llvm/dist/test/CodeGen/X86/materialize.ll Modified: vendor/llvm/dist/docs/CMake.rst vendor/llvm/dist/docs/CoverageMappingFormat.rst vendor/llvm/dist/docs/GettingStarted.rst vendor/llvm/dist/docs/MCJITDesignAndImplementation.rst vendor/llvm/dist/include/llvm/Analysis/MemoryBuiltins.h vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBuilder.h vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBundle.h vendor/llvm/dist/include/llvm/CodeGen/WinEHFuncInfo.h vendor/llvm/dist/include/llvm/IR/CallSite.h vendor/llvm/dist/include/llvm/IR/IRBuilder.h vendor/llvm/dist/include/llvm/IR/Instructions.h vendor/llvm/dist/include/llvm/IR/IntrinsicsX86.td vendor/llvm/dist/include/llvm/IR/Metadata.h vendor/llvm/dist/include/llvm/IR/Statepoint.h vendor/llvm/dist/include/llvm/MC/SubtargetFeature.h vendor/llvm/dist/include/llvm/ProfileData/InstrProf.h vendor/llvm/dist/include/llvm/ProfileData/InstrProfData.inc vendor/llvm/dist/include/llvm/Support/ARMTargetParser.def vendor/llvm/dist/include/llvm/Support/Program.h vendor/llvm/dist/include/llvm/Support/YAMLParser.h vendor/llvm/dist/include/llvm/TableGen/Record.h vendor/llvm/dist/include/llvm/Target/Target.td vendor/llvm/dist/include/llvm/Target/TargetLowering.h vendor/llvm/dist/include/llvm/Transforms/Utils/BypassSlowDivision.h vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h vendor/llvm/dist/lib/Analysis/BasicAliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/GlobalsModRef.cpp vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/TargetLibraryInfo.cpp vendor/llvm/dist/lib/Analysis/ValueTracking.cpp vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/WinException.cpp vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp vendor/llvm/dist/lib/CodeGen/MachineCSE.cpp vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp vendor/llvm/dist/lib/CodeGen/MachineInstrBundle.cpp vendor/llvm/dist/lib/CodeGen/RegisterPressure.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/StatepointLowering.cpp vendor/llvm/dist/lib/CodeGen/TargetSchedule.cpp vendor/llvm/dist/lib/CodeGen/WinEHPrepare.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerDriver.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerFlags.def vendor/llvm/dist/lib/Fuzzer/FuzzerInternal.h vendor/llvm/dist/lib/Fuzzer/FuzzerLoop.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerMutate.cpp vendor/llvm/dist/lib/Fuzzer/FuzzerTraceState.cpp vendor/llvm/dist/lib/Fuzzer/test/CMakeLists.txt vendor/llvm/dist/lib/Fuzzer/test/fuzzer.test vendor/llvm/dist/lib/IR/AsmWriter.cpp vendor/llvm/dist/lib/IR/Attributes.cpp vendor/llvm/dist/lib/IR/Instruction.cpp vendor/llvm/dist/lib/IR/Instructions.cpp vendor/llvm/dist/lib/IR/Metadata.cpp vendor/llvm/dist/lib/IR/Statepoint.cpp vendor/llvm/dist/lib/IR/Verifier.cpp vendor/llvm/dist/lib/Linker/IRMover.cpp vendor/llvm/dist/lib/MC/MCDwarf.cpp vendor/llvm/dist/lib/MC/MCObjectFileInfo.cpp vendor/llvm/dist/lib/MC/MCSubtargetInfo.cpp vendor/llvm/dist/lib/MC/SubtargetFeature.cpp vendor/llvm/dist/lib/ProfileData/CoverageMappingReader.cpp vendor/llvm/dist/lib/ProfileData/InstrProf.cpp vendor/llvm/dist/lib/Support/Unix/Program.inc vendor/llvm/dist/lib/Support/Windows/Program.inc vendor/llvm/dist/lib/Support/Windows/WindowsSupport.h vendor/llvm/dist/lib/Support/raw_ostream.cpp vendor/llvm/dist/lib/TableGen/Record.cpp vendor/llvm/dist/lib/TableGen/TGParser.cpp vendor/llvm/dist/lib/TableGen/TGParser.h vendor/llvm/dist/lib/Target/AArch64/AArch64.td vendor/llvm/dist/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64Subtarget.h vendor/llvm/dist/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp vendor/llvm/dist/lib/Target/AArch64/Utils/AArch64BaseInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPU.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSubtarget.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSubtarget.h vendor/llvm/dist/lib/Target/AMDGPU/CIInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/SIFrameLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.td vendor/llvm/dist/lib/Target/AMDGPU/SIInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/VIInstructions.td vendor/llvm/dist/lib/Target/ARM/ARM.td vendor/llvm/dist/lib/Target/ARM/ARMConstantIslandPass.cpp vendor/llvm/dist/lib/Target/ARM/ARMLoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARMSubtarget.h vendor/llvm/dist/lib/Target/Hexagon/Hexagon.td vendor/llvm/dist/lib/Target/Hexagon/HexagonInstrInfo.td vendor/llvm/dist/lib/Target/WebAssembly/known_gcc_test_failures.txt vendor/llvm/dist/lib/Target/X86/CMakeLists.txt vendor/llvm/dist/lib/Target/X86/InstPrinter/X86InstComments.cpp vendor/llvm/dist/lib/Target/X86/Utils/X86ShuffleDecode.cpp vendor/llvm/dist/lib/Target/X86/Utils/X86ShuffleDecode.h vendor/llvm/dist/lib/Target/X86/X86FastISel.cpp vendor/llvm/dist/lib/Target/X86/X86FrameLowering.cpp vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.h vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td vendor/llvm/dist/lib/Target/X86/X86InstrCompiler.td vendor/llvm/dist/lib/Target/X86/X86InstrInfo.cpp vendor/llvm/dist/lib/Target/X86/X86InstrInfo.h vendor/llvm/dist/lib/Target/X86/X86InstrInfo.td vendor/llvm/dist/lib/Target/X86/X86InstrMMX.td vendor/llvm/dist/lib/Target/X86/X86InstrMPX.td vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td vendor/llvm/dist/lib/Target/X86/X86InstrSystem.td vendor/llvm/dist/lib/Target/X86/X86IntrinsicsInfo.h vendor/llvm/dist/lib/Target/X86/X86MCInstLower.cpp vendor/llvm/dist/lib/Transforms/IPO/InferFunctionAttrs.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCasts.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineInternal.h vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineVectorOps.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstructionCombining.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/InstrProfiling.cpp vendor/llvm/dist/lib/Transforms/Scalar/LICM.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopIdiomRecognize.cpp vendor/llvm/dist/lib/Transforms/Scalar/MemCpyOptimizer.cpp vendor/llvm/dist/lib/Transforms/Scalar/Reassociate.cpp vendor/llvm/dist/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp vendor/llvm/dist/lib/Transforms/Utils/BypassSlowDivision.cpp vendor/llvm/dist/lib/Transforms/Utils/Local.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyLibCalls.cpp vendor/llvm/dist/lib/Transforms/Utils/ValueMapper.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist/test/Analysis/BasicAA/memset_pattern.ll vendor/llvm/dist/test/Analysis/GlobalsModRef/modreftest.ll vendor/llvm/dist/test/Bitcode/compatibility.ll vendor/llvm/dist/test/CodeGen/AArch64/arm64-vector-ext.ll vendor/llvm/dist/test/CodeGen/AArch64/cpus.ll vendor/llvm/dist/test/CodeGen/AArch64/remat.ll vendor/llvm/dist/test/CodeGen/AArch64/tbz-tbnz.ll vendor/llvm/dist/test/CodeGen/AMDGPU/flat-scratch-reg.ll vendor/llvm/dist/test/CodeGen/AMDGPU/large-alloca-compute.ll vendor/llvm/dist/test/CodeGen/AMDGPU/large-alloca-graphics.ll vendor/llvm/dist/test/CodeGen/AMDGPU/load.ll vendor/llvm/dist/test/CodeGen/AMDGPU/salu-to-valu.ll vendor/llvm/dist/test/CodeGen/ARM/build-attributes.ll vendor/llvm/dist/test/CodeGen/ARM/debugtrap.ll vendor/llvm/dist/test/CodeGen/WebAssembly/offset.ll vendor/llvm/dist/test/CodeGen/WinEH/wineh-cloning.ll vendor/llvm/dist/test/CodeGen/X86/2009-06-03-Win64SpillXMM.ll vendor/llvm/dist/test/CodeGen/X86/2011-11-30-or.ll vendor/llvm/dist/test/CodeGen/X86/avx-cast.ll vendor/llvm/dist/test/CodeGen/X86/avx512-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512bw-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512bwvl-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512cd-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/avx512vl-intrinsics.ll vendor/llvm/dist/test/CodeGen/X86/cmpxchg-clobber-flags.ll vendor/llvm/dist/test/CodeGen/X86/divrem8_ext.ll vendor/llvm/dist/test/CodeGen/X86/fold-load-unops.ll vendor/llvm/dist/test/CodeGen/X86/fpcmp-soft-fp.ll vendor/llvm/dist/test/CodeGen/X86/inline-sse.ll vendor/llvm/dist/test/CodeGen/X86/peephole-na-phys-copy-folding.ll vendor/llvm/dist/test/CodeGen/X86/powi.ll vendor/llvm/dist/test/CodeGen/X86/pr11415.ll vendor/llvm/dist/test/CodeGen/X86/pr21792.ll vendor/llvm/dist/test/CodeGen/X86/pr24139.ll vendor/llvm/dist/test/CodeGen/X86/sse3-avx-addsub.ll vendor/llvm/dist/test/CodeGen/X86/statepoint-far-call.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-64-xsave.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-64-xsavec.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-64-xsaveopt.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-64-xsaves.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-xsave.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-xsavec.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-xsaveopt.ll vendor/llvm/dist/test/CodeGen/X86/system-intrinsics-xsaves.ll vendor/llvm/dist/test/CodeGen/X86/vec_insert-7.ll vendor/llvm/dist/test/CodeGen/X86/vec_partial.ll vendor/llvm/dist/test/CodeGen/X86/vec_reassociate.ll vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-128-v4.ll vendor/llvm/dist/test/CodeGen/X86/win64_frame.ll vendor/llvm/dist/test/CodeGen/X86/wineh-coreclr.ll vendor/llvm/dist/test/CodeGen/X86/x86-32-intrcc.ll vendor/llvm/dist/test/CodeGen/X86/x86-64-intrcc.ll vendor/llvm/dist/test/CodeGen/X86/x86-win64-shrink-wrapping.ll vendor/llvm/dist/test/DebugInfo/COFF/asm.ll vendor/llvm/dist/test/DebugInfo/debugmacinfo.test vendor/llvm/dist/test/JitListener/multiple.ll vendor/llvm/dist/test/JitListener/simple.ll vendor/llvm/dist/test/MC/ARM/gas-compl-copr-reg.s vendor/llvm/dist/test/Transforms/EarlyCSE/AArch64/ldstN.ll vendor/llvm/dist/test/Transforms/InferFunctionAttrs/annotate.ll vendor/llvm/dist/test/Transforms/InstCombine/double-float-shrink-1.ll vendor/llvm/dist/test/Transforms/InstCombine/fast-math.ll vendor/llvm/dist/test/Transforms/InstCombine/insert-extract-shuffle.ll vendor/llvm/dist/test/Transforms/InstCombine/token.ll vendor/llvm/dist/test/Transforms/InstSimplify/call.ll vendor/llvm/dist/test/Transforms/LICM/sinking.ll vendor/llvm/dist/test/Transforms/PlaceSafepoints/statepoint-coreclr.ll vendor/llvm/dist/test/Transforms/Reassociate/secondary.ll vendor/llvm/dist/test/Transforms/SimplifyCFG/wineh-unreachable.ll vendor/llvm/dist/test/Verifier/invalid-eh.ll vendor/llvm/dist/test/tools/llvm-pdbdump/class-layout.test vendor/llvm/dist/test/tools/llvm-pdbdump/enum-layout.test vendor/llvm/dist/test/tools/llvm-pdbdump/load-address.test vendor/llvm/dist/test/tools/llvm-symbolizer/pdb/lit.local.cfg vendor/llvm/dist/unittests/IR/IRBuilderTest.cpp vendor/llvm/dist/unittests/IR/MetadataTest.cpp vendor/llvm/dist/unittests/IR/TypesTest.cpp vendor/llvm/dist/unittests/ProfileData/InstrProfTest.cpp vendor/llvm/dist/unittests/Support/YAMLParserTest.cpp vendor/llvm/dist/utils/TableGen/AsmMatcherEmitter.cpp vendor/llvm/dist/utils/TableGen/SubtargetEmitter.cpp vendor/llvm/dist/utils/TableGen/TableGen.cpp Modified: vendor/llvm/dist/docs/CMake.rst ============================================================================== --- vendor/llvm/dist/docs/CMake.rst Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/docs/CMake.rst Wed Jan 6 20:01:02 2016 (r293248) @@ -26,7 +26,10 @@ Quick start We use here the command-line, non-interactive CMake interface. #. `Download `_ and install - CMake. Version 2.8.8 is the minimum required. + CMake. Version 2.8.8 is the minimum required, but if you're using the Ninja + backend, CMake v3.2 or newer is required to `get interactive output + `_ + when running :doc:`Lit `. #. Open a shell. Your development tools must be reachable from this shell through the PATH environment variable. Modified: vendor/llvm/dist/docs/CoverageMappingFormat.rst ============================================================================== --- vendor/llvm/dist/docs/CoverageMappingFormat.rst Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/docs/CoverageMappingFormat.rst Wed Jan 6 20:01:02 2016 (r293248) @@ -241,15 +241,25 @@ For example, let’s consider a C file a return 13; } -The coverage mapping variable generated by Clang is: +The coverage mapping variable generated by Clang has 3 fields: + +* Coverage mapping header. + +* An array of function records. + +* Coverage mapping data which is an array of bytes. Zero paddings are added at the end to force 8 byte alignment. .. code-block:: llvm - @__llvm_coverage_mapping = internal constant { i32, i32, i32, i32, [2 x { i8*, i32, i32 }], [40 x i8] } - { i32 2, ; The number of function records - i32 20, ; The length of the string that contains the encoded translation unit filenames - i32 20, ; The length of the string that contains the encoded coverage mapping data - i32 0, ; Coverage mapping format version + @__llvm_coverage_mapping = internal constant { { i32, i32, i32, i32 }, [2 x { i8*, i32, i32 }], [40 x i8] } + { + { i32, i32, i32, i32 } ; Coverage map header + { + i32 2, ; The number of function records + i32 20, ; The length of the string that contains the encoded translation unit filenames + i32 20, ; The length of the string that contains the encoded coverage mapping data + i32 0, ; Coverage mapping format version + }, [2 x { i8*, i32, i32 }] [ ; Function records { i8*, i32, i32 } { i8* getelementptr inbounds ([3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), ; Function's name i32 3, ; Function's name length @@ -262,12 +272,18 @@ The coverage mapping variable generated [40 x i8] c"..." ; Encoded data (dissected later) }, section "__llvm_covmap", align 8 -Version: --------- +Coverage Mapping Header: +------------------------ + +The coverage mapping header has the following fields: + +* The number of function records. + +* The length of the string in the third field of *__llvm_coverage_mapping* that contains the encoded translation unit filenames. -The coverage mapping version number can have the following values: +* The length of the string in the third field of *__llvm_coverage_mapping* that contains the encoded coverage mapping data. -* 0 — The first (current) version of the coverage mapping format. +* The format version. 0 is the first (current) version of the coverage mapping format. .. _function records: @@ -331,7 +347,7 @@ IR for the `coverage mapping sample`_ th * The length of the substring that contains the encoded coverage mapping data for the first function is the value of the third field in the first structure in an array of `function records`_ stored in the - fifth field of the *__llvm_coverage_mapping* structure, which is the 9. + third field of the *__llvm_coverage_mapping* structure, which is the 9. Therefore, the coverage mapping for the first function record is encoded in this string: @@ -351,7 +367,7 @@ IR for the `coverage mapping sample`_ th | ``0x01`` | The number of mapping regions that are stored in an array for the function's file id #0. | +----------+-------------------------------------------------------------------------------------------------------------------------+ | ``0x01`` | The coverage mapping counter for the first region in this function. The value of 1 tells us that it's a coverage | - | | mapping counter that is a reference ot the profile instrumentation counter with an index of 0. | + | | mapping counter that is a reference to the profile instrumentation counter with an index of 0. | +----------+-------------------------------------------------------------------------------------------------------------------------+ | ``0x01`` | The starting line of the first mapping region in this function. | +----------+-------------------------------------------------------------------------------------------------------------------------+ Modified: vendor/llvm/dist/docs/GettingStarted.rst ============================================================================== --- vendor/llvm/dist/docs/GettingStarted.rst Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/docs/GettingStarted.rst Wed Jan 6 20:01:02 2016 (r293248) @@ -78,6 +78,8 @@ Here's the short story for getting up an The usual build uses `CMake `_. If you would rather use autotools, see `Building LLVM with autotools `_. + Although the build is known to work with CMake >= 2.8.8, we recommend CMake + >= v3.2, especially if you're generating Ninja build files. * ``cd where you want to build llvm`` * ``mkdir build`` Modified: vendor/llvm/dist/docs/MCJITDesignAndImplementation.rst ============================================================================== --- vendor/llvm/dist/docs/MCJITDesignAndImplementation.rst Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/docs/MCJITDesignAndImplementation.rst Wed Jan 6 20:01:02 2016 (r293248) @@ -1,180 +1,180 @@ -=============================== -MCJIT Design and Implementation -=============================== - -Introduction -============ - -This document describes the internal workings of the MCJIT execution -engine and the RuntimeDyld component. It is intended as a high level -overview of the implementation, showing the flow and interactions of -objects throughout the code generation and dynamic loading process. - -Engine Creation -=============== - -In most cases, an EngineBuilder object is used to create an instance of -the MCJIT execution engine. The EngineBuilder takes an llvm::Module -object as an argument to its constructor. The client may then set various -options that we control the later be passed along to the MCJIT engine, -including the selection of MCJIT as the engine type to be created. -Of particular interest is the EngineBuilder::setMCJITMemoryManager -function. If the client does not explicitly create a memory manager at -this time, a default memory manager (specifically SectionMemoryManager) -will be created when the MCJIT engine is instantiated. - -Once the options have been set, a client calls EngineBuilder::create to -create an instance of the MCJIT engine. If the client does not use the -form of this function that takes a TargetMachine as a parameter, a new -TargetMachine will be created based on the target triple associated with -the Module that was used to create the EngineBuilder. - -.. image:: MCJIT-engine-builder.png - -EngineBuilder::create will call the static MCJIT::createJIT function, -passing in its pointers to the module, memory manager and target machine -objects, all of which will subsequently be owned by the MCJIT object. - -The MCJIT class has a member variable, Dyld, which contains an instance of -the RuntimeDyld wrapper class. This member will be used for -communications between MCJIT and the actual RuntimeDyldImpl object that -gets created when an object is loaded. - -.. image:: MCJIT-creation.png - -Upon creation, MCJIT holds a pointer to the Module object that it received -from EngineBuilder but it does not immediately generate code for this -module. Code generation is deferred until either the -MCJIT::finalizeObject method is called explicitly or a function such as -MCJIT::getPointerToFunction is called which requires the code to have been -generated. - -Code Generation -=============== - -When code generation is triggered, as described above, MCJIT will first -attempt to retrieve an object image from its ObjectCache member, if one -has been set. If a cached object image cannot be retrieved, MCJIT will -call its emitObject method. MCJIT::emitObject uses a local PassManager -instance and creates a new ObjectBufferStream instance, both of which it -passes to TargetMachine::addPassesToEmitMC before calling PassManager::run -on the Module with which it was created. - -.. image:: MCJIT-load.png - -The PassManager::run call causes the MC code generation mechanisms to emit -a complete relocatable binary object image (either in either ELF or MachO -format, depending on the target) into the ObjectBufferStream object, which -is flushed to complete the process. If an ObjectCache is being used, the -image will be passed to the ObjectCache here. - -At this point, the ObjectBufferStream contains the raw object image. -Before the code can be executed, the code and data sections from this -image must be loaded into suitable memory, relocations must be applied and -memory permission and code cache invalidation (if required) must be completed. - -Object Loading -============== - -Once an object image has been obtained, either through code generation or -having been retrieved from an ObjectCache, it is passed to RuntimeDyld to -be loaded. The RuntimeDyld wrapper class examines the object to determine -its file format and creates an instance of either RuntimeDyldELF or -RuntimeDyldMachO (both of which derive from the RuntimeDyldImpl base -class) and calls the RuntimeDyldImpl::loadObject method to perform that -actual loading. - -.. image:: MCJIT-dyld-load.png - -RuntimeDyldImpl::loadObject begins by creating an ObjectImage instance -from the ObjectBuffer it received. ObjectImage, which wraps the -ObjectFile class, is a helper class which parses the binary object image -and provides access to the information contained in the format-specific -headers, including section, symbol and relocation information. - -RuntimeDyldImpl::loadObject then iterates through the symbols in the -image. Information about common symbols is collected for later use. For -each function or data symbol, the associated section is loaded into memory -and the symbol is stored in a symbol table map data structure. When the -iteration is complete, a section is emitted for the common symbols. - -Next, RuntimeDyldImpl::loadObject iterates through the sections in the -object image and for each section iterates through the relocations for -that sections. For each relocation, it calls the format-specific -processRelocationRef method, which will examine the relocation and store -it in one of two data structures, a section-based relocation list map and -an external symbol relocation map. - -.. image:: MCJIT-load-object.png - -When RuntimeDyldImpl::loadObject returns, all of the code and data -sections for the object will have been loaded into memory allocated by the -memory manager and relocation information will have been prepared, but the -relocations have not yet been applied and the generated code is still not -ready to be executed. - -[Currently (as of August 2013) the MCJIT engine will immediately apply -relocations when loadObject completes. However, this shouldn't be -happening. Because the code may have been generated for a remote target, -the client should be given a chance to re-map the section addresses before -relocations are applied. It is possible to apply relocations multiple -times, but in the case where addresses are to be re-mapped, this first -application is wasted effort.] - -Address Remapping -================= - -At any time after initial code has been generated and before -finalizeObject is called, the client can remap the address of sections in -the object. Typically this is done because the code was generated for an -external process and is being mapped into that process' address space. -The client remaps the section address by calling MCJIT::mapSectionAddress. -This should happen before the section memory is copied to its new -location. - -When MCJIT::mapSectionAddress is called, MCJIT passes the call on to -RuntimeDyldImpl (via its Dyld member). RuntimeDyldImpl stores the new -address in an internal data structure but does not update the code at this -time, since other sections are likely to change. - -When the client is finished remapping section addresses, it will call -MCJIT::finalizeObject to complete the remapping process. - -Final Preparations -================== - -When MCJIT::finalizeObject is called, MCJIT calls -RuntimeDyld::resolveRelocations. This function will attempt to locate any -external symbols and then apply all relocations for the object. - -External symbols are resolved by calling the memory manager's -getPointerToNamedFunction method. The memory manager will return the -address of the requested symbol in the target address space. (Note, this -may not be a valid pointer in the host process.) RuntimeDyld will then -iterate through the list of relocations it has stored which are associated -with this symbol and invoke the resolveRelocation method which, through an -format-specific implementation, will apply the relocation to the loaded -section memory. - -Next, RuntimeDyld::resolveRelocations iterates through the list of -sections and for each section iterates through a list of relocations that -have been saved which reference that symbol and call resolveRelocation for -each entry in this list. The relocation list here is a list of -relocations for which the symbol associated with the relocation is located -in the section associated with the list. Each of these locations will -have a target location at which the relocation will be applied that is -likely located in a different section. - -.. image:: MCJIT-resolve-relocations.png - -Once relocations have been applied as described above, MCJIT calls -RuntimeDyld::getEHFrameSection, and if a non-zero result is returned -passes the section data to the memory manager's registerEHFrames method. -This allows the memory manager to call any desired target-specific -functions, such as registering the EH frame information with a debugger. - -Finally, MCJIT calls the memory manager's finalizeMemory method. In this -method, the memory manager will invalidate the target code cache, if -necessary, and apply final permissions to the memory pages it has -allocated for code and data memory. - +=============================== +MCJIT Design and Implementation +=============================== + +Introduction +============ + +This document describes the internal workings of the MCJIT execution +engine and the RuntimeDyld component. It is intended as a high level +overview of the implementation, showing the flow and interactions of +objects throughout the code generation and dynamic loading process. + +Engine Creation +=============== + +In most cases, an EngineBuilder object is used to create an instance of +the MCJIT execution engine. The EngineBuilder takes an llvm::Module +object as an argument to its constructor. The client may then set various +options that we control the later be passed along to the MCJIT engine, +including the selection of MCJIT as the engine type to be created. +Of particular interest is the EngineBuilder::setMCJITMemoryManager +function. If the client does not explicitly create a memory manager at +this time, a default memory manager (specifically SectionMemoryManager) +will be created when the MCJIT engine is instantiated. + +Once the options have been set, a client calls EngineBuilder::create to +create an instance of the MCJIT engine. If the client does not use the +form of this function that takes a TargetMachine as a parameter, a new +TargetMachine will be created based on the target triple associated with +the Module that was used to create the EngineBuilder. + +.. image:: MCJIT-engine-builder.png + +EngineBuilder::create will call the static MCJIT::createJIT function, +passing in its pointers to the module, memory manager and target machine +objects, all of which will subsequently be owned by the MCJIT object. + +The MCJIT class has a member variable, Dyld, which contains an instance of +the RuntimeDyld wrapper class. This member will be used for +communications between MCJIT and the actual RuntimeDyldImpl object that +gets created when an object is loaded. + +.. image:: MCJIT-creation.png + +Upon creation, MCJIT holds a pointer to the Module object that it received +from EngineBuilder but it does not immediately generate code for this +module. Code generation is deferred until either the +MCJIT::finalizeObject method is called explicitly or a function such as +MCJIT::getPointerToFunction is called which requires the code to have been +generated. + +Code Generation +=============== + +When code generation is triggered, as described above, MCJIT will first +attempt to retrieve an object image from its ObjectCache member, if one +has been set. If a cached object image cannot be retrieved, MCJIT will +call its emitObject method. MCJIT::emitObject uses a local PassManager +instance and creates a new ObjectBufferStream instance, both of which it +passes to TargetMachine::addPassesToEmitMC before calling PassManager::run +on the Module with which it was created. + +.. image:: MCJIT-load.png + +The PassManager::run call causes the MC code generation mechanisms to emit +a complete relocatable binary object image (either in either ELF or MachO +format, depending on the target) into the ObjectBufferStream object, which +is flushed to complete the process. If an ObjectCache is being used, the +image will be passed to the ObjectCache here. + +At this point, the ObjectBufferStream contains the raw object image. +Before the code can be executed, the code and data sections from this +image must be loaded into suitable memory, relocations must be applied and +memory permission and code cache invalidation (if required) must be completed. + +Object Loading +============== + +Once an object image has been obtained, either through code generation or +having been retrieved from an ObjectCache, it is passed to RuntimeDyld to +be loaded. The RuntimeDyld wrapper class examines the object to determine +its file format and creates an instance of either RuntimeDyldELF or +RuntimeDyldMachO (both of which derive from the RuntimeDyldImpl base +class) and calls the RuntimeDyldImpl::loadObject method to perform that +actual loading. + +.. image:: MCJIT-dyld-load.png + +RuntimeDyldImpl::loadObject begins by creating an ObjectImage instance +from the ObjectBuffer it received. ObjectImage, which wraps the +ObjectFile class, is a helper class which parses the binary object image +and provides access to the information contained in the format-specific +headers, including section, symbol and relocation information. + +RuntimeDyldImpl::loadObject then iterates through the symbols in the +image. Information about common symbols is collected for later use. For +each function or data symbol, the associated section is loaded into memory +and the symbol is stored in a symbol table map data structure. When the +iteration is complete, a section is emitted for the common symbols. + +Next, RuntimeDyldImpl::loadObject iterates through the sections in the +object image and for each section iterates through the relocations for +that sections. For each relocation, it calls the format-specific +processRelocationRef method, which will examine the relocation and store +it in one of two data structures, a section-based relocation list map and +an external symbol relocation map. + +.. image:: MCJIT-load-object.png + +When RuntimeDyldImpl::loadObject returns, all of the code and data +sections for the object will have been loaded into memory allocated by the +memory manager and relocation information will have been prepared, but the +relocations have not yet been applied and the generated code is still not +ready to be executed. + +[Currently (as of August 2013) the MCJIT engine will immediately apply +relocations when loadObject completes. However, this shouldn't be +happening. Because the code may have been generated for a remote target, +the client should be given a chance to re-map the section addresses before +relocations are applied. It is possible to apply relocations multiple +times, but in the case where addresses are to be re-mapped, this first +application is wasted effort.] + +Address Remapping +================= + +At any time after initial code has been generated and before +finalizeObject is called, the client can remap the address of sections in +the object. Typically this is done because the code was generated for an +external process and is being mapped into that process' address space. +The client remaps the section address by calling MCJIT::mapSectionAddress. +This should happen before the section memory is copied to its new +location. + +When MCJIT::mapSectionAddress is called, MCJIT passes the call on to +RuntimeDyldImpl (via its Dyld member). RuntimeDyldImpl stores the new +address in an internal data structure but does not update the code at this +time, since other sections are likely to change. + +When the client is finished remapping section addresses, it will call +MCJIT::finalizeObject to complete the remapping process. + +Final Preparations +================== + +When MCJIT::finalizeObject is called, MCJIT calls +RuntimeDyld::resolveRelocations. This function will attempt to locate any +external symbols and then apply all relocations for the object. + +External symbols are resolved by calling the memory manager's +getPointerToNamedFunction method. The memory manager will return the +address of the requested symbol in the target address space. (Note, this +may not be a valid pointer in the host process.) RuntimeDyld will then +iterate through the list of relocations it has stored which are associated +with this symbol and invoke the resolveRelocation method which, through an +format-specific implementation, will apply the relocation to the loaded +section memory. + +Next, RuntimeDyld::resolveRelocations iterates through the list of +sections and for each section iterates through a list of relocations that +have been saved which reference that symbol and call resolveRelocation for +each entry in this list. The relocation list here is a list of +relocations for which the symbol associated with the relocation is located +in the section associated with the list. Each of these locations will +have a target location at which the relocation will be applied that is +likely located in a different section. + +.. image:: MCJIT-resolve-relocations.png + +Once relocations have been applied as described above, MCJIT calls +RuntimeDyld::getEHFrameSection, and if a non-zero result is returned +passes the section data to the memory manager's registerEHFrames method. +This allows the memory manager to call any desired target-specific +functions, such as registering the EH frame information with a debugger. + +Finally, MCJIT calls the memory manager's finalizeMemory method. In this +method, the memory manager will invalidate the target code cache, if +necessary, and apply final permissions to the memory pages it has +allocated for code and data memory. + Modified: vendor/llvm/dist/include/llvm/Analysis/MemoryBuiltins.h ============================================================================== --- vendor/llvm/dist/include/llvm/Analysis/MemoryBuiltins.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/Analysis/MemoryBuiltins.h Wed Jan 6 20:01:02 2016 (r293248) @@ -59,11 +59,6 @@ bool isCallocLikeFn(const Value *V, cons bool isAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI, bool LookThroughBitCast = false); -/// \brief Tests if a value is a call or invoke to a library function that -/// allocates memory and never returns null (such as operator new). -bool isOperatorNewLikeFn(const Value *V, const TargetLibraryInfo *TLI, - bool LookThroughBitCast = false); - //===----------------------------------------------------------------------===// // malloc Call Utility Functions. // Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h Wed Jan 6 20:01:02 2016 (r293248) @@ -97,7 +97,7 @@ private: // of memory operands required to be precise exceeds the maximum value of // NumMemRefs - currently 256 - we remove the operands entirely. Note also // that this is a non-owning reference to a shared copy on write buffer owned - // by the MachineFunction and created via MF.allocateMemRefsArray. + // by the MachineFunction and created via MF.allocateMemRefsArray. mmo_iterator MemRefs; DebugLoc debugLoc; // Source line information. @@ -354,7 +354,7 @@ public: mmo_iterator memoperands_end() const { return MemRefs + NumMemRefs; } /// Return true if we don't have any memory operands which described the the /// memory access done by this instruction. If this is true, calling code - /// must be conservative. + /// must be conservative. bool memoperands_empty() const { return NumMemRefs == 0; } iterator_range memoperands() { @@ -774,7 +774,7 @@ public: bool isKill() const { return getOpcode() == TargetOpcode::KILL; } bool isImplicitDef() const { return getOpcode()==TargetOpcode::IMPLICIT_DEF; } bool isInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM; } - bool isMSInlineAsm() const { + bool isMSInlineAsm() const { return getOpcode() == TargetOpcode::INLINEASM && getInlineAsmDialect(); } bool isStackAligningInlineAsm() const; @@ -1180,11 +1180,26 @@ public: /// Assign this MachineInstr's memory reference descriptor list. /// This does not transfer ownership. void setMemRefs(mmo_iterator NewMemRefs, mmo_iterator NewMemRefsEnd) { - MemRefs = NewMemRefs; - NumMemRefs = uint8_t(NewMemRefsEnd - NewMemRefs); - assert(NumMemRefs == NewMemRefsEnd - NewMemRefs && "Too many memrefs"); + setMemRefs(std::make_pair(NewMemRefs, NewMemRefsEnd-NewMemRefs)); } + /// Assign this MachineInstr's memory reference descriptor list. First + /// element in the pair is the begin iterator/pointer to the array; the + /// second is the number of MemoryOperands. This does not transfer ownership + /// of the underlying memory. + void setMemRefs(std::pair NewMemRefs) { + MemRefs = NewMemRefs.first; + NumMemRefs = uint8_t(NewMemRefs.second); + assert(NumMemRefs == NewMemRefs.second && + "Too many memrefs - must drop memory operands"); + } + + /// Return a set of memrefs (begin iterator, size) which conservatively + /// describe the memory behavior of both MachineInstrs. This is appropriate + /// for use when merging two MachineInstrs into one. This routine does not + /// modify the memrefs of the this MachineInstr. + std::pair mergeMemRefsWith(const MachineInstr& Other); + /// Clear this MachineInstr's memory reference descriptor list. This resets /// the memrefs to their most conservative state. This should be used only /// as a last resort since it greatly pessimizes our knowledge of the memory Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBuilder.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jan 6 20:01:02 2016 (r293248) @@ -162,6 +162,11 @@ public: return *this; } + const MachineInstrBuilder &setMemRefs(std::pair MemOperandsRef) const { + MI->setMemRefs(MemOperandsRef); + return *this; + } const MachineInstrBuilder &addOperand(const MachineOperand &MO) const { MI->addOperand(*MF, MO); Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBundle.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBundle.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBundle.h Wed Jan 6 20:01:02 2016 (r293248) @@ -178,7 +178,7 @@ public: /// register. bool FullyDefined; - /// Reg or ont of its aliases is read. The register may only be read + /// Reg or one of its aliases is read. The register may only be read /// partially. bool Read; /// Reg or a super-register is read. The full register is read. Modified: vendor/llvm/dist/include/llvm/CodeGen/WinEHFuncInfo.h ============================================================================== --- vendor/llvm/dist/include/llvm/CodeGen/WinEHFuncInfo.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/CodeGen/WinEHFuncInfo.h Wed Jan 6 20:01:02 2016 (r293248) @@ -83,7 +83,9 @@ enum class ClrHandlerType { Catch, Final struct ClrEHUnwindMapEntry { MBBOrBasicBlock Handler; uint32_t TypeToken; - int Parent; + int HandlerParentState; ///< Outer handler enclosing this entry's handler + int TryParentState; ///< Outer try region enclosing this entry's try region, + ///< treating later catches on same try as "outer" ClrHandlerType HandlerType; }; Modified: vendor/llvm/dist/include/llvm/IR/CallSite.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/CallSite.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/CallSite.h Wed Jan 6 20:01:02 2016 (r293248) @@ -310,6 +310,11 @@ public: CALLSITE_DELEGATE_GETTER(hasFnAttr(A)); } + /// \brief Return true if this function has the given attribute. + bool hasFnAttr(StringRef A) const { + CALLSITE_DELEGATE_GETTER(hasFnAttr(A)); + } + /// \brief Return true if the call or the callee has the given attribute. bool paramHasAttr(unsigned i, Attribute::AttrKind A) const { CALLSITE_DELEGATE_GETTER(paramHasAttr(i, A)); Modified: vendor/llvm/dist/include/llvm/IR/IRBuilder.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/IRBuilder.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/IRBuilder.h Wed Jan 6 20:01:02 2016 (r293248) @@ -61,9 +61,13 @@ protected: MDNode *DefaultFPMathTag; FastMathFlags FMF; + ArrayRef DefaultOperandBundles; + public: - IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = nullptr) - : Context(context), DefaultFPMathTag(FPMathTag), FMF() { + IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : Context(context), DefaultFPMathTag(FPMathTag), FMF(), + DefaultOperandBundles(OpBundles) { ClearInsertionPoint(); } @@ -538,37 +542,44 @@ class IRBuilder : public IRBuilderBase, public: IRBuilder(LLVMContext &C, const T &F, Inserter I = Inserter(), - MDNode *FPMathTag = nullptr) - : IRBuilderBase(C, FPMathTag), Inserter(std::move(I)), Folder(F) {} - - explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr) - : IRBuilderBase(C, FPMathTag), Folder() { - } - - explicit IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag = nullptr) - : IRBuilderBase(TheBB->getContext(), FPMathTag), Folder(F) { + MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(C, FPMathTag, OpBundles), Inserter(std::move(I)), + Folder(F) {} + + explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(C, FPMathTag, OpBundles), Folder() {} + + explicit IRBuilder(BasicBlock *TheBB, const T &F, MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder(F) { SetInsertPoint(TheBB); } - explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr) - : IRBuilderBase(TheBB->getContext(), FPMathTag), Folder() { + explicit IRBuilder(BasicBlock *TheBB, MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder() { SetInsertPoint(TheBB); } - explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr) - : IRBuilderBase(IP->getContext(), FPMathTag), Folder() { + explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(IP->getContext(), FPMathTag, OpBundles), Folder() { SetInsertPoint(IP); } - IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T& F, - MDNode *FPMathTag = nullptr) - : IRBuilderBase(TheBB->getContext(), FPMathTag), Folder(F) { + IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, const T &F, + MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder(F) { SetInsertPoint(TheBB, IP); } IRBuilder(BasicBlock *TheBB, BasicBlock::iterator IP, - MDNode *FPMathTag = nullptr) - : IRBuilderBase(TheBB->getContext(), FPMathTag), Folder() { + MDNode *FPMathTag = nullptr, + ArrayRef OpBundles = None) + : IRBuilderBase(TheBB->getContext(), FPMathTag, OpBundles), Folder() { SetInsertPoint(TheBB, IP); } @@ -1529,8 +1540,11 @@ public: CallInst *CreateCall(Value *Callee, ArrayRef Args = None, ArrayRef OpBundles = None, - const Twine &Name = "") { - return Insert(CallInst::Create(Callee, Args, OpBundles), Name); + const Twine &Name = "", MDNode *FPMathTag = nullptr) { + CallInst *CI = CallInst::Create(Callee, Args, OpBundles); + if (isa(CI)) + CI = cast(AddFPMathAttributes(CI, FPMathTag, FMF)); + return Insert(CI, Name); } CallInst *CreateCall(Value *Callee, ArrayRef Args, @@ -1543,7 +1557,7 @@ public: CallInst *CreateCall(llvm::FunctionType *FTy, Value *Callee, ArrayRef Args, const Twine &Name = "", MDNode *FPMathTag = nullptr) { - CallInst *CI = CallInst::Create(FTy, Callee, Args); + CallInst *CI = CallInst::Create(FTy, Callee, Args, DefaultOperandBundles); if (isa(CI)) CI = cast(AddFPMathAttributes(CI, FPMathTag, FMF)); return Insert(CI, Name); Modified: vendor/llvm/dist/include/llvm/IR/Instructions.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/Instructions.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/Instructions.h Wed Jan 6 20:01:02 2016 (r293248) @@ -3550,6 +3550,11 @@ public: return hasFnAttrImpl(A); } + /// \brief Determine whether this call has the given attribute. + bool hasFnAttr(StringRef A) const { + return hasFnAttrImpl(A); + } + /// \brief Determine whether the call or the callee has the given attributes. bool paramHasAttr(unsigned i, Attribute::AttrKind A) const; @@ -3734,7 +3739,19 @@ private: unsigned getNumSuccessorsV() const override; void setSuccessorV(unsigned idx, BasicBlock *B) override; - bool hasFnAttrImpl(Attribute::AttrKind A) const; + template bool hasFnAttrImpl(AttrKind A) const { + if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, A)) + return true; + + // Operand bundles override attributes on the called function, but don't + // override attributes directly present on the invoke instruction. + if (isFnAttrDisallowedByOpBundle(A)) + return false; + + if (const Function *F = getCalledFunction()) + return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A); + return false; + } // Shadow Instruction::setInstructionSubclassData with a private forwarding // method so that subclasses cannot accidentally use it. @@ -3966,6 +3983,8 @@ public: /// point to the added handler. void addHandler(BasicBlock *Dest); + void removeHandler(handler_iterator HI); + unsigned getNumSuccessors() const { return getNumOperands() - 1; } BasicBlock *getSuccessor(unsigned Idx) const { assert(Idx < getNumSuccessors() && Modified: vendor/llvm/dist/include/llvm/IR/IntrinsicsX86.td ============================================================================== --- vendor/llvm/dist/include/llvm/IR/IntrinsicsX86.td Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/IntrinsicsX86.td Wed Jan 6 20:01:02 2016 (r293248) @@ -33,6 +33,19 @@ let TargetPrefix = "x86" in { } //===----------------------------------------------------------------------===// +// FLAGS. +let TargetPrefix = "x86" in { + def int_x86_flags_read_u32 : GCCBuiltin<"__builtin_ia32_readeflags_u32">, + Intrinsic<[llvm_i32_ty], [], []>; + def int_x86_flags_read_u64 : GCCBuiltin<"__builtin_ia32_readeflags_u64">, + Intrinsic<[llvm_i64_ty], [], []>; + def int_x86_flags_write_u32 : GCCBuiltin<"__builtin_ia32_writeeflags_u32">, + Intrinsic<[], [llvm_i32_ty], []>; + def int_x86_flags_write_u64 : GCCBuiltin<"__builtin_ia32_writeeflags_u64">, + Intrinsic<[], [llvm_i64_ty], []>; +} + +//===----------------------------------------------------------------------===// // Read Time Stamp Counter. let TargetPrefix = "x86" in { def int_x86_rdtsc : GCCBuiltin<"__builtin_ia32_rdtsc">, @@ -2211,6 +2224,25 @@ let TargetPrefix = "x86" in { // All in Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_i8_ty, llvm_v32i16_ty, llvm_i32_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_w_128 : GCCBuiltin<"__builtin_ia32_psraw128_mask">, + Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, + llvm_v8i16_ty, llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_w_256 : GCCBuiltin<"__builtin_ia32_psraw256_mask">, + Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, + llvm_v8i16_ty, llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_w_512 : GCCBuiltin<"__builtin_ia32_psraw512_mask">, + Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, + llvm_v8i16_ty, llvm_v32i16_ty, llvm_i32_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_wi_128 : GCCBuiltin<"__builtin_ia32_psrawi128_mask">, + Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, + llvm_i8_ty, llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_wi_256 : GCCBuiltin<"__builtin_ia32_psrawi256_mask">, + Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, + llvm_i8_ty, llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_wi_512 : GCCBuiltin<"__builtin_ia32_psrawi512_mask">, + Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, + llvm_i8_ty, llvm_v32i16_ty, llvm_i32_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_d : GCCBuiltin<"__builtin_ia32_pslld512_mask">, Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v4i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>; @@ -2229,6 +2261,69 @@ let TargetPrefix = "x86" in { // All in def int_x86_avx512_mask_psra_q : GCCBuiltin<"__builtin_ia32_psraq512_mask">, Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v2i64_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>; + + def int_x86_avx512_mask_psra_d_128 : GCCBuiltin<"__builtin_ia32_psrad128_mask">, + Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, + llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_d_256 : GCCBuiltin<"__builtin_ia32_psrad256_mask">, + Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, + llvm_v4i32_ty, llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_di_128 : GCCBuiltin<"__builtin_ia32_psradi128_mask">, + Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, + llvm_i8_ty, llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_di_256 : GCCBuiltin<"__builtin_ia32_psradi256_mask">, + Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, + llvm_i8_ty, llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_di_512 : GCCBuiltin<"__builtin_ia32_psradi512_mask">, + Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, + llvm_i8_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_q_128 : GCCBuiltin<"__builtin_ia32_psraq128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_q_256 : GCCBuiltin<"__builtin_ia32_psraq256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_v2i64_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_qi_128 : GCCBuiltin<"__builtin_ia32_psraqi128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_i8_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_qi_256 : GCCBuiltin<"__builtin_ia32_psraqi256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_i8_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psra_qi_512 : GCCBuiltin<"__builtin_ia32_psraqi512_mask">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, + llvm_i8_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>; + + def int_x86_avx512_mask_psrl_d_128: GCCBuiltin<"__builtin_ia32_psrld128_mask">, + Intrinsic<[llvm_v4i32_ty], [ llvm_v4i32_ty, + llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty ], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_d_256: GCCBuiltin<"__builtin_ia32_psrld256_mask">, + Intrinsic<[llvm_v8i32_ty], [ llvm_v8i32_ty, + llvm_v4i32_ty, llvm_v8i32_ty, llvm_i8_ty ], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_di_128: GCCBuiltin<"__builtin_ia32_psrldi128_mask">, + Intrinsic<[llvm_v4i32_ty], [ llvm_v4i32_ty, + llvm_i8_ty, llvm_v4i32_ty, llvm_i8_ty ], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_di_256: GCCBuiltin<"__builtin_ia32_psrldi256_mask">, + Intrinsic<[llvm_v8i32_ty], [ llvm_v8i32_ty, + llvm_i8_ty, llvm_v8i32_ty, llvm_i8_ty ], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_di_512: GCCBuiltin<"__builtin_ia32_psrldi512_mask">, + Intrinsic<[llvm_v16i32_ty], [ llvm_v16i32_ty, + llvm_i8_ty, llvm_v16i32_ty, llvm_i16_ty ], [IntrNoMem]>; + + def int_x86_avx512_mask_psrl_q_128: GCCBuiltin<"__builtin_ia32_psrlq128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_q_256: GCCBuiltin<"__builtin_ia32_psrlq256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_v2i64_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_qi_128: GCCBuiltin<"__builtin_ia32_psrlqi128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_i8_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_qi_256: GCCBuiltin<"__builtin_ia32_psrlqi256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_i8_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrl_qi_512: GCCBuiltin<"__builtin_ia32_psrlqi512_mask">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, + llvm_i8_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>; } // Pack ops. @@ -2696,6 +2791,59 @@ let TargetPrefix = "x86" in { // All in def int_x86_avx512_psrl_dq_512 : GCCBuiltin<"__builtin_ia32_psrldq512">, Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_i32_ty], [IntrNoMem]>; + + def int_x86_avx512_mask_psll_d_128 : GCCBuiltin<"__builtin_ia32_pslld128_mask">, + Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, + llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_d_256 : GCCBuiltin<"__builtin_ia32_pslld256_mask">, + Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, + llvm_v4i32_ty, llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_di_128 : GCCBuiltin<"__builtin_ia32_pslldi128_mask">, + Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, + llvm_i8_ty, llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_di_256 : GCCBuiltin<"__builtin_ia32_pslldi256_mask">, + Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, + llvm_i8_ty, llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_di_512 : GCCBuiltin<"__builtin_ia32_pslldi512_mask">, + Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, + llvm_i8_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_q_128 : GCCBuiltin<"__builtin_ia32_psllq128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_q_256 : GCCBuiltin<"__builtin_ia32_psllq256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_v2i64_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_qi_128 : GCCBuiltin<"__builtin_ia32_psllqi128_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_i8_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_qi_256 : GCCBuiltin<"__builtin_ia32_psllqi256_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_i8_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psll_qi_512 : GCCBuiltin<"__builtin_ia32_psllqi512_mask">, + Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, + llvm_i8_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>; + + def int_x86_avx512_mask_psrlv16_hi : GCCBuiltin<"__builtin_ia32_psrlv16hi_mask">, + Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, + llvm_v16i16_ty, llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv2_di : GCCBuiltin<"__builtin_ia32_psrlv2di_mask">, + Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, + llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv32hi : GCCBuiltin<"__builtin_ia32_psrlv32hi_mask">, + Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, + llvm_v32i16_ty, llvm_v32i16_ty, llvm_i32_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv4_di : GCCBuiltin<"__builtin_ia32_psrlv4di_mask">, + Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, + llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv4_si : GCCBuiltin<"__builtin_ia32_psrlv4si_mask">, + Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, + llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv8_hi : GCCBuiltin<"__builtin_ia32_psrlv8hi_mask">, + Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, + llvm_v8i16_ty, llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>; + def int_x86_avx512_mask_psrlv8_si : GCCBuiltin<"__builtin_ia32_psrlv8si_mask">, + Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, + llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>; } // Gather ops @@ -3919,9 +4067,9 @@ let TargetPrefix = "x86" in { // All in // Support protection key let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". def int_x86_rdpkru : GCCBuiltin <"__builtin_ia32_rdpkru">, - Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>; + Intrinsic<[llvm_i32_ty], [], []>; def int_x86_wrpkru : GCCBuiltin<"__builtin_ia32_wrpkru">, - Intrinsic<[], [llvm_i32_ty], [IntrNoMem]>; + Intrinsic<[], [llvm_i32_ty], []>; } //===----------------------------------------------------------------------===// // Half float conversion Modified: vendor/llvm/dist/include/llvm/IR/Metadata.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/Metadata.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/Metadata.h Wed Jan 6 20:01:02 2016 (r293248) @@ -283,14 +283,20 @@ private: LLVMContext &Context; uint64_t NextIndex; SmallDenseMap, 4> UseMap; + /// Flag that can be set to false if this metadata should not be + /// RAUW'ed, e.g. if it is used as the key of a map. + bool CanReplace; public: ReplaceableMetadataImpl(LLVMContext &Context) - : Context(Context), NextIndex(0) {} + : Context(Context), NextIndex(0), CanReplace(true) {} ~ReplaceableMetadataImpl() { assert(UseMap.empty() && "Cannot destroy in-use replaceable metadata"); } + /// Set the CanReplace flag to the given value. + void setCanReplace(bool Replaceable) { CanReplace = Replaceable; } + LLVMContext &getContext() const { return Context; } /// \brief Replace all uses of this with MD. @@ -901,14 +907,19 @@ public: Context.getReplaceableUses()->replaceAllUsesWith(MD); } + /// Set the CanReplace flag to the given value. + void setCanReplace(bool Replaceable) { + Context.getReplaceableUses()->setCanReplace(Replaceable); + } + /// \brief Resolve cycles. /// /// Once all forward declarations have been resolved, force cycles to be - /// resolved. If \p MDMaterialized is true, then any temporary metadata + /// resolved. If \p AllowTemps is true, then any temporary metadata /// is ignored, otherwise it asserts when encountering temporary metadata. /// /// \pre No operands (or operands' operands, etc.) have \a isTemporary(). - void resolveCycles(bool MDMaterialized = true); + void resolveCycles(bool AllowTemps = false); /// \brief Replace a temporary node with a permanent one. /// Modified: vendor/llvm/dist/include/llvm/IR/Statepoint.h ============================================================================== --- vendor/llvm/dist/include/llvm/IR/Statepoint.h Wed Jan 6 19:41:06 2016 (r293247) +++ vendor/llvm/dist/include/llvm/IR/Statepoint.h Wed Jan 6 20:01:02 2016 (r293248) @@ -22,6 +22,7 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Intrinsics.h" #include "llvm/Support/Compiler.h" @@ -36,14 +37,13 @@ enum class StatepointFlags { MaskAll = GCTransition ///< A bitmask that includes all valid flags. }; -class GCRelocateOperands; +class GCRelocateInst; class ImmutableStatepoint; bool isStatepoint(const ImmutableCallSite &CS); bool isStatepoint(const Value *V); bool isStatepoint(const Value &V); -bool isGCRelocate(const Value *V); bool isGCRelocate(const ImmutableCallSite &CS); bool isGCResult(const Value *V); @@ -247,7 +247,7 @@ public: /// May contain several relocations for the same base/derived pair. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:01:34 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79090A656B0; Wed, 6 Jan 2016 20:01:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 321A91A1F; Wed, 6 Jan 2016 20:01:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K1XFa082139; Wed, 6 Jan 2016 20:01:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K1XCc082138; Wed, 6 Jan 2016 20:01:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062001.u06K1XCc082138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:01:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293249 - vendor/llvm/llvm-trunk-r256945 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:01:34 -0000 Author: dim Date: Wed Jan 6 20:01:33 2016 New Revision: 293249 URL: https://svnweb.freebsd.org/changeset/base/293249 Log: Tag llvm trunk r256945. Added: vendor/llvm/llvm-trunk-r256945/ - copied from r293248, vendor/llvm/dist/ From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:02:29 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F73CA65818; Wed, 6 Jan 2016 20:02:29 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B274A1C6E; Wed, 6 Jan 2016 20:02:28 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K2RgG084177; Wed, 6 Jan 2016 20:02:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K2QpX084165; Wed, 6 Jan 2016 20:02:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062002.u06K2QpX084165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:02:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293250 - in vendor/clang/dist: . cmake/caches include/clang/AST include/clang/Basic include/clang/Driver include/clang/Frontend include/clang/Sema lib/AST lib/Basic lib/CodeGen lib/Dri... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:02:29 -0000 Author: dim Date: Wed Jan 6 20:02:26 2016 New Revision: 293250 URL: https://svnweb.freebsd.org/changeset/base/293250 Log: Vendor import of clang trunk r256945: https://llvm.org/svn/llvm-project/cfe/trunk@256945 Added: vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake vendor/clang/dist/cmake/caches/PGO-stage2.cmake vendor/clang/dist/cmake/caches/PGO.cmake vendor/clang/dist/lib/Headers/pkuintrin.h (contents, props changed) vendor/clang/dist/test/Analysis/Inputs/qt-simulator.h (contents, props changed) vendor/clang/dist/test/Analysis/qt_malloc.cpp (contents, props changed) vendor/clang/dist/test/CodeGen/pku.c (contents, props changed) vendor/clang/dist/test/CodeGenCXX/optnone-and-attributes.cpp (contents, props changed) vendor/clang/dist/test/CodeGenCXX/optnone-class-members.cpp (contents, props changed) vendor/clang/dist/test/CodeGenCXX/optnone-templates.cpp (contents, props changed) vendor/clang/dist/test/Driver/ps4-analyzer-defaults.cpp (contents, props changed) vendor/clang/dist/test/Modules/tag-injection.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/schedule_codegen.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_codegen_registration.cpp (contents, props changed) vendor/clang/dist/test/OpenMP/target_codegen_registration_naming.cpp (contents, props changed) Deleted: vendor/clang/dist/test/Profile/c-attributes.c Modified: vendor/clang/dist/CMakeLists.txt vendor/clang/dist/include/clang/AST/DeclarationName.h vendor/clang/dist/include/clang/AST/Expr.h vendor/clang/dist/include/clang/AST/ExprCXX.h vendor/clang/dist/include/clang/AST/ExprObjC.h vendor/clang/dist/include/clang/AST/Mangle.h vendor/clang/dist/include/clang/AST/OpenMPClause.h vendor/clang/dist/include/clang/Basic/Builtins.h vendor/clang/dist/include/clang/Basic/BuiltinsX86.def vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/LangOptions.def vendor/clang/dist/include/clang/Basic/LangOptions.h vendor/clang/dist/include/clang/Basic/OpenMPKinds.def vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/Options.td vendor/clang/dist/include/clang/Frontend/CodeGenOptions.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/include/clang/Sema/TemplateDeduction.h vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/Expr.cpp vendor/clang/dist/lib/AST/ExprCXX.cpp vendor/clang/dist/lib/AST/ExprObjC.cpp vendor/clang/dist/lib/AST/MicrosoftMangle.cpp vendor/clang/dist/lib/AST/OpenMPClause.cpp vendor/clang/dist/lib/Basic/Builtins.cpp vendor/clang/dist/lib/Basic/LangOptions.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CGVTables.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp vendor/clang/dist/lib/CodeGen/CoverageMappingGen.cpp vendor/clang/dist/lib/Driver/Driver.cpp vendor/clang/dist/lib/Driver/ToolChains.cpp vendor/clang/dist/lib/Driver/Tools.cpp vendor/clang/dist/lib/Driver/Tools.h vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Format/FormatToken.cpp vendor/clang/dist/lib/Format/FormatToken.h vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Frontend/CodeGenOptions.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Headers/CMakeLists.txt vendor/clang/dist/lib/Headers/ia32intrin.h vendor/clang/dist/lib/Headers/immintrin.h vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/ParseStmtAsm.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaExprObjC.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaStmtAsm.cpp vendor/clang/dist/lib/Sema/SemaTemplateDeduction.cpp vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp vendor/clang/dist/test/Analysis/Inputs/system-header-simulator-cxx.h vendor/clang/dist/test/Analysis/inlining/stl.cpp vendor/clang/dist/test/Analysis/null-deref-ps.c vendor/clang/dist/test/Analysis/nullptr.cpp vendor/clang/dist/test/CXX/drs/dr5xx.cpp vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3.cpp vendor/clang/dist/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp vendor/clang/dist/test/CodeGen/2007-04-14-FNoBuiltin.c vendor/clang/dist/test/CodeGen/aarch64-v8.1a-neon-intrinsics.c vendor/clang/dist/test/CodeGen/arm-target-features.c vendor/clang/dist/test/CodeGen/arm-v8.1a-neon-intrinsics.c vendor/clang/dist/test/CodeGen/libcalls-complex.c vendor/clang/dist/test/CodeGen/libcalls-fno-builtin.c vendor/clang/dist/test/CodeGen/nobuiltin.c vendor/clang/dist/test/CodeGenCXX/ms-inline-asm-fields.cpp vendor/clang/dist/test/CodeGenCXX/optnone-def-decl.cpp vendor/clang/dist/test/CoverageMapping/ir.c vendor/clang/dist/test/Driver/aarch64-cpus.c vendor/clang/dist/test/Driver/arm-cortex-cpus.c vendor/clang/dist/test/Driver/arm-no-movt.c vendor/clang/dist/test/Driver/debug-options.c vendor/clang/dist/test/Driver/fortran.f95 vendor/clang/dist/test/Driver/instrprof-ld.c vendor/clang/dist/test/Index/cindex-test-inclusions.c vendor/clang/dist/test/Modules/ModuleDebugInfo.cpp vendor/clang/dist/test/OpenMP/for_simd_ast_print.cpp vendor/clang/dist/test/OpenMP/for_simd_codegen.cpp vendor/clang/dist/test/OpenMP/for_simd_loop_messages.cpp vendor/clang/dist/test/OpenMP/nesting_of_regions.cpp vendor/clang/dist/test/OpenMP/ordered_codegen.cpp vendor/clang/dist/test/OpenMP/parallel_for_simd_ast_print.cpp vendor/clang/dist/test/OpenMP/parallel_for_simd_codegen.cpp vendor/clang/dist/test/OpenMP/parallel_for_simd_loop_messages.cpp vendor/clang/dist/test/OpenMP/parallel_for_simd_messages.cpp vendor/clang/dist/test/OpenMP/target_codegen.cpp vendor/clang/dist/test/OpenMP/target_codegen_global_capture.cpp vendor/clang/dist/test/OpenMP/target_map_codegen.cpp vendor/clang/dist/test/OpenMP/target_messages.cpp vendor/clang/dist/test/Preprocessor/aarch64-target-features.c vendor/clang/dist/test/Profile/func-entry.c vendor/clang/dist/test/Sema/attr-ownership.c vendor/clang/dist/test/Sema/implicit-builtin-freestanding.c vendor/clang/dist/test/Sema/warn-documentation-crlf.c vendor/clang/dist/test/SemaCXX/attr-no-sanitize-address.cpp vendor/clang/dist/test/SemaCXX/attr-no-sanitize-memory.cpp vendor/clang/dist/test/SemaCXX/attr-no-sanitize-thread.cpp vendor/clang/dist/test/SemaCXX/dllexport.cpp vendor/clang/dist/test/SemaCXX/warn-literal-conversion.cpp vendor/clang/dist/test/SemaOpenCL/cond.cl vendor/clang/dist/test/SemaOpenCL/func_ptr.cl vendor/clang/dist/test/SemaTemplate/deduction.cpp vendor/clang/dist/tools/c-index-test/c-index-test.c vendor/clang/dist/tools/libclang/CIndexInclusionStack.cpp vendor/clang/dist/unittests/Format/FormatTest.cpp vendor/clang/dist/unittests/Format/FormatTestJS.cpp vendor/clang/dist/unittests/Format/FormatTestProto.cpp vendor/clang/dist/utils/TableGen/TableGen.cpp Modified: vendor/clang/dist/CMakeLists.txt ============================================================================== --- vendor/clang/dist/CMakeLists.txt Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/CMakeLists.txt Wed Jan 6 20:02:26 2016 (r293250) @@ -631,11 +631,19 @@ if (CLANG_ENABLE_BOOTSTRAP) string(REGEX MATCH "stage([0-9]*)" MATCHED_STAGE "${CLANG_STAGE}") if(MATCHED_STAGE) - math(EXPR STAGE_NUM "${MATCHED_STAGE} + 1") - set(NEXT_CLANG_STAGE stage${STAGE_NUM}) + if(NOT LLVM_BUILD_INSTRUMENTED) + math(EXPR STAGE_NUM "${CMAKE_MATCH_1} + 1") + set(NEXT_CLANG_STAGE stage${STAGE_NUM}) + else() + set(NEXT_CLANG_STAGE stage${CMAKE_MATCH_1}) + endif() else() set(NEXT_CLANG_STAGE bootstrap) endif() + + if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED) + set(NEXT_CLANG_STAGE ${NEXT_CLANG_STAGE}-instrumented) + endif() message(STATUS "Setting next clang stage to: ${NEXT_CLANG_STAGE}") @@ -681,6 +689,26 @@ if (CLANG_ENABLE_BOOTSTRAP) set(RUNTIME_DEP compiler-rt) endif() + set(COMPILER_OPTIONS + -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++ + -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang + -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang) + + if(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED) + set(PGO_DEP llvm-profdata) + set(PGO_OPT -DLLVM_PROFDATA=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-profdata) + endif() + + if(LLVM_BUILD_INSTRUMENTED) + set(PGO_DEP generate-profdata) + set(PGO_OPT -DLLVM_PROFDATA_FILE=${CMAKE_CURRENT_BINARY_DIR}/utils/perf-training/clang.profdata) + set(COMPILER_OPTIONS + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_ASM_COMPILER=${CMAKE_ASM_COMPILER}) + set(RUNTIME_DEP) # Don't set runtime dependencies + endif() + # Find all variables that start with BOOTSTRAP_ and populate a variable with # them. get_cmake_property(variableNames VARIABLES) @@ -703,7 +731,7 @@ if (CLANG_ENABLE_BOOTSTRAP) endforeach() ExternalProject_Add(${NEXT_CLANG_STAGE} - DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} + DEPENDS clang ${LTO_DEP} ${RUNTIME_DEP} ${PGO_DEP} PREFIX ${NEXT_CLANG_STAGE} SOURCE_DIR ${CMAKE_SOURCE_DIR} STAMP_DIR ${STAMP_DIR} @@ -715,11 +743,9 @@ if (CLANG_ENABLE_BOOTSTRAP) -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} ${CLANG_BOOTSTRAP_CMAKE_ARGS} ${PASSTHROUGH_VARIABLES} - -DCMAKE_CXX_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++ - -DCMAKE_C_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang - -DCMAKE_ASM_COMPILER=${LLVM_RUNTIME_OUTPUT_INTDIR}/clang - -DCLANG_STAGE=${NEXT_CLANG_STAGE} - ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} + -DCLANG_STAGE=${NEXT_CLANG_STAGE} + ${COMPILER_OPTIONS} + ${LTO_LIBRARY} ${LTO_AR} ${LTO_RANLIB} ${verbose} ${PGO_OPT} INSTALL_COMMAND "" STEP_TARGETS configure build ${cmake_3_4_USES_TERMINAL_OPTIONS} Added: vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/cmake/caches/PGO-stage2-instrumented.cmake Wed Jan 6 20:02:26 2016 (r293250) @@ -0,0 +1,9 @@ +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "") + +set(CLANG_BOOTSTRAP_TARGETS check-all check-llvm check-clang test-suite CACHE STRING "") + +set(CLANG_BOOTSTRAP_CMAKE_ARGS + -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2.cmake + CACHE STRING "") Added: vendor/clang/dist/cmake/caches/PGO-stage2.cmake ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/cmake/caches/PGO-stage2.cmake Wed Jan 6 20:02:26 2016 (r293250) @@ -0,0 +1,2 @@ +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "") Added: vendor/clang/dist/cmake/caches/PGO.cmake ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/cmake/caches/PGO.cmake Wed Jan 6 20:02:26 2016 (r293250) @@ -0,0 +1,17 @@ +set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "") +set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "") +set(LLVM_BUILD_EXTERNAL_COMPILER_RT ON CACHE BOOL "") + +set(LLVM_TARGETS_TO_BUILD X86 CACHE STRING "") +set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "") +set(CLANG_BOOTSTRAP_TARGETS + generate-profdata + stage2 + stage2-check-all + stage2-check-llvm + stage2-check-clang + stage2-test-suite CACHE STRING "") + +set(CLANG_BOOTSTRAP_CMAKE_ARGS + -C ${CMAKE_CURRENT_LIST_DIR}/PGO-stage2-instrumented.cmake + CACHE STRING "") Modified: vendor/clang/dist/include/clang/AST/DeclarationName.h ============================================================================== --- vendor/clang/dist/include/clang/AST/DeclarationName.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/DeclarationName.h Wed Jan 6 20:02:26 2016 (r293250) @@ -395,7 +395,7 @@ struct DeclarationNameLoc { // Locations (if any) for the tilde (destructor) or operator keyword // (conversion) are stored elsewhere. struct NT { - TypeSourceInfo* TInfo; + TypeSourceInfo *TInfo; }; // The location (if any) of the operator keyword is stored elsewhere. Modified: vendor/clang/dist/include/clang/AST/Expr.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Expr.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/Expr.h Wed Jan 6 20:02:26 2016 (r293250) @@ -2190,7 +2190,8 @@ public: return reinterpret_cast(SubExprs+getNumPreArgs()+PREARGS_START); } const Expr *const *getArgs() const { - return const_cast(this)->getArgs(); + return reinterpret_cast(SubExprs + getNumPreArgs() + + PREARGS_START); } /// getArg - Return the specified argument. @@ -3926,7 +3927,9 @@ public: /// which covers @c [2].y=1.0. This DesignatedInitExpr will have two /// designators, one array designator for @c [2] followed by one field /// designator for @c .y. The initialization expression will be 1.0. -class DesignatedInitExpr : public Expr { +class DesignatedInitExpr final + : public Expr, + private llvm::TrailingObjects { public: /// \brief Forward declaration of the Designator class. class Designator; @@ -4206,12 +4209,12 @@ public: Expr *getSubExpr(unsigned Idx) const { assert(Idx < NumSubExprs && "Subscript out of range"); - return cast(reinterpret_cast(this + 1)[Idx]); + return cast(getTrailingObjects()[Idx]); } void setSubExpr(unsigned Idx, Expr *E) { assert(Idx < NumSubExprs && "Subscript out of range"); - reinterpret_cast(this + 1)[Idx] = E; + getTrailingObjects()[Idx] = E; } /// \brief Replaces the designator at index @p Idx with the series @@ -4230,9 +4233,11 @@ public: // Iterators child_range children() { - Stmt **begin = reinterpret_cast(this + 1); + Stmt **begin = getTrailingObjects(); return child_range(begin, begin + NumSubExprs); } + + friend TrailingObjects; }; /// \brief Represents a place-holder for an object not to be initialized by @@ -4683,7 +4688,9 @@ public: /// equivalent to a particular message send, and this is very much /// part of the user model. The name of this class encourages this /// modelling design. -class PseudoObjectExpr : public Expr { +class PseudoObjectExpr final + : public Expr, + private llvm::TrailingObjects { // PseudoObjectExprBits.NumSubExprs - The number of sub-expressions. // Always at least two, because the first sub-expression is the // syntactic form. @@ -4695,13 +4702,11 @@ class PseudoObjectExpr : public Expr { // in to Create, which is an index within the semantic forms. // Note also that ASTStmtWriter assumes this encoding. - Expr **getSubExprsBuffer() { return reinterpret_cast(this + 1); } + Expr **getSubExprsBuffer() { return getTrailingObjects(); } const Expr * const *getSubExprsBuffer() const { - return reinterpret_cast(this + 1); + return getTrailingObjects(); } - friend class ASTStmtReader; - PseudoObjectExpr(QualType type, ExprValueKind VK, Expr *syntactic, ArrayRef semantic, unsigned resultIndex); @@ -4798,6 +4803,9 @@ public: static bool classof(const Stmt *T) { return T->getStmtClass() == PseudoObjectExprClass; } + + friend TrailingObjects; + friend class ASTStmtReader; }; /// AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, Modified: vendor/clang/dist/include/clang/AST/ExprCXX.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ExprCXX.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/ExprCXX.h Wed Jan 6 20:02:26 2016 (r293250) @@ -951,7 +951,9 @@ public: /// This wraps up a function call argument that was created from the /// corresponding parameter's default argument, when the call did not /// explicitly supply arguments for all of the parameters. -class CXXDefaultArgExpr : public Expr { +class CXXDefaultArgExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The parameter whose default is being used. /// /// When the bit is set, the subexpression is stored after the @@ -977,7 +979,7 @@ class CXXDefaultArgExpr : public Expr { SubExpr->getValueKind(), SubExpr->getObjectKind(), false, false, false, false), Param(param, true), Loc(Loc) { - *reinterpret_cast(this + 1) = SubExpr; + *getTrailingObjects() = SubExpr; } public: @@ -1002,12 +1004,12 @@ public: // Retrieve the actual argument to the function call. const Expr *getExpr() const { if (Param.getInt()) - return *reinterpret_cast (this + 1); + return *getTrailingObjects(); return getParam()->getDefaultArg(); } Expr *getExpr() { if (Param.getInt()) - return *reinterpret_cast (this + 1); + return *getTrailingObjects(); return getParam()->getDefaultArg(); } @@ -1031,6 +1033,7 @@ public: return child_range(child_iterator(), child_iterator()); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; @@ -1441,7 +1444,9 @@ public: /// C++1y introduces a new form of "capture" called an init-capture that /// includes an initializing expression (rather than capturing a variable), /// and which can never occur implicitly. -class LambdaExpr : public Expr { +class LambdaExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The source range that covers the lambda introducer ([...]). SourceRange IntroducerRange; @@ -1476,23 +1481,21 @@ class LambdaExpr : public Expr { /// module file just to determine the source range. SourceLocation ClosingBrace; - // Note: The capture initializers are stored directly after the lambda - // expression, along with the index variables used to initialize by-copy - // array captures. + size_t numTrailingObjects(OverloadToken) const { + return NumCaptures + 1; + } - typedef LambdaCapture Capture; + size_t numTrailingObjects(OverloadToken) const { + return HasArrayIndexVars ? NumCaptures + 1 : 0; + } /// \brief Construct a lambda expression. LambdaExpr(QualType T, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, - SourceLocation CaptureDefaultLoc, - ArrayRef Captures, - bool ExplicitParams, - bool ExplicitResultType, - ArrayRef CaptureInits, - ArrayRef ArrayIndexVars, - ArrayRef ArrayIndexStarts, - SourceLocation ClosingBrace, + SourceLocation CaptureDefaultLoc, ArrayRef Captures, + bool ExplicitParams, bool ExplicitResultType, + ArrayRef CaptureInits, ArrayRef ArrayIndexVars, + ArrayRef ArrayIndexStarts, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack); /// \brief Construct an empty lambda expression. @@ -1503,53 +1506,35 @@ class LambdaExpr : public Expr { getStoredStmts()[NumCaptures] = nullptr; } - Stmt **getStoredStmts() { return reinterpret_cast(this + 1); } + Stmt **getStoredStmts() { return getTrailingObjects(); } - Stmt *const *getStoredStmts() const { - return reinterpret_cast(this + 1); - } + Stmt *const *getStoredStmts() const { return getTrailingObjects(); } /// \brief Retrieve the mapping from captures to the first array index /// variable. - unsigned *getArrayIndexStarts() { - return reinterpret_cast(getStoredStmts() + NumCaptures + 1); - } + unsigned *getArrayIndexStarts() { return getTrailingObjects(); } const unsigned *getArrayIndexStarts() const { - return reinterpret_cast(getStoredStmts() + NumCaptures + - 1); + return getTrailingObjects(); } /// \brief Retrieve the complete set of array-index variables. - VarDecl **getArrayIndexVars() { - unsigned ArrayIndexSize = llvm::RoundUpToAlignment( - sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf()); - return reinterpret_cast( - reinterpret_cast(getArrayIndexStarts()) + ArrayIndexSize); - } + VarDecl **getArrayIndexVars() { return getTrailingObjects(); } VarDecl *const *getArrayIndexVars() const { - unsigned ArrayIndexSize = llvm::RoundUpToAlignment( - sizeof(unsigned) * (NumCaptures + 1), llvm::alignOf()); - return reinterpret_cast( - reinterpret_cast(getArrayIndexStarts()) + ArrayIndexSize); + return getTrailingObjects(); } public: /// \brief Construct a new lambda expression. - static LambdaExpr *Create(const ASTContext &C, - CXXRecordDecl *Class, - SourceRange IntroducerRange, - LambdaCaptureDefault CaptureDefault, - SourceLocation CaptureDefaultLoc, - ArrayRef Captures, - bool ExplicitParams, - bool ExplicitResultType, - ArrayRef CaptureInits, - ArrayRef ArrayIndexVars, - ArrayRef ArrayIndexStarts, - SourceLocation ClosingBrace, - bool ContainsUnexpandedParameterPack); + static LambdaExpr * + Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, + LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, + ArrayRef Captures, bool ExplicitParams, + bool ExplicitResultType, ArrayRef CaptureInits, + ArrayRef ArrayIndexVars, + ArrayRef ArrayIndexStarts, SourceLocation ClosingBrace, + bool ContainsUnexpandedParameterPack); /// \brief Construct a new lambda expression that will be deserialized from /// an external source. @@ -1572,7 +1557,7 @@ public: /// \brief An iterator that walks over the captures of the lambda, /// both implicit and explicit. - typedef const Capture *capture_iterator; + typedef const LambdaCapture *capture_iterator; /// \brief An iterator over a range of lambda captures. typedef llvm::iterator_range capture_range; @@ -1709,9 +1694,11 @@ public: SourceLocation getLocEnd() const LLVM_READONLY { return ClosingBrace; } child_range children() { + // Includes initialization exprs plus body stmt return child_range(getStoredStmts(), getStoredStmts() + NumCaptures + 1); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; @@ -2226,7 +2213,9 @@ public: /// __is_enum(std::string) == false /// __is_trivially_constructible(vector, int*, int*) /// \endcode -class TypeTraitExpr : public Expr { +class TypeTraitExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The location of the type trait keyword. SourceLocation Loc; @@ -2243,16 +2232,10 @@ class TypeTraitExpr : public Expr { TypeTraitExpr(EmptyShell Empty) : Expr(TypeTraitExprClass, Empty) { } - /// \brief Retrieve the argument types. - TypeSourceInfo **getTypeSourceInfos() { - return reinterpret_cast(this+1); - } - - /// \brief Retrieve the argument types. - TypeSourceInfo * const *getTypeSourceInfos() const { - return reinterpret_cast(this+1); + size_t numTrailingObjects(OverloadToken) const { + return getNumArgs(); } - + public: /// \brief Create a new type trait expression. static TypeTraitExpr *Create(const ASTContext &C, QualType T, @@ -2284,22 +2267,9 @@ public: } /// \brief Retrieve the argument types. - ArrayRef getArgs() const { - return llvm::makeArrayRef(getTypeSourceInfos(), getNumArgs()); - } - - typedef TypeSourceInfo **arg_iterator; - arg_iterator arg_begin() { - return getTypeSourceInfos(); - } - arg_iterator arg_end() { - return getTypeSourceInfos() + getNumArgs(); - } - - typedef TypeSourceInfo const * const *arg_const_iterator; - arg_const_iterator arg_begin() const { return getTypeSourceInfos(); } - arg_const_iterator arg_end() const { - return getTypeSourceInfos() + getNumArgs(); + ArrayRef getArgs() const { + return llvm::makeArrayRef(getTrailingObjects(), + getNumArgs()); } SourceLocation getLocStart() const LLVM_READONLY { return Loc; } @@ -2314,9 +2284,9 @@ public: return child_range(child_iterator(), child_iterator()); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; - }; /// \brief An Embarcadero array type trait, as used in the implementation of @@ -2899,7 +2869,9 @@ public: /// This expression also tracks whether the sub-expression contains a /// potentially-evaluated block literal. The lifetime of a block /// literal is the extent of the enclosing scope. -class ExprWithCleanups : public Expr { +class ExprWithCleanups final + : public Expr, + private llvm::TrailingObjects { public: /// The type of objects that are kept in the cleanup. /// It's useful to remember the set of blocks; we could also @@ -2913,12 +2885,7 @@ private: ExprWithCleanups(EmptyShell, unsigned NumObjects); ExprWithCleanups(Expr *SubExpr, ArrayRef Objects); - CleanupObject *getObjectsBuffer() { - return reinterpret_cast(this + 1); - } - const CleanupObject *getObjectsBuffer() const { - return reinterpret_cast(this + 1); - } + friend TrailingObjects; friend class ASTStmtReader; public: @@ -2929,7 +2896,8 @@ public: ArrayRef objects); ArrayRef getObjects() const { - return llvm::makeArrayRef(getObjectsBuffer(), getNumObjects()); + return llvm::makeArrayRef(getTrailingObjects(), + getNumObjects()); } unsigned getNumObjects() const { return ExprWithCleanupsBits.NumObjects; } @@ -2981,7 +2949,9 @@ public: /// When the returned expression is instantiated, it may resolve to a /// constructor call, conversion function call, or some kind of type /// conversion. -class CXXUnresolvedConstructExpr : public Expr { +class CXXUnresolvedConstructExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The type being constructed. TypeSourceInfo *Type; @@ -3002,6 +2972,7 @@ class CXXUnresolvedConstructExpr : publi CXXUnresolvedConstructExpr(EmptyShell Empty, unsigned NumArgs) : Expr(CXXUnresolvedConstructExprClass, Empty), Type(), NumArgs(NumArgs) { } + friend TrailingObjects; friend class ASTStmtReader; public: @@ -3036,13 +3007,11 @@ public: unsigned arg_size() const { return NumArgs; } typedef Expr** arg_iterator; - arg_iterator arg_begin() { return reinterpret_cast(this + 1); } + arg_iterator arg_begin() { return getTrailingObjects(); } arg_iterator arg_end() { return arg_begin() + NumArgs; } typedef const Expr* const * const_arg_iterator; - const_arg_iterator arg_begin() const { - return reinterpret_cast(this + 1); - } + const_arg_iterator arg_begin() const { return getTrailingObjects(); } const_arg_iterator arg_end() const { return arg_begin() + NumArgs; } @@ -3075,7 +3044,7 @@ public: // Iterators child_range children() { - Stmt **begin = reinterpret_cast(this+1); + Stmt **begin = reinterpret_cast(arg_begin()); return child_range(begin, begin + NumArgs); } }; @@ -3608,7 +3577,9 @@ public: /// static const unsigned value = sizeof...(Types); /// }; /// \endcode -class SizeOfPackExpr : public Expr { +class SizeOfPackExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The location of the \c sizeof keyword. SourceLocation OperatorLoc; @@ -3633,6 +3604,7 @@ class SizeOfPackExpr : public Expr { /// \brief The parameter pack. NamedDecl *Pack; + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; @@ -3649,7 +3621,7 @@ class SizeOfPackExpr : public Expr { Length(Length ? *Length : PartialArgs.size()), Pack(Pack) { assert((!Length || PartialArgs.empty()) && "have partial args for non-dependent sizeof... expression"); - TemplateArgument *Args = reinterpret_cast(this + 1); + TemplateArgument *Args = getTrailingObjects(); std::uninitialized_copy(PartialArgs.begin(), PartialArgs.end(), Args); } @@ -3700,8 +3672,7 @@ public: /// \brief Get ArrayRef getPartialArguments() const { assert(isPartiallySubstituted()); - const TemplateArgument *Args = - reinterpret_cast(this + 1); + const TemplateArgument *Args = getTrailingObjects(); return llvm::makeArrayRef(Args, Args + Length); } @@ -3837,7 +3808,9 @@ public: /// }; /// template struct S; /// \endcode -class FunctionParmPackExpr : public Expr { +class FunctionParmPackExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief The function parameter pack which was referenced. ParmVarDecl *ParamPack; @@ -3851,6 +3824,7 @@ class FunctionParmPackExpr : public Expr SourceLocation NameLoc, unsigned NumParams, ParmVarDecl *const *Params); + friend TrailingObjects; friend class ASTReader; friend class ASTStmtReader; @@ -3871,7 +3845,7 @@ public: /// \brief Iterators over the parameters which the parameter pack expanded /// into. typedef ParmVarDecl * const *iterator; - iterator begin() const { return reinterpret_cast(this+1); } + iterator begin() const { return getTrailingObjects(); } iterator end() const { return begin() + NumParameters; } /// \brief Get the number of parameters in this parameter pack. Modified: vendor/clang/dist/include/clang/AST/ExprObjC.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ExprObjC.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/ExprObjC.h Wed Jan 6 20:02:26 2016 (r293250) @@ -141,15 +141,17 @@ public: /// ObjCArrayLiteral - used for objective-c array containers; as in: /// @[@"Hello", NSApp, [NSNumber numberWithInt:42]]; -class ObjCArrayLiteral : public Expr { +class ObjCArrayLiteral final + : public Expr, + private llvm::TrailingObjects { unsigned NumElements; SourceRange Range; ObjCMethodDecl *ArrayWithObjectsMethod; - + ObjCArrayLiteral(ArrayRef Elements, QualType T, ObjCMethodDecl * Method, SourceRange SR); - + explicit ObjCArrayLiteral(EmptyShell Empty, unsigned NumElements) : Expr(ObjCArrayLiteralClass, Empty), NumElements(NumElements) {} @@ -171,11 +173,11 @@ public: } /// \brief Retrieve elements of array of literals. - Expr **getElements() { return reinterpret_cast(this + 1); } + Expr **getElements() { return getTrailingObjects(); } /// \brief Retrieve elements of array of literals. - const Expr * const *getElements() const { - return reinterpret_cast(this + 1); + const Expr * const *getElements() const { + return getTrailingObjects(); } /// getNumElements - Return number of elements of objective-c array literal. @@ -196,11 +198,12 @@ public: } // Iterators - child_range children() { - return child_range((Stmt **)getElements(), - (Stmt **)getElements() + NumElements); + child_range children() { + return child_range(reinterpret_cast(getElements()), + reinterpret_cast(getElements()) + NumElements); } - + + friend TrailingObjects; friend class ASTStmtReader; }; @@ -230,32 +233,35 @@ template <> struct isPodLike { /// \brief The number of elements in this dictionary literal. unsigned NumElements : 31; - + /// \brief Determine whether this dictionary literal has any pack expansions. /// /// If the dictionary literal has pack expansions, then there will @@ -264,10 +270,17 @@ class ObjCDictionaryLiteral : public Exp /// any) and number of elements in the expansion (if known). If /// there are no pack expansions, we optimize away this storage. unsigned HasPackExpansions : 1; - + SourceRange Range; ObjCMethodDecl *DictWithObjectsMethod; - + + typedef ObjCDictionaryLiteral_KeyValuePair KeyValuePair; + typedef ObjCDictionaryLiteral_ExpansionData ExpansionData; + + size_t numTrailingObjects(OverloadToken) const { + return NumElements; + } + ObjCDictionaryLiteral(ArrayRef VK, bool HasPackExpansions, QualType T, ObjCMethodDecl *method, @@ -278,28 +291,6 @@ class ObjCDictionaryLiteral : public Exp : Expr(ObjCDictionaryLiteralClass, Empty), NumElements(NumElements), HasPackExpansions(HasPackExpansions) {} - KeyValuePair *getKeyValues() { - return reinterpret_cast(this + 1); - } - - const KeyValuePair *getKeyValues() const { - return reinterpret_cast(this + 1); - } - - ExpansionData *getExpansionData() { - if (!HasPackExpansions) - return nullptr; - - return reinterpret_cast(getKeyValues() + NumElements); - } - - const ExpansionData *getExpansionData() const { - if (!HasPackExpansions) - return nullptr; - - return reinterpret_cast(getKeyValues()+NumElements); - } - public: static ObjCDictionaryLiteral *Create(const ASTContext &C, ArrayRef VK, @@ -317,10 +308,11 @@ public: ObjCDictionaryElement getKeyValueElement(unsigned Index) const { assert((Index < NumElements) && "Arg access out of range!"); - const KeyValuePair &KV = getKeyValues()[Index]; + const KeyValuePair &KV = getTrailingObjects()[Index]; ObjCDictionaryElement Result = { KV.Key, KV.Value, SourceLocation(), None }; if (HasPackExpansions) { - const ExpansionData &Expansion = getExpansionData()[Index]; + const ExpansionData &Expansion = + getTrailingObjects()[Index]; Result.EllipsisLoc = Expansion.EllipsisLoc; if (Expansion.NumExpansionsPlusOne > 0) Result.NumExpansions = Expansion.NumExpansionsPlusOne - 1; @@ -340,17 +332,20 @@ public: } // Iterators - child_range children() { + child_range children() { // Note: we're taking advantage of the layout of the KeyValuePair struct // here. If that struct changes, this code will need to change as well. static_assert(sizeof(KeyValuePair) == sizeof(Stmt *) * 2, "KeyValuePair is expected size"); - return child_range(reinterpret_cast(this + 1), - reinterpret_cast(this + 1) + NumElements * 2); + return child_range( + reinterpret_cast(getTrailingObjects()), + reinterpret_cast(getTrailingObjects()) + + NumElements * 2); } friend class ASTStmtReader; friend class ASTStmtWriter; + friend TrailingObjects; }; @@ -797,13 +792,6 @@ public: explicit ObjCSubscriptRefExpr(EmptyShell Empty) : Expr(ObjCSubscriptRefExprClass, Empty) {} - static ObjCSubscriptRefExpr *Create(const ASTContext &C, - Expr *base, - Expr *key, QualType T, - ObjCMethodDecl *getMethod, - ObjCMethodDecl *setMethod, - SourceLocation RB); - SourceLocation getRBracket() const { return RBracket; } void setRBracket(SourceLocation RB) { RBracket = RB; } @@ -865,7 +853,13 @@ private: /// All four kinds of message sends are modeled by the ObjCMessageExpr /// class, and can be distinguished via \c getReceiverKind(). Example: /// -class ObjCMessageExpr : public Expr { +/// The "void *" trailing objects are actually ONE void * (the +/// receiver pointer), and NumArgs Expr *. But due to the +/// implementation of children(), these must be together contiguously. + +class ObjCMessageExpr final + : public Expr, + private llvm::TrailingObjects { /// \brief Stores either the selector that this message is sending /// to (when \c HasMethod is zero) or an \c ObjCMethodDecl pointer /// referring to the method that we type-checked against. @@ -877,11 +871,6 @@ class ObjCMessageExpr : public Expr { /// including the receiver. unsigned NumArgs : NumArgsBitWidth; - void setNumArgs(unsigned Num) { - assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!"); - NumArgs = Num; - } - /// \brief The kind of message send this is, which is one of the /// ReceiverKind values. /// @@ -915,6 +904,13 @@ class ObjCMessageExpr : public Expr { /// brackets ('[' and ']', respectively). SourceLocation LBracLoc, RBracLoc; + size_t numTrailingObjects(OverloadToken) const { return NumArgs + 1; } + + void setNumArgs(unsigned Num) { + assert((Num >> NumArgsBitWidth) == 0 && "Num of args is out of range!"); + NumArgs = Num; + } + ObjCMessageExpr(EmptyShell Empty, unsigned NumArgs) : Expr(ObjCMessageExprClass, Empty), SelectorOrMethod(0), Kind(0), HasMethod(0), IsDelegateInitCall(0), IsImplicit(0), SelLocsKind(0) { @@ -959,14 +955,11 @@ class ObjCMessageExpr : public Expr { SelectorLocationsKind SelLocsK); /// \brief Retrieve the pointer value of the message receiver. - void *getReceiverPointer() const { - return *const_cast( - reinterpret_cast(this + 1)); - } + void *getReceiverPointer() const { return *getTrailingObjects(); } /// \brief Set the pointer value of the message receiver. void setReceiverPointer(void *Value) { - *reinterpret_cast(this + 1) = Value; + *getTrailingObjects() = Value; } SelectorLocationsKind getSelLocsKind() const { @@ -979,10 +972,10 @@ class ObjCMessageExpr : public Expr { /// \brief Get a pointer to the stored selector identifiers locations array. /// No locations will be stored if HasStandardSelLocs is true. SourceLocation *getStoredSelLocs() { - return reinterpret_cast(getArgs() + getNumArgs()); + return getTrailingObjects(); } const SourceLocation *getStoredSelLocs() const { - return reinterpret_cast(getArgs() + getNumArgs()); + return getTrailingObjects(); } /// \brief Get the number of stored selector identifiers locations. @@ -1286,20 +1279,21 @@ public: /// \brief Retrieve the arguments to this message, not including the /// receiver. Expr **getArgs() { - return reinterpret_cast(this + 1) + 1; + return reinterpret_cast(getTrailingObjects() + 1); } const Expr * const *getArgs() const { - return reinterpret_cast(this + 1) + 1; + return reinterpret_cast(getTrailingObjects() + + 1); } /// getArg - Return the specified argument. Expr *getArg(unsigned Arg) { assert(Arg < NumArgs && "Arg access out of range!"); - return cast(getArgs()[Arg]); + return getArgs()[Arg]; } const Expr *getArg(unsigned Arg) const { assert(Arg < NumArgs && "Arg access out of range!"); - return cast(getArgs()[Arg]); + return getArgs()[Arg]; } /// setArg - Set the specified argument. void setArg(unsigned Arg, Expr *ArgExpr) { @@ -1379,6 +1373,7 @@ public: return reinterpret_cast(getArgs() + NumArgs); } + friend TrailingObjects; friend class ASTStmtReader; friend class ASTStmtWriter; }; Modified: vendor/clang/dist/include/clang/AST/Mangle.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Mangle.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/Mangle.h Wed Jan 6 20:02:26 2016 (r293250) @@ -216,9 +216,6 @@ public: uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBIndex, raw_ostream &Out) = 0; - virtual void mangleCXXCatchHandlerType(QualType T, uint32_t Flags, - raw_ostream &Out) = 0; - virtual void mangleCXXRTTIBaseClassDescriptor( const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0; Modified: vendor/clang/dist/include/clang/AST/OpenMPClause.h ============================================================================== --- vendor/clang/dist/include/clang/AST/OpenMPClause.h Wed Jan 6 20:01:33 2016 (r293249) +++ vendor/clang/dist/include/clang/AST/OpenMPClause.h Wed Jan 6 20:02:26 2016 (r293250) @@ -84,21 +84,15 @@ protected: /// \brief Fetches list of variables associated with this clause. MutableArrayRef getVarRefs() { return MutableArrayRef( - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf())), - NumVars); + static_cast(this)->template getTrailingObjects(), NumVars); } /// \brief Sets the list of variables for this clause. void setVarRefs(ArrayRef VL) { assert(VL.size() == NumVars && "Number of variables is not the same as the preallocated buffer"); - std::copy( - VL.begin(), VL.end(), - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf()))); + std::copy(VL.begin(), VL.end(), + static_cast(this)->template getTrailingObjects()); } /// \brief Build a clause with \a N variables @@ -142,9 +136,7 @@ public: /// \brief Fetches list of all variables in the clause. ArrayRef getVarRefs() const { return llvm::makeArrayRef( - reinterpret_cast( - reinterpret_cast(this) + - llvm::RoundUpToAlignment(sizeof(T), llvm::alignOf())), + static_cast(this)->template getTrailingObjects(), NumVars); } }; @@ -1160,7 +1152,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'private' /// with the variables 'a' and 'b'. /// -class OMPPrivateClause : public OMPVarListClause { +class OMPPrivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. /// @@ -1252,7 +1248,11 @@ public: /// In this example directive '#pragma omp parallel' has clause 'firstprivate' /// with the variables 'a' and 'b'. /// -class OMPFirstprivateClause : public OMPVarListClause { +class OMPFirstprivateClause final + : public OMPVarListClause, + private llvm::TrailingObjects { + friend TrailingObjects; + friend OMPVarListClause; friend class OMPClauseReader; /// \brief Build clause with number of variables \a N. @@ -1372,7 +1372,9 @@ public: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:02:56 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09073A658E7; Wed, 6 Jan 2016 20:02:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B23DC1EB3; Wed, 6 Jan 2016 20:02:55 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K2sXd084287; Wed, 6 Jan 2016 20:02:54 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K2sNK084286; Wed, 6 Jan 2016 20:02:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062002.u06K2sNK084286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:02:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293252 - vendor/clang/clang-trunk-r256945 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:02:56 -0000 Author: dim Date: Wed Jan 6 20:02:54 2016 New Revision: 293252 URL: https://svnweb.freebsd.org/changeset/base/293252 Log: Tag clang trunk r256945. Added: vendor/clang/clang-trunk-r256945/ - copied from r293250, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:03:24 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34D5FA659A9; Wed, 6 Jan 2016 20:03:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F417B1171; Wed, 6 Jan 2016 20:03:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K3Njw084370; Wed, 6 Jan 2016 20:03:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K3Lx9084354; Wed, 6 Jan 2016 20:03:21 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062003.u06K3Lx9084354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293253 - in vendor/compiler-rt/dist: cmake include/sanitizer lib/asan lib/profile lib/sanitizer_common test/asan/TestCases X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:03:24 -0000 Author: dim Date: Wed Jan 6 20:03:21 2016 New Revision: 293253 URL: https://svnweb.freebsd.org/changeset/base/293253 Log: Vendor import of compiler-rt trunk r256945: https://llvm.org/svn/llvm-project/compiler-rt/trunk@256945 Added: vendor/compiler-rt/dist/lib/profile/WindowsMMap.c (contents, props changed) vendor/compiler-rt/dist/lib/profile/WindowsMMap.h (contents, props changed) vendor/compiler-rt/dist/test/asan/TestCases/coverage-pc-buffer.cc (contents, props changed) Modified: vendor/compiler-rt/dist/cmake/config-ix.cmake vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cc vendor/compiler-rt/dist/lib/profile/CMakeLists.txt vendor/compiler-rt/dist/lib/profile/GCDAProfiling.c vendor/compiler-rt/dist/lib/profile/InstrProfData.inc vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc Modified: vendor/compiler-rt/dist/cmake/config-ix.cmake ============================================================================== --- vendor/compiler-rt/dist/cmake/config-ix.cmake Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/cmake/config-ix.cmake Wed Jan 6 20:03:21 2016 (r293253) @@ -559,7 +559,7 @@ else() endif() if (PROFILE_SUPPORTED_ARCH AND - OS_NAME MATCHES "Darwin|Linux|FreeBSD") + OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows") set(COMPILER_RT_HAS_PROFILE TRUE) else() set(COMPILER_RT_HAS_PROFILE FALSE) Modified: vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h ============================================================================== --- vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/include/sanitizer/coverage_interface.h Wed Jan 6 20:03:21 2016 (r293253) @@ -41,6 +41,13 @@ extern "C" { // Some of the entries in *data will be zero. uintptr_t __sanitizer_get_coverage_guards(uintptr_t **data); + // Set *data to the growing buffer with covered PCs and return the size + // of the buffer. The entries are never zero. + // When only unique pcs are collected, the size is equal to + // __sanitizer_get_total_unique_coverage. + // WARNING: EXPERIMENTAL API. + uintptr_t __sanitizer_get_coverage_pc_buffer(uintptr_t **data); + // The coverage instrumentation may optionally provide imprecise counters. // Rather than exposing the counter values to the user we instead map // the counters to a bitset. Modified: vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cc ============================================================================== --- vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cc Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cc Wed Jan 6 20:03:21 2016 (r293253) @@ -315,6 +315,7 @@ INTERFACE_FUNCTION(__sanitizer_cov_trace INTERFACE_FUNCTION(__sanitizer_cov_with_check) INTERFACE_FUNCTION(__sanitizer_get_allocated_size) INTERFACE_FUNCTION(__sanitizer_get_coverage_guards) +INTERFACE_FUNCTION(__sanitizer_get_coverage_pc_buffer) INTERFACE_FUNCTION(__sanitizer_get_current_allocated_bytes) INTERFACE_FUNCTION(__sanitizer_get_estimated_allocated_size) INTERFACE_FUNCTION(__sanitizer_get_free_bytes) Modified: vendor/compiler-rt/dist/lib/profile/CMakeLists.txt ============================================================================== --- vendor/compiler-rt/dist/lib/profile/CMakeLists.txt Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/profile/CMakeLists.txt Wed Jan 6 20:03:21 2016 (r293253) @@ -35,7 +35,8 @@ set(PROFILE_SOURCES InstrProfilingPlatformLinux.c InstrProfilingPlatformOther.c InstrProfilingRuntime.cc - InstrProfilingUtil.c) + InstrProfilingUtil.c + WindowsMMap.c) if(UNIX) set(EXTRA_FLAGS Modified: vendor/compiler-rt/dist/lib/profile/GCDAProfiling.c ============================================================================== --- vendor/compiler-rt/dist/lib/profile/GCDAProfiling.c Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/profile/GCDAProfiling.c Wed Jan 6 20:03:21 2016 (r293253) @@ -27,8 +27,13 @@ #include #include #include + +#if defined(_WIN32) +#include "WindowsMMap.h" +#else #include #include +#endif #define I386_FREEBSD (defined(__FreeBSD__) && defined(__i386__)) @@ -37,6 +42,7 @@ #endif #if defined(_MSC_VER) +typedef unsigned char uint8_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; #elif I386_FREEBSD Modified: vendor/compiler-rt/dist/lib/profile/InstrProfData.inc ============================================================================== --- vendor/compiler-rt/dist/lib/profile/InstrProfData.inc Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/profile/InstrProfData.inc Wed Jan 6 20:03:21 2016 (r293253) @@ -1,4 +1,4 @@ -/*===-- InstrProfData.inc - instr profiling runtime structures -----------=== *\ +/*===-- InstrProfData.inc - instr profiling runtime structures -*- C++ -*-=== *\ |* |* The LLVM Compiler Infrastructure |* @@ -167,6 +167,25 @@ COVMAP_FUNC_RECORD(const uint64_t, llvm: #undef COVMAP_FUNC_RECORD /* COVMAP_FUNC_RECORD end. */ +/* COVMAP_HEADER start */ +/* Definition of member fields of coverage map header. + */ +#ifndef COVMAP_HEADER +#define COVMAP_HEADER(Type, LLVMType, Name, Initializer) +#else +#define INSTR_PROF_DATA_DEFINED +#endif +COVMAP_HEADER(uint32_t, Int32Ty, NRecords, \ + llvm::ConstantInt::get(Int32Ty, FunctionRecords.size())) +COVMAP_HEADER(uint32_t, Int32Ty, FilenamesSize, \ + llvm::ConstantInt::get(Int32Ty, FilenamesSize)) +COVMAP_HEADER(uint32_t, Int32Ty, CoverageSize, \ + llvm::ConstantInt::get(Int32Ty, CoverageMappingSize)) +COVMAP_HEADER(uint32_t, Int32Ty, Version, \ + llvm::ConstantInt::get(Int32Ty, CoverageMappingVersion1)) +#undef COVMAP_HEADER +/* COVMAP_HEADER end. */ + #ifdef INSTR_PROF_VALUE_PROF_DATA #define INSTR_PROF_DATA_DEFINED Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c ============================================================================== --- vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c Wed Jan 6 20:03:21 2016 (r293253) @@ -17,6 +17,10 @@ #define UNCONST(ptr) ((void *)(uintptr_t)(ptr)) +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + /* Return 1 if there is an error, otherwise return 0. */ static uint32_t fileWriter(ProfDataIOVec *IOVecs, uint32_t NumIOVecs, void **WriterCtx) { Modified: vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h ============================================================================== --- vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/profile/InstrProfilingPort.h Wed Jan 6 20:03:21 2016 (r293253) @@ -47,26 +47,12 @@ if (GetEnvHook && GetEnvHook("LLVM_PROFILE_VERBOSE_ERRORS")) \ fprintf(stderr, Format, __VA_ARGS__); -#if defined(__FreeBSD__) && defined(__i386__) +#if defined(__FreeBSD__) -/* System headers define 'size_t' incorrectly on x64 FreeBSD (prior to - * FreeBSD 10, r232261) when compiled in 32-bit mode. - */ -#define PRIu64 "llu" -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef uint32_t uintptr_t; -#elif defined(__FreeBSD__) && defined(__x86_64__) -#define PRIu64 "lu" -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; -typedef unsigned long int uintptr_t; +#include +#include -#else /* defined(__FreeBSD__) && defined(__i386__) */ +#else /* defined(__FreeBSD__) */ #include #include Added: vendor/compiler-rt/dist/lib/profile/WindowsMMap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/lib/profile/WindowsMMap.c Wed Jan 6 20:03:21 2016 (r293253) @@ -0,0 +1,128 @@ +/* + * This code is derived from uClibc (original license follows). + * https://git.uclibc.org/uClibc/tree/utils/mmap-windows.c + */ + /* mmap() replacement for Windows + * + * Author: Mike Frysinger + * Placed into the public domain + */ + +/* References: + * CreateFileMapping: http://msdn.microsoft.com/en-us/library/aa366537(VS.85).aspx + * CloseHandle: http://msdn.microsoft.com/en-us/library/ms724211(VS.85).aspx + * MapViewOfFile: http://msdn.microsoft.com/en-us/library/aa366761(VS.85).aspx + * UnmapViewOfFile: http://msdn.microsoft.com/en-us/library/aa366882(VS.85).aspx + */ + +#if defined(_WIN32) + +#include "WindowsMMap.h" +#include "InstrProfiling.h" + +#ifdef __USE_FILE_OFFSET64 +# define DWORD_HI(x) (x >> 32) +# define DWORD_LO(x) ((x) & 0xffffffff) +#else +# define DWORD_HI(x) (0) +# define DWORD_LO(x) (x) +#endif + +COMPILER_RT_VISIBILITY +void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) +{ + if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) + return MAP_FAILED; + if (fd == -1) { + if (!(flags & MAP_ANON) || offset) + return MAP_FAILED; + } else if (flags & MAP_ANON) + return MAP_FAILED; + + DWORD flProtect; + if (prot & PROT_WRITE) { + if (prot & PROT_EXEC) + flProtect = PAGE_EXECUTE_READWRITE; + else + flProtect = PAGE_READWRITE; + } else if (prot & PROT_EXEC) { + if (prot & PROT_READ) + flProtect = PAGE_EXECUTE_READ; + else if (prot & PROT_EXEC) + flProtect = PAGE_EXECUTE; + } else + flProtect = PAGE_READONLY; + + off_t end = length + offset; + HANDLE mmap_fd, h; + if (fd == -1) + mmap_fd = INVALID_HANDLE_VALUE; + else + mmap_fd = (HANDLE)_get_osfhandle(fd); + h = CreateFileMapping(mmap_fd, NULL, flProtect, DWORD_HI(end), DWORD_LO(end), NULL); + if (h == NULL) + return MAP_FAILED; + + DWORD dwDesiredAccess; + if (prot & PROT_WRITE) + dwDesiredAccess = FILE_MAP_WRITE; + else + dwDesiredAccess = FILE_MAP_READ; + if (prot & PROT_EXEC) + dwDesiredAccess |= FILE_MAP_EXECUTE; + if (flags & MAP_PRIVATE) + dwDesiredAccess |= FILE_MAP_COPY; + void *ret = MapViewOfFile(h, dwDesiredAccess, DWORD_HI(offset), DWORD_LO(offset), length); + if (ret == NULL) { + CloseHandle(h); + ret = MAP_FAILED; + } + return ret; +} + +COMPILER_RT_VISIBILITY +void munmap(void *addr, size_t length) +{ + UnmapViewOfFile(addr); + /* ruh-ro, we leaked handle from CreateFileMapping() ... */ +} + +COMPILER_RT_VISIBILITY +int msync(void *addr, size_t length, int flags) +{ + if (flags & MS_INVALIDATE) + return -1; /* Not supported. */ + + /* Exactly one of MS_ASYNC or MS_SYNC must be specified. */ + switch (flags & (MS_ASYNC | MS_SYNC)) { + case MS_SYNC: + case MS_ASYNC: + break; + default: + return -1; + } + + if (!FlushViewOfFile(addr, length)) + return -1; + + if (flags & MS_SYNC) { + /* FIXME: No longer have access to handle from CreateFileMapping(). */ + /* + * if (!FlushFileBuffers(h)) + * return -1; + */ + } + + return 0; +} + +COMPILER_RT_VISIBILITY +int flock(int fd, int operation) +{ + return -1; /* Not supported. */ +} + +#undef DWORD_HI +#undef DWORD_LO + +#endif /* _WIN32 */ Added: vendor/compiler-rt/dist/lib/profile/WindowsMMap.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/lib/profile/WindowsMMap.h Wed Jan 6 20:03:21 2016 (r293253) @@ -0,0 +1,65 @@ +/*===- WindowsMMap.h - Support library for PGO instrumentation ------------===*\ +|* +|* The LLVM Compiler Infrastructure +|* +|* This file is distributed under the University of Illinois Open Source +|* License. See LICENSE.TXT for details. +|* +\*===----------------------------------------------------------------------===*/ + +#ifndef PROFILE_INSTRPROFILING_WINDOWS_MMAP_H +#define PROFILE_INSTRPROFILING_WINDOWS_MMAP_H + +#if defined(_WIN32) + +#include +#include +#include + +/* + * mmap() flags + */ +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 +/* This flag is only available in WinXP+ */ +#ifdef FILE_MAP_EXECUTE +#define PROT_EXEC 0x4 +#else +#define PROT_EXEC 0x0 +#define FILE_MAP_EXECUTE 0 +#endif + +#define MAP_FILE 0x00 +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FAILED ((void *) -1) + +/* + * msync() flags + */ +#define MS_ASYNC 0x0001 /* return immediately */ +#define MS_INVALIDATE 0x0002 /* invalidate all cached data */ +#define MS_SYNC 0x0010 /* msync synchronously */ + +/* + * flock() operations + */ +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* don't block when locking */ +#define LOCK_UN 8 /* unlock */ + +void *mmap(void *start, size_t length, int prot, int flags, int fd, + off_t offset); + +void munmap(void *addr, size_t length); + +int msync(void *addr, size_t length, int flags); + +int flock(int fd, int operation); + +#endif /* _WIN32 */ + +#endif /* PROFILE_INSTRPROFILING_WINDOWS_MMAP_H */ Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Wed Jan 6 20:03:21 2016 (r293253) @@ -108,6 +108,7 @@ class CoverageData { uptr *data(); uptr size(); + uptr *buffer() const { return pc_buffer; } private: void DirectOpen(); @@ -133,6 +134,8 @@ class CoverageData { // Descriptor of the file mapped pc array. fd_t pc_fd; + uptr *pc_buffer; + // Vector of coverage guard arrays, protected by mu. InternalMmapVectorNoCtor guard_array_vec; @@ -209,6 +212,11 @@ void CoverageData::Enable() { atomic_store(&pc_array_size, kPcArrayMaxSize, memory_order_relaxed); } + pc_buffer = nullptr; + if (common_flags()->coverage_pc_buffer) + pc_buffer = reinterpret_cast(MmapNoReserveOrDie( + sizeof(uptr) * kPcArrayMaxSize, "CovInit::pc_buffer")); + cc_array = reinterpret_cast(MmapNoReserveOrDie( sizeof(uptr *) * kCcArrayMaxSize, "CovInit::cc_array")); atomic_store(&cc_array_size, kCcArrayMaxSize, memory_order_relaxed); @@ -246,6 +254,10 @@ void CoverageData::Disable() { UnmapOrDie(cc_array, sizeof(uptr *) * kCcArrayMaxSize); cc_array = nullptr; } + if (pc_buffer) { + UnmapOrDie(pc_buffer, sizeof(uptr) * kPcArrayMaxSize); + pc_buffer = nullptr; + } if (tr_event_array) { UnmapOrDie(tr_event_array, sizeof(tr_event_array[0]) * kTrEventArrayMaxSize + @@ -414,6 +426,7 @@ void CoverageData::Add(uptr pc, u32 *gua atomic_load(&pc_array_size, memory_order_acquire)); uptr counter = atomic_fetch_add(&coverage_counter, 1, memory_order_relaxed); pc_array[idx] = BundlePcAndCounter(pc, counter); + if (pc_buffer) pc_buffer[counter] = pc; } // Registers a pair caller=>callee. @@ -944,6 +957,12 @@ uptr __sanitizer_get_coverage_guards(upt } SANITIZER_INTERFACE_ATTRIBUTE +uptr __sanitizer_get_coverage_pc_buffer(uptr **data) { + *data = coverage_data.buffer(); + return __sanitizer_get_total_unique_coverage(); +} + +SANITIZER_INTERFACE_ATTRIBUTE uptr __sanitizer_get_number_of_counters() { return coverage_data.GetNumberOf8bitCounters(); } Modified: vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc ============================================================================== --- vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc Wed Jan 6 20:02:54 2016 (r293252) +++ vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.inc Wed Jan 6 20:03:21 2016 (r293253) @@ -144,6 +144,9 @@ COMMON_FLAG(bool, coverage_direct, SANIT COMMON_FLAG(const char *, coverage_dir, ".", "Target directory for coverage dumps. Defaults to the current " "directory.") +COMMON_FLAG(bool, coverage_pc_buffer, true, + "If set (and if 'coverage' is set too), the pcs would be collected " + "in a buffer.") COMMON_FLAG(bool, full_address_space, false, "Sanitize complete address space; " "by default kernel area on 32-bit platforms will not be sanitized") Added: vendor/compiler-rt/dist/test/asan/TestCases/coverage-pc-buffer.cc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/test/asan/TestCases/coverage-pc-buffer.cc Wed Jan 6 20:03:21 2016 (r293253) @@ -0,0 +1,48 @@ +// Test __sanitizer_coverage_pc_buffer(). + +// RUN: %clangxx_asan -fsanitize-coverage=edge %s -o %t && %run %t + +// UNSUPPORTED: android + +#include +#include +#include + +static volatile int sink; +__attribute__((noinline)) void bar() { sink = 2; } +__attribute__((noinline)) void foo() { sink = 1; } + +void assertNotZeroPcs(uintptr_t *buf, uintptr_t size) { + assert(buf); + for (uintptr_t i = 0; i < size; ++i) + assert(buf[i]); +} + +int main() { + uintptr_t *buf = NULL; + uintptr_t sz = __sanitizer_get_coverage_pc_buffer(&buf); + assertNotZeroPcs(buf, sz); + assert(sz); + + foo(); + bar(); + uintptr_t *buf1 = NULL; + uintptr_t sz1 = __sanitizer_get_coverage_pc_buffer(&buf1); + assertNotZeroPcs(buf1, sz1); + assert(buf1 == buf); + assert(sz1 > sz); + + bar(); + uintptr_t *buf2 = NULL; + uintptr_t sz2 = __sanitizer_get_coverage_pc_buffer(&buf2); + assertNotZeroPcs(buf2, sz2); + assert(buf2 == buf); + assert(sz2 > sz1); + + __sanitizer_reset_coverage(); + uintptr_t *buf3 = NULL; + uintptr_t sz3 = __sanitizer_get_coverage_pc_buffer(&buf3); + assertNotZeroPcs(buf3, sz3); + assert(buf3 == buf); + assert(sz3 < sz2); +} From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:03:58 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D15AEA65A03; Wed, 6 Jan 2016 20:03:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8729E12F9; Wed, 6 Jan 2016 20:03:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K3vqZ084452; Wed, 6 Jan 2016 20:03:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K3vST084451; Wed, 6 Jan 2016 20:03:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062003.u06K3vST084451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293254 - vendor/compiler-rt/compiler-rt-trunk-r256945 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:03:58 -0000 Author: dim Date: Wed Jan 6 20:03:57 2016 New Revision: 293254 URL: https://svnweb.freebsd.org/changeset/base/293254 Log: Tag compiler-rt trunk r256945. Added: vendor/compiler-rt/compiler-rt-trunk-r256945/ - copied from r293253, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:05:22 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BBEDA65BA8; Wed, 6 Jan 2016 20:05:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7A4215D8; Wed, 6 Jan 2016 20:05:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K5LoP084552; Wed, 6 Jan 2016 20:05:21 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K5KVK084545; Wed, 6 Jan 2016 20:05:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062005.u06K5KVK084545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293255 - in vendor/libc++/dist: include include/ext test/libcxx/test test/std/containers/associative/map/map.modifiers test/std/containers/associative/multimap/multimap.modifiers test/... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:05:22 -0000 Author: dim Date: Wed Jan 6 20:05:20 2016 New Revision: 293255 URL: https://svnweb.freebsd.org/changeset/base/293255 Log: Vendor import of libc++ trunk r256945: https://llvm.org/svn/llvm-project/libcxx/trunk@256945 Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/__hash_table vendor/libc++/dist/include/__tree vendor/libc++/dist/include/ext/hash_map vendor/libc++/dist/include/forward_list vendor/libc++/dist/include/list vendor/libc++/dist/include/map vendor/libc++/dist/include/unordered_map vendor/libc++/dist/test/libcxx/test/config.py vendor/libc++/dist/test/libcxx/test/target_info.py vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/insert_iter_rv.pass.cpp vendor/libc++/dist/test/std/containers/associative/map/map.modifiers/insert_rv.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/insert_iter_rv.pass.cpp vendor/libc++/dist/test/std/containers/associative/multimap/multimap.modifiers/insert_rv.pass.cpp vendor/libc++/dist/test/support/MoveOnly.h Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/__config Wed Jan 6 20:05:20 2016 (r293255) @@ -39,6 +39,8 @@ #define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. #define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +// Fix undefined behavior in how std::list stores it's linked nodes. +#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB #endif #define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y Modified: vendor/libc++/dist/include/__hash_table ============================================================================== --- vendor/libc++/dist/include/__hash_table Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/__hash_table Wed Jan 6 20:05:20 2016 (r293255) @@ -46,12 +46,7 @@ template struct __hash_node : public __hash_node_base < - typename pointer_traits<_VoidPtr>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__hash_node<_Tp, _VoidPtr> > -#else - rebind<__hash_node<_Tp, _VoidPtr> >::other -#endif + typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type > { typedef _Tp value_type; @@ -98,13 +93,7 @@ public: typedef typename pointer_traits<__node_pointer>::element_type::value_type value_type; typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef value_type& reference; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT #if _LIBCPP_STD_VER > 11 @@ -229,20 +218,8 @@ public: typedef typename __node::value_type value_type; typedef typename pointer_traits<__node_pointer>::difference_type difference_type; typedef const value_type& reference; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__node> -#else - rebind<__node>::other -#endif - __non_const_node_pointer; + typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer; + typedef typename __rebind_pointer<__node_pointer, __node>::type __non_const_node_pointer; typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator; _LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT @@ -376,13 +353,7 @@ public: typedef typename __pointer_traits::element_type::value_type value_type; typedef typename __pointer_traits::difference_type difference_type; typedef value_type& reference; - typedef typename __pointer_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT { @@ -514,13 +485,9 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_const typedef pointer_traits<__node_pointer> __pointer_traits; typedef typename __pointer_traits::element_type __node; typedef typename remove_const<__node>::type __non_const_node; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__non_const_node> -#else - rebind<__non_const_node>::other -#endif - __non_const_node_pointer; + typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type + __non_const_node_pointer; + typedef __hash_local_iterator<__non_const_node_pointer> __non_const_iterator; public: @@ -530,13 +497,9 @@ public: >::type value_type; typedef typename __pointer_traits::difference_type difference_type; typedef const value_type& reference; - typedef typename __pointer_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, const value_type>::type + pointer; + _LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT { @@ -780,13 +743,8 @@ public: typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_const_pointer; typedef __hash_node_base<__node_pointer> __first_node; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__first_node> -#else - rebind<__first_node>::other -#endif - __node_base_pointer; + typedef typename __rebind_pointer<__node_pointer, __first_node>::type + __node_base_pointer; private: Modified: vendor/libc++/dist/include/__tree ============================================================================== --- vendor/libc++/dist/include/__tree Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/__tree Wed Jan 6 20:05:20 2016 (r293255) @@ -548,31 +548,15 @@ template class __tree_node_base : public __tree_end_node < - typename pointer_traits<_VoidPtr>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__tree_node_base<_VoidPtr> > -#else - rebind<__tree_node_base<_VoidPtr> >::other -#endif + typename __rebind_pointer<_VoidPtr, __tree_node_base<_VoidPtr> >::type > { __tree_node_base(const __tree_node_base&); __tree_node_base& operator=(const __tree_node_base&); public: - typedef typename pointer_traits<_VoidPtr>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__tree_node_base> -#else - rebind<__tree_node_base>::other -#endif - pointer; - typedef typename pointer_traits<_VoidPtr>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - const_pointer; + typedef typename __rebind_pointer<_VoidPtr, __tree_node_base>::type pointer; + typedef typename __rebind_pointer<_VoidPtr, const __tree_node_base>::type const_pointer; + typedef __tree_end_node base; pointer __right_; @@ -623,13 +607,7 @@ public: typedef _Tp value_type; typedef _DiffType difference_type; typedef value_type& reference; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT #if _LIBCPP_STD_VER > 11 @@ -694,13 +672,7 @@ public: typedef _Tp value_type; typedef _DiffType difference_type; typedef const value_type& reference; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT #if _LIBCPP_STD_VER > 11 @@ -710,13 +682,8 @@ public: private: typedef typename remove_const<__node>::type __non_const_node; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__non_const_node> -#else - rebind<__non_const_node>::other -#endif - __non_const_node_pointer; + typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type + __non_const_node_pointer; typedef __tree_iterator __non_const_iterator; public: @@ -730,14 +697,8 @@ public: _LIBCPP_INLINE_VISIBILITY __tree_const_iterator& operator++() { - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - __node_base_pointer; - + typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type + __node_base_pointer; __ptr_ = static_cast<__node_pointer>( __tree_next(static_cast<__node_base_pointer>(__ptr_))); return *this; @@ -749,14 +710,8 @@ public: _LIBCPP_INLINE_VISIBILITY __tree_const_iterator& operator--() { - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - __node_base_pointer; - + typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type + __node_base_pointer; __ptr_ = static_cast<__node_pointer>( __tree_prev(static_cast<__node_base_pointer>(__ptr_))); return *this; @@ -810,20 +765,9 @@ public: typedef typename __node_base::pointer __node_base_const_pointer; private: typedef typename __node_base::base __end_node_t; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__end_node_t> -#else - rebind<__end_node_t>::other -#endif - __end_node_ptr; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__end_node_t> -#else - rebind<__end_node_t>::other -#endif - __end_node_const_ptr; + typedef typename __rebind_pointer<__node_pointer, __end_node_t>::type + __end_node_ptr; + typedef __end_node_ptr __end_node_const_ptr; __node_pointer __begin_node_; __compressed_pair<__end_node_t, __node_allocator> __pair1_; @@ -965,6 +909,13 @@ public: iterator __insert_multi(const value_type& __v); iterator __insert_multi(const_iterator __p, const value_type& __v); +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + pair __insert_unique( value_type&& __v); + iterator __insert_unique(const_iterator __p, value_type&& __v); + iterator __insert_multi( value_type&& __v); + iterator __insert_multi(const_iterator __p, value_type&& __v); +#endif + pair __node_insert_unique(__node_pointer __nd); iterator __node_insert_unique(const_iterator __p, __node_pointer __nd); @@ -1786,6 +1737,28 @@ __tree<_Tp, _Compare, _Allocator>::__emp #endif // _LIBCPP_HAS_NO_VARIADICS template +pair::iterator, bool> +__tree<_Tp, _Compare, _Allocator>::__insert_unique(value_type&& __v) +{ + __node_holder __h = __construct_node(_VSTD::forward(__v)); + pair __r = __node_insert_unique(__h.get()); + if (__r.second) + __h.release(); + return __r; +} + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, value_type&& __v) +{ + __node_holder __h = __construct_node(_VSTD::forward(__v)); + iterator __r = __node_insert_unique(__p, __h.get()); + if (__r.__ptr_ == __h.get()) + __h.release(); + return __r; +} + +template template pair::iterator, bool> __tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v) @@ -1810,6 +1783,28 @@ __tree<_Tp, _Compare, _Allocator>::__ins } template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__insert_multi(value_type&& __v) +{ + __node_base_pointer __parent; + __node_base_pointer& __child = __find_leaf_high(__parent, __v); + __node_holder __h = __construct_node(_VSTD::forward(__v)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + return iterator(__h.release()); +} + +template +typename __tree<_Tp, _Compare, _Allocator>::iterator +__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, value_type&& __v) +{ + __node_base_pointer __parent; + __node_base_pointer& __child = __find_leaf(__p, __parent, __v); + __node_holder __h = __construct_node(_VSTD::forward(__v)); + __insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get())); + return iterator(__h.release()); +} + +template template typename __tree<_Tp, _Compare, _Allocator>::iterator __tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v) Modified: vendor/libc++/dist/include/ext/hash_map ============================================================================== --- vendor/libc++/dist/include/ext/hash_map Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/ext/hash_map Wed Jan 6 20:05:20 2016 (r293255) @@ -368,7 +368,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_i { _HashIterator __i_; - typedef pointer_traits __pointer_traits; typedef const typename _HashIterator::value_type::first_type key_type; typedef typename _HashIterator::value_type::second_type mapped_type; public: @@ -376,13 +375,8 @@ public: typedef pair value_type; typedef typename _HashIterator::difference_type difference_type; typedef value_type& reference; - typedef typename __pointer_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer::type + pointer; _LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {} @@ -419,7 +413,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_c { _HashIterator __i_; - typedef pointer_traits __pointer_traits; typedef const typename _HashIterator::value_type::first_type key_type; typedef typename _HashIterator::value_type::second_type mapped_type; public: @@ -427,13 +420,8 @@ public: typedef pair value_type; typedef typename _HashIterator::difference_type difference_type; typedef const value_type& reference; - typedef typename __pointer_traits::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer::type + pointer; _LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {} Modified: vendor/libc++/dist/include/forward_list ============================================================================== --- vendor/libc++/dist/include/forward_list Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/forward_list Wed Jan 6 20:05:20 2016 (r293255) @@ -197,15 +197,9 @@ struct __forward_begin_node template struct _LIBCPP_HIDDEN __begin_node_of { - typedef __forward_begin_node - < - typename pointer_traits<_VoidPtr>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__forward_list_node<_Tp, _VoidPtr> > -#else - rebind<__forward_list_node<_Tp, _VoidPtr> >::other -#endif - > type; + typedef __forward_begin_node< + typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type + > type; }; template @@ -240,13 +234,7 @@ public: typedef value_type& reference; typedef typename pointer_traits<__node_pointer>::difference_type difference_type; - typedef typename pointer_traits<__node_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {} @@ -295,13 +283,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_li < typename pointer_traits<__node_const_pointer>::element_type >::type __node; - typedef typename pointer_traits<__node_const_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind<__node> -#else - rebind<__node>::other -#endif - __node_pointer; + typedef typename __rebind_pointer<__node_const_pointer, __node>::type __node_pointer; template friend class forward_list; @@ -311,13 +293,7 @@ public: typedef const value_type& reference; typedef typename pointer_traits<__node_const_pointer>::difference_type difference_type; - typedef typename pointer_traits<__node_const_pointer>::template -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES - rebind -#else - rebind::other -#endif - pointer; + typedef typename __rebind_pointer<__node_const_pointer, const value_type>::type pointer; _LIBCPP_INLINE_VISIBILITY __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} Modified: vendor/libc++/dist/include/list ============================================================================== --- vendor/libc++/dist/include/list Wed Jan 6 20:03:57 2016 (r293254) +++ vendor/libc++/dist/include/list Wed Jan 6 20:05:20 2016 (r293255) @@ -175,6 +175,7 @@ template #include #include #include +#include #include <__undef_min_max> @@ -187,25 +188,66 @@ template _LIBCPP_BEGIN_NAMESPACE_STD template struct __list_node; +template struct __list_node_base; + +template +struct __list_node_pointer_traits { + typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type + __node_pointer; + typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type + __base_pointer; + +#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB) + typedef __base_pointer __link_pointer; +#else + typedef typename conditional< + is_pointer<_VoidPtr>::value, + __base_pointer, + __node_pointer + >::type __link_pointer; +#endif + + typedef typename conditional< + is_same<__link_pointer, __node_pointer>::value, + __base_pointer, + __node_pointer + >::type __non_link_pointer; + + static _LIBCPP_INLINE_VISIBILITY + __link_pointer __unsafe_link_pointer_cast(__link_pointer __p) { + return __p; + } + + static _LIBCPP_INLINE_VISIBILITY + __link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) { + return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p)); + } + +}; template struct __list_node_base { - typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type - pointer; - typedef typename __rebind_pointer<_VoidPtr, __list_node_base>::type - __base_pointer; + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__node_pointer __node_pointer; + typedef typename _NodeTraits::__base_pointer __base_pointer; + typedef typename _NodeTraits::__link_pointer __link_pointer; - pointer __prev_; - pointer __next_; + __link_pointer __prev_; + __link_pointer __next_; _LIBCPP_INLINE_VISIBILITY - __list_node_base() : __prev_(__self()), __next_(__self()) {} + __list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())), + __next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {} _LIBCPP_INLINE_VISIBILITY - pointer __self() - { - return static_cast(pointer_traits<__base_pointer>::pointer_to(*this)); + __base_pointer __self() { + return pointer_traits<__base_pointer>::pointer_to(*this); + } + + _LIBCPP_INLINE_VISIBILITY + __node_pointer __as_node() { + return static_cast<__node_pointer>(__self()); } }; @@ -214,6 +256,14 @@ struct __list_node : public __list_node_base<_Tp, _VoidPtr> { _Tp __value_; + + typedef __list_node_base<_Tp, _VoidPtr> __base; + typedef typename __base::__link_pointer __link_pointer; + + _LIBCPP_INLINE_VISIBILITY + __link_pointer __as_link() { + return static_cast<__link_pointer>(__base::__self()); + } }; template > class _LIBCPP_TYPE_VIS_ONLY list; @@ -223,21 +273,21 @@ template cla template class _LIBCPP_TYPE_VIS_ONLY __list_iterator { - typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type - __node_pointer; + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__link_pointer __link_pointer; - __node_pointer __ptr_; + __link_pointer __ptr_; #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__node_pointer __p, const void* __c) _NOEXCEPT + explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { __get_db()->__insert_ic(this, __c); } #else _LIBCPP_INLINE_VISIBILITY - explicit __list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} + explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif @@ -295,7 +345,7 @@ public: _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable list::iterator"); #endif - return __ptr_->__value_; + return __ptr_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY pointer operator->() const @@ -304,7 +354,7 @@ public: _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable list::iterator"); #endif - return pointer_traits::pointer_to(__ptr_->__value_); + return pointer_traits::pointer_to(__ptr_->__as_node()->__value_); } _LIBCPP_INLINE_VISIBILITY @@ -346,21 +396,21 @@ public: template class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator { - typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type - __node_pointer; + typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits; + typedef typename _NodeTraits::__link_pointer __link_pointer; - __node_pointer __ptr_; + __link_pointer __ptr_; #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__node_pointer __p, const void* __c) _NOEXCEPT + explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT : __ptr_(__p) { __get_db()->__insert_ic(this, __c); } #else _LIBCPP_INLINE_VISIBILITY - explicit __list_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} + explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {} #endif template friend class list; @@ -422,7 +472,7 @@ public: _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable list::const_iterator"); #endif - return __ptr_->__value_; + return __ptr_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY pointer operator->() const @@ -431,7 +481,7 @@ public: _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), "Attempted to dereference a non-dereferenceable list::iterator"); #endif - return pointer_traits::pointer_to(__ptr_->__value_); + return pointer_traits::pointer_to(__ptr_->__as_node()->__value_); } _LIBCPP_INLINE_VISIBILITY @@ -489,6 +539,9 @@ protected: typedef allocator_traits<__node_allocator> __node_alloc_traits; typedef typename __node_alloc_traits::pointer __node_pointer; typedef typename __node_alloc_traits::pointer __node_const_pointer; + typedef __list_node_pointer_traits __node_pointer_traits; + typedef typename __node_pointer_traits::__link_pointer __link_pointer; + typedef __link_pointer __link_const_pointer; typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::const_pointer const_pointer; typedef typename __alloc_traits::difference_type difference_type; @@ -500,6 +553,12 @@ protected: __compressed_pair __size_alloc_; _LIBCPP_INLINE_VISIBILITY + __link_pointer __end_as_link() const _NOEXCEPT { + return __node_pointer_traits::__unsafe_link_pointer_cast( + const_cast<__node_base&>(__end_).__self()); + } + + _LIBCPP_INLINE_VISIBILITY size_type& __sz() _NOEXCEPT {return __size_alloc_.first();} _LIBCPP_INLINE_VISIBILITY const size_type& __sz() const _NOEXCEPT @@ -511,7 +570,7 @@ protected: const __node_allocator& __node_alloc() const _NOEXCEPT {return __size_alloc_.second();} - static void __unlink_nodes(__node_pointer __f, __node_pointer __l) _NOEXCEPT; + static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT; __list_imp() _NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value); @@ -543,22 +602,18 @@ protected: iterator end() _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL >= 2 - return iterator(static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_)), this); + return iterator(__end_as_link(), this); #else - return iterator(static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_))); + return iterator(__end_as_link()); #endif } _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT { #if _LIBCPP_DEBUG_LEVEL >= 2 - return const_iterator(static_cast<__node_const_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))), this); + return const_iterator(__end_as_link(), this); #else - return const_iterator(static_cast<__node_const_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_)))); + return const_iterator(__end_as_link()); #endif } @@ -613,7 +668,7 @@ private: template inline _LIBCPP_INLINE_VISIBILITY void -__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l) +__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT { __f->__prev_->__next_ = __l->__next_; @@ -651,17 +706,16 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCE if (!empty()) { __node_allocator& __na = __node_alloc(); - __node_pointer __f = __end_.__next_; - __node_pointer __l = static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_)); + __link_pointer __f = __end_.__next_; + __link_pointer __l = __end_as_link(); __unlink_nodes(__f, __l->__prev_); __sz() = 0; while (__f != __l) { - __node_pointer __n = __f; + __node_pointer __np = __f->__as_node(); __f = __f->__next_; - __node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_)); - __node_alloc_traits::deallocate(__na, __n, 1); + __node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_)); + __node_alloc_traits::deallocate(__na, __np, 1); } #if _LIBCPP_DEBUG_LEVEL >= 2 __c_node* __c = __get_db()->__find_c_and_lock(this); @@ -700,13 +754,13 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp swap(__sz(), __c.__sz()); swap(__end_, __c.__end_); if (__sz() == 0) - __end_.__next_ = __end_.__prev_ = __end_.__self(); + __end_.__next_ = __end_.__prev_ = __end_as_link(); else - __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_.__self(); + __end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link(); if (__c.__sz() == 0) - __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_.__self(); + __c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link(); else - __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_.__self(); + __c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link(); #if _LIBCPP_DEBUG_LEVEL >= 2 __libcpp_db* __db = __get_db(); @@ -719,8 +773,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp { --__p; const_iterator* __i = static_cast((*__p)->__i_); - if (__i->__ptr_ == static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__c.__end_))) + if (__i->__ptr_ == __c.__end_as_link()) { __cn2->__add(*__p); if (--__cn1->end_ != __p) @@ -733,8 +786,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp { --__p; const_iterator* __i = static_cast((*__p)->__i_); - if (__i->__ptr_ == static_cast<__node_pointer>( - pointer_traits<__node_base_pointer>::pointer_to(__end_))) + if (__i->__ptr_ == __end_as_link()) { __cn1->__add(*__p); if (--__cn2->end_ != __p) @@ -758,6 +810,7 @@ class _LIBCPP_TYPE_VIS_ONLY list typedef typename base::__node_alloc_traits __node_alloc_traits; typedef typename base::__node_base __node_base; typedef typename base::__node_base_pointer __node_base_pointer; + typedef typename base::__link_pointer __link_pointer; public: typedef _Tp value_type; @@ -881,25 +934,25 @@ public: reference front() { _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); - return base::__end_.__next_->__value_; + return base::__end_.__next_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY const_reference front() const { _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); - return base::__end_.__next_->__value_; + return base::__end_.__next_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY reference back() { _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); - return base::__end_.__prev_->__value_; + return base::__end_.__prev_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY const_reference back() const { _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); - return base::__end_.__prev_->__value_; + return base::__end_.__prev_->__as_node()->__value_; } #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -1004,9 +1057,9 @@ public: #endif // _LIBCPP_DEBUG_LEVEL >= 2 private: - static void __link_nodes (__node_pointer __p, __node_pointer __f, __node_pointer __l); - void __link_nodes_at_front(__node_pointer __f, __node_pointer __l); - void __link_nodes_at_back (__node_pointer __f, __node_pointer __l); + static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l); + void __link_nodes_at_front(__link_pointer __f, __link_pointer __l); + void __link_nodes_at_back (__link_pointer __f, __link_pointer __l); iterator __iterator(size_type __n); template static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp); @@ -1020,7 +1073,7 @@ private: template inline _LIBCPP_INLINE_VISIBILITY void -list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l) +list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l) { __p->__prev_->__next_ = __f; __f->__prev_ = __p->__prev_; @@ -1032,9 +1085,9 @@ list<_Tp, _Alloc>::__link_nodes(__node_p template inline _LIBCPP_INLINE_VISIBILITY void -list<_Tp, _Alloc>::__link_nodes_at_front(__node_pointer __f, __node_pointer __l) +list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l) { - __f->__prev_ = base::__end_.__self(); + __f->__prev_ = base::__end_as_link(); __l->__next_ = base::__end_.__next_; __l->__next_->__prev_ = __l; base::__end_.__next_ = __f; @@ -1044,9 +1097,9 @@ list<_Tp, _Alloc>::__link_nodes_at_front template inline _LIBCPP_INLINE_VISIBILITY void -list<_Tp, _Alloc>::__link_nodes_at_back(__node_pointer __f, __node_pointer __l) +list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l) { - __l->__next_ = base::__end_.__self(); + __l->__next_ = base::__end_as_link(); __f->__prev_ = base::__end_.__prev_; __f->__prev_->__next_ = __f; base::__end_.__prev_ = __l; @@ -1323,12 +1376,12 @@ list<_Tp, _Alloc>::insert(const_iterator unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __hold->__prev_ = 0; __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes(__p.__ptr_, __hold.get(), __hold.get()); + __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); #if _LIBCPP_DEBUG_LEVEL >= 2 - return iterator(__hold.release(), this); + return iterator(__hold.release()->__as_link(), this); #else - return iterator(__hold.release()); + return iterator(__hold.release()->__as_link()); #endif } @@ -1354,9 +1407,9 @@ list<_Tp, _Alloc>::insert(const_iterator __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; #if _LIBCPP_DEBUG_LEVEL >= 2 - __r = iterator(__hold.get(), this); + __r = iterator(__hold->__as_link(), this); #else - __r = iterator(__hold.get()); + __r = iterator(__hold->__as_link()); #endif __hold.release(); iterator __e = __r; @@ -1368,7 +1421,7 @@ list<_Tp, _Alloc>::insert(const_iterator { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __e.__ptr_->__next_ = __hold.get(); + __e.__ptr_->__next_ = __hold->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } @@ -1379,8 +1432,8 @@ list<_Tp, _Alloc>::insert(const_iterator while (true) { __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __node_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1422,9 +1475,9 @@ list<_Tp, _Alloc>::insert(const_iterator __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; #if _LIBCPP_DEBUG_LEVEL >= 2 - __r = iterator(__hold.get(), this); + __r = iterator(__hold.get()->__as_link(), this); #else - __r = iterator(__hold.get()); + __r = iterator(__hold.get()->__as_link()); #endif __hold.release(); iterator __e = __r; @@ -1436,7 +1489,7 @@ list<_Tp, _Alloc>::insert(const_iterator { __hold.reset(__node_alloc_traits::allocate(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); - __e.__ptr_->__next_ = __hold.get(); + __e.__ptr_->__next_ = __hold.get()->__as_link(); __hold->__prev_ = __e.__ptr_; __hold.release(); } @@ -1447,8 +1500,8 @@ list<_Tp, _Alloc>::insert(const_iterator while (true) { __node_alloc_traits::destroy(__na, _VSTD::addressof(*__e)); - __node_pointer __prev = __e.__ptr_->__prev_; - __node_alloc_traits::deallocate(__na, __e.__ptr_, 1); + __link_pointer __prev = __e.__ptr_->__prev_; + __node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1); if (__prev == 0) break; #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1474,7 +1527,8 @@ list<_Tp, _Alloc>::push_front(const valu typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes_at_front(__hold.get(), __hold.get()); + __link_pointer __nl = __hold->__as_link(); + __link_nodes_at_front(__nl, __nl); ++base::__sz(); __hold.release(); } @@ -1487,7 +1541,7 @@ list<_Tp, _Alloc>::push_back(const value typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); - __link_nodes_at_back(__hold.get(), __hold.get()); + __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } @@ -1502,7 +1556,7 @@ list<_Tp, _Alloc>::push_front(value_type typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes_at_front(__hold.get(), __hold.get()); + __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } @@ -1515,7 +1569,7 @@ list<_Tp, _Alloc>::push_back(value_type& typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); - __link_nodes_at_back(__hold.get(), __hold.get()); + __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } @@ -1531,7 +1585,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&& typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_nodes_at_front(__hold.get(), __hold.get()); + __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); __hold.release(); } @@ -1545,7 +1599,8 @@ list<_Tp, _Alloc>::emplace_back(_Args&&. typedef __allocator_destructor<__node_allocator> _Dp; unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); - __link_nodes_at_back(__hold.get(), __hold.get()); + __link_pointer __nl = __hold->__as_link(); + __link_nodes_at_back(__nl, __nl); ++base::__sz(); __hold.release(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:06:16 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10578A65C1D; Wed, 6 Jan 2016 20:06:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B97D6181F; Wed, 6 Jan 2016 20:06:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K6EaV084626; Wed, 6 Jan 2016 20:06:14 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K6Ebp084624; Wed, 6 Jan 2016 20:06:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062006.u06K6Ebp084624@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293256 - vendor/libc++/r256945 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:06:16 -0000 Author: dim Date: Wed Jan 6 20:06:14 2016 New Revision: 293256 URL: https://svnweb.freebsd.org/changeset/base/293256 Log: Tag libc++ trunk r256945. Added: vendor/libc++/r256945/ - copied from r293255, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Wed Jan 6 20:07:16 2016 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC9A3A65CBF; Wed, 6 Jan 2016 20:07:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D7AF1AFA; Wed, 6 Jan 2016 20:07:16 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u06K7Feh084761; Wed, 6 Jan 2016 20:07:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u06K7EWq084741; Wed, 6 Jan 2016 20:07:14 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601062007.u06K7EWq084741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 6 Jan 2016 20:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r293258 - in vendor/lld/dist: ELF lib/ReaderWriter/MachO test/ELF test/mach-o X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 20:07:17 -0000 Author: dim Date: Wed Jan 6 20:07:13 2016 New Revision: 293258 URL: https://svnweb.freebsd.org/changeset/base/293258 Log: Vendor import of lld trunk r256945: https://llvm.org/svn/llvm-project/lld/trunk@256945 Added: vendor/lld/dist/test/ELF/dt_tags.s (contents, props changed) vendor/lld/dist/test/mach-o/arm64-section-order.yaml Modified: vendor/lld/dist/ELF/Config.h vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/Driver.h vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/InputSection.h vendor/lld/dist/ELF/MarkLive.cpp vendor/lld/dist/ELF/OutputSections.cpp vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/Symbols.h vendor/lld/dist/ELF/Target.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_arm64.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp vendor/lld/dist/test/ELF/dynamic-reloc.s vendor/lld/dist/test/ELF/got.s vendor/lld/dist/test/ELF/local-got.s vendor/lld/dist/test/ELF/relocation-i686.s vendor/lld/dist/test/ELF/relocation.s vendor/lld/dist/test/ELF/relro.s vendor/lld/dist/test/ELF/shared-be.s vendor/lld/dist/test/ELF/shared.s vendor/lld/dist/test/ELF/tls-got.s vendor/lld/dist/test/ELF/tls-opt-gdie.s vendor/lld/dist/test/ELF/tls-opt-gdiele-i686.s vendor/lld/dist/test/ELF/tls-opt-iele-i686-nopic.s vendor/lld/dist/test/mach-o/arm64-reloc-negDelta32-fixup.yaml vendor/lld/dist/test/mach-o/parse-data-relocs-x86_64.yaml Modified: vendor/lld/dist/ELF/Config.h ============================================================================== --- vendor/lld/dist/ELF/Config.h Wed Jan 6 20:06:15 2016 (r293257) +++ vendor/lld/dist/ELF/Config.h Wed Jan 6 20:07:13 2016 (r293258) @@ -30,6 +30,10 @@ enum ELFKind { ELF64BEKind }; +// This struct contains the global configuration for the linker. +// Most fields are direct mapping from the command line options +// and such fields have the same name as the corresponding options. +// Most fields are initialized by the driver. struct Configuration { SymbolBody *EntrySym = nullptr; SymbolBody *MipsGpDisp = nullptr; @@ -76,6 +80,7 @@ struct Configuration { unsigned Optimize = 0; }; +// The only instance of Configuration struct. extern Configuration *Config; } // namespace elf2 Modified: vendor/lld/dist/ELF/Driver.cpp ============================================================================== --- vendor/lld/dist/ELF/Driver.cpp Wed Jan 6 20:06:15 2016 (r293257) +++ vendor/lld/dist/ELF/Driver.cpp Wed Jan 6 20:07:13 2016 (r293258) @@ -57,6 +57,24 @@ static std::pair pars error("Unknown emulation: " + S); } +// Returns slices of MB by parsing MB as an archive file. +// Each slice consists of a member file in the archive. +static std::vector getArchiveMembers(MemoryBufferRef MB) { + ErrorOr> FileOrErr = Archive::create(MB); + error(FileOrErr, "Failed to parse archive"); + std::unique_ptr File = std::move(*FileOrErr); + + std::vector V; + for (const ErrorOr &C : File->children()) { + error(C, "Could not get the child of the archive " + File->getFileName()); + ErrorOr MbOrErr = C->getMemoryBufferRef(); + error(MbOrErr, "Could not get the buffer for a child of the archive " + + File->getFileName()); + V.push_back(*MbOrErr); + } + return V; +} + // Opens and parses a file. Path has to be resolved already. // Newly created memory buffers are owned by this driver. void LinkerDriver::addFile(StringRef Path) { @@ -75,19 +93,17 @@ void LinkerDriver::addFile(StringRef Pat return; case file_magic::archive: if (WholeArchive) { - auto File = make_unique(MBRef); - for (MemoryBufferRef &MB : File->getMembers()) - Files.push_back(createELFFile(MB)); - OwningArchives.emplace_back(std::move(File)); + for (MemoryBufferRef MB : getArchiveMembers(MBRef)) + Files.push_back(createObjectFile(MB)); return; } Files.push_back(make_unique(MBRef)); return; case file_magic::elf_shared_object: - Files.push_back(createELFFile(MBRef)); + Files.push_back(createSharedFile(MBRef)); return; default: - Files.push_back(createELFFile(MBRef)); + Files.push_back(createObjectFile(MBRef)); } } Modified: vendor/lld/dist/ELF/Driver.h ============================================================================== --- vendor/lld/dist/ELF/Driver.h Wed Jan 6 20:06:15 2016 (r293257) +++ vendor/lld/dist/ELF/Driver.h Wed Jan 6 20:07:13 2016 (r293258) @@ -38,7 +38,6 @@ private: llvm::BumpPtrAllocator Alloc; bool WholeArchive = false; std::vector> Files; - std::vector> OwningArchives; std::vector> OwningMBs; }; Modified: vendor/lld/dist/ELF/InputFiles.cpp ============================================================================== --- vendor/lld/dist/ELF/InputFiles.cpp Wed Jan 6 20:06:15 2016 (r293257) +++ vendor/lld/dist/ELF/InputFiles.cpp Wed Jan 6 20:07:13 2016 (r293258) @@ -37,10 +37,9 @@ ELFFileBase::ELFFileBase(Kind K, M template ELFKind ELFFileBase::getELFKind() { - using llvm::support::little; - if (ELFT::Is64Bits) - return ELFT::TargetEndianness == little ? ELF64LEKind : ELF64BEKind; - return ELFT::TargetEndianness == little ? ELF32LEKind : ELF32BEKind; + if (ELFT::TargetEndianness == support::little) + return ELFT::Is64Bits ? ELF64LEKind : ELF32LEKind; + return ELFT::Is64Bits ? ELF64BEKind : ELF32BEKind; } template @@ -63,8 +62,7 @@ template uint32_t ELFFileBase::getSectionIndex(const Elf_Sym &Sym) const { uint32_t I = Sym.st_shndx; if (I == ELF::SHN_XINDEX) - return this->ELFObj.getExtendedSymbolTableIndex(&Sym, this->Symtab, - SymtabSHNDX); + return ELFObj.getExtendedSymbolTableIndex(&Sym, Symtab, SymtabSHNDX); if (I >= ELF::SHN_LORESERVE || I == ELF::SHN_ABS) return 0; return I; @@ -74,7 +72,7 @@ template void ELFFileBase StringTableOrErr = ELFObj.getStringTableForSymtab(*Symtab); - error(StringTableOrErr.getError()); + error(StringTableOrErr); StringTable = *StringTableOrErr; } @@ -108,9 +106,9 @@ ObjectFile::getLocalSymbol(uintX_t } template -void elf2::ObjectFile::parse(DenseSet &Comdats) { +void ObjectFile::parse(DenseSet &ComdatGroups) { // Read section and symbol tables. - initializeSections(Comdats); + initializeSections(ComdatGroups); initializeSymbols(); } @@ -139,7 +137,7 @@ ObjectFile::getShtGroupEntries(con const ELFFile &Obj = this->ELFObj; ErrorOr> EntriesOrErr = Obj.template getSectionContentsAsArray(&Sec); - error(EntriesOrErr.getError()); + error(EntriesOrErr); ArrayRef Entries = *EntriesOrErr; if (Entries.empty() || Entries[0] != GRP_COMDAT) error("Unsupported SHT_GROUP format"); @@ -174,7 +172,7 @@ static bool shouldMerge(const typename E } template -void elf2::ObjectFile::initializeSections(DenseSet &Comdats) { +void ObjectFile::initializeSections(DenseSet &ComdatGroups) { uint64_t Size = this->ELFObj.getNumSections(); Sections.resize(Size); unsigned I = -1; @@ -187,7 +185,7 @@ void elf2::ObjectFile::initializeS switch (Sec.sh_type) { case SHT_GROUP: Sections[I] = &InputSection::Discarded; - if (Comdats.insert(getShtGroupSignature(Sec)).second) + if (ComdatGroups.insert(getShtGroupSignature(Sec)).second) continue; for (GroupEntryType E : getShtGroupEntries(Sec)) { uint32_t SecIndex = E; @@ -235,7 +233,7 @@ void elf2::ObjectFile::initializeS } template InputSectionBase * -elf2::ObjectFile::createInputSection(const Elf_Shdr &Sec) { +ObjectFile::createInputSection(const Elf_Shdr &Sec) { ErrorOr NameOrErr = this->ELFObj.getSectionName(&Sec); error(NameOrErr); StringRef Name = *NameOrErr; @@ -250,29 +248,29 @@ elf2::ObjectFile::createInputSecti // A MIPS object file has a special section that contains register // usage info, which needs to be handled by the linker specially. if (Config->EMachine == EM_MIPS && Name == ".reginfo") { - MipsReginfo = new (this->Alloc) MipsReginfoInputSection(this, &Sec); + MipsReginfo = new (Alloc) MipsReginfoInputSection(this, &Sec); return MipsReginfo; } if (Name == ".eh_frame") - return new (this->EHAlloc.Allocate()) EHInputSection(this, &Sec); + return new (EHAlloc.Allocate()) EHInputSection(this, &Sec); if (shouldMerge(Sec)) - return new (this->MAlloc.Allocate()) MergeInputSection(this, &Sec); - return new (this->Alloc) InputSection(this, &Sec); + return new (MAlloc.Allocate()) MergeInputSection(this, &Sec); + return new (Alloc) InputSection(this, &Sec); } -template void elf2::ObjectFile::initializeSymbols() { +template void ObjectFile::initializeSymbols() { this->initStringTable(); Elf_Sym_Range Syms = this->getNonLocalSymbols(); uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end()); - this->SymbolBodies.reserve(NumSymbols); + SymbolBodies.reserve(NumSymbols); for (const Elf_Sym &Sym : Syms) - this->SymbolBodies.push_back(createSymbolBody(this->StringTable, &Sym)); + SymbolBodies.push_back(createSymbolBody(this->StringTable, &Sym)); } template InputSectionBase * -elf2::ObjectFile::getSection(const Elf_Sym &Sym) const { +ObjectFile::getSection(const Elf_Sym &Sym) const { uint32_t Index = this->getSectionIndex(Sym); if (Index == 0) return nullptr; @@ -282,19 +280,19 @@ elf2::ObjectFile::getSection(const } template -SymbolBody *elf2::ObjectFile::createSymbolBody(StringRef StringTable, +SymbolBody *ObjectFile::createSymbolBody(StringRef StringTable, const Elf_Sym *Sym) { ErrorOr NameOrErr = Sym->getName(StringTable); - error(NameOrErr.getError()); + error(NameOrErr); StringRef Name = *NameOrErr; switch (Sym->st_shndx) { case SHN_UNDEF: - return new (this->Alloc) UndefinedElf(Name, *Sym); + return new (Alloc) UndefinedElf(Name, *Sym); case SHN_COMMON: - return new (this->Alloc) DefinedCommon( - Name, Sym->st_size, Sym->st_value, - Sym->getBinding() == llvm::ELF::STB_WEAK, Sym->getVisibility()); + return new (Alloc) DefinedCommon(Name, Sym->st_size, Sym->st_value, + Sym->getBinding() == llvm::ELF::STB_WEAK, + Sym->getVisibility()); } switch (Sym->getBinding()) { @@ -305,20 +303,16 @@ SymbolBody *elf2::ObjectFile::crea case STB_GNU_UNIQUE: { InputSectionBase *Sec = getSection(*Sym); if (Sec == &InputSection::Discarded) - return new (this->Alloc) UndefinedElf(Name, *Sym); - return new (this->Alloc) DefinedRegular(Name, *Sym, Sec); + return new (Alloc) UndefinedElf(Name, *Sym); + return new (Alloc) DefinedRegular(Name, *Sym, Sec); } } } -static std::unique_ptr openArchive(MemoryBufferRef MB) { - ErrorOr> ArchiveOrErr = Archive::create(MB); - error(ArchiveOrErr, "Failed to parse archive"); - return std::move(*ArchiveOrErr); -} - void ArchiveFile::parse() { - File = openArchive(MB); + ErrorOr> FileOrErr = Archive::create(MB); + error(FileOrErr, "Failed to parse archive"); + File = std::move(*FileOrErr); // Allocate a buffer for Lazy objects. size_t NumSyms = File->getNumberOfSymbols(); @@ -345,28 +339,9 @@ MemoryBufferRef ArchiveFile::getMember(c return *RefOrErr; } -std::vector ArchiveFile::getMembers() { - File = openArchive(MB); - - std::vector Result; - for (auto &ChildOrErr : File->children()) { - error(ChildOrErr, - "Could not get the child of the archive " + File->getFileName()); - const Archive::Child Child(*ChildOrErr); - ErrorOr MbOrErr = Child.getMemoryBufferRef(); - if (!MbOrErr) - error(MbOrErr, "Could not get the buffer for a child of the archive " + - File->getFileName()); - Result.push_back(MbOrErr.get()); - } - return Result; -} - template SharedFile::SharedFile(MemoryBufferRef M) - : ELFFileBase(Base::SharedKind, M) { - AsNeeded = Config->AsNeeded; -} + : ELFFileBase(Base::SharedKind, M), AsNeeded(Config->AsNeeded) {} template const typename ELFFile::Elf_Shdr * @@ -379,6 +354,8 @@ SharedFile::getSection(const Elf_S return *Ret; } +// Partially parse the shared object file so that we can call +// getSoName on this object. template void SharedFile::parseSoName() { typedef typename ELFFile::Elf_Dyn Elf_Dyn; typedef typename ELFFile::uintX_t uintX_t; @@ -405,7 +382,7 @@ template void SharedFileinitStringTable(); - this->SoName = this->getName(); + SoName = this->getName(); if (!DynamicSec) return; @@ -418,13 +395,14 @@ template void SharedFile= this->StringTable.size()) error("Invalid DT_SONAME entry"); - this->SoName = StringRef(this->StringTable.data() + Val); + SoName = StringRef(this->StringTable.data() + Val); return; } } } -template void SharedFile::parse() { +// Fully parse the shared object file. This must be called after parseSoName(). +template void SharedFile::parseRest() { Elf_Sym_Range Syms = this->getNonLocalSymbols(); uint32_t NumSymbols = std::distance(Syms.begin(), Syms.end()); SymbolBodies.reserve(NumSymbols); @@ -456,7 +434,7 @@ static std::unique_ptr create } template