Merge
This commit is contained in:
commit
1619b516b6
4
.hgtags
4
.hgtags
@ -218,3 +218,7 @@ b72ae39e1329fefae50d4690db4fde43f3841a95 jdk8-b93
|
||||
0d804e3b955dce406af6a79ac1cc35c696aff7fb jdk8-b94
|
||||
49fe9c8049132647ad38837a877dd473e6c9b0e5 jdk8-b95
|
||||
ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96
|
||||
0a85476a0b9cb876d5666d45097dac68bef3fce1 jdk8-b97
|
||||
711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98
|
||||
2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99
|
||||
3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100
|
||||
|
@ -218,3 +218,7 @@ cb51fb4789ac0b8be4056482077ddfb8f3bd3805 jdk8-b91
|
||||
50d2bde060f2a9bbbe4da0c8986e20aca61f2e2e jdk8-b94
|
||||
785d07fe38901ecc1b7e0145e53e1c3da9361fee jdk8-b95
|
||||
c156084add486f941c12d886a0b1b2854795d557 jdk8-b96
|
||||
a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97
|
||||
0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98
|
||||
59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99
|
||||
d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -208,6 +208,8 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
|
||||
# Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk.
|
||||
VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'`
|
||||
VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'`
|
||||
# Remove any paths containing # (typically F#) as that messes up make
|
||||
PATH=`$ECHO "$PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
|
||||
VS_PATH="$PATH"
|
||||
AC_SUBST(VS_INCLUDE)
|
||||
AC_SUBST(VS_LIB)
|
||||
|
@ -218,3 +218,7 @@ c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
|
||||
22f5d7f261d9d61a953d2d9a53f2e9ce0ca361d1 jdk8-b94
|
||||
2cf36f43df36137980d9828cec27003ec10daeee jdk8-b95
|
||||
3357c2776431d51a8de326a85e0f41420e40774f jdk8-b96
|
||||
469995a8e97424f450c880606d689bf345277b19 jdk8-b97
|
||||
3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
|
||||
3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
|
||||
8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
|
||||
|
@ -355,3 +355,11 @@ b786c04b7be15194febe88dc1f0c9443e737a84b hs25-b35
|
||||
2cc5a9d1ba66dfdff578918b393c727bd9450210 hs25-b38
|
||||
e6a4b8c71fa6f225bd989a34de2d0d0a656a8be8 jdk8-b96
|
||||
2b9380b0bf0b649f40704735773e8956c2d88ba0 hs25-b39
|
||||
d197d377ab2e016d024e8c86cb06a57bd7eae590 jdk8-b97
|
||||
c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40
|
||||
30b5b75c42ac5174b640fbef8aa87527668e8400 jdk8-b98
|
||||
2b9946e10587f74ef75ae8145bea484df4a2738b hs25-b41
|
||||
81b6cb70717c66375846b78bb174594ec3aa998e jdk8-b99
|
||||
9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42
|
||||
5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100
|
||||
46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
|
||||
|
@ -31,13 +31,19 @@ import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class CLHSDB {
|
||||
|
||||
public CLHSDB(JVMDebugger d) {
|
||||
jvmDebugger = d;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
new CLHSDB(args).run();
|
||||
}
|
||||
|
||||
private void run() {
|
||||
// At this point, if pidText != null we are supposed to attach to it.
|
||||
// Else, if execPath != null, it is the path of a jdk/bin/java
|
||||
public void run() {
|
||||
// If jvmDebugger is already set, we have been given a JVMDebugger.
|
||||
// Otherwise, if pidText != null we are supposed to attach to it.
|
||||
// Finally, if execPath != null, it is the path of a jdk/bin/java
|
||||
// and coreFilename is the pathname of a core file we are
|
||||
// supposed to attach to.
|
||||
|
||||
@ -49,7 +55,9 @@ public class CLHSDB {
|
||||
}
|
||||
});
|
||||
|
||||
if (pidText != null) {
|
||||
if (jvmDebugger != null) {
|
||||
attachDebugger(jvmDebugger);
|
||||
} else if (pidText != null) {
|
||||
attachDebugger(pidText);
|
||||
} else if (execPath != null) {
|
||||
attachDebugger(execPath, coreFilename);
|
||||
@ -96,6 +104,7 @@ public class CLHSDB {
|
||||
// Internals only below this point
|
||||
//
|
||||
private HotSpotAgent agent;
|
||||
private JVMDebugger jvmDebugger;
|
||||
private boolean attached;
|
||||
// These had to be made data members because they are referenced in inner classes.
|
||||
private String pidText;
|
||||
@ -120,7 +129,7 @@ public class CLHSDB {
|
||||
case (1):
|
||||
if (args[0].equals("help") || args[0].equals("-help")) {
|
||||
doUsage();
|
||||
System.exit(0);
|
||||
return;
|
||||
}
|
||||
// If all numbers, it is a PID to attach to
|
||||
// Else, it is a pathname to a .../bin/java for a core file.
|
||||
@ -142,10 +151,15 @@ public class CLHSDB {
|
||||
default:
|
||||
System.out.println("HSDB Error: Too many options specified");
|
||||
doUsage();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void attachDebugger(JVMDebugger d) {
|
||||
agent.attach(d);
|
||||
attached = true;
|
||||
}
|
||||
|
||||
/** NOTE we are in a different thread here than either the main
|
||||
thread or the Swing/AWT event handler thread, so we must be very
|
||||
careful when creating or removing widgets */
|
||||
|
@ -101,6 +101,9 @@ import sun.jvm.hotspot.utilities.soql.JSJavaFactoryImpl;
|
||||
import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine;
|
||||
|
||||
public class CommandProcessor {
|
||||
|
||||
volatile boolean quit;
|
||||
|
||||
public abstract static class DebuggerInterface {
|
||||
public abstract HotSpotAgent getAgent();
|
||||
public abstract boolean isAttached();
|
||||
@ -1135,7 +1138,7 @@ public class CommandProcessor {
|
||||
usage();
|
||||
} else {
|
||||
debugger.detach();
|
||||
System.exit(0);
|
||||
quit = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1714,7 +1717,7 @@ public class CommandProcessor {
|
||||
}
|
||||
protected void quit() {
|
||||
debugger.detach();
|
||||
System.exit(0);
|
||||
quit = true;
|
||||
}
|
||||
protected BufferedReader getInputReader() {
|
||||
return in;
|
||||
@ -1781,7 +1784,7 @@ public class CommandProcessor {
|
||||
|
||||
public void run(boolean prompt) {
|
||||
// Process interactive commands.
|
||||
while (true) {
|
||||
while (!quit) {
|
||||
if (prompt) printPrompt();
|
||||
String ln = null;
|
||||
try {
|
||||
|
@ -59,8 +59,11 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
// Internals only below this point
|
||||
//
|
||||
private HotSpotAgent agent;
|
||||
private JVMDebugger jvmDebugger;
|
||||
private JDesktopPane desktop;
|
||||
private boolean attached;
|
||||
private boolean argError;
|
||||
private JFrame frame;
|
||||
/** List <JMenuItem> */
|
||||
private java.util.List attachMenuItems;
|
||||
/** List <JMenuItem> */
|
||||
@ -85,6 +88,11 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
System.out.println(" path-to-corefile: Debug this corefile. The default is 'core'");
|
||||
System.out.println(" If no arguments are specified, you can select what to do from the GUI.\n");
|
||||
HotSpotAgent.showUsage();
|
||||
argError = true;
|
||||
}
|
||||
|
||||
public HSDB(JVMDebugger d) {
|
||||
jvmDebugger = d;
|
||||
}
|
||||
|
||||
private HSDB(String[] args) {
|
||||
@ -95,7 +103,6 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
case (1):
|
||||
if (args[0].equals("help") || args[0].equals("-help")) {
|
||||
doUsage();
|
||||
System.exit(0);
|
||||
}
|
||||
// If all numbers, it is a PID to attach to
|
||||
// Else, it is a pathname to a .../bin/java for a core file.
|
||||
@ -117,24 +124,29 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
default:
|
||||
System.out.println("HSDB Error: Too many options specified");
|
||||
doUsage();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void run() {
|
||||
// At this point, if pidText != null we are supposed to attach to it.
|
||||
// Else, if execPath != null, it is the path of a jdk/bin/java
|
||||
// and coreFilename is the pathname of a core file we are
|
||||
// supposed to attach to.
|
||||
// close this tool without calling System.exit
|
||||
protected void closeUI() {
|
||||
workerThread.shutdown();
|
||||
frame.dispose();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
// Don't start the UI if there were bad arguments.
|
||||
if (argError) {
|
||||
return;
|
||||
}
|
||||
|
||||
agent = new HotSpotAgent();
|
||||
workerThread = new WorkerThread();
|
||||
attachMenuItems = new java.util.ArrayList();
|
||||
detachMenuItems = new java.util.ArrayList();
|
||||
|
||||
JFrame frame = new JFrame("HSDB - HotSpot Debugger");
|
||||
frame = new JFrame("HSDB - HotSpot Debugger");
|
||||
frame.setSize(800, 600);
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
|
||||
@ -197,7 +209,7 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
item = createMenuItem("Exit",
|
||||
new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
closeUI();
|
||||
}
|
||||
});
|
||||
item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK));
|
||||
@ -406,7 +418,15 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
}
|
||||
});
|
||||
|
||||
if (pidText != null) {
|
||||
// If jvmDebugger is already set, we have been given a JVMDebugger.
|
||||
// Otherwise, if pidText != null we are supposed to attach to it.
|
||||
// Finally, if execPath != null, it is the path of a jdk/bin/java
|
||||
// and coreFilename is the pathname of a core file we are
|
||||
// supposed to attach to.
|
||||
|
||||
if (jvmDebugger != null) {
|
||||
attach(jvmDebugger);
|
||||
} else if (pidText != null) {
|
||||
attach(pidText);
|
||||
} else if (execPath != null) {
|
||||
attach(execPath, coreFilename);
|
||||
@ -1113,6 +1133,12 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
|
||||
});
|
||||
}
|
||||
|
||||
// Attach to existing JVMDebugger, which should be already attached to a core/process.
|
||||
private void attach(JVMDebugger d) {
|
||||
attached = true;
|
||||
showThreadsDialog();
|
||||
}
|
||||
|
||||
/** NOTE we are in a different thread here than either the main
|
||||
thread or the Swing/AWT event handler thread, so we must be very
|
||||
careful when creating or removing widgets */
|
||||
|
@ -25,6 +25,8 @@
|
||||
package sun.jvm.hotspot;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import sun.jvm.hotspot.debugger.Debugger;
|
||||
import sun.jvm.hotspot.debugger.DebuggerException;
|
||||
@ -63,7 +65,6 @@ public class HotSpotAgent {
|
||||
|
||||
private String os;
|
||||
private String cpu;
|
||||
private String fileSep;
|
||||
|
||||
// The system can work in several ways:
|
||||
// - Attaching to local process
|
||||
@ -155,6 +156,14 @@ public class HotSpotAgent {
|
||||
go();
|
||||
}
|
||||
|
||||
/** This uses a JVMDebugger that is already attached to the core or process */
|
||||
public synchronized void attach(JVMDebugger d)
|
||||
throws DebuggerException {
|
||||
debugger = d;
|
||||
isServer = false;
|
||||
go();
|
||||
}
|
||||
|
||||
/** This attaches to a "debug server" on a remote machine; this
|
||||
remote server has already attached to a process or opened a
|
||||
core file and is waiting for RMI calls on the Debugger object to
|
||||
@ -303,28 +312,37 @@ public class HotSpotAgent {
|
||||
// server, but not client attaching to server)
|
||||
//
|
||||
|
||||
try {
|
||||
os = PlatformInfo.getOS();
|
||||
cpu = PlatformInfo.getCPU();
|
||||
}
|
||||
catch (UnsupportedPlatformException e) {
|
||||
throw new DebuggerException(e);
|
||||
}
|
||||
fileSep = System.getProperty("file.separator");
|
||||
// Handle existing or alternate JVMDebugger:
|
||||
// these will set os, cpu independently of our PlatformInfo implementation.
|
||||
String alternateDebugger = System.getProperty("sa.altDebugger");
|
||||
if (debugger != null) {
|
||||
setupDebuggerExisting();
|
||||
|
||||
} else if (alternateDebugger != null) {
|
||||
setupDebuggerAlternate(alternateDebugger);
|
||||
|
||||
if (os.equals("solaris")) {
|
||||
setupDebuggerSolaris();
|
||||
} else if (os.equals("win32")) {
|
||||
setupDebuggerWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupDebuggerLinux();
|
||||
} else if (os.equals("bsd")) {
|
||||
setupDebuggerBsd();
|
||||
} else if (os.equals("darwin")) {
|
||||
setupDebuggerDarwin();
|
||||
} else {
|
||||
// Add support for more operating systems here
|
||||
throw new DebuggerException("Operating system " + os + " not yet supported");
|
||||
// Otherwise, os, cpu are those of our current platform:
|
||||
try {
|
||||
os = PlatformInfo.getOS();
|
||||
cpu = PlatformInfo.getCPU();
|
||||
} catch (UnsupportedPlatformException e) {
|
||||
throw new DebuggerException(e);
|
||||
}
|
||||
if (os.equals("solaris")) {
|
||||
setupDebuggerSolaris();
|
||||
} else if (os.equals("win32")) {
|
||||
setupDebuggerWin32();
|
||||
} else if (os.equals("linux")) {
|
||||
setupDebuggerLinux();
|
||||
} else if (os.equals("bsd")) {
|
||||
setupDebuggerBsd();
|
||||
} else if (os.equals("darwin")) {
|
||||
setupDebuggerDarwin();
|
||||
} else {
|
||||
// Add support for more operating systems here
|
||||
throw new DebuggerException("Operating system " + os + " not yet supported");
|
||||
}
|
||||
}
|
||||
|
||||
if (isServer) {
|
||||
@ -423,6 +441,41 @@ public class HotSpotAgent {
|
||||
// OS-specific debugger setup/connect routines
|
||||
//
|
||||
|
||||
// Use the existing JVMDebugger, as passed to our constructor.
|
||||
// Retrieve os and cpu from that debugger, not the current platform.
|
||||
private void setupDebuggerExisting() {
|
||||
|
||||
os = debugger.getOS();
|
||||
cpu = debugger.getCPU();
|
||||
setupJVMLibNames(os);
|
||||
machDesc = debugger.getMachineDescription();
|
||||
}
|
||||
|
||||
// Given a classname, load an alternate implementation of JVMDebugger.
|
||||
private void setupDebuggerAlternate(String alternateName) {
|
||||
|
||||
try {
|
||||
Class c = Class.forName(alternateName);
|
||||
Constructor cons = c.getConstructor();
|
||||
debugger = (JVMDebugger) cons.newInstance();
|
||||
attachDebugger();
|
||||
setupDebuggerExisting();
|
||||
|
||||
} catch (ClassNotFoundException cnfe) {
|
||||
throw new DebuggerException("Cannot find alternate SA Debugger: '" + alternateName + "'");
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' has missing constructor.");
|
||||
} catch (InstantiationException ie) {
|
||||
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", ie);
|
||||
} catch (IllegalAccessException iae) {
|
||||
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
|
||||
} catch (InvocationTargetException iae) {
|
||||
throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae);
|
||||
}
|
||||
|
||||
System.err.println("Loaded alternate HotSpot SA Debugger: " + alternateName);
|
||||
}
|
||||
|
||||
//
|
||||
// Solaris
|
||||
//
|
||||
@ -466,6 +519,11 @@ public class HotSpotAgent {
|
||||
debugger = new RemoteDebuggerClient(remote);
|
||||
machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription();
|
||||
os = debugger.getOS();
|
||||
setupJVMLibNames(os);
|
||||
cpu = debugger.getCPU();
|
||||
}
|
||||
|
||||
private void setupJVMLibNames(String os) {
|
||||
if (os.equals("solaris")) {
|
||||
setupJVMLibNamesSolaris();
|
||||
} else if (os.equals("win32")) {
|
||||
@ -479,8 +537,6 @@ public class HotSpotAgent {
|
||||
} else {
|
||||
throw new RuntimeException("Unknown OS type");
|
||||
}
|
||||
|
||||
cpu = debugger.getCPU();
|
||||
}
|
||||
|
||||
private void setupJVMLibNamesSolaris() {
|
||||
|
@ -26,11 +26,11 @@ package sun.jvm.hotspot.debugger.linux;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
class LinuxAddress implements Address {
|
||||
public class LinuxAddress implements Address {
|
||||
protected LinuxDebugger debugger;
|
||||
protected long addr;
|
||||
|
||||
LinuxAddress(LinuxDebugger debugger, long addr) {
|
||||
public LinuxAddress(LinuxDebugger debugger, long addr) {
|
||||
this.debugger = debugger;
|
||||
this.addr = addr;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ package sun.jvm.hotspot.debugger.linux;
|
||||
|
||||
import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
class LinuxOopHandle extends LinuxAddress implements OopHandle {
|
||||
LinuxOopHandle(LinuxDebugger debugger, long addr) {
|
||||
public class LinuxOopHandle extends LinuxAddress implements OopHandle {
|
||||
public LinuxOopHandle(LinuxDebugger debugger, long addr) {
|
||||
super(debugger, addr);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,6 @@ public class ArrayKlass extends Klass {
|
||||
higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0);
|
||||
lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0);
|
||||
vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0);
|
||||
allocSize = new CIntField(type.getCIntegerField("_alloc_size"), 0);
|
||||
componentMirror = new OopField(type.getOopField("_component_mirror"), 0);
|
||||
javaLangCloneableName = null;
|
||||
javaLangObjectName = null;
|
||||
@ -64,7 +63,6 @@ public class ArrayKlass extends Klass {
|
||||
private static MetadataField higherDimension;
|
||||
private static MetadataField lowerDimension;
|
||||
private static CIntField vtableLen;
|
||||
private static CIntField allocSize;
|
||||
private static OopField componentMirror;
|
||||
|
||||
public Klass getJavaSuper() {
|
||||
@ -76,7 +74,6 @@ public class ArrayKlass extends Klass {
|
||||
public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); }
|
||||
public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); }
|
||||
public long getVtableLen() { return vtableLen.getValue(this); }
|
||||
public long getAllocSize() { return allocSize.getValue(this); }
|
||||
public Oop getComponentMirror() { return componentMirror.getValue(this); }
|
||||
|
||||
// constant class names - javaLangCloneable, javaIoSerializable, javaLangObject
|
||||
@ -147,7 +144,6 @@ public class ArrayKlass extends Klass {
|
||||
visitor.doMetadata(higherDimension, true);
|
||||
visitor.doMetadata(lowerDimension, true);
|
||||
visitor.doCInt(vtableLen, true);
|
||||
visitor.doCInt(allocSize, true);
|
||||
visitor.doOop(componentMirror, true);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ public class Klass extends Metadata implements ClassConstants {
|
||||
accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0);
|
||||
subklass = new MetadataField(type.getAddressField("_subklass"), 0);
|
||||
nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0);
|
||||
allocCount = new CIntField(type.getCIntegerField("_alloc_count"), 0);
|
||||
|
||||
LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue();
|
||||
LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue();
|
||||
@ -87,7 +86,6 @@ public class Klass extends Metadata implements ClassConstants {
|
||||
private static CIntField accessFlags;
|
||||
private static MetadataField subklass;
|
||||
private static MetadataField nextSibling;
|
||||
private static CIntField allocCount;
|
||||
|
||||
private Address getValue(AddressField field) {
|
||||
return addr.getAddressAt(field.getOffset());
|
||||
@ -108,7 +106,6 @@ public class Klass extends Metadata implements ClassConstants {
|
||||
public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); }
|
||||
public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); }
|
||||
public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); }
|
||||
public long getAllocCount() { return allocCount.getValue(this); }
|
||||
|
||||
// computed access flags - takes care of inner classes etc.
|
||||
// This is closer to actual source level than getAccessFlags() etc.
|
||||
@ -172,7 +169,6 @@ public class Klass extends Metadata implements ClassConstants {
|
||||
visitor.doCInt(accessFlags, true);
|
||||
visitor.doMetadata(subklass, true);
|
||||
visitor.doMetadata(nextSibling, true);
|
||||
visitor.doCInt(allocCount, true);
|
||||
}
|
||||
|
||||
public long getObjectSize() {
|
||||
|
@ -246,7 +246,7 @@ public class VM {
|
||||
}
|
||||
}
|
||||
|
||||
private static final boolean disableDerivedPrinterTableCheck;
|
||||
private static final boolean disableDerivedPointerTableCheck;
|
||||
private static final Properties saProps;
|
||||
|
||||
static {
|
||||
@ -256,12 +256,12 @@ public class VM {
|
||||
url = VM.class.getClassLoader().getResource("sa.properties");
|
||||
saProps.load(new BufferedInputStream(url.openStream()));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Unable to load properties " +
|
||||
System.err.println("Unable to load properties " +
|
||||
(url == null ? "null" : url.toString()) +
|
||||
": " + e.getMessage());
|
||||
}
|
||||
|
||||
disableDerivedPrinterTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null;
|
||||
disableDerivedPointerTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null;
|
||||
}
|
||||
|
||||
private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) {
|
||||
@ -371,7 +371,8 @@ public class VM {
|
||||
/** This is used by the debugging system */
|
||||
public static void initialize(TypeDataBase db, JVMDebugger debugger) {
|
||||
if (soleInstance != null) {
|
||||
throw new RuntimeException("Attempt to initialize VM twice");
|
||||
// Using multiple SA Tool classes in the same process creates a call here.
|
||||
return;
|
||||
}
|
||||
soleInstance = new VM(db, debugger, debugger.getMachineDescription().isBigEndian());
|
||||
|
||||
@ -683,7 +684,7 @@ public class VM {
|
||||
|
||||
/** Returns true if C2 derived pointer table should be used, false otherwise */
|
||||
public boolean useDerivedPointerTable() {
|
||||
return !disableDerivedPrinterTableCheck;
|
||||
return !disableDerivedPointerTableCheck;
|
||||
}
|
||||
|
||||
/** Returns the code cache; should not be used if is core build */
|
||||
|
@ -41,6 +41,14 @@ import sun.jvm.hotspot.utilities.*;
|
||||
public class ClassLoaderStats extends Tool {
|
||||
boolean verbose = true;
|
||||
|
||||
public ClassLoaderStats() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ClassLoaderStats(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ClassLoaderStats cls = new ClassLoaderStats();
|
||||
cls.start(args);
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.tools.*;
|
||||
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
@ -42,6 +43,15 @@ import java.util.Comparator;
|
||||
* summary of these objects in the form of a histogram.
|
||||
*/
|
||||
public class FinalizerInfo extends Tool {
|
||||
|
||||
public FinalizerInfo() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FinalizerInfo(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
FinalizerInfo finfo = new FinalizerInfo();
|
||||
finfo.start(args);
|
||||
|
@ -25,10 +25,19 @@
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
public class FlagDumper extends Tool {
|
||||
|
||||
public FlagDumper() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FlagDumper(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
VM.Flag[] flags = VM.getVM().getCommandLineFlags();
|
||||
PrintStream out = System.out;
|
||||
|
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import sun.jvm.hotspot.utilities.HeapHprofBinWriter;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import java.io.IOException;
|
||||
|
||||
/*
|
||||
@ -42,6 +43,11 @@ public class HeapDumper extends Tool {
|
||||
this.dumpFile = dumpFile;
|
||||
}
|
||||
|
||||
public HeapDumper(String dumpFile, JVMDebugger d) {
|
||||
super(d);
|
||||
this.dumpFile = dumpFile;
|
||||
}
|
||||
|
||||
protected void printFlagsUsage() {
|
||||
System.out.println(" <no option>\tto dump heap to " +
|
||||
DEFAULT_DUMP_FILE);
|
||||
|
@ -29,12 +29,21 @@ import sun.jvm.hotspot.gc_interface.*;
|
||||
import sun.jvm.hotspot.gc_implementation.g1.*;
|
||||
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
|
||||
import sun.jvm.hotspot.gc_implementation.shared.*;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.memory.*;
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
public class HeapSummary extends Tool {
|
||||
|
||||
public HeapSummary() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HeapSummary(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
HeapSummary hs = new HeapSummary();
|
||||
hs.start(args);
|
||||
|
@ -25,12 +25,21 @@
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
|
||||
public class JInfo extends Tool {
|
||||
public JInfo() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JInfo(int m) {
|
||||
mode = m;
|
||||
}
|
||||
|
||||
public JInfo(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
protected boolean needsJavaPrefix() {
|
||||
return false;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import java.io.*;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
|
||||
public class JMap extends Tool {
|
||||
@ -36,6 +37,10 @@ public class JMap extends Tool {
|
||||
this(MODE_PMAP);
|
||||
}
|
||||
|
||||
public JMap(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
protected boolean needsJavaPrefix() {
|
||||
return false;
|
||||
}
|
||||
|
@ -25,9 +25,19 @@
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import java.io.*;
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
public class JSnap extends Tool {
|
||||
|
||||
public JSnap() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JSnap(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
final PrintStream out = System.out;
|
||||
if (PerfMemory.initialized()) {
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
package sun.jvm.hotspot.tools;
|
||||
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
|
||||
public class JStack extends Tool {
|
||||
public JStack(boolean mixedMode, boolean concurrentLocks) {
|
||||
this.mixedMode = mixedMode;
|
||||
@ -34,6 +36,10 @@ public class JStack extends Tool {
|
||||
this(true, true);
|
||||
}
|
||||
|
||||
public JStack(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
protected boolean needsJavaPrefix() {
|
||||
return false;
|
||||
}
|
||||
|
@ -33,6 +33,14 @@ import java.io.PrintStream;
|
||||
an object histogram from a remote or crashed VM. */
|
||||
public class ObjectHistogram extends Tool {
|
||||
|
||||
public ObjectHistogram() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ObjectHistogram(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
run(System.out, System.err);
|
||||
}
|
||||
|
@ -31,6 +31,15 @@ import sun.jvm.hotspot.debugger.cdbg.*;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
public class PMap extends Tool {
|
||||
|
||||
public PMap() {
|
||||
super();
|
||||
}
|
||||
|
||||
public PMap(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
run(System.out);
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ public class PStack extends Tool {
|
||||
this(true, true);
|
||||
}
|
||||
|
||||
public PStack(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
run(System.out);
|
||||
}
|
||||
|
@ -45,6 +45,16 @@ public class StackTrace extends Tool {
|
||||
run(System.out);
|
||||
}
|
||||
|
||||
public StackTrace(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public StackTrace(JVMDebugger d, boolean v, boolean concurrentLocks) {
|
||||
super(d);
|
||||
this.verbose = v;
|
||||
this.concurrentLocks = concurrentLocks;
|
||||
}
|
||||
|
||||
public void run(java.io.PrintStream tty) {
|
||||
// Ready to go with the database...
|
||||
try {
|
||||
|
@ -27,10 +27,19 @@ package sun.jvm.hotspot.tools;
|
||||
import java.io.PrintStream;
|
||||
import java.util.*;
|
||||
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.runtime.*;
|
||||
|
||||
public class SysPropsDumper extends Tool {
|
||||
|
||||
public SysPropsDumper() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SysPropsDumper(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public void run() {
|
||||
Properties sysProps = VM.getVM().getSystemProperties();
|
||||
PrintStream out = System.out;
|
||||
|
@ -35,6 +35,7 @@ import sun.jvm.hotspot.debugger.*;
|
||||
|
||||
public abstract class Tool implements Runnable {
|
||||
private HotSpotAgent agent;
|
||||
private JVMDebugger jvmDebugger;
|
||||
private int debugeeType;
|
||||
|
||||
// debugeeType is one of constants below
|
||||
@ -42,6 +43,13 @@ public abstract class Tool implements Runnable {
|
||||
protected static final int DEBUGEE_CORE = 1;
|
||||
protected static final int DEBUGEE_REMOTE = 2;
|
||||
|
||||
public Tool() {
|
||||
}
|
||||
|
||||
public Tool(JVMDebugger d) {
|
||||
jvmDebugger = d;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return getClass().getName();
|
||||
}
|
||||
@ -90,7 +98,6 @@ public abstract class Tool implements Runnable {
|
||||
|
||||
protected void usage() {
|
||||
printUsage();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -106,13 +113,13 @@ public abstract class Tool implements Runnable {
|
||||
protected void stop() {
|
||||
if (agent != null) {
|
||||
agent.detach();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
protected void start(String[] args) {
|
||||
if ((args.length < 1) || (args.length > 2)) {
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
|
||||
// Attempt to handle -h or -help or some invalid flag
|
||||
@ -185,13 +192,31 @@ public abstract class Tool implements Runnable {
|
||||
}
|
||||
if (e.getMessage() != null) {
|
||||
err.print(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
err.println();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
err.println("Debugger attached successfully.");
|
||||
startInternal();
|
||||
}
|
||||
|
||||
// When using an existing JVMDebugger.
|
||||
public void start() {
|
||||
|
||||
if (jvmDebugger == null) {
|
||||
throw new RuntimeException("Tool.start() called with no JVMDebugger set.");
|
||||
}
|
||||
agent = new HotSpotAgent();
|
||||
agent.attach(jvmDebugger);
|
||||
startInternal();
|
||||
}
|
||||
|
||||
// Remains of the start mechanism, common to both start methods.
|
||||
private void startInternal() {
|
||||
|
||||
PrintStream err = System.err;
|
||||
VM vm = VM.getVM();
|
||||
if (vm.isCore()) {
|
||||
err.println("Core build detected.");
|
||||
|
@ -25,6 +25,7 @@
|
||||
package sun.jvm.hotspot.tools.jcore;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.Manifest;
|
||||
@ -38,6 +39,16 @@ public class ClassDump extends Tool {
|
||||
private ClassFilter classFilter;
|
||||
private String outputDirectory;
|
||||
private JarOutputStream jarStream;
|
||||
private String pkgList;
|
||||
|
||||
public ClassDump() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ClassDump(JVMDebugger d, String pkgList) {
|
||||
super(d);
|
||||
this.pkgList = pkgList;
|
||||
}
|
||||
|
||||
public void setClassFilter(ClassFilter cf) {
|
||||
classFilter = cf;
|
||||
@ -63,6 +74,25 @@ public class ClassDump extends Tool {
|
||||
public void run() {
|
||||
// Ready to go with the database...
|
||||
try {
|
||||
// The name of the filter always comes from a System property.
|
||||
// If we have a pkgList, pass it, otherwise let the filter read
|
||||
// its own System property for the list of classes.
|
||||
String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
|
||||
"sun.jvm.hotspot.tools.jcore.PackageNameFilter");
|
||||
try {
|
||||
Class filterClass = Class.forName(filterClassName);
|
||||
if (pkgList == null) {
|
||||
classFilter = (ClassFilter) filterClass.newInstance();
|
||||
} else {
|
||||
Constructor con = filterClass.getConstructor(String.class);
|
||||
classFilter = (ClassFilter) con.newInstance(pkgList);
|
||||
}
|
||||
} catch(Exception exp) {
|
||||
System.err.println("Warning: Can not create class filter!");
|
||||
}
|
||||
|
||||
String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", ".");
|
||||
setOutputDirectory(outputDirectory);
|
||||
|
||||
// walk through the system dictionary
|
||||
SystemDictionary dict = VM.getVM().getSystemDictionary();
|
||||
@ -139,26 +169,8 @@ public class ClassDump extends Tool {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// load class filters
|
||||
ClassFilter classFilter = null;
|
||||
String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter");
|
||||
if (filterClassName != null) {
|
||||
try {
|
||||
Class filterClass = Class.forName(filterClassName);
|
||||
classFilter = (ClassFilter) filterClass.newInstance();
|
||||
} catch(Exception exp) {
|
||||
System.err.println("Warning: Can not create class filter!");
|
||||
}
|
||||
}
|
||||
|
||||
String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir");
|
||||
if (outputDirectory == null)
|
||||
outputDirectory = ".";
|
||||
|
||||
|
||||
ClassDump cd = new ClassDump();
|
||||
cd.setClassFilter(classFilter);
|
||||
cd.setOutputDirectory(outputDirectory);
|
||||
cd.start(args);
|
||||
cd.stop();
|
||||
}
|
||||
|
@ -24,12 +24,22 @@
|
||||
|
||||
package sun.jvm.hotspot.tools.soql;
|
||||
|
||||
import sun.jvm.hotspot.debugger.JVMDebugger;
|
||||
import sun.jvm.hotspot.tools.*;
|
||||
import sun.jvm.hotspot.utilities.*;
|
||||
import sun.jvm.hotspot.utilities.soql.*;
|
||||
|
||||
/** This is command line JavaScript debugger console */
|
||||
public class JSDB extends Tool {
|
||||
|
||||
public JSDB() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JSDB(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSDB jsdb = new JSDB();
|
||||
jsdb.start(args);
|
||||
|
@ -44,6 +44,14 @@ public class SOQL extends Tool {
|
||||
soql.stop();
|
||||
}
|
||||
|
||||
public SOQL() {
|
||||
super();
|
||||
}
|
||||
|
||||
public SOQL(JVMDebugger d) {
|
||||
super(d);
|
||||
}
|
||||
|
||||
protected SOQLEngine soqlEngine;
|
||||
protected BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
|
||||
protected PrintStream out = System.out;
|
||||
|
@ -221,7 +221,6 @@
|
||||
_JVM_SetLength
|
||||
_JVM_SetNativeThreadName
|
||||
_JVM_SetPrimitiveArrayElement
|
||||
_JVM_SetProtectionDomain
|
||||
_JVM_SetSockOpt
|
||||
_JVM_SetThreadPriority
|
||||
_JVM_Sleep
|
||||
|
@ -221,7 +221,6 @@
|
||||
_JVM_SetLength
|
||||
_JVM_SetNativeThreadName
|
||||
_JVM_SetPrimitiveArrayElement
|
||||
_JVM_SetProtectionDomain
|
||||
_JVM_SetSockOpt
|
||||
_JVM_SetThreadPriority
|
||||
_JVM_Sleep
|
||||
|
@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
|
||||
|
||||
HS_MAJOR_VER=25
|
||||
HS_MINOR_VER=0
|
||||
HS_BUILD_NUMBER=39
|
||||
HS_BUILD_NUMBER=43
|
||||
|
||||
JDK_MAJOR_VER=1
|
||||
JDK_MINOR_VER=8
|
||||
|
@ -223,7 +223,6 @@ SUNWprivate_1.1 {
|
||||
JVM_SetLength;
|
||||
JVM_SetNativeThreadName;
|
||||
JVM_SetPrimitiveArrayElement;
|
||||
JVM_SetProtectionDomain;
|
||||
JVM_SetSockOpt;
|
||||
JVM_SetThreadPriority;
|
||||
JVM_Sleep;
|
||||
|
@ -223,7 +223,6 @@ SUNWprivate_1.1 {
|
||||
JVM_SetLength;
|
||||
JVM_SetNativeThreadName;
|
||||
JVM_SetPrimitiveArrayElement;
|
||||
JVM_SetProtectionDomain;
|
||||
JVM_SetSockOpt;
|
||||
JVM_SetThreadPriority;
|
||||
JVM_Sleep;
|
||||
|
@ -46,6 +46,7 @@ ifeq ($(findstring true, $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
|
||||
include $(MAKEFILES_DIR)/zeroshark.make
|
||||
else
|
||||
include $(MAKEFILES_DIR)/$(BUILDARCH).make
|
||||
-include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make
|
||||
endif
|
||||
|
||||
# set VPATH so make knows where to look for source files
|
||||
@ -211,6 +212,12 @@ ifeq ($(Platform_arch_model), x86_64)
|
||||
Src_Files_EXCLUDE += \*x86_32\*
|
||||
endif
|
||||
|
||||
# Alternate vm.make
|
||||
# This has to be included here to allow changes to the source
|
||||
# directories and excluded files before they are expanded
|
||||
# by the definition of Src_Files.
|
||||
-include $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make
|
||||
|
||||
# Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
|
||||
define findsrc
|
||||
$(notdir $(shell find $(1)/. ! -name . -prune \
|
||||
@ -380,4 +387,4 @@ build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceChe
|
||||
|
||||
install: install_jvm install_jsig install_saproc
|
||||
|
||||
.PHONY: default build install install_jvm
|
||||
.PHONY: default build install install_jvm $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/$(BUILDARCH).make $(HS_ALT_MAKE)/$(Platform_os_family)/makefiles/vm.make
|
||||
|
@ -223,7 +223,6 @@ SUNWprivate_1.1 {
|
||||
JVM_SetLength;
|
||||
JVM_SetNativeThreadName;
|
||||
JVM_SetPrimitiveArrayElement;
|
||||
JVM_SetProtectionDomain;
|
||||
JVM_SetSockOpt;
|
||||
JVM_SetThreadPriority;
|
||||
JVM_Sleep;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2013, 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
|
||||
@ -110,6 +110,7 @@ CXX_FLAGS=$(CXX_FLAGS) /D TARGET_COMPILER_visCPP
|
||||
# 1400 is for VS2005
|
||||
# 1500 is for VS2008
|
||||
# 1600 is for VS2010
|
||||
# 1700 is for VS2012
|
||||
# Do not confuse this MSC_VER with the predefined macro _MSC_VER that the
|
||||
# compiler provides, when MSC_VER==1399, _MSC_VER will be 1400.
|
||||
# Normally they are the same, but a pre-release of the VS2005 compilers
|
||||
@ -142,6 +143,9 @@ COMPILER_NAME=VS2008
|
||||
!if "$(MSC_VER)" == "1600"
|
||||
COMPILER_NAME=VS2010
|
||||
!endif
|
||||
!if "$(MSC_VER)" == "1700"
|
||||
COMPILER_NAME=VS2012
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# By default, we do not want to use the debug version of the msvcrt.dll file
|
||||
@ -151,9 +155,13 @@ MS_RUNTIME_OPTION = /MD
|
||||
MS_RUNTIME_OPTION = /MTd /D "_DEBUG"
|
||||
!endif
|
||||
|
||||
# VS2012 and later won't work with:
|
||||
# /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB
|
||||
!if "$(MSC_VER)" < "1700"
|
||||
# Always add the _STATIC_CPPLIB flag
|
||||
STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB
|
||||
MS_RUNTIME_OPTION = $(MS_RUNTIME_OPTION) $(STATIC_CPPLIB_OPTION)
|
||||
!endif
|
||||
CXX_FLAGS=$(CXX_FLAGS) $(MS_RUNTIME_OPTION)
|
||||
|
||||
# How /GX option is spelled
|
||||
@ -221,6 +229,22 @@ LD_FLAGS = /SAFESEH $(LD_FLAGS)
|
||||
!endif
|
||||
!endif
|
||||
|
||||
!if "$(COMPILER_NAME)" == "VS2012"
|
||||
PRODUCT_OPT_OPTION = /O2 /Oy-
|
||||
FASTDEBUG_OPT_OPTION = /O2 /Oy-
|
||||
DEBUG_OPT_OPTION = /Od
|
||||
GX_OPTION = /EHsc
|
||||
LD_FLAGS = /manifest $(LD_FLAGS)
|
||||
# Manifest Tool - used in VS2005 and later to adjust manifests stored
|
||||
# as resources inside build artifacts.
|
||||
!if "x$(MT)" == "x"
|
||||
MT=mt.exe
|
||||
!endif
|
||||
!if "$(BUILDARCH)" == "i486"
|
||||
LD_FLAGS = /SAFESEH $(LD_FLAGS)
|
||||
!endif
|
||||
!endif
|
||||
|
||||
# If NO_OPTIMIZATIONS is defined in the environment, turn everything off
|
||||
!ifdef NO_OPTIMIZATIONS
|
||||
PRODUCT_OPT_OPTION = $(DEBUG_OPT_OPTION)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2006, 2013, 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
|
||||
@ -27,9 +27,9 @@
|
||||
all: checkCL checkLink
|
||||
|
||||
checkCL:
|
||||
@ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" \
|
||||
@ if "$(MSC_VER)" NEQ "1310" if "$(MSC_VER)" NEQ "1399" if "$(MSC_VER)" NEQ "1400" if "$(MSC_VER)" NEQ "1500" if "$(MSC_VER)" NEQ "1600" if "$(MSC_VER)" NEQ "1700" \
|
||||
echo *** WARNING *** unrecognized cl.exe version $(MSC_VER) ($(RAW_MSC_VER)). Use FORCE_MSC_VER to override automatic detection.
|
||||
|
||||
checkLink:
|
||||
@ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" \
|
||||
@ if "$(LD_VER)" NEQ "710" if "$(LD_VER)" NEQ "800" if "$(LD_VER)" NEQ "900" if "$(LD_VER)" NEQ "1000" if "$(LD_VER)" NEQ "1100" \
|
||||
echo *** WARNING *** unrecognized link.exe version $(LD_VER) ($(RAW_LD_VER)). Use FORCE_LD_VER to override automatic detection.
|
||||
|
@ -132,6 +132,10 @@ CXX_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER
|
||||
|
||||
!if "$(USE_PRECOMPILED_HEADER)" != "0"
|
||||
CXX_USE_PCH=/Fp"vm.pch" /Yu"precompiled.hpp"
|
||||
!if "$(COMPILER_NAME)" == "VS2012"
|
||||
# VS2012 requires this object file to be listed:
|
||||
LD_FLAGS=$(LD_FLAGS) _build_pch_file.obj
|
||||
!endif
|
||||
!else
|
||||
CXX_USE_PCH=$(CXX_DONT_USE_PCH)
|
||||
!endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2013, 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
|
||||
@ -2946,6 +2946,9 @@ void LIR_Assembler::monitor_address(int monitor_no, LIR_Opr dst_opr) {
|
||||
}
|
||||
}
|
||||
|
||||
void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
|
||||
fatal("CRC32 intrinsic is not implemented on this platform");
|
||||
}
|
||||
|
||||
void LIR_Assembler::emit_lock(LIR_OpLock* op) {
|
||||
Register obj = op->obj_opr()->as_register();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -784,6 +784,10 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
|
||||
set_no_result(x);
|
||||
}
|
||||
|
||||
void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||
fatal("CRC32 intrinsic is not implemented on this platform");
|
||||
}
|
||||
|
||||
// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
|
||||
// _i2b, _i2c, _i2s
|
||||
void LIRGenerator::do_Convert(Convert* x) {
|
||||
|
@ -49,8 +49,9 @@ define_pd_global(intx, FreqInlineSize, 325 );
|
||||
define_pd_global(bool, ResizeTLAB, true );
|
||||
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
|
||||
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
|
||||
define_pd_global(uintx,CodeCacheMinBlockLength, 1);
|
||||
define_pd_global(uintx,MetaspaceSize, 12*M );
|
||||
define_pd_global(uintx, CodeCacheMinBlockLength, 1);
|
||||
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
|
||||
define_pd_global(uintx, MetaspaceSize, 12*M );
|
||||
define_pd_global(bool, NeverActAsServerClassMachine, true );
|
||||
define_pd_global(intx, NewSizeThreadIncrease, 16*K );
|
||||
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
|
@ -86,7 +86,8 @@ define_pd_global(intx, CodeCacheExpansionSize, 32*K);
|
||||
// Ergonomics related flags
|
||||
define_pd_global(uint64_t,MaxRAM, 4ULL*G);
|
||||
#endif
|
||||
define_pd_global(uintx,CodeCacheMinBlockLength, 4);
|
||||
define_pd_global(uintx, CodeCacheMinBlockLength, 4);
|
||||
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
|
||||
|
||||
// Heap related flags
|
||||
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
|
||||
|
@ -257,11 +257,6 @@ bool frame::safe_for_sender(JavaThread *thread) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Could be a zombie method
|
||||
if (sender_blob->is_zombie() || sender_blob->is_unloaded()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// It should be safe to construct the sender though it might not be valid
|
||||
|
||||
frame sender(_SENDER_SP, younger_sp, adjusted_stack);
|
||||
|
@ -240,10 +240,10 @@ inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {
|
||||
#endif // CC_INTERP
|
||||
|
||||
|
||||
inline JavaCallWrapper* frame::entry_frame_call_wrapper() const {
|
||||
inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {
|
||||
// note: adjust this code if the link argument in StubGenerator::call_stub() changes!
|
||||
const Argument link = Argument(0, false);
|
||||
return (JavaCallWrapper*)sp()[link.as_in().as_register()->sp_offset_in_saved_window()];
|
||||
return (JavaCallWrapper**)&sp()[link.as_in().as_register()->sp_offset_in_saved_window()];
|
||||
}
|
||||
|
||||
|
||||
|
@ -410,6 +410,51 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return start;
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
void generate_safefetch(const char* name, int size, address* entry,
|
||||
address* fault_pc, address* continuation_pc) {
|
||||
// safefetch signatures:
|
||||
// int SafeFetch32(int* adr, int errValue);
|
||||
// intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
|
||||
//
|
||||
// arguments:
|
||||
// o0 = adr
|
||||
// o1 = errValue
|
||||
//
|
||||
// result:
|
||||
// o0 = *adr or errValue
|
||||
|
||||
StubCodeMark mark(this, "StubRoutines", name);
|
||||
|
||||
// Entry point, pc or function descriptor.
|
||||
__ align(CodeEntryAlignment);
|
||||
*entry = __ pc();
|
||||
|
||||
__ mov(O0, G1); // g1 = o0
|
||||
__ mov(O1, O0); // o0 = o1
|
||||
// Load *adr into c_rarg1, may fault.
|
||||
*fault_pc = __ pc();
|
||||
switch (size) {
|
||||
case 4:
|
||||
// int32_t
|
||||
__ ldsw(G1, 0, O0); // o0 = [g1]
|
||||
break;
|
||||
case 8:
|
||||
// int64_t
|
||||
__ ldx(G1, 0, O0); // o0 = [g1]
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
// return errValue or *adr
|
||||
*continuation_pc = __ pc();
|
||||
// By convention with the trap handler we ensure there is a non-CTI
|
||||
// instruction in the trap shadow.
|
||||
__ nop();
|
||||
__ retl();
|
||||
__ delayed()->nop();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------
|
||||
// Continuation point for throwing of implicit exceptions that are not handled in
|
||||
@ -3315,6 +3360,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
// Don't initialize the platform math functions since sparc
|
||||
// doesn't have intrinsics for these operations.
|
||||
|
||||
// Safefetch stubs.
|
||||
generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry,
|
||||
&StubRoutines::_safefetch32_fault_pc,
|
||||
&StubRoutines::_safefetch32_continuation_pc);
|
||||
generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
|
||||
&StubRoutines::_safefetchN_fault_pc,
|
||||
&StubRoutines::_safefetchN_continuation_pc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -1673,6 +1673,11 @@ void Assembler::movdqa(XMMRegister dst, XMMRegister src) {
|
||||
emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
|
||||
}
|
||||
|
||||
void Assembler::movdqa(XMMRegister dst, Address src) {
|
||||
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
|
||||
emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66);
|
||||
}
|
||||
|
||||
void Assembler::movdqu(XMMRegister dst, Address src) {
|
||||
NOT_LP64(assert(VM_Version::supports_sse2(), ""));
|
||||
emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_F3);
|
||||
@ -2286,6 +2291,38 @@ void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
|
||||
emit_int8(imm8);
|
||||
}
|
||||
|
||||
void Assembler::pextrd(Register dst, XMMRegister src, int imm8) {
|
||||
assert(VM_Version::supports_sse4_1(), "");
|
||||
int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
|
||||
emit_int8(0x16);
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
emit_int8(imm8);
|
||||
}
|
||||
|
||||
void Assembler::pextrq(Register dst, XMMRegister src, int imm8) {
|
||||
assert(VM_Version::supports_sse4_1(), "");
|
||||
int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
|
||||
emit_int8(0x16);
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
emit_int8(imm8);
|
||||
}
|
||||
|
||||
void Assembler::pinsrd(XMMRegister dst, Register src, int imm8) {
|
||||
assert(VM_Version::supports_sse4_1(), "");
|
||||
int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, false);
|
||||
emit_int8(0x22);
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
emit_int8(imm8);
|
||||
}
|
||||
|
||||
void Assembler::pinsrq(XMMRegister dst, Register src, int imm8) {
|
||||
assert(VM_Version::supports_sse4_1(), "");
|
||||
int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, true);
|
||||
emit_int8(0x22);
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
emit_int8(imm8);
|
||||
}
|
||||
|
||||
void Assembler::pmovzxbw(XMMRegister dst, Address src) {
|
||||
assert(VM_Version::supports_sse4_1(), "");
|
||||
InstructionMark im(this);
|
||||
@ -3691,6 +3728,16 @@ void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
}
|
||||
|
||||
// Carry-Less Multiplication Quadword
|
||||
void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) {
|
||||
assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), "");
|
||||
bool vector256 = false;
|
||||
int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
|
||||
emit_int8(0x44);
|
||||
emit_int8((unsigned char)(0xC0 | encode));
|
||||
emit_int8((unsigned char)mask);
|
||||
}
|
||||
|
||||
void Assembler::vzeroupper() {
|
||||
assert(VM_Version::supports_avx(), "");
|
||||
(void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE);
|
||||
|
@ -1266,6 +1266,7 @@ private:
|
||||
|
||||
// Move Aligned Double Quadword
|
||||
void movdqa(XMMRegister dst, XMMRegister src);
|
||||
void movdqa(XMMRegister dst, Address src);
|
||||
|
||||
// Move Unaligned Double Quadword
|
||||
void movdqu(Address dst, XMMRegister src);
|
||||
@ -1404,6 +1405,14 @@ private:
|
||||
void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8);
|
||||
void pcmpestri(XMMRegister xmm1, Address src, int imm8);
|
||||
|
||||
// SSE 4.1 extract
|
||||
void pextrd(Register dst, XMMRegister src, int imm8);
|
||||
void pextrq(Register dst, XMMRegister src, int imm8);
|
||||
|
||||
// SSE 4.1 insert
|
||||
void pinsrd(XMMRegister dst, Register src, int imm8);
|
||||
void pinsrq(XMMRegister dst, Register src, int imm8);
|
||||
|
||||
// SSE4.1 packed move
|
||||
void pmovzxbw(XMMRegister dst, XMMRegister src);
|
||||
void pmovzxbw(XMMRegister dst, Address src);
|
||||
@ -1764,6 +1773,9 @@ private:
|
||||
// duplicate 4-bytes integer data from src into 8 locations in dest
|
||||
void vpbroadcastd(XMMRegister dst, XMMRegister src);
|
||||
|
||||
// Carry-Less Multiplication Quadword
|
||||
void vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask);
|
||||
|
||||
// AVX instruction which is used to clear upper 128 bits of YMM registers and
|
||||
// to avoid transaction penalty between AVX and SSE states. There is no
|
||||
// penalty if legacy SSE instructions are encoded using VEX prefix because
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2013, 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
|
||||
@ -3512,6 +3512,22 @@ void LIR_Assembler::emit_arraycopy(LIR_OpArrayCopy* op) {
|
||||
__ bind(*stub->continuation());
|
||||
}
|
||||
|
||||
void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
|
||||
assert(op->crc()->is_single_cpu(), "crc must be register");
|
||||
assert(op->val()->is_single_cpu(), "byte value must be register");
|
||||
assert(op->result_opr()->is_single_cpu(), "result must be register");
|
||||
Register crc = op->crc()->as_register();
|
||||
Register val = op->val()->as_register();
|
||||
Register res = op->result_opr()->as_register();
|
||||
|
||||
assert_different_registers(val, crc, res);
|
||||
|
||||
__ lea(res, ExternalAddress(StubRoutines::crc_table_addr()));
|
||||
__ notl(crc); // ~crc
|
||||
__ update_byte_crc32(crc, val, res);
|
||||
__ notl(crc); // ~crc
|
||||
__ mov(res, crc);
|
||||
}
|
||||
|
||||
void LIR_Assembler::emit_lock(LIR_OpLock* op) {
|
||||
Register obj = op->obj_opr()->as_register(); // may not be an oop
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -932,6 +932,81 @@ void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
|
||||
__ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint
|
||||
}
|
||||
|
||||
void LIRGenerator::do_update_CRC32(Intrinsic* x) {
|
||||
assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support");
|
||||
// Make all state_for calls early since they can emit code
|
||||
LIR_Opr result = rlock_result(x);
|
||||
int flags = 0;
|
||||
switch (x->id()) {
|
||||
case vmIntrinsics::_updateCRC32: {
|
||||
LIRItem crc(x->argument_at(0), this);
|
||||
LIRItem val(x->argument_at(1), this);
|
||||
crc.load_item();
|
||||
val.load_item();
|
||||
__ update_crc32(crc.result(), val.result(), result);
|
||||
break;
|
||||
}
|
||||
case vmIntrinsics::_updateBytesCRC32:
|
||||
case vmIntrinsics::_updateByteBufferCRC32: {
|
||||
bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);
|
||||
|
||||
LIRItem crc(x->argument_at(0), this);
|
||||
LIRItem buf(x->argument_at(1), this);
|
||||
LIRItem off(x->argument_at(2), this);
|
||||
LIRItem len(x->argument_at(3), this);
|
||||
buf.load_item();
|
||||
off.load_nonconstant();
|
||||
|
||||
LIR_Opr index = off.result();
|
||||
int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
|
||||
if(off.result()->is_constant()) {
|
||||
index = LIR_OprFact::illegalOpr;
|
||||
offset += off.result()->as_jint();
|
||||
}
|
||||
LIR_Opr base_op = buf.result();
|
||||
|
||||
#ifndef _LP64
|
||||
if (!is_updateBytes) { // long b raw address
|
||||
base_op = new_register(T_INT);
|
||||
__ convert(Bytecodes::_l2i, buf.result(), base_op);
|
||||
}
|
||||
#else
|
||||
if (index->is_valid()) {
|
||||
LIR_Opr tmp = new_register(T_LONG);
|
||||
__ convert(Bytecodes::_i2l, index, tmp);
|
||||
index = tmp;
|
||||
}
|
||||
#endif
|
||||
|
||||
LIR_Address* a = new LIR_Address(base_op,
|
||||
index,
|
||||
LIR_Address::times_1,
|
||||
offset,
|
||||
T_BYTE);
|
||||
BasicTypeList signature(3);
|
||||
signature.append(T_INT);
|
||||
signature.append(T_ADDRESS);
|
||||
signature.append(T_INT);
|
||||
CallingConvention* cc = frame_map()->c_calling_convention(&signature);
|
||||
const LIR_Opr result_reg = result_register_for(x->type());
|
||||
|
||||
LIR_Opr addr = new_pointer_register();
|
||||
__ leal(LIR_OprFact::address(a), addr);
|
||||
|
||||
crc.load_item_force(cc->at(0));
|
||||
__ move(addr, cc->at(1));
|
||||
len.load_item_force(cc->at(2));
|
||||
|
||||
__ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
|
||||
__ move(result_reg, result);
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
|
||||
// _i2b, _i2c, _i2s
|
||||
|
@ -50,8 +50,9 @@ define_pd_global(intx, InitialCodeCacheSize, 160*K);
|
||||
define_pd_global(intx, ReservedCodeCacheSize, 32*M );
|
||||
define_pd_global(bool, ProfileInterpreter, false);
|
||||
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
|
||||
define_pd_global(uintx,CodeCacheMinBlockLength, 1);
|
||||
define_pd_global(uintx,MetaspaceSize, 12*M );
|
||||
define_pd_global(uintx, CodeCacheMinBlockLength, 1);
|
||||
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
|
||||
define_pd_global(uintx, MetaspaceSize, 12*M );
|
||||
define_pd_global(bool, NeverActAsServerClassMachine, true );
|
||||
define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
define_pd_global(bool, CICompileOSR, true );
|
||||
|
@ -85,7 +85,8 @@ define_pd_global(bool, OptoScheduling, false);
|
||||
define_pd_global(bool, OptoBundling, false);
|
||||
|
||||
define_pd_global(intx, ReservedCodeCacheSize, 48*M);
|
||||
define_pd_global(uintx,CodeCacheMinBlockLength, 4);
|
||||
define_pd_global(uintx, CodeCacheMinBlockLength, 4);
|
||||
define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K);
|
||||
|
||||
// Heap related flags
|
||||
define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M));
|
||||
|
@ -272,11 +272,10 @@ inline jint frame::interpreter_frame_expression_stack_direction() { return -1; }
|
||||
|
||||
// Entry frames
|
||||
|
||||
inline JavaCallWrapper* frame::entry_frame_call_wrapper() const {
|
||||
return (JavaCallWrapper*)at(entry_frame_call_wrapper_offset);
|
||||
inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {
|
||||
return (JavaCallWrapper**)addr_at(entry_frame_call_wrapper_offset);
|
||||
}
|
||||
|
||||
|
||||
// Compiled frames
|
||||
|
||||
inline int frame::local_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) {
|
||||
|
@ -96,6 +96,9 @@ define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS
|
||||
product(intx, UseAVX, 99, \
|
||||
"Highest supported AVX instructions set on x86/x64") \
|
||||
\
|
||||
product(bool, UseCLMUL, false, \
|
||||
"Control whether CLMUL instructions can be used on x86/x64") \
|
||||
\
|
||||
diagnostic(bool, UseIncDec, true, \
|
||||
"Use INC, DEC instructions on x86") \
|
||||
\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -39,6 +39,8 @@
|
||||
address generate_empty_entry(void);
|
||||
address generate_accessor_entry(void);
|
||||
address generate_Reference_get_entry();
|
||||
address generate_CRC32_update_entry();
|
||||
address generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind);
|
||||
void lock_method(void);
|
||||
void generate_stack_overflow_check(void);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -2794,6 +2794,15 @@ void MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src) {
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::movdqa(XMMRegister dst, AddressLiteral src) {
|
||||
if (reachable(src)) {
|
||||
Assembler::movdqa(dst, as_Address(src));
|
||||
} else {
|
||||
lea(rscratch1, src);
|
||||
Assembler::movdqa(dst, Address(rscratch1, 0));
|
||||
}
|
||||
}
|
||||
|
||||
void MacroAssembler::movsd(XMMRegister dst, AddressLiteral src) {
|
||||
if (reachable(src)) {
|
||||
Assembler::movsd(dst, as_Address(src));
|
||||
@ -6388,6 +6397,193 @@ void MacroAssembler::encode_iso_array(Register src, Register dst, Register len,
|
||||
bind(L_done);
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits code to update CRC-32 with a byte value according to constants in table
|
||||
*
|
||||
* @param [in,out]crc Register containing the crc.
|
||||
* @param [in]val Register containing the byte to fold into the CRC.
|
||||
* @param [in]table Register containing the table of crc constants.
|
||||
*
|
||||
* uint32_t crc;
|
||||
* val = crc_table[(val ^ crc) & 0xFF];
|
||||
* crc = val ^ (crc >> 8);
|
||||
*
|
||||
*/
|
||||
void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) {
|
||||
xorl(val, crc);
|
||||
andl(val, 0xFF);
|
||||
shrl(crc, 8); // unsigned shift
|
||||
xorl(crc, Address(table, val, Address::times_4, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Fold 128-bit data chunk
|
||||
*/
|
||||
void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset) {
|
||||
vpclmulhdq(xtmp, xK, xcrc); // [123:64]
|
||||
vpclmulldq(xcrc, xK, xcrc); // [63:0]
|
||||
vpxor(xcrc, xcrc, Address(buf, offset), false /* vector256 */);
|
||||
pxor(xcrc, xtmp);
|
||||
}
|
||||
|
||||
void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf) {
|
||||
vpclmulhdq(xtmp, xK, xcrc);
|
||||
vpclmulldq(xcrc, xK, xcrc);
|
||||
pxor(xcrc, xbuf);
|
||||
pxor(xcrc, xtmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 8-bit folds to compute 32-bit CRC
|
||||
*
|
||||
* uint64_t xcrc;
|
||||
* timesXtoThe32[xcrc & 0xFF] ^ (xcrc >> 8);
|
||||
*/
|
||||
void MacroAssembler::fold_8bit_crc32(XMMRegister xcrc, Register table, XMMRegister xtmp, Register tmp) {
|
||||
movdl(tmp, xcrc);
|
||||
andl(tmp, 0xFF);
|
||||
movdl(xtmp, Address(table, tmp, Address::times_4, 0));
|
||||
psrldq(xcrc, 1); // unsigned shift one byte
|
||||
pxor(xcrc, xtmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* uint32_t crc;
|
||||
* timesXtoThe32[crc & 0xFF] ^ (crc >> 8);
|
||||
*/
|
||||
void MacroAssembler::fold_8bit_crc32(Register crc, Register table, Register tmp) {
|
||||
movl(tmp, crc);
|
||||
andl(tmp, 0xFF);
|
||||
shrl(crc, 8);
|
||||
xorl(crc, Address(table, tmp, Address::times_4, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param crc register containing existing CRC (32-bit)
|
||||
* @param buf register pointing to input byte buffer (byte*)
|
||||
* @param len register containing number of bytes
|
||||
* @param table register that will contain address of CRC table
|
||||
* @param tmp scratch register
|
||||
*/
|
||||
void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp) {
|
||||
assert_different_registers(crc, buf, len, table, tmp, rax);
|
||||
|
||||
Label L_tail, L_tail_restore, L_tail_loop, L_exit, L_align_loop, L_aligned;
|
||||
Label L_fold_tail, L_fold_128b, L_fold_512b, L_fold_512b_loop, L_fold_tail_loop;
|
||||
|
||||
lea(table, ExternalAddress(StubRoutines::crc_table_addr()));
|
||||
notl(crc); // ~crc
|
||||
cmpl(len, 16);
|
||||
jcc(Assembler::less, L_tail);
|
||||
|
||||
// Align buffer to 16 bytes
|
||||
movl(tmp, buf);
|
||||
andl(tmp, 0xF);
|
||||
jccb(Assembler::zero, L_aligned);
|
||||
subl(tmp, 16);
|
||||
addl(len, tmp);
|
||||
|
||||
align(4);
|
||||
BIND(L_align_loop);
|
||||
movsbl(rax, Address(buf, 0)); // load byte with sign extension
|
||||
update_byte_crc32(crc, rax, table);
|
||||
increment(buf);
|
||||
incrementl(tmp);
|
||||
jccb(Assembler::less, L_align_loop);
|
||||
|
||||
BIND(L_aligned);
|
||||
movl(tmp, len); // save
|
||||
shrl(len, 4);
|
||||
jcc(Assembler::zero, L_tail_restore);
|
||||
|
||||
// Fold crc into first bytes of vector
|
||||
movdqa(xmm1, Address(buf, 0));
|
||||
movdl(rax, xmm1);
|
||||
xorl(crc, rax);
|
||||
pinsrd(xmm1, crc, 0);
|
||||
addptr(buf, 16);
|
||||
subl(len, 4); // len > 0
|
||||
jcc(Assembler::less, L_fold_tail);
|
||||
|
||||
movdqa(xmm2, Address(buf, 0));
|
||||
movdqa(xmm3, Address(buf, 16));
|
||||
movdqa(xmm4, Address(buf, 32));
|
||||
addptr(buf, 48);
|
||||
subl(len, 3);
|
||||
jcc(Assembler::lessEqual, L_fold_512b);
|
||||
|
||||
// Fold total 512 bits of polynomial on each iteration,
|
||||
// 128 bits per each of 4 parallel streams.
|
||||
movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 32));
|
||||
|
||||
align(32);
|
||||
BIND(L_fold_512b_loop);
|
||||
fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0);
|
||||
fold_128bit_crc32(xmm2, xmm0, xmm5, buf, 16);
|
||||
fold_128bit_crc32(xmm3, xmm0, xmm5, buf, 32);
|
||||
fold_128bit_crc32(xmm4, xmm0, xmm5, buf, 48);
|
||||
addptr(buf, 64);
|
||||
subl(len, 4);
|
||||
jcc(Assembler::greater, L_fold_512b_loop);
|
||||
|
||||
// Fold 512 bits to 128 bits.
|
||||
BIND(L_fold_512b);
|
||||
movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16));
|
||||
fold_128bit_crc32(xmm1, xmm0, xmm5, xmm2);
|
||||
fold_128bit_crc32(xmm1, xmm0, xmm5, xmm3);
|
||||
fold_128bit_crc32(xmm1, xmm0, xmm5, xmm4);
|
||||
|
||||
// Fold the rest of 128 bits data chunks
|
||||
BIND(L_fold_tail);
|
||||
addl(len, 3);
|
||||
jccb(Assembler::lessEqual, L_fold_128b);
|
||||
movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16));
|
||||
|
||||
BIND(L_fold_tail_loop);
|
||||
fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0);
|
||||
addptr(buf, 16);
|
||||
decrementl(len);
|
||||
jccb(Assembler::greater, L_fold_tail_loop);
|
||||
|
||||
// Fold 128 bits in xmm1 down into 32 bits in crc register.
|
||||
BIND(L_fold_128b);
|
||||
movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr()));
|
||||
vpclmulqdq(xmm2, xmm0, xmm1, 0x1);
|
||||
vpand(xmm3, xmm0, xmm2, false /* vector256 */);
|
||||
vpclmulqdq(xmm0, xmm0, xmm3, 0x1);
|
||||
psrldq(xmm1, 8);
|
||||
psrldq(xmm2, 4);
|
||||
pxor(xmm0, xmm1);
|
||||
pxor(xmm0, xmm2);
|
||||
|
||||
// 8 8-bit folds to compute 32-bit CRC.
|
||||
for (int j = 0; j < 4; j++) {
|
||||
fold_8bit_crc32(xmm0, table, xmm1, rax);
|
||||
}
|
||||
movdl(crc, xmm0); // mov 32 bits to general register
|
||||
for (int j = 0; j < 4; j++) {
|
||||
fold_8bit_crc32(crc, table, rax);
|
||||
}
|
||||
|
||||
BIND(L_tail_restore);
|
||||
movl(len, tmp); // restore
|
||||
BIND(L_tail);
|
||||
andl(len, 0xf);
|
||||
jccb(Assembler::zero, L_exit);
|
||||
|
||||
// Fold the rest of bytes
|
||||
align(4);
|
||||
BIND(L_tail_loop);
|
||||
movsbl(rax, Address(buf, 0)); // load byte with sign extension
|
||||
update_byte_crc32(crc, rax, table);
|
||||
increment(buf);
|
||||
decrementl(len);
|
||||
jccb(Assembler::greater, L_tail_loop);
|
||||
|
||||
BIND(L_exit);
|
||||
notl(crc); // ~c
|
||||
}
|
||||
|
||||
#undef BIND
|
||||
#undef BLOCK_COMMENT
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -899,6 +899,11 @@ public:
|
||||
void movdqu(XMMRegister dst, XMMRegister src) { Assembler::movdqu(dst, src); }
|
||||
void movdqu(XMMRegister dst, AddressLiteral src);
|
||||
|
||||
// Move Aligned Double Quadword
|
||||
void movdqa(XMMRegister dst, Address src) { Assembler::movdqa(dst, src); }
|
||||
void movdqa(XMMRegister dst, XMMRegister src) { Assembler::movdqa(dst, src); }
|
||||
void movdqa(XMMRegister dst, AddressLiteral src);
|
||||
|
||||
void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
|
||||
void movsd(Address dst, XMMRegister src) { Assembler::movsd(dst, src); }
|
||||
void movsd(XMMRegister dst, Address src) { Assembler::movsd(dst, src); }
|
||||
@ -1027,6 +1032,16 @@ public:
|
||||
Assembler::vinsertf128h(dst, nds, src);
|
||||
}
|
||||
|
||||
// Carry-Less Multiplication Quadword
|
||||
void vpclmulldq(XMMRegister dst, XMMRegister nds, XMMRegister src) {
|
||||
// 0x00 - multiply lower 64 bits [0:63]
|
||||
Assembler::vpclmulqdq(dst, nds, src, 0x00);
|
||||
}
|
||||
void vpclmulhdq(XMMRegister dst, XMMRegister nds, XMMRegister src) {
|
||||
// 0x11 - multiply upper 64 bits [64:127]
|
||||
Assembler::vpclmulqdq(dst, nds, src, 0x11);
|
||||
}
|
||||
|
||||
// Data
|
||||
|
||||
void cmov32( Condition cc, Register dst, Address src);
|
||||
@ -1143,6 +1158,16 @@ public:
|
||||
XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3,
|
||||
XMMRegister tmp4, Register tmp5, Register result);
|
||||
|
||||
// CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic.
|
||||
void update_byte_crc32(Register crc, Register val, Register table);
|
||||
void kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp);
|
||||
// Fold 128-bit data chunk
|
||||
void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset);
|
||||
void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf);
|
||||
// Fold 8-bit data
|
||||
void fold_8bit_crc32(Register crc, Register table, Register tmp);
|
||||
void fold_8bit_crc32(XMMRegister crc, Register table, XMMRegister xtmp, Register tmp);
|
||||
|
||||
#undef VIRTUAL
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2013, 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
|
||||
@ -2713,6 +2713,92 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments:
|
||||
*
|
||||
* Inputs:
|
||||
* rsp(4) - int crc
|
||||
* rsp(8) - byte* buf
|
||||
* rsp(12) - int length
|
||||
*
|
||||
* Ouput:
|
||||
* rax - int crc result
|
||||
*/
|
||||
address generate_updateBytesCRC32() {
|
||||
assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
|
||||
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
|
||||
|
||||
address start = __ pc();
|
||||
|
||||
const Register crc = rdx; // crc
|
||||
const Register buf = rsi; // source java byte array address
|
||||
const Register len = rcx; // length
|
||||
const Register table = rdi; // crc_table address (reuse register)
|
||||
const Register tmp = rbx;
|
||||
assert_different_registers(crc, buf, len, table, tmp, rax);
|
||||
|
||||
BLOCK_COMMENT("Entry:");
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
__ push(rsi);
|
||||
__ push(rdi);
|
||||
__ push(rbx);
|
||||
|
||||
Address crc_arg(rbp, 8 + 0);
|
||||
Address buf_arg(rbp, 8 + 4);
|
||||
Address len_arg(rbp, 8 + 8);
|
||||
|
||||
// Load up:
|
||||
__ movl(crc, crc_arg);
|
||||
__ movptr(buf, buf_arg);
|
||||
__ movl(len, len_arg);
|
||||
|
||||
__ kernel_crc32(crc, buf, len, table, tmp);
|
||||
|
||||
__ movl(rax, crc);
|
||||
__ pop(rbx);
|
||||
__ pop(rdi);
|
||||
__ pop(rsi);
|
||||
__ leave(); // required for proper stackwalking of RuntimeStub frame
|
||||
__ ret(0);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
void generate_safefetch(const char* name, int size, address* entry,
|
||||
address* fault_pc, address* continuation_pc) {
|
||||
// safefetch signatures:
|
||||
// int SafeFetch32(int* adr, int errValue);
|
||||
// intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
|
||||
|
||||
StubCodeMark mark(this, "StubRoutines", name);
|
||||
|
||||
// Entry point, pc or function descriptor.
|
||||
*entry = __ pc();
|
||||
|
||||
__ movl(rax, Address(rsp, 0x8));
|
||||
__ movl(rcx, Address(rsp, 0x4));
|
||||
// Load *adr into eax, may fault.
|
||||
*fault_pc = __ pc();
|
||||
switch (size) {
|
||||
case 4:
|
||||
// int32_t
|
||||
__ movl(rax, Address(rcx, 0));
|
||||
break;
|
||||
case 8:
|
||||
// int64_t
|
||||
Unimplemented();
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
// Return errValue or *adr.
|
||||
*continuation_pc = __ pc();
|
||||
__ ret(0);
|
||||
}
|
||||
|
||||
public:
|
||||
// Information about frame layout at time of blocking runtime call.
|
||||
@ -2887,6 +2973,12 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
// Build this early so it's available for the interpreter
|
||||
StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError));
|
||||
|
||||
if (UseCRC32Intrinsics) {
|
||||
// set table address before stub generation which use it
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2919,6 +3011,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
|
||||
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt();
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry,
|
||||
&StubRoutines::_safefetch32_fault_pc,
|
||||
&StubRoutines::_safefetch32_continuation_pc);
|
||||
StubRoutines::_safefetchN_entry = StubRoutines::_safefetch32_entry;
|
||||
StubRoutines::_safefetchN_fault_pc = StubRoutines::_safefetch32_fault_pc;
|
||||
StubRoutines::_safefetchN_continuation_pc = StubRoutines::_safefetch32_continuation_pc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2013, 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
|
||||
@ -279,7 +279,7 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ stmxcsr(mxcsr_save);
|
||||
__ movl(rax, mxcsr_save);
|
||||
__ andl(rax, MXCSR_MASK); // Only check control and mask bits
|
||||
ExternalAddress mxcsr_std(StubRoutines::x86::mxcsr_std());
|
||||
ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std());
|
||||
__ cmp32(rax, mxcsr_std);
|
||||
__ jcc(Assembler::equal, skip_ldmx);
|
||||
__ ldmxcsr(mxcsr_std);
|
||||
@ -729,17 +729,18 @@ class StubGenerator: public StubCodeGenerator {
|
||||
|
||||
if (CheckJNICalls) {
|
||||
Label ok_ret;
|
||||
ExternalAddress mxcsr_std(StubRoutines::addr_mxcsr_std());
|
||||
__ push(rax);
|
||||
__ subptr(rsp, wordSize); // allocate a temp location
|
||||
__ stmxcsr(mxcsr_save);
|
||||
__ movl(rax, mxcsr_save);
|
||||
__ andl(rax, MXCSR_MASK); // Only check control and mask bits
|
||||
__ cmpl(rax, *(int *)(StubRoutines::x86::mxcsr_std()));
|
||||
__ cmp32(rax, mxcsr_std);
|
||||
__ jcc(Assembler::equal, ok_ret);
|
||||
|
||||
__ warn("MXCSR changed by native JNI code, use -XX:+RestoreMXCSROnJNICall");
|
||||
|
||||
__ ldmxcsr(ExternalAddress(StubRoutines::x86::mxcsr_std()));
|
||||
__ ldmxcsr(mxcsr_std);
|
||||
|
||||
__ bind(ok_ret);
|
||||
__ addptr(rsp, wordSize);
|
||||
@ -3357,7 +3358,45 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return start;
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
void generate_safefetch(const char* name, int size, address* entry,
|
||||
address* fault_pc, address* continuation_pc) {
|
||||
// safefetch signatures:
|
||||
// int SafeFetch32(int* adr, int errValue);
|
||||
// intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
|
||||
//
|
||||
// arguments:
|
||||
// c_rarg0 = adr
|
||||
// c_rarg1 = errValue
|
||||
//
|
||||
// result:
|
||||
// PPC_RET = *adr or errValue
|
||||
|
||||
StubCodeMark mark(this, "StubRoutines", name);
|
||||
|
||||
// Entry point, pc or function descriptor.
|
||||
*entry = __ pc();
|
||||
|
||||
// Load *adr into c_rarg1, may fault.
|
||||
*fault_pc = __ pc();
|
||||
switch (size) {
|
||||
case 4:
|
||||
// int32_t
|
||||
__ movl(c_rarg1, Address(c_rarg0, 0));
|
||||
break;
|
||||
case 8:
|
||||
// int64_t
|
||||
__ movq(c_rarg1, Address(c_rarg0, 0));
|
||||
break;
|
||||
default:
|
||||
ShouldNotReachHere();
|
||||
}
|
||||
|
||||
// return errValue or *adr
|
||||
*continuation_pc = __ pc();
|
||||
__ movq(rax, c_rarg1);
|
||||
__ ret(0);
|
||||
}
|
||||
|
||||
// This is a version of CBC/AES Decrypt which does 4 blocks in a loop at a time
|
||||
// to hide instruction latency
|
||||
@ -3584,7 +3623,45 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Arguments:
|
||||
*
|
||||
* Inputs:
|
||||
* c_rarg0 - int crc
|
||||
* c_rarg1 - byte* buf
|
||||
* c_rarg2 - int length
|
||||
*
|
||||
* Ouput:
|
||||
* rax - int crc result
|
||||
*/
|
||||
address generate_updateBytesCRC32() {
|
||||
assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions");
|
||||
|
||||
__ align(CodeEntryAlignment);
|
||||
StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32");
|
||||
|
||||
address start = __ pc();
|
||||
// Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...)
|
||||
// Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...)
|
||||
// rscratch1: r10
|
||||
const Register crc = c_rarg0; // crc
|
||||
const Register buf = c_rarg1; // source java byte array address
|
||||
const Register len = c_rarg2; // length
|
||||
const Register table = c_rarg3; // crc_table address (reuse register)
|
||||
const Register tmp = r11;
|
||||
assert_different_registers(crc, buf, len, table, tmp, rax);
|
||||
|
||||
BLOCK_COMMENT("Entry:");
|
||||
__ enter(); // required for proper stackwalking of RuntimeStub frame
|
||||
|
||||
__ kernel_crc32(crc, buf, len, table, tmp);
|
||||
|
||||
__ movl(rax, crc);
|
||||
__ leave(); // required for proper stackwalking of RuntimeStub frame
|
||||
__ ret(0);
|
||||
|
||||
return start;
|
||||
}
|
||||
|
||||
#undef __
|
||||
#define __ masm->
|
||||
@ -3691,12 +3768,35 @@ class StubGenerator: public StubCodeGenerator {
|
||||
return stub->entry_point();
|
||||
}
|
||||
|
||||
void create_control_words() {
|
||||
// Round to nearest, 53-bit mode, exceptions masked
|
||||
StubRoutines::_fpu_cntrl_wrd_std = 0x027F;
|
||||
// Round to zero, 53-bit mode, exception mased
|
||||
StubRoutines::_fpu_cntrl_wrd_trunc = 0x0D7F;
|
||||
// Round to nearest, 24-bit mode, exceptions masked
|
||||
StubRoutines::_fpu_cntrl_wrd_24 = 0x007F;
|
||||
// Round to nearest, 64-bit mode, exceptions masked
|
||||
StubRoutines::_fpu_cntrl_wrd_64 = 0x037F;
|
||||
// Round to nearest, 64-bit mode, exceptions masked
|
||||
StubRoutines::_mxcsr_std = 0x1F80;
|
||||
// Note: the following two constants are 80-bit values
|
||||
// layout is critical for correct loading by FPU.
|
||||
// Bias for strict fp multiply/divide
|
||||
StubRoutines::_fpu_subnormal_bias1[0]= 0x00000000; // 2^(-15360) == 0x03ff 8000 0000 0000 0000
|
||||
StubRoutines::_fpu_subnormal_bias1[1]= 0x80000000;
|
||||
StubRoutines::_fpu_subnormal_bias1[2]= 0x03ff;
|
||||
// Un-Bias for strict fp multiply/divide
|
||||
StubRoutines::_fpu_subnormal_bias2[0]= 0x00000000; // 2^(+15360) == 0x7bff 8000 0000 0000 0000
|
||||
StubRoutines::_fpu_subnormal_bias2[1]= 0x80000000;
|
||||
StubRoutines::_fpu_subnormal_bias2[2]= 0x7bff;
|
||||
}
|
||||
|
||||
// Initialization
|
||||
void generate_initial() {
|
||||
// Generates all stubs and initializes the entry points
|
||||
|
||||
// This platform-specific stub is needed by generate_call_stub()
|
||||
StubRoutines::x86::_mxcsr_std = generate_fp_mask("mxcsr_std", 0x0000000000001F80);
|
||||
// This platform-specific settings are needed by generate_call_stub()
|
||||
create_control_words();
|
||||
|
||||
// entry points that exist in all platforms Note: This is code
|
||||
// that could be shared among different platforms - however the
|
||||
@ -3736,6 +3836,11 @@ class StubGenerator: public StubCodeGenerator {
|
||||
CAST_FROM_FN_PTR(address,
|
||||
SharedRuntime::
|
||||
throw_StackOverflowError));
|
||||
if (UseCRC32Intrinsics) {
|
||||
// set table address before stub generation which use it
|
||||
StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table;
|
||||
StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32();
|
||||
}
|
||||
}
|
||||
|
||||
void generate_all() {
|
||||
@ -3790,6 +3895,14 @@ class StubGenerator: public StubCodeGenerator {
|
||||
StubRoutines::_cipherBlockChaining_encryptAESCrypt = generate_cipherBlockChaining_encryptAESCrypt();
|
||||
StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt_Parallel();
|
||||
}
|
||||
|
||||
// Safefetch stubs.
|
||||
generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry,
|
||||
&StubRoutines::_safefetch32_fault_pc,
|
||||
&StubRoutines::_safefetch32_continuation_pc);
|
||||
generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
|
||||
&StubRoutines::_safefetchN_fault_pc,
|
||||
&StubRoutines::_safefetchN_continuation_pc);
|
||||
}
|
||||
|
||||
public:
|
||||
|
130
hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp
Normal file
130
hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp
Normal file
@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "runtime/frame.inline.hpp"
|
||||
#include "runtime/stubRoutines.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
|
||||
// Implementation of the platform-specific part of StubRoutines - for
|
||||
// a description of how to extend it, see the stubRoutines.hpp file.
|
||||
|
||||
address StubRoutines::x86::_verify_mxcsr_entry = NULL;
|
||||
address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
|
||||
|
||||
uint64_t StubRoutines::x86::_crc_by128_masks[] =
|
||||
{
|
||||
/* The fields in this structure are arranged so that they can be
|
||||
* picked up two at a time with 128-bit loads.
|
||||
*
|
||||
* Because of flipped bit order for this CRC polynomials
|
||||
* the constant for X**N is left-shifted by 1. This is because
|
||||
* a 64 x 64 polynomial multiply produces a 127-bit result
|
||||
* but the highest term is always aligned to bit 0 in the container.
|
||||
* Pre-shifting by one fixes this, at the cost of potentially making
|
||||
* the 32-bit constant no longer fit in a 32-bit container (thus the
|
||||
* use of uint64_t, though this is also the size used by the carry-
|
||||
* less multiply instruction.
|
||||
*
|
||||
* In addition, the flipped bit order and highest-term-at-least-bit
|
||||
* multiply changes the constants used. The 96-bit result will be
|
||||
* aligned to the high-term end of the target 128-bit container,
|
||||
* not the low-term end; that is, instead of a 512-bit or 576-bit fold,
|
||||
* instead it is a 480 (=512-32) or 544 (=512+64-32) bit fold.
|
||||
*
|
||||
* This cause additional problems in the 128-to-64-bit reduction; see the
|
||||
* code for details. By storing a mask in the otherwise unused half of
|
||||
* a 128-bit constant, bits can be cleared before multiplication without
|
||||
* storing and reloading. Note that staying on a 128-bit datapath means
|
||||
* that some data is uselessly stored and some unused data is intersected
|
||||
* with an irrelevant constant.
|
||||
*/
|
||||
|
||||
((uint64_t) 0xffffffffUL), /* low of K_M_64 */
|
||||
((uint64_t) 0xb1e6b092U << 1), /* high of K_M_64 */
|
||||
((uint64_t) 0xba8ccbe8U << 1), /* low of K_160_96 */
|
||||
((uint64_t) 0x6655004fU << 1), /* high of K_160_96 */
|
||||
((uint64_t) 0xaa2215eaU << 1), /* low of K_544_480 */
|
||||
((uint64_t) 0xe3720acbU << 1) /* high of K_544_480 */
|
||||
};
|
||||
|
||||
/**
|
||||
* crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h
|
||||
*/
|
||||
juint StubRoutines::x86::_crc_table[] =
|
||||
{
|
||||
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
|
||||
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
|
||||
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
|
||||
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
|
||||
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
|
||||
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
|
||||
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
|
||||
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
|
||||
0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
|
||||
0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
|
||||
0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
|
||||
0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
|
||||
0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
|
||||
0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
|
||||
0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
|
||||
0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
|
||||
0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
|
||||
0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
|
||||
0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
|
||||
0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
|
||||
0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
|
||||
0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
|
||||
0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
|
||||
0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
|
||||
0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
|
||||
0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
|
||||
0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
|
||||
0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
|
||||
0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
|
||||
0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
|
||||
0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
|
||||
0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
|
||||
0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
|
||||
0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
|
||||
0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
|
||||
0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
|
||||
0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
|
||||
0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
|
||||
0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
|
||||
0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
|
||||
0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
|
||||
0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
|
||||
0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
|
||||
0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
|
||||
0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
|
||||
0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
|
||||
0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
|
||||
0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
|
||||
0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
|
||||
0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
|
||||
0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
|
||||
0x2d02ef8dUL
|
||||
};
|
45
hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
Normal file
45
hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 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
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CPU_X86_VM_STUBROUTINES_X86_HPP
|
||||
#define CPU_X86_VM_STUBROUTINES_X86_HPP
|
||||
|
||||
// This file holds the platform specific parts of the StubRoutines
|
||||
// definition. See stubRoutines.hpp for a description on how to
|
||||
// extend it.
|
||||
|
||||
private:
|
||||
static address _verify_mxcsr_entry;
|
||||
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
|
||||
static address _key_shuffle_mask_addr;
|
||||
// masks and table for CRC32
|
||||
static uint64_t _crc_by128_masks[];
|
||||
static juint _crc_table[];
|
||||
|
||||
public:
|
||||
static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
|
||||
static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
|
||||
static address crc_by128_masks_addr() { return (address)_crc_by128_masks; }
|
||||
|
||||
#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -31,6 +31,4 @@
|
||||
// Implementation of the platform-specific part of StubRoutines - for
|
||||
// a description of how to extend it, see the stubRoutines.hpp file.
|
||||
|
||||
address StubRoutines::x86::_verify_mxcsr_entry = NULL;
|
||||
address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL;
|
||||
address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -39,15 +39,12 @@ class x86 {
|
||||
friend class VMStructs;
|
||||
|
||||
private:
|
||||
static address _verify_mxcsr_entry;
|
||||
static address _verify_fpu_cntrl_wrd_entry;
|
||||
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
|
||||
static address _key_shuffle_mask_addr;
|
||||
|
||||
public:
|
||||
static address verify_mxcsr_entry() { return _verify_mxcsr_entry; }
|
||||
static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; }
|
||||
static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
|
||||
|
||||
# include "stubRoutines_x86.hpp"
|
||||
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2013, 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,8 +34,6 @@
|
||||
address StubRoutines::x86::_get_previous_fp_entry = NULL;
|
||||
address StubRoutines::x86::_get_previous_sp_entry = NULL;
|
||||
|
||||
address StubRoutines::x86::_verify_mxcsr_entry = NULL;
|
||||
|
||||
address StubRoutines::x86::_f2i_fixup = NULL;
|
||||
address StubRoutines::x86::_f2l_fixup = NULL;
|
||||
address StubRoutines::x86::_d2i_fixup = NULL;
|
||||
@ -44,5 +42,3 @@ address StubRoutines::x86::_float_sign_mask = NULL;
|
||||
address StubRoutines::x86::_float_sign_flip = NULL;
|
||||
address StubRoutines::x86::_double_sign_mask = NULL;
|
||||
address StubRoutines::x86::_double_sign_flip = NULL;
|
||||
address StubRoutines::x86::_mxcsr_std = NULL;
|
||||
address StubRoutines::x86::_key_shuffle_mask_addr = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2013, 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
|
||||
@ -42,7 +42,6 @@ class x86 {
|
||||
private:
|
||||
static address _get_previous_fp_entry;
|
||||
static address _get_previous_sp_entry;
|
||||
static address _verify_mxcsr_entry;
|
||||
|
||||
static address _f2i_fixup;
|
||||
static address _f2l_fixup;
|
||||
@ -53,9 +52,6 @@ class x86 {
|
||||
static address _float_sign_flip;
|
||||
static address _double_sign_mask;
|
||||
static address _double_sign_flip;
|
||||
static address _mxcsr_std;
|
||||
// shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers
|
||||
static address _key_shuffle_mask_addr;
|
||||
|
||||
public:
|
||||
|
||||
@ -69,11 +65,6 @@ class x86 {
|
||||
return _get_previous_sp_entry;
|
||||
}
|
||||
|
||||
static address verify_mxcsr_entry()
|
||||
{
|
||||
return _verify_mxcsr_entry;
|
||||
}
|
||||
|
||||
static address f2i_fixup()
|
||||
{
|
||||
return _f2i_fixup;
|
||||
@ -114,12 +105,7 @@ class x86 {
|
||||
return _double_sign_flip;
|
||||
}
|
||||
|
||||
static address mxcsr_std()
|
||||
{
|
||||
return _mxcsr_std;
|
||||
}
|
||||
|
||||
static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; }
|
||||
# include "stubRoutines_x86.hpp"
|
||||
|
||||
};
|
||||
|
||||
|
@ -868,6 +868,120 @@ address InterpreterGenerator::generate_Reference_get_entry(void) {
|
||||
return generate_accessor_entry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method entry for static native methods:
|
||||
* int java.util.zip.CRC32.update(int crc, int b)
|
||||
*/
|
||||
address InterpreterGenerator::generate_CRC32_update_entry() {
|
||||
if (UseCRC32Intrinsics) {
|
||||
address entry = __ pc();
|
||||
|
||||
// rbx,: Method*
|
||||
// rsi: senderSP must preserved for slow path, set SP to it on fast path
|
||||
// rdx: scratch
|
||||
// rdi: scratch
|
||||
|
||||
Label slow_path;
|
||||
// If we need a safepoint check, generate full interpreter entry.
|
||||
ExternalAddress state(SafepointSynchronize::address_of_state());
|
||||
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
|
||||
SafepointSynchronize::_not_synchronized);
|
||||
__ jcc(Assembler::notEqual, slow_path);
|
||||
|
||||
// We don't generate local frame and don't align stack because
|
||||
// we call stub code and there is no safepoint on this path.
|
||||
|
||||
// Load parameters
|
||||
const Register crc = rax; // crc
|
||||
const Register val = rdx; // source java byte value
|
||||
const Register tbl = rdi; // scratch
|
||||
|
||||
// Arguments are reversed on java expression stack
|
||||
__ movl(val, Address(rsp, wordSize)); // byte value
|
||||
__ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
|
||||
|
||||
__ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
|
||||
__ notl(crc); // ~crc
|
||||
__ update_byte_crc32(crc, val, tbl);
|
||||
__ notl(crc); // ~crc
|
||||
// result in rax
|
||||
|
||||
// _areturn
|
||||
__ pop(rdi); // get return address
|
||||
__ mov(rsp, rsi); // set sp to sender sp
|
||||
__ jmp(rdi);
|
||||
|
||||
// generate a vanilla native entry as the slow path
|
||||
__ bind(slow_path);
|
||||
|
||||
(void) generate_native_entry(false);
|
||||
|
||||
return entry;
|
||||
}
|
||||
return generate_native_entry(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method entry for static native methods:
|
||||
* int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
|
||||
* int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
|
||||
*/
|
||||
address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
|
||||
if (UseCRC32Intrinsics) {
|
||||
address entry = __ pc();
|
||||
|
||||
// rbx,: Method*
|
||||
// rsi: senderSP must preserved for slow path, set SP to it on fast path
|
||||
// rdx: scratch
|
||||
// rdi: scratch
|
||||
|
||||
Label slow_path;
|
||||
// If we need a safepoint check, generate full interpreter entry.
|
||||
ExternalAddress state(SafepointSynchronize::address_of_state());
|
||||
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
|
||||
SafepointSynchronize::_not_synchronized);
|
||||
__ jcc(Assembler::notEqual, slow_path);
|
||||
|
||||
// We don't generate local frame and don't align stack because
|
||||
// we call stub code and there is no safepoint on this path.
|
||||
|
||||
// Load parameters
|
||||
const Register crc = rax; // crc
|
||||
const Register buf = rdx; // source java byte array address
|
||||
const Register len = rdi; // length
|
||||
|
||||
// Arguments are reversed on java expression stack
|
||||
__ movl(len, Address(rsp, wordSize)); // Length
|
||||
// Calculate address of start element
|
||||
if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
|
||||
__ movptr(buf, Address(rsp, 3*wordSize)); // long buf
|
||||
__ addptr(buf, Address(rsp, 2*wordSize)); // + offset
|
||||
__ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC
|
||||
} else {
|
||||
__ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
|
||||
__ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
|
||||
__ addptr(buf, Address(rsp, 2*wordSize)); // + offset
|
||||
__ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC
|
||||
}
|
||||
|
||||
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
|
||||
// result in rax
|
||||
|
||||
// _areturn
|
||||
__ pop(rdi); // get return address
|
||||
__ mov(rsp, rsi); // set sp to sender sp
|
||||
__ jmp(rdi);
|
||||
|
||||
// generate a vanilla native entry as the slow path
|
||||
__ bind(slow_path);
|
||||
|
||||
(void) generate_native_entry(false);
|
||||
|
||||
return entry;
|
||||
}
|
||||
return generate_native_entry(false);
|
||||
}
|
||||
|
||||
//
|
||||
// Interpreter stub for calling a native method. (asm interpreter)
|
||||
// This sets up a somewhat different looking stack for calling the native method
|
||||
@ -1501,15 +1615,16 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
|
||||
// determine code generation flags
|
||||
bool synchronized = false;
|
||||
address entry_point = NULL;
|
||||
InterpreterGenerator* ig_this = (InterpreterGenerator*)this;
|
||||
|
||||
switch (kind) {
|
||||
case Interpreter::zerolocals : break;
|
||||
case Interpreter::zerolocals_synchronized: synchronized = true; break;
|
||||
case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
|
||||
case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
|
||||
case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
|
||||
case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
|
||||
case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
|
||||
case Interpreter::zerolocals : break;
|
||||
case Interpreter::zerolocals_synchronized: synchronized = true; break;
|
||||
case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break;
|
||||
case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break;
|
||||
case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break;
|
||||
case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break;
|
||||
case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break;
|
||||
|
||||
case Interpreter::java_lang_math_sin : // fall thru
|
||||
case Interpreter::java_lang_math_cos : // fall thru
|
||||
@ -1519,9 +1634,15 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
|
||||
case Interpreter::java_lang_math_log10 : // fall thru
|
||||
case Interpreter::java_lang_math_sqrt : // fall thru
|
||||
case Interpreter::java_lang_math_pow : // fall thru
|
||||
case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break;
|
||||
case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break;
|
||||
case Interpreter::java_lang_ref_reference_get
|
||||
: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
|
||||
: entry_point = ig_this->generate_Reference_get_entry(); break;
|
||||
case Interpreter::java_util_zip_CRC32_update
|
||||
: entry_point = ig_this->generate_CRC32_update_entry(); break;
|
||||
case Interpreter::java_util_zip_CRC32_updateBytes
|
||||
: // fall thru
|
||||
case Interpreter::java_util_zip_CRC32_updateByteBuffer
|
||||
: entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break;
|
||||
default:
|
||||
fatal(err_msg("unexpected method kind: %d", kind));
|
||||
break;
|
||||
@ -1529,7 +1650,7 @@ address AbstractInterpreterGenerator::generate_method_entry(AbstractInterpreter:
|
||||
|
||||
if (entry_point) return entry_point;
|
||||
|
||||
return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized);
|
||||
return ig_this->generate_normal_entry(synchronized);
|
||||
|
||||
}
|
||||
|
||||
|
@ -840,6 +840,117 @@ address InterpreterGenerator::generate_Reference_get_entry(void) {
|
||||
return generate_accessor_entry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method entry for static native methods:
|
||||
* int java.util.zip.CRC32.update(int crc, int b)
|
||||
*/
|
||||
address InterpreterGenerator::generate_CRC32_update_entry() {
|
||||
if (UseCRC32Intrinsics) {
|
||||
address entry = __ pc();
|
||||
|
||||
// rbx,: Method*
|
||||
// rsi: senderSP must preserved for slow path, set SP to it on fast path
|
||||
// rdx: scratch
|
||||
// rdi: scratch
|
||||
|
||||
Label slow_path;
|
||||
// If we need a safepoint check, generate full interpreter entry.
|
||||
ExternalAddress state(SafepointSynchronize::address_of_state());
|
||||
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
|
||||
SafepointSynchronize::_not_synchronized);
|
||||
__ jcc(Assembler::notEqual, slow_path);
|
||||
|
||||
// We don't generate local frame and don't align stack because
|
||||
// we call stub code and there is no safepoint on this path.
|
||||
|
||||
// Load parameters
|
||||
const Register crc = rax; // crc
|
||||
const Register val = rdx; // source java byte value
|
||||
const Register tbl = rdi; // scratch
|
||||
|
||||
// Arguments are reversed on java expression stack
|
||||
__ movl(val, Address(rsp, wordSize)); // byte value
|
||||
__ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC
|
||||
|
||||
__ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr()));
|
||||
__ notl(crc); // ~crc
|
||||
__ update_byte_crc32(crc, val, tbl);
|
||||
__ notl(crc); // ~crc
|
||||
// result in rax
|
||||
|
||||
// _areturn
|
||||
__ pop(rdi); // get return address
|
||||
__ mov(rsp, rsi); // set sp to sender sp
|
||||
__ jmp(rdi);
|
||||
|
||||
// generate a vanilla native entry as the slow path
|
||||
__ bind(slow_path);
|
||||
|
||||
(void) generate_native_entry(false);
|
||||
|
||||
return entry;
|
||||
}
|
||||
return generate_native_entry(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method entry for static native methods:
|
||||
* int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len)
|
||||
* int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len)
|
||||
*/
|
||||
address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) {
|
||||
if (UseCRC32Intrinsics) {
|
||||
address entry = __ pc();
|
||||
|
||||
// rbx,: Method*
|
||||
// r13: senderSP must preserved for slow path, set SP to it on fast path
|
||||
|
||||
Label slow_path;
|
||||
// If we need a safepoint check, generate full interpreter entry.
|
||||
ExternalAddress state(SafepointSynchronize::address_of_state());
|
||||
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()),
|
||||
SafepointSynchronize::_not_synchronized);
|
||||
__ jcc(Assembler::notEqual, slow_path);
|
||||
|
||||
// We don't generate local frame and don't align stack because
|
||||
// we call stub code and there is no safepoint on this path.
|
||||
|
||||
// Load parameters
|
||||
const Register crc = c_rarg0; // crc
|
||||
const Register buf = c_rarg1; // source java byte array address
|
||||
const Register len = c_rarg2; // length
|
||||
|
||||
// Arguments are reversed on java expression stack
|
||||
__ movl(len, Address(rsp, wordSize)); // Length
|
||||
// Calculate address of start element
|
||||
if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) {
|
||||
__ movptr(buf, Address(rsp, 3*wordSize)); // long buf
|
||||
__ addptr(buf, Address(rsp, 2*wordSize)); // + offset
|
||||
__ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC
|
||||
} else {
|
||||
__ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array
|
||||
__ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size
|
||||
__ addptr(buf, Address(rsp, 2*wordSize)); // + offset
|
||||
__ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC
|
||||
}
|
||||
|
||||
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len);
|
||||
// result in rax
|
||||
|
||||
// _areturn
|
||||
__ pop(rdi); // get return address
|
||||
__ mov(rsp, r13); // set sp to sender sp
|
||||
__ jmp(rdi);
|
||||
|
||||
// generate a vanilla native entry as the slow path
|
||||
__ bind(slow_path);
|
||||
|
||||
(void) generate_native_entry(false);
|
||||
|
||||
return entry;
|
||||
}
|
||||
return generate_native_entry(false);
|
||||
}
|
||||
|
||||
// Interpreter stub for calling a native method. (asm interpreter)
|
||||
// This sets up a somewhat different looking stack for calling the
|
||||
@ -1510,15 +1621,16 @@ address AbstractInterpreterGenerator::generate_method_entry(
|
||||
// determine code generation flags
|
||||
bool synchronized = false;
|
||||
address entry_point = NULL;
|
||||
InterpreterGenerator* ig_this = (InterpreterGenerator*)this;
|
||||
|
||||
switch (kind) {
|
||||
case Interpreter::zerolocals : break;
|
||||
case Interpreter::zerolocals_synchronized: synchronized = true; break;
|
||||
case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
|
||||
case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
|
||||
case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
|
||||
case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
|
||||
case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
|
||||
case Interpreter::zerolocals : break;
|
||||
case Interpreter::zerolocals_synchronized: synchronized = true; break;
|
||||
case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break;
|
||||
case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break;
|
||||
case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break;
|
||||
case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break;
|
||||
case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break;
|
||||
|
||||
case Interpreter::java_lang_math_sin : // fall thru
|
||||
case Interpreter::java_lang_math_cos : // fall thru
|
||||
@ -1528,9 +1640,15 @@ address AbstractInterpreterGenerator::generate_method_entry(
|
||||
case Interpreter::java_lang_math_log10 : // fall thru
|
||||
case Interpreter::java_lang_math_sqrt : // fall thru
|
||||
case Interpreter::java_lang_math_pow : // fall thru
|
||||
case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break;
|
||||
case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break;
|
||||
case Interpreter::java_lang_ref_reference_get
|
||||
: entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break;
|
||||
: entry_point = ig_this->generate_Reference_get_entry(); break;
|
||||
case Interpreter::java_util_zip_CRC32_update
|
||||
: entry_point = ig_this->generate_CRC32_update_entry(); break;
|
||||
case Interpreter::java_util_zip_CRC32_updateBytes
|
||||
: // fall thru
|
||||
case Interpreter::java_util_zip_CRC32_updateByteBuffer
|
||||
: entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break;
|
||||
default:
|
||||
fatal(err_msg("unexpected method kind: %d", kind));
|
||||
break;
|
||||
@ -1540,8 +1658,7 @@ address AbstractInterpreterGenerator::generate_method_entry(
|
||||
return entry_point;
|
||||
}
|
||||
|
||||
return ((InterpreterGenerator*) this)->
|
||||
generate_normal_entry(synchronized);
|
||||
return ig_this->generate_normal_entry(synchronized);
|
||||
}
|
||||
|
||||
// These should never be compiled since the interpreter will prefer
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -446,6 +446,7 @@ void VM_Version::get_processor_features() {
|
||||
(supports_avx() ? ", avx" : ""),
|
||||
(supports_avx2() ? ", avx2" : ""),
|
||||
(supports_aes() ? ", aes" : ""),
|
||||
(supports_clmul() ? ", clmul" : ""),
|
||||
(supports_erms() ? ", erms" : ""),
|
||||
(supports_mmx_ext() ? ", mmxext" : ""),
|
||||
(supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
|
||||
@ -489,6 +490,27 @@ void VM_Version::get_processor_features() {
|
||||
FLAG_SET_DEFAULT(UseAES, false);
|
||||
}
|
||||
|
||||
// Use CLMUL instructions if available.
|
||||
if (supports_clmul()) {
|
||||
if (FLAG_IS_DEFAULT(UseCLMUL)) {
|
||||
UseCLMUL = true;
|
||||
}
|
||||
} else if (UseCLMUL) {
|
||||
if (!FLAG_IS_DEFAULT(UseCLMUL))
|
||||
warning("CLMUL instructions not available on this CPU (AVX may also be required)");
|
||||
FLAG_SET_DEFAULT(UseCLMUL, false);
|
||||
}
|
||||
|
||||
if (UseCLMUL && (UseAVX > 0) && (UseSSE > 2)) {
|
||||
if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) {
|
||||
UseCRC32Intrinsics = true;
|
||||
}
|
||||
} else if (UseCRC32Intrinsics) {
|
||||
if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics))
|
||||
warning("CRC32 Intrinsics requires AVX and CLMUL instructions (not available on this CPU)");
|
||||
FLAG_SET_DEFAULT(UseCRC32Intrinsics, false);
|
||||
}
|
||||
|
||||
// The AES intrinsic stubs require AES instruction support (of course)
|
||||
// but also require sse3 mode for instructions it use.
|
||||
if (UseAES && (UseSSE > 2)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -61,7 +61,8 @@ public:
|
||||
uint32_t value;
|
||||
struct {
|
||||
uint32_t sse3 : 1,
|
||||
: 2,
|
||||
clmul : 1,
|
||||
: 1,
|
||||
monitor : 1,
|
||||
: 1,
|
||||
vmx : 1,
|
||||
@ -249,7 +250,8 @@ protected:
|
||||
CPU_AVX = (1 << 17),
|
||||
CPU_AVX2 = (1 << 18),
|
||||
CPU_AES = (1 << 19),
|
||||
CPU_ERMS = (1 << 20) // enhanced 'rep movsb/stosb' instructions
|
||||
CPU_ERMS = (1 << 20), // enhanced 'rep movsb/stosb' instructions
|
||||
CPU_CLMUL = (1 << 21) // carryless multiply for CRC
|
||||
} cpuFeatureFlags;
|
||||
|
||||
enum {
|
||||
@ -429,6 +431,8 @@ protected:
|
||||
result |= CPU_AES;
|
||||
if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0)
|
||||
result |= CPU_ERMS;
|
||||
if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0)
|
||||
result |= CPU_CLMUL;
|
||||
|
||||
// AMD features.
|
||||
if (is_amd()) {
|
||||
@ -555,6 +559,7 @@ public:
|
||||
static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; }
|
||||
static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; }
|
||||
static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; }
|
||||
static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; }
|
||||
|
||||
// Intel features
|
||||
static bool is_intel_family_core() { return is_intel() &&
|
||||
|
@ -58,7 +58,9 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M );
|
||||
define_pd_global(bool, ProfileInterpreter, false);
|
||||
define_pd_global(intx, CodeCacheExpansionSize, 32*K );
|
||||
define_pd_global(uintx, CodeCacheMinBlockLength, 1 );
|
||||
define_pd_global(uintx, MetaspaceSize, 12*M );
|
||||
define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K);
|
||||
|
||||
define_pd_global(uintx, MetaspaceSize, 12*M );
|
||||
define_pd_global(bool, NeverActAsServerClassMachine, true );
|
||||
define_pd_global(uint64_t, MaxRAM, 1ULL*G);
|
||||
define_pd_global(bool, CICompileOSR, true );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -437,6 +437,30 @@ AttachOperation* AttachListener::dequeue() {
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
// Performs initialization at vm startup
|
||||
// For BSD we remove any stale .java_pid file which could cause
|
||||
// an attaching process to think we are ready to receive on the
|
||||
// domain socket before we are properly initialized
|
||||
|
||||
void AttachListener::vm_start() {
|
||||
char fn[UNIX_PATH_MAX];
|
||||
struct stat64 st;
|
||||
int ret;
|
||||
|
||||
int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
|
||||
os::get_temp_directory(), os::current_process_id());
|
||||
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");
|
||||
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == 0) {
|
||||
ret = ::unlink(fn);
|
||||
if (ret == -1) {
|
||||
debug_only(warning("failed to remove stale attach pid file at %s", fn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AttachListener::pd_init() {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadBlockInVM tbivm(thread);
|
||||
|
@ -1234,12 +1234,13 @@ bool os::address_is_in_vm(address addr) {
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (libjvm_base_addr == NULL) {
|
||||
dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo);
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) {
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
}
|
||||
assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm");
|
||||
}
|
||||
|
||||
if (dladdr((void *)addr, &dlinfo)) {
|
||||
if (dladdr((void *)addr, &dlinfo) != 0) {
|
||||
if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true;
|
||||
}
|
||||
|
||||
@ -1251,35 +1252,40 @@ bool os::address_is_in_vm(address addr) {
|
||||
|
||||
bool os::dll_address_to_function_name(address addr, char *buf,
|
||||
int buflen, int *offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
char localbuf[MACH_MAXSYMLEN];
|
||||
|
||||
// dladdr will find names of dynamic functions only, but does
|
||||
// it set dli_fbase with mach_header address when it "fails" ?
|
||||
if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) {
|
||||
if (buf != NULL) {
|
||||
if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
if (dladdr((void*)addr, &dlinfo) != 0) {
|
||||
// see if we have a matching symbol
|
||||
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
// no matching symbol so try for just file info
|
||||
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle non-dymanic manually:
|
||||
if (dlinfo.dli_fbase != NULL &&
|
||||
Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) {
|
||||
if(!Decoder::demangle(localbuf, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, "%s", localbuf);
|
||||
// Handle non-dynamic manually:
|
||||
if (dlinfo.dli_fbase != NULL &&
|
||||
Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset,
|
||||
dlinfo.dli_fbase)) {
|
||||
if (!Decoder::demangle(localbuf, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, "%s", localbuf);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (buf != NULL) buf[0] = '\0';
|
||||
buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
@ -1287,17 +1293,24 @@ bool os::dll_address_to_function_name(address addr, char *buf,
|
||||
// ported from solaris version
|
||||
bool os::dll_address_to_library_name(address addr, char* buf,
|
||||
int buflen, int* offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (dladdr((void*)addr, &dlinfo)){
|
||||
if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
if (offset) *offset = addr - (address)dlinfo.dli_fbase;
|
||||
return true;
|
||||
} else {
|
||||
if (buf) buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
if (dladdr((void*)addr, &dlinfo) != 0) {
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase != NULL && offset != NULL) {
|
||||
*offset = addr - (address)dlinfo.dli_fbase;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loads .dll/.so and
|
||||
@ -1520,49 +1533,50 @@ static bool _print_ascii_file(const char* filename, outputStream* st) {
|
||||
}
|
||||
|
||||
void os::print_dll_info(outputStream *st) {
|
||||
st->print_cr("Dynamic libraries:");
|
||||
st->print_cr("Dynamic libraries:");
|
||||
#ifdef RTLD_DI_LINKMAP
|
||||
Dl_info dli;
|
||||
void *handle;
|
||||
Link_map *map;
|
||||
Link_map *p;
|
||||
Dl_info dli;
|
||||
void *handle;
|
||||
Link_map *map;
|
||||
Link_map *p;
|
||||
|
||||
if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
handle = dlopen(dli.dli_fname, RTLD_LAZY);
|
||||
if (handle == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
dlinfo(handle, RTLD_DI_LINKMAP, &map);
|
||||
if (map == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 ||
|
||||
dli.dli_fname == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
handle = dlopen(dli.dli_fname, RTLD_LAZY);
|
||||
if (handle == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
dlinfo(handle, RTLD_DI_LINKMAP, &map);
|
||||
if (map == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
|
||||
while (map->l_prev != NULL)
|
||||
map = map->l_prev;
|
||||
while (map->l_prev != NULL)
|
||||
map = map->l_prev;
|
||||
|
||||
while (map != NULL) {
|
||||
st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
|
||||
map = map->l_next;
|
||||
}
|
||||
while (map != NULL) {
|
||||
st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
|
||||
map = map->l_next;
|
||||
}
|
||||
|
||||
dlclose(handle);
|
||||
dlclose(handle);
|
||||
#elif defined(__APPLE__)
|
||||
uint32_t count;
|
||||
uint32_t i;
|
||||
uint32_t count;
|
||||
uint32_t i;
|
||||
|
||||
count = _dyld_image_count();
|
||||
for (i = 1; i < count; i++) {
|
||||
const char *name = _dyld_get_image_name(i);
|
||||
intptr_t slide = _dyld_get_image_vmaddr_slide(i);
|
||||
st->print_cr(PTR_FORMAT " \t%s", slide, name);
|
||||
}
|
||||
count = _dyld_image_count();
|
||||
for (i = 1; i < count; i++) {
|
||||
const char *name = _dyld_get_image_name(i);
|
||||
intptr_t slide = _dyld_get_image_vmaddr_slide(i);
|
||||
st->print_cr(PTR_FORMAT " \t%s", slide, name);
|
||||
}
|
||||
#else
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1707,8 +1721,11 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
bool ret = dll_address_to_library_name(
|
||||
CAST_FROM_FN_PTR(address, os::jvm_path),
|
||||
dli_fname, sizeof(dli_fname), NULL);
|
||||
assert(ret != 0, "cannot locate libjvm");
|
||||
char *rp = realpath(dli_fname, buf);
|
||||
assert(ret, "cannot locate libjvm");
|
||||
char *rp = NULL;
|
||||
if (ret && dli_fname[0] != '\0') {
|
||||
rp = realpath(dli_fname, buf);
|
||||
}
|
||||
if (rp == NULL)
|
||||
return;
|
||||
|
||||
@ -3747,20 +3764,20 @@ int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex,
|
||||
bool os::find(address addr, outputStream* st) {
|
||||
Dl_info dlinfo;
|
||||
memset(&dlinfo, 0, sizeof(dlinfo));
|
||||
if (dladdr(addr, &dlinfo)) {
|
||||
if (dladdr(addr, &dlinfo) != 0) {
|
||||
st->print(PTR_FORMAT ": ", addr);
|
||||
if (dlinfo.dli_sname != NULL) {
|
||||
if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
|
||||
st->print("%s+%#x", dlinfo.dli_sname,
|
||||
addr - (intptr_t)dlinfo.dli_saddr);
|
||||
} else if (dlinfo.dli_fname) {
|
||||
} else if (dlinfo.dli_fbase != NULL) {
|
||||
st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
|
||||
} else {
|
||||
st->print("<absolute address>");
|
||||
}
|
||||
if (dlinfo.dli_fname) {
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
st->print(" in %s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase) {
|
||||
if (dlinfo.dli_fbase != NULL) {
|
||||
st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
|
||||
}
|
||||
st->cr();
|
||||
@ -3773,7 +3790,7 @@ bool os::find(address addr, outputStream* st) {
|
||||
if (!lowest) lowest = (address) dlinfo.dli_fbase;
|
||||
if (begin < lowest) begin = lowest;
|
||||
Dl_info dlinfo2;
|
||||
if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
|
||||
end = (address) dlinfo2.dli_saddr;
|
||||
Disassembler::decode(begin, end, st);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -432,6 +432,30 @@ AttachOperation* AttachListener::dequeue() {
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
// Performs initialization at vm startup
|
||||
// For Linux we remove any stale .java_pid file which could cause
|
||||
// an attaching process to think we are ready to receive on the
|
||||
// domain socket before we are properly initialized
|
||||
|
||||
void AttachListener::vm_start() {
|
||||
char fn[UNIX_PATH_MAX];
|
||||
struct stat64 st;
|
||||
int ret;
|
||||
|
||||
int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
|
||||
os::get_temp_directory(), os::current_process_id());
|
||||
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");
|
||||
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == 0) {
|
||||
ret = ::unlink(fn);
|
||||
if (ret == -1) {
|
||||
debug_only(warning("failed to remove stale attach pid file at %s", fn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AttachListener::pd_init() {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadBlockInVM tbivm(thread);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2013, 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
|
||||
@ -107,7 +107,7 @@ static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
|
||||
|
||||
signal_lock();
|
||||
|
||||
sigused = (MASK(sig) & jvmsigs) != 0;
|
||||
sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0);
|
||||
if (jvm_signal_installed && sigused) {
|
||||
/* jvm has installed its signal handler for this signal. */
|
||||
/* Save the handler. Don't really install it. */
|
||||
@ -116,7 +116,7 @@ static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
|
||||
|
||||
signal_unlock();
|
||||
return oldhandler;
|
||||
} else if (jvm_signal_installing) {
|
||||
} else if (sig < MAXSIGNUM && jvm_signal_installing) {
|
||||
/* jvm is installing its signal handlers. Install the new
|
||||
* handlers and save the old ones. jvm uses sigaction().
|
||||
* Leave the piece here just in case. */
|
||||
@ -165,7 +165,7 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
|
||||
|
||||
signal_lock();
|
||||
|
||||
sigused = (MASK(sig) & jvmsigs) != 0;
|
||||
sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0);
|
||||
if (jvm_signal_installed && sigused) {
|
||||
/* jvm has installed its signal handler for this signal. */
|
||||
/* Save the handler. Don't really install it. */
|
||||
@ -178,7 +178,7 @@ int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
|
||||
|
||||
signal_unlock();
|
||||
return 0;
|
||||
} else if (jvm_signal_installing) {
|
||||
} else if (sig < MAXSIGNUM && jvm_signal_installing) {
|
||||
/* jvm is installing its signal handlers. Install the new
|
||||
* handlers and save the old ones. */
|
||||
res = call_os_sigaction(sig, act, &oldAct);
|
||||
|
@ -1682,12 +1682,13 @@ bool os::address_is_in_vm(address addr) {
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (libjvm_base_addr == NULL) {
|
||||
dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo);
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) {
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
}
|
||||
assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm");
|
||||
}
|
||||
|
||||
if (dladdr((void *)addr, &dlinfo)) {
|
||||
if (dladdr((void *)addr, &dlinfo) != 0) {
|
||||
if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true;
|
||||
}
|
||||
|
||||
@ -1696,24 +1697,30 @@ bool os::address_is_in_vm(address addr) {
|
||||
|
||||
bool os::dll_address_to_function_name(address addr, char *buf,
|
||||
int buflen, int *offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) {
|
||||
if (buf != NULL) {
|
||||
if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
if (dladdr((void*)addr, &dlinfo) != 0) {
|
||||
// see if we have a matching symbol
|
||||
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
// no matching symbol so try for just file info
|
||||
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buf != NULL) buf[0] = '\0';
|
||||
buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
@ -1764,6 +1771,9 @@ static int address_to_library_name_callback(struct dl_phdr_info *info,
|
||||
|
||||
bool os::dll_address_to_library_name(address addr, char* buf,
|
||||
int buflen, int* offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
struct _address_to_library_name data;
|
||||
|
||||
@ -1782,15 +1792,20 @@ bool os::dll_address_to_library_name(address addr, char* buf,
|
||||
// buf already contains library name
|
||||
if (offset) *offset = addr - data.base;
|
||||
return true;
|
||||
} else if (dladdr((void*)addr, &dlinfo)){
|
||||
if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
if (offset) *offset = addr - (address)dlinfo.dli_fbase;
|
||||
return true;
|
||||
} else {
|
||||
if (buf) buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
if (dladdr((void*)addr, &dlinfo) != 0) {
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase != NULL && offset != NULL) {
|
||||
*offset = addr - (address)dlinfo.dli_fbase;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Loads .dll/.so and
|
||||
@ -2317,8 +2332,11 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
bool ret = dll_address_to_library_name(
|
||||
CAST_FROM_FN_PTR(address, os::jvm_path),
|
||||
dli_fname, sizeof(dli_fname), NULL);
|
||||
assert(ret != 0, "cannot locate libjvm");
|
||||
char *rp = realpath(dli_fname, buf);
|
||||
assert(ret, "cannot locate libjvm");
|
||||
char *rp = NULL;
|
||||
if (ret && dli_fname[0] != '\0') {
|
||||
rp = realpath(dli_fname, buf);
|
||||
}
|
||||
if (rp == NULL)
|
||||
return;
|
||||
|
||||
@ -4730,20 +4748,20 @@ int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mute
|
||||
bool os::find(address addr, outputStream* st) {
|
||||
Dl_info dlinfo;
|
||||
memset(&dlinfo, 0, sizeof(dlinfo));
|
||||
if (dladdr(addr, &dlinfo)) {
|
||||
if (dladdr(addr, &dlinfo) != 0) {
|
||||
st->print(PTR_FORMAT ": ", addr);
|
||||
if (dlinfo.dli_sname != NULL) {
|
||||
if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
|
||||
st->print("%s+%#x", dlinfo.dli_sname,
|
||||
addr - (intptr_t)dlinfo.dli_saddr);
|
||||
} else if (dlinfo.dli_fname) {
|
||||
} else if (dlinfo.dli_fbase != NULL) {
|
||||
st->print("<offset %#x>", addr - (intptr_t)dlinfo.dli_fbase);
|
||||
} else {
|
||||
st->print("<absolute address>");
|
||||
}
|
||||
if (dlinfo.dli_fname) {
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
st->print(" in %s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase) {
|
||||
if (dlinfo.dli_fbase != NULL) {
|
||||
st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
|
||||
}
|
||||
st->cr();
|
||||
@ -4756,7 +4774,7 @@ bool os::find(address addr, outputStream* st) {
|
||||
if (!lowest) lowest = (address) dlinfo.dli_fbase;
|
||||
if (begin < lowest) begin = lowest;
|
||||
Dl_info dlinfo2;
|
||||
if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
|
||||
end = (address) dlinfo2.dli_saddr;
|
||||
Disassembler::decode(begin, end, st);
|
||||
|
@ -259,3 +259,52 @@ const char* os::get_current_directory(char *buf, size_t buflen) {
|
||||
FILE* os::open(int fd, const char* mode) {
|
||||
return ::fdopen(fd, mode);
|
||||
}
|
||||
|
||||
os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
|
||||
assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
|
||||
}
|
||||
|
||||
/*
|
||||
* See the caveats for this class in os_posix.hpp
|
||||
* Protects the callback call so that SIGSEGV / SIGBUS jumps back into this
|
||||
* method and returns false. If none of the signals are raised, returns true.
|
||||
* The callback is supposed to provide the method that should be protected.
|
||||
*/
|
||||
bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) {
|
||||
assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread");
|
||||
assert(!WatcherThread::watcher_thread()->has_crash_protection(),
|
||||
"crash_protection already set?");
|
||||
|
||||
if (sigsetjmp(_jmpbuf, 1) == 0) {
|
||||
// make sure we can see in the signal handler that we have crash protection
|
||||
// installed
|
||||
WatcherThread::watcher_thread()->set_crash_protection(this);
|
||||
cb.call();
|
||||
// and clear the crash protection
|
||||
WatcherThread::watcher_thread()->set_crash_protection(NULL);
|
||||
return true;
|
||||
}
|
||||
// this happens when we siglongjmp() back
|
||||
WatcherThread::watcher_thread()->set_crash_protection(NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
void os::WatcherThreadCrashProtection::restore() {
|
||||
assert(WatcherThread::watcher_thread()->has_crash_protection(),
|
||||
"must have crash protection");
|
||||
|
||||
siglongjmp(_jmpbuf, 1);
|
||||
}
|
||||
|
||||
void os::WatcherThreadCrashProtection::check_crash_protection(int sig,
|
||||
Thread* thread) {
|
||||
|
||||
if (thread != NULL &&
|
||||
thread->is_Watcher_thread() &&
|
||||
WatcherThread::watcher_thread()->has_crash_protection()) {
|
||||
|
||||
if (sig == SIGSEGV || sig == SIGBUS) {
|
||||
WatcherThread::watcher_thread()->crash_protection()->restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,5 +37,24 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* Crash protection for the watcher thread. Wrap the callback
|
||||
* with a sigsetjmp and in case of a SIGSEGV/SIGBUS we siglongjmp
|
||||
* back.
|
||||
* To be able to use this - don't take locks, don't rely on destructors,
|
||||
* don't make OS library calls, don't allocate memory, don't print,
|
||||
* don't call code that could leave the heap / memory in an inconsistent state,
|
||||
* or anything else where we are not in control if we suddenly jump out.
|
||||
*/
|
||||
class WatcherThreadCrashProtection : public StackObj {
|
||||
public:
|
||||
WatcherThreadCrashProtection();
|
||||
bool call(os::CrashProtectionCallback& cb);
|
||||
|
||||
static void check_crash_protection(int signal, Thread* thread);
|
||||
private:
|
||||
void restore();
|
||||
sigjmp_buf _jmpbuf;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2013, 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
|
||||
@ -332,12 +332,15 @@ dtrace:helper:ustack:
|
||||
|
||||
this->nameSymbol = copyin_ptr(this->constantPool +
|
||||
this->nameIndex * sizeof (pointer) + SIZE_ConstantPool);
|
||||
/* The symbol is a CPSlot and has lower bit set to indicate metadata */
|
||||
this->nameSymbol &= (~1); /* remove metadata lsb */
|
||||
|
||||
this->nameSymbolLength = copyin_uint16(this->nameSymbol +
|
||||
OFFSET_Symbol_length);
|
||||
|
||||
this->signatureSymbol = copyin_ptr(this->constantPool +
|
||||
this->signatureIndex * sizeof (pointer) + SIZE_ConstantPool);
|
||||
this->signatureSymbol &= (~1); /* remove metadata lsb */
|
||||
|
||||
this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
|
||||
OFFSET_Symbol_length);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -576,6 +576,30 @@ AttachOperation* AttachListener::dequeue() {
|
||||
return op;
|
||||
}
|
||||
|
||||
|
||||
// Performs initialization at vm startup
|
||||
// For Solaris we remove any stale .java_pid file which could cause
|
||||
// an attaching process to think we are ready to receive a door_call
|
||||
// before we are properly initialized
|
||||
|
||||
void AttachListener::vm_start() {
|
||||
char fn[PATH_MAX+1];
|
||||
struct stat64 st;
|
||||
int ret;
|
||||
|
||||
int n = snprintf(fn, sizeof(fn), "%s/.java_pid%d",
|
||||
os::get_temp_directory(), os::current_process_id());
|
||||
assert(n < sizeof(fn), "java_pid file name buffer overflow");
|
||||
|
||||
RESTARTABLE(::stat64(fn, &st), ret);
|
||||
if (ret == 0) {
|
||||
ret = ::unlink(fn);
|
||||
if (ret == -1) {
|
||||
debug_only(warning("failed to remove stale attach pid file at %s", fn));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int AttachListener::pd_init() {
|
||||
JavaThread* thread = JavaThread::current();
|
||||
ThreadBlockInVM tbivm(thread);
|
||||
|
@ -30,15 +30,6 @@
|
||||
//
|
||||
#define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \
|
||||
\
|
||||
product(bool, UseISM, false, \
|
||||
"Use Intimate Shared Memory (Solaris Only)") \
|
||||
\
|
||||
product(bool, UsePermISM, false, \
|
||||
"Obsolete flag for compatibility (same as UseISM)") \
|
||||
\
|
||||
product(bool, UseMPSS, true, \
|
||||
"Use Multiple Page Size Support (Solaris 9 Only)") \
|
||||
\
|
||||
product(bool, UseExtendedFileIO, true, \
|
||||
"Enable workaround for limitations of stdio FILE structure")
|
||||
|
||||
|
@ -115,45 +115,6 @@
|
||||
// for timer info max values which include all bits
|
||||
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
// See bug #6514594
|
||||
extern "C" int madvise(caddr_t, size_t, int);
|
||||
extern "C" int memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg,
|
||||
int attr, int mask);
|
||||
#endif //_GNU_SOURCE
|
||||
|
||||
/*
|
||||
MPSS Changes Start.
|
||||
The JVM binary needs to be built and run on pre-Solaris 9
|
||||
systems, but the constants needed by MPSS are only in Solaris 9
|
||||
header files. They are textually replicated here to allow
|
||||
building on earlier systems. Once building on Solaris 8 is
|
||||
no longer a requirement, these #defines can be replaced by ordinary
|
||||
system .h inclusion.
|
||||
|
||||
In earlier versions of the JDK and Solaris, we used ISM for large pages.
|
||||
But ISM requires shared memory to achieve this and thus has many caveats.
|
||||
MPSS is a fully transparent and is a cleaner way to get large pages.
|
||||
Although we still require keeping ISM for backward compatiblitiy as well as
|
||||
giving the opportunity to use large pages on older systems it is
|
||||
recommended that MPSS be used for Solaris 9 and above.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef MC_HAT_ADVISE
|
||||
|
||||
struct memcntl_mha {
|
||||
uint_t mha_cmd; /* command(s) */
|
||||
uint_t mha_flags;
|
||||
size_t mha_pagesize;
|
||||
};
|
||||
#define MC_HAT_ADVISE 7 /* advise hat map size */
|
||||
#define MHA_MAPSIZE_VA 0x1 /* set preferred page size */
|
||||
#define MAP_ALIGN 0x200 /* addr specifies alignment */
|
||||
|
||||
#endif
|
||||
// MPSS Changes End.
|
||||
|
||||
|
||||
// Here are some liblgrp types from sys/lgrp_user.h to be able to
|
||||
// compile on older systems without this header file.
|
||||
@ -172,32 +133,6 @@ struct memcntl_mha {
|
||||
# define LGRP_RSRC_MEM 1 /* memory resources */
|
||||
#endif
|
||||
|
||||
// Some more macros from sys/mman.h that are not present in Solaris 8.
|
||||
|
||||
#ifndef MAX_MEMINFO_CNT
|
||||
/*
|
||||
* info_req request type definitions for meminfo
|
||||
* request types starting with MEMINFO_V are used for Virtual addresses
|
||||
* and should not be mixed with MEMINFO_PLGRP which is targeted for Physical
|
||||
* addresses
|
||||
*/
|
||||
# define MEMINFO_SHIFT 16
|
||||
# define MEMINFO_MASK (0xFF << MEMINFO_SHIFT)
|
||||
# define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */
|
||||
# define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */
|
||||
# define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */
|
||||
# define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */
|
||||
# define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */
|
||||
# define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */
|
||||
# define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */
|
||||
|
||||
/* maximum number of addresses meminfo() can process at a time */
|
||||
# define MAX_MEMINFO_CNT 256
|
||||
|
||||
/* maximum number of request types */
|
||||
# define MAX_MEMINFO_REQ 31
|
||||
#endif
|
||||
|
||||
// see thr_setprio(3T) for the basis of these numbers
|
||||
#define MinimumPriority 0
|
||||
#define NormalPriority 64
|
||||
@ -1924,12 +1859,13 @@ bool os::address_is_in_vm(address addr) {
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (libjvm_base_addr == NULL) {
|
||||
dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo);
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) {
|
||||
libjvm_base_addr = (address)dlinfo.dli_fbase;
|
||||
}
|
||||
assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm");
|
||||
}
|
||||
|
||||
if (dladdr((void *)addr, &dlinfo)) {
|
||||
if (dladdr((void *)addr, &dlinfo) != 0) {
|
||||
if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true;
|
||||
}
|
||||
|
||||
@ -1941,114 +1877,133 @@ static dladdr1_func_type dladdr1_func = NULL;
|
||||
|
||||
bool os::dll_address_to_function_name(address addr, char *buf,
|
||||
int buflen, int * offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
|
||||
// dladdr1_func was initialized in os::init()
|
||||
if (dladdr1_func){
|
||||
// yes, we have dladdr1
|
||||
if (dladdr1_func != NULL) {
|
||||
// yes, we have dladdr1
|
||||
|
||||
// Support for dladdr1 is checked at runtime; it may be
|
||||
// available even if the vm is built on a machine that does
|
||||
// not have dladdr1 support. Make sure there is a value for
|
||||
// RTLD_DL_SYMENT.
|
||||
#ifndef RTLD_DL_SYMENT
|
||||
#define RTLD_DL_SYMENT 1
|
||||
#endif
|
||||
// Support for dladdr1 is checked at runtime; it may be
|
||||
// available even if the vm is built on a machine that does
|
||||
// not have dladdr1 support. Make sure there is a value for
|
||||
// RTLD_DL_SYMENT.
|
||||
#ifndef RTLD_DL_SYMENT
|
||||
#define RTLD_DL_SYMENT 1
|
||||
#endif
|
||||
#ifdef _LP64
|
||||
Elf64_Sym * info;
|
||||
Elf64_Sym * info;
|
||||
#else
|
||||
Elf32_Sym * info;
|
||||
Elf32_Sym * info;
|
||||
#endif
|
||||
if (dladdr1_func((void *)addr, &dlinfo, (void **)&info,
|
||||
RTLD_DL_SYMENT)) {
|
||||
if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) {
|
||||
if (buf != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen))
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
if (dladdr1_func((void *)addr, &dlinfo, (void **)&info,
|
||||
RTLD_DL_SYMENT) != 0) {
|
||||
// see if we have a matching symbol that covers our address
|
||||
if (dlinfo.dli_saddr != NULL &&
|
||||
(char *)dlinfo.dli_saddr + info->st_size > (char *)addr) {
|
||||
if (dlinfo.dli_sname != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (buf != NULL) buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
} else {
|
||||
// no, only dladdr is available
|
||||
if (dladdr((void *)addr, &dlinfo)) {
|
||||
if (buf != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen))
|
||||
jio_snprintf(buf, buflen, dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
} else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) {
|
||||
// no matching symbol so try for just file info
|
||||
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (buf != NULL) buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// no, only dladdr is available
|
||||
if (dladdr((void *)addr, &dlinfo) != 0) {
|
||||
// see if we have a matching symbol
|
||||
if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) {
|
||||
if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) {
|
||||
jio_snprintf(buf, buflen, dlinfo.dli_sname);
|
||||
}
|
||||
if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr;
|
||||
return true;
|
||||
}
|
||||
// no matching symbol so try for just file info
|
||||
if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) {
|
||||
if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase),
|
||||
buf, buflen, offset, dlinfo.dli_fname)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
buf[0] = '\0';
|
||||
if (offset != NULL) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool os::dll_address_to_library_name(address addr, char* buf,
|
||||
int buflen, int* offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
Dl_info dlinfo;
|
||||
|
||||
if (dladdr((void*)addr, &dlinfo)){
|
||||
if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
if (offset) *offset = addr - (address)dlinfo.dli_fbase;
|
||||
return true;
|
||||
} else {
|
||||
if (buf) buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
if (dladdr((void*)addr, &dlinfo) != 0) {
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase != NULL && offset != NULL) {
|
||||
*offset = addr - (address)dlinfo.dli_fbase;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prints the names and full paths of all opened dynamic libraries
|
||||
// for current process
|
||||
void os::print_dll_info(outputStream * st) {
|
||||
Dl_info dli;
|
||||
void *handle;
|
||||
Link_map *map;
|
||||
Link_map *p;
|
||||
Dl_info dli;
|
||||
void *handle;
|
||||
Link_map *map;
|
||||
Link_map *p;
|
||||
|
||||
st->print_cr("Dynamic libraries:"); st->flush();
|
||||
st->print_cr("Dynamic libraries:"); st->flush();
|
||||
|
||||
if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
handle = dlopen(dli.dli_fname, RTLD_LAZY);
|
||||
if (handle == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
dlinfo(handle, RTLD_DI_LINKMAP, &map);
|
||||
if (map == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 ||
|
||||
dli.dli_fname == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
handle = dlopen(dli.dli_fname, RTLD_LAZY);
|
||||
if (handle == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
dlinfo(handle, RTLD_DI_LINKMAP, &map);
|
||||
if (map == NULL) {
|
||||
st->print_cr("Error: Cannot print dynamic libraries.");
|
||||
return;
|
||||
}
|
||||
|
||||
while (map->l_prev != NULL)
|
||||
map = map->l_prev;
|
||||
while (map->l_prev != NULL)
|
||||
map = map->l_prev;
|
||||
|
||||
while (map != NULL) {
|
||||
st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
|
||||
map = map->l_next;
|
||||
}
|
||||
while (map != NULL) {
|
||||
st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name);
|
||||
map = map->l_next;
|
||||
}
|
||||
|
||||
dlclose(handle);
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
// Loads .dll/.so and
|
||||
@ -2475,7 +2430,12 @@ void os::jvm_path(char *buf, jint buflen) {
|
||||
Dl_info dlinfo;
|
||||
int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo);
|
||||
assert(ret != 0, "cannot locate libjvm");
|
||||
realpath((char *)dlinfo.dli_fname, buf);
|
||||
if (ret != 0 && dlinfo.dli_fname != NULL) {
|
||||
realpath((char *)dlinfo.dli_fname, buf);
|
||||
} else {
|
||||
buf[0] = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
if (Arguments::created_by_gamma_launcher()) {
|
||||
// Support for the gamma launcher. Typical value for buf is
|
||||
@ -2859,7 +2819,7 @@ int os::Solaris::commit_memory_impl(char* addr, size_t bytes,
|
||||
size_t alignment_hint, bool exec) {
|
||||
int err = Solaris::commit_memory_impl(addr, bytes, exec);
|
||||
if (err == 0) {
|
||||
if (UseMPSS && alignment_hint > (size_t)vm_page_size()) {
|
||||
if (UseLargePages && (alignment_hint > (size_t)vm_page_size())) {
|
||||
// If the large page size has been set and the VM
|
||||
// is using large pages, use the large page size
|
||||
// if it is smaller than the alignment hint. This is
|
||||
@ -2878,7 +2838,7 @@ int os::Solaris::commit_memory_impl(char* addr, size_t bytes,
|
||||
page_size = alignment_hint;
|
||||
}
|
||||
// Since this is a hint, ignore any failures.
|
||||
(void)Solaris::set_mpss_range(addr, bytes, page_size);
|
||||
(void)Solaris::setup_large_pages(addr, bytes, page_size);
|
||||
}
|
||||
}
|
||||
return err;
|
||||
@ -2921,8 +2881,8 @@ bool os::remove_stack_guard_pages(char* addr, size_t size) {
|
||||
void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
|
||||
assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
|
||||
assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
|
||||
if (UseLargePages && UseMPSS) {
|
||||
Solaris::set_mpss_range(addr, bytes, alignment_hint);
|
||||
if (UseLargePages) {
|
||||
Solaris::setup_large_pages(addr, bytes, alignment_hint);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3321,47 +3281,8 @@ bool os::unguard_memory(char* addr, size_t bytes) {
|
||||
}
|
||||
|
||||
// Large page support
|
||||
|
||||
// UseLargePages is the master flag to enable/disable large page memory.
|
||||
// UseMPSS and UseISM are supported for compatibility reasons. Their combined
|
||||
// effects can be described in the following table:
|
||||
//
|
||||
// UseLargePages UseMPSS UseISM
|
||||
// false * * => UseLargePages is the master switch, turning
|
||||
// it off will turn off both UseMPSS and
|
||||
// UseISM. VM will not use large page memory
|
||||
// regardless the settings of UseMPSS/UseISM.
|
||||
// true false false => Unless future Solaris provides other
|
||||
// mechanism to use large page memory, this
|
||||
// combination is equivalent to -UseLargePages,
|
||||
// VM will not use large page memory
|
||||
// true true false => JVM will use MPSS for large page memory.
|
||||
// This is the default behavior.
|
||||
// true false true => JVM will use ISM for large page memory.
|
||||
// true true true => JVM will use ISM if it is available.
|
||||
// Otherwise, JVM will fall back to MPSS.
|
||||
// Becaues ISM is now available on all
|
||||
// supported Solaris versions, this combination
|
||||
// is equivalent to +UseISM -UseMPSS.
|
||||
|
||||
static size_t _large_page_size = 0;
|
||||
|
||||
bool os::Solaris::ism_sanity_check(bool warn, size_t * page_size) {
|
||||
// x86 uses either 2M or 4M page, depending on whether PAE (Physical Address
|
||||
// Extensions) mode is enabled. AMD64/EM64T uses 2M page in 64bit mode. Sparc
|
||||
// can support multiple page sizes.
|
||||
|
||||
// Don't bother to probe page size because getpagesizes() comes with MPSS.
|
||||
// ISM is only recommended on old Solaris where there is no MPSS support.
|
||||
// Simply choose a conservative value as default.
|
||||
*page_size = LargePageSizeInBytes ? LargePageSizeInBytes :
|
||||
SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M)
|
||||
ARM_ONLY(2 * M);
|
||||
|
||||
// ISM is available on all supported Solaris versions
|
||||
return true;
|
||||
}
|
||||
|
||||
// Insertion sort for small arrays (descending order).
|
||||
static void insertion_sort_descending(size_t* array, int len) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
@ -3374,7 +3295,7 @@ static void insertion_sort_descending(size_t* array, int len) {
|
||||
}
|
||||
}
|
||||
|
||||
bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) {
|
||||
bool os::Solaris::mpss_sanity_check(bool warn, size_t* page_size) {
|
||||
const unsigned int usable_count = VM_Version::page_size_count();
|
||||
if (usable_count == 1) {
|
||||
return false;
|
||||
@ -3440,41 +3361,24 @@ bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) {
|
||||
}
|
||||
|
||||
void os::large_page_init() {
|
||||
if (!UseLargePages) {
|
||||
UseISM = false;
|
||||
UseMPSS = false;
|
||||
return;
|
||||
if (UseLargePages) {
|
||||
// print a warning if any large page related flag is specified on command line
|
||||
bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
|
||||
!FLAG_IS_DEFAULT(LargePageSizeInBytes);
|
||||
|
||||
UseLargePages = Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
|
||||
}
|
||||
|
||||
// print a warning if any large page related flag is specified on command line
|
||||
bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) ||
|
||||
!FLAG_IS_DEFAULT(UseISM) ||
|
||||
!FLAG_IS_DEFAULT(UseMPSS) ||
|
||||
!FLAG_IS_DEFAULT(LargePageSizeInBytes);
|
||||
UseISM = UseISM &&
|
||||
Solaris::ism_sanity_check(warn_on_failure, &_large_page_size);
|
||||
if (UseISM) {
|
||||
// ISM disables MPSS to be compatible with old JDK behavior
|
||||
UseMPSS = false;
|
||||
_page_sizes[0] = _large_page_size;
|
||||
_page_sizes[1] = vm_page_size();
|
||||
}
|
||||
|
||||
UseMPSS = UseMPSS &&
|
||||
Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size);
|
||||
|
||||
UseLargePages = UseISM || UseMPSS;
|
||||
}
|
||||
|
||||
bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
|
||||
bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) {
|
||||
// Signal to OS that we want large pages for addresses
|
||||
// from addr, addr + bytes
|
||||
struct memcntl_mha mpss_struct;
|
||||
mpss_struct.mha_cmd = MHA_MAPSIZE_VA;
|
||||
mpss_struct.mha_pagesize = align;
|
||||
mpss_struct.mha_flags = 0;
|
||||
if (memcntl(start, bytes, MC_HAT_ADVISE,
|
||||
(caddr_t) &mpss_struct, 0, 0) < 0) {
|
||||
// Upon successful completion, memcntl() returns 0
|
||||
if (memcntl(start, bytes, MC_HAT_ADVISE, (caddr_t) &mpss_struct, 0, 0)) {
|
||||
debug_only(warning("Attempt to use MPSS failed."));
|
||||
return false;
|
||||
}
|
||||
@ -3482,72 +3386,13 @@ bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) {
|
||||
}
|
||||
|
||||
char* os::reserve_memory_special(size_t size, char* addr, bool exec) {
|
||||
// "exec" is passed in but not used. Creating the shared image for
|
||||
// the code cache doesn't have an SHM_X executable permission to check.
|
||||
assert(UseLargePages && UseISM, "only for ISM large pages");
|
||||
|
||||
char* retAddr = NULL;
|
||||
int shmid;
|
||||
key_t ismKey;
|
||||
|
||||
bool warn_on_failure = UseISM &&
|
||||
(!FLAG_IS_DEFAULT(UseLargePages) ||
|
||||
!FLAG_IS_DEFAULT(UseISM) ||
|
||||
!FLAG_IS_DEFAULT(LargePageSizeInBytes)
|
||||
);
|
||||
char msg[128];
|
||||
|
||||
ismKey = IPC_PRIVATE;
|
||||
|
||||
// Create a large shared memory region to attach to based on size.
|
||||
// Currently, size is the total size of the heap
|
||||
shmid = shmget(ismKey, size, SHM_R | SHM_W | IPC_CREAT);
|
||||
if (shmid == -1){
|
||||
if (warn_on_failure) {
|
||||
jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
|
||||
warning(msg);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Attach to the region
|
||||
retAddr = (char *) shmat(shmid, 0, SHM_SHARE_MMU | SHM_R | SHM_W);
|
||||
int err = errno;
|
||||
|
||||
// Remove shmid. If shmat() is successful, the actual shared memory segment
|
||||
// will be deleted when it's detached by shmdt() or when the process
|
||||
// terminates. If shmat() is not successful this will remove the shared
|
||||
// segment immediately.
|
||||
shmctl(shmid, IPC_RMID, NULL);
|
||||
|
||||
if (retAddr == (char *) -1) {
|
||||
if (warn_on_failure) {
|
||||
jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
|
||||
warning(msg);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if ((retAddr != NULL) && UseNUMAInterleaving) {
|
||||
numa_make_global(retAddr, size);
|
||||
}
|
||||
|
||||
// The memory is committed
|
||||
MemTracker::record_virtual_memory_reserve_and_commit((address)retAddr, size, mtNone, CURRENT_PC);
|
||||
|
||||
return retAddr;
|
||||
fatal("os::reserve_memory_special should not be called on Solaris.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool os::release_memory_special(char* base, size_t bytes) {
|
||||
MemTracker::Tracker tkr = MemTracker::get_virtual_memory_release_tracker();
|
||||
// detaching the SHM segment will also delete it, see reserve_memory_special()
|
||||
int rslt = shmdt(base);
|
||||
if (rslt == 0) {
|
||||
tkr.record((address)base, bytes);
|
||||
return true;
|
||||
} else {
|
||||
tkr.discard();
|
||||
return false;
|
||||
}
|
||||
fatal("os::release_memory_special should not be called on Solaris.");
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t os::large_page_size() {
|
||||
@ -3557,11 +3402,11 @@ size_t os::large_page_size() {
|
||||
// MPSS allows application to commit large page memory on demand; with ISM
|
||||
// the entire memory region must be allocated as shared memory.
|
||||
bool os::can_commit_large_page_memory() {
|
||||
return UseISM ? false : true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool os::can_execute_large_page_memory() {
|
||||
return UseISM ? false : true;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int os_sleep(jlong millis, bool interruptible) {
|
||||
@ -3835,28 +3680,6 @@ static bool priocntl_enable = false;
|
||||
static const int criticalPrio = 60; // FX/60 is critical thread class/priority on T4
|
||||
static int java_MaxPriority_to_os_priority = 0; // Saved mapping
|
||||
|
||||
// Call the version of priocntl suitable for all supported versions
|
||||
// of Solaris. We need to call through this wrapper so that we can
|
||||
// build on Solaris 9 and run on Solaris 8, 9 and 10.
|
||||
//
|
||||
// This code should be removed if we ever stop supporting Solaris 8
|
||||
// and earlier releases.
|
||||
|
||||
static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg);
|
||||
typedef long (*priocntl_type)(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg);
|
||||
static priocntl_type priocntl_ptr = priocntl_stub;
|
||||
|
||||
// Stub to set the value of the real pointer, and then call the real
|
||||
// function.
|
||||
|
||||
static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg) {
|
||||
// Try Solaris 8- name only.
|
||||
priocntl_type tmp = (priocntl_type)dlsym(RTLD_DEFAULT, "__priocntl");
|
||||
guarantee(tmp != NULL, "priocntl function not found.");
|
||||
priocntl_ptr = tmp;
|
||||
return (*priocntl_ptr)(PC_VERSION, idtype, id, cmd, arg);
|
||||
}
|
||||
|
||||
|
||||
// lwp_priocntl_init
|
||||
//
|
||||
@ -3864,9 +3687,7 @@ static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t
|
||||
//
|
||||
// Return errno or 0 if OK.
|
||||
//
|
||||
static
|
||||
int lwp_priocntl_init ()
|
||||
{
|
||||
static int lwp_priocntl_init () {
|
||||
int rslt;
|
||||
pcinfo_t ClassInfo;
|
||||
pcparms_t ParmInfo;
|
||||
@ -3906,7 +3727,7 @@ int lwp_priocntl_init ()
|
||||
|
||||
strcpy(ClassInfo.pc_clname, "TS");
|
||||
ClassInfo.pc_cid = -1;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
if (rslt < 0) return errno;
|
||||
assert(ClassInfo.pc_cid != -1, "cid for TS class is -1");
|
||||
tsLimits.schedPolicy = ClassInfo.pc_cid;
|
||||
@ -3915,7 +3736,7 @@ int lwp_priocntl_init ()
|
||||
|
||||
strcpy(ClassInfo.pc_clname, "IA");
|
||||
ClassInfo.pc_cid = -1;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
if (rslt < 0) return errno;
|
||||
assert(ClassInfo.pc_cid != -1, "cid for IA class is -1");
|
||||
iaLimits.schedPolicy = ClassInfo.pc_cid;
|
||||
@ -3924,7 +3745,7 @@ int lwp_priocntl_init ()
|
||||
|
||||
strcpy(ClassInfo.pc_clname, "RT");
|
||||
ClassInfo.pc_cid = -1;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
if (rslt < 0) return errno;
|
||||
assert(ClassInfo.pc_cid != -1, "cid for RT class is -1");
|
||||
rtLimits.schedPolicy = ClassInfo.pc_cid;
|
||||
@ -3933,7 +3754,7 @@ int lwp_priocntl_init ()
|
||||
|
||||
strcpy(ClassInfo.pc_clname, "FX");
|
||||
ClassInfo.pc_cid = -1;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo);
|
||||
if (rslt < 0) return errno;
|
||||
assert(ClassInfo.pc_cid != -1, "cid for FX class is -1");
|
||||
fxLimits.schedPolicy = ClassInfo.pc_cid;
|
||||
@ -3944,7 +3765,7 @@ int lwp_priocntl_init ()
|
||||
// This will normally be IA, TS or, rarely, FX or RT.
|
||||
memset(&ParmInfo, 0, sizeof(ParmInfo));
|
||||
ParmInfo.pc_cid = PC_CLNULL;
|
||||
rslt = (*priocntl_ptr) (PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
if (rslt < 0) return errno;
|
||||
myClass = ParmInfo.pc_cid;
|
||||
|
||||
@ -3952,7 +3773,7 @@ int lwp_priocntl_init ()
|
||||
// about the class.
|
||||
ClassInfo.pc_cid = myClass;
|
||||
ClassInfo.pc_clname[0] = 0;
|
||||
rslt = (*priocntl_ptr) (PC_VERSION, (idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo);
|
||||
rslt = priocntl((idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo);
|
||||
if (rslt < 0) return errno;
|
||||
|
||||
if (ThreadPriorityVerbose) {
|
||||
@ -3961,7 +3782,7 @@ int lwp_priocntl_init ()
|
||||
|
||||
memset(&ParmInfo, 0, sizeof(pcparms_t));
|
||||
ParmInfo.pc_cid = PC_CLNULL;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
if (rslt < 0) return errno;
|
||||
|
||||
if (ParmInfo.pc_cid == rtLimits.schedPolicy) {
|
||||
@ -4065,7 +3886,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
|
||||
|
||||
memset(&ParmInfo, 0, sizeof(pcparms_t));
|
||||
ParmInfo.pc_cid = PC_CLNULL;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo);
|
||||
if (rslt < 0) return errno;
|
||||
|
||||
int cur_class = ParmInfo.pc_cid;
|
||||
@ -4133,7 +3954,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
|
||||
return EINVAL; // no clue, punt
|
||||
}
|
||||
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo);
|
||||
rslt = priocntl(P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo);
|
||||
if (ThreadPriorityVerbose && rslt) {
|
||||
tty->print_cr ("PC_SETPARMS ->%d %d\n", rslt, errno);
|
||||
}
|
||||
@ -4152,7 +3973,7 @@ int set_lwp_class_and_priority(int ThreadID, int lwpid,
|
||||
|
||||
memset(&ReadBack, 0, sizeof(pcparms_t));
|
||||
ReadBack.pc_cid = PC_CLNULL;
|
||||
rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack);
|
||||
rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack);
|
||||
assert(rslt >= 0, "priocntl failed");
|
||||
Actual = Expected = 0xBAD;
|
||||
assert(ParmInfo.pc_cid == ReadBack.pc_cid, "cid's don't match");
|
||||
@ -5244,11 +5065,6 @@ uint_t os::Solaris::getisax(uint32_t* array, uint_t n) {
|
||||
return _getisax(array, n);
|
||||
}
|
||||
|
||||
// Symbol doesn't exist in Solaris 8 pset.h
|
||||
#ifndef PS_MYID
|
||||
#define PS_MYID -3
|
||||
#endif
|
||||
|
||||
// int pset_getloadavg(psetid_t pset, double loadavg[], int nelem);
|
||||
typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem);
|
||||
static pset_getloadavg_type pset_getloadavg_ptr = NULL;
|
||||
@ -5418,20 +5234,6 @@ jint os::init_2(void) {
|
||||
UseNUMA = false;
|
||||
}
|
||||
}
|
||||
// ISM is not compatible with the NUMA allocator - it always allocates
|
||||
// pages round-robin across the lgroups.
|
||||
if (UseNUMA && UseLargePages && UseISM) {
|
||||
if (!FLAG_IS_DEFAULT(UseNUMA)) {
|
||||
if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseISM)) {
|
||||
UseLargePages = false;
|
||||
} else {
|
||||
warning("UseNUMA is not compatible with ISM large pages, disabling NUMA allocator");
|
||||
UseNUMA = false;
|
||||
}
|
||||
} else {
|
||||
UseNUMA = false;
|
||||
}
|
||||
}
|
||||
if (!UseNUMA && ForceNUMA) {
|
||||
UseNUMA = true;
|
||||
}
|
||||
@ -6077,24 +5879,20 @@ int os::loadavg(double loadavg[], int nelem) {
|
||||
bool os::find(address addr, outputStream* st) {
|
||||
Dl_info dlinfo;
|
||||
memset(&dlinfo, 0, sizeof(dlinfo));
|
||||
if (dladdr(addr, &dlinfo)) {
|
||||
#ifdef _LP64
|
||||
st->print("0x%016lx: ", addr);
|
||||
#else
|
||||
st->print("0x%08x: ", addr);
|
||||
#endif
|
||||
if (dlinfo.dli_sname != NULL)
|
||||
if (dladdr(addr, &dlinfo) != 0) {
|
||||
st->print(PTR_FORMAT ": ", addr);
|
||||
if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) {
|
||||
st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr);
|
||||
else if (dlinfo.dli_fname)
|
||||
} else if (dlinfo.dli_fbase != NULL)
|
||||
st->print("<offset %#lx>", addr-(intptr_t)dlinfo.dli_fbase);
|
||||
else
|
||||
st->print("<absolute address>");
|
||||
if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname);
|
||||
#ifdef _LP64
|
||||
if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase);
|
||||
#else
|
||||
if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase);
|
||||
#endif
|
||||
if (dlinfo.dli_fname != NULL) {
|
||||
st->print(" in %s", dlinfo.dli_fname);
|
||||
}
|
||||
if (dlinfo.dli_fbase != NULL) {
|
||||
st->print(" at " PTR_FORMAT, dlinfo.dli_fbase);
|
||||
}
|
||||
st->cr();
|
||||
|
||||
if (Verbose) {
|
||||
@ -6105,7 +5903,7 @@ bool os::find(address addr, outputStream* st) {
|
||||
if (!lowest) lowest = (address) dlinfo.dli_fbase;
|
||||
if (begin < lowest) begin = lowest;
|
||||
Dl_info dlinfo2;
|
||||
if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr
|
||||
&& end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin)
|
||||
end = (address) dlinfo2.dli_saddr;
|
||||
Disassembler::decode(begin, end, st);
|
||||
|
@ -106,8 +106,8 @@ class Solaris {
|
||||
|
||||
static meminfo_func_t _meminfo;
|
||||
|
||||
// Large Page Support--mpss.
|
||||
static bool set_mpss_range(caddr_t start, size_t bytes, size_t align);
|
||||
// Large Page Support
|
||||
static bool setup_large_pages(caddr_t start, size_t bytes, size_t align);
|
||||
|
||||
static void init_thread_fpu_state(void);
|
||||
|
||||
@ -174,7 +174,6 @@ class Solaris {
|
||||
static char* mmap_chunk(char *addr, size_t size, int flags, int prot);
|
||||
static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed);
|
||||
static bool mpss_sanity_check(bool warn, size_t * page_size);
|
||||
static bool ism_sanity_check (bool warn, size_t * page_size);
|
||||
|
||||
// Workaround for 4352906. thr_stksegment sometimes returns
|
||||
// a bad value for the primordial thread's stack base when
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2013, 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
|
||||
@ -358,6 +358,10 @@ AttachOperation* AttachListener::dequeue() {
|
||||
return op;
|
||||
}
|
||||
|
||||
void AttachListener::vm_start() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
int AttachListener::pd_init() {
|
||||
return Win32AttachListener::init();
|
||||
}
|
||||
|
@ -1420,34 +1420,40 @@ static int _locate_module_by_addr(int pid, char * mod_fname, address base_addr,
|
||||
|
||||
bool os::dll_address_to_library_name(address addr, char* buf,
|
||||
int buflen, int* offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
// NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always
|
||||
// return the full path to the DLL file, sometimes it returns path
|
||||
// to the corresponding PDB file (debug info); sometimes it only
|
||||
// returns partial path, which makes life painful.
|
||||
|
||||
struct _modinfo mi;
|
||||
mi.addr = addr;
|
||||
mi.full_path = buf;
|
||||
mi.buflen = buflen;
|
||||
int pid = os::current_process_id();
|
||||
if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) {
|
||||
// buf already contains path name
|
||||
if (offset) *offset = addr - mi.base_addr;
|
||||
return true;
|
||||
} else {
|
||||
if (buf) buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
struct _modinfo mi;
|
||||
mi.addr = addr;
|
||||
mi.full_path = buf;
|
||||
mi.buflen = buflen;
|
||||
int pid = os::current_process_id();
|
||||
if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) {
|
||||
// buf already contains path name
|
||||
if (offset) *offset = addr - mi.base_addr;
|
||||
return true;
|
||||
}
|
||||
|
||||
buf[0] = '\0';
|
||||
if (offset) *offset = -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool os::dll_address_to_function_name(address addr, char *buf,
|
||||
int buflen, int *offset) {
|
||||
// buf is not optional, but offset is optional
|
||||
assert(buf != NULL, "sanity check");
|
||||
|
||||
if (Decoder::decode(addr, buf, buflen, offset)) {
|
||||
return true;
|
||||
}
|
||||
if (offset != NULL) *offset = -1;
|
||||
if (buf != NULL) buf[0] = '\0';
|
||||
buf[0] = '\0';
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2317,6 +2323,11 @@ LONG WINAPI topLevelExceptionFilter(struct _EXCEPTION_POINTERS* exceptionInfo) {
|
||||
#endif
|
||||
Thread* t = ThreadLocalStorage::get_thread_slow(); // slow & steady
|
||||
|
||||
// Handle SafeFetch32 and SafeFetchN exceptions.
|
||||
if (StubRoutines::is_safefetch_fault(pc)) {
|
||||
return Handle_Exception(exceptionInfo, StubRoutines::continuation_for_safefetch_fault(pc));
|
||||
}
|
||||
|
||||
#ifndef _WIN64
|
||||
// Execution protection violation - win32 running on AMD64 only
|
||||
// Handled first to avoid misdiagnosis as a "normal" access violation;
|
||||
@ -2689,6 +2700,19 @@ address os::win32::fast_jni_accessor_wrapper(BasicType type) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) {
|
||||
// Install a win32 structured exception handler around the test
|
||||
// function call so the VM can generate an error dump if needed.
|
||||
__try {
|
||||
(*funcPtr)();
|
||||
} __except(topLevelExceptionFilter(
|
||||
(_EXCEPTION_POINTERS*)_exception_info())) {
|
||||
// Nothing to do.
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Virtual Memory
|
||||
|
||||
int os::vm_page_size() { return os::win32::vm_page_size(); }
|
||||
@ -4665,6 +4689,34 @@ void os::pause() {
|
||||
}
|
||||
}
|
||||
|
||||
os::WatcherThreadCrashProtection::WatcherThreadCrashProtection() {
|
||||
assert(Thread::current()->is_Watcher_thread(), "Must be WatcherThread");
|
||||
}
|
||||
|
||||
/*
|
||||
* See the caveats for this class in os_windows.hpp
|
||||
* Protects the callback call so that raised OS EXCEPTIONS causes a jump back
|
||||
* into this method and returns false. If no OS EXCEPTION was raised, returns
|
||||
* true.
|
||||
* The callback is supposed to provide the method that should be protected.
|
||||
*/
|
||||
bool os::WatcherThreadCrashProtection::call(os::CrashProtectionCallback& cb) {
|
||||
assert(Thread::current()->is_Watcher_thread(), "Only for WatcherThread");
|
||||
assert(!WatcherThread::watcher_thread()->has_crash_protection(),
|
||||
"crash_protection already set?");
|
||||
|
||||
bool success = true;
|
||||
__try {
|
||||
WatcherThread::watcher_thread()->set_crash_protection(this);
|
||||
cb.call();
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
// only for protection, nothing to do
|
||||
success = false;
|
||||
}
|
||||
WatcherThread::watcher_thread()->set_crash_protection(NULL);
|
||||
return success;
|
||||
}
|
||||
|
||||
// An Event wraps a win32 "CreateEvent" kernel handle.
|
||||
//
|
||||
// We have a number of choices regarding "CreateEvent" win32 handle leakage:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2013, 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
|
||||
@ -94,10 +94,28 @@ class win32 {
|
||||
static address fast_jni_accessor_wrapper(BasicType);
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
static void call_test_func_with_wrapper(void (*funcPtr)(void));
|
||||
#endif
|
||||
|
||||
// filter function to ignore faults on serializations page
|
||||
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
|
||||
};
|
||||
|
||||
/*
|
||||
* Crash protection for the watcher thread. Wrap the callback
|
||||
* with a __try { call() }
|
||||
* To be able to use this - don't take locks, don't rely on destructors,
|
||||
* don't make OS library calls, don't allocate memory, don't print,
|
||||
* don't call code that could leave the heap / memory in an inconsistent state,
|
||||
* or anything else where we are not in control if we suddenly jump out.
|
||||
*/
|
||||
class WatcherThreadCrashProtection : public StackObj {
|
||||
public:
|
||||
WatcherThreadCrashProtection();
|
||||
bool call(os::CrashProtectionCallback& cb);
|
||||
};
|
||||
|
||||
class PlatformEvent : public CHeapObj<mtInternal> {
|
||||
private:
|
||||
double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
|
||||
|
@ -106,4 +106,10 @@ inline size_t os::write(int fd, const void *buf, unsigned int nBytes) {
|
||||
inline int os::close(int fd) {
|
||||
return ::close(fd);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
#define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \
|
||||
os::win32::call_test_func_with_wrapper(f)
|
||||
#endif
|
||||
|
||||
#endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
|
||||
|
@ -63,24 +63,6 @@ SYMBOL(fixcw):
|
||||
popl %eax
|
||||
ret
|
||||
|
||||
.globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume)
|
||||
.globl SYMBOL(SafeFetchN)
|
||||
## TODO: avoid exposing Fetch32PFI and Fetch32Resume.
|
||||
## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP)
|
||||
## routine to vet the address. If the address is the faulting LD then
|
||||
## SafeFetchTriage() would return the resume-at EIP, otherwise null.
|
||||
ELF_TYPE(SafeFetch32,@function)
|
||||
.p2align 4,,15
|
||||
SYMBOL(SafeFetch32):
|
||||
SYMBOL(SafeFetchN):
|
||||
movl 0x8(%esp), %eax
|
||||
movl 0x4(%esp), %ecx
|
||||
SYMBOL(Fetch32PFI):
|
||||
movl (%ecx), %eax
|
||||
SYMBOL(Fetch32Resume):
|
||||
ret
|
||||
|
||||
|
||||
.globl SYMBOL(SpinPause)
|
||||
ELF_TYPE(SpinPause,@function)
|
||||
.p2align 4,,15
|
||||
|
@ -46,28 +46,6 @@
|
||||
|
||||
.text
|
||||
|
||||
.globl SYMBOL(SafeFetch32), SYMBOL(Fetch32PFI), SYMBOL(Fetch32Resume)
|
||||
.p2align 4,,15
|
||||
ELF_TYPE(SafeFetch32,@function)
|
||||
// Prototype: int SafeFetch32 (int * Adr, int ErrValue)
|
||||
SYMBOL(SafeFetch32):
|
||||
movl %esi, %eax
|
||||
SYMBOL(Fetch32PFI):
|
||||
movl (%rdi), %eax
|
||||
SYMBOL(Fetch32Resume):
|
||||
ret
|
||||
|
||||
.globl SYMBOL(SafeFetchN), SYMBOL(FetchNPFI), SYMBOL(FetchNResume)
|
||||
.p2align 4,,15
|
||||
ELF_TYPE(SafeFetchN,@function)
|
||||
// Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue)
|
||||
SYMBOL(SafeFetchN):
|
||||
movq %rsi, %rax
|
||||
SYMBOL(FetchNPFI):
|
||||
movq (%rdi), %rax
|
||||
SYMBOL(FetchNResume):
|
||||
ret
|
||||
|
||||
.globl SYMBOL(SpinPause)
|
||||
.p2align 4,,15
|
||||
ELF_TYPE(SpinPause,@function)
|
||||
|
@ -72,7 +72,7 @@ inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
|
||||
inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
|
||||
inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); }
|
||||
inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
|
||||
inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
|
||||
inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
|
||||
|
||||
inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
|
||||
inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
|
||||
@ -87,7 +87,7 @@ inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p
|
||||
inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); }
|
||||
inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong*)p, jlong_cast(v)); }
|
||||
|
||||
inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
|
||||
inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
|
||||
@ -190,7 +190,7 @@ inline void OrderAccess::release_store_fence(volatile juint* p, juint v)
|
||||
inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store_fence((volatile jlong*)p, (jlong)v); }
|
||||
|
||||
inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); }
|
||||
inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
|
||||
inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jdouble_cast(v)); }
|
||||
|
||||
inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) {
|
||||
#ifdef AMD64
|
||||
|
@ -385,13 +385,6 @@ enum {
|
||||
trap_page_fault = 0xE
|
||||
};
|
||||
|
||||
extern "C" void Fetch32PFI () ;
|
||||
extern "C" void Fetch32Resume () ;
|
||||
#ifdef AMD64
|
||||
extern "C" void FetchNPFI () ;
|
||||
extern "C" void FetchNResume () ;
|
||||
#endif // AMD64
|
||||
|
||||
extern "C" JNIEXPORT int
|
||||
JVM_handle_bsd_signal(int sig,
|
||||
siginfo_t* info,
|
||||
@ -401,6 +394,10 @@ JVM_handle_bsd_signal(int sig,
|
||||
|
||||
Thread* t = ThreadLocalStorage::get_thread_slow();
|
||||
|
||||
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
|
||||
// (no destructors can be run)
|
||||
os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
|
||||
|
||||
SignalHandlerMark shm(t);
|
||||
|
||||
// Note: it's not uncommon that JNI code uses signal/sigset to install
|
||||
@ -454,16 +451,10 @@ JVM_handle_bsd_signal(int sig,
|
||||
if (info != NULL && uc != NULL && thread != NULL) {
|
||||
pc = (address) os::Bsd::ucontext_get_pc(uc);
|
||||
|
||||
if (pc == (address) Fetch32PFI) {
|
||||
uc->context_pc = intptr_t(Fetch32Resume) ;
|
||||
return 1 ;
|
||||
if (StubRoutines::is_safefetch_fault(pc)) {
|
||||
uc->context_pc = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
|
||||
return 1;
|
||||
}
|
||||
#ifdef AMD64
|
||||
if (pc == (address) FetchNPFI) {
|
||||
uc->context_pc = intptr_t (FetchNResume) ;
|
||||
return 1 ;
|
||||
}
|
||||
#endif // AMD64
|
||||
|
||||
// Handle ALL stack overflow variations here
|
||||
if (sig == SIGSEGV || sig == SIGBUS) {
|
||||
|
@ -21,42 +21,6 @@
|
||||
# questions.
|
||||
#
|
||||
|
||||
# Prototype: int SafeFetch32 (int * adr, int ErrValue)
|
||||
# The "ld" at Fetch32 is potentially faulting instruction.
|
||||
# If the instruction traps the trap handler will arrange
|
||||
# for control to resume at Fetch32Resume.
|
||||
# By convention with the trap handler we ensure there is a non-CTI
|
||||
# instruction in the trap shadow.
|
||||
|
||||
|
||||
.globl SafeFetch32, Fetch32PFI, Fetch32Resume
|
||||
.globl SafeFetchN
|
||||
.align 32
|
||||
.type SafeFetch32,@function
|
||||
SafeFetch32:
|
||||
mov %o0, %g1
|
||||
mov %o1, %o0
|
||||
Fetch32PFI:
|
||||
# <-- Potentially faulting instruction
|
||||
ld [%g1], %o0
|
||||
Fetch32Resume:
|
||||
nop
|
||||
retl
|
||||
nop
|
||||
|
||||
.globl SafeFetchN, FetchNPFI, FetchNResume
|
||||
.type SafeFetchN,@function
|
||||
.align 32
|
||||
SafeFetchN:
|
||||
mov %o0, %g1
|
||||
mov %o1, %o0
|
||||
FetchNPFI:
|
||||
ldn [%g1], %o0
|
||||
FetchNResume:
|
||||
nop
|
||||
retl
|
||||
nop
|
||||
|
||||
# Possibilities:
|
||||
# -- membar
|
||||
# -- CAS (SP + BIAS, G0, G0)
|
||||
|
@ -366,18 +366,9 @@ intptr_t* os::Linux::ucontext_get_fp(ucontext_t *uc) {
|
||||
|
||||
// Utility functions
|
||||
|
||||
extern "C" void Fetch32PFI();
|
||||
extern "C" void Fetch32Resume();
|
||||
extern "C" void FetchNPFI();
|
||||
extern "C" void FetchNResume();
|
||||
|
||||
inline static bool checkPrefetch(sigcontext* uc, address pc) {
|
||||
if (pc == (address) Fetch32PFI) {
|
||||
set_cont_address(uc, address(Fetch32Resume));
|
||||
return true;
|
||||
}
|
||||
if (pc == (address) FetchNPFI) {
|
||||
set_cont_address(uc, address(FetchNResume));
|
||||
if (StubRoutines::is_safefetch_fault(pc)) {
|
||||
set_cont_address(uc, address(StubRoutines::continuation_for_safefetch_fault(pc)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -553,6 +544,10 @@ JVM_handle_linux_signal(int sig,
|
||||
|
||||
Thread* t = ThreadLocalStorage::get_thread_slow();
|
||||
|
||||
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
|
||||
// (no destructors can be run)
|
||||
os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
|
||||
|
||||
SignalHandlerMark shm(t);
|
||||
|
||||
// Note: it's not uncommon that JNI code uses signal/sigset to install
|
||||
|
@ -42,24 +42,6 @@
|
||||
|
||||
.text
|
||||
|
||||
.globl SafeFetch32, Fetch32PFI, Fetch32Resume
|
||||
.globl SafeFetchN
|
||||
## TODO: avoid exposing Fetch32PFI and Fetch32Resume.
|
||||
## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP)
|
||||
## routine to vet the address. If the address is the faulting LD then
|
||||
## SafeFetchTriage() would return the resume-at EIP, otherwise null.
|
||||
.type SafeFetch32,@function
|
||||
.p2align 4,,15
|
||||
SafeFetch32:
|
||||
SafeFetchN:
|
||||
movl 0x8(%esp), %eax
|
||||
movl 0x4(%esp), %ecx
|
||||
Fetch32PFI:
|
||||
movl (%ecx), %eax
|
||||
Fetch32Resume:
|
||||
ret
|
||||
|
||||
|
||||
.globl SpinPause
|
||||
.type SpinPause,@function
|
||||
.p2align 4,,15
|
||||
|
@ -38,28 +38,6 @@
|
||||
|
||||
.text
|
||||
|
||||
.globl SafeFetch32, Fetch32PFI, Fetch32Resume
|
||||
.align 16
|
||||
.type SafeFetch32,@function
|
||||
// Prototype: int SafeFetch32 (int * Adr, int ErrValue)
|
||||
SafeFetch32:
|
||||
movl %esi, %eax
|
||||
Fetch32PFI:
|
||||
movl (%rdi), %eax
|
||||
Fetch32Resume:
|
||||
ret
|
||||
|
||||
.globl SafeFetchN, FetchNPFI, FetchNResume
|
||||
.align 16
|
||||
.type SafeFetchN,@function
|
||||
// Prototype: intptr_t SafeFetchN (intptr_t * Adr, intptr_t ErrValue)
|
||||
SafeFetchN:
|
||||
movq %rsi, %rax
|
||||
FetchNPFI:
|
||||
movq (%rdi), %rax
|
||||
FetchNResume:
|
||||
ret
|
||||
|
||||
.globl SpinPause
|
||||
.align 16
|
||||
.type SpinPause,@function
|
||||
|
@ -72,7 +72,7 @@ inline jushort OrderAccess::load_acquire(volatile jushort* p) { return *p; }
|
||||
inline juint OrderAccess::load_acquire(volatile juint* p) { return *p; }
|
||||
inline julong OrderAccess::load_acquire(volatile julong* p) { return Atomic::load((volatile jlong*)p); }
|
||||
inline jfloat OrderAccess::load_acquire(volatile jfloat* p) { return *p; }
|
||||
inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
|
||||
inline jdouble OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
|
||||
|
||||
inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t* p) { return *p; }
|
||||
inline void* OrderAccess::load_ptr_acquire(volatile void* p) { return *(void* volatile *)p; }
|
||||
@ -87,7 +87,7 @@ inline void OrderAccess::release_store(volatile jushort* p, jushort v) { *p
|
||||
inline void OrderAccess::release_store(volatile juint* p, juint v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile julong* p, julong v) { Atomic::store((jlong)v, (volatile jlong*)p); }
|
||||
inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
|
||||
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); }
|
||||
|
||||
inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
|
||||
inline void OrderAccess::release_store_ptr(volatile void* p, void* v) { *(void* volatile *)p = v; }
|
||||
@ -129,7 +129,7 @@ inline void OrderAccess::store_fence(jushort* p, jushort v) { store_fence((j
|
||||
inline void OrderAccess::store_fence(juint* p, juint v) { store_fence((jint*)p, (jint)v); }
|
||||
inline void OrderAccess::store_fence(julong* p, julong v) { store_fence((jlong*)p, (jlong)v); }
|
||||
inline void OrderAccess::store_fence(jfloat* p, jfloat v) { *p = v; fence(); }
|
||||
inline void OrderAccess::store_fence(jdouble* p, jdouble v) { *p = v; fence(); }
|
||||
inline void OrderAccess::store_fence(jdouble* p, jdouble v) { store_fence((jlong*)p, jlong_cast(v)); }
|
||||
|
||||
inline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) {
|
||||
#ifdef AMD64
|
||||
@ -190,7 +190,7 @@ inline void OrderAccess::release_store_fence(volatile juint* p, juint v)
|
||||
inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store_fence((volatile jlong*)p, (jlong)v); }
|
||||
|
||||
inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { *p = v; fence(); }
|
||||
inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
|
||||
inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store_fence((volatile jlong*)p, jlong_cast(v)); }
|
||||
|
||||
inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) {
|
||||
#ifdef AMD64
|
||||
|
@ -209,13 +209,6 @@ enum {
|
||||
trap_page_fault = 0xE
|
||||
};
|
||||
|
||||
extern "C" void Fetch32PFI () ;
|
||||
extern "C" void Fetch32Resume () ;
|
||||
#ifdef AMD64
|
||||
extern "C" void FetchNPFI () ;
|
||||
extern "C" void FetchNResume () ;
|
||||
#endif // AMD64
|
||||
|
||||
extern "C" JNIEXPORT int
|
||||
JVM_handle_linux_signal(int sig,
|
||||
siginfo_t* info,
|
||||
@ -225,6 +218,10 @@ JVM_handle_linux_signal(int sig,
|
||||
|
||||
Thread* t = ThreadLocalStorage::get_thread_slow();
|
||||
|
||||
// Must do this before SignalHandlerMark, if crash protection installed we will longjmp away
|
||||
// (no destructors can be run)
|
||||
os::WatcherThreadCrashProtection::check_crash_protection(sig, t);
|
||||
|
||||
SignalHandlerMark shm(t);
|
||||
|
||||
// Note: it's not uncommon that JNI code uses signal/sigset to install
|
||||
@ -278,16 +275,10 @@ JVM_handle_linux_signal(int sig,
|
||||
if (info != NULL && uc != NULL && thread != NULL) {
|
||||
pc = (address) os::Linux::ucontext_get_pc(uc);
|
||||
|
||||
if (pc == (address) Fetch32PFI) {
|
||||
uc->uc_mcontext.gregs[REG_PC] = intptr_t(Fetch32Resume) ;
|
||||
return 1 ;
|
||||
if (StubRoutines::is_safefetch_fault(pc)) {
|
||||
uc->uc_mcontext.gregs[REG_PC] = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
|
||||
return 1;
|
||||
}
|
||||
#ifdef AMD64
|
||||
if (pc == (address) FetchNPFI) {
|
||||
uc->uc_mcontext.gregs[REG_PC] = intptr_t (FetchNResume) ;
|
||||
return 1 ;
|
||||
}
|
||||
#endif // AMD64
|
||||
|
||||
#ifndef AMD64
|
||||
// Halt if SI_KERNEL before more crashes get misdiagnosed as Java bugs
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user