cjson
fuzzing
inputs
test1 test10 test11 test2 test3 test3.bu test3.uf test3.uu test4 test5 test6 test7 test8 test9library_config
cJSONConfig.cmake.in cJSONConfigVersion.cmake.in libcjson.pc.in libcjson_utils.pc.in uninstall.cmaketests
inputs
test1 test1.expected test10 test10.expected test11 test11.expected test2 test2.expected test3 test3.expected test4 test4.expected test5 test5.expected test6 test7 test7.expected test8 test8.expected test9 test9.expectedjson-patch-tests
.editorconfig .gitignore .npmignore README.md cjson-utils-tests.json package.json spec_tests.json tests.jsonunity
auto
colour_prompt.rb colour_reporter.rb generate_config.yml generate_module.rb generate_test_runner.rb parse_output.rb stylize_as_junit.rb test_file_filter.rb type_sanitizer.rb unity_test_summary.py unity_test_summary.rb unity_to_junit.pydocs
ThrowTheSwitchCodingStandard.md UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf UnityAssertionsReference.md UnityConfigurationGuide.md UnityGettingStartedGuide.md UnityHelperScriptsGuide.md license.txtexamples
unity_config.hcurl
.github
scripts
cleancmd.pl cmp-config.pl cmp-pkg-config.sh codespell-ignore.words codespell.sh distfiles.sh pyspelling.words pyspelling.yaml randcurl.pl requirements-docs.txt requirements-proselint.txt requirements.txt shellcheck-ci.sh shellcheck.sh spellcheck.curl trimmarkdownheader.pl typos.sh typos.toml verify-examples.pl verify-synopsis.pl yamlcheck.sh yamlcheck.yamlworkflows
appveyor-status.yml checkdocs.yml checksrc.yml checkurls.yml codeql.yml configure-vs-cmake.yml curl-for-win.yml distcheck.yml fuzz.yml http3-linux.yml label.yml linux-old.yml linux.yml macos.yml non-native.yml windows.ymlCMake
CurlSymbolHiding.cmake CurlTests.c FindBrotli.cmake FindCares.cmake FindGSS.cmake FindGnuTLS.cmake FindLDAP.cmake FindLibbacktrace.cmake FindLibgsasl.cmake FindLibidn2.cmake FindLibpsl.cmake FindLibssh.cmake FindLibssh2.cmake FindLibuv.cmake FindMbedTLS.cmake FindNGHTTP2.cmake FindNGHTTP3.cmake FindNGTCP2.cmake FindNettle.cmake FindQuiche.cmake FindRustls.cmake FindWolfSSL.cmake FindZstd.cmake Macros.cmake OtherTests.cmake PickyWarnings.cmake Utilities.cmake cmake_uninstall.in.cmake curl-config.in.cmake unix-cache.cmake win32-cache.cmakedocs
cmdline-opts
.gitignore CMakeLists.txt MANPAGE.md Makefile.am Makefile.inc _AUTHORS.md _BUGS.md _DESCRIPTION.md _ENVIRONMENT.md _EXITCODES.md _FILES.md _GLOBBING.md _NAME.md _OPTIONS.md _OUTPUT.md _PROGRESS.md _PROTOCOLS.md _PROXYPREFIX.md _SEEALSO.md _SYNOPSIS.md _URL.md _VARIABLES.md _VERSION.md _WWW.md abstract-unix-socket.md alt-svc.md anyauth.md append.md aws-sigv4.md basic.md ca-native.md cacert.md capath.md cert-status.md cert-type.md cert.md ciphers.md compressed-ssh.md compressed.md config.md connect-timeout.md connect-to.md continue-at.md cookie-jar.md cookie.md create-dirs.md create-file-mode.md crlf.md crlfile.md curves.md data-ascii.md data-binary.md data-raw.md data-urlencode.md data.md delegation.md digest.md disable-eprt.md disable-epsv.md disable.md disallow-username-in-url.md dns-interface.md dns-ipv4-addr.md dns-ipv6-addr.md dns-servers.md doh-cert-status.md doh-insecure.md doh-url.md dump-ca-embed.md dump-header.md ech.md egd-file.md engine.md etag-compare.md etag-save.md expect100-timeout.md fail-early.md fail-with-body.md fail.md false-start.md follow.md form-escape.md form-string.md form.md ftp-account.md ftp-alternative-to-user.md ftp-create-dirs.md ftp-method.md ftp-pasv.md ftp-port.md ftp-pret.md ftp-skip-pasv-ip.md ftp-ssl-ccc-mode.md ftp-ssl-ccc.md ftp-ssl-control.md get.md globoff.md happy-eyeballs-timeout-ms.md haproxy-clientip.md haproxy-protocol.md head.md header.md help.md hostpubmd5.md hostpubsha256.md hsts.md http0.9.md http1.0.md http1.1.md http2-prior-knowledge.md http2.md http3-only.md http3.md ignore-content-length.md insecure.md interface.md ip-tos.md ipfs-gateway.md ipv4.md ipv6.md json.md junk-session-cookies.md keepalive-cnt.md keepalive-time.md key-type.md key.md knownhosts.md krb.md libcurl.md limit-rate.md list-only.md local-port.md location-trusted.md location.md login-options.md mail-auth.md mail-from.md mail-rcpt-allowfails.md mail-rcpt.md mainpage.idx manual.md max-filesize.md max-redirs.md max-time.md metalink.md mptcp.md negotiate.md netrc-file.md netrc-optional.md netrc.md next.md no-alpn.md no-buffer.md no-clobber.md no-keepalive.md no-npn.md no-progress-meter.md no-sessionid.md noproxy.md ntlm-wb.md ntlm.md oauth2-bearer.md out-null.md output-dir.md output.md parallel-immediate.md parallel-max-host.md parallel-max.md parallel.md pass.md path-as-is.md pinnedpubkey.md post301.md post302.md post303.md preproxy.md progress-bar.md proto-default.md proto-redir.md proto.md proxy-anyauth.md proxy-basic.md proxy-ca-native.md proxy-cacert.md proxy-capath.md proxy-cert-type.md proxy-cert.md proxy-ciphers.md proxy-crlfile.md proxy-digest.md proxy-header.md proxy-http2.md proxy-insecure.md proxy-key-type.md proxy-key.md proxy-negotiate.md proxy-ntlm.md proxy-pass.md proxy-pinnedpubkey.md proxy-service-name.md proxy-ssl-allow-beast.md proxy-ssl-auto-client-cert.md proxy-tls13-ciphers.md proxy-tlsauthtype.md proxy-tlspassword.md proxy-tlsuser.md proxy-tlsv1.md proxy-user.md proxy.md proxy1.0.md proxytunnel.md pubkey.md quote.md random-file.md range.md rate.md raw.md referer.md remote-header-name.md remote-name-all.md remote-name.md remote-time.md remove-on-error.md request-target.md request.md resolve.md retry-all-errors.md retry-connrefused.md retry-delay.md retry-max-time.md retry.md sasl-authzid.md sasl-ir.md service-name.md show-error.md show-headers.md sigalgs.md silent.md skip-existing.md socks4.md socks4a.md socks5-basic.md socks5-gssapi-nec.md socks5-gssapi-service.md socks5-gssapi.md socks5-hostname.md socks5.md speed-limit.md speed-time.md ssl-allow-beast.md ssl-auto-client-cert.md ssl-no-revoke.md ssl-reqd.md ssl-revoke-best-effort.md ssl-sessions.md ssl.md sslv2.md sslv3.md stderr.md styled-output.md suppress-connect-headers.md tcp-fastopen.md tcp-nodelay.md telnet-option.md tftp-blksize.md tftp-no-options.md time-cond.md tls-earlydata.md tls-max.md tls13-ciphers.md tlsauthtype.md tlspassword.md tlsuser.md tlsv1.0.md tlsv1.1.md tlsv1.2.md tlsv1.3.md tlsv1.md tr-encoding.md trace-ascii.md trace-config.md trace-ids.md trace-time.md trace.md unix-socket.md upload-file.md upload-flags.md url-query.md url.md use-ascii.md user-agent.md user.md variable.md verbose.md version.md vlan-priority.md write-out.md xattr.mdexamples
.checksrc .gitignore 10-at-a-time.c CMakeLists.txt Makefile.am Makefile.example Makefile.inc README.md adddocsref.pl address-scope.c altsvc.c anyauthput.c block_ip.c cacertinmem.c certinfo.c chkspeed.c connect-to.c cookie_interface.c crawler.c debug.c default-scheme.c ephiperfifo.c evhiperfifo.c externalsocket.c fileupload.c ftp-delete.c ftp-wildcard.c ftpget.c ftpgetinfo.c ftpgetresp.c ftpsget.c ftpupload.c ftpuploadfrommem.c ftpuploadresume.c getinfo.c getinmemory.c getredirect.c getreferrer.c ghiper.c headerapi.c hiperfifo.c hsts-preload.c htmltidy.c htmltitle.cpp http-options.c http-post.c http2-download.c http2-pushinmemory.c http2-serverpush.c http2-upload.c http3-present.c http3.c httpcustomheader.c httpput-postfields.c httpput.c https.c imap-append.c imap-authzid.c imap-copy.c imap-create.c imap-delete.c imap-examine.c imap-fetch.c imap-list.c imap-lsub.c imap-multi.c imap-noop.c imap-search.c imap-ssl.c imap-store.c imap-tls.c interface.c ipv6.c keepalive.c localport.c log_failed_transfers.c maxconnects.c multi-app.c multi-debugcallback.c multi-double.c multi-event.c multi-formadd.c multi-legacy.c multi-post.c multi-single.c multi-uv.c netrc.c parseurl.c persistent.c pop3-authzid.c pop3-dele.c pop3-list.c pop3-multi.c pop3-noop.c pop3-retr.c pop3-ssl.c pop3-stat.c pop3-tls.c pop3-top.c pop3-uidl.c post-callback.c postinmemory.c postit2-formadd.c postit2.c progressfunc.c protofeats.c range.c resolve.c rtsp-options.c sendrecv.c sepheaders.c sessioninfo.c sftpget.c sftpuploadresume.c shared-connection-cache.c simple.c simplepost.c simplessl.c smooth-gtk-thread.c smtp-authzid.c smtp-expn.c smtp-mail.c smtp-mime.c smtp-multi.c smtp-ssl.c smtp-tls.c smtp-vrfy.c sslbackend.c synctime.c threaded.c unixsocket.c url2file.c urlapi.c usercertinmem.c version-check.pl websocket-cb.c websocket-updown.c websocket.c xmlstream.cinternals
BUFQ.md BUFREF.md CHECKSRC.md CLIENT-READERS.md CLIENT-WRITERS.md CODE_STYLE.md CONNECTION-FILTERS.md CREDENTIALS.md CURLX.md DYNBUF.md HASH.md LLIST.md MID.md MQTT.md MULTI-EV.md NEW-PROTOCOL.md PEERS.md PORTING.md RATELIMITS.md README.md SCORECARD.md SPLAY.md STRPARSE.md THRDPOOL-AND-QUEUE.md TIME-KEEPING.md TLS-SESSIONS.md UINT_SETS.md WEBSOCKET.mdlibcurl
opts
CMakeLists.txt CURLINFO_ACTIVESOCKET.md CURLINFO_APPCONNECT_TIME.md CURLINFO_APPCONNECT_TIME_T.md CURLINFO_CAINFO.md CURLINFO_CAPATH.md CURLINFO_CERTINFO.md CURLINFO_CONDITION_UNMET.md CURLINFO_CONNECT_TIME.md CURLINFO_CONNECT_TIME_T.md CURLINFO_CONN_ID.md CURLINFO_CONTENT_LENGTH_DOWNLOAD.md CURLINFO_CONTENT_LENGTH_DOWNLOAD_T.md CURLINFO_CONTENT_LENGTH_UPLOAD.md CURLINFO_CONTENT_LENGTH_UPLOAD_T.md CURLINFO_CONTENT_TYPE.md CURLINFO_COOKIELIST.md CURLINFO_EARLYDATA_SENT_T.md CURLINFO_EFFECTIVE_METHOD.md CURLINFO_EFFECTIVE_URL.md CURLINFO_FILETIME.md CURLINFO_FILETIME_T.md CURLINFO_FTP_ENTRY_PATH.md CURLINFO_HEADER_SIZE.md CURLINFO_HTTPAUTH_AVAIL.md CURLINFO_HTTPAUTH_USED.md CURLINFO_HTTP_CONNECTCODE.md CURLINFO_HTTP_VERSION.md CURLINFO_LASTSOCKET.md CURLINFO_LOCAL_IP.md CURLINFO_LOCAL_PORT.md CURLINFO_NAMELOOKUP_TIME.md CURLINFO_NAMELOOKUP_TIME_T.md CURLINFO_NUM_CONNECTS.md CURLINFO_OS_ERRNO.md CURLINFO_POSTTRANSFER_TIME_T.md CURLINFO_PRETRANSFER_TIME.md CURLINFO_PRETRANSFER_TIME_T.md CURLINFO_PRIMARY_IP.md CURLINFO_PRIMARY_PORT.md CURLINFO_PRIVATE.md CURLINFO_PROTOCOL.md CURLINFO_PROXYAUTH_AVAIL.md CURLINFO_PROXYAUTH_USED.md CURLINFO_PROXY_ERROR.md CURLINFO_PROXY_SSL_VERIFYRESULT.md CURLINFO_QUEUE_TIME_T.md CURLINFO_REDIRECT_COUNT.md CURLINFO_REDIRECT_TIME.md CURLINFO_REDIRECT_TIME_T.md CURLINFO_REDIRECT_URL.md CURLINFO_REFERER.md CURLINFO_REQUEST_SIZE.md CURLINFO_RESPONSE_CODE.md CURLINFO_RETRY_AFTER.md CURLINFO_RTSP_CLIENT_CSEQ.md CURLINFO_RTSP_CSEQ_RECV.md CURLINFO_RTSP_SERVER_CSEQ.md CURLINFO_RTSP_SESSION_ID.md CURLINFO_SCHEME.md CURLINFO_SIZE_DELIVERED.md CURLINFO_SIZE_DOWNLOAD.md CURLINFO_SIZE_DOWNLOAD_T.md CURLINFO_SIZE_UPLOAD.md CURLINFO_SIZE_UPLOAD_T.md CURLINFO_SPEED_DOWNLOAD.md CURLINFO_SPEED_DOWNLOAD_T.md CURLINFO_SPEED_UPLOAD.md CURLINFO_SPEED_UPLOAD_T.md CURLINFO_SSL_ENGINES.md CURLINFO_SSL_VERIFYRESULT.md CURLINFO_STARTTRANSFER_TIME.md CURLINFO_STARTTRANSFER_TIME_T.md CURLINFO_TLS_SESSION.md CURLINFO_TLS_SSL_PTR.md CURLINFO_TOTAL_TIME.md CURLINFO_TOTAL_TIME_T.md CURLINFO_USED_PROXY.md CURLINFO_XFER_ID.md CURLMINFO_XFERS_ADDED.md CURLMINFO_XFERS_CURRENT.md CURLMINFO_XFERS_DONE.md CURLMINFO_XFERS_PENDING.md CURLMINFO_XFERS_RUNNING.md CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE.md CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE.md CURLMOPT_MAXCONNECTS.md CURLMOPT_MAX_CONCURRENT_STREAMS.md CURLMOPT_MAX_HOST_CONNECTIONS.md CURLMOPT_MAX_PIPELINE_LENGTH.md CURLMOPT_MAX_TOTAL_CONNECTIONS.md CURLMOPT_NETWORK_CHANGED.md CURLMOPT_NOTIFYDATA.md CURLMOPT_NOTIFYFUNCTION.md CURLMOPT_PIPELINING.md CURLMOPT_PIPELINING_SERVER_BL.md CURLMOPT_PIPELINING_SITE_BL.md CURLMOPT_PUSHDATA.md CURLMOPT_PUSHFUNCTION.md CURLMOPT_QUICK_EXIT.md CURLMOPT_RESOLVE_THREADS_MAX.md CURLMOPT_SOCKETDATA.md CURLMOPT_SOCKETFUNCTION.md CURLMOPT_TIMERDATA.md CURLMOPT_TIMERFUNCTION.md CURLOPT_ABSTRACT_UNIX_SOCKET.md CURLOPT_ACCEPTTIMEOUT_MS.md CURLOPT_ACCEPT_ENCODING.md CURLOPT_ADDRESS_SCOPE.md CURLOPT_ALTSVC.md CURLOPT_ALTSVC_CTRL.md CURLOPT_APPEND.md CURLOPT_AUTOREFERER.md CURLOPT_AWS_SIGV4.md CURLOPT_BUFFERSIZE.md CURLOPT_CAINFO.md CURLOPT_CAINFO_BLOB.md CURLOPT_CAPATH.md CURLOPT_CA_CACHE_TIMEOUT.md CURLOPT_CERTINFO.md CURLOPT_CHUNK_BGN_FUNCTION.md CURLOPT_CHUNK_DATA.md CURLOPT_CHUNK_END_FUNCTION.md CURLOPT_CLOSESOCKETDATA.md CURLOPT_CLOSESOCKETFUNCTION.md CURLOPT_CONNECTTIMEOUT.md CURLOPT_CONNECTTIMEOUT_MS.md CURLOPT_CONNECT_ONLY.md CURLOPT_CONNECT_TO.md CURLOPT_CONV_FROM_NETWORK_FUNCTION.md CURLOPT_CONV_FROM_UTF8_FUNCTION.md CURLOPT_CONV_TO_NETWORK_FUNCTION.md CURLOPT_COOKIE.md CURLOPT_COOKIEFILE.md CURLOPT_COOKIEJAR.md CURLOPT_COOKIELIST.md CURLOPT_COOKIESESSION.md CURLOPT_COPYPOSTFIELDS.md CURLOPT_CRLF.md CURLOPT_CRLFILE.md CURLOPT_CURLU.md CURLOPT_CUSTOMREQUEST.md CURLOPT_DEBUGDATA.md CURLOPT_DEBUGFUNCTION.md CURLOPT_DEFAULT_PROTOCOL.md CURLOPT_DIRLISTONLY.md CURLOPT_DISALLOW_USERNAME_IN_URL.md CURLOPT_DNS_CACHE_TIMEOUT.md CURLOPT_DNS_INTERFACE.md CURLOPT_DNS_LOCAL_IP4.md CURLOPT_DNS_LOCAL_IP6.md CURLOPT_DNS_SERVERS.md CURLOPT_DNS_SHUFFLE_ADDRESSES.md CURLOPT_DNS_USE_GLOBAL_CACHE.md CURLOPT_DOH_SSL_VERIFYHOST.md CURLOPT_DOH_SSL_VERIFYPEER.md CURLOPT_DOH_SSL_VERIFYSTATUS.md CURLOPT_DOH_URL.md CURLOPT_ECH.md CURLOPT_EGDSOCKET.md CURLOPT_ERRORBUFFER.md CURLOPT_EXPECT_100_TIMEOUT_MS.md CURLOPT_FAILONERROR.md CURLOPT_FILETIME.md CURLOPT_FNMATCH_DATA.md CURLOPT_FNMATCH_FUNCTION.md CURLOPT_FOLLOWLOCATION.md CURLOPT_FORBID_REUSE.md CURLOPT_FRESH_CONNECT.md CURLOPT_FTPPORT.md CURLOPT_FTPSSLAUTH.md CURLOPT_FTP_ACCOUNT.md CURLOPT_FTP_ALTERNATIVE_TO_USER.md CURLOPT_FTP_CREATE_MISSING_DIRS.md CURLOPT_FTP_FILEMETHOD.md CURLOPT_FTP_SKIP_PASV_IP.md CURLOPT_FTP_SSL_CCC.md CURLOPT_FTP_USE_EPRT.md CURLOPT_FTP_USE_EPSV.md CURLOPT_FTP_USE_PRET.md CURLOPT_GSSAPI_DELEGATION.md CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS.md CURLOPT_HAPROXYPROTOCOL.md CURLOPT_HAPROXY_CLIENT_IP.md CURLOPT_HEADER.md CURLOPT_HEADERDATA.md CURLOPT_HEADERFUNCTION.md CURLOPT_HEADEROPT.md CURLOPT_HSTS.md CURLOPT_HSTSREADDATA.md CURLOPT_HSTSREADFUNCTION.md CURLOPT_HSTSWRITEDATA.md CURLOPT_HSTSWRITEFUNCTION.md CURLOPT_HSTS_CTRL.md CURLOPT_HTTP09_ALLOWED.md CURLOPT_HTTP200ALIASES.md CURLOPT_HTTPAUTH.md CURLOPT_HTTPGET.md CURLOPT_HTTPHEADER.md CURLOPT_HTTPPOST.md CURLOPT_HTTPPROXYTUNNEL.md CURLOPT_HTTP_CONTENT_DECODING.md CURLOPT_HTTP_TRANSFER_DECODING.md CURLOPT_HTTP_VERSION.md CURLOPT_IGNORE_CONTENT_LENGTH.md CURLOPT_INFILESIZE.md CURLOPT_INFILESIZE_LARGE.md CURLOPT_INTERFACE.md CURLOPT_INTERLEAVEDATA.md CURLOPT_INTERLEAVEFUNCTION.md CURLOPT_IOCTLDATA.md CURLOPT_IOCTLFUNCTION.md CURLOPT_IPRESOLVE.md CURLOPT_ISSUERCERT.md CURLOPT_ISSUERCERT_BLOB.md CURLOPT_KEEP_SENDING_ON_ERROR.md CURLOPT_KEYPASSWD.md CURLOPT_KRBLEVEL.md CURLOPT_LOCALPORT.md CURLOPT_LOCALPORTRANGE.md CURLOPT_LOGIN_OPTIONS.md CURLOPT_LOW_SPEED_LIMIT.md CURLOPT_LOW_SPEED_TIME.md CURLOPT_MAIL_AUTH.md CURLOPT_MAIL_FROM.md CURLOPT_MAIL_RCPT.md CURLOPT_MAIL_RCPT_ALLOWFAILS.md CURLOPT_MAXAGE_CONN.md CURLOPT_MAXCONNECTS.md CURLOPT_MAXFILESIZE.md CURLOPT_MAXFILESIZE_LARGE.md CURLOPT_MAXLIFETIME_CONN.md CURLOPT_MAXREDIRS.md CURLOPT_MAX_RECV_SPEED_LARGE.md CURLOPT_MAX_SEND_SPEED_LARGE.md CURLOPT_MIMEPOST.md CURLOPT_MIME_OPTIONS.md CURLOPT_NETRC.md CURLOPT_NETRC_FILE.md CURLOPT_NEW_DIRECTORY_PERMS.md CURLOPT_NEW_FILE_PERMS.md CURLOPT_NOBODY.md CURLOPT_NOPROGRESS.md CURLOPT_NOPROXY.md CURLOPT_NOSIGNAL.md CURLOPT_OPENSOCKETDATA.md CURLOPT_OPENSOCKETFUNCTION.md CURLOPT_PASSWORD.md CURLOPT_PATH_AS_IS.md CURLOPT_PINNEDPUBLICKEY.md CURLOPT_PIPEWAIT.md CURLOPT_PORT.md CURLOPT_POST.md CURLOPT_POSTFIELDS.md CURLOPT_POSTFIELDSIZE.md CURLOPT_POSTFIELDSIZE_LARGE.md CURLOPT_POSTQUOTE.md CURLOPT_POSTREDIR.md CURLOPT_PREQUOTE.md CURLOPT_PREREQDATA.md CURLOPT_PREREQFUNCTION.md CURLOPT_PRE_PROXY.md CURLOPT_PRIVATE.md CURLOPT_PROGRESSDATA.md CURLOPT_PROGRESSFUNCTION.md CURLOPT_PROTOCOLS.md CURLOPT_PROTOCOLS_STR.md CURLOPT_PROXY.md CURLOPT_PROXYAUTH.md CURLOPT_PROXYHEADER.md CURLOPT_PROXYPASSWORD.md CURLOPT_PROXYPORT.md CURLOPT_PROXYTYPE.md CURLOPT_PROXYUSERNAME.md CURLOPT_PROXYUSERPWD.md CURLOPT_PROXY_CAINFO.md CURLOPT_PROXY_CAINFO_BLOB.md CURLOPT_PROXY_CAPATH.md CURLOPT_PROXY_CRLFILE.md CURLOPT_PROXY_ISSUERCERT.md CURLOPT_PROXY_ISSUERCERT_BLOB.md CURLOPT_PROXY_KEYPASSWD.md CURLOPT_PROXY_PINNEDPUBLICKEY.md CURLOPT_PROXY_SERVICE_NAME.md CURLOPT_PROXY_SSLCERT.md CURLOPT_PROXY_SSLCERTTYPE.md CURLOPT_PROXY_SSLCERT_BLOB.md CURLOPT_PROXY_SSLKEY.md CURLOPT_PROXY_SSLKEYTYPE.md CURLOPT_PROXY_SSLKEY_BLOB.md CURLOPT_PROXY_SSLVERSION.md CURLOPT_PROXY_SSL_CIPHER_LIST.md CURLOPT_PROXY_SSL_OPTIONS.md CURLOPT_PROXY_SSL_VERIFYHOST.md CURLOPT_PROXY_SSL_VERIFYPEER.md CURLOPT_PROXY_TLS13_CIPHERS.md CURLOPT_PROXY_TLSAUTH_PASSWORD.md CURLOPT_PROXY_TLSAUTH_TYPE.md CURLOPT_PROXY_TLSAUTH_USERNAME.md CURLOPT_PROXY_TRANSFER_MODE.md CURLOPT_PUT.md CURLOPT_QUICK_EXIT.md CURLOPT_QUOTE.md CURLOPT_RANDOM_FILE.md CURLOPT_RANGE.md CURLOPT_READDATA.md CURLOPT_READFUNCTION.md CURLOPT_REDIR_PROTOCOLS.md CURLOPT_REDIR_PROTOCOLS_STR.md CURLOPT_REFERER.md CURLOPT_REQUEST_TARGET.md CURLOPT_RESOLVE.md CURLOPT_RESOLVER_START_DATA.md CURLOPT_RESOLVER_START_FUNCTION.md CURLOPT_RESUME_FROM.md CURLOPT_RESUME_FROM_LARGE.md CURLOPT_RTSP_CLIENT_CSEQ.md CURLOPT_RTSP_REQUEST.md CURLOPT_RTSP_SERVER_CSEQ.md CURLOPT_RTSP_SESSION_ID.md CURLOPT_RTSP_STREAM_URI.md CURLOPT_RTSP_TRANSPORT.md CURLOPT_SASL_AUTHZID.md CURLOPT_SASL_IR.md CURLOPT_SEEKDATA.md CURLOPT_SEEKFUNCTION.md CURLOPT_SERVER_RESPONSE_TIMEOUT.md CURLOPT_SERVER_RESPONSE_TIMEOUT_MS.md CURLOPT_SERVICE_NAME.md CURLOPT_SHARE.md CURLOPT_SOCKOPTDATA.md CURLOPT_SOCKOPTFUNCTION.md CURLOPT_SOCKS5_AUTH.md CURLOPT_SOCKS5_GSSAPI_NEC.md CURLOPT_SOCKS5_GSSAPI_SERVICE.md CURLOPT_SSH_AUTH_TYPES.md CURLOPT_SSH_COMPRESSION.md CURLOPT_SSH_HOSTKEYDATA.md CURLOPT_SSH_HOSTKEYFUNCTION.md CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256.md CURLOPT_SSH_KEYDATA.md CURLOPT_SSH_KEYFUNCTION.md CURLOPT_SSH_KNOWNHOSTS.md CURLOPT_SSH_PRIVATE_KEYFILE.md CURLOPT_SSH_PUBLIC_KEYFILE.md CURLOPT_SSLCERT.md CURLOPT_SSLCERTTYPE.md CURLOPT_SSLCERT_BLOB.md CURLOPT_SSLENGINE.md CURLOPT_SSLENGINE_DEFAULT.md CURLOPT_SSLKEY.md CURLOPT_SSLKEYTYPE.md CURLOPT_SSLKEY_BLOB.md CURLOPT_SSLVERSION.md CURLOPT_SSL_CIPHER_LIST.md CURLOPT_SSL_CTX_DATA.md CURLOPT_SSL_CTX_FUNCTION.md CURLOPT_SSL_EC_CURVES.md CURLOPT_SSL_ENABLE_ALPN.md CURLOPT_SSL_ENABLE_NPN.md CURLOPT_SSL_FALSESTART.md CURLOPT_SSL_OPTIONS.md CURLOPT_SSL_SESSIONID_CACHE.md CURLOPT_SSL_SIGNATURE_ALGORITHMS.md CURLOPT_SSL_VERIFYHOST.md CURLOPT_SSL_VERIFYPEER.md CURLOPT_SSL_VERIFYSTATUS.md CURLOPT_STDERR.md CURLOPT_STREAM_DEPENDS.md CURLOPT_STREAM_DEPENDS_E.md CURLOPT_STREAM_WEIGHT.md CURLOPT_SUPPRESS_CONNECT_HEADERS.md CURLOPT_TCP_FASTOPEN.md CURLOPT_TCP_KEEPALIVE.md CURLOPT_TCP_KEEPCNT.md CURLOPT_TCP_KEEPIDLE.md CURLOPT_TCP_KEEPINTVL.md CURLOPT_TCP_NODELAY.md CURLOPT_TELNETOPTIONS.md CURLOPT_TFTP_BLKSIZE.md CURLOPT_TFTP_NO_OPTIONS.md CURLOPT_TIMECONDITION.md CURLOPT_TIMEOUT.md CURLOPT_TIMEOUT_MS.md CURLOPT_TIMEVALUE.md CURLOPT_TIMEVALUE_LARGE.md CURLOPT_TLS13_CIPHERS.md CURLOPT_TLSAUTH_PASSWORD.md CURLOPT_TLSAUTH_TYPE.md CURLOPT_TLSAUTH_USERNAME.md CURLOPT_TRAILERDATA.md CURLOPT_TRAILERFUNCTION.md CURLOPT_TRANSFERTEXT.md CURLOPT_TRANSFER_ENCODING.md CURLOPT_UNIX_SOCKET_PATH.md CURLOPT_UNRESTRICTED_AUTH.md CURLOPT_UPKEEP_INTERVAL_MS.md CURLOPT_UPLOAD.md CURLOPT_UPLOAD_BUFFERSIZE.md CURLOPT_UPLOAD_FLAGS.md CURLOPT_URL.md CURLOPT_USERAGENT.md CURLOPT_USERNAME.md CURLOPT_USERPWD.md CURLOPT_USE_SSL.md CURLOPT_VERBOSE.md CURLOPT_WILDCARDMATCH.md CURLOPT_WRITEDATA.md CURLOPT_WRITEFUNCTION.md CURLOPT_WS_OPTIONS.md CURLOPT_XFERINFODATA.md CURLOPT_XFERINFOFUNCTION.md CURLOPT_XOAUTH2_BEARER.md CURLSHOPT_LOCKFUNC.md CURLSHOPT_SHARE.md CURLSHOPT_UNLOCKFUNC.md CURLSHOPT_UNSHARE.md CURLSHOPT_USERDATA.md Makefile.am Makefile.incinclude
curl
Makefile.am curl.h curlver.h easy.h header.h mprintf.h multi.h options.h stdcheaders.h system.h typecheck-gcc.h urlapi.h websockets.hlib
curlx
base64.c base64.h basename.c basename.h dynbuf.c dynbuf.h fopen.c fopen.h inet_ntop.c inet_ntop.h inet_pton.c inet_pton.h multibyte.c multibyte.h nonblock.c nonblock.h snprintf.c snprintf.h strcopy.c strcopy.h strdup.c strdup.h strerr.c strerr.h strparse.c strparse.h timediff.c timediff.h timeval.c timeval.h version_win32.c version_win32.h wait.c wait.h warnless.c warnless.h winapi.c winapi.hvauth
cleartext.c cram.c digest.c digest.h digest_sspi.c gsasl.c krb5_gssapi.c krb5_sspi.c ntlm.c ntlm_sspi.c oauth2.c spnego_gssapi.c spnego_sspi.c vauth.c vauth.hvquic
curl_ngtcp2.c curl_ngtcp2.h curl_quiche.c curl_quiche.h vquic-tls.c vquic-tls.h vquic.c vquic.h vquic_int.hvtls
apple.c apple.h cipher_suite.c cipher_suite.h gtls.c gtls.h hostcheck.c hostcheck.h keylog.c keylog.h mbedtls.c mbedtls.h openssl.c openssl.h rustls.c rustls.h schannel.c schannel.h schannel_int.h schannel_verify.c vtls.c vtls.h vtls_int.h vtls_scache.c vtls_scache.h vtls_spack.c vtls_spack.h wolfssl.c wolfssl.h x509asn1.c x509asn1.hm4
.gitignore curl-amissl.m4 curl-apple-sectrust.m4 curl-compilers.m4 curl-confopts.m4 curl-functions.m4 curl-gnutls.m4 curl-mbedtls.m4 curl-openssl.m4 curl-override.m4 curl-reentrant.m4 curl-rustls.m4 curl-schannel.m4 curl-sysconfig.m4 curl-wolfssl.m4 xc-am-iface.m4 xc-cc-check.m4 xc-lt-iface.m4 xc-val-flgs.m4 zz40-xc-ovr.m4 zz50-xc-ovr.m4projects
OS400
.checksrc README.OS400 ccsidcurl.c ccsidcurl.h config400.default curl.cmd curl.inc.in curlcl.c curlmain.c initscript.sh make-docs.sh make-include.sh make-lib.sh make-src.sh make-tests.sh makefile.sh os400sys.c os400sys.hWindows
tmpl
.gitattributes README.txt curl-all.sln curl.sln curl.vcxproj curl.vcxproj.filters libcurl.sln libcurl.vcxproj libcurl.vcxproj.filtersvms
Makefile.am backup_gnv_curl_src.com build_curl-config_script.com build_gnv_curl.com build_gnv_curl_pcsi_desc.com build_gnv_curl_pcsi_text.com build_gnv_curl_release_notes.com build_libcurl_pc.com build_vms.com clean_gnv_curl.com compare_curl_source.com config_h.com curl_crtl_init.c curl_gnv_build_steps.txt curl_release_note_start.txt curl_startup.com curlmsg.h curlmsg.msg curlmsg.sdl curlmsg_vms.h generate_config_vms_h_curl.com generate_vax_transfer.com gnv_conftest.c_first gnv_curl_configure.sh gnv_libcurl_symbols.opt gnv_link_curl.com macro32_exactcase.patch make_gnv_curl_install.sh make_pcsi_curl_kit_name.com pcsi_gnv_curl_file_list.txt pcsi_product_gnv_curl.com readme report_openssl_version.c setup_gnv_curl_build.com stage_curl_install.com vms_eco_level.hscripts
.checksrc CMakeLists.txt Makefile.am badwords badwords-all badwords.txt cd2cd cd2nroff cdall checksrc-all.pl checksrc.pl cmakelint.sh completion.pl contributors.sh contrithanks.sh coverage.sh delta dmaketgz extract-unit-protos firefox-db2pem.sh installcheck.sh maketgz managen mdlinkcheck mk-ca-bundle.pl mk-unity.pl nroff2cd perlcheck.sh pythonlint.sh randdisable release-notes.pl release-tools.sh schemetable.c singleuse.pl spacecheck.pl top-complexity top-length verify-release wcurlsrc
.checksrc .gitignore CMakeLists.txt Makefile.am Makefile.inc config2setopts.c config2setopts.h curl.rc curlinfo.c mk-file-embed.pl mkhelp.pl slist_wc.c slist_wc.h terminal.c terminal.h tool_cb_dbg.c tool_cb_dbg.h tool_cb_hdr.c tool_cb_hdr.h tool_cb_prg.c tool_cb_prg.h tool_cb_rea.c tool_cb_rea.h tool_cb_see.c tool_cb_see.h tool_cb_soc.c tool_cb_soc.h tool_cb_wrt.c tool_cb_wrt.h tool_cfgable.c tool_cfgable.h tool_dirhie.c tool_dirhie.h tool_doswin.c tool_doswin.h tool_easysrc.c tool_easysrc.h tool_filetime.c tool_filetime.h tool_findfile.c tool_findfile.h tool_formparse.c tool_formparse.h tool_getparam.c tool_getparam.h tool_getpass.c tool_getpass.h tool_help.c tool_help.h tool_helpers.c tool_helpers.h tool_hugehelp.h tool_ipfs.c tool_ipfs.h tool_libinfo.c tool_libinfo.h tool_listhelp.c tool_main.c tool_main.h tool_msgs.c tool_msgs.h tool_operate.c tool_operate.h tool_operhlp.c tool_operhlp.h tool_paramhlp.c tool_paramhlp.h tool_parsecfg.c tool_parsecfg.h tool_progress.c tool_progress.h tool_sdecls.h tool_setopt.c tool_setopt.h tool_setup.h tool_ssls.c tool_ssls.h tool_stderr.c tool_stderr.h tool_urlglob.c tool_urlglob.h tool_util.c tool_util.h tool_version.h tool_vms.c tool_vms.h tool_writeout.c tool_writeout.h tool_writeout_json.c tool_writeout_json.h tool_xattr.c tool_xattr.h var.c var.htests
certs
.gitignore CMakeLists.txt Makefile.am Makefile.inc genserv.pl srp-verifier-conf srp-verifier-db test-ca.cnf test-ca.prm test-client-cert.prm test-client-eku-only.prm test-localhost-san-first.prm test-localhost-san-last.prm test-localhost.nn.prm test-localhost.prm test-localhost0h.prmdata
.gitignore DISABLED Makefile.am data-xml1 data1400.c data1401.c data1402.c data1403.c data1404.c data1405.c data1406.c data1407.c data1420.c data1461.txt data1463.txt data1465.c data1481.c data1705-1.md data1705-2.md data1705-3.md data1705-4.md data1705-stdout.1 data1706-1.md data1706-2.md data1706-3.md data1706-4.md data1706-stdout.txt data320.html test1 test10 test100 test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 test1008 test1009 test101 test1010 test1011 test1012 test1013 test1014 test1015 test1016 test1017 test1018 test1019 test102 test1020 test1021 test1022 test1023 test1024 test1025 test1026 test1027 test1028 test1029 test103 test1030 test1031 test1032 test1033 test1034 test1035 test1036 test1037 test1038 test1039 test104 test1040 test1041 test1042 test1043 test1044 test1045 test1046 test1047 test1048 test1049 test105 test1050 test1051 test1052 test1053 test1054 test1055 test1056 test1057 test1058 test1059 test106 test1060 test1061 test1062 test1063 test1064 test1065 test1066 test1067 test1068 test1069 test107 test1070 test1071 test1072 test1073 test1074 test1075 test1076 test1077 test1078 test1079 test108 test1080 test1081 test1082 test1083 test1084 test1085 test1086 test1087 test1088 test1089 test109 test1090 test1091 test1092 test1093 test1094 test1095 test1096 test1097 test1098 test1099 test11 test110 test1100 test1101 test1102 test1103 test1104 test1105 test1106 test1107 test1108 test1109 test111 test1110 test1111 test1112 test1113 test1114 test1115 test1116 test1117 test1118 test1119 test112 test1120 test1121 test1122 test1123 test1124 test1125 test1126 test1127 test1128 test1129 test113 test1130 test1131 test1132 test1133 test1134 test1135 test1136 test1137 test1138 test1139 test114 test1140 test1141 test1142 test1143 test1144 test1145 test1146 test1147 test1148 test1149 test115 test1150 test1151 test1152 test1153 test1154 test1155 test1156 test1157 test1158 test1159 test116 test1160 test1161 test1162 test1163 test1164 test1165 test1166 test1167 test1168 test1169 test117 test1170 test1171 test1172 test1173 test1174 test1175 test1176 test1177 test1178 test1179 test118 test1180 test1181 test1182 test1183 test1184 test1185 test1186 test1187 test1188 test1189 test119 test1190 test1191 test1192 test1193 test1194 test1195 test1196 test1197 test1198 test1199 test12 test120 test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 test1208 test1209 test121 test1210 test1211 test1212 test1213 test1214 test1215 test1216 test1217 test1218 test1219 test122 test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 test1228 test1229 test123 test1230 test1231 test1232 test1233 test1234 test1235 test1236 test1237 test1238 test1239 test124 test1240 test1241 test1242 test1243 test1244 test1245 test1246 test1247 test1248 test1249 test125 test1250 test1251 test1252 test1253 test1254 test1255 test1256 test1257 test1258 test1259 test126 test1260 test1261 test1262 test1263 test1264 test1265 test1266 test1267 test1268 test1269 test127 test1270 test1271 test1272 test1273 test1274 test1275 test1276 test1277 test1278 test1279 test128 test1280 test1281 test1282 test1283 test1284 test1285 test1286 test1287 test1288 test1289 test129 test1290 test1291 test1292 test1293 test1294 test1295 test1296 test1297 test1298 test1299 test13 test130 test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 test1308 test1309 test131 test1310 test1311 test1312 test1313 test1314 test1315 test1316 test1317 test1318 test1319 test132 test1320 test1321 test1322 test1323 test1324 test1325 test1326 test1327 test1328 test1329 test133 test1330 test1331 test1332 test1333 test1334 test1335 test1336 test1337 test1338 test1339 test134 test1340 test1341 test1342 test1343 test1344 test1345 test1346 test1347 test1348 test1349 test135 test1350 test1351 test1352 test1353 test1354 test1355 test1356 test1357 test1358 test1359 test136 test1360 test1361 test1362 test1363 test1364 test1365 test1366 test1367 test1368 test1369 test137 test1370 test1371 test1372 test1373 test1374 test1375 test1376 test1377 test1378 test1379 test138 test1380 test1381 test1382 test1383 test1384 test1385 test1386 test1387 test1388 test1389 test139 test1390 test1391 test1392 test1393 test1394 test1395 test1396 test1397 test1398 test1399 test14 test140 test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 test1408 test1409 test141 test1410 test1411 test1412 test1413 test1414 test1415 test1416 test1417 test1418 test1419 test142 test1420 test1421 test1422 test1423 test1424 test1425 test1426 test1427 test1428 test1429 test143 test1430 test1431 test1432 test1433 test1434 test1435 test1436 test1437 test1438 test1439 test144 test1440 test1441 test1442 test1443 test1444 test1445 test1446 test1447 test1448 test1449 test145 test1450 test1451 test1452 test1453 test1454 test1455 test1456 test1457 test1458 test1459 test146 test1460 test1461 test1462 test1463 test1464 test1465 test1466 test1467 test1468 test1469 test147 test1470 test1471 test1472 test1473 test1474 test1475 test1476 test1477 test1478 test1479 test148 test1480 test1481 test1482 test1483 test1484 test1485 test1486 test1487 test1488 test1489 test149 test1490 test1491 test1492 test1493 test1494 test1495 test1496 test1497 test1498 test1499 test15 test150 test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 test1508 test1509 test151 test1510 test1511 test1512 test1513 test1514 test1515 test1516 test1517 test1518 test1519 test152 test1520 test1521 test1522 test1523 test1524 test1525 test1526 test1527 test1528 test1529 test153 test1530 test1531 test1532 test1533 test1534 test1535 test1536 test1537 test1538 test1539 test154 test1540 test1541 test1542 test1543 test1544 test1545 test1546 test1547 test1548 test1549 test155 test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 test1558 test1559 test156 test1560 test1561 test1562 test1563 test1564 test1565 test1566 test1567 test1568 test1569 test157 test1570 test1571 test1572 test1573 test1574 test1575 test1576 test1577 test1578 test1579 test158 test1580 test1581 test1582 test1583 test1584 test1585 test1586 test1587 test1588 test1589 test159 test1590 test1591 test1592 test1593 test1594 test1595 test1596 test1597 test1598 test1599 test16 test160 test1600 test1601 test1602 test1603 test1604 test1605 test1606 test1607 test1608 test1609 test161 test1610 test1611 test1612 test1613 test1614 test1615 test1616 test1617 test1618 test1619 test162 test1620 test1621 test1622 test1623 test1624 test1625 test1626 test1627 test1628 test1629 test163 test1630 test1631 test1632 test1633 test1634 test1635 test1636 test1637 test1638 test1639 test164 test1640 test1641 test1642 test1643 test1644 test1645 test165 test1650 test1651 test1652 test1653 test1654 test1655 test1656 test1657 test1658 test1659 test166 test1660 test1661 test1662 test1663 test1664 test1665 test1666 test1667 test1668 test1669 test167 test1670 test1671 test1672 test1673 test1674 test1675 test1676 test168 test1680 test1681 test1682 test1683 test1684 test1685 test169 test17 test170 test1700 test1701 test1702 test1703 test1704 test1705 test1706 test1707 test1708 test1709 test171 test1710 test1711 test1712 test1713 test1714 test1715 test172 test1720 test1721 test173 test174 test175 test176 test177 test178 test179 test18 test180 test1800 test1801 test1802 test181 test182 test183 test184 test1847 test1848 test1849 test185 test1850 test1851 test186 test187 test188 test189 test19 test190 test1900 test1901 test1902 test1903 test1904 test1905 test1906 test1907 test1908 test1909 test191 test1910 test1911 test1912 test1913 test1914 test1915 test1916 test1917 test1918 test1919 test192 test1920 test1921 test193 test1933 test1934 test1935 test1936 test1937 test1938 test1939 test194 test1940 test1941 test1942 test1943 test1944 test1945 test1946 test1947 test1948 test195 test1955 test1956 test1957 test1958 test1959 test196 test1960 test1964 test1965 test1966 test197 test1970 test1971 test1972 test1973 test1974 test1975 test1976 test1977 test1978 test1979 test198 test1980 test1981 test1982 test1983 test1984 test199 test2 test20 test200 test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 test2008 test2009 test201 test2010 test2011 test2012 test2013 test2014 test202 test2023 test2024 test2025 test2026 test2027 test2028 test2029 test203 test2030 test2031 test2032 test2033 test2034 test2035 test2037 test2038 test2039 test204 test2040 test2041 test2042 test2043 test2044 test2045 test2046 test2047 test2048 test2049 test205 test2050 test2051 test2052 test2053 test2054 test2055 test2056 test2057 test2058 test2059 test206 test2060 test2061 test2062 test2063 test2064 test2065 test2066 test2067 test2068 test2069 test207 test2070 test2071 test2072 test2073 test2074 test2075 test2076 test2077 test2078 test2079 test208 test2080 test2081 test2082 test2083 test2084 test2085 test2086 test2087 test2088 test2089 test209 test2090 test2091 test2092 test21 test210 test2100 test2101 test2102 test2103 test2104 test211 test212 test213 test214 test215 test216 test217 test218 test219 test22 test220 test2200 test2201 test2202 test2203 test2204 test2205 test2206 test2207 test221 test222 test223 test224 test225 test226 test227 test228 test229 test23 test230 test2300 test2301 test2302 test2303 test2304 test2306 test2307 test2308 test2309 test231 test232 test233 test234 test235 test236 test237 test238 test239 test24 test240 test2400 test2401 test2402 test2403 test2404 test2405 test2406 test2407 test2408 test2409 test241 test2410 test2411 test242 test243 test244 test245 test246 test247 test248 test249 test25 test250 test2500 test2501 test2502 test2503 test2504 test2505 test2506 test251 test252 test253 test254 test255 test256 test257 test258 test259 test26 test260 test2600 test2601 test2602 test2603 test2604 test2605 test261 test262 test263 test264 test265 test266 test267 test268 test269 test27 test270 test2700 test2701 test2702 test2703 test2704 test2705 test2706 test2707 test2708 test2709 test271 test2710 test2711 test2712 test2713 test2714 test2715 test2716 test2717 test2718 test2719 test272 test2720 test2721 test2722 test2723 test273 test274 test275 test276 test277 test278 test279 test28 test280 test281 test282 test283 test284 test285 test286 test287 test288 test289 test29 test290 test291 test292 test293 test294 test295 test296 test297 test298 test299 test3 test30 test300 test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 test3008 test3009 test301 test3010 test3011 test3012 test3013 test3014 test3015 test3016 test3017 test3018 test3019 test302 test3020 test3021 test3022 test3023 test3024 test3025 test3026 test3027 test3028 test3029 test303 test3030 test3031 test3032 test3033 test3034 test3035 test3036 test304 test305 test306 test307 test308 test309 test31 test310 test3100 test3101 test3102 test3103 test3104 test3105 test3106 test311 test312 test313 test314 test315 test316 test317 test318 test319 test32 test320 test3200 test3201 test3202 test3203 test3204 test3205 test3206 test3207 test3208 test3209 test321 test3210 test3211 test3212 test3213 test3214 test3215 test3216 test3217 test3218 test3219 test322 test3220 test323 test324 test325 test326 test327 test328 test329 test33 test330 test3300 test3301 test3302 test331 test332 test333 test334 test335 test336 test337 test338 test339 test34 test340 test341 test342 test343 test344 test345 test346 test347 test348 test349 test35 test350 test351 test352 test353 test354 test355 test356 test357 test358 test359 test36 test360 test361 test362 test363 test364 test365 test366 test367 test368 test369 test37 test370 test371 test372 test373 test374 test375 test376 test378 test379 test38 test380 test381 test383 test384 test385 test386 test387 test388 test389 test39 test390 test391 test392 test393 test394 test395 test396 test397 test398 test399 test4 test40 test400 test4000 test4001 test401 test402 test403 test404 test405 test406 test407 test408 test409 test41 test410 test411 test412 test413 test414 test415 test416 test417 test418 test419 test42 test420 test421 test422 test423 test424 test425 test426 test427 test428 test429 test43 test430 test431 test432 test433 test434 test435 test436 test437 test438 test439 test44 test440 test441 test442 test443 test444 test445 test446 test447 test448 test449 test45 test450 test451 test452 test453 test454 test455 test456 test457 test458 test459 test46 test460 test461 test462 test463 test467 test468 test469 test47 test470 test471 test472 test473 test474 test475 test476 test477 test478 test479 test48 test480 test481 test482 test483 test484 test485 test486 test487 test488 test489 test49 test490 test491 test492 test493 test494 test495 test496 test497 test498 test499 test5 test50 test500 test501 test502 test503 test504 test505 test506 test507 test508 test509 test51 test510 test511 test512 test513 test514 test515 test516 test517 test518 test519 test52 test520 test521 test522 test523 test524 test525 test526 test527 test528 test529 test53 test530 test531 test532 test533 test534 test535 test536 test537 test538 test539 test54 test540 test541 test542 test543 test544 test545 test546 test547 test548 test549 test55 test550 test551 test552 test553 test554 test555 test556 test557 test558 test559 test56 test560 test561 test562 test563 test564 test565 test566 test567 test568 test569 test57 test570 test571 test572 test573 test574 test575 test576 test577 test578 test579 test58 test580 test581 test582 test583 test584 test585 test586 test587 test588 test589 test59 test590 test591 test592 test593 test594 test595 test596 test597 test598 test599 test6 test60 test600 test601 test602 test603 test604 test605 test606 test607 test608 test609 test61 test610 test611 test612 test613 test614 test615 test616 test617 test618 test619 test62 test620 test621 test622 test623 test624 test625 test626 test627 test628 test629 test63 test630 test631 test632 test633 test634 test635 test636 test637 test638 test639 test64 test640 test641 test642 test643 test644 test645 test646 test647 test648 test649 test65 test650 test651 test652 test653 test654 test655 test656 test658 test659 test66 test660 test661 test662 test663 test664 test665 test666 test667 test668 test669 test67 test670 test671 test672 test673 test674 test675 test676 test677 test678 test679 test68 test680 test681 test682 test683 test684 test685 test686 test687 test688 test689 test69 test690 test691 test692 test693 test694 test695 test696 test697 test698 test699 test7 test70 test700 test701 test702 test703 test704 test705 test706 test707 test708 test709 test71 test710 test711 test712 test713 test714 test715 test716 test717 test718 test719 test72 test720 test721 test722 test723 test724 test725 test726 test727 test728 test729 test73 test730 test731 test732 test733 test734 test735 test736 test737 test738 test739 test74 test740 test741 test742 test743 test744 test745 test746 test747 test748 test749 test75 test750 test751 test752 test753 test754 test755 test756 test757 test758 test759 test76 test760 test761 test762 test763 test764 test765 test766 test767 test768 test769 test77 test770 test771 test772 test773 test774 test775 test776 test777 test778 test779 test78 test780 test781 test782 test783 test784 test785 test786 test787 test788 test789 test79 test790 test791 test792 test793 test794 test795 test796 test797 test798 test799 test8 test80 test800 test801 test802 test803 test804 test805 test806 test807 test808 test809 test81 test810 test811 test812 test813 test814 test815 test816 test817 test818 test819 test82 test820 test821 test822 test823 test824 test825 test826 test827 test828 test829 test83 test830 test831 test832 test833 test834 test835 test836 test837 test838 test839 test84 test840 test841 test842 test843 test844 test845 test846 test847 test848 test849 test85 test850 test851 test852 test853 test854 test855 test856 test857 test858 test859 test86 test860 test861 test862 test863 test864 test865 test866 test867 test868 test869 test87 test870 test871 test872 test873 test874 test875 test876 test877 test878 test879 test88 test880 test881 test882 test883 test884 test885 test886 test887 test888 test889 test89 test890 test891 test892 test893 test894 test895 test896 test897 test898 test899 test9 test90 test900 test901 test902 test903 test904 test905 test906 test907 test908 test909 test91 test910 test911 test912 test913 test914 test915 test916 test917 test918 test919 test92 test920 test921 test922 test923 test924 test925 test926 test927 test928 test929 test93 test930 test931 test932 test933 test934 test935 test936 test937 test938 test939 test94 test940 test941 test942 test943 test944 test945 test946 test947 test948 test949 test95 test950 test951 test952 test953 test954 test955 test956 test957 test958 test959 test96 test960 test961 test962 test963 test964 test965 test966 test967 test968 test969 test97 test970 test971 test972 test973 test974 test975 test976 test977 test978 test979 test98 test980 test981 test982 test983 test984 test985 test986 test987 test988 test989 test99 test990 test991 test992 test993 test994 test995 test996 test997 test998 test999http
testenv
__init__.py caddy.py certs.py client.py curl.py dante.py dnsd.py env.py httpd.py nghttpx.py ports.py sshd.py vsftpd.py ws_echo_server.pylibtest
.gitignore CMakeLists.txt Makefile.am Makefile.inc cli_ftp_upload.c cli_h2_pausing.c cli_h2_serverpush.c cli_h2_upgrade_extreme.c cli_hx_download.c cli_hx_upload.c cli_tls_session_reuse.c cli_upload_pausing.c cli_ws_data.c cli_ws_pingpong.c first.c first.h lib1156.c lib1301.c lib1308.c lib1485.c lib1500.c lib1501.c lib1502.c lib1506.c lib1507.c lib1508.c lib1509.c lib1510.c lib1511.c lib1512.c lib1513.c lib1514.c lib1515.c lib1517.c lib1518.c lib1520.c lib1522.c lib1523.c lib1525.c lib1526.c lib1527.c lib1528.c lib1529.c lib1530.c lib1531.c lib1532.c lib1533.c lib1534.c lib1535.c lib1536.c lib1537.c lib1538.c lib1540.c lib1541.c lib1542.c lib1545.c lib1549.c lib1550.c lib1551.c lib1552.c lib1553.c lib1554.c lib1555.c lib1556.c lib1557.c lib1558.c lib1559.c lib1560.c lib1564.c lib1565.c lib1567.c lib1568.c lib1569.c lib1571.c lib1576.c lib1582.c lib1587.c lib1588.c lib1589.c lib1591.c lib1592.c lib1593.c lib1594.c lib1597.c lib1598.c lib1599.c lib1662.c lib1900.c lib1901.c lib1902.c lib1903.c lib1905.c lib1906.c lib1907.c lib1908.c lib1910.c lib1911.c lib1912.c lib1913.c lib1915.c lib1916.c lib1918.c lib1919.c lib1920.c lib1921.c lib1933.c lib1934.c lib1935.c lib1936.c lib1937.c lib1938.c lib1939.c lib1940.c lib1945.c lib1947.c lib1948.c lib1955.c lib1956.c lib1957.c lib1958.c lib1959.c lib1960.c lib1964.c lib1965.c lib1970.c lib1971.c lib1972.c lib1973.c lib1974.c lib1975.c lib1977.c lib1978.c lib2023.c lib2032.c lib2082.c lib2301.c lib2302.c lib2304.c lib2306.c lib2308.c lib2309.c lib2402.c lib2404.c lib2405.c lib2502.c lib2504.c lib2505.c lib2506.c lib2700.c lib3010.c lib3025.c lib3026.c lib3027.c lib3033.c lib3034.c lib3100.c lib3101.c lib3102.c lib3103.c lib3104.c lib3105.c lib3207.c lib3208.c lib500.c lib501.c lib502.c lib503.c lib504.c lib505.c lib506.c lib507.c lib508.c lib509.c lib510.c lib511.c lib512.c lib513.c lib514.c lib515.c lib516.c lib517.c lib518.c lib519.c lib520.c lib521.c lib523.c lib524.c lib525.c lib526.c lib530.c lib533.c lib536.c lib537.c lib539.c lib540.c lib541.c lib542.c lib543.c lib544.c lib547.c lib549.c lib552.c lib553.c lib554.c lib555.c lib556.c lib557.c lib558.c lib559.c lib560.c lib562.c lib564.c lib566.c lib567.c lib568.c lib569.c lib570.c lib571.c lib572.c lib573.c lib574.c lib575.c lib576.c lib578.c lib579.c lib582.c lib583.c lib586.c lib589.c lib590.c lib591.c lib597.c lib598.c lib599.c lib643.c lib650.c lib651.c lib652.c lib653.c lib654.c lib655.c lib658.c lib659.c lib661.c lib666.c lib667.c lib668.c lib670.c lib674.c lib676.c lib677.c lib678.c lib694.c lib695.c lib751.c lib753.c lib757.c lib758.c lib766.c memptr.c mk-lib1521.pl test1013.pl test1022.pl test307.pl test610.pl test613.pl testtrace.c testtrace.h testutil.c testutil.h unitcheck.hserver
.checksrc .gitignore CMakeLists.txt Makefile.am Makefile.inc dnsd.c first.c first.h getpart.c mqttd.c resolve.c rtspd.c sockfilt.c socksd.c sws.c tftpd.c util.ctunit
.gitignore CMakeLists.txt Makefile.am Makefile.inc README.md tool1394.c tool1604.c tool1621.c tool1622.c tool1623.c tool1720.cunit
.gitignore CMakeLists.txt Makefile.am Makefile.inc README.md unit1300.c unit1302.c unit1303.c unit1304.c unit1305.c unit1307.c unit1309.c unit1323.c unit1330.c unit1395.c unit1396.c unit1397.c unit1398.c unit1399.c unit1600.c unit1601.c unit1602.c unit1603.c unit1605.c unit1606.c unit1607.c unit1608.c unit1609.c unit1610.c unit1611.c unit1612.c unit1614.c unit1615.c unit1616.c unit1620.c unit1625.c unit1626.c unit1627.c unit1636.c unit1650.c unit1651.c unit1652.c unit1653.c unit1654.c unit1655.c unit1656.c unit1657.c unit1658.c unit1660.c unit1661.c unit1663.c unit1664.c unit1666.c unit1667.c unit1668.c unit1669.c unit1674.c unit1675.c unit1676.c unit1979.c unit1980.c unit2600.c unit2601.c unit2602.c unit2603.c unit2604.c unit2605.c unit3200.c unit3205.c unit3211.c unit3212.c unit3213.c unit3214.c unit3216.c unit3219.c unit3300.c unit3301.c unit3302.cexamples
.env config.ini crypto_test.lua env_test.lua fs_example.lua http_server.lua https_test.lua ini_example.lua json.lua log.lua path_fs_example.lua process_example.lua request_download.lua request_test.lua run_all.lua sqlite_example.lua sqlite_http_template.lua stash_test.lua template_test.lua timer.lua websocket.luainiparser
example
iniexample.c iniwrite.c parse.c twisted-errors.ini twisted-genhuge.py twisted-ofkey.ini twisted-ofval.ini twisted.initest
CMakeLists.txt test_dictionary.c test_iniparser.c unity-config.yml unity_config.hjinjac
libjinjac
src
CMakeLists.txt ast.c ast.h block_statement.c block_statement.h buffer.c buffer.h buildin.c buildin.h common.h convert.c convert.h flex_decl.h jfunction.c jfunction.h jinja_expression.l jinja_expression.y jinjac_parse.c jinjac_parse.h jinjac_stream.c jinjac_stream.h jlist.c jlist.h jobject.c jobject.h parameter.c parameter.h str_obj.c str_obj.h trace.c trace.htest
.gitignore CMakeLists.txt autotest.rb test_01.expected test_01.jinja test_01b.expected test_01b.jinja test_01c.expected test_01c.jinja test_01d.expected test_01d.jinja test_02.expected test_02.jinja test_03.expected test_03.jinja test_04.expected test_04.jinja test_05.expected test_05.jinja test_06.expected test_06.jinja test_07.expected test_07.jinja test_08.expected test_08.jinja test_08b.expected test_08b.jinja test_09.expected test_09.jinja test_10.expected test_10.jinja test_11.expected test_11.jinja test_12.expected test_12.jinja test_13.expected test_13.jinja test_14.expected test_14.jinja test_15.expected test_15.jinja test_16.expected test_16.jinja test_17.expected test_17.jinja test_18.expected test_18.jinja test_18b.expected test_18b.jinja test_18c.expected test_18c.jinja test_19.expected test_19.jinja test_19b.expected test_19b.jinja test_19c.expected test_19c.jinja test_19d.expected test_19d.jinja test_19e.expected test_19e.jinja test_19f.expected test_19f.jinja test_20.expected test_20.jinja test_21.expected test_21.jinja test_22.expected test_22.jinja test_22a.expected test_22a.jinja test_22b.expected test_22b.jinja test_23.expected test_23.jinja test_24.expected test_24.jinjalibev
Changes LICENSE Makefile Makefile.am Makefile.in README Symbols.ev Symbols.event aclocal.m4 autogen.sh compile config.guess config.h config.h.in config.status config.sub configure configure.ac depcomp ev++.h ev.3 ev.c ev.h ev.pod ev_epoll.c ev_kqueue.c ev_poll.c ev_port.c ev_select.c ev_vars.h ev_win32.c ev_wrap.h event.c event.h install-sh libev.m4 libtool ltmain.sh missing mkinstalldirs stamp-h1luajit
doc
bluequad-print.css bluequad.css contact.html ext_buffer.html ext_c_api.html ext_ffi.html ext_ffi_api.html ext_ffi_semantics.html ext_ffi_tutorial.html ext_jit.html ext_profiler.html extensions.html install.html luajit.html running.htmldynasm
dasm_arm.h dasm_arm.lua dasm_arm64.h dasm_arm64.lua dasm_mips.h dasm_mips.lua dasm_mips64.lua dasm_ppc.h dasm_ppc.lua dasm_proto.h dasm_x64.lua dasm_x86.h dasm_x86.lua dynasm.luasrc
host
.gitignore README buildvm.c buildvm.h buildvm_asm.c buildvm_fold.c buildvm_lib.c buildvm_libbc.h buildvm_peobj.c genlibbc.lua genminilua.lua genversion.lua minilua.cjit
.gitignore bc.lua bcsave.lua dis_arm.lua dis_arm64.lua dis_arm64be.lua dis_mips.lua dis_mips64.lua dis_mips64el.lua dis_mips64r6.lua dis_mips64r6el.lua dis_mipsel.lua dis_ppc.lua dis_x64.lua dis_x86.lua dump.lua p.lua v.lua zone.luawolfssl
.github
workflows
ada.yml arduino.yml async-examples.yml async.yml atecc608-sim.yml bind.yml cmake-autoconf.yml cmake.yml codespell.yml coverity-scan-fixes.yml cryptocb-only.yml curl.yml cyrus-sasl.yml disable-pk-algs.yml docker-Espressif.yml docker-OpenWrt.yml emnet-nonblock.yml fil-c.yml freertos-mem-track.yml gencertbuf.yml grpc.yml haproxy.yml hostap-vm.yml intelasm-c-fallback.yml ipmitool.yml jwt-cpp.yml krb5.yml libspdm.yml libssh2.yml libvncserver.yml linuxkm.yml macos-apple-native-cert-validation.yml mbedtls.sh mbedtls.yml membrowse-comment.yml membrowse-onboard.yml membrowse-report.yml memcached.sh memcached.yml mono.yml mosquitto.yml msmtp.yml msys2.yml multi-arch.yml multi-compiler.yml net-snmp.yml nginx.yml no-malloc.yml no-tls.yml nss.sh nss.yml ntp.yml ocsp.yml openldap.yml openssh.yml openssl-ech.yml opensslcoexist.yml openvpn.yml os-check.yml packaging.yml pam-ipmi.yml pq-all.yml pr-commit-check.yml psk.yml puf.yml python.yml rng-tools.yml rust-wrapper.yml se050-sim.yml smallStackSize.yml socat.yml softhsm.yml sssd.yml stm32-sim.yml stsafe-a120-sim.yml stunnel.yml symbol-prefixes.yml threadx.yml tls-anvil.yml trackmemory.yml watcomc.yml win-csharp-test.yml wolfCrypt-Wconversion.yml wolfboot-integration.yml wolfsm.yml xcode.yml zephyr-4.x.yml zephyr.ymlIDE
ARDUINO
Arduino_README_prepend.md README.md include.am keywords.txt library.properties.template wolfssl-arduino.cpp wolfssl-arduino.sh wolfssl.hECLIPSE
Espressif
ESP-IDF
examples
template
CMakeLists.txt Makefile README.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp8266wolfssl_benchmark
VisualGDB
wolfssl_benchmark_IDF_v4.4_ESP32.sln wolfssl_benchmark_IDF_v4.4_ESP32.vgdbproj wolfssl_benchmark_IDF_v5_ESP32.sln wolfssl_benchmark_IDF_v5_ESP32.vgdbproj wolfssl_benchmark_IDF_v5_ESP32C3.sln wolfssl_benchmark_IDF_v5_ESP32C3.vgdbproj wolfssl_benchmark_IDF_v5_ESP32S3.sln wolfssl_benchmark_IDF_v5_ESP32S3.vgdbprojwolfssl_client
CMakeLists.txt Makefile README.md README_server_sm.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp32c2 sdkconfig.defaults.esp8266 wolfssl_client_ESP8266.vgdbprojwolfssl_server
CMakeLists.txt Makefile README.md README_server_sm.md partitions_singleapp_large.csv sdkconfig.defaults sdkconfig.defaults.esp32c2 sdkconfig.defaults.esp8266 wolfssl_server_ESP8266.vgdbprojwolfssl_test
VisualGDB
wolfssl_test-IDF_v5_ESP32.sln wolfssl_test-IDF_v5_ESP32.vgdbproj wolfssl_test-IDF_v5_ESP32C3.sln wolfssl_test-IDF_v5_ESP32C3.vgdbproj wolfssl_test-IDF_v5_ESP32C6.sln wolfssl_test-IDF_v5_ESP32C6.vgdbproj wolfssl_test_IDF_v5_ESP32S3.sln wolfssl_test_IDF_v5_ESP32S3.vgdbprojGCC-ARM
Makefile Makefile.bench Makefile.client Makefile.common Makefile.server Makefile.static Makefile.test README.md include.am linker.ld linker_fips.ldIAR-EWARM
embOS
SAMV71_XULT
embOS_SAMV71_XULT_user_settings
user_settings.h user_settings_simple_example.h user_settings_verbose_example.hembOS_wolfcrypt_benchmark_SAMV71_XULT
README_wolfcrypt_benchmark wolfcrypt_benchmark.ewd wolfcrypt_benchmark.ewpINTIME-RTOS
Makefile README.md include.am libwolfssl.c libwolfssl.vcxproj user_settings.h wolfExamples.c wolfExamples.h wolfExamples.sln wolfExamples.vcxproj wolfssl-lib.sln wolfssl-lib.vcxprojMQX
Makefile README-jp.md README.md client-tls.c include.am server-tls.c user_config.h user_settings.hMSVS-2019-AZSPHERE
wolfssl_new_azsphere
.gitignore CMakeLists.txt CMakeSettings.json app_manifest.json applibs_versions.h launch.vs.json main.cNETOS
Makefile.wolfcrypt.inc README.md include.am user_settings.h user_settings.h-cert2425 user_settings.h-cert3389 wolfssl_netos_custom.cPlatformIO
examples
wolfssl_benchmark
CMakeLists.txt README.md platformio.ini sdkconfig.defaults wolfssl_benchmark.code-workspaceROWLEY-CROSSWORKS-ARM
Kinetis_FlashPlacement.xml README.md arm_startup.c benchmark_main.c hw.h include.am kinetis_hw.c retarget.c test_main.c user_settings.h wolfssl.hzp wolfssl_ltc.hzpRenesas
e2studio
RA6M3
README.md README_APRA6M_en.md README_APRA6M_jp.md include.amRX72N
EnvisionKit
Simple
README_EN.md README_JP.mdwolfssl_demo
key_data.c key_data.h user_settings.h wolfssl_demo.c wolfssl_demo.h wolfssl_tsip_unit_test.cSTM32Cube
README.md STM32_Benchmarks.md default_conf.ftl include.am main.c wolfssl_example.c wolfssl_example.hWIN
README.txt include.am test.vcxproj user_settings.h user_settings_dtls.h wolfssl-fips.sln wolfssl-fips.vcxprojWIN-SRTP-KDF-140-3
README.txt include.am resource.h test.vcxproj user_settings.h wolfssl-fips.rc wolfssl-fips.sln wolfssl-fips.vcxprojWIN10
README.txt include.am resource.h test.vcxproj user_settings.h wolfssl-fips.rc wolfssl-fips.sln wolfssl-fips.vcxprojXCODE
Benchmark
include.amXilinxSDK
README.md bench.sh combine.sh eclipse_formatter_profile.xml graph.sh include.am user_settings.h wolfssl_example.capple-universal
wolfssl-multiplatform
iotsafe
Makefile README.md ca-cert.c devices.c devices.h include.am main.c memory-tls.c startup.c target.ld user_settings.hmynewt
README.md apps.wolfcrypttest.pkg.yml crypto.wolfssl.pkg.yml crypto.wolfssl.syscfg.yml include.am setup.shcerts
1024
ca-cert.der ca-cert.pem ca-key.der ca-key.pem client-cert.der client-cert.pem client-key.der client-key.pem client-keyPub.der dh1024.der dh1024.pem dsa-pub-1024.pem dsa1024.der dsa1024.pem include.am rsa1024.der server-cert.der server-cert.pem server-key.der server-key.pemcrl
extra-crls
ca-int-cert-revoked.pem claim-root.pem crl_critical_entry.pem crlnum_57oct.pem crlnum_64oct.pem general-server-crl.pem large_crlnum.pem large_crlnum2.pemdilithium
bench_dilithium_level2_key.der bench_dilithium_level3_key.der bench_dilithium_level5_key.der include.amecc
bp256r1-key.der bp256r1-key.pem ca-secp256k1-cert.pem ca-secp256k1-key.pem client-bp256r1-cert.der client-bp256r1-cert.pem client-secp256k1-cert.der client-secp256k1-cert.pem genecc.sh include.am secp256k1-key.der secp256k1-key.pem secp256k1-param.pem secp256k1-privkey.der secp256k1-privkey.pem server-bp256r1-cert.der server-bp256r1-cert.pem server-secp256k1-cert.der server-secp256k1-cert.pem server2-secp256k1-cert.der server2-secp256k1-cert.pem wolfssl.cnf wolfssl_384.cnfed25519
ca-ed25519-key.der ca-ed25519-key.pem ca-ed25519-priv.der ca-ed25519-priv.pem ca-ed25519.der ca-ed25519.pem client-ed25519-key.der client-ed25519-key.pem client-ed25519-priv.der client-ed25519-priv.pem client-ed25519.der client-ed25519.pem eddsa-ed25519.der eddsa-ed25519.pem gen-ed25519-certs.sh gen-ed25519-keys.sh gen-ed25519.sh include.am root-ed25519-key.der root-ed25519-key.pem root-ed25519-priv.der root-ed25519-priv.pem root-ed25519.der root-ed25519.pem server-ed25519-cert.pem server-ed25519-key.der server-ed25519-key.pem server-ed25519-priv.der server-ed25519-priv.pem server-ed25519.der server-ed25519.pemed448
ca-ed448-key.der ca-ed448-key.pem ca-ed448-priv.der ca-ed448-priv.pem ca-ed448.der ca-ed448.pem client-ed448-key.der client-ed448-key.pem client-ed448-priv.der client-ed448-priv.pem client-ed448.der client-ed448.pem gen-ed448-certs.sh gen-ed448-keys.sh include.am root-ed448-key.der root-ed448-key.pem root-ed448-priv.der root-ed448-priv.pem root-ed448.der root-ed448.pem server-ed448-cert.pem server-ed448-key.der server-ed448-key.pem server-ed448-priv.der server-ed448-priv.pem server-ed448.der server-ed448.pemexternal
DigiCertGlobalRootCA.pem README.txt ca-digicert-ev.pem ca-globalsign-root.pem ca-google-root.pem ca_collection.pem include.amintermediate
ca_false_intermediate
gentestcert.sh int_ca.key server.key test_ca.key test_ca.pem test_int_not_cacert.pem test_sign_bynoca_srv.pem wolfssl_base.conf wolfssl_srv.conflms
bc_hss_L2_H5_W8_root.der bc_hss_L3_H5_W4_root.der bc_lms_chain_ca.der bc_lms_chain_leaf.der bc_lms_native_bc_root.der bc_lms_sha256_h10_w8_root.der bc_lms_sha256_h5_w4_root.der include.ammldsa
README.txt include.am mldsa44-cert.der mldsa44-cert.pem mldsa44-key.pem mldsa44_bare-priv.der mldsa44_bare-seed.der mldsa44_oqskeypair.der mldsa44_priv-only.der mldsa44_pub-spki.der mldsa44_seed-only.der mldsa44_seed-priv.der mldsa65-cert.der mldsa65-cert.pem mldsa65-key.pem mldsa65_bare-priv.der mldsa65_bare-seed.der mldsa65_oqskeypair.der mldsa65_priv-only.der mldsa65_pub-spki.der mldsa65_seed-only.der mldsa65_seed-priv.der mldsa87-cert.der mldsa87-cert.pem mldsa87-key.pem mldsa87_bare-priv.der mldsa87_bare-seed.der mldsa87_oqskeypair.der mldsa87_priv-only.der mldsa87_pub-spki.der mldsa87_seed-only.der mldsa87_seed-priv.derocsp
imposter-root-ca-cert.der imposter-root-ca-cert.pem imposter-root-ca-key.der imposter-root-ca-key.pem include.am index-ca-and-intermediate-cas.txt index-ca-and-intermediate-cas.txt.attr index-intermediate1-ca-issued-certs.txt index-intermediate1-ca-issued-certs.txt.attr index-intermediate2-ca-issued-certs.txt index-intermediate2-ca-issued-certs.txt.attr index-intermediate3-ca-issued-certs.txt index-intermediate3-ca-issued-certs.txt.attr intermediate1-ca-cert.der intermediate1-ca-cert.pem intermediate1-ca-key.der intermediate1-ca-key.pem intermediate2-ca-cert.der intermediate2-ca-cert.pem intermediate2-ca-key.der intermediate2-ca-key.pem intermediate3-ca-cert.der intermediate3-ca-cert.pem intermediate3-ca-key.der intermediate3-ca-key.pem ocsp-responder-cert.der ocsp-responder-cert.pem ocsp-responder-key.der ocsp-responder-key.pem openssl.cnf renewcerts-for-test.sh renewcerts.sh root-ca-cert.der root-ca-cert.pem root-ca-crl.pem root-ca-key.der root-ca-key.pem server1-cert.der server1-cert.pem server1-chain-noroot.pem server1-key.der server1-key.pem server2-cert.der server2-cert.pem server2-key.der server2-key.pem server3-cert.der server3-cert.pem server3-key.der server3-key.pem server4-cert.der server4-cert.pem server4-key.der server4-key.pem server5-cert.der server5-cert.pem server5-key.der server5-key.pem test-leaf-response.der test-multi-response.der test-response-nointern.der test-response-rsapss.der test-response.derp521
ca-p521-key.der ca-p521-key.pem ca-p521-priv.der ca-p521-priv.pem ca-p521.der ca-p521.pem client-p521-key.der client-p521-key.pem client-p521-priv.der client-p521-priv.pem client-p521.der client-p521.pem gen-p521-certs.sh gen-p521-keys.sh include.am root-p521-key.der root-p521-key.pem root-p521-priv.der root-p521-priv.pem root-p521.der root-p521.pem server-p521-cert.pem server-p521-key.der server-p521-key.pem server-p521-priv.der server-p521-priv.pem server-p521.der server-p521.pemrpk
client-cert-rpk.der client-ecc-cert-rpk.der include.am server-cert-rpk.der server-ecc-cert-rpk.derrsapss
ca-3072-rsapss-key.der ca-3072-rsapss-key.pem ca-3072-rsapss-priv.der ca-3072-rsapss-priv.pem ca-3072-rsapss.der ca-3072-rsapss.pem ca-rsapss-key.der ca-rsapss-key.pem ca-rsapss-priv.der ca-rsapss-priv.pem ca-rsapss.der ca-rsapss.pem client-3072-rsapss-key.der client-3072-rsapss-key.pem client-3072-rsapss-priv.der client-3072-rsapss-priv.pem client-3072-rsapss.der client-3072-rsapss.pem client-rsapss-key.der client-rsapss-key.pem client-rsapss-priv.der client-rsapss-priv.pem client-rsapss.der client-rsapss.pem gen-rsapss-keys.sh include.am renew-rsapss-certs.sh root-3072-rsapss-key.der root-3072-rsapss-key.pem root-3072-rsapss-priv.der root-3072-rsapss-priv.pem root-3072-rsapss.der root-3072-rsapss.pem root-rsapss-key.der root-rsapss-key.pem root-rsapss-priv.der root-rsapss-priv.pem root-rsapss.der root-rsapss.pem server-3072-rsapss-cert.pem server-3072-rsapss-key.der server-3072-rsapss-key.pem server-3072-rsapss-priv.der server-3072-rsapss-priv.pem server-3072-rsapss.der server-3072-rsapss.pem server-mix-rsapss-cert.pem server-rsapss-cert.pem server-rsapss-key.der server-rsapss-key.pem server-rsapss-priv.der server-rsapss-priv.pem server-rsapss.der server-rsapss.pemslhdsa
bench_slhdsa_sha2_128f_key.der bench_slhdsa_sha2_128s_key.der bench_slhdsa_sha2_192f_key.der bench_slhdsa_sha2_192s_key.der bench_slhdsa_sha2_256f_key.der bench_slhdsa_sha2_256s_key.der bench_slhdsa_shake128f_key.der bench_slhdsa_shake128s_key.der bench_slhdsa_shake192f_key.der bench_slhdsa_shake192s_key.der bench_slhdsa_shake256f_key.der bench_slhdsa_shake256s_key.der client-mldsa44-priv.pem client-mldsa44-sha2.der client-mldsa44-sha2.pem client-mldsa44-shake.der client-mldsa44-shake.pem gen-slhdsa-mldsa-certs.sh include.am root-slhdsa-sha2-128s-priv.der root-slhdsa-sha2-128s-priv.pem root-slhdsa-sha2-128s.der root-slhdsa-sha2-128s.pem root-slhdsa-shake-128s-priv.der root-slhdsa-shake-128s-priv.pem root-slhdsa-shake-128s.der root-slhdsa-shake-128s.pem server-mldsa44-priv.pem server-mldsa44-sha2.der server-mldsa44-sha2.pem server-mldsa44-shake.der server-mldsa44-shake.pemsm2
ca-sm2-key.der ca-sm2-key.pem ca-sm2-priv.der ca-sm2-priv.pem ca-sm2.der ca-sm2.pem client-sm2-key.der client-sm2-key.pem client-sm2-priv.der client-sm2-priv.pem client-sm2.der client-sm2.pem fix_sm2_spki.py gen-sm2-certs.sh gen-sm2-keys.sh include.am root-sm2-key.der root-sm2-key.pem root-sm2-priv.der root-sm2-priv.pem root-sm2.der root-sm2.pem self-sm2-cert.pem self-sm2-key.pem self-sm2-priv.pem server-sm2-cert.der server-sm2-cert.pem server-sm2-key.der server-sm2-key.pem server-sm2-priv.der server-sm2-priv.pem server-sm2.der server-sm2.pemstatickeys
dh-ffdhe2048-params.pem dh-ffdhe2048-pub.der dh-ffdhe2048-pub.pem dh-ffdhe2048.der dh-ffdhe2048.pem ecc-secp256r1.der ecc-secp256r1.pem gen-static.sh include.am x25519-pub.der x25519-pub.pem x25519.der x25519.pemtest
catalog.txt cert-bad-neg-int.der cert-bad-oid.der cert-bad-utf8.der cert-ext-ia.cfg cert-ext-ia.der cert-ext-ia.pem cert-ext-joi.cfg cert-ext-joi.der cert-ext-joi.pem cert-ext-mnc.der cert-ext-multiple.cfg cert-ext-multiple.der cert-ext-multiple.pem cert-ext-nc-combined.der cert-ext-nc-combined.pem cert-ext-nc.cfg cert-ext-nc.der cert-ext-nc.pem cert-ext-ncdns.der cert-ext-ncdns.pem cert-ext-ncip.der cert-ext-ncip.pem cert-ext-ncmixed.der cert-ext-ncmulti.der cert-ext-ncmulti.pem cert-ext-ncrid.der cert-ext-ncrid.pem cert-ext-nct.cfg cert-ext-nct.der cert-ext-nct.pem cert-ext-ndir-exc.cfg cert-ext-ndir-exc.der cert-ext-ndir-exc.pem cert-ext-ndir.cfg cert-ext-ndir.der cert-ext-ndir.pem cert-ext-ns.der cert-over-max-altnames.cfg cert-over-max-altnames.der cert-over-max-altnames.pem cert-over-max-nc.cfg cert-over-max-nc.der cert-over-max-nc.pem client-ecc-cert-ski.hex cn-ip-literal.der cn-ip-wildcard.der crit-cert.pem crit-key.pem dh1024.der dh1024.pem dh512.der dh512.pem digsigku.pem encrypteddata.msg gen-badsig.sh gen-ext-certs.sh gen-testcerts.sh include.am kari-keyid-cms.msg ktri-keyid-cms.msg ossl-trusted-cert.pem server-badaltname.der server-badaltname.pem server-badaltnull.der server-badaltnull.pem server-badcn.der server-badcn.pem server-badcnnull.der server-badcnnull.pem server-cert-ecc-badsig.der server-cert-ecc-badsig.pem server-cert-rsa-badsig.der server-cert-rsa-badsig.pem server-duplicate-policy.pem server-garbage.der server-garbage.pem server-goodalt.der server-goodalt.pem server-goodaltwild.der server-goodaltwild.pem server-goodcn.der server-goodcn.pem server-goodcnwild.der server-goodcnwild.pem server-localhost.der server-localhost.pem smime-test-canon.p7s smime-test-multipart-badsig.p7s smime-test-multipart.p7s smime-test.p7stest-pathlen
assemble-chains.sh chainA-ICA1-key.pem chainA-ICA1-pathlen0.pem chainA-assembled.pem chainA-entity-key.pem chainA-entity.pem chainB-ICA1-key.pem chainB-ICA1-pathlen0.pem chainB-ICA2-key.pem chainB-ICA2-pathlen1.pem chainB-assembled.pem chainB-entity-key.pem chainB-entity.pem chainC-ICA1-key.pem chainC-ICA1-pathlen1.pem chainC-assembled.pem chainC-entity-key.pem chainC-entity.pem chainD-ICA1-key.pem chainD-ICA1-pathlen127.pem chainD-assembled.pem chainD-entity-key.pem chainD-entity.pem chainE-ICA1-key.pem chainE-ICA1-pathlen128.pem chainE-assembled.pem chainE-entity-key.pem chainE-entity.pem chainF-ICA1-key.pem chainF-ICA1-pathlen1.pem chainF-ICA2-key.pem chainF-ICA2-pathlen0.pem chainF-assembled.pem chainF-entity-key.pem chainF-entity.pem chainG-ICA1-key.pem chainG-ICA1-pathlen0.pem chainG-ICA2-key.pem chainG-ICA2-pathlen1.pem chainG-ICA3-key.pem chainG-ICA3-pathlen99.pem chainG-ICA4-key.pem chainG-ICA4-pathlen5.pem chainG-ICA5-key.pem chainG-ICA5-pathlen20.pem chainG-ICA6-key.pem chainG-ICA6-pathlen10.pem chainG-ICA7-key.pem chainG-ICA7-pathlen100.pem chainG-assembled.pem chainG-entity-key.pem chainG-entity.pem chainH-ICA1-key.pem chainH-ICA1-pathlen0.pem chainH-ICA2-key.pem chainH-ICA2-pathlen2.pem chainH-ICA3-key.pem chainH-ICA3-pathlen2.pem chainH-ICA4-key.pem chainH-ICA4-pathlen2.pem chainH-assembled.pem chainH-entity-key.pem chainH-entity.pem chainI-ICA1-key.pem chainI-ICA1-no_pathlen.pem chainI-ICA2-key.pem chainI-ICA2-no_pathlen.pem chainI-ICA3-key.pem chainI-ICA3-pathlen2.pem chainI-assembled.pem chainI-entity-key.pem chainI-entity.pem chainJ-ICA1-key.pem chainJ-ICA1-no_pathlen.pem chainJ-ICA2-key.pem chainJ-ICA2-no_pathlen.pem chainJ-ICA3-key.pem chainJ-ICA3-no_pathlen.pem chainJ-ICA4-key.pem chainJ-ICA4-pathlen2.pem chainJ-assembled.pem chainJ-entity-key.pem chainJ-entity.pem include.am refreshkeys.shtest-serial0
ee_normal.pem ee_serial0.pem generate_certs.sh include.am intermediate_serial0.pem root_serial0.pem root_serial0_key.pem selfsigned_nonca_serial0.pemxmss
bc_xmss_chain_ca.der bc_xmss_chain_leaf.der bc_xmss_sha2_10_256_root.der bc_xmss_sha2_16_256_root.der bc_xmssmt_sha2_20_2_256_root.der bc_xmssmt_sha2_20_4_256_root.der bc_xmssmt_sha2_40_8_256_root.der include.amcmake
Config.cmake.in README.md config.in functions.cmake include.am options.h.in wolfssl-config-version.cmake.in wolfssl-targets.cmake.indebian
changelog.in control.in copyright include.am libwolfssl-dev.install libwolfssl.install rules.indoc
dox_comments
header_files
aes.h arc4.h ascon.h asn.h asn_public.h blake2.h bn.h camellia.h chacha.h chacha20_poly1305.h cmac.h coding.h compress.h cryptocb.h curve25519.h curve448.h des3.h dh.h doxygen_groups.h doxygen_pages.h dsa.h ecc.h eccsi.h ed25519.h ed448.h error-crypt.h evp.h hash.h hmac.h iotsafe.h kdf.h logging.h md2.h md4.h md5.h memory.h ocsp.h pem.h pkcs11.h pkcs7.h poly1305.h psa.h puf.h pwdbased.h quic.h random.h ripemd.h rsa.h sakke.h sha.h sha256.h sha3.h sha512.h signature.h siphash.h srp.h ssl.h tfm.h types.h wc_encrypt.h wc_port.h wc_she.h wc_slhdsa.h wolfio.hheader_files-ja
aes.h arc4.h ascon.h asn.h asn_public.h blake2.h bn.h camellia.h chacha.h chacha20_poly1305.h cmac.h coding.h compress.h cryptocb.h curve25519.h curve448.h des3.h dh.h doxygen_groups.h doxygen_pages.h dsa.h ecc.h eccsi.h ed25519.h ed448.h error-crypt.h evp.h hash.h hmac.h iotsafe.h kdf.h logging.h md2.h md4.h md5.h memory.h ocsp.h pem.h pkcs11.h pkcs7.h poly1305.h psa.h pwdbased.h quic.h random.h ripemd.h rsa.h sakke.h sha.h sha256.h sha3.h sha512.h signature.h siphash.h srp.h ssl.h tfm.h types.h wc_encrypt.h wc_port.h wolfio.hexamples
async
Makefile README.md async_client.c async_server.c async_tls.c async_tls.h include.am user_settings.hconfigs
README.md include.am user_settings_EBSnet.h user_settings_all.h user_settings_arduino.h user_settings_baremetal.h user_settings_ca.h user_settings_curve25519nonblock.h user_settings_dtls13.h user_settings_eccnonblock.h user_settings_espressif.h user_settings_fipsv2.h user_settings_fipsv5.h user_settings_min_ecc.h user_settings_openssl_compat.h user_settings_pkcs7.h user_settings_platformio.h user_settings_pq.h user_settings_rsa_only.h user_settings_stm32.h user_settings_template.h user_settings_tls12.h user_settings_tls13.h user_settings_wolfboot_keytools.h user_settings_wolfssh.h user_settings_wolftpm.hechoclient
echoclient.c echoclient.h echoclient.sln echoclient.vcproj echoclient.vcxproj include.am quitlinuxkm
Kbuild Makefile README.md get_thread_size.c include.am linuxkm-fips-hash-wrapper.sh linuxkm-fips-hash.c linuxkm_memory.c linuxkm_memory.h linuxkm_wc_port.h lkcapi_aes_glue.c lkcapi_dh_glue.c lkcapi_ecdh_glue.c lkcapi_ecdsa_glue.c lkcapi_glue.c lkcapi_rsa_glue.c lkcapi_sha_glue.c module_exports.c.template module_hooks.c pie_redirect_table.c wolfcrypt.lds x86_vector_register_glue.cm4
ax_add_am_macro.m4 ax_am_jobserver.m4 ax_am_macros.m4 ax_append_compile_flags.m4 ax_append_flag.m4 ax_append_link_flags.m4 ax_append_to_file.m4 ax_atomic.m4 ax_bsdkm.m4 ax_check_compile_flag.m4 ax_check_link_flag.m4 ax_compiler_version.m4 ax_count_cpus.m4 ax_create_generic_config.m4 ax_debug.m4 ax_file_escapes.m4 ax_harden_compiler_flags.m4 ax_linuxkm.m4 ax_print_to_file.m4 ax_pthread.m4 ax_require_defined.m4 ax_tls.m4 ax_vcs_checkout.m4 hexversion.m4 lib_socket_nsl.m4 visibility.m4mqx
wolfcrypt_benchmark
ReferencedRSESystems.xml wolfcrypt_benchmark_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfcrypt_benchmark_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchwolfcrypt_test
ReferencedRSESystems.xml wolfcrypt_test_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfcrypt_test_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchwolfssl_client
ReferencedRSESystems.xml wolfssl_client_twrk70f120m_Int_Flash_DDRData_Debug_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_DDRData_Release_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_JTrace.jlink wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_JTrace.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Debug_PnE_U-MultiLink.launch wolfssl_client_twrk70f120m_Int_Flash_SramData_Release_PnE_U-MultiLink.launchscripts
aria-cmake-build-test.sh asn1_oid_sum.pl benchmark.test benchmark_compare.sh cleanup_testfiles.sh crl-gen-openssl.test crl-revoked.test dertoc.pl dtls.test dtlscid.test external.test google.test include.am makedistsmall.sh memtest.sh ocsp-responder-openssl-interop.test ocsp-stapling-with-ca-as-responder.test ocsp-stapling-with-wolfssl-responder.test ocsp-stapling.test ocsp-stapling2.test ocsp-stapling_tls13multi.test ocsp.test openssl.test openssl_srtp.test pem.test ping.test pkcallbacks.test psk.test resume.test rsapss.test sniffer-gen.sh sniffer-ipv6.pcap sniffer-static-rsa.pcap sniffer-testsuite.test sniffer-tls12-keylog.out sniffer-tls12-keylog.pcap sniffer-tls12-keylog.sslkeylog sniffer-tls13-dh-resume.pcap sniffer-tls13-dh.pcap sniffer-tls13-ecc-resume.pcap sniffer-tls13-ecc.pcap sniffer-tls13-hrr.pcap sniffer-tls13-keylog.out sniffer-tls13-keylog.pcap sniffer-tls13-keylog.sslkeylog sniffer-tls13-x25519-resume.pcap sniffer-tls13-x25519.pcap stm32l4-v4_0_1_build.sh tls13.test trusted_peer.test unit.test.in user_settings_asm.shsrc
bio.c conf.c crl.c dtls.c dtls13.c include.am internal.c keys.c ocsp.c pk.c pk_ec.c pk_rsa.c quic.c sniffer.c ssl.c ssl_api_cert.c ssl_api_crl_ocsp.c ssl_api_pk.c ssl_asn1.c ssl_bn.c ssl_certman.c ssl_crypto.c ssl_ech.c ssl_load.c ssl_misc.c ssl_p7p12.c ssl_sess.c ssl_sk.c tls.c tls13.c wolfio.c x509.c x509_str.ctests
api
api.h api_decl.h create_ocsp_test_blobs.py include.am test_aes.c test_aes.h test_arc4.c test_arc4.h test_ascon.c test_ascon.h test_ascon_kats.h test_asn.c test_asn.h test_blake2.c test_blake2.h test_camellia.c test_camellia.h test_certman.c test_certman.h test_chacha.c test_chacha.h test_chacha20_poly1305.c test_chacha20_poly1305.h test_cmac.c test_cmac.h test_curve25519.c test_curve25519.h test_curve448.c test_curve448.h test_des3.c test_des3.h test_dh.c test_dh.h test_digest.h test_dsa.c test_dsa.h test_dtls.c test_dtls.h test_ecc.c test_ecc.h test_ed25519.c test_ed25519.h test_ed448.c test_ed448.h test_evp.c test_evp.h test_evp_cipher.c test_evp_cipher.h test_evp_digest.c test_evp_digest.h test_evp_pkey.c test_evp_pkey.h test_hash.c test_hash.h test_hmac.c test_hmac.h test_md2.c test_md2.h test_md4.c test_md4.h test_md5.c test_md5.h test_mldsa.c test_mldsa.h test_mlkem.c test_mlkem.h test_ocsp.c test_ocsp.h test_ocsp_test_blobs.h test_ossl_asn1.c test_ossl_asn1.h test_ossl_bio.c test_ossl_bio.h test_ossl_bn.c test_ossl_bn.h test_ossl_cipher.c test_ossl_cipher.h test_ossl_dgst.c test_ossl_dgst.h test_ossl_dh.c test_ossl_dh.h test_ossl_dsa.c test_ossl_dsa.h test_ossl_ec.c test_ossl_ec.h test_ossl_ecx.c test_ossl_ecx.h test_ossl_mac.c test_ossl_mac.h test_ossl_obj.c test_ossl_obj.h test_ossl_p7p12.c test_ossl_p7p12.h test_ossl_pem.c test_ossl_pem.h test_ossl_rand.c test_ossl_rand.h test_ossl_rsa.c test_ossl_rsa.h test_ossl_sk.c test_ossl_sk.h test_ossl_x509.c test_ossl_x509.h test_ossl_x509_acert.c test_ossl_x509_acert.h test_ossl_x509_crypto.c test_ossl_x509_crypto.h test_ossl_x509_ext.c test_ossl_x509_ext.h test_ossl_x509_info.c test_ossl_x509_info.h test_ossl_x509_io.c test_ossl_x509_io.h test_ossl_x509_lu.c test_ossl_x509_lu.h test_ossl_x509_name.c test_ossl_x509_name.h test_ossl_x509_pk.c test_ossl_x509_pk.h test_ossl_x509_str.c test_ossl_x509_str.h test_ossl_x509_vp.c test_ossl_x509_vp.h test_pkcs12.c test_pkcs12.h test_pkcs7.c test_pkcs7.h test_poly1305.c test_poly1305.h test_random.c test_random.h test_rc2.c test_rc2.h test_ripemd.c test_ripemd.h test_rsa.c test_rsa.h test_sha.c test_sha.h test_sha256.c test_sha256.h test_sha3.c test_sha3.h test_sha512.c test_sha512.h test_she.c test_she.h test_signature.c test_signature.h test_slhdsa.c test_slhdsa.h test_sm2.c test_sm2.h test_sm3.c test_sm3.h test_sm4.c test_sm4.h test_tls.c test_tls.h test_tls13.c test_tls13.h test_tls_ext.c test_tls_ext.h test_wc_encrypt.c test_wc_encrypt.h test_wolfmath.c test_wolfmath.h test_x509.c test_x509.hwolfcrypt
benchmark
README.md benchmark-VS2022.sln benchmark-VS2022.vcxproj benchmark-VS2022.vcxproj.user benchmark.c benchmark.h benchmark.sln benchmark.vcproj benchmark.vcxproj include.amsrc
port
Espressif
esp_crt_bundle
README.md cacrt_all.pem cacrt_deprecated.pem cacrt_local.pem esp_crt_bundle.c gen_crt_bundle.py pio_install_cryptography.pyRenesas
README.md renesas_common.c renesas_fspsm_aes.c renesas_fspsm_rsa.c renesas_fspsm_sha.c renesas_fspsm_util.c renesas_rx64_hw_sha.c renesas_rx64_hw_util.c renesas_tsip_aes.c renesas_tsip_rsa.c renesas_tsip_sha.c renesas_tsip_util.carm
armv8-32-aes-asm.S armv8-32-aes-asm_c.c armv8-32-chacha-asm.S armv8-32-chacha-asm_c.c armv8-32-curve25519.S armv8-32-curve25519_c.c armv8-32-mlkem-asm.S armv8-32-mlkem-asm_c.c armv8-32-poly1305-asm.S armv8-32-poly1305-asm_c.c armv8-32-sha256-asm.S armv8-32-sha256-asm_c.c armv8-32-sha3-asm.S armv8-32-sha3-asm_c.c armv8-32-sha512-asm.S armv8-32-sha512-asm_c.c armv8-aes-asm.S armv8-aes-asm_c.c armv8-aes.c armv8-chacha-asm.S armv8-chacha-asm_c.c armv8-curve25519.S armv8-curve25519_c.c armv8-mlkem-asm.S armv8-mlkem-asm_c.c armv8-poly1305-asm.S armv8-poly1305-asm_c.c armv8-sha256-asm.S armv8-sha256-asm_c.c armv8-sha256.c armv8-sha3-asm.S armv8-sha3-asm_c.c armv8-sha512-asm.S armv8-sha512-asm_c.c armv8-sha512.c cryptoCell.c cryptoCellHash.c thumb2-aes-asm.S thumb2-aes-asm_c.c thumb2-chacha-asm.S thumb2-chacha-asm_c.c thumb2-curve25519.S thumb2-curve25519_c.c thumb2-mlkem-asm.S thumb2-mlkem-asm_c.c thumb2-poly1305-asm.S thumb2-poly1305-asm_c.c thumb2-sha256-asm.S thumb2-sha256-asm_c.c thumb2-sha3-asm.S thumb2-sha3-asm_c.c thumb2-sha512-asm.S thumb2-sha512-asm_c.ccaam
README.md caam_aes.c caam_doc.pdf caam_driver.c caam_error.c caam_integrity.c caam_qnx.c caam_sha.c wolfcaam_aes.c wolfcaam_cmac.c wolfcaam_ecdsa.c wolfcaam_fsl_nxp.c wolfcaam_hash.c wolfcaam_hmac.c wolfcaam_init.c wolfcaam_qnx.c wolfcaam_rsa.c wolfcaam_seco.c wolfcaam_x25519.cdevcrypto
README.md devcrypto_aes.c devcrypto_ecdsa.c devcrypto_hash.c devcrypto_hmac.c devcrypto_rsa.c devcrypto_x25519.c wc_devcrypto.criscv
riscv-64-aes.c riscv-64-chacha.c riscv-64-poly1305.c riscv-64-sha256.c riscv-64-sha3.c riscv-64-sha512.cwolfssl
openssl
aes.h asn1.h asn1t.h bio.h bn.h buffer.h camellia.h cmac.h cms.h compat_types.h conf.h crypto.h des.h dh.h dsa.h ec.h ec25519.h ec448.h ecdh.h ecdsa.h ed25519.h ed448.h engine.h err.h evp.h fips_rand.h hmac.h include.am kdf.h lhash.h md4.h md5.h modes.h obj_mac.h objects.h ocsp.h opensslconf.h opensslv.h ossl_typ.h pem.h pkcs12.h pkcs7.h rand.h rc4.h ripemd.h rsa.h safestack.h sha.h sha3.h srp.h ssl.h ssl23.h stack.h tls1.h txt_db.h ui.h x509.h x509_vfy.h x509v3.hwolfcrypt
port
Renesas
renesas-fspsm-crypt.h renesas-fspsm-types.h renesas-rx64-hw-crypt.h renesas-tsip-crypt.h renesas_cmn.h renesas_fspsm_internal.h renesas_sync.h renesas_tsip_internal.h renesas_tsip_types.hcaam
caam_driver.h caam_error.h caam_qnx.h wolfcaam.h wolfcaam_aes.h wolfcaam_cmac.h wolfcaam_ecdsa.h wolfcaam_fsl_nxp.h wolfcaam_hash.h wolfcaam_qnx.h wolfcaam_rsa.h wolfcaam_seco.h wolfcaam_sha.h wolfcaam_x25519.hwrapper
Ada
examples
src
aes_verify_main.adb rsa_verify_main.adb sha256_main.adb spark_sockets.adb spark_sockets.ads spark_terminal.adb spark_terminal.ads tls_client.adb tls_client.ads tls_client_main.adb tls_server.adb tls_server.ads tls_server_main.adbtests
src
aes_bindings_tests.adb aes_bindings_tests.ads rsa_verify_bindings_tests.adb rsa_verify_bindings_tests.ads sha256_bindings_tests.adb sha256_bindings_tests.ads tests.adbCSharp
wolfSSL-Example-IOCallbacks
App.config wolfSSL-Example-IOCallbacks.cs wolfSSL-Example-IOCallbacks.csprojwolfSSL-TLS-ServerThreaded
App.config wolfSSL-TLS-ServerThreaded.cs wolfSSL-TLS-ServerThreaded.csprojrust
wolfssl-wolfcrypt
src
aes.rs blake2.rs chacha20_poly1305.rs cmac.rs cmac_mac.rs curve25519.rs dh.rs dilithium.rs ecc.rs ecdsa.rs ed25519.rs ed448.rs fips.rs hkdf.rs hmac.rs hmac_mac.rs kdf.rs lib.rs lms.rs mlkem.rs mlkem_kem.rs pbkdf2_password_hash.rs prf.rs random.rs rsa.rs rsa_pkcs1v15.rs sha.rs sha_digest.rs sys.rstests
test_aes.rs test_blake2.rs test_chacha20_poly1305.rs test_cmac.rs test_cmac_mac.rs test_curve25519.rs test_dh.rs test_dilithium.rs test_ecc.rs test_ecdsa.rs test_ed25519.rs test_ed448.rs test_hkdf.rs test_hmac.rs test_hmac_mac.rs test_kdf.rs test_lms.rs test_mlkem.rs test_mlkem_kem.rs test_pbkdf2_password_hash.rs test_prf.rs test_random.rs test_rsa.rs test_rsa_pkcs1v15.rs test_sha.rs test_sha_digest.rs test_wolfcrypt.rszephyr
samples
wolfssl_benchmark
CMakeLists.txt README install_test.sh prj.conf sample.yaml zephyr_legacy.conf zephyr_v4.1.confwolfssl_test
CMakeLists.txt README install_test.sh prj-no-malloc.conf prj.conf sample.yaml zephyr_legacy.conf zephyr_v4.1.conf
luajit/src/vm_arm64.dasc
raw
1|// Low-level VM code for ARM64 CPUs.
2|// Bytecode interpreter, fast functions and helper functions.
3|// Copyright (C) 2005-2026 Mike Pall. See Copyright Notice in luajit.h
4|
5|.arch arm64
6|.section code_op, code_sub
7|
8|.actionlist build_actionlist
9|.globals GLOB_
10|.globalnames globnames
11|.externnames extnames
12|
13|// Note: The ragged indentation of the instructions is intentional.
14|// The starting columns indicate data dependencies.
15|
16|//-----------------------------------------------------------------------
17|
18|// ARM64 registers and the AAPCS64 ABI 1.0 at a glance:
19|//
20|// x0-x17 temp, x19-x28 callee-saved, x29 fp, x30 lr
21|// x18 is reserved on most platforms. Don't use it, save it or restore it.
22|// x31 doesn't exist. Register number 31 either means xzr/wzr (zero) or sp,
23|// depending on the instruction.
24|// v0-v7 temp, v8-v15 callee-saved (only d8-d15 preserved), v16-v31 temp
25|//
26|// x0-x7/v0-v7 hold parameters and results.
27|
28|// Fixed register assignments for the interpreter.
29|
30|// The following must be C callee-save.
31|.define BASE, x19 // Base of current Lua stack frame.
32|.define KBASE, x20 // Constants of current Lua function.
33|.define PC, x21 // Next PC.
34|.define GLREG, x22 // Global state.
35|.define LREG, x23 // Register holding lua_State (also in SAVE_L).
36|.define TISNUM, x24 // Constant LJ_TISNUM << 47.
37|.define TISNUMhi, x25 // Constant LJ_TISNUM << 15.
38|.define TISNIL, x26 // Constant -1LL.
39|.define fp, x29 // Yes, we have to maintain a frame pointer.
40|
41|.define ST_INTERP, w26 // Constant -1.
42|
43|// The following temporaries are not saved across C calls, except for RA/RC.
44|.define RA, x27
45|.define RC, x28
46|.define RB, x17
47|.define RAw, w27
48|.define RCw, w28
49|.define RBw, w17
50|.define INS, x16
51|.define INSw, w16
52|.define ITYPE, x15
53|.define TMP0, x8
54|.define TMP1, x9
55|.define TMP2, x10
56|.define TMP3, x11
57|.define TMP0w, w8
58|.define TMP1w, w9
59|.define TMP2w, w10
60|.define TMP3w, w11
61|
62|// Calling conventions. Also used as temporaries.
63|.define CARG1, x0
64|.define CARG2, x1
65|.define CARG3, x2
66|.define CARG4, x3
67|.define CARG5, x4
68|.define CARG1w, w0
69|.define CARG2w, w1
70|.define CARG3w, w2
71|.define CARG4w, w3
72|.define CARG5w, w4
73|
74|.define FARG1, d0
75|.define FARG2, d1
76|
77|.define CRET1, x0
78|.define CRET1w, w0
79|
80|//-----------------------------------------------------------------------
81|
82|// ARM64e pointer authentication codes (PAC).
83|.if PAUTH
84|.macro sp_auth; pacibsp; .endmacro
85|.macro br_auth, reg; braaz reg; .endmacro
86|.macro blr_auth, reg; blraaz reg; .endmacro
87|.macro ret_auth; retab; .endmacro
88|.else
89|.macro sp_auth; .endmacro
90|.macro br_auth, reg; br reg; .endmacro
91|.macro blr_auth, reg; blr reg; .endmacro
92|.macro ret_auth; ret; .endmacro
93|.endif
94|
95|// ARM64 branch target identification (BTI).
96|.if BRANCH_TRACK
97|.macro bti_jump; bti j; .endmacro
98|.macro bti_call; bti c; .endmacro
99|.macro bti_tailcall; bti jc; .endmacro
100|.else
101|.macro bti_jump; .endmacro
102|.macro bti_call; .endmacro
103|.macro bti_tailcall; .endmacro
104|.endif
105|
106|//-----------------------------------------------------------------------
107|
108|// Stack layout while in interpreter. Must match with lj_frame.h.
109|
110|.define CFRAME_SPACE, 208
111|//----- 16 byte aligned, <-- sp entering interpreter
112|.define SAVE_FP_LR_, 192
113|.define SAVE_GPR_, 112 // 112+10*8: 64 bit GPR saves
114|.define SAVE_FPR_, 48 // 48+8*8: 64 bit FPR saves
115|// Unused [sp, #44] // 32 bit values
116|.define SAVE_NRES, [sp, #40]
117|.define SAVE_ERRF, [sp, #36]
118|.define SAVE_MULTRES, [sp, #32]
119|.define TMPD, [sp, #24] // 64 bit values
120|.define SAVE_L, [sp, #16]
121|.define SAVE_PC, [sp, #8]
122|.define SAVE_CFRAME, [sp, #0]
123|//----- 16 byte aligned, <-- sp while in interpreter.
124|
125|.define TMPDofs, #24
126|
127|.if WIN
128|// Windows unwind data is suited to r1 stored first.
129|.macro stp_unwind, r1, r2, where
130| stp r1, r2, where
131|.endmacro
132|.macro ldp_unwind, r1, r2, where
133| ldp r1, r2, where
134|.endmacro
135|.macro ldp_unwind, r1, r2, where, post_index
136| ldp r1, r2, where, post_index
137|.endmacro
138|.else
139|// Otherwise store r2 first for compact unwind info (OSX).
140|.macro stp_unwind, r1, r2, where
141| stp r2, r1, where
142|.endmacro
143|.macro ldp_unwind, r1, r2, where
144| ldp r2, r1, where
145|.endmacro
146|.macro ldp_unwind, r1, r2, where, post_index
147| ldp r2, r1, where, post_index
148|.endmacro
149|.endif
150|
151|.macro save_, gpr1, gpr2, fpr1, fpr2
152| stp_unwind d..fpr1, d..fpr2, [sp, # SAVE_FPR_+(14-fpr1)*8]
153| stp_unwind x..gpr1, x..gpr2, [sp, # SAVE_GPR_+(27-gpr1)*8]
154|.endmacro
155|.macro rest_, gpr1, gpr2, fpr1, fpr2
156| ldp_unwind d..fpr1, d..fpr2, [sp, # SAVE_FPR_+(14-fpr1)*8]
157| ldp_unwind x..gpr1, x..gpr2, [sp, # SAVE_GPR_+(27-gpr1)*8]
158|.endmacro
159|
160|.macro saveregs
161| sp_auth
162| sub sp, sp, # CFRAME_SPACE
163| stp fp, lr, [sp, # SAVE_FP_LR_]
164| add fp, sp, # SAVE_FP_LR_
165| stp_unwind x19, x20, [sp, # SAVE_GPR_+(27-19)*8]
166| save_ 21, 22, 8, 9
167| save_ 23, 24, 10, 11
168| save_ 25, 26, 12, 13
169| save_ 27, 28, 14, 15
170|.endmacro
171|.macro restoreregs
172| ldp_unwind x19, x20, [sp, # SAVE_GPR_+(27-19)*8]
173| rest_ 21, 22, 8, 9
174| rest_ 23, 24, 10, 11
175| rest_ 25, 26, 12, 13
176| rest_ 27, 28, 14, 15
177| ldp fp, lr, [sp, # SAVE_FP_LR_]
178| add sp, sp, # CFRAME_SPACE
179|.endmacro
180|
181|// Type definitions. Some of these are only used for documentation.
182|.type L, lua_State, LREG
183|.type GL, global_State, GLREG
184|.type TVALUE, TValue
185|.type GCOBJ, GCobj
186|.type STR, GCstr
187|.type TAB, GCtab
188|.type LFUNC, GCfuncL
189|.type CFUNC, GCfuncC
190|.type PROTO, GCproto
191|.type UPVAL, GCupval
192|.type NODE, Node
193|.type NARGS8, int
194|.type TRACE, GCtrace
195|.type SBUF, SBuf
196|
197|//-----------------------------------------------------------------------
198|
199|// Trap for not-yet-implemented parts.
200|.macro NYI; brk; .endmacro
201|
202|//-----------------------------------------------------------------------
203|
204|// Access to frame relative to BASE.
205|.define FRAME_FUNC, #-16
206|.define FRAME_PC, #-8
207|
208|// Endian-specific defines.
209|.if ENDIAN_LE
210|.define LO, 0
211|.define OFS_RD, 2
212|.define OFS_RB, 3
213|.define OFS_RA, 1
214|.define OFS_OP, 0
215|.else
216|.define LO, 4
217|.define OFS_RD, 0
218|.define OFS_RB, 0
219|.define OFS_RA, 2
220|.define OFS_OP, 3
221|.endif
222|
223|.macro decode_RA, dst, ins; ubfx dst, ins, #8, #8; .endmacro
224|.macro decode_RB, dst, ins; ubfx dst, ins, #24, #8; .endmacro
225|.macro decode_RC, dst, ins; ubfx dst, ins, #16, #8; .endmacro
226|.macro decode_RD, dst, ins; ubfx dst, ins, #16, #16; .endmacro
227|.macro decode_RC8RD, dst, src; ubfiz dst, src, #3, #8; .endmacro
228|
229|// Instruction decode+dispatch.
230|.macro ins_NEXT
231| ldr INSw, [PC], #4
232| add TMP1, GL, INS, uxtb #3
233| decode_RA RA, INS
234| ldr TMP0, [TMP1, #GG_G2DISP]
235| decode_RD RC, INS
236| br_auth TMP0
237|.endmacro
238|
239|// Instruction footer.
240|.if 1
241| // Replicated dispatch. Less unpredictable branches, but higher I-Cache use.
242| .define ins_next, ins_NEXT
243| .define ins_next_, ins_NEXT
244|.else
245| // Common dispatch. Lower I-Cache use, only one (very) unpredictable branch.
246| // Affects only certain kinds of benchmarks (and only with -j off).
247| .macro ins_next
248| b ->ins_next
249| .endmacro
250| .macro ins_next_
251| ->ins_next:
252| ins_NEXT
253| .endmacro
254|.endif
255|
256|// Call decode and dispatch.
257|.macro ins_callt
258| // BASE = new base, CARG3 = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
259| ldr PC, LFUNC:CARG3->pc
260| ldr INSw, [PC], #4
261| add TMP1, GL, INS, uxtb #3
262| decode_RA RA, INS
263| ldr TMP0, [TMP1, #GG_G2DISP]
264| add RA, BASE, RA, lsl #3
265| br_auth TMP0
266|.endmacro
267|
268|.macro ins_call
269| // BASE = new base, CARG3 = LFUNC/CFUNC, RC = nargs*8, PC = caller PC
270| str PC, [BASE, FRAME_PC]
271| ins_callt
272|.endmacro
273|
274|//-----------------------------------------------------------------------
275|
276|// Macros to check the TValue type and extract the GCobj. Branch on failure.
277|.macro checktp, reg, tp, target
278| asr ITYPE, reg, #47
279| cmn ITYPE, #-tp
280| and reg, reg, #LJ_GCVMASK
281| bne target
282|.endmacro
283|.macro checktp, dst, reg, tp, target
284| asr ITYPE, reg, #47
285| cmn ITYPE, #-tp
286| and dst, reg, #LJ_GCVMASK
287| bne target
288|.endmacro
289|.macro checkstr, reg, target; checktp reg, LJ_TSTR, target; .endmacro
290|.macro checktab, reg, target; checktp reg, LJ_TTAB, target; .endmacro
291|.macro checkfunc, reg, target; checktp reg, LJ_TFUNC, target; .endmacro
292|.macro checkint, reg, target
293| cmp TISNUMhi, reg, lsr #32
294| bne target
295|.endmacro
296|.macro checknum, reg, target
297| cmp TISNUMhi, reg, lsr #32
298| bls target
299|.endmacro
300|.macro checknumber, reg, target
301| cmp TISNUMhi, reg, lsr #32
302| blo target
303|.endmacro
304|
305|.macro init_constants
306| movn TISNIL, #0
307| movz TISNUM, #(LJ_TISNUM>>1)&0xffff, lsl #48
308| movz TISNUMhi, #(LJ_TISNUM>>1)&0xffff, lsl #16
309|.endmacro
310|
311|.macro mov_false, reg; movn reg, #0x8000, lsl #32; .endmacro
312|.macro mov_true, reg; movn reg, #0x0001, lsl #48; .endmacro
313|.macro mov_nil, reg; mov reg, TISNIL; .endmacro
314|.macro cmp_nil, reg; cmp reg, TISNIL; .endmacro
315|.macro add_TISNUM, dst, src; add dst, src, TISNUM; .endmacro
316|
317#define GL_J(field) (GG_G2J + (int)offsetof(jit_State, field))
318|
319#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
320|
321|.macro hotcheck, delta
322| lsr CARG1, PC, #1
323| and CARG1, CARG1, #126
324| add CARG1, CARG1, #GG_G2DISP+GG_DISP2HOT
325| ldrh CARG2w, [GL, CARG1]
326| subs CARG2, CARG2, #delta
327| strh CARG2w, [GL, CARG1]
328|.endmacro
329|
330|.macro hotloop
331| hotcheck HOTCOUNT_LOOP
332| blo ->vm_hotloop
333|.endmacro
334|
335|.macro hotcall
336| hotcheck HOTCOUNT_CALL
337| blo ->vm_hotcall
338|.endmacro
339|
340|// Set current VM state.
341|.macro mv_vmstate, reg, st; movn reg, #LJ_VMST_..st; .endmacro
342|.macro st_vmstate, reg; str reg, GL->vmstate; .endmacro
343|
344|// Move table write barrier back. Overwrites mark and tmp.
345|.macro barrierback, tab, mark, tmp
346| ldr tmp, GL->gc.grayagain
347| and mark, mark, #~LJ_GC_BLACK // black2gray(tab)
348| str tab, GL->gc.grayagain
349| strb mark, tab->marked
350| str tmp, tab->gclist
351|.endmacro
352|
353|//-----------------------------------------------------------------------
354
355#if !LJ_DUALNUM
356#error "Only dual-number mode supported for ARM64 target"
357#endif
358
359/* Generate subroutines used by opcodes and other parts of the VM. */
360/* The .code_sub section should be last to help static branch prediction. */
361static void build_subroutines(BuildCtx *ctx)
362{
363 |.code_sub
364 |
365 |//-----------------------------------------------------------------------
366 |//-- Return handling ----------------------------------------------------
367 |//-----------------------------------------------------------------------
368 |
369 |->vm_returnp:
370 | // See vm_return. Also: RB = previous base.
371 | tbz PC, #2, ->cont_dispatch // (PC & FRAME_P) == 0?
372 |
373 | // Return from pcall or xpcall fast func.
374 | ldr PC, [RB, FRAME_PC] // Fetch PC of previous frame.
375 | mov_true TMP0
376 | mov BASE, RB
377 | // Prepending may overwrite the pcall frame, so do it at the end.
378 | str TMP0, [RA, #-8]! // Prepend true to results.
379 |
380 |->vm_returnc:
381 | adds RC, RC, #8 // RC = (nresults+1)*8.
382 | mov CRET1, #LUA_YIELD
383 | beq ->vm_unwind_c_eh
384 | str RCw, SAVE_MULTRES
385 | ands CARG1, PC, #FRAME_TYPE
386 | beq ->BC_RET_Z // Handle regular return to Lua.
387 |
388 |->vm_return:
389 | // BASE = base, RA = resultptr, RC/MULTRES = (nresults+1)*8, PC = return
390 | // CARG1 = PC & FRAME_TYPE
391 | and RB, PC, #~FRAME_TYPEP
392 | cmp CARG1, #FRAME_C
393 | sub RB, BASE, RB // RB = previous base.
394 | bne ->vm_returnp
395 |
396 | str RB, L->base
397 | ldrsw CARG2, SAVE_NRES // CARG2 = nresults+1.
398 | mv_vmstate TMP0w, C
399 | sub BASE, BASE, #16
400 | subs TMP2, RC, #8
401 | st_vmstate TMP0w
402 | beq >2
403 |1:
404 | subs TMP2, TMP2, #8
405 | ldr TMP0, [RA], #8
406 | str TMP0, [BASE], #8
407 | bne <1
408 |2:
409 | cmp RC, CARG2, lsl #3 // More/less results wanted?
410 | bne >6
411 |3:
412 | str BASE, L->top // Store new top.
413 |
414 |->vm_leave_cp:
415 | ldr RC, SAVE_CFRAME // Restore previous C frame.
416 | mov CRET1, #0 // Ok return status for vm_pcall.
417 | str RC, L->cframe
418 |
419 |->vm_leave_unw:
420 | restoreregs
421 | ret_auth
422 |
423 |6:
424 | bgt >7 // Less results wanted?
425 | // More results wanted. Check stack size and fill up results with nil.
426 | ldr CARG3, L->maxstack
427 | cmp BASE, CARG3
428 | bhs >8
429 | str TISNIL, [BASE], #8
430 | add RC, RC, #8
431 | b <2
432 |
433 |7: // Less results wanted.
434 | cbz CARG2, <3 // LUA_MULTRET+1 case?
435 | sub CARG1, RC, CARG2, lsl #3
436 | sub BASE, BASE, CARG1 // Shrink top.
437 | b <3
438 |
439 |8: // Corner case: need to grow stack for filling up results.
440 | // This can happen if:
441 | // - A C function grows the stack (a lot).
442 | // - The GC shrinks the stack in between.
443 | // - A return back from a lua_call() with (high) nresults adjustment.
444 | str BASE, L->top // Save current top held in BASE (yes).
445 | mov CARG1, L
446 | bl extern lj_state_growstack // (lua_State *L, int n)
447 | ldr BASE, L->top // Need the (realloced) L->top in BASE.
448 | ldrsw CARG2, SAVE_NRES
449 | b <2
450 |
451 |->vm_unwind_c: // Unwind C stack, return from vm_pcall.
452 | // (void *cframe, int errcode)
453 | bti_tailcall
454 | add fp, CARG1, # SAVE_FP_LR_
455 | mov sp, CARG1
456 | mov CRET1, CARG2
457 | ldr L, SAVE_L
458 | ldr GL, L->glref
459 |->vm_unwind_c_eh: // Landing pad for external unwinder.
460 | bti_tailcall
461 | mv_vmstate TMP0w, C
462 | st_vmstate TMP0w
463 | b ->vm_leave_unw
464 |
465 |->vm_unwind_ff: // Unwind C stack, return from ff pcall.
466 | // (void *cframe)
467 | bti_tailcall
468 | add fp, CARG1, # SAVE_FP_LR_
469 | mov sp, CARG1
470 | ldr L, SAVE_L
471 | init_constants
472 | ldr GL, L->glref // Setup pointer to global state.
473 |->vm_unwind_ff_eh: // Landing pad for external unwinder.
474 | bti_tailcall
475 | mov RC, #16 // 2 results: false + error message.
476 | ldr BASE, L->base
477 | mov_false TMP0
478 | sub RA, BASE, #8 // Results start at BASE-8.
479 | ldr PC, [BASE, FRAME_PC] // Fetch PC of previous frame.
480 | str TMP0, [BASE, #-8] // Prepend false to error message.
481 | st_vmstate ST_INTERP
482 | b ->vm_returnc
483 |
484 |//-----------------------------------------------------------------------
485 |//-- Grow stack for calls -----------------------------------------------
486 |//-----------------------------------------------------------------------
487 |
488 |->vm_growstack_c: // Grow stack for C function.
489 | // CARG1 = L
490 | mov CARG2, #LUA_MINSTACK
491 | b >2
492 |
493 |->vm_growstack_l: // Grow stack for Lua function.
494 | // BASE = new base, RA = BASE+framesize*8, RC = nargs*8, PC = first PC
495 | add RC, BASE, RC
496 | sub RA, RA, BASE
497 | mov CARG1, L
498 | stp BASE, RC, L->base
499 | add PC, PC, #4 // Must point after first instruction.
500 | lsr CARG2, RA, #3
501 |2:
502 | // L->base = new base, L->top = top
503 | str PC, SAVE_PC
504 | bl extern lj_state_growstack // (lua_State *L, int n)
505 | ldp BASE, RC, L->base
506 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC]
507 | sub NARGS8:RC, RC, BASE
508 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
509 | // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
510 | ins_callt // Just retry the call.
511 |
512 |//-----------------------------------------------------------------------
513 |//-- Entry points into the assembler VM ---------------------------------
514 |//-----------------------------------------------------------------------
515 |
516 |->vm_resume: // Setup C frame and resume thread.
517 | // (lua_State *L, TValue *base, int nres1 = 0, ptrdiff_t ef = 0)
518 | saveregs
519 | mov L, CARG1
520 | ldr GL, L->glref // Setup pointer to global state.
521 | mov BASE, CARG2
522 | str L, SAVE_L
523 | mov PC, #FRAME_CP
524 | str wzr, SAVE_NRES
525 | add TMP0, sp, #CFRAME_RESUME
526 | ldrb TMP1w, L->status
527 | str wzr, SAVE_ERRF
528 | str L, SAVE_PC // Any value outside of bytecode is ok.
529 | str xzr, SAVE_CFRAME
530 | str TMP0, L->cframe
531 | cbz TMP1w, >3
532 |
533 | // Resume after yield (like a return).
534 | str L, GL->cur_L
535 | mov RA, BASE
536 | ldp BASE, CARG1, L->base
537 | init_constants
538 | ldr PC, [BASE, FRAME_PC]
539 | strb wzr, L->status
540 | sub RC, CARG1, BASE
541 | ands CARG1, PC, #FRAME_TYPE
542 | add RC, RC, #8
543 | st_vmstate ST_INTERP
544 | str RCw, SAVE_MULTRES
545 | beq ->BC_RET_Z
546 | b ->vm_return
547 |
548 |->vm_pcall: // Setup protected C frame and enter VM.
549 | // (lua_State *L, TValue *base, int nres1, ptrdiff_t ef)
550 | saveregs
551 | mov PC, #FRAME_CP
552 | str CARG4w, SAVE_ERRF
553 | b >1
554 |
555 |->vm_call: // Setup C frame and enter VM.
556 | // (lua_State *L, TValue *base, int nres1)
557 | saveregs
558 | mov PC, #FRAME_C
559 |
560 |1: // Entry point for vm_pcall above (PC = ftype).
561 | ldr RC, L:CARG1->cframe
562 | str CARG3w, SAVE_NRES
563 | mov L, CARG1
564 | str CARG1, SAVE_L
565 | ldr GL, L->glref // Setup pointer to global state.
566 | mov BASE, CARG2
567 | str CARG1, SAVE_PC // Any value outside of bytecode is ok.
568 | add TMP0, sp, #0
569 | str RC, SAVE_CFRAME
570 | str TMP0, L->cframe // Add our C frame to cframe chain.
571 |
572 |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype).
573 | str L, GL->cur_L
574 | ldp RB, CARG1, L->base // RB = old base (for vmeta_call).
575 | add PC, PC, BASE
576 | init_constants
577 | sub PC, PC, RB // PC = frame delta + frame type
578 | sub NARGS8:RC, CARG1, BASE
579 | st_vmstate ST_INTERP
580 |
581 |->vm_call_dispatch:
582 | // RB = old base, BASE = new base, RC = nargs*8, PC = caller PC
583 | ldr CARG3, [BASE, FRAME_FUNC]
584 | checkfunc CARG3, ->vmeta_call
585 |
586 |->vm_call_dispatch_f:
587 | ins_call
588 | // BASE = new base, CARG3 = func, RC = nargs*8, PC = caller PC
589 |
590 |->vm_cpcall: // Setup protected C frame, call C.
591 | // (lua_State *L, lua_CFunction func, void *ud, lua_CPFunction cp)
592 | saveregs
593 | mov L, CARG1
594 | ldr RA, L:CARG1->stack
595 | str CARG1, SAVE_L
596 | ldr GL, L->glref // Setup pointer to global state.
597 | ldr RB, L->top
598 | str CARG1, SAVE_PC // Any value outside of bytecode is ok.
599 | ldr RC, L->cframe
600 | sub RA, RA, RB // Compute -savestack(L, L->top).
601 | str RAw, SAVE_NRES // Neg. delta means cframe w/o frame.
602 | str wzr, SAVE_ERRF // No error function.
603 | add TMP0, sp, #0
604 | str RC, SAVE_CFRAME
605 | str TMP0, L->cframe // Add our C frame to cframe chain.
606 | str L, GL->cur_L
607 | blr_auth CARG4 // (lua_State *L, lua_CFunction func, void *ud)
608 | mov BASE, CRET1
609 | mov PC, #FRAME_CP
610 | cbnz BASE, <3 // Else continue with the call.
611 | b ->vm_leave_cp // No base? Just remove C frame.
612 |
613 |//-----------------------------------------------------------------------
614 |//-- Metamethod handling ------------------------------------------------
615 |//-----------------------------------------------------------------------
616 |
617 |//-- Continuation dispatch ----------------------------------------------
618 |
619 |->cont_dispatch:
620 | // BASE = meta base, RA = resultptr, RC = (nresults+1)*8
621 | ldr LFUNC:CARG3, [RB, FRAME_FUNC]
622 | ldr CARG1, [BASE, #-32] // Get continuation.
623 | mov CARG4, BASE
624 | mov BASE, RB // Restore caller BASE.
625 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
626 |.if FFI
627 | cmp CARG1, #1
628 |.endif
629 | ldr PC, [CARG4, #-24] // Restore PC from [cont|PC].
630 | add TMP0, RA, RC
631 | str TISNIL, [TMP0, #-8] // Ensure one valid arg.
632 |.if FFI
633 | bls >1
634 |.endif
635 | ldr CARG3, LFUNC:CARG3->pc
636 | ldr KBASE, [CARG3, #PC2PROTO(k)]
637 | // BASE = base, RA = resultptr, CARG4 = meta base
638 | br_auth CARG1
639 |
640 |.if FFI
641 |1:
642 | beq ->cont_ffi_callback // cont = 1: return from FFI callback.
643 | // cont = 0: tailcall from C function.
644 | sub CARG4, CARG4, #32
645 | sub RC, CARG4, BASE
646 | b ->vm_call_tail
647 |.endif
648 |
649 |->cont_cat: // RA = resultptr, CARG4 = meta base
650 | bti_jump
651 | ldr INSw, [PC, #-4]
652 | sub CARG2, CARG4, #32
653 | ldr TMP0, [RA]
654 | str BASE, L->base
655 | decode_RB RB, INS
656 | decode_RA RA, INS
657 | add TMP1, BASE, RB, lsl #3
658 | subs TMP1, CARG2, TMP1
659 | beq >1
660 | str TMP0, [CARG2]
661 | lsr CARG3, TMP1, #3
662 | b ->BC_CAT_Z
663 |
664 |1:
665 | str TMP0, [BASE, RA, lsl #3]
666 | b ->cont_nop
667 |
668 |//-- Table indexing metamethods -----------------------------------------
669 |
670 |->vmeta_tgets1:
671 | movn CARG4, #~LJ_TSTR
672 | add CARG2, BASE, RB, lsl #3
673 | add CARG4, STR:RC, CARG4, lsl #47
674 | b >2
675 |
676 |->vmeta_tgets:
677 | movk CARG2, #(LJ_TTAB>>1)&0xffff, lsl #48
678 | str CARG2, GL->tmptv
679 | add CARG2, GL, #offsetof(global_State, tmptv)
680 |2:
681 | add CARG3, sp, TMPDofs
682 | str CARG4, TMPD
683 | b >1
684 |
685 |->vmeta_tgetb: // RB = table, RC = index
686 | add_TISNUM RC, RC
687 | add CARG2, BASE, RB, lsl #3
688 | add CARG3, sp, TMPDofs
689 | str RC, TMPD
690 | b >1
691 |
692 |->vmeta_tgetv: // RB = table, RC = key
693 | add CARG2, BASE, RB, lsl #3
694 | add CARG3, BASE, RC, lsl #3
695 |1:
696 | str BASE, L->base
697 | mov CARG1, L
698 | str PC, SAVE_PC
699 | bl extern lj_meta_tget // (lua_State *L, TValue *o, TValue *k)
700 | // Returns TValue * (finished) or NULL (metamethod).
701 | cbz CRET1, >3
702 | ldr TMP0, [CRET1]
703 | str TMP0, [BASE, RA, lsl #3]
704 | ins_next
705 |
706 |3: // Call __index metamethod.
707 | // BASE = base, L->top = new base, stack = cont/func/t/k
708 | sub TMP1, BASE, #FRAME_CONT
709 | ldr BASE, L->top
710 | mov NARGS8:RC, #16 // 2 args for func(t, k).
711 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here.
712 | str PC, [BASE, #-24] // [cont|PC]
713 | sub PC, BASE, TMP1
714 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
715 | b ->vm_call_dispatch_f
716 |
717 |->vmeta_tgetr:
718 | sxtw CARG2, TMP1w
719 | bl extern lj_tab_getinth // (GCtab *t, int32_t key)
720 | // Returns cTValue * or NULL.
721 | mov_nil TMP0
722 | cbz CRET1, ->BC_TGETR_Z
723 | ldr TMP0, [CRET1]
724 | b ->BC_TGETR_Z
725 |
726 |//-----------------------------------------------------------------------
727 |
728 |->vmeta_tsets1:
729 | movn CARG4, #~LJ_TSTR
730 | add CARG2, BASE, RB, lsl #3
731 | add CARG4, STR:RC, CARG4, lsl #47
732 | b >2
733 |
734 |->vmeta_tsets:
735 | movk CARG2, #(LJ_TTAB>>1)&0xffff, lsl #48
736 | str CARG2, GL->tmptv
737 | add CARG2, GL, #offsetof(global_State, tmptv)
738 |2:
739 | add CARG3, sp, TMPDofs
740 | str CARG4, TMPD
741 | b >1
742 |
743 |->vmeta_tsetb: // RB = table, RC = index
744 | add_TISNUM RC, RC
745 | add CARG2, BASE, RB, lsl #3
746 | add CARG3, sp, TMPDofs
747 | str RC, TMPD
748 | b >1
749 |
750 |->vmeta_tsetv:
751 | add CARG2, BASE, RB, lsl #3
752 | add CARG3, BASE, RC, lsl #3
753 |1:
754 | str BASE, L->base
755 | mov CARG1, L
756 | str PC, SAVE_PC
757 | bl extern lj_meta_tset // (lua_State *L, TValue *o, TValue *k)
758 | // Returns TValue * (finished) or NULL (metamethod).
759 | ldr TMP0, [BASE, RA, lsl #3]
760 | cbz CRET1, >3
761 | // NOBARRIER: lj_meta_tset ensures the table is not black.
762 | str TMP0, [CRET1]
763 | ins_next
764 |
765 |3: // Call __newindex metamethod.
766 | // BASE = base, L->top = new base, stack = cont/func/t/k/(v)
767 | sub TMP1, BASE, #FRAME_CONT
768 | ldr BASE, L->top
769 | mov NARGS8:RC, #24 // 3 args for func(t, k, v).
770 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here.
771 | str TMP0, [BASE, #16] // Copy value to third argument.
772 | str PC, [BASE, #-24] // [cont|PC]
773 | sub PC, BASE, TMP1
774 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
775 | b ->vm_call_dispatch_f
776 |
777 |->vmeta_tsetr:
778 | sxtw CARG3, TMP1w
779 | str BASE, L->base
780 | mov CARG1, L
781 | str PC, SAVE_PC
782 | bl extern lj_tab_setinth // (lua_State *L, GCtab *t, int32_t key)
783 | // Returns TValue *.
784 | b ->BC_TSETR_Z
785 |
786 |//-- Comparison metamethods ---------------------------------------------
787 |
788 |->vmeta_comp:
789 | add CARG2, BASE, RA, lsl #3
790 | sub PC, PC, #4
791 | add CARG3, BASE, RC, lsl #3
792 | str BASE, L->base
793 | mov CARG1, L
794 | str PC, SAVE_PC
795 | uxtb CARG4w, INSw
796 | bl extern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op)
797 | // Returns 0/1 or TValue * (metamethod).
798 |3:
799 | cmp CRET1, #1
800 | bhi ->vmeta_binop
801 |4:
802 | ldrh RBw, [PC, # OFS_RD]
803 | add PC, PC, #4
804 | add RB, PC, RB, lsl #2
805 | sub RB, RB, #0x20000
806 | csel PC, PC, RB, lo
807 |->cont_nop:
808 | bti_jump
809 | ins_next
810 |
811 |->cont_ra: // RA = resultptr
812 | bti_jump
813 | ldr INSw, [PC, #-4]
814 | ldr TMP0, [RA]
815 | decode_RA TMP1, INS
816 | str TMP0, [BASE, TMP1, lsl #3]
817 | b ->cont_nop
818 |
819 |->cont_condt: // RA = resultptr
820 | bti_jump
821 | ldr TMP0, [RA]
822 | mov_true TMP1
823 | cmp TMP1, TMP0 // Branch if result is true.
824 | b <4
825 |
826 |->cont_condf: // RA = resultptr
827 | bti_jump
828 | ldr TMP0, [RA]
829 | mov_false TMP1
830 | cmp TMP0, TMP1 // Branch if result is false.
831 | b <4
832 |
833 |->vmeta_equal:
834 | // CARG2, CARG3, CARG4 are already set by BC_ISEQV/BC_ISNEV.
835 | and TAB:CARG3, CARG3, #LJ_GCVMASK
836 | sub PC, PC, #4
837 | str BASE, L->base
838 | mov CARG1, L
839 | str PC, SAVE_PC
840 | bl extern lj_meta_equal // (lua_State *L, GCobj *o1, *o2, int ne)
841 | // Returns 0/1 or TValue * (metamethod).
842 | b <3
843 |
844 |->vmeta_equal_cd:
845 |.if FFI
846 | sub PC, PC, #4
847 | str BASE, L->base
848 | mov CARG1, L
849 | mov CARG2, INS
850 | str PC, SAVE_PC
851 | bl extern lj_meta_equal_cd // (lua_State *L, BCIns op)
852 | // Returns 0/1 or TValue * (metamethod).
853 | b <3
854 |.endif
855 |
856 |->vmeta_istype:
857 | sub PC, PC, #4
858 | str BASE, L->base
859 | mov CARG1, L
860 | mov CARG2, RA
861 | mov CARG3, RC
862 | str PC, SAVE_PC
863 | bl extern lj_meta_istype // (lua_State *L, BCReg ra, BCReg tp)
864 | b ->cont_nop
865 |
866 |//-- Arithmetic metamethods ---------------------------------------------
867 |
868 |->vmeta_arith_vn:
869 | add CARG3, BASE, RB, lsl #3
870 | add CARG4, KBASE, RC, lsl #3
871 | b >1
872 |
873 |->vmeta_arith_nv:
874 | add CARG4, BASE, RB, lsl #3
875 | add CARG3, KBASE, RC, lsl #3
876 | b >1
877 |
878 |->vmeta_unm:
879 | add CARG3, BASE, RC, lsl #3
880 | mov CARG4, CARG3
881 | b >1
882 |
883 |->vmeta_arith_vv:
884 | add CARG3, BASE, RB, lsl #3
885 | add CARG4, BASE, RC, lsl #3
886 |1:
887 | uxtb CARG5w, INSw
888 | add CARG2, BASE, RA, lsl #3
889 | str BASE, L->base
890 | mov CARG1, L
891 | str PC, SAVE_PC
892 | bl extern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op)
893 | // Returns NULL (finished) or TValue * (metamethod).
894 | cbz CRET1, ->cont_nop
895 |
896 | // Call metamethod for binary op.
897 |->vmeta_binop:
898 | // BASE = old base, CRET1 = new base, stack = cont/func/o1/o2
899 | sub TMP1, CRET1, BASE
900 | str PC, [CRET1, #-24] // [cont|PC]
901 | add PC, TMP1, #FRAME_CONT
902 | mov BASE, CRET1
903 | mov NARGS8:RC, #16 // 2 args for func(o1, o2).
904 | b ->vm_call_dispatch
905 |
906 |->vmeta_len:
907 | add CARG2, BASE, RC, lsl #3
908#if LJ_52
909 | mov TAB:RC, TAB:CARG1 // Save table (ignored for other types).
910#endif
911 | str BASE, L->base
912 | mov CARG1, L
913 | str PC, SAVE_PC
914 | bl extern lj_meta_len // (lua_State *L, TValue *o)
915 | // Returns NULL (retry) or TValue * (metamethod base).
916#if LJ_52
917 | cbnz CRET1, ->vmeta_binop // Binop call for compatibility.
918 | mov TAB:CARG1, TAB:RC
919 | b ->BC_LEN_Z
920#else
921 | b ->vmeta_binop // Binop call for compatibility.
922#endif
923 |
924 |//-- Call metamethod ----------------------------------------------------
925 |
926 |->vmeta_call: // Resolve and call __call metamethod.
927 | // RB = old base, BASE = new base, RC = nargs*8
928 | mov CARG1, L
929 | str RB, L->base // This is the callers base!
930 | sub CARG2, BASE, #16
931 | str PC, SAVE_PC
932 | add CARG3, BASE, NARGS8:RC
933 | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
934 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Guaranteed to be a function here.
935 | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now.
936 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
937 | ins_call
938 |
939 |->vmeta_callt: // Resolve __call for BC_CALLT.
940 | // BASE = old base, RA = new base, RC = nargs*8
941 | mov CARG1, L
942 | str BASE, L->base
943 | sub CARG2, RA, #16
944 | str PC, SAVE_PC
945 | add CARG3, RA, NARGS8:RC
946 | bl extern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
947 | ldr TMP1, [RA, FRAME_FUNC] // Guaranteed to be a function here.
948 | ldr PC, [BASE, FRAME_PC]
949 | add NARGS8:RC, NARGS8:RC, #8 // Got one more argument now.
950 | and LFUNC:CARG3, TMP1, #LJ_GCVMASK
951 | b ->BC_CALLT2_Z
952 |
953 |//-- Argument coercion for 'for' statement ------------------------------
954 |
955 |->vmeta_for:
956 | mov CARG1, L
957 | str BASE, L->base
958 | mov CARG2, RA
959 | str PC, SAVE_PC
960 | bl extern lj_meta_for // (lua_State *L, TValue *base)
961 | ldr INSw, [PC, #-4]
962 |.if JIT
963 | uxtb TMP0w, INSw
964 |.endif
965 | decode_RA RA, INS
966 | decode_RD RC, INS
967 |.if JIT
968 | cmp TMP0, #BC_JFORI
969 | beq =>BC_JFORI
970 |.endif
971 | b =>BC_FORI
972 |
973 |//-----------------------------------------------------------------------
974 |//-- Fast functions -----------------------------------------------------
975 |//-----------------------------------------------------------------------
976 |
977 |.macro .ffunc, name
978 |->ff_ .. name:
979 | bti_jump
980 |.endmacro
981 |
982 |.macro .ffunc_1, name
983 |->ff_ .. name:
984 | bti_jump
985 | ldr CARG1, [BASE]
986 | cmp NARGS8:RC, #8
987 | blo ->fff_fallback
988 |.endmacro
989 |
990 |.macro .ffunc_2, name
991 |->ff_ .. name:
992 | bti_jump
993 | ldp CARG1, CARG2, [BASE]
994 | cmp NARGS8:RC, #16
995 | blo ->fff_fallback
996 |.endmacro
997 |
998 |.macro .ffunc_n, name
999 | .ffunc name
1000 | ldr CARG1, [BASE]
1001 | cmp NARGS8:RC, #8
1002 | ldr FARG1, [BASE]
1003 | blo ->fff_fallback
1004 | checknum CARG1, ->fff_fallback
1005 |.endmacro
1006 |
1007 |.macro .ffunc_nn, name
1008 | .ffunc name
1009 | ldp CARG1, CARG2, [BASE]
1010 | cmp NARGS8:RC, #16
1011 | ldp FARG1, FARG2, [BASE]
1012 | blo ->fff_fallback
1013 | checknum CARG1, ->fff_fallback
1014 | checknum CARG2, ->fff_fallback
1015 |.endmacro
1016 |
1017 |// Inlined GC threshold check. Caveat: uses CARG1 and CARG2.
1018 |.macro ffgccheck
1019 | ldp CARG1, CARG2, GL->gc.total // Assumes threshold follows total.
1020 | cmp CARG1, CARG2
1021 | blt >1
1022 | bl ->fff_gcstep
1023 |1:
1024 |.endmacro
1025 |
1026 |//-- Base library: checks -----------------------------------------------
1027 |
1028 |.ffunc_1 assert
1029 | ldr PC, [BASE, FRAME_PC]
1030 | mov_false TMP1
1031 | cmp CARG1, TMP1
1032 | bhs ->fff_fallback
1033 | str CARG1, [BASE, #-16]
1034 | sub RB, BASE, #8
1035 | subs RA, NARGS8:RC, #8
1036 | add RC, NARGS8:RC, #8 // Compute (nresults+1)*8.
1037 | cbz RA, ->fff_res // Done if exactly 1 argument.
1038 |1:
1039 | ldr CARG1, [RB, #16]
1040 | sub RA, RA, #8
1041 | str CARG1, [RB], #8
1042 | cbnz RA, <1
1043 | b ->fff_res
1044 |
1045 |.ffunc_1 type
1046 | mov TMP0, #~LJ_TISNUM
1047 | asr ITYPE, CARG1, #47
1048 | cmn ITYPE, #~LJ_TISNUM
1049 | csinv TMP1, TMP0, ITYPE, lo
1050 | add TMP1, TMP1, #offsetof(GCfuncC, upvalue)/8
1051 | ldr CARG1, [CFUNC:CARG3, TMP1, lsl #3]
1052 | b ->fff_restv
1053 |
1054 |//-- Base library: getters and setters ---------------------------------
1055 |
1056 |.ffunc_1 getmetatable
1057 | asr ITYPE, CARG1, #47
1058 | cmn ITYPE, #-LJ_TTAB
1059 | ccmn ITYPE, #-LJ_TUDATA, #4, ne
1060 | and TAB:CARG1, CARG1, #LJ_GCVMASK
1061 | bne >6
1062 |1: // Field metatable must be at same offset for GCtab and GCudata!
1063 | ldr TAB:RB, TAB:CARG1->metatable
1064 |2:
1065 | mov_nil CARG1
1066 | ldr STR:RC, GL->gcroot[GCROOT_MMNAME+MM_metatable]
1067 | cbz TAB:RB, ->fff_restv
1068 | ldr TMP1w, TAB:RB->hmask
1069 | ldr TMP2w, STR:RC->sid
1070 | ldr NODE:CARG3, TAB:RB->node
1071 | and TMP1w, TMP1w, TMP2w // idx = str->sid & tab->hmask
1072 | add TMP1, TMP1, TMP1, lsl #1
1073 | movn CARG4, #~LJ_TSTR
1074 | add NODE:CARG3, NODE:CARG3, TMP1, lsl #3 // node = tab->node + idx*3*8
1075 | add CARG4, STR:RC, CARG4, lsl #47 // Tagged key to look for.
1076 |3: // Rearranged logic, because we expect _not_ to find the key.
1077 | ldp CARG1, TMP0, NODE:CARG3->val
1078 | ldr NODE:CARG3, NODE:CARG3->next
1079 | cmp TMP0, CARG4
1080 | beq >5
1081 | cbnz NODE:CARG3, <3
1082 |4:
1083 | mov CARG1, RB // Use metatable as default result.
1084 | movk CARG1, #(LJ_TTAB>>1)&0xffff, lsl #48
1085 | b ->fff_restv
1086 |5:
1087 | cmp_nil TMP0
1088 | bne ->fff_restv
1089 | b <4
1090 |
1091 |6:
1092 | movn TMP0, #~LJ_TISNUM
1093 | cmp ITYPE, TMP0
1094 | csel ITYPE, ITYPE, TMP0, hs
1095 | sub TMP1, GL, ITYPE, lsl #3
1096 | ldr TAB:RB, [TMP1, #offsetof(global_State, gcroot[GCROOT_BASEMT])-8]
1097 | b <2
1098 |
1099 |.ffunc_2 setmetatable
1100 | // Fast path: no mt for table yet and not clearing the mt.
1101 | checktp TMP1, CARG1, LJ_TTAB, ->fff_fallback
1102 | ldr TAB:TMP0, TAB:TMP1->metatable
1103 | asr ITYPE, CARG2, #47
1104 | ldrb TMP2w, TAB:TMP1->marked
1105 | cmn ITYPE, #-LJ_TTAB
1106 | and TAB:CARG2, CARG2, #LJ_GCVMASK
1107 | ccmp TAB:TMP0, #0, #0, eq
1108 | bne ->fff_fallback
1109 | str TAB:CARG2, TAB:TMP1->metatable
1110 | tbz TMP2w, #2, ->fff_restv // isblack(table)
1111 | barrierback TAB:TMP1, TMP2w, TMP0
1112 | b ->fff_restv
1113 |
1114 |.ffunc rawget
1115 | ldr CARG2, [BASE]
1116 | cmp NARGS8:RC, #16
1117 | blo ->fff_fallback
1118 | checktab CARG2, ->fff_fallback
1119 | mov CARG1, L
1120 | add CARG3, BASE, #8
1121 | bl extern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key)
1122 | // Returns cTValue *.
1123 | ldr CARG1, [CRET1]
1124 | b ->fff_restv
1125 |
1126 |//-- Base library: conversions ------------------------------------------
1127 |
1128 |.ffunc tonumber
1129 | // Only handles the number case inline (without a base argument).
1130 | ldr CARG1, [BASE]
1131 | cmp NARGS8:RC, #8
1132 | bne ->fff_fallback
1133 | checknumber CARG1, ->fff_fallback
1134 | b ->fff_restv
1135 |
1136 |.ffunc_1 tostring
1137 | // Only handles the string or number case inline.
1138 | asr ITYPE, CARG1, #47
1139 | cmn ITYPE, #-LJ_TSTR
1140 | // A __tostring method in the string base metatable is ignored.
1141 | beq ->fff_restv
1142 | // Handle numbers inline, unless a number base metatable is present.
1143 | ldr TMP1, GL->gcroot[GCROOT_BASEMT_NUM]
1144 | str BASE, L->base
1145 | cmn ITYPE, #-LJ_TISNUM
1146 | ccmp TMP1, #0, #0, ls
1147 | str PC, SAVE_PC // Redundant (but a defined value).
1148 | bne ->fff_fallback
1149 | ffgccheck
1150 | mov CARG1, L
1151 | mov CARG2, BASE
1152 | bl extern lj_strfmt_number // (lua_State *L, cTValue *o)
1153 | // Returns GCstr *.
1154 | movn TMP1, #~LJ_TSTR
1155 | ldr BASE, L->base
1156 | add CARG1, CARG1, TMP1, lsl #47
1157 | b ->fff_restv
1158 |
1159 |//-- Base library: iterators -------------------------------------------
1160 |
1161 |.ffunc_1 next
1162 | checktp CARG1, LJ_TTAB, ->fff_fallback
1163 | str TISNIL, [BASE, NARGS8:RC] // Set missing 2nd arg to nil.
1164 | ldr PC, [BASE, FRAME_PC]
1165 | add CARG2, BASE, #8
1166 | sub CARG3, BASE, #16
1167 | bl extern lj_tab_next // (GCtab *t, cTValue *key, TValue *o)
1168 | // Returns 1=found, 0=end, -1=error.
1169 | mov RC, #(2+1)*8
1170 | tbnz CRET1w, #31, ->fff_fallback // Invalid key.
1171 | cbnz CRET1, ->fff_res // Found key/value.
1172 | // End of traversal: return nil.
1173 | str TISNIL, [BASE, #-16]
1174 | b ->fff_res1
1175 |
1176 |.ffunc_1 pairs
1177 | checktp TMP1, CARG1, LJ_TTAB, ->fff_fallback
1178#if LJ_52
1179 | ldr TAB:CARG2, TAB:TMP1->metatable
1180#endif
1181 | ldr CFUNC:CARG4, CFUNC:CARG3->upvalue[0]
1182 | ldr PC, [BASE, FRAME_PC]
1183#if LJ_52
1184 | cbnz TAB:CARG2, ->fff_fallback
1185#endif
1186 | mov RC, #(3+1)*8
1187 | stp CFUNC:CARG4, CARG1, [BASE, #-16]
1188 | str TISNIL, [BASE]
1189 | b ->fff_res
1190 |
1191 |.ffunc_2 ipairs_aux
1192 | checktab CARG1, ->fff_fallback
1193 | checkint CARG2, ->fff_fallback
1194 | ldr TMP1w, TAB:CARG1->asize
1195 | ldr CARG3, TAB:CARG1->array
1196 | ldr TMP0w, TAB:CARG1->hmask
1197 | add CARG2w, CARG2w, #1
1198 | cmp CARG2w, TMP1w
1199 | ldr PC, [BASE, FRAME_PC]
1200 | add_TISNUM TMP2, CARG2
1201 | mov RC, #(0+1)*8
1202 | str TMP2, [BASE, #-16]
1203 | bhs >2 // Not in array part?
1204 | ldr TMP0, [CARG3, CARG2, lsl #3]
1205 |1:
1206 | mov TMP1, #(2+1)*8
1207 | cmp_nil TMP0
1208 | str TMP0, [BASE, #-8]
1209 | csel RC, RC, TMP1, eq
1210 | b ->fff_res
1211 |2: // Check for empty hash part first. Otherwise call C function.
1212 | cbz TMP0w, ->fff_res
1213 | bl extern lj_tab_getinth // (GCtab *t, int32_t key)
1214 | // Returns cTValue * or NULL.
1215 | cbz CRET1, ->fff_res
1216 | ldr TMP0, [CRET1]
1217 | b <1
1218 |
1219 |.ffunc_1 ipairs
1220 | checktp TMP1, CARG1, LJ_TTAB, ->fff_fallback
1221#if LJ_52
1222 | ldr TAB:CARG2, TAB:TMP1->metatable
1223#endif
1224 | ldr CFUNC:CARG4, CFUNC:CARG3->upvalue[0]
1225 | ldr PC, [BASE, FRAME_PC]
1226#if LJ_52
1227 | cbnz TAB:CARG2, ->fff_fallback
1228#endif
1229 | mov RC, #(3+1)*8
1230 | stp CFUNC:CARG4, CARG1, [BASE, #-16]
1231 | str TISNUM, [BASE]
1232 | b ->fff_res
1233 |
1234 |//-- Base library: catch errors ----------------------------------------
1235 |
1236 |.ffunc pcall
1237 | ldr TMP1, L->maxstack
1238 | add TMP2, BASE, NARGS8:RC
1239 | cmp TMP1, TMP2
1240 | blo ->fff_fallback
1241 | cmp NARGS8:RC, #8
1242 | ldrb TMP0w, GL->hookmask
1243 | blo ->fff_fallback
1244 | sub NARGS8:RC, NARGS8:RC, #8
1245 | mov RB, BASE
1246 | add BASE, BASE, #16
1247 | ubfx TMP0w, TMP0w, #HOOK_ACTIVE_SHIFT, #1
1248 | add PC, TMP0, #16+FRAME_PCALL
1249 | beq ->vm_call_dispatch
1250 |1:
1251 | add TMP2, BASE, NARGS8:RC
1252 |2:
1253 | ldr TMP0, [TMP2, #-16]
1254 | str TMP0, [TMP2, #-8]!
1255 | cmp TMP2, BASE
1256 | bne <2
1257 | b ->vm_call_dispatch
1258 |
1259 |.ffunc xpcall
1260 | ldr TMP1, L->maxstack
1261 | add TMP2, BASE, NARGS8:RC
1262 | cmp TMP1, TMP2
1263 | blo ->fff_fallback
1264 | ldp CARG1, CARG2, [BASE]
1265 | ldrb TMP0w, GL->hookmask
1266 | subs NARGS8:TMP1, NARGS8:RC, #16
1267 | blo ->fff_fallback
1268 | mov RB, BASE
1269 | asr ITYPE, CARG2, #47
1270 | ubfx TMP0w, TMP0w, #HOOK_ACTIVE_SHIFT, #1
1271 | cmn ITYPE, #-LJ_TFUNC
1272 | add PC, TMP0, #24+FRAME_PCALL
1273 | bne ->fff_fallback // Traceback must be a function.
1274 | mov NARGS8:RC, NARGS8:TMP1
1275 | add BASE, BASE, #24
1276 | stp CARG2, CARG1, [RB] // Swap function and traceback.
1277 | cbz NARGS8:RC, ->vm_call_dispatch
1278 | b <1
1279 |
1280 |//-- Coroutine library --------------------------------------------------
1281 |
1282 |.macro coroutine_resume_wrap, resume
1283 |.if resume
1284 |.ffunc_1 coroutine_resume
1285 | checktp CARG1, LJ_TTHREAD, ->fff_fallback
1286 |.else
1287 |.ffunc coroutine_wrap_aux
1288 | ldr L:CARG1, CFUNC:CARG3->upvalue[0].gcr
1289 | and L:CARG1, CARG1, #LJ_GCVMASK
1290 |.endif
1291 | ldr PC, [BASE, FRAME_PC]
1292 | str BASE, L->base
1293 | ldp RB, CARG2, L:CARG1->base
1294 | ldrb TMP1w, L:CARG1->status
1295 | add TMP0, CARG2, TMP1
1296 | str PC, SAVE_PC
1297 | cmp TMP0, RB
1298 | beq ->fff_fallback
1299 | cmp TMP1, #LUA_YIELD
1300 | add TMP0, CARG2, #8
1301 | csel CARG2, CARG2, TMP0, hs
1302 | ldr CARG4, L:CARG1->maxstack
1303 | add CARG3, CARG2, NARGS8:RC
1304 | ldr RB, L:CARG1->cframe
1305 | ccmp CARG3, CARG4, #2, ls
1306 | ccmp RB, #0, #2, ls
1307 | bhi ->fff_fallback
1308 |.if resume
1309 | sub CARG3, CARG3, #8 // Keep resumed thread in stack for GC.
1310 | add BASE, BASE, #8
1311 | sub NARGS8:RC, NARGS8:RC, #8
1312 |.endif
1313 | str CARG3, L:CARG1->top
1314 | str BASE, L->top
1315 | cbz NARGS8:RC, >3
1316 |2: // Move args to coroutine.
1317 | ldr TMP0, [BASE, RB]
1318 | cmp RB, NARGS8:RC
1319 | str TMP0, [CARG2, RB]
1320 | add RB, RB, #8
1321 | bne <2
1322 |3:
1323 | mov CARG3, #0
1324 | mov L:RA, L:CARG1
1325 | mov CARG4, #0
1326 | bl ->vm_resume // (lua_State *L, TValue *base, 0, 0)
1327 | // Returns thread status.
1328 |4:
1329 | ldp CARG3, CARG4, L:RA->base
1330 | cmp CRET1, #LUA_YIELD
1331 | ldr BASE, L->base
1332 | str L, GL->cur_L
1333 | st_vmstate ST_INTERP
1334 | bhi >8
1335 | sub RC, CARG4, CARG3
1336 | ldr CARG1, L->maxstack
1337 | add CARG2, BASE, RC
1338 | cbz RC, >6 // No results?
1339 | cmp CARG2, CARG1
1340 | mov RB, #0
1341 | bhi >9 // Need to grow stack?
1342 |
1343 | sub CARG4, RC, #8
1344 | str CARG3, L:RA->top // Clear coroutine stack.
1345 |5: // Move results from coroutine.
1346 | ldr TMP0, [CARG3, RB]
1347 | cmp RB, CARG4
1348 | str TMP0, [BASE, RB]
1349 | add RB, RB, #8
1350 | bne <5
1351 |6:
1352 |.if resume
1353 | mov_true TMP1
1354 | add RC, RC, #16
1355 |7:
1356 | str TMP1, [BASE, #-8] // Prepend true/false to results.
1357 | sub RA, BASE, #8
1358 |.else
1359 | mov RA, BASE
1360 | add RC, RC, #8
1361 |.endif
1362 | ands CARG1, PC, #FRAME_TYPE
1363 | str PC, SAVE_PC
1364 | str RCw, SAVE_MULTRES
1365 | beq ->BC_RET_Z
1366 | b ->vm_return
1367 |
1368 |8: // Coroutine returned with error (at co->top-1).
1369 |.if resume
1370 | ldr TMP0, [CARG4, #-8]!
1371 | mov_false TMP1
1372 | mov RC, #(2+1)*8
1373 | str CARG4, L:RA->top // Remove error from coroutine stack.
1374 | str TMP0, [BASE] // Copy error message.
1375 | b <7
1376 |.else
1377 | mov CARG1, L
1378 | mov CARG2, L:RA
1379 | bl extern lj_ffh_coroutine_wrap_err // (lua_State *L, lua_State *co)
1380 | // Never returns.
1381 |.endif
1382 |
1383 |9: // Handle stack expansion on return from yield.
1384 | mov CARG1, L
1385 | lsr CARG2, RC, #3
1386 | bl extern lj_state_growstack // (lua_State *L, int n)
1387 | mov CRET1, #0
1388 | b <4
1389 |.endmacro
1390 |
1391 | coroutine_resume_wrap 1 // coroutine.resume
1392 | coroutine_resume_wrap 0 // coroutine.wrap
1393 |
1394 |.ffunc coroutine_yield
1395 | ldr TMP0, L->cframe
1396 | add TMP1, BASE, NARGS8:RC
1397 | mov CRET1, #LUA_YIELD
1398 | stp BASE, TMP1, L->base
1399 | tbz TMP0, #0, ->fff_fallback
1400 | str xzr, L->cframe
1401 | strb CRET1w, L->status
1402 | b ->vm_leave_unw
1403 |
1404 |//-- Math library -------------------------------------------------------
1405 |
1406 |.macro math_round, func, round
1407 | .ffunc math_ .. func
1408 | ldr CARG1, [BASE]
1409 | cmp NARGS8:RC, #8
1410 | ldr d0, [BASE]
1411 | blo ->fff_fallback
1412 | cmp TISNUMhi, CARG1, lsr #32
1413 | beq ->fff_restv
1414 | blo ->fff_fallback
1415 | round d0, d0
1416 | b ->fff_resn
1417 |.endmacro
1418 |
1419 | math_round floor, frintm
1420 | math_round ceil, frintp
1421 |
1422 |.ffunc_1 math_abs
1423 | checknumber CARG1, ->fff_fallback
1424 | and CARG1, CARG1, #U64x(7fffffff,ffffffff)
1425 | bne ->fff_restv
1426 | eor CARG2w, CARG1w, CARG1w, asr #31
1427 | movz CARG3, #0x41e0, lsl #48 // 2^31.
1428 | subs CARG1w, CARG2w, CARG1w, asr #31
1429 | add_TISNUM CARG1, CARG1
1430 | csel CARG1, CARG1, CARG3, pl
1431 | // Fallthrough.
1432 |
1433 |->fff_restv:
1434 | // CARG1 = TValue result.
1435 | ldr PC, [BASE, FRAME_PC]
1436 | str CARG1, [BASE, #-16]
1437 |->fff_res1:
1438 | // PC = return.
1439 | mov RC, #(1+1)*8
1440 |->fff_res:
1441 | // RC = (nresults+1)*8, PC = return.
1442 | ands CARG1, PC, #FRAME_TYPE
1443 | str RCw, SAVE_MULTRES
1444 | sub RA, BASE, #16
1445 | bne ->vm_return
1446 | ldr INSw, [PC, #-4]
1447 | decode_RB RB, INS
1448 |5:
1449 | cmp RC, RB, lsl #3 // More results expected?
1450 | blo >6
1451 | decode_RA TMP1, INS
1452 | // Adjust BASE. KBASE is assumed to be set for the calling frame.
1453 | sub BASE, RA, TMP1, lsl #3
1454 | ins_next
1455 |
1456 |6: // Fill up results with nil.
1457 | add TMP1, RA, RC
1458 | add RC, RC, #8
1459 | str TISNIL, [TMP1, #-8]
1460 | b <5
1461 |
1462 |.macro math_extern, func
1463 | .ffunc_n math_ .. func
1464 | bl extern func
1465 | b ->fff_resn
1466 |.endmacro
1467 |
1468 |.macro math_extern2, func
1469 | .ffunc_nn math_ .. func
1470 | bl extern func
1471 | b ->fff_resn
1472 |.endmacro
1473 |
1474 |.ffunc_n math_sqrt
1475 | fsqrt d0, d0
1476 |->fff_resn:
1477 | ldr PC, [BASE, FRAME_PC]
1478 | str d0, [BASE, #-16]
1479 | b ->fff_res1
1480 |
1481 |.ffunc math_log
1482 | ldr CARG1, [BASE]
1483 | cmp NARGS8:RC, #8
1484 | ldr FARG1, [BASE]
1485 | bne ->fff_fallback // Need exactly 1 argument.
1486 | checknum CARG1, ->fff_fallback
1487 | bl extern log
1488 | b ->fff_resn
1489 |
1490 | math_extern log10
1491 | math_extern exp
1492 | math_extern sin
1493 | math_extern cos
1494 | math_extern tan
1495 | math_extern asin
1496 | math_extern acos
1497 | math_extern atan
1498 | math_extern sinh
1499 | math_extern cosh
1500 | math_extern tanh
1501 | math_extern2 pow
1502 | math_extern2 atan2
1503 | math_extern2 fmod
1504 |
1505 |.ffunc_2 math_ldexp
1506 | ldr FARG1, [BASE]
1507 | checknum CARG1, ->fff_fallback
1508 | checkint CARG2, ->fff_fallback
1509 | sxtw CARG1, CARG2w
1510 | bl extern ldexp // (double x, int exp)
1511 | b ->fff_resn
1512 |
1513 |.ffunc_n math_frexp
1514 | add CARG1, sp, TMPDofs
1515 | bl extern frexp
1516 | ldr CARG2w, TMPD
1517 | ldr PC, [BASE, FRAME_PC]
1518 | str d0, [BASE, #-16]
1519 | mov RC, #(2+1)*8
1520 | add_TISNUM CARG2, CARG2
1521 | str CARG2, [BASE, #-8]
1522 | b ->fff_res
1523 |
1524 |.ffunc_n math_modf
1525 | sub CARG1, BASE, #16
1526 | ldr PC, [BASE, FRAME_PC]
1527 | bl extern modf
1528 | mov RC, #(2+1)*8
1529 | str d0, [BASE, #-8]
1530 | b ->fff_res
1531 |
1532 |.macro math_minmax, name, cond, fcond
1533 | .ffunc_1 name
1534 | add RB, BASE, RC
1535 | add RA, BASE, #8
1536 | checkint CARG1, >4
1537 |1: // Handle integers.
1538 | ldr CARG2, [RA]
1539 | cmp RA, RB
1540 | bhs ->fff_restv
1541 | checkint CARG2, >3
1542 | cmp CARG1w, CARG2w
1543 | add RA, RA, #8
1544 | csel CARG1, CARG2, CARG1, cond
1545 | b <1
1546 |3: // Convert intermediate result to number and continue below.
1547 | scvtf d0, CARG1w
1548 | blo ->fff_fallback
1549 | ldr d1, [RA]
1550 | b >6
1551 |
1552 |4:
1553 | ldr d0, [BASE]
1554 | blo ->fff_fallback
1555 |5: // Handle numbers.
1556 | ldr CARG2, [RA]
1557 | ldr d1, [RA]
1558 | cmp RA, RB
1559 | bhs ->fff_resn
1560 | checknum CARG2, >7
1561 |6:
1562 | fcmp d0, d1
1563 | add RA, RA, #8
1564 | fcsel d0, d1, d0, fcond
1565 | b <5
1566 |7: // Convert integer to number and continue above.
1567 | scvtf d1, CARG2w
1568 | blo ->fff_fallback
1569 | b <6
1570 |.endmacro
1571 |
1572 | math_minmax math_min, gt, pl
1573 | math_minmax math_max, lt, le
1574 |
1575 |//-- String library -----------------------------------------------------
1576 |
1577 |.ffunc string_byte // Only handle the 1-arg case here.
1578 | ldp PC, CARG1, [BASE, FRAME_PC]
1579 | cmp NARGS8:RC, #8
1580 | asr ITYPE, CARG1, #47
1581 | ccmn ITYPE, #-LJ_TSTR, #0, eq
1582 | and STR:CARG1, CARG1, #LJ_GCVMASK
1583 | bne ->fff_fallback
1584 | ldrb TMP0w, STR:CARG1[1] // Access is always ok (NUL at end).
1585 | ldr CARG3w, STR:CARG1->len
1586 | add_TISNUM TMP0, TMP0
1587 | str TMP0, [BASE, #-16]
1588 | mov RC, #(0+1)*8
1589 | cbz CARG3, ->fff_res
1590 | b ->fff_res1
1591 |
1592 |.ffunc string_char // Only handle the 1-arg case here.
1593 | ffgccheck
1594 | ldp PC, CARG1, [BASE, FRAME_PC]
1595 | cmp CARG1w, #255
1596 | ccmp NARGS8:RC, #8, #0, ls // Need exactly 1 argument.
1597 | bne ->fff_fallback
1598 | checkint CARG1, ->fff_fallback
1599 | mov CARG3, #1
1600 | // Point to the char inside the integer in the stack slot.
1601 |.if ENDIAN_LE
1602 | mov CARG2, BASE
1603 |.else
1604 | add CARG2, BASE, #7
1605 |.endif
1606 |->fff_newstr:
1607 | // CARG2 = str, CARG3 = len.
1608 | str BASE, L->base
1609 | mov CARG1, L
1610 | str PC, SAVE_PC
1611 | bl extern lj_str_new // (lua_State *L, char *str, size_t l)
1612 |->fff_resstr:
1613 | // Returns GCstr *.
1614 | ldr BASE, L->base
1615 | movn TMP1, #~LJ_TSTR
1616 | add CARG1, CARG1, TMP1, lsl #47
1617 | b ->fff_restv
1618 |
1619 |.ffunc string_sub
1620 | ffgccheck
1621 | ldr CARG1, [BASE]
1622 | ldr CARG3, [BASE, #16]
1623 | cmp NARGS8:RC, #16
1624 | movn RB, #0
1625 | beq >1
1626 | blo ->fff_fallback
1627 | checkint CARG3, ->fff_fallback
1628 | sxtw RB, CARG3w
1629 |1:
1630 | ldr CARG2, [BASE, #8]
1631 | checkstr CARG1, ->fff_fallback
1632 | ldr TMP1w, STR:CARG1->len
1633 | checkint CARG2, ->fff_fallback
1634 | sxtw CARG2, CARG2w
1635 | // CARG1 = str, TMP1 = str->len, CARG2 = start, RB = end
1636 | add TMP2, RB, TMP1
1637 | cmp RB, #0
1638 | add TMP0, CARG2, TMP1
1639 | csinc RB, RB, TMP2, ge // if (end < 0) end += len+1
1640 | cmp CARG2, #0
1641 | csinc CARG2, CARG2, TMP0, ge // if (start < 0) start += len+1
1642 | cmp RB, #0
1643 | csel RB, RB, xzr, ge // if (end < 0) end = 0
1644 | cmp CARG2, #1
1645 | csinc CARG2, CARG2, xzr, ge // if (start < 1) start = 1
1646 | cmp RB, TMP1
1647 | csel RB, RB, TMP1, le // if (end > len) end = len
1648 | add CARG1, STR:CARG1, #sizeof(GCstr)-1
1649 | subs CARG3, RB, CARG2 // len = end - start
1650 | add CARG2, CARG1, CARG2
1651 | add CARG3, CARG3, #1 // len += 1
1652 | bge ->fff_newstr
1653 | add STR:CARG1, GL, #offsetof(global_State, strempty)
1654 | movn TMP1, #~LJ_TSTR
1655 | add CARG1, CARG1, TMP1, lsl #47
1656 | b ->fff_restv
1657 |
1658 |.macro ffstring_op, name
1659 | .ffunc string_ .. name
1660 | ffgccheck
1661 | ldr CARG2, [BASE]
1662 | cmp NARGS8:RC, #8
1663 | asr ITYPE, CARG2, #47
1664 | ccmn ITYPE, #-LJ_TSTR, #0, hs
1665 | and STR:CARG2, CARG2, #LJ_GCVMASK
1666 | bne ->fff_fallback
1667 | ldr TMP0, GL->tmpbuf.b
1668 | add SBUF:CARG1, GL, #offsetof(global_State, tmpbuf)
1669 | str BASE, L->base
1670 | str PC, SAVE_PC
1671 | str L, GL->tmpbuf.L
1672 | str TMP0, GL->tmpbuf.w
1673 | bl extern lj_buf_putstr_ .. name
1674 | bl extern lj_buf_tostr
1675 | b ->fff_resstr
1676 |.endmacro
1677 |
1678 |ffstring_op reverse
1679 |ffstring_op lower
1680 |ffstring_op upper
1681 |
1682 |//-- Bit library --------------------------------------------------------
1683 |
1684 |// FP number to bit conversion. Clobbers CARG1-CARG2, FARG1-FARG2.
1685 |->vm_tobit_fb:
1686 | bls ->fff_fallback
1687 | fmov FARG1, CARG1
1688 | movz CARG2, #0x4338, lsl #48
1689 | fmov FARG2, CARG2
1690 | fadd FARG1, FARG1, FARG2
1691 | fmov CARG1w, s0
1692 | br lr
1693 |
1694 |.macro .ffunc_bit, name
1695 | .ffunc_1 bit_..name
1696 | adr lr, >1
1697 | checkint CARG1, ->vm_tobit_fb
1698 |1:
1699 | bti_jump
1700 |.endmacro
1701 |
1702 |.macro .ffunc_bit_op, name, ins
1703 | .ffunc_bit name
1704 | mov RA, #8
1705 | mov TMP0w, CARG1w
1706 | adr lr, >2
1707 |1:
1708 | ldr CARG1, [BASE, RA]
1709 | cmp RA, NARGS8:RC
1710 | add RA, RA, #8
1711 | bge >9
1712 | checkint CARG1, ->vm_tobit_fb
1713 |2:
1714 | bti_jump
1715 | ins TMP0w, TMP0w, CARG1w
1716 | b <1
1717 |.endmacro
1718 |
1719 |.ffunc_bit_op band, and
1720 |.ffunc_bit_op bor, orr
1721 |.ffunc_bit_op bxor, eor
1722 |
1723 |.ffunc_bit tobit
1724 | mov TMP0w, CARG1w
1725 |9: // Label reused by .ffunc_bit_op users.
1726 | add_TISNUM CARG1, TMP0
1727 | b ->fff_restv
1728 |
1729 |.ffunc_bit bswap
1730 | rev TMP0w, CARG1w
1731 | add_TISNUM CARG1, TMP0
1732 | b ->fff_restv
1733 |
1734 |.ffunc_bit bnot
1735 | mvn TMP0w, CARG1w
1736 | add_TISNUM CARG1, TMP0
1737 | b ->fff_restv
1738 |
1739 |.macro .ffunc_bit_sh, name, ins, shmod
1740 | .ffunc bit_..name
1741 | ldp TMP0, CARG1, [BASE]
1742 | cmp NARGS8:RC, #16
1743 | blo ->fff_fallback
1744 | adr lr, >1
1745 | checkint CARG1, ->vm_tobit_fb
1746 |1:
1747 | bti_jump
1748 |.if shmod == 0
1749 | mov TMP1, CARG1
1750 |.else
1751 | neg TMP1, CARG1
1752 |.endif
1753 | mov CARG1, TMP0
1754 | adr lr, >2
1755 | checkint CARG1, ->vm_tobit_fb
1756 |2:
1757 | bti_jump
1758 | ins TMP0w, CARG1w, TMP1w
1759 | add_TISNUM CARG1, TMP0
1760 | b ->fff_restv
1761 |.endmacro
1762 |
1763 |.ffunc_bit_sh lshift, lsl, 0
1764 |.ffunc_bit_sh rshift, lsr, 0
1765 |.ffunc_bit_sh arshift, asr, 0
1766 |.ffunc_bit_sh rol, ror, 1
1767 |.ffunc_bit_sh ror, ror, 0
1768 |
1769 |//-----------------------------------------------------------------------
1770 |
1771 |->fff_fallback: // Call fast function fallback handler.
1772 | // BASE = new base, RC = nargs*8
1773 | ldp CFUNC:CARG3, PC, [BASE, FRAME_FUNC] // Fallback may overwrite PC.
1774 | ldr TMP2, L->maxstack
1775 | add TMP1, BASE, NARGS8:RC
1776 | stp BASE, TMP1, L->base
1777 | and CFUNC:CARG3, CARG3, #LJ_GCVMASK
1778 | add TMP1, TMP1, #8*LUA_MINSTACK
1779 | ldr CARG3, CFUNC:CARG3->f
1780 | str PC, SAVE_PC // Redundant (but a defined value).
1781 | cmp TMP1, TMP2
1782 | mov CARG1, L
1783 | bhi >5 // Need to grow stack.
1784 | blr_auth CARG3 // (lua_State *L)
1785 | // Either throws an error, or recovers and returns -1, 0 or nresults+1.
1786 | ldr BASE, L->base
1787 | cmp CRET1w, #0
1788 | lsl RC, CRET1, #3
1789 | sub RA, BASE, #16
1790 | bgt ->fff_res // Returned nresults+1?
1791 |1: // Returned 0 or -1: retry fast path.
1792 | ldr CARG1, L->top
1793 | ldr CFUNC:CARG3, [BASE, FRAME_FUNC]
1794 | sub NARGS8:RC, CARG1, BASE
1795 | bne ->vm_call_tail // Returned -1?
1796 | and CFUNC:CARG3, CARG3, #LJ_GCVMASK
1797 | ins_callt // Returned 0: retry fast path.
1798 |
1799 |// Reconstruct previous base for vmeta_call during tailcall.
1800 |->vm_call_tail:
1801 | ands TMP0, PC, #FRAME_TYPE
1802 | and TMP1, PC, #~FRAME_TYPEP
1803 | bne >3
1804 | ldrb RAw, [PC, #-4+OFS_RA]
1805 | lsl RA, RA, #3
1806 | add TMP1, RA, #16
1807 |3:
1808 | sub RB, BASE, TMP1
1809 | b ->vm_call_dispatch // Resolve again for tailcall.
1810 |
1811 |5: // Grow stack for fallback handler.
1812 | mov CARG2, #LUA_MINSTACK
1813 | bl extern lj_state_growstack // (lua_State *L, int n)
1814 | ldr BASE, L->base
1815 | cmp CARG1, CARG1 // Set zero-flag to force retry.
1816 | b <1
1817 |
1818 |->fff_gcstep: // Call GC step function.
1819 | // BASE = new base, RC = nargs*8
1820 | sp_auth
1821 | add CARG2, BASE, NARGS8:RC // Calculate L->top.
1822 | mov RA, lr
1823 | stp BASE, CARG2, L->base
1824 | str PC, SAVE_PC // Redundant (but a defined value).
1825 | mov CARG1, L
1826 | bl extern lj_gc_step // (lua_State *L)
1827 | ldp BASE, CARG2, L->base
1828 | ldr CFUNC:CARG3, [BASE, FRAME_FUNC]
1829 | mov lr, RA // Help return address predictor.
1830 | sub NARGS8:RC, CARG2, BASE // Calculate nargs*8.
1831 | and CFUNC:CARG3, CARG3, #LJ_GCVMASK
1832 | ret_auth
1833 |
1834 |//-----------------------------------------------------------------------
1835 |//-- Special dispatch targets -------------------------------------------
1836 |//-----------------------------------------------------------------------
1837 |
1838 |->vm_record: // Dispatch target for recording phase.
1839 |.if JIT
1840 | bti_jump
1841 | ldrb CARG1w, GL->hookmask
1842 | tst CARG1, #HOOK_VMEVENT // No recording while in vmevent.
1843 | bne >5
1844 | // Decrement the hookcount for consistency, but always do the call.
1845 | ldr CARG2w, GL->hookcount
1846 | tst CARG1, #HOOK_ACTIVE
1847 | bne >1
1848 | sub CARG2w, CARG2w, #1
1849 | tst CARG1, #LUA_MASKLINE|LUA_MASKCOUNT
1850 | beq >1
1851 | str CARG2w, GL->hookcount
1852 | b >1
1853 |.endif
1854 |
1855 |->vm_rethook: // Dispatch target for return hooks.
1856 | bti_jump
1857 | ldrb TMP2w, GL->hookmask
1858 | tbz TMP2w, #HOOK_ACTIVE_SHIFT, >1 // Hook already active?
1859 |5: // Re-dispatch to static ins.
1860 | ldr TMP0, [TMP1, #GG_G2DISP+GG_DISP2STATIC]
1861 | br_auth TMP0
1862 |
1863 |->vm_inshook: // Dispatch target for instr/line hooks.
1864 | bti_jump
1865 | ldrb TMP2w, GL->hookmask
1866 | ldr TMP3w, GL->hookcount
1867 | tbnz TMP2w, #HOOK_ACTIVE_SHIFT, <5 // Hook already active?
1868 | tst TMP2w, #LUA_MASKLINE|LUA_MASKCOUNT
1869 | beq <5
1870 | sub TMP3w, TMP3w, #1
1871 | str TMP3w, GL->hookcount
1872 | cbz TMP3w, >1
1873 | tbz TMP2w, #LUA_HOOKLINE, <5
1874 |1:
1875 | mov CARG1, L
1876 | str BASE, L->base
1877 | mov CARG2, PC
1878 | // SAVE_PC must hold the _previous_ PC. The callee updates it with PC.
1879 | bl extern lj_dispatch_ins // (lua_State *L, const BCIns *pc)
1880 |3:
1881 | ldr BASE, L->base
1882 |4: // Re-dispatch to static ins.
1883 | ldr INSw, [PC, #-4]
1884 | add TMP1, GL, INS, uxtb #3
1885 | decode_RA RA, INS
1886 | ldr TMP0, [TMP1, #GG_G2DISP+GG_DISP2STATIC]
1887 | decode_RD RC, INS
1888 | br_auth TMP0
1889 |
1890 |->cont_hook: // Continue from hook yield.
1891 | bti_jump
1892 | ldr CARG1, [CARG4, #-40]
1893 | add PC, PC, #4
1894 | str CARG1w, SAVE_MULTRES // Restore MULTRES for *M ins.
1895 | b <4
1896 |
1897 |->vm_hotloop: // Hot loop counter underflow.
1898 |.if JIT
1899 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC] // Same as curr_topL(L).
1900 | add CARG1, GL, #GG_G2DISP+GG_DISP2J
1901 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
1902 | str PC, SAVE_PC
1903 | ldr CARG3, LFUNC:CARG3->pc
1904 | mov CARG2, PC
1905 | str L, [GL, #GL_J(L)]
1906 | ldrb CARG3w, [CARG3, #PC2PROTO(framesize)]
1907 | str BASE, L->base
1908 | add CARG3, BASE, CARG3, lsl #3
1909 | str CARG3, L->top
1910 | bl extern lj_trace_hot // (jit_State *J, const BCIns *pc)
1911 | b <3
1912 |.endif
1913 |
1914 |->vm_callhook: // Dispatch target for call hooks.
1915 | bti_jump
1916 | mov CARG2, PC
1917 |.if JIT
1918 | b >1
1919 |.endif
1920 |
1921 |->vm_hotcall: // Hot call counter underflow.
1922 |.if JIT
1923 | orr CARG2, PC, #1
1924 |1:
1925 |.endif
1926 | add TMP1, BASE, NARGS8:RC
1927 | str PC, SAVE_PC
1928 | mov CARG1, L
1929 | sub RA, RA, BASE
1930 | stp BASE, TMP1, L->base
1931 | bl extern lj_dispatch_call // (lua_State *L, const BCIns *pc)
1932 | // Returns ASMFunction.
1933 | ldp BASE, TMP1, L->base
1934 | str xzr, SAVE_PC // Invalidate for subsequent line hook.
1935 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC]
1936 | add RA, BASE, RA
1937 | sub NARGS8:RC, TMP1, BASE
1938 | ldr INSw, [PC, #-4]
1939 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
1940 | br_auth CRET1
1941 |
1942 |->cont_stitch: // Trace stitching.
1943 |.if JIT
1944 | // RA = resultptr, CARG4 = meta base
1945 | bti_jump
1946 | ldr RBw, SAVE_MULTRES
1947 | ldr INSw, [PC, #-4]
1948 | ldr TRACE:CARG3, [CARG4, #-40] // Save previous trace.
1949 | subs RB, RB, #8
1950 | decode_RA RC, INS // Call base.
1951 | and CARG3, CARG3, #LJ_GCVMASK
1952 | beq >2
1953 |1: // Move results down.
1954 | ldr CARG1, [RA], #8
1955 | subs RB, RB, #8
1956 | str CARG1, [BASE, RC, lsl #3]
1957 | add RC, RC, #1
1958 | bne <1
1959 |2:
1960 | decode_RA RA, INS
1961 | decode_RB RB, INS
1962 | add RA, RA, RB
1963 |3:
1964 | cmp RA, RC
1965 | bhi >9 // More results wanted?
1966 |
1967 | ldrh RAw, TRACE:CARG3->traceno
1968 | ldrh RCw, TRACE:CARG3->link
1969 | cmp RCw, RAw
1970 | beq ->cont_nop // Blacklisted.
1971 | cmp RCw, #0
1972 | bne =>BC_JLOOP // Jump to stitched trace.
1973 |
1974 | // Stitch a new trace to the previous trace.
1975 | mov CARG1, #GL_J(exitno)
1976 | str RAw, [GL, CARG1]
1977 | mov CARG1, #GL_J(L)
1978 | str L, [GL, CARG1]
1979 | str BASE, L->base
1980 | add CARG1, GL, #GG_G2J
1981 | mov CARG2, PC
1982 | bl extern lj_dispatch_stitch // (jit_State *J, const BCIns *pc)
1983 | ldr BASE, L->base
1984 | b ->cont_nop
1985 |
1986 |9: // Fill up results with nil.
1987 | str TISNIL, [BASE, RC, lsl #3]
1988 | add RC, RC, #1
1989 | b <3
1990 |.endif
1991 |
1992 |->vm_profhook: // Dispatch target for profiler hook.
1993#if LJ_HASPROFILE
1994 | bti_jump
1995 | mov CARG1, L
1996 | str BASE, L->base
1997 | mov CARG2, PC
1998 | bl extern lj_dispatch_profile // (lua_State *L, const BCIns *pc)
1999 | // HOOK_PROFILE is off again, so re-dispatch to dynamic instruction.
2000 | ldr BASE, L->base
2001 | sub PC, PC, #4
2002 | b ->cont_nop
2003#endif
2004 |
2005 |//-----------------------------------------------------------------------
2006 |//-- Trace exit handler -------------------------------------------------
2007 |//-----------------------------------------------------------------------
2008 |
2009 |.macro savex_, a, b
2010 | stp d..a, d..b, [sp, #a*8]
2011 | stp x..a, x..b, [sp, #32*8+a*8]
2012 |.endmacro
2013 |
2014 |->vm_exit_handler:
2015 |.if JIT
2016 | bti_call
2017 | sub sp, sp, #(64*8)
2018 | savex_, 0, 1
2019 | savex_, 2, 3
2020 | savex_, 4, 5
2021 | savex_, 6, 7
2022 | savex_, 8, 9
2023 | savex_, 10, 11
2024 | savex_, 12, 13
2025 | savex_, 14, 15
2026 | savex_, 16, 17
2027 | savex_, 18, 19
2028 | savex_, 20, 21
2029 | savex_, 22, 23
2030 | savex_, 24, 25
2031 | savex_, 26, 27
2032 | savex_, 28, 29
2033 | stp d30, d31, [sp, #30*8]
2034 | ldr CARG1, [sp, #64*8] // Load original value of lr.
2035 | add CARG3, sp, #64*8 // Recompute original value of sp.
2036 | mv_vmstate CARG4w, EXIT
2037 | stp xzr, CARG3, [sp, #62*8] // Store 0/sp in RID_LR/RID_SP.
2038 | sub CARG1, CARG1, lr
2039 | ldr L, GL->cur_L
2040 | lsr CARG1, CARG1, #2
2041 | ldr BASE, GL->jit_base
2042 | sub CARG1, CARG1, #2
2043 | ldr CARG2w, [lr] // Load trace number.
2044 | st_vmstate CARG4w
2045 |.if ENDIAN_BE
2046 | rev32 CARG2, CARG2
2047 |.endif
2048 | str BASE, L->base
2049 | ubfx CARG2w, CARG2w, #5, #16
2050 | str CARG1w, [GL, #GL_J(exitno)]
2051 | str CARG2w, [GL, #GL_J(parent)]
2052 | str L, [GL, #GL_J(L)]
2053 | str xzr, GL->jit_base
2054 | add CARG1, GL, #GG_G2J
2055 | mov CARG2, sp
2056 | bl extern lj_trace_exit // (jit_State *J, ExitState *ex)
2057 | // Returns MULTRES (unscaled) or negated error code.
2058 | ldr CARG2, L->cframe
2059 | ldr BASE, L->base
2060 | and sp, CARG2, #CFRAME_RAWMASK
2061 | ldr PC, SAVE_PC // Get SAVE_PC.
2062 | str L, SAVE_L // Set SAVE_L (on-trace resume/yield).
2063 | b >1
2064 |.endif
2065 |
2066 |->vm_exit_interp:
2067 | bti_jump
2068 | // CARG1 = MULTRES or negated error code, BASE, PC and GL set.
2069 |.if JIT
2070 | ldr L, SAVE_L
2071 |1:
2072 | init_constants
2073 | cmn CARG1w, #LUA_ERRERR
2074 | bhs >9 // Check for error from exit.
2075 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
2076 | lsl RC, CARG1, #3
2077 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
2078 | str RCw, SAVE_MULTRES
2079 | str BASE, L->base
2080 | ldr CARG2, LFUNC:CARG2->pc
2081 | str xzr, GL->jit_base
2082 | mv_vmstate CARG4w, INTERP
2083 | ldr KBASE, [CARG2, #PC2PROTO(k)]
2084 | // Modified copy of ins_next which handles function header dispatch, too.
2085 | ldrb RBw, [PC, # OFS_OP]
2086 | ldr INSw, [PC], #4
2087 | st_vmstate CARG4w
2088 | cmn CARG1w, #17 // Static dispatch?
2089 | beq >5
2090 | cmp RBw, #BC_FUNCC+2 // Fast function?
2091 | add TMP1, GL, INS, uxtb #3
2092 | bhs >4
2093 |2:
2094 | cmp RBw, #BC_FUNCF // Function header?
2095 | add TMP0, GL, RB, uxtb #3
2096 | ldr RB, [TMP0, #GG_G2DISP]
2097 | decode_RA RA, INS
2098 | lsr TMP0, INS, #16
2099 | csel RC, TMP0, RC, lo
2100 | blo >3
2101 | ldr CARG3, [BASE, FRAME_FUNC]
2102 | sub RC, RC, #8
2103 | add RA, BASE, RA, lsl #3 // Yes: RA = BASE+framesize*8, RC = nargs*8
2104 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
2105 |3:
2106 | br_auth RB
2107 |
2108 |4: // Check frame below fast function.
2109 | ldr CARG1, [BASE, FRAME_PC]
2110 | ands CARG2, CARG1, #FRAME_TYPE
2111 | bne <2 // Trace stitching continuation?
2112 | // Otherwise set KBASE for Lua function below fast function.
2113 | ldr CARG3w, [CARG1, #-4]
2114 | decode_RA CARG1, CARG3
2115 | sub CARG2, BASE, CARG1, lsl #3
2116 | ldr LFUNC:CARG3, [CARG2, #-32]
2117 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
2118 | ldr CARG3, LFUNC:CARG3->pc
2119 | ldr KBASE, [CARG3, #PC2PROTO(k)]
2120 | b <2
2121 |
2122 |5: // Dispatch to static entry of original ins replaced by BC_JLOOP.
2123 | ldr RA, [GL, #GL_J(trace)]
2124 | decode_RD RC, INS
2125 | ldr TRACE:RA, [RA, RC, lsl #3]
2126 | ldr INSw, TRACE:RA->startins
2127 | add TMP0, GL, INS, uxtb #3
2128 | decode_RA RA, INS
2129 | ldr RB, [TMP0, #GG_G2DISP+GG_DISP2STATIC]
2130 | decode_RD RC, INS
2131 | br_auth RB
2132 |
2133 |9: // Rethrow error from the right C frame.
2134 | neg CARG2w, CARG1w
2135 | mov CARG1, L
2136 | bl extern lj_err_trace // (lua_State *L, int errcode)
2137 |.endif
2138 |
2139 |//-----------------------------------------------------------------------
2140 |//-- Math helper functions ----------------------------------------------
2141 |//-----------------------------------------------------------------------
2142 |
2143 | // int lj_vm_modi(int dividend, int divisor);
2144 |->vm_modi:
2145 | bti_call
2146 | eor CARG4w, CARG1w, CARG2w
2147 | cmp CARG4w, #0
2148 | eor CARG3w, CARG1w, CARG1w, asr #31
2149 | eor CARG4w, CARG2w, CARG2w, asr #31
2150 | sub CARG3w, CARG3w, CARG1w, asr #31
2151 | sub CARG4w, CARG4w, CARG2w, asr #31
2152 | udiv CARG1w, CARG3w, CARG4w
2153 | msub CARG1w, CARG1w, CARG4w, CARG3w
2154 | ccmp CARG1w, #0, #4, mi
2155 | sub CARG3w, CARG1w, CARG4w
2156 | csel CARG1w, CARG1w, CARG3w, eq
2157 | eor CARG3w, CARG1w, CARG2w
2158 | cmp CARG3w, #0
2159 | cneg CARG1w, CARG1w, mi
2160 | ret
2161 |
2162 |//-----------------------------------------------------------------------
2163 |//-- Number conversion functions ----------------------------------------
2164 |//-----------------------------------------------------------------------
2165 |
2166 |// int64_t lj_vm_num2int_check(double x)
2167 |->vm_num2int_check:
2168 | fcvtzs CRET1w, FARG1
2169 | scvtf FARG2, CRET1w
2170 | fcmp FARG2, FARG1
2171 | bne >1
2172 | ret
2173 |1:
2174 | mov CRET1, #0x8000000080000000
2175 | ret
2176 |
2177 |// int64_t lj_vm_num2i64(double x)
2178 |->vm_num2i64:
2179 | fcvtzs CRET1, FARG1
2180 | ret
2181 |
2182 |// uint64_t lj_vm_num2u64(double x)
2183 |->vm_num2u64:
2184 | fcvtzs CRET1, FARG1
2185 | fcvtzu CARG2, FARG1
2186 | cmn CRET1, #1 // Set overflow if CRET1 == INT64_MAX.
2187 | csel CRET1, CRET1, CARG2, vc // No overflow ? i64 : u64.
2188 | ret
2189 |
2190 |// int32_t lj_vm_tobit(double x)
2191 |->vm_tobit:
2192 | movz CRET1, #0x4338, lsl #48 // 2^52 + 2^51.
2193 | fmov FARG2, CRET1
2194 | fadd FARG1, FARG1, FARG2
2195 | fmov CRET1w, s0
2196 | ret
2197 |
2198 |//-----------------------------------------------------------------------
2199 |//-- Miscellaneous functions --------------------------------------------
2200 |//-----------------------------------------------------------------------
2201 |
2202 |.define NEXT_TAB, TAB:CARG1
2203 |.define NEXT_RES, CARG1
2204 |.define NEXT_IDX, CARG2w
2205 |.define NEXT_LIM, CARG3w
2206 |.define NEXT_TMP0, TMP0
2207 |.define NEXT_TMP0w, TMP0w
2208 |.define NEXT_TMP1, TMP1
2209 |.define NEXT_TMP1w, TMP1w
2210 |.define NEXT_RES_PTR, sp
2211 |.define NEXT_RES_VAL, [sp]
2212 |.define NEXT_RES_KEY, [sp, #8]
2213 |
2214 |// TValue *lj_vm_next(GCtab *t, uint32_t idx)
2215 |// Next idx returned in CRET2w.
2216 |->vm_next:
2217 |.if JIT
2218 | bti_call
2219 | ldr NEXT_LIM, NEXT_TAB->asize
2220 | ldr NEXT_TMP1, NEXT_TAB->array
2221 |1: // Traverse array part.
2222 | subs NEXT_TMP0w, NEXT_IDX, NEXT_LIM
2223 | bhs >5 // Index points after array part?
2224 | ldr NEXT_TMP0, [NEXT_TMP1, NEXT_IDX, uxtw #3]
2225 | cmn NEXT_TMP0, #-LJ_TNIL
2226 | cinc NEXT_IDX, NEXT_IDX, eq
2227 | beq <1 // Skip holes in array part.
2228 | str NEXT_TMP0, NEXT_RES_VAL
2229 | movz NEXT_TMP0w, #(LJ_TISNUM>>1)&0xffff, lsl #16
2230 | stp NEXT_IDX, NEXT_TMP0w, NEXT_RES_KEY
2231 | add NEXT_IDX, NEXT_IDX, #1
2232 | mov NEXT_RES, NEXT_RES_PTR
2233 |4:
2234 | ret
2235 |
2236 |5: // Traverse hash part.
2237 | ldr NEXT_TMP1w, NEXT_TAB->hmask
2238 | ldr NODE:NEXT_RES, NEXT_TAB->node
2239 | add NEXT_TMP0w, NEXT_TMP0w, NEXT_TMP0w, lsl #1
2240 | add NEXT_LIM, NEXT_LIM, NEXT_TMP1w
2241 | add NODE:NEXT_RES, NODE:NEXT_RES, NEXT_TMP0w, uxtw #3
2242 |6:
2243 | cmp NEXT_IDX, NEXT_LIM
2244 | bhi >9
2245 | ldr NEXT_TMP0, NODE:NEXT_RES->val
2246 | cmn NEXT_TMP0, #-LJ_TNIL
2247 | add NEXT_IDX, NEXT_IDX, #1
2248 | bne <4
2249 | // Skip holes in hash part.
2250 | add NODE:NEXT_RES, NODE:NEXT_RES, #sizeof(Node)
2251 | b <6
2252 |
2253 |9: // End of iteration. Set the key to nil (not the value).
2254 | movn NEXT_TMP0, #0
2255 | str NEXT_TMP0, NEXT_RES_KEY
2256 | mov NEXT_RES, NEXT_RES_PTR
2257 | ret
2258 |.endif
2259 |
2260 |//-----------------------------------------------------------------------
2261 |//-- FFI helper functions -----------------------------------------------
2262 |//-----------------------------------------------------------------------
2263 |
2264 |// Handler for callback functions.
2265 |// Saveregs already performed. Callback slot number in w9, g in x10.
2266 |->vm_ffi_callback:
2267 |.if FFI
2268 |.type CTSTATE, CTState, PC
2269 | saveregs
2270 | ldr CTSTATE, GL:x10->ctype_state
2271 | mov GL, x10
2272 | add x10, sp, # CFRAME_SPACE
2273 | str w9, CTSTATE->cb.slot
2274 | stp x0, x1, CTSTATE->cb.gpr[0]
2275 | stp d0, d1, CTSTATE->cb.fpr[0]
2276 | stp x2, x3, CTSTATE->cb.gpr[2]
2277 | stp d2, d3, CTSTATE->cb.fpr[2]
2278 | stp x4, x5, CTSTATE->cb.gpr[4]
2279 | stp d4, d5, CTSTATE->cb.fpr[4]
2280 | stp x6, x7, CTSTATE->cb.gpr[6]
2281 | stp d6, d7, CTSTATE->cb.fpr[6]
2282 | str x10, CTSTATE->cb.stack
2283 | mov CARG1, CTSTATE
2284 | str CTSTATE, SAVE_PC // Any value outside of bytecode is ok.
2285 | mov CARG2, sp
2286 | bl extern lj_ccallback_enter // (CTState *cts, void *cf)
2287 | // Returns lua_State *.
2288 | ldp BASE, RC, L:CRET1->base
2289 | init_constants
2290 | mov L, CRET1
2291 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC]
2292 | sub RC, RC, BASE
2293 | st_vmstate ST_INTERP
2294 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
2295 | ins_callt
2296 |.endif
2297 |
2298 |->cont_ffi_callback: // Return from FFI callback.
2299 |.if FFI
2300 | ldr CTSTATE, GL->ctype_state
2301 | stp BASE, CARG4, L->base
2302 | str L, CTSTATE->L
2303 | mov CARG1, CTSTATE
2304 | mov CARG2, RA
2305 | bl extern lj_ccallback_leave // (CTState *cts, TValue *o)
2306 | ldp x0, x1, CTSTATE->cb.gpr[0]
2307 | ldp d0, d1, CTSTATE->cb.fpr[0]
2308 | b ->vm_leave_unw
2309 |.endif
2310 |
2311 |->vm_ffi_call: // Call C function via FFI.
2312 | // Caveat: needs special frame unwinding, see below.
2313 |.if FFI
2314 | .type CCSTATE, CCallState, x19
2315 | sp_auth
2316 | stp_unwind CCSTATE, x20, [sp, #-32]!
2317 | stp fp, lr, [sp, #16]
2318 | add fp, sp, #16
2319 | mov CCSTATE, x0
2320 | ldr TMP0w, CCSTATE:x0->spadj
2321 | ldrb TMP1w, CCSTATE->nsp
2322 | add TMP2, CCSTATE, #offsetof(CCallState, stack)
2323 | subs TMP1, TMP1, #8
2324 | ldr TMP3, CCSTATE->func
2325 | sub sp, sp, TMP0
2326 | bmi >2
2327 |1: // Copy stack slots
2328 | ldr TMP0, [TMP2, TMP1]
2329 | str TMP0, [sp, TMP1]
2330 | subs TMP1, TMP1, #8
2331 | bpl <1
2332 |2:
2333 | ldp x0, x1, CCSTATE->gpr[0]
2334 | ldp d0, d1, CCSTATE->fpr[0]
2335 | ldp x2, x3, CCSTATE->gpr[2]
2336 | ldp d2, d3, CCSTATE->fpr[2]
2337 | ldp x4, x5, CCSTATE->gpr[4]
2338 | ldp d4, d5, CCSTATE->fpr[4]
2339 | ldp x6, x7, CCSTATE->gpr[6]
2340 | ldp d6, d7, CCSTATE->fpr[6]
2341 | ldr x8, CCSTATE->retp
2342 | blr_auth TMP3
2343 | sub sp, fp, #16
2344 | stp x0, x1, CCSTATE->gpr[0]
2345 | stp d0, d1, CCSTATE->fpr[0]
2346 | stp d2, d3, CCSTATE->fpr[2]
2347 | ldp fp, lr, [sp, #16]
2348 | ldp_unwind CCSTATE, x20, [sp], #32
2349 | ret_auth
2350 |.endif
2351 |// Note: vm_ffi_call must be the last function in this object file!
2352 |
2353 |//-----------------------------------------------------------------------
2354}
2355
2356/* Generate the code for a single instruction. */
2357static void build_ins(BuildCtx *ctx, BCOp op, int defop)
2358{
2359 int vk = 0;
2360 |=>defop:
2361
2362 switch (op) {
2363#if !LJ_HASJIT
2364 case BC_FORL:
2365 case BC_JFORI:
2366 case BC_JFORL:
2367 case BC_ITERL:
2368 case BC_JITERL:
2369 case BC_LOOP:
2370 case BC_JLOOP:
2371 case BC_FUNCF:
2372 case BC_JFUNCF:
2373 case BC_JFUNCV:
2374#endif
2375 case BC_FUNCV: /* NYI: compiled vararg functions. */
2376 break; /* Avoid redundant bti instructions. */
2377 default:
2378 | bti_jump
2379 break;
2380 }
2381
2382 switch (op) {
2383
2384 /* -- Comparison ops ---------------------------------------------------- */
2385
2386 /* Remember: all ops branch for a true comparison, fall through otherwise. */
2387
2388 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
2389 | // RA = src1, RC = src2, JMP with RC = target
2390 | ldr CARG1, [BASE, RA, lsl #3]
2391 | ldrh RBw, [PC, # OFS_RD]
2392 | ldr CARG2, [BASE, RC, lsl #3]
2393 | add PC, PC, #4
2394 | add RB, PC, RB, lsl #2
2395 | sub RB, RB, #0x20000
2396 | checkint CARG1, >3
2397 | checkint CARG2, >4
2398 | cmp CARG1w, CARG2w
2399 if (op == BC_ISLT) {
2400 | csel PC, RB, PC, lt
2401 } else if (op == BC_ISGE) {
2402 | csel PC, RB, PC, ge
2403 } else if (op == BC_ISLE) {
2404 | csel PC, RB, PC, le
2405 } else {
2406 | csel PC, RB, PC, gt
2407 }
2408 |1:
2409 | ins_next
2410 |
2411 |3: // RA not int.
2412 | ldr FARG1, [BASE, RA, lsl #3]
2413 | blo ->vmeta_comp
2414 | ldr FARG2, [BASE, RC, lsl #3]
2415 | cmp TISNUMhi, CARG2, lsr #32
2416 | bhi >5
2417 | bne ->vmeta_comp
2418 | // RA number, RC int.
2419 | scvtf FARG2, CARG2w
2420 | b >5
2421 |
2422 |4: // RA int, RC not int
2423 | ldr FARG2, [BASE, RC, lsl #3]
2424 | blo ->vmeta_comp
2425 | // RA int, RC number.
2426 | scvtf FARG1, CARG1w
2427 |
2428 |5: // RA number, RC number
2429 | fcmp FARG1, FARG2
2430 | // To preserve NaN semantics GE/GT branch on unordered, but LT/LE don't.
2431 if (op == BC_ISLT) {
2432 | csel PC, RB, PC, lo
2433 } else if (op == BC_ISGE) {
2434 | csel PC, RB, PC, hs
2435 } else if (op == BC_ISLE) {
2436 | csel PC, RB, PC, ls
2437 } else {
2438 | csel PC, RB, PC, hi
2439 }
2440 | b <1
2441 break;
2442
2443 case BC_ISEQV: case BC_ISNEV:
2444 vk = op == BC_ISEQV;
2445 | // RA = src1, RC = src2, JMP with RC = target
2446 | ldr CARG1, [BASE, RA, lsl #3]
2447 | add RC, BASE, RC, lsl #3
2448 | ldrh RBw, [PC, # OFS_RD]
2449 | ldr CARG3, [RC]
2450 | add PC, PC, #4
2451 | add RB, PC, RB, lsl #2
2452 | sub RB, RB, #0x20000
2453 | asr ITYPE, CARG3, #47
2454 | cmn ITYPE, #-LJ_TISNUM
2455 if (vk) {
2456 | bls ->BC_ISEQN_Z
2457 } else {
2458 | bls ->BC_ISNEN_Z
2459 }
2460 | // RC is not a number.
2461 | asr TMP0, CARG1, #47
2462 |.if FFI
2463 | // Check if RC or RA is a cdata.
2464 | cmn ITYPE, #-LJ_TCDATA
2465 | ccmn TMP0, #-LJ_TCDATA, #4, ne
2466 | beq ->vmeta_equal_cd
2467 |.endif
2468 | cmp CARG1, CARG3
2469 | bne >2
2470 | // Tag and value are equal.
2471 if (vk) {
2472 |->BC_ISEQV_Z:
2473 | mov PC, RB // Perform branch.
2474 }
2475 |1:
2476 | ins_next
2477 |
2478 |2: // Check if the tags are the same and it's a table or userdata.
2479 | cmp ITYPE, TMP0
2480 | ccmn ITYPE, #-LJ_TISTABUD, #2, eq
2481 if (vk) {
2482 | bhi <1
2483 } else {
2484 | bhi ->BC_ISEQV_Z // Reuse code from opposite instruction.
2485 }
2486 | // Different tables or userdatas. Need to check __eq metamethod.
2487 | // Field metatable must be at same offset for GCtab and GCudata!
2488 | and TAB:CARG2, CARG1, #LJ_GCVMASK
2489 | ldr TAB:TMP2, TAB:CARG2->metatable
2490 if (vk) {
2491 | cbz TAB:TMP2, <1 // No metatable?
2492 | ldrb TMP1w, TAB:TMP2->nomm
2493 | mov CARG4, #0 // ne = 0
2494 | tbnz TMP1w, #MM_eq, <1 // 'no __eq' flag set: done.
2495 } else {
2496 | cbz TAB:TMP2, ->BC_ISEQV_Z // No metatable?
2497 | ldrb TMP1w, TAB:TMP2->nomm
2498 | mov CARG4, #1 // ne = 1.
2499 | tbnz TMP1w, #MM_eq, ->BC_ISEQV_Z // 'no __eq' flag set: done.
2500 }
2501 | b ->vmeta_equal
2502 break;
2503
2504 case BC_ISEQS: case BC_ISNES:
2505 vk = op == BC_ISEQS;
2506 | // RA = src, RC = str_const (~), JMP with RC = target
2507 | ldr CARG1, [BASE, RA, lsl #3]
2508 | mvn RC, RC
2509 | ldrh RBw, [PC, # OFS_RD]
2510 | ldr CARG2, [KBASE, RC, lsl #3]
2511 | add PC, PC, #4
2512 | movn TMP0, #~LJ_TSTR
2513 |.if FFI
2514 | asr ITYPE, CARG1, #47
2515 |.endif
2516 | add RB, PC, RB, lsl #2
2517 | add CARG2, CARG2, TMP0, lsl #47
2518 | sub RB, RB, #0x20000
2519 |.if FFI
2520 | cmn ITYPE, #-LJ_TCDATA
2521 | beq ->vmeta_equal_cd
2522 |.endif
2523 | cmp CARG1, CARG2
2524 if (vk) {
2525 | csel PC, RB, PC, eq
2526 } else {
2527 | csel PC, RB, PC, ne
2528 }
2529 | ins_next
2530 break;
2531
2532 case BC_ISEQN: case BC_ISNEN:
2533 vk = op == BC_ISEQN;
2534 | // RA = src, RC = num_const (~), JMP with RC = target
2535 | ldr CARG1, [BASE, RA, lsl #3]
2536 | add RC, KBASE, RC, lsl #3
2537 | ldrh RBw, [PC, # OFS_RD]
2538 | ldr CARG3, [RC]
2539 | add PC, PC, #4
2540 | add RB, PC, RB, lsl #2
2541 | sub RB, RB, #0x20000
2542 if (vk) {
2543 |->BC_ISEQN_Z:
2544 } else {
2545 |->BC_ISNEN_Z:
2546 }
2547 | checkint CARG1, >4
2548 | checkint CARG3, >6
2549 | cmp CARG1w, CARG3w
2550 |1:
2551 if (vk) {
2552 | csel PC, RB, PC, eq
2553 |2:
2554 } else {
2555 |2:
2556 | csel PC, RB, PC, ne
2557 }
2558 |3:
2559 | ins_next
2560 |
2561 |4: // RA not int.
2562 |.if FFI
2563 | blo >7
2564 |.else
2565 | blo <2
2566 |.endif
2567 | ldr FARG1, [BASE, RA, lsl #3]
2568 | ldr FARG2, [RC]
2569 | cmp TISNUMhi, CARG3, lsr #32
2570 | bne >5
2571 | // RA number, RC int.
2572 | scvtf FARG2, CARG3w
2573 |5:
2574 | // RA number, RC number.
2575 | fcmp FARG1, FARG2
2576 | b <1
2577 |
2578 |6: // RA int, RC number
2579 | ldr FARG2, [RC]
2580 | scvtf FARG1, CARG1w
2581 | fcmp FARG1, FARG2
2582 | b <1
2583 |
2584 |.if FFI
2585 |7:
2586 | asr ITYPE, CARG1, #47
2587 | cmn ITYPE, #-LJ_TCDATA
2588 | bne <2
2589 | b ->vmeta_equal_cd
2590 |.endif
2591 break;
2592
2593 case BC_ISEQP: case BC_ISNEP:
2594 vk = op == BC_ISEQP;
2595 | // RA = src, RC = primitive_type (~), JMP with RC = target
2596 | ldr TMP0, [BASE, RA, lsl #3]
2597 | ldrh RBw, [PC, # OFS_RD]
2598 | add PC, PC, #4
2599 | add RC, RC, #1
2600 | add RB, PC, RB, lsl #2
2601 |.if FFI
2602 | asr ITYPE, TMP0, #47
2603 | cmn ITYPE, #-LJ_TCDATA
2604 | beq ->vmeta_equal_cd
2605 | cmn RC, ITYPE
2606 |.else
2607 | cmn RC, TMP0, asr #47
2608 |.endif
2609 | sub RB, RB, #0x20000
2610 if (vk) {
2611 | csel PC, RB, PC, eq
2612 } else {
2613 | csel PC, RB, PC, ne
2614 }
2615 | ins_next
2616 break;
2617
2618 /* -- Unary test and copy ops ------------------------------------------- */
2619
2620 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
2621 | // RA = dst or unused, RC = src, JMP with RC = target
2622 | ldrh RBw, [PC, # OFS_RD]
2623 | ldr TMP0, [BASE, RC, lsl #3]
2624 | add PC, PC, #4
2625 | mov_false TMP1
2626 | add RB, PC, RB, lsl #2
2627 | cmp TMP0, TMP1
2628 | sub RB, RB, #0x20000
2629 if (op == BC_ISTC || op == BC_IST) {
2630 if (op == BC_ISTC) {
2631 | csel RA, RA, RC, lo
2632 }
2633 | csel PC, RB, PC, lo
2634 } else {
2635 if (op == BC_ISFC) {
2636 | csel RA, RA, RC, hs
2637 }
2638 | csel PC, RB, PC, hs
2639 }
2640 if (op == BC_ISTC || op == BC_ISFC) {
2641 | str TMP0, [BASE, RA, lsl #3]
2642 }
2643 | ins_next
2644 break;
2645
2646 case BC_ISTYPE:
2647 | // RA = src, RC = -type
2648 | ldr TMP0, [BASE, RA, lsl #3]
2649 | cmn RC, TMP0, asr #47
2650 | bne ->vmeta_istype
2651 | ins_next
2652 break;
2653 case BC_ISNUM:
2654 | // RA = src, RC = -(TISNUM-1)
2655 | ldr TMP0, [BASE, RA]
2656 | checknum TMP0, ->vmeta_istype
2657 | ins_next
2658 break;
2659
2660 /* -- Unary ops --------------------------------------------------------- */
2661
2662 case BC_MOV:
2663 | // RA = dst, RC = src
2664 | ldr TMP0, [BASE, RC, lsl #3]
2665 | str TMP0, [BASE, RA, lsl #3]
2666 | ins_next
2667 break;
2668 case BC_NOT:
2669 | // RA = dst, RC = src
2670 | ldr TMP0, [BASE, RC, lsl #3]
2671 | mov_false TMP1
2672 | mov_true TMP2
2673 | cmp TMP0, TMP1
2674 | csel TMP0, TMP1, TMP2, lo
2675 | str TMP0, [BASE, RA, lsl #3]
2676 | ins_next
2677 break;
2678 case BC_UNM:
2679 | // RA = dst, RC = src
2680 | ldr TMP0, [BASE, RC, lsl #3]
2681 | asr ITYPE, TMP0, #47
2682 | cmn ITYPE, #-LJ_TISNUM
2683 | bhi ->vmeta_unm
2684 | eor TMP0, TMP0, #U64x(80000000,00000000)
2685 | bne >5
2686 | negs TMP0w, TMP0w
2687 | movz CARG3, #0x41e0, lsl #48 // 2^31.
2688 | add_TISNUM TMP0, TMP0
2689 | csel TMP0, TMP0, CARG3, vc
2690 | movz CARG3, #0x8000, lsl #48 // -0.
2691 | csel TMP0, TMP0, CARG3, ne
2692 |5:
2693 | str TMP0, [BASE, RA, lsl #3]
2694 | ins_next
2695 break;
2696 case BC_LEN:
2697 | // RA = dst, RC = src
2698 | ldr CARG1, [BASE, RC, lsl #3]
2699 | asr ITYPE, CARG1, #47
2700 | cmn ITYPE, #-LJ_TSTR
2701 | and CARG1, CARG1, #LJ_GCVMASK
2702 | bne >2
2703 | ldr CARG1w, STR:CARG1->len
2704 |1:
2705 | add_TISNUM CARG1, CARG1
2706 | str CARG1, [BASE, RA, lsl #3]
2707 | ins_next
2708 |
2709 |2:
2710 | cmn ITYPE, #-LJ_TTAB
2711 | bne ->vmeta_len
2712#if LJ_52
2713 | ldr TAB:CARG2, TAB:CARG1->metatable
2714 | cbnz TAB:CARG2, >9
2715 |3:
2716#endif
2717 |->BC_LEN_Z:
2718 | bl extern lj_tab_len // (GCtab *t)
2719 | // Returns uint32_t (but less than 2^31).
2720 | b <1
2721 |
2722#if LJ_52
2723 |9:
2724 | ldrb TMP1w, TAB:CARG2->nomm
2725 | tbnz TMP1w, #MM_len, <3 // 'no __len' flag set: done.
2726 | b ->vmeta_len
2727#endif
2728 break;
2729
2730 /* -- Binary ops -------------------------------------------------------- */
2731
2732 |.macro ins_arithcheck_int, target
2733 | checkint CARG1, target
2734 | checkint CARG2, target
2735 |.endmacro
2736 |
2737 |.macro ins_arithcheck_num, target
2738 | checknum CARG1, target
2739 | checknum CARG2, target
2740 |.endmacro
2741 |
2742 |.macro ins_arithcheck_nzdiv, target
2743 | cbz CARG2w, target
2744 |.endmacro
2745 |
2746 |.macro ins_arithhead
2747 ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
2748 ||if (vk == 1) {
2749 | and RC, RC, #255
2750 | decode_RB RB, INS
2751 ||} else {
2752 | decode_RB RB, INS
2753 | and RC, RC, #255
2754 ||}
2755 |.endmacro
2756 |
2757 |.macro ins_arithload, reg1, reg2
2758 | // RA = dst, RB = src1, RC = src2 | num_const
2759 ||switch (vk) {
2760 ||case 0:
2761 | ldr reg1, [BASE, RB, lsl #3]
2762 | ldr reg2, [KBASE, RC, lsl #3]
2763 || break;
2764 ||case 1:
2765 | ldr reg1, [KBASE, RC, lsl #3]
2766 | ldr reg2, [BASE, RB, lsl #3]
2767 || break;
2768 ||default:
2769 | ldr reg1, [BASE, RB, lsl #3]
2770 | ldr reg2, [BASE, RC, lsl #3]
2771 || break;
2772 ||}
2773 |.endmacro
2774 |
2775 |.macro ins_arithfallback, ins
2776 ||switch (vk) {
2777 ||case 0:
2778 | ins ->vmeta_arith_vn
2779 || break;
2780 ||case 1:
2781 | ins ->vmeta_arith_nv
2782 || break;
2783 ||default:
2784 | ins ->vmeta_arith_vv
2785 || break;
2786 ||}
2787 |.endmacro
2788 |
2789 |.macro ins_arithmod, res, reg1, reg2
2790 | fdiv d2, reg1, reg2
2791 | frintm d2, d2
2792 | // Cannot use fmsub, because FMA is not enabled by default.
2793 | fmul d2, d2, reg2
2794 | fsub res, reg1, d2
2795 |.endmacro
2796 |
2797 |.macro ins_arithdn, intins, fpins
2798 | ins_arithhead
2799 | ins_arithload CARG1, CARG2
2800 | ins_arithcheck_int >5
2801 |.if "intins" == "smull"
2802 | smull CARG1, CARG1w, CARG2w
2803 | cmp CARG1, CARG1, sxtw
2804 | mov CARG1w, CARG1w
2805 | ins_arithfallback bne
2806 |.elif "intins" == "ins_arithmodi"
2807 | ins_arithfallback ins_arithcheck_nzdiv
2808 | bl ->vm_modi
2809 |.else
2810 | intins CARG1w, CARG1w, CARG2w
2811 | ins_arithfallback bvs
2812 |.endif
2813 | add_TISNUM CARG1, CARG1
2814 | str CARG1, [BASE, RA, lsl #3]
2815 |4:
2816 | ins_next
2817 |
2818 |5: // FP variant.
2819 | ins_arithload FARG1, FARG2
2820 | ins_arithfallback ins_arithcheck_num
2821 | fpins FARG1, FARG1, FARG2
2822 | str FARG1, [BASE, RA, lsl #3]
2823 | b <4
2824 |.endmacro
2825 |
2826 |.macro ins_arithfp, fpins
2827 | ins_arithhead
2828 | ins_arithload CARG1, CARG2
2829 | ins_arithload FARG1, FARG2
2830 | ins_arithfallback ins_arithcheck_num
2831 |.if "fpins" == "fpow"
2832 | bl extern pow
2833 |.else
2834 | fpins FARG1, FARG1, FARG2
2835 |.endif
2836 | str FARG1, [BASE, RA, lsl #3]
2837 | ins_next
2838 |.endmacro
2839
2840 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
2841 | ins_arithdn adds, fadd
2842 break;
2843 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
2844 | ins_arithdn subs, fsub
2845 break;
2846 case BC_MULVN: case BC_MULNV: case BC_MULVV:
2847 | ins_arithdn smull, fmul
2848 break;
2849 case BC_DIVVN: case BC_DIVNV: case BC_DIVVV:
2850 | ins_arithfp fdiv
2851 break;
2852 case BC_MODVN: case BC_MODNV: case BC_MODVV:
2853 | ins_arithdn ins_arithmodi, ins_arithmod
2854 break;
2855 case BC_POW:
2856 | // NYI: (partial) integer arithmetic.
2857 | ins_arithfp fpow
2858 break;
2859
2860 case BC_CAT:
2861 | decode_RB RB, INS
2862 | and RC, RC, #255
2863 | // RA = dst, RB = src_start, RC = src_end
2864 | str BASE, L->base
2865 | sub CARG3, RC, RB
2866 | add CARG2, BASE, RC, lsl #3
2867 |->BC_CAT_Z:
2868 | // RA = dst, CARG2 = top-1, CARG3 = left
2869 | mov CARG1, L
2870 | str PC, SAVE_PC
2871 | bl extern lj_meta_cat // (lua_State *L, TValue *top, int left)
2872 | // Returns NULL (finished) or TValue * (metamethod).
2873 | ldrb RBw, [PC, #-4+OFS_RB]
2874 | ldr BASE, L->base
2875 | cbnz CRET1, ->vmeta_binop
2876 | ldr TMP0, [BASE, RB, lsl #3]
2877 | str TMP0, [BASE, RA, lsl #3] // Copy result to RA.
2878 | ins_next
2879 break;
2880
2881 /* -- Constant ops ------------------------------------------------------ */
2882
2883 case BC_KSTR:
2884 | // RA = dst, RC = str_const (~)
2885 | mvn RC, RC
2886 | ldr TMP0, [KBASE, RC, lsl #3]
2887 | movn TMP1, #~LJ_TSTR
2888 | add TMP0, TMP0, TMP1, lsl #47
2889 | str TMP0, [BASE, RA, lsl #3]
2890 | ins_next
2891 break;
2892 case BC_KCDATA:
2893 |.if FFI
2894 | // RA = dst, RC = cdata_const (~)
2895 | mvn RC, RC
2896 | ldr TMP0, [KBASE, RC, lsl #3]
2897 | movn TMP1, #~LJ_TCDATA
2898 | add TMP0, TMP0, TMP1, lsl #47
2899 | str TMP0, [BASE, RA, lsl #3]
2900 | ins_next
2901 |.endif
2902 break;
2903 case BC_KSHORT:
2904 | // RA = dst, RC = int16_literal
2905 | sxth RCw, RCw
2906 | add_TISNUM TMP0, RC
2907 | str TMP0, [BASE, RA, lsl #3]
2908 | ins_next
2909 break;
2910 case BC_KNUM:
2911 | // RA = dst, RC = num_const
2912 | ldr TMP0, [KBASE, RC, lsl #3]
2913 | str TMP0, [BASE, RA, lsl #3]
2914 | ins_next
2915 break;
2916 case BC_KPRI:
2917 | // RA = dst, RC = primitive_type (~)
2918 | mvn TMP0, RC, lsl #47
2919 | str TMP0, [BASE, RA, lsl #3]
2920 | ins_next
2921 break;
2922 case BC_KNIL:
2923 | // RA = base, RC = end
2924 | add RA, BASE, RA, lsl #3
2925 | add RC, BASE, RC, lsl #3
2926 | str TISNIL, [RA], #8
2927 |1:
2928 | cmp RA, RC
2929 | str TISNIL, [RA], #8
2930 | blt <1
2931 | ins_next_
2932 break;
2933
2934 /* -- Upvalue and function ops ------------------------------------------ */
2935
2936 case BC_UGET:
2937 | // RA = dst, RC = uvnum
2938 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
2939 | add RC, RC, #offsetof(GCfuncL, uvptr)/8
2940 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
2941 | ldr UPVAL:CARG2, [LFUNC:CARG2, RC, lsl #3]
2942 | ldr CARG2, UPVAL:CARG2->v
2943 | ldr TMP0, [CARG2]
2944 | str TMP0, [BASE, RA, lsl #3]
2945 | ins_next
2946 break;
2947 case BC_USETV:
2948 | // RA = uvnum, RC = src
2949 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
2950 | add RA, RA, #offsetof(GCfuncL, uvptr)/8
2951 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
2952 | ldr UPVAL:CARG1, [LFUNC:CARG2, RA, lsl #3]
2953 | ldr CARG3, [BASE, RC, lsl #3]
2954 | ldr CARG2, UPVAL:CARG1->v
2955 | ldrb TMP2w, UPVAL:CARG1->marked
2956 | ldrb TMP0w, UPVAL:CARG1->closed
2957 | asr ITYPE, CARG3, #47
2958 | str CARG3, [CARG2]
2959 | add ITYPE, ITYPE, #-LJ_TISGCV
2960 | tst TMP2w, #LJ_GC_BLACK // isblack(uv)
2961 | ccmp TMP0w, #0, #4, ne // && uv->closed
2962 | ccmn ITYPE, #-(LJ_TNUMX - LJ_TISGCV), #0, ne // && tvisgcv(v)
2963 | bhi >2
2964 |1:
2965 | ins_next
2966 |
2967 |2: // Check if new value is white.
2968 | and GCOBJ:CARG3, CARG3, #LJ_GCVMASK
2969 | ldrb TMP1w, GCOBJ:CARG3->gch.marked
2970 | tst TMP1w, #LJ_GC_WHITES // iswhite(str)
2971 | beq <1
2972 | // Crossed a write barrier. Move the barrier forward.
2973 | mov CARG1, GL
2974 | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv)
2975 | b <1
2976 break;
2977 case BC_USETS:
2978 | // RA = uvnum, RC = str_const (~)
2979 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
2980 | add RA, RA, #offsetof(GCfuncL, uvptr)/8
2981 | mvn RC, RC
2982 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
2983 | ldr UPVAL:CARG1, [LFUNC:CARG2, RA, lsl #3]
2984 | ldr STR:CARG3, [KBASE, RC, lsl #3]
2985 | movn TMP0, #~LJ_TSTR
2986 | ldr CARG2, UPVAL:CARG1->v
2987 | ldrb TMP2w, UPVAL:CARG1->marked
2988 | add TMP0, STR:CARG3, TMP0, lsl #47
2989 | ldrb TMP1w, STR:CARG3->marked
2990 | str TMP0, [CARG2]
2991 | tbnz TMP2w, #2, >2 // isblack(uv)
2992 |1:
2993 | ins_next
2994 |
2995 |2: // Check if string is white and ensure upvalue is closed.
2996 | ldrb TMP0w, UPVAL:CARG1->closed
2997 | tst TMP1w, #LJ_GC_WHITES // iswhite(str)
2998 | ccmp TMP0w, #0, #4, ne
2999 | beq <1
3000 | // Crossed a write barrier. Move the barrier forward.
3001 | mov CARG1, GL
3002 | bl extern lj_gc_barrieruv // (global_State *g, TValue *tv)
3003 | b <1
3004 break;
3005 case BC_USETN:
3006 | // RA = uvnum, RC = num_const
3007 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
3008 | add RA, RA, #offsetof(GCfuncL, uvptr)/8
3009 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
3010 | ldr UPVAL:CARG2, [LFUNC:CARG2, RA, lsl #3]
3011 | ldr TMP0, [KBASE, RC, lsl #3]
3012 | ldr CARG2, UPVAL:CARG2->v
3013 | str TMP0, [CARG2]
3014 | ins_next
3015 break;
3016 case BC_USETP:
3017 | // RA = uvnum, RC = primitive_type (~)
3018 | ldr LFUNC:CARG2, [BASE, FRAME_FUNC]
3019 | add RA, RA, #offsetof(GCfuncL, uvptr)/8
3020 | and LFUNC:CARG2, CARG2, #LJ_GCVMASK
3021 | ldr UPVAL:CARG2, [LFUNC:CARG2, RA, lsl #3]
3022 | mvn TMP0, RC, lsl #47
3023 | ldr CARG2, UPVAL:CARG2->v
3024 | str TMP0, [CARG2]
3025 | ins_next
3026 break;
3027
3028 case BC_UCLO:
3029 | // RA = level, RC = target
3030 | ldr CARG3, L->openupval
3031 | add RC, PC, RC, lsl #2
3032 | str BASE, L->base
3033 | sub PC, RC, #0x20000
3034 | cbz CARG3, >1
3035 | mov CARG1, L
3036 | add CARG2, BASE, RA, lsl #3
3037 | bl extern lj_func_closeuv // (lua_State *L, TValue *level)
3038 | ldr BASE, L->base
3039 |1:
3040 | ins_next
3041 break;
3042
3043 case BC_FNEW:
3044 | // RA = dst, RC = proto_const (~) (holding function prototype)
3045 | mvn RC, RC
3046 | str BASE, L->base
3047 | ldr LFUNC:CARG3, [BASE, FRAME_FUNC]
3048 | str PC, SAVE_PC
3049 | ldr CARG2, [KBASE, RC, lsl #3]
3050 | mov CARG1, L
3051 | and LFUNC:CARG3, CARG3, #LJ_GCVMASK
3052 | // (lua_State *L, GCproto *pt, GCfuncL *parent)
3053 | bl extern lj_func_newL_gc
3054 | // Returns GCfuncL *.
3055 | ldr BASE, L->base
3056 | movn TMP0, #~LJ_TFUNC
3057 | add CRET1, CRET1, TMP0, lsl #47
3058 | str CRET1, [BASE, RA, lsl #3]
3059 | ins_next
3060 break;
3061
3062 /* -- Table ops --------------------------------------------------------- */
3063
3064 case BC_TNEW:
3065 case BC_TDUP:
3066 | // RA = dst, RC = (hbits|asize) | tab_const (~)
3067 | ldp CARG3, CARG4, GL->gc.total // Assumes threshold follows total.
3068 | str BASE, L->base
3069 | str PC, SAVE_PC
3070 | mov CARG1, L
3071 | cmp CARG3, CARG4
3072 | bhs >5
3073 |1:
3074 if (op == BC_TNEW) {
3075 | and CARG2, RC, #0x7ff
3076 | lsr CARG3, RC, #11
3077 | cmp CARG2, #0x7ff
3078 | mov TMP0, #0x801
3079 | csel CARG2, CARG2, TMP0, ne
3080 | bl extern lj_tab_new // (lua_State *L, int32_t asize, uint32_t hbits)
3081 | // Returns GCtab *.
3082 } else {
3083 | mvn RC, RC
3084 | ldr CARG2, [KBASE, RC, lsl #3]
3085 | bl extern lj_tab_dup // (lua_State *L, Table *kt)
3086 | // Returns GCtab *.
3087 }
3088 | ldr BASE, L->base
3089 | movk CRET1, #(LJ_TTAB>>1)&0xffff, lsl #48
3090 | str CRET1, [BASE, RA, lsl #3]
3091 | ins_next
3092 |
3093 |5:
3094 | bl extern lj_gc_step_fixtop // (lua_State *L)
3095 | mov CARG1, L
3096 | b <1
3097 break;
3098
3099 case BC_GGET:
3100 | // RA = dst, RC = str_const (~)
3101 case BC_GSET:
3102 | // RA = src, RC = str_const (~)
3103 | ldr LFUNC:CARG1, [BASE, FRAME_FUNC]
3104 | mvn RC, RC
3105 | and LFUNC:CARG1, CARG1, #LJ_GCVMASK
3106 | ldr TAB:CARG2, LFUNC:CARG1->env
3107 | ldr STR:RC, [KBASE, RC, lsl #3]
3108 if (op == BC_GGET) {
3109 | b ->BC_TGETS_Z
3110 } else {
3111 | b ->BC_TSETS_Z
3112 }
3113 break;
3114
3115 case BC_TGETV:
3116 | decode_RB RB, INS
3117 | and RC, RC, #255
3118 | // RA = dst, RB = table, RC = key
3119 | ldr CARG2, [BASE, RB, lsl #3]
3120 | ldr TMP1, [BASE, RC, lsl #3]
3121 | checktab CARG2, ->vmeta_tgetv
3122 | checkint TMP1, >9 // Integer key?
3123 | ldr CARG3, TAB:CARG2->array
3124 | ldr CARG1w, TAB:CARG2->asize
3125 | add CARG3, CARG3, TMP1, uxtw #3
3126 | cmp TMP1w, CARG1w // In array part?
3127 | bhs ->vmeta_tgetv
3128 | ldr TMP0, [CARG3]
3129 | cmp_nil TMP0
3130 | beq >5
3131 |1:
3132 | str TMP0, [BASE, RA, lsl #3]
3133 | ins_next
3134 |
3135 |5: // Check for __index if table value is nil.
3136 | ldr TAB:CARG1, TAB:CARG2->metatable
3137 | cbz TAB:CARG1, <1 // No metatable: done.
3138 | ldrb TMP1w, TAB:CARG1->nomm
3139 | tbnz TMP1w, #MM_index, <1 // 'no __index' flag set: done.
3140 | b ->vmeta_tgetv
3141 |
3142 |9:
3143 | asr ITYPE, TMP1, #47
3144 | cmn ITYPE, #-LJ_TSTR // String key?
3145 | bne ->vmeta_tgetv
3146 | and STR:RC, TMP1, #LJ_GCVMASK
3147 | b ->BC_TGETS_Z
3148 break;
3149 case BC_TGETS:
3150 | decode_RB RB, INS
3151 | and RC, RC, #255
3152 | // RA = dst, RB = table, RC = str_const (~)
3153 | ldr CARG2, [BASE, RB, lsl #3]
3154 | mvn RC, RC
3155 | ldr STR:RC, [KBASE, RC, lsl #3]
3156 | checktab CARG2, ->vmeta_tgets1
3157 |->BC_TGETS_Z:
3158 | // TAB:CARG2 = GCtab *, STR:RC = GCstr *, RA = dst
3159 | ldr TMP1w, TAB:CARG2->hmask
3160 | ldr TMP2w, STR:RC->sid
3161 | ldr NODE:CARG3, TAB:CARG2->node
3162 | and TMP1w, TMP1w, TMP2w // idx = str->sid & tab->hmask
3163 | add TMP1, TMP1, TMP1, lsl #1
3164 | movn CARG4, #~LJ_TSTR
3165 | add NODE:CARG3, NODE:CARG3, TMP1, lsl #3 // node = tab->node + idx*3*8
3166 | add CARG4, STR:RC, CARG4, lsl #47 // Tagged key to look for.
3167 |1:
3168 | ldp TMP0, CARG1, NODE:CARG3->val
3169 | ldr NODE:CARG3, NODE:CARG3->next
3170 | cmp CARG1, CARG4
3171 | bne >4
3172 | cmp_nil TMP0
3173 | beq >5
3174 |3:
3175 | str TMP0, [BASE, RA, lsl #3]
3176 | ins_next
3177 |
3178 |4: // Follow hash chain.
3179 | cbnz NODE:CARG3, <1
3180 | // End of hash chain: key not found, nil result.
3181 | mov_nil TMP0
3182 |
3183 |5: // Check for __index if table value is nil.
3184 | ldr TAB:CARG1, TAB:CARG2->metatable
3185 | cbz TAB:CARG1, <3 // No metatable: done.
3186 | ldrb TMP1w, TAB:CARG1->nomm
3187 | tbnz TMP1w, #MM_index, <3 // 'no __index' flag set: done.
3188 | b ->vmeta_tgets
3189 break;
3190 case BC_TGETB:
3191 | decode_RB RB, INS
3192 | and RC, RC, #255
3193 | // RA = dst, RB = table, RC = index
3194 | ldr CARG2, [BASE, RB, lsl #3]
3195 | checktab CARG2, ->vmeta_tgetb
3196 | ldr CARG3, TAB:CARG2->array
3197 | ldr CARG1w, TAB:CARG2->asize
3198 | add CARG3, CARG3, RC, lsl #3
3199 | cmp RCw, CARG1w // In array part?
3200 | bhs ->vmeta_tgetb
3201 | ldr TMP0, [CARG3]
3202 | cmp_nil TMP0
3203 | beq >5
3204 |1:
3205 | str TMP0, [BASE, RA, lsl #3]
3206 | ins_next
3207 |
3208 |5: // Check for __index if table value is nil.
3209 | ldr TAB:CARG1, TAB:CARG2->metatable
3210 | cbz TAB:CARG1, <1 // No metatable: done.
3211 | ldrb TMP1w, TAB:CARG1->nomm
3212 | tbnz TMP1w, #MM_index, <1 // 'no __index' flag set: done.
3213 | b ->vmeta_tgetb
3214 break;
3215 case BC_TGETR:
3216 | decode_RB RB, INS
3217 | and RC, RC, #255
3218 | // RA = dst, RB = table, RC = key
3219 | ldr CARG1, [BASE, RB, lsl #3]
3220 | ldr TMP1, [BASE, RC, lsl #3]
3221 | and TAB:CARG1, CARG1, #LJ_GCVMASK
3222 | ldr CARG3, TAB:CARG1->array
3223 | ldr TMP2w, TAB:CARG1->asize
3224 | add CARG3, CARG3, TMP1w, uxtw #3
3225 | cmp TMP1w, TMP2w // In array part?
3226 | bhs ->vmeta_tgetr
3227 | ldr TMP0, [CARG3]
3228 |->BC_TGETR_Z:
3229 | str TMP0, [BASE, RA, lsl #3]
3230 | ins_next
3231 break;
3232
3233 case BC_TSETV:
3234 | decode_RB RB, INS
3235 | and RC, RC, #255
3236 | // RA = src, RB = table, RC = key
3237 | ldr CARG2, [BASE, RB, lsl #3]
3238 | ldr TMP1, [BASE, RC, lsl #3]
3239 | checktab CARG2, ->vmeta_tsetv
3240 | checkint TMP1, >9 // Integer key?
3241 | ldr CARG3, TAB:CARG2->array
3242 | ldr CARG1w, TAB:CARG2->asize
3243 | add CARG3, CARG3, TMP1, uxtw #3
3244 | cmp TMP1w, CARG1w // In array part?
3245 | bhs ->vmeta_tsetv
3246 | ldr TMP1, [CARG3]
3247 | ldr TMP0, [BASE, RA, lsl #3]
3248 | ldrb TMP2w, TAB:CARG2->marked
3249 | cmp_nil TMP1 // Previous value is nil?
3250 | beq >5
3251 |1:
3252 | str TMP0, [CARG3]
3253 | tbnz TMP2w, #2, >7 // isblack(table)
3254 |2:
3255 | ins_next
3256 |
3257 |5: // Check for __newindex if previous value is nil.
3258 | ldr TAB:CARG1, TAB:CARG2->metatable
3259 | cbz TAB:CARG1, <1 // No metatable: done.
3260 | ldrb TMP1w, TAB:CARG1->nomm
3261 | tbnz TMP1w, #MM_newindex, <1 // 'no __newindex' flag set: done.
3262 | b ->vmeta_tsetv
3263 |
3264 |7: // Possible table write barrier for the value. Skip valiswhite check.
3265 | barrierback TAB:CARG2, TMP2w, TMP1
3266 | b <2
3267 |
3268 |9:
3269 | asr ITYPE, TMP1, #47
3270 | cmn ITYPE, #-LJ_TSTR // String key?
3271 | bne ->vmeta_tsetv
3272 | and STR:RC, TMP1, #LJ_GCVMASK
3273 | b ->BC_TSETS_Z
3274 break;
3275 case BC_TSETS:
3276 | decode_RB RB, INS
3277 | and RC, RC, #255
3278 | // RA = dst, RB = table, RC = str_const (~)
3279 | ldr CARG2, [BASE, RB, lsl #3]
3280 | mvn RC, RC
3281 | ldr STR:RC, [KBASE, RC, lsl #3]
3282 | checktab CARG2, ->vmeta_tsets1
3283 |->BC_TSETS_Z:
3284 | // TAB:CARG2 = GCtab *, STR:RC = GCstr *, RA = src
3285 | ldr TMP1w, TAB:CARG2->hmask
3286 | ldr TMP2w, STR:RC->sid
3287 | ldr NODE:CARG3, TAB:CARG2->node
3288 | and TMP1w, TMP1w, TMP2w // idx = str->sid & tab->hmask
3289 | add TMP1, TMP1, TMP1, lsl #1
3290 | movn CARG4, #~LJ_TSTR
3291 | add NODE:CARG3, NODE:CARG3, TMP1, lsl #3 // node = tab->node + idx*3*8
3292 | add CARG4, STR:RC, CARG4, lsl #47 // Tagged key to look for.
3293 | strb wzr, TAB:CARG2->nomm // Clear metamethod cache.
3294 |1:
3295 | ldp TMP1, CARG1, NODE:CARG3->val
3296 | ldr NODE:TMP3, NODE:CARG3->next
3297 | ldrb TMP2w, TAB:CARG2->marked
3298 | cmp CARG1, CARG4
3299 | bne >5
3300 | ldr TMP0, [BASE, RA, lsl #3]
3301 | cmp_nil TMP1 // Previous value is nil?
3302 | beq >4
3303 |2:
3304 | str TMP0, NODE:CARG3->val
3305 | tbnz TMP2w, #2, >7 // isblack(table)
3306 |3:
3307 | ins_next
3308 |
3309 |4: // Check for __newindex if previous value is nil.
3310 | ldr TAB:CARG1, TAB:CARG2->metatable
3311 | cbz TAB:CARG1, <2 // No metatable: done.
3312 | ldrb TMP1w, TAB:CARG1->nomm
3313 | tbnz TMP1w, #MM_newindex, <2 // 'no __newindex' flag set: done.
3314 | b ->vmeta_tsets
3315 |
3316 |5: // Follow hash chain.
3317 | mov NODE:CARG3, NODE:TMP3
3318 | cbnz NODE:TMP3, <1
3319 | // End of hash chain: key not found, add a new one.
3320 |
3321 | // But check for __newindex first.
3322 | ldr TAB:CARG1, TAB:CARG2->metatable
3323 | cbz TAB:CARG1, >6 // No metatable: continue.
3324 | ldrb TMP1w, TAB:CARG1->nomm
3325 | // 'no __newindex' flag NOT set: check.
3326 | tbz TMP1w, #MM_newindex, ->vmeta_tsets
3327 |6:
3328 | movn TMP1, #~LJ_TSTR
3329 | str PC, SAVE_PC
3330 | add TMP0, STR:RC, TMP1, lsl #47
3331 | str BASE, L->base
3332 | mov CARG1, L
3333 | str TMP0, TMPD
3334 | add CARG3, sp, TMPDofs
3335 | bl extern lj_tab_newkey // (lua_State *L, GCtab *t, TValue *k)
3336 | // Returns TValue *.
3337 | ldr BASE, L->base
3338 | ldr TMP0, [BASE, RA, lsl #3]
3339 | str TMP0, [CRET1]
3340 | b <3 // No 2nd write barrier needed.
3341 |
3342 |7: // Possible table write barrier for the value. Skip valiswhite check.
3343 | barrierback TAB:CARG2, TMP2w, TMP1
3344 | b <3
3345 break;
3346 case BC_TSETB:
3347 | decode_RB RB, INS
3348 | and RC, RC, #255
3349 | // RA = src, RB = table, RC = index
3350 | ldr CARG2, [BASE, RB, lsl #3]
3351 | checktab CARG2, ->vmeta_tsetb
3352 | ldr CARG3, TAB:CARG2->array
3353 | ldr CARG1w, TAB:CARG2->asize
3354 | add CARG3, CARG3, RC, lsl #3
3355 | cmp RCw, CARG1w // In array part?
3356 | bhs ->vmeta_tsetb
3357 | ldr TMP1, [CARG3]
3358 | ldr TMP0, [BASE, RA, lsl #3]
3359 | ldrb TMP2w, TAB:CARG2->marked
3360 | cmp_nil TMP1 // Previous value is nil?
3361 | beq >5
3362 |1:
3363 | str TMP0, [CARG3]
3364 | tbnz TMP2w, #2, >7 // isblack(table)
3365 |2:
3366 | ins_next
3367 |
3368 |5: // Check for __newindex if previous value is nil.
3369 | ldr TAB:CARG1, TAB:CARG2->metatable
3370 | cbz TAB:CARG1, <1 // No metatable: done.
3371 | ldrb TMP1w, TAB:CARG1->nomm
3372 | tbnz TMP1w, #MM_newindex, <1 // 'no __newindex' flag set: done.
3373 | b ->vmeta_tsetb
3374 |
3375 |7: // Possible table write barrier for the value. Skip valiswhite check.
3376 | barrierback TAB:CARG2, TMP2w, TMP1
3377 | b <2
3378 break;
3379 case BC_TSETR:
3380 | decode_RB RB, INS
3381 | and RC, RC, #255
3382 | // RA = src, RB = table, RC = key
3383 | ldr CARG2, [BASE, RB, lsl #3]
3384 | ldr TMP1, [BASE, RC, lsl #3]
3385 | and TAB:CARG2, CARG2, #LJ_GCVMASK
3386 | ldr CARG1, TAB:CARG2->array
3387 | ldrb TMP2w, TAB:CARG2->marked
3388 | ldr CARG4w, TAB:CARG2->asize
3389 | add CARG1, CARG1, TMP1, uxtw #3
3390 | tbnz TMP2w, #2, >7 // isblack(table)
3391 |2:
3392 | cmp TMP1w, CARG4w // In array part?
3393 | bhs ->vmeta_tsetr
3394 |->BC_TSETR_Z:
3395 | ldr TMP0, [BASE, RA, lsl #3]
3396 | str TMP0, [CARG1]
3397 | ins_next
3398 |
3399 |7: // Possible table write barrier for the value. Skip valiswhite check.
3400 | barrierback TAB:CARG2, TMP2w, TMP0
3401 | b <2
3402 break;
3403
3404 case BC_TSETM:
3405 | // RA = base (table at base-1), RC = num_const (start index)
3406 | add RA, BASE, RA, lsl #3
3407 |1:
3408 | ldr RBw, SAVE_MULTRES
3409 | ldr TAB:CARG2, [RA, #-8] // Guaranteed to be a table.
3410 | ldr TMP1, [KBASE, RC, lsl #3] // Integer constant is in lo-word.
3411 | sub RB, RB, #8
3412 | cbz RB, >4 // Nothing to copy?
3413 | and TAB:CARG2, CARG2, #LJ_GCVMASK
3414 | ldr CARG1w, TAB:CARG2->asize
3415 | add CARG3w, TMP1w, RBw, lsr #3
3416 | ldr CARG4, TAB:CARG2->array
3417 | cmp CARG3, CARG1
3418 | add RB, RA, RB
3419 | bhi >5
3420 | add TMP1, CARG4, TMP1w, uxtw #3
3421 | ldrb TMP2w, TAB:CARG2->marked
3422 |3: // Copy result slots to table.
3423 | ldr TMP0, [RA], #8
3424 | str TMP0, [TMP1], #8
3425 | cmp RA, RB
3426 | blo <3
3427 | tbnz TMP2w, #2, >7 // isblack(table)
3428 |4:
3429 | ins_next
3430 |
3431 |5: // Need to resize array part.
3432 | str BASE, L->base
3433 | mov CARG1, L
3434 | str PC, SAVE_PC
3435 | bl extern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize)
3436 | // Must not reallocate the stack.
3437 | b <1
3438 |
3439 |7: // Possible table write barrier for any value. Skip valiswhite check.
3440 | barrierback TAB:CARG2, TMP2w, TMP1
3441 | b <4
3442 break;
3443
3444 /* -- Calls and vararg handling ----------------------------------------- */
3445
3446 case BC_CALLM:
3447 | // RA = base, (RB = nresults+1,) RC = extra_nargs
3448 | ldr TMP0w, SAVE_MULTRES
3449 | decode_RC8RD NARGS8:RC, RC
3450 | add NARGS8:RC, NARGS8:RC, TMP0
3451 | b ->BC_CALL_Z
3452 break;
3453 case BC_CALL:
3454 | decode_RC8RD NARGS8:RC, RC
3455 | // RA = base, (RB = nresults+1,) RC = (nargs+1)*8
3456 |->BC_CALL_Z:
3457 | mov RB, BASE // Save old BASE for vmeta_call.
3458 | add BASE, BASE, RA, lsl #3
3459 | ldr CARG3, [BASE], #16
3460 | sub NARGS8:RC, NARGS8:RC, #8
3461 | checkfunc CARG3, ->vmeta_call
3462 | ins_call
3463 break;
3464
3465 case BC_CALLMT:
3466 | // RA = base, (RB = 0,) RC = extra_nargs
3467 | ldr TMP0w, SAVE_MULTRES
3468 | add NARGS8:RC, TMP0, RC, lsl #3
3469 | b ->BC_CALLT1_Z
3470 break;
3471 case BC_CALLT:
3472 | lsl NARGS8:RC, RC, #3
3473 | // RA = base, (RB = 0,) RC = (nargs+1)*8
3474 |->BC_CALLT1_Z:
3475 | add RA, BASE, RA, lsl #3
3476 | ldr TMP1, [RA], #16
3477 | sub NARGS8:RC, NARGS8:RC, #8
3478 | checktp CARG3, TMP1, LJ_TFUNC, ->vmeta_callt
3479 | ldr PC, [BASE, FRAME_PC]
3480 |->BC_CALLT2_Z:
3481 | mov RB, #0
3482 | ldrb TMP2w, LFUNC:CARG3->ffid
3483 | tst PC, #FRAME_TYPE
3484 | bne >7
3485 |1:
3486 | str TMP1, [BASE, FRAME_FUNC] // Copy function down, but keep PC.
3487 | cbz NARGS8:RC, >3
3488 |2:
3489 | ldr TMP0, [RA, RB]
3490 | add TMP1, RB, #8
3491 | cmp TMP1, NARGS8:RC
3492 | str TMP0, [BASE, RB]
3493 | mov RB, TMP1
3494 | bne <2
3495 |3:
3496 | cmp TMP2, #1 // (> FF_C) Calling a fast function?
3497 | bhi >5
3498 |4:
3499 | ins_callt
3500 |
3501 |5: // Tailcall to a fast function with a Lua frame below.
3502 | ldrb RAw, [PC, #-4+OFS_RA]
3503 | sub CARG1, BASE, RA, lsl #3
3504 | ldr LFUNC:CARG1, [CARG1, #-32]
3505 | and LFUNC:CARG1, CARG1, #LJ_GCVMASK
3506 | ldr CARG1, LFUNC:CARG1->pc
3507 | ldr KBASE, [CARG1, #PC2PROTO(k)]
3508 | b <4
3509 |
3510 |7: // Tailcall from a vararg function.
3511 | eor PC, PC, #FRAME_VARG
3512 | tst PC, #FRAME_TYPEP // Vararg frame below?
3513 | csel TMP2, RB, TMP2, ne // Clear ffid if no Lua function below.
3514 | bne <1
3515 | sub BASE, BASE, PC
3516 | ldr PC, [BASE, FRAME_PC]
3517 | tst PC, #FRAME_TYPE
3518 | csel TMP2, RB, TMP2, ne // Clear ffid if no Lua function below.
3519 | b <1
3520 break;
3521
3522 case BC_ITERC:
3523 | // RA = base, (RB = nresults+1, RC = nargs+1 (2+1))
3524 | add RA, BASE, RA, lsl #3
3525 | ldr CARG3, [RA, #-24]
3526 | mov RB, BASE // Save old BASE for vmeta_call.
3527 | ldp CARG1, CARG2, [RA, #-16]
3528 | add BASE, RA, #16
3529 | mov NARGS8:RC, #16 // Iterators get 2 arguments.
3530 | str CARG3, [RA] // Copy callable.
3531 | stp CARG1, CARG2, [RA, #16] // Copy state and control var.
3532 | checkfunc CARG3, ->vmeta_call
3533 | ins_call
3534 break;
3535
3536 case BC_ITERN:
3537 |.if JIT
3538 | hotloop
3539 |.endif
3540 |->vm_IITERN:
3541 | // RA = base, (RB = nresults+1, RC = nargs+1 (2+1))
3542 |.if JIT
3543 | bti_jump
3544 |.endif
3545 | add RA, BASE, RA, lsl #3
3546 | ldr TAB:RB, [RA, #-16]
3547 | ldrh TMP3w, [PC, # OFS_RD]
3548 | ldr CARG1w, [RA, #-8+LO] // Get index from control var.
3549 | add PC, PC, #4
3550 | add TMP3, PC, TMP3, lsl #2
3551 | and TAB:RB, RB, #LJ_GCVMASK
3552 | sub TMP3, TMP3, #0x20000
3553 | ldr TMP1w, TAB:RB->asize
3554 | ldr CARG2, TAB:RB->array
3555 |1: // Traverse array part.
3556 | subs RC, CARG1, TMP1
3557 | add CARG3, CARG2, CARG1, lsl #3
3558 | bhs >5 // Index points after array part?
3559 | ldr TMP0, [CARG3]
3560 | cmp_nil TMP0
3561 | cinc CARG1, CARG1, eq // Skip holes in array part.
3562 | beq <1
3563 | add_TISNUM CARG1, CARG1
3564 | stp CARG1, TMP0, [RA]
3565 | add CARG1, CARG1, #1
3566 |3:
3567 | str CARG1w, [RA, #-8+LO] // Update control var.
3568 | mov PC, TMP3
3569 |4:
3570 | ins_next
3571 |
3572 |5: // Traverse hash part.
3573 | ldr TMP2w, TAB:RB->hmask
3574 | ldr NODE:RB, TAB:RB->node
3575 |6:
3576 | add CARG1, RC, RC, lsl #1
3577 | cmp RC, TMP2 // End of iteration? Branch to ITERN+1.
3578 | add NODE:CARG3, NODE:RB, CARG1, lsl #3 // node = tab->node + idx*3*8
3579 | bhi <4
3580 | ldp TMP0, CARG1, NODE:CARG3->val
3581 | cmp_nil TMP0
3582 | add RC, RC, #1
3583 | beq <6 // Skip holes in hash part.
3584 | stp CARG1, TMP0, [RA]
3585 | add CARG1, RC, TMP1
3586 | b <3
3587 break;
3588
3589 case BC_ISNEXT:
3590 | // RA = base, RC = target (points to ITERN)
3591 | add RA, BASE, RA, lsl #3
3592 | ldr CFUNC:CARG1, [RA, #-24]
3593 | add RC, PC, RC, lsl #2
3594 | ldp TAB:CARG3, CARG4, [RA, #-16]
3595 | sub RC, RC, #0x20000
3596 | checkfunc CFUNC:CARG1, >5
3597 | asr TMP0, TAB:CARG3, #47
3598 | ldrb TMP1w, CFUNC:CARG1->ffid
3599 | cmp_nil CARG4
3600 | ccmn TMP0, #-LJ_TTAB, #0, eq
3601 | ccmp TMP1w, #FF_next_N, #0, eq
3602 | bne >5
3603 | mov TMP0w, #0xfffe7fff // LJ_KEYINDEX
3604 | lsl TMP0, TMP0, #32
3605 | str TMP0, [RA, #-8] // Initialize control var.
3606 |1:
3607 | mov PC, RC
3608 | ins_next
3609 |
3610 |5: // Despecialize bytecode if any of the checks fail.
3611 |.if JIT
3612 | ldrb TMP2w, [RC, # OFS_OP]
3613 |.endif
3614 | mov TMP0, #BC_JMP
3615 | mov TMP1, #BC_ITERC
3616 | strb TMP0w, [PC, #-4+OFS_OP]
3617 |.if JIT
3618 | cmp TMP2w, #BC_ITERN
3619 | bne >6
3620 |.endif
3621 | strb TMP1w, [RC, # OFS_OP]
3622 | b <1
3623 |.if JIT
3624 |6: // Unpatch JLOOP.
3625 | ldr RA, [GL, #GL_J(trace)]
3626 | ldrh TMP2w, [RC, # OFS_RD]
3627 | ldr TRACE:RA, [RA, TMP2, lsl #3]
3628 | ldr TMP2w, TRACE:RA->startins
3629 | bfxil TMP2w, TMP1w, #0, #8
3630 | str TMP2w, [RC]
3631 | b <1
3632 |.endif
3633 break;
3634
3635 case BC_VARG:
3636 | decode_RB RB, INS
3637 | and RC, RC, #255
3638 | // RA = base, RB = (nresults+1), RC = numparams
3639 | ldr TMP1, [BASE, FRAME_PC]
3640 | add TMP0, BASE, RC, lsl #3
3641 | add RC, BASE, RA, lsl #3 // RC = destination
3642 | add TMP0, TMP0, #FRAME_VARG
3643 | add TMP2, RC, RB, lsl #3
3644 | sub RA, TMP0, TMP1 // RA = vbase
3645 | // Note: RA may now be even _above_ BASE if nargs was < numparams.
3646 | sub TMP3, BASE, #16 // TMP3 = vtop
3647 | cbz RB, >5
3648 | sub TMP2, TMP2, #16
3649 |1: // Copy vararg slots to destination slots.
3650 | cmp RA, TMP3
3651 | ldr TMP0, [RA], #8
3652 | csinv TMP0, TMP0, xzr, lo // TISNIL = ~xzr
3653 | cmp RC, TMP2
3654 | str TMP0, [RC], #8
3655 | blo <1
3656 |2:
3657 | ins_next
3658 |
3659 |5: // Copy all varargs.
3660 | ldr TMP0, L->maxstack
3661 | subs TMP2, TMP3, RA
3662 | csel RB, xzr, TMP2, le // MULTRES = (max(vtop-vbase,0)+1)*8
3663 | add RB, RB, #8
3664 | add TMP1, RC, TMP2
3665 | str RBw, SAVE_MULTRES
3666 | ble <2 // Nothing to copy.
3667 | cmp TMP1, TMP0
3668 | bhi >7
3669 |6:
3670 | ldr TMP0, [RA], #8
3671 | str TMP0, [RC], #8
3672 | cmp RA, TMP3
3673 | blo <6
3674 | b <2
3675 |
3676 |7: // Grow stack for varargs.
3677 | lsr CARG2, TMP2, #3
3678 | stp BASE, RC, L->base
3679 | mov CARG1, L
3680 | sub RA, RA, BASE // Need delta, because BASE may change.
3681 | str PC, SAVE_PC
3682 | bl extern lj_state_growstack // (lua_State *L, int n)
3683 | ldp BASE, RC, L->base
3684 | add RA, BASE, RA
3685 | sub TMP3, BASE, #16
3686 | b <6
3687 break;
3688
3689 /* -- Returns ----------------------------------------------------------- */
3690
3691 case BC_RETM:
3692 | // RA = results, RC = extra results
3693 | ldr TMP0w, SAVE_MULTRES
3694 | ldr PC, [BASE, FRAME_PC]
3695 | add RA, BASE, RA, lsl #3
3696 | add RC, TMP0, RC, lsl #3
3697 | b ->BC_RETM_Z
3698 break;
3699
3700 case BC_RET:
3701 | // RA = results, RC = nresults+1
3702 | ldr PC, [BASE, FRAME_PC]
3703 | lsl RC, RC, #3
3704 | add RA, BASE, RA, lsl #3
3705 |->BC_RETM_Z:
3706 | str RCw, SAVE_MULTRES
3707 |1:
3708 | ands CARG1, PC, #FRAME_TYPE
3709 | eor CARG2, PC, #FRAME_VARG
3710 | bne ->BC_RETV2_Z
3711 |
3712 |->BC_RET_Z:
3713 | // BASE = base, RA = resultptr, RC = (nresults+1)*8, PC = return
3714 | ldr INSw, [PC, #-4]
3715 | subs TMP1, RC, #8
3716 | sub CARG3, BASE, #16
3717 | beq >3
3718 |2:
3719 | ldr TMP0, [RA], #8
3720 | add BASE, BASE, #8
3721 | sub TMP1, TMP1, #8
3722 | str TMP0, [BASE, #-24]
3723 | cbnz TMP1, <2
3724 |3:
3725 | decode_RA RA, INS
3726 | sub CARG4, CARG3, RA, lsl #3
3727 | decode_RB RB, INS
3728 | ldr LFUNC:CARG1, [CARG4, FRAME_FUNC]
3729 |5:
3730 | cmp RC, RB, lsl #3 // More results expected?
3731 | blo >6
3732 | and LFUNC:CARG1, CARG1, #LJ_GCVMASK
3733 | mov BASE, CARG4
3734 | ldr CARG2, LFUNC:CARG1->pc
3735 | ldr KBASE, [CARG2, #PC2PROTO(k)]
3736 | ins_next
3737 |
3738 |6: // Fill up results with nil.
3739 | add BASE, BASE, #8
3740 | add RC, RC, #8
3741 | str TISNIL, [BASE, #-24]
3742 | b <5
3743 |
3744 |->BC_RETV1_Z: // Non-standard return case.
3745 | add RA, BASE, RA, lsl #3
3746 |->BC_RETV2_Z:
3747 | tst CARG2, #FRAME_TYPEP
3748 | bne ->vm_return
3749 | // Return from vararg function: relocate BASE down.
3750 | sub BASE, BASE, CARG2
3751 | ldr PC, [BASE, FRAME_PC]
3752 | b <1
3753 break;
3754
3755 case BC_RET0: case BC_RET1:
3756 | // RA = results, RC = nresults+1
3757 | ldr PC, [BASE, FRAME_PC]
3758 | lsl RC, RC, #3
3759 | str RCw, SAVE_MULTRES
3760 | ands CARG1, PC, #FRAME_TYPE
3761 | eor CARG2, PC, #FRAME_VARG
3762 | bne ->BC_RETV1_Z
3763 | ldr INSw, [PC, #-4]
3764 if (op == BC_RET1) {
3765 | ldr TMP0, [BASE, RA, lsl #3]
3766 }
3767 | sub CARG4, BASE, #16
3768 | decode_RA RA, INS
3769 | sub BASE, CARG4, RA, lsl #3
3770 if (op == BC_RET1) {
3771 | str TMP0, [CARG4], #8
3772 }
3773 | decode_RB RB, INS
3774 | ldr LFUNC:CARG1, [BASE, FRAME_FUNC]
3775 |5:
3776 | cmp RC, RB, lsl #3
3777 | blo >6
3778 | and LFUNC:CARG1, CARG1, #LJ_GCVMASK
3779 | ldr CARG2, LFUNC:CARG1->pc
3780 | ldr KBASE, [CARG2, #PC2PROTO(k)]
3781 | ins_next
3782 |
3783 |6: // Fill up results with nil.
3784 | add RC, RC, #8
3785 | str TISNIL, [CARG4], #8
3786 | b <5
3787 break;
3788
3789 /* -- Loops and branches ------------------------------------------------ */
3790
3791 |.define FOR_IDX, [RA]; .define FOR_TIDX, [RA, #4]
3792 |.define FOR_STOP, [RA, #8]; .define FOR_TSTOP, [RA, #12]
3793 |.define FOR_STEP, [RA, #16]; .define FOR_TSTEP, [RA, #20]
3794 |.define FOR_EXT, [RA, #24]; .define FOR_TEXT, [RA, #28]
3795
3796 case BC_FORL:
3797 |.if JIT
3798 | hotloop
3799 |.endif
3800 | // Fall through. Assumes BC_IFORL follows.
3801 break;
3802
3803 case BC_JFORI:
3804 case BC_JFORL:
3805#if !LJ_HASJIT
3806 break;
3807#endif
3808 case BC_FORI:
3809 case BC_IFORL:
3810 | // RA = base, RC = target (after end of loop or start of loop)
3811 vk = (op == BC_IFORL || op == BC_JFORL);
3812 | add RA, BASE, RA, lsl #3
3813 | ldp CARG1, CARG2, FOR_IDX // CARG1 = IDX, CARG2 = STOP
3814 | ldr CARG3, FOR_STEP // CARG3 = STEP
3815 if (op != BC_JFORL) {
3816 | add RC, PC, RC, lsl #2
3817 | sub RC, RC, #0x20000
3818 }
3819 | checkint CARG1, >5
3820 if (!vk) {
3821 | checkint CARG2, ->vmeta_for
3822 | checkint CARG3, ->vmeta_for
3823 | tbnz CARG3w, #31, >4
3824 | cmp CARG1w, CARG2w
3825 } else {
3826 | adds CARG1w, CARG1w, CARG3w
3827 | bvs >2
3828 | add_TISNUM TMP0, CARG1
3829 | tbnz CARG3w, #31, >4
3830 | cmp CARG1w, CARG2w
3831 }
3832 |1:
3833 if (op == BC_FORI) {
3834 | csel PC, RC, PC, gt
3835 } else if (op == BC_JFORI) {
3836 | mov PC, RC
3837 | ldrh RCw, [RC, #-4+OFS_RD]
3838 } else if (op == BC_IFORL) {
3839 | csel PC, RC, PC, le
3840 }
3841 if (vk) {
3842 | str TMP0, FOR_IDX
3843 | str TMP0, FOR_EXT
3844 } else {
3845 | str CARG1, FOR_EXT
3846 }
3847 if (op == BC_JFORI || op == BC_JFORL) {
3848 | ble =>BC_JLOOP
3849 }
3850 |2:
3851 | ins_next
3852 |
3853 |4: // Invert check for negative step.
3854 | cmp CARG2w, CARG1w
3855 | b <1
3856 |
3857 |5: // FP loop.
3858 | ldp d0, d1, FOR_IDX
3859 | blo ->vmeta_for
3860 if (!vk) {
3861 | checknum CARG2, ->vmeta_for
3862 | checknum CARG3, ->vmeta_for
3863 | str d0, FOR_EXT
3864 } else {
3865 | ldr d2, FOR_STEP
3866 | fadd d0, d0, d2
3867 }
3868 | tbnz CARG3, #63, >7
3869 | fcmp d0, d1
3870 |6:
3871 if (vk) {
3872 | str d0, FOR_IDX
3873 | str d0, FOR_EXT
3874 }
3875 if (op == BC_FORI) {
3876 | csel PC, RC, PC, hi
3877 } else if (op == BC_JFORI) {
3878 | ldrh RCw, [RC, #-4+OFS_RD]
3879 | bls =>BC_JLOOP
3880 } else if (op == BC_IFORL) {
3881 | csel PC, RC, PC, ls
3882 } else {
3883 | bls =>BC_JLOOP
3884 }
3885 | b <2
3886 |
3887 |7: // Invert check for negative step.
3888 | fcmp d1, d0
3889 | b <6
3890 break;
3891
3892 case BC_ITERL:
3893 |.if JIT
3894 | hotloop
3895 |.endif
3896 | // Fall through. Assumes BC_IITERL follows.
3897 break;
3898
3899 case BC_JITERL:
3900#if !LJ_HASJIT
3901 break;
3902#endif
3903 case BC_IITERL:
3904 | // RA = base, RC = target
3905 | ldr CARG1, [BASE, RA, lsl #3]
3906 | add TMP1, BASE, RA, lsl #3
3907 | cmp_nil CARG1
3908 | beq >1 // Stop if iterator returned nil.
3909 if (op == BC_JITERL) {
3910 | str CARG1, [TMP1, #-8]
3911 | b =>BC_JLOOP
3912 } else {
3913 | add TMP0, PC, RC, lsl #2 // Otherwise save control var + branch.
3914 | sub PC, TMP0, #0x20000
3915 | str CARG1, [TMP1, #-8]
3916 }
3917 |1:
3918 | ins_next
3919 break;
3920
3921 case BC_LOOP:
3922 | // RA = base, RC = target (loop extent)
3923 | // Note: RA/RC is only used by trace recorder to determine scope/extent
3924 | // This opcode does NOT jump, it's only purpose is to detect a hot loop.
3925 |.if JIT
3926 | hotloop
3927 |.endif
3928 | // Fall through. Assumes BC_ILOOP follows.
3929 break;
3930
3931 case BC_ILOOP:
3932 | // RA = base, RC = target (loop extent)
3933 | ins_next
3934 break;
3935
3936 case BC_JLOOP:
3937 |.if JIT
3938 | // RA = base (ignored), RC = traceno
3939 | ldr CARG1, [GL, #GL_J(trace)]
3940 | st_vmstate wzr // Traces on ARM64 don't store the trace #, so use 0.
3941 | ldr TRACE:RC, [CARG1, RC, lsl #3]
3942 |.if PAUTH
3943 | ldr RA, TRACE:RC->mcauth
3944 |.else
3945 | ldr RA, TRACE:RC->mcode
3946 |.endif
3947 | str BASE, GL->jit_base
3948 | str L, GL->tmpbuf.L
3949 | sub sp, sp, #16 // See SPS_FIXED. Avoids sp adjust in every root trace.
3950 |.if PAUTH
3951 | braa RA, RC
3952 |.else
3953 | br RA
3954 |.endif
3955 |.endif
3956 break;
3957
3958 case BC_JMP:
3959 | // RA = base (only used by trace recorder), RC = target
3960 | add RC, PC, RC, lsl #2
3961 | sub PC, RC, #0x20000
3962 | ins_next
3963 break;
3964
3965 /* -- Function headers -------------------------------------------------- */
3966
3967 case BC_FUNCF:
3968 |.if JIT
3969 | hotcall
3970 |.endif
3971 case BC_FUNCV: /* NYI: compiled vararg functions. */
3972 | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow.
3973 break;
3974
3975 case BC_JFUNCF:
3976#if !LJ_HASJIT
3977 break;
3978#endif
3979 case BC_IFUNCF:
3980 | // BASE = new base, RA = BASE+framesize*8, CARG3 = LFUNC, RC = nargs*8
3981 | ldr CARG1, L->maxstack
3982 | ldrb TMP1w, [PC, #-4+PC2PROTO(numparams)]
3983 | ldr KBASE, [PC, #-4+PC2PROTO(k)]
3984 | cmp RA, CARG1
3985 | bhi ->vm_growstack_l
3986 |2:
3987 | cmp NARGS8:RC, TMP1, lsl #3 // Check for missing parameters.
3988 | blo >3
3989 if (op == BC_JFUNCF) {
3990 | decode_RD RC, INS
3991 | b =>BC_JLOOP
3992 } else {
3993 | ins_next
3994 }
3995 |
3996 |3: // Clear missing parameters.
3997 | str TISNIL, [BASE, NARGS8:RC]
3998 | add NARGS8:RC, NARGS8:RC, #8
3999 | b <2
4000 break;
4001
4002 case BC_JFUNCV:
4003#if !LJ_HASJIT
4004 break;
4005#endif
4006 | NYI // NYI: compiled vararg functions
4007 break; /* NYI: compiled vararg functions. */
4008
4009 case BC_IFUNCV:
4010 | // BASE = new base, RA = BASE+framesize*8, CARG3 = LFUNC, RC = nargs*8
4011 | ldr CARG1, L->maxstack
4012 | movn TMP0, #~LJ_TFUNC
4013 | add TMP2, BASE, RC
4014 | add LFUNC:CARG3, CARG3, TMP0, lsl #47
4015 | add RA, RA, RC
4016 | sub CARG1, CARG1, #8
4017 | add TMP0, RC, #16+FRAME_VARG
4018 | str LFUNC:CARG3, [TMP2], #8 // Store (tagged) copy of LFUNC.
4019 | ldr KBASE, [PC, #-4+PC2PROTO(k)]
4020 | cmp RA, CARG1
4021 | str TMP0, [TMP2], #8 // Store delta + FRAME_VARG.
4022 | bhs ->vm_growstack_l
4023 | sub RC, TMP2, #16
4024 | ldrb TMP1w, [PC, #-4+PC2PROTO(numparams)]
4025 | mov RA, BASE
4026 | mov BASE, TMP2
4027 | cbz TMP1, >2
4028 |1:
4029 | cmp RA, RC // Less args than parameters?
4030 | bhs >3
4031 | ldr TMP0, [RA]
4032 | sub TMP1, TMP1, #1
4033 | str TISNIL, [RA], #8 // Clear old fixarg slot (help the GC).
4034 | str TMP0, [TMP2], #8
4035 | cbnz TMP1, <1
4036 |2:
4037 | ins_next
4038 |
4039 |3:
4040 | sub TMP1, TMP1, #1
4041 | str TISNIL, [TMP2], #8
4042 | cbz TMP1, <2
4043 | b <3
4044 break;
4045
4046 case BC_FUNCC:
4047 case BC_FUNCCW:
4048 | // BASE = new base, RA = BASE+framesize*8, CARG3 = CFUNC, RC = nargs*8
4049 if (op == BC_FUNCC) {
4050 | ldr CARG4, CFUNC:CARG3->f
4051 } else {
4052 | ldr CARG4, GL->wrapf
4053 }
4054 | add CARG2, RA, NARGS8:RC
4055 | ldr CARG1, L->maxstack
4056 | add RC, BASE, NARGS8:RC
4057 | cmp CARG2, CARG1
4058 | stp BASE, RC, L->base
4059 if (op == BC_FUNCCW) {
4060 | ldr CARG2, CFUNC:CARG3->f
4061 }
4062 | mv_vmstate TMP0w, C
4063 | mov CARG1, L
4064 | bhi ->vm_growstack_c // Need to grow stack.
4065 | st_vmstate TMP0w
4066 | blr_auth CARG4 // (lua_State *L [, lua_CFunction f])
4067 | // Returns nresults.
4068 | ldp BASE, TMP1, L->base
4069 | str L, GL->cur_L
4070 | sbfiz RC, CRET1, #3, #32
4071 | st_vmstate ST_INTERP
4072 | ldr PC, [BASE, FRAME_PC]
4073 | sub RA, TMP1, RC // RA = L->top - nresults*8
4074 | b ->vm_returnc
4075 break;
4076
4077 /* ---------------------------------------------------------------------- */
4078
4079 default:
4080 fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]);
4081 exit(2);
4082 break;
4083 }
4084}
4085
4086static int build_backend(BuildCtx *ctx)
4087{
4088 int op;
4089
4090 dasm_growpc(Dst, BC__MAX);
4091
4092 build_subroutines(ctx);
4093
4094 |.code_op
4095 for (op = 0; op < BC__MAX; op++)
4096 build_ins(ctx, (BCOp)op, op);
4097
4098 return BC__MAX;
4099}
4100
4101/* Emit pseudo frame-info for all assembler functions. */
4102static void emit_asm_debug(BuildCtx *ctx)
4103{
4104 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
4105 int i;
4106 switch (ctx->mode) {
4107 case BUILD_elfasm:
4108 fprintf(ctx->fp, "\t.section .debug_frame,\"\",%%progbits\n");
4109 fprintf(ctx->fp,
4110 ".Lframe0:\n"
4111 "\t.long .LECIE0-.LSCIE0\n"
4112 ".LSCIE0:\n"
4113 "\t.long 0xffffffff\n"
4114 "\t.byte 0x1\n"
4115 "\t.string \"\"\n"
4116 "\t.uleb128 0x1\n"
4117 "\t.sleb128 -8\n"
4118 "\t.byte 30\n" /* Return address is in lr. */
4119 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */
4120 "\t.align 3\n"
4121 ".LECIE0:\n\n");
4122 fprintf(ctx->fp,
4123 ".LSFDE0:\n"
4124 "\t.long .LEFDE0-.LASFDE0\n"
4125 ".LASFDE0:\n"
4126 "\t.long .Lframe0\n"
4127 "\t.quad .Lbegin\n"
4128 "\t.quad %d\n"
4129 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4130 "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */
4131 fcofs);
4132 for (i = 19; i <= 28; i++) /* offset x19-x28 */
4133 fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19));
4134 for (i = 8; i <= 15; i++) /* offset d8-d15 */
4135 fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n",
4136 64+i, i+(3+(28-19+1)-8));
4137 fprintf(ctx->fp,
4138 "\t.align 3\n"
4139 ".LEFDE0:\n\n");
4140#if LJ_HASFFI
4141 fprintf(ctx->fp,
4142 ".LSFDE1:\n"
4143 "\t.long .LEFDE1-.LASFDE1\n"
4144 ".LASFDE1:\n"
4145 "\t.long .Lframe0\n"
4146 "\t.quad lj_vm_ffi_call\n"
4147 "\t.quad %d\n"
4148 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4149 "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */
4150 "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */
4151 "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */
4152 "\t.align 3\n"
4153 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
4154#endif
4155#if !LJ_NO_UNWIND
4156 fprintf(ctx->fp, "\t.section .eh_frame,\"a\",%%progbits\n");
4157 fprintf(ctx->fp,
4158 ".Lframe1:\n"
4159 "\t.long .LECIE1-.LSCIE1\n"
4160 ".LSCIE1:\n"
4161 "\t.long 0\n"
4162 "\t.byte 0x1\n"
4163 "\t.string \"zPR\"\n"
4164 "\t.uleb128 0x1\n"
4165 "\t.sleb128 -8\n"
4166 "\t.byte 30\n" /* Return address is in lr. */
4167 "\t.uleb128 6\n" /* augmentation length */
4168 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4169 "\t.long lj_err_unwind_dwarf-.\n"
4170 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4171 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */
4172 "\t.align 3\n"
4173 ".LECIE1:\n\n");
4174 fprintf(ctx->fp,
4175 ".LSFDE2:\n"
4176 "\t.long .LEFDE2-.LASFDE2\n"
4177 ".LASFDE2:\n"
4178 "\t.long .LASFDE2-.Lframe1\n"
4179 "\t.long .Lbegin-.\n"
4180 "\t.long %d\n"
4181 "\t.uleb128 0\n" /* augmentation length */
4182 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4183 "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */
4184 fcofs);
4185 for (i = 19; i <= 28; i++) /* offset x19-x28 */
4186 fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19));
4187 for (i = 8; i <= 15; i++) /* offset d8-d15 */
4188 fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n",
4189 64+i, i+(3+(28-19+1)-8));
4190 fprintf(ctx->fp,
4191 "\t.align 3\n"
4192 ".LEFDE2:\n\n");
4193#if LJ_HASFFI
4194 fprintf(ctx->fp,
4195 ".Lframe2:\n"
4196 "\t.long .LECIE2-.LSCIE2\n"
4197 ".LSCIE2:\n"
4198 "\t.long 0\n"
4199 "\t.byte 0x1\n"
4200 "\t.string \"zR\"\n"
4201 "\t.uleb128 0x1\n"
4202 "\t.sleb128 -8\n"
4203 "\t.byte 30\n" /* Return address is in lr. */
4204 "\t.uleb128 1\n" /* augmentation length */
4205 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4206 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */
4207 "\t.align 3\n"
4208 ".LECIE2:\n\n");
4209 fprintf(ctx->fp,
4210 ".LSFDE3:\n"
4211 "\t.long .LEFDE3-.LASFDE3\n"
4212 ".LASFDE3:\n"
4213 "\t.long .LASFDE3-.Lframe2\n"
4214 "\t.long lj_vm_ffi_call-.\n"
4215 "\t.long %d\n"
4216 "\t.uleb128 0\n" /* augmentation length */
4217 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4218 "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */
4219 "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */
4220 "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */
4221 "\t.align 3\n"
4222 ".LEFDE3:\n\n", (int)ctx->codesz - fcofs);
4223#endif
4224#endif
4225#if LJ_TARGET_LINUX && LJ_ABI_BRANCH_TRACK
4226 fprintf(ctx->fp,
4227 "\t.section .note.gnu.property,\"a\"\n"
4228 "\t.align 3\n"
4229 "\t.long 4\n"
4230 "\t.long 16\n"
4231 "\t.long 5\n"
4232 "\t.long 0x00554e47\n"
4233 "\t.long 0xc0000000\n"
4234 "\t.long 4\n"
4235 "\t.long 1\n"
4236 "\t.long 0\n");
4237#endif
4238 break;
4239#if !LJ_NO_UNWIND
4240 case BUILD_machasm: {
4241#if LJ_HASFFI
4242 int fcsize = 0;
4243#endif
4244 int j;
4245 fprintf(ctx->fp, "\t.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support\n");
4246 fprintf(ctx->fp,
4247 "EH_frame1:\n"
4248 "\t.set L$set$x,LECIEX-LSCIEX\n"
4249 "\t.long L$set$x\n"
4250 "LSCIEX:\n"
4251 "\t.long 0\n"
4252 "\t.byte 0x1\n"
4253 "\t.ascii \"zPR\\0\"\n"
4254 "\t.uleb128 0x1\n"
4255 "\t.sleb128 -8\n"
4256 "\t.byte 30\n" /* Return address is in lr. */
4257 "\t.uleb128 6\n" /* augmentation length */
4258 "\t.byte 0x9b\n" /* indirect|pcrel|sdata4 */
4259 "\t.long _lj_err_unwind_dwarf@GOT-.\n"
4260 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4261 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */
4262 "\t.align 3\n"
4263 "LECIEX:\n\n");
4264 for (j = 0; j < ctx->nsym; j++) {
4265 const char *name = ctx->sym[j].name;
4266 int32_t size = ctx->sym[j+1].ofs - ctx->sym[j].ofs;
4267 if (size == 0) continue;
4268#if LJ_HASFFI
4269 if (!strcmp(name, "_lj_vm_ffi_call")) { fcsize = size; continue; }
4270#endif
4271 fprintf(ctx->fp,
4272 "LSFDE%d:\n"
4273 "\t.set L$set$%d,LEFDE%d-LASFDE%d\n"
4274 "\t.long L$set$%d\n"
4275 "LASFDE%d:\n"
4276 "\t.long LASFDE%d-EH_frame1\n"
4277 "\t.long %s-.\n"
4278 "\t.long %d\n"
4279 "\t.uleb128 0\n" /* augmentation length */
4280 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4281 "\t.byte 0x9d\n\t.uleb128 2\n", /* offset fp */
4282 j, j, j, j, j, j, j, name, size);
4283 for (i = 19; i <= 28; i++) /* offset x19-x28 */
4284 fprintf(ctx->fp, "\t.byte 0x%x\n\t.uleb128 %d\n", 0x80+i, i+(3-19));
4285 for (i = 8; i <= 15; i++) /* offset d8-d15 */
4286 fprintf(ctx->fp, "\t.byte 5\n\t.uleb128 0x%x\n\t.uleb128 %d\n",
4287 64+i, i+(3+(28-19+1)-8));
4288 fprintf(ctx->fp,
4289 "\t.align 3\n"
4290 "LEFDE%d:\n\n", j);
4291 }
4292#if LJ_HASFFI
4293 if (fcsize) {
4294 fprintf(ctx->fp,
4295 "EH_frame2:\n"
4296 "\t.set L$set$y,LECIEY-LSCIEY\n"
4297 "\t.long L$set$y\n"
4298 "LSCIEY:\n"
4299 "\t.long 0\n"
4300 "\t.byte 0x1\n"
4301 "\t.ascii \"zR\\0\"\n"
4302 "\t.uleb128 0x1\n"
4303 "\t.sleb128 -8\n"
4304 "\t.byte 30\n" /* Return address is in lr. */
4305 "\t.uleb128 1\n" /* augmentation length */
4306 "\t.byte 0x1b\n" /* pcrel|sdata4 */
4307 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 16\n" /* def_cfa fp 16 */
4308 "\t.align 3\n"
4309 "LECIEY:\n\n");
4310 fprintf(ctx->fp,
4311 "LSFDEY:\n"
4312 "\t.set L$set$yy,LEFDEY-LASFDEY\n"
4313 "\t.long L$set$yy\n"
4314 "LASFDEY:\n"
4315 "\t.long LASFDEY-EH_frame2\n"
4316 "\t.long _lj_vm_ffi_call-.\n"
4317 "\t.long %d\n"
4318 "\t.uleb128 0\n" /* augmentation length */
4319 "\t.byte 0x9e\n\t.uleb128 1\n" /* offset lr */
4320 "\t.byte 0x9d\n\t.uleb128 2\n" /* offset fp */
4321 "\t.byte 0x93\n\t.uleb128 3\n" /* offset x19 */
4322 "\t.byte 0x94\n\t.uleb128 4\n" /* offset x20 */
4323 "\t.align 3\n"
4324 "LEFDEY:\n\n", fcsize);
4325 }
4326#endif
4327 }
4328 break;
4329#endif
4330 default:
4331 break;
4332 }
4333}
4334