Skip to content

Commit

Permalink
Merge pull request #4191 from keithc-ca/ddr
Browse files Browse the repository at this point in the history
Improve robustness of checking tags of allocated memory blocks
  • Loading branch information
pshipton authored Jan 8, 2019
2 parents 46257f0 + 64b270c commit 761ff93
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2014 IBM Corp. and others
* Copyright (c) 2010, 2019 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -72,9 +72,8 @@ public class J9MemTagHelper
*/
public static IDATA j9mem_check_tags(VoidPointer memoryPointer, long headerEyecatcher, long footerEyecatcher) throws J9MemTagCheckError
{
J9MemTagPointer headerTagAddress, footerTagAddress = J9MemTagPointer.NULL;

headerTagAddress = j9mem_get_header_tag(memoryPointer);
J9MemTagPointer headerTagAddress = j9mem_get_header_tag(memoryPointer);
J9MemTagPointer footerTagAddress = J9MemTagPointer.NULL;

try {
footerTagAddress = j9mem_get_footer_tag(headerTagAddress);
Expand Down Expand Up @@ -266,8 +265,9 @@ public static VoidPointer j9mem_get_footer_padding(J9MemTagPointer headerEyeCatc

public static UDATA ROUNDED_FOOTER_OFFSET(UDATA number)
{
UDATA a = (number.add(ROUNDING_GRANULARITY - 1)).add(J9MemTag.SIZEOF);
UDATA b = new UDATA(ROUNDING_GRANULARITY - 1).bitNot();
UDATA mask = new UDATA(ROUNDING_GRANULARITY - 1);
UDATA a = mask.add(number).add(J9MemTag.SIZEOF);
UDATA b = mask.bitNot();
return a.bitAnd(b);
}

Expand All @@ -294,7 +294,7 @@ public J9MemTagCheckError(J9MemTagPointer memTag,

public J9MemTagPointer getMemTag()
{
return memTag;
return memTag;
}
}
}

0 comments on commit 761ff93

Please sign in to comment.