-
Notifications
You must be signed in to change notification settings - Fork 247
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
Port to LoongArch64 #257
Closed
Closed
Port to LoongArch64 #257
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#define STACK_REFPLUS 1 | ||
|
||
#ifdef SLP_EVAL | ||
#define STACK_MAGIC 0 | ||
|
||
#define REGS_TO_SAVE "s0", "s1", "s2", "s3", "s4", "s5", \ | ||
"s6", "s7", "s8", "fp", \ | ||
"f24", "f25", "f26", "f27", "f28", "f29", "f30", "f31" | ||
|
||
static int | ||
slp_switch(void) | ||
{ | ||
register int ret; | ||
register long *stackref, stsizediff; | ||
__asm__ volatile ("" : : : REGS_TO_SAVE); | ||
__asm__ volatile ("move %0, $sp" : "=r" (stackref) : ); | ||
{ | ||
SLP_SAVE_STATE(stackref, stsizediff); | ||
__asm__ volatile ( | ||
"add.d $sp, $sp, %0\n\t" | ||
: /* no outputs */ | ||
: "r" (stsizediff) | ||
); | ||
SLP_RESTORE_STATE(); | ||
} | ||
__asm__ volatile ("" : : : REGS_TO_SAVE); | ||
__asm__ volatile ("move %0, $zero" : "=r" (ret) : ); | ||
return ret; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure
fp
can be included? I see this in my independent port before I saw your PR:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I am sure
fp
can be included. I think your error message is caused by gcc compilation optimization. This is my compilation flags.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's not good for portability, you can't force one particular set of CFLAGS, due to different distros just doing their job differently. I know that
fp/s9
actually should be saved, but how do we force it in this case? I'm using the latest upstream submission for my toolchain and kernel, and a self-compiled Gentoo userland; let me know if you need the Gentoo tarball to reproduce the issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I can reproduce this issue in other way. This is indeed a problem.
Inspired by your question, I found this the
setup.py
. I think we should add appropriate compilation optimization flags for loongarch64 here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimization flags are not the proper way to solve this, in my opinion, because they tend to depend on intricate compiler internals to work. The "solution" will likely be fragile and break when the stars don't align.
Actually, the way most other projects manually save/restore preserved registers is to write concrete asm fragments, even whole
.S
files; doing this via clobber list is something I have never seen before, yet in this project every port does that. How about noticing your compiler team about this so they can provide some input?@
-mentioning them here should be enough.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merore 所以这里正确的处理方式是什么?python setup.py bdist_wheel是一样的报上面的错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Duanexiao Please refer to the latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gevent项目我看贵司还没提兼容loongarch64的代码?但是龙芯的pypi里面有这个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code here https://github.com/merore/greenlet/commits/master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我说的是gevent项目