WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
201138
testmasm: save r6 in JIT'ed code on ARM_THUMB2
https://bugs.webkit.org/show_bug.cgi?id=201138
Summary
testmasm: save r6 in JIT'ed code on ARM_THUMB2
Guillaume Emont
Reported
2019-08-26 06:50:59 PDT
MacroAssemblerArmv7 uses r6 as a temporary register, and it is a callee-saved register. The JITs use AssemblyHelpers::emitSaveCalleeSaves() and friends to save callee-saved registers, but there is no such mechanism in testmasm, which seems to make the assumption that the macroassembler does not use callee-saved registers (which I guess is true for all other architectures, but not for Armv7). This issue means that testmasm crashes on Armv7 since code generated by gcc uses r6, and it gets modified by JIT'ed code.
Attachments
Patch
(20.91 KB, patch)
2019-08-26 07:15 PDT
,
Guillaume Emont
no flags
Details
Formatted Diff
Diff
Patch
(21.09 KB, patch)
2019-08-28 16:15 PDT
,
Guillaume Emont
no flags
Details
Formatted Diff
Diff
Patch
(21.09 KB, patch)
2019-08-29 04:00 PDT
,
Guillaume Emont
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Guillaume Emont
Comment 1
2019-08-26 07:15:02 PDT
Created
attachment 377243
[details]
Patch Patch.
Caio Lima
Comment 2
2019-08-26 07:24:01 PDT
Comment on
attachment 377243
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=377243&action=review
LGTM. I left some comments.
> Source/JavaScriptCore/ChangeLog:17 > + by gcc uses r6, and it gets modified by JIT'ed code.
It would be good point to the source where you've found this information. Also, is it a problem if we use a different version of GCC or even Clang?
Guillaume Emont
Comment 3
2019-08-26 07:31:26 PDT
(In reply to Caio Lima from
comment #2
)
> Comment on
attachment 377243
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=377243&action=review
> > LGTM. I left some comments. > > > Source/JavaScriptCore/ChangeLog:17 > > + by gcc uses r6, and it gets modified by JIT'ed code. > > It would be good point to the source where you've found this information. > Also, is it a problem if we use a different version of GCC or even Clang?
gcc, or any compiler, can use r6 and expect it not to change during a call to masm-compiled code because arm EABI says it is a callee-saved register. Do you think I should add a comment saying where we use it in MacroAssemblerARMv7? (answer: a bunch of methods, and more will likely be added in the future).
Caio Lima
Comment 4
2019-08-26 09:45:15 PDT
(In reply to Guillaume Emont from
comment #3
)
> gcc, or any compiler, can use r6 and expect it not to change during a call > to masm-compiled code because arm EABI says it is a callee-saved register.
In this case, I think this info is available into ARMv7 manual, right? Maybe it is worth it point to the section where this is stated.
> Do you think I should add a comment saying where we use it in > MacroAssemblerARMv7? (answer: a bunch of methods, and more will likely be > added in the future).
I'm not sure if this is necessary.Maybe a comment into `emitFunctionPrologue` is already sufficient.
Guillaume Emont
Comment 5
2019-08-28 16:15:35 PDT
Created
attachment 377505
[details]
Patch New patch.
Caio Lima
Comment 6
2019-08-28 19:02:02 PDT
Comment on
attachment 377505
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=377505&action=review
LGTM. I'm wondering if we should add a FIXME to add the concept of callee-saved register into macroassembler.
> Source/JavaScriptCore/assembler/testmasm.cpp:187 > + //
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042f/IHI0042F_aapcs.pdf
Nice. I think there are some strange characters there.
Guillaume Emont
Comment 7
2019-08-29 04:00:35 PDT
Created
attachment 377566
[details]
Patch New patch with only ASCII chars.
Guillaume Emont
Comment 8
2019-09-06 03:47:38 PDT
Ping reviewer.
Mark Lam
Comment 9
2019-09-06 09:11:06 PDT
Comment on
attachment 377566
[details]
Patch r=me
WebKit Commit Bot
Comment 10
2019-09-06 09:56:27 PDT
Comment on
attachment 377566
[details]
Patch Clearing flags on attachment: 377566 Committed
r249576
: <
https://trac.webkit.org/changeset/249576
>
WebKit Commit Bot
Comment 11
2019-09-06 09:56:29 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12
2019-09-06 09:57:15 PDT
<
rdar://problem/55115864
>
Radar WebKit Bug Importer
Comment 13
2019-09-06 09:57:16 PDT
<
rdar://problem/55115866
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug