Add alignment checks to NativeFunc mark methods by jbachorik ยท Pull Request #348 ยท DataDog/java-profiler

@jbachorik added the AI label

Jan 29, 2026

zhengyu123

rkennke

Prevents ASAN segfault when accessing mark on non-NativeFunc strings.
All mark methods now validate pointer alignment like libIndex() does.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- isMarked() โ†’ is_marked()
- mark() getter โ†’ read_mark()
- mark() setter โ†’ set_mark()

Improves API clarity by distinguishing read/write operations.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Critical fix: is_aligned() had inverted logic using ~(alignment-1)
instead of (alignment-1). This meant alignment checks always failed
for non-NULL pointers, completely breaking the safety mechanism.

Also fixed indentation in read_mark() and set_mark() to match other
methods (4-space indent).

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds two new test suites to prevent marking from being accidentally disabled:

1. utils_ut.cpp - Tests is_aligned() directly
   - Verifies aligned pointers return true
   - Verifies unaligned pointers return false
   - Critical test catches inverted logic bug

2. nativefunc_ut.cpp - Tests NativeFunc end-to-end
   - Verifies marks can be set and read back
   - Tests all mark types (THREAD_ENTRY, COMPILER_ENTRY, etc.)
   - Critical test: MarkingDisabledDetection fails if is_aligned() broken

These tests would have caught the recent is_aligned() bug where marking
was silently disabled for all non-NULL pointers.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Feature: PR labels test:release, test:asan, test:tsan trigger
additional test configurations. Debug always runs.

Fixes:
- check-for-pr: broken jq expression and variable handling
- Removed dead gh-release job with invalid workflow syntax

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@jbachorik @claude

Uses hidden HTML marker (<!-- comment-id -->) to find existing
comments instead of GITHUB_ACTOR which doesn't work with app tokens.

๐Ÿค– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

rkennke

@jbachorik