Merge
This commit is contained in:
commit
bcbeb16d14
@ -424,3 +424,5 @@ aa3c97810d7c484c93a2fd75d3c76ff574deb6d8 jdk-10+7
|
||||
df33ef1dc163f994177fd97d4d0e73a1e3cb5d85 jdk-10+8
|
||||
b94be69cbb1d2943b886bf2d458745756df146e4 jdk-10+9
|
||||
4c12464a907db4656c1033f56fa49cba643ac629 jdk-9+171
|
||||
6558c37afe832582238d338578d598f30c6fdd75 jdk-10+10
|
||||
2c25fc24103251f9711a1c280c31e1e41016d90f jdk-9+172
|
||||
|
@ -584,3 +584,5 @@ fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
|
||||
f5ded0cf954c770deeecb80f2ba1ba6a05cd979b jdk-10+8
|
||||
233647e3d3800e76d7612014b745b37a88098f63 jdk-10+9
|
||||
d53171650a2cc6c6f699c966c533b914ca9c0602 jdk-9+171
|
||||
c6cd3ec8d46b034e57c86399380ffcf7f25706e4 jdk-10+10
|
||||
1ae9e84f68b359420d2d153ecfe5ee2903e33a2e jdk-9+172
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2017, 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
|
||||
@ -50,6 +50,7 @@ public class JavaThread extends Thread {
|
||||
private static AddressField osThreadField;
|
||||
private static AddressField stackBaseField;
|
||||
private static CIntegerField stackSizeField;
|
||||
private static CIntegerField terminatedField;
|
||||
|
||||
private static JavaThreadPDAccess access;
|
||||
|
||||
@ -66,6 +67,9 @@ public class JavaThread extends Thread {
|
||||
private static int BLOCKED;
|
||||
private static int BLOCKED_TRANS;
|
||||
|
||||
private static int NOT_TERMINATED;
|
||||
private static int EXITING;
|
||||
|
||||
static {
|
||||
VM.registerVMInitializedObserver(new Observer() {
|
||||
public void update(Observable o, Object data) {
|
||||
@ -87,6 +91,7 @@ public class JavaThread extends Thread {
|
||||
osThreadField = type.getAddressField("_osthread");
|
||||
stackBaseField = type.getAddressField("_stack_base");
|
||||
stackSizeField = type.getCIntegerField("_stack_size");
|
||||
terminatedField = type.getCIntegerField("_terminated");
|
||||
|
||||
UNINITIALIZED = db.lookupIntConstant("_thread_uninitialized").intValue();
|
||||
NEW = db.lookupIntConstant("_thread_new").intValue();
|
||||
@ -99,6 +104,10 @@ public class JavaThread extends Thread {
|
||||
IN_JAVA_TRANS = db.lookupIntConstant("_thread_in_Java_trans").intValue();
|
||||
BLOCKED = db.lookupIntConstant("_thread_blocked").intValue();
|
||||
BLOCKED_TRANS = db.lookupIntConstant("_thread_blocked_trans").intValue();
|
||||
|
||||
NOT_TERMINATED = db.lookupIntConstant("JavaThread::_not_terminated").intValue();
|
||||
EXITING = db.lookupIntConstant("JavaThread::_thread_exiting").intValue();
|
||||
|
||||
}
|
||||
|
||||
public JavaThread(Address addr) {
|
||||
@ -128,6 +137,14 @@ public class JavaThread extends Thread {
|
||||
example, "SolarisSPARCCompilerThread".) */
|
||||
public boolean isJavaThread() { return true; }
|
||||
|
||||
public boolean isExiting () {
|
||||
return (getTerminated() == EXITING) || isTerminated();
|
||||
}
|
||||
|
||||
public boolean isTerminated() {
|
||||
return (getTerminated() != NOT_TERMINATED) && (getTerminated() != EXITING);
|
||||
}
|
||||
|
||||
public static AddressField getAnchorField() { return anchorField; }
|
||||
|
||||
/** Get the last Java stack pointer */
|
||||
@ -329,6 +346,10 @@ public class JavaThread extends Thread {
|
||||
return stackSizeField.getValue(addr);
|
||||
}
|
||||
|
||||
public int getTerminated() {
|
||||
return (int) terminatedField.getValue(addr);
|
||||
}
|
||||
|
||||
/** Gets the Java-side thread object for this JavaThread */
|
||||
public Oop getThreadObj() {
|
||||
Oop obj = null;
|
||||
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.runtime;
|
||||
|
||||
import sun.jvm.hotspot.oops.*;
|
||||
|
||||
public class StackFrameInfo {
|
||||
private Method method;
|
||||
int bci;
|
||||
Oop classHolder;
|
||||
|
||||
public StackFrameInfo(JavaVFrame vf) {
|
||||
this.method = vf.getMethod();
|
||||
this.bci = vf.getBCI();
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public int getBCI() {
|
||||
return bci;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package sun.jvm.hotspot.runtime;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ThreadStackTrace {
|
||||
private JavaThread thread;
|
||||
private int depth; // number of stack frames added
|
||||
private ArrayList<StackFrameInfo> frames;
|
||||
|
||||
public ThreadStackTrace(JavaThread t) {
|
||||
this.thread = t;
|
||||
this.depth = 0;
|
||||
this.frames = new ArrayList<StackFrameInfo>();
|
||||
}
|
||||
|
||||
public int getStackDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public StackFrameInfo stackFrameAt(int index) {
|
||||
return frames.get(index);
|
||||
}
|
||||
|
||||
public void dumpStack(int maxDepth) {
|
||||
if (!thread.isJavaThread()) {
|
||||
System.out.println("dumpStack: not java Thread returning");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
for (JavaVFrame vf = thread.getLastJavaVFrameDbg(); vf != null; vf = vf.javaSender()) {
|
||||
StackFrameInfo frame = new StackFrameInfo(vf);
|
||||
frames.add(frame);
|
||||
depth++;
|
||||
|
||||
if (maxDepth > 0 && depth == maxDepth) {
|
||||
// Skip frames if more than maxDepth
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("Error occurred during stack walking:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
@ -379,6 +379,10 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
private static final long MAX_U4_VALUE = 0xFFFFFFFFL;
|
||||
int serialNum = 1;
|
||||
|
||||
public HeapHprofBinWriter() {
|
||||
this.KlassMap = new ArrayList<Klass>();
|
||||
}
|
||||
|
||||
public synchronized void write(String fileName) throws IOException {
|
||||
// open file stream and create buffered data output stream
|
||||
fos = new FileOutputStream(fileName);
|
||||
@ -426,6 +430,9 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
// HPROF_LOAD_CLASS records for all classes
|
||||
writeClasses();
|
||||
|
||||
// write HPROF_FRAME and HPROF_TRACE records
|
||||
dumpStackTraces();
|
||||
|
||||
// write CLASS_DUMP records
|
||||
writeClassDumpRecords();
|
||||
|
||||
@ -700,6 +707,67 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpStackTraces() throws IOException {
|
||||
// write a HPROF_TRACE record without any frames to be referenced as object alloc sites
|
||||
writeHeader(HPROF_TRACE, 3 * (int)INT_SIZE );
|
||||
out.writeInt(DUMMY_STACK_TRACE_ID);
|
||||
out.writeInt(0); // thread number
|
||||
out.writeInt(0); // frame count
|
||||
|
||||
int frameSerialNum = 0;
|
||||
int numThreads = 0;
|
||||
Threads threads = VM.getVM().getThreads();
|
||||
|
||||
for (JavaThread thread = threads.first(); thread != null; thread = thread.next()) {
|
||||
Oop threadObj = thread.getThreadObj();
|
||||
if (threadObj != null && !thread.isExiting() && !thread.isHiddenFromExternalView()) {
|
||||
|
||||
// dump thread stack trace
|
||||
ThreadStackTrace st = new ThreadStackTrace(thread);
|
||||
st.dumpStack(-1);
|
||||
numThreads++;
|
||||
|
||||
// write HPROF_FRAME records for this thread's stack trace
|
||||
int depth = st.getStackDepth();
|
||||
int threadFrameStart = frameSerialNum;
|
||||
for (int j=0; j < depth; j++) {
|
||||
StackFrameInfo frame = st.stackFrameAt(j);
|
||||
Method m = frame.getMethod();
|
||||
int classSerialNum = KlassMap.indexOf(m.getMethodHolder()) + 1;
|
||||
// the class serial number starts from 1
|
||||
assert classSerialNum > 0:"class not found";
|
||||
dumpStackFrame(++frameSerialNum, classSerialNum, m, frame.getBCI());
|
||||
}
|
||||
|
||||
// write HPROF_TRACE record for one thread
|
||||
writeHeader(HPROF_TRACE, 3 * (int)INT_SIZE + depth * (int)VM.getVM().getOopSize());
|
||||
int stackSerialNum = numThreads + DUMMY_STACK_TRACE_ID;
|
||||
out.writeInt(stackSerialNum); // stack trace serial number
|
||||
out.writeInt(numThreads); // thread serial number
|
||||
out.writeInt(depth); // frame count
|
||||
for (int j=1; j <= depth; j++) {
|
||||
writeObjectID(threadFrameStart + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void dumpStackFrame(int frameSN, int classSN, Method m, int bci) throws IOException {
|
||||
int lineNumber;
|
||||
if (m.isNative()) {
|
||||
lineNumber = -3; // native frame
|
||||
} else {
|
||||
lineNumber = m.getLineNumberFromBCI(bci);
|
||||
}
|
||||
writeHeader(HPROF_FRAME, 4 * (int)VM.getVM().getOopSize() + 2 * (int)INT_SIZE);
|
||||
writeObjectID(frameSN); // frame serial number
|
||||
writeSymbolID(m.getName()); // method's name
|
||||
writeSymbolID(m.getSignature()); // method's signature
|
||||
writeSymbolID(m.getMethodHolder().getSourceFileName()); // source file name
|
||||
out.writeInt(classSN); // class serial number
|
||||
out.writeInt(lineNumber); // line number
|
||||
}
|
||||
|
||||
protected void writeJavaThread(JavaThread jt, int index) throws IOException {
|
||||
out.writeByte((byte) HPROF_GC_ROOT_THREAD_OBJ);
|
||||
writeObjectID(jt.getThreadObj());
|
||||
@ -1030,6 +1098,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
writeHeader(HPROF_LOAD_CLASS, 2 * (OBJ_ID_SIZE + 4));
|
||||
out.writeInt(serialNum);
|
||||
writeObjectID(clazz);
|
||||
KlassMap.add(serialNum - 1, k);
|
||||
out.writeInt(DUMMY_STACK_TRACE_ID);
|
||||
writeSymbolID(k.getName());
|
||||
serialNum++;
|
||||
@ -1045,6 +1114,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
writeHeader(HPROF_LOAD_CLASS, 2 * (OBJ_ID_SIZE + 4));
|
||||
out.writeInt(serialNum);
|
||||
writeObjectID(clazz);
|
||||
KlassMap.add(serialNum - 1, k);
|
||||
out.writeInt(DUMMY_STACK_TRACE_ID);
|
||||
writeSymbolID(k.getName());
|
||||
serialNum++;
|
||||
@ -1157,6 +1227,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
|
||||
private Debugger dbg;
|
||||
private ObjectHeap objectHeap;
|
||||
private SymbolTable symTbl;
|
||||
private ArrayList<Klass> KlassMap;
|
||||
|
||||
// oopSize of the debuggee
|
||||
private int OBJ_ID_SIZE;
|
||||
|
@ -129,9 +129,9 @@ void RelocIterator::initialize(CompiledMethod* nm, address begin, address limit)
|
||||
if (nm == NULL && begin != NULL) {
|
||||
// allow nmethod to be deduced from beginning address
|
||||
CodeBlob* cb = CodeCache::find_blob(begin);
|
||||
nm = cb->as_compiled_method_or_null();
|
||||
nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
|
||||
}
|
||||
assert(nm != NULL, "must be able to deduce nmethod from other arguments");
|
||||
guarantee(nm != NULL, "must be able to deduce nmethod from other arguments");
|
||||
|
||||
_code = nm;
|
||||
_current = nm->relocation_begin() - 1;
|
||||
|
@ -350,16 +350,14 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
|
||||
omv = oms.current();
|
||||
oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
|
||||
guarantee(loc != NULL, "missing saved register");
|
||||
oop *base_loc = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
|
||||
oop *derived_loc = loc;
|
||||
oop val = *base_loc;
|
||||
if (val == (oop)NULL || Universe::is_narrow_oop_base(val)) {
|
||||
// Ignore NULL oops and decoded NULL narrow oops which
|
||||
// equal to Universe::narrow_oop_base when a narrow oop
|
||||
// implicit null check is used in compiled code.
|
||||
// The narrow_oop_base could be NULL or be the address
|
||||
// of the page below heap depending on compressed oops mode.
|
||||
} else {
|
||||
oop *base_loc = fr->oopmapreg_to_location(omv.content_reg(), reg_map);
|
||||
// Ignore NULL oops and decoded NULL narrow oops which
|
||||
// equal to Universe::narrow_oop_base when a narrow oop
|
||||
// implicit null check is used in compiled code.
|
||||
// The narrow_oop_base could be NULL or be the address
|
||||
// of the page below heap depending on compressed oops mode.
|
||||
if (base_loc != NULL && *base_loc != (oop)NULL && !Universe::is_narrow_oop_base(*base_loc)) {
|
||||
derived_oop_fn(base_loc, derived_loc);
|
||||
}
|
||||
oms.next();
|
||||
|
@ -549,7 +549,7 @@ address SharedRuntime::get_poll_stub(address pc) {
|
||||
CodeBlob *cb = CodeCache::find_blob(pc);
|
||||
|
||||
// Should be an nmethod
|
||||
assert(cb && cb->is_compiled(), "safepoint polling: pc must refer to an nmethod");
|
||||
guarantee(cb != NULL && cb->is_compiled(), "safepoint polling: pc must refer to an nmethod");
|
||||
|
||||
// Look up the relocation information
|
||||
assert(((CompiledMethod*)cb)->is_at_poll_or_poll_return(pc),
|
||||
@ -1802,7 +1802,7 @@ bool SharedRuntime::should_fixup_call_destination(address destination, address e
|
||||
if (destination != entry_point) {
|
||||
CodeBlob* callee = CodeCache::find_blob(destination);
|
||||
// callee == cb seems weird. It means calling interpreter thru stub.
|
||||
if (callee == cb || callee->is_adapter_blob()) {
|
||||
if (callee != NULL && (callee == cb || callee->is_adapter_blob())) {
|
||||
// static call or optimized virtual
|
||||
if (TraceCallFixup) {
|
||||
tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", p2i(caller_pc));
|
||||
@ -1851,7 +1851,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
|
||||
// ask me how I know this...
|
||||
|
||||
CodeBlob* cb = CodeCache::find_blob(caller_pc);
|
||||
if (!cb->is_compiled() || entry_point == moop->get_c2i_entry()) {
|
||||
if (cb == NULL || !cb->is_compiled() || entry_point == moop->get_c2i_entry()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2017, 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
|
||||
@ -971,6 +971,7 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
|
||||
nonstatic_field(JavaThread, _vframe_array_last, vframeArray*) \
|
||||
nonstatic_field(JavaThread, _satb_mark_queue, SATBMarkQueue) \
|
||||
nonstatic_field(JavaThread, _dirty_card_queue, DirtyCardQueue) \
|
||||
volatile_nonstatic_field(JavaThread, _terminated, JavaThread::TerminatedTypes) \
|
||||
nonstatic_field(Thread, _resource_area, ResourceArea*) \
|
||||
nonstatic_field(CompilerThread, _env, ciEnv*) \
|
||||
\
|
||||
@ -2213,6 +2214,7 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
|
||||
declare_toplevel_type(JavaThread*) \
|
||||
declare_toplevel_type(java_lang_Class) \
|
||||
declare_integer_type(JavaThread::AsyncRequests) \
|
||||
declare_integer_type(JavaThread::TerminatedTypes) \
|
||||
declare_toplevel_type(jbyte*) \
|
||||
declare_toplevel_type(jbyte**) \
|
||||
declare_toplevel_type(jint*) \
|
||||
@ -2435,6 +2437,8 @@ typedef RehashableHashtable<Symbol*, mtSymbol> RehashableSymbolHashtable;
|
||||
declare_constant(_thread_in_Java_trans) \
|
||||
declare_constant(_thread_blocked) \
|
||||
declare_constant(_thread_blocked_trans) \
|
||||
declare_constant(JavaThread::_not_terminated) \
|
||||
declare_constant(JavaThread::_thread_exiting) \
|
||||
\
|
||||
/******************************/ \
|
||||
/* Klass misc. enum constants */ \
|
||||
|
193
make/Docs.gmk
193
make/Docs.gmk
@ -36,10 +36,22 @@ include $(JDK_TOPDIR)/make/ModuleTools.gmk
|
||||
$(eval $(call ReadImportMetaData))
|
||||
|
||||
################################################################################
|
||||
|
||||
# Hook to include the corresponding custom file, if present.
|
||||
$(eval $(call IncludeCustomExtension, , Docs.gmk))
|
||||
|
||||
################################################################################
|
||||
# This file generates all documentation for OpenJDK.
|
||||
#
|
||||
# We will generate API documentation for two different selections of the source
|
||||
# code: "Java SE", which contains just the modules covered by the top-level
|
||||
# module java.se.ee, and "JDK", which covers all of Java SE and also all
|
||||
# other available modules that should be documented, including imported modules,
|
||||
# if any.
|
||||
#
|
||||
# We will also generate separate, free-standing specifications from either
|
||||
# markdown or existing html files.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
# Javadoc settings
|
||||
|
||||
@ -106,6 +118,8 @@ endif
|
||||
FULL_COMPANY_NAME := Oracle and/or its affiliates
|
||||
COMPANY_ADDRESS := 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA
|
||||
|
||||
JAVA_PLATFORM := Java™ Platform
|
||||
|
||||
ifeq ($(IS_DRAFT), true)
|
||||
DRAFT_MARKER_STR := <br><strong>DRAFT $(VERSION_STRING)</strong>
|
||||
ifeq ($(VERSION_BUILD), 0)
|
||||
@ -113,15 +127,12 @@ ifeq ($(IS_DRAFT), true)
|
||||
else
|
||||
DRAFT_MARKER_TITLE := [build $(VERSION_BUILD)]
|
||||
endif
|
||||
DRAFT_TEXT := Please note that the specifications and other information \
|
||||
contained herein are not final and are subject to change. The \
|
||||
information is being made available to you solely for purpose of \
|
||||
evaluation.
|
||||
endif
|
||||
|
||||
JAVADOC_WINDOW_TITLE := Java Platform SE $(VERSION_SPECIFICATION) \
|
||||
$(DRAFT_MARKER_TITLE)
|
||||
|
||||
JAVADOC_HEADER_TITLE := $(subst $(SPACE), ,$(strip \
|
||||
<strong>Java™ Platform<br>Standard Ed. \
|
||||
$(VERSION_SPECIFICATION)</strong>$(DRAFT_MARKER_STR)))
|
||||
|
||||
JAVADOC_BOTTOM := \
|
||||
<span style="font-size:smaller"> \
|
||||
<a href="$(BUG_SUBMIT_URL)">Submit a bug or feature</a><br> \
|
||||
@ -143,27 +154,24 @@ JAVADOC_TOP := \
|
||||
<div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
|
||||
margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
|
||||
6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
|
||||
sans-serif; font-weight: normal;">Please note that the specifications \
|
||||
and other information contained herein are not final and are subject to \
|
||||
change. The information is being made available to you solely for \
|
||||
purpose of evaluation.</div></div>
|
||||
sans-serif; font-weight: normal;">$(DRAFT_TEXT)</div></div>
|
||||
|
||||
################################################################################
|
||||
# JDK javadoc titles/text snippets
|
||||
|
||||
JDK_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition Development Kit \
|
||||
(JDK™) $(VERSION_SPECIFICATION)<br>API Specification
|
||||
JDK_SHORT_NAME := JDK™ $(VERSION_SPECIFICATION)
|
||||
JDK_LONG_NAME := Standard Edition Development Kit (JDK™) $(VERSION_SPECIFICATION)
|
||||
|
||||
################################################################################
|
||||
# Java SE javadoc titles/text snippets
|
||||
|
||||
JAVASE_JAVADOC_DOC_TITLE := Java™ Platform, Standard Edition \
|
||||
$(VERSION_SPECIFICATION)<br>API Specification
|
||||
JAVASE_SHORT_NAME := SE $(VERSION_SPECIFICATION)
|
||||
JAVASE_LONG_NAME := Standard Edition $(VERSION_SPECIFICATION)
|
||||
|
||||
################################################################################
|
||||
# Index page text titles/snippets
|
||||
|
||||
JDK_INDEX_TITLE := Java™ Platform, Standard Edition Development Kit \
|
||||
(JDK™) $(VERSION_SPECIFICATION) Specification<br>$(DRAFT_MARKER_TITLE)
|
||||
JDK_INDEX_TITLE := $(JAVA_PLATFORM), $(JDK_LONG_NAME) Specification $(DRAFT_MARKER_TITLE)
|
||||
|
||||
################################################################################
|
||||
# Functions
|
||||
@ -187,9 +195,53 @@ define setup_gengraph_dot_to_png
|
||||
$1_MODULEGRAPH_TARGETS += $$($1_$2_PNG_TARGET)
|
||||
endef
|
||||
|
||||
# Helper function to create the overview.html file to use with the -overview
|
||||
# javadoc option.
|
||||
# Returns the filename as $1_OVERVIEW.
|
||||
#
|
||||
# param 1: SetupJavadocGeneration namespace ($1)
|
||||
define create_overview_file
|
||||
$1_OVERVIEW_TEXT := \
|
||||
<!DOCTYPE html> \
|
||||
<html><head></head><body> \
|
||||
<p>This document is the API specification for $$($1_FULL_NAME).</p> \
|
||||
#
|
||||
ifneq ($$($1_GROUPS),)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
<p>For an overview of the full specification, grouped by usage, see the <a href="../index.html">$$(JAVA_PLATFORM), $$($1_LONG_NAME) Specification</a>.</p> \
|
||||
<dl> \
|
||||
#
|
||||
$1_OVERVIEW_TEXT += $$(foreach g, $$($1_GROUPS), \
|
||||
<dt><a href="\#$$g">$$($$g_GROUP_NAME)</a></dt> \
|
||||
<dd>$$($$g_GROUP_DESCRIPTION)</dt> \
|
||||
)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
</dl> \
|
||||
#
|
||||
endif
|
||||
ifeq ($$(IS_DRAFT), true)
|
||||
$1_OVERVIEW_TEXT += \
|
||||
<p><strong>$$(DRAFT_TEXT)</strong></p> \
|
||||
#
|
||||
endif
|
||||
$1_OVERVIEW_TEXT += \
|
||||
</body></html> \
|
||||
#
|
||||
|
||||
$1_OVERVIEW := $$(SUPPORT_OUTPUTDIR)/docs/$1-overview.html
|
||||
|
||||
$1_OVERVIEW_VARDEPS_FILE := $$(call DependOnVariable, $1_OVERVIEW_TEXT, \
|
||||
$$($1_OVERVIEW).vardeps)
|
||||
|
||||
$$($1_OVERVIEW): $$($1_OVERVIEW_VARDEPS_FILE)
|
||||
$$(call LogInfo, Creating overview.html for $1)
|
||||
$$(call MakeDir, $$(@D))
|
||||
$$(PRINTF) > $$@ '$$($1_OVERVIEW_TEXT)'
|
||||
endef
|
||||
|
||||
################################################################################
|
||||
# Setup make rules for creating the API documentation, using javadoc and other
|
||||
# tools if needed.
|
||||
# Setup make rules to create an API documentation collection, using javadoc and
|
||||
# other tools if needed.
|
||||
#
|
||||
# Parameter 1 is the name of the rule. This name is used as variable prefix.
|
||||
# Targets generated are returned as $1_JAVADOC_TARGETS and
|
||||
@ -198,14 +250,10 @@ endef
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# MODULES - Modules to generate javadoc for
|
||||
# NAME - The name of the javadoc compilation, to be presented to the user
|
||||
# GROUPS - Name of the groups to divide the modules into, if any
|
||||
# SHORT_NAME - The short name of this documentation collection
|
||||
# LONG_NAME - The long name of this documentation collection
|
||||
# TARGET_DIR - Where to store the output
|
||||
# OVERVIEW - Path to an html overview file
|
||||
# DOC_TITLE - Title to use in -doctitle.
|
||||
# WINDOW_TITLE - Title to use in -windowtitle.
|
||||
# HEADER_TITLE - Title to use in -header.
|
||||
# BOTTOM_TEXT - Text to use in -bottom.
|
||||
# TOP_TEXT - Text to use in -top.
|
||||
#
|
||||
SetupApiDocsGeneration = $(NamedParamsMacroTemplate)
|
||||
define SetupApiDocsGenerationBody
|
||||
@ -224,7 +272,6 @@ define SetupApiDocsGenerationBody
|
||||
# Always include tags and basic options
|
||||
$1_OPTIONS := $$(JAVADOC_TAGS) $$(JAVADOC_OPTIONS)
|
||||
|
||||
$1_OPTIONS += -overview $$($1_OVERVIEW)
|
||||
$1_OPTIONS += --module-source-path $$(MODULES_SOURCE_PATH)
|
||||
$1_OPTIONS += --module $$(call CommaList, $$($1_MODULES))
|
||||
|
||||
@ -232,12 +279,20 @@ define SetupApiDocsGenerationBody
|
||||
$1_OPTIONS += -Xdoclint:all,$$(call CommaList, $$(addprefix -, \
|
||||
$$(JAVADOC_DISABLED_DOCLINT)))
|
||||
|
||||
$1_FULL_NAME := $$(JAVA_PLATFORM), $$($1_LONG_NAME) \
|
||||
$$(DRAFT_MARKER_TITLE)
|
||||
$1_DOC_TITLE := $$($1_FULL_NAME)<br>API Specification
|
||||
$1_WINDOW_TITLE := $$(subst ™,,$$(JAVA_PLATFORM) $$($1_SHORT_NAME)) \
|
||||
$$(DRAFT_MARKER_TITLE)
|
||||
$1_HEADER_TITLE := <strong>$$(JAVA_PLATFORM)<br>$$($1_SHORT_NAME)</strong> \
|
||||
$$(DRAFT_MARKER_STR)
|
||||
|
||||
$1_OPTIONS += -doctitle '$$($1_DOC_TITLE)'
|
||||
$1_OPTIONS += -windowtitle '$$($1_WINDOW_TITLE)'
|
||||
$1_OPTIONS += -header '$$($1_HEADER_TITLE)'
|
||||
$1_OPTIONS += -bottom '$$($1_BOTTOM_TEXT)'
|
||||
$1_OPTIONS += -bottom '$$(JAVADOC_BOTTOM)'
|
||||
ifeq ($$(IS_DRAFT), true)
|
||||
$1_OPTIONS += -top '$$($1_TOP_TEXT)'
|
||||
$1_OPTIONS += -top '$$(JAVADOC_TOP)'
|
||||
endif
|
||||
|
||||
# Do not store debug level options in VARDEPS.
|
||||
@ -247,6 +302,15 @@ define SetupApiDocsGenerationBody
|
||||
$1_LOG_OPTION += -verbose
|
||||
endif
|
||||
|
||||
# Generate the overview.html file. This will return the filename in
|
||||
# $1_OVERVIEW.
|
||||
$$(eval $$(call create_overview_file,$1))
|
||||
$1_OPTIONS += -overview $$($1_OVERVIEW)
|
||||
|
||||
$$(foreach g, $$($1_GROUPS), \
|
||||
$$(eval $1_OPTIONS += -group "$$($$g_GROUP_NAME)" "$$($$g_GROUP_MODULES)") \
|
||||
)
|
||||
|
||||
$1_VARDEPS := $$($1_JAVA_ARGS) $$($1_OPTIONS) $$(MODULES_SOURCE_PATH) \
|
||||
$$($1_ALL_MODULES)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
@ -259,7 +323,7 @@ define SetupApiDocsGenerationBody
|
||||
# Javadoc creates a lot of files but use index.html as a marker
|
||||
$$($1_TARGET_DIR)/index.html: $$(BUILD_TOOLS_JDK) $$($1_VARDEPS_FILE) \
|
||||
$$($1_SOURCE_DEPS) $$($1_OVERVIEW)
|
||||
$$(call LogWarn, Generating $$($1_NAME) API javadoc for \
|
||||
$$(call LogWarn, Generating $1 javadoc for \
|
||||
$$(words $$($1_ALL_MODULES)) modules)
|
||||
$$(call LogInfo, Javadoc modules: $$($1_ALL_MODULES))
|
||||
$$(call MakeDir, $$($1_TARGET_DIR))
|
||||
@ -291,7 +355,7 @@ define SetupApiDocsGenerationBody
|
||||
$1_GENGRAPHS_MARKER := $$($1_GENGRAPHS_DIR)/_gengraphs_run.marker
|
||||
|
||||
$$($1_GENGRAPHS_MARKER): $$(BUILD_JIGSAW_TOOLS) $$(GENGRAPHS_PROPS)
|
||||
$$(call LogInfo, Running gengraphs for $$($1_NAME) API documentation)
|
||||
$$(call LogInfo, Running gengraphs for $1 documentation)
|
||||
$$(call MakeDir, $$($1_GENGRAPHS_DIR))
|
||||
$$(call ExecuteWithLog, $$($1_GENGRAPHS_DIR)/gengraphs, \
|
||||
$$(TOOL_GENGRAPHS) --spec --output $$($1_GENGRAPHS_DIR) \
|
||||
@ -310,21 +374,49 @@ endef
|
||||
################################################################################
|
||||
# Setup generation of the JDK API documentation (javadoc + modulegraph)
|
||||
|
||||
# All modules to have docs generated by docs-jdk-api target
|
||||
JDK_JAVADOC_MODULES := $(sort $(DOCS_MODULES))
|
||||
# Define the groups of the JDK API documentation
|
||||
JavaSE_GROUP_NAME := Java SE
|
||||
JavaSE_GROUP_MODULES := $(call ColonList, $(sort java.se.ee \
|
||||
$(call FindTransitiveIndirectDepsForModules, java.se.ee)))
|
||||
JavaSE_GROUP_DESCRIPTION := \
|
||||
The Java Platform, Standard Edition ("Java SE") APIs define the core Java \
|
||||
platform for general-purpose computing. These APIs are in modules with \
|
||||
names starting with the string "java.". \
|
||||
#
|
||||
JDK_GROUPS += JavaSE
|
||||
|
||||
JDK_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
|
||||
JDK_GROUP_NAME := JDK
|
||||
JDK_GROUP_MODULES := jdk.*
|
||||
JDK_GROUP_DESCRIPTION := \
|
||||
The Java Development Kit ("JDK") APIs define an implementation of the Java \
|
||||
SE Platform which may include platform-specific details. These APIs are in \
|
||||
modules with names starting with the string "jdk.". \
|
||||
#
|
||||
JDK_GROUPS += JDK
|
||||
|
||||
# If we are importing JavaFX, we need a JavaFX group. In an ideal world, this
|
||||
# would have been abstracted away to a more proper generic handling of imported
|
||||
# modules.
|
||||
ifneq ($(findstring javafx., $(IMPORTED_MODULES)), )
|
||||
JavaFX_GROUP_NAME := JavaFX
|
||||
JavaFX_GROUP_MODULES := javafx.*
|
||||
JavaFX_GROUP_DESCRIPTION := \
|
||||
The JavaFX APIs define a set of user interface (UI) controls, graphics, \
|
||||
media, and web packages for developing rich client applications. These \
|
||||
APIs are in modules with names starting with the string "javafx.". \
|
||||
#
|
||||
JDK_GROUPS += JavaFX
|
||||
endif
|
||||
|
||||
# All modules to have docs generated by docs-jdk-api target
|
||||
JDK_MODULES := $(sort $(DOCS_MODULES))
|
||||
|
||||
$(eval $(call SetupApiDocsGeneration, JDK_API, \
|
||||
MODULES := $(JDK_JAVADOC_MODULES), \
|
||||
NAME := JDK, \
|
||||
MODULES := $(JDK_MODULES), \
|
||||
GROUPS := $(JDK_GROUPS), \
|
||||
SHORT_NAME := $(JDK_SHORT_NAME), \
|
||||
LONG_NAME := $(JDK_LONG_NAME), \
|
||||
TARGET_DIR := $(DOCS_OUTPUTDIR)/api, \
|
||||
OVERVIEW := $(JDK_JAVADOC_OVERVIEW), \
|
||||
DOC_TITLE := $(JDK_JAVADOC_DOC_TITLE), \
|
||||
WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \
|
||||
HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \
|
||||
BOTTOM_TEXT := $(JAVADOC_BOTTOM), \
|
||||
TOP_TEXT := $(JAVADOC_TOP), \
|
||||
))
|
||||
|
||||
# Targets generated are returned in JDK_API_JAVADOC_TARGETS and
|
||||
@ -335,20 +427,13 @@ $(eval $(call SetupApiDocsGeneration, JDK_API, \
|
||||
|
||||
# The Java SE module scope is just java.se.ee and it's transitive indirect
|
||||
# exports.
|
||||
JAVASE_JAVADOC_MODULES := java.se.ee
|
||||
|
||||
JAVASE_JAVADOC_OVERVIEW := $(JDK_TOPDIR)/src/java.base/share/classes/overview-core.html
|
||||
JAVASE_MODULES := java.se.ee
|
||||
|
||||
$(eval $(call SetupApiDocsGeneration, JAVASE_API, \
|
||||
MODULES := $(JAVASE_JAVADOC_MODULES), \
|
||||
NAME := Java SE, \
|
||||
MODULES := $(JAVASE_MODULES), \
|
||||
SHORT_NAME := $(JAVASE_SHORT_NAME), \
|
||||
LONG_NAME := $(JAVASE_LONG_NAME), \
|
||||
TARGET_DIR := $(IMAGES_OUTPUTDIR)/javase-docs/api, \
|
||||
OVERVIEW := $(JAVASE_JAVADOC_OVERVIEW), \
|
||||
DOC_TITLE := $(JAVASE_JAVADOC_DOC_TITLE), \
|
||||
WINDOW_TITLE := $(JAVADOC_WINDOW_TITLE), \
|
||||
HEADER_TITLE := $(JAVADOC_HEADER_TITLE), \
|
||||
BOTTOM_TEXT := $(JAVADOC_BOTTOM), \
|
||||
TOP_TEXT := $(JAVADOC_TOP), \
|
||||
))
|
||||
|
||||
# Targets generated are returned in JAVASE_API_JAVADOC_TARGETS and
|
||||
|
@ -977,6 +977,17 @@ CommaList = \
|
||||
$(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1))) \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
# Converts a space separated list to a colon separated list.
|
||||
#
|
||||
# Replacing double-colon with a single colon is to workaround the issue with
|
||||
# some version of make on windows that doesn't substitute spaces with one colon
|
||||
# properly.
|
||||
ColonList = \
|
||||
$(strip \
|
||||
$(subst ::,:,$(subst $(SPACE),:,$(strip $1))) \
|
||||
)
|
||||
|
||||
################################################################################
|
||||
|
||||
# Hook to include the corresponding custom file, if present.
|
||||
|
@ -39,7 +39,6 @@ import java.util.stream.Collectors;
|
||||
* This class consists exclusively of static utility methods for invoking the
|
||||
* java compiler.
|
||||
*/
|
||||
|
||||
public final class CompilerUtils {
|
||||
private CompilerUtils() { }
|
||||
|
||||
@ -52,13 +51,21 @@ public final class CompilerUtils {
|
||||
*
|
||||
* @return true if the compilation is successful
|
||||
*
|
||||
* @throws IOException if there is an I/O error scanning the source tree or
|
||||
* creating the destination directory
|
||||
* @throws IOException
|
||||
* if there is an I/O error scanning the source tree or
|
||||
* creating the destination directory
|
||||
* @throws UnsupportedOperationException
|
||||
* if there is no system java compiler
|
||||
*/
|
||||
public static boolean compile(Path source, Path destination, String ... options)
|
||||
public static boolean compile(Path source, Path destination, String... options)
|
||||
throws IOException
|
||||
{
|
||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||
if (compiler == null) {
|
||||
// no compiler available
|
||||
throw new UnsupportedOperationException("Unable to get system java compiler. "
|
||||
+ "Perhaps, jdk.compiler module is not available.");
|
||||
}
|
||||
StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
|
||||
|
||||
List<Path> sources
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, 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
|
||||
@ -35,6 +35,7 @@ package jdk.test.lib.hprof.parser;
|
||||
import java.io.*;
|
||||
import java.util.Date;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import jdk.test.lib.hprof.model.ArrayTypeCodes;
|
||||
import jdk.test.lib.hprof.model.*;
|
||||
|
||||
@ -357,6 +358,22 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
public String printStackTraces() {
|
||||
StringBuffer output = new StringBuffer();
|
||||
for (Map.Entry<Integer, StackTrace> entry : stackTraces.entrySet()) {
|
||||
StackFrame[] frames = entry.getValue().getFrames();
|
||||
output.append("SerialNo " + entry.getKey() + "\n");
|
||||
for (int i = 0; i < frames.length; i++) {
|
||||
output.append(" " + frames[i].getClassName() + "." + frames[i].getMethodName()
|
||||
+ frames[i].getMethodSignature() + " (" + frames[i].getSourceFileName()
|
||||
+ ":" + frames[i].getLineNumber() + ")" + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(output);
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
private void skipBytes(long length) throws IOException {
|
||||
while (length > 0) {
|
||||
long skipped = in.skip(length);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2017, 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,4 +94,42 @@ public abstract class Reader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Stack Traces from a Hprof file.
|
||||
*
|
||||
* @param heapFile The name of a file containing a heap dump
|
||||
*/
|
||||
public static String getStack(String heapFile, int debugLevel)
|
||||
throws IOException {
|
||||
int dumpNumber = 1;
|
||||
int pos = heapFile.lastIndexOf('#');
|
||||
if (pos > -1) {
|
||||
String num = heapFile.substring(pos+1, heapFile.length());
|
||||
try {
|
||||
dumpNumber = Integer.parseInt(num, 10);
|
||||
} catch (java.lang.NumberFormatException ex) {
|
||||
String msg = "In file name \"" + heapFile
|
||||
+ "\", a dump number was "
|
||||
+ "expected after the :, but \""
|
||||
+ num + "\" was found instead.";
|
||||
System.err.println(msg);
|
||||
throw new IOException(msg);
|
||||
}
|
||||
heapFile = heapFile.substring(0, pos);
|
||||
}
|
||||
try (PositionDataInputStream in = new PositionDataInputStream(
|
||||
new BufferedInputStream(new FileInputStream(heapFile)))) {
|
||||
int i = in.readInt();
|
||||
if (i == HprofReader.MAGIC_NUMBER) {
|
||||
HprofReader r
|
||||
= new HprofReader(heapFile, in, dumpNumber,
|
||||
true, debugLevel);
|
||||
r.read();
|
||||
return r.printStackTraces();
|
||||
} else {
|
||||
throw new IOException("Unrecognized magic number: " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user