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_mips64.dasc
raw
1|// Low-level VM code for MIPS64 CPUs.
2|// Bytecode interpreter, fast functions and helper functions.
3|// Copyright (C) 2005-2026 Mike Pall. See Copyright Notice in luajit.h
4|//
5|// Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com.
6|// Sponsored by Cisco Systems, Inc.
7|
8|.arch mips64
9|.section code_op, code_sub
10|
11|.actionlist build_actionlist
12|.globals GLOB_
13|.globalnames globnames
14|.externnames extnames
15|
16|// Note: The ragged indentation of the instructions is intentional.
17|// The starting columns indicate data dependencies.
18|
19|//-----------------------------------------------------------------------
20|
21|// Fixed register assignments for the interpreter.
22|// Don't use: r0 = 0, r26/r27 = reserved, r28 = gp, r29 = sp, r31 = ra
23|
24|.macro .FPU, a, b
25|.if FPU
26| a, b
27|.endif
28|.endmacro
29|
30|// The following must be C callee-save (but BASE is often refetched).
31|.define BASE, r16 // Base of current Lua stack frame.
32|.define KBASE, r17 // Constants of current Lua function.
33|.define PC, r18 // Next PC.
34|.define DISPATCH, r19 // Opcode dispatch table.
35|.define LREG, r20 // Register holding lua_State (also in SAVE_L).
36|.define MULTRES, r21 // Size of multi-result: (nresults+1)*8.
37|
38|.define JGL, r30 // On-trace: global_State + 32768.
39|
40|// Constants for type-comparisons, stores and conversions. C callee-save.
41|.define TISNIL, r30
42|.define TISNUM, r22
43|.if FPU
44|.define TOBIT, f30 // 2^52 + 2^51.
45|.endif
46|
47|// The following temporaries are not saved across C calls, except for RA.
48|.define RA, r23 // Callee-save.
49|.define RB, r8
50|.define RC, r9
51|.define RD, r10
52|.define INS, r11
53|
54|.define AT, r1 // Assembler temporary.
55|.define TMP0, r12
56|.define TMP1, r13
57|.define TMP2, r14
58|.define TMP3, r15
59|
60|// MIPS n64 calling convention.
61|.define CFUNCADDR, r25
62|.define CARG1, r4
63|.define CARG2, r5
64|.define CARG3, r6
65|.define CARG4, r7
66|.define CARG5, r8
67|.define CARG6, r9
68|.define CARG7, r10
69|.define CARG8, r11
70|
71|.define CRET1, r2
72|.define CRET2, r3
73|
74|.if FPU
75|.define FARG1, f12
76|.define FARG2, f13
77|.define FARG3, f14
78|.define FARG4, f15
79|.define FARG5, f16
80|.define FARG6, f17
81|.define FARG7, f18
82|.define FARG8, f19
83|
84|.define FRET1, f0
85|.define FRET2, f2
86|
87|.define FTMP0, f20
88|.define FTMP1, f21
89|.define FTMP2, f22
90|.endif
91|
92|// Stack layout while in interpreter. Must match with lj_frame.h.
93|.if FPU // MIPS64 hard-float.
94|
95|.define CFRAME_SPACE, 192 // Delta for sp.
96|
97|//----- 16 byte aligned, <-- sp entering interpreter
98|.define SAVE_ERRF, 188(sp) // 32 bit values.
99|.define SAVE_NRES, 184(sp)
100|.define SAVE_CFRAME, 176(sp) // 64 bit values.
101|.define SAVE_L, 168(sp)
102|.define SAVE_PC, 160(sp)
103|//----- 16 byte aligned
104|.define SAVE_GPR_, 80 // .. 80+10*8: 64 bit GPR saves.
105|.define SAVE_FPR_, 16 // .. 16+8*8: 64 bit FPR saves.
106|
107|.else // MIPS64 soft-float
108|
109|.define CFRAME_SPACE, 128 // Delta for sp.
110|
111|//----- 16 byte aligned, <-- sp entering interpreter
112|.define SAVE_ERRF, 124(sp) // 32 bit values.
113|.define SAVE_NRES, 120(sp)
114|.define SAVE_CFRAME, 112(sp) // 64 bit values.
115|.define SAVE_L, 104(sp)
116|.define SAVE_PC, 96(sp)
117|//----- 16 byte aligned
118|.define SAVE_GPR_, 16 // .. 16+10*8: 64 bit GPR saves.
119|
120|.endif
121|
122|.define TMPX, 8(sp) // Unused by interpreter, temp for JIT code.
123|.define TMPD, 0(sp)
124|//----- 16 byte aligned
125|
126|.define TMPD_OFS, 0
127|
128|.define SAVE_MULTRES, TMPD
129|
130|//-----------------------------------------------------------------------
131|
132|.macro saveregs
133| daddiu sp, sp, -CFRAME_SPACE
134| sd ra, SAVE_GPR_+9*8(sp)
135| sd r30, SAVE_GPR_+8*8(sp)
136| .FPU sdc1 f31, SAVE_FPR_+7*8(sp)
137| sd r23, SAVE_GPR_+7*8(sp)
138| .FPU sdc1 f30, SAVE_FPR_+6*8(sp)
139| sd r22, SAVE_GPR_+6*8(sp)
140| .FPU sdc1 f29, SAVE_FPR_+5*8(sp)
141| sd r21, SAVE_GPR_+5*8(sp)
142| .FPU sdc1 f28, SAVE_FPR_+4*8(sp)
143| sd r20, SAVE_GPR_+4*8(sp)
144| .FPU sdc1 f27, SAVE_FPR_+3*8(sp)
145| sd r19, SAVE_GPR_+3*8(sp)
146| .FPU sdc1 f26, SAVE_FPR_+2*8(sp)
147| sd r18, SAVE_GPR_+2*8(sp)
148| .FPU sdc1 f25, SAVE_FPR_+1*8(sp)
149| sd r17, SAVE_GPR_+1*8(sp)
150| .FPU sdc1 f24, SAVE_FPR_+0*8(sp)
151| sd r16, SAVE_GPR_+0*8(sp)
152|.endmacro
153|
154|.macro restoreregs_ret
155| ld ra, SAVE_GPR_+9*8(sp)
156| ld r30, SAVE_GPR_+8*8(sp)
157| ld r23, SAVE_GPR_+7*8(sp)
158| .FPU ldc1 f31, SAVE_FPR_+7*8(sp)
159| ld r22, SAVE_GPR_+6*8(sp)
160| .FPU ldc1 f30, SAVE_FPR_+6*8(sp)
161| ld r21, SAVE_GPR_+5*8(sp)
162| .FPU ldc1 f29, SAVE_FPR_+5*8(sp)
163| ld r20, SAVE_GPR_+4*8(sp)
164| .FPU ldc1 f28, SAVE_FPR_+4*8(sp)
165| ld r19, SAVE_GPR_+3*8(sp)
166| .FPU ldc1 f27, SAVE_FPR_+3*8(sp)
167| ld r18, SAVE_GPR_+2*8(sp)
168| .FPU ldc1 f26, SAVE_FPR_+2*8(sp)
169| ld r17, SAVE_GPR_+1*8(sp)
170| .FPU ldc1 f25, SAVE_FPR_+1*8(sp)
171| ld r16, SAVE_GPR_+0*8(sp)
172| .FPU ldc1 f24, SAVE_FPR_+0*8(sp)
173| jr ra
174| daddiu sp, sp, CFRAME_SPACE
175|.endmacro
176|
177|// Type definitions. Some of these are only used for documentation.
178|.type L, lua_State, LREG
179|.type GL, global_State
180|.type TVALUE, TValue
181|.type GCOBJ, GCobj
182|.type STR, GCstr
183|.type TAB, GCtab
184|.type LFUNC, GCfuncL
185|.type CFUNC, GCfuncC
186|.type PROTO, GCproto
187|.type UPVAL, GCupval
188|.type NODE, Node
189|.type NARGS8, int
190|.type TRACE, GCtrace
191|.type SBUF, SBuf
192|
193|//-----------------------------------------------------------------------
194|
195|// Trap for not-yet-implemented parts.
196|.macro NYI; .long 0xec1cf0f0; .endmacro
197|
198|// Macros to mark delay slots.
199|.macro ., a; a; .endmacro
200|.macro ., a,b; a,b; .endmacro
201|.macro ., a,b,c; a,b,c; .endmacro
202|.macro ., a,b,c,d; a,b,c,d; .endmacro
203|
204|.define FRAME_PC, -8
205|.define FRAME_FUNC, -16
206|
207|//-----------------------------------------------------------------------
208|
209|// Endian-specific defines.
210|.if ENDIAN_LE
211|.define HI, 4
212|.define LO, 0
213|.define OFS_RD, 2
214|.define OFS_RA, 1
215|.define OFS_OP, 0
216|.else
217|.define HI, 0
218|.define LO, 4
219|.define OFS_RD, 0
220|.define OFS_RA, 2
221|.define OFS_OP, 3
222|.endif
223|
224|// Instruction decode.
225|.macro decode_OP1, dst, ins; andi dst, ins, 0xff; .endmacro
226|.macro decode_OP8a, dst, ins; andi dst, ins, 0xff; .endmacro
227|.macro decode_OP8b, dst; sll dst, dst, 3; .endmacro
228|.macro decode_RC8a, dst, ins; srl dst, ins, 13; .endmacro
229|.macro decode_RC8b, dst; andi dst, dst, 0x7f8; .endmacro
230|.macro decode_RD4b, dst; sll dst, dst, 2; .endmacro
231|.macro decode_RA8a, dst, ins; srl dst, ins, 5; .endmacro
232|.macro decode_RA8b, dst; andi dst, dst, 0x7f8; .endmacro
233|.macro decode_RB8a, dst, ins; srl dst, ins, 21; .endmacro
234|.macro decode_RB8b, dst; andi dst, dst, 0x7f8; .endmacro
235|.macro decode_RD8a, dst, ins; srl dst, ins, 16; .endmacro
236|.macro decode_RD8b, dst; sll dst, dst, 3; .endmacro
237|.macro decode_RDtoRC8, dst, src; andi dst, src, 0x7f8; .endmacro
238|
239|// Instruction fetch.
240|.macro ins_NEXT1
241| lw INS, 0(PC)
242| daddiu PC, PC, 4
243|.endmacro
244|// Instruction decode+dispatch.
245|.macro ins_NEXT2
246| decode_OP8a TMP1, INS
247| decode_OP8b TMP1
248| daddu TMP0, DISPATCH, TMP1
249| decode_RD8a RD, INS
250| ld AT, 0(TMP0)
251| decode_RA8a RA, INS
252| decode_RD8b RD
253| jr AT
254| decode_RA8b RA
255|.endmacro
256|.macro ins_NEXT
257| ins_NEXT1
258| ins_NEXT2
259|.endmacro
260|
261|// Instruction footer.
262|.if 1
263| // Replicated dispatch. Less unpredictable branches, but higher I-Cache use.
264| .define ins_next, ins_NEXT
265| .define ins_next_, ins_NEXT
266| .define ins_next1, ins_NEXT1
267| .define ins_next2, ins_NEXT2
268|.else
269| // Common dispatch. Lower I-Cache use, only one (very) unpredictable branch.
270| // Affects only certain kinds of benchmarks (and only with -j off).
271| .macro ins_next
272| b ->ins_next
273| .endmacro
274| .macro ins_next1
275| .endmacro
276| .macro ins_next2
277| b ->ins_next
278| .endmacro
279| .macro ins_next_
280| ->ins_next:
281| ins_NEXT
282| .endmacro
283|.endif
284|
285|// Call decode and dispatch.
286|.macro ins_callt
287| // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
288| ld PC, LFUNC:RB->pc
289| lw INS, 0(PC)
290| daddiu PC, PC, 4
291| decode_OP8a TMP1, INS
292| decode_RA8a RA, INS
293| decode_OP8b TMP1
294| decode_RA8b RA
295| daddu TMP0, DISPATCH, TMP1
296| ld TMP0, 0(TMP0)
297| jr TMP0
298| daddu RA, RA, BASE
299|.endmacro
300|
301|.macro ins_call
302| // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, PC = caller PC
303| sd PC, FRAME_PC(BASE)
304| ins_callt
305|.endmacro
306|
307|//-----------------------------------------------------------------------
308|
309|.macro branch_RD
310| srl TMP0, RD, 1
311| lui AT, (-(BCBIAS_J*4 >> 16) & 65535)
312| addu TMP0, TMP0, AT
313| daddu PC, PC, TMP0
314|.endmacro
315|
316|// Assumes DISPATCH is relative to GL.
317#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
318#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
319#define GG_DISP2GOT (GG_OFS(got) - GG_OFS(dispatch))
320#define DISPATCH_GOT(name) (GG_DISP2GOT + sizeof(void*)*LJ_GOT_##name)
321|
322#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))
323|
324|.macro load_got, func
325| ld CFUNCADDR, DISPATCH_GOT(func)(DISPATCH)
326|.endmacro
327|// Much faster. Sadly, there's no easy way to force the required code layout.
328|// .macro call_intern, func; bal extern func; .endmacro
329|.macro call_intern, func; jalr CFUNCADDR; .endmacro
330|.macro call_extern; jalr CFUNCADDR; .endmacro
331|.macro jmp_extern; jr CFUNCADDR; .endmacro
332|
333|.macro hotcheck, delta, target
334| dsrl TMP1, PC, 1
335| andi TMP1, TMP1, 126
336| daddu TMP1, TMP1, DISPATCH
337| lhu TMP2, GG_DISP2HOT(TMP1)
338| addiu TMP2, TMP2, -delta
339| bltz TMP2, target
340|. sh TMP2, GG_DISP2HOT(TMP1)
341|.endmacro
342|
343|.macro hotloop
344| hotcheck HOTCOUNT_LOOP, ->vm_hotloop
345|.endmacro
346|
347|.macro hotcall
348| hotcheck HOTCOUNT_CALL, ->vm_hotcall
349|.endmacro
350|
351|// Set current VM state. Uses TMP0.
352|.macro li_vmstate, st; li TMP0, ~LJ_VMST_..st; .endmacro
353|.macro st_vmstate; sw TMP0, DISPATCH_GL(vmstate)(DISPATCH); .endmacro
354|
355|// Move table write barrier back. Overwrites mark and tmp.
356|.macro barrierback, tab, mark, tmp, target
357| ld tmp, DISPATCH_GL(gc.grayagain)(DISPATCH)
358| andi mark, mark, ~LJ_GC_BLACK & 255 // black2gray(tab)
359| sd tab, DISPATCH_GL(gc.grayagain)(DISPATCH)
360| sb mark, tab->marked
361| b target
362|. sd tmp, tab->gclist
363|.endmacro
364|
365|// Clear type tag. Isolate lowest 14+32+1=47 bits of reg.
366|.macro cleartp, reg; dextm reg, reg, 0, 14; .endmacro
367|.macro cleartp, dst, reg; dextm dst, reg, 0, 14; .endmacro
368|
369|// Set type tag: Merge 17 type bits into bits [15+32=47, 31+32+1=64) of dst.
370|.macro settp, dst, tp; dinsu dst, tp, 15, 31; .endmacro
371|
372|// Extract (negative) type tag.
373|.macro gettp, dst, src; dsra dst, src, 47; .endmacro
374|
375|// Macros to check the TValue type and extract the GCobj. Branch on failure.
376|.macro checktp, reg, tp, target
377| gettp AT, reg
378| daddiu AT, AT, tp
379| bnez AT, target
380|. cleartp reg
381|.endmacro
382|.macro checktp, dst, reg, tp, target
383| gettp AT, reg
384| daddiu AT, AT, tp
385| bnez AT, target
386|. cleartp dst, reg
387|.endmacro
388|.macro checkstr, reg, target; checktp reg, -LJ_TSTR, target; .endmacro
389|.macro checktab, reg, target; checktp reg, -LJ_TTAB, target; .endmacro
390|.macro checkfunc, reg, target; checktp reg, -LJ_TFUNC, target; .endmacro
391|.macro checkint, reg, target // Caveat: has delay slot!
392| gettp AT, reg
393| bne AT, TISNUM, target
394|.endmacro
395|.macro checknum, reg, target // Caveat: has delay slot!
396| gettp AT, reg
397| sltiu AT, AT, LJ_TISNUM
398| beqz AT, target
399|.endmacro
400|
401|.macro mov_false, reg
402| lu reg, 0x8000
403| dsll reg, reg, 32
404| not reg, reg
405|.endmacro
406|.macro mov_true, reg
407| li reg, 0x0001
408| dsll reg, reg, 48
409| not reg, reg
410|.endmacro
411|
412|//-----------------------------------------------------------------------
413
414/* Generate subroutines used by opcodes and other parts of the VM. */
415/* The .code_sub section should be last to help static branch prediction. */
416static void build_subroutines(BuildCtx *ctx)
417{
418 |.code_sub
419 |
420 |//-----------------------------------------------------------------------
421 |//-- Return handling ----------------------------------------------------
422 |//-----------------------------------------------------------------------
423 |
424 |->vm_returnp:
425 | // See vm_return. Also: TMP2 = previous base.
426 | andi AT, PC, FRAME_P
427 | beqz AT, ->cont_dispatch
428 |
429 | // Return from pcall or xpcall fast func.
430 |. mov_true TMP1
431 | ld PC, FRAME_PC(TMP2) // Fetch PC of previous frame.
432 | move BASE, TMP2 // Restore caller base.
433 | // Prepending may overwrite the pcall frame, so do it at the end.
434 | sd TMP1, -8(RA) // Prepend true to results.
435 | daddiu RA, RA, -8
436 |
437 |->vm_returnc:
438 | addiu RD, RD, 8 // RD = (nresults+1)*8.
439 | andi TMP0, PC, FRAME_TYPE
440 | beqz RD, ->vm_unwind_c_eh
441 |. li CRET1, LUA_YIELD
442 | beqz TMP0, ->BC_RET_Z // Handle regular return to Lua.
443 |. move MULTRES, RD
444 |
445 |->vm_return:
446 | // BASE = base, RA = resultptr, RD/MULTRES = (nresults+1)*8, PC = return
447 | // TMP0 = PC & FRAME_TYPE
448 | li TMP2, -8
449 | xori AT, TMP0, FRAME_C
450 | and TMP2, PC, TMP2
451 | bnez AT, ->vm_returnp
452 | dsubu TMP2, BASE, TMP2 // TMP2 = previous base.
453 |
454 | addiu TMP1, RD, -8
455 | sd TMP2, L->base
456 | li_vmstate C
457 | lw TMP2, SAVE_NRES
458 | daddiu BASE, BASE, -16
459 | st_vmstate
460 | beqz TMP1, >2
461 |. sll TMP2, TMP2, 3
462 |1:
463 | addiu TMP1, TMP1, -8
464 | ld CRET1, 0(RA)
465 | daddiu RA, RA, 8
466 | sd CRET1, 0(BASE)
467 | bnez TMP1, <1
468 |. daddiu BASE, BASE, 8
469 |
470 |2:
471 | bne TMP2, RD, >6
472 |3:
473 |. sd BASE, L->top // Store new top.
474 |
475 |->vm_leave_cp:
476 | ld TMP0, SAVE_CFRAME // Restore previous C frame.
477 | move CRET1, r0 // Ok return status for vm_pcall.
478 | sd TMP0, L->cframe
479 |
480 |->vm_leave_unw:
481 | restoreregs_ret
482 |
483 |6:
484 | ld TMP1, L->maxstack
485 | slt AT, TMP2, RD
486 | bnez AT, >7 // Less results wanted?
487 | // More results wanted. Check stack size and fill up results with nil.
488 |. slt AT, BASE, TMP1
489 | beqz AT, >8
490 |. nop
491 | sd TISNIL, 0(BASE)
492 | addiu RD, RD, 8
493 | b <2
494 |. daddiu BASE, BASE, 8
495 |
496 |7: // Less results wanted.
497 | subu TMP0, RD, TMP2
498 | dsubu TMP0, BASE, TMP0 // Either keep top or shrink it.
499 |.if MIPSR6
500 | selnez TMP0, TMP0, TMP2 // LUA_MULTRET+1 case?
501 | seleqz BASE, BASE, TMP2
502 | b <3
503 |. or BASE, BASE, TMP0
504 |.else
505 | b <3
506 |. movn BASE, TMP0, TMP2 // LUA_MULTRET+1 case?
507 |.endif
508 |
509 |8: // Corner case: need to grow stack for filling up results.
510 | // This can happen if:
511 | // - A C function grows the stack (a lot).
512 | // - The GC shrinks the stack in between.
513 | // - A return back from a lua_call() with (high) nresults adjustment.
514 | load_got lj_state_growstack
515 | move MULTRES, RD
516 | srl CARG2, TMP2, 3
517 | call_intern lj_state_growstack // (lua_State *L, int n)
518 |. move CARG1, L
519 | lw TMP2, SAVE_NRES
520 | ld BASE, L->top // Need the (realloced) L->top in BASE.
521 | move RD, MULTRES
522 | b <2
523 |. sll TMP2, TMP2, 3
524 |
525 |->vm_unwind_c: // Unwind C stack, return from vm_pcall.
526 | // (void *cframe, int errcode)
527 | move sp, CARG1
528 | move CRET1, CARG2
529 |->vm_unwind_c_eh: // Landing pad for external unwinder.
530 | ld L, SAVE_L
531 | li TMP0, ~LJ_VMST_C
532 | ld GL:TMP1, L->glref
533 | b ->vm_leave_unw
534 |. sw TMP0, GL:TMP1->vmstate
535 |
536 |->vm_unwind_ff: // Unwind C stack, return from ff pcall.
537 | // (void *cframe)
538 | li AT, -4
539 | and sp, CARG1, AT
540 |->vm_unwind_ff_eh: // Landing pad for external unwinder.
541 | ld L, SAVE_L
542 | .FPU lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
543 | li TISNIL, LJ_TNIL
544 | li TISNUM, LJ_TISNUM
545 | ld BASE, L->base
546 | ld DISPATCH, L->glref // Setup pointer to dispatch table.
547 | .FPU mtc1 TMP3, TOBIT
548 | mov_false TMP1
549 | li_vmstate INTERP
550 | ld PC, FRAME_PC(BASE) // Fetch PC of previous frame.
551 | .FPU cvt.d.s TOBIT, TOBIT
552 | daddiu RA, BASE, -8 // Results start at BASE-8.
553 | daddiu DISPATCH, DISPATCH, GG_G2DISP
554 | sd TMP1, 0(RA) // Prepend false to error message.
555 | st_vmstate
556 | b ->vm_returnc
557 |. li RD, 16 // 2 results: false + error message.
558 |
559 |->vm_unwind_stub: // Jump to exit stub from unwinder.
560 | jr CARG1
561 |. move ra, CARG2
562 |
563 |//-----------------------------------------------------------------------
564 |//-- Grow stack for calls -----------------------------------------------
565 |//-----------------------------------------------------------------------
566 |
567 |->vm_growstack_c: // Grow stack for C function.
568 | b >2
569 |. li CARG2, LUA_MINSTACK
570 |
571 |->vm_growstack_l: // Grow stack for Lua function.
572 | // BASE = new base, RA = BASE+framesize*8, RC = nargs*8, PC = first PC
573 | daddu RC, BASE, RC
574 | dsubu RA, RA, BASE
575 | sd BASE, L->base
576 | daddiu PC, PC, 4 // Must point after first instruction.
577 | sd RC, L->top
578 | srl CARG2, RA, 3
579 |2:
580 | // L->base = new base, L->top = top
581 | load_got lj_state_growstack
582 | sd PC, SAVE_PC
583 | call_intern lj_state_growstack // (lua_State *L, int n)
584 |. move CARG1, L
585 | ld BASE, L->base
586 | ld RC, L->top
587 | ld LFUNC:RB, FRAME_FUNC(BASE)
588 | dsubu RC, RC, BASE
589 | cleartp LFUNC:RB
590 | // BASE = new base, RB = LFUNC/CFUNC, RC = nargs*8, FRAME_PC(BASE) = PC
591 | ins_callt // Just retry the call.
592 |
593 |//-----------------------------------------------------------------------
594 |//-- Entry points into the assembler VM ---------------------------------
595 |//-----------------------------------------------------------------------
596 |
597 |->vm_resume: // Setup C frame and resume thread.
598 | // (lua_State *L, TValue *base, int nres1 = 0, ptrdiff_t ef = 0)
599 | saveregs
600 | move L, CARG1
601 | ld DISPATCH, L->glref // Setup pointer to dispatch table.
602 | move BASE, CARG2
603 | lbu TMP1, L->status
604 | sd L, SAVE_L
605 | li PC, FRAME_CP
606 | daddiu TMP0, sp, CFRAME_RESUME
607 | daddiu DISPATCH, DISPATCH, GG_G2DISP
608 | sw r0, SAVE_NRES
609 | sw r0, SAVE_ERRF
610 | sd CARG1, SAVE_PC // Any value outside of bytecode is ok.
611 | sd r0, SAVE_CFRAME
612 | beqz TMP1, >3
613 |. sd TMP0, L->cframe
614 |
615 | // Resume after yield (like a return).
616 | sd L, DISPATCH_GL(cur_L)(DISPATCH)
617 | move RA, BASE
618 | ld BASE, L->base
619 | ld TMP1, L->top
620 | ld PC, FRAME_PC(BASE)
621 | .FPU lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
622 | dsubu RD, TMP1, BASE
623 | .FPU mtc1 TMP3, TOBIT
624 | sb r0, L->status
625 | .FPU cvt.d.s TOBIT, TOBIT
626 | li_vmstate INTERP
627 | daddiu RD, RD, 8
628 | st_vmstate
629 | move MULTRES, RD
630 | andi TMP0, PC, FRAME_TYPE
631 | li TISNIL, LJ_TNIL
632 | beqz TMP0, ->BC_RET_Z
633 |. li TISNUM, LJ_TISNUM
634 | b ->vm_return
635 |. nop
636 |
637 |->vm_pcall: // Setup protected C frame and enter VM.
638 | // (lua_State *L, TValue *base, int nres1, ptrdiff_t ef)
639 | saveregs
640 | sw CARG4, SAVE_ERRF
641 | b >1
642 |. li PC, FRAME_CP
643 |
644 |->vm_call: // Setup C frame and enter VM.
645 | // (lua_State *L, TValue *base, int nres1)
646 | saveregs
647 | li PC, FRAME_C
648 |
649 |1: // Entry point for vm_pcall above (PC = ftype).
650 | ld TMP1, L:CARG1->cframe
651 | move L, CARG1
652 | sw CARG3, SAVE_NRES
653 | ld DISPATCH, L->glref // Setup pointer to dispatch table.
654 | sd CARG1, SAVE_L
655 | move BASE, CARG2
656 | daddiu DISPATCH, DISPATCH, GG_G2DISP
657 | sd CARG1, SAVE_PC // Any value outside of bytecode is ok.
658 | sd TMP1, SAVE_CFRAME
659 | sd sp, L->cframe // Add our C frame to cframe chain.
660 |
661 |3: // Entry point for vm_cpcall/vm_resume (BASE = base, PC = ftype).
662 | sd L, DISPATCH_GL(cur_L)(DISPATCH)
663 | ld TMP2, L->base // TMP2 = old base (used in vmeta_call).
664 | .FPU lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
665 | ld TMP1, L->top
666 | .FPU mtc1 TMP3, TOBIT
667 | daddu PC, PC, BASE
668 | dsubu NARGS8:RC, TMP1, BASE
669 | li TISNUM, LJ_TISNUM
670 | dsubu PC, PC, TMP2 // PC = frame delta + frame type
671 | .FPU cvt.d.s TOBIT, TOBIT
672 | li_vmstate INTERP
673 | li TISNIL, LJ_TNIL
674 | st_vmstate
675 |
676 |->vm_call_dispatch:
677 | // TMP2 = old base, BASE = new base, RC = nargs*8, PC = caller PC
678 | ld LFUNC:RB, FRAME_FUNC(BASE)
679 | checkfunc LFUNC:RB, ->vmeta_call
680 |
681 |->vm_call_dispatch_f:
682 | ins_call
683 | // BASE = new base, RB = func, RC = nargs*8, PC = caller PC
684 |
685 |->vm_cpcall: // Setup protected C frame, call C.
686 | // (lua_State *L, lua_CFunction func, void *ud, lua_CPFunction cp)
687 | saveregs
688 | move L, CARG1
689 | ld TMP0, L:CARG1->stack
690 | sd CARG1, SAVE_L
691 | ld TMP1, L->top
692 | ld DISPATCH, L->glref // Setup pointer to dispatch table.
693 | sd CARG1, SAVE_PC // Any value outside of bytecode is ok.
694 | dsubu TMP0, TMP0, TMP1 // Compute -savestack(L, L->top).
695 | ld TMP1, L->cframe
696 | daddiu DISPATCH, DISPATCH, GG_G2DISP
697 | sw TMP0, SAVE_NRES // Neg. delta means cframe w/o frame.
698 | sw r0, SAVE_ERRF // No error function.
699 | sd TMP1, SAVE_CFRAME
700 | sd sp, L->cframe // Add our C frame to cframe chain.
701 | sd L, DISPATCH_GL(cur_L)(DISPATCH)
702 | jalr CARG4 // (lua_State *L, lua_CFunction func, void *ud)
703 |. move CFUNCADDR, CARG4
704 | move BASE, CRET1
705 | bnez CRET1, <3 // Else continue with the call.
706 |. li PC, FRAME_CP
707 | b ->vm_leave_cp // No base? Just remove C frame.
708 |. nop
709 |
710 |//-----------------------------------------------------------------------
711 |//-- Metamethod handling ------------------------------------------------
712 |//-----------------------------------------------------------------------
713 |
714 |// The lj_meta_* functions (except for lj_meta_cat) don't reallocate the
715 |// stack, so BASE doesn't need to be reloaded across these calls.
716 |
717 |//-- Continuation dispatch ----------------------------------------------
718 |
719 |->cont_dispatch:
720 | // BASE = meta base, RA = resultptr, RD = (nresults+1)*8
721 | ld TMP0, -32(BASE) // Continuation.
722 | move RB, BASE
723 | move BASE, TMP2 // Restore caller BASE.
724 | ld LFUNC:TMP1, FRAME_FUNC(TMP2)
725 |.if FFI
726 | sltiu AT, TMP0, 2
727 |.endif
728 | ld PC, -24(RB) // Restore PC from [cont|PC].
729 | cleartp LFUNC:TMP1
730 | daddu TMP2, RA, RD
731 |.if FFI
732 | bnez AT, >1
733 |.endif
734 |. sd TISNIL, -8(TMP2) // Ensure one valid arg.
735 | ld TMP1, LFUNC:TMP1->pc
736 | // BASE = base, RA = resultptr, RB = meta base
737 | jr TMP0 // Jump to continuation.
738 |. ld KBASE, PC2PROTO(k)(TMP1)
739 |
740 |.if FFI
741 |1:
742 | bnez TMP0, ->cont_ffi_callback // cont = 1: return from FFI callback.
743 | // cont = 0: tailcall from C function.
744 |. daddiu TMP1, RB, -32
745 | b ->vm_call_tail
746 |. dsubu RC, TMP1, BASE
747 |.endif
748 |
749 |->cont_cat: // RA = resultptr, RB = meta base
750 | lw INS, -4(PC)
751 | daddiu CARG2, RB, -32
752 | ld CRET1, 0(RA)
753 | decode_RB8a MULTRES, INS
754 | decode_RA8a RA, INS
755 | decode_RB8b MULTRES
756 | decode_RA8b RA
757 | daddu TMP1, BASE, MULTRES
758 | sd BASE, L->base
759 | dsubu CARG3, CARG2, TMP1
760 | bne TMP1, CARG2, ->BC_CAT_Z
761 |. sd CRET1, 0(CARG2)
762 | daddu RA, BASE, RA
763 | b ->cont_nop
764 |. sd CRET1, 0(RA)
765 |
766 |//-- Table indexing metamethods -----------------------------------------
767 |
768 |->vmeta_tgets1:
769 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv)
770 | li TMP0, LJ_TSTR
771 | settp STR:RC, TMP0
772 | b >1
773 |. sd STR:RC, 0(CARG3)
774 |
775 |->vmeta_tgets:
776 | daddiu CARG2, DISPATCH, DISPATCH_GL(tmptv)
777 | li TMP0, LJ_TTAB
778 | li TMP1, LJ_TSTR
779 | settp TAB:RB, TMP0
780 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv2)
781 | sd TAB:RB, 0(CARG2)
782 | settp STR:RC, TMP1
783 | b >1
784 |. sd STR:RC, 0(CARG3)
785 |
786 |->vmeta_tgetb: // TMP0 = index
787 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv)
788 | settp TMP0, TISNUM
789 | sd TMP0, 0(CARG3)
790 |
791 |->vmeta_tgetv:
792 |1:
793 | load_got lj_meta_tget
794 | sd BASE, L->base
795 | sd PC, SAVE_PC
796 | call_intern lj_meta_tget // (lua_State *L, TValue *o, TValue *k)
797 |. move CARG1, L
798 | // Returns TValue * (finished) or NULL (metamethod).
799 | beqz CRET1, >3
800 |. daddiu TMP1, BASE, -FRAME_CONT
801 | ld CARG1, 0(CRET1)
802 | ins_next1
803 | sd CARG1, 0(RA)
804 | ins_next2
805 |
806 |3: // Call __index metamethod.
807 | // BASE = base, L->top = new base, stack = cont/func/t/k
808 | ld BASE, L->top
809 | sd PC, -24(BASE) // [cont|PC]
810 | dsubu PC, BASE, TMP1
811 | ld LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
812 | cleartp LFUNC:RB
813 | b ->vm_call_dispatch_f
814 |. li NARGS8:RC, 16 // 2 args for func(t, k).
815 |
816 |->vmeta_tgetr:
817 | load_got lj_tab_getinth
818 | call_intern lj_tab_getinth // (GCtab *t, int32_t key)
819 |. nop
820 | // Returns cTValue * or NULL.
821 | beqz CRET1, ->BC_TGETR_Z
822 |. move CARG2, TISNIL
823 | b ->BC_TGETR_Z
824 |. ld CARG2, 0(CRET1)
825 |
826 |//-----------------------------------------------------------------------
827 |
828 |->vmeta_tsets1:
829 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv)
830 | li TMP0, LJ_TSTR
831 | settp STR:RC, TMP0
832 | b >1
833 |. sd STR:RC, 0(CARG3)
834 |
835 |->vmeta_tsets:
836 | daddiu CARG2, DISPATCH, DISPATCH_GL(tmptv)
837 | li TMP0, LJ_TTAB
838 | li TMP1, LJ_TSTR
839 | settp TAB:RB, TMP0
840 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv2)
841 | sd TAB:RB, 0(CARG2)
842 | settp STR:RC, TMP1
843 | b >1
844 |. sd STR:RC, 0(CARG3)
845 |
846 |->vmeta_tsetb: // TMP0 = index
847 | daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv)
848 | settp TMP0, TISNUM
849 | sd TMP0, 0(CARG3)
850 |
851 |->vmeta_tsetv:
852 |1:
853 | load_got lj_meta_tset
854 | sd BASE, L->base
855 | sd PC, SAVE_PC
856 | call_intern lj_meta_tset // (lua_State *L, TValue *o, TValue *k)
857 |. move CARG1, L
858 | // Returns TValue * (finished) or NULL (metamethod).
859 | beqz CRET1, >3
860 |. ld CARG1, 0(RA)
861 | // NOBARRIER: lj_meta_tset ensures the table is not black.
862 | ins_next1
863 | sd CARG1, 0(CRET1)
864 | ins_next2
865 |
866 |3: // Call __newindex metamethod.
867 | // BASE = base, L->top = new base, stack = cont/func/t/k/(v)
868 | daddiu TMP1, BASE, -FRAME_CONT
869 | ld BASE, L->top
870 | sd PC, -24(BASE) // [cont|PC]
871 | dsubu PC, BASE, TMP1
872 | ld LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
873 | cleartp LFUNC:RB
874 | sd CARG1, 16(BASE) // Copy value to third argument.
875 | b ->vm_call_dispatch_f
876 |. li NARGS8:RC, 24 // 3 args for func(t, k, v)
877 |
878 |->vmeta_tsetr:
879 | load_got lj_tab_setinth
880 | sd BASE, L->base
881 | sd PC, SAVE_PC
882 | call_intern lj_tab_setinth // (lua_State *L, GCtab *t, int32_t key)
883 |. move CARG1, L
884 | // Returns TValue *.
885 | b ->BC_TSETR_Z
886 |. nop
887 |
888 |//-- Comparison metamethods ---------------------------------------------
889 |
890 |->vmeta_comp:
891 | // RA/RD point to o1/o2.
892 | move CARG2, RA
893 | move CARG3, RD
894 | load_got lj_meta_comp
895 | daddiu PC, PC, -4
896 | sd BASE, L->base
897 | sd PC, SAVE_PC
898 | decode_OP1 CARG4, INS
899 | call_intern lj_meta_comp // (lua_State *L, TValue *o1, *o2, int op)
900 |. move CARG1, L
901 | // Returns 0/1 or TValue * (metamethod).
902 |3:
903 | sltiu AT, CRET1, 2
904 | beqz AT, ->vmeta_binop
905 | negu TMP2, CRET1
906 |4:
907 | lhu RD, OFS_RD(PC)
908 | daddiu PC, PC, 4
909 | lui TMP1, (-(BCBIAS_J*4 >> 16) & 65535)
910 | sll RD, RD, 2
911 | addu RD, RD, TMP1
912 | and RD, RD, TMP2
913 | daddu PC, PC, RD
914 |->cont_nop:
915 | ins_next
916 |
917 |->cont_ra: // RA = resultptr
918 | lbu TMP1, -4+OFS_RA(PC)
919 | ld CRET1, 0(RA)
920 | sll TMP1, TMP1, 3
921 | daddu TMP1, BASE, TMP1
922 | b ->cont_nop
923 |. sd CRET1, 0(TMP1)
924 |
925 |->cont_condt: // RA = resultptr
926 | ld TMP0, 0(RA)
927 | gettp TMP0, TMP0
928 | sltiu AT, TMP0, LJ_TISTRUECOND
929 | b <4
930 |. negu TMP2, AT // Branch if result is true.
931 |
932 |->cont_condf: // RA = resultptr
933 | ld TMP0, 0(RA)
934 | gettp TMP0, TMP0
935 | sltiu AT, TMP0, LJ_TISTRUECOND
936 | b <4
937 |. addiu TMP2, AT, -1 // Branch if result is false.
938 |
939 |->vmeta_equal:
940 | // CARG1/CARG2 point to o1/o2. TMP0 is set to 0/1.
941 | load_got lj_meta_equal
942 | cleartp LFUNC:CARG3, CARG2
943 | cleartp LFUNC:CARG2, CARG1
944 | move CARG4, TMP0
945 | daddiu PC, PC, -4
946 | sd BASE, L->base
947 | sd PC, SAVE_PC
948 | call_intern lj_meta_equal // (lua_State *L, GCobj *o1, *o2, int ne)
949 |. move CARG1, L
950 | // Returns 0/1 or TValue * (metamethod).
951 | b <3
952 |. nop
953 |
954 |->vmeta_equal_cd:
955 |.if FFI
956 | load_got lj_meta_equal_cd
957 | move CARG2, INS
958 | daddiu PC, PC, -4
959 | sd BASE, L->base
960 | sd PC, SAVE_PC
961 | call_intern lj_meta_equal_cd // (lua_State *L, BCIns op)
962 |. move CARG1, L
963 | // Returns 0/1 or TValue * (metamethod).
964 | b <3
965 |. nop
966 |.endif
967 |
968 |->vmeta_istype:
969 | load_got lj_meta_istype
970 | daddiu PC, PC, -4
971 | sd BASE, L->base
972 | srl CARG2, RA, 3
973 | srl CARG3, RD, 3
974 | sd PC, SAVE_PC
975 | call_intern lj_meta_istype // (lua_State *L, BCReg ra, BCReg tp)
976 |. move CARG1, L
977 | b ->cont_nop
978 |. nop
979 |
980 |//-- Arithmetic metamethods ---------------------------------------------
981 |
982 |->vmeta_unm:
983 | move RC, RB
984 |
985 |->vmeta_arith:
986 | load_got lj_meta_arith
987 | sd BASE, L->base
988 | move CARG2, RA
989 | sd PC, SAVE_PC
990 | move CARG3, RB
991 | move CARG4, RC
992 | decode_OP1 CARG5, INS // CARG5 == RB.
993 | call_intern lj_meta_arith // (lua_State *L, TValue *ra,*rb,*rc, BCReg op)
994 |. move CARG1, L
995 | // Returns NULL (finished) or TValue * (metamethod).
996 | beqz CRET1, ->cont_nop
997 |. nop
998 |
999 | // Call metamethod for binary op.
1000 |->vmeta_binop:
1001 | // BASE = old base, CRET1 = new base, stack = cont/func/o1/o2
1002 | dsubu TMP1, CRET1, BASE
1003 | sd PC, -24(CRET1) // [cont|PC]
1004 | move TMP2, BASE
1005 | daddiu PC, TMP1, FRAME_CONT
1006 | move BASE, CRET1
1007 | b ->vm_call_dispatch
1008 |. li NARGS8:RC, 16 // 2 args for func(o1, o2).
1009 |
1010 |->vmeta_len:
1011 | // CARG2 already set by BC_LEN.
1012#if LJ_52
1013 | move MULTRES, CARG1
1014#endif
1015 | load_got lj_meta_len
1016 | sd BASE, L->base
1017 | sd PC, SAVE_PC
1018 | call_intern lj_meta_len // (lua_State *L, TValue *o)
1019 |. move CARG1, L
1020 | // Returns NULL (retry) or TValue * (metamethod base).
1021#if LJ_52
1022 | bnez CRET1, ->vmeta_binop // Binop call for compatibility.
1023 |. nop
1024 | b ->BC_LEN_Z
1025 |. move CARG1, MULTRES
1026#else
1027 | b ->vmeta_binop // Binop call for compatibility.
1028 |. nop
1029#endif
1030 |
1031 |//-- Call metamethod ----------------------------------------------------
1032 |
1033 |->vmeta_call: // Resolve and call __call metamethod.
1034 | // TMP2 = old base, BASE = new base, RC = nargs*8
1035 | load_got lj_meta_call
1036 | sd TMP2, L->base // This is the callers base!
1037 | daddiu CARG2, BASE, -16
1038 | sd PC, SAVE_PC
1039 | daddu CARG3, BASE, RC
1040 | move MULTRES, NARGS8:RC
1041 | call_intern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
1042 |. move CARG1, L
1043 | ld LFUNC:RB, FRAME_FUNC(BASE) // Guaranteed to be a function here.
1044 | daddiu NARGS8:RC, MULTRES, 8 // Got one more argument now.
1045 | cleartp LFUNC:RB
1046 | ins_call
1047 |
1048 |->vmeta_callt: // Resolve __call for BC_CALLT.
1049 | // BASE = old base, RA = new base, RC = nargs*8
1050 | load_got lj_meta_call
1051 | sd BASE, L->base
1052 | daddiu CARG2, RA, -16
1053 | sd PC, SAVE_PC
1054 | daddu CARG3, RA, RC
1055 | move MULTRES, NARGS8:RC
1056 | call_intern lj_meta_call // (lua_State *L, TValue *func, TValue *top)
1057 |. move CARG1, L
1058 | ld RB, FRAME_FUNC(RA) // Guaranteed to be a function here.
1059 | ld TMP1, FRAME_PC(BASE)
1060 | daddiu NARGS8:RC, MULTRES, 8 // Got one more argument now.
1061 | b ->BC_CALLT_Z
1062 |. cleartp LFUNC:CARG3, RB
1063 |
1064 |//-- Argument coercion for 'for' statement ------------------------------
1065 |
1066 |->vmeta_for:
1067 | load_got lj_meta_for
1068 | sd BASE, L->base
1069 | move CARG2, RA
1070 | sd PC, SAVE_PC
1071 | move MULTRES, INS
1072 | call_intern lj_meta_for // (lua_State *L, TValue *base)
1073 |. move CARG1, L
1074 |.if JIT
1075 | decode_OP1 TMP0, MULTRES
1076 | li AT, BC_JFORI
1077 |.endif
1078 | decode_RA8a RA, MULTRES
1079 | decode_RD8a RD, MULTRES
1080 | decode_RA8b RA
1081 |.if JIT
1082 | beq TMP0, AT, =>BC_JFORI
1083 |. decode_RD8b RD
1084 | b =>BC_FORI
1085 |. nop
1086 |.else
1087 | b =>BC_FORI
1088 |. decode_RD8b RD
1089 |.endif
1090 |
1091 |//-----------------------------------------------------------------------
1092 |//-- Fast functions -----------------------------------------------------
1093 |//-----------------------------------------------------------------------
1094 |
1095 |.macro .ffunc, name
1096 |->ff_ .. name:
1097 |.endmacro
1098 |
1099 |.macro .ffunc_1, name
1100 |->ff_ .. name:
1101 | beqz NARGS8:RC, ->fff_fallback
1102 |. ld CARG1, 0(BASE)
1103 |.endmacro
1104 |
1105 |.macro .ffunc_2, name
1106 |->ff_ .. name:
1107 | sltiu AT, NARGS8:RC, 16
1108 | ld CARG1, 0(BASE)
1109 | bnez AT, ->fff_fallback
1110 |. ld CARG2, 8(BASE)
1111 |.endmacro
1112 |
1113 |.macro .ffunc_n, name // Caveat: has delay slot!
1114 |->ff_ .. name:
1115 | ld CARG1, 0(BASE)
1116 | beqz NARGS8:RC, ->fff_fallback
1117 | // Either ldc1 or the 1st instruction of checknum is in the delay slot.
1118 | .FPU ldc1 FARG1, 0(BASE)
1119 | checknum CARG1, ->fff_fallback
1120 |.endmacro
1121 |
1122 |.macro .ffunc_nn, name // Caveat: has delay slot!
1123 |->ff_ .. name:
1124 | ld CARG1, 0(BASE)
1125 | sltiu AT, NARGS8:RC, 16
1126 | ld CARG2, 8(BASE)
1127 | bnez AT, ->fff_fallback
1128 |. gettp TMP0, CARG1
1129 | gettp TMP1, CARG2
1130 | sltiu TMP0, TMP0, LJ_TISNUM
1131 | sltiu TMP1, TMP1, LJ_TISNUM
1132 | .FPU ldc1 FARG1, 0(BASE)
1133 | and TMP0, TMP0, TMP1
1134 | .FPU ldc1 FARG2, 8(BASE)
1135 | beqz TMP0, ->fff_fallback
1136 |.endmacro
1137 |
1138 |// Inlined GC threshold check. Caveat: uses TMP0 and TMP1 and has delay slot!
1139 |// MIPSR6: no delay slot, but a forbidden slot.
1140 |.macro ffgccheck
1141 | ld TMP0, DISPATCH_GL(gc.total)(DISPATCH)
1142 | ld TMP1, DISPATCH_GL(gc.threshold)(DISPATCH)
1143 | dsubu AT, TMP0, TMP1
1144 |.if MIPSR6
1145 | bgezalc AT, ->fff_gcstep
1146 |.else
1147 | bgezal AT, ->fff_gcstep
1148 |.endif
1149 |.endmacro
1150 |
1151 |//-- Base library: checks -----------------------------------------------
1152 |.ffunc_1 assert
1153 | gettp AT, CARG1
1154 | sltiu AT, AT, LJ_TISTRUECOND
1155 | beqz AT, ->fff_fallback
1156 |. daddiu RA, BASE, -16
1157 | ld PC, FRAME_PC(BASE)
1158 | addiu RD, NARGS8:RC, 8 // Compute (nresults+1)*8.
1159 | daddu TMP2, RA, RD
1160 | daddiu TMP1, BASE, 8
1161 | beq BASE, TMP2, ->fff_res // Done if exactly 1 argument.
1162 |. sd CARG1, 0(RA)
1163 |1:
1164 | ld CRET1, 0(TMP1)
1165 | sd CRET1, -16(TMP1)
1166 | bne TMP1, TMP2, <1
1167 |. daddiu TMP1, TMP1, 8
1168 | b ->fff_res
1169 |. nop
1170 |
1171 |.ffunc_1 type
1172 | gettp TMP0, CARG1
1173 | sltu TMP1, TISNUM, TMP0
1174 | not TMP2, TMP0
1175 | li TMP3, ~LJ_TISNUM
1176 |.if MIPSR6
1177 | selnez TMP2, TMP2, TMP1
1178 | seleqz TMP3, TMP3, TMP1
1179 | or TMP2, TMP2, TMP3
1180 |.else
1181 | movz TMP2, TMP3, TMP1
1182 |.endif
1183 | dsll TMP2, TMP2, 3
1184 | daddu TMP2, CFUNC:RB, TMP2
1185 | b ->fff_restv
1186 |. ld CARG1, CFUNC:TMP2->upvalue
1187 |
1188 |//-- Base library: getters and setters ---------------------------------
1189 |
1190 |.ffunc_1 getmetatable
1191 | gettp TMP2, CARG1
1192 | daddiu TMP0, TMP2, -LJ_TTAB
1193 | daddiu TMP1, TMP2, -LJ_TUDATA
1194 |.if MIPSR6
1195 | selnez TMP0, TMP1, TMP0
1196 |.else
1197 | movn TMP0, TMP1, TMP0
1198 |.endif
1199 | bnez TMP0, >6
1200 |. cleartp TAB:CARG1
1201 |1: // Field metatable must be at same offset for GCtab and GCudata!
1202 | ld TAB:RB, TAB:CARG1->metatable
1203 |2:
1204 | ld STR:RC, DISPATCH_GL(gcroot[GCROOT_MMNAME+MM_metatable])(DISPATCH)
1205 | beqz TAB:RB, ->fff_restv
1206 |. li CARG1, LJ_TNIL
1207 | lw TMP0, TAB:RB->hmask
1208 | lw TMP1, STR:RC->sid
1209 | ld NODE:TMP2, TAB:RB->node
1210 | and TMP1, TMP1, TMP0 // idx = str->sid & tab->hmask
1211 | dsll TMP0, TMP1, 5
1212 | dsll TMP1, TMP1, 3
1213 | dsubu TMP1, TMP0, TMP1
1214 | daddu NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
1215 | li CARG4, LJ_TSTR
1216 | settp STR:RC, CARG4 // Tagged key to look for.
1217 |3: // Rearranged logic, because we expect _not_ to find the key.
1218 | ld TMP0, NODE:TMP2->key
1219 | ld CARG1, NODE:TMP2->val
1220 | ld NODE:TMP2, NODE:TMP2->next
1221 | beq RC, TMP0, >5
1222 |. li AT, LJ_TTAB
1223 | bnez NODE:TMP2, <3
1224 |. nop
1225 |4:
1226 | move CARG1, RB
1227 | b ->fff_restv // Not found, keep default result.
1228 |. settp CARG1, AT
1229 |5:
1230 | bne CARG1, TISNIL, ->fff_restv
1231 |. nop
1232 | b <4 // Ditto for nil value.
1233 |. nop
1234 |
1235 |6:
1236 | sltiu AT, TMP2, LJ_TISNUM
1237 |.if MIPSR6
1238 | selnez TMP0, TISNUM, AT
1239 | seleqz AT, TMP2, AT
1240 | or TMP2, TMP0, AT
1241 |.else
1242 | movn TMP2, TISNUM, AT
1243 |.endif
1244 | dsll TMP2, TMP2, 3
1245 | dsubu TMP0, DISPATCH, TMP2
1246 | b <2
1247 |. ld TAB:RB, DISPATCH_GL(gcroot[GCROOT_BASEMT])-8(TMP0)
1248 |
1249 |.ffunc_2 setmetatable
1250 | // Fast path: no mt for table yet and not clearing the mt.
1251 | checktp TMP1, CARG1, -LJ_TTAB, ->fff_fallback
1252 | gettp TMP3, CARG2
1253 | ld TAB:TMP0, TAB:TMP1->metatable
1254 | lbu TMP2, TAB:TMP1->marked
1255 | daddiu AT, TMP3, -LJ_TTAB
1256 | cleartp TAB:CARG2
1257 | or AT, AT, TAB:TMP0
1258 | bnez AT, ->fff_fallback
1259 |. andi AT, TMP2, LJ_GC_BLACK // isblack(table)
1260 | beqz AT, ->fff_restv
1261 |. sd TAB:CARG2, TAB:TMP1->metatable
1262 | barrierback TAB:TMP1, TMP2, TMP0, ->fff_restv
1263 |
1264 |.ffunc rawget
1265 | ld CARG2, 0(BASE)
1266 | sltiu AT, NARGS8:RC, 16
1267 | load_got lj_tab_get
1268 | gettp TMP0, CARG2
1269 | cleartp CARG2
1270 | daddiu TMP0, TMP0, -LJ_TTAB
1271 | or AT, AT, TMP0
1272 | bnez AT, ->fff_fallback
1273 |. daddiu CARG3, BASE, 8
1274 | call_intern lj_tab_get // (lua_State *L, GCtab *t, cTValue *key)
1275 |. move CARG1, L
1276 | b ->fff_restv
1277 |. ld CARG1, 0(CRET1)
1278 |
1279 |//-- Base library: conversions ------------------------------------------
1280 |
1281 |.ffunc tonumber
1282 | // Only handles the number case inline (without a base argument).
1283 | ld CARG1, 0(BASE)
1284 | xori AT, NARGS8:RC, 8 // Exactly one number argument.
1285 | gettp TMP1, CARG1
1286 | sltu TMP0, TISNUM, TMP1
1287 | or AT, AT, TMP0
1288 | bnez AT, ->fff_fallback
1289 |. nop
1290 | b ->fff_restv
1291 |. nop
1292 |
1293 |.ffunc_1 tostring
1294 | // Only handles the string or number case inline.
1295 | gettp TMP0, CARG1
1296 | daddiu AT, TMP0, -LJ_TSTR
1297 | // A __tostring method in the string base metatable is ignored.
1298 | beqz AT, ->fff_restv // String key?
1299 | // Handle numbers inline, unless a number base metatable is present.
1300 |. ld TMP1, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM])(DISPATCH)
1301 | sltu TMP0, TISNUM, TMP0
1302 | or TMP0, TMP0, TMP1
1303 | bnez TMP0, ->fff_fallback
1304 |. sd BASE, L->base // Add frame since C call can throw.
1305 |.if MIPSR6
1306 | sd PC, SAVE_PC // Redundant (but a defined value).
1307 | ffgccheck
1308 |.else
1309 | ffgccheck
1310 |. sd PC, SAVE_PC // Redundant (but a defined value).
1311 |.endif
1312 | load_got lj_strfmt_number
1313 | move CARG1, L
1314 | call_intern lj_strfmt_number // (lua_State *L, cTValue *o)
1315 |. move CARG2, BASE
1316 | // Returns GCstr *.
1317 | li AT, LJ_TSTR
1318 | settp CRET1, AT
1319 | b ->fff_restv
1320 |. move CARG1, CRET1
1321 |
1322 |//-- Base library: iterators -------------------------------------------
1323 |
1324 |.ffunc_1 next
1325 | checktp CARG1, -LJ_TTAB, ->fff_fallback
1326 | daddu TMP2, BASE, NARGS8:RC
1327 | sd TISNIL, 0(TMP2) // Set missing 2nd arg to nil.
1328 | load_got lj_tab_next
1329 | ld PC, FRAME_PC(BASE)
1330 | daddiu CARG2, BASE, 8
1331 | call_intern lj_tab_next // (GCtab *t, cTValue *key, TValue *o)
1332 |. daddiu CARG3, BASE, -16
1333 | // Returns 1=found, 0=end, -1=error.
1334 | daddiu RA, BASE, -16
1335 | bgtz CRET1, ->fff_res // Found key/value.
1336 |. li RD, (2+1)*8
1337 | beqz CRET1, ->fff_restv // End of traversal: return nil.
1338 |. move CARG1, TISNIL
1339 | ld CFUNC:RB, FRAME_FUNC(BASE)
1340 | cleartp CFUNC:RB
1341 | b ->fff_fallback // Invalid key.
1342 |. li RC, 2*8
1343 |
1344 |.ffunc_1 pairs
1345 | checktp TAB:TMP1, CARG1, -LJ_TTAB, ->fff_fallback
1346 | ld PC, FRAME_PC(BASE)
1347#if LJ_52
1348 | ld TAB:TMP2, TAB:TMP1->metatable
1349 | ld TMP0, CFUNC:RB->upvalue[0]
1350 | bnez TAB:TMP2, ->fff_fallback
1351#else
1352 | ld TMP0, CFUNC:RB->upvalue[0]
1353#endif
1354 |. daddiu RA, BASE, -16
1355 | sd TISNIL, 0(BASE)
1356 | sd CARG1, -8(BASE)
1357 | sd TMP0, 0(RA)
1358 | b ->fff_res
1359 |. li RD, (3+1)*8
1360 |
1361 |.ffunc_2 ipairs_aux
1362 | checktab CARG1, ->fff_fallback
1363 | checkint CARG2, ->fff_fallback
1364 |. lw TMP0, TAB:CARG1->asize
1365 | ld TMP1, TAB:CARG1->array
1366 | ld PC, FRAME_PC(BASE)
1367 | sextw TMP2, CARG2
1368 | addiu TMP2, TMP2, 1
1369 | sltu AT, TMP2, TMP0
1370 | daddiu RA, BASE, -16
1371 | zextw TMP0, TMP2
1372 | settp TMP0, TISNUM
1373 | beqz AT, >2 // Not in array part?
1374 |. sd TMP0, 0(RA)
1375 | dsll TMP3, TMP2, 3
1376 | daddu TMP3, TMP1, TMP3
1377 | ld TMP1, 0(TMP3)
1378 |1:
1379 | beq TMP1, TISNIL, ->fff_res // End of iteration, return 0 results.
1380 |. li RD, (0+1)*8
1381 | sd TMP1, -8(BASE)
1382 | b ->fff_res
1383 |. li RD, (2+1)*8
1384 |2: // Check for empty hash part first. Otherwise call C function.
1385 | lw TMP0, TAB:CARG1->hmask
1386 | load_got lj_tab_getinth
1387 | beqz TMP0, ->fff_res
1388 |. li RD, (0+1)*8
1389 | call_intern lj_tab_getinth // (GCtab *t, int32_t key)
1390 |. move CARG2, TMP2
1391 | // Returns cTValue * or NULL.
1392 | beqz CRET1, ->fff_res
1393 |. li RD, (0+1)*8
1394 | b <1
1395 |. ld TMP1, 0(CRET1)
1396 |
1397 |.ffunc_1 ipairs
1398 | checktp TAB:TMP1, CARG1, -LJ_TTAB, ->fff_fallback
1399 | ld PC, FRAME_PC(BASE)
1400#if LJ_52
1401 | ld TAB:TMP2, TAB:TMP1->metatable
1402 | ld CFUNC:TMP0, CFUNC:RB->upvalue[0]
1403 | bnez TAB:TMP2, ->fff_fallback
1404#else
1405 | ld TMP0, CFUNC:RB->upvalue[0]
1406#endif
1407 | daddiu RA, BASE, -16
1408 | dsll AT, TISNUM, 47
1409 | sd CARG1, -8(BASE)
1410 | sd AT, 0(BASE)
1411 | sd CFUNC:TMP0, 0(RA)
1412 | b ->fff_res
1413 |. li RD, (3+1)*8
1414 |
1415 |//-- Base library: catch errors ----------------------------------------
1416 |
1417 |.ffunc pcall
1418 | ld TMP1, L->maxstack
1419 | daddu TMP2, BASE, NARGS8:RC
1420 | sltu AT, TMP1, TMP2
1421 | bnez AT, ->fff_fallback
1422 |. lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
1423 | daddiu NARGS8:TMP0, NARGS8:RC, -8
1424 | bltz NARGS8:TMP0, ->fff_fallback
1425 |. move TMP2, BASE
1426 | move NARGS8:RC, NARGS8:TMP0
1427 | daddiu BASE, BASE, 16
1428 | // Remember active hook before pcall.
1429 | srl TMP3, TMP3, HOOK_ACTIVE_SHIFT
1430 | andi TMP3, TMP3, 1
1431 | daddiu PC, TMP3, 16+FRAME_PCALL
1432 | beqz NARGS8:RC, ->vm_call_dispatch
1433 |1:
1434 |. daddu TMP0, BASE, NARGS8:RC
1435 |2:
1436 | ld TMP1, -16(TMP0)
1437 | sd TMP1, -8(TMP0)
1438 | daddiu TMP0, TMP0, -8
1439 | bne TMP0, BASE, <2
1440 |. nop
1441 | b ->vm_call_dispatch
1442 |. nop
1443 |
1444 |.ffunc xpcall
1445 | ld TMP1, L->maxstack
1446 | daddu TMP2, BASE, NARGS8:RC
1447 | sltu AT, TMP1, TMP2
1448 | bnez AT, ->fff_fallback
1449 |. ld CARG1, 0(BASE)
1450 | daddiu NARGS8:TMP0, NARGS8:RC, -16
1451 | ld CARG2, 8(BASE)
1452 | bltz NARGS8:TMP0, ->fff_fallback
1453 |. lbu TMP1, DISPATCH_GL(hookmask)(DISPATCH)
1454 | gettp AT, CARG2
1455 | daddiu AT, AT, -LJ_TFUNC
1456 | bnez AT, ->fff_fallback // Traceback must be a function.
1457 |. move TMP2, BASE
1458 | move NARGS8:RC, NARGS8:TMP0
1459 | daddiu BASE, BASE, 24
1460 | // Remember active hook before pcall.
1461 | srl TMP3, TMP3, HOOK_ACTIVE_SHIFT
1462 | sd CARG2, 0(TMP2) // Swap function and traceback.
1463 | andi TMP3, TMP3, 1
1464 | sd CARG1, 8(TMP2)
1465 | beqz NARGS8:RC, ->vm_call_dispatch
1466 |. daddiu PC, TMP3, 24+FRAME_PCALL
1467 | b <1
1468 |. nop
1469 |
1470 |//-- Coroutine library --------------------------------------------------
1471 |
1472 |.macro coroutine_resume_wrap, resume
1473 |.if resume
1474 |.ffunc_1 coroutine_resume
1475 | checktp CARG1, CARG1, -LJ_TTHREAD, ->fff_fallback
1476 |.else
1477 |.ffunc coroutine_wrap_aux
1478 | ld L:CARG1, CFUNC:RB->upvalue[0].gcr
1479 | cleartp L:CARG1
1480 |.endif
1481 | lbu TMP0, L:CARG1->status
1482 | ld TMP1, L:CARG1->cframe
1483 | ld CARG2, L:CARG1->top
1484 | ld TMP2, L:CARG1->base
1485 | addiu AT, TMP0, -LUA_YIELD
1486 | daddu CARG3, CARG2, TMP0
1487 | daddiu TMP3, CARG2, 8
1488 |.if MIPSR6
1489 | seleqz CARG2, CARG2, AT
1490 | selnez TMP3, TMP3, AT
1491 | bgtz AT, ->fff_fallback // st > LUA_YIELD?
1492 |. or CARG2, TMP3, CARG2
1493 |.else
1494 | bgtz AT, ->fff_fallback // st > LUA_YIELD?
1495 |. movn CARG2, TMP3, AT
1496 |.endif
1497 | xor TMP2, TMP2, CARG3
1498 | bnez TMP1, ->fff_fallback // cframe != 0?
1499 |. or AT, TMP2, TMP0
1500 | ld TMP0, L:CARG1->maxstack
1501 | beqz AT, ->fff_fallback // base == top && st == 0?
1502 |. ld PC, FRAME_PC(BASE)
1503 | daddu TMP2, CARG2, NARGS8:RC
1504 | sltu AT, TMP0, TMP2
1505 | bnez AT, ->fff_fallback // Stack overflow?
1506 |. sd PC, SAVE_PC
1507 | sd BASE, L->base
1508 |1:
1509 |.if resume
1510 | daddiu BASE, BASE, 8 // Keep resumed thread in stack for GC.
1511 | daddiu NARGS8:RC, NARGS8:RC, -8
1512 | daddiu TMP2, TMP2, -8
1513 |.endif
1514 | sd TMP2, L:CARG1->top
1515 | daddu TMP1, BASE, NARGS8:RC
1516 | move CARG3, CARG2
1517 | sd BASE, L->top
1518 |2: // Move args to coroutine.
1519 | ld CRET1, 0(BASE)
1520 | sltu AT, BASE, TMP1
1521 | beqz AT, >3
1522 |. daddiu BASE, BASE, 8
1523 | sd CRET1, 0(CARG3)
1524 | b <2
1525 |. daddiu CARG3, CARG3, 8
1526 |3:
1527 | bal ->vm_resume // (lua_State *L, TValue *base, 0, 0)
1528 |. move L:RA, L:CARG1
1529 | // Returns thread status.
1530 |4:
1531 | ld TMP2, L:RA->base
1532 | sltiu AT, CRET1, LUA_YIELD+1
1533 | ld TMP3, L:RA->top
1534 | li_vmstate INTERP
1535 | ld BASE, L->base
1536 | sd L, DISPATCH_GL(cur_L)(DISPATCH)
1537 | st_vmstate
1538 | beqz AT, >8
1539 |. dsubu RD, TMP3, TMP2
1540 | ld TMP0, L->maxstack
1541 | beqz RD, >6 // No results?
1542 |. daddu TMP1, BASE, RD
1543 | sltu AT, TMP0, TMP1
1544 | bnez AT, >9 // Need to grow stack?
1545 |. daddu TMP3, TMP2, RD
1546 | sd TMP2, L:RA->top // Clear coroutine stack.
1547 | move TMP1, BASE
1548 |5: // Move results from coroutine.
1549 | ld CRET1, 0(TMP2)
1550 | daddiu TMP2, TMP2, 8
1551 | sltu AT, TMP2, TMP3
1552 | sd CRET1, 0(TMP1)
1553 | bnez AT, <5
1554 |. daddiu TMP1, TMP1, 8
1555 |6:
1556 | andi TMP0, PC, FRAME_TYPE
1557 |.if resume
1558 | mov_true TMP1
1559 | daddiu RA, BASE, -8
1560 | sd TMP1, -8(BASE) // Prepend true to results.
1561 | daddiu RD, RD, 16
1562 |.else
1563 | move RA, BASE
1564 | daddiu RD, RD, 8
1565 |.endif
1566 |7:
1567 | sd PC, SAVE_PC
1568 | beqz TMP0, ->BC_RET_Z
1569 |. move MULTRES, RD
1570 | b ->vm_return
1571 |. nop
1572 |
1573 |8: // Coroutine returned with error (at co->top-1).
1574 |.if resume
1575 | daddiu TMP3, TMP3, -8
1576 | mov_false TMP1
1577 | ld CRET1, 0(TMP3)
1578 | sd TMP3, L:RA->top // Remove error from coroutine stack.
1579 | li RD, (2+1)*8
1580 | sd TMP1, -8(BASE) // Prepend false to results.
1581 | daddiu RA, BASE, -8
1582 | sd CRET1, 0(BASE) // Copy error message.
1583 | b <7
1584 |. andi TMP0, PC, FRAME_TYPE
1585 |.else
1586 | load_got lj_ffh_coroutine_wrap_err
1587 | move CARG2, L:RA
1588 | call_intern lj_ffh_coroutine_wrap_err // (lua_State *L, lua_State *co)
1589 |. move CARG1, L
1590 |.endif
1591 |
1592 |9: // Handle stack expansion on return from yield.
1593 | load_got lj_state_growstack
1594 | srl CARG2, RD, 3
1595 | call_intern lj_state_growstack // (lua_State *L, int n)
1596 |. move CARG1, L
1597 | b <4
1598 |. li CRET1, 0
1599 |.endmacro
1600 |
1601 | coroutine_resume_wrap 1 // coroutine.resume
1602 | coroutine_resume_wrap 0 // coroutine.wrap
1603 |
1604 |.ffunc coroutine_yield
1605 | ld TMP0, L->cframe
1606 | daddu TMP1, BASE, NARGS8:RC
1607 | sd BASE, L->base
1608 | andi TMP0, TMP0, CFRAME_RESUME
1609 | sd TMP1, L->top
1610 | beqz TMP0, ->fff_fallback
1611 |. li CRET1, LUA_YIELD
1612 | sd r0, L->cframe
1613 | b ->vm_leave_unw
1614 |. sb CRET1, L->status
1615 |
1616 |//-- Math library -------------------------------------------------------
1617 |
1618 |.ffunc_1 math_abs
1619 | gettp CARG2, CARG1
1620 | daddiu AT, CARG2, -LJ_TISNUM
1621 | bnez AT, >1
1622 |. sextw TMP1, CARG1
1623 | sra TMP0, TMP1, 31 // Extract sign.
1624 | xor TMP1, TMP1, TMP0
1625 | dsubu CARG1, TMP1, TMP0
1626 | dsll TMP3, CARG1, 32
1627 | bgez TMP3, ->fff_restv
1628 |. settp CARG1, TISNUM
1629 | li CARG1, 0x41e0 // 2^31 as a double.
1630 | b ->fff_restv
1631 |. dsll CARG1, CARG1, 48
1632 |1:
1633 | sltiu AT, CARG2, LJ_TISNUM
1634 | beqz AT, ->fff_fallback
1635 |. dextm CARG1, CARG1, 0, 30
1636 |// fallthrough
1637 |
1638 |->fff_restv:
1639 | // CARG1 = TValue result.
1640 | ld PC, FRAME_PC(BASE)
1641 | daddiu RA, BASE, -16
1642 | sd CARG1, -16(BASE)
1643 |->fff_res1:
1644 | // RA = results, PC = return.
1645 | li RD, (1+1)*8
1646 |->fff_res:
1647 | // RA = results, RD = (nresults+1)*8, PC = return.
1648 | andi TMP0, PC, FRAME_TYPE
1649 | bnez TMP0, ->vm_return
1650 |. move MULTRES, RD
1651 | lw INS, -4(PC)
1652 | decode_RB8a RB, INS
1653 | decode_RB8b RB
1654 |5:
1655 | sltu AT, RD, RB
1656 | bnez AT, >6 // More results expected?
1657 |. decode_RA8a TMP0, INS
1658 | decode_RA8b TMP0
1659 | ins_next1
1660 | // Adjust BASE. KBASE is assumed to be set for the calling frame.
1661 | dsubu BASE, RA, TMP0
1662 | ins_next2
1663 |
1664 |6: // Fill up results with nil.
1665 | daddu TMP1, RA, RD
1666 | daddiu RD, RD, 8
1667 | b <5
1668 |. sd TISNIL, -8(TMP1)
1669 |
1670 |.macro math_extern, func
1671 | .ffunc_n math_ .. func
1672 | load_got func
1673 | call_extern
1674 |. nop
1675 | b ->fff_resn
1676 |. nop
1677 |.endmacro
1678 |
1679 |.macro math_extern2, func
1680 | .ffunc_nn math_ .. func
1681 |. load_got func
1682 | call_extern
1683 |. nop
1684 | b ->fff_resn
1685 |. nop
1686 |.endmacro
1687 |
1688 |// TODO: Return integer type if result is integer (own sf implementation).
1689 |.macro math_round, func
1690 |->ff_math_ .. func:
1691 | ld CARG1, 0(BASE)
1692 | beqz NARGS8:RC, ->fff_fallback
1693 |. gettp TMP0, CARG1
1694 | beq TMP0, TISNUM, ->fff_restv
1695 |. sltu AT, TMP0, TISNUM
1696 | beqz AT, ->fff_fallback
1697 |.if FPU
1698 |. ldc1 FARG1, 0(BASE)
1699 | bal ->vm_ .. func
1700 |. nop
1701 |.else
1702 |. load_got func
1703 | call_extern
1704 |. nop
1705 |.endif
1706 | b ->fff_resn
1707 |. nop
1708 |.endmacro
1709 |
1710 | math_round floor
1711 | math_round ceil
1712 |
1713 |.ffunc math_log
1714 | li AT, 8
1715 | bne NARGS8:RC, AT, ->fff_fallback // Exactly 1 argument.
1716 |. ld CARG1, 0(BASE)
1717 | checknum CARG1, ->fff_fallback
1718 |. load_got log
1719 |.if FPU
1720 | call_extern
1721 |. ldc1 FARG1, 0(BASE)
1722 |.else
1723 | call_extern
1724 |. nop
1725 |.endif
1726 | b ->fff_resn
1727 |. nop
1728 |
1729 | math_extern log10
1730 | math_extern exp
1731 | math_extern sin
1732 | math_extern cos
1733 | math_extern tan
1734 | math_extern asin
1735 | math_extern acos
1736 | math_extern atan
1737 | math_extern sinh
1738 | math_extern cosh
1739 | math_extern tanh
1740 | math_extern2 pow
1741 | math_extern2 atan2
1742 | math_extern2 fmod
1743 |
1744 |.if FPU
1745 |.ffunc_n math_sqrt
1746 |. sqrt.d FRET1, FARG1
1747 |// fallthrough to ->fff_resn
1748 |.else
1749 | math_extern sqrt
1750 |.endif
1751 |
1752 |->fff_resn:
1753 | ld PC, FRAME_PC(BASE)
1754 | daddiu RA, BASE, -16
1755 | b ->fff_res1
1756 |.if FPU
1757 |. sdc1 FRET1, 0(RA)
1758 |.else
1759 |. sd CRET1, 0(RA)
1760 |.endif
1761 |
1762 |
1763 |.ffunc_2 math_ldexp
1764 | checknum CARG1, ->fff_fallback
1765 | checkint CARG2, ->fff_fallback
1766 |. load_got ldexp
1767 | .FPU ldc1 FARG1, 0(BASE)
1768 | call_extern
1769 |. lw CARG2, 8+LO(BASE)
1770 | b ->fff_resn
1771 |. nop
1772 |
1773 |.ffunc_n math_frexp
1774 | load_got frexp
1775 | ld PC, FRAME_PC(BASE)
1776 | call_extern
1777 |. daddiu CARG2, DISPATCH, DISPATCH_GL(tmptv)
1778 | lw TMP1, DISPATCH_GL(tmptv)(DISPATCH)
1779 | daddiu RA, BASE, -16
1780 |.if FPU
1781 | mtc1 TMP1, FARG2
1782 | sdc1 FRET1, 0(RA)
1783 | cvt.d.w FARG2, FARG2
1784 | sdc1 FARG2, 8(RA)
1785 |.else
1786 | sd CRET1, 0(RA)
1787 | zextw TMP1, TMP1
1788 | settp TMP1, TISNUM
1789 | sd TMP1, 8(RA)
1790 |.endif
1791 | b ->fff_res
1792 |. li RD, (2+1)*8
1793 |
1794 |.ffunc_n math_modf
1795 | load_got modf
1796 | ld PC, FRAME_PC(BASE)
1797 | call_extern
1798 |. daddiu CARG2, BASE, -16
1799 | daddiu RA, BASE, -16
1800 |.if FPU
1801 | sdc1 FRET1, -8(BASE)
1802 |.else
1803 | sd CRET1, -8(BASE)
1804 |.endif
1805 | b ->fff_res
1806 |. li RD, (2+1)*8
1807 |
1808 |.macro math_minmax, name, intins, intinsc, fpins
1809 | .ffunc_1 name
1810 | daddu TMP3, BASE, NARGS8:RC
1811 | checkint CARG1, >5
1812 |. daddiu TMP2, BASE, 8
1813 |1: // Handle integers.
1814 | beq TMP2, TMP3, ->fff_restv
1815 |. ld CARG2, 0(TMP2)
1816 | checkint CARG2, >3
1817 |. sextw CARG1, CARG1
1818 | lw CARG2, LO(TMP2)
1819 |. slt AT, CARG1, CARG2
1820 |.if MIPSR6
1821 | intins TMP1, CARG2, AT
1822 | intinsc CARG1, CARG1, AT
1823 | or CARG1, CARG1, TMP1
1824 |.else
1825 | intins CARG1, CARG2, AT
1826 |.endif
1827 | daddiu TMP2, TMP2, 8
1828 | zextw CARG1, CARG1
1829 | b <1
1830 |. settp CARG1, TISNUM
1831 |
1832 |3: // Convert intermediate result to number and continue with number loop.
1833 | checknum CARG2, ->fff_fallback
1834 |.if FPU
1835 |. mtc1 CARG1, FRET1
1836 | cvt.d.w FRET1, FRET1
1837 | b >7
1838 |. ldc1 FARG1, 0(TMP2)
1839 |.else
1840 |. nop
1841 | bal ->vm_sfi2d_1
1842 |. nop
1843 | b >7
1844 |. nop
1845 |.endif
1846 |
1847 |5:
1848 | .FPU ldc1 FRET1, 0(BASE)
1849 | checknum CARG1, ->fff_fallback
1850 |6: // Handle numbers.
1851 |. ld CARG2, 0(TMP2)
1852 | beq TMP2, TMP3, ->fff_resn
1853 |.if FPU
1854 | ldc1 FARG1, 0(TMP2)
1855 |.else
1856 | move CRET1, CARG1
1857 |.endif
1858 | checknum CARG2, >8
1859 |. nop
1860 |7:
1861 |.if FPU
1862 |.if MIPSR6
1863 | fpins FRET1, FRET1, FARG1
1864 |.else
1865 |.if fpins // ismax
1866 | c.olt.d FARG1, FRET1
1867 |.else
1868 | c.olt.d FRET1, FARG1
1869 |.endif
1870 | movf.d FRET1, FARG1
1871 |.endif
1872 |.else
1873 |.if fpins // ismax
1874 | bal ->vm_sfcmpogt
1875 |.else
1876 | bal ->vm_sfcmpolt
1877 |.endif
1878 |. nop
1879 |.if MIPSR6
1880 | seleqz AT, CARG2, CRET1
1881 | selnez CARG1, CARG1, CRET1
1882 | or CARG1, CARG1, AT
1883 |.else
1884 | movz CARG1, CARG2, CRET1
1885 |.endif
1886 |.endif
1887 | b <6
1888 |. daddiu TMP2, TMP2, 8
1889 |
1890 |8: // Convert integer to number and continue with number loop.
1891 | checkint CARG2, ->fff_fallback
1892 |.if FPU
1893 |. lwc1 FARG1, LO(TMP2)
1894 | b <7
1895 |. cvt.d.w FARG1, FARG1
1896 |.else
1897 |. lw CARG2, LO(TMP2)
1898 | bal ->vm_sfi2d_2
1899 |. nop
1900 | b <7
1901 |. nop
1902 |.endif
1903 |
1904 |.endmacro
1905 |
1906 |.if MIPSR6
1907 | math_minmax math_min, seleqz, selnez, min.d
1908 | math_minmax math_max, selnez, seleqz, max.d
1909 |.else
1910 | math_minmax math_min, movz, _, 0
1911 | math_minmax math_max, movn, _, 1
1912 |.endif
1913 |
1914 |//-- String library -----------------------------------------------------
1915 |
1916 |.ffunc string_byte // Only handle the 1-arg case here.
1917 | ld CARG1, 0(BASE)
1918 | gettp TMP0, CARG1
1919 | xori AT, NARGS8:RC, 8
1920 | daddiu TMP0, TMP0, -LJ_TSTR
1921 | or AT, AT, TMP0
1922 | bnez AT, ->fff_fallback // Need exactly 1 string argument.
1923 |. cleartp STR:CARG1
1924 | lw TMP0, STR:CARG1->len
1925 | daddiu RA, BASE, -16
1926 | ld PC, FRAME_PC(BASE)
1927 | sltu RD, r0, TMP0
1928 | lbu TMP1, STR:CARG1[1] // Access is always ok (NUL at end).
1929 | addiu RD, RD, 1
1930 | sll RD, RD, 3 // RD = ((str->len != 0)+1)*8
1931 | settp TMP1, TISNUM
1932 | b ->fff_res
1933 |. sd TMP1, 0(RA)
1934 |
1935 |.ffunc string_char // Only handle the 1-arg case here.
1936 | ffgccheck
1937 |.if not MIPSR6
1938 |. nop
1939 |.endif
1940 | ld CARG1, 0(BASE)
1941 | gettp TMP0, CARG1
1942 | xori AT, NARGS8:RC, 8 // Exactly 1 argument.
1943 | daddiu TMP0, TMP0, -LJ_TISNUM // Integer.
1944 | li TMP1, 255
1945 | sextw CARG1, CARG1
1946 | or AT, AT, TMP0
1947 | sltu TMP1, TMP1, CARG1 // !(255 < n).
1948 | or AT, AT, TMP1
1949 | bnez AT, ->fff_fallback
1950 |. li CARG3, 1
1951 | daddiu CARG2, sp, TMPD_OFS
1952 | sb CARG1, TMPD
1953 |->fff_newstr:
1954 | load_got lj_str_new
1955 | sd BASE, L->base
1956 | sd PC, SAVE_PC
1957 | call_intern lj_str_new // (lua_State *L, char *str, size_t l)
1958 |. move CARG1, L
1959 | // Returns GCstr *.
1960 | ld BASE, L->base
1961 |->fff_resstr:
1962 | li AT, LJ_TSTR
1963 | settp CRET1, AT
1964 | b ->fff_restv
1965 |. move CARG1, CRET1
1966 |
1967 |.ffunc string_sub
1968 | ffgccheck
1969 |.if not MIPSR6
1970 |. nop
1971 |.endif
1972 | addiu AT, NARGS8:RC, -16
1973 | ld TMP0, 0(BASE)
1974 | bltz AT, ->fff_fallback
1975 |. gettp TMP3, TMP0
1976 | cleartp STR:CARG1, TMP0
1977 | ld CARG2, 8(BASE)
1978 | beqz AT, >1
1979 |. li CARG4, -1
1980 | ld CARG3, 16(BASE)
1981 | checkint CARG3, ->fff_fallback
1982 |. sextw CARG4, CARG3
1983 |1:
1984 | checkint CARG2, ->fff_fallback
1985 |. li AT, LJ_TSTR
1986 | bne TMP3, AT, ->fff_fallback
1987 |. sextw CARG3, CARG2
1988 | lw CARG2, STR:CARG1->len
1989 | // STR:CARG1 = str, CARG2 = str->len, CARG3 = start, CARG4 = end
1990 | slt AT, CARG4, r0
1991 | addiu TMP0, CARG2, 1
1992 | addu TMP1, CARG4, TMP0
1993 | slt TMP3, CARG3, r0
1994 |.if MIPSR6
1995 | seleqz CARG4, CARG4, AT
1996 | selnez TMP1, TMP1, AT
1997 | or CARG4, TMP1, CARG4 // if (end < 0) end += len+1
1998 |.else
1999 | movn CARG4, TMP1, AT // if (end < 0) end += len+1
2000 |.endif
2001 | addu TMP1, CARG3, TMP0
2002 |.if MIPSR6
2003 | selnez TMP1, TMP1, TMP3
2004 | seleqz CARG3, CARG3, TMP3
2005 | or CARG3, TMP1, CARG3 // if (start < 0) start += len+1
2006 | li TMP2, 1
2007 | slt AT, CARG4, r0
2008 | slt TMP3, r0, CARG3
2009 | seleqz CARG4, CARG4, AT // if (end < 0) end = 0
2010 | selnez CARG3, CARG3, TMP3
2011 | seleqz TMP2, TMP2, TMP3
2012 | or CARG3, TMP2, CARG3 // if (start < 1) start = 1
2013 | slt AT, CARG2, CARG4
2014 | seleqz CARG4, CARG4, AT
2015 | selnez CARG2, CARG2, AT
2016 | or CARG4, CARG2, CARG4 // if (end > len) end = len
2017 |.else
2018 | movn CARG3, TMP1, TMP3 // if (start < 0) start += len+1
2019 | li TMP2, 1
2020 | slt AT, CARG4, r0
2021 | slt TMP3, r0, CARG3
2022 | movn CARG4, r0, AT // if (end < 0) end = 0
2023 | movz CARG3, TMP2, TMP3 // if (start < 1) start = 1
2024 | slt AT, CARG2, CARG4
2025 | movn CARG4, CARG2, AT // if (end > len) end = len
2026 |.endif
2027 | daddu CARG2, STR:CARG1, CARG3
2028 | subu CARG3, CARG4, CARG3 // len = end - start
2029 | daddiu CARG2, CARG2, sizeof(GCstr)-1
2030 | bgez CARG3, ->fff_newstr
2031 |. addiu CARG3, CARG3, 1 // len++
2032 |->fff_emptystr: // Return empty string.
2033 | li AT, LJ_TSTR
2034 | daddiu STR:CARG1, DISPATCH, DISPATCH_GL(strempty)
2035 | b ->fff_restv
2036 |. settp CARG1, AT
2037 |
2038 |.macro ffstring_op, name
2039 | .ffunc string_ .. name
2040 | ffgccheck
2041 |. nop
2042 | beqz NARGS8:RC, ->fff_fallback
2043 |. ld CARG2, 0(BASE)
2044 | checkstr STR:CARG2, ->fff_fallback
2045 | daddiu SBUF:CARG1, DISPATCH, DISPATCH_GL(tmpbuf)
2046 | load_got lj_buf_putstr_ .. name
2047 | ld TMP0, SBUF:CARG1->b
2048 | sd L, SBUF:CARG1->L
2049 | sd BASE, L->base
2050 | sd TMP0, SBUF:CARG1->w
2051 | call_intern extern lj_buf_putstr_ .. name
2052 |. sd PC, SAVE_PC
2053 | load_got lj_buf_tostr
2054 | call_intern lj_buf_tostr
2055 |. move SBUF:CARG1, SBUF:CRET1
2056 | b ->fff_resstr
2057 |. ld BASE, L->base
2058 |.endmacro
2059 |
2060 |ffstring_op reverse
2061 |ffstring_op lower
2062 |ffstring_op upper
2063 |
2064 |//-- Bit library --------------------------------------------------------
2065 |
2066 |->vm_tobit_fb:
2067 | beqz TMP1, ->fff_fallback
2068 |.if FPU
2069 |. ldc1 FARG1, 0(BASE)
2070 | add.d FARG1, FARG1, TOBIT
2071 | mfc1 CRET1, FARG1
2072 | jr ra
2073 |. zextw CRET1, CRET1
2074 |.else
2075 |// FP number to bit conversion for soft-float.
2076 |->vm_tobit:
2077 | dsll TMP0, CARG1, 1
2078 | li CARG3, 1076
2079 | dsrl AT, TMP0, 53
2080 | dsubu CARG3, CARG3, AT
2081 | sltiu AT, CARG3, 54
2082 | beqz AT, >1
2083 |. dextm TMP0, TMP0, 0, 20
2084 | dinsu TMP0, AT, 21, 21
2085 | slt AT, CARG1, r0
2086 | dsrlv CRET1, TMP0, CARG3
2087 | dsubu TMP0, r0, CRET1
2088 |.if MIPSR6
2089 | selnez TMP0, TMP0, AT
2090 | seleqz CRET1, CRET1, AT
2091 | or CRET1, CRET1, TMP0
2092 |.else
2093 | movn CRET1, TMP0, AT
2094 |.endif
2095 | jr ra
2096 |. zextw CRET1, CRET1
2097 |1:
2098 | jr ra
2099 |. move CRET1, r0
2100 |
2101 |// FP number to int conversion with a check for soft-float.
2102 |// Modifies CARG1, CRET1, CRET2, TMP0, AT.
2103 |->vm_tointg:
2104 |.if JIT
2105 | dsll CRET2, CARG1, 1
2106 | beqz CRET2, >2
2107 |. li TMP0, 1076
2108 | dsrl AT, CRET2, 53
2109 | dsubu TMP0, TMP0, AT
2110 | sltiu AT, TMP0, 54
2111 | beqz AT, >1
2112 |. dextm CRET2, CRET2, 0, 20
2113 | dinsu CRET2, AT, 21, 21
2114 | slt AT, CARG1, r0
2115 | dsrlv CRET1, CRET2, TMP0
2116 | negu CARG1, CRET1
2117 |.if MIPSR6
2118 | seleqz CRET1, CRET1, AT
2119 | selnez CARG1, CARG1, AT
2120 | or CRET1, CRET1, CARG1
2121 |.else
2122 | movn CRET1, CARG1, AT
2123 |.endif
2124 | negu TMP0, TMP0
2125 | dsllv CRET2, CRET2, TMP0 // Integer check.
2126 | sextw AT, CRET1
2127 | xor AT, CRET1, AT // Range check.
2128 | jr ra
2129 |. or CRET2, AT, CRET2
2130 |1:
2131 | jr ra
2132 |. li CRET2, 1
2133 |2:
2134 | jr ra
2135 |. move CRET1, r0
2136 |.endif
2137 |.endif
2138 |
2139 |.macro .ffunc_bit, name
2140 | .ffunc_1 bit_..name
2141 | gettp TMP0, CARG1
2142 | beq TMP0, TISNUM, >6
2143 |. zextw CRET1, CARG1
2144 | bal ->vm_tobit_fb
2145 |. sltiu TMP1, TMP0, LJ_TISNUM
2146 |6:
2147 |.endmacro
2148 |
2149 |.macro .ffunc_bit_op, name, bins
2150 | .ffunc_bit name
2151 | daddiu TMP2, BASE, 8
2152 | daddu TMP3, BASE, NARGS8:RC
2153 |1:
2154 | beq TMP2, TMP3, ->fff_resi
2155 |. ld CARG1, 0(TMP2)
2156 | gettp TMP0, CARG1
2157 |.if FPU
2158 | bne TMP0, TISNUM, >2
2159 |. daddiu TMP2, TMP2, 8
2160 | zextw CARG1, CARG1
2161 | b <1
2162 |. bins CRET1, CRET1, CARG1
2163 |2:
2164 | ldc1 FARG1, -8(TMP2)
2165 | sltiu AT, TMP0, LJ_TISNUM
2166 | beqz AT, ->fff_fallback
2167 |. add.d FARG1, FARG1, TOBIT
2168 | mfc1 CARG1, FARG1
2169 | zextw CARG1, CARG1
2170 | b <1
2171 |. bins CRET1, CRET1, CARG1
2172 |.else
2173 | beq TMP0, TISNUM, >2
2174 |. move CRET2, CRET1
2175 | bal ->vm_tobit_fb
2176 |. sltiu TMP1, TMP0, LJ_TISNUM
2177 | move CARG1, CRET2
2178 |2:
2179 | zextw CARG1, CARG1
2180 | bins CRET1, CRET1, CARG1
2181 | b <1
2182 |. daddiu TMP2, TMP2, 8
2183 |.endif
2184 |.endmacro
2185 |
2186 |.ffunc_bit_op band, and
2187 |.ffunc_bit_op bor, or
2188 |.ffunc_bit_op bxor, xor
2189 |
2190 |.ffunc_bit bswap
2191 | dsrl TMP0, CRET1, 8
2192 | dsrl TMP1, CRET1, 24
2193 | andi TMP2, TMP0, 0xff00
2194 | dins TMP1, CRET1, 24, 31
2195 | dins TMP2, TMP0, 16, 23
2196 | b ->fff_resi
2197 |. or CRET1, TMP1, TMP2
2198 |
2199 |.ffunc_bit bnot
2200 | not CRET1, CRET1
2201 | b ->fff_resi
2202 |. zextw CRET1, CRET1
2203 |
2204 |.macro .ffunc_bit_sh, name, shins, shmod
2205 | .ffunc_2 bit_..name
2206 | gettp TMP0, CARG1
2207 | beq TMP0, TISNUM, >1
2208 |. nop
2209 | bal ->vm_tobit_fb
2210 |. sltiu TMP1, TMP0, LJ_TISNUM
2211 | move CARG1, CRET1
2212 |1:
2213 | gettp TMP0, CARG2
2214 | bne TMP0, TISNUM, ->fff_fallback
2215 |. zextw CARG2, CARG2
2216 | sextw CARG1, CARG1
2217 |.if shmod == 1
2218 | negu CARG2, CARG2
2219 |.endif
2220 | shins CRET1, CARG1, CARG2
2221 | b ->fff_resi
2222 |. zextw CRET1, CRET1
2223 |.endmacro
2224 |
2225 |.ffunc_bit_sh lshift, sllv, 0
2226 |.ffunc_bit_sh rshift, srlv, 0
2227 |.ffunc_bit_sh arshift, srav, 0
2228 |.ffunc_bit_sh rol, rotrv, 1
2229 |.ffunc_bit_sh ror, rotrv, 0
2230 |
2231 |.ffunc_bit tobit
2232 |->fff_resi:
2233 | ld PC, FRAME_PC(BASE)
2234 | daddiu RA, BASE, -16
2235 | settp CRET1, TISNUM
2236 | b ->fff_res1
2237 |. sd CRET1, -16(BASE)
2238 |
2239 |//-----------------------------------------------------------------------
2240 |->fff_fallback: // Call fast function fallback handler.
2241 | // BASE = new base, RB = CFUNC, RC = nargs*8
2242 | ld TMP3, CFUNC:RB->f
2243 | daddu TMP1, BASE, NARGS8:RC
2244 | ld PC, FRAME_PC(BASE) // Fallback may overwrite PC.
2245 | daddiu TMP0, TMP1, 8*LUA_MINSTACK
2246 | ld TMP2, L->maxstack
2247 | sd PC, SAVE_PC // Redundant (but a defined value).
2248 | sltu AT, TMP2, TMP0
2249 | sd BASE, L->base
2250 | sd TMP1, L->top
2251 | bnez AT, >5 // Need to grow stack.
2252 |. move CFUNCADDR, TMP3
2253 | jalr TMP3 // (lua_State *L)
2254 |. move CARG1, L
2255 | // Either throws an error, or recovers and returns -1, 0 or nresults+1.
2256 | ld BASE, L->base
2257 | sll RD, CRET1, 3
2258 | bgtz CRET1, ->fff_res // Returned nresults+1?
2259 |. daddiu RA, BASE, -16
2260 |1: // Returned 0 or -1: retry fast path.
2261 | ld LFUNC:RB, FRAME_FUNC(BASE)
2262 | ld TMP0, L->top
2263 | cleartp LFUNC:RB
2264 | bnez CRET1, ->vm_call_tail // Returned -1?
2265 |. dsubu NARGS8:RC, TMP0, BASE
2266 | ins_callt // Returned 0: retry fast path.
2267 |
2268 |// Reconstruct previous base for vmeta_call during tailcall.
2269 |->vm_call_tail:
2270 | andi TMP0, PC, FRAME_TYPE
2271 | li AT, -4
2272 | bnez TMP0, >3
2273 |. and TMP1, PC, AT
2274 | lbu TMP1, OFS_RA(PC)
2275 | sll TMP1, TMP1, 3
2276 | addiu TMP1, TMP1, 16
2277 |3:
2278 | b ->vm_call_dispatch // Resolve again for tailcall.
2279 |. dsubu TMP2, BASE, TMP1
2280 |
2281 |5: // Grow stack for fallback handler.
2282 | load_got lj_state_growstack
2283 | li CARG2, LUA_MINSTACK
2284 | call_intern lj_state_growstack // (lua_State *L, int n)
2285 |. move CARG1, L
2286 | ld BASE, L->base
2287 | b <1
2288 |. li CRET1, 0 // Force retry.
2289 |
2290 |->fff_gcstep: // Call GC step function.
2291 | // BASE = new base, RC = nargs*8
2292 | move MULTRES, ra
2293 | load_got lj_gc_step
2294 | sd BASE, L->base
2295 | daddu TMP0, BASE, NARGS8:RC
2296 | sd PC, SAVE_PC // Redundant (but a defined value).
2297 | sd TMP0, L->top
2298 | call_intern lj_gc_step // (lua_State *L)
2299 |. move CARG1, L
2300 | ld BASE, L->base
2301 | move ra, MULTRES
2302 | ld TMP0, L->top
2303 | ld CFUNC:RB, FRAME_FUNC(BASE)
2304 | cleartp CFUNC:RB
2305 | jr ra
2306 |. dsubu NARGS8:RC, TMP0, BASE
2307 |
2308 |//-----------------------------------------------------------------------
2309 |//-- Special dispatch targets -------------------------------------------
2310 |//-----------------------------------------------------------------------
2311 |
2312 |->vm_record: // Dispatch target for recording phase.
2313 |.if JIT
2314 | lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
2315 | andi AT, TMP3, HOOK_VMEVENT // No recording while in vmevent.
2316 | bnez AT, >5
2317 | // Decrement the hookcount for consistency, but always do the call.
2318 |. lw TMP2, DISPATCH_GL(hookcount)(DISPATCH)
2319 | andi AT, TMP3, HOOK_ACTIVE
2320 | bnez AT, >1
2321 |. addiu TMP2, TMP2, -1
2322 | andi AT, TMP3, LUA_MASKLINE|LUA_MASKCOUNT
2323 | beqz AT, >1
2324 |. nop
2325 | b >1
2326 |. sw TMP2, DISPATCH_GL(hookcount)(DISPATCH)
2327 |.endif
2328 |
2329 |->vm_rethook: // Dispatch target for return hooks.
2330 | lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
2331 | andi AT, TMP3, HOOK_ACTIVE // Hook already active?
2332 | beqz AT, >1
2333 |5: // Re-dispatch to static ins.
2334 |. ld AT, GG_DISP2STATIC(TMP0) // Assumes TMP0 holds DISPATCH+OP*4.
2335 | jr AT
2336 |. nop
2337 |
2338 |->vm_inshook: // Dispatch target for instr/line hooks.
2339 | lbu TMP3, DISPATCH_GL(hookmask)(DISPATCH)
2340 | lw TMP2, DISPATCH_GL(hookcount)(DISPATCH)
2341 | andi AT, TMP3, HOOK_ACTIVE // Hook already active?
2342 | bnez AT, <5
2343 |. andi AT, TMP3, LUA_MASKLINE|LUA_MASKCOUNT
2344 | beqz AT, <5
2345 |. addiu TMP2, TMP2, -1
2346 | beqz TMP2, >1
2347 |. sw TMP2, DISPATCH_GL(hookcount)(DISPATCH)
2348 | andi AT, TMP3, LUA_MASKLINE
2349 | beqz AT, <5
2350 |1:
2351 |. load_got lj_dispatch_ins
2352 | sw MULTRES, SAVE_MULTRES
2353 | move CARG2, PC
2354 | sd BASE, L->base
2355 | // SAVE_PC must hold the _previous_ PC. The callee updates it with PC.
2356 | call_intern lj_dispatch_ins // (lua_State *L, const BCIns *pc)
2357 |. move CARG1, L
2358 |3:
2359 | ld BASE, L->base
2360 |4: // Re-dispatch to static ins.
2361 | lw INS, -4(PC)
2362 | decode_OP8a TMP1, INS
2363 | decode_OP8b TMP1
2364 | daddu TMP0, DISPATCH, TMP1
2365 | decode_RD8a RD, INS
2366 | ld AT, GG_DISP2STATIC(TMP0)
2367 | decode_RA8a RA, INS
2368 | decode_RD8b RD
2369 | jr AT
2370 | decode_RA8b RA
2371 |
2372 |->cont_hook: // Continue from hook yield.
2373 | daddiu PC, PC, 4
2374 | b <4
2375 |. lw MULTRES, -24+LO(RB) // Restore MULTRES for *M ins.
2376 |
2377 |->vm_hotloop: // Hot loop counter underflow.
2378 |.if JIT
2379 | ld LFUNC:TMP1, FRAME_FUNC(BASE)
2380 | daddiu CARG1, DISPATCH, GG_DISP2J
2381 | cleartp LFUNC:TMP1
2382 | sd PC, SAVE_PC
2383 | ld TMP1, LFUNC:TMP1->pc
2384 | move CARG2, PC
2385 | sd L, DISPATCH_J(L)(DISPATCH)
2386 | lbu TMP1, PC2PROTO(framesize)(TMP1)
2387 | load_got lj_trace_hot
2388 | sd BASE, L->base
2389 | dsll TMP1, TMP1, 3
2390 | daddu TMP1, BASE, TMP1
2391 | call_intern lj_trace_hot // (jit_State *J, const BCIns *pc)
2392 |. sd TMP1, L->top
2393 | b <3
2394 |. nop
2395 |.endif
2396 |
2397 |
2398 |->vm_callhook: // Dispatch target for call hooks.
2399 |.if JIT
2400 | b >1
2401 |.endif
2402 |. move CARG2, PC
2403 |
2404 |->vm_hotcall: // Hot call counter underflow.
2405 |.if JIT
2406 | ori CARG2, PC, 1
2407 |1:
2408 |.endif
2409 | load_got lj_dispatch_call
2410 | daddu TMP0, BASE, RC
2411 | sd PC, SAVE_PC
2412 | sd BASE, L->base
2413 | dsubu RA, RA, BASE
2414 | sd TMP0, L->top
2415 | call_intern lj_dispatch_call // (lua_State *L, const BCIns *pc)
2416 |. move CARG1, L
2417 | // Returns ASMFunction.
2418 | ld BASE, L->base
2419 | ld TMP0, L->top
2420 | sd r0, SAVE_PC // Invalidate for subsequent line hook.
2421 | dsubu NARGS8:RC, TMP0, BASE
2422 | daddu RA, BASE, RA
2423 | ld LFUNC:RB, FRAME_FUNC(BASE)
2424 | cleartp LFUNC:RB
2425 | jr CRET1
2426 |. lw INS, -4(PC)
2427 |
2428 |->cont_stitch: // Trace stitching.
2429 |.if JIT
2430 | // RA = resultptr, RB = meta base
2431 | lw INS, -4(PC)
2432 | ld TRACE:TMP2, -40(RB) // Save previous trace.
2433 | decode_RA8a RC, INS
2434 | daddiu AT, MULTRES, -8
2435 | cleartp TRACE:TMP2
2436 | decode_RA8b RC
2437 | beqz AT, >2
2438 |. daddu RC, BASE, RC // Call base.
2439 |1: // Move results down.
2440 | ld CARG1, 0(RA)
2441 | daddiu AT, AT, -8
2442 | daddiu RA, RA, 8
2443 | sd CARG1, 0(RC)
2444 | bnez AT, <1
2445 |. daddiu RC, RC, 8
2446 |2:
2447 | decode_RA8a RA, INS
2448 | decode_RB8a RB, INS
2449 | decode_RA8b RA
2450 | decode_RB8b RB
2451 | daddu RA, RA, RB
2452 | daddu RA, BASE, RA
2453 |3:
2454 | sltu AT, RC, RA
2455 | bnez AT, >9 // More results wanted?
2456 |. nop
2457 |
2458 | lhu TMP3, TRACE:TMP2->traceno
2459 | lhu RD, TRACE:TMP2->link
2460 | beq RD, TMP3, ->cont_nop // Blacklisted.
2461 |. load_got lj_dispatch_stitch
2462 | bnez RD, =>BC_JLOOP // Jump to stitched trace.
2463 |. sll RD, RD, 3
2464 |
2465 | // Stitch a new trace to the previous trace.
2466 | sw TMP3, DISPATCH_J(exitno)(DISPATCH)
2467 | sd L, DISPATCH_J(L)(DISPATCH)
2468 | sd BASE, L->base
2469 | daddiu CARG1, DISPATCH, GG_DISP2J
2470 | call_intern lj_dispatch_stitch // (jit_State *J, const BCIns *pc)
2471 |. move CARG2, PC
2472 | b ->cont_nop
2473 |. ld BASE, L->base
2474 |
2475 |9:
2476 | sd TISNIL, 0(RC)
2477 | b <3
2478 |. daddiu RC, RC, 8
2479 |.endif
2480 |
2481 |->vm_profhook: // Dispatch target for profiler hook.
2482#if LJ_HASPROFILE
2483 | load_got lj_dispatch_profile
2484 | sw MULTRES, SAVE_MULTRES
2485 | move CARG2, PC
2486 | sd BASE, L->base
2487 | call_intern lj_dispatch_profile // (lua_State *L, const BCIns *pc)
2488 |. move CARG1, L
2489 | // HOOK_PROFILE is off again, so re-dispatch to dynamic instruction.
2490 | daddiu PC, PC, -4
2491 | b ->cont_nop
2492 |. ld BASE, L->base
2493#endif
2494 |
2495 |//-----------------------------------------------------------------------
2496 |//-- Trace exit handler -------------------------------------------------
2497 |//-----------------------------------------------------------------------
2498 |
2499 |.macro savex_, a, b
2500 |.if FPU
2501 | sdc1 f..a, a*8(sp)
2502 | sdc1 f..b, b*8(sp)
2503 | sd r..a, 32*8+a*8(sp)
2504 | sd r..b, 32*8+b*8(sp)
2505 |.else
2506 | sd r..a, a*8(sp)
2507 | sd r..b, b*8(sp)
2508 |.endif
2509 |.endmacro
2510 |
2511 |->vm_exit_handler:
2512 |.if JIT
2513 |.if FPU
2514 | daddiu sp, sp, -(32*8+32*8)
2515 |.else
2516 | daddiu sp, sp, -(32*8)
2517 |.endif
2518 | savex_ 0, 1
2519 | savex_ 2, 3
2520 | savex_ 4, 5
2521 | savex_ 6, 7
2522 | savex_ 8, 9
2523 | savex_ 10, 11
2524 | savex_ 12, 13
2525 | savex_ 14, 15
2526 | savex_ 16, 17
2527 | savex_ 18, 19
2528 | savex_ 20, 21
2529 | savex_ 22, 23
2530 | savex_ 24, 25
2531 | savex_ 26, 27
2532 | savex_ 28, 30
2533 |.if FPU
2534 | sdc1 f29, 29*8(sp)
2535 | sdc1 f31, 31*8(sp)
2536 | sd r0, 32*8+31*8(sp) // Clear RID_TMP.
2537 | daddiu TMP2, sp, 32*8+32*8 // Recompute original value of sp.
2538 | sd TMP2, 32*8+29*8(sp) // Store sp in RID_SP
2539 |.else
2540 | sd r0, 31*8(sp) // Clear RID_TMP.
2541 | daddiu TMP2, sp, 32*8 // Recompute original value of sp.
2542 | sd TMP2, 29*8(sp) // Store sp in RID_SP
2543 |.endif
2544 | li_vmstate EXIT
2545 | daddiu DISPATCH, JGL, -GG_DISP2G-32768
2546 | lw TMP1, 0(TMP2) // Load exit number.
2547 | st_vmstate
2548 | ld L, DISPATCH_GL(cur_L)(DISPATCH)
2549 | ld BASE, DISPATCH_GL(jit_base)(DISPATCH)
2550 | load_got lj_trace_exit
2551 | sd L, DISPATCH_J(L)(DISPATCH)
2552 | sw ra, DISPATCH_J(parent)(DISPATCH) // Store trace number.
2553 | sd BASE, L->base
2554 | sw TMP1, DISPATCH_J(exitno)(DISPATCH) // Store exit number.
2555 | daddiu CARG1, DISPATCH, GG_DISP2J
2556 | sd r0, DISPATCH_GL(jit_base)(DISPATCH)
2557 | call_intern lj_trace_exit // (jit_State *J, ExitState *ex)
2558 |. move CARG2, sp
2559 | // Returns MULTRES (unscaled) or negated error code.
2560 | ld TMP1, L->cframe
2561 | li AT, -4
2562 | ld BASE, L->base
2563 | and sp, TMP1, AT
2564 | ld PC, SAVE_PC // Get SAVE_PC.
2565 | b >1
2566 |. sd L, SAVE_L // Set SAVE_L (on-trace resume/yield).
2567 |.endif
2568 |->vm_exit_interp:
2569 |.if JIT
2570 | // CRET1 = MULTRES or negated error code, BASE, PC and JGL set.
2571 | ld L, SAVE_L
2572 | daddiu DISPATCH, JGL, -GG_DISP2G-32768
2573 | sd BASE, L->base
2574 |1:
2575 | sltiu TMP0, CRET1, -LUA_ERRERR // Check for error from exit.
2576 | beqz TMP0, >9
2577 |. ld LFUNC:RB, FRAME_FUNC(BASE)
2578 | .FPU lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
2579 | dsll MULTRES, CRET1, 3
2580 | cleartp LFUNC:RB
2581 | sw MULTRES, SAVE_MULTRES
2582 | li TISNIL, LJ_TNIL
2583 | li TISNUM, LJ_TISNUM // Setup type comparison constants.
2584 | .FPU mtc1 TMP3, TOBIT
2585 | ld TMP3, LFUNC:RB->pc
2586 | sd r0, DISPATCH_GL(jit_base)(DISPATCH)
2587 | .FPU cvt.d.s TOBIT, TOBIT
2588 | // Modified copy of ins_next which handles function header dispatch, too.
2589 | lw INS, 0(PC)
2590 | addiu CRET1, CRET1, 17 // Static dispatch?
2591 | // Assumes TISNIL == ~LJ_VMST_INTERP == -1
2592 | sw TISNIL, DISPATCH_GL(vmstate)(DISPATCH)
2593 | decode_RD8a RD, INS
2594 | beqz CRET1, >5
2595 |. daddiu PC, PC, 4
2596 | decode_OP8a TMP1, INS
2597 | decode_OP8b TMP1
2598 | daddu TMP0, DISPATCH, TMP1
2599 | sltiu TMP2, TMP1, BC_FUNCF*8
2600 | ld AT, 0(TMP0)
2601 | decode_RA8a RA, INS
2602 | beqz TMP2, >2
2603 |. decode_RA8b RA
2604 | ld KBASE, PC2PROTO(k)(TMP3)
2605 | jr AT
2606 |. decode_RD8b RD
2607 |2:
2608 | sltiu TMP2, TMP1, (BC_FUNCC+2)*8 // Fast function?
2609 | bnez TMP2, >3
2610 |. ld TMP1, FRAME_PC(BASE)
2611 | // Check frame below fast function.
2612 | andi TMP0, TMP1, FRAME_TYPE
2613 | bnez TMP0, >3 // Trace stitching continuation?
2614 |. nop
2615 | // Otherwise set KBASE for Lua function below fast function.
2616 | lw TMP2, -4(TMP1)
2617 | decode_RA8a TMP0, TMP2
2618 | decode_RA8b TMP0
2619 | dsubu TMP1, BASE, TMP0
2620 | ld LFUNC:TMP2, -32(TMP1)
2621 | cleartp LFUNC:TMP2
2622 | ld TMP3, LFUNC:TMP2->pc
2623 | ld KBASE, PC2PROTO(k)(TMP3)
2624 |3:
2625 | daddiu RC, MULTRES, -8
2626 | jr AT
2627 |. daddu RA, RA, BASE
2628 |
2629 |5: // Dispatch to static entry of original ins replaced by BC_JLOOP.
2630 | ld TMP0, DISPATCH_J(trace)(DISPATCH)
2631 | decode_RD8b RD
2632 | daddu TMP0, TMP0, RD
2633 | ld TRACE:TMP2, 0(TMP0)
2634 | lw INS, TRACE:TMP2->startins
2635 | decode_OP8a TMP1, INS
2636 | decode_OP8b TMP1
2637 | daddu TMP0, DISPATCH, TMP1
2638 | decode_RD8a RD, INS
2639 | ld AT, GG_DISP2STATIC(TMP0)
2640 | decode_RA8a RA, INS
2641 | decode_RD8b RD
2642 | ld KBASE, PC2PROTO(k)(TMP3)
2643 | jr AT
2644 |. decode_RA8b RA
2645 |
2646 |9: // Rethrow error from the right C frame.
2647 | load_got lj_err_trace
2648 | sub CARG2, r0, CRET1
2649 | call_intern lj_err_trace // (lua_State *L, int errcode)
2650 |. move CARG1, L
2651 |.endif
2652 |
2653 |//-----------------------------------------------------------------------
2654 |//-- Math helper functions ----------------------------------------------
2655 |//-----------------------------------------------------------------------
2656 |
2657 |// Hard-float round to integer.
2658 |// Modifies AT, TMP0, FRET1, FRET2, f4. Keeps all others incl. FARG1.
2659 |// MIPSR6: Modifies FTMP1, too.
2660 |.macro vm_round_hf, func
2661 | lui TMP0, 0x4330 // Hiword of 2^52 (double).
2662 | dsll TMP0, TMP0, 32
2663 | dmtc1 TMP0, f4
2664 | abs.d FRET2, FARG1 // |x|
2665 | dmfc1 AT, FARG1
2666 |.if MIPSR6
2667 | cmp.lt.d FTMP1, FRET2, f4
2668 | add.d FRET1, FRET2, f4 // (|x| + 2^52) - 2^52
2669 | bc1eqz FTMP1, >1 // Truncate only if |x| < 2^52.
2670 |.else
2671 | c.olt.d 0, FRET2, f4
2672 | add.d FRET1, FRET2, f4 // (|x| + 2^52) - 2^52
2673 | bc1f 0, >1 // Truncate only if |x| < 2^52.
2674 |.endif
2675 |. sub.d FRET1, FRET1, f4
2676 | slt AT, AT, r0
2677 |.if "func" == "ceil"
2678 | lui TMP0, 0xbff0 // Hiword of -1 (double). Preserves -0.
2679 |.else
2680 | lui TMP0, 0x3ff0 // Hiword of +1 (double).
2681 |.endif
2682 |.if "func" == "trunc"
2683 | dsll TMP0, TMP0, 32
2684 | dmtc1 TMP0, f4
2685 |.if MIPSR6
2686 | cmp.lt.d FTMP1, FRET2, FRET1 // |x| < result?
2687 | sub.d FRET2, FRET1, f4
2688 | sel.d FTMP1, FRET1, FRET2 // If yes, subtract +1.
2689 | dmtc1 AT, FRET1
2690 | neg.d FRET2, FTMP1
2691 | jr ra
2692 |. sel.d FRET1, FTMP1, FRET2 // Merge sign bit back in.
2693 |.else
2694 | c.olt.d 0, FRET2, FRET1 // |x| < result?
2695 | sub.d FRET2, FRET1, f4
2696 | movt.d FRET1, FRET2, 0 // If yes, subtract +1.
2697 | neg.d FRET2, FRET1
2698 | jr ra
2699 |. movn.d FRET1, FRET2, AT // Merge sign bit back in.
2700 |.endif
2701 |.else
2702 | neg.d FRET2, FRET1
2703 | dsll TMP0, TMP0, 32
2704 | dmtc1 TMP0, f4
2705 |.if MIPSR6
2706 | dmtc1 AT, FTMP1
2707 | sel.d FTMP1, FRET1, FRET2
2708 |.if "func" == "ceil"
2709 | cmp.lt.d FRET1, FTMP1, FARG1 // x > result?
2710 |.else
2711 | cmp.lt.d FRET1, FARG1, FTMP1 // x < result?
2712 |.endif
2713 | sub.d FRET2, FTMP1, f4 // If yes, subtract +-1.
2714 | jr ra
2715 |. sel.d FRET1, FTMP1, FRET2
2716 |.else
2717 | movn.d FRET1, FRET2, AT // Merge sign bit back in.
2718 |.if "func" == "ceil"
2719 | c.olt.d 0, FRET1, FARG1 // x > result?
2720 |.else
2721 | c.olt.d 0, FARG1, FRET1 // x < result?
2722 |.endif
2723 | sub.d FRET2, FRET1, f4 // If yes, subtract +-1.
2724 | jr ra
2725 |. movt.d FRET1, FRET2, 0
2726 |.endif
2727 |.endif
2728 |1:
2729 | jr ra
2730 |. mov.d FRET1, FARG1
2731 |.endmacro
2732 |
2733 |.macro vm_round, func
2734 |.if FPU
2735 | vm_round_hf, func
2736 |.endif
2737 |.endmacro
2738 |
2739 |->vm_floor:
2740 | vm_round floor
2741 |->vm_ceil:
2742 | vm_round ceil
2743 |->vm_trunc:
2744 |.if JIT
2745 | vm_round trunc
2746 |.endif
2747 |
2748 |// Soft-float integer to number conversion.
2749 |.macro sfi2d, ARG
2750 |.if not FPU
2751 | beqz ARG, >9 // Handle zero first.
2752 |. sra TMP0, ARG, 31
2753 | xor TMP1, ARG, TMP0
2754 | dsubu TMP1, TMP1, TMP0 // Absolute value in TMP1.
2755 | dclz ARG, TMP1
2756 | addiu ARG, ARG, -11
2757 | li AT, 0x3ff+63-11-1
2758 | dsllv TMP1, TMP1, ARG // Align mantissa left with leading 1.
2759 | subu ARG, AT, ARG // Exponent - 1.
2760 | ins ARG, TMP0, 11, 11 // Sign | Exponent.
2761 | dsll ARG, ARG, 52 // Align left.
2762 | jr ra
2763 |. daddu ARG, ARG, TMP1 // Add mantissa, increment exponent.
2764 |9:
2765 | jr ra
2766 |. nop
2767 |.endif
2768 |.endmacro
2769 |
2770 |// Input CARG1. Output: CARG1. Temporaries: AT, TMP0, TMP1.
2771 |->vm_sfi2d_1:
2772 | sfi2d CARG1
2773 |
2774 |// Input CARG2. Output: CARG2. Temporaries: AT, TMP0, TMP1.
2775 |->vm_sfi2d_2:
2776 | sfi2d CARG2
2777 |
2778 |// Soft-float comparison. Equivalent to c.eq.d.
2779 |// Input: CARG*. Output: CRET1. Temporaries: AT, TMP0, TMP1.
2780 |->vm_sfcmpeq:
2781 |.if not FPU
2782 | dsll AT, CARG1, 1
2783 | dsll TMP0, CARG2, 1
2784 | or TMP1, AT, TMP0
2785 | beqz TMP1, >8 // Both args +-0: return 1.
2786 |. lui TMP1, 0xffe0
2787 | dsll TMP1, TMP1, 32
2788 | sltu AT, TMP1, AT
2789 | sltu TMP0, TMP1, TMP0
2790 | or TMP1, AT, TMP0
2791 | bnez TMP1, >9 // Either arg is NaN: return 0;
2792 |. xor AT, CARG1, CARG2
2793 | jr ra
2794 |. sltiu CRET1, AT, 1 // Same values: return 1.
2795 |8:
2796 | jr ra
2797 |. li CRET1, 1
2798 |9:
2799 | jr ra
2800 |. li CRET1, 0
2801 |.endif
2802 |
2803 |// Soft-float comparison. Equivalent to c.ult.d and c.olt.d.
2804 |// Input: CARG1, CARG2. Output: CRET1. Temporaries: AT, TMP0, TMP1, CRET2.
2805 |->vm_sfcmpult:
2806 |.if not FPU
2807 | b >1
2808 |. li CRET2, 1
2809 |.endif
2810 |
2811 |->vm_sfcmpolt:
2812 |.if not FPU
2813 | li CRET2, 0
2814 |1:
2815 | dsll AT, CARG1, 1
2816 | dsll TMP0, CARG2, 1
2817 | or TMP1, AT, TMP0
2818 | beqz TMP1, >8 // Both args +-0: return 0.
2819 |. lui TMP1, 0xffe0
2820 | dsll TMP1, TMP1, 32
2821 | sltu AT, TMP1, AT
2822 | sltu TMP0, TMP1, TMP0
2823 | or TMP1, AT, TMP0
2824 | bnez TMP1, >9 // Either arg is NaN: return 0 or 1;
2825 |. and AT, CARG1, CARG2
2826 | bltz AT, >5 // Both args negative?
2827 |. nop
2828 | jr ra
2829 |. slt CRET1, CARG1, CARG2
2830 |5: // Swap conditions if both operands are negative.
2831 | jr ra
2832 |. slt CRET1, CARG2, CARG1
2833 |8:
2834 | jr ra
2835 |. li CRET1, 0
2836 |9:
2837 | jr ra
2838 |. move CRET1, CRET2
2839 |.endif
2840 |
2841 |->vm_sfcmpogt:
2842 |.if not FPU
2843 | dsll AT, CARG2, 1
2844 | dsll TMP0, CARG1, 1
2845 | or TMP1, AT, TMP0
2846 | beqz TMP1, >8 // Both args +-0: return 0.
2847 |. lui TMP1, 0xffe0
2848 | dsll TMP1, TMP1, 32
2849 | sltu AT, TMP1, AT
2850 | sltu TMP0, TMP1, TMP0
2851 | or TMP1, AT, TMP0
2852 | bnez TMP1, >9 // Either arg is NaN: return 0 or 1;
2853 |. and AT, CARG2, CARG1
2854 | bltz AT, >5 // Both args negative?
2855 |. nop
2856 | jr ra
2857 |. slt CRET1, CARG2, CARG1
2858 |5: // Swap conditions if both operands are negative.
2859 | jr ra
2860 |. slt CRET1, CARG1, CARG2
2861 |8:
2862 | jr ra
2863 |. li CRET1, 0
2864 |9:
2865 | jr ra
2866 |. li CRET1, 0
2867 |.endif
2868 |
2869 |// Soft-float comparison. Equivalent to c.ole.d a, b or c.ole.d b, a.
2870 |// Input: CARG1, CARG2, TMP3. Output: CRET1. Temporaries: AT, TMP0, TMP1.
2871 |->vm_sfcmpolex:
2872 |.if not FPU
2873 | dsll AT, CARG1, 1
2874 | dsll TMP0, CARG2, 1
2875 | or TMP1, AT, TMP0
2876 | beqz TMP1, >8 // Both args +-0: return 1.
2877 |. lui TMP1, 0xffe0
2878 | dsll TMP1, TMP1, 32
2879 | sltu AT, TMP1, AT
2880 | sltu TMP0, TMP1, TMP0
2881 | or TMP1, AT, TMP0
2882 | bnez TMP1, >9 // Either arg is NaN: return 0;
2883 |. and AT, CARG1, CARG2
2884 | xor AT, AT, TMP3
2885 | bltz AT, >5 // Both args negative?
2886 |. nop
2887 | jr ra
2888 |. slt CRET1, CARG2, CARG1
2889 |5: // Swap conditions if both operands are negative.
2890 | jr ra
2891 |. slt CRET1, CARG1, CARG2
2892 |8:
2893 | jr ra
2894 |. li CRET1, 1
2895 |9:
2896 | jr ra
2897 |. li CRET1, 0
2898 |.endif
2899 |
2900 |.macro sfmin_max, name, fpcall
2901 |->vm_sf .. name:
2902 |.if JIT and not FPU
2903 | move TMP2, ra
2904 | bal ->fpcall
2905 |. nop
2906 | move ra, TMP2
2907 | move TMP0, CRET1
2908 | move CRET1, CARG1
2909 |.if MIPSR6
2910 | selnez CRET1, CRET1, TMP0
2911 | seleqz TMP0, CARG2, TMP0
2912 | jr ra
2913 |. or CRET1, CRET1, TMP0
2914 |.else
2915 | jr ra
2916 |. movz CRET1, CARG2, TMP0
2917 |.endif
2918 |.endif
2919 |.endmacro
2920 |
2921 | sfmin_max min, vm_sfcmpolt
2922 | sfmin_max max, vm_sfcmpogt
2923 |
2924 |//-----------------------------------------------------------------------
2925 |//-- Number conversion functions ----------------------------------------
2926 |//-----------------------------------------------------------------------
2927 |
2928 |// int64_t lj_vm_num2int_check(double x)
2929 |->vm_num2int_check:
2930 |.if FPU
2931 | trunc.w.d FARG2, FARG1
2932 | mfc1 CRET1, FARG2
2933 | cvt.d.w FARG2, FARG2
2934 |.if MIPSR6
2935 | cmp.eq.d FARG2, FARG1, FARG2
2936 | bc1eqz FARG2, >2
2937 |.else
2938 | c.eq.d FARG1, FARG2
2939 | bc1f 0, >2
2940 |.endif
2941 |. nop
2942 | jr ra
2943 |. zextw CRET1, CRET1
2944 |
2945 |.else
2946 |
2947 | dsll CRET2, CARG1, 1
2948 | beqz CRET2, >1
2949 |. li TMP0, 1076
2950 | dsrl AT, CRET2, 53
2951 | dsubu TMP0, TMP0, AT
2952 | sltiu AT, TMP0, 54
2953 | beqz AT, >2
2954 |. dextm CRET2, CRET2, 0, 20
2955 | dinsu CRET2, AT, 21, 21
2956 | slt AT, CARG1, r0
2957 | dsrlv CRET1, CRET2, TMP0
2958 | negu CARG1, CRET1
2959 |.if MIPSR6
2960 | seleqz CRET1, CRET1, AT
2961 | selnez CARG1, CARG1, AT
2962 | or CRET1, CRET1, CARG1
2963 |.else
2964 | movn CRET1, CARG1, AT
2965 |.endif
2966 | negu TMP0, TMP0
2967 | dsllv CRET2, CRET2, TMP0 // Integer check.
2968 | sextw AT, CRET1
2969 | xor AT, CRET1, AT // Range check.
2970 | or AT, AT, CRET2
2971 | bnez AT, >2
2972 |. nop
2973 | jr ra
2974 |. zextw CRET1, CRET1
2975 |1:
2976 | jr ra
2977 |. move CRET1, r0
2978 |.endif
2979 |2:
2980 | lui CRET1, 0x8000
2981 | dsll CRET1, CRET1, 16
2982 | ori CRET1, CRET1, 0x8000
2983 | jr ra
2984 |. dsll CRET1, CRET1, 16
2985 |
2986 |// int64_t lj_vm_num2i64(double x)
2987 |->vm_num2i64:
2988 |.if FPU
2989 | trunc.l.d FARG1, FARG1
2990 | jr ra
2991 |. dmfc1 CRET1, FARG1
2992 |.else
2993 |// fallthrough, same as lj_vm_num2u64 for soft-float.
2994 |.endif
2995 |
2996 |// uint64_t lj_vm_num2u64(double x)
2997 |->vm_num2u64:
2998 |.if FPU
2999 | trunc.l.d FARG2, FARG1
3000 | dmfc1 CRET1, FARG2
3001 | li AT, -1
3002 | dsrl AT, AT, 1
3003 | beq CRET1, AT, >1
3004 |. lui AT, 0xdf80 // -2^64 (float).
3005 | jr ra
3006 |. nop
3007 |1:
3008 | mtc1 AT, FARG2
3009 | cvt.d.s FARG2, FARG2
3010 | add.d FARG1, FARG1, FARG2
3011 | trunc.l.d FARG2, FARG1
3012 | jr ra
3013 |. dmfc1 CRET1, FARG2
3014 |
3015 |.else
3016 |
3017 | dextu CARG2, CARG1, 20, 10
3018 | addiu AT, CARG2, -1023
3019 | sltiu AT, AT, 116
3020 | beqz AT, >2 // Exponent out of range.
3021 |. addiu CARG2, CARG2, -1075
3022 | dextm CRET1, CARG1, 0, 19
3023 | dsll AT, AT, 52
3024 | dsra CARG1, CARG1, 63 // sign = 0 or -1.
3025 | bgez CARG2, >1 // Shift mantissa left or right?
3026 |. or CRET1, CRET1, AT // Merge leading 1 into masked mantissa.
3027 | subu CARG2, r0, CARG2
3028 | dsrlv CRET1, CRET1, CARG2 // Shift mantissa right for low exp.
3029 | daddu CRET1, CRET1, CARG1
3030 | jr ra
3031 |. xor CRET1, CRET1, CARG1 // m = sign?-m:m = (m+sign)^sign.
3032 |1:
3033 | dsllv CRET1, CRET1, CARG2 // Shift mantissa left for high exp.
3034 | daddu CRET1, CRET1, CARG1
3035 | jr ra
3036 |. xor CRET1, CRET1, CARG1 // m = sign?-m:m = (m+sign)^sign.
3037 |2:
3038 | jr ra
3039 |. move CRET1, r0
3040 |.endif
3041 |
3042 |// int32_t lj_vm_tobit(double x)
3043 |.if FPU
3044 |->vm_tobit:
3045 | lui AT, 0x59c0 // 2^52 + 2^51 (float).
3046 | mtc1 AT, FARG2
3047 | cvt.d.s FARG2, FARG2
3048 | add.d FARG1, FARG1, FARG2
3049 | mfc1 CRET1, FARG1
3050 | jr ra
3051 |. sextw CRET1, CRET1
3052 |.endif
3053 |
3054 |//-----------------------------------------------------------------------
3055 |//-- Miscellaneous functions --------------------------------------------
3056 |//-----------------------------------------------------------------------
3057 |
3058 |.define NEXT_TAB, TAB:CARG1
3059 |.define NEXT_IDX, CARG2
3060 |.define NEXT_ASIZE, CARG3
3061 |.define NEXT_NIL, CARG4
3062 |.define NEXT_TMP0, r12
3063 |.define NEXT_TMP1, r13
3064 |.define NEXT_TMP2, r14
3065 |.define NEXT_RES_VK, CRET1
3066 |.define NEXT_RES_IDX, CRET2
3067 |.define NEXT_RES_PTR, sp
3068 |.define NEXT_RES_VAL, 0(sp)
3069 |.define NEXT_RES_KEY, 8(sp)
3070 |
3071 |// TValue *lj_vm_next(GCtab *t, uint32_t idx)
3072 |// Next idx returned in CRET2.
3073 |->vm_next:
3074 |.if JIT and ENDIAN_LE
3075 | lw NEXT_ASIZE, NEXT_TAB->asize
3076 | ld NEXT_TMP0, NEXT_TAB->array
3077 | li NEXT_NIL, LJ_TNIL
3078 |1: // Traverse array part.
3079 | sltu AT, NEXT_IDX, NEXT_ASIZE
3080 | sll NEXT_TMP1, NEXT_IDX, 3
3081 | beqz AT, >5
3082 |. daddu NEXT_TMP1, NEXT_TMP0, NEXT_TMP1
3083 | li AT, LJ_TISNUM
3084 | ld NEXT_TMP2, 0(NEXT_TMP1)
3085 | dsll AT, AT, 47
3086 | or NEXT_TMP1, NEXT_IDX, AT
3087 | beq NEXT_TMP2, NEXT_NIL, <1
3088 |. addiu NEXT_IDX, NEXT_IDX, 1
3089 | sd NEXT_TMP2, NEXT_RES_VAL
3090 | sd NEXT_TMP1, NEXT_RES_KEY
3091 | move NEXT_RES_VK, NEXT_RES_PTR
3092 | jr ra
3093 |. move NEXT_RES_IDX, NEXT_IDX
3094 |
3095 |5: // Traverse hash part.
3096 | subu NEXT_RES_IDX, NEXT_IDX, NEXT_ASIZE
3097 | ld NODE:NEXT_RES_VK, NEXT_TAB->node
3098 | sll NEXT_TMP2, NEXT_RES_IDX, 5
3099 | lw NEXT_TMP0, NEXT_TAB->hmask
3100 | sll AT, NEXT_RES_IDX, 3
3101 | subu AT, NEXT_TMP2, AT
3102 | daddu NODE:NEXT_RES_VK, NODE:NEXT_RES_VK, AT
3103 |6:
3104 | sltu AT, NEXT_TMP0, NEXT_RES_IDX
3105 | bnez AT, >8
3106 |. nop
3107 | ld NEXT_TMP2, NODE:NEXT_RES_VK->val
3108 | bne NEXT_TMP2, NEXT_NIL, >9
3109 |. addiu NEXT_RES_IDX, NEXT_RES_IDX, 1
3110 | // Skip holes in hash part.
3111 | b <6
3112 |. daddiu NODE:NEXT_RES_VK, NODE:NEXT_RES_VK, sizeof(Node)
3113 |
3114 |8: // End of iteration. Set the key to nil (not the value).
3115 | sd NEXT_NIL, NEXT_RES_KEY
3116 | move NEXT_RES_VK, NEXT_RES_PTR
3117 |9:
3118 | jr ra
3119 |. addu NEXT_RES_IDX, NEXT_RES_IDX, NEXT_ASIZE
3120 |.endif
3121 |
3122 |//-----------------------------------------------------------------------
3123 |//-- FFI helper functions -----------------------------------------------
3124 |//-----------------------------------------------------------------------
3125 |
3126 |// Handler for callback functions. Callback slot number in r1, g in r2.
3127 |->vm_ffi_callback:
3128 |.if FFI
3129 |.type CTSTATE, CTState, PC
3130 | saveregs
3131 | ld CTSTATE, GL:r2->ctype_state
3132 | daddiu DISPATCH, r2, GG_G2DISP
3133 | load_got lj_ccallback_enter
3134 | sw r1, CTSTATE->cb.slot
3135 | sd CARG1, CTSTATE->cb.gpr[0]
3136 | .FPU sdc1 FARG1, CTSTATE->cb.fpr[0]
3137 | sd CARG2, CTSTATE->cb.gpr[1]
3138 | .FPU sdc1 FARG2, CTSTATE->cb.fpr[1]
3139 | sd CARG3, CTSTATE->cb.gpr[2]
3140 | .FPU sdc1 FARG3, CTSTATE->cb.fpr[2]
3141 | sd CARG4, CTSTATE->cb.gpr[3]
3142 | .FPU sdc1 FARG4, CTSTATE->cb.fpr[3]
3143 | sd CARG5, CTSTATE->cb.gpr[4]
3144 | .FPU sdc1 FARG5, CTSTATE->cb.fpr[4]
3145 | sd CARG6, CTSTATE->cb.gpr[5]
3146 | .FPU sdc1 FARG6, CTSTATE->cb.fpr[5]
3147 | sd CARG7, CTSTATE->cb.gpr[6]
3148 | .FPU sdc1 FARG7, CTSTATE->cb.fpr[6]
3149 | sd CARG8, CTSTATE->cb.gpr[7]
3150 | .FPU sdc1 FARG8, CTSTATE->cb.fpr[7]
3151 | daddiu TMP0, sp, CFRAME_SPACE
3152 | sd TMP0, CTSTATE->cb.stack
3153 | sd r0, SAVE_PC // Any value outside of bytecode is ok.
3154 | move CARG2, sp
3155 | call_intern lj_ccallback_enter // (CTState *cts, void *cf)
3156 |. move CARG1, CTSTATE
3157 | // Returns lua_State *.
3158 | ld BASE, L:CRET1->base
3159 | ld RC, L:CRET1->top
3160 | move L, CRET1
3161 | .FPU lui TMP3, 0x59c0 // TOBIT = 2^52 + 2^51 (float).
3162 | ld LFUNC:RB, FRAME_FUNC(BASE)
3163 | .FPU mtc1 TMP3, TOBIT
3164 | li TISNIL, LJ_TNIL
3165 | li TISNUM, LJ_TISNUM
3166 | li_vmstate INTERP
3167 | subu RC, RC, BASE
3168 | cleartp LFUNC:RB
3169 | st_vmstate
3170 | .FPU cvt.d.s TOBIT, TOBIT
3171 | ins_callt
3172 |.endif
3173 |
3174 |->cont_ffi_callback: // Return from FFI callback.
3175 |.if FFI
3176 | load_got lj_ccallback_leave
3177 | ld CTSTATE, DISPATCH_GL(ctype_state)(DISPATCH)
3178 | sd BASE, L->base
3179 | sd RB, L->top
3180 | sd L, CTSTATE->L
3181 | move CARG2, RA
3182 | call_intern lj_ccallback_leave // (CTState *cts, TValue *o)
3183 |. move CARG1, CTSTATE
3184 | .FPU ldc1 FRET1, CTSTATE->cb.fpr[0]
3185 | ld CRET1, CTSTATE->cb.gpr[0]
3186 | .FPU ldc1 FRET2, CTSTATE->cb.fpr[1]
3187 | b ->vm_leave_unw
3188 |. ld CRET2, CTSTATE->cb.gpr[1]
3189 |.endif
3190 |
3191 |->vm_ffi_call: // Call C function via FFI.
3192 | // Caveat: needs special frame unwinding, see below.
3193 |.if FFI
3194 | .type CCSTATE, CCallState, CARG1
3195 | lw TMP1, CCSTATE->spadj
3196 | lbu CARG2, CCSTATE->nsp
3197 | move TMP2, sp
3198 | dsubu sp, sp, TMP1
3199 | sd ra, -8(TMP2)
3200 | sd r16, -16(TMP2)
3201 | sd CCSTATE, -24(TMP2)
3202 | move r16, TMP2
3203 | daddiu TMP1, CCSTATE, offsetof(CCallState, stack)
3204 | move TMP2, sp
3205 | beqz CARG2, >2
3206 |. daddu TMP3, TMP1, CARG2
3207 |1:
3208 | ld TMP0, 0(TMP1)
3209 | daddiu TMP1, TMP1, 8
3210 | sltu AT, TMP1, TMP3
3211 | sd TMP0, 0(TMP2)
3212 | bnez AT, <1
3213 |. daddiu TMP2, TMP2, 8
3214 |2:
3215 | ld CFUNCADDR, CCSTATE->func
3216 | .FPU ldc1 FARG1, CCSTATE->gpr[0]
3217 | ld CARG2, CCSTATE->gpr[1]
3218 | .FPU ldc1 FARG2, CCSTATE->gpr[1]
3219 | ld CARG3, CCSTATE->gpr[2]
3220 | .FPU ldc1 FARG3, CCSTATE->gpr[2]
3221 | ld CARG4, CCSTATE->gpr[3]
3222 | .FPU ldc1 FARG4, CCSTATE->gpr[3]
3223 | ld CARG5, CCSTATE->gpr[4]
3224 | .FPU ldc1 FARG5, CCSTATE->gpr[4]
3225 | ld CARG6, CCSTATE->gpr[5]
3226 | .FPU ldc1 FARG6, CCSTATE->gpr[5]
3227 | ld CARG7, CCSTATE->gpr[6]
3228 | .FPU ldc1 FARG7, CCSTATE->gpr[6]
3229 | ld CARG8, CCSTATE->gpr[7]
3230 | .FPU ldc1 FARG8, CCSTATE->gpr[7]
3231 | jalr CFUNCADDR
3232 |. ld CARG1, CCSTATE->gpr[0] // Do this last, since CCSTATE is CARG1.
3233 | ld CCSTATE:TMP1, -24(r16)
3234 | ld TMP2, -16(r16)
3235 | ld ra, -8(r16)
3236 | sd CRET1, CCSTATE:TMP1->gpr[0]
3237 | sd CRET2, CCSTATE:TMP1->gpr[1]
3238 |.if FPU
3239 | sdc1 FRET1, CCSTATE:TMP1->fpr[0]
3240 | sdc1 FRET2, CCSTATE:TMP1->fpr[1]
3241 |.else
3242 | sd CARG1, CCSTATE:TMP1->gpr[2] // 2nd FP struct field for soft-float.
3243 |.endif
3244 | move sp, r16
3245 | jr ra
3246 |. move r16, TMP2
3247 |.endif
3248 |// Note: vm_ffi_call must be the last function in this object file!
3249 |
3250 |//-----------------------------------------------------------------------
3251}
3252
3253/* Generate the code for a single instruction. */
3254static void build_ins(BuildCtx *ctx, BCOp op, int defop)
3255{
3256 int vk = 0;
3257 |=>defop:
3258
3259 switch (op) {
3260
3261 /* -- Comparison ops ---------------------------------------------------- */
3262
3263 /* Remember: all ops branch for a true comparison, fall through otherwise. */
3264
3265 case BC_ISLT: case BC_ISGE: case BC_ISLE: case BC_ISGT:
3266 | // RA = src1*8, RD = src2*8, JMP with RD = target
3267 |.macro bc_comp, FRA, FRD, ARGRA, ARGRD, movop, fmovop, fcomp, sfcomp
3268 | daddu RA, BASE, RA
3269 | daddu RD, BASE, RD
3270 | ld ARGRA, 0(RA)
3271 | ld ARGRD, 0(RD)
3272 | lhu TMP2, OFS_RD(PC)
3273 | gettp CARG3, ARGRA
3274 | gettp CARG4, ARGRD
3275 | bne CARG3, TISNUM, >2
3276 |. daddiu PC, PC, 4
3277 | bne CARG4, TISNUM, >5
3278 |. decode_RD4b TMP2
3279 | sextw ARGRA, ARGRA
3280 | sextw ARGRD, ARGRD
3281 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3282 | slt AT, CARG1, CARG2
3283 | addu TMP2, TMP2, TMP3
3284 |.if MIPSR6
3285 | movop TMP2, TMP2, AT
3286 |.else
3287 | movop TMP2, r0, AT
3288 |.endif
3289 |1:
3290 | daddu PC, PC, TMP2
3291 | ins_next
3292 |
3293 |2: // RA is not an integer.
3294 | sltiu AT, CARG3, LJ_TISNUM
3295 | beqz AT, ->vmeta_comp
3296 |. lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3297 | sltiu AT, CARG4, LJ_TISNUM
3298 | beqz AT, >4
3299 |. decode_RD4b TMP2
3300 |.if FPU
3301 | ldc1 FRA, 0(RA)
3302 | ldc1 FRD, 0(RD)
3303 |.endif
3304 |3: // RA and RD are both numbers.
3305 |.if FPU
3306 |.if MIPSR6
3307 | fcomp FTMP0, FTMP0, FTMP2
3308 | addu TMP2, TMP2, TMP3
3309 | mfc1 TMP3, FTMP0
3310 | b <1
3311 |. fmovop TMP2, TMP2, TMP3
3312 |.else
3313 | fcomp FTMP0, FTMP2
3314 | addu TMP2, TMP2, TMP3
3315 | b <1
3316 |. fmovop TMP2, r0
3317 |.endif
3318 |.else
3319 | bal sfcomp
3320 |. addu TMP2, TMP2, TMP3
3321 | b <1
3322 |.if MIPSR6
3323 |. movop TMP2, TMP2, CRET1
3324 |.else
3325 |. movop TMP2, r0, CRET1
3326 |.endif
3327 |.endif
3328 |
3329 |4: // RA is a number, RD is not a number.
3330 | bne CARG4, TISNUM, ->vmeta_comp
3331 | // RA is a number, RD is an integer. Convert RD to a number.
3332 |.if FPU
3333 |. lwc1 FRD, LO(RD)
3334 | ldc1 FRA, 0(RA)
3335 | b <3
3336 |. cvt.d.w FRD, FRD
3337 |.else
3338 |.if "ARGRD" == "CARG1"
3339 |. sextw CARG1, CARG1
3340 | bal ->vm_sfi2d_1
3341 |. nop
3342 |.else
3343 |. sextw CARG2, CARG2
3344 | bal ->vm_sfi2d_2
3345 |. nop
3346 |.endif
3347 | b <3
3348 |. nop
3349 |.endif
3350 |
3351 |5: // RA is an integer, RD is not an integer
3352 | sltiu AT, CARG4, LJ_TISNUM
3353 | beqz AT, ->vmeta_comp
3354 |. lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3355 | // RA is an integer, RD is a number. Convert RA to a number.
3356 |.if FPU
3357 | lwc1 FRA, LO(RA)
3358 | ldc1 FRD, 0(RD)
3359 | b <3
3360 | cvt.d.w FRA, FRA
3361 |.else
3362 |.if "ARGRA" == "CARG1"
3363 | bal ->vm_sfi2d_1
3364 |. sextw CARG1, CARG1
3365 |.else
3366 | bal ->vm_sfi2d_2
3367 |. sextw CARG2, CARG2
3368 |.endif
3369 | b <3
3370 |. nop
3371 |.endif
3372 |.endmacro
3373 |
3374 |.if MIPSR6
3375 if (op == BC_ISLT) {
3376 | bc_comp FTMP0, FTMP2, CARG1, CARG2, selnez, selnez, cmp.lt.d, ->vm_sfcmpolt
3377 } else if (op == BC_ISGE) {
3378 | bc_comp FTMP0, FTMP2, CARG1, CARG2, seleqz, seleqz, cmp.lt.d, ->vm_sfcmpolt
3379 } else if (op == BC_ISLE) {
3380 | bc_comp FTMP2, FTMP0, CARG2, CARG1, seleqz, seleqz, cmp.ult.d, ->vm_sfcmpult
3381 } else {
3382 | bc_comp FTMP2, FTMP0, CARG2, CARG1, selnez, selnez, cmp.ult.d, ->vm_sfcmpult
3383 }
3384 |.else
3385 if (op == BC_ISLT) {
3386 | bc_comp FTMP0, FTMP2, CARG1, CARG2, movz, movf, c.olt.d, ->vm_sfcmpolt
3387 } else if (op == BC_ISGE) {
3388 | bc_comp FTMP0, FTMP2, CARG1, CARG2, movn, movt, c.olt.d, ->vm_sfcmpolt
3389 } else if (op == BC_ISLE) {
3390 | bc_comp FTMP2, FTMP0, CARG2, CARG1, movn, movt, c.ult.d, ->vm_sfcmpult
3391 } else {
3392 | bc_comp FTMP2, FTMP0, CARG2, CARG1, movz, movf, c.ult.d, ->vm_sfcmpult
3393 }
3394 |.endif
3395 break;
3396
3397 case BC_ISEQV: case BC_ISNEV:
3398 vk = op == BC_ISEQV;
3399 | // RA = src1*8, RD = src2*8, JMP with RD = target
3400 | daddu RA, BASE, RA
3401 | daddiu PC, PC, 4
3402 | daddu RD, BASE, RD
3403 | ld CARG1, 0(RA)
3404 | lhu TMP2, -4+OFS_RD(PC)
3405 | ld CARG2, 0(RD)
3406 | gettp CARG3, CARG1
3407 | gettp CARG4, CARG2
3408 | sltu AT, TISNUM, CARG3
3409 | sltu TMP1, TISNUM, CARG4
3410 | or AT, AT, TMP1
3411 if (vk) {
3412 | beqz AT, ->BC_ISEQN_Z
3413 } else {
3414 | beqz AT, ->BC_ISNEN_Z
3415 }
3416 | // Either or both types are not numbers.
3417 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3418 |.if FFI
3419 |. li AT, LJ_TCDATA
3420 | beq CARG3, AT, ->vmeta_equal_cd
3421 |.endif
3422 | decode_RD4b TMP2
3423 |.if FFI
3424 | beq CARG4, AT, ->vmeta_equal_cd
3425 |. nop
3426 |.endif
3427 | bne CARG1, CARG2, >2
3428 |. addu TMP2, TMP2, TMP3
3429 | // Tag and value are equal.
3430 if (vk) {
3431 |->BC_ISEQV_Z:
3432 | daddu PC, PC, TMP2
3433 }
3434 |1:
3435 | ins_next
3436 |
3437 |2: // Check if the tags are the same and it's a table or userdata.
3438 | xor AT, CARG3, CARG4 // Same type?
3439 | sltiu TMP0, CARG3, LJ_TISTABUD+1 // Table or userdata?
3440 |.if MIPSR6
3441 | seleqz TMP0, TMP0, AT
3442 |.else
3443 | movn TMP0, r0, AT
3444 |.endif
3445 if (vk) {
3446 | beqz TMP0, <1
3447 } else {
3448 | beqz TMP0, ->BC_ISEQV_Z // Reuse code from opposite instruction.
3449 }
3450 | // Different tables or userdatas. Need to check __eq metamethod.
3451 | // Field metatable must be at same offset for GCtab and GCudata!
3452 |. cleartp TAB:TMP1, CARG1
3453 | ld TAB:TMP3, TAB:TMP1->metatable
3454 if (vk) {
3455 | beqz TAB:TMP3, <1 // No metatable?
3456 |. nop
3457 | lbu TMP3, TAB:TMP3->nomm
3458 | andi TMP3, TMP3, 1<<MM_eq
3459 | bnez TMP3, >1 // Or 'no __eq' flag set?
3460 } else {
3461 | beqz TAB:TMP3,->BC_ISEQV_Z // No metatable?
3462 |. nop
3463 | lbu TMP3, TAB:TMP3->nomm
3464 | andi TMP3, TMP3, 1<<MM_eq
3465 | bnez TMP3, ->BC_ISEQV_Z // Or 'no __eq' flag set?
3466 }
3467 |. nop
3468 | b ->vmeta_equal // Handle __eq metamethod.
3469 |. li TMP0, 1-vk // ne = 0 or 1.
3470 break;
3471
3472 case BC_ISEQS: case BC_ISNES:
3473 vk = op == BC_ISEQS;
3474 | // RA = src*8, RD = str_const*8 (~), JMP with RD = target
3475 | daddu RA, BASE, RA
3476 | daddiu PC, PC, 4
3477 | ld CARG1, 0(RA)
3478 | dsubu RD, KBASE, RD
3479 | lhu TMP2, -4+OFS_RD(PC)
3480 | ld CARG2, -8(RD) // KBASE-8-str_const*8
3481 |.if FFI
3482 | gettp TMP0, CARG1
3483 | li AT, LJ_TCDATA
3484 |.endif
3485 | li TMP1, LJ_TSTR
3486 | decode_RD4b TMP2
3487 |.if FFI
3488 | beq TMP0, AT, ->vmeta_equal_cd
3489 |.endif
3490 |. settp CARG2, TMP1
3491 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3492 | xor TMP1, CARG1, CARG2
3493 | addu TMP2, TMP2, TMP3
3494 |.if MIPSR6
3495 if (vk) {
3496 | seleqz TMP2, TMP2, TMP1
3497 } else {
3498 | selnez TMP2, TMP2, TMP1
3499 }
3500 |.else
3501 if (vk) {
3502 | movn TMP2, r0, TMP1
3503 } else {
3504 | movz TMP2, r0, TMP1
3505 }
3506 |.endif
3507 | daddu PC, PC, TMP2
3508 | ins_next
3509 break;
3510
3511 case BC_ISEQN: case BC_ISNEN:
3512 vk = op == BC_ISEQN;
3513 | // RA = src*8, RD = num_const*8, JMP with RD = target
3514 | daddu RA, BASE, RA
3515 | daddu RD, KBASE, RD
3516 | ld CARG1, 0(RA)
3517 | ld CARG2, 0(RD)
3518 | lhu TMP2, OFS_RD(PC)
3519 | gettp CARG3, CARG1
3520 | gettp CARG4, CARG2
3521 | daddiu PC, PC, 4
3522 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3523 if (vk) {
3524 |->BC_ISEQN_Z:
3525 } else {
3526 |->BC_ISNEN_Z:
3527 }
3528 | bne CARG3, TISNUM, >3
3529 |. decode_RD4b TMP2
3530 | bne CARG4, TISNUM, >6
3531 |. addu TMP2, TMP2, TMP3
3532 | xor AT, CARG1, CARG2
3533 |.if MIPSR6
3534 if (vk) {
3535 | seleqz TMP2, TMP2, AT
3536 |1:
3537 | daddu PC, PC, TMP2
3538 |2:
3539 } else {
3540 | selnez TMP2, TMP2, AT
3541 |1:
3542 |2:
3543 | daddu PC, PC, TMP2
3544 }
3545 |.else
3546 if (vk) {
3547 | movn TMP2, r0, AT
3548 |1:
3549 | daddu PC, PC, TMP2
3550 |2:
3551 } else {
3552 | movz TMP2, r0, AT
3553 |1:
3554 |2:
3555 | daddu PC, PC, TMP2
3556 }
3557 |.endif
3558 | ins_next
3559 |
3560 |3: // RA is not an integer.
3561 | sltu AT, CARG3, TISNUM
3562 |.if FFI
3563 | beqz AT, >8
3564 |.else
3565 | beqz AT, <2
3566 |.endif
3567 |. addu TMP2, TMP2, TMP3
3568 | sltu AT, CARG4, TISNUM
3569 |.if FPU
3570 | ldc1 FTMP0, 0(RA)
3571 | ldc1 FTMP2, 0(RD)
3572 |.endif
3573 | beqz AT, >5
3574 |. nop
3575 |4: // RA and RD are both numbers.
3576 |.if FPU
3577 |.if MIPSR6
3578 | cmp.eq.d FTMP0, FTMP0, FTMP2
3579 | dmfc1 TMP1, FTMP0
3580 | b <1
3581 if (vk) {
3582 |. selnez TMP2, TMP2, TMP1
3583 } else {
3584 |. seleqz TMP2, TMP2, TMP1
3585 }
3586 |.else
3587 | c.eq.d FTMP0, FTMP2
3588 | b <1
3589 if (vk) {
3590 |. movf TMP2, r0
3591 } else {
3592 |. movt TMP2, r0
3593 }
3594 |.endif
3595 |.else
3596 | bal ->vm_sfcmpeq
3597 |. nop
3598 | b <1
3599 |.if MIPSR6
3600 if (vk) {
3601 |. selnez TMP2, TMP2, CRET1
3602 } else {
3603 |. seleqz TMP2, TMP2, CRET1
3604 }
3605 |.else
3606 if (vk) {
3607 |. movz TMP2, r0, CRET1
3608 } else {
3609 |. movn TMP2, r0, CRET1
3610 }
3611 |.endif
3612 |.endif
3613 |
3614 |5: // RA is a number, RD is not a number.
3615 |.if FFI
3616 | bne CARG4, TISNUM, >9
3617 |.else
3618 | bne CARG4, TISNUM, <2
3619 |.endif
3620 | // RA is a number, RD is an integer. Convert RD to a number.
3621 |.if FPU
3622 |. lwc1 FTMP2, LO(RD)
3623 | b <4
3624 |. cvt.d.w FTMP2, FTMP2
3625 |.else
3626 |. sextw CARG2, CARG2
3627 | bal ->vm_sfi2d_2
3628 |. nop
3629 | b <4
3630 |. nop
3631 |.endif
3632 |
3633 |6: // RA is an integer, RD is not an integer
3634 | sltu AT, CARG4, TISNUM
3635 |.if FFI
3636 | beqz AT, >9
3637 |.else
3638 | beqz AT, <2
3639 |.endif
3640 | // RA is an integer, RD is a number. Convert RA to a number.
3641 |.if FPU
3642 |. lwc1 FTMP0, LO(RA)
3643 | ldc1 FTMP2, 0(RD)
3644 | b <4
3645 | cvt.d.w FTMP0, FTMP0
3646 |.else
3647 |. sextw CARG1, CARG1
3648 | bal ->vm_sfi2d_1
3649 |. nop
3650 | b <4
3651 |. nop
3652 |.endif
3653 |
3654 |.if FFI
3655 |8:
3656 | li AT, LJ_TCDATA
3657 | bne CARG3, AT, <2
3658 |. nop
3659 | b ->vmeta_equal_cd
3660 |. nop
3661 |9:
3662 | li AT, LJ_TCDATA
3663 | bne CARG4, AT, <2
3664 |. nop
3665 | b ->vmeta_equal_cd
3666 |. nop
3667 |.endif
3668 break;
3669
3670 case BC_ISEQP: case BC_ISNEP:
3671 vk = op == BC_ISEQP;
3672 | // RA = src*8, RD = primitive_type*8 (~), JMP with RD = target
3673 | daddu RA, BASE, RA
3674 | srl TMP1, RD, 3
3675 | ld TMP0, 0(RA)
3676 | lhu TMP2, OFS_RD(PC)
3677 | not TMP1, TMP1
3678 | gettp TMP0, TMP0
3679 | daddiu PC, PC, 4
3680 |.if FFI
3681 | li AT, LJ_TCDATA
3682 | beq TMP0, AT, ->vmeta_equal_cd
3683 |.endif
3684 |. xor TMP0, TMP0, TMP1
3685 | decode_RD4b TMP2
3686 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3687 | addu TMP2, TMP2, TMP3
3688 |.if MIPSR6
3689 if (vk) {
3690 | seleqz TMP2, TMP2, TMP0
3691 } else {
3692 | selnez TMP2, TMP2, TMP0
3693 }
3694 |.else
3695 if (vk) {
3696 | movn TMP2, r0, TMP0
3697 } else {
3698 | movz TMP2, r0, TMP0
3699 }
3700 |.endif
3701 | daddu PC, PC, TMP2
3702 | ins_next
3703 break;
3704
3705 /* -- Unary test and copy ops ------------------------------------------- */
3706
3707 case BC_ISTC: case BC_ISFC: case BC_IST: case BC_ISF:
3708 | // RA = dst*8 or unused, RD = src*8, JMP with RD = target
3709 | daddu RD, BASE, RD
3710 | lhu TMP2, OFS_RD(PC)
3711 | ld TMP0, 0(RD)
3712 | daddiu PC, PC, 4
3713 | gettp TMP0, TMP0
3714 | sltiu TMP0, TMP0, LJ_TISTRUECOND
3715 if (op == BC_IST || op == BC_ISF) {
3716 | decode_RD4b TMP2
3717 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3718 | addu TMP2, TMP2, TMP3
3719 |.if MIPSR6
3720 if (op == BC_IST) {
3721 | selnez TMP2, TMP2, TMP0;
3722 } else {
3723 | seleqz TMP2, TMP2, TMP0;
3724 }
3725 |.else
3726 if (op == BC_IST) {
3727 | movz TMP2, r0, TMP0
3728 } else {
3729 | movn TMP2, r0, TMP0
3730 }
3731 |.endif
3732 | daddu PC, PC, TMP2
3733 } else {
3734 | ld CRET1, 0(RD)
3735 if (op == BC_ISTC) {
3736 | beqz TMP0, >1
3737 } else {
3738 | bnez TMP0, >1
3739 }
3740 |. daddu RA, BASE, RA
3741 | decode_RD4b TMP2
3742 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
3743 | addu TMP2, TMP2, TMP3
3744 | sd CRET1, 0(RA)
3745 | daddu PC, PC, TMP2
3746 |1:
3747 }
3748 | ins_next
3749 break;
3750
3751 case BC_ISTYPE:
3752 | // RA = src*8, RD = -type*8
3753 | daddu TMP2, BASE, RA
3754 | srl TMP1, RD, 3
3755 | ld TMP0, 0(TMP2)
3756 | ins_next1
3757 | gettp TMP0, TMP0
3758 | daddu AT, TMP0, TMP1
3759 | bnez AT, ->vmeta_istype
3760 |. ins_next2
3761 break;
3762 case BC_ISNUM:
3763 | // RA = src*8, RD = -(TISNUM-1)*8
3764 | daddu TMP2, BASE, RA
3765 | ld TMP0, 0(TMP2)
3766 | ins_next1
3767 | checknum TMP0, ->vmeta_istype
3768 |. ins_next2
3769 break;
3770
3771 /* -- Unary ops --------------------------------------------------------- */
3772
3773 case BC_MOV:
3774 | // RA = dst*8, RD = src*8
3775 | daddu RD, BASE, RD
3776 | daddu RA, BASE, RA
3777 | ld CRET1, 0(RD)
3778 | ins_next1
3779 | sd CRET1, 0(RA)
3780 | ins_next2
3781 break;
3782 case BC_NOT:
3783 | // RA = dst*8, RD = src*8
3784 | daddu RD, BASE, RD
3785 | daddu RA, BASE, RA
3786 | ld TMP0, 0(RD)
3787 | li AT, LJ_TTRUE
3788 | gettp TMP0, TMP0
3789 | sltu TMP0, AT, TMP0
3790 | addiu TMP0, TMP0, 1
3791 | dsll TMP0, TMP0, 47
3792 | not TMP0, TMP0
3793 | ins_next1
3794 | sd TMP0, 0(RA)
3795 | ins_next2
3796 break;
3797 case BC_UNM:
3798 | // RA = dst*8, RD = src*8
3799 | daddu RB, BASE, RD
3800 | ld CARG1, 0(RB)
3801 | daddu RA, BASE, RA
3802 | gettp CARG3, CARG1
3803 | bne CARG3, TISNUM, >2
3804 |. lui TMP1, 0x8000
3805 | sextw CARG1, CARG1
3806 | beq CARG1, TMP1, ->vmeta_unm // Meta handler deals with -2^31.
3807 |. negu CARG1, CARG1
3808 | beqz CARG1, >3
3809 |. zextw CARG1, CARG1
3810 | settp CARG1, TISNUM
3811 |1:
3812 | ins_next1
3813 | sd CARG1, 0(RA)
3814 | ins_next2
3815 |2:
3816 | sltiu AT, CARG3, LJ_TISNUM
3817 | beqz AT, ->vmeta_unm
3818 |. dsll TMP1, TMP1, 32
3819 | b <1
3820 |. xor CARG1, CARG1, TMP1
3821 |3:
3822 | b <1
3823 |. dsll CARG1, TMP1, 32
3824 break;
3825 case BC_LEN:
3826 | // RA = dst*8, RD = src*8
3827 | daddu CARG2, BASE, RD
3828 | daddu RA, BASE, RA
3829 | ld TMP0, 0(CARG2)
3830 | gettp TMP1, TMP0
3831 | daddiu AT, TMP1, -LJ_TSTR
3832 | bnez AT, >2
3833 |. cleartp STR:CARG1, TMP0
3834 | lw CRET1, STR:CARG1->len
3835 |1:
3836 | settp CRET1, TISNUM
3837 | ins_next1
3838 | sd CRET1, 0(RA)
3839 | ins_next2
3840 |2:
3841 | daddiu AT, TMP1, -LJ_TTAB
3842 | bnez AT, ->vmeta_len
3843 |. nop
3844#if LJ_52
3845 | ld TAB:TMP2, TAB:CARG1->metatable
3846 | bnez TAB:TMP2, >9
3847 |. nop
3848 |3:
3849#endif
3850 |->BC_LEN_Z:
3851 | load_got lj_tab_len
3852 | call_intern lj_tab_len // (GCtab *t)
3853 |. nop
3854 | // Returns uint32_t (but less than 2^31).
3855 | b <1
3856 |. nop
3857#if LJ_52
3858 |9:
3859 | lbu TMP0, TAB:TMP2->nomm
3860 | andi TMP0, TMP0, 1<<MM_len
3861 | bnez TMP0, <3 // 'no __len' flag set: done.
3862 |. nop
3863 | b ->vmeta_len
3864 |. nop
3865#endif
3866 break;
3867
3868 /* -- Binary ops -------------------------------------------------------- */
3869
3870 |.macro fpmod, a, b, c
3871 | bal ->vm_floor // floor(b/c)
3872 |. div.d FARG1, b, c
3873 | mul.d a, FRET1, c
3874 | sub.d a, b, a // b - floor(b/c)*c
3875 |.endmacro
3876
3877 |.macro sfpmod
3878 | daddiu sp, sp, -16
3879 |
3880 | load_got __divdf3
3881 | sd CARG1, 0(sp)
3882 | call_extern
3883 |. sd CARG2, 8(sp)
3884 |
3885 | load_got floor
3886 | call_extern
3887 |. move CARG1, CRET1
3888 |
3889 | load_got __muldf3
3890 | move CARG1, CRET1
3891 | call_extern
3892 |. ld CARG2, 8(sp)
3893 |
3894 | load_got __subdf3
3895 | ld CARG1, 0(sp)
3896 | call_extern
3897 |. move CARG2, CRET1
3898 |
3899 | daddiu sp, sp, 16
3900 |.endmacro
3901
3902 |.macro ins_arithpre, label
3903 ||vk = ((int)op - BC_ADDVN) / (BC_ADDNV-BC_ADDVN);
3904 | // RA = dst*8, RB = src1*8, RC = src2*8 | num_const*8
3905 ||switch (vk) {
3906 ||case 0:
3907 | decode_RB8a RB, INS
3908 | decode_RB8b RB
3909 | decode_RDtoRC8 RC, RD
3910 | // RA = dst*8, RB = src1*8, RC = num_const*8
3911 | daddu RB, BASE, RB
3912 |.if "label" ~= "none"
3913 | b label
3914 |.endif
3915 |. daddu RC, KBASE, RC
3916 || break;
3917 ||case 1:
3918 | decode_RB8a RC, INS
3919 | decode_RB8b RC
3920 | decode_RDtoRC8 RB, RD
3921 | // RA = dst*8, RB = num_const*8, RC = src1*8
3922 | daddu RC, BASE, RC
3923 |.if "label" ~= "none"
3924 | b label
3925 |.endif
3926 |. daddu RB, KBASE, RB
3927 || break;
3928 ||default:
3929 | decode_RB8a RB, INS
3930 | decode_RB8b RB
3931 | decode_RDtoRC8 RC, RD
3932 | // RA = dst*8, RB = src1*8, RC = src2*8
3933 | daddu RB, BASE, RB
3934 |.if "label" ~= "none"
3935 | b label
3936 |.endif
3937 |. daddu RC, BASE, RC
3938 || break;
3939 ||}
3940 |.endmacro
3941 |
3942 |.macro ins_arith, intins, fpins, fpcall, label
3943 | ins_arithpre none
3944 |
3945 |.if "label" ~= "none"
3946 |label:
3947 |.endif
3948 |
3949 |// Used in 5.
3950 | ld CARG1, 0(RB)
3951 | ld CARG2, 0(RC)
3952 | gettp TMP0, CARG1
3953 | gettp TMP1, CARG2
3954 |
3955 |.if "intins" ~= "div"
3956 |
3957 | // Check for two integers.
3958 | sextw CARG3, CARG1
3959 | bne TMP0, TISNUM, >5
3960 |. sextw CARG4, CARG2
3961 | bne TMP1, TISNUM, >5
3962 |
3963 |.if "intins" == "addu"
3964 |. intins CRET1, CARG3, CARG4
3965 | xor TMP1, CRET1, CARG3 // ((y^a) & (y^b)) < 0: overflow.
3966 | xor TMP2, CRET1, CARG4
3967 | and TMP1, TMP1, TMP2
3968 | bltz TMP1, ->vmeta_arith
3969 |. daddu RA, BASE, RA
3970 |.elif "intins" == "subu"
3971 |. intins CRET1, CARG3, CARG4
3972 | xor TMP1, CRET1, CARG3 // ((y^a) & (a^b)) < 0: overflow.
3973 | xor TMP2, CARG3, CARG4
3974 | and TMP1, TMP1, TMP2
3975 | bltz TMP1, ->vmeta_arith
3976 |. daddu RA, BASE, RA
3977 |.elif "intins" == "mult"
3978 |.if MIPSR6
3979 |. nop
3980 | mul CRET1, CARG3, CARG4
3981 | muh TMP2, CARG3, CARG4
3982 |.else
3983 |. intins CARG3, CARG4
3984 | mflo CRET1
3985 | mfhi TMP2
3986 |.endif
3987 | sra TMP1, CRET1, 31
3988 | bne TMP1, TMP2, ->vmeta_arith
3989 |. daddu RA, BASE, RA
3990 |.else
3991 |. load_got lj_vm_modi
3992 | beqz CARG4, ->vmeta_arith
3993 |. daddu RA, BASE, RA
3994 | move CARG1, CARG3
3995 | call_extern
3996 |. move CARG2, CARG4
3997 |.endif
3998 |
3999 | zextw CRET1, CRET1
4000 | settp CRET1, TISNUM
4001 | ins_next1
4002 | sd CRET1, 0(RA)
4003 |3:
4004 | ins_next2
4005 |
4006 |.endif
4007 |
4008 |5: // Check for two numbers.
4009 | .FPU ldc1 FTMP0, 0(RB)
4010 | sltu AT, TMP0, TISNUM
4011 | sltu TMP0, TMP1, TISNUM
4012 | .FPU ldc1 FTMP2, 0(RC)
4013 | and AT, AT, TMP0
4014 | beqz AT, ->vmeta_arith
4015 |. daddu RA, BASE, RA
4016 |
4017 |.if FPU
4018 | fpins FRET1, FTMP0, FTMP2
4019 |.elif "fpcall" == "sfpmod"
4020 | sfpmod
4021 |.else
4022 | load_got fpcall
4023 | call_extern
4024 |. nop
4025 |.endif
4026 |
4027 | ins_next1
4028 |.if "intins" ~= "div"
4029 | b <3
4030 |.endif
4031 |.if FPU
4032 |. sdc1 FRET1, 0(RA)
4033 |.else
4034 |. sd CRET1, 0(RA)
4035 |.endif
4036 |.if "intins" == "div"
4037 | ins_next2
4038 |.endif
4039 |
4040 |.endmacro
4041
4042 case BC_ADDVN: case BC_ADDNV: case BC_ADDVV:
4043 | ins_arith addu, add.d, __adddf3, none
4044 break;
4045 case BC_SUBVN: case BC_SUBNV: case BC_SUBVV:
4046 | ins_arith subu, sub.d, __subdf3, none
4047 break;
4048 case BC_MULVN: case BC_MULNV: case BC_MULVV:
4049 | ins_arith mult, mul.d, __muldf3, none
4050 break;
4051 case BC_DIVVN:
4052 | ins_arith div, div.d, __divdf3, ->BC_DIVVN_Z
4053 break;
4054 case BC_DIVNV: case BC_DIVVV:
4055 | ins_arithpre ->BC_DIVVN_Z
4056 break;
4057 case BC_MODVN:
4058 | ins_arith modi, fpmod, sfpmod, ->BC_MODVN_Z
4059 break;
4060 case BC_MODNV: case BC_MODVV:
4061 | ins_arithpre ->BC_MODVN_Z
4062 break;
4063 case BC_POW:
4064 | ins_arithpre none
4065 | ld CARG1, 0(RB)
4066 | ld CARG2, 0(RC)
4067 | gettp TMP0, CARG1
4068 | gettp TMP1, CARG2
4069 | sltiu TMP0, TMP0, LJ_TISNUM
4070 | sltiu TMP1, TMP1, LJ_TISNUM
4071 | and AT, TMP0, TMP1
4072 | load_got pow
4073 | beqz AT, ->vmeta_arith
4074 |. daddu RA, BASE, RA
4075 |.if FPU
4076 | ldc1 FARG1, 0(RB)
4077 | ldc1 FARG2, 0(RC)
4078 |.endif
4079 | call_extern
4080 |. nop
4081 | ins_next1
4082 |.if FPU
4083 | sdc1 FRET1, 0(RA)
4084 |.else
4085 | sd CRET1, 0(RA)
4086 |.endif
4087 | ins_next2
4088 break;
4089
4090 case BC_CAT:
4091 | // RA = dst*8, RB = src_start*8, RC = src_end*8
4092 | decode_RB8a RB, INS
4093 | decode_RB8b RB
4094 | decode_RDtoRC8 RC, RD
4095 | dsubu CARG3, RC, RB
4096 | sd BASE, L->base
4097 | daddu CARG2, BASE, RC
4098 | move MULTRES, RB
4099 |->BC_CAT_Z:
4100 | load_got lj_meta_cat
4101 | srl CARG3, CARG3, 3
4102 | sd PC, SAVE_PC
4103 | call_intern lj_meta_cat // (lua_State *L, TValue *top, int left)
4104 |. move CARG1, L
4105 | // Returns NULL (finished) or TValue * (metamethod).
4106 | bnez CRET1, ->vmeta_binop
4107 |. ld BASE, L->base
4108 | daddu RB, BASE, MULTRES
4109 | ld CRET1, 0(RB)
4110 | daddu RA, BASE, RA
4111 | ins_next1
4112 | sd CRET1, 0(RA)
4113 | ins_next2
4114 break;
4115
4116 /* -- Constant ops ------------------------------------------------------ */
4117
4118 case BC_KSTR:
4119 | // RA = dst*8, RD = str_const*8 (~)
4120 | dsubu TMP1, KBASE, RD
4121 | ins_next1
4122 | li TMP2, LJ_TSTR
4123 | ld TMP0, -8(TMP1) // KBASE-8-str_const*8
4124 | daddu RA, BASE, RA
4125 | settp TMP0, TMP2
4126 | sd TMP0, 0(RA)
4127 | ins_next2
4128 break;
4129 case BC_KCDATA:
4130 |.if FFI
4131 | // RA = dst*8, RD = cdata_const*8 (~)
4132 | dsubu TMP1, KBASE, RD
4133 | ins_next1
4134 | ld TMP0, -8(TMP1) // KBASE-8-cdata_const*8
4135 | li TMP2, LJ_TCDATA
4136 | daddu RA, BASE, RA
4137 | settp TMP0, TMP2
4138 | sd TMP0, 0(RA)
4139 | ins_next2
4140 |.endif
4141 break;
4142 case BC_KSHORT:
4143 | // RA = dst*8, RD = int16_literal*8
4144 | sra RD, INS, 16
4145 | daddu RA, BASE, RA
4146 | zextw RD, RD
4147 | ins_next1
4148 | settp RD, TISNUM
4149 | sd RD, 0(RA)
4150 | ins_next2
4151 break;
4152 case BC_KNUM:
4153 | // RA = dst*8, RD = num_const*8
4154 | daddu RD, KBASE, RD
4155 | daddu RA, BASE, RA
4156 | ld CRET1, 0(RD)
4157 | ins_next1
4158 | sd CRET1, 0(RA)
4159 | ins_next2
4160 break;
4161 case BC_KPRI:
4162 | // RA = dst*8, RD = primitive_type*8 (~)
4163 | daddu RA, BASE, RA
4164 | dsll TMP0, RD, 44
4165 | not TMP0, TMP0
4166 | ins_next1
4167 | sd TMP0, 0(RA)
4168 | ins_next2
4169 break;
4170 case BC_KNIL:
4171 | // RA = base*8, RD = end*8
4172 | daddu RA, BASE, RA
4173 | sd TISNIL, 0(RA)
4174 | daddiu RA, RA, 8
4175 | daddu RD, BASE, RD
4176 |1:
4177 | sd TISNIL, 0(RA)
4178 | slt AT, RA, RD
4179 | bnez AT, <1
4180 |. daddiu RA, RA, 8
4181 | ins_next_
4182 break;
4183
4184 /* -- Upvalue and function ops ------------------------------------------ */
4185
4186 case BC_UGET:
4187 | // RA = dst*8, RD = uvnum*8
4188 | ld LFUNC:RB, FRAME_FUNC(BASE)
4189 | daddu RA, BASE, RA
4190 | cleartp LFUNC:RB
4191 | daddu RD, RD, LFUNC:RB
4192 | ld UPVAL:RB, LFUNC:RD->uvptr
4193 | ins_next1
4194 | ld TMP1, UPVAL:RB->v
4195 | ld CRET1, 0(TMP1)
4196 | sd CRET1, 0(RA)
4197 | ins_next2
4198 break;
4199 case BC_USETV:
4200 | // RA = uvnum*8, RD = src*8
4201 | ld LFUNC:RB, FRAME_FUNC(BASE)
4202 | daddu RD, BASE, RD
4203 | cleartp LFUNC:RB
4204 | daddu RA, RA, LFUNC:RB
4205 | ld UPVAL:RB, LFUNC:RA->uvptr
4206 | ld CRET1, 0(RD)
4207 | lbu TMP3, UPVAL:RB->marked
4208 | ld CARG2, UPVAL:RB->v
4209 | andi TMP3, TMP3, LJ_GC_BLACK // isblack(uv)
4210 | lbu TMP0, UPVAL:RB->closed
4211 | gettp TMP2, CRET1
4212 | sd CRET1, 0(CARG2)
4213 | li AT, LJ_GC_BLACK|1
4214 | or TMP3, TMP3, TMP0
4215 | beq TMP3, AT, >2 // Upvalue is closed and black?
4216 |. daddiu TMP2, TMP2, -(LJ_TNUMX+1)
4217 |1:
4218 | ins_next
4219 |
4220 |2: // Check if new value is collectable.
4221 | sltiu AT, TMP2, LJ_TISGCV - (LJ_TNUMX+1)
4222 | beqz AT, <1 // tvisgcv(v)
4223 |. cleartp GCOBJ:CRET1, CRET1
4224 | lbu TMP3, GCOBJ:CRET1->gch.marked
4225 | andi TMP3, TMP3, LJ_GC_WHITES // iswhite(v)
4226 | beqz TMP3, <1
4227 |. load_got lj_gc_barrieruv
4228 | // Crossed a write barrier. Move the barrier forward.
4229 | call_intern lj_gc_barrieruv // (global_State *g, TValue *tv)
4230 |. daddiu CARG1, DISPATCH, GG_DISP2G
4231 | b <1
4232 |. nop
4233 break;
4234 case BC_USETS:
4235 | // RA = uvnum*8, RD = str_const*8 (~)
4236 | ld LFUNC:RB, FRAME_FUNC(BASE)
4237 | dsubu TMP1, KBASE, RD
4238 | cleartp LFUNC:RB
4239 | daddu RA, RA, LFUNC:RB
4240 | ld UPVAL:RB, LFUNC:RA->uvptr
4241 | ld STR:TMP1, -8(TMP1) // KBASE-8-str_const*8
4242 | lbu TMP2, UPVAL:RB->marked
4243 | ld CARG2, UPVAL:RB->v
4244 | lbu TMP3, STR:TMP1->marked
4245 | andi AT, TMP2, LJ_GC_BLACK // isblack(uv)
4246 | lbu TMP2, UPVAL:RB->closed
4247 | li TMP0, LJ_TSTR
4248 | settp TMP1, TMP0
4249 | bnez AT, >2
4250 |. sd TMP1, 0(CARG2)
4251 |1:
4252 | ins_next
4253 |
4254 |2: // Check if string is white and ensure upvalue is closed.
4255 | beqz TMP2, <1
4256 |. andi AT, TMP3, LJ_GC_WHITES // iswhite(str)
4257 | beqz AT, <1
4258 |. load_got lj_gc_barrieruv
4259 | // Crossed a write barrier. Move the barrier forward.
4260 | call_intern lj_gc_barrieruv // (global_State *g, TValue *tv)
4261 |. daddiu CARG1, DISPATCH, GG_DISP2G
4262 | b <1
4263 |. nop
4264 break;
4265 case BC_USETN:
4266 | // RA = uvnum*8, RD = num_const*8
4267 | ld LFUNC:RB, FRAME_FUNC(BASE)
4268 | daddu RD, KBASE, RD
4269 | cleartp LFUNC:RB
4270 | daddu RA, RA, LFUNC:RB
4271 | ld UPVAL:RB, LFUNC:RA->uvptr
4272 | ld CRET1, 0(RD)
4273 | ld TMP1, UPVAL:RB->v
4274 | ins_next1
4275 | sd CRET1, 0(TMP1)
4276 | ins_next2
4277 break;
4278 case BC_USETP:
4279 | // RA = uvnum*8, RD = primitive_type*8 (~)
4280 | ld LFUNC:RB, FRAME_FUNC(BASE)
4281 | dsll TMP0, RD, 44
4282 | cleartp LFUNC:RB
4283 | daddu RA, RA, LFUNC:RB
4284 | not TMP0, TMP0
4285 | ld UPVAL:RB, LFUNC:RA->uvptr
4286 | ins_next1
4287 | ld TMP1, UPVAL:RB->v
4288 | sd TMP0, 0(TMP1)
4289 | ins_next2
4290 break;
4291
4292 case BC_UCLO:
4293 | // RA = level*8, RD = target
4294 | ld TMP2, L->openupval
4295 | branch_RD // Do this first since RD is not saved.
4296 | load_got lj_func_closeuv
4297 | sd BASE, L->base
4298 | beqz TMP2, >1
4299 |. move CARG1, L
4300 | call_intern lj_func_closeuv // (lua_State *L, TValue *level)
4301 |. daddu CARG2, BASE, RA
4302 | ld BASE, L->base
4303 |1:
4304 | ins_next
4305 break;
4306
4307 case BC_FNEW:
4308 | // RA = dst*8, RD = proto_const*8 (~) (holding function prototype)
4309 | load_got lj_func_newL_gc
4310 | dsubu TMP1, KBASE, RD
4311 | ld CARG3, FRAME_FUNC(BASE)
4312 | ld CARG2, -8(TMP1) // KBASE-8-tab_const*8
4313 | sd BASE, L->base
4314 | sd PC, SAVE_PC
4315 | cleartp CARG3
4316 | // (lua_State *L, GCproto *pt, GCfuncL *parent)
4317 | call_intern lj_func_newL_gc
4318 |. move CARG1, L
4319 | // Returns GCfuncL *.
4320 | li TMP0, LJ_TFUNC
4321 | ld BASE, L->base
4322 | ins_next1
4323 | settp CRET1, TMP0
4324 | daddu RA, BASE, RA
4325 | sd CRET1, 0(RA)
4326 | ins_next2
4327 break;
4328
4329 /* -- Table ops --------------------------------------------------------- */
4330
4331 case BC_TNEW:
4332 case BC_TDUP:
4333 | // RA = dst*8, RD = (hbits|asize)*8 | tab_const*8 (~)
4334 | ld TMP0, DISPATCH_GL(gc.total)(DISPATCH)
4335 | ld TMP1, DISPATCH_GL(gc.threshold)(DISPATCH)
4336 | sd BASE, L->base
4337 | sd PC, SAVE_PC
4338 | sltu AT, TMP0, TMP1
4339 | beqz AT, >5
4340 |1:
4341 if (op == BC_TNEW) {
4342 | load_got lj_tab_new
4343 | srl CARG2, RD, 3
4344 | andi CARG2, CARG2, 0x7ff
4345 | li TMP0, 0x801
4346 | addiu AT, CARG2, -0x7ff
4347 | srl CARG3, RD, 14
4348 |.if MIPSR6
4349 | seleqz TMP0, TMP0, AT
4350 | selnez CARG2, CARG2, AT
4351 | or CARG2, CARG2, TMP0
4352 |.else
4353 | movz CARG2, TMP0, AT
4354 |.endif
4355 | // (lua_State *L, int32_t asize, uint32_t hbits)
4356 | call_intern lj_tab_new
4357 |. move CARG1, L
4358 | // Returns Table *.
4359 } else {
4360 | load_got lj_tab_dup
4361 | dsubu TMP1, KBASE, RD
4362 | move CARG1, L
4363 | call_intern lj_tab_dup // (lua_State *L, Table *kt)
4364 |. ld CARG2, -8(TMP1) // KBASE-8-str_const*8
4365 | // Returns Table *.
4366 }
4367 | li TMP0, LJ_TTAB
4368 | ld BASE, L->base
4369 | ins_next1
4370 | daddu RA, BASE, RA
4371 | settp CRET1, TMP0
4372 | sd CRET1, 0(RA)
4373 | ins_next2
4374 |5:
4375 | load_got lj_gc_step_fixtop
4376 | move MULTRES, RD
4377 | call_intern lj_gc_step_fixtop // (lua_State *L)
4378 |. move CARG1, L
4379 | b <1
4380 |. move RD, MULTRES
4381 break;
4382
4383 case BC_GGET:
4384 | // RA = dst*8, RD = str_const*8 (~)
4385 case BC_GSET:
4386 | // RA = src*8, RD = str_const*8 (~)
4387 | ld LFUNC:TMP2, FRAME_FUNC(BASE)
4388 | dsubu TMP1, KBASE, RD
4389 | ld STR:RC, -8(TMP1) // KBASE-8-str_const*8
4390 | cleartp LFUNC:TMP2
4391 | ld TAB:RB, LFUNC:TMP2->env
4392 if (op == BC_GGET) {
4393 | b ->BC_TGETS_Z
4394 } else {
4395 | b ->BC_TSETS_Z
4396 }
4397 |. daddu RA, BASE, RA
4398 break;
4399
4400 case BC_TGETV:
4401 | // RA = dst*8, RB = table*8, RC = key*8
4402 | decode_RB8a RB, INS
4403 | decode_RB8b RB
4404 | decode_RDtoRC8 RC, RD
4405 | daddu CARG2, BASE, RB
4406 | daddu CARG3, BASE, RC
4407 | ld TAB:RB, 0(CARG2)
4408 | ld TMP2, 0(CARG3)
4409 | daddu RA, BASE, RA
4410 | checktab TAB:RB, ->vmeta_tgetv
4411 | gettp TMP3, TMP2
4412 | bne TMP3, TISNUM, >5 // Integer key?
4413 |. lw TMP0, TAB:RB->asize
4414 | sextw TMP2, TMP2
4415 | ld TMP1, TAB:RB->array
4416 | sltu AT, TMP2, TMP0
4417 | sll TMP2, TMP2, 3
4418 | beqz AT, ->vmeta_tgetv // Integer key and in array part?
4419 |. daddu TMP2, TMP1, TMP2
4420 | ld AT, 0(TMP2)
4421 | beq AT, TISNIL, >2
4422 |. ld CRET1, 0(TMP2)
4423 |1:
4424 | ins_next1
4425 | sd CRET1, 0(RA)
4426 | ins_next2
4427 |
4428 |2: // Check for __index if table value is nil.
4429 | ld TAB:TMP2, TAB:RB->metatable
4430 | beqz TAB:TMP2, <1 // No metatable: done.
4431 |. nop
4432 | lbu TMP0, TAB:TMP2->nomm
4433 | andi TMP0, TMP0, 1<<MM_index
4434 | bnez TMP0, <1 // 'no __index' flag set: done.
4435 |. nop
4436 | b ->vmeta_tgetv
4437 |. nop
4438 |
4439 |5:
4440 | li AT, LJ_TSTR
4441 | bne TMP3, AT, ->vmeta_tgetv
4442 |. cleartp RC, TMP2
4443 | b ->BC_TGETS_Z // String key?
4444 |. nop
4445 break;
4446 case BC_TGETS:
4447 | // RA = dst*8, RB = table*8, RC = str_const*8 (~)
4448 | decode_RB8a RB, INS
4449 | decode_RB8b RB
4450 | decode_RC8a RC, INS
4451 | daddu CARG2, BASE, RB
4452 | decode_RC8b RC
4453 | ld TAB:RB, 0(CARG2)
4454 | dsubu CARG3, KBASE, RC
4455 | daddu RA, BASE, RA
4456 | ld STR:RC, -8(CARG3) // KBASE-8-str_const*8
4457 | checktab TAB:RB, ->vmeta_tgets1
4458 |->BC_TGETS_Z:
4459 | // TAB:RB = GCtab *, STR:RC = GCstr *, RA = dst*8
4460 | lw TMP0, TAB:RB->hmask
4461 | lw TMP1, STR:RC->sid
4462 | ld NODE:TMP2, TAB:RB->node
4463 | and TMP1, TMP1, TMP0 // idx = str->sid & tab->hmask
4464 | sll TMP0, TMP1, 5
4465 | sll TMP1, TMP1, 3
4466 | subu TMP1, TMP0, TMP1
4467 | li TMP3, LJ_TSTR
4468 | daddu NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
4469 | settp STR:RC, TMP3 // Tagged key to look for.
4470 |1:
4471 | ld CARG1, NODE:TMP2->key
4472 | ld CRET1, NODE:TMP2->val
4473 | ld NODE:TMP1, NODE:TMP2->next
4474 | bne CARG1, RC, >4
4475 |. ld TAB:TMP3, TAB:RB->metatable
4476 | beq CRET1, TISNIL, >5 // Key found, but nil value?
4477 |. nop
4478 |3:
4479 | ins_next1
4480 | sd CRET1, 0(RA)
4481 | ins_next2
4482 |
4483 |4: // Follow hash chain.
4484 | bnez NODE:TMP1, <1
4485 |. move NODE:TMP2, NODE:TMP1
4486 | // End of hash chain: key not found, nil result.
4487 |
4488 |5: // Check for __index if table value is nil.
4489 | beqz TAB:TMP3, <3 // No metatable: done.
4490 |. move CRET1, TISNIL
4491 | lbu TMP0, TAB:TMP3->nomm
4492 | andi TMP0, TMP0, 1<<MM_index
4493 | bnez TMP0, <3 // 'no __index' flag set: done.
4494 |. nop
4495 | b ->vmeta_tgets
4496 |. nop
4497 break;
4498 case BC_TGETB:
4499 | // RA = dst*8, RB = table*8, RC = index*8
4500 | decode_RB8a RB, INS
4501 | decode_RB8b RB
4502 | daddu CARG2, BASE, RB
4503 | decode_RDtoRC8 RC, RD
4504 | ld TAB:RB, 0(CARG2)
4505 | daddu RA, BASE, RA
4506 | srl TMP0, RC, 3
4507 | checktab TAB:RB, ->vmeta_tgetb
4508 | lw TMP1, TAB:RB->asize
4509 | ld TMP2, TAB:RB->array
4510 | sltu AT, TMP0, TMP1
4511 | beqz AT, ->vmeta_tgetb
4512 |. daddu RC, TMP2, RC
4513 | ld AT, 0(RC)
4514 | beq AT, TISNIL, >5
4515 |. ld CRET1, 0(RC)
4516 |1:
4517 | ins_next1
4518 | sd CRET1, 0(RA)
4519 | ins_next2
4520 |
4521 |5: // Check for __index if table value is nil.
4522 | ld TAB:TMP2, TAB:RB->metatable
4523 | beqz TAB:TMP2, <1 // No metatable: done.
4524 |. nop
4525 | lbu TMP1, TAB:TMP2->nomm
4526 | andi TMP1, TMP1, 1<<MM_index
4527 | bnez TMP1, <1 // 'no __index' flag set: done.
4528 |. nop
4529 | b ->vmeta_tgetb // Caveat: preserve TMP0 and CARG2!
4530 |. nop
4531 break;
4532 case BC_TGETR:
4533 | // RA = dst*8, RB = table*8, RC = key*8
4534 | decode_RB8a RB, INS
4535 | decode_RB8b RB
4536 | decode_RDtoRC8 RC, RD
4537 | daddu RB, BASE, RB
4538 | daddu RC, BASE, RC
4539 | ld TAB:CARG1, 0(RB)
4540 | lw CARG2, LO(RC)
4541 | daddu RA, BASE, RA
4542 | cleartp TAB:CARG1
4543 | lw TMP0, TAB:CARG1->asize
4544 | ld TMP1, TAB:CARG1->array
4545 | sltu AT, CARG2, TMP0
4546 | sll TMP2, CARG2, 3
4547 | beqz AT, ->vmeta_tgetr // In array part?
4548 |. daddu CRET1, TMP1, TMP2
4549 | ld CARG2, 0(CRET1)
4550 |->BC_TGETR_Z:
4551 | ins_next1
4552 | sd CARG2, 0(RA)
4553 | ins_next2
4554 break;
4555
4556 case BC_TSETV:
4557 | // RA = src*8, RB = table*8, RC = key*8
4558 | decode_RB8a RB, INS
4559 | decode_RB8b RB
4560 | decode_RDtoRC8 RC, RD
4561 | daddu CARG2, BASE, RB
4562 | daddu CARG3, BASE, RC
4563 | ld RB, 0(CARG2)
4564 | ld TMP2, 0(CARG3)
4565 | daddu RA, BASE, RA
4566 | checktab RB, ->vmeta_tsetv
4567 | checkint TMP2, >5
4568 |. sextw RC, TMP2
4569 | lw TMP0, TAB:RB->asize
4570 | ld TMP1, TAB:RB->array
4571 | sltu AT, RC, TMP0
4572 | sll TMP2, RC, 3
4573 | beqz AT, ->vmeta_tsetv // Integer key and in array part?
4574 |. daddu TMP1, TMP1, TMP2
4575 | ld TMP0, 0(TMP1)
4576 | lbu TMP3, TAB:RB->marked
4577 | beq TMP0, TISNIL, >3
4578 |. ld CRET1, 0(RA)
4579 |1:
4580 | andi AT, TMP3, LJ_GC_BLACK // isblack(table)
4581 | bnez AT, >7
4582 |. sd CRET1, 0(TMP1)
4583 |2:
4584 | ins_next
4585 |
4586 |3: // Check for __newindex if previous value is nil.
4587 | ld TAB:TMP2, TAB:RB->metatable
4588 | beqz TAB:TMP2, <1 // No metatable: done.
4589 |. nop
4590 | lbu TMP2, TAB:TMP2->nomm
4591 | andi TMP2, TMP2, 1<<MM_newindex
4592 | bnez TMP2, <1 // 'no __newindex' flag set: done.
4593 |. nop
4594 | b ->vmeta_tsetv
4595 |. nop
4596 |
4597 |5:
4598 | gettp AT, TMP2
4599 | daddiu AT, AT, -LJ_TSTR
4600 | bnez AT, ->vmeta_tsetv
4601 |. nop
4602 | b ->BC_TSETS_Z // String key?
4603 |. cleartp STR:RC, TMP2
4604 |
4605 |7: // Possible table write barrier for the value. Skip valiswhite check.
4606 | barrierback TAB:RB, TMP3, TMP0, <2
4607 break;
4608 case BC_TSETS:
4609 | // RA = src*8, RB = table*8, RC = str_const*8 (~)
4610 | decode_RB8a RB, INS
4611 | decode_RB8b RB
4612 | daddu CARG2, BASE, RB
4613 | decode_RC8a RC, INS
4614 | ld TAB:RB, 0(CARG2)
4615 | decode_RC8b RC
4616 | dsubu CARG3, KBASE, RC
4617 | ld RC, -8(CARG3) // KBASE-8-str_const*8
4618 | daddu RA, BASE, RA
4619 | cleartp STR:RC
4620 | checktab TAB:RB, ->vmeta_tsets1
4621 |->BC_TSETS_Z:
4622 | // TAB:RB = GCtab *, STR:RC = GCstr *, RA = BASE+src*8
4623 | lw TMP0, TAB:RB->hmask
4624 | lw TMP1, STR:RC->sid
4625 | ld NODE:TMP2, TAB:RB->node
4626 | sb r0, TAB:RB->nomm // Clear metamethod cache.
4627 | and TMP1, TMP1, TMP0 // idx = str->sid & tab->hmask
4628 | sll TMP0, TMP1, 5
4629 | sll TMP1, TMP1, 3
4630 | subu TMP1, TMP0, TMP1
4631 | li TMP3, LJ_TSTR
4632 | daddu NODE:TMP2, NODE:TMP2, TMP1 // node = tab->node + (idx*32-idx*8)
4633 | settp STR:RC, TMP3 // Tagged key to look for.
4634 |.if FPU
4635 | ldc1 FTMP0, 0(RA)
4636 |.else
4637 | ld CRET1, 0(RA)
4638 |.endif
4639 |1:
4640 | ld TMP0, NODE:TMP2->key
4641 | ld CARG2, NODE:TMP2->val
4642 | ld NODE:TMP1, NODE:TMP2->next
4643 | bne TMP0, RC, >5
4644 |. lbu TMP3, TAB:RB->marked
4645 | beq CARG2, TISNIL, >4 // Key found, but nil value?
4646 |. ld TAB:TMP0, TAB:RB->metatable
4647 |2:
4648 | andi AT, TMP3, LJ_GC_BLACK // isblack(table)
4649 | bnez AT, >7
4650 |.if FPU
4651 |. sdc1 FTMP0, NODE:TMP2->val
4652 |.else
4653 |. sd CRET1, NODE:TMP2->val
4654 |.endif
4655 |3:
4656 | ins_next
4657 |
4658 |4: // Check for __newindex if previous value is nil.
4659 | beqz TAB:TMP0, <2 // No metatable: done.
4660 |. nop
4661 | lbu TMP0, TAB:TMP0->nomm
4662 | andi TMP0, TMP0, 1<<MM_newindex
4663 | bnez TMP0, <2 // 'no __newindex' flag set: done.
4664 |. nop
4665 | b ->vmeta_tsets
4666 |. nop
4667 |
4668 |5: // Follow hash chain.
4669 | bnez NODE:TMP1, <1
4670 |. move NODE:TMP2, NODE:TMP1
4671 | // End of hash chain: key not found, add a new one
4672 |
4673 | // But check for __newindex first.
4674 | ld TAB:TMP2, TAB:RB->metatable
4675 | beqz TAB:TMP2, >6 // No metatable: continue.
4676 |. daddiu CARG3, DISPATCH, DISPATCH_GL(tmptv)
4677 | lbu TMP0, TAB:TMP2->nomm
4678 | andi TMP0, TMP0, 1<<MM_newindex
4679 | beqz TMP0, ->vmeta_tsets // 'no __newindex' flag NOT set: check.
4680 |6:
4681 | load_got lj_tab_newkey
4682 | sd RC, 0(CARG3)
4683 | sd BASE, L->base
4684 | move CARG2, TAB:RB
4685 | sd PC, SAVE_PC
4686 | call_intern lj_tab_newkey // (lua_State *L, GCtab *t, TValue *k
4687 |. move CARG1, L
4688 | // Returns TValue *.
4689 | ld BASE, L->base
4690 |.if FPU
4691 | b <3 // No 2nd write barrier needed.
4692 |. sdc1 FTMP0, 0(CRET1)
4693 |.else
4694 | ld CARG1, 0(RA)
4695 | b <3 // No 2nd write barrier needed.
4696 |. sd CARG1, 0(CRET1)
4697 |.endif
4698 |
4699 |7: // Possible table write barrier for the value. Skip valiswhite check.
4700 | barrierback TAB:RB, TMP3, TMP0, <3
4701 break;
4702 case BC_TSETB:
4703 | // RA = src*8, RB = table*8, RC = index*8
4704 | decode_RB8a RB, INS
4705 | decode_RB8b RB
4706 | daddu CARG2, BASE, RB
4707 | decode_RDtoRC8 RC, RD
4708 | ld TAB:RB, 0(CARG2)
4709 | daddu RA, BASE, RA
4710 | srl TMP0, RC, 3
4711 | checktab RB, ->vmeta_tsetb
4712 | lw TMP1, TAB:RB->asize
4713 | ld TMP2, TAB:RB->array
4714 | sltu AT, TMP0, TMP1
4715 | beqz AT, ->vmeta_tsetb
4716 |. daddu RC, TMP2, RC
4717 | ld TMP1, 0(RC)
4718 | lbu TMP3, TAB:RB->marked
4719 | beq TMP1, TISNIL, >5
4720 |1:
4721 |. ld CRET1, 0(RA)
4722 | andi AT, TMP3, LJ_GC_BLACK // isblack(table)
4723 | bnez AT, >7
4724 |. sd CRET1, 0(RC)
4725 |2:
4726 | ins_next
4727 |
4728 |5: // Check for __newindex if previous value is nil.
4729 | ld TAB:TMP2, TAB:RB->metatable
4730 | beqz TAB:TMP2, <1 // No metatable: done.
4731 |. nop
4732 | lbu TMP1, TAB:TMP2->nomm
4733 | andi TMP1, TMP1, 1<<MM_newindex
4734 | bnez TMP1, <1 // 'no __newindex' flag set: done.
4735 |. nop
4736 | b ->vmeta_tsetb // Caveat: preserve TMP0 and CARG2!
4737 |. nop
4738 |
4739 |7: // Possible table write barrier for the value. Skip valiswhite check.
4740 | barrierback TAB:RB, TMP3, TMP0, <2
4741 break;
4742 case BC_TSETR:
4743 | // RA = dst*8, RB = table*8, RC = key*8
4744 | decode_RB8a RB, INS
4745 | decode_RB8b RB
4746 | decode_RDtoRC8 RC, RD
4747 | daddu CARG1, BASE, RB
4748 | daddu CARG3, BASE, RC
4749 | ld TAB:CARG2, 0(CARG1)
4750 | lw CARG3, LO(CARG3)
4751 | cleartp TAB:CARG2
4752 | lbu TMP3, TAB:CARG2->marked
4753 | lw TMP0, TAB:CARG2->asize
4754 | ld TMP1, TAB:CARG2->array
4755 | andi AT, TMP3, LJ_GC_BLACK // isblack(table)
4756 | bnez AT, >7
4757 |. daddu RA, BASE, RA
4758 |2:
4759 | sltu AT, CARG3, TMP0
4760 | sll TMP2, CARG3, 3
4761 | beqz AT, ->vmeta_tsetr // In array part?
4762 |. daddu CRET1, TMP1, TMP2
4763 |->BC_TSETR_Z:
4764 | ld CARG1, 0(RA)
4765 | ins_next1
4766 | sd CARG1, 0(CRET1)
4767 | ins_next2
4768 |
4769 |7: // Possible table write barrier for the value. Skip valiswhite check.
4770 | barrierback TAB:CARG2, TMP3, CRET1, <2
4771 break;
4772
4773 case BC_TSETM:
4774 | // RA = base*8 (table at base-1), RD = num_const*8 (start index)
4775 | daddu RA, BASE, RA
4776 |1:
4777 | daddu TMP3, KBASE, RD
4778 | ld TAB:CARG2, -8(RA) // Guaranteed to be a table.
4779 | addiu TMP0, MULTRES, -8
4780 | lw TMP3, LO(TMP3) // Integer constant is in lo-word.
4781 | beqz TMP0, >4 // Nothing to copy?
4782 |. srl CARG3, TMP0, 3
4783 | cleartp CARG2
4784 | addu CARG3, CARG3, TMP3
4785 | lw TMP2, TAB:CARG2->asize
4786 | sll TMP1, TMP3, 3
4787 | lbu TMP3, TAB:CARG2->marked
4788 | ld CARG1, TAB:CARG2->array
4789 | sltu AT, TMP2, CARG3
4790 | bnez AT, >5
4791 |. daddu TMP2, RA, TMP0
4792 | daddu TMP1, TMP1, CARG1
4793 | andi TMP0, TMP3, LJ_GC_BLACK // isblack(table)
4794 |3: // Copy result slots to table.
4795 | ld CRET1, 0(RA)
4796 | daddiu RA, RA, 8
4797 | sltu AT, RA, TMP2
4798 | sd CRET1, 0(TMP1)
4799 | bnez AT, <3
4800 |. daddiu TMP1, TMP1, 8
4801 | bnez TMP0, >7
4802 |. nop
4803 |4:
4804 | ins_next
4805 |
4806 |5: // Need to resize array part.
4807 | load_got lj_tab_reasize
4808 | sd BASE, L->base
4809 | sd PC, SAVE_PC
4810 | move BASE, RD
4811 | call_intern lj_tab_reasize // (lua_State *L, GCtab *t, int nasize)
4812 |. move CARG1, L
4813 | // Must not reallocate the stack.
4814 | move RD, BASE
4815 | b <1
4816 |. ld BASE, L->base // Reload BASE for lack of a saved register.
4817 |
4818 |7: // Possible table write barrier for any value. Skip valiswhite check.
4819 | barrierback TAB:CARG2, TMP3, TMP0, <4
4820 break;
4821
4822 /* -- Calls and vararg handling ----------------------------------------- */
4823
4824 case BC_CALLM:
4825 | // RA = base*8, (RB = (nresults+1)*8,) RC = extra_nargs*8
4826 | decode_RDtoRC8 NARGS8:RC, RD
4827 | b ->BC_CALL_Z
4828 |. addu NARGS8:RC, NARGS8:RC, MULTRES
4829 break;
4830 case BC_CALL:
4831 | // RA = base*8, (RB = (nresults+1)*8,) RC = (nargs+1)*8
4832 | decode_RDtoRC8 NARGS8:RC, RD
4833 |->BC_CALL_Z:
4834 | move TMP2, BASE
4835 | daddu BASE, BASE, RA
4836 | ld LFUNC:RB, 0(BASE)
4837 | daddiu BASE, BASE, 16
4838 | addiu NARGS8:RC, NARGS8:RC, -8
4839 | checkfunc RB, ->vmeta_call
4840 | ins_call
4841 break;
4842
4843 case BC_CALLMT:
4844 | // RA = base*8, (RB = 0,) RC = extra_nargs*8
4845 | addu NARGS8:RD, NARGS8:RD, MULTRES // BC_CALLT gets RC from RD.
4846 | // Fall through. Assumes BC_CALLT follows.
4847 break;
4848 case BC_CALLT:
4849 | // RA = base*8, (RB = 0,) RC = (nargs+1)*8
4850 | daddu RA, BASE, RA
4851 | ld RB, 0(RA)
4852 | move NARGS8:RC, RD
4853 | ld TMP1, FRAME_PC(BASE)
4854 | daddiu RA, RA, 16
4855 | addiu NARGS8:RC, NARGS8:RC, -8
4856 | checktp CARG3, RB, -LJ_TFUNC, ->vmeta_callt
4857 |->BC_CALLT_Z:
4858 | andi TMP0, TMP1, FRAME_TYPE // Caveat: preserve TMP0 until the 'or'.
4859 | lbu TMP3, LFUNC:CARG3->ffid
4860 | bnez TMP0, >7
4861 |. xori TMP2, TMP1, FRAME_VARG
4862 |1:
4863 | sd RB, FRAME_FUNC(BASE) // Copy function down, but keep PC.
4864 | sltiu AT, TMP3, 2 // (> FF_C) Calling a fast function?
4865 | move TMP2, BASE
4866 | move RB, CARG3
4867 | beqz NARGS8:RC, >3
4868 |. move TMP3, NARGS8:RC
4869 |2:
4870 | ld CRET1, 0(RA)
4871 | daddiu RA, RA, 8
4872 | addiu TMP3, TMP3, -8
4873 | sd CRET1, 0(TMP2)
4874 | bnez TMP3, <2
4875 |. daddiu TMP2, TMP2, 8
4876 |3:
4877 | or TMP0, TMP0, AT
4878 | beqz TMP0, >5
4879 |. nop
4880 |4:
4881 | ins_callt
4882 |
4883 |5: // Tailcall to a fast function with a Lua frame below.
4884 | lw INS, -4(TMP1)
4885 | decode_RA8a RA, INS
4886 | decode_RA8b RA
4887 | dsubu TMP1, BASE, RA
4888 | ld TMP1, -32(TMP1)
4889 | cleartp LFUNC:TMP1
4890 | ld TMP1, LFUNC:TMP1->pc
4891 | b <4
4892 |. ld KBASE, PC2PROTO(k)(TMP1) // Need to prepare KBASE.
4893 |
4894 |7: // Tailcall from a vararg function.
4895 | andi AT, TMP2, FRAME_TYPEP
4896 | bnez AT, <1 // Vararg frame below?
4897 |. dsubu TMP2, BASE, TMP2 // Relocate BASE down.
4898 | move BASE, TMP2
4899 | ld TMP1, FRAME_PC(TMP2)
4900 | b <1
4901 |. andi TMP0, TMP1, FRAME_TYPE
4902 break;
4903
4904 case BC_ITERC:
4905 | // RA = base*8, (RB = (nresults+1)*8, RC = (nargs+1)*8 ((2+1)*8))
4906 | move TMP2, BASE // Save old BASE fir vmeta_call.
4907 | daddu BASE, BASE, RA
4908 | ld RB, -24(BASE)
4909 | ld CARG1, -16(BASE)
4910 | ld CARG2, -8(BASE)
4911 | li NARGS8:RC, 16 // Iterators get 2 arguments.
4912 | sd RB, 0(BASE) // Copy callable.
4913 | sd CARG1, 16(BASE) // Copy state.
4914 | sd CARG2, 24(BASE) // Copy control var.
4915 | daddiu BASE, BASE, 16
4916 | checkfunc RB, ->vmeta_call
4917 | ins_call
4918 break;
4919
4920 case BC_ITERN:
4921 |.if JIT and ENDIAN_LE
4922 | hotloop
4923 |.endif
4924 |->vm_IITERN:
4925 | // RA = base*8, (RB = (nresults+1)*8, RC = (nargs+1)*8 (2+1)*8)
4926 | daddu RA, BASE, RA
4927 | ld TAB:RB, -16(RA)
4928 | lw RC, -8+LO(RA) // Get index from control var.
4929 | cleartp TAB:RB
4930 | daddiu PC, PC, 4
4931 | lw TMP0, TAB:RB->asize
4932 | ld TMP1, TAB:RB->array
4933 | dsll CARG3, TISNUM, 47
4934 |1: // Traverse array part.
4935 | sltu AT, RC, TMP0
4936 | beqz AT, >5 // Index points after array part?
4937 |. sll TMP3, RC, 3
4938 | daddu TMP3, TMP1, TMP3
4939 | ld CARG1, 0(TMP3)
4940 | lhu RD, -4+OFS_RD(PC)
4941 | or TMP2, RC, CARG3
4942 | beq CARG1, TISNIL, <1 // Skip holes in array part.
4943 |. addiu RC, RC, 1
4944 | sd TMP2, 0(RA)
4945 | sd CARG1, 8(RA)
4946 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
4947 | decode_RD4b RD
4948 | daddu RD, RD, TMP3
4949 | sw RC, -8+LO(RA) // Update control var.
4950 | daddu PC, PC, RD
4951 |3:
4952 | ins_next
4953 |
4954 |5: // Traverse hash part.
4955 | lw TMP1, TAB:RB->hmask
4956 | subu RC, RC, TMP0
4957 | ld TMP2, TAB:RB->node
4958 |6:
4959 | sltu AT, TMP1, RC // End of iteration? Branch to ITERL+1.
4960 | bnez AT, <3
4961 |. sll TMP3, RC, 5
4962 | sll RB, RC, 3
4963 | subu TMP3, TMP3, RB
4964 | daddu NODE:TMP3, TMP3, TMP2
4965 | ld CARG1, 0(NODE:TMP3)
4966 | lhu RD, -4+OFS_RD(PC)
4967 | beq CARG1, TISNIL, <6 // Skip holes in hash part.
4968 |. addiu RC, RC, 1
4969 | ld CARG2, NODE:TMP3->key
4970 | lui TMP3, (-(BCBIAS_J*4 >> 16) & 65535)
4971 | sd CARG1, 8(RA)
4972 | addu RC, RC, TMP0
4973 | decode_RD4b RD
4974 | addu RD, RD, TMP3
4975 | sd CARG2, 0(RA)
4976 | daddu PC, PC, RD
4977 | b <3
4978 |. sw RC, -8+LO(RA) // Update control var.
4979 break;
4980
4981 case BC_ISNEXT:
4982 | // RA = base*8, RD = target (points to ITERN)
4983 | daddu RA, BASE, RA
4984 | srl TMP0, RD, 1
4985 | ld CFUNC:CARG1, -24(RA)
4986 | daddu TMP0, PC, TMP0
4987 | ld CARG2, -16(RA)
4988 | ld CARG3, -8(RA)
4989 | lui TMP2, (-(BCBIAS_J*4 >> 16) & 65535)
4990 | checkfunc CFUNC:CARG1, >5
4991 | gettp CARG2, CARG2
4992 | daddiu CARG2, CARG2, -LJ_TTAB
4993 | lbu TMP1, CFUNC:CARG1->ffid
4994 | daddiu CARG3, CARG3, -LJ_TNIL
4995 | or AT, CARG2, CARG3
4996 | daddiu TMP1, TMP1, -FF_next_N
4997 | or AT, AT, TMP1
4998 | bnez AT, >5
4999 |. lui TMP1, (LJ_KEYINDEX >> 16)
5000 | daddu PC, TMP0, TMP2
5001 | ori TMP1, TMP1, (LJ_KEYINDEX & 0xffff)
5002 | dsll TMP1, TMP1, 32
5003 | sd TMP1, -8(RA)
5004 |1:
5005 | ins_next
5006 |5: // Despecialize bytecode if any of the checks fail.
5007 | li TMP3, BC_JMP
5008 | li TMP1, BC_ITERC
5009 | sb TMP3, -4+OFS_OP(PC)
5010 | daddu PC, TMP0, TMP2
5011 |.if JIT
5012 | lb TMP0, OFS_OP(PC)
5013 | li AT, BC_ITERN
5014 | bne TMP0, AT, >6
5015 |. lhu TMP2, OFS_RD(PC)
5016 |.endif
5017 | b <1
5018 |. sb TMP1, OFS_OP(PC)
5019 |.if JIT
5020 |6: // Unpatch JLOOP.
5021 | ld TMP0, DISPATCH_J(trace)(DISPATCH)
5022 | sll TMP2, TMP2, 3
5023 | daddu TMP0, TMP0, TMP2
5024 | ld TRACE:TMP2, 0(TMP0)
5025 | lw TMP0, TRACE:TMP2->startins
5026 | li AT, -256
5027 | and TMP0, TMP0, AT
5028 | or TMP0, TMP0, TMP1
5029 | b <1
5030 |. sw TMP0, 0(PC)
5031 |.endif
5032 break;
5033
5034 case BC_VARG:
5035 | // RA = base*8, RB = (nresults+1)*8, RC = numparams*8
5036 | ld TMP0, FRAME_PC(BASE)
5037 | decode_RDtoRC8 RC, RD
5038 | decode_RB8a RB, INS
5039 | daddu RC, BASE, RC
5040 | decode_RB8b RB
5041 | daddu RA, BASE, RA
5042 | daddiu RC, RC, FRAME_VARG
5043 | daddu TMP2, RA, RB
5044 | daddiu TMP3, BASE, -16 // TMP3 = vtop
5045 | dsubu RC, RC, TMP0 // RC = vbase
5046 | // Note: RC may now be even _above_ BASE if nargs was < numparams.
5047 | beqz RB, >5 // Copy all varargs?
5048 |. dsubu TMP1, TMP3, RC
5049 | daddiu TMP2, TMP2, -16
5050 |1: // Copy vararg slots to destination slots.
5051 | ld CARG1, 0(RC)
5052 | sltu AT, RC, TMP3
5053 | daddiu RC, RC, 8
5054 |.if MIPSR6
5055 | selnez CARG1, CARG1, AT
5056 | seleqz AT, TISNIL, AT
5057 | or CARG1, CARG1, AT
5058 |.else
5059 | movz CARG1, TISNIL, AT
5060 |.endif
5061 | sd CARG1, 0(RA)
5062 | sltu AT, RA, TMP2
5063 | bnez AT, <1
5064 |. daddiu RA, RA, 8
5065 |3:
5066 | ins_next
5067 |
5068 |5: // Copy all varargs.
5069 | ld TMP0, L->maxstack
5070 | blez TMP1, <3 // No vararg slots?
5071 |. li MULTRES, 8 // MULTRES = (0+1)*8
5072 | daddu TMP2, RA, TMP1
5073 | sltu AT, TMP0, TMP2
5074 | bnez AT, >7
5075 |. daddiu MULTRES, TMP1, 8
5076 |6:
5077 | ld CRET1, 0(RC)
5078 | daddiu RC, RC, 8
5079 | sd CRET1, 0(RA)
5080 | sltu AT, RC, TMP3
5081 | bnez AT, <6 // More vararg slots?
5082 |. daddiu RA, RA, 8
5083 | b <3
5084 |. nop
5085 |
5086 |7: // Grow stack for varargs.
5087 | load_got lj_state_growstack
5088 | sd RA, L->top
5089 | dsubu RA, RA, BASE
5090 | sd BASE, L->base
5091 | dsubu BASE, RC, BASE // Need delta, because BASE may change.
5092 | sd PC, SAVE_PC
5093 | srl CARG2, TMP1, 3
5094 | call_intern lj_state_growstack // (lua_State *L, int n)
5095 |. move CARG1, L
5096 | move RC, BASE
5097 | ld BASE, L->base
5098 | daddu RA, BASE, RA
5099 | daddu RC, BASE, RC
5100 | b <6
5101 |. daddiu TMP3, BASE, -16
5102 break;
5103
5104 /* -- Returns ----------------------------------------------------------- */
5105
5106 case BC_RETM:
5107 | // RA = results*8, RD = extra_nresults*8
5108 | addu RD, RD, MULTRES // MULTRES >= 8, so RD >= 8.
5109 | // Fall through. Assumes BC_RET follows.
5110 break;
5111
5112 case BC_RET:
5113 | // RA = results*8, RD = (nresults+1)*8
5114 | ld PC, FRAME_PC(BASE)
5115 | daddu RA, BASE, RA
5116 | move MULTRES, RD
5117 |1:
5118 | andi TMP0, PC, FRAME_TYPE
5119 | bnez TMP0, ->BC_RETV_Z
5120 |. xori TMP1, PC, FRAME_VARG
5121 |
5122 |->BC_RET_Z:
5123 | // BASE = base, RA = resultptr, RD = (nresults+1)*8, PC = return
5124 | lw INS, -4(PC)
5125 | daddiu TMP2, BASE, -16
5126 | daddiu RC, RD, -8
5127 | decode_RA8a TMP0, INS
5128 | decode_RB8a RB, INS
5129 | decode_RA8b TMP0
5130 | decode_RB8b RB
5131 | daddu TMP3, TMP2, RB
5132 | beqz RC, >3
5133 |. dsubu BASE, TMP2, TMP0
5134 |2:
5135 | ld CRET1, 0(RA)
5136 | daddiu RA, RA, 8
5137 | daddiu RC, RC, -8
5138 | sd CRET1, 0(TMP2)
5139 | bnez RC, <2
5140 |. daddiu TMP2, TMP2, 8
5141 |3:
5142 | daddiu TMP3, TMP3, -8
5143 |5:
5144 | sltu AT, TMP2, TMP3
5145 | bnez AT, >6
5146 |. ld LFUNC:TMP1, FRAME_FUNC(BASE)
5147 | ins_next1
5148 | cleartp LFUNC:TMP1
5149 | ld TMP1, LFUNC:TMP1->pc
5150 | ld KBASE, PC2PROTO(k)(TMP1)
5151 | ins_next2
5152 |
5153 |6: // Fill up results with nil.
5154 | sd TISNIL, 0(TMP2)
5155 | b <5
5156 |. daddiu TMP2, TMP2, 8
5157 |
5158 |->BC_RETV_Z: // Non-standard return case.
5159 | andi TMP2, TMP1, FRAME_TYPEP
5160 | bnez TMP2, ->vm_return
5161 |. nop
5162 | // Return from vararg function: relocate BASE down.
5163 | dsubu BASE, BASE, TMP1
5164 | b <1
5165 |. ld PC, FRAME_PC(BASE)
5166 break;
5167
5168 case BC_RET0: case BC_RET1:
5169 | // RA = results*8, RD = (nresults+1)*8
5170 | ld PC, FRAME_PC(BASE)
5171 | daddu RA, BASE, RA
5172 | move MULTRES, RD
5173 | andi TMP0, PC, FRAME_TYPE
5174 | bnez TMP0, ->BC_RETV_Z
5175 |. xori TMP1, PC, FRAME_VARG
5176 | lw INS, -4(PC)
5177 | daddiu TMP2, BASE, -16
5178 if (op == BC_RET1) {
5179 | ld CRET1, 0(RA)
5180 }
5181 | decode_RB8a RB, INS
5182 | decode_RA8a RA, INS
5183 | decode_RB8b RB
5184 | decode_RA8b RA
5185 | dsubu BASE, TMP2, RA
5186 if (op == BC_RET1) {
5187 | sd CRET1, 0(TMP2)
5188 }
5189 |5:
5190 | sltu AT, RD, RB
5191 | bnez AT, >6
5192 |. ld TMP1, FRAME_FUNC(BASE)
5193 | ins_next1
5194 | cleartp LFUNC:TMP1
5195 | ld TMP1, LFUNC:TMP1->pc
5196 | ld KBASE, PC2PROTO(k)(TMP1)
5197 | ins_next2
5198 |
5199 |6: // Fill up results with nil.
5200 | daddiu TMP2, TMP2, 8
5201 | daddiu RD, RD, 8
5202 | b <5
5203 if (op == BC_RET1) {
5204 |. sd TISNIL, 0(TMP2)
5205 } else {
5206 |. sd TISNIL, -8(TMP2)
5207 }
5208 break;
5209
5210 /* -- Loops and branches ------------------------------------------------ */
5211
5212 case BC_FORL:
5213 |.if JIT
5214 | hotloop
5215 |.endif
5216 | // Fall through. Assumes BC_IFORL follows.
5217 break;
5218
5219 case BC_JFORI:
5220 case BC_JFORL:
5221#if !LJ_HASJIT
5222 break;
5223#endif
5224 case BC_FORI:
5225 case BC_IFORL:
5226 | // RA = base*8, RD = target (after end of loop or start of loop)
5227 vk = (op == BC_IFORL || op == BC_JFORL);
5228 | daddu RA, BASE, RA
5229 | ld CARG1, FORL_IDX*8(RA) // IDX CARG1 - CARG3 type
5230 | gettp CARG3, CARG1
5231 if (op != BC_JFORL) {
5232 | srl RD, RD, 1
5233 | lui TMP2, (-(BCBIAS_J*4 >> 16) & 65535)
5234 | daddu TMP2, RD, TMP2
5235 }
5236 if (!vk) {
5237 | ld CARG2, FORL_STOP*8(RA) // STOP CARG2 - CARG4 type
5238 | ld CRET1, FORL_STEP*8(RA) // STEP CRET1 - CRET2 type
5239 | gettp CARG4, CARG2
5240 | bne CARG3, TISNUM, >5
5241 |. gettp CRET2, CRET1
5242 | bne CARG4, TISNUM, ->vmeta_for
5243 |. sextw CARG3, CARG1
5244 | bne CRET2, TISNUM, ->vmeta_for
5245 |. sextw CARG2, CARG2
5246 | dext AT, CRET1, 31, 0
5247 | slt CRET1, CARG2, CARG3
5248 | slt TMP1, CARG3, CARG2
5249 |.if MIPSR6
5250 | selnez TMP1, TMP1, AT
5251 | seleqz CRET1, CRET1, AT
5252 | or CRET1, CRET1, TMP1
5253 |.else
5254 | movn CRET1, TMP1, AT
5255 |.endif
5256 } else {
5257 | bne CARG3, TISNUM, >5
5258 |. ld CARG2, FORL_STEP*8(RA) // STEP CARG2 - CARG4 type
5259 | ld CRET1, FORL_STOP*8(RA) // STOP CRET1 - CRET2 type
5260 | sextw TMP3, CARG1
5261 | sextw CARG2, CARG2
5262 | sextw CRET1, CRET1
5263 | addu CARG1, TMP3, CARG2
5264 | xor TMP0, CARG1, TMP3
5265 | xor TMP1, CARG1, CARG2
5266 | and TMP0, TMP0, TMP1
5267 | slt TMP1, CARG1, CRET1
5268 | slt CRET1, CRET1, CARG1
5269 | slt AT, CARG2, r0
5270 | slt TMP0, TMP0, r0 // ((y^a) & (y^b)) < 0: overflow.
5271 |.if MIPSR6
5272 | selnez TMP1, TMP1, AT
5273 | seleqz CRET1, CRET1, AT
5274 | or CRET1, CRET1, TMP1
5275 |.else
5276 | movn CRET1, TMP1, AT
5277 |.endif
5278 | or CRET1, CRET1, TMP0
5279 | zextw CARG1, CARG1
5280 | settp CARG1, TISNUM
5281 }
5282 |1:
5283 if (op == BC_FORI) {
5284 |.if MIPSR6
5285 | selnez TMP2, TMP2, CRET1
5286 |.else
5287 | movz TMP2, r0, CRET1
5288 |.endif
5289 | daddu PC, PC, TMP2
5290 } else if (op == BC_JFORI) {
5291 | daddu PC, PC, TMP2
5292 | lhu RD, -4+OFS_RD(PC)
5293 } else if (op == BC_IFORL) {
5294 |.if MIPSR6
5295 | seleqz TMP2, TMP2, CRET1
5296 |.else
5297 | movn TMP2, r0, CRET1
5298 |.endif
5299 | daddu PC, PC, TMP2
5300 }
5301 if (vk) {
5302 | sd CARG1, FORL_IDX*8(RA)
5303 }
5304 | ins_next1
5305 | sd CARG1, FORL_EXT*8(RA)
5306 |2:
5307 if (op == BC_JFORI) {
5308 | beqz CRET1, =>BC_JLOOP
5309 |. decode_RD8b RD
5310 } else if (op == BC_JFORL) {
5311 | beqz CRET1, =>BC_JLOOP
5312 }
5313 | ins_next2
5314 |
5315 |5: // FP loop.
5316 |.if FPU
5317 if (!vk) {
5318 | ldc1 f0, FORL_IDX*8(RA)
5319 | ldc1 f2, FORL_STOP*8(RA)
5320 | sltiu TMP0, CARG3, LJ_TISNUM
5321 | sltiu TMP1, CARG4, LJ_TISNUM
5322 | sltiu AT, CRET2, LJ_TISNUM
5323 | ld TMP3, FORL_STEP*8(RA)
5324 | and TMP0, TMP0, TMP1
5325 | and AT, AT, TMP0
5326 | beqz AT, ->vmeta_for
5327 |. slt TMP3, TMP3, r0
5328 |.if MIPSR6
5329 | dmtc1 TMP3, FTMP2
5330 | cmp.lt.d FTMP0, f0, f2
5331 | cmp.lt.d FTMP1, f2, f0
5332 | sel.d FTMP2, FTMP1, FTMP0
5333 | b <1
5334 |. dmfc1 CRET1, FTMP2
5335 |.else
5336 | c.ole.d 0, f0, f2
5337 | c.ole.d 1, f2, f0
5338 | li CRET1, 1
5339 | movt CRET1, r0, 0
5340 | movt AT, r0, 1
5341 | b <1
5342 |. movn CRET1, AT, TMP3
5343 |.endif
5344 } else {
5345 | ldc1 f0, FORL_IDX*8(RA)
5346 | ldc1 f4, FORL_STEP*8(RA)
5347 | ldc1 f2, FORL_STOP*8(RA)
5348 | ld TMP3, FORL_STEP*8(RA)
5349 | add.d f0, f0, f4
5350 |.if MIPSR6
5351 | slt TMP3, TMP3, r0
5352 | dmtc1 TMP3, FTMP2
5353 | cmp.lt.d FTMP0, f0, f2
5354 | cmp.lt.d FTMP1, f2, f0
5355 | sel.d FTMP2, FTMP1, FTMP0
5356 | dmfc1 CRET1, FTMP2
5357 if (op == BC_IFORL) {
5358 | seleqz TMP2, TMP2, CRET1
5359 | daddu PC, PC, TMP2
5360 }
5361 |.else
5362 | c.ole.d 0, f0, f2
5363 | c.ole.d 1, f2, f0
5364 | slt TMP3, TMP3, r0
5365 | li CRET1, 1
5366 | li AT, 1
5367 | movt CRET1, r0, 0
5368 | movt AT, r0, 1
5369 | movn CRET1, AT, TMP3
5370 if (op == BC_IFORL) {
5371 | movn TMP2, r0, CRET1
5372 | daddu PC, PC, TMP2
5373 }
5374 |.endif
5375 | sdc1 f0, FORL_IDX*8(RA)
5376 | ins_next1
5377 | b <2
5378 |. sdc1 f0, FORL_EXT*8(RA)
5379 }
5380 |.else
5381 if (!vk) {
5382 | sltiu TMP0, CARG3, LJ_TISNUM
5383 | sltiu TMP1, CARG4, LJ_TISNUM
5384 | sltiu AT, CRET2, LJ_TISNUM
5385 | and TMP0, TMP0, TMP1
5386 | and AT, AT, TMP0
5387 | beqz AT, ->vmeta_for
5388 |. nop
5389 | bal ->vm_sfcmpolex
5390 |. lw TMP3, FORL_STEP*8+HI(RA)
5391 | b <1
5392 |. nop
5393 } else {
5394 | load_got __adddf3
5395 | call_extern
5396 |. sw TMP2, TMPD
5397 | ld CARG2, FORL_STOP*8(RA)
5398 | move CARG1, CRET1
5399 if ( op == BC_JFORL ) {
5400 | lhu RD, -4+OFS_RD(PC)
5401 | decode_RD8b RD
5402 }
5403 | bal ->vm_sfcmpolex
5404 |. lw TMP3, FORL_STEP*8+HI(RA)
5405 | b <1
5406 |. lw TMP2, TMPD
5407 }
5408 |.endif
5409 break;
5410
5411 case BC_ITERL:
5412 |.if JIT
5413 | hotloop
5414 |.endif
5415 | // Fall through. Assumes BC_IITERL follows.
5416 break;
5417
5418 case BC_JITERL:
5419#if !LJ_HASJIT
5420 break;
5421#endif
5422 case BC_IITERL:
5423 | // RA = base*8, RD = target
5424 | daddu RA, BASE, RA
5425 | ld TMP1, 0(RA)
5426 | beq TMP1, TISNIL, >1 // Stop if iterator returned nil.
5427 |. nop
5428 if (op == BC_JITERL) {
5429 | b =>BC_JLOOP
5430 |. sd TMP1, -8(RA)
5431 } else {
5432 | branch_RD // Otherwise save control var + branch.
5433 | sd TMP1, -8(RA)
5434 }
5435 |1:
5436 | ins_next
5437 break;
5438
5439 case BC_LOOP:
5440 | // RA = base*8, RD = target (loop extent)
5441 | // Note: RA/RD is only used by trace recorder to determine scope/extent
5442 | // This opcode does NOT jump, it's only purpose is to detect a hot loop.
5443 |.if JIT
5444 | hotloop
5445 |.endif
5446 | // Fall through. Assumes BC_ILOOP follows.
5447 break;
5448
5449 case BC_ILOOP:
5450 | // RA = base*8, RD = target (loop extent)
5451 | ins_next
5452 break;
5453
5454 case BC_JLOOP:
5455 |.if JIT
5456 | // RA = base*8 (ignored), RD = traceno*8
5457 | ld TMP1, DISPATCH_J(trace)(DISPATCH)
5458 | li AT, 0
5459 | daddu TMP1, TMP1, RD
5460 | // Traces on MIPS don't store the trace number, so use 0.
5461 | sd AT, DISPATCH_GL(vmstate)(DISPATCH)
5462 | ld TRACE:TMP2, 0(TMP1)
5463 | sd BASE, DISPATCH_GL(jit_base)(DISPATCH)
5464 | ld TMP2, TRACE:TMP2->mcode
5465 | sd L, DISPATCH_GL(tmpbuf.L)(DISPATCH)
5466 | jr TMP2
5467 |. daddiu JGL, DISPATCH, GG_DISP2G+32768
5468 |.endif
5469 break;
5470
5471 case BC_JMP:
5472 | // RA = base*8 (only used by trace recorder), RD = target
5473 | branch_RD
5474 | ins_next
5475 break;
5476
5477 /* -- Function headers -------------------------------------------------- */
5478
5479 case BC_FUNCF:
5480 |.if JIT
5481 | hotcall
5482 |.endif
5483 case BC_FUNCV: /* NYI: compiled vararg functions. */
5484 | // Fall through. Assumes BC_IFUNCF/BC_IFUNCV follow.
5485 break;
5486
5487 case BC_JFUNCF:
5488#if !LJ_HASJIT
5489 break;
5490#endif
5491 case BC_IFUNCF:
5492 | // BASE = new base, RA = BASE+framesize*8, RB = LFUNC, RC = nargs*8
5493 | ld TMP2, L->maxstack
5494 | lbu TMP1, -4+PC2PROTO(numparams)(PC)
5495 | ld KBASE, -4+PC2PROTO(k)(PC)
5496 | sltu AT, TMP2, RA
5497 | bnez AT, ->vm_growstack_l
5498 |. sll TMP1, TMP1, 3
5499 if (op != BC_JFUNCF) {
5500 | ins_next1
5501 }
5502 |2:
5503 | sltu AT, NARGS8:RC, TMP1 // Check for missing parameters.
5504 | bnez AT, >3
5505 |. daddu AT, BASE, NARGS8:RC
5506 if (op == BC_JFUNCF) {
5507 | decode_RD8a RD, INS
5508 | b =>BC_JLOOP
5509 |. decode_RD8b RD
5510 } else {
5511 | ins_next2
5512 }
5513 |
5514 |3: // Clear missing parameters.
5515 | sd TISNIL, 0(AT)
5516 | b <2
5517 |. addiu NARGS8:RC, NARGS8:RC, 8
5518 break;
5519
5520 case BC_JFUNCV:
5521#if !LJ_HASJIT
5522 break;
5523#endif
5524 | NYI // NYI: compiled vararg functions
5525 break; /* NYI: compiled vararg functions. */
5526
5527 case BC_IFUNCV:
5528 | // BASE = new base, RA = BASE+framesize*8, RB = LFUNC, RC = nargs*8
5529 | li TMP0, LJ_TFUNC
5530 | daddu TMP1, BASE, RC
5531 | ld TMP2, L->maxstack
5532 | settp LFUNC:RB, TMP0
5533 | daddu TMP0, RA, RC
5534 | sd LFUNC:RB, 0(TMP1) // Store (tagged) copy of LFUNC.
5535 | daddiu TMP2, TMP2, -8
5536 | daddiu TMP3, RC, 16+FRAME_VARG
5537 | sltu AT, TMP0, TMP2
5538 | ld KBASE, -4+PC2PROTO(k)(PC)
5539 | beqz AT, ->vm_growstack_l
5540 |. sd TMP3, 8(TMP1) // Store delta + FRAME_VARG.
5541 | lbu TMP2, -4+PC2PROTO(numparams)(PC)
5542 | move RA, BASE
5543 | move RC, TMP1
5544 | ins_next1
5545 | beqz TMP2, >3
5546 |. daddiu BASE, TMP1, 16
5547 |1:
5548 | ld TMP0, 0(RA)
5549 | sltu AT, RA, RC // Less args than parameters?
5550 | move CARG1, TMP0
5551 |.if MIPSR6
5552 | selnez TMP0, TMP0, AT
5553 | seleqz TMP3, TISNIL, AT
5554 | or TMP0, TMP0, TMP3
5555 | seleqz TMP3, CARG1, AT
5556 | selnez CARG1, TISNIL, AT
5557 | or CARG1, CARG1, TMP3
5558 |.else
5559 | movz TMP0, TISNIL, AT // Clear missing parameters.
5560 | movn CARG1, TISNIL, AT // Clear old fixarg slot (help the GC).
5561 |.endif
5562 | addiu TMP2, TMP2, -1
5563 | sd TMP0, 16(TMP1)
5564 | daddiu TMP1, TMP1, 8
5565 | sd CARG1, 0(RA)
5566 | bnez TMP2, <1
5567 |. daddiu RA, RA, 8
5568 |3:
5569 | ins_next2
5570 break;
5571
5572 case BC_FUNCC:
5573 case BC_FUNCCW:
5574 | // BASE = new base, RA = BASE+framesize*8, RB = CFUNC, RC = nargs*8
5575 if (op == BC_FUNCC) {
5576 | ld CFUNCADDR, CFUNC:RB->f
5577 } else {
5578 | ld CFUNCADDR, DISPATCH_GL(wrapf)(DISPATCH)
5579 }
5580 | daddu TMP1, RA, NARGS8:RC
5581 | ld TMP2, L->maxstack
5582 | daddu RC, BASE, NARGS8:RC
5583 | sd BASE, L->base
5584 | sltu AT, TMP2, TMP1
5585 | sd RC, L->top
5586 | li_vmstate C
5587 if (op == BC_FUNCCW) {
5588 | ld CARG2, CFUNC:RB->f
5589 }
5590 | bnez AT, ->vm_growstack_c // Need to grow stack.
5591 |. move CARG1, L
5592 | jalr CFUNCADDR // (lua_State *L [, lua_CFunction f])
5593 |. st_vmstate
5594 | // Returns nresults.
5595 | ld BASE, L->base
5596 | sll RD, CRET1, 3
5597 | ld TMP1, L->top
5598 | li_vmstate INTERP
5599 | ld PC, FRAME_PC(BASE) // Fetch PC of caller.
5600 | dsubu RA, TMP1, RD // RA = L->top - nresults*8
5601 | sd L, DISPATCH_GL(cur_L)(DISPATCH)
5602 | b ->vm_returnc
5603 |. st_vmstate
5604 break;
5605
5606 /* ---------------------------------------------------------------------- */
5607
5608 default:
5609 fprintf(stderr, "Error: undefined opcode BC_%s\n", bc_names[op]);
5610 exit(2);
5611 break;
5612 }
5613}
5614
5615static int build_backend(BuildCtx *ctx)
5616{
5617 int op;
5618
5619 dasm_growpc(Dst, BC__MAX);
5620
5621 build_subroutines(ctx);
5622
5623 |.code_op
5624 for (op = 0; op < BC__MAX; op++)
5625 build_ins(ctx, (BCOp)op, op);
5626
5627 return BC__MAX;
5628}
5629
5630/* Emit pseudo frame-info for all assembler functions. */
5631static void emit_asm_debug(BuildCtx *ctx)
5632{
5633 int fcofs = (int)((uint8_t *)ctx->glob[GLOB_vm_ffi_call] - ctx->code);
5634 int i;
5635 switch (ctx->mode) {
5636 case BUILD_elfasm:
5637 fprintf(ctx->fp, "\t.section .debug_frame,\"\",@progbits\n");
5638 fprintf(ctx->fp,
5639 ".Lframe0:\n"
5640 "\t.4byte .LECIE0-.LSCIE0\n"
5641 ".LSCIE0:\n"
5642 "\t.4byte 0xffffffff\n"
5643 "\t.byte 0x1\n"
5644 "\t.string \"\"\n"
5645 "\t.uleb128 0x1\n"
5646 "\t.sleb128 -4\n"
5647 "\t.byte 31\n"
5648 "\t.byte 0xc\n\t.uleb128 29\n\t.uleb128 0\n"
5649 "\t.align 2\n"
5650 ".LECIE0:\n\n");
5651 fprintf(ctx->fp,
5652 ".LSFDE0:\n"
5653 "\t.4byte .LEFDE0-.LASFDE0\n"
5654 ".LASFDE0:\n"
5655 "\t.4byte .Lframe0\n"
5656 "\t.8byte .Lbegin\n"
5657 "\t.8byte %d\n"
5658 "\t.byte 0xe\n\t.uleb128 %d\n"
5659 "\t.byte 0x9f\n\t.sleb128 2*5\n"
5660 "\t.byte 0x9e\n\t.sleb128 2*6\n",
5661 fcofs, CFRAME_SIZE);
5662 for (i = 23; i >= 16; i--)
5663 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+i, 2*(30-i));
5664#if !LJ_SOFTFP
5665 for (i = 31; i >= 24; i--)
5666 fprintf(ctx->fp, "\t.byte %d\n\t.uleb128 %d\n", 0x80+32+i, 2*(46-i));
5667#endif
5668 fprintf(ctx->fp,
5669 "\t.align 2\n"
5670 ".LEFDE0:\n\n");
5671#if LJ_HASFFI
5672 fprintf(ctx->fp,
5673 ".LSFDE1:\n"
5674 "\t.4byte .LEFDE1-.LASFDE1\n"
5675 ".LASFDE1:\n"
5676 "\t.4byte .Lframe0\n"
5677 "\t.4byte lj_vm_ffi_call\n"
5678 "\t.4byte %d\n"
5679 "\t.byte 0x9f\n\t.uleb128 2*1\n"
5680 "\t.byte 0x90\n\t.uleb128 2*2\n"
5681 "\t.byte 0xd\n\t.uleb128 0x10\n"
5682 "\t.align 2\n"
5683 ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
5684#endif
5685#if !LJ_NO_UNWIND
5686 /* NYI */
5687#endif
5688 break;
5689 default:
5690 break;
5691 }
5692}
5693