Help with intrinsic testing for String.indexOf()

Gibbons, Scott scott.gibbons at intel.com
Fri May 24 16:01:13 UTC 2024


Hi.  I wrote a stub for implementing the indexOf method and am looking for a way to thoroughly test it.  I have good tests for both positive and negative functionality that I'm pretty confident in.  What I'm looking for is a good way to write a testcase to validate that I am not accessing memory outside the range of the strings passed to the stub.

What I'd like​ to do is to allocate an isolated page of memory such that accesses outside the page would cause a SIGSEGV.  I would like to allocate the string within the page such that the last character of the string is at the end of the page, and also allocate a string at the beginning of the page.  That way I could get clear indications of reading either past the end of the string or before the beginning (I know there's a header, so the header would be allocated at the beginning).

Is there any method at all I can use within a Java testcase to effect such behavior?  I've carefully performed code inspection and am relatively confident that I'm staying within the bounds of the strings but would like HW verification that I haven't missed anything.

Ideas?


Thanks,

--Scott Gibbons

Software Development Engineer, Runtime Engineering

[cid:916a9f87-078f-42b1-ba53-c90320614209]  DEVELOPER SOFTWARE ENGINEERING
Ph: 1-503-456-7756

Cell: 1-469-450-8390

Intel JF1, 2111 NE 25th Ave

Hillsboro, OR 97124
Intel Corporation | www.intel.com<https://webmail.intel.com/owa/redir.aspx?SURL=WYr7qZDpIv3m1SKFmeHJuzsfCBuGN-jwkBYQUSRR6yrupkscpgzUCGgAdAB0AHAAOgAvAC8AdwB3AHcALgBpAG4AdABlAGwALgBjAG8AbQA.&URL=http%3a%2f%2fwww.intel.com>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-compiler-dev/attachments/20240524/1adebf9d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Outlook-rx5s21kd
Type: image/jpg
Size: 1250 bytes
Desc: Outlook-rx5s21kd
URL: <https://mail.openjdk.org/pipermail/hotspot-compiler-dev/attachments/20240524/1adebf9d/Outlook-rx5s21kd-0001.jpg>


More information about the hotspot-compiler-dev mailing list