Merge pull request #641 from bunkerity/dev

Merge branch "dev" into branch "staging"
This commit is contained in:
Théophile Diot 2023-09-15 18:33:29 +02:00 committed by GitHub
commit b5bd17d4da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
430 changed files with 12535 additions and 12668 deletions

View file

@ -41,8 +41,6 @@ body:
⚠️ DON'T FORGET TO REMOVE PRIVATE DATA LIKE IP ADDRESSES ! ⚠️
placeholder: Log output
render: shell
validations:
required: true
- type: input
id: version
attributes:

View file

@ -18,7 +18,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/bw"
target-branch: "dev"
@ -29,7 +29,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/scheduler"
target-branch: "dev"
@ -38,7 +38,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/scheduler"
target-branch: "dev"
@ -49,7 +49,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/autoconf"
target-branch: "dev"
@ -58,7 +58,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/autoconf"
target-branch: "dev"
@ -69,7 +69,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/ui"
target-branch: "dev"
@ -78,7 +78,7 @@ updates:
schedule:
interval: "daily"
assignees:
- "fl0ppy-d1sk"
- "TheophileDiot"
commit-message:
prefix: "deps/ui"
target-branch: "dev"

View file

@ -61,22 +61,22 @@ jobs:
SSH_IP: ${{ secrets.ARM_SSH_IP }}
SSH_CONFIG: ${{ secrets.ARM_SSH_CONFIG }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
if: inputs.CACHE_SUFFIX != 'arm'
- name: Setup Buildx (ARM)
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
if: inputs.CACHE_SUFFIX == 'arm'
with:
endpoint: ssh://root@arm
platforms: linux/arm64,linux/arm/v7,linux/arm/v6
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
if: inputs.PUSH == true
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -84,13 +84,13 @@ jobs:
# Compute metadata
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: bunkerity/${{ inputs.IMAGE }}
# Build cached image
- name: Build image
if: inputs.CACHE == true
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.DOCKERFILE }}
@ -103,7 +103,7 @@ jobs:
# Build non-cached image
- name: Build image
if: inputs.CACHE != true
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.DOCKERFILE }}

View file

@ -99,12 +99,12 @@ jobs:
packages: write
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}

View file

@ -70,21 +70,21 @@ jobs:
SSH_IP: ${{ secrets.ARM_SSH_IP }}
SSH_CONFIG: ${{ secrets.ARM_SSH_CONFIG }}
- name: Setup Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
if: startsWith(env.ARCH, 'arm') == false
- name: Setup Buildx (ARM)
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
if: startsWith(env.ARCH, 'arm') == true
with:
endpoint: ssh://root@arm
platforms: linux/arm64,linux/arm/v7,linux/arm/v6
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -92,7 +92,7 @@ jobs:
# Build testing package image
- name: Build package image
if: inputs.RELEASE == 'testing'
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
load: true
@ -104,7 +104,7 @@ jobs:
# Build non-testing package image
- name: Build package image
if: inputs.RELEASE != 'testing'
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
load: true
@ -135,12 +135,12 @@ jobs:
- name: Extract metadata
if: inputs.TEST == true
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ghcr.io/bunkerity/${{ inputs.LINUX }}-tests:${{ inputs.RELEASE }}
- name: Build test image
if: inputs.TEST == true
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: tests/linux/Dockerfile-${{ inputs.LINUX }}

View file

@ -35,7 +35,7 @@ jobs:
- name: Install doc requirements
run: pip install -r docs/requirements.txt
- name: Push doc
run: mike deploy --update-aliases --push ${{ inputs.VERSION }} ${{ inputs.ALIAS }}
run: mike deploy --update-aliases --push --no-redirect ${{ inputs.VERSION }} ${{ inputs.ALIAS }}
- name: Set default doc
if: inputs.ALIAS == 'latest'
run: mike set-default --push latest

View file

@ -35,12 +35,12 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -56,19 +56,19 @@ jobs:
SSH_IP: ${{ secrets.ARM_SSH_IP }}
SSH_CONFIG: ${{ secrets.ARM_SSH_CONFIG }}
- name: Setup Buildx (ARM)
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
with:
endpoint: ssh://root@arm
platforms: linux/arm64,linux/arm/v7,linux/arm/v6
# Compute metadata
- name: Extract metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: bunkerity/${{ inputs.IMAGE }}
# Build and push
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: ${{ inputs.DOCKERFILE }}

View file

@ -27,7 +27,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}

View file

@ -175,12 +175,12 @@ jobs:
packages: write
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}

View file

@ -17,7 +17,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}

View file

@ -14,7 +14,7 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to ghcr
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}

View file

@ -1,6 +1,12 @@
# Changelog
## v1.5.2 -
## v1.5.3 -
- [BUGFIX] Fix BunkerWeb not loading his own settings after a docker restart
- [BUGFIX] Fix Custom configs not following the service name after an update on the UI
- [MISC] Updated core dependencies
## v1.5.2 - 2023/10/10
- [BUGFIX] Fix UI fetching only default values from the database (fixes no trash button too)
- [BUGFIX] Fix infinite loop when using autoconf

View file

@ -1,5 +1,5 @@
mkdocs==1.5.2
mkdocs-material==9.2.8
mkdocs-material==9.3.1
pytablewriter==1.0.0
mike==1.1.2
mkdocs-print-site-plugin==2.3.6

View file

@ -1,4 +1,4 @@
User-agent: *
Allow: /latest/
Sitemap: https://docs.bunkerweb.io/sitemap.xml
Sitemap: https://docs.bunkerweb.io/latest/sitemap.xml

View file

@ -73,7 +73,7 @@ RUN apk add --no-cache pcre bash python3 yajl && \
ln -s /proc/1/fd/1 /var/log/bunkerweb/access.log
# Fix CVEs
# There are no CVE to fix for the moment
RUN apk add --no-cache "libwebp>=1.2.4-r3"
VOLUME /data /etc/nginx

View file

@ -35,13 +35,9 @@ function trap_reload() {
}
trap "trap_reload" HUP
if [ -f "/etc/nginx/variables.env" ] ; then
log "ENTRYPOINT" "⚠️ " "Looks like BunkerWeb has already been loaded, will not generate temp config"
else
# generate "temp" config
echo -e "IS_LOADING=yes\nUSE_BUNKERNET=no\nSERVER_NAME=\nAPI_HTTP_PORT=${API_HTTP_PORT:-5000}\nAPI_SERVER_NAME=${API_SERVER_NAME:-bwapi}\nAPI_WHITELIST_IP=${API_WHITELIST_IP:-127.0.0.0/8}\nUSE_REAL_IP=${USE_REAL_IP:-no}\nUSE_PROXY_PROTOCOL=${USE_PROXY_PROTOCOL:-no}\nREAL_IP_FROM=${REAL_IP_FROM:-192.168.0.0/16 172.16.0.0/12 10.0.0.0/8}\nREAL_IP_HEADER=${REAL_IP_HEADER:-X-Forwarded-For}\nHTTP_PORT=${HTTP_PORT:-8080}\nHTTPS_PORT=${HTTPS_PORT:-8443}" > /tmp/variables.env
python3 /usr/share/bunkerweb/gen/main.py --variables /tmp/variables.env
fi
# generate "temp" config
echo -e "IS_LOADING=yes\nUSE_BUNKERNET=no\nSERVER_NAME=\nAPI_HTTP_PORT=${API_HTTP_PORT:-5000}\nAPI_SERVER_NAME=${API_SERVER_NAME:-bwapi}\nAPI_WHITELIST_IP=${API_WHITELIST_IP:-127.0.0.0/8}\nUSE_REAL_IP=${USE_REAL_IP:-no}\nUSE_PROXY_PROTOCOL=${USE_PROXY_PROTOCOL:-no}\nREAL_IP_FROM=${REAL_IP_FROM:-192.168.0.0/16 172.16.0.0/12 10.0.0.0/8}\nREAL_IP_HEADER=${REAL_IP_HEADER:-X-Forwarded-For}\nHTTP_PORT=${HTTP_PORT:-8080}\nHTTPS_PORT=${HTTPS_PORT:-8443}" > /tmp/variables.env
python3 /usr/share/bunkerweb/gen/main.py --variables /tmp/variables.env
# start nginx
log "ENTRYPOINT" "" "Starting nginx ..."

View file

@ -120,8 +120,11 @@ markupsafe==2.1.3 \
--hash=sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e \
--hash=sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431 \
--hash=sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686 \
--hash=sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c \
--hash=sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559 \
--hash=sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc \
--hash=sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb \
--hash=sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939 \
--hash=sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c \
--hash=sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0 \
--hash=sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4 \
@ -129,6 +132,7 @@ markupsafe==2.1.3 \
--hash=sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575 \
--hash=sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba \
--hash=sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d \
--hash=sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd \
--hash=sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3 \
--hash=sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00 \
--hash=sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155 \
@ -137,6 +141,7 @@ markupsafe==2.1.3 \
--hash=sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f \
--hash=sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8 \
--hash=sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b \
--hash=sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007 \
--hash=sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24 \
--hash=sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea \
--hash=sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198 \
@ -144,9 +149,12 @@ markupsafe==2.1.3 \
--hash=sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee \
--hash=sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be \
--hash=sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2 \
--hash=sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1 \
--hash=sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707 \
--hash=sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6 \
--hash=sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c \
--hash=sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58 \
--hash=sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823 \
--hash=sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779 \
--hash=sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636 \
--hash=sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c \
@ -165,7 +173,9 @@ markupsafe==2.1.3 \
--hash=sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9 \
--hash=sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57 \
--hash=sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc \
--hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2
--hash=sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc \
--hash=sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2 \
--hash=sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11
# via jinja2
oauthlib==3.2.2 \
--hash=sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca \
@ -282,9 +292,9 @@ urllib3==2.0.4 \
# docker
# kubernetes
# requests
websocket-client==1.6.2 \
--hash=sha256:53e95c826bf800c4c465f50093a8c4ff091c7327023b10bfaff40cf1ef170eaa \
--hash=sha256:ce54f419dfae71f4bdba69ebe65bf7f0a93fe71bc009ad3a010aacc3eebad537
websocket-client==1.6.3 \
--hash=sha256:3aad25d31284266bcfcfd1fd8a743f63282305a364b8d0948a43bd606acc652f \
--hash=sha256:6cfc30d051ebabb73a5fa246efdcc14c8fbebbd0330f8984ac3bb6d9edd2ad03
# via
# docker
# kubernetes

View file

@ -35,6 +35,7 @@ class ApiCaller:
self.__apis = apis
def auto_setup(self, bw_integration: Optional[str] = None):
self.__apis.clear()
if bw_integration is None:
if getenv("KUBERNETES_MODE", "no") == "yes":
bw_integration = "Kubernetes"

View file

@ -9,15 +9,15 @@
"git_repository": [
{
"id": "luajit",
"name": "LuaJIT v2.1-20230410",
"name": "LuaJIT v2.1-20230911",
"url": "https://github.com/openresty/luajit2.git",
"commit": "04f33ff01da97905a1641985fb5c840d234f97f1"
"commit": "e598aeb7426dbc069f90ba70db9bce43cd573b0e"
},
{
"id": "modsecurity",
"name": "ModSecurity v3.0.9",
"name": "ModSecurity v3.0.10",
"url": "https://github.com/SpiderLabs/ModSecurity.git",
"commit": "205dac0e8c675182f96b5c2fb06be7d1cf7af2b2",
"commit": "ccc2d9b53632fb5088673bbaafedf0d8d4b5f1d8",
"post_install": "patch src/deps/src/modsecurity/configure.ac src/deps/misc/modsecurity.patch && rm -rf src/deps/src/modsecurity/others/libinjection"
},
{
@ -83,9 +83,9 @@
},
{
"id": "lua-ffi-zlib",
"name": "lua-ffi-zlib v0.5",
"name": "lua-ffi-zlib v0.6",
"url": "https://github.com/hamishforbes/lua-ffi-zlib.git",
"commit": "1fb69ca505444097c82d2b72e87904f3ed923ae9",
"commit": "61e95cb434e4047c8bc65a180c293a05bf754416",
"post_install": "patch src/deps/src/lua-ffi-zlib/lib/ffi-zlib.lua src/deps/misc/lua-ffi-zlib.patch"
},
{
@ -170,9 +170,9 @@
},
{
"id": "lua-resty-session",
"name": "lua-resty-session v4.0.4",
"name": "lua-resty-session v4.0.5",
"url": "https://github.com/bungle/lua-resty-session.git",
"commit": "8b5f8752f3046396c414c5b97850e784c07e1641"
"commit": "5f2aed616d16fa7ca04dc40e23d6941740cd634d"
},
{
"id": "lua-resty-signal",
@ -213,9 +213,9 @@
},
{
"id": "luasec",
"name": "luasec v1.3.1",
"name": "luasec v1.3.2",
"url": "https://github.com/brunoos/luasec.git",
"commit": "fddde111f7fe9ad5417d75ebbd70429d13eaad97"
"commit": "4c06287052d68fdbe7429b8f967cdc8ee94aa44a"
},
{
"id": "luasocket",
@ -231,9 +231,9 @@
},
{
"id": "zlib",
"name": "zlib v1.2.13",
"name": "zlib v1.3",
"url": "https://github.com/madler/zlib.git",
"commit": "04f42ceca40f73e2978b50e93806c2a18c1281fc"
"commit": "09155eaa2f9270dc4ed1fa13e2b4b2613e6e4851"
}
]
}

