Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All builtins needed for first release of Unison Cloud JIT #3742

Open
pchiusano opened this issue Jan 12, 2023 · 3 comments
Open

All builtins needed for first release of Unison Cloud JIT #3742

pchiusano opened this issue Jan 12, 2023 · 3 comments
Assignees

Comments

@pchiusano
Copy link
Member

pchiusano commented Jan 12, 2023

Ultimately we want to have the JIT support the full language, but for a first milestone, we're trying to get it to compile all the things needed for Unison Cloud so we can run the JIT on all the cloud nodes. The cloud nodes don't allow arbitrary I/O so there's some builtins (particularly STM) that we can get away with not implementing for now.

Once we do a first release, we'll go back and implement STM and probably will do our own threading and async I/O implementations.

Here's primops that have not yet been implemented:

  • ABSF
  • ACOS
  • ACSH
  • ADDF
  • ADDI
  • ASIN
  • ASNH
  • ATAN
  • ATN2
  • ATNH
  • CACH
  • CATB
  • CEIL
  • CMPU
  • COSF
  • COSH
  • CVLD
  • DECN
  • DIVF
  • DIVI
  • DRPT
  • EQLF
  • EQLI
  • EQLU
  • EXPF
  • FLOR
  • FLTB
  • FORK
  • INCI
  • INCN
  • INFO
  • ITOF
  • LEQF
  • LEQI
  • LEQT
  • LKUP
  • LOAD
  • LOGB
  • LOGF
  • MAXF
  • MINF
  • MISS
  • MODI
  • MULF
  • MULI
  • NEGI
  • NTOF
  • PAKB
  • POPC
  • POWF
  • POWI
  • POWN
  • PRNT
  • RNDF
  • SDBX
  • SGNI
  • SINF
  • SINH
  • SIZB
  • SPLL
  • SPLR
  • SQRT
  • SUBF
  • SUBI
  • TAKB
  • TANF
  • TANH
  • TLTT
  • TRNF
  • TTOF
  • TTOI
  • TZRO
  • UCNS
  • UPKB
  • USNC
  • VWRS

Note, things like Nat.+ are wrappers around primop instructions. The wrapper code gets compiled to scheme just like any other unison (intermediate) function, so the primops are what need to be implemented (unless the builtin corresponding to a primop is being replaced completely, but that is a separate mechanism).

I might come back and annotate these with their meanings later, and possibly delete some as irrelevant.

Must have

  • Universal.murmurHash : a -> Nat
  • Code.validateLinks
  • Text.indexOf
  • Bytes.indexOf
  • tryEval.impl
  • Pattern.isMatch
  • Pattern.run
  • Pattern.replicate
  • Pattern.or
  • Pattern.join
  • Pattern.capture
  • Pattern.many
  • Text.patterns.notCharIn
  • Text.patterns.charIn
  • Text.patterns.notCharRange
  • Text.patterns.charRange
  • Text.patterns.eof
  • Text.patterns.anyChar
  • Text.patterns.punctuation
  • Text.patterns.space
  • Text.patterns.letter
  • Text.patterns.digit
  • Text.patterns.literal
  • Scope.bytearrayOf
  • Scope.bytearray
  • Scope.arrayOf
  • Scope.array
  • IO.bytearrayOf
  • IO.bytearray
  • IO.arrayOf
  • IO.array
  • ImmutableByteArray.length
  • MutableByteArray.length
  • MutableArray.freeze
  • MutableByteArray.freeze
  • MutableArray.freeze!
  • MutableByteArray.freeze!
  • ImmutableByteArray.read64be
  • ImmutableByteArray.read40be
  • ImmutableByteArray.read32be
  • ImmutableByteArray.read24be
  • ImmutableByteArray.read16be
  • ImmutableByteArray.read8
  • ImmutableArray.read
  • MutableByteArray.write64be
  • MutableByteArray.write32be
  • MutableByteArray.write16be
  • MutableByteArray.write8
  • MutableArray.write
  • MutableByteArray.read64be
  • MutableByteArray.read40be
  • MutableByteArray.read32be
  • MutableByteArray.read24be
  • MutableByteArray.read16be
  • MutableByteArray.read8
  • MutableArray.read
  • ImmutableByteArray.copyTo!
  • MutableByteArray.size
  • ImmutableByteArray.size
  • MutableArray.size
  • ImmutableArray.size
  • ImmutableArray.copyTo!
  • MutableByteArray.copyTo!
  • MutableArray.copyTo!
  • Bytes.encodeNat16le
  • Bytes.encodeNat16be
  • Bytes.encodeNat32le
  • Bytes.encodeNat32be
  • Bytes.encodeNat64le
  • Bytes.encodeNat64be
  • Bytes.decodeNat16le
  • Bytes.decodeNat16be
  • Bytes.decodeNat32le
  • Bytes.decodeNat32be
  • Bytes.decodeNat64le
  • Bytes.decodeNat64be
  • Bytes.fromBase64UrlUnpadded
  • Bytes.fromBase64
  • Bytes.fromBase32
  • Bytes.fromBase16
  • Bytes.toBase64UrlUnpadded
  • Bytes.toBase64
  • Bytes.toBase32
  • Bytes.toBase16
  • Bytes.gzip.decompress
  • Bytes.zlib.decompress
  • Bytes.gzip.compress
  • Bytes.zlib.compress
  • Value.deserialize
  • Value.serialize
  • Value.dependencies
  • Code.deserialize
  • Code.serialize
  • Code.dependencies
  • Debug.trace
  • Debug.toText
  • Ref.write
  • Ref.read
  • IO.ref
  • Scope.ref
  • Text.fromUtf8.impl.v3
  • Text.toUtf8
  • Text.toLowercase
  • Text.toUppercase
  • Text.reverse
  • Text.repeat
  • Char.toText
  • IO.stdHandle
  • IO.delay.impl.v3
  • IO.kill.impl.v3
  • IO.socketReceive.impl.v3
  • IO.socketSend.impl.v3
  • IO.socketAccept.impl.v3
  • IO.closeSocket.impl.v3
  • IO.clientSocket.impl.v3
  • IO.listen.impl.v3
  • IO.socketPort.impl.v3
  • ThreadId.toText
  • Handle.toText
  • Socket.toText
  • IO.serverSocket.impl.v3
  • IO.getFileSize.impl.v3
  • IO.getFileTimestamp.impl.v3
  • IO.removeFile.impl.v3
  • IO.directoryContents.impl.v3
  • IO.getArgs.impl.v1
  • IO.getEnv.impl.v1
  • IO.fileExists.impl.v3
  • IO.getCurrentDirectory.impl.v3
  • Clock.internals.nsec.v1
  • Clock.internals.sec.v1
  • Clock.internals.threadCPUTime.v1
  • Clock.internals.processCPUTime.v1
  • Clock.internals.realtime.v1
  • Clock.internals.monotonic.v1
  • IO.systemTimeMicroseconds.v1
  • IO.putBytes.impl.v3
  • IO.getSomeBytes.impl.v1
  • IO.getBytes.impl.v3
  • IO.getLine.impl.v1
  • IO.setBuffering.impl.v3
  • IO.getBuffering.impl.v3
  • IO.getChar.impl.v1
  • IO.getEcho.impl.v1
  • IO.isFileEOF.impl.v3
  • IO.closeFile.impl.v3
  • IO.openFile.impl.v3
  • Ref.readForCas
  • Ref.cas
  • Ticket.read
  • Promise.new
  • Promise.write
  • Promise.read
  • Promise.tryRead

Needs research

  • Tls.ServerConfig.certificates.set
  • Tls.ClientConfig.certificates.set
  • Tls.ServerConfig.default
  • Tls.ClientConfig.default
  • Tls.terminate.impl.v3
  • Tls.receive.impl.v3
  • Tls.encodePrivateKey
  • Tls.decodePrivateKey
  • Tls.encodeCert
  • Tls.decodeCert.impl.v3
  • Tls.send.impl.v3
  • Tls.handshake.impl.v3
  • Tls.newServer.impl.v3
  • Tls.newClient.impl.v3
  • crypto.hmac
  • crypto.hash
  • crypto.hmacBytes
  • crypto.hashBytes
  • HashAlgorithm.Blake2b_256 : HashAlgorithm
  • HashAlgorithm.Blake2b_512 : HashAlgorithm
  • HashAlgorithm.Blake2s_256 : HashAlgorithm
  • HashAlgorithm.Sha1 : HashAlgorithm
  • HashAlgorithm.Sha2_256 : HashAlgorithm
  • HashAlgorithm.Sha2_512 : HashAlgorithm
  • HashAlgorithm.Sha3_256 : HashAlgorithm
  • HashAlgorithm.Sha3_512 : HashAlgorithm

Not needed for now:

  • IO.setCurrentDirectory.impl.v3
  • Link.Term.toText
  • IO.getTempDirectory.impl.v3
  • IO.createTempDirectory.impl.v3
  • IO.isFileOpen.impl.v3
  • IO.ready.impl.v1
  • IO.setEcho.impl.v1
  • IO.handlePosition.impl.v3
  • IO.seekHandle.impl.v3
  • IO.isSeekable.impl.v3
  • IO.isDirectory.impl.v3
  • IO.systemTime.impl.v3
  • IO.createDirectory.impl.v3
  • IO.removeDirectory.impl.v3
  • IO.renameFile.impl.v3
  • IO.renameDirectory.impl.v3
  • Code.display
  • STM.retry
  • TVar.swap
  • TVar.readIO
  • TVar.newIO
  • TVar.write
  • TVar.read
  • TVar.new
  • MVar.tryRead.impl.v3
  • MVar.read.impl.v3
  • MVar.isEmpty
  • MVar.swap.impl.v3
  • MVar.tryPut.impl.v3
  • MVar.put.impl.v3
  • MVar.tryTake
  • MVar.take.impl.v3
  • MVar.newEmpty.v2
  • MVar.new
@ceedubs
Copy link
Contributor

ceedubs commented May 1, 2023

Link.Term.toText is another primop that this list seems to be missing.

@dolio
Copy link
Contributor

dolio commented Nov 7, 2023

Everything on the necessary list is now checked off.

@aryairani
Copy link
Contributor

  • HashAlgorithm.Blake2b_256 : HashAlgorithm
  • HashAlgorithm.Blake2b_512 : HashAlgorithm
  • HashAlgorithm.Blake2s_256 : HashAlgorithm

Question: Why do we need HashAlgorithm.Blake2b_256 if we have the other two?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants