This commit is contained in:
Vladimir Kozlov 2013-08-16 16:21:28 -07:00
commit 61feec4939
1024 changed files with 62107 additions and 16711 deletions

View File

@ -222,3 +222,6 @@ ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96
711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98 711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98
2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99 2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99
3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100 3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100
edb01c460d4cab21ff0ff13512df7b746efaa0e7 jdk8-b101
bbe43d712fe08e650808d774861b256ccb34e500 jdk8-b102
30a1d677a20c6a95f98043d8f20ce570304e3818 jdk8-b103

View File

@ -222,3 +222,6 @@ a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97
0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98 0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98
59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99 59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99
d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100 d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100
9f74a220677dc265a724515d8e2617548cef62f1 jdk8-b101
5eb3c1dc348f72a7f84f7d9d07834e8bbe09a799 jdk8-b102
b7e64be81c8a7690703df5711f4fc2375da8a9cb jdk8-b103

File diff suppressed because it is too large Load Diff

View File

@ -412,17 +412,16 @@ AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
[ [
# keep track of c/cxx flags that we added outselves... # keep track of c/cxx flags that we added outselves...
# to prevent emitting warning... # to prevent emitting warning...
ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" TARGET_BITS_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" AC_SUBST(TARGET_BITS_FLAG)
ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
CFLAGS="${CFLAGS}${ADDED_CFLAGS}" CFLAGS="${CFLAGS} ${TARGET_BITS_FLAG}"
CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" CXXFLAGS="${CXXFLAGS} ${TARGET_BITS_FLAG}"
LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" LDFLAGS="${LDFLAGS} ${TARGET_BITS_FLAG}"
CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" CFLAGS_JDK="${CFLAGS_JDK} ${TARGET_BITS_FLAG}"
CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" CXXFLAGS_JDK="${CXXFLAGS_JDK} ${TARGET_BITS_FLAG}"
LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" LDFLAGS_JDK="${LDFLAGS_JDK} ${TARGET_BITS_FLAG}"
]) ])
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],

View File

@ -304,6 +304,7 @@ MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@
COMPILER_TYPE:=@COMPILER_TYPE@ COMPILER_TYPE:=@COMPILER_TYPE@
COMPILER_NAME:=@COMPILER_NAME@ COMPILER_NAME:=@COMPILER_NAME@
TARGET_BITS_FLAG=@TARGET_BITS_FLAG@
COMPILER_SUPPORTS_TARGET_BITS_FLAG=@COMPILER_SUPPORTS_TARGET_BITS_FLAG@ COMPILER_SUPPORTS_TARGET_BITS_FLAG=@COMPILER_SUPPORTS_TARGET_BITS_FLAG@
CC_OUT_OPTION:=@CC_OUT_OPTION@ CC_OUT_OPTION:=@CC_OUT_OPTION@

View File

@ -83,9 +83,6 @@ $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NE
$(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(call LogSetupMacroEntry,SetupIdlCompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupIdlCompilation, please update IdlCompilation.gmk))
# Remove any relative addressing in the paths.
$1_SRC := $$(abspath $$($1_SRC))
$1_BIN := $$(abspath $$($1_BIN))
# Find all existing java files and existing class files. # Find all existing java files and existing class files.
$$(eval $$(call MakeDir,$$($1_BIN))) $$(eval $$(call MakeDir,$$($1_BIN)))
$1_SRCS := $$(shell find $$($1_SRC) -name "*.idl") $1_SRCS := $$(shell find $$($1_SRC) -name "*.idl")

View File

@ -204,7 +204,7 @@ clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jd
# If the output directory was created by configure and now becomes empty, remove it as well. # If the output directory was created by configure and now becomes empty, remove it as well.
# FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh! # FIXME: tmp should not be here, fix ResetTimers instead. And remove spec.sh!
dist-clean: clean dist-clean: clean
@($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp) @($(CD) $(OUTPUT_ROOT) && $(RM) -r *spec.gmk config.* configure-arguments Makefile compare.sh spec.sh tmp javacservers)
@$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \ @$(if $(filter $(CONF_NAME),$(notdir $(OUTPUT_ROOT))), \
if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \ if test "x`$(LS) $(OUTPUT_ROOT)`" != x; then \
$(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\ $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ;\

View File

@ -222,3 +222,6 @@ c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98 3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99 3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100 8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101
528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102
49c4a777fdfd648d4c3fffc940fdb97a23108ca8 jdk8-b103

View File

@ -1,528 +0,0 @@
/*
* Copyright (c) 2004, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.encoding;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.Principal;
import org.omg.CORBA.Any;
import com.sun.org.omg.SendingContext.CodeBase;
import com.sun.corba.se.pept.protocol.MessageMediator;
import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
import com.sun.corba.se.impl.encoding.CodeSetConversion;
import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
/**
* This is delegates to the real implementation.
*
* NOTE:
*
* Before using the stream for valuetype unmarshaling, one must call
* performORBVersionSpecificInit().
*/
public abstract class CDRInputStream
extends org.omg.CORBA_2_3.portable.InputStream
implements com.sun.corba.se.impl.encoding.MarshalInputStream,
org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream
{
protected CorbaMessageMediator messageMediator;
private CDRInputStreamBase impl;
// We can move this out somewhere later. For now, it serves its purpose
// to create a concrete CDR delegate based on the GIOP version.
private static class InputStreamFactory {
public static CDRInputStreamBase newInputStream(ORB orb, GIOPVersion version)
{
switch(version.intValue()) {
case GIOPVersion.VERSION_1_0:
return new CDRInputStream_1_0();
case GIOPVersion.VERSION_1_1:
return new CDRInputStream_1_1();
case GIOPVersion.VERSION_1_2:
return new CDRInputStream_1_2();
default:
ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_ENCODING ) ;
throw wrapper.unsupportedGiopVersion( version ) ;
}
}
}
// Required for the case when a ClientResponseImpl is
// created with a SystemException due to a dead server/closed
// connection with no warning. Note that the stream will
// not be initialized in this case.
//
// Probably also required by ServerRequestImpl.
//
// REVISIT.
public CDRInputStream() {
}
public CDRInputStream(CDRInputStream is) {
impl = is.impl.dup();
impl.setParent(this);
}
public CDRInputStream(org.omg.CORBA.ORB orb,
ByteBuffer byteBuffer,
int size,
boolean littleEndian,
GIOPVersion version,
BufferManagerRead bufMgr)
{
impl = InputStreamFactory.newInputStream( (ORB)orb, version);
impl.init(orb, byteBuffer, size, littleEndian, bufMgr);
impl.setParent(this);
}
// org.omg.CORBA.portable.InputStream
public final boolean read_boolean() {
return impl.read_boolean();
}
public final char read_char() {
return impl.read_char();
}
public final char read_wchar() {
return impl.read_wchar();
}
public final byte read_octet() {
return impl.read_octet();
}
public final short read_short() {
return impl.read_short();
}
public final short read_ushort() {
return impl.read_ushort();
}
public final int read_long() {
return impl.read_long();
}
public final int read_ulong() {
return impl.read_ulong();
}
public final long read_longlong() {
return impl.read_longlong();
}
public final long read_ulonglong() {
return impl.read_ulonglong();
}
public final float read_float() {
return impl.read_float();
}
public final double read_double() {
return impl.read_double();
}
public final String read_string() {
return impl.read_string();
}
public final String read_wstring() {
return impl.read_wstring();
}
public final void read_boolean_array(boolean[] value, int offset, int length) {
impl.read_boolean_array(value, offset, length);
}
public final void read_char_array(char[] value, int offset, int length) {
impl.read_char_array(value, offset, length);
}
public final void read_wchar_array(char[] value, int offset, int length) {
impl.read_wchar_array(value, offset, length);
}
public final void read_octet_array(byte[] value, int offset, int length) {
impl.read_octet_array(value, offset, length);
}
public final void read_short_array(short[] value, int offset, int length) {
impl.read_short_array(value, offset, length);
}
public final void read_ushort_array(short[] value, int offset, int length) {
impl.read_ushort_array(value, offset, length);
}
public final void read_long_array(int[] value, int offset, int length) {
impl.read_long_array(value, offset, length);
}
public final void read_ulong_array(int[] value, int offset, int length) {
impl.read_ulong_array(value, offset, length);
}
public final void read_longlong_array(long[] value, int offset, int length) {
impl.read_longlong_array(value, offset, length);
}
public final void read_ulonglong_array(long[] value, int offset, int length) {
impl.read_ulonglong_array(value, offset, length);
}
public final void read_float_array(float[] value, int offset, int length) {
impl.read_float_array(value, offset, length);
}
public final void read_double_array(double[] value, int offset, int length) {
impl.read_double_array(value, offset, length);
}
public final org.omg.CORBA.Object read_Object() {
return impl.read_Object();
}
public final TypeCode read_TypeCode() {
return impl.read_TypeCode();
}
public final Any read_any() {
return impl.read_any();
}
public final Principal read_Principal() {
return impl.read_Principal();
}
public final int read() throws java.io.IOException {
return impl.read();
}
public final java.math.BigDecimal read_fixed() {
return impl.read_fixed();
}
public final org.omg.CORBA.Context read_Context() {
return impl.read_Context();
}
public final org.omg.CORBA.Object read_Object(java.lang.Class clz) {
return impl.read_Object(clz);
}
public final org.omg.CORBA.ORB orb() {
return impl.orb();
}
// org.omg.CORBA_2_3.portable.InputStream
public final java.io.Serializable read_value() {
return impl.read_value();
}
public final java.io.Serializable read_value(java.lang.Class clz) {
return impl.read_value(clz);
}
public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
return impl.read_value(factory);
}
public final java.io.Serializable read_value(java.lang.String rep_id) {
return impl.read_value(rep_id);
}
public final java.io.Serializable read_value(java.io.Serializable value) {
return impl.read_value(value);
}
public final java.lang.Object read_abstract_interface() {
return impl.read_abstract_interface();
}
public final java.lang.Object read_abstract_interface(java.lang.Class clz) {
return impl.read_abstract_interface(clz);
}
// com.sun.corba.se.impl.encoding.MarshalInputStream
public final void consumeEndian() {
impl.consumeEndian();
}
public final int getPosition() {
return impl.getPosition();
}
// org.omg.CORBA.DataInputStream
public final java.lang.Object read_Abstract () {
return impl.read_Abstract();
}
public final java.io.Serializable read_Value () {
return impl.read_Value();
}
public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
impl.read_any_array(seq, offset, length);
}
public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
impl.read_boolean_array(seq, offset, length);
}
public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
impl.read_char_array(seq, offset, length);
}
public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
impl.read_wchar_array(seq, offset, length);
}
public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
impl.read_octet_array(seq, offset, length);
}
public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
impl.read_short_array(seq, offset, length);
}
public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
impl.read_ushort_array(seq, offset, length);
}
public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
impl.read_long_array(seq, offset, length);
}
public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
impl.read_ulong_array(seq, offset, length);
}
public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
impl.read_ulonglong_array(seq, offset, length);
}
public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
impl.read_longlong_array(seq, offset, length);
}
public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
impl.read_float_array(seq, offset, length);
}
public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
impl.read_double_array(seq, offset, length);
}
// org.omg.CORBA.portable.ValueBase
public final String[] _truncatable_ids() {
return impl._truncatable_ids();
}
// java.io.InputStream
public final int read(byte b[]) throws IOException {
return impl.read(b);
}
public final int read(byte b[], int off, int len) throws IOException {
return impl.read(b, off, len);
}
public final long skip(long n) throws IOException {
return impl.skip(n);
}
public final int available() throws IOException {
return impl.available();
}
public final void close() throws IOException {
impl.close();
}
public final void mark(int readlimit) {
impl.mark(readlimit);
}
public final void reset() {
impl.reset();
}
public final boolean markSupported() {
return impl.markSupported();
}
public abstract CDRInputStream dup();
// Needed by TCUtility
public final java.math.BigDecimal read_fixed(short digits, short scale) {
return impl.read_fixed(digits, scale);
}
public final boolean isLittleEndian() {
return impl.isLittleEndian();
}
protected final ByteBuffer getByteBuffer() {
return impl.getByteBuffer();
}
protected final void setByteBuffer(ByteBuffer byteBuffer) {
impl.setByteBuffer(byteBuffer);
}
protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
impl.setByteBufferWithInfo(bbwi);
}
public final int getBufferLength() {
return impl.getBufferLength();
}
protected final void setBufferLength(int value) {
impl.setBufferLength(value);
}
protected final int getIndex() {
return impl.getIndex();
}
protected final void setIndex(int value) {
impl.setIndex(value);
}
public final void orb(org.omg.CORBA.ORB orb) {
impl.orb(orb);
}
public final GIOPVersion getGIOPVersion() {
return impl.getGIOPVersion();
}
public final BufferManagerRead getBufferManager() {
return impl.getBufferManager();
}
// This should be overridden by any stream (ex: IIOPInputStream)
// which wants to read values. Thus, TypeCodeInputStream doesn't
// have to do this.
public CodeBase getCodeBase() {
return null;
}
// Use Latin-1 for GIOP 1.0 or when code set negotiation was not
// performed.
protected CodeSetConversion.BTCConverter createCharBTCConverter() {
return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1,
impl.isLittleEndian());
}
// Subclasses must decide what to do here. It's inconvenient to
// make the class and this method abstract because of dup().
protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter();
// Prints the current buffer in a human readable form
void printBuffer() {
impl.printBuffer();
}
/**
* Aligns the current position on the given octet boundary
* if there are enough bytes available to do so. Otherwise,
* it just returns. This is used for some (but not all)
* GIOP 1.2 message headers.
*/
public void alignOnBoundary(int octetBoundary) {
impl.alignOnBoundary(octetBoundary);
}
// Needed by request and reply messages for GIOP versions >= 1.2 only.
public void setHeaderPadding(boolean headerPadding) {
impl.setHeaderPadding(headerPadding);
}
/**
* This must be called after determining the proper ORB version,
* and setting it on the stream's ORB instance. It can be called
* after reading the service contexts, since that is the only place
* we can get the ORB version info.
*
* Trying to unmarshal things requiring repository IDs before calling
* this will result in NullPtrExceptions.
*/
public void performORBVersionSpecificInit() {
// In the case of SystemExceptions, a stream is created
// with its default constructor (and thus no impl is set).
if (impl != null)
impl.performORBVersionSpecificInit();
}
/**
* Resets any internal references to code set converters.
* This is useful for forcing the CDR stream to reacquire
* converters (probably from its subclasses) when state
* has changed.
*/
public void resetCodeSetConverters() {
impl.resetCodeSetConverters();
}
public void setMessageMediator(MessageMediator messageMediator)
{
this.messageMediator = (CorbaMessageMediator) messageMediator;
}
public MessageMediator getMessageMediator()
{
return messageMediator;
}
// ValueInputStream -----------------------------
public void start_value() {
impl.start_value();
}
public void end_value() {
impl.end_value();
}
}

View File

@ -1,435 +0,0 @@
/*
* Copyright (c) 2004, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.encoding;
import java.io.IOException;
import java.io.Serializable;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.Principal;
import org.omg.CORBA.Any;
import com.sun.corba.se.pept.protocol.MessageMediator;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import com.sun.corba.se.impl.encoding.CodeSetConversion;
import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
/**
* This is delegates to the real implementation.
*/
public abstract class CDROutputStream
extends org.omg.CORBA_2_3.portable.OutputStream
implements com.sun.corba.se.impl.encoding.MarshalOutputStream,
org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream
{
/*
private CDROutputStreamBase impl;
protected ORB orb ;
protected ORBUtilSystemException wrapper ;
protected CorbaMessageMediator corbaMessageMediator;
// We can move this out somewhere later. For now, it serves its purpose
// to create a concrete CDR delegate based on the GIOP version.
private static class OutputStreamFactory {
public static CDROutputStreamBase newOutputStream(ORB orb, GIOPVersion version)
{
switch(version.intValue()) {
case GIOPVersion.VERSION_1_0:
return new CDROutputStream_1_0();
case GIOPVersion.VERSION_1_1:
return new CDROutputStream_1_1();
case GIOPVersion.VERSION_1_2:
return new CDROutputStream_1_2();
default:
ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_ENCODING ) ;
// REVISIT - what is appropriate? INTERNAL exceptions
// are really hard to track later.
throw wrapper.unsupportedGiopVersion( version ) ;
}
}
}
// REVISIT - These two constructors should be re-factored to better hide
// the fact that someone extending this class 'can' construct a CDROutputStream
// that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
// does _not_ use pooled ByteBuffers, see EncapsOutputStream.
// NOTE: When a stream is constructed for non-channel-backed sockets
// it notifies the constructor not to use pooled (i.e, direct)
// ByteBuffers.
public CDROutputStream(ORB orb,
GIOPVersion version,
boolean littleEndian,
BufferManagerWrite bufferManager,
byte streamFormatVersion,
boolean usePooledByteBuffers)
{
impl = OutputStreamFactory.newOutputStream(orb, version);
impl.init(orb, littleEndian, bufferManager, streamFormatVersion, usePooledByteBuffers);
impl.setParent(this);
this.orb = orb ;
this.wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_ENCODING ) ;
}
public CDROutputStream(ORB orb,
GIOPVersion version,
boolean littleEndian,
BufferManagerWrite bufferManager,
byte streamFormatVersion)
{
this(orb, version, littleEndian, bufferManager, streamFormatVersion, true);
}
*/
private ByteArrayOutputStream bos ;
private ObjectOutputStream oos ;
public JavaOutputStream()
{
bos = new ByteArrayOutputStream() ;
oos = new ObjectOutputStream( bos ) ;
}
// Provided by IIOPOutputStream and EncapsOutputStream
public org.omg.CORBA.portable.InputStream create_input_stream()
{
ObjectInputStream ois = new ByteArrayInputStream( bos.toByteArray() ) ;
return new JavaInputStream( ois ) ;
}
public final void write_boolean(boolean value) {
impl.write_boolean(value);
}
public final void write_char(char value) {
impl.write_char(value);
}
public final void write_wchar(char value) {
impl.write_wchar(value);
}
public final void write_octet(byte value) {
impl.write_octet(value);
}
public final void write_short(short value) {
impl.write_short(value);
}
public final void write_ushort(short value) {
impl.write_ushort(value);
}
public final void write_long(int value) {
impl.write_long(value);
}
public final void write_ulong(int value) {
impl.write_ulong(value);
}
public final void write_longlong(long value) {
impl.write_longlong(value);
}
public final void write_ulonglong(long value) {
impl.write_ulonglong(value);
}
public final void write_float(float value) {
impl.write_float(value);
}
public final void write_double(double value) {
impl.write_double(value);
}
public final void write_string(String value) {
impl.write_string(value);
}
public final void write_wstring(String value) {
impl.write_wstring(value);
}
public final void write_boolean_array(boolean[] value, int offset, int length) {
impl.write_boolean_array(value, offset, length);
}
public final void write_char_array(char[] value, int offset, int length) {
impl.write_char_array(value, offset, length);
}
public final void write_wchar_array(char[] value, int offset, int length) {
impl.write_wchar_array(value, offset, length);
}
public final void write_octet_array(byte[] value, int offset, int length) {
impl.write_octet_array(value, offset, length);
}
public final void write_short_array(short[] value, int offset, int length) {
impl.write_short_array(value, offset, length);
}
public final void write_ushort_array(short[] value, int offset, int length){
impl.write_ushort_array(value, offset, length);
}
public final void write_long_array(int[] value, int offset, int length) {
impl.write_long_array(value, offset, length);
}
public final void write_ulong_array(int[] value, int offset, int length) {
impl.write_ulong_array(value, offset, length);
}
public final void write_longlong_array(long[] value, int offset, int length) {
impl.write_longlong_array(value, offset, length);
}
public final void write_ulonglong_array(long[] value, int offset,int length) {
impl.write_ulonglong_array(value, offset, length);
}
public final void write_float_array(float[] value, int offset, int length) {
impl.write_float_array(value, offset, length);
}
public final void write_double_array(double[] value, int offset, int length) {
impl.write_double_array(value, offset, length);
}
public final void write_Object(org.omg.CORBA.Object value) {
impl.write_Object(value);
}
public final void write_TypeCode(TypeCode value) {
impl.write_TypeCode(value);
}
public final void write_any(Any value) {
impl.write_any(value);
}
public final void write_Principal(Principal value) {
impl.write_Principal(value);
}
public final void write(int b) throws java.io.IOException {
impl.write(b);
}
public final void write_fixed(java.math.BigDecimal value) {
impl.write_fixed(value);
}
public final void write_Context(org.omg.CORBA.Context ctx,
org.omg.CORBA.ContextList contexts) {
impl.write_Context(ctx, contexts);
}
public final org.omg.CORBA.ORB orb() {
return impl.orb();
}
// org.omg.CORBA_2_3.portable.OutputStream
public final void write_value(java.io.Serializable value) {
impl.write_value(value);
}
public final void write_value(java.io.Serializable value, java.lang.Class clz) {
impl.write_value(value, clz);
}
public final void write_value(java.io.Serializable value, String repository_id) {
impl.write_value(value, repository_id);
}
public final void write_value(java.io.Serializable value,
org.omg.CORBA.portable.BoxedValueHelper factory) {
impl.write_value(value, factory);
}
public final void write_abstract_interface(java.lang.Object obj) {
impl.write_abstract_interface(obj);
}
// java.io.OutputStream
public final void write(byte b[]) throws IOException {
impl.write(b);
}
public final void write(byte b[], int off, int len) throws IOException {
impl.write(b, off, len);
}
public final void flush() throws IOException {
impl.flush();
}
public final void close() throws IOException {
impl.close();
}
// com.sun.corba.se.impl.encoding.MarshalOutputStream
public final void start_block() {
impl.start_block();
}
public final void end_block() {
impl.end_block();
}
public final void putEndian() {
impl.putEndian();
}
public void writeTo(java.io.OutputStream s)
throws IOException
{
impl.writeTo(s);
}
public final byte[] toByteArray() {
return impl.toByteArray();
}
// org.omg.CORBA.DataOutputStream
public final void write_Abstract (java.lang.Object value) {
impl.write_Abstract(value);
}
public final void write_Value (java.io.Serializable value) {
impl.write_Value(value);
}
public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
impl.write_any_array(seq, offset, length);
}
public void setMessageMediator(MessageMediator messageMediator)
{
this.corbaMessageMediator = (CorbaMessageMediator) messageMediator;
}
public MessageMediator getMessageMediator()
{
return corbaMessageMediator;
}
// org.omg.CORBA.portable.ValueBase
public final String[] _truncatable_ids() {
return impl._truncatable_ids();
}
// Other
protected final int getSize() {
return impl.getSize();
}
protected final int getIndex() {
return impl.getIndex();
}
protected int getRealIndex(int index) {
// Used in indirections. Overridden by TypeCodeOutputStream.
return index;
}
protected final void setIndex(int value) {
impl.setIndex(value);
}
protected final ByteBuffer getByteBuffer() {
return impl.getByteBuffer();
}
protected final void setByteBuffer(ByteBuffer byteBuffer) {
impl.setByteBuffer(byteBuffer);
}
public final boolean isLittleEndian() {
return impl.isLittleEndian();
}
// XREVISIT - return to final if possible
// REVISIT - was protected - need access from msgtypes test.
public ByteBufferWithInfo getByteBufferWithInfo() {
return impl.getByteBufferWithInfo();
}
protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
impl.setByteBufferWithInfo(bbwi);
}
// REVISIT: was protected - but need to access from xgiop.
public final BufferManagerWrite getBufferManager() {
return impl.getBufferManager();
}
public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
impl.write_fixed(bigDecimal, digits, scale);
}
public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
impl.writeOctetSequenceTo(s);
}
public final GIOPVersion getGIOPVersion() {
return impl.getGIOPVersion();
}
public final void writeIndirection(int tag, int posIndirectedTo) {
impl.writeIndirection(tag, posIndirectedTo);
}
// Use Latin-1 for GIOP 1.0 or when code set negotiation was not
// performed.
protected CodeSetConversion.CTBConverter createCharCTBConverter() {
return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
}
// Subclasses must decide what to do here. It's inconvenient to
// make the class and this method abstract because of dup().
protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter();
protected final void freeInternalCaches() {
impl.freeInternalCaches();
}
void printBuffer() {
impl.printBuffer();
}
public void alignOnBoundary(int octetBoundary) {
impl.alignOnBoundary(octetBoundary);
}
// Needed by request and reply messages for GIOP versions >= 1.2 only.
public void setHeaderPadding(boolean headerPadding) {
impl.setHeaderPadding(headerPadding);
}
// ValueOutputStream -----------------------------
public void start_value(String rep_id) {
impl.start_value(rep_id);
}
public void end_value() {
impl.end_value();
}
}

View File

@ -1,164 +0,0 @@
/*
* Copyright (c) 2000, 2002, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.interceptors;
import com.sun.corba.se.impl.corba.AnyImpl;
import org.omg.PortableInterceptor.Current;
import org.omg.PortableInterceptor.InvalidSlot;
import com.sun.corba.se.impl.util.MinorCodes;
import com.sun.corba.se.impl.core.ORB;
/**
* ThreadCurrentStack is the container of PICurrent instances for each thread
*/
public class ThreadCurrentStack
{
// PICurrentPool is the container for reusable PICurrents
private class PICurrentPool {
// Contains a list of reusable PICurrents
private java.util.ArrayList pool;
// High water mark for the pool
// If the pool size reaches this limit then putPICurrent will
// not put PICurrent to the pool.
private static final int HIGH_WATER_MARK = 5;
// currentIndex points to the last PICurrent in the list
private int currentIndex;
PICurrentPool( ) {
pool = new java.util.ArrayList( HIGH_WATER_MARK );
currentIndex = 0;
}
/**
* Puts PICurrent to the re-usable pool.
*/
void putPICurrent( PICurrent current ) {
// If there are enough PICurrents in the pool, then don't add
// this current to the pool.
if( currentIndex >= HIGH_WATER_MARK ) {
return;
}
pool.add(currentIndex , current);
currentIndex++;
}
/**
* Gets PICurrent from the re-usable pool.
*/
PICurrent getPICurrent( ) {
// If there are no entries in the pool then return null
if( currentIndex == 0 ) {
return null;
}
// Works like a stack, Gets the last one added first
currentIndex--;
return (PICurrent) pool.get(currentIndex);
}
}
// Contains all the active PICurrents for each thread.
// The ArrayList is made to behave like a stack.
private java.util.ArrayList currentContainer;
// Keeps track of number of PICurrents in the stack.
private int currentIndex;
// For Every Thread there will be a pool of re-usable ThreadCurrent's
// stored in PICurrentPool
private PICurrentPool currentPool;
// The orb associated with this ThreadCurrentStack
private ORB piOrb;
/**
* Constructs the stack and and PICurrentPool
*/
ThreadCurrentStack( ORB piOrb, PICurrent current ) {
this.piOrb = piOrb;
currentIndex = 0;
currentContainer = new java.util.ArrayList( );
currentPool = new PICurrentPool( );
currentContainer.add( currentIndex, current );
currentIndex++;
}
/**
* pushPICurrent goes through the following steps
* 1: Checks to see if there is any PICurrent in PICurrentPool
* If present then use that instance to push into the ThreadCurrentStack
*
* 2:If there is no PICurrent in the pool, then creates a new one and pushes
* that into the ThreadCurrentStack
*/
void pushPICurrent( ) {
PICurrent current = currentPool.getPICurrent( );
if( current == null ) {
// get an existing PICurrent to get the slotSize
PICurrent currentTemp = peekPICurrent();
current = new PICurrent( piOrb, currentTemp.getSlotSize( ));
}
currentContainer.add( currentIndex, current );
currentIndex++;
}
/**
* popPICurrent does the following
* 1: pops the top PICurrent in the ThreadCurrentStack
*
* 2: resets the slots in the PICurrent which resets the slotvalues to
* null if there are any previous sets.
*
* 3: pushes the reset PICurrent into the PICurrentPool to reuse
*/
void popPICurrent( ) {
// Do not pop the PICurrent, If there is only one.
// This should not happen, But an extra check for safety.
if( currentIndex <= 1 ) {
throw new org.omg.CORBA.INTERNAL(
"Cannot pop the only PICurrent in the stack",
MinorCodes.CANT_POP_ONLY_CURRENT_2,
CompletionStatus.COMPLETED_NO );
}
currentIndex--;
PICurrent current = (PICurrent)currentContainer.get( currentIndex );
current.resetSlots( );
currentPool.putPICurrent( current );
}
/**
* peekPICurrent gets the top PICurrent in the ThreadCurrentStack without
* popping.
*/
PICurrent peekPICurrent( ) {
return (PICurrent) currentContainer.get( currentIndex - 1);
}
}

