Skip to content

Supportding dict in LLVM backend #964

Closed
@czgdp1807

Description

@czgdp1807

I gave a thought on how should we go about implementing this. Before writing my conclusion following points should be noted,

  1. Implementing a Hash function is tricky for now in LLVM backend. In addition, using a pre-existing one written in C language sounds like a good choice for me.
  2. Scaling for various combination of types is extremely tricky and unsafe in C. Our asr_to_llvm.cpp allows to scale very easily. We did this for lists and tuples in LLVM backend by generating only the types required by the user code.
  3. In future I believe, we will be able to implement complicated hash functions in Python itself and then compile them via LPython.

So now my conclusion is,

  1. Implement everything other than hash function in LLVM itself, like collision handling, accessing key-value pair, etc.
  2. Implement hash function in C for now and call it from LLVM. In future once we will be able to write and compile hash function in Python itself then we will directly call it from LLVM and stop using the one defined in C runtime.
  3. We should implement everything in dict so that drop in replacement of hash functions is possible.

Rest of the details, blockers I will try to figure out while actually implementing dict.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions