Skip to content

Commit

Permalink
Function pointers instead of branches for oopmap stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickard Bäckman committed Sep 23, 2019
1 parent 66509dc commit 32c6af3
Show file tree
Hide file tree
Showing 4 changed files with 435 additions and 283 deletions.
6 changes: 0 additions & 6 deletions src/hotspot/cpu/x86/continuation_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ FreezeFnT ContinuationHelper::freeze_stub(const FrameT& f) {
#endif

FreezeFnT f_fn = (FreezeFnT)f.oop_map()->freeze_stub();
if ((void*)f_fn == (void*)f.oop_map()) {
f_fn = NULL; // need CompressedOops for now ????
}
#ifdef CONT_DOUBLE_NOP
// we currently patch explicitly, based on ConfigT etc.
// if (LIKELY(nop != NULL && f_fn != NULL && !nop->is_mode2())) {
Expand Down Expand Up @@ -169,9 +166,6 @@ ThawFnT ContinuationHelper::thaw_stub(const FrameT& f) {
}
#endif
ThawFnT t_fn = (ThawFnT)f.oop_map()->thaw_stub();
if ((void*)t_fn == (void*)f.oop_map()) {
t_fn = NULL; // need CompressedOops for now ????
}
return t_fn;
}

Expand Down
14 changes: 10 additions & 4 deletions src/hotspot/share/compiler/oopMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,17 @@ OopMapValue* ExplodedOopMap::copyOopMapValues(const ImmutableOopMap* oopMap, int
void ImmutableOopMap::generate_stub(const CodeBlob* cb) const {
/* The address of the ImmutableOopMap is put into the _freeze_stub and _thaw_stub
* if we can't generate the stub for some reason */
if (_freeze_stub == NULL) {
address default_value = Continuations::default_freeze_oops_stub();
address slow_value = Continuations::freeze_oops_slow();

assert(default_value != slow_value, "should not reach here!");

if (_freeze_stub == default_value) {
OopMapStubGenerator cgen(cb, *this);
if (Atomic::cmpxchg((address) this, &_freeze_stub, (address) NULL) == NULL) {
// lock this by putting the slow path in place
if (Atomic::cmpxchg(slow_value, &_freeze_stub, default_value) == default_value) {
if (!cgen.generate()) {
Atomic::store((address) this, &_thaw_stub);
Atomic::store((address) Continuations::thaw_oops_slow(), &_thaw_stub);
cgen.free();
return;
}
Expand Down Expand Up @@ -833,7 +839,7 @@ const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) con
return last->get_from(this);
}

ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _exploded(NULL), _freeze_stub(NULL), _thaw_stub(NULL), _count(oopmap->count()), _num_oops(oopmap->num_oops()) {
ImmutableOopMap::ImmutableOopMap(const OopMap* oopmap) : _exploded(NULL), _freeze_stub(Continuations::default_freeze_oops_stub()), _thaw_stub(Continuations::default_thaw_oops_stub()), _count(oopmap->count()), _num_oops(oopmap->num_oops()) {
_num_oops = oopmap->num_oops();
address addr = data_addr();
//oopmap->copy_data_to(addr);
Expand Down
Loading

0 comments on commit 32c6af3

Please sign in to comment.