mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-28 16:50:10 +00:00
8378985: serviceability/sa/TestJhsdbJstackMixedWithXComp.java failed if sender frame is return barrier of Continuation
Reviewed-by: cjplummer, mdoerr, fyang
This commit is contained in:
parent
ceb109fbd8
commit
69deec2016
@ -475,6 +475,7 @@
|
||||
/***********************************/ \
|
||||
\
|
||||
static_field(StubRoutines, _call_stub_return_address, address) \
|
||||
static_field(StubRoutines, _cont_returnBarrier, address) \
|
||||
\
|
||||
/***************************************/ \
|
||||
/* PcDesc and other compiled code info */ \
|
||||
@ -786,6 +787,7 @@
|
||||
static_field(Mutex, _mutex_array, Mutex**) \
|
||||
static_field(Mutex, _num_mutex, int) \
|
||||
volatile_nonstatic_field(Mutex, _owner, Thread*) \
|
||||
nonstatic_field(ContinuationEntry, _parent, ContinuationEntry*) \
|
||||
static_field(ContinuationEntry, _return_pc, address)
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Address;
|
||||
|
||||
|
||||
public class Continuation {
|
||||
|
||||
public static boolean isReturnBarrierEntry(Address senderPC) {
|
||||
if (!Continuations.enabled()) {
|
||||
return false;
|
||||
}
|
||||
return VM.getVM().getStubRoutines().contReturnBarrier().equals(senderPC);
|
||||
}
|
||||
|
||||
public static boolean isSPInContinuation(ContinuationEntry entry, Address sp) {
|
||||
return entry.getEntrySP().greaterThan(sp);
|
||||
}
|
||||
|
||||
public static ContinuationEntry getContinuationEntryForSP(JavaThread thread, Address sp) {
|
||||
ContinuationEntry entry = thread.getContEntry();
|
||||
while (entry != null && !isSPInContinuation(entry, sp)) {
|
||||
entry = entry.getParent();
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
public static Frame continuationBottomSender(JavaThread thread, Frame callee, Address senderSP) {
|
||||
ContinuationEntry ce = getContinuationEntryForSP(thread, callee.getSP());
|
||||
Frame entry = ce.toFrame();
|
||||
if (callee.isInterpretedFrame()) {
|
||||
entry.setSP(senderSP); // sp != unextended_sp
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, NTT DATA.
|
||||
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,12 +26,17 @@
|
||||
package sun.jvm.hotspot.runtime;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.runtime.aarch64.*;
|
||||
import sun.jvm.hotspot.runtime.amd64.*;
|
||||
import sun.jvm.hotspot.runtime.ppc64.*;
|
||||
import sun.jvm.hotspot.runtime.riscv64.*;
|
||||
import sun.jvm.hotspot.types.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
|
||||
public class ContinuationEntry extends VMObject {
|
||||
public abstract class ContinuationEntry extends VMObject {
|
||||
private static long size;
|
||||
private static AddressField parentField;
|
||||
private static Address returnPC;
|
||||
|
||||
static {
|
||||
@ -41,13 +46,28 @@ public class ContinuationEntry extends VMObject {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("ContinuationEntry");
|
||||
size = type.getSize();
|
||||
parentField = type.getAddressField("_parent");
|
||||
returnPC = type.getAddressField("_return_pc").getValue();
|
||||
}
|
||||
|
||||
public static ContinuationEntry create(Address addr) {
|
||||
return switch (VM.getVM().getDebugger().getCPU()) {
|
||||
case "amd64" -> VMObjectFactory.newObject(AMD64ContinuationEntry.class, addr);
|
||||
case "aarch64" -> VMObjectFactory.newObject(AARCH64ContinuationEntry.class, addr);
|
||||
case "riscv64" -> VMObjectFactory.newObject(RISCV64ContinuationEntry.class, addr);
|
||||
case "ppc64" -> VMObjectFactory.newObject(PPC64ContinuationEntry.class, addr);
|
||||
default -> throw new UnsupportedPlatformException("Continuation is not yet implemented.");
|
||||
};
|
||||
}
|
||||
|
||||
public ContinuationEntry(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
public ContinuationEntry getParent() {
|
||||
return create(parentField.getValue(addr));
|
||||
}
|
||||
|
||||
public Address getEntryPC() {
|
||||
return returnPC;
|
||||
}
|
||||
@ -60,4 +80,6 @@ public class ContinuationEntry extends VMObject {
|
||||
return this.getAddress().addOffsetTo(size);
|
||||
}
|
||||
|
||||
public abstract Frame toFrame();
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime;
|
||||
|
||||
public class Continuations {
|
||||
|
||||
public static boolean enabled() {
|
||||
return VM.getVM().getCommandLineFlag("VMContinuations").getBool();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -138,6 +138,7 @@ public abstract class Frame implements Cloneable {
|
||||
}
|
||||
|
||||
public abstract Address getSP();
|
||||
public abstract void setSP(Address newSP);
|
||||
public abstract Address getID();
|
||||
public abstract Address getFP();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -343,7 +343,7 @@ public class JavaThread extends Thread {
|
||||
}
|
||||
|
||||
public ContinuationEntry getContEntry() {
|
||||
return VMObjectFactory.newObject(ContinuationEntry.class, contEntryField.getValue(addr));
|
||||
return ContinuationEntry.create(contEntryField.getValue(addr));
|
||||
}
|
||||
|
||||
/** Gets the Java-side thread object for this JavaThread */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +34,7 @@ import sun.jvm.hotspot.utilities.Observer;
|
||||
|
||||
public class StubRoutines {
|
||||
private static AddressField callStubReturnAddressField;
|
||||
private static AddressField contReturnBarrierField;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
@ -46,6 +47,7 @@ public class StubRoutines {
|
||||
private static synchronized void initialize(TypeDataBase db) {
|
||||
Type type = db.lookupType("StubRoutines");
|
||||
callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
|
||||
contReturnBarrierField = type.getAddressField("_cont_returnBarrier");
|
||||
}
|
||||
|
||||
public StubRoutines() {
|
||||
@ -59,4 +61,9 @@ public class StubRoutines {
|
||||
return (addr.equals(returnPC));
|
||||
}
|
||||
}
|
||||
|
||||
public Address contReturnBarrier() {
|
||||
return contReturnBarrierField.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime.aarch64;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Address;
|
||||
import sun.jvm.hotspot.runtime.ContinuationEntry;
|
||||
import sun.jvm.hotspot.runtime.Frame;
|
||||
|
||||
|
||||
public class AARCH64ContinuationEntry extends ContinuationEntry {
|
||||
|
||||
public AARCH64ContinuationEntry(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Frame toFrame() {
|
||||
return new AARCH64Frame(getEntrySP(), getEntrySP(), getEntryFP(), getEntryPC());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, Red Hat Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -206,6 +206,11 @@ public class AARCH64Frame extends Frame {
|
||||
public Address getSP() { return raw_sp; }
|
||||
public Address getID() { return raw_sp; }
|
||||
|
||||
@Override
|
||||
public void setSP(Address newSP) {
|
||||
raw_sp = newSP;
|
||||
}
|
||||
|
||||
// FIXME: not implemented yet
|
||||
public boolean isSignalHandlerFrameDbg() { return false; }
|
||||
public int getSignalNumberDbg() { return 0; }
|
||||
@ -360,16 +365,6 @@ public class AARCH64Frame extends Frame {
|
||||
map.setLocation(fp, savedFPAddr);
|
||||
}
|
||||
|
||||
private Frame senderForContinuationStub(AARCH64RegisterMap map, CodeBlob cb) {
|
||||
var contEntry = map.getThread().getContEntry();
|
||||
|
||||
Address senderSP = contEntry.getEntrySP();
|
||||
Address senderPC = contEntry.getEntryPC();
|
||||
Address senderFP = contEntry.getEntryFP();
|
||||
|
||||
return new AARCH64Frame(senderSP, senderFP, senderPC);
|
||||
}
|
||||
|
||||
private Frame senderForCompiledFrame(AARCH64RegisterMap map, CodeBlob cb) {
|
||||
if (DEBUG) {
|
||||
System.out.println("senderForCompiledFrame");
|
||||
@ -416,6 +411,22 @@ public class AARCH64Frame extends Frame {
|
||||
updateMapWithSavedLink(map, savedFPAddr);
|
||||
}
|
||||
|
||||
if (Continuation.isReturnBarrierEntry(senderPC)) {
|
||||
// We assume WalkContinuation is "WalkContinuation::skip".
|
||||
// It is same with c'tor arguments of RegisterMap in frame::next_frame().
|
||||
//
|
||||
// HotSpot code in cpu/aarch64/frame_aarch64.inline.hpp:
|
||||
//
|
||||
// if (Continuation::is_return_barrier_entry(sender_pc)) {
|
||||
// if (map->walk_cont()) { // about to walk into an h-stack
|
||||
// return Continuation::top_frame(*this, map);
|
||||
// } else {
|
||||
// return Continuation::continuation_bottom_sender(map->thread(), *this, l_sender_sp);
|
||||
// }
|
||||
// }
|
||||
return Continuation.continuationBottomSender(map.getThread(), this, senderSP);
|
||||
}
|
||||
|
||||
return new AARCH64Frame(senderSP, savedFPAddr.getAddressAt(0), senderPC);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime.amd64;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Address;
|
||||
import sun.jvm.hotspot.runtime.ContinuationEntry;
|
||||
import sun.jvm.hotspot.runtime.Frame;
|
||||
|
||||
|
||||
public class AMD64ContinuationEntry extends ContinuationEntry {
|
||||
|
||||
public AMD64ContinuationEntry(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Frame toFrame() {
|
||||
return new AMD64Frame(getEntrySP(), getEntrySP(), getEntryFP(), getEntryPC());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -206,6 +206,11 @@ public class AMD64Frame extends Frame {
|
||||
public Address getSP() { return raw_sp; }
|
||||
public Address getID() { return raw_sp; }
|
||||
|
||||
@Override
|
||||
public void setSP(Address newSP) {
|
||||
raw_sp = newSP;
|
||||
}
|
||||
|
||||
// FIXME: not implemented yet (should be done for Solaris)
|
||||
public boolean isSignalHandlerFrameDbg() { return false; }
|
||||
public int getSignalNumberDbg() { return 0; }
|
||||
@ -258,6 +263,23 @@ public class AMD64Frame extends Frame {
|
||||
// update it accordingly
|
||||
map.setIncludeArgumentOops(false);
|
||||
|
||||
// HotSpot has following code in frame::sender_raw() at frame_x86.inline.hpp, however
|
||||
// in_cont() should be false.
|
||||
//
|
||||
// if (map->in_cont()) { // already in an h-stack
|
||||
// return map->stack_chunk()->sender(*this, map);
|
||||
// }
|
||||
//
|
||||
// in_cont() returns true if _chunk() is not null.
|
||||
//
|
||||
// frame::next_frame() creates RegisterMap instance with 4 arguments.
|
||||
// It sets RegisterMap::WalkContinuation::skip to final argument (walk_cont),
|
||||
// therefore _chunk will not be initialized by the following code in c'tor of RegisterMap.
|
||||
//
|
||||
// if (walk_cont == WalkContinuation::include && thread != nullptr && thread->last_continuation() != nullptr) {
|
||||
// _chunk = stackChunkHandle(Thread::current()->handle_area()->allocate_null_handle(), true /* dummy */);
|
||||
// }
|
||||
|
||||
if (isEntryFrame()) return senderForEntryFrame(map);
|
||||
if (isInterpretedFrame()) return senderForInterpreterFrame(map);
|
||||
|
||||
@ -360,16 +382,6 @@ public class AMD64Frame extends Frame {
|
||||
map.setLocation(rbp, savedFPAddr);
|
||||
}
|
||||
|
||||
private Frame senderForContinuationStub(AMD64RegisterMap map, CodeBlob cb) {
|
||||
var contEntry = map.getThread().getContEntry();
|
||||
|
||||
Address senderSP = contEntry.getEntrySP();
|
||||
Address senderPC = contEntry.getEntryPC();
|
||||
Address senderFP = contEntry.getEntryFP();
|
||||
|
||||
return new AMD64Frame(senderSP, senderFP, senderPC);
|
||||
}
|
||||
|
||||
private Frame senderForCompiledFrame(AMD64RegisterMap map, CodeBlob cb) {
|
||||
if (DEBUG) {
|
||||
System.out.println("senderForCompiledFrame");
|
||||
@ -408,6 +420,22 @@ public class AMD64Frame extends Frame {
|
||||
updateMapWithSavedLink(map, savedFPAddr);
|
||||
}
|
||||
|
||||
if (Continuation.isReturnBarrierEntry(senderPC)) {
|
||||
// We assume WalkContinuation is "WalkContinuation::skip".
|
||||
// It is same with c'tor arguments of RegisterMap in frame::next_frame().
|
||||
//
|
||||
// HotSpot code in cpu/x86/frame_x86.inline.hpp:
|
||||
//
|
||||
// if (Continuation::is_return_barrier_entry(sender_pc)) {
|
||||
// if (map->walk_cont()) { // about to walk into an h-stack
|
||||
// return Continuation::top_frame(*this, map);
|
||||
// } else {
|
||||
// return Continuation::continuation_bottom_sender(map->thread(), *this, sender_sp);
|
||||
// }
|
||||
// }
|
||||
return Continuation.continuationBottomSender(map.getThread(), this, senderSP);
|
||||
}
|
||||
|
||||
return new AMD64Frame(senderSP, savedFPAddr.getAddressAt(0), senderPC);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime.ppc64;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Address;
|
||||
import sun.jvm.hotspot.runtime.ContinuationEntry;
|
||||
import sun.jvm.hotspot.runtime.Frame;
|
||||
|
||||
|
||||
public class PPC64ContinuationEntry extends ContinuationEntry {
|
||||
|
||||
public PPC64ContinuationEntry(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Frame toFrame() {
|
||||
return new PPC64Frame(getEntrySP(), getEntrySP(), getEntryFP(), getEntryPC());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -198,6 +198,11 @@ public class PPC64Frame extends Frame {
|
||||
public Address getSP() { return raw_sp; }
|
||||
public Address getID() { return raw_sp; }
|
||||
|
||||
@Override
|
||||
public void setSP(Address newSP) {
|
||||
raw_sp = newSP;
|
||||
}
|
||||
|
||||
// FIXME: not implemented yet (should be done for Solaris/PPC64)
|
||||
public boolean isSignalHandlerFrameDbg() { return false; }
|
||||
public int getSignalNumberDbg() { return 0; }
|
||||
@ -260,9 +265,7 @@ public class PPC64Frame extends Frame {
|
||||
if (cb != null) {
|
||||
if (cb.isUpcallStub()) {
|
||||
return senderForUpcallStub(map, (UpcallStub)cb);
|
||||
} else if (cb.isContinuationStub()) {
|
||||
return senderForContinuationStub(map, cb);
|
||||
} else {
|
||||
} else if (cb.getFrameSize() > 0) {
|
||||
return senderForCompiledFrame(map, cb);
|
||||
}
|
||||
}
|
||||
@ -337,16 +340,6 @@ public class PPC64Frame extends Frame {
|
||||
return new PPC64Frame(sp, unextendedSP, getLink(), getSenderPC());
|
||||
}
|
||||
|
||||
private Frame senderForContinuationStub(PPC64RegisterMap map, CodeBlob cb) {
|
||||
var contEntry = map.getThread().getContEntry();
|
||||
|
||||
Address sp = contEntry.getEntrySP();
|
||||
Address pc = contEntry.getEntryPC();
|
||||
Address fp = contEntry.getEntryFP();
|
||||
|
||||
return new PPC64Frame(sp, fp, pc);
|
||||
}
|
||||
|
||||
private Frame senderForCompiledFrame(PPC64RegisterMap map, CodeBlob cb) {
|
||||
if (DEBUG) {
|
||||
System.out.println("senderForCompiledFrame");
|
||||
@ -379,6 +372,22 @@ public class PPC64Frame extends Frame {
|
||||
}
|
||||
}
|
||||
|
||||
if (Continuation.isReturnBarrierEntry(senderPC)) {
|
||||
// We assume WalkContinuation is "WalkContinuation::skip".
|
||||
// It is same with c'tor arguments of RegisterMap in frame::next_frame().
|
||||
//
|
||||
// HotSpot code in cpu/ppc/frame_ppc.inline.hpp:
|
||||
//
|
||||
// if (Continuation::is_return_barrier_entry(sender_pc)) {
|
||||
// if (map->walk_cont()) { // about to walk into an h-stack
|
||||
// return Continuation::top_frame(*this, map);
|
||||
// } else {
|
||||
// return Continuation::continuation_bottom_sender(map->thread(), *this, l_sender_sp);
|
||||
// }
|
||||
// }
|
||||
return Continuation.continuationBottomSender(map.getThread(), this, senderSP);
|
||||
}
|
||||
|
||||
return new PPC64Frame(senderSP, getLink(), senderPC);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2026, NTT DATA.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
package sun.jvm.hotspot.runtime.riscv64;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Address;
|
||||
import sun.jvm.hotspot.runtime.ContinuationEntry;
|
||||
import sun.jvm.hotspot.runtime.Frame;
|
||||
|
||||
|
||||
public class RISCV64ContinuationEntry extends ContinuationEntry {
|
||||
|
||||
public RISCV64ContinuationEntry(Address addr) {
|
||||
super(addr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Frame toFrame() {
|
||||
return new RISCV64Frame(getEntrySP(), getEntrySP(), getEntryFP(), getEntryPC());
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, Red Hat Inc.
|
||||
* Copyright (c) 2021, 2023, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -201,6 +201,11 @@ public class RISCV64Frame extends Frame {
|
||||
public Address getSP() { return raw_sp; }
|
||||
public Address getID() { return raw_sp; }
|
||||
|
||||
@Override
|
||||
public void setSP(Address newSP) {
|
||||
raw_sp = newSP;
|
||||
}
|
||||
|
||||
// FIXME: not implemented yet
|
||||
public boolean isSignalHandlerFrameDbg() { return false; }
|
||||
public int getSignalNumberDbg() { return 0; }
|
||||
@ -264,9 +269,7 @@ public class RISCV64Frame extends Frame {
|
||||
if (cb != null) {
|
||||
if (cb.isUpcallStub()) {
|
||||
return senderForUpcallStub(map, (UpcallStub)cb);
|
||||
} else if (cb.isContinuationStub()) {
|
||||
return senderForContinuationStub(map, cb);
|
||||
} else {
|
||||
} else if (cb.getFrameSize() > 0) {
|
||||
return senderForCompiledFrame(map, cb);
|
||||
}
|
||||
}
|
||||
@ -354,16 +357,6 @@ public class RISCV64Frame extends Frame {
|
||||
map.setLocation(fp, savedFPAddr);
|
||||
}
|
||||
|
||||
private Frame senderForContinuationStub(RISCV64RegisterMap map, CodeBlob cb) {
|
||||
var contEntry = map.getThread().getContEntry();
|
||||
|
||||
Address senderSP = contEntry.getEntrySP();
|
||||
Address senderPC = contEntry.getEntryPC();
|
||||
Address senderFP = contEntry.getEntryFP();
|
||||
|
||||
return new RISCV64Frame(senderSP, senderFP, senderPC);
|
||||
}
|
||||
|
||||
private Frame senderForCompiledFrame(RISCV64RegisterMap map, CodeBlob cb) {
|
||||
if (DEBUG) {
|
||||
System.out.println("senderForCompiledFrame");
|
||||
@ -406,6 +399,22 @@ public class RISCV64Frame extends Frame {
|
||||
updateMapWithSavedLink(map, savedFPAddr);
|
||||
}
|
||||
|
||||
if (Continuation.isReturnBarrierEntry(senderPC)) {
|
||||
// We assume WalkContinuation is "WalkContinuation::skip".
|
||||
// It is same with c'tor arguments of RegisterMap in frame::next_frame().
|
||||
//
|
||||
// HotSpot code in cpu/riscv/frame_riscv.inline.hpp:
|
||||
//
|
||||
// if (Continuation::is_return_barrier_entry(sender_pc)) {
|
||||
// if (map->walk_cont()) { // about to walk into an h-stack
|
||||
// return Continuation::top_frame(*this, map);
|
||||
// } else {
|
||||
// return Continuation::continuation_bottom_sender(map->thread(), *this, l_sender_sp);
|
||||
// }
|
||||
// }
|
||||
return Continuation.continuationBottomSender(map.getThread(), this, senderSP);
|
||||
}
|
||||
|
||||
return new RISCV64Frame(senderSP, savedFPAddr.getAddressAt(0), senderPC);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user