8041415: remove port.{cpp,hpp} files

Hotspot should use standard headers and types

Reviewed-by: coleenp, kvn
This commit is contained in:
Zhengyu Gu 2014-05-07 06:03:31 -07:00
parent eddb53ffb9
commit adcde492fa
34 changed files with 120 additions and 497 deletions

View file

@ -30,12 +30,13 @@
//
// standard library constants
#include "stdio.h"
#include "stdlib.h"
#include <iostream>
#include "string.h"
#include "ctype.h"
#include "stdarg.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <sys/types.h>
/* Make sure that we have the intptr_t and uintptr_t definitions */

View file

@ -64,8 +64,6 @@ class PeepMatch;
class PeepConstraint;
class PeepReplace;
// class ostream; // ostream is a typedef in some systems
extern char *toUpper(const char *str);
//---------------------------ADLParser-----------------------------------------

View file

@ -25,8 +25,6 @@
// 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) {

View file

@ -26,9 +26,6 @@
#define SHARE_VM_ADLC_FILEBUFF_HPP
// FILEBUFF.HPP - Definitions for parser file buffering routines
#include <iostream>
using namespace std;
// STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES

View file

@ -211,7 +211,7 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper)
const char *type = oper->ideal_type(globals);
if (!strcmp(type, "ConI")) {
if (i > 0) fprintf(fp,", ");
fprintf(fp," int32 _c%d;\n", i);
fprintf(fp," int32_t _c%d;\n", i);
}
else if (!strcmp(type, "ConP")) {
if (i > 0) fprintf(fp,", ");
@ -307,7 +307,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
assert(num_consts == 1, "Bad component list detected.\n");
switch( constant_type ) {
case Form::idealI : {
fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i);
fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32_t c%d", i);
break;
}
case Form::idealN : { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
@ -326,7 +326,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
while((comp = lst.iter()) != NULL) {
if (!strcmp(comp->base_type(globals), "ConI")) {
if (i > 0) fprintf(fp,", ");
fprintf(fp,"int32 c%d", i);
fprintf(fp,"int32_t c%d", i);
i++;
}
else if (!strcmp(comp->base_type(globals), "ConP")) {

View file

@ -119,7 +119,7 @@ void AbstractAssembler::bind(Label& L) {
L.patch_instructions((MacroAssembler*)this);
}
void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
if (UseStackBanging) {
// Each code entry causes one stack bang n pages down the stack where n
// is configurable by StackShadowPages. The setting depends on the maximum
@ -134,7 +134,7 @@ void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes)
// is greater than a page.
const int page_size = os::vm_page_size();
int bang_end = StackShadowPages*page_size;
int bang_end = StackShadowPages * page_size;
// This is how far the previous frame's stack banging extended.
const int bang_end_safe = bang_end;

View file

@ -24,29 +24,17 @@
#include "precompiled.hpp"
#include "libadt/dict.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.hpp"
// Dictionaries - An Abstract Data Type
// %%%%% includes not needed with AVM framework - Ungar
// #include "port.hpp"
//IMPLEMENTATION
// #include "dict.hpp"
#include <assert.h>
// The iostream is not needed and it gets confused for gcc by the
// define of bool.
//
// #include <iostream.h>
//------------------------------data-----------------------------------------
// String hash tables
#define MAXID 20
static byte initflag = 0; // True after 1st initialization
static uint8_t initflag = 0; // True after 1st initialization
static const char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
static short xsum[MAXID];
@ -281,7 +269,7 @@ void *Dict::operator [](const void *key) const {
// CmpDict compares two dictionaries; they must have the same keys (their
// keys must match using CmpKey) and they must have the same values (pointer
// comparison). If so 1 is returned, if not 0 is returned.
int32 Dict::operator ==(const Dict &d2) const {
int32_t Dict::operator ==(const Dict &d2) const {
if( _cnt != d2._cnt ) return 0;
if( _hash != d2._hash ) return 0;
if( _cmp != d2._cmp ) return 0;
@ -318,7 +306,7 @@ void Dict::print() {
// C text shows excellent spreading of values for any size hash table.
int hashstr(const void *t) {
register char c, k = 0;
register int32 sum = 0;
register int32_t sum = 0;
register const char *s = (const char *)t;
while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1
@ -332,11 +320,7 @@ int hashstr(const void *t) {
// 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__
return ((intptr_t)key >> 16);
#else // __TURBOC__
return ((intptr_t)key >> 2);
#endif
}
// Slimey cheap hash function; no guaranteed performance.
@ -345,12 +329,12 @@ int hashkey(const void *key) {
}
//------------------------------Key Comparator Functions---------------------
int32 cmpstr(const void *k1, const void *k2) {
int32_t cmpstr(const void *k1, const void *k2) {
return strcmp((const char *)k1,(const char *)k2);
}
// Cheap key comparator.
int32 cmpkey(const void *key1, const void *key2) {
int32_t cmpkey(const void *key1, const void *key2) {
if (key1 == key2) return 0;
intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
if (delta > 0) return 1;

View file

@ -25,11 +25,12 @@
#ifndef SHARE_VM_LIBADT_DICT_HPP
#define SHARE_VM_LIBADT_DICT_HPP
#include "libadt/port.hpp"
// Dictionaries - An Abstract Data Type
//INTERFACE
class ostream;
#include "memory/allocation.inline.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/thread.hpp"
class Dict;
// These dictionaries define a key-value mapping. They can be inserted to,
@ -38,7 +39,7 @@ class Dict;
// key comparison routine determines if two keys are equal or not. A hash
// function can be provided; if it's not provided the key itself is used
// instead. A nice string hash function is included.
typedef int32 (*CmpKey)(const void *key1, const void *key2);
typedef int32_t (*CmpKey)(const void *key1, const void *key2);
typedef int (*Hash)(const void *key);
typedef void (*FuncDict)(const void *key, const void *val, Dict *d);
@ -47,7 +48,7 @@ class Dict : public ResourceObj { // Dictionary structure
class Arena *_arena; // Where to draw storage from
class bucket *_bin; // Hash table is array of buckets
uint _size; // Size (# of slots) in hash table
uint32 _cnt; // Number of key-value pairs in hash table
uint32_t _cnt; // Number of key-value pairs in hash table
const Hash _hash; // Hashing function
const CmpKey _cmp; // Key comparison function
void doubhash( void ); // Double hash table size
@ -67,7 +68,7 @@ class Dict : public ResourceObj { // Dictionary structure
void Clear();
// Return # of key-value pairs in dict
uint32 Size(void) const { return _cnt; }
uint32_t Size(void) const { return _cnt; }
// Insert inserts the given key-value pair into the dictionary. The prior
// value of the key is returned; NULL if the key was not previously defined.
@ -81,7 +82,7 @@ class Dict : public ResourceObj { // Dictionary structure
// == compares two dictionaries; they must have the same keys (their keys
// must match using CmpKey) and they must have the same values (pointer
// comparison). If so 1 is returned, if not 0 is returned.
int32 operator ==(const Dict &d) const; // Compare dictionaries for equal
int32_t operator ==(const Dict &d) const; // Compare dictionaries for equal
// Print out the dictionary contents as key-value pairs
void print();
@ -96,9 +97,9 @@ int hashptr(const void *key);
int hashkey(const void *key);
// Key comparators
int32 cmpstr(const void *k1, const void *k2);
int32_t cmpstr(const void *k1, const void *k2);
// Slimey cheap key comparator.
int32 cmpkey(const void *key1, const void *key2);
int32_t cmpkey(const void *key1, const void *key2);
//------------------------------Iteration--------------------------------------
// The class of dictionary iterators. Fails in the presences of modifications

View file

@ -1,123 +0,0 @@
/*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "libadt/port.hpp"
// Code for portable compiling
#ifdef __GNUC__
#pragma implementation
#endif
// %%%%% includes not needed with AVM framework - Ungar
// #include "port.hpp"
// This is only used if turboc is used and it causes problems with
// gcc.
#ifdef __TURBOC__
#include <iostream.h>
#endif
#include <stdio.h>
//------------------------------gcd--------------------------------------------
// Greatest common divisor
uint32 gcd( register uint32 x, register uint32 y )
{
register uint32 tmp;
while( x ) { // While not zero
tmp = x; // Hold onto smaller x value
x = y % x; // Compute modulus; since y>=x, 0 <= mod < x
y = tmp; // y = old x
}
return y;
}
//-----------------------------------------------------------------------------
// Find first 1, or return 32 if empty
int ff1( uint32 mask )
{
unsigned i, n = 0;
for( i=1, n=0; i; i<<=1, n++)
if( mask&i ) return n;
return 32;
}
//-----------------------------------------------------------------------------
// Find highest 1, or return 32 if empty
int fh1( uint32 mask )
{
unsigned i, n = 0;
for( i=((uint32)1<<31), n=31; i; i>>=1, n--)
if( mask&i ) return n;
return 32;
}
//------------------------------rotate32---------------------------------------
// Rotate 32bits. Postive rotates left (bits move toward high-order bit),
// negative rotates right.
uint32 rotate32( register uint32 x, register int32 cnt )
{
if( cnt >= 0 ) { // Positive rotates left
cnt &= 31; // Mask off extra shift bits
} else { // Negative rotates right
cnt = (-cnt)&31; // Flip sign; mask extra shift bits
cnt = 32-cnt; // Rotate right by big left rotation
}
return (x << cnt) | (x >> (32-cnt));
}
/* Disabled - we have another log2 in the system.
This function doesn't work if used as substitute
for the existing log2. Keep around until we have
verified all uses of log2 do the correct thing!
//------------------------------log2-------------------------------------------
// Log base 2. Might also be called 'count leading zeros'. Log2(x) returns
// an l such that (1L<<l) <= x < (2L<<l). log2(x) returns 32.
uint log2( uint32 x )
{
register uint l = 32; // Log bits
register int32 sx = x; // Treat as signed number
while( sx >= 0 ) // While high bit is clear
sx <<= 1, l--; // Shift bits left, count down log2
return l;
}
*/
//------------------------------print------------------------------------------
// Print a pointer without modifying the contents
#ifdef __TURBOC__
ostream &ostream::operator << (const void *ptr)
{
return (*this) << "0x" << hex << (uint)ptr << dec;
}
#else
/*ostream &operator << (ostream &os, const void *ptr)
{
return os << "0x" << hex << (uint)ptr << dec;
}*/
#endif

View file

@ -1,208 +0,0 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_LIBADT_PORT_HPP
#define SHARE_VM_LIBADT_PORT_HPP
#include "utilities/top.hpp"
// Typedefs for portable compiling
#if defined(__GNUC__)
#define INTERFACE #pragma interface
#define IMPLEMENTATION #pragma implementation
//INTERFACE
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
// Access to the C++ class virtual function pointer
// Put the class in the macro
typedef void *VPTR;
// G++ puts it at the end of the base class
#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));}
#elif defined(__TURBOC__)
#include <mem.h>
#include <string.h>
extern "C" int stricmp(const char *, const char *);
inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); }
inline void bzero(void *p, int l) { memset(p,0,l); }
inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); }
inline int min( int a, int b) { return a < b ? a : b; }
inline int max( int a, int b) { return a > b ? a : b; }
//strcasecmp moved to globalDefinitions_visCPP.hpp
//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
inline long abs( long x ) { return x < 0 ? -x : x; }
// Access to the C++ class virtual function pointer
// Put the class in the macro
typedef void near *VPTR;
// BorlandC puts it up front
#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)this;}
#elif defined(__hpux)
#define INTERFACE
#define IMPLEMENTATION
#define signed
#include <strings.h>
#include <stdlib.h>
inline long min( long a, long b) { return a < b ? a : b; }
inline long max( long a, long b) { return a > b ? a : b; }
inline int min( int a, int b) { return a < b ? a : b; }
inline int max( int a, int b) { return a > b ? a : b; }
inline long abs( long x ) { return x < 0 ? -x : x; }
#elif defined(__MOTO__)
// Motorola's mcc
#define INTERFACE
#define IMPLEMENTATION
#include <stdlib.h>
#include <memory.h>
inline int min( int a, int b) { return a < b ? a : b; }
inline int max( int a, int b) { return a > b ? a : b; }
#elif defined(_AIX)
// IBM's xlC compiler
#define INTERFACE
#define IMPLEMENTATION
#include <stdlib.h>
#include <memory.h>
#elif defined(_MSC_VER)
// Microsoft Visual C++
//#define INTERFACE
#define IMPLEMENTATION
#include <stdlib.h>
#undef small
//strcasecmp moved to globalDefinitions_visCPP.hpp
//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
#elif defined(SPARC_WORKS)
#define INTERFACE
#define IMPLEMENTATION
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#elif defined(SOLARIS)
#define INTERFACE
#define IMPLEMENTATION
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#elif defined(__TANDEM)
// This case is for the Tandem Business Unit of Compaq Computer Corporation.
// The Tandem case must precede the AT&T case,
// because the Tandem c89 compiler also defines __cplusplus.
#include "port_tandem.hpp"
#elif defined(__cplusplus)
// AT&Ts cfront
#define INTERFACE
#define IMPLEMENTATION
#include <unistd.h>
#define signed
// #include <bstring.h>
inline int min( int a, int b) { return a < b ? a : b; }
inline int max( int a, int b) { return a > b ? a : b; }
#else // All other machines
#define signed
extern "C" void bcopy(void *b1, void *b2, int len);
inline int min( int a, int b) { return a < b ? a : b; }
inline int max( int a, int b) { return a > b ? a : b; }
#endif
//-----------------------------------------------------------------------------
// Safer memory allocations
#ifdef SAFE_MEMORY
#define malloc(size) safe_malloc(__FILE__,__LINE__,size)
#define free(ptr) safe_free(__FILE__,__LINE__,ptr)
#define realloc(ptr,size) safe_realloc(__FILE__,__LINE__,ptr,size)
#define calloc(nitems,size) safe_calloc(__FILE__,__LINE__,nitems,size)
#define strdup(ptr) safe_strdup(__FILE__,__LINE__,ptr)
extern void *safe_malloc (const char *file, unsigned line, unsigned size);
extern void safe_free (const char *file, unsigned line, void *ptr);
extern void *safe_calloc (const char *file, unsigned line, unsigned nitems, unsigned size);
extern void *safe_realloc(const char *file, unsigned line, void *ptr, unsigned size);
extern char *safe_strdup (const char *file, unsigned line, const char *src);
inline void *operator new( size_t size ) throw() { return malloc(size); }
inline void operator delete( void *ptr ) { free(ptr); }
#endif
//-----------------------------------------------------------------------------
// And now, the bit-size-specified integer sizes
typedef signed char int8;
typedef unsigned char uint8;
typedef unsigned char byte;
// All uses of *int16 changed to 32-bit to speed up compiler on Intel
//typedef signed short int16; // Exactly 16bits signed
//typedef unsigned short uint16; // Exactly 16bits unsigned
//const unsigned int min_uint16 = 0x0000; // smallest uint16
//const unsigned int max_uint16 = 0xFFFF; // largest uint16
typedef unsigned int uint; // When you need a fast >=16bit unsigned value
/*typedef int int; */ // When you need a fast >=16bit value
const unsigned int max_uint = (uint)-1;
typedef int32_t int32; // Exactly 32bits signed
typedef uint32_t uint32; // Exactly 32bits unsigned
// Bit-sized floating point and long thingies
#ifndef __TANDEM
// Do not define these for Tandem, because they conflict with typedefs in softieee.h.
typedef float float32; // 32-bit float
typedef double float64; // 64-bit float
#endif // __TANDEM
typedef jlong int64; // Java long for my 64-bit type
typedef julong uint64; // Java long for my 64-bit type
//-----------------------------------------------------------------------------
// Nice constants
uint32 gcd( uint32 x, uint32 y );
int ff1( uint32 mask );
int fh1( uint32 mask );
uint32 rotate32( uint32 x, int32 cnt );
//-----------------------------------------------------------------------------
extern uint32 heap_totalmem; // Current total memory allocation
extern uint32 heap_highwater; // Highwater mark to date for memory usage
#endif // SHARE_VM_LIBADT_PORT_HPP

View file

@ -28,20 +28,11 @@
// Sets - An Abstract Data Type
// %%%%% includes not needed with AVM framework - Ungar
// #include "port.hpp"
//IMPLEMENTATION
// #include "set.hpp"
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
// Not needed and it causes terouble for gcc.
//
// #include <iostream.h>
//-------------------------Virtual Functions-----------------------------------
// These functions MUST be implemented by the inheriting class.
class SparseSet;

View file

@ -25,13 +25,10 @@
#ifndef SHARE_VM_LIBADT_SET_HPP
#define SHARE_VM_LIBADT_SET_HPP
#include "libadt/port.hpp"
#include "memory/allocation.hpp"
// Sets - An Abstract Data Type
//INTERFACE
class SparseSet;
class VectorSet;
class ListSet;

View file

@ -28,15 +28,10 @@
// Vector Sets - An Abstract Data Type
// %%%%% includes not needed with AVM framework - Ungar
// #include "port.hpp"
//IMPLEMENTATION
// #include "vectset.hpp"
// BitsInByte is a lookup table which tells the number of bits that
// are in the looked-up number. It is very useful in VectorSet_Size.
uint8 bitsInByte[256] = {
uint8_t bitsInByte[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
@ -59,7 +54,7 @@ uint8 bitsInByte[256] = {
// Create a new, empty Set.
VectorSet::VectorSet(Arena *arena) : Set(arena) {
size = 2; // Small initial size
data = (uint32 *)_set_arena->Amalloc(size*sizeof(uint32));
data = (uint32_t *)_set_arena->Amalloc(size*sizeof(uint32_t));
data[0] = 0; // No elements
data[1] = 0;
}
@ -85,8 +80,8 @@ Set &VectorSet::operator = (const Set &set)
void VectorSet::slamin(const VectorSet& s)
{
size = s.size; // Use new size
data = (uint32*)s._set_arena->Amalloc(size*sizeof(uint32)); // Make array of required size
memcpy( data, s.data, size*sizeof(uint32) ); // Fill the array
data = (uint32_t*)s._set_arena->Amalloc(size*sizeof(uint32_t)); // Make array of required size
memcpy( data, s.data, size*sizeof(uint32_t) ); // Fill the array
}
//------------------------------grow-------------------------------------------
@ -96,8 +91,8 @@ void VectorSet::grow( uint newsize )
newsize = (newsize+31) >> 5; // Convert to longwords
uint x = size;
while( x < newsize ) x <<= 1;
data = (uint32 *)_set_arena->Arealloc(data, size*sizeof(uint32), x*sizeof(uint32));
memset((char *)(data + size), 0, (x - size)*sizeof(uint32));
data = (uint32_t *)_set_arena->Arealloc(data, size*sizeof(uint32_t), x*sizeof(uint32_t));
memset((char *)(data + size), 0, (x - size)*sizeof(uint32_t));
size = x;
}
@ -106,7 +101,7 @@ void VectorSet::grow( uint newsize )
Set &VectorSet::operator <<= (uint elem)
{
register uint word = elem >> 5; // Get the longword offset
register uint32 mask = 1L << (elem & 31); // Get bit mask
register uint32_t mask = 1L << (elem & 31); // Get bit mask
if( word >= size ) // Need to grow set?
grow(elem+1); // Then grow it
@ -121,7 +116,7 @@ Set &VectorSet::operator >>= (uint elem)
register uint word = elem >> 5; // Get the longword offset
if( word >= size ) // Beyond the last?
return *this; // Then it's clear & return clear
register uint32 mask = 1L << (elem & 31); // Get bit mask
register uint32_t mask = 1L << (elem & 31); // Get bit mask
data[word] &= ~mask; // Clear bit
return *this;
}
@ -132,8 +127,8 @@ VectorSet &VectorSet::operator &= (const VectorSet &s)
{
// NOTE: The intersection is never any larger than the smallest set.
if( s.size < size ) size = s.size; // Get smaller size
register uint32 *u1 = data; // Pointer to the destination data
register uint32 *u2 = s.data; // Pointer to the source data
register uint32_t *u1 = data; // Pointer to the destination data
register uint32_t *u2 = s.data; // Pointer to the source data
for( uint i=0; i<size; i++) // For data in set
*u1++ &= *u2++; // Copy and AND longwords
return *this; // Return set
@ -152,14 +147,14 @@ VectorSet &VectorSet::operator |= (const VectorSet &s)
{
// This many words must be unioned
register uint cnt = ((size<s.size)?size:s.size);
register uint32 *u1 = data; // Pointer to the destination data
register uint32 *u2 = s.data; // Pointer to the source data
register uint32_t *u1 = data; // Pointer to the destination data
register uint32_t *u2 = s.data; // Pointer to the source data
for( uint i=0; i<cnt; i++) // Copy and OR the two sets
*u1++ |= *u2++;
if( size < s.size ) { // Is set 2 larger than set 1?
// Extend result by larger set
grow(s.size*sizeof(uint32)*8);
memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32));
grow(s.size*sizeof(uint32_t)*8);
memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32_t));
}
return *this; // Return result set
}
@ -177,8 +172,8 @@ VectorSet &VectorSet::operator -= (const VectorSet &s)
{
// This many words must be unioned
register uint cnt = ((size<s.size)?size:s.size);
register uint32 *u1 = data; // Pointer to the destination data
register uint32 *u2 = s.data; // Pointer to the source data
register uint32_t *u1 = data; // Pointer to the destination data
register uint32_t *u2 = s.data; // Pointer to the source data
for( uint i=0; i<cnt; i++ ) // For data in set
*u1++ &= ~(*u2++); // A <-- A & ~B with longwords
return *this; // Return new set
@ -199,17 +194,17 @@ Set &VectorSet::operator -= (const Set &set)
// 1X -- B is a subset of A
int VectorSet::compare (const VectorSet &s) const
{
register uint32 *u1 = data; // Pointer to the destination data
register uint32 *u2 = s.data; // Pointer to the source data
register uint32 AnotB = 0, BnotA = 0;
register uint32_t *u1 = data; // Pointer to the destination data
register uint32_t *u2 = s.data; // Pointer to the source data
register uint32_t AnotB = 0, BnotA = 0;
// This many words must be unioned
register uint cnt = ((size<s.size)?size:s.size);
// Get bits for both sets
uint i; // Exit value of loop
for( i=0; i<cnt; i++ ) { // For data in BOTH sets
register uint32 A = *u1++; // Data from one guy
register uint32 B = *u2++; // Data from other guy
register uint32_t A = *u1++; // Data from one guy
register uint32_t B = *u2++; // Data from other guy
AnotB |= (A & ~B); // Compute bits in A not B
BnotA |= (B & ~A); // Compute bits in B not A
}
@ -250,8 +245,8 @@ int VectorSet::disjoint(const Set &set) const
// NOTE: The intersection is never any larger than the smallest set.
register uint small_size = ((size<s.size)?size:s.size);
register uint32 *u1 = data; // Pointer to the destination data
register uint32 *u2 = s.data; // Pointer to the source data
register uint32_t *u1 = data; // Pointer to the destination data
register uint32_t *u2 = s.data; // Pointer to the source data
for( uint i=0; i<small_size; i++) // For data in set
if( *u1++ & *u2++ ) // If any elements in common
return 0; // Then not disjoint
@ -293,7 +288,7 @@ int VectorSet::operator[](uint elem) const
register uint word = elem >> 5; // Get the longword offset
if( word >= size ) // Beyond the last?
return 0; // Then it's clear
register uint32 mask = 1L << (elem & 31); // Get bit mask
register uint32_t mask = 1L << (elem & 31); // Get bit mask
return ((data[word] & mask))!=0; // Return the sense of the bit
}
@ -305,7 +300,7 @@ uint VectorSet::getelem(void) const
for( i=0; i<size; i++ )
if( data[i] )
break;
uint32 word = data[i];
uint32_t word = data[i];
int j; // Exit value of loop
for( j= -1; word; j++, word>>=1 );
return (i<<5)+j;
@ -316,11 +311,11 @@ uint VectorSet::getelem(void) const
void VectorSet::Clear(void)
{
if( size > 100 ) { // Reclaim storage only if huge
FREE_RESOURCE_ARRAY(uint32,data,size);
FREE_RESOURCE_ARRAY(uint32_t,data,size);
size = 2; // Small initial size
data = NEW_RESOURCE_ARRAY(uint32,size);
data = NEW_RESOURCE_ARRAY(uint32_t,size);
}
memset( data, 0, size*sizeof(uint32) );
memset( data, 0, size*sizeof(uint32_t) );
}
//------------------------------Size-------------------------------------------
@ -328,8 +323,8 @@ void VectorSet::Clear(void)
uint VectorSet::Size(void) const
{
uint sum = 0; // Cumulative size so far.
uint8 *currByte = (uint8*)data;
for( uint32 i = 0; i < (size<<2); i++) // While have bytes to process
uint8_t* currByte = (uint8_t*) data;
for( uint32_t i = 0; i < (size<<2); i++) // While have bytes to process
sum += bitsInByte[*currByte++]; // Add bits in current byte to size.
return sum;
}
@ -343,7 +338,7 @@ void VectorSet::Sort(void)
//------------------------------hash-------------------------------------------
int VectorSet::hash() const
{
uint32 _xor = 0;
uint32_t _xor = 0;
uint lim = ((size<4)?size:4);
for( uint i = 0; i < lim; i++ )
_xor ^= data[i];

View file

@ -47,7 +47,7 @@ class VectorSet : public Set {
friend class VectorSetI; // Friendly iterator class
protected:
uint size; // Size of data IN LONGWORDS (32bits)
uint32 *data; // The data, bit packed
uint32_t* data; // The data, bit packed
void slamin( const VectorSet& s ); // Initialize one set with another
int compare(const VectorSet &s) const; // Compare set contents
@ -99,7 +99,7 @@ public:
void Sort(void); // Sort before iterating
int hash() const; // Hash function
void Reset(void) { // Reset a set
memset( data, 0, size*sizeof(uint32) );
memset( data, 0, size*sizeof(uint32_t) );
}
/* Removed for MCC BUG
@ -108,7 +108,7 @@ public:
// Expose internals for speed-critical fast iterators
uint word_size() const { return size; }
uint32 *EXPOSE() const { return data; }
uint32_t* EXPOSE() const { return data; }
// Fast inlined "test and set". Replaces the idiom:
// if( visited[idx] ) return;
@ -120,8 +120,8 @@ public:
uint word = elem >> 5; // Get the longword offset
if( word >= size ) // Beyond the last?
return test_set_grow(elem); // Then grow; set; return 0;
uint32 mask = 1L << (elem & 31); // Get bit mask
uint32 datum = data[word] & mask;// Get bit
uint32_t mask = 1L << (elem & 31); // Get bit mask
uint32_t datum = data[word] & mask;// Get bit
data[word] |= mask; // Set bit
return datum; // Return bit
}
@ -134,7 +134,7 @@ public:
int test( uint elem ) const {
uint word = elem >> 5; // Get the longword offset
if( word >= size ) return 0; // Beyond the last?
uint32 mask = 1L << (elem & 31); // Get bit mask
uint32_t mask = 1L << (elem & 31); // Get bit mask
return data[word] & mask; // Get bit
}
@ -144,7 +144,7 @@ public:
if( word >= size ) { // Beyond the last?
test_set_grow(elem); // Then grow and set
} else {
uint32 mask = 1L << (elem & 31); // Get bit mask
uint32_t mask = 1L << (elem & 31); // Get bit mask
data[word] |= mask; // Set bit
}
}
@ -164,7 +164,7 @@ class VectorSetI : public StackObj {
friend class VectorSet;
const VectorSet *s;
uint i, j;
uint32 mask;
uint32_t mask;
uint next(void);
public:

View file

@ -1268,7 +1268,6 @@ void UnionFind::extend( uint from_idx, uint to_idx ) {
}
void UnionFind::reset( uint max ) {
assert( max <= max_uint, "Must fit within uint" );
// Force the Union-Find mapping to be at least this large
extend(max,0);
// Initialize to be the ID mapping.

View file

@ -26,7 +26,6 @@
#define SHARE_VM_OPTO_CHAITIN_HPP
#include "code/vmreg.hpp"
#include "libadt/port.hpp"
#include "memory/resourceArea.hpp"
#include "opto/connode.hpp"
#include "opto/live.hpp"
@ -142,7 +141,7 @@ public:
// Number of registers this live range uses when it colors
private:
uint8 _num_regs; // 2 for Longs and Doubles, 1 for all else
uint8_t _num_regs; // 2 for Longs and Doubles, 1 for all else
// except _num_regs is kill count for fat_proj
public:
int num_regs() const { return _num_regs; }
@ -151,7 +150,7 @@ public:
private:
// Number of physical registers this live range uses when it colors
// Architecture and register-set dependent
uint8 _reg_pressure;
uint8_t _reg_pressure;
public:
void set_reg_pressure(int i) { _reg_pressure = i; }
int reg_pressure() const { return _reg_pressure; }

View file

@ -32,7 +32,6 @@
#include "compiler/compilerOracle.hpp"
#include "compiler/compileBroker.hpp"
#include "libadt/dict.hpp"
#include "libadt/port.hpp"
#include "libadt/vectset.hpp"
#include "memory/resourceArea.hpp"
#include "opto/idealGraphPrinter.hpp"

View file

@ -514,7 +514,7 @@ const Type *DivINode::Value( PhaseTransform *phase ) const {
int widen = MAX2(i1->_widen, i2->_widen);
if( i2->is_con() && i2->get_con() != 0 ) {
int32 d = i2->get_con(); // Divisor
int32_t d = i2->get_con(); // Divisor
jint lo, hi;
if( d >= 0 ) {
lo = i1->_lo/d;
@ -536,7 +536,7 @@ const Type *DivINode::Value( PhaseTransform *phase ) const {
// If the dividend is a constant
if( i1->is_con() ) {
int32 d = i1->get_con();
int32_t d = i1->get_con();
if( d < 0 ) {
if( d == min_jint ) {
// (-min_jint) == min_jint == (min_jint / -1)

View file

@ -397,8 +397,9 @@ void PhaseIdealLoop::Dominators() {
ntarjan[i]._control = NULL;
// Store the DFS order for the main loop
const uint fill_value = max_juint;
uint *dfsorder = NEW_RESOURCE_ARRAY(uint,C->unique()+1);
memset(dfsorder, max_uint, (C->unique()+1) * sizeof(uint));
memset(dfsorder, fill_value, (C->unique()+1) * sizeof(uint));
// Tarjan's algorithm, almost verbatim:
// Step 1:
@ -419,7 +420,7 @@ void PhaseIdealLoop::Dominators() {
if( whead->in(j) == NULL || !whead->in(j)->is_CFG() )
continue; // Only process control nodes
uint b = dfsorder[whead->in(j)->_idx];
if(b == max_uint) continue;
if(b == fill_value) continue;
NTarjan *vx = &ntarjan[b];
NTarjan *u = vx->EVAL();
if( u->_semi < w->_semi )

View file

@ -51,7 +51,7 @@ int IndexSet::_serial_count = 1;
#endif
// What is the first set bit in a 5 bit integer?
const byte IndexSetIterator::_first_bit[32] = {
const uint8_t IndexSetIterator::_first_bit[32] = {
0, 0, 1, 0,
2, 0, 1, 0,
3, 0, 1, 0,
@ -63,7 +63,7 @@ const byte IndexSetIterator::_first_bit[32] = {
};
// What is the second set bit in a 5 bit integer?
const byte IndexSetIterator::_second_bit[32] = {
const uint8_t IndexSetIterator::_second_bit[32] = {
5, 5, 5, 1,
5, 2, 2, 1,
5, 3, 3, 1,
@ -298,7 +298,7 @@ IndexSet::IndexSet (IndexSet *set) {
set_block(i, &_empty_block);
} else {
BitBlock *new_block = alloc_block();
memcpy(new_block->words(), block->words(), sizeof(uint32) * words_per_block);
memcpy(new_block->words(), block->words(), sizeof(uint32_t) * words_per_block);
set_block(i, new_block);
}
}

View file

@ -106,12 +106,12 @@ class IndexSet : public ResourceObj {
// is used by IndexSet to mainting this free list.
union {
uint32 _words[words_per_block];
uint32_t _words[words_per_block];
BitBlock *_next;
} _data;
// accessors
uint32 *words() { return _data._words; }
uint32_t* words() { return _data._words; }
void set_next(BitBlock *next) { _data._next = next; }
BitBlock *next() { return _data._next; }
@ -120,22 +120,22 @@ class IndexSet : public ResourceObj {
// not assume that the block index has been masked out.
void clear() {
memset(words(), 0, sizeof(uint32) * words_per_block);
memset(words(), 0, sizeof(uint32_t) * words_per_block);
}
bool member(uint element) {
uint word_index = IndexSet::get_word_index(element);
uint bit_index = IndexSet::get_bit_index(element);
return ((words()[word_index] & (uint32)(0x1 << bit_index)) != 0);
return ((words()[word_index] & (uint32_t)(0x1 << bit_index)) != 0);
}
bool insert(uint element) {
uint word_index = IndexSet::get_word_index(element);
uint bit_index = IndexSet::get_bit_index(element);
uint32 bit = (0x1 << bit_index);
uint32 before = words()[word_index];
uint32_t bit = (0x1 << bit_index);
uint32_t before = words()[word_index];
words()[word_index] = before | bit;
return ((before & bit) != 0);
}
@ -144,8 +144,8 @@ class IndexSet : public ResourceObj {
uint word_index = IndexSet::get_word_index(element);
uint bit_index = IndexSet::get_bit_index(element);
uint32 bit = (0x1 << bit_index);
uint32 before = words()[word_index];
uint32_t bit = (0x1 << bit_index);
uint32_t before = words()[word_index];
words()[word_index] = before & ~bit;
return ((before & bit) != 0);
}
@ -404,14 +404,14 @@ class IndexSetIterator VALUE_OBJ_CLASS_SPEC {
table_size = (1 << window_size) };
// For an integer of length window_size, what is the first set bit?
static const byte _first_bit[table_size];
static const uint8_t _first_bit[table_size];
// For an integer of length window_size, what is the second set bit?
static const byte _second_bit[table_size];
static const uint8_t _second_bit[table_size];
private:
// The current word we are inspecting
uint32 _current;
uint32_t _current;
// What element number are we currently on?
uint _value;
@ -420,7 +420,7 @@ class IndexSetIterator VALUE_OBJ_CLASS_SPEC {
uint _next_word;
// A pointer to the contents of the current block
uint32 *_words;
uint32_t *_words;
// The index of the next block we will inspect
uint _next_block;

View file

@ -25,7 +25,6 @@
#ifndef SHARE_VM_OPTO_LIVE_HPP
#define SHARE_VM_OPTO_LIVE_HPP
#include "libadt/port.hpp"
#include "libadt/vectset.hpp"
#include "opto/block.hpp"
#include "opto/indexSet.hpp"

View file

@ -339,8 +339,8 @@ public:
Node_List _body; // Loop body for inner loops
uint8 _nest; // Nesting depth
uint8 _irreducible:1, // True if irreducible
uint8_t _nest; // Nesting depth
uint8_t _irreducible:1, // True if irreducible
_has_call:1, // True if has call safepoint
_has_sfpt:1, // True if has non-call safepoint
_rce_candidate:1; // True if candidate for range check elimination

View file

@ -235,23 +235,23 @@ const Type *MulINode::mul_ring(const Type *t0, const Type *t1) const {
const TypeInt *r1 = t1->is_int();
// Fetch endpoints of all ranges
int32 lo0 = r0->_lo;
int32_t lo0 = r0->_lo;
double a = (double)lo0;
int32 hi0 = r0->_hi;
int32_t hi0 = r0->_hi;
double b = (double)hi0;
int32 lo1 = r1->_lo;
int32_t lo1 = r1->_lo;
double c = (double)lo1;
int32 hi1 = r1->_hi;
int32_t hi1 = r1->_hi;
double d = (double)hi1;
// Compute all endpoints & check for overflow
int32 A = lo0*lo1;
int32_t A = lo0*lo1;
if( (double)A != a*c ) return TypeInt::INT; // Overflow?
int32 B = lo0*hi1;
int32_t B = lo0*hi1;
if( (double)B != a*d ) return TypeInt::INT; // Overflow?
int32 C = hi0*lo1;
int32_t C = hi0*lo1;
if( (double)C != b*c ) return TypeInt::INT; // Overflow?
int32 D = hi0*hi1;
int32_t D = hi0*hi1;
if( (double)D != b*d ) return TypeInt::INT; // Overflow?
if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
@ -1228,12 +1228,12 @@ const Type *URShiftINode::Value( PhaseTransform *phase ) const {
//
// const TypeInstPtr *o = t1->is_instptr();
// if( t1->singleton() )
// return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
// return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
// }
// else if( t1->base() == Type::KlassPtr ) {
// const TypeKlassPtr *o = t1->is_klassptr();
// if( t1->singleton() )
// return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
// return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
// }
return TypeInt::INT;

View file

@ -25,7 +25,6 @@
#ifndef SHARE_VM_OPTO_NODE_HPP
#define SHARE_VM_OPTO_NODE_HPP
#include "libadt/port.hpp"
#include "libadt/vectset.hpp"
#include "opto/compile.hpp"
#include "opto/type.hpp"

View file

@ -366,8 +366,8 @@ void Compile::shorten_branches(uint* blk_starts, int& code_size, int& reloc_size
// third inserts nops where needed.
// Step one, perform a pessimistic sizing pass.
uint last_call_adr = max_uint;
uint last_avoid_back_to_back_adr = max_uint;
uint last_call_adr = max_juint;
uint last_avoid_back_to_back_adr = max_juint;
uint nop_size = (new (this) MachNopNode())->size(_regalloc);
for (uint i = 0; i < nblocks; i++) { // For all blocks
Block* block = _cfg->get_block(i);
@ -479,7 +479,7 @@ void Compile::shorten_branches(uint* blk_starts, int& code_size, int& reloc_size
// Step two, replace eligible long jumps.
bool progress = true;
uint last_may_be_short_branch_adr = max_uint;
uint last_may_be_short_branch_adr = max_juint;
while (has_short_branch_candidate && progress) {
progress = false;
has_short_branch_candidate = false;

View file

@ -405,9 +405,9 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi)
bool needs_guard = false;
int default_dest;
int64 total_outlier_size = 0;
int64 hi_size = ((int64)hi->hi()) - ((int64)hi->lo()) + 1;
int64 lo_size = ((int64)lo->hi()) - ((int64)lo->lo()) + 1;
int64_t total_outlier_size = 0;
int64_t hi_size = ((int64_t)hi->hi()) - ((int64_t)hi->lo()) + 1;
int64_t lo_size = ((int64_t)lo->hi()) - ((int64_t)lo->lo()) + 1;
if (lo->dest() == hi->dest()) {
total_outlier_size = hi_size + lo_size;
@ -429,7 +429,7 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi)
}
// Find the total number of cases and ranges
int64 num_cases = ((int64)hi->hi()) - ((int64)lo->lo()) + 1;
int64_t num_cases = ((int64_t)hi->hi()) - ((int64_t)lo->lo()) + 1;
int num_range = hi - lo + 1;
// Don't create table if: too large, too small, or too sparse.
@ -473,7 +473,7 @@ bool Parse::create_jump_tables(Node* key_val, SwitchRange* lo, SwitchRange* hi)
// These are the switch destinations hanging off the jumpnode
int i = 0;
for (SwitchRange* r = lo; r <= hi; r++) {
for (int64 j = r->lo(); j <= r->hi(); j++, i++) {
for (int64_t j = r->lo(); j <= r->hi(); j++, i++) {
Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval)));
{
PreserveJVMState pjvms(this);

View file

@ -25,7 +25,6 @@
#ifndef SHARE_VM_OPTO_PHASE_HPP
#define SHARE_VM_OPTO_PHASE_HPP
#include "libadt/port.hpp"
#include "runtime/timer.hpp"
class Compile;

View file

@ -51,7 +51,7 @@
//-------------Non-zero bit search methods used by RegMask---------------------
// Find lowest 1, or return 32 if empty
int find_lowest_bit( uint32 mask ) {
int find_lowest_bit( uint32_t mask ) {
int n = 0;
if( (mask & 0xffff) == 0 ) {
mask >>= 16;
@ -80,7 +80,7 @@ int find_lowest_bit( uint32 mask ) {
}
// Find highest 1, or return 32 if empty
int find_hihghest_bit( uint32 mask ) {
int find_hihghest_bit( uint32_t mask ) {
int n = 0;
if( mask > 0xffff ) {
mask >>= 16;
@ -395,7 +395,7 @@ bool RegMask::is_UP() const {
//------------------------------Size-------------------------------------------
// Compute size of register mask in bits
uint RegMask::Size() const {
extern uint8 bitsInByte[256];
extern uint8_t bitsInByte[256];
uint sum = 0;
for( int i = 0; i < RM_SIZE; i++ )
sum +=

View file

@ -26,7 +26,6 @@
#define SHARE_VM_OPTO_REGMASK_HPP
#include "code/vmreg.hpp"
#include "libadt/port.hpp"
#include "opto/optoreg.hpp"
#ifdef TARGET_ARCH_MODEL_x86_32
# include "adfiles/adGlobals_x86_32.hpp"
@ -68,9 +67,9 @@
//-------------Non-zero bit search methods used by RegMask---------------------
// Find lowest 1, or return 32 if empty
int find_lowest_bit( uint32 mask );
int find_lowest_bit( uint32_t mask );
// Find highest 1, or return 32 if empty
int find_hihghest_bit( uint32 mask );
int find_hihghest_bit( uint32_t mask );
//------------------------------RegMask----------------------------------------
// The ADL file describes how to print the machine-specific registers, as well

View file

@ -960,7 +960,7 @@ JRT_LEAF(void, OptoRuntime::profile_receiver_type_C(DataLayout* data, oopDesc* r
} else {
// Receiver did not match any saved receiver and there is no empty row for it.
// Increment total counter to indicate polymorphic case.
intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset()));
intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset()));
*count_p += DataLayout::counter_increment;
}
JRT_END

View file

@ -242,8 +242,8 @@ Node *SubINode::Ideal(PhaseGVN *phase, bool can_reshape){
const Type *SubINode::sub( const Type *t1, const Type *t2 ) const {
const TypeInt *r0 = t1->is_int(); // Handy access
const TypeInt *r1 = t2->is_int();
int32 lo = r0->_lo - r1->_hi;
int32 hi = r0->_hi - r1->_lo;
int32_t lo = r0->_lo - r1->_hi;
int32_t hi = r0->_hi - r1->_lo;
// We next check for 32-bit overflow.
// If that happens, we just assume all integers are possible.

View file

@ -25,7 +25,6 @@
#ifndef SHARE_VM_OPTO_TYPE_HPP
#define SHARE_VM_OPTO_TYPE_HPP
#include "libadt/port.hpp"
#include "opto/adlcVMDeps.hpp"
#include "runtime/handles.hpp"

View file

@ -246,7 +246,6 @@
# include "utilities/yieldingWorkgroup.hpp"
#ifdef COMPILER2
# include "libadt/dict.hpp"
# include "libadt/port.hpp"
# include "libadt/set.hpp"
# include "libadt/vectset.hpp"
# include "opto/addnode.hpp"