View File

@ -1,145 +0,0 @@
/*
* Copyright (c) 2001, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.orbutil ;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
/** This class provides just a main method. Its purpose is to allow -D arguments to
* set up the system properties when starting programs with tools like OptimizeIt that
* make this difficult or impossible.
*
* Invocation: {java launcher of some kind} DefineClass -Dxxx=yyy -Dxxx=yyy ... {class name} arg0, arg1, ...
* Result: updates system properties with -D args, then uses reflection to invoke {class name}.main with the args
*/
class DefineWrapper {
public static void main( String[] args )
{
int numberDefines = args.length ;
String className = null ;
for (int ctr=0; ctr<args.length; ctr++ ) {
String arg = args[ctr] ;
if ((arg.charAt(0) == '-') && (arg.charAt(1) == 'D')) {
int eqIndex = arg.indexOf( '=' ) ;
if (eqIndex < 0)
throw new Exception( arg + " is not a valid property assignment" ) ;
final String key = arg.subString( 2, eqIndex ) ;
final String value = arg.subStrung( eqIndex + 1 ) ;
AccessController.doPrivileged( new PrivilegedAction() {
public Object run() {
System.setProperty( key, value ) ;
return null ;
}
} ) ;
} else {
numberDefines = ctr ;
className = arg ;
break ;
}
}
if (numberDefines < args.length) {
Class cls = getMainClass( className ) ;
Method mainMethod = getMainMethod( cls ) ;
String[] newArgs = new String[ args.length - numberDefines ] ;
for (int ctr = numberDefines+1; ctr<args.length; ctr++ ) {
newArgs[ ctr-numberDefines-1 ] = args[ ctr ] ;
}
// build args to the main and call it
Object params [] = new Object [1];
params[0] = newArgs;
mainMethod.invoke(null, params);
} else {
throw new Exception( "No class name given" ) ;
}
}
private static Class getMainClass( String name )
{
// determine the class loader to be used for loading the class
// since ServerMain is going to be in JDK and we need to have this
// class to load application classes, this is required here.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null)
cl = ClassLoader.getSystemClassLoader();
try {
// determine the main class, try loading with current class loader
cls = Class.forName( className ) ;
} catch (ClassNotFoundException ex) {
// eat the exception and try to load using SystemClassLoader
cls = Class.forName( className, true, cl);
}
}
private static Method getMainMethod( Class serverClass )
{
Class argTypes[] = new Class[] { String[].class } ;
Method method = null ;
try {
method = serverClass.getDeclaredMethod( "main", argTypes ) ;
} catch (Exception exc) {
throw new Exception( "Could not get main() method: " + exc ) ;
}
if (!isPublicStaticVoid( method ))
throw new Exception( "Main method is not public static void" ) ;
return method ;
}
private static boolean isPublicStaticVoid( Method method )
{
// check modifiers: public static
int modifiers = method.getModifiers ();
if (!Modifier.isPublic (modifiers) || !Modifier.isStatic (modifiers)) {
logError( method.getName() + " is not public static" ) ;
return false ;
}
// check return type and exceptions
if (method.getExceptionTypes ().length != 0) {
logError( method.getName() + " declares exceptions" ) ;
return false ;
}
if (!method.getReturnType().equals (Void.TYPE)) {
logError( method.getName() + " does not have a void return type" ) ;
return false ;
}
return true ;
}
}

View File

@ -1,909 +0,0 @@
/*
* Copyright (c) 2004, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.presentation.rmi ;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import java.util.HashMap;
import java.util.StringTokenizer;
import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
import com.sun.corba.se.impl.presentation.rmi.IDLType ;
import com.sun.corba.se.impl.presentation.rmi.IDLTypeException ;
import com.sun.corba.se.impl.presentation.rmi.IDLTypesUtil ;
import com.sun.corba.se.impl.orbutil.ObjectUtility ;
/**
* Bidirectional translator between RMI-IIOP interface methods and
* and IDL Names.
*/
public class IDLNameTranslatorImpl implements IDLNameTranslator {
// From CORBA Spec, Table 6 Keywords.
// Note that since all IDL identifiers are case
// insensitive, java identifier comparisons to these
// will be case insensitive also.
private static String[] IDL_KEYWORDS = {
"abstract", "any", "attribute", "boolean", "case", "char",
"const", "context", "custom", "default", "double", "enum",
"exception", "factory", "FALSE", "fixed", "float", "in", "inout",
"interface", "long", "module", "native", "Object", "octet",
"oneway", "out", "private", "public", "raises", "readonly", "sequence",
"short", "string", "struct", "supports", "switch", "TRUE", "truncatable",
"typedef", "unsigned", "union", "ValueBase", "valuetype", "void",
"wchar", "wstring"
};
private static char[] HEX_DIGITS = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
private static final String UNDERSCORE = "_";
// used to mangle java inner class names
private static final String INNER_CLASS_SEPARATOR =
UNDERSCORE + UNDERSCORE;
// used to form IDL array type names
private static final String[] BASE_IDL_ARRAY_MODULE_TYPE=
new String[] { "org", "omg", "boxedRMI" } ;
private static final String BASE_IDL_ARRAY_ELEMENT_TYPE = "seq";
// used to mangling java identifiers that have a leading underscore
private static final String LEADING_UNDERSCORE_CHAR = "J";
private static final String ID_CONTAINER_CLASH_CHAR = UNDERSCORE;
// separator used between types in a mangled overloaded method name
private static final String OVERLOADED_TYPE_SEPARATOR =
UNDERSCORE + UNDERSCORE;
// string appended to attribute if it clashes with a method name
private static final String ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS =
UNDERSCORE + UNDERSCORE;
private static Set idlKeywords_;
static {
idlKeywords_ = new HashSet();
for(int i = 0; i < IDL_KEYWORDS.length; i++) {
String next = (String) IDL_KEYWORDS[i];
// Convert keyword to all caps to ease equality
// check.
String keywordAllCaps = next.toUpperCase();
idlKeywords_.add(keywordAllCaps);
}
}
//
// Instance state
//
// Remote interface for name translation.
private Class[] interf_;
// Maps used to hold name translations. These do not need to be
// synchronized since the translation is never modified after
// initialization.
private Map methodToIDLNameMap_;
private Map IDLNameToMethodMap_;
private Method[] methods_;
/**
* Return an IDLNameTranslator for the given interface.
*
* @throws IllegalStateException if given class is not a valid
* RMI/IIOP Remote Interface
*/
public static IDLNameTranslator get( Class interf )
{
return new IDLNameTranslatorImpl(new Class[] { interf } );
}
/**
* Return an IDLNameTranslator for the given interfacex.
*
* @throws IllegalStateException if given classes are not valid
* RMI/IIOP Remote Interfaces
*/
public static IDLNameTranslator get( Class[] interfaces )
{
return new IDLNameTranslatorImpl(interfaces );
}
public static String getExceptionId( Class cls )
{
// Requirements for this method:
// 1. cls must be an exception but not a RemoteException.
// 2. If cls has an IDL keyword name, an underscore is prepended (1.3.2.2).
// 3. If cls jas a leading underscore, J is prepended (1.3.2.3).
// 4. If cls has an illegal IDL ident char, it is mapped to UXXXX where
// XXXX is the unicode value in hex of the char (1.3.2.4).
// 5. double underscore for inner class (1.3.2.5).
// 6. The ID is "IDL:" + name with / separators + ":1.0".
IDLType itype = classToIDLType( cls ) ;
return itype.getExceptionName() ;
}
public Class[] getInterfaces()
{
return interf_;
}
public Method[] getMethods()
{
return methods_ ;
}
public Method getMethod( String idlName )
{
return (Method) IDLNameToMethodMap_.get(idlName);
}
public String getIDLName( Method method )
{
return (String) methodToIDLNameMap_.get(method);
}
/**
* Initialize an IDLNameTranslator for the given interface.
*
* @throws IllegalStateException if given class is not a valid
* RMI/IIOP Remote Interface
*/
private IDLNameTranslatorImpl(Class[] interfaces)
{
try {
IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
for (int ctr=0; ctr<interfaces.length; ctr++)
idlTypesUtil.validateRemoteInterface(interfaces[ctr]);
interf_ = interfaces;
buildNameTranslation();
} catch( IDLTypeException ite) {
String msg = ite.getMessage();
IllegalStateException ise = new IllegalStateException(msg);
ise.initCause(ite);
throw ise;
}
}
private void buildNameTranslation()
{
// holds method info, keyed by method
Map allMethodInfo = new HashMap() ;
for (int ctr=0; ctr<interf_.length; ctr++) {
Class interf = interf_[ctr] ;
IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
Method[] methods = interf.getMethods();
// Take an initial pass through all the methods and create some
// information that will be used to track the IDL name
// transformation.
for(int i = 0; i < methods.length; i++) {
Method nextMethod = methods[i];
IDLMethodInfo methodInfo = new IDLMethodInfo();
methodInfo.method = nextMethod;
methodInfo.propertyType =
idlTypesUtil.propertyAccessorMethodType(
nextMethod, interf ) ;
if (methodInfo.propertyType != null) {
String attributeName = idlTypesUtil.
getAttributeNameForProperty(nextMethod.getName());
methodInfo.originalName = attributeName;
methodInfo.mangledName = attributeName;
} else {
methodInfo.originalName = nextMethod.getName();
methodInfo.mangledName = nextMethod.getName();
}
allMethodInfo.put(nextMethod, methodInfo);
}
}
// Check for having both is<NAME> and get<NAME> methods.
//
// Perform case sensitivity test first. This applies to all
// method names AND attributes. Compare each method name and
// attribute to all other method names and attributes. If names
// differ only in case, apply mangling as defined in section 1.3.2.7
// of Java2IDL spec. Note that we compare using the original names.
//
for(Iterator outerIter=allMethodInfo.values().iterator();
outerIter.hasNext();) {
IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
for(Iterator innerIter = allMethodInfo.values().iterator();
innerIter.hasNext();) {
IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
if( (outer != inner) &&
(!outer.originalName.equals(inner.originalName)) &&
outer.originalName.equalsIgnoreCase(inner.originalName) ) {
outer.mangledName =
mangleCaseSensitiveCollision(outer.originalName);
break;
}
}
}
for(Iterator iter = allMethodInfo.values().iterator();
iter.hasNext();) {
IDLMethodInfo next = (IDLMethodcurrentInfo) iter.next();
next.mangledName =
mangleIdentifier(next.mangledName,
next.propertyType != null);
}
//
// Now check for overloaded method names and apply 1.3.2.6.
//
for(Iterator outerIter=allMethodInfo.values().iterator();
outerIter.hasNext();) {
IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
if (outer.propertyType != null) {
continue;
}
for(Iterator innerIter = allMethodInfo.values().iterator();
innerIter.hasNext();) {
IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
if( (outer != inner) &&
(inner.propertyType == null) &&
outer.originalName.equals(inner.originalName) ) {
outer.mangledName = mangleOverloadedMethod
(outer.mangledName, outer.method);
break;
}
}
}
//
// Now mangle any properties that clash with method names.
//
for(Iterator outerIter=allMethodInfo.values().iterator();
outerIter.hasNext();) {
IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
if(outer.propertyType == null) {
continue;
}
for(Iterator innerIter = allMethodInfo.values().iterator();
innerIter.hasNext();) {
IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
if( (outer != inner) &&
(inner.propertyType == null) &&
outer.mangledName.equals(inner.mangledName) ) {
outer.mangledName = outer.mangledName +
ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS;
break;
}
}
}
//
// Ensure that no mapped method names clash with mapped name
// of container(1.3.2.9). This is a case insensitive comparison.
//
for (int ctr=0; ctr<interf_.length; ctr++ ) {
Class interf = interf_[ctr] ;
String mappedContainerName = getMappedContainerName(interf);
for(Iterator iter = allMethodInfo.values().iterator();
iter.hasNext();) {
IDLMethodInfo next = (IDLMethodInfo) iter.next();
if( (next.propertyType == null) &&
identifierClashesWithContainer(mappedContainerName,
next.mangledName)) {
next.mangledName = mangleContainerClash(next.mangledName);
}
}
}
//
// Populate name translation maps.
//
methodToIDLNameMap_ = new HashMap();
IDLNameToMethodMap_ = new HashMap();
methods_ = (Method[])allMethodInfo.keySet().toArray(
new Method[0] ) ;
for(Iterator iter = allMethodInfo.values().iterator();
iter.hasNext();) {
IDLMethodInfo next = (IDLMethodInfo) iter.next();
String idlName = next.mangledName;
if (next.propertyType != null) {
idlName = javaPropertyPrefixToIDL( next.propertyType ) +
next.mangledName ;
}
methodToIDLNameMap_.put(next.method, idlName);
// Final check to see if there are any clashes after all the
// manglings have been applied. If so, this is treated as an
// invalid interface. Currently, we do a CASE-SENSITIVE
// comparison since that matches the rmic behavior.
// @@@ Shouldn't this be a case-insensitive check?
// If there is a collision between is<TYPE> and get<TYPE>,
// map only is<TYPE> to an attribute, and leave the
// get<TYPE> method alone.
if( IDLNameToMethodMap_.containsKey(idlName) ) {
// @@@ I18N
Method clash = (Method) IDLNameToMethodMap_.get(idlName);
MethodInfo clashMethodInfo =
(MethodInfo)allMethodInfo.get( clash ) ;
if (clashMethodInfo.isBooleanProperty() &&
next.isReadProperty()) {
// fix idlName
} else if (clashMethodInfo.isReadProperty() &&
next.isBooleanProperty()) {
// Remove entry under idlName
// put entry into table under correct name
} else {
throw new IllegalStateException("Error : methods " +
clash + " and " + next.method +
" both result in IDL name '" + idlName + "'");
}
}
IDLNameToMethodMap_.put(idlName, next.method);
}
return;
}
/**
* Perform all necessary stand-alone identifier mangling operations
* on a java identifier that is being transformed into an IDL name.
* That is, mangling operations that don't require looking at anything
* else but the identifier itself. This covers sections 1.3.2.2, 1.3.2.3,
* and 1.3.2.4 of the Java2IDL spec. Method overloading and
* case-sensitivity checks are handled elsewhere.
*/
private static String mangleIdentifier(String identifier) {
return mangleIdentifier(identifier, false);
}
private static String mangleIdentifier(String identifier, boolean attribute) {
String mangledName = identifier;
//
// Apply leading underscore test (1.3.2.3)
// This should be done before IDL Keyword clash test, since clashing
// IDL keywords are mangled by adding a leading underscore.
//
if( hasLeadingUnderscore(mangledName) ) {
mangledName = mangleLeadingUnderscore(mangledName);
}
//
// Apply IDL keyword clash test (1.3.2.2).
// This is not needed for attributes since when the full property
// name is composed it cannot clash with an IDL keyword.
// (Also, rmic doesn't do it.)
//
if( !attribute && isIDLKeyword(mangledName) ) {
mangledName = mangleIDLKeywordClash(mangledName);
}
//
// Replace illegal IDL identifier characters (1.3.2.4)
// for all method names and attributes.
//
if( !isIDLIdentifier(mangledName) ) {
mangledName = mangleUnicodeChars(mangledName);
}
return mangledName;
}
/**
* Checks whether a java identifier clashes with an
* IDL keyword. Note that this is a case-insensitive
* comparison.
*
* Used to implement section 1.3.2.2 of Java2IDL spec.
*/
private static boolean isIDLKeyword(String identifier) {
String identifierAllCaps = identifier.toUpperCase();
return idlKeywords_.contains(identifierAllCaps);
}
private static String mangleIDLKeywordClash(String identifier) {
return UNDERSCORE + identifier;
}
private static String mangleLeadingUnderscore(String identifier) {
return LEADING_UNDERSCORE_CHAR + identifier;
}
/**
* Checks whether a java identifier starts with an underscore.
* Used to implement section 1.3.2.3 of Java2IDL spec.
*/
private static boolean hasLeadingUnderscore(String identifier) {
return identifier.startsWith(UNDERSCORE);
}
/**
* Implements Section 1.3.2.4 of Java2IDL Mapping.
* All non-IDL identifier characters must be replaced
* with their Unicode representation.
*/
static String mangleUnicodeChars(String identifier) {
StringBuffer mangledIdentifier = new StringBuffer();
for(int i = 0; i < identifier.length(); i++) {
char nextChar = identifier.charAt(i);
if( isIDLIdentifierChar(nextChar) ) {
mangledIdentifier.append(nextChar);
} else {
String unicode = charToUnicodeRepresentation(nextChar);
mangledIdentifier.append(unicode);
}
}
return mangledIdentifier.toString();
}
/**
* Implements mangling portion of Section 1.3.2.7 of Java2IDL spec.
* This method only deals with the actual mangling. Decision about
* whether case-sensitive collision mangling is required is made
* elsewhere.
*
*
* "...a mangled name is generated consisting of the original name
* followed by an underscore separated list of decimal indices
* into the string, where the indices identify all the upper case
* characters in the original string. Indices are zero based."
*
*/
String mangleCaseSensitiveCollision(String identifier) {
StringBuffer mangledIdentifier = new StringBuffer(identifier);
// There is always at least one trailing underscore, whether or
// not the identifier has uppercase letters.
mangledIdentifier.append(UNDERSCORE);
boolean needUnderscore = false;
for(int i = 0; i < identifier.length(); i++) {
char next = identifier.charAt(i);
if( Character.isUpperCase(next) ) {
// This bit of logic is needed to ensure that we have
// an underscore separated list of indices but no
// trailing underscores. Basically, after we have at least
// one uppercase letter, we always put an undercore before
// printing the next one.
if( needUnderscore ) {
mangledIdentifier.append(UNDERSCORE);
}
mangledIdentifier.append(i);
needUnderscore = true;
}
}
return mangledIdentifier.toString();
}
private static String mangleContainerClash(String identifier) {
return identifier + ID_CONTAINER_CLASH_CHAR;
}
/**
* Implements Section 1.3.2.9 of Java2IDL Mapping. Container in this
* context means the name of the java Class(excluding package) in which
* the identifier is defined. Comparison is case-insensitive.
*/
private static boolean identifierClashesWithContainer
(String mappedContainerName, String identifier) {
return identifier.equalsIgnoreCase(mappedContainerName);
}
/**
* Returns Unicode mangling as defined in Section 1.3.2.4 of
* Java2IDL spec.
*
* "For Java identifiers that contain illegal OMG IDL identifier
* characters such as '$' or Unicode characters outside of ISO Latin 1,
* any such illegal characters are replaced by "U" followed by the
* 4 hexadecimal characters(in upper case) representing the Unicode
* value. So, the Java name a$b is mapped to aU0024b and
* x\u03bCy is mapped to xU03BCy."
*/
public static String charToUnicodeRepresentation(char c) {
int orig = (int) c;
StringBuffer hexString = new StringBuffer();
int value = orig;
while( value > 0 ) {
int div = value / 16;
int mod = value % 16;
hexString.insert(0, HEX_DIGITS[mod]);
value = div;
}
int numZerosToAdd = 4 - hexString.length();
for(int i = 0; i < numZerosToAdd; i++) {
hexString.insert(0, "0");
}
hexString.insert(0, "U");
return hexString.toString();
}
private static boolean isIDLIdentifier(String identifier) {
boolean isIdentifier = true;
for(int i = 0; i < identifier.length(); i++) {
char nextChar = identifier.charAt(i);
// 1st char must be alphbetic.
isIdentifier = (i == 0) ?
isIDLAlphabeticChar(nextChar) :
isIDLIdentifierChar(nextChar);
if( !isIdentifier ) {
break;
}
}
return isIdentifier;
}
private static boolean isIDLIdentifierChar(char c) {
return (isIDLAlphabeticChar(c) ||
isIDLDecimalDigit(c) ||
isUnderscore(c));
}
/**
* True if character is one of 114 Alphabetic characters as
* specified in Table 2 of Chapter 3 in CORBA spec.
*/
private static boolean isIDLAlphabeticChar(char c) {
// NOTE that we can't use the java.lang.Character
// isUpperCase, isLowerCase, etc. methods since they
// include many characters other than the Alphabetic list in
// the CORBA spec. Instead, we test for inclusion in the
// Unicode value ranges for the corresponding legal characters.
boolean alphaChar =
(
// A - Z
((c >= 0x0041) && (c <= 0x005A))
||
// a - z
((c >= 0x0061) && (c <= 0x007A))
||
// other letter uppercase, other letter lowercase, which is
// the entire upper half of C1 Controls except X and /
((c >= 0x00C0) && (c <= 0x00FF)
&& (c != 0x00D7) && (c != 0x00F7)));
return alphaChar;
}
/**
* True if character is one of 10 Decimal Digits
* specified in Table 3 of Chapter 3 in CORBA spec.
*/
private static boolean isIDLDecimalDigit(char c) {
return ( (c >= 0x0030) && (c <= 0x0039) );
}
private static boolean isUnderscore(char c) {
return ( c == 0x005F );
}
/**
* Mangle an overloaded method name as defined in Section 1.3.2.6 of
* Java2IDL spec. Current value of method name is passed in as argument.
* We can't start from original method name since the name might have
* been partially mangled as a result of the other rules.
*/
private static String mangleOverloadedMethod(String mangledName, Method m) {
IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
// Start by appending the separator string
String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR;
Class[] parameterTypes = m.getParameterTypes();
for(int i = 0; i < parameterTypes.length; i++) {
Class nextParamType = parameterTypes[i];
if( i > 0 ) {
newMangledName = newMangledName + OVERLOADED_TYPE_SEPARATOR;
}
IDLType idlType = classToIDLType(nextParamType);
String moduleName = idlType.getModuleName();
String memberName = idlType.getMemberName();
String typeName = (moduleName.length() > 0) ?
moduleName + UNDERSCORE + memberName : memberName;
if( !idlTypesUtil.isPrimitive(nextParamType) &&
(idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType)
== null) &&
isIDLKeyword(typeName) ) {
typeName = mangleIDLKeywordClash(typeName);
}
typeName = mangleUnicodeChars(typeName);
newMangledName = newMangledName + typeName;
}
return newMangledName;
}
private static IDLType classToIDLType(Class c) {
IDLType idlType = null;
IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
if( idlTypesUtil.isPrimitive(c) ) {
idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c);
} else if( c.isArray() ) {
// Calculate array depth, as well as base element type.
Class componentType = c.getComponentType();
int numArrayDimensions = 1;
while(componentType.isArray()) {
componentType = componentType.getComponentType();
numArrayDimensions++;
}
IDLType componentIdlType = classToIDLType(componentType);
String[] modules = BASE_IDL_ARRAY_MODULE_TYPE;
if( componentIdlType.hasModule() ) {
modules = (String[])ObjectUtility.concatenateArrays( modules,
componentIdlType.getModules() ) ;
}
String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE +
numArrayDimensions + UNDERSCORE +
componentIdlType.getMemberName();
idlType = new IDLType(c, modules, memberName);
} else {
idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c);
if (idlType == null) {
// Section 1.3.2.5 of Java2IDL spec defines mangling rules for
// inner classes.
String memberName = getUnmappedContainerName(c);
// replace inner class separator with double underscore
memberName = memberName.replaceAll("\\$",
INNER_CLASS_SEPARATOR);
if( hasLeadingUnderscore(memberName) ) {
memberName = mangleLeadingUnderscore(memberName);
}
// Get raw package name. If there is a package, it
// will still have the "." separators and none of the
// mangling rules will have been applied.
String packageName = getPackageName(c);
if (packageName == null) {
idlType = new IDLType( c, memberName ) ;
} else {
// If this is a generated IDL Entity Type we need to
// prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9
if (idlTypesUtil.isEntity(c)) {
packageName = "org.omg.boxedIDL." + packageName ;
}
// Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines
// rules for mapping java packages to IDL modules and for
// mangling module name portion of type name. NOTE that
// of the individual identifier mangling rules,
// only the leading underscore test is done here.
// The other two(IDL Keyword, Illegal Unicode chars) are
// done in mangleOverloadedMethodName.
StringTokenizer tokenizer =
new StringTokenizer(packageName, ".");
String[] modules = new String[ tokenizer.countTokens() ] ;
int index = 0 ;
while (tokenizer.hasMoreElements()) {
String next = tokenizer.nextToken();
String nextMangled = hasLeadingUnderscore(next) ?
mangleLeadingUnderscore(next) : next;
modules[index++] = nextMangled ;
}
idlType = new IDLType(c, modules, memberName);
}
}
}
return idlType;
}
/**
* Return Class' package name or null if there is no package.
*/
private static String getPackageName(Class c) {
Package thePackage = c.getPackage();
String packageName = null;
// Try to get package name by introspection. Some classloaders might
// not provide this information, so check for null.
if( thePackage != null ) {
packageName = thePackage.getName();
} else {
// brute force method
String fullyQualifiedClassName = c.getName();
int lastDot = fullyQualifiedClassName.indexOf('.');
packageName = (lastDot == -1) ? null :
fullyQualifiedClassName.substring(0, lastDot);
}
return packageName;
}
private static String getMappedContainerName(Class c) {
String unmappedName = getUnmappedContainerName(c);
return mangleIdentifier(unmappedName);
}
/**
* Return portion of class name excluding package name.
*/
private static String getUnmappedContainerName(Class c) {
String memberName = null;
String packageName = getPackageName(c);
String fullyQualifiedClassName = c.getName();
if( packageName != null ) {
int packageLength = packageName.length();
memberName = fullyQualifiedClassName.substring(packageLength + 1);
} else {
memberName = fullyQualifiedClassName;
}
return memberName;
}
/**
* Internal helper class for tracking information related to each
* interface method while we're building the name translation table.
*/
private static class IDLMethodInfo
{
public Method method;
public String propertyType;
// If this is a property, originalName holds the original
// attribute name. Otherwise, it holds the original method name.
public String originalName;
// If this is a property, mangledName holds the mangled attribute
// name. Otherwise, it holds the mangled method name.
public String mangledName;
}
public String toString() {
StringBuffer contents = new StringBuffer();
contents.append("IDLNameTranslator[" );
for( int ctr=0; ctr<interf_.length; ctr++) {
if (ctr != 0)
contents.append( " " ) ;
contents.append( interf_[ctr].getName() ) ;
}
contents.append("]\n");
for(Iterator iter = methodToIDLNameMap_.keySet().iterator();
iter.hasNext();) {
Method method = (Method) iter.next();
String idlName = (String) methodToIDLNameMap_.get(method);
contents.append(idlName + ":" + method + "\n");
}
return contents.toString();
}
public static void main(String[] args) {
Class remoteInterface = java.rmi.Remote.class;
if( args.length > 0 ) {
String className = args[0];
try {
remoteInterface = Class.forName(className);
} catch(Exception e) {
e.printStackTrace();
System.exit(-1);
}
}
System.out.println("Building name translation for " + remoteInterface);
try {
IDLNameTranslator nameTranslator =
IDLNameTranslatorImpl.get(remoteInterface);
System.out.println(nameTranslator);
} catch(IllegalStateException ise) {
ise.printStackTrace();
}
}
}

