Skip to content

Conversation

@Brugarolas
Copy link
Owner

No description provided.

agentzh and others added 30 commits July 19, 2018 19:59
… in current stack upon trace exiting. thanks Mike Pall."

This reverts commit aa8fc2e.
The Lua API can be used like below:

  local exdata = require "thread.exdata"
  exdata(0xdeadbeefLL)  -- set the exdata of the current Lua thread
  local ptr = exdata()  -- fetch the exdata of the current Lua thread

The exdata value on the Lua land is represented as a cdata object of the
ctype "void*".

Right now the reading API, i.e., `exdata()` calls without any arguments,
can be JIT compiled.

Also exposed the following public C API functions for manipulating
exdata on the C land:

  void lua_setexdata(lua_State *L, void *exdata);
  void *lua_getexdata(lua_State *L);

The exdata pointer is initialized to NULL when the main thread is
created. Any child Lua threads created will inherit the parent's exdata
but still have their own exdata storage. So child Lua threads can always
override the inherited parent exdata pointer values.

This API is used internally by the OpenResty core so never ever mess
with it yourself in the context of OpenResty.

Thanks Zexuan Luo for preparing the final version of the patch.

Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
…d LUAJIT_ENABLE_GC64 are both supplied.

The !LJ_64 branch is unable to handle pointer address > 2G.

There is not Valgrind error report when running the test cases under
lua-nginx-module and lua-resty-core after this modification.
…ow for large Lua programs, leading to segfaults; enlarged them to 32-bit.
…d overflow for large Lua programs, leading to segfaults; enlarged them to 32-bit."

This reverts commit 520d53a.
…ertion `nslots <= 250' failed" found by stressing our edgelang compiler.
This Lua API can be JIT compiled.

Returns true when the table contains non-nil array elements or non-nil
key-value pairs.

Usage:

```lua
    local isempty = require "table.isempty"
    print(isempty({}))  -- true
    print(isempty({nil, dog = nil}))  -- true
    print(isempty({"a", "b"}))  -- false
    print(isempty({nil, 3}))  -- false
    print(isempty({cat = 3}))  -- false
```

Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
…eturns true for purely array-like Lua tables and false otherwise.

Empty Lua tables are treated as arrays.

Use it like this:

    isarr = require "table.isarray"
    print(isarr{"a", true, 3.14})  -- true
    print(isarr{"dog" = 3})  -- false
    print(isarr{})  -- true

Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
This Lua builtin returns the number of elements in a Lua table, i.e.,
the number of non-nil array elements plus the number of non-nil key-value
pairs in a single Lua table.

It can be used like this:

  local nkeys = require "table.nkeys"

  print(nkeys({}))  -- 0
  print(nkeys({ "a", nil, "b" }))  -- 2
  print(nkeys({ dog = 3, cat = 4, bird = nil }))  -- 2
  print(nkeys({ "a", dog = 3, cat = 4 }))  -- 3

This Lua API can be JIT compiled.

Signed-off-by: Yichun Zhang (agentzh) <agentzh@gmail.com>
…a stack traversal code. thanks Thibault Charbonnier for the report in #40.
…se-after-free issues and memory corruptions.

Fix #42.
doc: also mentioned our own bugfixes in LuaJIT's JIT compiler and VM.

Fix #39.
The unsinking code was not using the correct layout for GC64 IR
constants (value in adjacent slot) for this case.

This patch is a derivative of
raptorjit/raptorjit#246 ported for LuaJIT
itself.

Fixed after an intense debugging session with @lukego.

Co-authored-by: Luke Gorrie <lukego@gmail.com>
This is a followup fix for commit 2d33927.
… patch.

The test covering this bug was submitted to the openresty/luajit2-test-suite
repo as commit ce2c916d55.
dstogov and others added 30 commits December 26, 2023 21:18
These instructions are useful to support Intel Control-flow Enforcement Technology (CET),
when JIT code is called through idirect jump.

See `man gcc` "-fcf-protection" and https://www.felixcloutier.com/x86/endbr64
Add support for ENDBR instructions
Import OpenXRay changes
Better support for Android & iOS
Small steviegt6 patches
Specialize to the global environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.