This commit is contained in:
Vladimir Kozlov 2009-03-03 10:34:22 -08:00
commit 4b15cdadd3
153 changed files with 2412 additions and 503 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1999-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -61,8 +61,8 @@ CPPFLAGS = $(SYSDEFS) $(INCLUDES)
CPPFLAGS += -DASSERT
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# Suppress warnings (for now)
CFLAGS_WARN = -w
# Compiler warnings are treated as errors
CFLAGS_WARN = -Werror
CFLAGS += $(CFLAGS_WARN)
OBJECTNAMES = \

View File

@ -1,5 +1,5 @@
#
# Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
# Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -67,6 +67,8 @@ ifndef USE_GCC
endif
# CFLAGS_WARN holds compiler options to suppress/enable warnings.
# Compiler warnings are treated as errors
CFLAGS_WARN = +w -errwarn
CFLAGS += $(CFLAGS_WARN)
ifeq ("${Platform_compiler}", "sparcWorks")

View File

@ -2465,7 +2465,7 @@ void InterpreterMacroAssembler::verify_FPU(int stack_depth, TosState state) {
// InterpreterRuntime::post_method_entry();
// }
// if (DTraceMethodProbes) {
// SharedRuntime::dtrace_method_entry(method, reciever);
// SharedRuntime::dtrace_method_entry(method, receiver);
// }
void InterpreterMacroAssembler::notify_method_entry() {

View File

@ -243,7 +243,7 @@ class NativeInstruction VALUE_OBJ_CLASS_SPEC {
// Regenerate the instruction sequence that performs the 64 bit
// sethi. This only does the sethi. The disp field (bottom 10 bits)
// must be handled seperately.
// must be handled separately.
static void set_data64_sethi(address instaddr, intptr_t x);
// combine the fields of a sethi/simm13 pair (simm13 = or, add, jmpl, ld/st)

View File

@ -189,7 +189,7 @@ reg_def R_F31( SOC, SOC, Op_RegF, 31, F31->as_VMReg());
// double fp register numbers. FloatRegisterImpl in register_sparc.hpp
// wants 0-63, so we have to convert every time we want to use fp regs
// with the macroassembler, using reg_to_DoubleFloatRegister_object().
// 255 is a flag meaning 'dont go here'.
// 255 is a flag meaning "don't go here".
// I believe we can't handle callee-save doubles D32 and up until
// the place in the sparc stack crawler that asserts on the 255 is
// fixed up.
@ -462,7 +462,7 @@ extern bool can_branch_register( Node *bol, Node *cmp );
// Macros to extract hi & lo halves from a long pair.
// G0 is not part of any long pair, so assert on that.
// Prevents accidently using G1 instead of G0.
// Prevents accidentally using G1 instead of G0.
#define LONG_HI_REG(x) (x)
#define LONG_LO_REG(x) (x)
@ -1431,7 +1431,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf,
#ifndef _LP64
// In the LP64 build, all registers can be moved as aligned/adjacent
// pairs, so there's never any need to move the high bits seperately.
// pairs, so there's never any need to move the high bits separately.
// The 32-bit builds have to deal with the 32-bit ABI which can force
// all sorts of silly alignment problems.
@ -1624,7 +1624,7 @@ void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {
Register temp_reg = G3;
assert( G5_ic_reg != temp_reg, "conflicting registers" );
// Load klass from reciever
// Load klass from receiver
__ load_klass(O0, temp_reg);
// Compare against expected klass
__ cmp(temp_reg, G5_ic_reg);
@ -4149,7 +4149,7 @@ operand cmpOp_commute() %{
//----------OPERAND CLASSES----------------------------------------------------
// Operand Classes are groups of operands that are used to simplify
// instruction definitions by not requiring the AD writer to specify seperate
// instruction definitions by not requiring the AD writer to specify separate
// instructions for every form of operand when the instruction accepts
// multiple operand types with the same basic encoding and format. The classic
// case of this is memory operands.
@ -6847,7 +6847,7 @@ instruct mul_hi(iRegIsafe dst, iRegIsafe src1, iRegIsafe src2 ) %{
ins_pipe(sdiv_reg_reg);
%}
// Magic constant, reciprical of 10
// Magic constant, reciprocal of 10
instruct loadConI_x66666667(iRegIsafe dst) %{
effect( DEF dst );
@ -6857,7 +6857,7 @@ instruct loadConI_x66666667(iRegIsafe dst) %{
ins_pipe(ialu_hi_lo_reg);
%}
// Register Shift Right Arithmatic Long by 32-63
// Register Shift Right Arithmetic Long by 32-63
instruct sra_31( iRegI dst, iRegI src ) %{
effect( DEF dst, USE src );
format %{ "SRA $src,31,$dst\t! Used in div-by-10" %}
@ -9048,7 +9048,7 @@ instruct storeL_reversed(memory dst, iRegL src) %{
// These must follow all instruction definitions as they use the names
// defined in the instructions definitions.
//
// peepmatch ( root_instr_name [preceeding_instruction]* );
// peepmatch ( root_instr_name [preceding_instruction]* );
//
// peepconstraint %{
// (instruction_number.operand_name relational_op instruction_number.operand_name

View File

@ -1545,7 +1545,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Handle all the JSR stuff here, then exit.
// It's much shorter and cleaner than intermingling with the
// non-JSR normal-branch stuff occuring below.
// non-JSR normal-branch stuff occurring below.
if( is_jsr ) {
// compute return address as bci in Otos_i
__ ld_ptr(Address(Lmethod, 0, in_bytes(methodOopDesc::const_offset())), G3_scratch);
@ -3079,7 +3079,7 @@ void TemplateTable::invokeinterface(int byte_no) {
Label ok;
// Check that entry is non-null. Null entries are probably a bytecode
// problem. If the interface isn't implemented by the reciever class,
// problem. If the interface isn't implemented by the receiver class,
// the VM should throw IncompatibleClassChangeError. linkResolver checks
// this too but that's only if the entry isn't already resolved, so we
// need to check again.

View File

@ -6463,7 +6463,8 @@ void MacroAssembler::serialize_memory(Register thread, Register tmp) {
Address index(noreg, tmp, Address::times_1);
ExternalAddress page(os::get_memory_serialize_page());
movptr(ArrayAddress(page, index), tmp);
// Size of store must match masking code above
movl(as_Address(ArrayAddress(page, index)), tmp);
}
// Calls to C land

View File

@ -501,7 +501,7 @@ void LIRGenerator::do_ArithmeticOp_Long(ArithmeticOp* x) {
LIRItem right(x->y(), this);
left.load_item();
// dont load constants to save register
// don't load constants to save register
right.load_nonconstant();
rlock_result(x);
arithmetic_op_long(x->op(), x->operand(), left.result(), right.result(), NULL);

View File

@ -523,7 +523,7 @@ void CppInterpreterGenerator::generate_compute_interpreter_state(const Register
#ifdef _LP64
// Make sure stack is properly aligned and sized for the abi
__ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
__ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI)
__ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
#endif // _LP64
@ -970,7 +970,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef _LP64
// duplicate the alignment rsp got after setting stack_base
__ subptr(rax, frame::arg_reg_save_area_bytes); // windows
__ andptr(rax, -16); // must be 16 byte boundry (see amd64 ABI)
__ andptr(rax, -16); // must be 16 byte boundary (see amd64 ABI)
#endif // _LP64
__ cmpptr(rax, rsp);
__ jcc(Assembler::equal, L);
@ -1067,7 +1067,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
#ifdef _LP64
__ subptr(rsp, t);
__ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
__ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI)
__ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
#else
__ addptr(t, 2*wordSize); // allocate two more slots for JNIEnv and possible mirror
__ subptr(rsp, t);

View File

@ -1350,7 +1350,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
{
Label L;
__ mov(rax, rsp);
__ andptr(rax, -16); // must be 16 byte boundry (see amd64 ABI)
__ andptr(rax, -16); // must be 16 byte boundary (see amd64 ABI)
__ cmpptr(rax, rsp);
__ jcc(Assembler::equal, L);
__ stop("improperly aligned stack");

View File

@ -826,7 +826,7 @@ address InterpreterGenerator::generate_native_entry(bool synchronized) {
__ subptr(rsp, t);
__ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
__ andptr(rsp, -16); // must be 16 byte boundry (see amd64 ABI)
__ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
// get signature handler
{

View File

@ -1586,7 +1586,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Handle all the JSR stuff here, then exit.
// It's much shorter and cleaner than intermingling with the
// non-JSR normal-branch stuff occuring below.
// non-JSR normal-branch stuff occurring below.
if (is_jsr) {
// Pre-load the next target bytecode into EBX
__ load_unsigned_byte(rbx, Address(rsi, rdx, Address::times_1, 0));

View File

@ -1559,7 +1559,7 @@ void TemplateTable::branch(bool is_jsr, bool is_wide) {
// Handle all the JSR stuff here, then exit.
// It's much shorter and cleaner than intermingling with the non-JSR
// normal-branch stuff occuring below.
// normal-branch stuff occurring below.
if (is_jsr) {
// Pre-load the next target bytecode into rbx
__ load_unsigned_byte(rbx, Address(r13, rdx, Address::times_1, 0));

View File

@ -130,7 +130,7 @@ reg_def XMM7b( SOC, SOC, Op_RegF, 7, xmm7->as_VMReg()->next());
// allocation. Highest priority is first. A useful heuristic is to
// give registers a low priority when they are required by machine
// instructions, like EAX and EDX. Registers which are used as
// pairs must fall on an even boundry (witness the FPR#L's in this list).
// pairs must fall on an even boundary (witness the FPR#L's in this list).
// For the Intel integer registers, the equivalent Long pairs are
// EDX:EAX, EBX:ECX, and EDI:EBP.
alloc_class chunk0( ECX, EBX, EBP, EDI, EAX, EDX, ESI, ESP,
@ -5857,7 +5857,7 @@ operand cmpOp_commute() %{
//----------OPERAND CLASSES----------------------------------------------------
// Operand Classes are groups of operands that are used as to simplify
// instruction definitions by not requiring the AD writer to specify seperate
// instruction definitions by not requiring the AD writer to specify separate
// instructions for every form of operand when the instruction accepts
// multiple operand types with the same basic encoding and format. The classic
// case of this is memory operands.
@ -13220,7 +13220,7 @@ instruct safePoint_poll(eFlagsReg cr) %{
// These must follow all instruction definitions as they use the names
// defined in the instructions definitions.
//
// peepmatch ( root_instr_name [preceeding_instruction]* );
// peepmatch ( root_instr_name [preceding_instruction]* );
//
// peepconstraint %{
// (instruction_number.operand_name relational_op instruction_number.operand_name

View File

@ -5483,7 +5483,7 @@ operand cmpOpUCF2() %{
//----------OPERAND CLASSES----------------------------------------------------
// Operand Classes are groups of operands that are used as to simplify
// instruction definitions by not requiring the AD writer to specify seperate
// instruction definitions by not requiring the AD writer to specify separate
// instructions for every form of operand when the instruction accepts
// multiple operand types with the same basic encoding and format. The classic
// case of this is memory operands.
@ -8363,7 +8363,7 @@ instruct divModL_rReg_divmod(rax_RegL rax, rdx_RegL rdx, no_rax_rdx_RegL div,
//----------- DivL-By-Constant-Expansions--------------------------------------
// DivI cases are handled by the compiler
// Magic constant, reciprical of 10
// Magic constant, reciprocal of 10
instruct loadConL_0x6666666666666667(rRegL dst)
%{
effect(DEF dst);
@ -12082,7 +12082,7 @@ instruct RethrowException()
// These must follow all instruction definitions as they use the names
// defined in the instructions definitions.
//
// peepmatch ( root_instr_name [precerding_instruction]* );
// peepmatch ( root_instr_name [preceding_instruction]* );
//
// peepconstraint %{
// (instruction_number.operand_name relational_op instruction_number.operand_name

View File

@ -419,7 +419,7 @@ main(int argc, char ** argv)
goto leave;
}
mainClass = LoadClass(env, classname);
if(mainClass == NULL) { /* exception occured */
if(mainClass == NULL) { /* exception occurred */
ReportExceptionDescription(env);
message = "Could not find the main class. Program will exit.";
goto leave;
@ -441,7 +441,7 @@ main(int argc, char ** argv)
goto leave;
}
mainClass = LoadClass(env, classname);
if(mainClass == NULL) { /* exception occured */
if(mainClass == NULL) { /* exception occurred */
ReportExceptionDescription(env);
message = "Could not find the main class. Program will exit.";
goto leave;

View File

@ -47,7 +47,7 @@
#ifdef JAVA_ARGS
/*
* ApplicationHome is prepended to each of these entries; the resulting
* strings are concatenated (seperated by PATH_SEPARATOR) and used as the
* strings are concatenated (separated by PATH_SEPARATOR) and used as the
* value of -cp option to the launcher.
*/
#ifndef APP_CLASSPATH

View File

@ -192,7 +192,7 @@ static pid_t filename_to_pid(const char* filename) {
// check if the given path is considered a secure directory for
// the backing store files. Returns true if the directory exists
// and is considered a secure location. Returns false if the path
// is a symbolic link or if an error occured.
// is a symbolic link or if an error occurred.
//
static bool is_directory_secure(const char* path) {
struct stat statbuf;

View File

@ -419,7 +419,7 @@ main(int argc, char ** argv)
goto leave;
}
mainClass = LoadClass(env, classname);
if(mainClass == NULL) { /* exception occured */
if(mainClass == NULL) { /* exception occurred */
ReportExceptionDescription(env);
message = "Could not find the main class. Program will exit.";
goto leave;
@ -441,7 +441,7 @@ main(int argc, char ** argv)
goto leave;
}
mainClass = LoadClass(env, classname);
if(mainClass == NULL) { /* exception occured */
if(mainClass == NULL) { /* exception occurred */
ReportExceptionDescription(env);
message = "Could not find the main class. Program will exit.";
goto leave;

View File

@ -47,7 +47,7 @@
#ifdef JAVA_ARGS
/*
* ApplicationHome is prepended to each of these entries; the resulting
* strings are concatenated (seperated by PATH_SEPARATOR) and used as the
* strings are concatenated (separated by PATH_SEPARATOR) and used as the
* value of -cp option to the launcher.
*/
#ifndef APP_CLASSPATH

View File

@ -194,7 +194,7 @@ static pid_t filename_to_pid(const char* filename) {
// check if the given path is considered a secure directory for
// the backing store files. Returns true if the directory exists
// and is considered a secure location. Returns false if the path
// is a symbolic link or if an error occured.
// is a symbolic link or if an error occurred.
//
static bool is_directory_secure(const char* path) {
struct stat statbuf;

View File

@ -195,7 +195,7 @@ static int filename_to_pid(const char* filename) {
// check if the given path is considered a secure directory for
// the backing store files. Returns true if the directory exists
// and is considered a secure location. Returns false if the path
// is a symbolic link or if an error occured.
// is a symbolic link or if an error occurred.
//
static bool is_directory_secure(const char* path) {
@ -994,7 +994,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
return false;
}
// if running on windows 2000 or later, set the automatic inheritence
// if running on windows 2000 or later, set the automatic inheritance
// control flags.
SetSecurityDescriptorControlFnPtr _SetSecurityDescriptorControl;
_SetSecurityDescriptorControl = (SetSecurityDescriptorControlFnPtr)
@ -1002,7 +1002,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
"SetSecurityDescriptorControl");
if (_SetSecurityDescriptorControl != NULL) {
// We do not want to further propogate inherited DACLs, so making them
// We do not want to further propagate inherited DACLs, so making them
// protected prevents that.
if (!_SetSecurityDescriptorControl(pSD, SE_DACL_PROTECTED,
SE_DACL_PROTECTED)) {

View File

@ -532,7 +532,7 @@ int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_
if (oldAct.sa_sigaction != signalHandler) {
void* sighand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler);
warning("Unexpected Signal %d occured under user-defined signal handler " INTPTR_FORMAT, sig, (intptr_t)sighand);
warning("Unexpected Signal %d occurred under user-defined signal handler " INTPTR_FORMAT, sig, (intptr_t)sighand);
}
}

View File

@ -694,7 +694,7 @@ int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_
if (oldAct.sa_sigaction != signalHandler) {
void* sighand = oldAct.sa_sigaction ? CAST_FROM_FN_PTR(void*, oldAct.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oldAct.sa_handler);
warning("Unexpected Signal %d occured under user-defined signal handler %#lx", sig, (long)sighand);
warning("Unexpected Signal %d occurred under user-defined signal handler %#lx", sig, (long)sighand);
}
}

View File

@ -0,0 +1,75 @@
#
# Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#
#
PKGLIST = \
com.sun.hotspot.tools.compiler
#END PKGLIST
FILELIST = com/sun/hotspot/tools/compiler/*.java
ifneq "x$(ALT_BOOTDIR)" "x"
BOOTDIR := $(ALT_BOOTDIR)
endif
ifeq "x$(BOOTDIR)" "x"
JDK_HOME := $(shell dirname $(shell which java))/..
else
JDK_HOME := $(BOOTDIR)
endif
isUnix := $(shell test -r c:/; echo $$?)
ifeq "$(isUnix)" "1"
CPS := :
else
CPS := ";"
endif
SRC_DIR = src
BUILD_DIR = build
OUTPUT_DIR = $(BUILD_DIR)/classes
# gnumake 3.78.1 does not accept the *s,
# so use the shell to expand them
ALLFILES := $(patsubst %,$(SRC_DIR)/%,$(FILELIST))
ALLFILES := $(shell /bin/ls $(ALLFILES))
JAVAC = $(JDK_HOME)/bin/javac
JAR = $(JDK_HOME)/bin/jar
# Tagging it on because there's no reason not to run it
all: logc.jar
logc.jar: filelist manifest.mf
@mkdir -p $(OUTPUT_DIR)
$(JAVAC) -source 1.5 -deprecation -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) @filelist
$(JAR) cvfm logc.jar manifest.mf -C $(OUTPUT_DIR) com
.PHONY: filelist
filelist: $(ALLFILES)
@rm -f $@
@echo $(ALLFILES) > $@
clean::
rm -rf filelist logc.jar
rm -rf $(BUILD_DIR)

View File

@ -0,0 +1,18 @@
This is a very rough tool for parsing -XX:+LogCompilation output.
It's main purpose is to recreate output similar to
-XX:+PrintCompilation -XX:+PrintInlining output from a debug JVM. It
requires a 1.5 JDK to build and simply typing make should build it.
It produces a jar file, logc.jar, that can be run on the
hotspot.log from LogCompilation output like this:
java -jar logc.jar hotspot.log
This will produce something like the normal PrintCompilation output.
Adding the -i option with also report inlining like PrintInlining.
More information about the LogCompilation output can be found at
http://wikis.sun.com/display/HotSpotInternals/LogCompilation+overview
http://wikis.sun.com/display/HotSpotInternals/PrintCompilation
http://wikis.sun.com/display/HotSpotInternals/LogCompilation+tool

View File

@ -0,0 +1 @@
Main-Class: com.sun.hotspot.tools.compiler.LogCompilation

View File

@ -0,0 +1,75 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
/**
*
* @author never
*/
public abstract class BasicLogEvent implements LogEvent {
protected final String id;
protected final double start;
protected double end;
protected Compilation compilation;
BasicLogEvent(double start, String id) {
this.start = start;
this.end = start;
this.id = id;
}
public double getStart() {
return start;
}
public double getEnd() {
return end;
}
public void setEnd(double end) {
this.end = end;
}
public double getElapsedTime() {
return ((int) ((getEnd() - getStart()) * 1000)) / 1000.0;
}
public String getId() {
return id;
}
public Compilation getCompilation() {
return compilation;
}
public void setCompilation(Compilation compilation) {
this.compilation = compilation;
}
abstract public void print(PrintStream stream);
}

View File

@ -0,0 +1,183 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
public class CallSite {
private int bci;
private Method method;
private int count;
private String receiver;
private int receiver_count;
private String reason;
private List<CallSite> calls;
CallSite() {
}
CallSite(int bci, Method m) {
this.bci = bci;
this.method = m;
}
void add(CallSite site) {
if (getCalls() == null) {
setCalls(new ArrayList<CallSite>());
}
getCalls().add(site);
}
CallSite last() {
return last(-1);
}
CallSite last(int fromEnd) {
return getCalls().get(getCalls().size() + fromEnd);
}
public String toString() {
StringBuilder sb = new StringBuilder();
if (getReason() == null) {
sb.append(" @ " + getBci() + " " + getMethod());
} else {
sb.append("- @ " + getBci() + " " + getMethod() + " " + getReason());
}
sb.append("\n");
if (getCalls() != null) {
for (CallSite site : getCalls()) {
sb.append(site);
sb.append("\n");
}
}
return sb.toString();
}
public void print(PrintStream stream) {
print(stream, 0);
}
void emit(PrintStream stream, int indent) {
for (int i = 0; i < indent; i++) {
stream.print(' ');
}
}
private static boolean compat = true;
public void print(PrintStream stream, int indent) {
emit(stream, indent);
String m = getMethod().getHolder().replace('/', '.') + "::" + getMethod().getName();
if (getReason() == null) {
stream.println(" @ " + getBci() + " " + m + " (" + getMethod().getBytes() + " bytes)");
} else {
if (isCompat()) {
stream.println(" @ " + getBci() + " " + m + " " + getReason());
} else {
stream.println("- @ " + getBci() + " " + m +
" (" + getMethod().getBytes() + " bytes) " + getReason());
}
}
if (getReceiver() != null) {
emit(stream, indent + 3);
// stream.println("type profile " + method.holder + " -> " + receiver + " (" +
// receiver_count + "/" + count + "," + (receiver_count * 100 / count) + "%)");
stream.println("type profile " + getMethod().getHolder() + " -> " + getReceiver() + " (" +
(getReceiverCount() * 100 / getCount()) + "%)");
}
if (getCalls() != null) {
for (CallSite site : getCalls()) {
site.print(stream, indent + 2);
}
}
}
public int getBci() {
return bci;
}
public void setBci(int bci) {
this.bci = bci;
}
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public int getReceiverCount() {
return receiver_count;
}
public void setReceiver_count(int receiver_count) {
this.receiver_count = receiver_count;
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public List<CallSite> getCalls() {
return calls;
}
public void setCalls(List<CallSite> calls) {
this.calls = calls;
}
public static boolean isCompat() {
return compat;
}
public static void setCompat(boolean aCompat) {
compat = aCompat;
}
}

View File

@ -0,0 +1,236 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
import java.util.ArrayList;
public class Compilation implements LogEvent {
private int id;
private boolean osr;
private Method method;
private CallSite call = new CallSite();
private int osrBci;
private String icount;
private String bcount;
private String special;
private double start;
private double end;
private int attempts;
private NMethod nmethod;
private ArrayList<Phase> phases = new ArrayList<Phase>(4);
private String failureReason;
Compilation(int id) {
this.id = id;
}
Phase getPhase(String s) {
for (Phase p : getPhases()) {
if (p.getName().equals(s)) {
return p;
}
}
return null;
}
double getRegallocTime() {
return getPhase("regalloc").getElapsedTime();
}
public double getStart() {
return start;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getId());
sb.append(" ");
sb.append(getMethod());
sb.append(" ");
sb.append(getIcount());
sb.append("+");
sb.append(getBcount());
sb.append("\n");
for (CallSite site : getCall().getCalls()) {
sb.append(site);
sb.append("\n");
}
return sb.toString();
}
public void printShort(PrintStream stream) {
if (getMethod() == null) {
stream.println(getSpecial());
} else {
int bc = isOsr() ? getOsr_bci() : -1;
stream.print(getId() + getMethod().decodeFlags(bc) + getMethod().format(bc));
}
}
public void print(PrintStream stream) {
print(stream, 0, false);
}
public void print(PrintStream stream, boolean printInlining) {
print(stream, 0, printInlining);
}
public void print(PrintStream stream, int indent, boolean printInlining) {
if (getMethod() == null) {
stream.println(getSpecial());
} else {
int bc = isOsr() ? getOsr_bci() : -1;
stream.print(getId() + getMethod().decodeFlags(bc) + getMethod().format(bc));
stream.println();
if (getFailureReason() != null) {
stream.println("COMPILE FAILED " + getFailureReason());
}
if (printInlining && call.getCalls() != null) {
for (CallSite site : call.getCalls()) {
site.print(stream, indent + 2);
}
}
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public boolean isOsr() {
return osr;
}
public void setOsr(boolean osr) {
this.osr = osr;
}
public int getOsr_bci() {
return osrBci;
}
public void setOsr_bci(int osrBci) {
this.osrBci = osrBci;
}
public String getIcount() {
return icount;
}
public void setICount(String icount) {
this.icount = icount;
}
public String getBcount() {
return bcount;
}
public void setBCount(String bcount) {
this.bcount = bcount;
}
public String getSpecial() {
return special;
}
public void setSpecial(String special) {
this.special = special;
}
public void setStart(double start) {
this.start = start;
}
public double getEnd() {
return end;
}
public void setEnd(double end) {
this.end = end;
}
public int getAttempts() {
return attempts;
}
public void setAttempts(int attempts) {
this.attempts = attempts;
}
public NMethod getNMethod() {
return nmethod;
}
public void setNMethod(NMethod NMethod) {
this.nmethod = NMethod;
}
public ArrayList<Phase> getPhases() {
return phases;
}
public void setPhases(ArrayList<Phase> phases) {
this.setPhases(phases);
}
public String getFailureReason() {
return failureReason;
}
public void setFailureReason(String failureReason) {
this.failureReason = failureReason;
}
public Method getMethod() {
return method;
}
public void setMethod(Method method) {
this.method = method;
}
public CallSite getCall() {
return call;
}
public void setCall(CallSite call) {
this.call = call;
}
public double getElapsedTime() {
return end - start;
}
public Compilation getCompilation() {
return this;
}
}

View File

@ -0,0 +1,46 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
interface Constants {
static final int JVM_ACC_PUBLIC = 0x0001; /* visible to everyone */
static final int JVM_ACC_PRIVATE = 0x0002; /* visible only to the defining class */
static final int JVM_ACC_PROTECTED = 0x0004; /* visible to subclasses */
static final int JVM_ACC_STATIC = 0x0008; /* instance variable is static */
static final int JVM_ACC_FINAL = 0x0010; /* no further subclassing, overriding */
static final int JVM_ACC_SYNCHRONIZED = 0x0020; /* wrap method call in monitor lock */
static final int JVM_ACC_SUPER = 0x0020; /* funky handling of invokespecial */
static final int JVM_ACC_VOLATILE = 0x0040; /* can not cache in registers */
static final int JVM_ACC_BRIDGE = 0x0040; /* bridge method generated by compiler */
static final int JVM_ACC_TRANSIENT = 0x0080; /* not persistent */
static final int JVM_ACC_VARARGS = 0x0080; /* method declared with variable number of args */
static final int JVM_ACC_NATIVE = 0x0100; /* implemented in C */
static final int JVM_ACC_INTERFACE = 0x0200; /* class is an interface */
static final int JVM_ACC_ABSTRACT = 0x0400; /* no definition provided */
static final int JVM_ACC_STRICT = 0x0800; /* strict floating point */
static final int JVM_ACC_SYNTHETIC = 0x1000; /* compiler-generated class, method or field */
static final int JVM_ACC_ANNOTATION = 0x2000; /* annotation type */
static final int JVM_ACC_ENUM = 0x4000; /* field is declared as element of enum */
}

View File

@ -0,0 +1,212 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.*;
import java.util.regex.*;
/**
* This class is a filter class to deal with malformed XML that used
* to be produced by the JVM when generating LogCompilation. In 1.6
* and later releases it shouldn't be required.
* @author never
*/
class LogCleanupReader extends Reader {
private Reader reader;
private char[] buffer = new char[4096];
private int bufferCount;
private int bufferOffset;
private char[] line = new char[1024];
private int index;
private int length;
private char[] one = new char[1];
LogCleanupReader(Reader r) {
reader = r;
}
static final private Matcher pattern = Pattern.compile(".+ compile_id='[0-9]+'.*( compile_id='[0-9]+)").matcher("");
static final private Matcher pattern2 = Pattern.compile("' (C[12]) compile_id=").matcher("");
static final private Matcher pattern3 = Pattern.compile("'(destroy_vm)/").matcher("");
private void fill() throws IOException {
rawFill();
if (length != -1) {
boolean changed = false;
String s = new String(line, 0, length);
String orig = s;
pattern2.reset(s);
if (pattern2.find()) {
s = s.substring(0, pattern2.start(1)) + s.substring(pattern2.end(1) + 1);
changed = true;
}
pattern.reset(s);
if (pattern.lookingAt()) {
s = s.substring(0, pattern.start(1)) + s.substring(pattern.end(1) + 1);
changed = true;
}
pattern3.reset(s);
if (pattern3.find()) {
s = s.substring(0, pattern3.start(1)) + s.substring(pattern3.end(1));
changed = true;
}
if (changed) {
s.getChars(0, s.length(), line, 0);
length = s.length();
}
}
}
private void rawFill() throws IOException {
if (bufferCount == -1) {
length = -1;
return;
}
int i = 0;
boolean fillNonEOL = true;
outer:
while (true) {
if (fillNonEOL) {
int p;
for (p = bufferOffset; p < bufferCount; p++) {
char c = buffer[p];
if (c == '\r' || c == '\n') {
bufferOffset = p;
fillNonEOL = false;
continue outer;
}
if (i >= line.length) {
// copy and enlarge the line array
char[] newLine = new char[line.length * 2];
System.arraycopy(line, 0, newLine, 0, line.length);
line = newLine;
}
line[i++] = c;
}
bufferOffset = p;
} else {
int p;
for (p = bufferOffset; p < bufferCount; p++) {
char c = buffer[p];
if (c != '\r' && c != '\n') {
bufferOffset = p;
length = i;
index = 0;
return;
}
line[i++] = c;
}
bufferOffset = p;
}
if (bufferCount == -1) {
if (i == 0) {
length = -1;
} else {
length = i;
}
index = 0;
return;
}
if (bufferOffset != bufferCount) {
System.out.println(bufferOffset);
System.out.println(bufferCount);
throw new InternalError("how did we get here");
}
// load more data and try again.
bufferCount = reader.read(buffer, 0, buffer.length);
bufferOffset = 0;
}
}
public int read() throws java.io.IOException {
read(one, 0, 1);
return one[0];
}
public int read(char[] buffer) throws java.io.IOException {
return read(buffer, 0, buffer.length);
}
public int read(char[] b, int off, int len) throws java.io.IOException {
if (length == -1) {
return -1;
}
if (index == length) {
fill();
if (length == -1) {
return -1;
}
}
int n = Math.min(length - index, Math.min(b.length - off, len));
// System.out.printf("%d %d %d %d %d\n", index, length, off, len, n);
System.arraycopy(line, index, b, off, n);
index += n;
return n;
}
public long skip(long n) throws java.io.IOException {
long result = n;
while (n-- > 0) read();
return result;
}
public boolean ready() throws java.io.IOException {
return reader.ready() || (line != null && length > 0);
}
public boolean markSupported() {
return false;
}
public void mark(int unused) throws java.io.IOException {
throw new UnsupportedOperationException("mark not supported");
}
public void reset() throws java.io.IOException {
reader.reset();
line = null;
index = 0;
}
public void close() throws java.io.IOException {
reader.close();
line = null;
index = 0;
}
}

View File

@ -0,0 +1,177 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
/**
* The main command line driver of a parser for LogCompilation output.
* @author never
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
import java.util.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class LogCompilation extends DefaultHandler implements ErrorHandler, Constants {
public static void usage(int exitcode) {
System.out.println("Usage: LogCompilation [ -v ] [ -c ] [ -s ] [ -e | -N ] file1 ...");
System.out.println(" -c: clean up malformed 1.5 xml");
System.out.println(" -i: print inlining decisions");
System.out.println(" -S: print compilation statistics");
System.out.println(" -s: sort events by start time");
System.out.println(" -e: sort events by elapsed time");
System.out.println(" -N: sort events by name and start");
System.exit(exitcode);
}
public static void main(String[] args) throws Exception {
Comparator<LogEvent> defaultSort = LogParser.sortByStart;
boolean statistics = false;
boolean printInlining = false;
boolean cleanup = false;
int index = 0;
while (args.length > index) {
if (args[index].equals("-e")) {
defaultSort = LogParser.sortByElapsed;
index++;
} else if (args[index].equals("-n")) {
defaultSort = LogParser.sortByNameAndStart;
index++;
} else if (args[index].equals("-s")) {
defaultSort = LogParser.sortByStart;
index++;
} else if (args[index].equals("-c")) {
cleanup = true;
index++;
} else if (args[index].equals("-S")) {
statistics = true;
index++;
} else if (args[index].equals("-h")) {
usage(0);
} else if (args[index].equals("-i")) {
printInlining = true;
index++;
} else {
break;
}
}
if (index >= args.length) {
usage(1);
}
while (index < args.length) {
ArrayList<LogEvent> events = LogParser.parse(args[index], cleanup);
if (statistics) {
printStatistics(events, System.out);
} else {
Collections.sort(events, defaultSort);
for (LogEvent c : events) {
if (printInlining && c instanceof Compilation) {
Compilation comp = (Compilation)c;
comp.print(System.out, true);
} else {
c.print(System.out);
}
}
}
index++;
}
}
public static void printStatistics(ArrayList<LogEvent> events, PrintStream out) {
long cacheSize = 0;
long maxCacheSize = 0;
int nmethodsCreated = 0;
int nmethodsLive = 0;
int[] attempts = new int[32];
double regallocTime = 0;
int maxattempts = 0;
LinkedHashMap<String, Double> phaseTime = new LinkedHashMap<String, Double>(7);
LinkedHashMap<String, Integer> phaseNodes = new LinkedHashMap<String, Integer>(7);
double elapsed = 0;
for (LogEvent e : events) {
if (e instanceof Compilation) {
Compilation c = (Compilation) e;
c.printShort(out);
out.printf(" %6.4f\n", c.getElapsedTime());
attempts[c.getAttempts()]++;
maxattempts = Math.max(maxattempts,c.getAttempts());
elapsed += c.getElapsedTime();
for (Phase phase : c.getPhases()) {
out.printf("\t%s %6.4f\n", phase.getName(), phase.getElapsedTime());
Double v = phaseTime.get(phase.getName());
if (v == null) {
v = Double.valueOf(0.0);
}
phaseTime.put(phase.getName(), Double.valueOf(v.doubleValue() + phase.getElapsedTime()));
Integer v2 = phaseNodes.get(phase.getName());
if (v2 == null) {
v2 = Integer.valueOf(0);
}
phaseNodes.put(phase.getName(), Integer.valueOf(v2.intValue() + phase.getNodes()));
}
} else if (e instanceof MakeNotEntrantEvent) {
MakeNotEntrantEvent mne = (MakeNotEntrantEvent) e;
NMethod nm = mne.getNMethod();
if (mne.isZombie()) {
if (nm == null) {
System.err.println(mne.getId());
}
cacheSize -= nm.getSize();
nmethodsLive--;
}
} else if (e instanceof NMethod) {
nmethodsLive++;
nmethodsCreated++;
NMethod nm = (NMethod) e;
cacheSize += nm.getSize();
maxCacheSize = Math.max(cacheSize, maxCacheSize);
}
}
out.printf("NMethods: %d created %d live %d bytes (%d peak) in the code cache\n",
nmethodsCreated, nmethodsLive, cacheSize, maxCacheSize);
out.println("Phase times:");
for (String name : phaseTime.keySet()) {
Double v = phaseTime.get(name);
Integer v2 = phaseNodes.get(name);
out.printf("%20s %6.4f %d\n", name, v.doubleValue(), v2.intValue());
}
out.printf("%20s %6.4f\n", "total", elapsed);
if (maxattempts > 0) {
out.println("Distribution of regalloc passes:");
for (int i = 0; i <= maxattempts; i++) {
out.printf("%2d %8d\n", i, attempts[i]);
}
}
}
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
import java.util.*;
public interface LogEvent {
public double getStart();
public double getElapsedTime();
public Compilation getCompilation();
public void print(PrintStream stream);
}

View File

@ -0,0 +1,430 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
/**
* A SAX based parser of LogCompilation output from HotSpot. It takes a complete
* @author never
*/
package com.sun.hotspot.tools.compiler;
import java.io.FileReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.helpers.DefaultHandler;
public class LogParser extends DefaultHandler implements ErrorHandler, Constants {
static final HashMap<String, String> typeMap;
static {
typeMap = new HashMap<String, String>();
typeMap.put("[I", "int[]");
typeMap.put("[C", "char[]");
typeMap.put("[Z", "boolean[]");
typeMap.put("[L", "Object[]");
typeMap.put("[B", "byte[]");
}
static Comparator<LogEvent> sortByStart = new Comparator<LogEvent>() {
public int compare(LogEvent a, LogEvent b) {
double difference = (a.getStart() - b.getStart());
if (difference < 0) {
return -1;
}
if (difference > 0) {
return 1;
}
return 0;
}
@Override
public boolean equals(Object other) {
return false;
}
@Override
public int hashCode() {
return 7;
}
};
static Comparator<LogEvent> sortByNameAndStart = new Comparator<LogEvent>() {
public int compare(LogEvent a, LogEvent b) {
Compilation c1 = a.getCompilation();
Compilation c2 = b.getCompilation();
if (c1 != null && c2 != null) {
int result = c1.getMethod().toString().compareTo(c2.getMethod().toString());
if (result != 0) {
return result;
}
}
double difference = (a.getStart() - b.getStart());
if (difference < 0) {
return -1;
}
if (difference > 0) {
return 1;
}
return 0;
}
public boolean equals(Object other) {
return false;
}
@Override
public int hashCode() {
return 7;
}
};
static Comparator<LogEvent> sortByElapsed = new Comparator<LogEvent>() {
public int compare(LogEvent a, LogEvent b) {
double difference = (a.getElapsedTime() - b.getElapsedTime());
if (difference < 0) {
return -1;
}
if (difference > 0) {
return 1;
}
return 0;
}
@Override
public boolean equals(Object other) {
return false;
}
@Override
public int hashCode() {
return 7;
}
};
private ArrayList<LogEvent> events = new ArrayList<LogEvent>();
private HashMap<String, String> types = new HashMap<String, String>();
private HashMap<String, Method> methods = new HashMap<String, Method>();
private LinkedHashMap<String, NMethod> nmethods = new LinkedHashMap<String, NMethod>();
private HashMap<String, Compilation> compiles = new HashMap<String, Compilation>();
private String failureReason;
private int bci;
private Stack<CallSite> scopes = new Stack<CallSite>();
private Compilation compile;
private CallSite site;
private Stack<Phase> phaseStack = new Stack<Phase>();
private UncommonTrapEvent currentTrap;
long parseLong(String l) {
try {
return Long.decode(l).longValue();
} catch (NumberFormatException nfe) {
int split = l.length() - 8;
String s1 = "0x" + l.substring(split);
String s2 = l.substring(0, split);
long v1 = Long.decode(s1).longValue() & 0xffffffffL;
long v2 = (Long.decode(s2).longValue() & 0xffffffffL) << 32;
if (!l.equals("0x" + Long.toHexString(v1 + v2))) {
System.out.println(l);
System.out.println(s1);
System.out.println(s2);
System.out.println(v1);
System.out.println(v2);
System.out.println(Long.toHexString(v1 + v2));
throw new InternalError("bad conversion");
}
return v1 + v2;
}
}
public static ArrayList<LogEvent> parse(String file, boolean cleanup) throws Exception {
return parse(new FileReader(file), cleanup);
}
public static ArrayList<LogEvent> parse(Reader reader, boolean cleanup) throws Exception {
// Create the XML input factory
SAXParserFactory factory = SAXParserFactory.newInstance();
// Create the XML LogEvent reader
SAXParser p = factory.newSAXParser();
if (cleanup) {
// some versions of the log have slightly malformed XML, so clean it
// up before passing it to SAX
reader = new LogCleanupReader(reader);
}
LogParser log = new LogParser();
p.parse(new InputSource(reader), log);
// Associate compilations with their NMethods
for (NMethod nm : log.nmethods.values()) {
Compilation c = log.compiles.get(nm.getId());
nm.setCompilation(c);
// Native wrappers for methods don't have a compilation
if (c != null) {
c.setNMethod(nm);
}
}
// Initially we want the LogEvent log sorted by timestamp
Collections.sort(log.events, sortByStart);
return log.events;
}
String search(Attributes attr, String name) {
return search(attr, name, null);
}
String search(Attributes attr, String name, String defaultValue) {
String result = attr.getValue(name);
if (result != null) {
return result;
}
if (defaultValue != null) {
return defaultValue;
}
for (int i = 0; i < attr.getLength(); i++) {
System.out.println(attr.getQName(i) + " " + attr.getValue(attr.getQName(i)));
}
throw new InternalError("can't find " + name);
}
int indent = 0;
String compile_id;
String type(String id) {
String result = types.get(id);
if (result == null) {
throw new InternalError(id);
}
String remapped = typeMap.get(result);
if (remapped != null) {
return remapped;
}
return result;
}
void type(String id, String name) {
assert type(id) == null;
types.put(id, name);
}
Method method(String id) {
Method result = methods.get(id);
if (result == null) {
throw new InternalError(id);
}
return result;
}
public String makeId(Attributes atts) {
String id = atts.getValue("compile_id");
String kind = atts.getValue("kind");
if (kind != null && kind.equals("osr")) {
id += "%";
}
return id;
}
@Override
public void startElement(String uri,
String localName,
String qname,
Attributes atts) {
if (qname.equals("phase")) {
Phase p = new Phase(search(atts, "name"),
Double.parseDouble(search(atts, "stamp")),
Integer.parseInt(search(atts, "nodes")));
phaseStack.push(p);
} else if (qname.equals("phase_done")) {
Phase p = phaseStack.pop();
p.setEndNodes(Integer.parseInt(search(atts, "nodes")));
p.setEnd(Double.parseDouble(search(atts, "stamp")));
compile.getPhases().add(p);
} else if (qname.equals("task")) {
compile = new Compilation(Integer.parseInt(search(atts, "compile_id", "-1")));
compile.setStart(Double.parseDouble(search(atts, "stamp")));
compile.setICount(search(atts, "count", "0"));
compile.setBCount(search(atts, "backedge_count", "0"));
String method = atts.getValue("method");
int space = method.indexOf(' ');
method = method.substring(0, space) + "::" +
method.substring(space + 1, method.indexOf(' ', space + 1) + 1);
String compiler = atts.getValue("compiler");
if (compiler == null) {
compiler = "";
}
String kind = atts.getValue("compile_kind");
if (kind == null) {
kind = "normal";
}
if (kind.equals("osr")) {
compile.setOsr(true);
compile.setOsr_bci(Integer.parseInt(search(atts, "osr_bci")));
} else if (kind.equals("c2i")) {
compile.setSpecial("--- adapter " + method);
} else {
compile.setSpecial(compile.getId() + " " + method + " (0 bytes)");
}
events.add(compile);
compiles.put(makeId(atts), compile);
} else if (qname.equals("type")) {
type(search(atts, "id"), search(atts, "name"));
} else if (qname.equals("bc")) {
bci = Integer.parseInt(search(atts, "bci"));
} else if (qname.equals("klass")) {
type(search(atts, "id"), search(atts, "name"));
} else if (qname.equals("method")) {
String id = search(atts, "id");
Method m = new Method();
m.setHolder(type(search(atts, "holder")));
m.setName(search(atts, "name"));
m.setReturnType(type(search(atts, "return")));
m.setArguments(search(atts, "arguments", "void"));
m.setBytes(search(atts, "bytes"));
m.setIICount(search(atts, "iicount"));
m.setFlags(search(atts, "flags"));
methods.put(id, m);
} else if (qname.equals("call")) {
site = new CallSite(bci, method(search(atts, "method")));
site.setCount(Integer.parseInt(search(atts, "count")));
String receiver = atts.getValue("receiver");
if (receiver != null) {
site.setReceiver(type(receiver));
site.setReceiver_count(Integer.parseInt(search(atts, "receiver_count")));
}
scopes.peek().add(site);
} else if (qname.equals("regalloc")) {
compile.setAttempts(Integer.parseInt(search(atts, "attempts")));
} else if (qname.equals("inline_fail")) {
scopes.peek().last().setReason(search(atts, "reason"));
} else if (qname.equals("failure")) {
failureReason = search(atts, "reason");
} else if (qname.equals("task_done")) {
compile.setEnd(Double.parseDouble(search(atts, "stamp")));
if (Integer.parseInt(search(atts, "success")) == 0) {
compile.setFailureReason(failureReason);
}
} else if (qname.equals("make_not_entrant")) {
String id = makeId(atts);
NMethod nm = nmethods.get(id);
if (nm == null) throw new InternalError();
LogEvent e = new MakeNotEntrantEvent(Double.parseDouble(search(atts, "stamp")), id,
atts.getValue("zombie") != null, nm);
events.add(e);
} else if (qname.equals("uncommon_trap")) {
String id = atts.getValue("compile_id");
if (id != null) {
id = makeId(atts);
currentTrap = new UncommonTrapEvent(Double.parseDouble(search(atts, "stamp")),
id,
atts.getValue("reason"),
atts.getValue("action"),
Integer.parseInt(search(atts, "count", "0")));
events.add(currentTrap);
} else {
// uncommon trap inserted during parsing.
// ignore for now
}
} else if (qname.equals("jvms")) {
// <jvms bci='4' method='java/io/DataInputStream readChar ()C' bytes='40' count='5815' iicount='20815'/>
if (currentTrap != null) {
currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci")));
} else {
System.err.println("Missing uncommon_trap for jvms");
}
} else if (qname.equals("nmethod")) {
String id = makeId(atts);
NMethod nm = new NMethod(Double.parseDouble(search(atts, "stamp")),
id,
parseLong(atts.getValue("address")),
parseLong(atts.getValue("size")));
nmethods.put(id, nm);
events.add(nm);
} else if (qname.equals("parse")) {
Method m = method(search(atts, "method"));
if (scopes.size() == 0) {
compile.setMethod(m);
scopes.push(compile.getCall());
} else {
if (site.getMethod() == m) {
scopes.push(site);
} else if (scopes.peek().getCalls().size() > 2 && m == scopes.peek().last(-2).getMethod()) {
scopes.push(scopes.peek().last(-2));
} else {
System.out.println(site.getMethod());
System.out.println(m);
throw new InternalError("call site and parse don't match");
}
}
}
}
@Override
public void endElement(String uri,
String localName,
String qname) {
if (qname.equals("parse")) {
indent -= 2;
scopes.pop();
} else if (qname.equals("uncommon_trap")) {
currentTrap = null;
} else if (qname.equals("task")) {
types.clear();
methods.clear();
site = null;
}
}
@Override
public void warning(org.xml.sax.SAXParseException e) {
System.err.println(e.getMessage() + " at line " + e.getLineNumber() + ", column " + e.getColumnNumber());
e.printStackTrace();
}
@Override
public void error(org.xml.sax.SAXParseException e) {
System.err.println(e.getMessage() + " at line " + e.getLineNumber() + ", column " + e.getColumnNumber());
e.printStackTrace();
}
@Override
public void fatalError(org.xml.sax.SAXParseException e) {
System.err.println(e.getMessage() + " at line " + e.getLineNumber() + ", column " + e.getColumnNumber());
e.printStackTrace();
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
class MakeNotEntrantEvent extends BasicLogEvent {
private final boolean zombie;
private NMethod nmethod;
MakeNotEntrantEvent(double s, String i, boolean z, NMethod nm) {
super(s, i);
zombie = z;
nmethod = nm;
}
public NMethod getNMethod() {
return nmethod;
}
public void print(PrintStream stream) {
if (isZombie()) {
stream.printf("%s make_zombie\n", getId());
} else {
stream.printf("%s make_not_entrant\n", getId());
}
}
public boolean isZombie() {
return zombie;
}
}

View File

@ -0,0 +1,120 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.util.Arrays;
public class Method implements Constants {
private String holder;
private String name;
private String returnType;
private String arguments;
private String bytes;
private String iicount;
private String flags;
String decodeFlags(int osr_bci) {
int f = Integer.parseInt(getFlags());
char[] c = new char[4];
Arrays.fill(c, ' ');
if (osr_bci >= 0) {
c[0] = '%';
}
if ((f & JVM_ACC_SYNCHRONIZED) != 0) {
c[1] = 's';
}
return new String(c);
}
String format(int osr_bci) {
if (osr_bci >= 0) {
return getHolder().replace('/', '.') + "::" + getName() + " @ " + osr_bci + " (" + getBytes() + " bytes)";
} else {
return getHolder().replace('/', '.') + "::" + getName() + " (" + getBytes() + " bytes)";
}
}
@Override
public String toString() {
return getHolder().replace('/', '.') + "::" + getName() + " (" + getBytes() + " bytes)";
}
public String getHolder() {
return holder;
}
public void setHolder(String holder) {
this.holder = holder;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public String getArguments() {
return arguments;
}
public void setArguments(String arguments) {
this.arguments = arguments;
}
public String getBytes() {
return bytes;
}
public void setBytes(String bytes) {
this.bytes = bytes;
}
public String getIICount() {
return iicount;
}
public void setIICount(String iicount) {
this.iicount = iicount;
}
public String getFlags() {
return flags;
}
public void setFlags(String flags) {
this.flags = flags;
}
}

View File

@ -0,0 +1,60 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
public class NMethod extends BasicLogEvent {
private long address;
private long size;
NMethod(double s, String i, long a, long sz) {
super(s, i);
address = a;
size = sz;
}
public void print(PrintStream out) {
// XXX Currently we do nothing
// throw new InternalError();
}
public long getAddress() {
return address;
}
public void setAddress(long address) {
this.address = address;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
public class Phase extends BasicLogEvent {
private final int startNodes;
private int endNodes;
Phase(String n, double s, int nodes) {
super(s, n);
startNodes = nodes;
}
int getNodes() {
return getStartNodes();
}
void setEndNodes(int n) {
endNodes = n;
}
public String getName() {
return getId();
}
public int getStartNodes() {
return startNodes;
}
public int getEndNodes() {
return endNodes;
}
@Override
public void print(PrintStream stream) {
throw new UnsupportedOperationException("Not supported yet.");
}
}

View File

@ -0,0 +1,84 @@
/*
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
package com.sun.hotspot.tools.compiler;
import java.io.PrintStream;
class UncommonTrapEvent extends BasicLogEvent {
private final String reason;
private final String action;
private int count;
private String jvms = "";
UncommonTrapEvent(double s, String i, String r, String a, int c) {
super(s, i);
reason = r;
action = a;
count = c;
}
public void addJVMS(String method, int bci) {
setJvms(getJvms() + " @" + bci + " " + method + "\n");
}
public void updateCount(UncommonTrapEvent trap) {
setCount(Math.max(getCount(), trap.getCount()));
}
public void print(PrintStream stream) {
stream.printf("%s uncommon trap %s %s\n", getId(), getReason(), getAction());
stream.print(getJvms());
}
public String getReason() {
return reason;
}
public String getAction() {
return action;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getJvms() {
return jvms;
}
public void setJvms(String jvms) {
this.jvms = jvms;
}
public void setCompilation(Compilation compilation) {
this.compilation = compilation;
}
}

View File

@ -365,7 +365,7 @@ public class Database {
// HACK ALERT. The compilation of ad_<arch> files is very slow.
// We want to start compiling them as early as possible. The compilation
// order on unix is dependant on the order we emit files here.
// order on unix is dependent on the order we emit files here.
// By sorting the output before emitting it, we expect
// that ad_<arch> will be compiled early.
boolean shouldSortObjFiles = true;

View File

@ -88,7 +88,7 @@ reg_class X_REG(AX, BX); // form a matcher register class of X_REG
// these are used for constraints, etc.
alloc_class class1(AX, BX); // form an allocation class of registers
// used by the register allocator for seperate
// used by the register allocator for separate
// allocation of target register classes
3. Pipeline Syntax for Scheduling
@ -150,7 +150,7 @@ D. Delimiters
b. %} (block terminator)
c. EOF (file terminator)
4. Each statement must start on a seperate line
4. Each statement must start on a separate line
5. Identifiers cannot contain: (){}%;,"/\

View File

@ -79,6 +79,7 @@ typedef unsigned int uintptr_t;
// Macros
// Debugging note: Put a breakpoint on "abort".
#undef assert
#define assert(cond, msg) { if (!(cond)) { fprintf(stderr, "assert fails %s %d: %s\n", __FILE__, __LINE__, msg); abort(); }}
#define max(a, b) (((a)>(b)) ? (a) : (b))

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -298,7 +298,7 @@ void ADLParser::matchrule_clone_and_swap(MatchRule* rule, const char* instr_iden
rule->count_commutative_op(count);
if (count > 0) {
// Clone match rule and swap commutative operation's operands.
rule->swap_commutative_op(instr_ident, count, match_rules_cnt);
rule->matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt);
}
}
@ -2586,7 +2586,7 @@ void ADLParser::peep_constraint_parse(Peephole &peep) {
while( _curchar != ')' ) {
// Get information on the left instruction and its operand
// left-instructions's number
intptr_t left_inst = get_int();
int left_inst = get_int();
// Left-instruction's operand
skipws();
if( _curchar != '.' ) {
@ -2602,7 +2602,7 @@ void ADLParser::peep_constraint_parse(Peephole &peep) {
skipws();
// Get information on the right instruction and its operand
intptr_t right_inst; // Right-instructions's number
int right_inst; // Right-instructions's number
if( isdigit(_curchar) ) {
right_inst = get_int();
// Right-instruction's operand
@ -3497,22 +3497,24 @@ FormatRule* ADLParser::template_parse(void) {
// (1)
// Check if there is a string to pass through to output
char *start = _ptr; // Record start of the next string
while ((_curchar != '$') && ((_curchar != '%') || (*(_ptr+1) != '}')) ) {
// If at the start of a comment, skip past it
if( (_curchar == '/') && ((*(_ptr+1) == '/') || (*(_ptr+1) == '*')) ) {
skipws_no_preproc();
} else {
// ELSE advance to the next character, or start of the next line
next_char_or_line();
{
char *start = _ptr; // Record start of the next string
while ((_curchar != '$') && ((_curchar != '%') || (*(_ptr+1) != '}')) ) {
// If at the start of a comment, skip past it
if( (_curchar == '/') && ((*(_ptr+1) == '/') || (*(_ptr+1) == '*')) ) {
skipws_no_preproc();
} else {
// ELSE advance to the next character, or start of the next line
next_char_or_line();
}
}
// If a string was found, terminate it and record in EncClass
if ( start != _ptr ) {
*_ptr = '\0'; // Terminate the string
// Add flag to _strings list indicating we should check _rep_vars
format->_strings.addName(NameList::_signal2);
format->_strings.addName(start);
}
}
// If a string was found, terminate it and record in EncClass
if ( start != _ptr ) {
*_ptr = '\0'; // Terminate the string
// Add flag to _strings list indicating we should check _rep_vars
format->_strings.addName(NameList::_signal2);
format->_strings.addName(start);
}
// (2)
@ -3563,10 +3565,10 @@ FormatRule* ADLParser::template_parse(void) {
// copy it and record in FormatRule
if ( _curchar == '$' ) {
next_char(); // Move past the '$'
char* rep_var = get_ident(); // Nil terminate the variable name
rep_var = strdup(rep_var);// Copy the string
char* next_rep_var = get_ident(); // Nil terminate the variable name
next_rep_var = strdup(next_rep_var);// Copy the string
*_ptr = _curchar; // and replace Nil with original character
format->_rep_vars.addName(rep_var);
format->_rep_vars.addName(next_rep_var);
// Add flag to _strings list indicating we should check _rep_vars
format->_strings.addName(NameList::_signal);
}
@ -3714,13 +3716,13 @@ ExpandRule* ADLParser::expand_parse(InstructForm *instr) {
parse_err(SYNERR, "identifier expected at %c\n", _curchar);
continue;
} // Check that you have a valid operand
const Form *form = instr->_localNames[ident2];
if (!form) {
const Form *form2 = instr->_localNames[ident2];
if (!form2) {
parse_err(SYNERR, "operand name expected at %s\n", ident2);
continue;
}
oper = form->is_operand();
if (oper == NULL && !form->is_opclass()) {
oper = form2->is_operand();
if (oper == NULL && !form2->is_opclass()) {
parse_err(SYNERR, "operand name expected at %s\n", ident2);
continue;
} // Add operand to list
@ -4271,7 +4273,7 @@ int ADLParser::get_int(void) {
int result; // Storage for integer result
if( _curline == NULL ) // Return NULL at EOF.
return NULL;
return 0;
skipws(); // Skip whitespace before identifier
start = end = _ptr; // Start points at first character
@ -4553,7 +4555,7 @@ void ADLParser::parse_err(int flag, const char *fmt, ...) {
//---------------------------ensure_start_of_line------------------------------
// A preprocessor directive has been encountered. Be sure it has fallen at
// the begining of a line, or else report an error.
// the beginning of a line, or else report an error.
void ADLParser::ensure_start_of_line(void) {
if (_curchar == '\n') { next_line(); return; }
assert( _ptr >= _curline && _ptr < _curline+strlen(_curline),

View File

@ -1,5 +1,5 @@
//
// Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
// Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -436,10 +436,12 @@ void ArchDesc::build_chain_rule(OperandForm *oper) {
if ((oper->_matrule) && (oper->_matrule->_lChild == NULL) &&
(oper->_matrule->_rChild == NULL)) {
const Form *form = _globalNames[oper->_matrule->_opType];
if ((form) && form->is_operand() &&
(form->ideal_only() == false)) {
add_chain_rule_entry(oper->_matrule->_opType, oper->cost(), oper->_ident);
{
const Form *form = _globalNames[oper->_matrule->_opType];
if ((form) && form->is_operand() &&
(form->ideal_only() == false)) {
add_chain_rule_entry(oper->_matrule->_opType, oper->cost(), oper->_ident);
}
}
// Check for additional chain rules
if (oper->_matrule->_next) {
@ -1015,12 +1017,12 @@ void ArchDesc::initBaseOpTypes() {
int idealIndex = 0;
for (idealIndex = 1; idealIndex < _last_machine_leaf; ++idealIndex) {
const char *idealName = NodeClassNames[idealIndex];
_idealIndex.Insert((void*)idealName, (void*)idealIndex);
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
}
for ( idealIndex = _last_machine_leaf+1;
idealIndex < _last_opcode; ++idealIndex) {
const char *idealName = NodeClassNames[idealIndex];
_idealIndex.Insert((void*)idealName, (void*)idealIndex);
_idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -870,7 +870,7 @@ void ExprDict::print_asserts(FILE *fp) {
}
// Print out the dictionary contents as key-value pairs
static void dumpekey(const void* key) { fprintf(stdout, "%s", key); }
static void dumpekey(const void* key) { fprintf(stdout, "%s", (char*) key); }
static void dumpexpr(const void* expr) { fflush(stdout); ((Expr*)expr)->print(); }
void ExprDict::dump() {
@ -1020,7 +1020,7 @@ void ProductionState::set_cost_bounds(const char *result, const Expr *cost, bool
}
// Print out the dictionary contents as key-value pairs
static void print_key (const void* key) { fprintf(stdout, "%s", key); }
static void print_key (const void* key) { fprintf(stdout, "%s", (char*) key); }
static void print_production(const void* production) { fflush(stdout); ((Production*)production)->print(); }
void ProductionState::print() {

View File

@ -275,7 +275,7 @@ void Dict::print(PrintKeyOrValue print_key, PrintKeyOrValue print_value) {
// Convert string to hash key. This algorithm implements a universal hash
// function with the multipliers frozen (ok, so it's not universal). The
// multipliers (and allowable characters) are all odd, so the resultant sum
// is odd - guarenteed not divisible by any power of two, so the hash tables
// is odd - guaranteed not divisible by any power of two, so the hash tables
// can be any power of two with good results. Also, I choose multipliers
// that have only 2 bits set (the low is always set to be odd) so
// multiplication requires only shifts and adds. Characters are required to
@ -296,7 +296,7 @@ int hashstr(const void *t) {
}
//------------------------------hashptr--------------------------------------
// Slimey cheap hash function; no guarenteed performance. Better than the
// Slimey cheap hash function; no guaranteed performance. Better than the
// default for pointers, especially on MS-DOS machines.
int hashptr(const void *key) {
#ifdef __TURBOC__
@ -306,7 +306,7 @@ int hashptr(const void *key) {
#endif
}
// Slimey cheap hash function; no guarenteed performance.
// Slimey cheap hash function; no guaranteed performance.
int hashkey(const void *key) {
return (int)((intptr_t)key);
}

View File

@ -89,10 +89,10 @@ class Dict { // Dictionary structure
// Hashing functions
int hashstr(const void *s); // Nice string hash
// Slimey cheap hash function; no guarenteed performance. Better than the
// Slimey cheap hash function; no guaranteed performance. Better than the
// default for pointers, especially on MS-DOS machines.
int hashptr(const void *key);
// Slimey cheap hash function; no guarenteed performance.
// Slimey cheap hash function; no guaranteed performance.
int hashkey(const void *key);
// Key comparators

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -25,6 +25,8 @@
// FILEBUFF.CPP - Routines for handling a parser file buffer
#include "adlc.hpp"
using namespace std;
//------------------------------FileBuff---------------------------------------
// Create a new parsing buffer
FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) {
@ -48,10 +50,10 @@ FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(arc
file_error(SEMERR, 0, "Buffer allocation failed\n");
exit(1); // Exit on allocation failure
}
*_bigbuf = '\n'; // Lead with a sentinal newline
_buf = _bigbuf+1; // Skip sentinal
*_bigbuf = '\n'; // Lead with a sentinel newline
_buf = _bigbuf+1; // Skip sentinel
_bufmax = _buf; // Buffer is empty
_bufeol = _bigbuf; // _bufeol points at sentinal
_bufeol = _bigbuf; // _bufeol points at sentinel
_filepos = -1; // filepos is in sync with _bufeol
_bufoff = _offset = 0L; // Offset at file start
@ -60,8 +62,8 @@ FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(arc
file_error(SEMERR, 0, "File read error, no input read\n");
exit(1); // Exit on read error
}
*_bufmax = '\n'; // End with a sentinal new-line
*(_bufmax+1) = '\0'; // Then end with a sentinal NULL
*_bufmax = '\n'; // End with a sentinel new-line
*(_bufmax+1) = '\0'; // Then end with a sentinel NULL
}
//------------------------------~FileBuff--------------------------------------
@ -79,7 +81,7 @@ char *FileBuff::get_line(void) {
_linenum++;
retval = ++_bufeol; // return character following end of previous line
if (*retval == '\0') return NULL; // Check for EOF sentinal
if (*retval == '\0') return NULL; // Check for EOF sentinel
// Search for newline character which must end each line
for(_filepos++; *_bufeol != '\n'; _bufeol++)
_filepos++; // keep filepos in sync with _bufeol
@ -217,7 +219,7 @@ static int printline( ostream& os, const char *fname, int line,
off = expandtab(os,off,*s++,'-','-');
if( i == len ) os << '^'; // Mark end of region
os << '\n'; // End of marked line
return 0L; // All done
return 0; // All done
}
//------------------------------print------------------------------------------

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -26,6 +26,7 @@
#include <iostream>
using namespace std;
// STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
typedef struct {
const char *_name;
@ -36,7 +37,7 @@ class ArchDesc;
//------------------------------FileBuff--------------------------------------
// This class defines a nicely behaved buffer of text. Entire file of text
// is read into buffer at creation, with sentinals at start and end.
// is read into buffer at creation, with sentinels at start and end.
class FileBuff {
friend class FileBuffRegion;
private:
@ -45,8 +46,8 @@ class FileBuff {
long _bufoff; // Start of buffer file offset
char *_buf; // The buffer itself.
char *_bigbuf; // The buffer plus sentinals; actual heap area
char *_bufmax; // A pointer to the buffer end sentinal
char *_bigbuf; // The buffer plus sentinels; actual heap area
char *_bufmax; // A pointer to the buffer end sentinel
char *_bufeol; // A pointer to the last complete line end
int _err; // Error flag for file seek/read operations
@ -72,7 +73,7 @@ class FileBuff {
// This converts a pointer into the buffer to a file offset. It only works
// when the pointer is valid (i.e. just obtained from getline()).
int getoff(const char *s) { return _bufoff+(int)(s-_buf); }
long getoff(const char* s) { return _bufoff + (s - _buf); }
};
//------------------------------FileBuffRegion---------------------------------
@ -95,8 +96,6 @@ class FileBuffRegion {
FileBuffRegion *copy(); // Deep copy
FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input
// void print(std::ostream&);
// friend std::ostream& operator<< (std::ostream&, FileBuffRegion&);
void print(ostream&);
friend ostream& operator<< (ostream&, FileBuffRegion&);
};

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -370,7 +370,7 @@ bool FormDict::operator ==(const FormDict &d) const {
}
// Print out the dictionary contents as key-value pairs
static void dumpkey (const void* key) { fprintf(stdout, "%s", key); }
static void dumpkey (const void* key) { fprintf(stdout, "%s", (char*) key); }
static void dumpform(const void* form) { fflush(stdout); ((Form*)form)->dump(); }
void FormDict::dump() {

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -124,7 +124,7 @@ protected:
public:
// Public Data
Form *_next; // Next pointer for form lists
long _linenum; // Line number for debugging
int _linenum; // Line number for debugging
// Dynamic type check for common forms.
virtual OpClassForm *is_opclass() const;

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -273,13 +273,13 @@ int RegClass::regs_in_word( int wordnum, bool stack_also ) {
for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
int rnum = ((RegDef*)_regDef[name])->register_num();
if( (rnum >> 5) == wordnum )
word |= (1L<<(rnum&31));
word |= (1 << (rnum & 31));
}
if( stack_also ) {
// Now also collect stack bits
for( int i = 0; i < 32; i++ )
if( wordnum*32+i >= RegisterForm::_reg_ctr )
word |= (1L<<i);
word |= (1 << i);
}
return word;
@ -592,10 +592,10 @@ void PeepMatch::add_instruction(int parent, int position, const char *name,
int input) {
if( position > _max_position ) _max_position = position;
_parent.addName((char *)parent);
_position.addName((char *)position);
_parent.addName((char*) (intptr_t) parent);
_position.addName((char*) (intptr_t) position);
_instrs.addName(name);
_input.addName((char *)input);
_input.addName((char*) (intptr_t) input);
}
// Access info about instructions in the peep-match rule
@ -603,7 +603,7 @@ int PeepMatch::max_position() {
return _max_position;
}
const char *PeepMatch::instruction_name(intptr_t position) {
const char *PeepMatch::instruction_name(int position) {
return _instrs.name(position);
}
@ -615,11 +615,11 @@ void PeepMatch::reset() {
_input.reset();
}
void PeepMatch::next_instruction( intptr_t &parent, intptr_t &position, const char * &name, intptr_t &input ){
parent = (intptr_t)_parent.iter();
position = (intptr_t)_position.iter();
void PeepMatch::next_instruction(int &parent, int &position, const char* &name, int &input) {
parent = (int) (intptr_t) _parent.iter();
position = (int) (intptr_t) _position.iter();
name = _instrs.iter();
input = (intptr_t)_input.iter();
input = (int) (intptr_t) _input.iter();
}
// 'true' if current position in iteration is a placeholder, not matched.
@ -637,15 +637,15 @@ void PeepMatch::output(FILE *fp) { // Write info to output files
}
//------------------------------PeepConstraint---------------------------------
PeepConstraint::PeepConstraint(intptr_t left_inst, char *left_op, char *relation,
intptr_t right_inst, char *right_op)
PeepConstraint::PeepConstraint(int left_inst, char* left_op, char* relation,
int right_inst, char* right_op)
: _left_inst(left_inst), _left_op(left_op), _relation(relation),
_right_inst(right_inst), _right_op(right_op), _next(NULL) {}
PeepConstraint::~PeepConstraint() {
}
// Check if constraints use instruction at position
bool PeepConstraint::constrains_instruction(intptr_t position) {
bool PeepConstraint::constrains_instruction(int position) {
// Check local instruction constraints
if( _left_inst == position ) return true;
if( _right_inst == position ) return true;
@ -692,7 +692,7 @@ void PeepReplace::add_instruction(char *root) {
}
void PeepReplace::add_operand( int inst_num, char *inst_operand ) {
_instruction.add_signal();
_operand_inst_num.addName((char*)inst_num);
_operand_inst_num.addName((char*) (intptr_t) inst_num);
_operand_op_name.addName(inst_operand);
}
@ -702,15 +702,15 @@ void PeepReplace::reset() {
_operand_inst_num.reset();
_operand_op_name.reset();
}
void PeepReplace::next_instruction(const char * &inst){
void PeepReplace::next_instruction(const char* &inst){
inst = _instruction.iter();
intptr_t inst_num = (intptr_t)_operand_inst_num.iter();
const char *inst_operand = _operand_op_name.iter();
int inst_num = (int) (intptr_t) _operand_inst_num.iter();
const char* inst_operand = _operand_op_name.iter();
}
void PeepReplace::next_operand( intptr_t &inst_num, const char * &inst_operand ) {
const char *inst = _instruction.iter();
inst_num = (intptr_t)_operand_inst_num.iter();
inst_operand = _operand_op_name.iter();
void PeepReplace::next_operand(int &inst_num, const char* &inst_operand) {
const char* inst = _instruction.iter();
inst_num = (int) (intptr_t) _operand_inst_num.iter();
inst_operand = _operand_op_name.iter();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -457,10 +457,10 @@ public:
// Access info about instructions in the peep-match rule
int max_position();
const char *instruction_name(intptr_t position);
const char *instruction_name(int position);
// Iterate through all info on matched instructions
void reset();
void next_instruction( intptr_t &parent, intptr_t &position, const char * &name, intptr_t &input );
void next_instruction(int &parent, int &position, const char* &name, int &input);
// 'true' if current position in iteration is a placeholder, not matched.
bool is_placeholder();
@ -474,20 +474,20 @@ private:
PeepConstraint *_next; // Additional constraints ANDed together
public:
const intptr_t _left_inst;
const char *_left_op;
const char *_relation;
const intptr_t _right_inst;
const char *_right_op;
const int _left_inst;
const char* _left_op;
const char* _relation;
const int _right_inst;
const char* _right_op;
public:
// Public Methods
PeepConstraint(intptr_t left_inst, char *left_op, char *relation,
intptr_t right_inst, char *right_op);
PeepConstraint(int left_inst, char* left_op, char* relation,
int right_inst, char* right_op);
~PeepConstraint();
// Check if constraints use instruction at position
bool constrains_instruction(intptr_t position);
bool constrains_instruction(int position);
// Add another constraint
void append(PeepConstraint *next_peep_constraint);
@ -519,7 +519,7 @@ public:
// Access contents of peepreplace
void reset();
void next_instruction(const char * &root);
void next_operand( intptr_t &inst_num, const char * &inst_operand );
void next_operand(int &inst_num, const char * &inst_operand );
// Utilities
void dump();

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -844,8 +844,12 @@ void InstructForm::build_components() {
for (_parameters.reset(); (name = _parameters.iter()) != NULL;) {
OperandForm *opForm = (OperandForm*)_localNames[name];
const Form *form = _effects[name];
Effect *e = form ? form->is_effect() : NULL;
Effect* e = NULL;
{
const Form* form = _effects[name];
e = form ? form->is_effect() : NULL;
}
if (e != NULL) {
has_temp |= e->is(Component::TEMP);
@ -858,19 +862,7 @@ void InstructForm::build_components() {
OperandForm* kill = (OperandForm*)_localNames[kill_name];
globalAD->syntax_err(_linenum, "%s: %s %s must be at the end of the argument list\n",
_ident, kill->_ident, kill_name);
} else if (e->isa(Component::KILL)) {
kill_name = name;
}
// TEMPs are real uses and need to be among the first parameters
// listed, otherwise the numbering of operands and inputs gets
// screwy, so enforce this restriction during parse.
if (kill_name != NULL &&
e->isa(Component::TEMP) && !e->isa(Component::DEF)) {
OperandForm* kill = (OperandForm*)_localNames[kill_name];
globalAD->syntax_err(_linenum, "%s: %s %s must follow %s %s in the argument list\n",
_ident, kill->_ident, kill_name, opForm->_ident, name);
} else if (e->isa(Component::KILL)) {
} else if (e->isa(Component::KILL) && !e->isa(Component::USE)) {
kill_name = name;
}
}
@ -1122,7 +1114,7 @@ bool InstructForm::cisc_spills_to(ArchDesc &AD, InstructForm *instr) {
const char *op_name = NULL;
const char *reg_type = NULL;
FormDict &globals = AD.globalNames();
cisc_spill_operand = _matrule->cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type);
cisc_spill_operand = _matrule->matchrule_cisc_spill_match(globals, AD.get_registers(), instr->_matrule, op_name, reg_type);
if( (cisc_spill_operand != Not_cisc_spillable) && (op_name != NULL) && equivalent_predicates(this, instr) ) {
cisc_spill_operand = operand_position(op_name, Component::USE);
int def_oper = operand_position(op_name, Component::DEF);
@ -1217,13 +1209,17 @@ void InstructForm::rep_var_format(FILE *fp, const char *rep_var) {
// Seach through operands to determine parameters unique positions.
void InstructForm::set_unique_opnds() {
uint* uniq_idx = NULL;
uint nopnds = num_opnds();
int nopnds = num_opnds();
uint num_uniq = nopnds;
uint i;
int i;
_uniq_idx_length = 0;
if ( nopnds > 0 ) {
// Allocate index array with reserve.
uniq_idx = (uint*) malloc(sizeof(uint)*(nopnds + 2));
for( i = 0; i < nopnds+2; i++ ) {
// Allocate index array. Worst case we're mapping from each
// component back to an index and any DEF always goes at 0 so the
// length of the array has to be the number of components + 1.
_uniq_idx_length = _components.count() + 1;
uniq_idx = (uint*) malloc(sizeof(uint)*(_uniq_idx_length));
for( i = 0; i < _uniq_idx_length; i++ ) {
uniq_idx[i] = i;
}
}
@ -1238,8 +1234,8 @@ void InstructForm::set_unique_opnds() {
_parameters.reset();
while( (name = _parameters.iter()) != NULL ) {
count = 0;
uint position = 0;
uint uniq_position = 0;
int position = 0;
int uniq_position = 0;
_components.reset();
Component *comp = NULL;
if( sets_result() ) {
@ -1255,6 +1251,7 @@ void InstructForm::set_unique_opnds() {
}
if( strcmp(name, comp->_name)==0 ) {
if( ++count > 1 ) {
assert(position < _uniq_idx_length, "out of bounds");
uniq_idx[position] = uniq_position;
has_dupl_use = true;
} else {
@ -1284,7 +1281,7 @@ void InstructForm::set_unique_opnds() {
_num_uniq = num_uniq;
}
// Generate index values needed for determing the operand position
// Generate index values needed for determining the operand position
void InstructForm::index_temps(FILE *fp, FormDict &globals, const char *prefix, const char *receiver) {
uint idx = 0; // position of operand in match rule
int cur_num_opnds = num_opnds();
@ -2200,8 +2197,8 @@ int OperandForm::operand_position(const char *name, int usedef) {
// Return zero-based position in component list, only counting constants;
// Return -1 if not in list.
int OperandForm::constant_position(FormDict &globals, const Component *last) {
// Iterate through components and count constants preceeding 'constant'
uint position = 0;
// Iterate through components and count constants preceding 'constant'
int position = 0;
Component *comp;
_components.reset();
while( (comp = _components.iter()) != NULL && (comp != last) ) {
@ -2238,7 +2235,7 @@ int OperandForm::constant_position(FormDict &globals, const char *name) {
// Return zero-based position in component list, only counting constants;
// Return -1 if not in list.
int OperandForm::register_position(FormDict &globals, const char *reg_name) {
// Iterate through components and count registers preceeding 'last'
// Iterate through components and count registers preceding 'last'
uint position = 0;
Component *comp;
_components.reset();
@ -2304,7 +2301,7 @@ void OperandForm::disp_is_oop(FILE *fp, FormDict &globals) {
if ( op->is_base_constant(globals) == Form::idealP ) {
// Find the constant's index: _c0, _c1, _c2, ... , _cN
uint idx = op->constant_position( globals, rep_var);
fprintf(fp," virtual bool disp_is_oop() const {", _ident);
fprintf(fp," virtual bool disp_is_oop() const {");
fprintf(fp, " return _c%d->isa_oop_ptr();", idx);
fprintf(fp, " }\n");
}
@ -3042,9 +3039,9 @@ bool MatchNode::find_type(const char *type, int &position) const {
// Recursive call collecting info on top-level operands, not transitive.
// Implementation does not modify state of internal structures.
void MatchNode::append_components(FormDict &locals, ComponentList &components,
bool deflag) const {
int usedef = deflag ? Component::DEF : Component::USE;
void MatchNode::append_components(FormDict& locals, ComponentList& components,
bool def_flag) const {
int usedef = def_flag ? Component::DEF : Component::USE;
FormDict &globals = _AD.globalNames();
assert (_name != NULL, "MatchNode::build_components encountered empty node\n");
@ -3062,10 +3059,10 @@ void MatchNode::append_components(FormDict &locals, ComponentList &components,
return;
}
// Promote results of "Set" to DEF
bool def_flag = (!strcmp(_opType, "Set")) ? true : false;
if (_lChild) _lChild->append_components(locals, components, def_flag);
def_flag = false; // only applies to component immediately following 'Set'
if (_rChild) _rChild->append_components(locals, components, def_flag);
bool tmpdef_flag = (!strcmp(_opType, "Set")) ? true : false;
if (_lChild) _lChild->append_components(locals, components, tmpdef_flag);
tmpdef_flag = false; // only applies to component immediately following 'Set'
if (_rChild) _rChild->append_components(locals, components, tmpdef_flag);
}
// Find the n'th base-operand in the match node,
@ -3411,9 +3408,9 @@ bool static root_ops_match(FormDict &globals, const char *op1, const char *op2)
return (form1 == form2);
}
//-------------------------cisc_spill_match------------------------------------
//-------------------------cisc_spill_match_node-------------------------------
// Recursively check two MatchRules for legal conversion via cisc-spilling
int MatchNode::cisc_spill_match(FormDict &globals, RegisterForm *registers, MatchNode *mRule2, const char * &operand, const char * &reg_type) {
int MatchNode::cisc_spill_match(FormDict& globals, RegisterForm* registers, MatchNode* mRule2, const char* &operand, const char* &reg_type) {
int cisc_spillable = Maybe_cisc_spillable;
int left_spillable = Maybe_cisc_spillable;
int right_spillable = Maybe_cisc_spillable;
@ -3487,13 +3484,13 @@ int MatchNode::cisc_spill_match(FormDict &globals, RegisterForm *registers, Mat
return cisc_spillable;
}
//---------------------------cisc_spill_match----------------------------------
//---------------------------cisc_spill_match_rule------------------------------
// Recursively check two MatchRules for legal conversion via cisc-spilling
// This method handles the root of Match tree,
// general recursive checks done in MatchNode
int MatchRule::cisc_spill_match(FormDict &globals, RegisterForm *registers,
MatchRule *mRule2, const char * &operand,
const char * &reg_type) {
int MatchRule::matchrule_cisc_spill_match(FormDict& globals, RegisterForm* registers,
MatchRule* mRule2, const char* &operand,
const char* &reg_type) {
int cisc_spillable = Maybe_cisc_spillable;
int left_spillable = Maybe_cisc_spillable;
int right_spillable = Maybe_cisc_spillable;
@ -3531,7 +3528,7 @@ int MatchRule::cisc_spill_match(FormDict &globals, RegisterForm *registers,
//----------------------------- equivalent ------------------------------------
// Recursively check to see if two match rules are equivalent.
// This rule handles the root.
bool MatchRule::equivalent(FormDict &globals, MatchRule *mRule2) {
bool MatchRule::equivalent(FormDict &globals, MatchNode *mRule2) {
// Check that each sets a result
if (sets_result() != mRule2->sets_result()) {
return false;
@ -3647,7 +3644,7 @@ void MatchNode::swap_commutative_op(bool atroot, int id) {
//-------------------------- swap_commutative_op ------------------------------
// Recursively swap specified commutative operation with subtree operands.
void MatchRule::swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) {
void MatchRule::matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt) {
assert(match_rules_cnt < 100," too many match rule clones");
// Clone
MatchRule* clone = new MatchRule(_AD, this);
@ -3660,8 +3657,8 @@ void MatchRule::swap_commutative_op(const char* instr_ident, int count, int& mat
clone->_next = this->_next;
this-> _next = clone;
if( (--count) > 0 ) {
this-> swap_commutative_op(instr_ident, count, match_rules_cnt);
clone->swap_commutative_op(instr_ident, count, match_rules_cnt);
this-> matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt);
clone->matchrule_swap_commutative_op(instr_ident, count, match_rules_cnt);
}
}
@ -3693,7 +3690,7 @@ MatchRule::~MatchRule() {
// Recursive call collecting info on top-level operands, not transitive.
// Implementation does not modify state of internal structures.
void MatchRule::append_components(FormDict &locals, ComponentList &components) const {
void MatchRule::append_components(FormDict& locals, ComponentList& components, bool def_flag) const {
assert (_name != NULL, "MatchNode::build_components encountered empty node\n");
MatchNode::append_components(locals, components,

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -101,6 +101,7 @@ public:
const char *_ins_pipe; // Instruction Scheduline description class
uint *_uniq_idx; // Indexes of unique operands
int _uniq_idx_length; // Length of _uniq_idx array
uint _num_uniq; // Number of unique operands
ComponentList _components; // List of Components matches MachNode's
// operand structure
@ -257,11 +258,13 @@ public:
void set_unique_opnds();
uint num_unique_opnds() { return _num_uniq; }
uint unique_opnds_idx(int idx) {
if( _uniq_idx != NULL && idx > 0 )
if( _uniq_idx != NULL && idx > 0 ) {
assert(idx < _uniq_idx_length, "out of bounds");
return _uniq_idx[idx];
else
} else {
return idx;
}
}
}
// Operands which are only KILLs aren't part of the input array and
// require special handling in some cases. Their position in this
@ -274,7 +277,7 @@ public:
//
// Generate the format call for the replacement variable
void rep_var_format(FILE *fp, const char *rep_var);
// Generate index values needed for determing the operand position
// Generate index values needed for determining the operand position
void index_temps (FILE *fp, FormDict &globals, const char *prefix = "", const char *receiver = "");
// ---------------------------
@ -341,7 +344,7 @@ public:
// --------------------------- Code Block
// Add code
void add_code(const char *string_preceeding_replacement_var);
void add_code(const char *string_preceding_replacement_var);
// Add a replacement variable or one of its subfields
// Subfields are stored with a leading '$'
void add_rep_var(char *replacement_var);
@ -917,8 +920,8 @@ public:
// return 1 if found and position is incremented by operand offset in rule
bool find_name(const char *str, int &position) const;
bool find_type(const char *str, int &position) const;
void append_components(FormDict &locals, ComponentList &components,
bool def_flag) const;
virtual void append_components(FormDict& locals, ComponentList& components,
bool def_flag = false) const;
bool base_operand(uint &position, FormDict &globals,
const char * &result, const char * &name,
const char * &opType) const;
@ -944,12 +947,12 @@ public:
const char *reduce_left (FormDict &globals) const;
// Recursive version of check in MatchRule
int cisc_spill_match(FormDict &globals, RegisterForm *registers,
MatchNode *mRule2, const char * &operand,
const char * &reg_type);
int cisc_spill_match(FormDict& globals, RegisterForm* registers,
MatchNode* mRule2, const char* &operand,
const char* &reg_type);
int cisc_spill_merge(int left_result, int right_result);
bool equivalent(FormDict &globals, MatchNode *mNode2);
virtual bool equivalent(FormDict& globals, MatchNode* mNode2);
void count_commutative_op(int& count);
void swap_commutative_op(bool atroot, int count);
@ -976,7 +979,7 @@ public:
MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves);
~MatchRule();
void append_components(FormDict &locals, ComponentList &components) const;
virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const;
// Recursive call on all operands' match rules in my match rule.
bool base_operand(uint &position, FormDict &globals,
const char * &result, const char * &name,
@ -1003,14 +1006,14 @@ public:
Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
// Check if 'mRule2' is a cisc-spill variant of this MatchRule
int cisc_spill_match(FormDict &globals, RegisterForm *registers,
MatchRule *mRule2, const char * &operand,
const char * &reg_type);
int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers,
MatchRule* mRule2, const char* &operand,
const char* &reg_type);
// Check if 'mRule2' is equivalent to this MatchRule
bool equivalent(FormDict &globals, MatchRule *mRule2);
virtual bool equivalent(FormDict& globals, MatchNode* mRule2);
void swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt);
void matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt);
void dump();
void output(FILE *fp);

View File

@ -1,5 +1,5 @@
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1997-2009 Sun Microsystems, Inc. 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
@ -349,7 +349,7 @@ void ArchDesc::close_files(int delete_out)
}
else {
if (_ADL_file._name) printf("%s --> ", _ADL_file._name);
printf("%s, %s, %s, %s, %s, %s, %s, %s, %s",
printf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
_CPP_file._name,
_CPP_CLONE_file._name,
_CPP_EXPAND_file._name,
@ -358,7 +358,8 @@ void ArchDesc::close_files(int delete_out)
_CPP_MISC_file._name,
_CPP_PEEPHOLE_file._name,
_CPP_PIPELINE_file._name,
_HPP_file._name, _DFA_file._name);
_HPP_file._name,
_DFA_file._name);
}
printf("\n");
}
@ -431,7 +432,7 @@ int get_legal_text(FileBuff &fbuf, char **legal_text)
legal_end = fbuf.get_line();
}
*legal_text = legal_start;
return (legal_end - legal_start);
return (int) (legal_end - legal_start);
}
// VS2005 has its own definition, identical to this one.

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -225,11 +225,11 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi
pipeclass->_parameters.reset();
while ( (paramname = pipeclass->_parameters.iter()) != NULL ) {
const PipeClassOperandForm *pipeopnd =
const PipeClassOperandForm *tmppipeopnd =
(const PipeClassOperandForm *)pipeclass->_localUsage[paramname];
if (pipeopnd)
templen += 10 + (int)strlen(pipeopnd->_stage);
if (tmppipeopnd)
templen += 10 + (int)strlen(tmppipeopnd->_stage);
else
templen += 19;
@ -253,10 +253,10 @@ static int pipeline_reads_initializer(FILE *fp_cpp, NameList &pipeline_reads, Pi
pipeclass->_parameters.reset();
while ( (paramname = pipeclass->_parameters.iter()) != NULL ) {
const PipeClassOperandForm *pipeopnd =
const PipeClassOperandForm *tmppipeopnd =
(const PipeClassOperandForm *)pipeclass->_localUsage[paramname];
templen += sprintf(&operand_stages[templen], " stage_%s%c\n",
pipeopnd ? pipeopnd->_stage : "undefined",
tmppipeopnd ? tmppipeopnd->_stage : "undefined",
(++i < paramcount ? ',' : ' ') );
}
@ -1042,10 +1042,10 @@ static void defineOut_RegMask(FILE *fp, const char *node, const char *regMask) {
// Scan the peepmatch and output a test for each instruction
static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
intptr_t parent = -1;
intptr_t inst_position = 0;
const char *inst_name = NULL;
intptr_t input = 0;
int parent = -1;
int inst_position = 0;
const char* inst_name = NULL;
int input = 0;
fprintf(fp, " // Check instruction sub-tree\n");
pmatch->reset();
for( pmatch->next_instruction( parent, inst_position, inst_name, input );
@ -1055,14 +1055,14 @@ static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepCo
if( ! pmatch->is_placeholder() ) {
// Define temporaries 'inst#', based on parent and parent's input index
if( parent != -1 ) { // root was initialized
fprintf(fp, " inst%ld = inst%ld->in(%ld);\n",
fprintf(fp, " inst%d = inst%d->in(%d);\n",
inst_position, parent, input);
}
// When not the root
// Test we have the correct instruction by comparing the rule
if( parent != -1 ) {
fprintf(fp, " matches = matches && ( inst%ld->rule() == %s_rule );",
fprintf(fp, " matches = matches && ( inst%d->rule() == %s_rule );",
inst_position, inst_name);
}
} else {
@ -1073,20 +1073,20 @@ static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepCo
}
}
static void print_block_index(FILE *fp, intptr_t inst_position) {
static void print_block_index(FILE *fp, int inst_position) {
assert( inst_position >= 0, "Instruction number less than zero");
fprintf(fp, "block_index");
if( inst_position != 0 ) {
fprintf(fp, " - %ld", inst_position);
fprintf(fp, " - %d", inst_position);
}
}
// Scan the peepmatch and output a test for each instruction
static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
intptr_t parent = -1;
intptr_t inst_position = 0;
const char *inst_name = NULL;
intptr_t input = 0;
int parent = -1;
int inst_position = 0;
const char* inst_name = NULL;
int input = 0;
fprintf(fp, " // Check instruction sub-tree\n");
pmatch->reset();
for( pmatch->next_instruction( parent, inst_position, inst_name, input );
@ -1101,14 +1101,14 @@ static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, Pe
print_block_index(fp, inst_position);
fprintf(fp, " > 0 ) {\n Node *n = block->_nodes.at(");
print_block_index(fp, inst_position);
fprintf(fp, ");\n inst%ld = (n->is_Mach()) ? ", inst_position);
fprintf(fp, ");\n inst%d = (n->is_Mach()) ? ", inst_position);
fprintf(fp, "n->as_Mach() : NULL;\n }\n");
}
// When not the root
// Test we have the correct instruction by comparing the rule.
if( parent != -1 ) {
fprintf(fp, " matches = matches && (inst%ld != NULL) && (inst%ld->rule() == %s_rule);\n",
fprintf(fp, " matches = matches && (inst%d != NULL) && (inst%d->rule() == %s_rule);\n",
inst_position, inst_position, inst_name);
}
} else {
@ -1121,10 +1121,10 @@ static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, Pe
// Build mapping for register indices, num_edges to input
static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMatch *pmatch ) {
intptr_t parent = -1;
intptr_t inst_position = 0;
const char *inst_name = NULL;
intptr_t input = 0;
int parent = -1;
int inst_position = 0;
const char* inst_name = NULL;
int input = 0;
fprintf(fp, " // Build map to register info\n");
pmatch->reset();
for( pmatch->next_instruction( parent, inst_position, inst_name, input );
@ -1136,9 +1136,9 @@ static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMa
InstructForm *inst = globals[inst_name]->is_instruction();
if( inst != NULL ) {
char inst_prefix[] = "instXXXX_";
sprintf(inst_prefix, "inst%ld_", inst_position);
sprintf(inst_prefix, "inst%d_", inst_position);
char receiver[] = "instXXXX->";
sprintf(receiver, "inst%ld->", inst_position);
sprintf(receiver, "inst%d->", inst_position);
inst->index_temps( fp, globals, inst_prefix, receiver );
}
}
@ -1168,7 +1168,7 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch
}
// LEFT
intptr_t left_index = pconstraint->_left_inst;
int left_index = pconstraint->_left_inst;
const char *left_op = pconstraint->_left_op;
// Access info on the instructions whose operands are compared
InstructForm *inst_left = globals[pmatch->instruction_name(left_index)]->is_instruction();
@ -1191,7 +1191,7 @@ static void check_peepconstraints(FILE *fp, FormDict &globals, PeepMatch *pmatch
// RIGHT
int right_op_index = -1;
intptr_t right_index = pconstraint->_right_inst;
int right_index = pconstraint->_right_inst;
const char *right_op = pconstraint->_right_op;
if( right_index != -1 ) { // Match operand
// Access info on the instructions whose operands are compared
@ -1351,7 +1351,7 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
assert( root_form != NULL, "Replacement instruction was not previously defined");
fprintf(fp, " %sNode *root = new (C) %sNode();\n", root_inst, root_inst);
intptr_t inst_num;
int inst_num;
const char *op_name;
int opnds_index = 0; // define result operand
// Then install the use-operands for the new sub-tree
@ -1362,7 +1362,6 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
InstructForm *inst_form;
inst_form = globals[pmatch->instruction_name(inst_num)]->is_instruction();
assert( inst_form, "Parser should guaranty this is an instruction");
int op_base = inst_form->oper_input_base(globals);
int inst_op_num = inst_form->operand_position(op_name, Component::USE);
if( inst_op_num == NameList::Not_in_list )
inst_op_num = inst_form->operand_position(op_name, Component::USE_DEF);
@ -1379,32 +1378,32 @@ static void generate_peepreplace( FILE *fp, FormDict &globals, PeepMatch *pmatch
// Add unmatched edges from root of match tree
int op_base = root_form->oper_input_base(globals);
for( int unmatched_edge = 1; unmatched_edge < op_base; ++unmatched_edge ) {
fprintf(fp, " root->add_req(inst%ld->in(%d)); // unmatched ideal edge\n",
fprintf(fp, " root->add_req(inst%d->in(%d)); // unmatched ideal edge\n",
inst_num, unmatched_edge);
}
// If new instruction captures bottom type
if( root_form->captures_bottom_type() ) {
// Get bottom type from instruction whose result we are replacing
fprintf(fp, " root->_bottom_type = inst%ld->bottom_type();\n", inst_num);
fprintf(fp, " root->_bottom_type = inst%d->bottom_type();\n", inst_num);
}
// Define result register and result operand
fprintf(fp, " ra_->add_reference(root, inst%ld);\n", inst_num);
fprintf(fp, " ra_->set_oop (root, ra_->is_oop(inst%ld));\n", inst_num);
fprintf(fp, " ra_->set_pair(root->_idx, ra_->get_reg_second(inst%ld), ra_->get_reg_first(inst%ld));\n", inst_num, inst_num);
fprintf(fp, " root->_opnds[0] = inst%ld->_opnds[0]->clone(C); // result\n", inst_num);
fprintf(fp, " ra_->add_reference(root, inst%d);\n", inst_num);
fprintf(fp, " ra_->set_oop (root, ra_->is_oop(inst%d));\n", inst_num);
fprintf(fp, " ra_->set_pair(root->_idx, ra_->get_reg_second(inst%d), ra_->get_reg_first(inst%d));\n", inst_num, inst_num);
fprintf(fp, " root->_opnds[0] = inst%d->_opnds[0]->clone(C); // result\n", inst_num);
fprintf(fp, " // ----- Done with initial setup -----\n");
} else {
if( (op_form == NULL) || (op_form->is_base_constant(globals) == Form::none) ) {
// Do not have ideal edges for constants after matching
fprintf(fp, " for( unsigned x%d = inst%ld_idx%d; x%d < inst%ld_idx%d; x%d++ )\n",
fprintf(fp, " for( unsigned x%d = inst%d_idx%d; x%d < inst%d_idx%d; x%d++ )\n",
inst_op_num, inst_num, inst_op_num,
inst_op_num, inst_num, inst_op_num+1, inst_op_num );
fprintf(fp, " root->add_req( inst%ld->in(x%d) );\n",
fprintf(fp, " root->add_req( inst%d->in(x%d) );\n",
inst_num, inst_op_num );
} else {
fprintf(fp, " // no ideal edge for constants after matching\n");
}
fprintf(fp, " root->_opnds[%d] = inst%ld->_opnds[%d]->clone(C);\n",
fprintf(fp, " root->_opnds[%d] = inst%d->_opnds[%d]->clone(C);\n",
opnds_index, inst_num, inst_op_num );
}
++opnds_index;
@ -1443,7 +1442,7 @@ void ArchDesc::definePeephole(FILE *fp, InstructForm *node) {
}
for( int i = 0; i <= max_position; ++i ) {
if( i == 0 ) {
fprintf(fp, " MachNode *inst0 = this;\n", i);
fprintf(fp, " MachNode *inst0 = this;\n");
} else {
fprintf(fp, " MachNode *inst%d = NULL;\n", i);
}
@ -1743,7 +1742,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
}
// delete the rest of edges
fprintf(fp," for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
fprintf(fp," del_req(i);\n", i);
fprintf(fp," del_req(i);\n");
fprintf(fp," }\n");
fprintf(fp," _num_opnds = %d;\n", new_num_opnds);
}
@ -1817,7 +1816,7 @@ void ArchDesc::defineExpand(FILE *fp, InstructForm *node) {
fprintf(fp,"\n");
if( node->expands() ) {
fprintf(fp," return result;\n",cnt-1);
fprintf(fp," return result;\n");
} else {
fprintf(fp," return this;\n");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-2009 Sun Microsystems, Inc. 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
@ -574,7 +574,7 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c
// Generate the user-defined portion of the format
if( inst._format ) {
// If there are replacement variables,
// Generate index values needed for determing the operand position
// Generate index values needed for determining the operand position
if( inst._format->_rep_vars.count() )
inst.index_temps(fp, globals);
@ -1832,7 +1832,7 @@ void ArchDesc::declareClasses(FILE *fp) {
break;
case Form::idealP:
case Form::idealN:
fprintf(fp," return opnd_array(1)->type();\n",result);
fprintf(fp," return opnd_array(1)->type();\n");
break;
case Form::idealD:
fprintf(fp," return TypeD::make(opnd_array(1)->constantD());\n");

View File

@ -31,7 +31,7 @@
// The AbstractAssembler is generating code into a CodeBuffer. To make code generation faster,
// the assembler keeps a copy of the code buffers boundaries & modifies them when
// emitting bytes rather than using the code buffers accessor functions all the time.
// The code buffer is updated via set_code_end(...) after emiting a whole instruction.
// The code buffer is updated via set_code_end(...) after emitting a whole instruction.
AbstractAssembler::AbstractAssembler(CodeBuffer* code) {
if (code == NULL) return;

View File

@ -22,7 +22,7 @@
*
*/
// This file contains platform-independant assembler declarations.
// This file contains platform-independent assembler declarations.
class CodeBuffer;
class MacroAssembler;

View File

@ -541,7 +541,7 @@ void ciTypeFlow::StateVector::do_aaload(ciBytecodeStream* str) {
// is report a value that will meet correctly with any downstream
// reference types on paths that will truly be executed. This null type
// meets with any reference type to yield that same reference type.
// (The compiler will generate an unconditonal exception here.)
// (The compiler will generate an unconditional exception here.)
push(null_type());
return;
}

View File

@ -156,7 +156,7 @@ symbolOop SymbolTable::basic_add(int index, u1 *name, int len,
symbolOop test = lookup(index, (char*)name, len, hashValue);
if (test != NULL) {
// A race occured and another thread introduced the symbol, this one
// A race occurred and another thread introduced the symbol, this one
// will be dropped and collected.
return test;
}
@ -193,7 +193,7 @@ bool SymbolTable::basic_add(constantPoolHandle cp, int names_count,
int index = hash_to_index(hashValues[i]);
symbolOop test = lookup(index, names[i], lengths[i], hashValues[i]);
if (test != NULL) {
// A race occured and another thread introduced the symbol, this one
// A race occurred and another thread introduced the symbol, this one
// will be dropped and collected. Use test instead.
cp->symbol_at_put(cp_indices[i], test);
} else {

View File

@ -380,7 +380,7 @@ address nmethod::handler_for_exception_and_pc(Handle exception, address pc) {
void nmethod::add_handler_for_exception_and_pc(Handle exception, address pc, address handler) {
// There are potential race conditions during exception cache updates, so we
// must own the ExceptionCache_lock before doing ANY modifications. Because
// we dont lock during reads, it is possible to have several threads attempt
// we don't lock during reads, it is possible to have several threads attempt
// to update the cache with the same data. We need to check for already inserted
// copies of the current data before adding it.

View File

@ -167,7 +167,7 @@ class nmethod : public CodeBlob {
nmFlags flags; // various flags to keep track of nmethod state
bool _markedForDeoptimization; // Used for stack deoptimization
enum { alive = 0,
not_entrant = 1, // uncommon trap has happend but activations may still exist
not_entrant = 1, // uncommon trap has happened but activations may still exist
zombie = 2,
unloaded = 3 };

View File

@ -393,7 +393,7 @@ class CMSAdaptiveSizePolicy : public AdaptiveSizePolicy {
// Restarts the concurrent phases timer.
void concurrent_phases_resume();
// Time begining and end of the marking phase for
// Time beginning and end of the marking phase for
// a synchronous MS collection. A MS collection
// that finishes in the foreground can have started
// in the background. These methods capture the

View File

@ -69,7 +69,7 @@ class CMSGCAdaptivePolicyCounters : public GCAdaptivePolicyCounters {
// end of the sweep of the tenured generation.
PerfVariable* _avg_cms_free_counter;
// Average of the free space in the tenured generation at the
// start of the sweep of the tenured genertion.
// start of the sweep of the tenured generation.
PerfVariable* _avg_cms_free_at_sweep_counter;
// Average of the free space in the tenured generation at the
// after any resizing of the tenured generation at the end

View File

@ -4178,7 +4178,7 @@ bool CMSCollector::do_marking_mt(bool asynch) {
// and is deferred for now; see CR# TBF. 07252005YSR. XXX
assert(!CMSAbortSemantics || tsk.aborted(), "Inconsistency");
// If _restart_addr is non-NULL, a marking stack overflow
// occured; we need to do a fresh marking iteration from the
// occurred; we need to do a fresh marking iteration from the
// indicated restart address.
if (_foregroundGCIsActive && asynch) {
// We may be running into repeated stack overflows, having
@ -4221,7 +4221,7 @@ bool CMSCollector::do_marking_st(bool asynch) {
// should be incremental with periodic yields.
_markBitMap.iterate(&markFromRootsClosure);
// If _restart_addr is non-NULL, a marking stack overflow
// occured; we need to do a fresh iteration from the
// occurred; we need to do a fresh iteration from the
// indicated restart address.
while (_restart_addr != NULL) {
if (_foregroundGCIsActive && asynch) {

View File

@ -2513,7 +2513,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(HeapRegion* popular_region) {
}
save_marks();
// We must do this before any possible evacuation that should propogate
// We must do this before any possible evacuation that should propagate
// marks, including evacuation of popular objects in a popular pause.
if (mark_in_progress()) {
double start_time_sec = os::elapsedTime();

View File

@ -78,7 +78,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
}
// Card marks are not precise. The current system can leave us with
// a mismash of precise marks and begining of object marks. This means
// a mismash of precise marks and beginning of object marks. This means
// we test for missing precise marks first. If any are found, we don't
// fail unless the object head is also unmarked.
virtual void do_object(oop obj) {
@ -258,7 +258,7 @@ void CardTableExtension::scavenge_contents_parallel(ObjectStartArray* start_arra
if (!start_array->object_starts_in_range(slice_start, slice_end)) {
continue;
}
// Update our begining addr
// Update our beginning addr
HeapWord* first_object = start_array->object_start(slice_start);
debug_only(oop* first_object_within_slice = (oop*) first_object;)
if (first_object < slice_start) {

View File

@ -127,7 +127,7 @@ class ObjectStartArray : public CHeapObj {
// Optimized for finding the first object that crosses into
// a given block. The blocks contain the offset of the last
// object in that block. Scroll backwards by one, and the first
// object hit should be at the begining of the block
// object hit should be at the beginning of the block
HeapWord* object_start(HeapWord* addr) const {
assert(_covered_region.contains(addr), "Must be in covered region");
jbyte* block = block_for_addr(addr);

View File

@ -26,7 +26,7 @@
// PrefetchQueue is a FIFO queue of variable length (currently 8).
//
// We need to examine the performance penalty of variable lengths.
// We may also want to split this into cpu dependant bits.
// We may also want to split this into cpu dependent bits.
//
const int PREFETCH_QUEUE_SIZE = 8;

View File

@ -74,7 +74,7 @@ void MutableNUMASpace::ensure_parsability() {
for (int i = 0; i < lgrp_spaces()->length(); i++) {
LGRPSpace *ls = lgrp_spaces()->at(i);
MutableSpace *s = ls->space();
if (s->top() < top()) { // For all spaces preceeding the one containing top()
if (s->top() < top()) { // For all spaces preceding the one containing top()
if (s->free_in_words() > 0) {
size_t area_touched_words = pointer_delta(s->end(), s->top());
CollectedHeap::fill_with_object(s->top(), area_touched_words);

View File

@ -474,6 +474,7 @@ cardTableModRefBS.cpp java.hpp
cardTableModRefBS.cpp mutexLocker.hpp
cardTableModRefBS.cpp sharedHeap.hpp
cardTableModRefBS.cpp space.hpp
cardTableModRefBS.cpp space.inline.hpp
cardTableModRefBS.cpp universe.hpp
cardTableModRefBS.cpp virtualspace.hpp

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the abstract interpreter and the abstract interpreter generator.
// Organization of the interpreter(s). There exists two different interpreters in hotpot

View File

@ -2642,7 +2642,7 @@ handle_return:
// two interpreted frames). We need to save the current arguments in C heap so that
// the deoptimized frame when it restarts can copy the arguments to its expression
// stack and re-execute the call. We also have to notify deoptimization that this
// has occured and to pick the preerved args copy them to the deoptimized frame's
// has occurred and to pick the preserved args copy them to the deoptimized frame's
// java expression stack. Yuck.
//
THREAD->popframe_preserve_args(in_ByteSize(METHOD->size_of_parameters() * wordSize),

View File

@ -22,7 +22,7 @@
*
*/
// This file holds platform-independant bodies of inline functions for the C++ based interpreter
// This file holds platform-independent bodies of inline functions for the C++ based interpreter
#ifdef CC_INTERP

View File

@ -24,7 +24,7 @@
#ifdef CC_INTERP
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the c++ interpreter
class CppInterpreter: public AbstractInterpreter {

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the template interpreter generator.
#ifdef CC_INTERP

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the interpreter and the interpreter generator.
//------------------------------------------------------------------------------------------------------------------------

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the interpreter generator.

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the template interpreter and the template interpreter generator.
#ifndef CC_INTERP

View File

@ -22,7 +22,7 @@
*
*/
// This file contains the platform-independant parts
// This file contains the platform-independent parts
// of the template interpreter generator.
#ifndef CC_INTERP

View File

@ -306,7 +306,7 @@ void Dict::print() {
// Convert string to hash key. This algorithm implements a universal hash
// function with the multipliers frozen (ok, so it's not universal). The
// multipliers (and allowable characters) are all odd, so the resultant sum
// is odd - guarenteed not divisible by any power of two, so the hash tables
// is odd - guaranteed not divisible by any power of two, so the hash tables
// can be any power of two with good results. Also, I choose multipliers
// that have only 2 bits set (the low is always set to be odd) so
// multiplication requires only shifts and adds. Characters are required to
@ -326,7 +326,7 @@ int hashstr(const void *t) {
}
//------------------------------hashptr--------------------------------------
// Slimey cheap hash function; no guarenteed performance. Better than the
// Slimey cheap hash function; no guaranteed performance. Better than the
// default for pointers, especially on MS-DOS machines.
int hashptr(const void *key) {
#ifdef __TURBOC__
@ -336,7 +336,7 @@ int hashptr(const void *key) {
#endif
}
// Slimey cheap hash function; no guarenteed performance.
// Slimey cheap hash function; no guaranteed performance.
int hashkey(const void *key) {
return (intptr_t)key;
}

View File

@ -86,10 +86,10 @@ class Dict : public ResourceObj { // Dictionary structure
// Hashing functions
int hashstr(const void *s); // Nice string hash
// Slimey cheap hash function; no guarenteed performance. Better than the
// Slimey cheap hash function; no guaranteed performance. Better than the
// default for pointers, especially on MS-DOS machines.
int hashptr(const void *key);
// Slimey cheap hash function; no guarenteed performance.
// Slimey cheap hash function; no guaranteed performance.
int hashkey(const void *key);
// Key comparators

View File

@ -35,14 +35,14 @@
extern address JVM_FunctionAtStart();
extern address JVM_FunctionAtEnd();
// Complain and stop. All error conditions occuring during the writing of
// Complain and stop. All error conditions occurring during the writing of
// an archive file should stop the process. Unrecoverable errors during
// the reading of the archive file should stop the process.
static void fail(const char *msg, va_list ap) {
// This occurs very early during initialization: tty is not initialized.
jio_fprintf(defaultStream::error_stream(),
"An error has occured while processing the"
"An error has occurred while processing the"
" shared archive file.\n");
jio_vfprintf(defaultStream::error_stream(), msg, ap);
jio_fprintf(defaultStream::error_stream(), "\n");

View File

@ -36,7 +36,7 @@ class PermGen : public CHeapObj {
friend class VMStructs;
protected:
size_t _capacity_expansion_limit; // maximum expansion allowed without a
// full gc occuring
// full gc occurring
HeapWord* mem_allocate_in_gen(size_t size, Generation* gen);

View File

@ -2003,7 +2003,7 @@ void GenerateOopMap::print_time() {
// ============ Main Entry Point ===========
//
GenerateOopMap::GenerateOopMap(methodHandle method) {
// We have to initialize all variables here, that can be queried direcly
// We have to initialize all variables here, that can be queried directly
_method = method;
_max_locals=0;
_init_vars = NULL;

View File

@ -292,7 +292,7 @@ class GenerateOopMap VALUE_OBJ_CLASS_SPEC {
int _max_stack; // Cached value of max. stack depth
int _max_monitors; // Cached value of max. monitor stack depth
int _has_exceptions; // True, if exceptions exist for method
bool _got_error; // True, if an error occured during interpretation.
bool _got_error; // True, if an error occurred during interpretation.
Handle _exception; // Exception if got_error is true.
bool _did_rewriting; // was bytecodes rewritten
bool _did_relocation; // was relocation neccessary
@ -422,7 +422,7 @@ class GenerateOopMap VALUE_OBJ_CLASS_SPEC {
void add_to_ref_init_set (int localNo);
// Conflicts rewrite logic
bool _conflict; // True, if a conflict occured during interpretation
bool _conflict; // True, if a conflict occurred during interpretation
int _nof_refval_conflicts; // No. of conflicts that require rewrites
int * _new_var_map;

View File

@ -1917,7 +1917,7 @@ methodOop instanceKlass::method_at_itable(klassOop holder, int index, TRAPS) {
/ itableOffsetEntry::size();
for (int cnt = 0 ; ; cnt ++, ioe ++) {
// If the interface isn't implemented by the reciever class,
// If the interface isn't implemented by the receiver class,
// the VM should throw IncompatibleClassChangeError.
if (cnt >= nof_interfaces) {
THROW_OOP_0(vmSymbols::java_lang_IncompatibleClassChangeError());

View File

@ -71,7 +71,7 @@ Klass *Klass::up_cast_abstract() {
return r; // Return the 1 concrete class
}
// Find LCA in class heirarchy
// Find LCA in class hierarchy
Klass *Klass::LCA( Klass *k2 ) {
Klass *k1 = this;
while( 1 ) {

View File

@ -471,7 +471,7 @@ class Klass : public Klass_vtbl {
}
bool search_secondary_supers(klassOop k) const;
// Find LCA in class heirarchy
// Find LCA in class hierarchy
Klass *LCA( Klass *k );
// Check whether reflection/jni/jvm code is allowed to instantiate this class;

View File

@ -296,7 +296,7 @@ class methodOopDesc : public oopDesc {
void set_compiled_invocation_count(int count) { _compiled_invocation_count = count; }
#endif // not PRODUCT
// Clear (non-shared space) pointers which could not be relevent
// Clear (non-shared space) pointers which could not be relevant
// if this (shared) method were mapped into another JVM.
void remove_unshareable_info();

View File

@ -181,7 +181,7 @@ int Block::is_Empty() const {
}
//------------------------------has_uncommon_code------------------------------
// Return true if the block's code implies that it is not likely to be
// Return true if the block's code implies that it is likely to be
// executed infrequently. Check to see if the block ends in a Halt or
// a low probability call.
bool Block::has_uncommon_code() const {
@ -909,6 +909,10 @@ void PhaseCFG::verify( ) const {
!(n->jvms() != NULL && n->jvms()->is_monitor_use(k)) ) {
assert( b->find_node(def) < j, "uses must follow definitions" );
}
if( def->is_SafePointScalarObject() ) {
assert(_bbs[def->_idx] == b, "SafePointScalarObject Node should be at the same block as its SafePoint node");
assert(_bbs[def->_idx] == _bbs[def->in(0)->_idx], "SafePointScalarObject Node should be at the same block as its control edge");
}
}
}
}
@ -1307,7 +1311,7 @@ void PhaseBlockLayout::merge_traces(bool fall_thru_only)
}
} else if (e->state() == CFGEdge::open) {
// Append traces, even without a fall-thru connection.
// But leave root entry at the begining of the block list.
// But leave root entry at the beginning of the block list.
if (targ_trace != trace(_cfg._broot)) {
e->set_state(CFGEdge::connected);
src_trace->append(targ_trace);
@ -1430,7 +1434,7 @@ bool Trace::backedge(CFGEdge *e) {
}
// Backbranch to the top of a trace
// Scroll foward through the trace from the targ_block. If we find
// Scroll forward through the trace from the targ_block. If we find
// a loop head before another loop top, use the the loop head alignment.
for (Block *b = targ_block; b != NULL; b = next(b)) {
if (b->has_loop_alignment()) {

View File

@ -347,6 +347,8 @@ class PhaseCFG : public Phase {
// Helper function to insert a node into a block
void schedule_node_into_block( Node *n, Block *b );
void replace_block_proj_ctrl( Node *n );
// Set the basic block for pinned Nodes
void schedule_pinned_nodes( VectorSet &visited );
@ -607,7 +609,7 @@ class Trace : public ResourceObj {
Block * next(Block *b) const { return _next_list[b->_pre_order]; }
void set_next(Block *b, Block *n) const { _next_list[b->_pre_order] = n; }
// Return the block that preceeds "b" in the trace.
// Return the block that precedes "b" in the trace.
Block * prev(Block *b) const { return _prev_list[b->_pre_order]; }
void set_prev(Block *b, Block *p) const { _prev_list[b->_pre_order] = p; }

View File

@ -55,7 +55,7 @@
// breadth-first approach but it was worse (showed O(n^2) in the
// pick-next-block code).
//
// The relevent data is kept in a struct of arrays (it could just as well be
// The relevant data is kept in a struct of arrays (it could just as well be
// an array of structs, but the struct-of-arrays is generally a little more
// efficient). The arrays are indexed by register number (including
// stack-slots as registers) and so is bounded by 200 to 300 elements in

View File

@ -975,6 +975,7 @@ SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp,
}
bool SafePointScalarObjectNode::pinned() const { return true; }
bool SafePointScalarObjectNode::depends_only_on_test() const { return false; }
uint SafePointScalarObjectNode::ideal_reg() const {
return 0; // No matching to machine instruction

View File

@ -437,6 +437,10 @@ public:
// of the SafePoint node for which it was generated.
virtual bool pinned() const; // { return true; }
// SafePointScalarObject depends on the SafePoint node
// for which it was generated.
virtual bool depends_only_on_test() const; // { return false; }
virtual uint size_of() const { return sizeof(*this); }
// Assumes that "this" is an argument to a safepoint node "s", and that

View File

@ -1350,7 +1350,7 @@ static void split_once(PhaseIterGVN *igvn, Node *phi, Node *val, Node *n, Node *
}
// Register the new node but do not transform it. Cannot transform until the
// entire Region/Phi conglerate has been hacked as a single huge transform.
// entire Region/Phi conglomerate has been hacked as a single huge transform.
igvn->register_new_node_with_optimizer( newn );
// Now I can point to the new node.
n->add_req(newn);
@ -1381,7 +1381,7 @@ static Node* split_flow_path(PhaseGVN *phase, PhiNode *phi) {
Node *val = phi->in(i); // Constant to split for
uint hit = 0; // Number of times it occurs
for( ; i < phi->req(); i++ ){ // Count occurances of constant
for( ; i < phi->req(); i++ ){ // Count occurrences of constant
Node *n = phi->in(i);
if( !n ) return NULL;
if( phase->type(n) == Type::TOP ) return NULL;
@ -1423,7 +1423,7 @@ static Node* split_flow_path(PhaseGVN *phase, PhiNode *phi) {
//=============================================================================
//------------------------------simple_data_loop_check-------------------------
// Try to determing if the phi node in a simple safe/unsafe data loop.
// Try to determining if the phi node in a simple safe/unsafe data loop.
// Returns:
// enum LoopSafety { Safe = 0, Unsafe, UnsafeLoop };
// Safe - safe case when the phi and it's inputs reference only safe data
@ -1687,7 +1687,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
progress = phase->C->top();
break;
}
// If tranformed to a MergeMem, get the desired slice
// If transformed to a MergeMem, get the desired slice
// Otherwise the returned node represents memory for every slice
Node *new_mem = (m->is_MergeMem()) ?
m->as_MergeMem()->memory_at(alias_idx) : m;
@ -1962,7 +1962,7 @@ const Type *CatchNode::Value( PhaseTransform *phase ) const {
f[CatchProjNode::fall_through_index] = Type::TOP;
} else if( call->req() > TypeFunc::Parms ) {
const Type *arg0 = phase->type( call->in(TypeFunc::Parms) );
// Check for null reciever to virtual or interface calls
// Check for null receiver to virtual or interface calls
if( call->is_CallDynamicJava() &&
arg0->higher_equal(TypePtr::NULL_PTR) ) {
f[CatchProjNode::fall_through_index] = Type::TOP;
@ -1995,7 +1995,7 @@ Node *CatchProjNode::Identity( PhaseTransform *phase ) {
// also remove any exception table entry. Thus we must know the call
// feeding the Catch will not really throw an exception. This is ok for
// the main fall-thru control (happens when we know a call can never throw
// an exception) or for "rethrow", because a further optimnization will
// an exception) or for "rethrow", because a further optimization will
// yank the rethrow (happens when we inline a function that can throw an
// exception and the caller has no handler). Not legal, e.g., for passing
// a NULL receiver to a v-call, or passing bad types to a slow-check-cast.

View File

@ -1246,7 +1246,7 @@ uint PhaseChaitin::Select( ) {
// If the live range is not bound, then we actually had some choices
// to make. In this case, the mask has more bits in it than the colors
// choosen. Restrict the mask to just what was picked.
// chosen. Restrict the mask to just what was picked.
if( lrg->num_regs() == 1 ) { // Size 1 live range
lrg->Clear(); // Clear the mask
lrg->Insert(reg); // Set regmask to match selected reg

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