View File

@ -1,544 +0,0 @@
/*
* Copyright (c) 2004, 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.presentation.rmi ;
import java.lang.reflect.Method;
import java.lang.reflect.Field;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
/**
* Utility class for testing RMI/IDL Types as defined in
* Section 1.2 of The Java Language to IDL Mapping. Note that
* these are static checks only. Runtime checks, such as those
* described in Section 1.2.3, #3, are not covered.
*/
public class IDLTypesUtil {
public static final String JAVA_GET_PROPERTY_PREFIX = "get";
public static final String JAVA_SET_PROPERTY_PREFIX = "set";
public static final String JAVA_IS_PROPERTY_PREFIX = "is";
public static final int VALID_TYPE = 0;
public static final int INVALID_TYPE = 1;
/**
* Validate a class to ensure it conforms to the rules for a
* Java RMI/IIOP interface.
*
* @throws IDLTypeException if not a valid RMI/IIOP interface.
*/
public void validateRemoteInterface(Class c) throws IDLTypeException
{
if( c == null ) {
throw new IllegalArgumentException();
}
if( !c.isInterface() ) {
String msg = "Class " + c + " must be a java interface.";
throw new IDLTypeException(msg);
}
if( !java.rmi.Remote.class.isAssignableFrom(c) ) {
String msg = "Class " + c + " must extend java.rmi.Remote, " +
"either directly or indirectly.";
throw new IDLTypeException(msg);
}
// Get all methods, including super-interface methods.
Method[] methods = c.getMethods();
for(int i = 0; i < methods.length; i++) {
Method next = methods[i];
validateExceptions(next);
}
// Removed because of bug 4989053
// validateDirectInterfaces(c);
validateConstants(c);
return;
}
public boolean isRemoteInterface(Class c)
{
boolean remoteInterface = true;
try {
validateRemoteInterface(c);
} catch(IDLTypeException ite) {
remoteInterface = false;
}
return remoteInterface;
}
/**
* Section 1.2.2 Primitive Types
*/
public boolean isPrimitive(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
return c.isPrimitive();
}
/**
* Section 1.2.4
*/
public boolean isValue(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
return
(!c.isInterface() &&
java.io.Serializable.class.isAssignableFrom(c) &&
!java.rmi.Remote.class.isAssignableFrom(c));
}
/**
* Section 1.2.5
*/
public boolean isArray(Class c)
{
boolean arrayType = false;
if( c == null ) {
throw new IllegalArgumentException();
}
if( c.isArray() ) {
Class componentType = c.getComponentType();
arrayType =
(isPrimitive(componentType) || isRemoteInterface(componentType) ||
isEntity(componentType) || isException(componentType) ||
isValue(componentType) || isObjectReference(componentType) );
}
return arrayType;
}
/**
* Section 1.2.6
*/
public boolean isException(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
// Must be a checked exception, not including RemoteException or
// its subclasses.
return isCheckedException(c) && !isRemoteException(c) && isValue(c);
}
public boolean isRemoteException(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
return java.rmi.RemoteException.class.isAssignableFrom(c) ;
}
public boolean isCheckedException(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
return Throwable.class.isAssignableFrom(c) &&
!RuntimeException.class.isAssignableFrom(c) &&
!Error.class.isAssignableFrom(c) ;
}
/**
* Section 1.2.7
*/
public boolean isObjectReference(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
return (c.isInterface() &&
org.omg.CORBA.Object.class.isAssignableFrom(c));
}
/**
* Section 1.2.8
*/
public boolean isEntity(Class c)
{
if( c == null ) {
throw new IllegalArgumentException();
}
Class superClass = c.getSuperclass();
return (!c.isInterface() &&
(superClass != null) &&
(org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c)));
}
public String javaPropertyPrefixToIDL( String javaPrefix )
{
return "_" + javaPrefix + "_" ;
}
/**
* Return the property type if given method is legal property accessor as defined in
* Section 1.3.4.3 of Java2IDL spec. Result is one of: JAVA_GET_PROPERTY_PREFIX,
* JAVA_SET_PROPERTY_PREFIX, JAVA_IS_PROPERTY_PREFIX.
*/
public String propertyAccessorMethodType(Method m, Class c) {
String methodName = m.getName();
Class returnType = m.getReturnType();
Class[] parameters = m.getParameterTypes();
Class[] exceptionTypes = m.getExceptionTypes();
String propertyType = null;
if( methodName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) {
if((parameters.length == 0) && (returnType != Void.TYPE) &&
!hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX) {
propertyType = JAVA_GET_PROPERTY_PREFIX;
}
} else if( methodName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) {
if((returnType == Void.TYPE) && (parameters.length == 1)) {
if (hasCorrespondingReadProperty(m, c, JAVA_GET_PROPERTY_PREFIX) ||
hasCorrespondingReadProperty(m, c, JAVA_IS_PROPERTY_PREFIX)) {
propertyType = JAVA_SET_PROPERTY_PREFIX;
}
}
} else if( methodName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) {
if((parameters.length == 0) && (returnType == Boolean.TYPE)) {
propertyType = JAVA_IS_PROPERTY_PREFIX;
}
}
// Some final checks that apply to all properties.
if( propertyType != null ) {
if(!validPropertyExceptions(m) ||
(methodName.length() <= propertyType.length())) {
propertyType = null;
}
}
return propertyType ;
}
private boolean hasCorrespondingReadProperty
(Method writeProperty, Class c, String readPropertyPrefix) {
String writePropertyMethodName = writeProperty.getName();
Class[] writePropertyParameters = writeProperty.getParameterTypes();
boolean foundReadProperty = false;
try {
// Look for a valid corresponding Read property
String readPropertyMethodName =
writePropertyMethodName.replaceFirst
(JAVA_SET_PROPERTY_PREFIX, readPropertyPrefix);
Method readPropertyMethod = c.getMethod(readPropertyMethodName,
new Class[] {});
foundReadProperty =
((propertyAccessorMethodType(readPropertyMethod, c) != null) &&
(readPropertyMethod.getReturnType() ==
writePropertyParameters[0]));
} catch(Exception e) {
// ignore. this means we didn't find a corresponding get property.
}
return foundReadProperty;
}
public String getAttributeNameForProperty(String propertyName) {
String attributeName = null;
String prefix = null;
if( propertyName.startsWith(JAVA_GET_PROPERTY_PREFIX) ) {
prefix = JAVA_GET_PROPERTY_PREFIX;
} else if( propertyName.startsWith(JAVA_SET_PROPERTY_PREFIX) ) {
prefix = JAVA_SET_PROPERTY_PREFIX;
} else if( propertyName.startsWith(JAVA_IS_PROPERTY_PREFIX) ) {
prefix = JAVA_IS_PROPERTY_PREFIX;
}
if( (prefix != null) && (prefix.length() < propertyName.length()) ) {
String remainder = propertyName.substring(prefix.length());
if( (remainder.length() >= 2) &&
Character.isUpperCase(remainder.charAt(0)) &&
Character.isUpperCase(remainder.charAt(1)) ) {
// don't set the first letter to lower-case if the
// first two are upper-case
attributeName = remainder;
} else {
attributeName = Character.toLowerCase(remainder.charAt(0)) +
remainder.substring(1);
}
}
return attributeName;
}
/**
* Return IDL Type name for primitive types as defined in
* Section 1.3.3 of Java2IDL spec or null if not a primitive type.
*/
public IDLType getPrimitiveIDLTypeMapping(Class c) {
if( c == null ) {
throw new IllegalArgumentException();
}
if( c.isPrimitive() ) {
if( c == Void.TYPE ) {
return new IDLType( c, "void" ) ;
} else if( c == Boolean.TYPE ) {
return new IDLType( c, "boolean" ) ;
} else if( c == Character.TYPE ) {
return new IDLType( c, "wchar" ) ;
} else if( c == Byte.TYPE ) {
return new IDLType( c, "octet" ) ;
} else if( c == Short.TYPE ) {
return new IDLType( c, "short" ) ;
} else if( c == Integer.TYPE ) {
return new IDLType( c, "long" ) ;
} else if( c == Long.TYPE ) {
return new IDLType( c, "long_long" ) ;
} else if( c == Float.TYPE ) {
return new IDLType( c, "float" ) ;
} else if( c == Double.TYPE ) {
return new IDLType( c, "double" ) ;
}
}
return null;
}
/**
* Return IDL Type name for special case type mappings as defined in
* Table 1-1 of Java2IDL spec or null if given class is not a special
* type.
*/
public IDLType getSpecialCaseIDLTypeMapping(Class c) {
if( c == null ) {
throw new IllegalArgumentException();
}
if( c == java.lang.Object.class ) {
return new IDLType( c, new String[] { "java", "lang" },
"Object" ) ;
} else if( c == java.lang.String.class ) {
return new IDLType( c, new String[] { "CORBA" },
"WStringValue" ) ;
} else if( c == java.lang.Class.class ) {
return new IDLType( c, new String[] { "javax", "rmi", "CORBA" },
"ClassDesc" ) ;
} else if( c == java.io.Serializable.class ) {
return new IDLType( c, new String[] { "java", "io" },
"Serializable" ) ;
} else if( c == java.io.Externalizable.class ) {
return new IDLType( c, new String[] { "java", "io" },
"Externalizable" ) ;
} else if( c == java.rmi.Remote.class ) {
return new IDLType( c, new String[] { "java", "rmi" },
"Remote" ) ;
} else if( c == org.omg.CORBA.Object.class ) {
return new IDLType( c, "Object" ) ;
} else {
return null;
}
}
/**
* Implements 1.2.3 #2 and #4
*/
private void validateExceptions(Method method) throws IDLTypeException {
Class[] exceptions = method.getExceptionTypes();
boolean declaresRemoteExceptionOrSuperClass = false;
// Section 1.2.3, #2
for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
Class exception = exceptions[eIndex];
if( isRemoteExceptionOrSuperClass(exception) ) {
declaresRemoteExceptionOrSuperClass = true;
break;
}
}
if( !declaresRemoteExceptionOrSuperClass ) {
String msg = "Method '" + method + "' must throw at least one " +
"exception of type java.rmi.RemoteException or one of its " +
"super-classes";
throw new IDLTypeException(msg);
}
// Section 1.2.3, #4
// See also bug 4972402
// For all exceptions E in exceptions,
// (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) )
for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
Class exception = exceptions[eIndex];
if (isCheckedException(exception) && !isValue(exception) &&
!isRemoteException(exception))
{
String msg = "Exception '" + exception + "' on method '" +
method + "' is not a allowed RMI/IIOP exception type";
throw new IDLTypeException(msg);
}
}
return;
}
/**
* Returns true if the method's throw clause conforms to the exception
* restrictions for properties as defined in Section 1.3.4.3 of
* Java2IDL spec. This means that for all exceptions E declared on the
* method, E isChecked => RemoteException.isAssignableFrom( E ).
*/
private boolean validPropertyExceptions(Method method)
{
Class[] exceptions = method.getExceptionTypes();
for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
Class exception = exceptions[eIndex];
if (isCheckedException(exception) && !isRemoteException(exception))
return false ;
}
return true;
}
/**
* Implements Section 1.2.3, #2.
*/
private boolean isRemoteExceptionOrSuperClass(Class c) {
return
((c == java.rmi.RemoteException.class) ||
(c == java.io.IOException.class) ||
(c == java.lang.Exception.class) ||
(c == java.lang.Throwable.class));
}
/**
* Implements Section 1.2.3, #5.
*/
private void validateDirectInterfaces(Class c) throws IDLTypeException {
Class[] directInterfaces = c.getInterfaces();
if( directInterfaces.length < 2 ) {
return;
}
Set allMethodNames = new HashSet();
Set currentMethodNames = new HashSet();
for(int i = 0; i < directInterfaces.length; i++) {
Class next = directInterfaces[i];
Method[] methods = next.getMethods();
// Comparison is based on method names only. First collect
// all methods from current interface, eliminating duplicate
// names.
currentMethodNames.clear();
for(int m = 0; m < methods.length; m++) {
currentMethodNames.add(methods[m].getName());
}
// Now check each method against list of all unique method
// names processed so far.
for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) {
String methodName = (String) iter.next();
if( allMethodNames.contains(methodName) ) {
String msg = "Class " + c + " inherits method " +
methodName + " from multiple direct interfaces.";
throw new IDLTypeException(msg);
} else {
allMethodNames.add(methodName);
}
}
}
return;
}
/**
* Implements 1.2.3 #6
*/
private void validateConstants(final Class c)
throws IDLTypeException {
Field[] fields = null;
try {
fields = (Field[])
java.security.AccessController.doPrivileged
(new java.security.PrivilegedExceptionAction() {
public java.lang.Object run() throws Exception {
return c.getFields();
}
});
} catch(java.security.PrivilegedActionException pae) {
IDLTypeException ite = new IDLTypeException();
ite.initCause(pae);
throw ite;
}
for(int i = 0; i < fields.length; i++) {
Field next = fields[i];
Class fieldType = next.getType();
if( (fieldType != java.lang.String.class) &&
!isPrimitive(fieldType) ) {
String msg = "Constant field '" + next.getName() +
"' in class '" + next.getDeclaringClass().getName() +
"' has invalid type' " + next.getType() + "'. Constants" +
" in RMI/IIOP interfaces can only have primitive" +
" types and java.lang.String types.";
throw new IDLTypeException(msg);
}
}
return;
}
}

View File

@ -1,138 +0,0 @@
/*
* Copyright (c) 1999, 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.iiop;
import com.sun.corba.se.impl.protocol.Request;
import com.sun.corba.se.impl.core.ClientRequest;
import com.sun.corba.se.impl.core.ServiceContext;
import com.sun.corba.se.impl.core.ServiceContexts;
import com.sun.corba.se.impl.core.ClientResponse;
import com.sun.corba.se.impl.core.ServerRequest;
import com.sun.corba.se.impl.core.ServerResponse;
import com.sun.corba.se.impl.corba.IOR;
import com.sun.corba.se.impl.corba.GIOPVersion;
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.impl.core.ORBVersion;
import com.sun.corba.se.impl.core.ORB;
import com.sun.corba.se.impl.orbutil.ORBUtility;
import com.sun.corba.se.impl.ior.ObjectKeyFactory ;
import com.sun.corba.se.impl.ior.ObjectKey ;
import com.sun.corba.se.impl.ior.ObjectKeyTemplate ;
import com.sun.corba.se.impl.ior.IIOPProfile;
public class LocalClientRequestImpl extends IIOPOutputStream
implements ClientRequest
{
public LocalClientRequestImpl( GIOPVersion gv,
ORB orb, IOR ior, short addrDisposition,
String operationName, boolean oneway, ServiceContexts svc,
int requestId, byte streamFormatVersion)
{
super(gv,
orb,
null,
BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW),
streamFormatVersion);
this.isOneway = oneway;
boolean responseExpected = !isOneway;
IIOPProfile iop = ior.getProfile();
ObjectKey okey = iop.getObjectKey();
ObjectKeyTemplate oktemp = okey.getTemplate() ;
ORBVersion version = oktemp.getORBVersion() ;
orb.setORBVersion( version ) ;
this.request = MessageBase.createRequest(orb, gv, requestId,
responseExpected, ior, addrDisposition, operationName, svc, null);
setMessage(request);
request.write(this);
// mark beginning of msg body for possible later use
bodyBegin = getSize();
}
public int getRequestId() {
return request.getRequestId();
}
public boolean isOneWay() {
return isOneway;
}
public ServiceContexts getServiceContexts() {
return request.getServiceContexts();
}
public String getOperationName() {
return request.getOperation();
}
public ObjectKey getObjectKey() {
return request.getObjectKey();
}
public ServerRequest getServerRequest()
{
// Set the size of the marshalled data in the message header.
getMessage().setSize( getByteBuffer(), getSize() ) ;
// Construct a new ServerRequest out of the buffer in this ClientRequest
LocalServerRequestImpl serverRequest = new LocalServerRequestImpl(
(ORB)orb(), toByteArray(), request ) ;
// Skip over all of the GIOP header information. This positions
// the offset in the buffer so that the skeleton can correctly read
// the marshalled arguments.
serverRequest.setIndex( bodyBegin ) ;
return serverRequest ;
}
public ClientResponse invoke()
{
ORB myORB = (ORB)orb() ;
ServerResponse serverResponse = myORB.process( getServerRequest() ) ;
LocalServerResponseImpl lsr = (LocalServerResponseImpl)serverResponse ;
return lsr.getClientResponse() ;
}
/**
* Check to see if the request is local.
*/
public boolean isLocal(){
return true;
}
private RequestMessage request;
private int bodyBegin;
private boolean isOneway;
}

View File

@ -1,162 +0,0 @@
/*
* Copyright (c) 1999, 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.iiop;
import java.io.IOException;
import org.omg.CORBA.SystemException;
import org.omg.CORBA.CompletionStatus;
import com.sun.corba.se.impl.core.Response;
import com.sun.corba.se.impl.core.ClientResponse;
import com.sun.corba.se.impl.corba.IOR;
import com.sun.corba.se.impl.core.ORB;
import com.sun.corba.se.impl.core.ServiceContext;
import com.sun.corba.se.impl.core.ServiceContexts;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
import com.sun.corba.se.impl.orbutil.MinorCodes;
class LocalClientResponseImpl extends IIOPInputStream implements ClientResponse
{
LocalClientResponseImpl(ORB orb, byte[] buf, ReplyMessage header)
{
super(orb, buf, header.getSize(), header.isLittleEndian(), header, null);
this.reply = header;
// NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin)
// in LocalServerResponse.getClientResponse(), then we do not need
// to read the headers (done below) anymore.
// This will be an optimisation which is can be done to speed up the
// local invocation by avoiding reading the headers in the local cases.
// BUGFIX(Ram Jeyaraman) This has been moved from
// LocalServerResponse.getClientResponse()
// Skip over all of the GIOP header information. This positions
// the offset in the buffer so that the skeleton can correctly read
// the marshalled arguments.
this.setIndex(Message.GIOPMessageHeaderLength);
// BUGFIX(Ram Jeyaraman) For local invocations, the reply mesg fields
// needs to be set, by reading the response buffer contents
// to correctly set the exception type and other info.
this.reply.read(this);
}
LocalClientResponseImpl(SystemException ex)
{
this.systemException = ex;
}
public boolean isSystemException() {
if ( reply != null )
return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION;
else
return (systemException != null);
}
public boolean isUserException() {
if ( reply != null )
return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION;
else
return false;
}
public boolean isLocationForward() {
if ( reply != null ) {
return ( (reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) ||
(reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) );
//return reply.getReplyStatus() == ReplyMessage.LOCATION_FORWARD;
} else {
return false;
}
}
public boolean isDifferentAddrDispositionRequested() {
if (reply != null) {
return reply.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE;
}
return false;
}
public short getAddrDisposition() {
if (reply != null) {
return reply.getAddrDisposition();
}
throw new org.omg.CORBA.INTERNAL(
"Null reply in getAddrDisposition",
MinorCodes.NULL_REPLY_IN_GET_ADDR_DISPOSITION,
CompletionStatus.COMPLETED_MAYBE);
}
public IOR getForwardedIOR() {
if ( reply != null )
return reply.getIOR();
else
return null;
}
public int getRequestId() {
if ( reply != null )
return reply.getRequestId();
else
throw new org.omg.CORBA.INTERNAL("Error in getRequestId");
}
public ServiceContexts getServiceContexts() {
if ( reply != null )
return reply.getServiceContexts();
else
return null;
}
public SystemException getSystemException() {
if ( reply != null )
return reply.getSystemException();
else
return systemException;
}
public java.lang.String peekUserExceptionId() {
mark(Integer.MAX_VALUE);
String result = read_string();
reset();
return result;
}
/**
* Check to see if the response is local.
*/
public boolean isLocal(){
return true;
}
private ReplyMessage reply;
private SystemException systemException;
}

View File

@ -1,208 +0,0 @@
/*
* Copyright (c) 1999, 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.iiop;
import org.omg.CORBA.SystemException;
import com.sun.corba.se.impl.core.ServerRequest;
import com.sun.corba.se.impl.core.ServiceContext;
import com.sun.corba.se.impl.core.DuplicateServiceContext;
import com.sun.corba.se.impl.core.UEInfoServiceContext;
import com.sun.corba.se.impl.core.ServiceContexts;
import com.sun.corba.se.impl.core.ServerResponse;
import com.sun.corba.se.impl.corba.IOR;
import com.sun.corba.se.impl.core.ORB;
import com.sun.corba.se.impl.orbutil.ORBUtility; //d11638
import org.omg.CORBA.portable.UnknownException;
import org.omg.CORBA.UNKNOWN;
import org.omg.CORBA.CompletionStatus;
import com.sun.corba.se.impl.ior.ObjectKey;
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
class LocalServerRequestImpl extends IIOPInputStream implements ServerRequest {
org.omg.CORBA.portable.OutputStream replyStream;
org.omg.CORBA.portable.OutputStream exceptionReplyStream;
LocalServerRequestImpl(ORB orb, byte[] buf, RequestMessage header)
{
super(orb, buf, header.getSize(), header.isLittleEndian(), header, null );
this.request = header;
}
public int getRequestId() {
return request.getRequestId();
}
public boolean isOneWay() {
return !request.isResponseExpected();
}
public ServiceContexts getServiceContexts() {
return request.getServiceContexts();
}
public String getOperationName() {
return request.getOperation();
}
public ObjectKey getObjectKey() {
return request.getObjectKey();
}
public ServerResponse createResponse(ServiceContexts svc)
{
return new LocalServerResponseImpl(this, svc);
}
public org.omg.CORBA.portable.OutputStream createReply() {
if (replyStream == null) {
replyStream = (org.omg.CORBA.portable.OutputStream)
createResponse(null);
}
return replyStream;
}
public org.omg.CORBA.portable.OutputStream createExceptionReply() {
if (exceptionReplyStream == null) {
exceptionReplyStream = (org.omg.CORBA.portable.OutputStream)
createUserExceptionResponse(null);
}
return exceptionReplyStream;
}
public ServerResponse createUserExceptionResponse(
ServiceContexts svc)
{
return new LocalServerResponseImpl(this, svc, true);
}
public ServerResponse createUnknownExceptionResponse(
UnknownException ex) {
ServiceContexts contexts = null;
SystemException sys = new UNKNOWN( 0,
CompletionStatus.COMPLETED_MAYBE);
try {
contexts = new ServiceContexts( (ORB)orb() );
UEInfoServiceContext uei = new UEInfoServiceContext(sys);
contexts.put(uei) ;
} catch (DuplicateServiceContext d) {
// can't happen
}
return createSystemExceptionResponse(sys,contexts);
}
public ServerResponse createSystemExceptionResponse(
SystemException ex, ServiceContexts svc) {
// Only do this if interceptors have been initialized on this request
// and have not completed their lifecycle (otherwise the info stack
// may be empty or have a different request's entry on top).
if (executePIInResponseConstructor()) {
// Inform Portable Interceptors of the SystemException. This is
// required to be done here because the ending interception point
// is called in the ServerResponseImpl constructor called below
// but we do not currently write the SystemException into the
// response until after the ending point is called.
ORB orb = (ORB)orb();
orb.getPIHandler().setServerPIInfo( ex );
}
if (orb() != null && ((ORB)orb()).subcontractDebugFlag && ex != null)
ORBUtility.dprint(this, "Sending SystemException:", ex);
LocalServerResponseImpl response =
new LocalServerResponseImpl(this, svc, false);
ORBUtility.writeSystemException(ex, response);
return response;
}
public ServerResponse createLocationForward(
IOR ior, ServiceContexts svc) {
ReplyMessage reply = MessageBase.createReply( (ORB)orb(),
request.getGIOPVersion(), request.getRequestId(),
ReplyMessage.LOCATION_FORWARD, svc, ior);
LocalServerResponseImpl response =
new LocalServerResponseImpl(this, reply, ior);
return response;
}
private RequestMessage request;
/**
* Check to see if the request is local.
*/
public boolean isLocal(){
return true;
}
private boolean _executeReturnServantInResponseConstructor = false;
public boolean executeReturnServantInResponseConstructor()
{
return _executeReturnServantInResponseConstructor;
}
public void setExecuteReturnServantInResponseConstructor(boolean b)
{
_executeReturnServantInResponseConstructor = b;
}
private boolean _executeRemoveThreadInfoInResponseConstructor = false;
public boolean executeRemoveThreadInfoInResponseConstructor()
{
return _executeRemoveThreadInfoInResponseConstructor;
}
public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b)
{
_executeRemoveThreadInfoInResponseConstructor = b;
}
private boolean _executePIInResponseConstructor = false;
public boolean executePIInResponseConstructor() {
return _executePIInResponseConstructor;
}
public void setExecutePIInResponseConstructor( boolean b ) {
_executePIInResponseConstructor = b;
}
// We know that we're talking to the same ValueHandler, so
// use the maximum version it supports.
public byte getStreamFormatVersionForReply() {
return ORBUtility.getMaxStreamFormatVersion();
}
}

View File

@ -1,192 +0,0 @@
/*
* Copyright (c) 1999, 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.iiop;
import org.omg.CORBA.SystemException;
import com.sun.corba.se.impl.core.ServerResponse;
import com.sun.corba.se.impl.core.ORB;
import com.sun.corba.se.impl.corba.IOR;
import com.sun.corba.se.impl.core.ServiceContext;
import com.sun.corba.se.impl.core.ServiceContexts;
import com.sun.corba.se.impl.core.ClientResponse;
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
class LocalServerResponseImpl
extends IIOPOutputStream
implements ServerResponse
{
LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc)
{
this(request,
MessageBase.createReply(
(ORB)request.orb(),
request.getGIOPVersion(),
request.getRequestId(), ReplyMessage.NO_EXCEPTION,
svc, null),
null);
}
LocalServerResponseImpl(LocalServerRequestImpl request, ServiceContexts svc,
boolean user)
{
this(request,
MessageBase.createReply(
(ORB)request.orb(),
request.getGIOPVersion(), request.getRequestId(),
user ? ReplyMessage.USER_EXCEPTION :
ReplyMessage.SYSTEM_EXCEPTION,
svc, null),
null);
}
LocalServerResponseImpl( LocalServerRequestImpl request, ReplyMessage reply,
IOR ior)
{
super(request.getGIOPVersion(),
(ORB)request.orb(),
null,
BufferManagerFactory.newBufferManagerWrite(BufferManagerFactory.GROW),
request.getStreamFormatVersionForReply());
setMessage(reply);
ORB orb = (ORB)request.orb();
ServerResponseImpl.runServantPostInvoke(orb, request);
if( request.executePIInResponseConstructor() ) {
// Invoke server request ending interception points (send_*):
// Note: this may end up with a SystemException or an internal
// Runtime ForwardRequest.
orb.getPIHandler().invokeServerPIEndingPoint( reply );
// Note this will be executed even if a ForwardRequest or
// SystemException is thrown by a Portable Interceptors ending
// point since we end up in this constructor again anyway.
orb.getPIHandler().cleanupServerPIRequest();
// See (Local)ServerRequestImpl.createSystemExceptionResponse
// for why this is necesary.
request.setExecutePIInResponseConstructor(false);
}
// Once you get here then the final reply is available (i.e.,
// postinvoke and interceptors have completed.
if (request.executeRemoveThreadInfoInResponseConstructor()) {
ServerResponseImpl.removeThreadInfo(orb, request);
}
reply.write(this);
if (reply.getIOR() != null)
reply.getIOR().write(this);
this.reply = reply;
this.ior = reply.getIOR();
}
public boolean isSystemException() {
if (reply != null)
return reply.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION;
return false;
}
public boolean isUserException() {
if (reply != null)
return reply.getReplyStatus() == ReplyMessage.USER_EXCEPTION;
return false;
}
public boolean isLocationForward() {
if (ior != null)
return true;
return false;
}
public IOR getForwardedIOR() {
return ior;
}
public int getRequestId() {
if (reply != null)
return reply.getRequestId();
return -1;
}
public ServiceContexts getServiceContexts() {
if (reply != null)
return reply.getServiceContexts();
return null;
}
public SystemException getSystemException() {
if (reply != null)
return reply.getSystemException();
return null;
}
public ReplyMessage getReply()
{
return reply ;
}
public ClientResponse getClientResponse()
{
// set the size of the marshalled data in the message header
getMessage().setSize(getByteBuffer(), getSize());
// Construct a new ClientResponse out of the buffer in this ClientRequest
LocalClientResponseImpl result =
new LocalClientResponseImpl( (ORB)orb(), toByteArray(), reply);
// NOTE (Ram J) (06/02/2000) if we set result.setIndex(bodyBegin) here
// then the LocalClientResponse does not need to read the headers anymore.
// This will be an optimisation which is can be done to speed up the
// local invocation by avoiding reading the headers in the local cases.
// BUGFIX(Ram Jeyaraman) result.setOffset is now done in
// LocalClientResponseImpl constructor.
/*
// Skip over all of the GIOP header information. This positions
// the offset in the buffer so that the skeleton can correctly read
// the marshalled arguments.
result.setOffset( bodyBegin ) ;
*/
return result ;
}
/**
* Check to see if the response is local.
*/
public boolean isLocal(){
return true;
}
private ReplyMessage reply;
private IOR ior; // forwarded IOR
}

View File

@ -1,710 +0,0 @@
/*
* Copyright (c) 2004, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 com.sun.corba.se.impl.transport;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.ByteBuffer;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Collections;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Map;
import org.omg.CORBA.COMM_FAILURE;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.DATA_CONVERSION;
import org.omg.CORBA.INTERNAL;
import org.omg.CORBA.MARSHAL;
import org.omg.CORBA.OBJECT_NOT_EXIST;
import org.omg.CORBA.SystemException;
import com.sun.org.omg.SendingContext.CodeBase;
import com.sun.corba.se.pept.broker.Broker;
import com.sun.corba.se.pept.encoding.InputObject;
import com.sun.corba.se.pept.encoding.OutputObject;
import com.sun.corba.se.pept.protocol.MessageMediator;
import com.sun.corba.se.pept.transport.Acceptor;
import com.sun.corba.se.pept.transport.Connection;
import com.sun.corba.se.pept.transport.ConnectionCache;
import com.sun.corba.se.pept.transport.ContactInfo;
import com.sun.corba.se.pept.transport.EventHandler;
import com.sun.corba.se.pept.transport.InboundConnectionCache;
import com.sun.corba.se.pept.transport.OutboundConnectionCache;
import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
import com.sun.corba.se.pept.transport.Selector;
import com.sun.corba.se.spi.ior.IOR;
import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.spi.orb.ORB ;
import com.sun.corba.se.spi.orbutil.threadpool.Work;
import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
import com.sun.corba.se.spi.transport.CorbaContactInfo;
import com.sun.corba.se.spi.transport.CorbaConnection;
import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom;
import com.sun.corba.se.impl.encoding.CachedCodeBase;
import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
import com.sun.corba.se.impl.encoding.CDROutputObject;
import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.impl.orbutil.ORBUtility;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl;
/**
* @author Ken Cavanaugh
*/
public class BufferConnectionImpl
extends
EventHandlerBase
implements
CorbaConnection,
Work
{
//
// New transport.
//
protected long enqueueTime;
public SocketChannel getSocketChannel()
{
return null;
}
// REVISIT:
// protected for test: genericRPCMSGFramework.IIOPConnection constructor.
//
// From iiop.Connection.java
//
protected long timeStamp = 0;
protected boolean isServer = false;
// Start at some value other than zero since this is a magic
// value in some protocols.
protected int requestId = 5;
protected CorbaResponseWaitingRoom responseWaitingRoom;
protected int state;
protected java.lang.Object stateEvent = new java.lang.Object();
protected java.lang.Object writeEvent = new java.lang.Object();
protected boolean writeLocked;
protected int serverRequestCount = 0;
// Server request map: used on the server side of Connection
// Maps request ID to IIOPInputStream.
Map serverRequestMap = new HashMap() ;
// This is a flag associated per connection telling us if the
// initial set of sending contexts were sent to the receiver
// already...
protected boolean postInitialContexts = false;
// Remote reference to CodeBase server (supplies
// FullValueDescription, among other things)
protected IOR codeBaseServerIOR;
// CodeBase cache for this connection. This will cache remote operations,
// handle connecting, and ensure we don't do any remote operations until
// necessary.
protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this);
protected ORBUtilSystemException wrapper ;
List buffers ;
public BufferConnectionImpl(ORB orb, byte[][] data )
{
this.orb = orb;
wrapper = ORBUtilSystemException.get( orb,
CORBALogDomains.RPC_TRANSPORT ) ;
buffers = new ArrayList() ;
}
////////////////////////////////////////////////////
//
// framework.transport.Connection
//
public boolean shouldRegisterReadEvent()
{
return false;
}
public boolean shouldRegisterServerReadEvent()
{
return false;
}
public boolean read()
{
return true ;
}
protected CorbaMessageMediator readBits()
{
return null ;
}
protected boolean dispatch(CorbaMessageMediator messageMediator)
{
}
public boolean shouldUseDirectByteBuffers()
{
return false ;
}
// Only called from readGIOPMessage with (12, 0, 12) as arguments
// size is size of buffer to create
// offset is offset from start of message in buffer
// length is length to read
public ByteBuffer read(int size, int offset, int length)
throws IOException
{
byte[] buf = new byte[size];
readFully( buf, offset, length);
ByteBuffer byteBuffer = ByteBuffer.wrap(buf);
byteBuffer.limit(size);
return byteBuffer;
}
// Only called as read( buf, 12, msgsize-12 ) in readGIOPMessage
// We can ignore the byteBuffer parameter
// offset is the starting position to place data in the result
// length is the length of the data to read
public ByteBuffer read(ByteBuffer byteBuffer, int offset, int length)
throws IOException
{
int size = offset + length;
byte[] buf = new byte[size];
readFully(buf, offset, length);
return ByteBuffer.wrap(buf);
}
// Read size bytes from buffer list and place the data
// starting at offset in buf.
public void readFully(byte[] buf, int offset, int size)
throws IOException
{
int remaining = size ;
int position = offset ;
while (remaining > 0) {
ByteBuffer buff = (ByteBuffer)buffers.get(0) ;
int dataSize = buff.remaining() ;
int xferSize = dataSize ;
if (dataSize >= remaining) :
xferSize = remaining ;
buffers.remove(0) ;
}
buff.get( buf, offset, xferSize ) ;
offset += xferSize ;
remaining -= xferSize ;
}
}
public void write(ByteBuffer byteBuffer)
throws IOException
{
buffers.add( byteBuffer ) ;
}
/**
* Note:it is possible for this to be called more than once
*/
public synchronized void close()
{
}
public Acceptor getAcceptor()
{
return null;
}
public ContactInfo getContactInfo()
{
return null;
}
public EventHandler getEventHandler()
{
return this;
}
public OutputObject createOutputObject(MessageMediator messageMediator)
{
// REVISIT - remove this method from Connection and all it subclasses.
throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called.");
}
// This is used by the GIOPOutputObject in order to
// throw the correct error when handling code sets.
// Can we determine if we are on the server side by
// other means? XREVISIT
public boolean isServer()
{
return isServer;
}
public boolean isBusy()
{
return false ;
}
public long getTimeStamp()
{
return timeStamp;
}
public void setTimeStamp(long time)
{
timeStamp = time;
}
public void setState(String stateString)
{
synchronized (stateEvent) {
if (stateString.equals("ESTABLISHED")) {
state = ESTABLISHED;
stateEvent.notifyAll();
} else {
// REVISIT: ASSERT
}
}
}
public void writeLock()
{
}
public void writeUnlock()
{
}
public void sendWithoutLock(OutputObject outputObject)
{
}
public void registerWaiter(MessageMediator messageMediator)
{
}
public void unregisterWaiter(MessageMediator messageMediator)
{
}
public InputObject waitForResponse(MessageMediator messageMediator)
{
return null ;
}
public void setConnectionCache(ConnectionCache connectionCache)
{
}
public ConnectionCache getConnectionCache()
{
return null;
}
////////////////////////////////////////////////////
//
// EventHandler methods
//
public SelectableChannel getChannel()
{
return null;
}
public int getInterestOps()
{
return null;
}
// public Acceptor getAcceptor() - already defined above.
public Connection getConnection()
{
return this;
}
////////////////////////////////////////////////////
//
// Work methods.
//
public String getName()
{
return this.toString();
}
public void doWork()
{
}
public void setEnqueueTime(long timeInMillis)
{
enqueueTime = timeInMillis;
}
public long getEnqueueTime()
{
return enqueueTime;
}
////////////////////////////////////////////////////
//
// spi.transport.CorbaConnection.
//
public ResponseWaitingRoom getResponseWaitingRoom()
{
return null ;
}
// REVISIT - inteface defines isServer but already defined in
// higher interface.
public void serverRequestMapPut(int requestId,
CorbaMessageMediator messageMediator)
{
serverRequestMap.put(new Integer(requestId), messageMediator);
}
public CorbaMessageMediator serverRequestMapGet(int requestId)
{
return (CorbaMessageMediator)
serverRequestMap.get(new Integer(requestId));
}
public void serverRequestMapRemove(int requestId)
{
serverRequestMap.remove(new Integer(requestId));
}
// REVISIT: this is also defined in:
// com.sun.corba.se.spi.legacy.connection.Connection
public java.net.Socket getSocket()
{
return null;
}
/** It is possible for a Close Connection to have been
** sent here, but we will not check for this. A "lazy"
** Exception will be thrown in the Worker thread after the
** incoming request has been processed even though the connection
** is closed before the request is processed. This is o.k because
** it is a boundary condition. To prevent it we would have to add
** more locks which would reduce performance in the normal case.
**/
public synchronized void serverRequestProcessingBegins()
{
serverRequestCount++;
}
public synchronized void serverRequestProcessingEnds()
{
serverRequestCount--;
}
//
//
//
public synchronized int getNextRequestId()
{
return requestId++;
}
// Negotiated code sets for char and wchar data
protected CodeSetComponentInfo.CodeSetContext codeSetContext = null;
public ORB getBroker()
{
return orb;
}
public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
{
// Needs to be synchronized for the following case when the client
// doesn't send the code set context twice, and we have two threads
// in ServerRequestDispatcher processCodeSetContext.
//
// Thread A checks to see if there is a context, there is none, so
// it calls setCodeSetContext, getting the synch lock.
// Thread B checks to see if there is a context. If we didn't synch,
// it might decide to outlaw wchar/wstring.
if (codeSetContext == null) {
synchronized(this) {
return codeSetContext;
}
}
return codeSetContext;
}
public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
// Double check whether or not we need to do this
if (codeSetContext == null) {
if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null ||
OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) {
// If the client says it's negotiated a code set that
// isn't a fallback and we never said we support, then
// it has a bug.
throw wrapper.badCodesetsFromClient() ;
}
codeSetContext = csc;
}
}
//
// from iiop.IIOPConnection.java
//
// Map request ID to an InputObject.
// This is so the client thread can start unmarshaling
// the reply and remove it from the out_calls map while the
// ReaderThread can still obtain the input stream to give
// new fragments. Only the ReaderThread touches the clientReplyMap,
// so it doesn't incur synchronization overhead.
public MessageMediator clientRequestMapGet(int requestId)
{
return null ;
}
protected MessageMediator clientReply_1_1;
public void clientReply_1_1_Put(MessageMediator x)
{
clientReply_1_1 = x;
}
public MessageMediator clientReply_1_1_Get()
{
return clientReply_1_1;
}
public void clientReply_1_1_Remove()
{
clientReply_1_1 = null;
}
protected MessageMediator serverRequest_1_1;
public void serverRequest_1_1_Put(MessageMediator x)
{
serverRequest_1_1 = x;
}
public MessageMediator serverRequest_1_1_Get()
{
return serverRequest_1_1;
}
public void serverRequest_1_1_Remove()
{
serverRequest_1_1 = null;
}
protected String getStateString( int state )
{
synchronized ( stateEvent ){
switch (state) {
case OPENING : return "OPENING" ;
case ESTABLISHED : return "ESTABLISHED" ;
case CLOSE_SENT : return "CLOSE_SENT" ;
case CLOSE_RECVD : return "CLOSE_RECVD" ;
case ABORT : return "ABORT" ;
default : return "???" ;
}
}
}
public synchronized boolean isPostInitialContexts() {
return postInitialContexts;
}
// Can never be unset...
public synchronized void setPostInitialContexts(){
postInitialContexts = true;
}
/**
* Wake up the outstanding requests on the connection, and hand them
* COMM_FAILURE exception with a given minor code.
*
* Also, delete connection from connection table and
* stop the reader thread.
* Note that this should only ever be called by the Reader thread for
* this connection.
*
* @param minor_code The minor code for the COMM_FAILURE major code.
* @param die Kill the reader thread (this thread) before exiting.
*/
public void purgeCalls(SystemException systemException,
boolean die, boolean lockHeld)
{
}
/*************************************************************************
* The following methods are for dealing with Connection cleaning for
* better scalability of servers in high network load conditions.
**************************************************************************/
public void sendCloseConnection(GIOPVersion giopVersion)
throws IOException
{
Message msg = MessageBase.createCloseConnection(giopVersion);
sendHelper(giopVersion, msg);
}
public void sendMessageError(GIOPVersion giopVersion)
throws IOException
{
Message msg = MessageBase.createMessageError(giopVersion);
sendHelper(giopVersion, msg);
}
/**
* Send a CancelRequest message. This does not lock the connection, so the
* caller needs to ensure this method is called appropriately.
* @exception IOException - could be due to abortive connection closure.
*/
public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
throws IOException
{
Message msg = MessageBase.createCancelRequest(giopVersion, requestId);
sendHelper(giopVersion, msg);
}
protected void sendHelper(GIOPVersion giopVersion, Message msg)
throws IOException
{
// REVISIT: See comments in CDROutputObject constructor.
CDROutputObject outputObject =
new CDROutputObject((ORB)orb, null, giopVersion, this, msg,
ORBConstants.STREAM_FORMAT_VERSION_1);
msg.write(outputObject);
outputObject.writeTo(this);
}
public void sendCancelRequestWithLock(GIOPVersion giopVersion,
int requestId)
throws IOException
{
writeLock();
try {
sendCancelRequest(giopVersion, requestId);
} finally {
writeUnlock();
}
}
// Begin Code Base methods ---------------------------------------
//
// Set this connection's code base IOR. The IOR comes from the
// SendingContext. This is an optional service context, but all
// JavaSoft ORBs send it.
//
// The set and get methods don't need to be synchronized since the
// first possible get would occur during reading a valuetype, and
// that would be after the set.
// Sets this connection's code base IOR. This is done after
// getting the IOR out of the SendingContext service context.
// Our ORBs always send this, but it's optional in CORBA.
public final void setCodeBaseIOR(IOR ior) {
codeBaseServerIOR = ior;
}
public final IOR getCodeBaseIOR() {
return codeBaseServerIOR;
}
// Get a CodeBase stub to use in unmarshaling. The CachedCodeBase
// won't connect to the remote codebase unless it's necessary.
public final CodeBase getCodeBase() {
return cachedCodeBase;
}
// End Code Base methods -----------------------------------------
// Can be overridden in subclass for different options.
protected void setSocketOptions(Socket socket)
{
}
public String toString()
{
synchronized ( stateEvent ){
return
"BufferConnectionImpl[" + " "
+ getStateString( state ) + " "
+ shouldUseSelectThreadToWait() + " "
+ shouldUseWorkerThreadForEvent()
+ "]" ;
}
}
// Must be public - used in encoding.
public void dprint(String msg)
{
ORBUtility.dprint("SocketOrChannelConnectionImpl", msg);
}
protected void dprint(String msg, Throwable t)
{
dprint(msg);
t.printStackTrace(System.out);
}
}
// End of file.

View File

@ -363,3 +363,9 @@ c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40
9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42 9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42
5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100 5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100
46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43 46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
f6921c876db192bba389cec062855a66372da01c jdk8-b101
530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44
c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102
7f55137d6aa81efc6eb0035813709f2cb6a26b8b hs25-b45
6f9be7f87b9653e94fd8fb3070891a0cc91b15bf jdk8-b103
580430d131ccd475e2f2ad4006531b8c4813d102 hs25-b46

View File

@ -29,11 +29,10 @@ public interface JVMTIThreadState {
public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001; public static final int JVMTI_THREAD_STATE_ALIVE = 0x0001;
public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002; public static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002;
public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; public static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004;
public static final int JVMTI_THREAD_STATE_WAITING = 0x0008; public static final int JVMTI_THREAD_STATE_WAITING = 0x0080;
public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; public static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010;
public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; public static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020;
public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040; public static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040;
public static final int JVMTI_THREAD_STATE_WAITING_FOR_NOTIFICATION = 0x0080;
public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100; public static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100;
public static final int JVMTI_THREAD_STATE_PARKED = 0x0200; public static final int JVMTI_THREAD_STATE_PARKED = 0x0200;
public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; public static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400;

View File

@ -44,7 +44,7 @@ public class PhaseCFG extends Phase {
Type type = db.lookupType("PhaseCFG"); Type type = db.lookupType("PhaseCFG");
numBlocksField = new CIntField(type.getCIntegerField("_num_blocks"), 0); numBlocksField = new CIntField(type.getCIntegerField("_num_blocks"), 0);
blocksField = type.getAddressField("_blocks"); blocksField = type.getAddressField("_blocks");
bbsField = type.getAddressField("_bbs"); bbsField = type.getAddressField("_node_to_block_mapping");
brootField = type.getAddressField("_broot"); brootField = type.getAddressField("_broot");
} }

View File

@ -32,7 +32,7 @@ import sun.jvm.hotspot.types.*;
// to the sys_thread_t structure of the classic JVM implementation. // to the sys_thread_t structure of the classic JVM implementation.
public class OSThread extends VMObject { public class OSThread extends VMObject {
private static JIntField interruptedField; private static JIntField interruptedField;
private static JIntField threadIdField; private static Field threadIdField;
static { static {
VM.registerVMInitializedObserver(new Observer() { VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) { public void update(Observable o, Object data) {
@ -44,7 +44,7 @@ public class OSThread extends VMObject {
private static synchronized void initialize(TypeDataBase db) { private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("OSThread"); Type type = db.lookupType("OSThread");
interruptedField = type.getJIntField("_interrupted"); interruptedField = type.getJIntField("_interrupted");
threadIdField = type.getJIntField("_thread_id"); threadIdField = type.getField("_thread_id");
} }
public OSThread(Address addr) { public OSThread(Address addr) {
@ -56,7 +56,7 @@ public class OSThread extends VMObject {
} }
public int threadId() { public int threadId() {
return (int)threadIdField.getValue(addr); return threadIdField.getJInt(addr);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -74,7 +74,8 @@ public class ClassDump extends Tool {
public void run() { public void run() {
// Ready to go with the database... // Ready to go with the database...
try { try {
// The name of the filter always comes from a System property. if (classFilter == null) {
// If not already set, the name of the filter comes from a System property.
// If we have a pkgList, pass it, otherwise let the filter read // If we have a pkgList, pass it, otherwise let the filter read
// its own System property for the list of classes. // its own System property for the list of classes.
String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter", String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
@ -90,7 +91,7 @@ public class ClassDump extends Tool {
} catch(Exception exp) { } catch(Exception exp) {
System.err.println("Warning: Can not create class filter!"); System.err.println("Warning: Can not create class filter!");
} }
}
String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", "."); String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", ".");
setOutputDirectory(outputDirectory); setOutputDirectory(outputDirectory);

View File

@ -41,13 +41,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
ifeq ("${Platform_arch_model}", "${Platform_arch}") ifeq ("${Platform_arch_model}", "${Platform_arch}")
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
else else
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
endif endif
EXEC = $(OUTDIR)/adlc EXEC = $(OUTDIR)/adlc

View File

@ -24,16 +24,20 @@
TYPE=MINIMAL1 TYPE=MINIMAL1
INCLUDE_JVMTI ?= false # Force all variables to false, overriding any other
INCLUDE_FPROF ?= false # setting that may have occurred in the makefiles. These
INCLUDE_VM_STRUCTS ?= false # can still be overridden by passing the variable as an
INCLUDE_JNI_CHECK ?= false # argument to 'make'
INCLUDE_SERVICES ?= false INCLUDE_JVMTI := false
INCLUDE_MANAGEMENT ?= false INCLUDE_FPROF := false
INCLUDE_ALL_GCS ?= false INCLUDE_VM_STRUCTS := false
INCLUDE_NMT ?= false INCLUDE_JNI_CHECK := false
INCLUDE_TRACE ?= false INCLUDE_SERVICES := false
INCLUDE_CDS ?= false INCLUDE_MANAGEMENT := false
INCLUDE_ALL_GCS := false
INCLUDE_NMT := false
INCLUDE_TRACE := false
INCLUDE_CDS := false
CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=43 HS_BUILD_NUMBER=46
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View File

@ -41,13 +41,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
ifeq ("${Platform_arch_model}", "${Platform_arch}") ifeq ("${Platform_arch_model}", "${Platform_arch}")
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
else else
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
endif endif
EXEC = $(OUTDIR)/adlc EXEC = $(OUTDIR)/adlc

View File

@ -24,16 +24,20 @@
TYPE=MINIMAL1 TYPE=MINIMAL1
INCLUDE_JVMTI ?= false # Force all variables to false, overriding any other
INCLUDE_FPROF ?= false # setting that may have occurred in the makefiles. These
INCLUDE_VM_STRUCTS ?= false # can still be overridden by passing the variable as an
INCLUDE_JNI_CHECK ?= false # argument to 'make'
INCLUDE_SERVICES ?= false INCLUDE_JVMTI := false
INCLUDE_MANAGEMENT ?= false INCLUDE_FPROF := false
INCLUDE_ALL_GCS ?= false INCLUDE_VM_STRUCTS := false
INCLUDE_NMT ?= false INCLUDE_JNI_CHECK := false
INCLUDE_TRACE ?= false INCLUDE_SERVICES := false
INCLUDE_CDS ?= false INCLUDE_MANAGEMENT := false
INCLUDE_ALL_GCS := false
INCLUDE_NMT := false
INCLUDE_TRACE := false
INCLUDE_CDS := false
CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\" CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"

View File

@ -42,13 +42,11 @@ SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad
ifeq ("${Platform_arch_model}", "${Platform_arch}") ifeq ("${Platform_arch_model}", "${Platform_arch}")
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
else else
SOURCES.AD = \ SOURCES.AD = \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad) \ $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch).ad)
$(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
endif endif
EXEC = $(OUTDIR)/adlc EXEC = $(OUTDIR)/adlc

View File

@ -283,8 +283,8 @@ $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
$(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \ $(QUIETLY) $(DTRACE_PROG) $(DTRACE_OPTS) -C -I. -G -xlazyload -o $@ -s $(DTRACE).d \
$(DTraced_Files) ||\ $(DTraced_Files) ||\
STATUS=$$?;\ STATUS=$$?;\
if [ x"$$STATUS" = x"1" -a \ if [ x"$$STATUS" = x"1" ]; then \
x`uname -r` = x"5.10" -a \ if [ x`uname -r` = x"5.10" -a \
x`uname -p` = x"sparc" ]; then\ x`uname -p` = x"sparc" ]; then\
echo "*****************************************************************";\ echo "*****************************************************************";\
echo "* If you are building server compiler, and the error message is ";\ echo "* If you are building server compiler, and the error message is ";\
@ -294,6 +294,20 @@ $(DTRACE.o): $(DTRACE).d $(JVMOFFS).h $(JVMOFFS)Index.h $(DTraced_Files)
echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\ echo "* environment variable HOTSPOT_DISABLE_DTRACE_PROBES to disable ";\
echo "* dtrace probes for this build.";\ echo "* dtrace probes for this build.";\
echo "*****************************************************************";\ echo "*****************************************************************";\
elif [ x`uname -r` = x"5.10" ]; then\
echo "*****************************************************************";\
echo "* If you are seeing 'syntax error near \"umpiconninfo_t\"' on Solaris";\
echo "* 10, try doing 'cd /usr/lib/dtrace && gzip mpi.d' as root, ";\
echo "* or set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\
echo "* to disable dtrace probes for this build.";\
echo "*****************************************************************";\
else \
echo "*****************************************************************";\
echo "* If you cannot fix dtrace build issues, try to ";\
echo "* set the environment variable HOTSPOT_DISABLE_DTRACE_PROBES";\
echo "* to disable dtrace probes for this build.";\
echo "*****************************************************************";\
fi; \
fi;\ fi;\
exit $$STATUS exit $$STATUS
# Since some DTraced_Files are in LIBJVM.o and they are touched by this # Since some DTraced_Files are in LIBJVM.o and they are touched by this

View File

@ -1,6 +1,6 @@
@echo off @echo off
REM REM
REM Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
REM REM
REM This code is free software; you can redistribute it and/or modify it REM This code is free software; you can redistribute it and/or modify it
@ -148,7 +148,7 @@ echo HotSpotJDKDist=%HotSpotJDKDist%
REM This is now safe to do. REM This is now safe to do.
:copyfiles :copyfiles
for /D %%i in (compiler1, compiler2, tiered, core) do ( for /D %%i in (compiler1, compiler2, tiered ) do (
if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated
copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL
) )
@ -156,7 +156,7 @@ copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\
REM force regneration of ProjectFile REM force regneration of ProjectFile
if exist %ProjectFile% del %ProjectFile% if exist %ProjectFile% del %ProjectFile%
for /D %%i in (compiler1, compiler2, tiered, core) do ( for /D %%i in (compiler1, compiler2, tiered ) do (
echo -- %%i -- echo -- %%i --
echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make
echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make

View File

@ -73,19 +73,17 @@ done
BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles ${GENERATED}/tracefiles" BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles ${GENERATED}/tracefiles"
if [ -d "${ALTSRC}/share/vm/jfr" ]; then if [ -d "${ALTSRC}/share/vm/jfr/buffers" ]; then
BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr"
BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/buffers" BASE_PATHS="${BASE_PATHS} ${ALTSRC}/share/vm/jfr/buffers"
fi fi
BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/share/vm/prims/wbtestmethods" BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/share/vm/prims/wbtestmethods"
CORE_PATHS="${BASE_PATHS}"
# shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS. # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS.
if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then
CORE_PATHS="${CORE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" BASE_PATHS="${BASE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`"
fi fi
CORE_PATHS="${CORE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`" BASE_PATHS="${BASE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`"
if [ -d "${ALTSRC}/share/vm/c1" ]; then if [ -d "${ALTSRC}/share/vm/c1" ]; then
COMPILER1_PATHS="${ALTSRC}/share/vm/c1" COMPILER1_PATHS="${ALTSRC}/share/vm/c1"
@ -104,12 +102,11 @@ COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles"
# Include dirs per type. # Include dirs per type.
case "${TYPE}" in case "${TYPE}" in
"core") Src_Dirs="${CORE_PATHS}" ;; "compiler1") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS}" ;;
"compiler1") Src_Dirs="${CORE_PATHS} ${COMPILER1_PATHS}" ;; "compiler2") Src_Dirs="${BASE_PATHS} ${COMPILER2_PATHS}" ;;
"compiler2") Src_Dirs="${CORE_PATHS} ${COMPILER2_PATHS}" ;; "tiered") Src_Dirs="${BASE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;;
"tiered") Src_Dirs="${CORE_PATHS} ${COMPILER1_PATHS} ${COMPILER2_PATHS}" ;; "zero") Src_Dirs="${BASE_PATHS}" ;;
"zero") Src_Dirs="${CORE_PATHS}" ;; "shark") Src_Dirs="${BASE_PATHS}" ;;
"shark") Src_Dirs="${CORE_PATHS}" ;;
esac esac
COMPILER2_SPECIFIC_FILES="opto libadt bcEscapeAnalyzer.cpp c2_* runtime_*" COMPILER2_SPECIFIC_FILES="opto libadt bcEscapeAnalyzer.cpp c2_* runtime_*"
@ -122,7 +119,6 @@ Src_Files_EXCLUDE="jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp"
# Exclude per type. # Exclude per type.
case "${TYPE}" in case "${TYPE}" in
"core") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;;
"compiler1") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;; "compiler1") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER2_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES} ciTypeFlow.cpp" ;;
"compiler2") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; "compiler2") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${COMPILER1_SPECIFIC_FILES} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;;
"tiered") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;; "tiered") Src_Files_EXCLUDE="${Src_Files_EXCLUDE} ${ZERO_SPECIFIC_FILES} ${SHARK_SPECIFIC_FILES}" ;;
@ -149,9 +145,17 @@ for e in ${Src_Dirs}; do
Src_Files="${Src_Files}`findsrc ${e}` " Src_Files="${Src_Files}`findsrc ${e}` "
done done
Obj_Files= Obj_Files=" "
for e in ${Src_Files}; do for e in ${Src_Files}; do
Obj_Files="${Obj_Files}${e%\.[!.]*}.obj " o="${e%\.[!.]*}.obj"
set +e
chk=`expr "${Obj_Files}" : ".* $o"`
set -e
if [ "$chk" != 0 ]; then
echo "# INFO: skipping duplicate $o"
continue
fi
Obj_Files="${Obj_Files}$o "
done done
echo Obj_Files=${Obj_Files} echo Obj_Files=${Obj_Files}

View File

@ -55,13 +55,11 @@ CXX_INCLUDE_DIRS=\
!if "$(Platform_arch_model)" == "$(Platform_arch)" !if "$(Platform_arch_model)" == "$(Platform_arch)"
SOURCES_AD=\ SOURCES_AD=\
$(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \ $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad
$(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm/windows_$(Platform_arch_model).ad
!else !else
SOURCES_AD=\ SOURCES_AD=\
$(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \ $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad \
$(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad \ $(WorkSpace)/src/cpu/$(Platform_arch)/vm/$(Platform_arch).ad
$(WorkSpace)/src/os_cpu/windows_$(Platform_arch)/vm/windows_$(Platform_arch_model).ad
!endif !endif
# NOTE! If you add any files here, you must also update GENERATED_NAMES_IN_DIR # NOTE! If you add any files here, you must also update GENERATED_NAMES_IN_DIR

View File

@ -44,10 +44,11 @@ ProjectCreatorSources=\
# This is only used internally # This is only used internally
ProjectCreatorIncludesPRIVATE=\ ProjectCreatorIncludesPRIVATE=\
-relativeInclude src\closed\share\vm \ -relativeAltSrcInclude src\closed \
-relativeInclude src\closed\os\windows\vm \ -altRelativeInclude share\vm \
-relativeInclude src\closed\os_cpu\windows_$(Platform_arch)\vm \ -altRelativeInclude os\windows\vm \
-relativeInclude src\closed\cpu\$(Platform_arch)\vm \ -altRelativeInclude os_cpu\windows_$(Platform_arch)\vm \
-altRelativeInclude cpu\$(Platform_arch)\vm \
-relativeInclude src\share\vm \ -relativeInclude src\share\vm \
-relativeInclude src\share\vm\precompiled \ -relativeInclude src\share\vm\precompiled \
-relativeInclude src\share\vm\prims\wbtestmethods \ -relativeInclude src\share\vm\prims\wbtestmethods \
@ -91,7 +92,7 @@ ProjectCreatorIDEOptions = \
-disablePch getThread_windows_$(Platform_arch).cpp \ -disablePch getThread_windows_$(Platform_arch).cpp \
-disablePch_compiler2 opcodes.cpp -disablePch_compiler2 opcodes.cpp
# Common options for the IDE builds for core, c1, and c2 # Common options for the IDE builds for c1, and c2
ProjectCreatorIDEOptions=\ ProjectCreatorIDEOptions=\
$(ProjectCreatorIDEOptions) \ $(ProjectCreatorIDEOptions) \
-sourceBase $(HOTSPOTWORKSPACE) \ -sourceBase $(HOTSPOTWORKSPACE) \
@ -157,19 +158,11 @@ ProjectCreatorIDEOptionsIgnoreCompiler2=\
-ignoreFile_TARGET ciTypeFlow.hpp \ -ignoreFile_TARGET ciTypeFlow.hpp \
-ignoreFile_TARGET $(Platform_arch_model).ad -ignoreFile_TARGET $(Platform_arch_model).ad
##################################################
# Without compiler(core) specific options
##################################################
ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
$(ProjectCreatorIDEOptionsIgnoreCompiler1:TARGET=core) \
$(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=core)
################################################## ##################################################
# Client(C1) compiler specific options # Client(C1) compiler specific options
################################################## ##################################################
ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
-define_compiler1 COMPILER1 \ -define_compiler1 COMPILER1 \
-ignorePath_compiler1 core \
$(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1) $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1)
################################################## ##################################################
@ -178,7 +171,6 @@ $(ProjectCreatorIDEOptionsIgnoreCompiler2:TARGET=compiler1)
#NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make. #NOTE! This list must be kept in sync with GENERATED_NAMES in adlc.make.
ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \ ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
-define_compiler2 COMPILER2 \ -define_compiler2 COMPILER2 \
-ignorePath_compiler2 core \
-additionalFile_compiler2 $(Platform_arch_model).ad \ -additionalFile_compiler2 $(Platform_arch_model).ad \
-additionalFile_compiler2 ad_$(Platform_arch_model).cpp \ -additionalFile_compiler2 ad_$(Platform_arch_model).cpp \
-additionalFile_compiler2 ad_$(Platform_arch_model).hpp \ -additionalFile_compiler2 ad_$(Platform_arch_model).hpp \

View File

@ -90,25 +90,25 @@ $(TraceOutDir)/traceTypes.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceType
!if "$(OPENJDK)" == "true" !if "$(OPENJDK)" == "true"
$(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS) $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS)
@echo Generating $@ @echo Generating OpenJDK $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp
!else !else
$(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS) $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventClasses.xsl $(XML_DEPS)
@echo Generating $@ @echo Generating AltSrc $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventClasses.xsl -OUT $(TraceOutDir)/traceEventClasses.hpp
$(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS) $(TraceOutDir)/traceProducer.cpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceProducer.xsl $(XML_DEPS)
@echo Generating $@ @echo Generating AltSrc $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceProducer.xsl -OUT $(TraceOutDir)/traceProducer.cpp @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceProducer.xsl -OUT $(TraceOutDir)/traceProducer.cpp
$(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS) $(TraceOutDir)/traceRequestables.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceRequestables.xsl $(XML_DEPS)
@echo Generating $@ @echo Generating AltSrc $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceRequestables.xsl -OUT $(TraceOutDir)/traceRequestables.hpp
$(TraceOutDir)/traceEventControl.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS) $(TraceOutDir)/traceEventControl.hpp: $(TraceSrcDir)/trace.xml $(TraceAltSrcDir)/traceEventControl.xsl $(XML_DEPS)
@echo Generating $@ @echo Generating AltSrc $@
@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventControl.xsl -OUT $(TraceOutDir)/traceEventControl.hpp @$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceAltSrcDir)/traceEventControl.xsl -OUT $(TraceOutDir)/traceEventControl.hpp
!endif !endif

View File

@ -36,10 +36,6 @@ CXX_FLAGS=$(CXX_FLAGS) /D "PRODUCT"
CXX_FLAGS=$(CXX_FLAGS) /D "ASSERT" CXX_FLAGS=$(CXX_FLAGS) /D "ASSERT"
!endif !endif
!if "$(Variant)" == "core"
# No need to define anything, CORE is defined as !COMPILER1 && !COMPILER2
!endif
!if "$(Variant)" == "compiler1" !if "$(Variant)" == "compiler1"
CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1" CXX_FLAGS=$(CXX_FLAGS) /D "COMPILER1"
!endif !endif

View File

@ -112,6 +112,7 @@ ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -def
ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions) ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
$(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
@if "$(MSC_VER)"=="1500" echo Make sure you have VS2008 SP1 or later, or you may see 'expanded command line too long'
@$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions) @$(RUN_JAVA) -Djava.class.path="$(HOTSPOTBUILDSPACE)/classes" ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions)
clean: clean:

View File

@ -42,7 +42,7 @@ define_pd_global(bool, ProfileInterpreter, false);
#else #else
define_pd_global(bool, ProfileInterpreter, true); define_pd_global(bool, ProfileInterpreter, true);
#endif // CC_INTERP #endif // CC_INTERP
define_pd_global(bool, TieredCompilation, false); define_pd_global(bool, TieredCompilation, trueInTiered);
define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, CompileThreshold, 10000);
define_pd_global(intx, BackEdgeThreshold, 140000); define_pd_global(intx, BackEdgeThreshold, 140000);

View File

@ -1887,6 +1887,27 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
if (ProfileInterpreter) { if (ProfileInterpreter) {
__ set_method_data_pointer_for_bcp(); __ set_method_data_pointer_for_bcp();
} }
#if INCLUDE_JVMTI
if (EnableInvokeDynamic) {
Label L_done;
__ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode
__ cmp_and_br_short(G1_scratch, Bytecodes::_invokestatic, Assembler::notEqual, Assembler::pn, L_done);
// The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
// Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
__ call_VM(G1_scratch, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), I0, Lmethod, Lbcp);
__ br_null(G1_scratch, false, Assembler::pn, L_done);
__ delayed()->nop();
__ st_ptr(G1_scratch, Lesp, wordSize);
__ bind(L_done);
}
#endif // INCLUDE_JVMTI
// Resume bytecode interpretation at the current bcp // Resume bytecode interpretation at the current bcp
__ dispatch_next(vtos); __ dispatch_next(vtos);
// end of JVMTI PopFrame support // end of JVMTI PopFrame support

View File

@ -44,7 +44,7 @@ define_pd_global(bool, ProfileInterpreter, false);
#else #else
define_pd_global(bool, ProfileInterpreter, true); define_pd_global(bool, ProfileInterpreter, true);
#endif // CC_INTERP #endif // CC_INTERP
define_pd_global(bool, TieredCompilation, false); define_pd_global(bool, TieredCompilation, trueInTiered);
define_pd_global(intx, CompileThreshold, 10000); define_pd_global(intx, CompileThreshold, 10000);
define_pd_global(intx, BackEdgeThreshold, 100000); define_pd_global(intx, BackEdgeThreshold, 100000);

View File

@ -1920,6 +1920,29 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
__ get_thread(thread); __ get_thread(thread);
__ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive); __ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
#if INCLUDE_JVMTI
if (EnableInvokeDynamic) {
Label L_done;
const Register local0 = rdi;
__ cmpb(Address(rsi, 0), Bytecodes::_invokestatic);
__ jcc(Assembler::notEqual, L_done);
// The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
// Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
__ get_method(rdx);
__ movptr(rax, Address(local0, 0));
__ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), rax, rdx, rsi);
__ testptr(rax, rax);
__ jcc(Assembler::zero, L_done);
__ movptr(Address(rbx, 0), rax);
__ bind(L_done);
}
#endif // INCLUDE_JVMTI
__ dispatch_next(vtos); __ dispatch_next(vtos);
// end of PopFrame support // end of PopFrame support

View File

@ -1929,6 +1929,29 @@ void TemplateInterpreterGenerator::generate_throw_exception() {
__ movl(Address(r15_thread, JavaThread::popframe_condition_offset()), __ movl(Address(r15_thread, JavaThread::popframe_condition_offset()),
JavaThread::popframe_inactive); JavaThread::popframe_inactive);
#if INCLUDE_JVMTI
if (EnableInvokeDynamic) {
Label L_done;
const Register local0 = r14;
__ cmpb(Address(r13, 0), Bytecodes::_invokestatic);
__ jcc(Assembler::notEqual, L_done);
// The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
// Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
__ get_method(rdx);
__ movptr(rax, Address(local0, 0));
__ call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null), rax, rdx, r13);
__ testptr(rax, rax);
__ jcc(Assembler::zero, L_done);
__ movptr(Address(rbx, 0), rax);
__ bind(L_done);
}
#endif // INCLUDE_JVMTI
__ dispatch_next(vtos); __ dispatch_next(vtos);
// end of PopFrame support // end of PopFrame support

View File

@ -58,8 +58,8 @@ class EntryFrame : public ZeroFrame {
JavaCallWrapper* call_wrapper, JavaCallWrapper* call_wrapper,
TRAPS); TRAPS);
public: public:
JavaCallWrapper *call_wrapper() const { JavaCallWrapper **call_wrapper() const {
return (JavaCallWrapper *) value_of_word(call_wrapper_off); return (JavaCallWrapper **) addr_of_word(call_wrapper_off);
} }
public: public:

View File

@ -141,7 +141,7 @@ inline intptr_t* frame::id() const {
return fp(); return fp();
} }
inline JavaCallWrapper* frame::entry_frame_call_wrapper() const { inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {
return zero_entryframe()->call_wrapper(); return zero_entryframe()->call_wrapper();
} }

View File

@ -176,6 +176,19 @@ class StubGenerator: public StubCodeGenerator {
StubRoutines::_oop_arraycopy; StubRoutines::_oop_arraycopy;
} }
static int SafeFetch32(int *adr, int errValue) {
int value = errValue;
value = *adr;
return value;
}
static intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) {
intptr_t value = errValue;
value = *adr;
return value;
}
void generate_initial() { void generate_initial() {
// Generates all stubs and initializes the entry points // Generates all stubs and initializes the entry points
@ -225,6 +238,15 @@ class StubGenerator: public StubCodeGenerator {
// arraycopy stubs used by compilers // arraycopy stubs used by compilers
generate_arraycopy_stubs(); generate_arraycopy_stubs();
// Safefetch stubs.
StubRoutines::_safefetch32_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetch32);
StubRoutines::_safefetch32_fault_pc = NULL;
StubRoutines::_safefetch32_continuation_pc = NULL;
StubRoutines::_safefetchN_entry = CAST_FROM_FN_PTR(address, StubGenerator::SafeFetchN);
StubRoutines::_safefetchN_fault_pc = NULL;
StubRoutines::_safefetchN_continuation_pc = NULL;
} }
public: public:

View File

@ -445,14 +445,14 @@ AttachOperation* AttachListener::dequeue() {
void AttachListener::vm_start() { void AttachListener::vm_start() {
char fn[UNIX_PATH_MAX]; char fn[UNIX_PATH_MAX];
struct stat64 st; struct stat st;
int ret; int ret;
int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d", int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
os::get_temp_directory(), os::current_process_id()); os::get_temp_directory(), os::current_process_id());
assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow"); assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");
RESTARTABLE(::stat64(fn, &st), ret); RESTARTABLE(::stat(fn, &st), ret);
if (ret == 0) { if (ret == 0) {
ret = ::unlink(fn); ret = ::unlink(fn);
if (ret == -1) { if (ret == -1) {

View File

@ -1642,6 +1642,8 @@ void os::print_os_info(outputStream* st) {
void os::win32::print_windows_version(outputStream* st) { void os::win32::print_windows_version(outputStream* st) {
OSVERSIONINFOEX osvi; OSVERSIONINFOEX osvi;
SYSTEM_INFO si;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
@ -1651,6 +1653,18 @@ void os::win32::print_windows_version(outputStream* st) {
} }
int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion; int os_vers = osvi.dwMajorVersion * 1000 + osvi.dwMinorVersion;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
if (os_vers >= 5002) {
// Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
// find out whether we are running on 64 bit processor or not.
if (os::Kernel32Dll::GetNativeSystemInfoAvailable()) {
os::Kernel32Dll::GetNativeSystemInfo(&si);
} else {
GetSystemInfo(&si);
}
}
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) { if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) {
switch (os_vers) { switch (os_vers) {
case 3051: st->print(" Windows NT 3.51"); break; case 3051: st->print(" Windows NT 3.51"); break;
@ -1658,57 +1672,48 @@ void os::win32::print_windows_version(outputStream* st) {
case 5000: st->print(" Windows 2000"); break; case 5000: st->print(" Windows 2000"); break;
case 5001: st->print(" Windows XP"); break; case 5001: st->print(" Windows XP"); break;
case 5002: case 5002:
case 6000:
case 6001:
case 6002: {
// Retrieve SYSTEM_INFO from GetNativeSystemInfo call so that we could
// find out whether we are running on 64 bit processor or not.
SYSTEM_INFO si;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
if (!os::Kernel32Dll::GetNativeSystemInfoAvailable()){
GetSystemInfo(&si);
} else {
os::Kernel32Dll::GetNativeSystemInfo(&si);
}
if (os_vers == 5002) {
if (osvi.wProductType == VER_NT_WORKSTATION && if (osvi.wProductType == VER_NT_WORKSTATION &&
si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
st->print(" Windows XP x64 Edition"); st->print(" Windows XP x64 Edition");
else } else {
st->print(" Windows Server 2003 family"); st->print(" Windows Server 2003 family");
} else if (os_vers == 6000) { }
if (osvi.wProductType == VER_NT_WORKSTATION) break;
case 6000:
if (osvi.wProductType == VER_NT_WORKSTATION) {
st->print(" Windows Vista"); st->print(" Windows Vista");
else } else {
st->print(" Windows Server 2008"); st->print(" Windows Server 2008");
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) }
st->print(" , 64 bit"); break;
} else if (os_vers == 6001) {
case 6001:
if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.wProductType == VER_NT_WORKSTATION) {
st->print(" Windows 7"); st->print(" Windows 7");
} else { } else {
// Unrecognized windows, print out its major and minor versions st->print(" Windows Server 2008 R2");
st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
} }
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) break;
st->print(" , 64 bit");
} else if (os_vers == 6002) { case 6002:
if (osvi.wProductType == VER_NT_WORKSTATION) { if (osvi.wProductType == VER_NT_WORKSTATION) {
st->print(" Windows 8"); st->print(" Windows 8");
} else { } else {
st->print(" Windows Server 2012"); st->print(" Windows Server 2012");
} }
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) break;
st->print(" , 64 bit");
} else { // future os case 6003:
// Unrecognized windows, print out its major and minor versions if (osvi.wProductType == VER_NT_WORKSTATION) {
st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); st->print(" Windows 8.1");
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) } else {
st->print(" , 64 bit"); st->print(" Windows Server 2012 R2");
} }
break; break;
}
default: // future windows, print out its major and minor versions default: // future os
// Unrecognized windows, print out its major and minor versions
st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); st->print(" Windows NT %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
} }
} else { } else {
@ -1720,6 +1725,11 @@ void os::win32::print_windows_version(outputStream* st) {
st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion); st->print(" Windows %d.%d", osvi.dwMajorVersion, osvi.dwMinorVersion);
} }
} }
if (os_vers >= 6000 && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
st->print(" , 64 bit");
}
st->print(" Build %d", osvi.dwBuildNumber); st->print(" Build %d", osvi.dwBuildNumber);
st->print(" %s", osvi.szCSDVersion); // service pack st->print(" %s", osvi.szCSDVersion); // service pack
st->cr(); st->cr();

View File

@ -1,26 +0,0 @@
//
// Copyright (c) 1999, 2012, 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.
//
//
// X86 Bsd Architecture Description File

View File

@ -1,65 +0,0 @@
//
// Copyright (c) 2003, 2012, 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.
//
//
// AMD64 Bsd Architecture Description File
//----------OS-DEPENDENT ENCODING BLOCK----------------------------------------
// This block specifies the encoding classes used by the compiler to
// output byte streams. Encoding classes generate functions which are
// called by Machine Instruction Nodes in order to generate the bit
// encoding of the instruction. Operands specify their base encoding
// interface with the interface keyword. There are currently
// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, &
// COND_INTER. REG_INTER causes an operand to generate a function
// which returns its register number when queried. CONST_INTER causes
// an operand to generate a function which returns the value of the
// constant when queried. MEMORY_INTER causes an operand to generate
// four functions which return the Base Register, the Index Register,
// the Scale Value, and the Offset Value of the operand when queried.
// COND_INTER causes an operand to generate six functions which return
// the encoding code (ie - encoding bits for the instruction)
// associated with each basic boolean condition for a conditional
// instruction. Instructions specify two basic values for encoding.
// They use the ins_encode keyword to specify their encoding class
// (which must be one of the class names specified in the encoding
// block), and they use the opcode keyword to specify, in order, their
// primary, secondary, and tertiary opcode. Only the opcode sections
// which a particular instruction needs for encoding need to be
// specified.
encode %{
// Build emit functions for each basic byte or larger field in the intel
// encoding scheme (opcode, rm, sib, immediate), and call them from C++
// code in the enc_class source block. Emit functions will live in the
// main source block for now. In future, we can generalize this by
// adding a syntax that specifies the sizes of fields in an order,
// so that the adlc can build the emit functions automagically
%}
// Platform dependent source
source %{
%}

View File

@ -1,26 +0,0 @@
//
// Copyright (c) 1999, 2012, 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.
//
//
// X86 Linux Architecture Description File

View File

@ -1,65 +0,0 @@
//
// Copyright (c) 2003, 2012, 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.
//
//
// AMD64 Linux Architecture Description File
//----------OS-DEPENDENT ENCODING BLOCK----------------------------------------
// This block specifies the encoding classes used by the compiler to
// output byte streams. Encoding classes generate functions which are
// called by Machine Instruction Nodes in order to generate the bit
// encoding of the instruction. Operands specify their base encoding
// interface with the interface keyword. There are currently
// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, &
// COND_INTER. REG_INTER causes an operand to generate a function
// which returns its register number when queried. CONST_INTER causes
// an operand to generate a function which returns the value of the
// constant when queried. MEMORY_INTER causes an operand to generate
// four functions which return the Base Register, the Index Register,
// the Scale Value, and the Offset Value of the operand when queried.
// COND_INTER causes an operand to generate six functions which return
// the encoding code (ie - encoding bits for the instruction)
// associated with each basic boolean condition for a conditional
// instruction. Instructions specify two basic values for encoding.
// They use the ins_encode keyword to specify their encoding class
// (which must be one of the class names specified in the encoding
// block), and they use the opcode keyword to specify, in order, their
// primary, secondary, and tertiary opcode. Only the opcode sections
// which a particular instruction needs for encoding need to be
// specified.
encode %{
// Build emit functions for each basic byte or larger field in the intel
// encoding scheme (opcode, rm, sib, immediate), and call them from C++
// code in the enc_class source block. Emit functions will live in the
// main source block for now. In future, we can generalize this by
// adding a syntax that specifies the sizes of fields in an order,
// so that the adlc can build the emit functions automagically
%}
// Platform dependent source
source %{
%}

View File