View file

@ -0,0 +1,57 @@
name: Tests
on:
pull_request:
paths-ignore:
- '*.md'
push:
branches:
- master
- release/*
paths-ignore:
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
container:
image: openresty/openresty:${{ matrix.openresty }}-jammy
strategy:
fail-fast: false
matrix:
openresty: ["1.19.9.1-14", "1.21.4.1-0"]
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Install valgrind
run: |
apt-get update
apt-get install -y valgrind
# ensure the library works even without dev packages installed (libz.so.1 instead of libz.so)
- name: Remove dev packages
run: |
apt-get purge -y libc-dev-bin
- name: Run test with LuaJIT
run: |
luajit test.lua /usr/local/openresty/nginx/sbin/nginx 65536000
- name: Run test with resty-cli
run: |
resty --no-stream test.lua /usr/local/openresty/nginx/sbin/nginx 65536000
- name: Run test with resty-cli (valgrind)
if: contains(matrix.extras, 'valgrind')
run: |
resty --no-stream --valgrind test.lua /usr/local/openresty/nginx/sbin/nginx 65536000

View file

@ -95,11 +95,11 @@ unsigned long crc32_combine(unsigned long, unsigned long, long);
]])
local zlib = ffi.load("/usr/share/bunkerweb/deps/lib/lua/libz.so")
_M.zlib = zlib
local zlib = ffi.load("/usr/share/bunkerweb/deps/lib/lua/libz.so")
_M.zlib = zlib
-- Default to 16k output buffer
local DEFAULT_CHUNK = 16384
local DEFAULT_CHUNK = 16384
local Z_OK = zlib.Z_OK
local Z_NO_FLUSH = zlib.Z_NO_FLUSH
@ -119,7 +119,7 @@ local function createStream(bufsize)
local stream = ffi_new("z_stream")
-- Create input buffer var
local inbuf = ffi_new('char[?]', bufsize+1)
local inbuf = ffi_new('char[?]', bufsize + 1)
stream.next_in, stream.avail_in = inbuf, 0
-- create the output buffer
@ -142,9 +142,9 @@ _M.initInflate = initInflate
local function initDeflate(stream, options)
-- Setup deflate process
local method = zlib.Z_DEFLATED
local level = options.level or zlib.Z_DEFAULT_COMPRESSION
local memLevel = options.memLevel or 8
local strategy = options.strategy or zlib.Z_DEFAULT_STRATEGY
local level = options.level or zlib.Z_DEFAULT_COMPRESSION
local memLevel = options.memLevel or 8
local strategy = options.strategy or zlib.Z_DEFAULT_STRATEGY
local windowBits = options.windowBits or (15 + 16) -- +16 sets gzip wrapper not zlib
local version = ffi_str(zlib.zlibVersion())
@ -192,25 +192,24 @@ local function inflate(input, output, bufsize, stream, inbuf, outbuf)
stream.next_out = outbuf
stream.avail_out = bufsize
-- Process the stream, always Z_NO_FLUSH in inflate mode
err = zlib_flate(stream, Z_NO_FLUSH)
err = zlib_flate(stream, Z_NO_FLUSH)
-- Buffer errors are OK here
if err == Z_BUF_ERROR then
err = Z_OK
end
if err < Z_OK or err == Z_NEED_DICT then
-- Error, clean up and return
zlib_flateEnd(stream)
return false, "INFLATE: "..zlib_err(err), stream
-- Error, clean up and return
zlib_flateEnd(stream)
return false, "INFLATE: " .. zlib_err(err), stream
end
-- Write the data out
local err = flushOutput(stream, bufsize, output, outbuf)
if err then
zlib_flateEnd(stream)
return false, "INFLATE: "..err
zlib_flateEnd(stream)
return false, "INFLATE: " .. err
end
until stream.avail_out ~= 0
until err == Z_STREAM_END
-- Stream finished, clean up and return
@ -244,19 +243,19 @@ local function deflate(input, output, bufsize, stream, inbuf, outbuf)
stream.avail_out = bufsize
-- Process the stream
err = zlib_flate(stream, mode)
err = zlib_flate(stream, mode)
-- Only possible *bad* return value here
if err == Z_STREAM_ERROR then
-- Error, clean up and return
zlib_flateEnd(stream)
return false, "DEFLATE: "..zlib_err(err), stream
-- Error, clean up and return
zlib_flateEnd(stream)
return false, "DEFLATE: " .. zlib_err(err), stream
end
-- Write the data out
local err = flushOutput(stream, bufsize, output, outbuf)
if err then
zlib_flateEnd(stream)
return false, "DEFLATE: "..err
zlib_flateEnd(stream)
return false, "DEFLATE: " .. err
end
until stream.avail_out ~= 0
@ -265,7 +264,6 @@ local function deflate(input, output, bufsize, stream, inbuf, outbuf)
zlib_flateEnd(stream)
return false, "DEFLATE: Input not used"
end
until err == Z_STREAM_END
-- Stream finished, clean up and return
@ -301,7 +299,7 @@ function _M.inflateGzip(input, output, bufsize, windowBits)
else
-- Init error
zlib.inflateEnd(stream)
return false, "INIT: "..zlib_err(init)
return false, "INIT: " .. zlib_err(init)
end
end
@ -319,7 +317,7 @@ function _M.deflateGzip(input, output, bufsize, options)
else
-- Init error
zlib.deflateEnd(stream)
return false, "INIT: "..zlib_err(init)
return false, "INIT: " .. zlib_err(init)
end
end

View file

@ -0,0 +1,20 @@
package = "lua-ffi-zlib"
version = "0.6-0"
source = {
url = "git://github.com/hamishforbes/lua-ffi-zlib",
tag = "v0.6"
}
description = {
summary = "A Lua module using LuaJIT's FFI feature to access zlib.",
homepage = "https://github.com/hamishforbes/lua-ffi-zlib",
maintainer = "Hamish Forbes"
}
dependencies = {
"lua >= 5.1",
}
build = {
type = "builtin",
modules = {
["ffi-zlib"] = "lib/ffi-zlib.lua",
}
}

View file

@ -2,6 +2,12 @@
All notable changes to `lua-resty-session` will be documented in this file.
## [4.0.5] - 2023-08-16
### Fixed
- fix(dshm/memcached): add a missing return parameter as otherwise pool parameters are not respected, fix #171
## [4.0.4] - 2023-06-05
### Changed
- chore(utils): remove dependency for lua_pack, fix #158

View file

@ -29,6 +29,7 @@
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/resty.session.html">resty.session</a></li>
@ -119,8 +120,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -294,6 +294,7 @@ pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .function-name { color: #60447f; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -389,8 +390,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -359,8 +360,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -323,8 +324,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -342,8 +343,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -315,12 +316,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> <span class="keyword">not</span> exists <span class="keyword">then</span>
session:set_data({
session:<span class="function-name">set_data</span>({
cart = {},
})
session:save()
session:<span class="function-name">save</span>()
<span class="keyword">end</span></pre>
</ul>
@ -345,10 +346,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> data = session:get_data()
ngx.req.set_header(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. data.access_token)
<span class="keyword">local</span> data = session:<span class="function-name">get_data</span>()
ngx.req.<span class="function-name">set_header</span>(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. data.access_token)
<span class="keyword">end</span></pre>
</ul>
@ -409,10 +410,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> access_token = session:get(<span class="string">"access-token"</span>)
ngx.req.set_header(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. access_token)
<span class="keyword">local</span> access_token = session:<span class="function-name">get</span>(<span class="string">"access-token"</span>)
ngx.req.<span class="function-name">set_header</span>(<span class="string">"Authorization"</span>, <span class="string">"Bearer "</span> .. access_token)
<span class="keyword">end</span></pre>
</ul>
@ -438,8 +439,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
session.set_audience(<span class="string">"my-service"</span>)</pre>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
session.<span class="function-name">set_audience</span>(<span class="string">"my-service"</span>)</pre>
</ul>
</dd>
@ -484,8 +485,8 @@ session.set_audience(<span class="string">"my-service"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
session.<span class="function-name">set_subject</span>(<span class="string">"john@doe.com"</span>)</pre>
</ul>
</dd>
@ -509,9 +510,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> subject = session.get_subject()
<span class="keyword">local</span> subject = session.<span class="function-name">get_subject</span>()
<span class="keyword">end</span></pre>
</ul>
@ -546,9 +547,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="keyword">if</span> exists <span class="keyword">then</span>
<span class="keyword">local</span> timeout = session.get_property(<span class="string">"timeout"</span>)
<span class="keyword">local</span> timeout = session.<span class="function-name">get_property</span>(<span class="string">"timeout"</span>)
<span class="keyword">end</span></pre>
</ul>
@ -1037,7 +1038,7 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.init({
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">init</span>({
audience = <span class="string">"my-application"</span>,
storage = <span class="string">"redis"</span>,
redis = {
@ -1082,9 +1083,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.new({
</span><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">new</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1131,9 +1132,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.open()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.open({
</span><span class="keyword">local</span> session, err, exists = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">open</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1180,9 +1181,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.start()
<pre class="example"><span class="keyword">local</span> session = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">start</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> session, err, exists, refreshed = <span class="global">require</span> <span class="string">"resty.session"</span>.start({
</span><span class="keyword">local</span> session, err, exists, refreshed = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">start</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1238,9 +1239,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.logout()
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">logout</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> ok, err, exists, logged_out = <span class="global">require</span> <span class="string">"resty.session"</span>.logout({
</span><span class="keyword">local</span> ok, err, exists, logged_out = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">logout</span>({
audience = <span class="string">"my-application"</span>,
})</pre>
</ul>
@ -1285,9 +1286,9 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.destroy()
<pre class="example"><span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">destroy</span>()
<span class="comment">-- OR
</span><span class="keyword">local</span> ok, err, exists, destroyed = <span class="global">require</span> <span class="string">"resty.session"</span>.destroy({
</span><span class="keyword">local</span> ok, err, exists, destroyed = <span class="global">require</span> <span class="string">"resty.session"</span>.<span class="function-name">destroy</span>({
cookie_name = <span class="string">"auth"</span>,
})</pre>
</ul>
@ -1299,8 +1300,8 @@ session.set_subject(<span class="string">"john@doe.com"</span>)</pre>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -392,8 +393,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -430,12 +431,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions (
sid CHAR(<span class="number">43</span>) PRIMARY KEY,
name VARCHAR(<span class="number">255</span>),
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions</span> (
sid <span class="function-name">CHAR</span>(<span class="number">43</span>) PRIMARY KEY,
name <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
data MEDIUMTEXT,
exp DATETIME,
INDEX (exp)
<span class="function-name">INDEX</span> (exp)
) CHARACTER SET ascii;</pre>
</ul>
@ -456,12 +457,12 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions_meta (
aud VARCHAR(<span class="number">255</span>),
sub VARCHAR(<span class="number">255</span>),
sid CHAR(<span class="number">43</span>),
PRIMARY KEY (aud, sub, sid),
CONSTRAINT FOREIGN KEY (sid) REFERENCES sessions(sid) ON DELETE CASCADE ON UPDATE CASCADE
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions_meta</span> (
aud <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
sub <span class="function-name">VARCHAR</span>(<span class="number">255</span>),
sid <span class="function-name">CHAR</span>(<span class="number">43</span>),
PRIMARY <span class="function-name">KEY</span> (aud, sub, sid),
CONSTRAINT FOREIGN <span class="function-name">KEY</span> (sid) REFERENCES <span class="function-name">sessions</span>(sid) ON DELETE CASCADE ON UPDATE CASCADE
) CHARACTER SET ascii;</pre>
</ul>
@ -472,8 +473,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -427,13 +428,13 @@
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions (
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions</span> (
sid TEXT PRIMARY KEY,
name TEXT,
data TEXT,
exp TIMESTAMP WITH TIME ZONE
);
CREATE INDEX ON sessions (exp);</pre>
CREATE INDEX ON <span class="function-name">sessions</span> (exp);</pre>
</ul>
</dd>
@ -453,11 +454,11 @@ CREATE INDEX ON sessions (exp);</pre>
<h3>Usage:</h3>
<ul>
<pre class="example">CREATE TABLE IF NOT EXISTS sessions_meta (
<pre class="example">CREATE TABLE IF NOT EXISTS <span class="function-name">sessions_meta</span> (
aud TEXT,
sub TEXT,
sid TEXT REFERENCES sessions (sid) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (aud, sub, sid)
sid TEXT REFERENCES <span class="function-name">sessions</span> (sid) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY <span class="function-name">KEY</span> (aud, sub, sid)
);</pre>
</ul>
@ -468,8 +469,8 @@ CREATE INDEX ON sessions (exp);</pre>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -455,8 +456,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -313,8 +314,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -401,8 +402,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -452,8 +453,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -356,8 +357,8 @@
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -26,6 +26,7 @@
<br/>
<h1>resty.session</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
@ -215,7 +216,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> is_fips = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.is_fips_mode()</pre>
<pre class="example"><span class="keyword">local</span> is_fips = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">is_fips_mode</span>()</pre>
</ul>
</dd>
@ -267,8 +268,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> packed_128 = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.bpack(<span class="number">1</span>, <span class="number">128</span>)
<span class="keyword">local</span> packed_now = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.bpack(<span class="number">8</span>, ngx.time())</pre>
<pre class="example"><span class="keyword">local</span> packed_128 = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">bpack</span>(<span class="number">1</span>, <span class="number">128</span>)
<span class="keyword">local</span> packed_now = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">bpack</span>(<span class="number">8</span>, ngx.<span class="function-name">time</span>())</pre>
</ul>
</dd>
@ -322,8 +323,8 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> value = <span class="number">128</span>
<span class="keyword">local</span> packed_value = utils.bpack(<span class="number">1</span>, value)
<span class="keyword">local</span> unpacked_value = utils.bunpack(<span class="number">1</span>, packed_value)
<span class="keyword">local</span> packed_value = utils.<span class="function-name">bpack</span>(<span class="number">1</span>, value)
<span class="keyword">local</span> unpacked_value = utils.<span class="function-name">bunpack</span>(<span class="number">1</span>, packed_value)
<span class="global">print</span>(value == unpacked_value) <span class="comment">-- true</span></pre>
</ul>
@ -368,7 +369,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> trimmed = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.trim(<span class="string">" hello world "</span>)</pre>
<pre class="example"><span class="keyword">local</span> trimmed = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">trim</span>(<span class="string">" hello world "</span>)</pre>
</ul>
</dd>
@ -399,7 +400,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> json = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.encode_json({ hello = <span class="string">"world"</span> })</pre>
<pre class="example"><span class="keyword">local</span> json = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">encode_json</span>({ hello = <span class="string">"world"</span> })</pre>
</ul>
</dd>
@ -430,7 +431,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> tbl = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.decode_json(<span class="string">'{ "hello": "world" }'</span>)</pre>
<pre class="example"><span class="keyword">local</span> tbl = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">decode_json</span>(<span class="string">'{ "hello": "world" }'</span>)</pre>
</ul>
</dd>
@ -461,7 +462,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> encoded = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.encode_base64url(<span class="string">"test"</span>)</pre>
<pre class="example"><span class="keyword">local</span> encoded = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">encode_base64url</span>(<span class="string">"test"</span>)</pre>
</ul>
</dd>
@ -493,8 +494,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> encoded = utils.encode_base64url(<span class="string">"test"</span>)
<span class="keyword">local</span> decoded = utils.decode_base64url(encoded)</pre>
<span class="keyword">local</span> encoded = utils.<span class="function-name">encode_base64url</span>(<span class="string">"test"</span>)
<span class="keyword">local</span> decoded = utils.<span class="function-name">decode_base64url</span>(encoded)</pre>
</ul>
</dd>
@ -526,7 +527,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> test = <span class="string">"test"</span>
<span class="keyword">local</span> b64len = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.base64_size(#test)</pre>
<span class="keyword">local</span> b64len = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">base64_size</span>(#test)</pre>
</ul>
</dd>
@ -558,7 +559,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> test = <span class="string">"test"</span>
<span class="keyword">local</span> deflated = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.deflate((<span class="string">"a"</span>):rep(<span class="number">100</span>))</pre>
<span class="keyword">local</span> deflated = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">deflate</span>((<span class="string">"a"</span>):<span class="function-name">rep</span>(<span class="number">100</span>))</pre>
</ul>
</dd>
@ -590,8 +591,8 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> deflated = utils.deflate((<span class="string">"a"</span>):rep(<span class="number">100</span>))
<span class="keyword">local</span> inflated = utils.inflate(deflated)</pre>
<span class="keyword">local</span> deflated = utils.<span class="function-name">deflate</span>((<span class="string">"a"</span>):<span class="function-name">rep</span>(<span class="number">100</span>))
<span class="keyword">local</span> inflated = utils.<span class="function-name">inflate</span>(deflated)</pre>
</ul>
</dd>
@ -625,7 +626,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> bytes = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.rand_bytes(<span class="number">32</span>)</pre>
<pre class="example"><span class="keyword">local</span> bytes = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)</pre>
</ul>
</dd>
@ -659,7 +660,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> hash, err = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.sha256(<span class="string">"hello world"</span>)</pre>
<pre class="example"><span class="keyword">local</span> hash, err = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">sha256</span>(<span class="string">"hello world"</span>)</pre>
</ul>
</dd>
@ -706,9 +707,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hkdf_sha256(ikm, nonce, <span class="string">"encryption"</span>, <span class="number">32</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hkdf_sha256</span>(ikm, nonce, <span class="string">"encryption"</span>, <span class="number">32</span>)</pre>
</ul>
</dd>
@ -760,8 +761,8 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> pass = <span class="string">"my-super-secret-password"</span>
<span class="keyword">local</span> salt = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_pbkdf2_hmac_sha256(pass, salt, <span class="string">"encryption"</span>, <span class="number">32</span>, <span class="number">10000</span>)</pre>
<span class="keyword">local</span> salt = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_pbkdf2_hmac_sha256</span>(pass, salt, <span class="string">"encryption"</span>, <span class="number">32</span>, <span class="number">10000</span>)</pre>
</ul>
</dd>
@ -815,9 +816,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce, <span class="string">"Medium"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce, <span class="string">"Medium"</span>)</pre>
</ul>
</dd>
@ -857,9 +858,9 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hmac_sha256_key(ikm, nonce)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hmac_sha256_key</span>(ikm, nonce)</pre>
</ul>
</dd>
@ -909,10 +910,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.encrypt_aes_256_gcm(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.<span class="function-name">encrypt_aes_256_gcm</span>(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)</pre>
</ul>
</dd>
@ -963,11 +964,11 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.derive_aes_gcm_256_key_and_iv(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.encrypt_aes_256_gcm(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)
<span class="keyword">local</span> out, err = utils.decrypt_aes_256_gcm(key, iv, ciphertext, <span class="string">"john@doe.com"</span>, tag)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err, iv = utils.<span class="function-name">derive_aes_gcm_256_key_and_iv</span>(ikm, nonce)
<span class="keyword">local</span> enc, err, tag = utils.<span class="function-name">encrypt_aes_256_gcm</span>(key, iv, <span class="string">"hello"</span>, <span class="string">"john@doe.com"</span>)
<span class="keyword">local</span> out, err = utils.<span class="function-name">decrypt_aes_256_gcm</span>(key, iv, ciphertext, <span class="string">"john@doe.com"</span>, tag)</pre>
</ul>
</dd>
@ -1006,10 +1007,10 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> ikm = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.rand_bytes(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.derive_hmac_sha256_key(ikm, nonce)
<span class="keyword">local</span> mac, err = utils.hmac_sha256(key, <span class="string">"hello"</span>)</pre>
<span class="keyword">local</span> ikm = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> nonce = utils.<span class="function-name">rand_bytes</span>(<span class="number">32</span>)
<span class="keyword">local</span> key, err = utils.<span class="function-name">derive_hmac_sha256_key</span>(ikm, nonce)
<span class="keyword">local</span> mac, err = utils.<span class="function-name">hmac_sha256</span>(key, <span class="string">"hello"</span>)</pre>
</ul>
</dd>
@ -1048,7 +1049,7 @@
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="keyword">local</span> postgres = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.load_storage(<span class="string">"postgres"</span>, {
<pre class="example"><span class="keyword">local</span> postgres = <span class="global">require</span> <span class="string">"resty.session.utils"</span>.<span class="function-name">load_storage</span>(<span class="string">"postgres"</span>, {
postgres = {
host = <span class="string">"127.0.0.1"</span>,
}
@ -1094,9 +1095,9 @@
<ul>
<pre class="example"><span class="keyword">local</span> utils = <span class="global">require</span> <span class="string">"resty.session.utils"</span>
<span class="keyword">local</span> test = <span class="string">"aaaa"</span>
<span class="keyword">local</span> data, err = utils.deflate(test)
<span class="keyword">local</span> data, err = utils.<span class="function-name">deflate</span>(test)
<span class="keyword">if</span> <span class="keyword">not</span> data <span class="keyword">then</span>
<span class="global">print</span>(utils.errmsg(err, <span class="string">"unable to deflate data '%s'"</span>, test)
<span class="global">print</span>(utils.<span class="function-name">errmsg</span>(err, <span class="string">"unable to deflate data '%s'"</span>, test)
<span class="keyword">end</span></pre>
</ul>
@ -1173,7 +1174,7 @@
<ul>
<pre class="example"><span class="keyword">local</span> flags = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
flags = utils.set_flag(flags, FLAG_DOG)</pre>
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_DOG)</pre>
</ul>
</dd>
@ -1210,8 +1211,8 @@ flags = utils.set_flag(flags, FLAG_DOG)</pre>
<ul>
<pre class="example"><span class="keyword">local</span> options = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
flags = utils.set_flag(options, FLAG_DOG)
flags = utils.unset_flag(options, FLAG_DOG)</pre>
flags = utils.<span class="function-name">set_flag</span>(options, FLAG_DOG)
flags = utils.<span class="function-name">unset_flag</span>(options, FLAG_DOG)</pre>
</ul>
</dd>
@ -1249,9 +1250,9 @@ flags = utils.unset_flag(options, FLAG_DOG)</pre>
<pre class="example"><span class="keyword">local</span> flags = <span class="number">0x0000</span>
<span class="keyword">local</span> FLAG_DOG = <span class="number">0x001</span>
<span class="keyword">local</span> FLAG_BONE = <span class="number">0x010</span>
flags = utils.set_flag(flags, FLAG_DOG)
flags = utils.set_flag(flags, FLAG_BONE)
<span class="global">print</span>(utils.has_flag(flags, FLAG_BONE)</pre>
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_DOG)
flags = utils.<span class="function-name">set_flag</span>(flags, FLAG_BONE)
<span class="global">print</span>(utils.<span class="function-name">has_flag</span>(flags, FLAG_BONE)</pre>
</ul>
</dd>
@ -1362,8 +1363,8 @@ flags = utils.set_flag(flags, FLAG_BONE)
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2023-06-05 17:05:22 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-08-16 18:11:28 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View file

@ -2194,7 +2194,7 @@ end
local session = {
_VERSION = "4.0.4",
_VERSION = "4.0.5",
metatable = metatable,
}

View file

@ -309,7 +309,7 @@ function storage.new(configuration)
local server_name = configuration and configuration.server_name
if pool or pool_size or backlog then
setmetatable({
return setmetatable({
prefix = prefix,
suffix = suffix,
host = host,

View file

@ -354,7 +354,7 @@ function storage.new(configuration)
local server_name = configuration and configuration.server_name
if pool or pool_size or backlog then
setmetatable({
return setmetatable({
prefix = prefix,
suffix = suffix,
host = host,

View file

@ -1,8 +1,8 @@
package = "lua-resty-session"
version = "4.0.4-1"
version = "4.0.5-1"
source = {
url = "git+https://github.com/bungle/lua-resty-session.git",
tag = "v4.0.4",
tag = "v4.0.5",
}
description = {
summary = "Session Library for OpenResty - Flexible and Secure",

View file

@ -136,4 +136,50 @@ describe("Testing utils", function()
end
end)
end)
describe("load_storage", function()
-- "dshm" is disabled as it currently cannot be checked by CI
for _, strategy in ipairs({ "memcached", "mysql", "postgres", "redis" }) do
it("respects pool parameters #" .. strategy, function()
local storage = assert(utils.load_storage(strategy, {
[strategy] = {
pool = "doge",
pool_size = 10,
backlog = 20,
},
}))
assert.equal("doge", storage.options.pool)
assert.equal(10, storage.options.pool_size)
assert.equal(20, storage.options.backlog)
end)
end
it("respects pool parameters #redis-sentinel", function()
local storage = assert(utils.load_storage("redis", {
redis = {
pool = "doge",
pool_size = 10,
backlog = 20,
sentinels = {},
},
}))
assert.equal("doge", storage.connector.config.connection_options.pool)
assert.equal(10, storage.connector.config.connection_options.pool_size)
assert.equal(20, storage.connector.config.connection_options.backlog)
end)
it("respects pool parameters #redis-cluster", function()
local storage = assert(utils.load_storage("redis", {
redis = {
pool = "doge",
pool_size = 10,
backlog = 20,
nodes = {},
},
}))
assert.equal("doge", storage.options.connect_opts.pool)
assert.equal(10, storage.options.connect_opts.pool_size)
assert.equal(20, storage.options.connect_opts.backlog)
end)
end)
end)

1
src/deps/src/luajit/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
/.relver export-subst

View file

@ -0,0 +1 @@
$Format:%ct$

View file

@ -58,4 +58,4 @@ script:
- sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1)
- if [ ${TRAVIS_CPU_ARCH} == "amd64" ]; then PATH=/opt/luajit21/bin:$PATH prove -I. t; fi
- cd ../luajit2-test-suite
- ./run-tests -j $JOBS $FLAGS $LUAJIT_PREFIX
- ./run-tests -j 1 $FLAGS $LUAJIT_PREFIX

View file

@ -1,7 +1,7 @@
===============================================================================
LuaJIT -- a Just-In-Time Compiler for Lua. https://luajit.org/
Copyright (C) 2005-2022 Mike Pall. All rights reserved.
Copyright (C) 2005-2023 Mike Pall. All rights reserved.
Copyright (C) 2017-2018 Yichun Zhang. All rights reserved.

View file

@ -10,16 +10,21 @@
# For MSVC, please follow the instructions given in src/msvcbuild.bat.
# For MinGW and Cygwin, cd to src and run make with the Makefile there.
#
# Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
# Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 1
RELVER= 0
PREREL= -beta3
VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
ABIVER= 5.1
# LuaJIT uses rolling releases. The release version is based on the time of
# the latest git commit. The 'git' command must be available during the build.
RELVER= $(shell cat src/luajit_relver.txt 2>/dev/null || : )
# Note: setting it with := doesn't work, since it will change during the build.
MMVERSION= $(MAJVER).$(MINVER)
VERSION= $(MMVERSION).$(RELVER)
##############################################################################
#
# Change the installation path as needed. This automatically adjusts
@ -33,10 +38,10 @@ DPREFIX= $(DESTDIR)$(PREFIX)
INSTALL_BIN= $(DPREFIX)/bin
INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
INSTALL_SHARE= $(DPREFIX)/share
INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
INSTALL_DEFINC= $(DPREFIX)/include/luajit-$(MMVERSION)
INSTALL_INC= $(INSTALL_DEFINC)
INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(VERSION)
INSTALL_LJLIBD= $(INSTALL_SHARE)/luajit-$(MMVERSION)
INSTALL_JITLIB= $(INSTALL_LJLIBD)/jit
INSTALL_LMODD= $(INSTALL_SHARE)/lua
INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
@ -50,10 +55,10 @@ INSTALL_TSYMNAME= luajit
INSTALL_ANAME= libluajit-$(ABIVER).a
INSTALL_SOSHORT1= libluajit-$(ABIVER).so
INSTALL_SOSHORT2= libluajit-$(ABIVER).so.$(MAJVER)
INSTALL_SONAME= $(INSTALL_SOSHORT2).$(MINVER).$(RELVER)
INSTALL_SONAME= libluajit-$(ABIVER).so.$(VERSION)
INSTALL_DYLIBSHORT1= libluajit-$(ABIVER).dylib
INSTALL_DYLIBSHORT2= libluajit-$(ABIVER).$(MAJVER).dylib
INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_DYLIBNAME= libluajit-$(ABIVER).$(VERSION).dylib
INSTALL_PCNAME= luajit.pc
INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
@ -78,7 +83,8 @@ INSTALL_F= install -m 0644
UNINSTALL= $(RM)
LDCONFIG= ldconfig -n 2>/dev/null
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-e "s|^multilib=.*|multilib=$(MULTILIB)|"
-e "s|^multilib=.*|multilib=$(MULTILIB)|" \
-e "s|^relver=.*|relver=$(RELVER)|"
ifneq ($(INSTALL_DEFINC),$(INSTALL_INC))
SED_PC+= -e "s|^includedir=.*|includedir=$(INSTALL_INC)|"
endif
@ -92,7 +98,9 @@ FILES_INC= lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h
FILES_JITLIB= bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua \
dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua \
dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua \
dis_mips64.lua dis_mips64el.lua vmdef.lua
dis_mips64.lua dis_mips64el.lua \
dis_mips64r6.lua dis_mips64r6el.lua \
vmdef.lua
ifeq (,$(findstring Windows,$(OS)))
HOST_SYS:= $(shell uname -s)
@ -113,9 +121,9 @@ endif
INSTALL_DEP= src/luajit
default all $(INSTALL_DEP):
@echo "==== Building LuaJIT $(VERSION) ===="
@echo "==== Building LuaJIT $(MMVERSION) ===="
$(MAKE) -C src
@echo "==== Successfully built LuaJIT $(VERSION) ===="
@echo "==== Successfully built LuaJIT $(MMVERSION) ===="
install: $(INSTALL_DEP)
@echo "==== Installing LuaJIT $(VERSION) to $(PREFIX) ===="
@ -137,10 +145,9 @@ install: $(INSTALL_DEP)
$(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
uninstall:
@echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
$(UNINSTALL) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
$(UNINSTALL) $(INSTALL_TSYM) $(INSTALL_T) $(INSTALL_STATIC) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2) $(INSTALL_MAN)/$(FILE_MAN) $(INSTALL_PC)
for file in $(FILES_JITLIB); do \
$(UNINSTALL) $(INSTALL_JITLIB)/$$file; \
done
@ -154,8 +161,9 @@ uninstall:
##############################################################################
amalg:
@echo "Building LuaJIT $(VERSION)"
@echo "==== Building LuaJIT $(MMVERSION) (amalgamation) ===="
$(MAKE) -C src amalg
@echo "==== Successfully built LuaJIT $(MMVERSION) (amalgamation) ===="
clean:
$(MAKE) -C src clean

View file

@ -1,11 +1,11 @@
README for LuaJIT 2.1.0-beta3
-----------------------------
README for LuaJIT 2.1
---------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
Project Homepage: https://luajit.org/
LuaJIT is Copyright (C) 2005-2022 Mike Pall.
LuaJIT is Copyright (C) 2005-2023 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2022 Mike Pall.
/* Copyright (C) 2004-2023 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2004-2022 Mike Pall.
/* Copyright (C) 2004-2023 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
@ -206,11 +206,9 @@ img.right {
.ext {
color: #ff8000;
}
.new {
font-size: 6pt;
vertical-align: middle;
background: #ff8000;
color: #ffffff;
.note {
padding: 0.5em 1em;
border-left: 3px solid #bfcfff;
}
#site {
clear: both;

View file

@ -3,7 +3,7 @@
<head>
<title>Contact</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -46,9 +46,9 @@
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -94,7 +94,7 @@ don't like that, please complain to Google or Microsoft, not me.
<h2>Copyright</h2>
<p>
All documentation is
Copyright &copy; 2005-2022 Mike Pall.
Copyright &copy; 2005-2023 Mike Pall.
</p>
@ -102,7 +102,7 @@ Copyright &copy; 2005-2022 Mike Pall.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>String Buffer Library</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -57,9 +57,9 @@
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -88,12 +88,6 @@ The string buffer library also includes a high-performance
<a href="serialize">serializer</a> for Lua objects.
</p>
<h2 id="wip" style="color:#ff0000">Work in Progress</h2>
<p>
<b style="color:#ff0000">This library is a work in progress. More
functionality will be added soon.</b>
</p>
<h2 id="use">Using the String Buffer Library</h2>
<p>
The string buffer library is built into LuaJIT by default, but it's not
@ -685,7 +679,7 @@ mappings of files are OK, but only if the file does not change.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>Lua/C API Extensions</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -46,9 +46,9 @@
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -173,7 +173,7 @@ Also note that this mechanism is not without overhead.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>FFI Library</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -46,9 +46,9 @@
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -316,7 +316,7 @@ without undue conversion penalties.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>ffi.* API Functions</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -51,9 +51,9 @@ td.abiparam { font-weight: bold; width: 6em; }
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -463,8 +463,10 @@ otherwise. The following parameters are currently defined:
<tr class="odd">
<td class="abiparam">win</td><td class="abidesc">Windows variant of the standard ABI</td></tr>
<tr class="even">
<td class="abiparam">uwp</td><td class="abidesc">Universal Windows Platform</td></tr>
<td class="abiparam">pauth</td><td class="abidesc">Pointer authentication ABI</td></tr>
<tr class="odd">
<td class="abiparam">uwp</td><td class="abidesc">Universal Windows Platform</td></tr>
<tr class="even">
<td class="abiparam">gc64</td><td class="abidesc">64 bit GC references</td></tr>
</table>
@ -556,7 +558,7 @@ named <tt>i</tt>.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>FFI Semantics</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -51,9 +51,9 @@ td.convop { font-style: italic; width: 40%; }
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -1246,7 +1246,7 @@ compiled.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>FFI Tutorial</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -53,9 +53,9 @@ td.idiomlua b { font-weight: normal; color: #2142bf; }
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -587,7 +587,7 @@ it to a local variable in the function scope is unnecessary.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>jit.* Library</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -46,9 +46,9 @@
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -135,7 +135,9 @@ Contains the LuaJIT version string.
<h3 id="jit_version_num"><tt>jit.version_num</tt></h3>
<p>
Contains the version number of the LuaJIT core. Version xx.yy.zz
is represented by the decimal number xxyyzz.
is represented by the decimal number xxyyzz.<br>
<b>DEPRECATED after the switch to
<a href="https://luajit.org/status.html#release"><span class="ext">&raquo;</span>&nbsp;rolling releases</a>. zz is frozen at 99.</b>
</p>
<h3 id="jit_os"><tt>jit.os</tt></h3>
@ -185,7 +187,7 @@ if you want to know more.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>Profiler</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -46,9 +46,9 @@
<a class="current" href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -349,7 +349,7 @@ use.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>Extensions</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -63,14 +63,15 @@ td.excinterop {
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT is fully upwards-compatible with Lua 5.1. It supports all
<a href="https://www.lua.org/manual/5.1/manual.html#5"><span class="ext">&raquo;</span>&nbsp;standard Lua
@ -462,7 +463,7 @@ C++ destructors.</li>
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -1,195 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Frequently Asked Questions (FAQ)</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
<style type="text/css">
dd { margin-left: 1.5em; }
</style>
</head>
<body>
<div id="site">
<a href="https://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Frequently Asked Questions (FAQ)</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="https://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li><li>
<a href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li></ul>
</li><li>
<a href="extensions.html">Extensions</a>
<ul><li>
<a href="ext_ffi.html">FFI Library</a>
<ul><li>
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
</li><li>
<a href="ext_ffi_api.html">ffi.* API</a>
</li><li>
<a href="ext_ffi_semantics.html">FFI Semantics</a>
</li></ul>
</li><li>
<a href="ext_buffer.html">String Buffers</a>
</li><li>
<a href="ext_jit.html">jit.* Library</a>
</li><li>
<a href="ext_c_api.html">Lua/C API</a>
</li><li>
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
</li><li>
<a class="current" href="faq.html">FAQ</a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<dl id="info">
<dt>Q: Where can I learn more about LuaJIT and Lua?</dt>
<dd>
<ul style="padding: 0;">
<li>The <a href="https://luajit.org/list.html"><span class="ext">&raquo;</span>&nbsp;LuaJIT mailing list</a> focuses on topics
related to LuaJIT.</li>
<li>News about Lua itself can be found at the
<a href="https://www.lua.org/lua-l.html"><span class="ext">&raquo;</span>&nbsp;Lua mailing list</a>.
The mailing list archives are worth checking out for older postings
about LuaJIT.</li>
<li>The <a href="https://lua.org"><span class="ext">&raquo;</span>&nbsp;main Lua.org site</a> has complete
<a href="https://www.lua.org/docs.html"><span class="ext">&raquo;</span>&nbsp;documentation</a> of the language
and links to books and papers about Lua.</li>
<li>The community-managed <a href="http://lua-users.org/wiki/"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a>
has information about diverse topics.</li>
</ul></dd>
</dl>
<dl id="tech">
<dt>Q: Where can I learn more about the compiler technology used by LuaJIT?</dt>
<dd>
Please use the following Google Scholar searches to find relevant papers:<br>
Search for: <a href="https://scholar.google.com/scholar?q=Trace+Compiler"><span class="ext">&raquo;</span>&nbsp;Trace Compiler</a><br>
Search for: <a href="https://scholar.google.com/scholar?q=JIT+Compiler"><span class="ext">&raquo;</span>&nbsp;JIT Compiler</a><br>
Search for: <a href="https://scholar.google.com/scholar?q=Dynamic+Language+Optimizations"><span class="ext">&raquo;</span>&nbsp;Dynamic Language Optimizations</a><br>
Search for: <a href="https://scholar.google.com/scholar?q=SSA+Form"><span class="ext">&raquo;</span>&nbsp;SSA Form</a><br>
Search for: <a href="https://scholar.google.com/scholar?q=Linear+Scan+Register+Allocation"><span class="ext">&raquo;</span>&nbsp;Linear Scan Register Allocation</a><br>
Here is a list of the <a href="http://lua-users.org/lists/lua-l/2009-11/msg00089.html"><span class="ext">&raquo;</span>&nbsp;innovative features in LuaJIT</a>.<br>
And, you know, reading the source is of course the only way to enlightenment.
</dd>
</dl>
<dl id="arg">
<dt>Q: Why do I get this error: "attempt to index global 'arg' (a nil value)"?<br>
Q: My vararg functions fail after switching to LuaJIT!</dt>
<dd>LuaJIT is compatible to the Lua 5.1 language standard. It doesn't
support the implicit <tt>arg</tt> parameter for old-style vararg
functions from Lua 5.0.<br>Please convert your code to the
<a href="https://www.lua.org/manual/5.1/manual.html#2.5.9"><span class="ext">&raquo;</span>&nbsp;Lua 5.1
vararg syntax</a>.</dd>
</dl>
<dl id="x87">
<dt>Q: Why do I get this error: "bad FPU precision"?<br>
<dt>Q: I get weird behavior after initializing Direct3D.<br>
<dt>Q: Some FPU operations crash after I load a Delphi DLL.<br>
</dt>
<dd>
DirectX/Direct3D (up to version 9) sets the x87 FPU to single-precision
mode by default. This violates the Windows ABI and interferes with the
operation of many programs &mdash; LuaJIT is affected, too. Please make
sure you always use the <tt>D3DCREATE_FPU_PRESERVE</tt> flag when
initializing Direct3D.<br>
Direct3D version 10 or higher do not show this behavior anymore.
Consider testing your application with older versions, too.<br>
Similarly, the Borland/Delphi runtime modifies the FPU control word and
enables FP exceptions. Of course, this violates the Windows ABI, too.
Please check the Delphi docs for the Set8087CW method.</dd>
</dl>
<dl id="ctrlc">
<dt>Q: Sometimes Ctrl-C fails to stop my Lua program. Why?</dt>
<dd>The interrupt signal handler sets a Lua debug hook. But this is
ignored by compiled code. If your program is running in a tight loop
and never falls back to the interpreter, the debug hook never runs and
can't throw the "interrupted!" error.<br>
You have to press Ctrl-C twice to stop your program. That's similar
to when it's stuck running inside a C function under the Lua interpreter.</dd>
</dl>
<dl id="order">
<dt>Q: Table iteration with <tt>pairs()</tt> does not result in the same order?</dt>
<dd>The order of table iteration is explicitly <b>undefined</b> by
the Lua language standard.<br>
Different Lua implementations or versions may use different orders for
otherwise identical tables. Different ways of constructing a table may
result in different orders, too.<br>
Due to improved VM security, LuaJIT 2.1 may even use a different order
on separate VM invocations or when string keys are newly interned.<br><br>
If your program relies on a deterministic order, it has a bug. Rewrite it,
so it doesn't rely on the key order. Or sort the table keys, if you must.</dd>
</dl>
<dl id="sandbox">
<dt>Q: Can Lua code be safely sandboxed?</dt>
<dd>
Maybe for an extremely restricted subset of Lua and if you relentlessly
scrutinize every single interface function you offer to the untrusted code.<br>
Although Lua provides some sandboxing functionality (<tt>setfenv()</tt>, hooks),
it's very hard to get this right even for the Lua core libraries. Of course,
you'll need to inspect any extension library, too. And there are libraries
that are inherently unsafe, e.g. the <a href="ext_ffi.html">FFI library</a>.<br>
More reading material at the <a href="http://lua-users.org/wiki/SandBoxes"><span class="ext">&raquo;</span>&nbsp;Lua Wiki</a> and <a href="https://en.wikipedia.org/wiki/Sandbox_(computer_security)"><span class="ext">&raquo;</span>&nbsp;Wikipedia</a>.<br><br>
Relatedly, <b>loading untrusted bytecode is not safe!</b><br>
It's trivial to crash the Lua or LuaJIT VM with maliciously crafted bytecode.
This is well known and there's no bytecode verification on purpose, so please
don't report a bug about it. Check the <tt>mode</tt> parameter for the
<tt>load*()</tt> functions to disable loading of bytecode.<br><br>
<b>In general, the only promising approach is to sandbox Lua code at the
process level and not the VM level.</b>
</dd>
</dl>
<dl id="arch">
<dt>Q: Lua runs everywhere. Why doesn't LuaJIT support my CPU?</dt>
<dd>Because it's a compiler &mdash; it needs to generate native
machine code. This means the code generator must be ported to each
architecture. And the fast interpreter is written in assembler and
must be ported, too. This is quite an undertaking.<br>
The <a href="install.html">install documentation</a> shows the supported
architectures.<br>
Other architectures may follow based on sufficient user demand and
market-relevance of the architecture. Sponsoring is required to develop
the port itself, to integrate it and to continuously maintain it in the
actively developed branches.</dd>
</dl>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>

View file

@ -3,7 +3,7 @@
<head>
<title>Installation</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -20,7 +20,7 @@ table.compat tr.compathead td {
font-weight: bold;
border-bottom: 2px solid #bfcfff;
}
td.compatname, td.compatver {
td.compatname {
width: 10%;
}
td.compatbits {
@ -69,18 +69,18 @@ td.compatx {
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT is only distributed as a source package. This page explains
how to build and install LuaJIT with different operating systems
and C&nbsp;compilers.
LuaJIT is only distributed as source code &mdash; get it from the
<a href="https://luajit.org/download.html"><span class="ext">&raquo;</span>&nbsp;git repository</a>. This page explains how to build
and install the LuaJIT binary and library for different operating systems.
</p>
<p>
For the impatient (on POSIX systems):
@ -90,201 +90,21 @@ make &amp;&amp; sudo make install
</pre>
<h2 id="req">Requirements</h2>
<h3 id="systems">Systems</h3>
<p>
LuaJIT currently builds out-of-the box on most systems:
LuaJIT currently builds out-of-the box on most systems. Please check the
supported operating systems and CPU architectures on the
<a href="https://luajit.org/status.html"><span class="ext">&raquo;</span>&nbsp;status page</a>.
</p>
<table class="compat">
<tr class="compathead">
<td class="compatname">OS</td>
<td class="compatver">Min. Version</td>
<td class="compatx">Requirements</td>
<td class="compatx">LuaJIT Versions</td>
</tr>
<tr class="odd separate">
<td class="compatname"><a href="#windows">Windows</a></td>
<td class="compatver">7</td>
<td class="compatx">x86 or x64, ARM64: TBA</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname"><a href="#posix">Linux</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#posix">*BSD</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname"><a href="#posix">macOS (OSX)</a></td>
<td class="compatver">10.4</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#posix">POSIX</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">mmap, dlopen</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even separate">
<td class="compatname"><a href="#android">Android</a></td>
<td class="compatver">4.0</td>
<td class="compatx">Recent Android NDK</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#ios">iOS</a></td>
<td class="compatver">3.0</td>
<td class="compatx">Xcode iOS SDK</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="even separate">
<td class="compatname"><a href="#consoles">PS3</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">PS3 SDK</td>
<td class="compatx">v2.0 &ndash; v2.1 EOL</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#consoles">PS4</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">PS4 SDK (ORBIS)</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname"><a href="#consoles">PS5</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">PS5 SDK (PROSPERO)</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#consoles">PS Vita</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">PS Vita SDK (PSP2)</td>
<td class="compatx">v2.0 &ndash; v2.1 EOL</td>
</tr>
<tr class="even">
<td class="compatname"><a href="#consoles">Xbox 360</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">Xbox 360 SDK (XEDK)</td>
<td class="compatx">v2.0 &ndash; v2.1 EOL</td>
</tr>
<tr class="odd">
<td class="compatname"><a href="#consoles">Xbox One</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">Xbox One SDK (DURANGO)</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname"><a href="#consoles">Nintendo Switch</a></td>
<td class="compatver">&nbsp;</td>
<td class="compatx">NintendoSDK + NX Addon</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
</table>
<p>
The codebase has compatibility defines for some more systems, but
without official support.
</p>
<h3 id="toolchains">Toolchains</h3>
<p>
Building LuaJIT requires a recent toolchain based on GCC, Clang/LLVM or
MSVC++.
</p>
<p>
The Makefile-based build system requires GNU Make and supports
cross-builds. Batch files are provided for MSVC++ builds and console
cross-builds.
</p>
<h3 id="architectures">CPU Architectures</h3>
<table class="compat">
<tr class="compathead">
<td class="compatname">CPU</td>
<td class="compatbits">Bits</td>
<td class="compatx">Requirements</td>
<td class="compatx">Variants</td>
<td class="compatx">LuaJIT Versions</td>
</tr>
<tr class="odd separate">
<td class="compatname">x86</td>
<td class="compatbits">32</td>
<td class="compatx">v2.1+: SSE2</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname">x64</td>
<td class="compatbits">64</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname">ARM</td>
<td class="compatbits">32</td>
<td class="compatx">ARMv5+, ARM9E+</td>
<td class="compatx">hard-fp + soft-fp</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname">ARM64</td>
<td class="compatbits">64</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">ARM64le + ARM64be</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname">PPC32</td>
<td class="compatbits">32</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">hard-fp + soft-fp</td>
<td class="compatx">v2.0 &ndash; v2.1 EOL</td>
</tr>
<tr class="even">
<td class="compatname">PPC/e500</td>
<td class="compatbits">32</td>
<td class="compatx">e500v2</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">v2.0 EOL</td>
</tr>
<tr class="odd">
<td class="compatname">MIPS32</td>
<td class="compatbits">32</td>
<td class="compatx">MIPS32r1 &ndash; r5</td>
<td class="compatx">hard-fp + soft-fp</td>
<td class="compatx">v2.0 &ndash;</td>
</tr>
<tr class="even">
<td class="compatname">MIPS64</td>
<td class="compatbits">64</td>
<td class="compatx">MIPS64r1 &ndash; r5</td>
<td class="compatx">hard-fp + soft-fp</td>
<td class="compatx">v2.1 &ndash;</td>
</tr>
<tr class="odd">
<td class="compatname">MIPS64</td>
<td class="compatbits">64</td>
<td class="compatx">MIPS64r6</td>
<td class="compatx">hard-fp + soft-fp</td>
<td class="compatx">v2.1 EOL</td>
</tr>
<tr class="even">
<td class="compatname">RISC-V</td>
<td class="compatbits">64</td>
<td class="compatx">RVA22+</td>
<td class="compatx">&nbsp;</td>
<td class="compatx">TBA</td>
</tr>
</table>
<p>
There are no plans to add historic architectures or to continue support
for end-of-life (EOL) architectures, for which no new CPUs are commonly
available anymore. Likewise, there are no plans to support marginal
and/or de-facto-dead architectures.
Batch files are provided for MSVC++ builds and console cross-builds.
</p>
<h2>Configuring LuaJIT</h2>
@ -294,7 +114,6 @@ Usually there is no need to tweak the settings. The following files
hold all user-configurable settings:
</p>
<ul>
<li><tt>src/luaconf.h</tt> sets some configuration variables.</li>
<li><tt>Makefile</tt> has settings for <b>installing</b> LuaJIT (POSIX
only).</li>
<li><tt>src/Makefile</tt> has settings for <b>compiling</b> LuaJIT
@ -317,23 +136,11 @@ Please check the note about the
<h2 id="posix">POSIX Systems (Linux, macOS, *BSD etc.)</h2>
<h3>Prerequisites</h3>
<p>
Depending on your distribution, you may need to install a package for
GCC, the development headers and/or a complete SDK. E.g. on a current
Debian/Ubuntu, install <tt>libc6-dev</tt> with the package manager.
Depending on your distribution, you may need to install a package for a
compiler (GCC or Clang/LLVM), the development headers and/or a complete SDK.
E.g. on a current Debian/Ubuntu, install <tt>build-essential</tt> with the
package manager.
</p>
<p>
The recommended way to fetch the latest version is to do a pull from
the git repository.
</p>
<p>
Alternatively, download the latest source package of LuaJIT (pick the .tar.gz).
Move it to a directory of your choice, open a terminal window and change
to this directory. Now unpack the archive and change to the newly created
directory (replace XX.YY.ZZ with the version you downloaded):
</p>
<pre class="code">
tar zxf LuaJIT-XX.YY.ZZ.tar.gz
cd LuaJIT-XX.YY.ZZ
</pre>
<h3>Building LuaJIT</h3>
<p>
@ -394,15 +201,10 @@ Either install one of the open source SDKs
GCC plus the required development headers.
Or install Microsoft's Visual Studio (MSVC).
</p>
<p>
Next, pull from the git repository or download the source package and
unpack it using an archive manager (e.g. the Windows Explorer) to
a directory of your choice.
</p>
<h3>Building with MSVC</h3>
<p>
Open a "Visual Studio Command Prompt" (either x86 or x64), <tt>cd</tt> to the
directory where you've unpacked the sources and run these commands:
directory with the source code and run these commands:
</p>
<pre class="code">
cd src
@ -415,8 +217,8 @@ Then follow the installation instructions below.
<h3>Building with MinGW or Cygwin</h3>
<p>
Open a command prompt window and make sure the MinGW or Cygwin programs
are in your path. Then <tt>cd</tt> to the directory of the git repository
or where you've unpacked the sources. Then run this command for MinGW:
are in your path. Then <tt>cd</tt> to the directory of the git repository.
Then run this command for MinGW:
</p>
<pre class="code">
mingw32-make
@ -518,15 +320,15 @@ make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabi- \
make HOST_CC="gcc -m32" CROSS=arm-linux-gnueabihf-
# ARM64
make CROSS=aarch64-linux-
make CROSS=aarch64-linux-gnu-
# PPC
make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu-
# MIPS32 big-endian
make HOST_CC="gcc -m32" CROSS=mips-linux-
make HOST_CC="gcc -m32" CROSS=mips-linux-gnu-
# MIPS32 little-endian
make HOST_CC="gcc -m32" CROSS=mipsel-linux-
make HOST_CC="gcc -m32" CROSS=mipsel-linux-gnu-
# MIPS64 big-endian
make CROSS=mips-linux- TARGET_CFLAGS="-mips64r2 -mabi=64"
@ -605,8 +407,8 @@ make HOST_CC="gcc -m32" CROSS=ppu-lv2-
To cross-compile for the other consoles from a Windows host, open a
"Native Tools Command Prompt for VS". You need to choose either the 32
or the 64&nbsp;bit version of the host compiler to match the target.
Then <tt>cd</tt> to the <tt>src</tt> directory below where you've
unpacked the sources and run the build command given in the table:
Then <tt>cd</tt> to the <tt>src</tt> directory below the source code
and run the build command given in the table:
</p>
<table class="compat">
<tr class="compathead">
@ -766,7 +568,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>LuaJIT</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -67,30 +67,6 @@ table.fcompat td {
background-image: -o-linear-gradient(#41bfbf 10%, #b0ffff 95%);
background-image: -ms-linear-gradient(#41bfbf 10%, #b0ffff 95%);
}
table.stats td {
color: #ffffff;
background: #a0a0a0;
background-image: linear-gradient(#808080 10%, #d0d0d0 95%);
background-image: -moz-linear-gradient(#808080 10%, #d0d0d0 95%);
background-image: -webkit-linear-gradient(#808080 10%, #d0d0d0 95%);
background-image: -o-linear-gradient(#808080 10%, #d0d0d0 95%);
background-image: -ms-linear-gradient(#808080 10%, #d0d0d0 95%);
}
table.stats td.speed {
color: #ff4020;
}
table.stats td.kb {
color: #ffff80;
background: #808080;
background-image: linear-gradient(#606060 10%, #c0c0c0 95%);
background-image: -moz-linear-gradient(#606060 10%, #c0c0c0 95%);
background-image: -webkit-linear-gradient(#606060 10%, #c0c0c0 95%);
background-image: -o-linear-gradient(#606060 10%, #c0c0c0 95%);
background-image: -ms-linear-gradient(#606060 10%, #c0c0c0 95%);
}
table.feature small {
font-size: 50%;
}
</style>
</head>
<body>
@ -131,9 +107,9 @@ table.feature small {
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
@ -146,7 +122,7 @@ Lua is a powerful, dynamic and light-weight programming language.
It may be embedded or used as a general-purpose, stand-alone language.
</p>
<p>
LuaJIT is Copyright &copy; 2005-2022 Mike Pall, released under the
LuaJIT is Copyright &copy; 2005-2023 Mike Pall, released under the
<a href="https://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT open source license</a>.
</p>
<p>
@ -173,23 +149,20 @@ LuaJIT is Copyright &copy; 2005-2022 Mike Pall, released under the
</table>
<h2>Overview</h2>
<table class="feature stats">
<tr>
<td class="speed">3x<br>-&nbsp;&nbsp;100x</td>
<td class="kb">115&nbsp;<small>KB</small><br>VM</td>
<td class="kb">90&nbsp;<small>KB</small><br>JIT</td>
<td class="kloc">63&nbsp;<small>KLOC</small><br>C</td>
<td class="kloc">24&nbsp;<small>KLOC</small><br>ASM</td>
<td class="kloc">11&nbsp;<small>KLOC</small><br>Lua</td>
</tr>
</table>
<p style="margin-top: 1em;">
LuaJIT has been successfully used as a <b>scripting middleware</b> in
games, appliances, network and graphics apps, numerical simulations,
trading platforms and many other specialty applications. It scales from
embedded devices, smartphones, desktops up to server farms. It combines
high flexibility with high performance
and an unmatched <b>low memory footprint</b>.
trading platforms and many other specialty applications.
</p>
<p>
LuaJIT is part of a hundred million web sites, huge SaaS installations,
network switches, set-top boxes and other embedded devices. You've probably
already used LuaJIT without knowing about it.
</p>
<p>
LuaJIT scales from embedded devices, smartphones, desktops up to server
farms. It combines high flexibility with high performance and an unmatched
<b>low memory footprint</b>.
</p>
<p>
LuaJIT has been in continuous development since 2005. It's widely
@ -220,7 +193,7 @@ Please select a sub-topic in the navigation bar to learn more about LuaJIT.
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -3,7 +3,7 @@
<head>
<title>Running LuaJIT</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Copyright" content="Copyright (C) 2005-2023">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@ -68,14 +68,15 @@ td.param_default {
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a href="status.html">Status</a>
<a href="https://luajit.org/status.html">Status <span class="ext">&raquo;</span></a>
</li><li>
<a href="faq.html">FAQ</a>
<a href="https://luajit.org/faq.html">FAQ <span class="ext">&raquo;</span></a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
LuaJIT has only a single stand-alone executable, called <tt>luajit</tt> on
POSIX systems or <tt>luajit.exe</tt> on Windows. It can be used to run simple
@ -302,7 +303,7 @@ Here are the parameters and their default settings:
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
Copyright &copy; 2005-2023
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>

View file

@ -1,105 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Status</title>
<meta charset="utf-8">
<meta name="Copyright" content="Copyright (C) 2005-2022">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
<style type="text/css">
ul li { padding-bottom: 0.3em; }
</style>
</head>
<body>
<div id="site">
<a href="https://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
<h1>Status</h1>
</div>
<div id="nav">
<ul><li>
<a href="luajit.html">LuaJIT</a>
<ul><li>
<a href="https://luajit.org/download.html">Download <span class="ext">&raquo;</span></a>
</li><li>
<a href="install.html">Installation</a>
</li><li>
<a href="running.html">Running</a>
</li></ul>
</li><li>
<a href="extensions.html">Extensions</a>
<ul><li>
<a href="ext_ffi.html">FFI Library</a>
<ul><li>
<a href="ext_ffi_tutorial.html">FFI Tutorial</a>
</li><li>
<a href="ext_ffi_api.html">ffi.* API</a>
</li><li>
<a href="ext_ffi_semantics.html">FFI Semantics</a>
</li></ul>
</li><li>
<a href="ext_buffer.html">String Buffers</a>
</li><li>
<a href="ext_jit.html">jit.* Library</a>
</li><li>
<a href="ext_c_api.html">Lua/C API</a>
</li><li>
<a href="ext_profiler.html">Profiler</a>
</li></ul>
</li><li>
<a class="current" href="status.html">Status</a>
</li><li>
<a href="faq.html">FAQ</a>
</li><li>
<a href="https://luajit.org/list.html">Mailing List <span class="ext">&raquo;</span></a>
</li></ul>
</div>
<div id="main">
<p>
This documentation is for LuaJIT 2.1.0-beta3. Please check the <tt>doc</tt>
directory in each git branch for the version-specific documentation.
</p>
<p>
The currently developed branches are LuaJIT&nbsp;2.1 and LuaJIT&nbsp;2.0.
</p>
<p>
LuaJIT&nbsp;2.0 is in feature-freeze &mdash; new features will only
be added to LuaJIT&nbsp;2.1.
</p>
<h2>Current Status</h2>
<p>
LuaJIT ought to run all Lua&nbsp;5.1-compatible source code just fine.
It's considered a serious bug if the VM crashes or produces unexpected
results &mdash; please report this.
</p>
<p>
Known incompatibilities and issues in LuaJIT&nbsp;2.0:
</p>
<ul>
<li>
There are some differences in <b>implementation-defined</b> behavior.
These either have a good reason, are arbitrary design choices,
or are due to quirks in the VM. The latter cases may get fixed if a
demonstrable need is shown.
</li>
<li>
The Lua <b>debug API</b> is missing a couple of features (return
hooks for non-Lua functions) and shows slightly different behavior
in LuaJIT (no per-coroutine hooks, no tail call counting).
</li>
</ul>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
Copyright &copy; 2005-2022
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
</span>
</div>
</body>
</html>

View file

@ -1,6 +1,6 @@
/*
** DynASM ARM encoding engine.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
@ -70,7 +70,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -87,7 +87,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -98,12 +97,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -123,7 +117,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
@ -148,6 +142,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -372,7 +367,7 @@ int dasm_encode(Dst_DECL, void *buffer)
break;
case DASM_REL_LG:
if (n < 0) {
n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp - 4);
n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp - 4);
goto patchrel;
}
/* fallthrough */
@ -396,7 +391,7 @@ int dasm_encode(Dst_DECL, void *buffer)
}
break;
case DASM_LABEL_LG:
ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n);
break;
case DASM_LABEL_PC: break;
case DASM_IMM:

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM ARM module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View file

