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