Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multithreading to FiOne #1545

Merged
merged 17 commits into from
Nov 12, 2024
Merged

Conversation

ccuser44
Copy link
Contributor

@ccuser44 ccuser44 commented Jun 2, 2024

Add multithreading to FiOne. Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries

Function is multithreaded when function name is prefixed with SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_.
Only (local)? function NAME(...) is detected, not NAME = function(...).

Only uses one different thread per function for now. Functions yields until multithreaded function returns or errors

Upval mutation, env mutations, calling closures outside threaded context, cross thread metatables, Instance interactions and cross thread table changes have all undefined behavior

Question: Why does Adonis need this?
Answer: You can't create cloned FiOne runners without hacking Adonis, this makes multithreading possible without hacking Adonis. Making some form of multithreading possible in Adonis without hacking Adonis itself is very nice

@ccuser44 ccuser44 changed the title Add multithreading to FiOne. **Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries** Add multithreading to Loadstring. **Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries** Jun 2, 2024
@ccuser44 ccuser44 changed the title Add multithreading to Loadstring. **Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries** Add multithreading to FiOne. **Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries** Jun 2, 2024
@ccuser44 ccuser44 changed the title Add multithreading to FiOne. **Officially the first ever per function multithreading implementation in Lua that works out of the box without libraries** Add multithreading to FiOne Jun 2, 2024
@Dimenpsyonal Dimenpsyonal added the ⌛needs PoF This PR is awaiting proof of functionality label Jun 5, 2024
@Epix-Incorporated Epix-Incorporated deleted a comment Jun 8, 2024
@P3tray
Copy link
Contributor

P3tray commented Jul 8, 2024

SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_

@Dimenpsyonal
Copy link
Member

Needs proof of functionality

@LolloDev5123
Copy link
Contributor

I say we do all compiler/interpreter related stuff on a separate repository which is then included here as a git module.
Here's a proof of concept: https://github.com/Indirecta-Technologies/luic

@Dimenpsyonal
Copy link
Member

just add that into adonis. ez

@P3tray
Copy link
Contributor

P3tray commented Oct 22, 2024

WOOHOO! NEW COMMITS!

@ccuser44
Copy link
Contributor Author

@Expertcoderz @Dimenpsyonal @P3tray PoF is here, this can be merged.

PoF:
image

Script for PoF:

local function SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_hi(arg, arg2, ...)
return arg, arg2, "Hello", ...
end

print(SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_hi("WAT", false, 5435345, nil, "DOOO", {}))

NOTE: A vanilla Lua compiler was used to compile the bytecode and feed it in to FiOne due to a current limitation with function debug names regarding the Yueliang compiler

@P3tray
Copy link
Contributor

P3tray commented Oct 28, 2024

@Expertcoderz @Dimenpsyonal @P3tray PoF is here, this can be merged.

PoF: image

Script for PoF:

local function SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_hi(arg, arg2, ...)
return arg, arg2, "Hello", ...
end

print(SUPER_SECRET_ADONIS_MULTITHREAD_PREFIX_hi("WAT", false, 5435345, nil, "DOOO", {}))

NOTE: A vanilla Lua compiler was used to compile the bytecode and feed it in to FiOne due to a current limitation with function debug names regarding the Yueliang compiler

Neat.

We'd effectively need to pre-encode our Luau and feed it directly into FiOne in order to use mutlithreading, then? That's pretty cool.

Copy link
Contributor

@P3tray P3tray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'ery nice.

@Dimenpsyonal Dimenpsyonal merged commit e87874b into Epix-Incorporated:master Nov 12, 2024
2 checks passed
@ccuser44 ccuser44 deleted the patch-10 branch November 12, 2024 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⌛needs PoF This PR is awaiting proof of functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants