Skip to content
Permalink
Browse files
Remove double nop experiment code
  • Loading branch information
pron committed Mar 30, 2021
1 parent 1fa9e0a commit c174264aff9819f2d357a4258cc80c49c44a589d
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 88 deletions.
@@ -488,12 +488,7 @@ inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == NULL) return NULL;
if (_cb->oop_maps() != NULL) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != NULL &&
#ifdef CONT_DOUBLE_NOP
!nop->is_mode2() &&
#endif
nop->displacement() != 0
) {
if (nop != NULL && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
@@ -53,8 +53,6 @@
#include "utilities/macros.hpp"
#include "crc32c.h"

#include "runtime/continuation.hpp" // TODO LOOM remove after testing CONT_DOUBLE_NOP

#ifdef PRODUCT
#define BLOCK_COMMENT(str) /* nothing */
#define STOP(error) stop(error)
@@ -2006,13 +2004,6 @@ void MacroAssembler::post_call_nop() {
emit_int8((int8_t)0x84);
emit_int8((int8_t)0x00);
emit_int32(0x00);
#ifdef CONT_DOUBLE_NOP
emit_int8((int8_t)0x0f);
emit_int8((int8_t)0x1f);
emit_int8((int8_t)0x84);
emit_int8((int8_t)0x00);
emit_int32(0x00);
#endif
}

// A 5 byte nop that is safe for patching (see patch_verified_entry)
@@ -664,24 +664,6 @@ void NativePostCallNop::patch(jint diff) {
*((int32_t *)(code_pos)) = (int32_t) diff;
}

#ifdef CONT_DOUBLE_NOP
void NativePostCallNop::patch(uint32_t int1, uint32_t int2) {
patch_int2(int2);
patch_int1(int1); // order matters

// *((uint8_t *)addr_at(3)) = (uint8_t) short1 >> 8;
// *((uint8_t *)addr_at(11)) = (uint8_t) short1;
}
void NativePostCallNop::patch_int1(uint32_t int1) {
*((uint32_t *)addr_at(4)) = (int32_t) int1;
wrote(4);
}
void NativePostCallNop::patch_int2(uint32_t int2) {
*((uint32_t *)addr_at(12)) = (int32_t) int2;
wrote(12);
}
#endif

void NativeDeoptInstruction::verify() {
}

@@ -30,8 +30,6 @@
#include "runtime/os.hpp"
#include "runtime/safepointMechanism.hpp"

#include "runtime/continuation.hpp" // TODO LOOM remove after testing CONT_DOUBLE_NOP

// We have interfaces for the following instructions:
// - NativeInstruction
// - - NativeCall
@@ -744,54 +742,23 @@ class NativePostCallNop: public NativeInstruction {
displacement_offset = 4
};

bool check() const {
#ifdef CONT_DOUBLE_NOP
return check1() && int2_data() == 0;
#else
return int_at(0) == 0x841f0f;
#endif
}
bool check() const { return int_at(0) == 0x841f0f; }
int displacement() const { return (jint) int_at(displacement_offset); }
void patch(jint diff);
void make_deopt();

#ifdef CONT_DOUBLE_NOP
bool check1() const { return (int_at(0) & 0xffffff) == 0x841f0f && (int_at(8) & 0xffffff) == 0x841f0f; }
uint16_t short_data() const { return (uint16_t)((ubyte_at(3) << 8) | ubyte_at(11)); }
uint32_t int1_data() const { return (uint32_t)int_at(4); }
uint32_t int2_data() const { return (uint32_t)int_at(12); }
void patch(uint32_t int1, uint32_t int2);
void patch_int1(uint32_t int1);
void patch_int2(uint32_t int2);

// int mode() {
// assert (int2_data() == 0 || int1_data() != 0, "");
// return static_cast<bool>(int1_data()) + static_cast<bool>(int2_data());
// }

bool is_mode2() { return int2_data() != 0; } // mode2 is used for fast continuation freeze/thaw metadata
#endif
};

inline NativePostCallNop* nativePostCallNop_at(address address) {
NativePostCallNop* nop = (NativePostCallNop*) address;
#ifdef CONT_DOUBLE_NOP
if (nop->check1()) {
#else
if (nop->check()) {
#endif
return nop;
}
return NULL;
}

inline NativePostCallNop* nativePostCallNop_unsafe_at(address address) {
NativePostCallNop* nop = (NativePostCallNop*) address;
#ifdef CONT_DOUBLE_NOP
assert (nop->check1(), "");
#else
assert (nop->check(), "");
#endif
return nop;
}

@@ -668,9 +668,6 @@ CodeBlob* CodeCache::patch_nop(NativePostCallNop* nop, void* pc, int& slot) {
slot = -1;
log_debug(codecache)("failed to encode %d %d", oopmap_slot, (int) offset);
}
#ifdef CONT_DOUBLE_NOP
assert (!nop->is_mode2(), "");
#endif
return cb;
}

@@ -35,11 +35,7 @@ inline CodeBlob* CodeCache::find_blob_fast(void* pc) {

inline CodeBlob* CodeCache::find_blob_and_oopmap(void* pc, int& slot) {
NativePostCallNop* nop = nativePostCallNop_at((address) pc);
if (LIKELY(nop != NULL)
#ifdef CONT_DOUBLE_NOP
&& !nop->is_mode2()
#endif
) {
if (LIKELY(nop != NULL)) {
CodeBlob* cb;
if (LIKELY(nop->displacement() != 0)) {
int offset = (nop->displacement() & 0xffffff);
@@ -50,9 +46,6 @@ inline CodeBlob* CodeCache::find_blob_and_oopmap(void* pc, int& slot) {
// tty->print_cr(">>> patching");
cb = CodeCache::patch_nop(nop, pc, slot);
}
#ifdef CONT_DOUBLE_NOP
assert(!nop->is_mode2() == 1, "");
#endif
assert(cb != NULL, "must be");
return cb;
} else {
@@ -65,17 +58,10 @@ inline CodeBlob* CodeCache::find_blob_and_oopmap(void* pc, int& slot) {
inline int CodeCache::find_oopmap_slot_fast(void* pc) {
int slot = -1;
NativePostCallNop* nop = nativePostCallNop_at((address) pc);
if (LIKELY(nop != NULL)
#ifdef CONT_DOUBLE_NOP
&& !nop->is_mode2()
#endif
) {
if (LIKELY(nop != NULL)) {
if (LIKELY(nop->displacement() != 0)) {
slot = ((nop->displacement() >> 24) & 0xff);
}
#ifdef CONT_DOUBLE_NOP
assert(!nop->is_mode2() == 1, "");
#endif
}
return slot;
}
@@ -32,8 +32,6 @@
#include "runtime/globals.hpp"
#include "jni.h"

// #define CONT_DOUBLE_NOP 1

// The order of this struct matters as it's directly manipulated by assembly code (push/pop)

class ContinuationEntry;

0 comments on commit c174264

Please sign in to comment.