@ -410,16 +410,6 @@ extern "C" {
int SpinPause() { int SpinPause() {
} }
int SafeFetch32(int *adr, int errValue) {
int value = errValue;
value = *adr;
return value;
}
intptr_t SafeFetchN(intptr_t *adr, intptr_t errValue) {
intptr_t value = errValue;
value = *adr;
return value;
}
void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { void _Copy_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
if (from > to) { if (from > to) {

View File

@ -1,27 +0,0 @@
//
// Copyright (c) 1999, 2007, 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.
//
//
//
// SPARC Solaris Architecture Description File

View File

@ -1,26 +0,0 @@
//
// Copyright (c) 1999, 2012, 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.
//
//
// X86 Solaris Architecture Description File

View File

@ -1,63 +0,0 @@
//
// Copyright (c) 2004, 2012, 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.
//
//
// AMD64 Solaris Architecture Description File
//----------OS-DEPENDENT ENCODING BLOCK----------------------------------------
// This block specifies the encoding classes used by the compiler to
// output byte streams. Encoding classes generate functions which are
// called by Machine Instruction Nodes in order to generate the bit
// encoding of the instruction. Operands specify their base encoding
// interface with the interface keyword. There are currently
// supported four interfaces, REG_INTER, CONST_INTER, MEMORY_INTER, &
// COND_INTER. REG_INTER causes an operand to generate a function
// which returns its register number when queried. CONST_INTER causes
// an operand to generate a function which returns the value of the
// constant when queried. MEMORY_INTER causes an operand to generate
// four functions which return the Base Register, the Index Register,
// the Scale Value, and the Offset Value of the operand when queried.
// COND_INTER causes an operand to generate six functions which return
// the encoding code (ie - encoding bits for the instruction)
// associated with each basic boolean condition for a conditional
// instruction. Instructions specify two basic values for encoding.
// They use the ins_encode keyword to specify their encoding class
// (which must be one of the class names specified in the encoding
// block), and they use the opcode keyword to specify, in order, their
// primary, secondary, and tertiary opcode. Only the opcode sections
// which a particular instruction needs for encoding need to be
// specified.
encode %{
// Build emit functions for each basic byte or larger field in the intel
// encoding scheme (opcode, rm, sib, immediate), and call them from C++
// code in the enc_class source block. Emit functions will live in the
// main source block for now. In future, we can generalize this by
// adding a syntax that specifies the sizes of fields in an order,
// so that the adlc can build the emit functions automagically
%}
// Platform dependent source
source %{
%}

View File

@ -1,26 +0,0 @@
//
// Copyright (c) 1999, 2012, 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.
//
//
// X86 Win32 Architecture Description File

View File

@ -1,63 +0,0 @@
//
// Copyright (c) 2003, 2012, 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.
//
//
// AMD64 Win32 Architecture Description File
//----------OS-DEPENDENT ENCODING BLOCK-----------------------------------------------------
// This block specifies the encoding classes used by the compiler to output
// byte streams. Encoding classes generate functions which are called by
// Machine Instruction Nodes in order to generate the bit encoding of the
// instruction. Operands specify their base encoding interface with the
// interface keyword. There are currently supported four interfaces,
// REG_INTER, CONST_INTER, MEMORY_INTER, & COND_INTER. REG_INTER causes an
// operand to generate a function which returns its register number when
// queried. CONST_INTER causes an operand to generate a function which
// returns the value of the constant when queried. MEMORY_INTER causes an
// operand to generate four functions which return the Base Register, the
// Index Register, the Scale Value, and the Offset Value of the operand when
// queried. COND_INTER causes an operand to generate six functions which
// return the encoding code (ie - encoding bits for the instruction)
// associated with each basic boolean condition for a conditional instruction.
// Instructions specify two basic values for encoding. They use the
// ins_encode keyword to specify their encoding class (which must be one of
// the class names specified in the encoding block), and they use the
// opcode keyword to specify, in order, their primary, secondary, and
// tertiary opcode. Only the opcode sections which a particular instruction
// needs for encoding need to be specified.
encode %{
// Build emit functions for each basic byte or larger field in the intel
// encoding scheme (opcode, rm, sib, immediate), and call them from C++
// code in the enc_class source block. Emit functions will live in the
// main source block for now. In future, we can generalize this by
// adding a syntax that specifies the sizes of fields in an order,
// so that the adlc can build the emit functions automagically
%}
// Platform dependent source
source %{
%}

View File

@ -142,6 +142,69 @@ class BuildConfig {
return rv; return rv;
} }
// Returns true if the specified path refers to a relative alternate
// source file. RelativeAltSrcInclude is usually "src\closed".
public static boolean matchesRelativeAltSrcInclude(String path) {
String relativeAltSrcInclude =
getFieldString(null, "RelativeAltSrcInclude");
Vector<String> v = getFieldVector(null, "AltRelativeInclude");
for (String pathPart : v) {
if (path.contains(relativeAltSrcInclude + Util.sep + pathPart)) {
return true;
}
}
return false;
}
// Returns the relative alternate source file for the specified path.
// Null is returned if the specified path does not have a matching
// alternate source file.
public static String getMatchingRelativeAltSrcFile(String path) {
Vector<String> v = getFieldVector(null, "RelativeAltSrcFileList");
if (v == null) {
return null;
}
for (String pathPart : v) {
if (path.endsWith(pathPart)) {
String relativeAltSrcInclude =
getFieldString(null, "RelativeAltSrcInclude");
return relativeAltSrcInclude + Util.sep + pathPart;
}
}
return null;
}
// Returns true if the specified path has a matching alternate
// source file.
public static boolean matchesRelativeAltSrcFile(String path) {
return getMatchingRelativeAltSrcFile(path) != null;
}
// Track the specified alternate source file. The source file is
// tracked without the leading .*<sep><RelativeAltSrcFileList><sep>
// part to make matching regular source files easier.
public static void trackRelativeAltSrcFile(String path) {
String pattern = getFieldString(null, "RelativeAltSrcInclude") +
Util.sep;
int altSrcInd = path.indexOf(pattern);
if (altSrcInd == -1) {
// not an AltSrc path
return;
}
altSrcInd += pattern.length();
if (altSrcInd >= path.length()) {
// not a valid AltSrc path
return;
}
String altSrcFile = path.substring(altSrcInd);
Vector v = getFieldVector(null, "RelativeAltSrcFileList");
if (v == null || !v.contains(altSrcFile)) {
addFieldVector(null, "RelativeAltSrcFileList", altSrcFile);
}
}
void addTo(Hashtable ht, String key, String value) { void addTo(Hashtable ht, String key, String value) {
ht.put(expandFormat(key), expandFormat(value)); ht.put(expandFormat(key), expandFormat(value));
} }
@ -272,8 +335,19 @@ class BuildConfig {
private Vector getSourceIncludes() { private Vector getSourceIncludes() {
Vector<String> rv = new Vector<String>(); Vector<String> rv = new Vector<String>();
Vector<String> ri = new Vector<String>();
String sourceBase = getFieldString(null, "SourceBase"); String sourceBase = getFieldString(null, "SourceBase");
// add relative alternate source include values:
String relativeAltSrcInclude =
getFieldString(null, "RelativeAltSrcInclude");
Vector<String> asri = new Vector<String>();
collectRelevantVectors(asri, "AltRelativeInclude");
for (String f : asri) {
rv.add(sourceBase + Util.sep + relativeAltSrcInclude +
Util.sep + f);
}
Vector<String> ri = new Vector<String>();
collectRelevantVectors(ri, "RelativeInclude"); collectRelevantVectors(ri, "RelativeInclude");
for (String f : ri) { for (String f : ri) {
rv.add(sourceBase + Util.sep + f); rv.add(sourceBase + Util.sep + f);
@ -541,35 +615,6 @@ class TieredProductConfig extends ProductConfig {
} }
} }
class CoreDebugConfig extends GenericDebugNonKernelConfig {
String getOptFlag() {
return getCI().getNoOptFlag();
}
CoreDebugConfig() {
initNames("core", "debug", "jvm.dll");
init(getIncludes(), getDefines());
}
}
class CoreFastDebugConfig extends GenericDebugNonKernelConfig {
String getOptFlag() {
return getCI().getOptFlag();
}
CoreFastDebugConfig() {
initNames("core", "fastdebug", "jvm.dll");
init(getIncludes(), getDefines());
}
}
class CoreProductConfig extends ProductConfig {
CoreProductConfig() {
initNames("core", "product", "jvm.dll");
init(getIncludes(), getDefines());
}
}
abstract class CompilerInterface { abstract class CompilerInterface {
abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir); abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);

View File

@ -12,11 +12,15 @@ public class FileTreeCreator extends SimpleFileVisitor<Path>
final int startDirLength; final int startDirLength;
Stack<DirAttributes> attributes = new Stack<DirAttributes>(); Stack<DirAttributes> attributes = new Stack<DirAttributes>();
Vector<BuildConfig> allConfigs; Vector<BuildConfig> allConfigs;
WinGammaPlatformVC10 wg; WinGammaPlatform wg;
WinGammaPlatformVC10 wg10;
public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatformVC10 wg) { public FileTreeCreator(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) {
super(); super();
this.wg = wg; this.wg = wg;
if (wg instanceof WinGammaPlatformVC10) {
wg10 = (WinGammaPlatformVC10)wg;
}
this.allConfigs = allConfigs; this.allConfigs = allConfigs;
this.startDir = startDir; this.startDir = startDir;
startDirLength = startDir.toAbsolutePath().toString().length(); startDirLength = startDir.toAbsolutePath().toString().length();

View File

@ -1,3 +1,27 @@
/*
* Copyright (c) 2012, 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.
*
*/
import static java.nio.file.FileVisitResult.CONTINUE; import static java.nio.file.FileVisitResult.CONTINUE;
import java.io.IOException; import java.io.IOException;
@ -21,6 +45,8 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
boolean usePch = false; boolean usePch = false;
boolean disablePch = false; boolean disablePch = false;
boolean useIgnore = false; boolean useIgnore = false;
boolean isAltSrc = false; // only needed as a debugging crumb
boolean isReplacedByAltSrc = false;
String fileName = file.getFileName().toString(); String fileName = file.getFileName().toString();
// TODO hideFile // TODO hideFile
@ -30,6 +56,26 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
usePch = true; usePch = true;
} }
String fileLoc = vcProjLocation.relativize(file).toString();
// isAltSrc and isReplacedByAltSrc applies to all configs for a file
if (BuildConfig.matchesRelativeAltSrcInclude(
file.toAbsolutePath().toString())) {
// current file is an alternate source file so track it
isAltSrc = true;
BuildConfig.trackRelativeAltSrcFile(
file.toAbsolutePath().toString());
} else if (BuildConfig.matchesRelativeAltSrcFile(
file.toAbsolutePath().toString())) {
// current file is a regular file that matches an alternate
// source file so yack about replacing the regular file
isReplacedByAltSrc = true;
System.out.println("INFO: alternate source file '" +
BuildConfig.getMatchingRelativeAltSrcFile(
file.toAbsolutePath().toString()) +
"' replaces '" + fileLoc + "'");
}
for (BuildConfig cfg : allConfigs) { for (BuildConfig cfg : allConfigs) {
if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) { if (cfg.lookupHashFieldInContext("IgnoreFile", fileName) != null) {
useIgnore = true; useIgnore = true;
@ -57,10 +103,9 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
} }
} }
String tagName = wg.getFileTagFromSuffix(fileName); String tagName = wg10.getFileTagFromSuffix(fileName);
String fileLoc = vcProjLocation.relativize(file).toString();
if (!useIgnore && !disablePch && !usePch) { if (!useIgnore && !disablePch && !usePch && !isReplacedByAltSrc) {
wg.tag(tagName, new String[] { "Include", fileLoc}); wg.tag(tagName, new String[] { "Include", fileLoc});
} else { } else {
wg.startTag( wg.startTag(
@ -78,12 +123,17 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
if (disablePch) { if (disablePch) {
wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'"); wg.tag("PrecompiledHeader", "Condition", "'$(Configuration)|$(Platform)'=='" + cfg.get("Name") + "'");
} }
if (isReplacedByAltSrc) {
wg.tagData("ExcludedFromBuild", "true", "Condition",
"'$(Configuration)|$(Platform)'=='" +
cfg.get("Name") + "'");
}
} }
wg.endTag(); wg.endTag();
} }
String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString(); String filter = startDir.relativize(file.getParent().toAbsolutePath()).toString();
wg.addFilterDependency(fileLoc, filter); wg10.addFilterDependency(fileLoc, filter);
return CONTINUE; return CONTINUE;
} }
@ -112,7 +162,7 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
if (!hide) { if (!hide) {
String name = startDir.relativize(path.toAbsolutePath()).toString(); String name = startDir.relativize(path.toAbsolutePath()).toString();
if (!"".equals(name)) { if (!"".equals(name)) {
wg.addFilter(name); wg10.addFilter(name);
} }
attributes.push(newAttr); attributes.push(newAttr);
@ -137,6 +187,4 @@ public class FileTreeCreatorVC10 extends FileTreeCreator {
public void writeFileTree() throws IOException { public void writeFileTree() throws IOException {
Files.walkFileTree(this.startDir, this); Files.walkFileTree(this.startDir, this);
} }
} }

View File

@ -12,7 +12,7 @@ import java.util.Vector;
public class FileTreeCreatorVC7 extends FileTreeCreator { public class FileTreeCreatorVC7 extends FileTreeCreator {
public FileTreeCreatorVC7(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) { public FileTreeCreatorVC7(Path startDir, Vector<BuildConfig> allConfigs, WinGammaPlatform wg) {
super(startDir, allConfigs, null); super(startDir, allConfigs, wg);
} }
@Override @Override

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,10 +39,15 @@ public class ProjectCreator {
+ "jvm.dll; no trailing slash>"); + "jvm.dll; no trailing slash>");
System.err.println(" If any of the above are specified, " System.err.println(" If any of the above are specified, "
+ "they must all be."); + "they must all be.");
System.err.println(" Note: if '-altRelativeInclude' option below is "
+ "used, then the '-relativeAltSrcInclude' option must be used "
+ "to specify the alternate source dir, e.g., 'src\\closed'");
System.err.println(" Additional, optional arguments, which can be " System.err.println(" Additional, optional arguments, which can be "
+ "specified multiple times:"); + "specified multiple times:");
System.err.println(" -absoluteInclude <string containing absolute " System.err.println(" -absoluteInclude <string containing absolute "
+ "path to include directory>"); + "path to include directory>");
System.err.println(" -altRelativeInclude <string containing "
+ "alternate include directory relative to -envVar>");
System.err.println(" -relativeInclude <string containing include " System.err.println(" -relativeInclude <string containing include "
+ "directory relative to -envVar>"); + "directory relative to -envVar>");
System.err.println(" -define <preprocessor flag to be #defined " System.err.println(" -define <preprocessor flag to be #defined "

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -140,10 +140,17 @@ public abstract class WinGammaPlatform {
"already exist>"); "already exist>");
System.err.println(" If any of the above are specified, "+ System.err.println(" If any of the above are specified, "+
"they must all be."); "they must all be.");
System.err.println(" Note: if '-altRelativeInclude' option below " +
"is used, then the '-relativeAltSrcInclude' " +
"option must be used to specify the alternate " +
"source dir, e.g., 'src\\closed'");
System.err.println(" Additional, optional arguments, which can be " + System.err.println(" Additional, optional arguments, which can be " +
"specified multiple times:"); "specified multiple times:");
System.err.println(" -absoluteInclude <string containing absolute " + System.err.println(" -absoluteInclude <string containing absolute " +
"path to include directory>"); "path to include directory>");
System.err.println(" -altRelativeInclude <string containing " +
"alternate include directory relative to " +
"-sourceBase>");
System.err.println(" -relativeInclude <string containing include " + System.err.println(" -relativeInclude <string containing include " +
"directory relative to -sourceBase>"); "directory relative to -sourceBase>");
System.err.println(" -define <preprocessor flag to be #defined " + System.err.println(" -define <preprocessor flag to be #defined " +
@ -343,6 +350,12 @@ public abstract class WinGammaPlatform {
HsArgHandler.VECTOR HsArgHandler.VECTOR
), ),
new HsArgRule("-altRelativeInclude",
"AltRelativeInclude",
null,
HsArgHandler.VECTOR
),
new HsArgRule("-relativeInclude", new HsArgRule("-relativeInclude",
"RelativeInclude", "RelativeInclude",
null, null,
@ -355,6 +368,12 @@ public abstract class WinGammaPlatform {
HsArgHandler.VECTOR HsArgHandler.VECTOR
), ),
new HsArgRule("-relativeAltSrcInclude",
"RelativeAltSrcInclude",
null,
HsArgHandler.STRING
),
new HsArgRule("-relativeSrcInclude", new HsArgRule("-relativeSrcInclude",
"RelativeSrcInclude", "RelativeSrcInclude",
null, null,
@ -560,10 +579,6 @@ public abstract class WinGammaPlatform {
allConfigs.add(new TieredFastDebugConfig()); allConfigs.add(new TieredFastDebugConfig());
allConfigs.add(new TieredProductConfig()); allConfigs.add(new TieredProductConfig());
allConfigs.add(new CoreDebugConfig());
allConfigs.add(new CoreFastDebugConfig());
allConfigs.add(new CoreProductConfig());
return allConfigs; return allConfigs;
} }

View File

@ -1,3 +1,27 @@
/*
* Copyright (c) 2011, 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.
*
*/
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
@ -24,7 +48,7 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
public void writeProjectFile(String projectFileName, String projectName, public void writeProjectFile(String projectFileName, String projectName,
Vector<BuildConfig> allConfigs) throws IOException { Vector<BuildConfig> allConfigs) throws IOException {
System.out.println(); System.out.println();
System.out.print(" Writing .vcxproj file: " + projectFileName); System.out.println(" Writing .vcxproj file: " + projectFileName);
String projDir = Util.normalize(new File(projectFileName).getParent()); String projDir = Util.normalize(new File(projectFileName).getParent());
@ -114,7 +138,7 @@ public class WinGammaPlatformVC10 extends WinGammaPlatformVC7 {
endTag(); endTag();
printWriter.close(); printWriter.close();
System.out.println(" Done."); System.out.println(" Done writing .vcxproj file.");
writeFilterFile(projectFileName, projectName, allConfigs, projDir); writeFilterFile(projectFileName, projectName, allConfigs, projDir);
writeUserFile(projectFileName, allConfigs); writeUserFile(projectFileName, allConfigs);

View File

@ -139,6 +139,9 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform {
tagV("Tool", cfg.getV("LinkerFlags")); tagV("Tool", cfg.getV("LinkerFlags"));
String postBuildCmd = BuildConfig.getFieldString(null,
"PostbuildCommand");
if (postBuildCmd != null) {
tag("Tool", tag("Tool",
new String[] { new String[] {
"Name", "Name",
@ -149,9 +152,9 @@ public class WinGammaPlatformVC7 extends WinGammaPlatform {
// Caution: String.replace(String,String) is available // Caution: String.replace(String,String) is available
// from JDK5 onwards only // from JDK5 onwards only
"CommandLine", "CommandLine",
cfg.expandFormat(BuildConfig.getFieldString(null, cfg.expandFormat(postBuildCmd.replace("\t",
"PostbuildCommand").replace("\t",
"&#x0D;&#x0A;")) }); "&#x0D;&#x0A;")) });
}
tag("Tool", new String[] { "Name", "VCPreBuildEventTool" }); tag("Tool", new String[] { "Name", "VCPreBuildEventTool" });

View File

@ -2295,7 +2295,7 @@ void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) {
if (gen_type_check) { if (gen_type_check) {
// We have determined that offset == referent_offset && src != null. // We have determined that offset == referent_offset && src != null.
// if (src->_klass->_reference_type == REF_NONE) -> continue // if (src->_klass->_reference_type == REF_NONE) -> continue
__ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), UseCompressedKlassPointers ? T_OBJECT : T_ADDRESS), src_klass); __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
LIR_Opr reference_type = new_register(T_INT); LIR_Opr reference_type = new_register(T_INT);
__ move(reference_type_addr, reference_type); __ move(reference_type_addr, reference_type);

View File

@ -299,7 +299,7 @@ class CompileReplay : public StackObj {
Symbol* method_signature = parse_symbol(CHECK_NULL); Symbol* method_signature = parse_symbol(CHECK_NULL);
Method* m = k->find_method(method_name, method_signature); Method* m = k->find_method(method_name, method_signature);
if (m == NULL) { if (m == NULL) {
report_error("can't find method"); report_error("Can't find method");
} }
return m; return m;
} }
@ -398,8 +398,8 @@ class CompileReplay : public StackObj {
// compile <klass> <name> <signature> <entry_bci> <comp_level> // compile <klass> <name> <signature> <entry_bci> <comp_level>
void process_compile(TRAPS) { void process_compile(TRAPS) {
// methodHandle method;
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
int entry_bci = parse_int("entry_bci"); int entry_bci = parse_int("entry_bci");
const char* comp_level_label = "comp_level"; const char* comp_level_label = "comp_level";
int comp_level = parse_int(comp_level_label); int comp_level = parse_int(comp_level_label);
@ -440,6 +440,7 @@ class CompileReplay : public StackObj {
// //
void process_ciMethod(TRAPS) { void process_ciMethod(TRAPS) {
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
ciMethodRecord* rec = new_ciMethod(method); ciMethodRecord* rec = new_ciMethod(method);
rec->invocation_counter = parse_int("invocation_counter"); rec->invocation_counter = parse_int("invocation_counter");
rec->backedge_counter = parse_int("backedge_counter"); rec->backedge_counter = parse_int("backedge_counter");
@ -451,6 +452,7 @@ class CompileReplay : public StackObj {
// ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
void process_ciMethodData(TRAPS) { void process_ciMethodData(TRAPS) {
Method* method = parse_method(CHECK); Method* method = parse_method(CHECK);
if (had_error()) return;
/* jsut copied from Method, to build interpret data*/ /* jsut copied from Method, to build interpret data*/
if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) { if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
return; return;

View File

@ -878,7 +878,7 @@ objArrayOop ClassLoader::get_system_packages(TRAPS) {
instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) { instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
EventMark m("loading class " INTPTR_FORMAT, (address)h_name); EventMark m("loading class %s", h_name->as_C_string());
ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion);
stringStream st; stringStream st;

View File

@ -2557,6 +2557,26 @@ void java_lang_ref_SoftReference::set_clock(jlong value) {
*offset = value; *offset = value;
} }
// Support for java_lang_invoke_DirectMethodHandle
int java_lang_invoke_DirectMethodHandle::_member_offset;
oop java_lang_invoke_DirectMethodHandle::member(oop dmh) {
oop member_name = NULL;
bool is_dmh = dmh->is_oop() && java_lang_invoke_DirectMethodHandle::is_instance(dmh);
assert(is_dmh, "a DirectMethodHandle oop is expected");
if (is_dmh) {
member_name = dmh->obj_field(member_offset_in_bytes());
}
return member_name;
}
void java_lang_invoke_DirectMethodHandle::compute_offsets() {
Klass* klass_oop = SystemDictionary::DirectMethodHandle_klass();
if (klass_oop != NULL && EnableInvokeDynamic) {
compute_offset(_member_offset, klass_oop, vmSymbols::member_name(), vmSymbols::java_lang_invoke_MemberName_signature());
}
}
// Support for java_lang_invoke_MethodHandle // Support for java_lang_invoke_MethodHandle
@ -3205,6 +3225,7 @@ void JavaClasses::compute_offsets() {
java_lang_ThreadGroup::compute_offsets(); java_lang_ThreadGroup::compute_offsets();
if (EnableInvokeDynamic) { if (EnableInvokeDynamic) {
java_lang_invoke_MethodHandle::compute_offsets(); java_lang_invoke_MethodHandle::compute_offsets();
java_lang_invoke_DirectMethodHandle::compute_offsets();
java_lang_invoke_MemberName::compute_offsets(); java_lang_invoke_MemberName::compute_offsets();
java_lang_invoke_LambdaForm::compute_offsets(); java_lang_invoke_LambdaForm::compute_offsets();
java_lang_invoke_MethodType::compute_offsets(); java_lang_invoke_MethodType::compute_offsets();

View File

@ -976,6 +976,32 @@ class java_lang_invoke_MethodHandle: AllStatic {
static int form_offset_in_bytes() { return _form_offset; } static int form_offset_in_bytes() { return _form_offset; }
}; };
// Interface to java.lang.invoke.DirectMethodHandle objects
class java_lang_invoke_DirectMethodHandle: AllStatic {
friend class JavaClasses;
private:
static int _member_offset; // the MemberName of this DMH
static void compute_offsets();
public:
// Accessors
static oop member(oop mh);
// Testers
static bool is_subclass(Klass* klass) {
return klass->is_subclass_of(SystemDictionary::DirectMethodHandle_klass());
}
static bool is_instance(oop obj) {
return obj != NULL && is_subclass(obj->klass());
}
// Accessors for code generation:
static int member_offset_in_bytes() { return _member_offset; }
};
// Interface to java.lang.invoke.LambdaForm objects // Interface to java.lang.invoke.LambdaForm objects
// (These are a private interface for managing adapter code generation.) // (These are a private interface for managing adapter code generation.)

View File

@ -151,6 +151,7 @@ class SymbolPropertyTable;
do_klass(reflect_CallerSensitive_klass, sun_reflect_CallerSensitive, Opt ) \ do_klass(reflect_CallerSensitive_klass, sun_reflect_CallerSensitive, Opt ) \
\ \
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \ /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292 ) \ do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre_JSR292 ) \
do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292 ) \ do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre_JSR292 ) \
do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292 ) \ do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre_JSR292 ) \

View File

@ -255,6 +255,7 @@
/* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \ /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */ \
template(java_lang_invoke_CallSite, "java/lang/invoke/CallSite") \ template(java_lang_invoke_CallSite, "java/lang/invoke/CallSite") \
template(java_lang_invoke_ConstantCallSite, "java/lang/invoke/ConstantCallSite") \ template(java_lang_invoke_ConstantCallSite, "java/lang/invoke/ConstantCallSite") \
template(java_lang_invoke_DirectMethodHandle, "java/lang/invoke/DirectMethodHandle") \
template(java_lang_invoke_MutableCallSite, "java/lang/invoke/MutableCallSite") \ template(java_lang_invoke_MutableCallSite, "java/lang/invoke/MutableCallSite") \
template(java_lang_invoke_VolatileCallSite, "java/lang/invoke/VolatileCallSite") \ template(java_lang_invoke_VolatileCallSite, "java/lang/invoke/VolatileCallSite") \
template(java_lang_invoke_MethodHandle, "java/lang/invoke/MethodHandle") \ template(java_lang_invoke_MethodHandle, "java/lang/invoke/MethodHandle") \
@ -352,6 +353,7 @@
template(thread_id_name, "tid") \ template(thread_id_name, "tid") \
template(newInstance0_name, "newInstance0") \ template(newInstance0_name, "newInstance0") \
template(limit_name, "limit") \ template(limit_name, "limit") \
template(member_name, "member") \
template(forName_name, "forName") \ template(forName_name, "forName") \
template(forName0_name, "forName0") \ template(forName0_name, "forName0") \
template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \ template(isJavaIdentifierStart_name, "isJavaIdentifierStart") \

View File

@ -122,6 +122,22 @@ class MarkRefsIntoClosure: public CMSOopsInGenClosure {
} }
}; };
class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
private:
const MemRegion _span;
CMSBitMap* _bitMap;
protected:
DO_OOP_WORK_DEFN
public:
Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
Prefetch::style prefetch_style() {
return Prefetch::do_read;
}
};
// A variant of the above used in certain kinds of CMS // A variant of the above used in certain kinds of CMS
// marking verification. // marking verification.
class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure { class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {

View File

@ -50,6 +50,7 @@
#include "memory/genMarkSweep.hpp" #include "memory/genMarkSweep.hpp"
#include "memory/genOopClosures.inline.hpp" #include "memory/genOopClosures.inline.hpp"
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
#include "memory/padded.hpp"
#include "memory/referencePolicy.hpp" #include "memory/referencePolicy.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/tenuredGeneration.hpp" #include "memory/tenuredGeneration.hpp"
@ -569,6 +570,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
_restart_addr(NULL), _restart_addr(NULL),
_overflow_list(NULL), _overflow_list(NULL),
_stats(cmsGen), _stats(cmsGen),
_eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)),
_eden_chunk_array(NULL), // may be set in ctor body _eden_chunk_array(NULL), // may be set in ctor body
_eden_chunk_capacity(0), // -- ditto -- _eden_chunk_capacity(0), // -- ditto --
_eden_chunk_index(0), // -- ditto -- _eden_chunk_index(0), // -- ditto --
@ -732,7 +734,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error"); assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error");
// Support for parallelizing survivor space rescan // Support for parallelizing survivor space rescan
if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) { if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
const size_t max_plab_samples = const size_t max_plab_samples =
((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize; ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
@ -2137,6 +2139,39 @@ void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs,
} }
void CMSCollector::print_eden_and_survivor_chunk_arrays() {
DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
// Eden
if (_eden_chunk_array != NULL) {
gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
eden_space->bottom(), eden_space->top(),
eden_space->end(), eden_space->capacity());
gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
"_eden_chunk_capacity=" SIZE_FORMAT,
_eden_chunk_index, _eden_chunk_capacity);
for (size_t i = 0; i < _eden_chunk_index; i++) {
gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
i, _eden_chunk_array[i]);
}
}
// Survivor
if (_survivor_chunk_array != NULL) {
gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
from_space->bottom(), from_space->top(),
from_space->end(), from_space->capacity());
gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
"_survivor_chunk_capacity=" SIZE_FORMAT,
_survivor_chunk_index, _survivor_chunk_capacity);
for (size_t i = 0; i < _survivor_chunk_index; i++) {
gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
i, _survivor_chunk_array[i]);
}
}
}
void CMSCollector::getFreelistLocks() const { void CMSCollector::getFreelistLocks() const {
// Get locks for all free lists in all generations that this // Get locks for all free lists in all generations that this
// collector is responsible for // collector is responsible for
@ -3549,6 +3584,31 @@ CMSPhaseAccounting::~CMSPhaseAccounting() {
// CMS work // CMS work
// The common parts of CMSParInitialMarkTask and CMSParRemarkTask.
class CMSParMarkTask : public AbstractGangTask {
protected:
CMSCollector* _collector;
int _n_workers;
CMSParMarkTask(const char* name, CMSCollector* collector, int n_workers) :
AbstractGangTask(name),
_collector(collector),
_n_workers(n_workers) {}
// Work method in support of parallel rescan ... of young gen spaces
void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl,
ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top);
void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
};
// Parallel initial mark task
class CMSParInitialMarkTask: public CMSParMarkTask {
public:
CMSParInitialMarkTask(CMSCollector* collector, int n_workers) :
CMSParMarkTask("Scan roots and young gen for initial mark in parallel",
collector, n_workers) {}
void work(uint worker_id);
};
// Checkpoint the roots into this generation from outside // Checkpoint the roots into this generation from outside
// this generation. [Note this initial checkpoint need only // this generation. [Note this initial checkpoint need only
// be approximate -- we'll do a catch up phase subsequently.] // be approximate -- we'll do a catch up phase subsequently.]
@ -3646,9 +3706,31 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
// the klasses. The claimed marks need to be cleared before marking starts. // the klasses. The claimed marks need to be cleared before marking starts.
ClassLoaderDataGraph::clear_claimed_marks(); ClassLoaderDataGraph::clear_claimed_marks();
CMKlassClosure klass_closure(&notOlder); if (CMSPrintEdenSurvivorChunks) {
print_eden_and_survivor_chunk_arrays();
}
{ {
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
if (CMSParallelInitialMarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
// The parallel version.
FlexibleWorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
int n_workers = workers->active_workers();
CMSParInitialMarkTask tsk(this, n_workers);
gch->set_par_threads(n_workers);
initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
if (n_workers > 1) {
GenCollectedHeap::StrongRootsScope srs(gch);
workers->run_task(&tsk);
} else {
GenCollectedHeap::StrongRootsScope srs(gch);
tsk.work(0);
}
gch->set_par_threads(0);
} else {
// The serial version.
CMKlassClosure klass_closure(&notOlder);
gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel. gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
gch->gen_process_strong_roots(_cmsGen->level(), gch->gen_process_strong_roots(_cmsGen->level(),
true, // younger gens are roots true, // younger gens are roots
@ -3660,6 +3742,7 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
NULL, NULL,
&klass_closure); &klass_closure);
} }
}
// Clear mod-union table; it will be dirtied in the prologue of // Clear mod-union table; it will be dirtied in the prologue of
// CMS generation per each younger generation collection. // CMS generation per each younger generation collection.
@ -4417,7 +4500,9 @@ void CMSCollector::preclean() {
verify_overflow_empty(); verify_overflow_empty();
_abort_preclean = false; _abort_preclean = false;
if (CMSPrecleaningEnabled) { if (CMSPrecleaningEnabled) {
if (!CMSEdenChunksRecordAlways) {
_eden_chunk_index = 0; _eden_chunk_index = 0;
}
size_t used = get_eden_used(); size_t used = get_eden_used();
size_t capacity = get_eden_capacity(); size_t capacity = get_eden_capacity();
// Don't start sampling unless we will get sufficiently // Don't start sampling unless we will get sufficiently
@ -4526,7 +4611,9 @@ void CMSCollector::sample_eden() {
if (!_start_sampling) { if (!_start_sampling) {
return; return;
} }
if (_eden_chunk_array) { // When CMSEdenChunksRecordAlways is true, the eden chunk array
// is populated by the young generation.
if (_eden_chunk_array != NULL && !CMSEdenChunksRecordAlways) {
if (_eden_chunk_index < _eden_chunk_capacity) { if (_eden_chunk_index < _eden_chunk_capacity) {
_eden_chunk_array[_eden_chunk_index] = *_top_addr; // take sample _eden_chunk_array[_eden_chunk_index] = *_top_addr; // take sample
assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr, assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
@ -5010,6 +5097,10 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
// Update the saved marks which may affect the root scans. // Update the saved marks which may affect the root scans.
gch->save_marks(); gch->save_marks();
if (CMSPrintEdenSurvivorChunks) {
print_eden_and_survivor_chunk_arrays();
}
{ {
COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;) COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
@ -5116,10 +5207,53 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
} }
} }
void CMSParInitialMarkTask::work(uint worker_id) {
elapsedTimer _timer;
ResourceMark rm;
HandleMark hm;
// ---------- scan from roots --------------
_timer.start();
GenCollectedHeap* gch = GenCollectedHeap::heap();
Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap));
CMKlassClosure klass_closure(&par_mri_cl);
// ---------- young gen roots --------------
{
work_on_young_gen_roots(worker_id, &par_mri_cl);
_timer.stop();
if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr(
"Finished young gen initial mark scan work in %dth thread: %3.3f sec",
worker_id, _timer.seconds());
}
}
// ---------- remaining roots --------------
_timer.reset();
_timer.start();
gch->gen_process_strong_roots(_collector->_cmsGen->level(),
false, // yg was scanned above
false, // this is parallel code
false, // not scavenging
SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
&par_mri_cl,
true, // walk all of code cache if (so & SO_CodeCache)
NULL,
&klass_closure);
assert(_collector->should_unload_classes()
|| (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache),
"if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
_timer.stop();
if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr(
"Finished remaining root initial mark scan work in %dth thread: %3.3f sec",
worker_id, _timer.seconds());
}
}
// Parallel remark task // Parallel remark task
class CMSParRemarkTask: public AbstractGangTask { class CMSParRemarkTask: public CMSParMarkTask {
CMSCollector* _collector;
int _n_workers;
CompactibleFreeListSpace* _cms_space; CompactibleFreeListSpace* _cms_space;
// The per-thread work queues, available here for stealing. // The per-thread work queues, available here for stealing.
@ -5133,10 +5267,9 @@ class CMSParRemarkTask: public AbstractGangTask {
CompactibleFreeListSpace* cms_space, CompactibleFreeListSpace* cms_space,
int n_workers, FlexibleWorkGang* workers, int n_workers, FlexibleWorkGang* workers,
OopTaskQueueSet* task_queues): OopTaskQueueSet* task_queues):
AbstractGangTask("Rescan roots and grey objects in parallel"), CMSParMarkTask("Rescan roots and grey objects in parallel",
_collector(collector), collector, n_workers),
_cms_space(cms_space), _cms_space(cms_space),
_n_workers(n_workers),
_task_queues(task_queues), _task_queues(task_queues),
_term(n_workers, task_queues) { } _term(n_workers, task_queues) { }
@ -5150,11 +5283,6 @@ class CMSParRemarkTask: public AbstractGangTask {
void work(uint worker_id); void work(uint worker_id);
private: private:
// Work method in support of parallel rescan ... of young gen spaces
void do_young_space_rescan(int i, Par_MarkRefsIntoAndScanClosure* cl,
ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top);
// ... of dirty cards in old space // ... of dirty cards in old space
void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i, void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i,
Par_MarkRefsIntoAndScanClosure* cl); Par_MarkRefsIntoAndScanClosure* cl);
@ -5186,6 +5314,25 @@ class RemarkKlassClosure : public KlassClosure {
} }
}; };
void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
HeapWord** eca = _collector->_eden_chunk_array;
size_t ect = _collector->_eden_chunk_index;
HeapWord** sca = _collector->_survivor_chunk_array;
size_t sct = _collector->_survivor_chunk_index;
assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
do_young_space_rescan(worker_id, cl, to_space, NULL, 0);
do_young_space_rescan(worker_id, cl, from_space, sca, sct);
do_young_space_rescan(worker_id, cl, eden_space, eca, ect);
}
// work_queue(i) is passed to the closure // work_queue(i) is passed to the closure
// Par_MarkRefsIntoAndScanClosure. The "i" parameter // Par_MarkRefsIntoAndScanClosure. The "i" parameter
// also is passed to do_dirty_card_rescan_tasks() and to // also is passed to do_dirty_card_rescan_tasks() and to
@ -5210,23 +5357,7 @@ void CMSParRemarkTask::work(uint worker_id) {
// work first. // work first.
// ---------- young gen roots -------------- // ---------- young gen roots --------------
{ {
DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration(); work_on_young_gen_roots(worker_id, &par_mrias_cl);
EdenSpace* eden_space = dng->eden();
ContiguousSpace* from_space = dng->from();
ContiguousSpace* to_space = dng->to();
HeapWord** eca = _collector->_eden_chunk_array;
size_t ect = _collector->_eden_chunk_index;
HeapWord** sca = _collector->_survivor_chunk_array;
size_t sct = _collector->_survivor_chunk_index;
assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
do_young_space_rescan(worker_id, &par_mrias_cl, to_space, NULL, 0);
do_young_space_rescan(worker_id, &par_mrias_cl, from_space, sca, sct);
do_young_space_rescan(worker_id, &par_mrias_cl, eden_space, eca, ect);
_timer.stop(); _timer.stop();
if (PrintCMSStatistics != 0) { if (PrintCMSStatistics != 0) {
gclog_or_tty->print_cr( gclog_or_tty->print_cr(
@ -5334,8 +5465,8 @@ void CMSParRemarkTask::work(uint worker_id) {
// Note that parameter "i" is not used. // Note that parameter "i" is not used.
void void
CMSParRemarkTask::do_young_space_rescan(int i, CMSParMarkTask::do_young_space_rescan(uint worker_id,
Par_MarkRefsIntoAndScanClosure* cl, ContiguousSpace* space, OopsInGenClosure* cl, ContiguousSpace* space,
HeapWord** chunk_array, size_t chunk_top) { HeapWord** chunk_array, size_t chunk_top) {
// Until all tasks completed: // Until all tasks completed:
// . claim an unclaimed task // . claim an unclaimed task
@ -5530,6 +5661,32 @@ CMSParRemarkTask::do_work_steal(int i, Par_MarkRefsIntoAndScanClosure* cl,
"Else our work is not yet done"); "Else our work is not yet done");
} }
// Record object boundaries in _eden_chunk_array by sampling the eden
// top in the slow-path eden object allocation code path and record
// the boundaries, if CMSEdenChunksRecordAlways is true. If
// CMSEdenChunksRecordAlways is false, we use the other asynchronous
// sampling in sample_eden() that activates during the part of the
// preclean phase.
void CMSCollector::sample_eden_chunk() {
if (CMSEdenChunksRecordAlways && _eden_chunk_array != NULL) {
if (_eden_chunk_lock->try_lock()) {
// Record a sample. This is the critical section. The contents
// of the _eden_chunk_array have to be non-decreasing in the
// address order.
_eden_chunk_array[_eden_chunk_index] = *_top_addr;
assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
"Unexpected state of Eden");
if (_eden_chunk_index == 0 ||
((_eden_chunk_array[_eden_chunk_index] > _eden_chunk_array[_eden_chunk_index-1]) &&
(pointer_delta(_eden_chunk_array[_eden_chunk_index],
_eden_chunk_array[_eden_chunk_index-1]) >= CMSSamplingGrain))) {
_eden_chunk_index++; // commit sample
}
_eden_chunk_lock->unlock();
}
}
}
// Return a thread-local PLAB recording array, as appropriate. // Return a thread-local PLAB recording array, as appropriate.
void* CMSCollector::get_data_recorder(int thr_num) { void* CMSCollector::get_data_recorder(int thr_num) {
if (_survivor_plab_array != NULL && if (_survivor_plab_array != NULL &&
@ -5553,12 +5710,13 @@ void CMSCollector::reset_survivor_plab_arrays() {
// Merge the per-thread plab arrays into the global survivor chunk // Merge the per-thread plab arrays into the global survivor chunk
// array which will provide the partitioning of the survivor space // array which will provide the partitioning of the survivor space
// for CMS rescan. // for CMS initial scan and rescan.
void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv, void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
int no_of_gc_threads) { int no_of_gc_threads) {
assert(_survivor_plab_array != NULL, "Error"); assert(_survivor_plab_array != NULL, "Error");
assert(_survivor_chunk_array != NULL, "Error"); assert(_survivor_chunk_array != NULL, "Error");
assert(_collectorState == FinalMarking, "Error"); assert(_collectorState == FinalMarking ||
(CMSParallelInitialMarkEnabled && _collectorState == InitialMarking), "Error");
for (int j = 0; j < no_of_gc_threads; j++) { for (int j = 0; j < no_of_gc_threads; j++) {
_cursor[j] = 0; _cursor[j] = 0;
} }
@ -5621,7 +5779,7 @@ void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
} }
// Set up the space's par_seq_tasks structure for work claiming // Set up the space's par_seq_tasks structure for work claiming
// for parallel rescan of young gen. // for parallel initial scan and rescan of young gen.
// See ParRescanTask where this is currently used. // See ParRescanTask where this is currently used.
void void
CMSCollector:: CMSCollector::
@ -6748,6 +6906,28 @@ void MarkRefsIntoClosure::do_oop(oop obj) {
void MarkRefsIntoClosure::do_oop(oop* p) { MarkRefsIntoClosure::do_oop_work(p); } void MarkRefsIntoClosure::do_oop(oop* p) { MarkRefsIntoClosure::do_oop_work(p); }
void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); } void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); }
Par_MarkRefsIntoClosure::Par_MarkRefsIntoClosure(
MemRegion span, CMSBitMap* bitMap):
_span(span),
_bitMap(bitMap)
{
assert(_ref_processor == NULL, "deliberately left NULL");
assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
}
void Par_MarkRefsIntoClosure::do_oop(oop obj) {
// if p points into _span, then mark corresponding bit in _markBitMap
assert(obj->is_oop(), "expected an oop");
HeapWord* addr = (HeapWord*)obj;
if (_span.contains(addr)) {
// this should be made more efficient
_bitMap->par_mark(addr);
}
}
void Par_MarkRefsIntoClosure::do_oop(oop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
void Par_MarkRefsIntoClosure::do_oop(narrowOop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
// A variant of the above, used for CMS marking verification. // A variant of the above, used for CMS marking verification.
MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure( MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm): MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm):
@ -9305,7 +9485,6 @@ void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) {
return; return;
} }
} }
// Transfer some number of overflown objects to usual marking // Transfer some number of overflown objects to usual marking
// stack. Return true if some objects were transferred. // stack. Return true if some objects were transferred.
bool MarkRefsIntoAndScanClosure::take_from_overflow_list() { bool MarkRefsIntoAndScanClosure::take_from_overflow_list() {
@ -9377,4 +9556,3 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
ShouldNotReachHere(); ShouldNotReachHere();
} }
} }

View File

@ -515,6 +515,8 @@ class CMSCollector: public CHeapObj<mtGC> {
friend class ConcurrentMarkSweepThread; friend class ConcurrentMarkSweepThread;
friend class ConcurrentMarkSweepGeneration; friend class ConcurrentMarkSweepGeneration;
friend class CompactibleFreeListSpace; friend class CompactibleFreeListSpace;
friend class CMSParMarkTask;
friend class CMSParInitialMarkTask;
friend class CMSParRemarkTask; friend class CMSParRemarkTask;
friend class CMSConcMarkingTask; friend class CMSConcMarkingTask;
friend class CMSRefProcTaskProxy; friend class CMSRefProcTaskProxy;
@ -749,6 +751,7 @@ class CMSCollector: public CHeapObj<mtGC> {
Generation* _young_gen; // the younger gen Generation* _young_gen; // the younger gen
HeapWord** _top_addr; // ... Top of Eden HeapWord** _top_addr; // ... Top of Eden
HeapWord** _end_addr; // ... End of Eden HeapWord** _end_addr; // ... End of Eden
Mutex* _eden_chunk_lock;
HeapWord** _eden_chunk_array; // ... Eden partitioning array HeapWord** _eden_chunk_array; // ... Eden partitioning array
size_t _eden_chunk_index; // ... top (exclusive) of array size_t _eden_chunk_index; // ... top (exclusive) of array
size_t _eden_chunk_capacity; // ... max entries in array size_t _eden_chunk_capacity; // ... max entries in array
@ -950,6 +953,7 @@ class CMSCollector: public CHeapObj<mtGC> {
// Support for parallel remark of survivor space // Support for parallel remark of survivor space
void* get_data_recorder(int thr_num); void* get_data_recorder(int thr_num);
void sample_eden_chunk();
CMSBitMap* markBitMap() { return &_markBitMap; } CMSBitMap* markBitMap() { return &_markBitMap; }
void directAllocated(HeapWord* start, size_t size); void directAllocated(HeapWord* start, size_t size);
@ -1027,6 +1031,8 @@ class CMSCollector: public CHeapObj<mtGC> {
// Initialization errors // Initialization errors
bool completed_initialization() { return _completed_initialization; } bool completed_initialization() { return _completed_initialization; }
void print_eden_and_survivor_chunk_arrays();
}; };
class CMSExpansionCause : public AllStatic { class CMSExpansionCause : public AllStatic {
@ -1317,6 +1323,10 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
//Delegate to collector //Delegate to collector
return collector()->get_data_recorder(thr_num); return collector()->get_data_recorder(thr_num);
} }
void sample_eden_chunk() {
//Delegate to collector
return collector()->sample_eden_chunk();
}
// Printing // Printing
const char* name() const; const char* name() const;

View File

@ -96,11 +96,6 @@
"the buffer will be enqueued for processing. A value of 0 " \ "the buffer will be enqueued for processing. A value of 0 " \
"specifies that mutator threads should not do such filtering.") \ "specifies that mutator threads should not do such filtering.") \
\ \
develop(intx, G1ExtraRegionSurvRate, 33, \
"If the young survival rate is S, and there's room left in " \
"to-space, we will allow regions whose survival rate is up to " \
"S + (1 - S)*X, where X is this parameter (as a fraction.)") \
\
develop(bool, G1SATBPrintStubs, false, \ develop(bool, G1SATBPrintStubs, false, \
"If true, print generated stubs for the SATB barrier") \ "If true, print generated stubs for the SATB barrier") \
\ \
@ -110,9 +105,6 @@
develop(bool, G1RSBarrierRegionFilter, true, \ develop(bool, G1RSBarrierRegionFilter, true, \
"If true, generate region filtering code in RS barrier") \ "If true, generate region filtering code in RS barrier") \
\ \
develop(bool, G1RSBarrierNullFilter, true, \
"If true, generate null-pointer filtering code in RS barrier") \
\
develop(bool, G1DeferredRSUpdate, true, \ develop(bool, G1DeferredRSUpdate, true, \
"If true, use deferred RS updates") \ "If true, use deferred RS updates") \
\ \
@ -120,9 +112,6 @@
"If true, verify that no dirty cards remain after RS log " \ "If true, verify that no dirty cards remain after RS log " \
"processing.") \ "processing.") \
\ \
develop(bool, G1RSCountHisto, false, \
"If true, print a histogram of RS occupancies after each pause") \
\
diagnostic(bool, G1PrintRegionLivenessInfo, false, \ diagnostic(bool, G1PrintRegionLivenessInfo, false, \
"Prints the liveness information for all regions in the heap " \ "Prints the liveness information for all regions in the heap " \
"at the end of a marking cycle.") \ "at the end of a marking cycle.") \
@ -169,9 +158,6 @@
product(uintx, G1ConcRSHotCardLimit, 4, \ product(uintx, G1ConcRSHotCardLimit, 4, \
"The threshold that defines (>=) a hot card.") \ "The threshold that defines (>=) a hot card.") \
\ \
develop(bool, G1PrintOopAppls, false, \
"When true, print applications of closures to external locs.") \
\
develop(intx, G1RSetRegionEntriesBase, 256, \ develop(intx, G1RSetRegionEntriesBase, 256, \
"Max number of regions in a fine-grain table per MB.") \ "Max number of regions in a fine-grain table per MB.") \
\ \

View File

@ -314,6 +314,11 @@ void HeapRegion::setup_heap_region_size(uintx min_heap_size) {
region_size = MAX_REGION_SIZE; region_size = MAX_REGION_SIZE;
} }
if (region_size != G1HeapRegionSize) {
// Update the flag to make sure that PrintFlagsFinal logs the correct value
FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size);
}
// And recalculate the log. // And recalculate the log.
region_size_log = log2_long((jlong) region_size); region_size_log = log2_long((jlong) region_size);

View File

@ -927,11 +927,9 @@ void ParNewGeneration::collect(bool full,
workers->active_workers(), workers->active_workers(),
Threads::number_of_non_daemon_threads()); Threads::number_of_non_daemon_threads());
workers->set_active_workers(active_workers); workers->set_active_workers(active_workers);
_next_gen = gch->next_gen(this);
assert(_next_gen != NULL,
"This must be the youngest gen, and not the only gen");
assert(gch->n_gens() == 2, assert(gch->n_gens() == 2,
"Par collection currently only works with single older gen."); "Par collection currently only works with single older gen.");
_next_gen = gch->next_gen(this);
// Do we have to avoid promotion_undo? // Do we have to avoid promotion_undo?
if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) { if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) {
set_avoid_promotion_undo(true); set_avoid_promotion_undo(true);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2012, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@
#include "gc_implementation/shared/parGCAllocBuffer.hpp" #include "gc_implementation/shared/parGCAllocBuffer.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp"
#include "memory/defNewGeneration.hpp" #include "memory/defNewGeneration.hpp"
#include "memory/padded.hpp"
#include "utilities/taskqueue.hpp" #include "utilities/taskqueue.hpp"
class ChunkArray; class ChunkArray;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
#define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_HPP #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PAROOPCLOSURES_HPP
#include "memory/genOopClosures.hpp" #include "memory/genOopClosures.hpp"
#include "memory/padded.hpp"
// Closures for ParNewGeneration // Closures for ParNewGeneration

View File

@ -29,11 +29,13 @@
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp" #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
#include "gc_implementation/shared/gcTrace.hpp" #include "gc_implementation/shared/gcTrace.hpp"
#include "gc_implementation/shared/mutableSpace.hpp" #include "gc_implementation/shared/mutableSpace.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/memRegion.hpp" #include "memory/memRegion.hpp"
#include "memory/padded.inline.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "oops/oop.psgc.inline.hpp" #include "oops/oop.psgc.inline.hpp"
PSPromotionManager** PSPromotionManager::_manager_array = NULL; PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL; OopStarTaskQueueSet* PSPromotionManager::_stack_array_depth = NULL;
PSOldGen* PSPromotionManager::_old_gen = NULL; PSOldGen* PSPromotionManager::_old_gen = NULL;
MutableSpace* PSPromotionManager::_young_space = NULL; MutableSpace* PSPromotionManager::_young_space = NULL;
@ -45,8 +47,10 @@ void PSPromotionManager::initialize() {
_old_gen = heap->old_gen(); _old_gen = heap->old_gen();
_young_space = heap->young_gen()->to_space(); _young_space = heap->young_gen()->to_space();
// To prevent false sharing, we pad the PSPromotionManagers
// and make sure that the first instance starts at a cache line.
assert(_manager_array == NULL, "Attempt to initialize twice"); assert(_manager_array == NULL, "Attempt to initialize twice");
_manager_array = NEW_C_HEAP_ARRAY(PSPromotionManager*, ParallelGCThreads+1, mtGC); _manager_array = PaddedArray<PSPromotionManager, mtGC>::create_unfreeable(ParallelGCThreads + 1);
guarantee(_manager_array != NULL, "Could not initialize promotion manager"); guarantee(_manager_array != NULL, "Could not initialize promotion manager");
_stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads); _stack_array_depth = new OopStarTaskQueueSet(ParallelGCThreads);
@ -54,26 +58,21 @@ void PSPromotionManager::initialize() {
// Create and register the PSPromotionManager(s) for the worker threads. // Create and register the PSPromotionManager(s) for the worker threads.
for(uint i=0; i<ParallelGCThreads; i++) { for(uint i=0; i<ParallelGCThreads; i++) {
_manager_array[i] = new PSPromotionManager(); stack_array_depth()->register_queue(i, _manager_array[i].claimed_stack_depth());
guarantee(_manager_array[i] != NULL, "Could not create PSPromotionManager");
stack_array_depth()->register_queue(i, _manager_array[i]->claimed_stack_depth());
} }
// The VMThread gets its own PSPromotionManager, which is not available // The VMThread gets its own PSPromotionManager, which is not available
// for work stealing. // for work stealing.
_manager_array[ParallelGCThreads] = new PSPromotionManager();
guarantee(_manager_array[ParallelGCThreads] != NULL, "Could not create PSPromotionManager");
} }
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) { PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range"); assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
assert(_manager_array != NULL, "Sanity"); assert(_manager_array != NULL, "Sanity");
return _manager_array[index]; return &_manager_array[index];
} }
PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() { PSPromotionManager* PSPromotionManager::vm_thread_promotion_manager() {
assert(_manager_array != NULL, "Sanity"); assert(_manager_array != NULL, "Sanity");
return _manager_array[ParallelGCThreads]; return &_manager_array[ParallelGCThreads];
} }
void PSPromotionManager::pre_scavenge() { void PSPromotionManager::pre_scavenge() {

View File

@ -29,6 +29,8 @@
#include "gc_implementation/shared/gcTrace.hpp" #include "gc_implementation/shared/gcTrace.hpp"
#include "gc_implementation/shared/copyFailedInfo.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp"
#include "memory/allocation.hpp" #include "memory/allocation.hpp"
#include "memory/padded.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/taskqueue.hpp" #include "utilities/taskqueue.hpp"
// //
@ -51,11 +53,11 @@ class MutableSpace;
class PSOldGen; class PSOldGen;
class ParCompactionManager; class ParCompactionManager;
class PSPromotionManager : public CHeapObj<mtGC> { class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
friend class PSScavenge; friend class PSScavenge;
friend class PSRefProcTaskExecutor; friend class PSRefProcTaskExecutor;
private: private:
static PSPromotionManager** _manager_array; static PaddedEnd<PSPromotionManager>* _manager_array;
static OopStarTaskQueueSet* _stack_array_depth; static OopStarTaskQueueSet* _stack_array_depth;
static PSOldGen* _old_gen; static PSOldGen* _old_gen;
static MutableSpace* _young_space; static MutableSpace* _young_space;

View File

@ -32,7 +32,7 @@
inline PSPromotionManager* PSPromotionManager::manager_array(int index) { inline PSPromotionManager* PSPromotionManager::manager_array(int index) {
assert(_manager_array != NULL, "access of NULL manager_array"); assert(_manager_array != NULL, "access of NULL manager_array");
assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access"); assert(index >= 0 && index <= (int)ParallelGCThreads, "out of range manager_array access");
return _manager_array[index]; return &_manager_array[index];
} }
template <class T> template <class T>

View File

@ -32,6 +32,7 @@
#if INCLUDE_SERVICES #if INCLUDE_SERVICES
void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) { void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) {
#if INCLUDE_TRACE
assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId), assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId),
"Only call this method if the event is enabled"); "Only call this method if the event is enabled");
@ -42,6 +43,7 @@ void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong
event.set_totalSize(entry->words() * BytesPerWord); event.set_totalSize(entry->words() * BytesPerWord);
event.set_endtime(timestamp); event.set_endtime(timestamp);
event.commit(); event.commit();
#endif // INCLUDE_TRACE
} }
bool ObjectCountEventSender::should_send_event() { bool ObjectCountEventSender::should_send_event() {

View File

@ -1209,3 +1209,26 @@ IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* threa
size_of_arguments * Interpreter::stackElementSize); size_of_arguments * Interpreter::stackElementSize);
IRT_END IRT_END
#endif #endif
#if INCLUDE_JVMTI
// This is a support of the JVMTI PopFrame interface.
// Make sure it is an invokestatic of a polymorphic intrinsic that has a member_name argument
// and return it as a vm_result so that it can be reloaded in the list of invokestatic parameters.
// The dmh argument is a reference to a DirectMethoHandle that has a member name field.
IRT_ENTRY(void, InterpreterRuntime::member_name_arg_or_null(JavaThread* thread, address dmh,
Method* method, address bcp))
Bytecodes::Code code = Bytecodes::code_at(method, bcp);
if (code != Bytecodes::_invokestatic) {
return;
}
ConstantPool* cpool = method->constants();
int cp_index = Bytes::get_native_u2(bcp + 1) + ConstantPool::CPCACHE_INDEX_TAG;
Symbol* cname = cpool->klass_name_at(cpool->klass_ref_index_at(cp_index));
Symbol* mname = cpool->name_ref_at(cp_index);
if (MethodHandles::has_member_arg(cname, mname)) {
oop member_name = java_lang_invoke_DirectMethodHandle::member((oop)dmh);
thread->set_vm_result(member_name);
}
IRT_END
#endif // INCLUDE_JVMTI

View File

@ -95,6 +95,9 @@ class InterpreterRuntime: AllStatic {
static void create_exception(JavaThread* thread, char* name, char* message); static void create_exception(JavaThread* thread, char* name, char* message);
static void create_klass_exception(JavaThread* thread, char* name, oopDesc* obj); static void create_klass_exception(JavaThread* thread, char* name, oopDesc* obj);
static address exception_handler_for_exception(JavaThread* thread, oopDesc* exception); static address exception_handler_for_exception(JavaThread* thread, oopDesc* exception);
#if INCLUDE_JVMTI
static void member_name_arg_or_null(JavaThread* thread, address dmh, Method* m, address bcp);
#endif
static void throw_pending_exception(JavaThread* thread); static void throw_pending_exception(JavaThread* thread);
// Statics & fields // Statics & fields

View File

@ -310,46 +310,31 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp,
_ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this); _ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
} }
void CardTableRS::clear_into_younger(Generation* gen) { void CardTableRS::clear_into_younger(Generation* old_gen) {
GenCollectedHeap* gch = GenCollectedHeap::heap(); assert(old_gen->level() == 1, "Should only be called for the old generation");
// Generations younger than gen have been evacuated. We can clear // The card tables for the youngest gen need never be cleared.
// card table entries for gen (we know that it has no pointers
// to younger gens) and for those below. The card tables for
// the youngest gen need never be cleared.
// There's a bit of subtlety in the clear() and invalidate() // There's a bit of subtlety in the clear() and invalidate()
// methods that we exploit here and in invalidate_or_clear() // methods that we exploit here and in invalidate_or_clear()
// below to avoid missing cards at the fringes. If clear() or // below to avoid missing cards at the fringes. If clear() or
// invalidate() are changed in the future, this code should // invalidate() are changed in the future, this code should
// be revisited. 20040107.ysr // be revisited. 20040107.ysr
Generation* g = gen; clear(old_gen->prev_used_region());
for(Generation* prev_gen = gch->prev_gen(g);
prev_gen != NULL;
g = prev_gen, prev_gen = gch->prev_gen(g)) {
MemRegion to_be_cleared_mr = g->prev_used_region();
clear(to_be_cleared_mr);
}
} }
void CardTableRS::invalidate_or_clear(Generation* gen, bool younger) { void CardTableRS::invalidate_or_clear(Generation* old_gen) {
GenCollectedHeap* gch = GenCollectedHeap::heap(); assert(old_gen->level() == 1, "Should only be called for the old generation");
// For each generation gen (and younger) // Invalidate the cards for the currently occupied part of
// invalidate the cards for the currently occupied part // the old generation and clear the cards for the
// of that generation and clear the cards for the
// unoccupied part of the generation (if any, making use // unoccupied part of the generation (if any, making use
// of that generation's prev_used_region to determine that // of that generation's prev_used_region to determine that
// region). No need to do anything for the youngest // region). No need to do anything for the youngest
// generation. Also see note#20040107.ysr above. // generation. Also see note#20040107.ysr above.
Generation* g = gen; MemRegion used_mr = old_gen->used_region();
for(Generation* prev_gen = gch->prev_gen(g); prev_gen != NULL; MemRegion to_be_cleared_mr = old_gen->prev_used_region().minus(used_mr);
g = prev_gen, prev_gen = gch->prev_gen(g)) {
MemRegion used_mr = g->used_region();
MemRegion to_be_cleared_mr = g->prev_used_region().minus(used_mr);
if (!to_be_cleared_mr.is_empty()) { if (!to_be_cleared_mr.is_empty()) {
clear(to_be_cleared_mr); clear(to_be_cleared_mr);
} }
invalidate(used_mr); invalidate(used_mr);
if (!younger) break;
}
} }

View File

@ -142,12 +142,12 @@ public:
void verify_aligned_region_empty(MemRegion mr); void verify_aligned_region_empty(MemRegion mr);
void clear(MemRegion mr) { _ct_bs->clear(mr); } void clear(MemRegion mr) { _ct_bs->clear(mr); }
void clear_into_younger(Generation* gen); void clear_into_younger(Generation* old_gen);
void invalidate(MemRegion mr, bool whole_heap = false) { void invalidate(MemRegion mr, bool whole_heap = false) {
_ct_bs->invalidate(mr, whole_heap); _ct_bs->invalidate(mr, whole_heap);
} }
void invalidate_or_clear(Generation* gen, bool younger); void invalidate_or_clear(Generation* old_gen);
static uintx ct_max_alignment_constraint() { static uintx ct_max_alignment_constraint() {
return CardTableModRefBS::ct_max_alignment_constraint(); return CardTableModRefBS::ct_max_alignment_constraint();

View File

@ -567,8 +567,6 @@ void DefNewGeneration::collect(bool full,
gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start()); gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
_next_gen = gch->next_gen(this); _next_gen = gch->next_gen(this);
assert(_next_gen != NULL,
"This must be the youngest gen, and not the only gen");
// If the next generation is too full to accommodate promotion // If the next generation is too full to accommodate promotion
// from this generation, pass on collection; let the next generation // from this generation, pass on collection; let the next generation
@ -901,8 +899,6 @@ bool DefNewGeneration::collection_attempt_is_safe() {
if (_next_gen == NULL) { if (_next_gen == NULL) {
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
_next_gen = gch->next_gen(this); _next_gen = gch->next_gen(this);
assert(_next_gen != NULL,
"This must be the youngest gen, and not the only gen");
} }
return _next_gen->promotion_attempt_is_safe(used()); return _next_gen->promotion_attempt_is_safe(used());
} }
@ -1033,6 +1029,9 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
// have to use it here, as well. // have to use it here, as well.
HeapWord* result = eden()->par_allocate(word_size); HeapWord* result = eden()->par_allocate(word_size);
if (result != NULL) { if (result != NULL) {
if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
}
return result; return result;
} }
do { do {
@ -1063,13 +1062,19 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
// circular dependency at compile time. // circular dependency at compile time.
if (result == NULL) { if (result == NULL) {
result = allocate_from_space(word_size); result = allocate_from_space(word_size);
} else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
} }
return result; return result;
} }
HeapWord* DefNewGeneration::par_allocate(size_t word_size, HeapWord* DefNewGeneration::par_allocate(size_t word_size,
bool is_tlab) { bool is_tlab) {
return eden()->par_allocate(word_size); HeapWord* res = eden()->par_allocate(word_size);
if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
_next_gen->sample_eden_chunk();
}
return res;
} }
void DefNewGeneration::gc_prologue(bool full) { void DefNewGeneration::gc_prologue(bool full) {

View File

@ -1070,13 +1070,13 @@ GenCollectedHeap* GenCollectedHeap::heap() {
void GenCollectedHeap::prepare_for_compaction() { void GenCollectedHeap::prepare_for_compaction() {
Generation* scanning_gen = _gens[_n_gens-1]; guarantee(_n_gens = 2, "Wrong number of generations");
Generation* old_gen = _gens[1];
// Start by compacting into same gen. // Start by compacting into same gen.
CompactPoint cp(scanning_gen, NULL, NULL); CompactPoint cp(old_gen, NULL, NULL);
while (scanning_gen != NULL) { old_gen->prepare_for_compaction(&cp);
scanning_gen->prepare_for_compaction(&cp); Generation* young_gen = _gens[0];
scanning_gen = prev_gen(scanning_gen); young_gen->prepare_for_compaction(&cp);
}
} }
GCStats* GenCollectedHeap::gc_stats(int level) const { GCStats* GenCollectedHeap::gc_stats(int level) const {
@ -1245,27 +1245,14 @@ void GenCollectedHeap::ensure_parsability(bool retire_tlabs) {
generation_iterate(&ep_cl, false); generation_iterate(&ep_cl, false);
} }
oop GenCollectedHeap::handle_failed_promotion(Generation* gen, oop GenCollectedHeap::handle_failed_promotion(Generation* old_gen,
oop obj, oop obj,
size_t obj_size) { size_t obj_size) {
guarantee(old_gen->level() == 1, "We only get here with an old generation");
assert(obj_size == (size_t)obj->size(), "bad obj_size passed in"); assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
HeapWord* result = NULL; HeapWord* result = NULL;
// First give each higher generation a chance to allocate the promoted object. result = old_gen->expand_and_allocate(obj_size, false);
Generation* allocator = next_gen(gen);
if (allocator != NULL) {
do {
result = allocator->allocate(obj_size, false);
} while (result == NULL && (allocator = next_gen(allocator)) != NULL);
}
if (result == NULL) {
// Then give gen and higher generations a chance to expand and allocate the
// object.
do {
result = gen->expand_and_allocate(obj_size, false);
} while (result == NULL && (gen = next_gen(gen)) != NULL);
}
if (result != NULL) { if (result != NULL) {
Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size); Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size);

View File

@ -368,25 +368,23 @@ public:
// collection. // collection.
virtual bool is_maximal_no_gc() const; virtual bool is_maximal_no_gc() const;
// Return the generation before "gen", or else NULL. // Return the generation before "gen".
Generation* prev_gen(Generation* gen) const { Generation* prev_gen(Generation* gen) const {
int l = gen->level(); int l = gen->level();
if (l == 0) return NULL; guarantee(l > 0, "Out of bounds");
else return _gens[l-1]; return _gens[l-1];
} }
// Return the generation after "gen", or else NULL. // Return the generation after "gen".
Generation* next_gen(Generation* gen) const { Generation* next_gen(Generation* gen) const {
int l = gen->level() + 1; int l = gen->level() + 1;
if (l == _n_gens) return NULL; guarantee(l < _n_gens, "Out of bounds");
else return _gens[l]; return _gens[l];
} }
Generation* get_gen(int i) const { Generation* get_gen(int i) const {
if (i >= 0 && i < _n_gens) guarantee(i >= 0 && i < _n_gens, "Out of bounds");
return _gens[i]; return _gens[i];
else
return NULL;
} }
int n_gens() const { int n_gens() const {
@ -485,9 +483,9 @@ public:
// Promotion of obj into gen failed. Try to promote obj to higher // Promotion of obj into gen failed. Try to promote obj to higher
// gens in ascending order; return the new location of obj if successful. // gens in ascending order; return the new location of obj if successful.
// Otherwise, try expand-and-allocate for obj in each generation starting at // Otherwise, try expand-and-allocate for obj in both the young and old
// gen; return the new location of obj if successful. Otherwise, return NULL. // generation; return the new location of obj if successful. Otherwise, return NULL.
oop handle_failed_promotion(Generation* gen, oop handle_failed_promotion(Generation* old_gen,
oop obj, oop obj,
size_t obj_size); size_t obj_size);

View File

@ -52,8 +52,8 @@
#include "utilities/copy.hpp" #include "utilities/copy.hpp"
#include "utilities/events.hpp" #include "utilities/events.hpp"
void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) {
bool clear_all_softrefs) { guarantee(level == 1, "We always collect both old and young.");
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint"); assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
GenCollectedHeap* gch = GenCollectedHeap::heap(); GenCollectedHeap* gch = GenCollectedHeap::heap();
@ -84,11 +84,6 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
// Capture heap size before collection for printing. // Capture heap size before collection for printing.
size_t gch_prev_used = gch->used(); size_t gch_prev_used = gch->used();
// Some of the card table updates below assume that the perm gen is
// also being collected.
assert(level == gch->n_gens() - 1,
"All generations are being collected, ergo perm gen too.");
// Capture used regions for each generation that will be // Capture used regions for each generation that will be
// subject to collection, so that card table adjustments can // subject to collection, so that card table adjustments can
// be made intelligently (see clear / invalidate further below). // be made intelligently (see clear / invalidate further below).
@ -126,17 +121,15 @@ void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
all_empty = all_empty && gch->get_gen(i)->used() == 0; all_empty = all_empty && gch->get_gen(i)->used() == 0;
} }
GenRemSet* rs = gch->rem_set(); GenRemSet* rs = gch->rem_set();
Generation* old_gen = gch->get_gen(level);
// Clear/invalidate below make use of the "prev_used_regions" saved earlier. // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
if (all_empty) { if (all_empty) {
// We've evacuated all generations below us. // We've evacuated all generations below us.
Generation* g = gch->get_gen(level); rs->clear_into_younger(old_gen);
rs->clear_into_younger(g);
} else { } else {
// Invalidate the cards corresponding to the currently used // Invalidate the cards corresponding to the currently used
// region and clear those corresponding to the evacuated region // region and clear those corresponding to the evacuated region.
// of all generations just collected (i.e. level and younger). rs->invalidate_or_clear(old_gen);
rs->invalidate_or_clear(gch->get_gen(level),
true /* younger */);
} }
Threads::gc_epilogue(); Threads::gc_epilogue();

View File

@ -135,7 +135,7 @@ public:
// younger than gen from generations gen and older. // younger than gen from generations gen and older.
// The parameter clear_perm indicates if the perm_gen's // The parameter clear_perm indicates if the perm_gen's
// remembered set should also be processed/cleared. // remembered set should also be processed/cleared.
virtual void clear_into_younger(Generation* gen) = 0; virtual void clear_into_younger(Generation* old_gen) = 0;
// Informs the RS that refs in the given "mr" may have changed // Informs the RS that refs in the given "mr" may have changed
// arbitrarily, and therefore may contain old-to-young pointers. // arbitrarily, and therefore may contain old-to-young pointers.
@ -146,11 +146,8 @@ public:
// Informs the RS that refs in this generation // Informs the RS that refs in this generation
// may have changed arbitrarily, and therefore may contain // may have changed arbitrarily, and therefore may contain
// old-to-young pointers in arbitrary locations. The parameter // old-to-young pointers in arbitrary locations.
// younger indicates if the same should be done for younger generations virtual void invalidate_or_clear(Generation* old_gen) = 0;
// as well. The parameter perm indicates if the same should be done for
// perm gen as well.
virtual void invalidate_or_clear(Generation* gen, bool younger) = 0;
}; };
#endif // SHARE_VM_MEMORY_GENREMSET_HPP #endif // SHARE_VM_MEMORY_GENREMSET_HPP

View File

@ -455,6 +455,7 @@ class Generation: public CHeapObj<mtGC> {
// expected to be GC worker thread-local, with the worker index // expected to be GC worker thread-local, with the worker index
// indicated by "thr_num". // indicated by "thr_num".
virtual void* get_data_recorder(int thr_num) { return NULL; } virtual void* get_data_recorder(int thr_num) { return NULL; }
virtual void sample_eden_chunk() {}
// Some generations may require some cleanup actions before allowing // Some generations may require some cleanup actions before allowing
// a verification. // a verification.

View File

@ -2254,10 +2254,11 @@ ChunkIndex ChunkManager::list_index(size_t size) {
void SpaceManager::deallocate(MetaWord* p, size_t word_size) { void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
assert_lock_strong(_lock); assert_lock_strong(_lock);
size_t raw_word_size = get_raw_word_size(word_size);
size_t min_size = TreeChunk<Metablock, FreeList>::min_size(); size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
assert(word_size >= min_size, assert(raw_word_size >= min_size,
err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size)); err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size));
block_freelists()->return_block(p, word_size); block_freelists()->return_block(p, raw_word_size);
} }
// Adds a chunk to the list of chunks in use. // Adds a chunk to the list of chunks in use.

View File

@ -0,0 +1,93 @@
/*
* 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 SHARE_VM_MEMORY_PADDED_HPP
#define SHARE_VM_MEMORY_PADDED_HPP
#include "memory/allocation.hpp"
#include "utilities/globalDefinitions.hpp"
// Bytes needed to pad type to avoid cache-line sharing; alignment should be the
// expected cache line size (a power of two). The first addend avoids sharing
// when the start address is not a multiple of alignment; the second maintains
// alignment of starting addresses that happen to be a multiple.
#define PADDING_SIZE(type, alignment) \
((alignment) + align_size_up_(sizeof(type), alignment))
// Templates to create a subclass padded to avoid cache line sharing. These are
// effective only when applied to derived-most (leaf) classes.
// When no args are passed to the base ctor.
template <class T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class Padded : public T {
private:
char _pad_buf_[PADDING_SIZE(T, alignment)];
};
// When either 0 or 1 args may be passed to the base ctor.
template <class T, typename Arg1T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class Padded01 : public T {
public:
Padded01(): T() { }
Padded01(Arg1T arg1): T(arg1) { }
private:
char _pad_buf_[PADDING_SIZE(T, alignment)];
};
// Super class of PaddedEnd when pad_size != 0.
template <class T, size_t pad_size>
class PaddedEndImpl : public T {
private:
char _pad_buf[pad_size];
};
// Super class of PaddedEnd when pad_size == 0.
template <class T>
class PaddedEndImpl<T, /*pad_size*/ 0> : public T {
// No padding.
};
#define PADDED_END_SIZE(type, alignment) (align_size_up_(sizeof(type), alignment) - sizeof(type))
// More memory conservative implementation of Padded. The subclass adds the
// minimal amount of padding needed to make the size of the objects be aligned.
// This will help reducing false sharing,
// if the start address is a multiple of alignment.
template <class T, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class PaddedEnd : public PaddedEndImpl<T, PADDED_END_SIZE(T, alignment)> {
// C++ don't allow zero-length arrays. The padding is put in a
// super class that is specialized for the pad_size == 0 case.
};
// Helper class to create an array of PaddedEnd<T> objects. All elements will
// start at a multiple of alignment and the size will be aligned to alignment.
template <class T, MEMFLAGS flags, size_t alignment = DEFAULT_CACHE_LINE_SIZE>
class PaddedArray {
public:
// Creates an aligned padded array.
// The memory can't be deleted since the raw memory chunk is not returned.
static PaddedEnd<T>* create_unfreeable(uint length);
};
#endif // SHARE_VM_MEMORY_PADDED_HPP

View File

@ -0,0 +1,49 @@
/*
* 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 "memory/allocation.inline.hpp"
#include "memory/padded.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"
// Creates an aligned padded array.
// The memory can't be deleted since the raw memory chunk is not returned.
template <class T, MEMFLAGS flags, size_t alignment>
PaddedEnd<T>* PaddedArray<T, flags, alignment>::create_unfreeable(uint length) {
// Check that the PaddedEnd class works as intended.
STATIC_ASSERT(is_size_aligned_(sizeof(PaddedEnd<T>), alignment));
// Allocate a chunk of memory large enough to allow for some alignment.
void* chunk = AllocateHeap(length * sizeof(PaddedEnd<T, alignment>) + alignment, flags);
// Make the initial alignment.
PaddedEnd<T>* aligned_padded_array = (PaddedEnd<T>*)align_pointer_up(chunk, alignment);
// Call the default constructor for each element.
for (uint i = 0; i < length; i++) {
::new (&aligned_padded_array[i]) T();
}
return aligned_padded_array;
}

View File

@ -65,7 +65,8 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) :
} }
_sh = this; // ch is static, should be set only once. _sh = this; // ch is static, should be set only once.
if ((UseParNewGC || if ((UseParNewGC ||
(UseConcMarkSweepGC && CMSParallelRemarkEnabled) || (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
CMSParallelRemarkEnabled)) ||
UseG1GC) && UseG1GC) &&
ParallelGCThreads > 0) { ParallelGCThreads > 0) {
_workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads, _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,

View File

@ -105,10 +105,9 @@ objArrayOop Universe::_the_empty_class_klass_array = NULL;
Array<Klass*>* Universe::_the_array_interfaces_array = NULL; Array<Klass*>* Universe::_the_array_interfaces_array = NULL;
oop Universe::_the_null_string = NULL; oop Universe::_the_null_string = NULL;
oop Universe::_the_min_jint_string = NULL; oop Universe::_the_min_jint_string = NULL;
LatestMethodOopCache* Universe::_finalizer_register_cache = NULL; LatestMethodCache* Universe::_finalizer_register_cache = NULL;
LatestMethodOopCache* Universe::_loader_addClass_cache = NULL; LatestMethodCache* Universe::_loader_addClass_cache = NULL;
LatestMethodOopCache* Universe::_pd_implies_cache = NULL; LatestMethodCache* Universe::_pd_implies_cache = NULL;
ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL;
oop Universe::_out_of_memory_error_java_heap = NULL; oop Universe::_out_of_memory_error_java_heap = NULL;
oop Universe::_out_of_memory_error_metaspace = NULL; oop Universe::_out_of_memory_error_metaspace = NULL;
oop Universe::_out_of_memory_error_class_metaspace = NULL; oop Universe::_out_of_memory_error_class_metaspace = NULL;
@ -225,7 +224,6 @@ void Universe::serialize(SerializeClosure* f, bool do_all) {
f->do_ptr((void**)&_the_empty_klass_array); f->do_ptr((void**)&_the_empty_klass_array);
_finalizer_register_cache->serialize(f); _finalizer_register_cache->serialize(f);
_loader_addClass_cache->serialize(f); _loader_addClass_cache->serialize(f);
_reflect_invoke_cache->serialize(f);
_pd_implies_cache->serialize(f); _pd_implies_cache->serialize(f);
} }
@ -649,10 +647,9 @@ jint universe_init() {
// We have a heap so create the Method* caches before // We have a heap so create the Method* caches before
// Metaspace::initialize_shared_spaces() tries to populate them. // Metaspace::initialize_shared_spaces() tries to populate them.
Universe::_finalizer_register_cache = new LatestMethodOopCache(); Universe::_finalizer_register_cache = new LatestMethodCache();
Universe::_loader_addClass_cache = new LatestMethodOopCache(); Universe::_loader_addClass_cache = new LatestMethodCache();
Universe::_pd_implies_cache = new LatestMethodOopCache(); Universe::_pd_implies_cache = new LatestMethodCache();
Universe::_reflect_invoke_cache = new ActiveMethodOopsCache();
if (UseSharedSpaces) { if (UseSharedSpaces) {
// Read the data structures supporting the shared spaces (shared // Read the data structures supporting the shared spaces (shared
@ -1088,35 +1085,21 @@ bool universe_post_init() {
vmSymbols::register_method_name(), vmSymbols::register_method_name(),
vmSymbols::register_method_signature()); vmSymbols::register_method_signature());
if (m == NULL || !m->is_static()) { if (m == NULL || !m->is_static()) {
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), tty->print_cr("Unable to link/verify Finalizer.register method");
"java.lang.ref.Finalizer.register", false); return false; // initialization failed (cannot throw exception yet)
} }
Universe::_finalizer_register_cache->init( Universe::_finalizer_register_cache->init(
SystemDictionary::Finalizer_klass(), m, CHECK_false); SystemDictionary::Finalizer_klass(), m);
// Resolve on first use and initialize class.
// Note: No race-condition here, since a resolve will always return the same result
// Setup method for security checks
k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_reflect_Method(), true, CHECK_false);
k_h = instanceKlassHandle(THREAD, k);
k_h->link_class(CHECK_false);
m = k_h->find_method(vmSymbols::invoke_name(), vmSymbols::object_object_array_object_signature());
if (m == NULL || m->is_static()) {
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(),
"java.lang.reflect.Method.invoke", false);
}
Universe::_reflect_invoke_cache->init(k_h(), m, CHECK_false);
// Setup method for registering loaded classes in class loader vector // Setup method for registering loaded classes in class loader vector
InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false); InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature()); m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
if (m == NULL || m->is_static()) { if (m == NULL || m->is_static()) {
THROW_MSG_(vmSymbols::java_lang_NoSuchMethodException(), tty->print_cr("Unable to link/verify ClassLoader.addClass method");
"java.lang.ClassLoader.addClass", false); return false; // initialization failed (cannot throw exception yet)
} }
Universe::_loader_addClass_cache->init( Universe::_loader_addClass_cache->init(
SystemDictionary::ClassLoader_klass(), m, CHECK_false); SystemDictionary::ClassLoader_klass(), m);
// Setup method for checking protection domain // Setup method for checking protection domain
InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false); InstanceKlass::cast(SystemDictionary::ProtectionDomain_klass())->link_class(CHECK_false);
@ -1132,7 +1115,7 @@ bool universe_post_init() {
return false; // initialization failed return false; // initialization failed
} }
Universe::_pd_implies_cache->init( Universe::_pd_implies_cache->init(
SystemDictionary::ProtectionDomain_klass(), m, CHECK_false);; SystemDictionary::ProtectionDomain_klass(), m);;
} }
// The folowing is initializing converter functions for serialization in // The folowing is initializing converter functions for serialization in
@ -1455,7 +1438,7 @@ void Universe::compute_verify_oop_data() {
} }
void CommonMethodOopCache::init(Klass* k, Method* m, TRAPS) { void LatestMethodCache::init(Klass* k, Method* m) {
if (!UseSharedSpaces) { if (!UseSharedSpaces) {
_klass = k; _klass = k;
} }
@ -1471,88 +1454,7 @@ void CommonMethodOopCache::init(Klass* k, Method* m, TRAPS) {
} }
ActiveMethodOopsCache::~ActiveMethodOopsCache() { Method* LatestMethodCache::get_method() {
if (_prev_methods != NULL) {
delete _prev_methods;
_prev_methods = NULL;
}
}
void ActiveMethodOopsCache::add_previous_version(Method* method) {
assert(Thread::current()->is_VM_thread(),
"only VMThread can add previous versions");
// Only append the previous method if it is executing on the stack.
if (method->on_stack()) {
if (_prev_methods == NULL) {
// This is the first previous version so make some space.
// Start with 2 elements under the assumption that the class
// won't be redefined much.
_prev_methods = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Method*>(2, true);
}
// RC_TRACE macro has an embedded ResourceMark
RC_TRACE(0x00000100,
("add: %s(%s): adding prev version ref for cached method @%d",
method->name()->as_C_string(), method->signature()->as_C_string(),
_prev_methods->length()));
_prev_methods->append(method);
}
// Since the caller is the VMThread and we are at a safepoint, this is a good
// time to clear out unused method references.
if (_prev_methods == NULL) return;
for (int i = _prev_methods->length() - 1; i >= 0; i--) {
Method* method = _prev_methods->at(i);
assert(method != NULL, "weak method ref was unexpectedly cleared");
if (!method->on_stack()) {
// This method isn't running anymore so remove it
_prev_methods->remove_at(i);
MetadataFactory::free_metadata(method->method_holder()->class_loader_data(), method);
} else {
// RC_TRACE macro has an embedded ResourceMark
RC_TRACE(0x00000400,
("add: %s(%s): previous cached method @%d is alive",
method->name()->as_C_string(), method->signature()->as_C_string(), i));
}
}
} // end add_previous_version()
bool ActiveMethodOopsCache::is_same_method(const Method* method) const {
InstanceKlass* ik = InstanceKlass::cast(klass());
const Method* check_method = ik->method_with_idnum(method_idnum());
assert(check_method != NULL, "sanity check");
if (check_method == method) {
// done with the easy case
return true;
}
if (_prev_methods != NULL) {
// The cached method has been redefined at least once so search
// the previous versions for a match.
for (int i = 0; i < _prev_methods->length(); i++) {
check_method = _prev_methods->at(i);
if (check_method == method) {
// a previous version matches
return true;
}
}
}
// either no previous versions or no previous version matched
return false;
}
Method* LatestMethodOopCache::get_Method() {
if (klass() == NULL) return NULL; if (klass() == NULL) return NULL;
InstanceKlass* ik = InstanceKlass::cast(klass()); InstanceKlass* ik = InstanceKlass::cast(klass());
Method* m = ik->method_with_idnum(method_idnum()); Method* m = ik->method_with_idnum(method_idnum());

Some files were not shown because too many files have changed in this diff Show More