Code Monkey home page Code Monkey logo

penguin's People

Contributors

mike-ando avatar proffan avatar pschuh avatar robb avatar saeta avatar texasmichelle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

penguin's Issues

HTML files shouldn't be checked into this repo.

Even if you need to check it in somewhere else, just trying to quick-open a swift file, or do a global search, often leaves me in an .html file I don't care about. Slows development down a lot!

These things can be generated using GH actions if for some reason a stock jekyll or HTML site is insufficient.

Make `InsertionOrderedDictionary` use a single allocation

By cannibalizing implementation details of Dictionary from the standard library (which should be exposed as part of a hashtable construction kit, but that's a separate issue) we could avoid storing a dictionary plus an array, and (I think) avoid storing keys twice.

Build Broken on Swift for Tensorflow Stock Toolchain Nightly Builds

$ which swift
/home/xander/swift-tensorflow-DEVELOPMENT-cuda10.2-cudnn7-stock-ubuntu18.04/usr/bin/swift
$ swift --version
Swift version 5.3-dev (LLVM a80ce7032652e19, Swift 6a6f972f7fcf51d)
Target: x86_64-unknown-linux-gnu
$ git log
commit fca2fc0e0581656449f1cee40ec5513f7a957446 (HEAD -> main, origin/main, origin/HEAD)
Author: Dave Abrahams <[email protected]>
Date:   Mon Dec 21 13:39:50 2020 -0800

    Make base of Projections public. (#138)
[4/4] Compiling PenguinTables TypedColumn.swift
$ swift package clean
$ swift build
createBuildSystem false
/home/xander/dev/penguin/Sources/PenguinParallel/ConcurrencyPlatform.swift:105:5: warning: future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it
    await(predicate)
    ^~~~~
    `await`
/home/xander/dev/penguin/Sources/PenguinParallel/ConcurrencyPlatform.swift:105:5: warning: future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it
    await(predicate)
    ^~~~~
    `await`
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:20:33: error: cannot find type 'KeyPathIterable' in scope
  public protocol PTableSchema: KeyPathIterable, PDefaultInit {
                                ^~~~~~~~~~~~~~~
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:26:27: error: value of type 'Self' has no member 'allKeyPaths'
      let keyPaths = self.allKeyPaths as! [PartialKeyPath<Self>]
                     ~~~~ ^~~~~~~~~~~
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:20:33: error: cannot find type 'KeyPathIterable' in scope
  public protocol PTableSchema: KeyPathIterable, PDefaultInit {
                                ^~~~~~~~~~~~~~~
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:26:27: error: value of type 'Self' has no member 'allKeyPaths'
      let keyPaths = self.allKeyPaths as! [PartialKeyPath<Self>]
                     ~~~~ ^~~~~~~~~~~
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:20:33: error: cannot find type 'KeyPathIterable' in scope
  public protocol PTableSchema: KeyPathIterable, PDefaultInit {
                                ^~~~~~~~~~~~~~~
/home/xander/dev/penguin/Sources/PenguinTables/TableSchema.swift:20:33: error: cannot find type 'KeyPathIterable' in scope
  public protocol PTableSchema: KeyPathIterable, PDefaultInit {
                                ^~~~~~~~~~~~~~~

I just tried this using the latest nightly as of 29 January 2021 and got the same result.

Polish fast RNG & make available publicly

#30 pulled the PCGRandomNumberGenerator out from NonBlockingThreadPool.swift, but it (and fastFit) should really move to PenguinStructures (or some similar library) and be made publicly available (and generic where appropriate).

Note: #36 pulls out the other numerical bits and cleans them up.

Factor common Dictionary APIs into Protocol[s]

InsertionOrderedDictionary has most of the same APIs as Dictionary and there are some common algorithms we can build upon that (currently in PenguinExtensions.swift). It's unclear how much is specific to a hashed dictionary and whether a SortOrderedDictionary would have a subset of these APIs. Investigating that is another interesting project.

Reconsider NominalElementDictionary

As I have been working on InsertionOrderedDictionary, I've started to wonder whether NominalElementDictionary was such a hot idea. Instead, maybe the thing to do is make an extension on Dictionary called nominalElements that presents the (key: Key, value: Value) elements as a Collection of KeyValuePair<Key, Value>. When people need the capabilities associated with a collection of KeyValuePair, they can use this extension. Otherwise it just sits there.

Part of the reason for this is that you lose convenient destructuring that was available with tuples. Part is the massive complexity overhead of making the whole dictionary API just in order to be able to use Collection where Element: SomeProtocol extensions.

/cc @saeta @marcrasi

Generic XCTest'ing components for conformance to protocols.

It's super easy to build what you assume to be a correct model of a protocol and have it function perfectly well in tests of other components but also be utterly broken. You need to test the semantics of all the protocol requirements, and doing that for a commonly-modeled protocol like Collection is tedious and error-prone. We need a set of testing components for common protocols akin to what's in https://github.com/apple/swift/tree/master/stdlib/private/StdlibCollectionUnittest but based on XCTest.

Feature Request: Variable-length array with short-array optimization

(Please feel free to disregard if it's out of scope for this library, or send me to an existing implementation if available.)

My app has a bunch of cases where many arrays are created. Most of these arrays are expected to be fairly short (<= 3 elements), but the length of the longest arrays is potentially unbounded.

It would be great to have a data structure that could automatically store the first few elements inline to avoid allocating the array buffer altogether. For example, up to 7 Int8s could be stored in the 8 bytes occupied by Array<Int8> before an allocation would be necessary. With some bit fiddling, it might even be possible to store a single pointer in a regular array's 8 bytes. I am not an expert on that, however; not sure how many bits are "left" for such purposes. For arrays larger than that, the implementation could "fall through" to a regular buffer-backed array.

I would also happily give up some stack space in exchange for saving these allocations. If I could store up to 3 pointers in a 24-byte data structure with the possibility of automatically expanding to the heap when those 3 slots are exceeded, I would be very happy. Given that ArrayBuffer already takes some heap space of its own (not sure how much off the top of my head, but definitely >= 8), I would "lose" at most 8 bytes in the "up to 3 case", potentially zero if ArrayBuffer takes >= 16 bytes on the heap.

Given that this library already implements ArrayN, I was wondering whether such use cases would be in scope for this.

release-mode compilation crashes on swift development toolchains

For example, on the 2020-11-18 toolchain, swift build -c release gives:

[1/5] Compiling PenguinTesting StdlibProtocolTests.swift
swift-frontend: /home/build-user/swift/lib/SIL/Utils/MemAccessUtils.cpp:98: void (anonymous namespace)::AccessPhiVisitor<(anonymous namespace)::FindAccessBaseVisitor>::checkVisitorResult(swift::SILValue) [UseDefVisitor = (anonymous namespace)::FindAccessBaseVisitor]: Assertion `!result && "must override any visitor that returns a result"' failed.
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.	Program arguments: /usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend -frontend -c /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/AnyArrayBuffer.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/AnyValue.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/ArrayBuffer.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/ArrayStorage.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/CollectionAlgorithms.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Concatenation.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/DefaultInitializable.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Deque.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Either.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Empty.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/FactoryInitializable.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/FixedSizeArray.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Heap.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/HierarchicalArrays.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/HierarchicalCollection.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/IdIndexable.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/InsertionOrderedDictionary.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/KeyValuePair.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Lens.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/NominalElementDictionary.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/PCGRandomNumberGenerator.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Projections.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Random.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/SourceInitializableCollection.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Tuple.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/Type.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/TypeID.swift /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/UnsignedInteger+Reduced.swift -supplementary-output-file-map /tmp/supplementaryOutputs-9c95c9 -target x86_64-unknown-linux-gnu -disable-objc-interop -I /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release -g -module-cache-path /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/ModuleCache -swift-version 5 -O -D SWIFT_PACKAGE -parse-as-library -module-name PenguinStructures -num-threads 12 -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/AnyArrayBuffer.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/AnyValue.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/ArrayBuffer.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/ArrayStorage.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/CollectionAlgorithms.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Concatenation.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/DefaultInitializable.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Deque.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Either.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Empty.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/FactoryInitializable.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/FixedSizeArray.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Heap.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/HierarchicalArrays.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/HierarchicalCollection.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/IdIndexable.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/InsertionOrderedDictionary.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/KeyValuePair.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Lens.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/NominalElementDictionary.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/PCGRandomNumberGenerator.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Projections.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Random.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/SourceInitializableCollection.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Tuple.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/Type.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/TypeID.swift.o -o /usr/local/google/home/marcrasi/git/penguin/.build/x86_64-unknown-linux-gnu/release/PenguinStructures.build/UnsignedInteger+Reduced.swift.o
1.	Swift version 5.3-dev (LLVM d6fb8423828a5e4, Swift 54144acf6a727e9)
2.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, Serialize, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for PenguinStructures.PenguinStructures)
3.	While running pass #25667 SILFunctionTransform "EarlyRedundantLoadElimination" on SILFunction "@$s17PenguinStructures8AnyValueV10storedTypeypXpvg".
 for getter for storedType (at /usr/local/google/home/marcrasi/git/penguin/Sources/PenguinStructures/AnyValue.swift:73:14)
 #0 0x00000000054b68d4 PrintStackTraceSignalHandler(void*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x54b68d4)
 #1 0x00000000054b44ce llvm::sys::RunSignalHandlers() (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x54b44ce)
 #2 0x00000000054b6ab5 SignalHandler(int) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x54b6ab5)
 #3 0x00007f6856d45140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007f6856831db1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f685681b537 abort ./stdlib/abort.c:81:7
 #6 0x00007f685681b40f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #7 0x00007f685681b40f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #8 0x00007f685682a5b2 (/lib/x86_64-linux-gnu/libc.so.6+0x345b2)
 #9 0x000000000120431a (anonymous namespace)::AccessPhiVisitor<(anonymous namespace)::FindAccessBaseVisitor>::findPhiAccess(swift::SILPhiArgument*) && (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x120431a)
#10 0x0000000001203bd5 swift::AccessUseDefChainVisitor<(anonymous namespace)::FindAccessBaseVisitor, swift::SILValue>::visit(swift::SILValue) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x1203bd5)
#11 0x0000000001203763 (anonymous namespace)::FindAccessVisitorImpl<(anonymous namespace)::FindAccessBaseVisitor>::reenterUseDef(swift::SILValue) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x1203763)
#12 0x00000000011fff9e swift::isLetAddress(swift::SILValue) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x11fff9e)
#13 0x0000000000d70da9 swift::SILInstructionVisitor<(anonymous namespace)::MemoryBehaviorVisitor, swift::SILInstruction::MemoryBehavior>::visit(swift::SILInstruction*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xd70da9)
#14 0x0000000000d70c7b swift::AliasAnalysis::computeMemoryBehaviorInner(swift::SILInstruction*, swift::SILValue) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xd70c7b)
#15 0x0000000000d70972 swift::AliasAnalysis::computeMemoryBehavior(swift::SILInstruction*, swift::SILValue) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xd70972)
#16 0x0000000000bad9bb (anonymous namespace)::BlockState::processUnknownWriteInst((anonymous namespace)::RLEContext&, swift::SILInstruction*, RLEKind) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xbad9bb)
#17 0x0000000000ba4625 (anonymous namespace)::RedundantLoadElimination::run() (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xba4625)
#18 0x0000000000aaf492 swift::SILPassManager::runPassOnFunction(unsigned int, swift::SILFunction*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xaaf492)
#19 0x0000000000ab03a7 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xab03a7)
#20 0x0000000000aad8a8 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xaad8a8)
#21 0x0000000000aad85b swift::ExecuteSILPipelineRequest::evaluate(swift::Evaluator&, swift::SILPipelineExecutionDescriptor) const (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xaad85b)
#22 0x0000000000acde3a swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xacde3a)
#23 0x0000000000ab8351 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xab8351)
#24 0x0000000000aada85 swift::executePassPipelinePlan(swift::SILModule*, swift::SILPassPipelinePlan const&, bool, swift::irgen::IRGenModule*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xaada85)
#25 0x0000000000abaa3f swift::runSILOptimizationPasses(swift::SILModule&) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0xabaa3f)
#26 0x0000000000690662 swift::CompilerInstance::performSILProcessing(swift::SILModule*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x690662)
#27 0x0000000000514261 performCompileStepsPostSILGen(swift::CompilerInstance&, std::unique_ptr<swift::SILModule, std::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x514261)
#28 0x0000000000513c97 performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x513c97)
#29 0x00000000005084fe swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x5084fe)
#30 0x000000000049a7d1 main (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x49a7d1)
#31 0x00007f685681ccca __libc_start_main ./csu/../csu/libc-start.c:308:16
#32 0x000000000049a37e _start (/usr/local/google/home/marcrasi/Downloads/swift-toolchains/master-2020-11-18/swift-DEVELOPMENT-SNAPSHOT-2020-11-18-a-ubuntu20.04/usr/bin/swift-frontend+0x49a37e)

This also affects the tensorflow 0.12 toolchain.

I have figured out a workaround that I will upload a PR for soon.

`updateValue` in `InsertionOrderedDictionary` fails invariant assertion

When updating the existing key with updateValue method the original index is not set back after acquiring it with indexForKey.updateValue(endIndex, forKey: key).

I believe this should be done after the guard statement:

guard let index = indexForKey.updateValue(endIndex, forKey: key) else {
    elements.append(.init(key: key, value: newValue))
    return nil
}
indexForKey[key] = index

At the moment of writing InsertionOrderedDictionaryTests don't have tests for updateValue.

The following test triggers the assertion:

func test_updateValue() {
    var d0 = p0
    for (key, value) in p1 {
        XCTAssertEqual(d0[key], value)
        let replaced = d0.updateValue("*", forKey: key)
        XCTAssertEqual(d0[key], "*")
        XCTAssertEqual(replaced, value)
    }
    XCTAssertEqual(d0[99], nil)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.