-
Notifications
You must be signed in to change notification settings - Fork 59
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
JIT compiler + bugfixes #66
base: master
Are you sure you want to change the base?
Conversation
f86e91d
to
6609500
Compare
@eh-steve , thanks. By the way, goloader does not test with cgo and asm. |
c616d15
to
a4cf8b4
Compare
I appreciate that - my main motivation was getting common packages like |
@eh-steve Could you give me a simple case for TestStackSplit and TestJitPanicRecoveryStackTrace this issue mentioned? Thx |
What version of Go are you using, and which symbols remain unresolved? (I'm using 1.19.3 and it's working fine) Can you try
I've made certain core packages forbidden for re-inclusion in the JIT compiler to prevent duplication of certain atomic, reflect or runtime packages, are the missing symbols from these forbidden packages? If so, they just need to be included in the test binary by declaring some global variables which use them. Also I recently rebased and force pushed so you might wanna delete and re-checkout if you pulled before the rebase. EDIT: I just tried running via
I could fix this by forcing the symbols to be included by importing more things in |
8514089
to
5749924
Compare
10a85a2
to
c272d99
Compare
Edit:
|
@pkujhd All tests are passing on my machine now, I think it's ready for review |
how to fixed it? I don't find the code change for goloader. |
For commit 31f8f2b, the pclntable does not split for adapter golang version < 1.16 For commit 3cd5a08, plugin use deduplicate function to deal it, but in goloader it will be lead to far address relocate error on R_ADDROFF & R_METHODOFF. By modifying read-only memory. used first module type descriptor. it could avoid it, but I worried it will be forbidden on MacOSX. I think maybe the best way are use deduplicate function to deal it and copy type descriptor with far address relocated from the first module into data segment. (it maybe means a lots of workload, because a far address type descriptor maybe is an interface) By the way, |
… hijack firstmoduledata.typemap to allow resolveTypeOff to find JIT types using a firstmodule base address
… fix bug where inittask package names containing a dot were not properly escaped
…est which involves mutating C initialised data and C calling Go
… wraps handwritten asm with a PUSH/POP BP to create frames for you
…ative path (e.g. when resolved via $PATH)
…en JMP (back from epilogue) instead of CALL (into epilogue) then JMP (into target func), since if a traceback hits while we're in the epilogue, the funcForPC for the current PC will not be aligned with the link register (regardless whether the LR is virtual or real), and it will appear that the callee and caller are the same `_func`
…alue gets converted to new type
This is mostly a rebased commit history of #62, plus the addition of a new
jit
package to allow compiling and loading Go files/packages/text, and recursively resolving their dependencies.This allows users to build and load arbitrary Go files with any number of imports automatically.
You can simply do:
The
jit
package and tests are early on in the commit history to demonstrate the purpose of each subsequent commit in fixing specific tests.So far, testing has only been on
linux/amd64
,linux/arm64
,darwin/amd64
,darwin/arm64
(Apple M1 silicon), andwindows/amd64
. Once the last fewgoloader
bugs are ironed out, I will try to backport these changes for earlier Go versions where possible.Versions: