JDK-8198309 : Introduce a BAD_PTR macro in globalDefinitions.hpp for 0xdeadbeef
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2018-02-16
  • Updated: 2019-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
0xdeadbeef is used throughout the JVM.  There is potential to consolidate this into a BAD_PTR macro as suggested by David Holmes in JDK-8196884.  Assessment is needed to understand all the different conversions that exist when 0xdeadbeef is used to determine if they could all be safely converted to intptr_t.

os/aix/misc_aix.cpp:  int deadbeef = 0xdeadbeef;
share/gc/cms/freeChunk.cpp:#define deadbeefHeapWord 0xdeadbeef
share/prims/jni.cpp:    jint b = Atomic::xchg((jint) 0xdeadbeef, &a);
share/prims/jni.cpp:    assert(a == (jint) 0xdeadbeef && b == (jint) 0xcafebabe, "Atomic::xchg() works");
share/opto/output.cpp:  debug_only( def = (Node*)((intptr_t)0xdeadbeef); )
share/opto/regalloc.cpp:               _framesize(0xdeadbeef)
share/opto/node.hpp:    debug_only(_out[_outcnt] = (Node *)(uintptr_t)0xdeadbeef);
share/opto/node.hpp:    debug_only(_out[_outcnt] = (Node *)(uintptr_t)0xdeadbeef);
share/opto/split_if.cpp:  Node *prior_n = (Node*)((intptr_t)0xdeadbeef);
share/opto/split_if.cpp:  prior_n = (Node*)((intptr_t)0xdeadbeef);  // Reset IDOM walk
share/opto/idealGraphPrinter.cpp:    if (_chaitin && _chaitin != (PhaseChaitin *)((intptr_t)0xdeadbeef)) {
share/opto/gcm.cpp:  _node_latency = (GrowableArray<uint> *)((intptr_t)0xdeadbeef);
share/opto/buildOopMap.cpp:    Block *pred = (Block*)((intptr_t)0xdeadbeef);
share/opto/compile.cpp:  _cfg     = (PhaseCFG*)((intptr_t)0xdeadbeef);
share/opto/compile.cpp:  _regalloc = (PhaseChaitin*)((intptr_t)0xdeadbeef);
cpu/aarch64/stubGenerator_aarch64.cpp:    __ mov(rscratch1, (uint64_t)0xdeadbeef);
cpu/s390/macroAssembler_s390.cpp:    z_iilf(scratch, 0xdeadbeef);


Comments
Only the ones used for pointers need be replaced by the BAD_PTR intptr_t definition. Other sentinel uses of "deadbeef" are not relevant.
18-02-2018

Suggest using a constant, rather than a macro. Or maybe even a function template, e.g. template<typename T> inline T* bad_pointer(intptr_t value = 0xdeadbeef) { return reinterpret_cast<T*>(value); }
17-02-2018

The majority of these are in opto so reassigning it to compiler.
16-02-2018