@ -1,6 +1,6 @@
/*
** DynASM ARM64 encoding engine.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
@ -72,7 +72,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -89,7 +89,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -100,12 +99,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -125,7 +119,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
@ -150,6 +144,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -444,7 +439,7 @@ int dasm_encode(Dst_DECL, void *buffer)
break;
case DASM_REL_LG:
if (n < 0) {
ptrdiff_t na = (ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp + 4;
ptrdiff_t na = (ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp + 4;
n = (int)na;
CK((ptrdiff_t)n == na, RANGE_REL);
goto patchrel;
@ -487,7 +482,7 @@ int dasm_encode(Dst_DECL, void *buffer)
goto patchrel;
}
case DASM_LABEL_LG:
ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n);
break;
case DASM_LABEL_PC: break;
case DASM_IMM:

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM ARM64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
@ -823,6 +823,13 @@ map_op = {
tbz_3 = "36000000DTBw|36000000DTBx",
tbnz_3 = "37000000DTBw|37000000DTBx",
-- ARM64e: Pointer authentication codes (PAC).
blraaz_1 = "d63f081fNx",
braa_2 = "d71f0800NDx",
braaz_1 = "d61f081fNx",
pacibsp_0 = "d503237f",
retab_0 = "d65f0fff",
-- Miscellaneous instructions.
-- TODO: hlt, hvc, smc, svc, eret, dcps[123], drps, mrs, msr
-- TODO: sys, sysl, ic, dc, at, tlbi

View file

@ -1,6 +1,6 @@
/*
** DynASM MIPS encoding engine.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
@ -69,7 +69,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -86,7 +86,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -97,12 +96,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -122,7 +116,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
@ -147,6 +141,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -350,7 +345,7 @@ int dasm_encode(Dst_DECL, void *buffer)
break;
case DASM_REL_LG:
if (n < 0) {
n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp);
n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp);
goto patchrel;
}
/* fallthrough */
@ -369,7 +364,7 @@ int dasm_encode(Dst_DECL, void *buffer)
}
break;
case DASM_LABEL_LG:
ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n);
break;
case DASM_LABEL_PC: break;
case DASM_IMMS:

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM MIPS32/MIPS64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM MIPS64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- This module just sets 64 bit mode for the combined MIPS/MIPS64 module.

View file

@ -1,6 +1,6 @@
/*
** DynASM PPC/PPC64 encoding engine.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
@ -69,7 +69,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -86,7 +86,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -97,12 +96,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -122,7 +116,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
@ -147,6 +141,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -354,7 +349,7 @@ int dasm_encode(Dst_DECL, void *buffer)
break;
case DASM_REL_LG:
if (n < 0) {
n = (int)((ptrdiff_t)D->globals[-n] - (ptrdiff_t)cp);
n = (int)((ptrdiff_t)D->globals[-n-10] - (ptrdiff_t)cp);
goto patchrel;
}
/* fallthrough */
@ -368,7 +363,7 @@ int dasm_encode(Dst_DECL, void *buffer)
cp[-1] |= ((n+4) & ((ins & 2048) ? 0x0000fffc: 0x03fffffc));
break;
case DASM_LABEL_LG:
ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
ins &= 2047; if (ins >= 20) D->globals[ins-20] = (void *)(base + n);
break;
case DASM_LABEL_PC: break;
case DASM_IMM:

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM PPC/PPC64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
--
-- Support for various extensions contributed by Caio Souza Oliveira.

View file

@ -1,6 +1,6 @@
/*
** DynASM encoding engine prototypes.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/

View file

@ -72,7 +72,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -89,7 +89,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -100,12 +99,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -127,7 +121,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10 + maxgl) * sizeof(int));
}
@ -153,6 +147,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -463,7 +458,7 @@ int dasm_encode(Dst_DECL, void *buffer)
case DASM_LABEL_LG:
ins = *p++;
if (ins >= 20)
D->globals[ins - 10] = (void *)(base + n);
D->globals[ins - 20] = (void *)(base + n);
break;
case DASM_LABEL_PC:
break;

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- This module just sets 64 bit mode for the combined x86/x64 module.

View file

@ -1,6 +1,6 @@
/*
** DynASM x86 encoding engine.
** Copyright (C) 2005-2022 Mike Pall. All rights reserved.
** Copyright (C) 2005-2023 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
@ -68,7 +68,7 @@ struct dasm_State {
size_t lgsize;
int *pclabels; /* PC label chains/pos ptrs. */
size_t pcsize;
void **globals; /* Array of globals (bias -10). */
void **globals; /* Array of globals. */
dasm_Section *section; /* Pointer to active section. */
size_t codesize; /* Total size of all code sections. */
int maxsection; /* 0 <= sectionidx < maxsection. */
@ -85,7 +85,6 @@ void dasm_init(Dst_DECL, int maxsection)
{
dasm_State *D;
size_t psz = 0;
int i;
Dst_REF = NULL;
DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
D = Dst_REF;
@ -96,12 +95,7 @@ void dasm_init(Dst_DECL, int maxsection)
D->pcsize = 0;
D->globals = NULL;
D->maxsection = maxsection;
for (i = 0; i < maxsection; i++) {
D->sections[i].buf = NULL; /* Need this for pass3. */
D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
D->sections[i].bsize = 0;
D->sections[i].epos = 0; /* Wrong, but is recalculated after resize. */
}
memset((void *)D->sections, 0, maxsection * sizeof(dasm_Section));
}
/* Free DynASM state. */
@ -121,7 +115,7 @@ void dasm_free(Dst_DECL)
void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl)
{
dasm_State *D = Dst_REF;
D->globals = gl - 10; /* Negative bias to compensate for locals. */
D->globals = gl;
DASM_M_GROW(Dst, int, D->lglabels, D->lgsize, (10+maxgl)*sizeof(int));
}
@ -146,6 +140,7 @@ void dasm_setup(Dst_DECL, const void *actionlist)
if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
for (i = 0; i < D->maxsection; i++) {
D->sections[i].pos = DASM_SEC2POS(i);
D->sections[i].rbuf = D->sections[i].buf - D->sections[i].pos;
D->sections[i].ofs = 0;
}
}
@ -445,7 +440,7 @@ int dasm_encode(Dst_DECL, void *buffer)
break;
}
case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
b++; n = (int)(ptrdiff_t)D->globals[-n];
b++; n = (int)(ptrdiff_t)D->globals[-n-10];
/* fallthrough */
case DASM_REL_A: rel_a:
n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
@ -459,7 +454,7 @@ int dasm_encode(Dst_DECL, void *buffer)
}
case DASM_IMM_LG:
p++;
if (n < 0) { dasma((ptrdiff_t)D->globals[-n]); break; }
if (n < 0) { dasma((ptrdiff_t)D->globals[-n-10]); break; }
/* fallthrough */
case DASM_IMM_PC: {
int *pb = DASM_POS2PTR(D, n);
@ -469,7 +464,7 @@ int dasm_encode(Dst_DECL, void *buffer)
case DASM_LABEL_LG: {
int idx = *p++;
if (idx >= 10)
D->globals[idx] = (void *)(base + (*p == DASM_SETLABEL ? *b : n));
D->globals[idx-10] = (void *)(base + (*p == DASM_SETLABEL ? *b : n));
break;
}
case DASM_LABEL_PC: case DASM_SETLABEL: break;

View file

@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x86/x64 module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------

View file

@ -2,7 +2,7 @@
-- DynASM. A dynamic assembler for code generation engines.
-- Originally designed and implemented for LuaJIT.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- See below for full copyright notice.
------------------------------------------------------------------------------
@ -17,7 +17,7 @@ local _info = {
url = "https://luajit.org/dynasm.html",
license = "MIT",
copyright = [[
Copyright (C) 2005-2022 Mike Pall. All rights reserved.
Copyright (C) 2005-2023 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View file

@ -74,7 +74,7 @@ luajit \-jv \-e "for i=1,10 do for j=1,10 do for k=1,100 do end end end"
Runs some nested loops and shows the resulting traces.
.SH COPYRIGHT
.PP
\fBLuaJIT\fR is Copyright \(co 2005-2022 Mike Pall.
\fBLuaJIT\fR is Copyright \(co 2005-2023 Mike Pall.
.br
\fBLuaJIT\fR is open source software, released under the MIT license.
.SH SEE ALSO

View file

@ -1,8 +1,8 @@
# Package information for LuaJIT to be used by pkg-config.
majver=2
minver=1
relver=0
version=${majver}.${minver}.${relver}-beta3
relver=ROLLING
version=${majver}.${minver}.${relver}
abiver=5.1
prefix=/usr/local

View file

@ -1,4 +1,6 @@
luajit
luajit.h
luajit_relver.txt
lj_bcdef.h
lj_ffdef.h
lj_libdef.h

View file

@ -7,12 +7,11 @@
# Also works with MinGW and Cygwin on Windows.
# Please check msvcbuild.bat for building with MSVC on Windows.
#
# Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
# Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 1
RELVER= 0
ABIVER= 5.1
NODOTABIVER= 51
@ -327,13 +326,13 @@ ifeq (Darwin,$(TARGET_SYS))
TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
TARGET_DYNXLDOPTS=
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255
else
ifeq (iOS,$(TARGET_SYS))
TARGET_STRIP+= -x
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
TARGET_DYNXLDOPTS=
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).255
ifeq (arm64,$(TARGET_LJARCH))
TARGET_XCFLAGS+= -fno-omit-frame-pointer
endif
@ -392,10 +391,11 @@ MINILUA_O= host/minilua.o
MINILUA_LIBS= -lm
MINILUA_T= host/minilua
MINILUA_X= $(MINILUA_T)
MINILUA_DEP=
ifeq (,$(HOST_LUA))
HOST_LUA= $(MINILUA_X)
DASM_DEP= $(MINILUA_T)
MINILUA_DEP= $(MINILUA_T)
endif
DASM_DIR= ../dynasm
@ -437,6 +437,10 @@ ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH)))
DASM_AFLAGS+= -D NO_UNWIND
TARGET_ARCH+= -DLUAJIT_NO_UNWIND
endif
ifneq (,$(findstring LJ_ABI_PAUTH 1,$(TARGET_TESTARCH)))
DASM_AFLAGS+= -D PAUTH
TARGET_ARCH+= -DLJ_ABI_PAUTH=1
endif
DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH))))
ifeq (Windows,$(TARGET_SYS))
DASM_AFLAGS+= -D WIN
@ -483,6 +487,10 @@ endif
DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS)
DASM_DASC= vm_$(DASM_ARCH).dasc
GIT= git
GIT_RELVER= [ -e ../.git ] && $(GIT) show -s --format=%ct >luajit_relver.txt 2>/dev/null || cat ../.relver >luajit_relver.txt 2>/dev/null || :
GIT_DEP= $(wildcard ../.git/HEAD ../.git/refs/heads/*)
BUILDVM_O= host/buildvm.o host/buildvm_asm.o host/buildvm_peobj.o \
host/buildvm_lib.o host/buildvm_fold.o
BUILDVM_T= host/buildvm
@ -535,8 +543,8 @@ LUAJIT_T= luajit
ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(HOST_T)
ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h \
host/buildvm_arch.h
ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP)
host/buildvm_arch.h luajit.h
ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) luajit_relver.txt $(LIB_VMDEFP)
WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM)
@ -660,7 +668,12 @@ $(MINILUA_T): $(MINILUA_O)
$(E) "HOSTLINK $@"
$(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS)
host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua lj_arch.h lua.h luaconf.h
luajit.h: $(MINILUA_DEP) $(GIT_DEP) luajit_rolling.h
$(E) "VERSION $@"
$(Q)$(GIT_RELVER)
$(Q)$(HOST_LUA) host/genversion.lua
host/buildvm_arch.h: $(DASM_DASC) $(MINILUA_DEP) lj_arch.h lua.h luaconf.h
$(E) "DYNASM $@"
$(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC)

View file

@ -1,6 +1,6 @@
lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
lj_arch.h lj_err.h lj_errmsg.h lj_state.h lj_trace.h lj_jit.h lj_ir.h \
lj_dispatch.h lj_bc.h lj_traceerr.h lj_lib.h
lj_dispatch.h lj_bc.h lj_traceerr.h lj_lib.h lj_vmevent.h
lib_base.o: lib_base.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h \
lj_def.h lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_buf.h \
lj_str.h lj_tab.h lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_ctype.h \
@ -55,7 +55,7 @@ lj_asm.o: lj_asm.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_buf.h lj_str.h lj_tab.h lj_frame.h lj_bc.h lj_ctype.h lj_ir.h \
lj_jit.h lj_ircall.h lj_iropt.h lj_mcode.h lj_trace.h lj_dispatch.h \
lj_traceerr.h lj_snap.h lj_asm.h lj_vm.h lj_target.h lj_target_*.h \
lj_emit_*.h lj_asm_*.h
lj_prng.h lj_emit_*.h lj_asm_*.h
lj_assert.o: lj_assert.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h
lj_bc.o: lj_bc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_bc.h \
lj_bcdef.h
@ -124,7 +124,7 @@ lj_func.o: lj_func.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_gc.o: lj_gc.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_buf.h lj_str.h lj_tab.h lj_func.h lj_udata.h \
lj_meta.h lj_state.h lj_frame.h lj_bc.h lj_ctype.h lj_cdata.h lj_trace.h \
lj_jit.h lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h
lj_jit.h lj_ir.h lj_dispatch.h lj_traceerr.h lj_vm.h lj_vmevent.h
lj_gdbjit.o: lj_gdbjit.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_gc.h lj_err.h lj_errmsg.h lj_debug.h lj_frame.h lj_bc.h lj_buf.h \
lj_str.h lj_strfmt.h lj_jit.h lj_ir.h lj_dispatch.h
@ -222,25 +222,25 @@ ljamalg.o: ljamalg.c lua.h luaconf.h lauxlib.h lj_assert.c lj_obj.h \
lj_def.h lj_arch.h lj_gc.c lj_gc.h lj_err.h lj_errmsg.h lj_buf.h \
lj_str.h lj_tab.h lj_func.h lj_udata.h lj_meta.h lj_state.h lj_frame.h \
lj_bc.h lj_ctype.h lj_cdata.h lj_trace.h lj_jit.h lj_ir.h lj_dispatch.h \
lj_traceerr.h lj_vm.h lj_err.c lj_debug.h lj_ff.h lj_ffdef.h lj_strfmt.h \
lj_char.c lj_char.h lj_bc.c lj_bcdef.h lj_obj.c lj_buf.c lj_str.c \
lj_prng.h lj_tab.c lj_func.c lj_udata.c lj_meta.c lj_strscan.h lj_lib.h \
lj_debug.c lj_prng.c lj_state.c lj_lex.h lj_alloc.h luajit.h \
lj_dispatch.c lj_ccallback.h lj_profile.h lj_vmevent.c lj_vmevent.h \
lj_vmmath.c lj_strscan.c lj_strfmt.c lj_strfmt_num.c lj_serialize.c \
lj_serialize.h lj_api.c lj_profile.c lj_lex.c lualib.h lj_parse.h \
lj_parse.c lj_bcread.c lj_bcdump.h lj_bcwrite.c lj_load.c lj_ctype.c \
lj_cdata.c lj_cconv.h lj_cconv.c lj_ccall.c lj_ccall.h lj_ccallback.c \
lj_target.h lj_target_*.h lj_mcode.h lj_carith.c lj_carith.h lj_clib.c \
lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_ir.c lj_ircall.h \
lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h lj_opt_narrow.c \
lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c lj_opt_sink.c \
lj_mcode.c lj_snap.c lj_record.c lj_record.h lj_ffrecord.h lj_crecord.c \
lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h lj_emit_*.h \
lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c lib_aux.c \
lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c lib_io.c \
lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c lib_ffi.c \
lib_buffer.c lib_init.c
lj_traceerr.h lj_vm.h lj_vmevent.h lj_err.c lj_debug.h lj_ff.h \
lj_ffdef.h lj_strfmt.h lj_char.c lj_char.h lj_bc.c lj_bcdef.h lj_obj.c \
lj_buf.c lj_str.c lj_prng.h lj_tab.c lj_func.c lj_udata.c lj_meta.c \
lj_strscan.h lj_lib.h lj_debug.c lj_prng.c lj_state.c lj_lex.h \
lj_alloc.h luajit.h lj_dispatch.c lj_ccallback.h lj_profile.h \
lj_vmevent.c lj_vmmath.c lj_strscan.c lj_strfmt.c lj_strfmt_num.c \
lj_serialize.c lj_serialize.h lj_api.c lj_profile.c lj_lex.c lualib.h \
lj_parse.h lj_parse.c lj_bcread.c lj_bcdump.h lj_bcwrite.c lj_load.c \
lj_ctype.c lj_cdata.c lj_cconv.h lj_cconv.c lj_ccall.c lj_ccall.h \
lj_ccallback.c lj_target.h lj_target_*.h lj_mcode.h lj_carith.c \
lj_carith.h lj_clib.c lj_clib.h lj_cparse.c lj_cparse.h lj_lib.c lj_ir.c \
lj_ircall.h lj_iropt.h lj_opt_mem.c lj_opt_fold.c lj_folddef.h \
lj_opt_narrow.c lj_opt_dce.c lj_opt_loop.c lj_snap.h lj_opt_split.c \
lj_opt_sink.c lj_mcode.c lj_snap.c lj_record.c lj_record.h lj_ffrecord.h \
lj_crecord.c lj_crecord.h lj_ffrecord.c lj_recdef.h lj_asm.c lj_asm.h \
lj_emit_*.h lj_asm_*.h lj_trace.c lj_gdbjit.h lj_gdbjit.c lj_alloc.c \
lib_aux.c lib_base.c lj_libdef.h lib_math.c lib_string.c lib_table.c \
lib_io.c lib_os.c lib_package.c lib_debug.c lib_bit.c lib_jit.c \
lib_ffi.c lib_buffer.c lib_init.c
luajit.o: luajit.c lua.h luaconf.h lauxlib.h lualib.h luajit.h lj_arch.h
host/buildvm.o: host/buildvm.c host/buildvm.h lj_def.h lua.h luaconf.h \
lj_arch.h lj_obj.h lj_def.h lj_arch.h lj_gc.h lj_obj.h lj_bc.h lj_ir.h \

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
**
** This is a tool to build the hand-tuned assembler code required for
** LuaJIT's bytecode interpreter. It supports a variety of output formats
@ -331,6 +331,7 @@ static void emit_vmdef(BuildCtx *ctx)
#endif
int i;
fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n");
fprintf(ctx->fp, "assert(require(\"jit\").version == \"%s\", \"LuaJIT core/library version mismatch\")\n\n", LUAJIT_VERSION);
fprintf(ctx->fp, "return {\n\n");
fprintf(ctx->fp, "bcnames = \"");

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _BUILDVM_H

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: Assembler source code emitter.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
@ -298,6 +298,12 @@ void emit_asm(BuildCtx *ctx)
fprintf(ctx->fp, "\t.abiversion 2\n");
#endif
fprintf(ctx->fp, "\t.text\n");
#if LJ_TARGET_MIPS32 && !LJ_ABI_SOFTFP
fprintf(ctx->fp, "\t.module fp=32\n");
#endif
#if LJ_TARGET_MIPS
fprintf(ctx->fp, "\t.set nomips16\n\t.abicalls\n\t.set noreorder\n\t.set nomacro\n");
#endif
emit_asm_align(ctx, 4);
#if LJ_TARGET_PS3
@ -323,9 +329,6 @@ void emit_asm(BuildCtx *ctx)
".save {r4, r5, r6, r7, r8, r9, r10, r11, lr}\n"
".pad #28\n");
#endif
#endif
#if LJ_TARGET_MIPS
fprintf(ctx->fp, ".set nomips16\n.abicalls\n.set noreorder\n.set nomacro\n");
#endif
for (i = rel = 0; i < ctx->nsym; i++) {

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: IR folding hash table generator.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: library definition compiler.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
@ -378,7 +378,8 @@ void emit_lib(BuildCtx *ctx)
char *p;
/* Simplistic pre-processor. Only handles top-level #if/#endif. */
if (buf[0] == '#' && buf[1] == 'i' && buf[2] == 'f') {
int ok = 1, len = strlen(buf);
int ok = 1;
size_t len = strlen(buf);
if (buf[len-1] == '\n') {
buf[len-1] = 0;
if (buf[len-2] == '\r') {
@ -391,7 +392,7 @@ void emit_lib(BuildCtx *ctx)
ok = LJ_HASJIT;
else if (!strcmp(buf, "#if LJ_HASFFI"))
ok = LJ_HASFFI;
else if (!strcmp(buf, "#if LJ_HASBUFFER\n"))
else if (!strcmp(buf, "#if LJ_HASBUFFER"))
ok = LJ_HASBUFFER;
if (!ok) {
int lvl = 1;

View file

@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: PE object emitter.
** Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
**
** Only used for building on Windows, since we cannot assume the presence
** of a suitable assembler. The host and target byte order must match.

View file

@ -2,7 +2,7 @@
-- Lua script to dump the bytecode of the library functions written in Lua.
-- The resulting 'buildvm_libbc.h' is used for the build process of LuaJIT.
----------------------------------------------------------------------------
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------

View file

@ -2,7 +2,7 @@
-- Lua script to generate a customized, minified version of Lua.
-- The resulting 'minilua' is used for the build process of LuaJIT.
----------------------------------------------------------------------------
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------

View file

@ -0,0 +1,44 @@
----------------------------------------------------------------------------
-- Lua script to embed the rolling release version in luajit.h.
----------------------------------------------------------------------------
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
local FILE_ROLLING_H = "luajit_rolling.h"
local FILE_RELVER_TXT = "luajit_relver.txt"
local FILE_LUAJIT_H = "luajit.h"
local function file_read(file)
local fp = assert(io.open(file, "rb"), "run from the wrong directory")
local data = assert(fp:read("*a"))
fp:close()
return data
end
local function file_write_mod(file, data)
local fp = io.open(file, "rb")
if fp then
local odata = assert(fp:read("*a"))
fp:close()
if odata == data then return end
end
fp = assert(io.open(file, "wb"))
assert(fp:write(data))
assert(fp:close())
end
local text = file_read(FILE_ROLLING_H)
local relver = file_read(FILE_RELVER_TXT):match("(%d+)")
if relver then
text = text:gsub("ROLLING", relver)
else
io.stderr:write([[
**** WARNING Cannot determine rolling release version from git log.
**** WARNING The 'git' command must be available during the build.
]])
file_write_mod(FILE_RELVER_TXT, "ROLLING\n") -- Fallback for install target.
end
file_write_mod(FILE_LUAJIT_H, text)

View file

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT bytecode listing module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -41,7 +41,6 @@
-- Cache some library functions and objects.
local jit = require("jit")
assert(jit.version_num == 20100, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local bit = require("bit")

View file

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT module to save/list bytecode.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@ -11,7 +11,7 @@
------------------------------------------------------------------------------
local jit = require("jit")
assert(jit.version_num == 20100, "LuaJIT core/library version mismatch")
assert(jit.version_num == 20199, "LuaJIT core/library version mismatch")
local bit = require("bit")
-- Symbol name prefix for LuaJIT bytecode.

View file

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT ARM disassembler module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.

View file

@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT ARM64 disassembler module.
--
-- Copyright (C) 2005-2022 Mike Pall. All rights reserved.
-- Copyright (C) 2005-2023 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
--
-- Contributed by Djordje Kovacevic and Stefan Pejic from RT-RK.com.

Some files were not shown because too many files have changed in this diff Show more