Github user vrozov commented on a diff in the pull request:
https://github.com/apache/drill/pull/1090#discussion_r161384235
--- Diff: exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java ---
@@ -851,48 +851,52 @@ public void print(StringBuilder sb, int indent,
Verbosity verbosity) {
* Write an integer to the buffer at the given byte index, without
* bounds checks.
*
- * @param offset byte (not int) offset of the location to write
+ * @param bufOffset byte (not int) offset of the location to write
* @param value the value to write
*/
- public void unsafePutInt(int offset, int value) {
- PlatformDependent.putInt(addr + offset, value);
+ public void unsafePutInt(int bufOffset, int value) {
+ assert unsafeCheckIndex(bufOffset, 4);
--- End diff --
I don't think that `unsafePutXXX()` provides any performance benefits over
existing `setXXX()` variants after DRILL-6004 was merged, except that unsafe
variants use `assert` while existing use `final static boolean` flag that
functionally and performance wise is equivalent to java `assert`. It is
necessary to agree on a single mechanism to enable bounds checking and use it
in all methods.
---