8281522: Rename ADLC classes which have the same name as hotspot variants

Reviewed-by: neliasso, kvn
This commit is contained in:
Thomas Stuefe 2022-02-11 05:34:27 +00:00
parent 84868e39be
commit eee6a5622d
11 changed files with 109 additions and 109 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -24,7 +24,7 @@
#include "adlc.hpp" #include "adlc.hpp"
void* AllocateHeap(size_t size) { void* AdlAllocateHeap(size_t size) {
unsigned char* ptr = (unsigned char*) malloc(size); unsigned char* ptr = (unsigned char*) malloc(size);
if (ptr == NULL && size != 0) { if (ptr == NULL && size != 0) {
fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash! fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash!
@ -34,7 +34,7 @@ void* AllocateHeap(size_t size) {
return ptr; return ptr;
} }
void* ReAllocateHeap(void* old_ptr, size_t size) { void* AdlReAllocateHeap(void* old_ptr, size_t size) {
unsigned char* ptr = (unsigned char*) realloc(old_ptr, size); unsigned char* ptr = (unsigned char*) realloc(old_ptr, size);
if (ptr == NULL && size != 0) { if (ptr == NULL && size != 0) {
fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash! fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash!
@ -44,24 +44,24 @@ void* ReAllocateHeap(void* old_ptr, size_t size) {
return ptr; return ptr;
} }
void* Chunk::operator new(size_t requested_size, size_t length) throw() { void* AdlChunk::operator new(size_t requested_size, size_t length) throw() {
return CHeapObj::operator new(requested_size + length); return AdlCHeapObj::operator new(requested_size + length);
} }
void Chunk::operator delete(void* p, size_t length) { void AdlChunk::operator delete(void* p, size_t length) {
CHeapObj::operator delete(p); AdlCHeapObj::operator delete(p);
} }
Chunk::Chunk(size_t length) { AdlChunk::AdlChunk(size_t length) {
_next = NULL; // Chain on the linked list _next = NULL; // Chain on the linked list
_len = length; // Save actual size _len = length; // Save actual size
} }
//------------------------------chop------------------------------------------- //------------------------------chop-------------------------------------------
void Chunk::chop() { void AdlChunk::chop() {
Chunk *k = this; AdlChunk *k = this;
while( k ) { while( k ) {
Chunk *tmp = k->_next; AdlChunk *tmp = k->_next;
// clear out this chunk (to detect allocation bugs) // clear out this chunk (to detect allocation bugs)
memset(k, 0xBE, k->_len); memset(k, 0xBE, k->_len);
free(k); // Free chunk (was malloc'd) free(k); // Free chunk (was malloc'd)
@ -69,52 +69,52 @@ void Chunk::chop() {
} }
} }
void Chunk::next_chop() { void AdlChunk::next_chop() {
_next->chop(); _next->chop();
_next = NULL; _next = NULL;
} }
//------------------------------Arena------------------------------------------ //------------------------------AdlArena------------------------------------------
Arena::Arena( size_t init_size ) { AdlArena::AdlArena( size_t init_size ) {
init_size = (init_size+3) & ~3; init_size = (init_size+3) & ~3;
_first = _chunk = new (init_size) Chunk(init_size); _first = _chunk = new (init_size) AdlChunk(init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max _hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top(); _max = _chunk->top();
set_size_in_bytes(init_size); set_size_in_bytes(init_size);
} }
Arena::Arena() { AdlArena::AdlArena() {
_first = _chunk = new (Chunk::init_size) Chunk(Chunk::init_size); _first = _chunk = new (AdlChunk::init_size) AdlChunk(AdlChunk::init_size);
_hwm = _chunk->bottom(); // Save the cached hwm, max _hwm = _chunk->bottom(); // Save the cached hwm, max
_max = _chunk->top(); _max = _chunk->top();
set_size_in_bytes(Chunk::init_size); set_size_in_bytes(AdlChunk::init_size);
} }
Arena::Arena( Arena *a ) AdlArena::AdlArena( AdlArena *a )
: _chunk(a->_chunk), _hwm(a->_hwm), _max(a->_max), _first(a->_first) { : _chunk(a->_chunk), _hwm(a->_hwm), _max(a->_max), _first(a->_first) {
set_size_in_bytes(a->size_in_bytes()); set_size_in_bytes(a->size_in_bytes());
} }
//------------------------------used------------------------------------------- //------------------------------used-------------------------------------------
// Total of all Chunks in arena // Total of all AdlChunks in arena
size_t Arena::used() const { size_t AdlArena::used() const {
size_t sum = _chunk->_len - (_max-_hwm); // Size leftover in this Chunk size_t sum = _chunk->_len - (_max-_hwm); // Size leftover in this AdlChunk
Chunk *k = _first; AdlChunk *k = _first;
while( k != _chunk) { // Whilst have Chunks in a row while( k != _chunk) { // Whilst have AdlChunks in a row
sum += k->_len; // Total size of this Chunk sum += k->_len; // Total size of this AdlChunk
k = k->_next; // Bump along to next Chunk k = k->_next; // Bump along to next AdlChunk
} }
return sum; // Return total consumed space. return sum; // Return total consumed space.
} }
//------------------------------grow------------------------------------------- //------------------------------grow-------------------------------------------
// Grow a new Chunk // Grow a new AdlChunk
void* Arena::grow( size_t x ) { void* AdlArena::grow( size_t x ) {
// Get minimal required size. Either real big, or even bigger for giant objs // Get minimal required size. Either real big, or even bigger for giant objs
size_t len = max(x, Chunk::size); size_t len = max(x, AdlChunk::size);
Chunk *k = _chunk; // Get filled-up chunk address AdlChunk *k = _chunk; // Get filled-up chunk address
_chunk = new (len) Chunk(len); _chunk = new (len) AdlChunk(len);
if( k ) k->_next = _chunk; // Append new chunk to end of linked list if( k ) k->_next = _chunk; // Append new chunk to end of linked list
else _first = _chunk; else _first = _chunk;
@ -127,8 +127,8 @@ void* Arena::grow( size_t x ) {
} }
//------------------------------calloc----------------------------------------- //------------------------------calloc-----------------------------------------
// Allocate zeroed storage in Arena // Allocate zeroed storage in AdlArena
void *Arena::Acalloc( size_t items, size_t x ) { void *AdlArena::Acalloc( size_t items, size_t x ) {
size_t z = items*x; // Total size needed size_t z = items*x; // Total size needed
void *ptr = Amalloc(z); // Get space void *ptr = Amalloc(z); // Get space
memset( ptr, 0, z ); // Zap space memset( ptr, 0, z ); // Zap space
@ -136,8 +136,8 @@ void *Arena::Acalloc( size_t items, size_t x ) {
} }
//------------------------------realloc---------------------------------------- //------------------------------realloc----------------------------------------
// Reallocate storage in Arena. // Reallocate storage in AdlArena.
void *Arena::Arealloc( void *old_ptr, size_t old_size, size_t new_size ) { void *AdlArena::Arealloc( void *old_ptr, size_t old_size, size_t new_size ) {
char *c_old = (char*)old_ptr; // Handy name char *c_old = (char*)old_ptr; // Handy name
// Stupid fast special case // Stupid fast special case
if( new_size <= old_size ) { // Shrink in-place if( new_size <= old_size ) { // Shrink in-place
@ -161,32 +161,32 @@ void *Arena::Arealloc( void *old_ptr, size_t old_size, size_t new_size ) {
} }
//------------------------------reset------------------------------------------ //------------------------------reset------------------------------------------
// Reset this Arena to empty, and return this Arenas guts in a new Arena. // Reset this AdlArena to empty, and return this AdlArenas guts in a new AdlArena.
Arena *Arena::reset(void) { AdlArena *AdlArena::reset(void) {
Arena *a = new Arena(this); // New empty arena AdlArena *a = new AdlArena(this); // New empty arena
_first = _chunk = NULL; // Normal, new-arena initialization _first = _chunk = NULL; // Normal, new-arena initialization
_hwm = _max = NULL; _hwm = _max = NULL;
return a; // Return Arena with guts return a; // Return AdlArena with guts
} }
//------------------------------contains--------------------------------------- //------------------------------contains---------------------------------------
// Determine if pointer belongs to this Arena or not. // Determine if pointer belongs to this AdlArena or not.
bool Arena::contains( const void *ptr ) const { bool AdlArena::contains( const void *ptr ) const {
if( (void*)_chunk->bottom() <= ptr && ptr < (void*)_hwm ) if( (void*)_chunk->bottom() <= ptr && ptr < (void*)_hwm )
return true; // Check for in this chunk return true; // Check for in this chunk
for( Chunk *c = _first; c; c = c->_next ) for( AdlChunk *c = _first; c; c = c->_next )
if( (void*)c->bottom() <= ptr && ptr < (void*)c->top()) if( (void*)c->bottom() <= ptr && ptr < (void*)c->top())
return true; // Check for every chunk in Arena return true; // Check for every chunk in AdlArena
return false; // Not in any Chunk, so not in Arena return false; // Not in any AdlChunk, so not in AdlArena
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// CHeapObj // CHeapObj
void* CHeapObj::operator new(size_t size) throw() { void* AdlCHeapObj::operator new(size_t size) throw() {
return (void *) AllocateHeap(size); return (void *) AdlAllocateHeap(size);
} }
void CHeapObj::operator delete(void* p){ void AdlCHeapObj::operator delete(void* p){
free(p); free(p);
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,11 +22,11 @@
* *
*/ */
#ifndef SHARE_ADLC_ARENA_HPP #ifndef SHARE_ADLC_ADLARENA_HPP
#define SHARE_ADLC_ARENA_HPP #define SHARE_ADLC_ADLARENA_HPP
void* AllocateHeap(size_t size); void* AdlAllocateHeap(size_t size);
void* ReAllocateHeap(void* old_ptr, size_t size); void* AdlReAllocateHeap(void* old_ptr, size_t size);
// All classes in adlc may be derived // All classes in adlc may be derived
// from one of the following allocation classes: // from one of the following allocation classes:
@ -35,10 +35,10 @@ void* ReAllocateHeap(void* old_ptr, size_t size);
// - CHeapObj // - CHeapObj
// //
// For classes used as name spaces. // For classes used as name spaces.
// - AllStatic // - AdlAllStatic
// //
class CHeapObj { class AdlCHeapObj {
public: public:
void* operator new(size_t size) throw(); void* operator new(size_t size) throw();
void operator delete(void* p); void operator delete(void* p);
@ -47,16 +47,16 @@ class CHeapObj {
// Base class for classes that constitute name spaces. // Base class for classes that constitute name spaces.
class AllStatic { class AdlAllStatic {
public: public:
void* operator new(size_t size) throw(); void* operator new(size_t size) throw();
void operator delete(void* p); void operator delete(void* p);
}; };
//------------------------------Chunk------------------------------------------ //------------------------------AdlChunk------------------------------------------
// Linked list of raw memory chunks // Linked list of raw memory chunks
class Chunk: public CHeapObj { class AdlChunk: public AdlCHeapObj {
private: private:
// This ordinary operator delete is needed even though not used, so the // This ordinary operator delete is needed even though not used, so the
// below two-argument operator delete will be treated as a placement // below two-argument operator delete will be treated as a placement
@ -65,41 +65,41 @@ class Chunk: public CHeapObj {
public: public:
void* operator new(size_t size, size_t length) throw(); void* operator new(size_t size, size_t length) throw();
void operator delete(void* p, size_t length); void operator delete(void* p, size_t length);
Chunk(size_t length); AdlChunk(size_t length);
enum { enum {
init_size = 1*1024, // Size of first chunk init_size = 1*1024, // Size of first chunk
size = 32*1024 // Default size of an Arena chunk (following the first) size = 32*1024 // Default size of an AdlArena chunk (following the first)
}; };
Chunk* _next; // Next Chunk in list AdlChunk* _next; // Next AdlChunk in list
size_t _len; // Size of this Chunk size_t _len; // Size of this AdlChunk
void chop(); // Chop this chunk void chop(); // Chop this chunk
void next_chop(); // Chop next chunk void next_chop(); // Chop next chunk
// Boundaries of data area (possibly unused) // Boundaries of data area (possibly unused)
char* bottom() const { return ((char*) this) + sizeof(Chunk); } char* bottom() const { return ((char*) this) + sizeof(AdlChunk); }
char* top() const { return bottom() + _len; } char* top() const { return bottom() + _len; }
}; };
//------------------------------Arena------------------------------------------ //------------------------------AdlArena------------------------------------------
// Fast allocation of memory // Fast allocation of memory
class Arena: public CHeapObj { class AdlArena: public AdlCHeapObj {
protected: protected:
friend class ResourceMark; friend class ResourceMark;
friend class HandleMark; friend class HandleMark;
friend class NoHandleMark; friend class NoHandleMark;
Chunk *_first; // First chunk AdlChunk *_first; // First chunk
Chunk *_chunk; // current chunk AdlChunk *_chunk; // current chunk
char *_hwm, *_max; // High water mark and max in current chunk char *_hwm, *_max; // High water mark and max in current chunk
void* grow(size_t x); // Get a new Chunk of at least size x void* grow(size_t x); // Get a new AdlChunk of at least size x
size_t _size_in_bytes; // Size of arena (used for memory usage tracing) size_t _size_in_bytes; // Size of arena (used for memory usage tracing)
public: public:
Arena(); AdlArena();
Arena(size_t init_size); AdlArena(size_t init_size);
Arena(Arena *old); AdlArena(AdlArena *old);
~Arena() { _first->chop(); } ~AdlArena() { _first->chop(); }
char* hwm() const { return _hwm; } char* hwm() const { return _hwm; }
// Fast allocate in the arena. Common case is: pointer test + increment. // Fast allocate in the arena. Common case is: pointer test + increment.
@ -137,10 +137,10 @@ public:
void *Acalloc( size_t items, size_t x ); void *Acalloc( size_t items, size_t x );
void *Arealloc( void *old_ptr, size_t old_size, size_t new_size ); void *Arealloc( void *old_ptr, size_t old_size, size_t new_size );
// Reset this Arena to empty, and return this Arenas guts in a new Arena. // Reset this AdlArena to empty, and return this AdlArenas guts in a new AdlArena.
Arena *reset(void); AdlArena *reset(void);
// Determine if pointer belongs to this Arena or not. // Determine if pointer belongs to this AdlArena or not.
bool contains( const void *ptr ) const; bool contains( const void *ptr ) const;
// Total of all chunks in use (not thread-safe) // Total of all chunks in use (not thread-safe)
@ -151,4 +151,4 @@ public:
void set_size_in_bytes(size_t size) { _size_in_bytes = size; } void set_size_in_bytes(size_t size) { _size_in_bytes = size; }
}; };
#endif // SHARE_ADLC_ARENA_HPP #endif // SHARE_ADLC_ADLARENA_HPP

View file

@ -93,7 +93,7 @@ typedef unsigned int uintptr_t;
#define max(a, b) (((a)>(b)) ? (a) : (b)) #define max(a, b) (((a)>(b)) ? (a) : (b))
// ADLC components // ADLC components
#include "arena.hpp" #include "adlArena.hpp"
#include "opto/adlcVMDeps.hpp" #include "opto/adlcVMDeps.hpp"
#include "filebuff.hpp" #include "filebuff.hpp"
#include "dict2.hpp" #include "dict2.hpp"

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -211,7 +211,7 @@ void ADLParser::instr_parse(void) {
return; return;
} }
assert(match_rules_cnt < 100," too many match rule clones"); assert(match_rules_cnt < 100," too many match rule clones");
char* buf = (char*) AllocateHeap(strlen(instr->_ident) + 4); char* buf = (char*) AdlAllocateHeap(strlen(instr->_ident) + 4);
sprintf(buf, "%s_%d", instr->_ident, match_rules_cnt++); sprintf(buf, "%s_%d", instr->_ident, match_rules_cnt++);
rule->_result = buf; rule->_result = buf;
// Check for commutative operations with tree operands. // Check for commutative operations with tree operands.
@ -2805,7 +2805,7 @@ void ADLParser::ins_encode_parse_block(InstructForm& inst) {
// Create a new encoding name based on the name of the instruction // Create a new encoding name based on the name of the instruction
// definition, which should be unique. // definition, which should be unique.
const char* prefix = "__ins_encode_"; const char* prefix = "__ins_encode_";
char* ec_name = (char*) AllocateHeap(strlen(inst._ident) + strlen(prefix) + 1); char* ec_name = (char*) AdlAllocateHeap(strlen(inst._ident) + strlen(prefix) + 1);
sprintf(ec_name, "%s%s", prefix, inst._ident); sprintf(ec_name, "%s%s", prefix, inst._ident);
assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist"); assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist");
@ -3276,7 +3276,7 @@ void ADLParser::constant_parse(InstructForm& inst) {
// Create a new encoding name based on the name of the instruction // Create a new encoding name based on the name of the instruction
// definition, which should be unique. // definition, which should be unique.
const char* prefix = "__constant_"; const char* prefix = "__constant_";
char* ec_name = (char*) AllocateHeap(strlen(inst._ident) + strlen(prefix) + 1); char* ec_name = (char*) AdlAllocateHeap(strlen(inst._ident) + strlen(prefix) + 1);
sprintf(ec_name, "%s%s", prefix, inst._ident); sprintf(ec_name, "%s%s", prefix, inst._ident);
assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist"); assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist");
@ -4409,7 +4409,7 @@ char* ADLParser::find_cpp_block(const char* description) {
if (_AD._adlocation_debug) { if (_AD._adlocation_debug) {
char* location = get_line_string(line); char* location = get_line_string(line);
char* end_loc = end_line_marker(); char* end_loc = end_line_marker();
char* result = (char *)AllocateHeap(strlen(location) + strlen(cppBlock) + strlen(end_loc) + 1); char* result = (char *)AdlAllocateHeap(strlen(location) + strlen(cppBlock) + strlen(end_loc) + 1);
strcpy(result, location); strcpy(result, location);
strcat(result, cppBlock); strcat(result, cppBlock);
strcat(result, end_loc); strcat(result, end_loc);
@ -4498,7 +4498,7 @@ char *ADLParser::get_paren_expr(const char *description, bool include_location)
// Prepend location descriptor, for debugging. // Prepend location descriptor, for debugging.
char* location = get_line_string(line); char* location = get_line_string(line);
char* end_loc = end_line_marker(); char* end_loc = end_line_marker();
char* result = (char *)AllocateHeap(strlen(location) + strlen(token2) + strlen(end_loc) + 1); char* result = (char *)AdlAllocateHeap(strlen(location) + strlen(token2) + strlen(end_loc) + 1);
strcpy(result, location); strcpy(result, location);
strcat(result, token2); strcat(result, token2);
strcat(result, end_loc); strcat(result, end_loc);
@ -4596,7 +4596,7 @@ char *ADLParser::get_ident_or_literal_constant(const char* description) {
// Grab a constant expression. // Grab a constant expression.
param = get_paren_expr(description); param = get_paren_expr(description);
if (param[0] != '(') { if (param[0] != '(') {
char* buf = (char*) AllocateHeap(strlen(param) + 3); char* buf = (char*) AdlAllocateHeap(strlen(param) + 3);
sprintf(buf, "(%s)", param); sprintf(buf, "(%s)", param);
param = buf; param = buf;
} }
@ -5204,7 +5204,7 @@ void ADLParser::next_line() {
char* ADLParser::get_line_string(int linenum) { char* ADLParser::get_line_string(int linenum) {
const char* file = _AD._ADL_file._name; const char* file = _AD._ADL_file._name;
int line = linenum ? linenum : this->linenum(); int line = linenum ? linenum : this->linenum();
char* location = (char *)AllocateHeap(strlen(file) + 100); char* location = (char *)AdlAllocateHeap(strlen(file) + 100);
sprintf(location, "\n#line %d \"%s\"\n", line, file); sprintf(location, "\n#line %d \"%s\"\n", line, file);
return location; return location;
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -72,7 +72,7 @@ private:
public: public:
// cmpstr does string comparisions. hashstr computes a key. // cmpstr does string comparisions. hashstr computes a key.
ProductionState(Arena *arena) : _production(cmpstr, hashstr, arena) { initialize(); }; ProductionState(AdlArena *arena) : _production(cmpstr, hashstr, arena) { initialize(); };
~ProductionState() { }; ~ProductionState() { };
void initialize(); // reset local and dictionary state void initialize(); // reset local and dictionary state
@ -817,7 +817,7 @@ bool Expr::check_buffers() {
//------------------------------ExprDict--------------------------------------- //------------------------------ExprDict---------------------------------------
// Constructor // Constructor
ExprDict::ExprDict( CmpKey cmp, Hash hash, Arena *arena ) ExprDict::ExprDict( CmpKey cmp, Hash hash, AdlArena *arena )
: _expr(cmp, hash, arena), _defines() { : _expr(cmp, hash, arena), _defines() {
} }
ExprDict::~ExprDict() { ExprDict::~ExprDict() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ Dict::Dict(CmpKey initcmp, Hash inithash) : _hash(inithash), _cmp(initcmp), _are
init(); init();
} }
Dict::Dict(CmpKey initcmp, Hash inithash, Arena *arena) : _hash(inithash), _cmp(initcmp), _arena(arena) { Dict::Dict(CmpKey initcmp, Hash inithash, AdlArena *arena) : _hash(inithash), _cmp(initcmp), _arena(arena) {
init(); init();
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ typedef void (*FuncDict)(const void *key, const void *val, Dict *d);
class Dict { // Dictionary structure class Dict { // Dictionary structure
private: private:
class Arena *_arena; // Where to draw storage from class AdlArena *_arena; // Where to draw storage from
class bucket *_bin; // Hash table is array of buckets class bucket *_bin; // Hash table is array of buckets
int _size; // Size (# of slots) in hash table int _size; // Size (# of slots) in hash table
int _cnt; // Number of key-value pairs in hash table int _cnt; // Number of key-value pairs in hash table
@ -56,7 +56,7 @@ class Dict { // Dictionary structure
// cmp is a key comparision routine. hash is a routine to hash a key. // cmp is a key comparision routine. hash is a routine to hash a key.
Dict( CmpKey cmp, Hash hash ); Dict( CmpKey cmp, Hash hash );
Dict( CmpKey cmp, Hash hash, Arena *arena ); Dict( CmpKey cmp, Hash hash, AdlArena *arena );
void init(); void init();
~Dict(); ~Dict();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,9 +27,9 @@
//------------------------------Static Initializers---------------------------- //------------------------------Static Initializers----------------------------
// allocate arena used by forms // allocate arena used by forms
Arena *Form::arena = Form::generate_arena(); // = Form::generate_arena(); AdlArena *Form::arena = Form::generate_arena(); // = Form::generate_arena();
Arena *Form::generate_arena() { AdlArena *Form::generate_arena() {
return (new Arena); return (new AdlArena);
} }
//------------------------------NameList--------------------------------------- //------------------------------NameList---------------------------------------
@ -40,7 +40,7 @@ const char *NameList::_signal3 = "$$SIGNAL3$$";
// Constructor and Destructor // Constructor and Destructor
NameList::NameList() : _cur(0), _max(4), _iter(0), _justReset(true) { NameList::NameList() : _cur(0), _max(4), _iter(0), _justReset(true) {
_names = (const char**) AllocateHeap(_max*sizeof(char*)); _names = (const char**) AdlAllocateHeap(_max*sizeof(char*));
} }
NameList::~NameList() { NameList::~NameList() {
// The following free is a double-free, and crashes the program: // The following free is a double-free, and crashes the program:
@ -49,7 +49,7 @@ NameList::~NameList() {
void NameList::addName(const char *name) { void NameList::addName(const char *name) {
if (_cur == _max) { if (_cur == _max) {
_names = (const char**) ReAllocateHeap(_names, (_max *=2)*sizeof(char*)); _names = (const char**) AdlReAllocateHeap(_names, (_max *=2)*sizeof(char*));
} }
_names[_cur++] = name; _names[_cur++] = name;
} }
@ -312,7 +312,7 @@ FormList::~FormList() {
//------------------------------FormDict--------------------------------------- //------------------------------FormDict---------------------------------------
// Constructor // Constructor
FormDict::FormDict( CmpKey cmp, Hash hash, Arena *arena ) FormDict::FormDict( CmpKey cmp, Hash hash, AdlArena *arena )
: _form(cmp, hash, arena) { : _form(cmp, hash, arena) {
} }
FormDict::~FormDict() { FormDict::~FormDict() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -97,7 +97,7 @@ private:
public: public:
// cmp is a key comparision routine. hash is a routine to hash a key. // cmp is a key comparision routine. hash is a routine to hash a key.
// FormDict( CmpKey cmp, Hash hash ); // FormDict( CmpKey cmp, Hash hash );
FormDict( CmpKey cmp, Hash hash, Arena *arena ); FormDict( CmpKey cmp, Hash hash, AdlArena *arena );
FormDict( const FormDict & fd ); // Deep-copy guts FormDict( const FormDict & fd ); // Deep-copy guts
~FormDict(); ~FormDict();
@ -119,9 +119,9 @@ public:
//------------------------------Form------------------------------------------- //------------------------------Form-------------------------------------------
class Form { class Form {
public: public:
static Arena *arena; // arena used by forms static AdlArena *arena; // arena used by forms
private: private:
static Arena *generate_arena(); // allocate arena used by forms static AdlArena *generate_arena(); // allocate arena used by forms
protected: protected:
int _ftype; // Indicator for derived class type int _ftype; // Indicator for derived class type
@ -573,7 +573,7 @@ private:
public: public:
// cmp is a key comparision routine. hash is a routine to hash a key. // cmp is a key comparision routine. hash is a routine to hash a key.
ExprDict( CmpKey cmp, Hash hash, Arena *arena ); ExprDict( CmpKey cmp, Hash hash, AdlArena *arena );
~ExprDict(); ~ExprDict();
// Return # of key-value pairs in dict // Return # of key-value pairs in dict

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -206,7 +206,7 @@ RegDef::RegDef(char *regname, char *callconv, char *c_conv, char * idealtype, ch
_concrete(concrete), _concrete(concrete),
_register_num(0) { _register_num(0) {
// Chunk and register mask are determined by the register number // AdlChunk and register mask are determined by the register number
// _register_num is set when registers are added to an allocation class // _register_num is set when registers are added to an allocation class
} }
RegDef::~RegDef() { // Destructor RegDef::~RegDef() { // Destructor

View file

@ -1366,7 +1366,7 @@ void InstructForm::set_unique_opnds() {
// component back to an index and any DEF always goes at 0 so the // 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. // length of the array has to be the number of components + 1.
_uniq_idx_length = _components.count() + 1; _uniq_idx_length = _components.count() + 1;
uniq_idx = (uint*) AllocateHeap(sizeof(uint) * _uniq_idx_length); uniq_idx = (uint*) AdlAllocateHeap(sizeof(uint) * _uniq_idx_length);
for (i = 0; i < _uniq_idx_length; i++) { for (i = 0; i < _uniq_idx_length; i++) {
uniq_idx[i] = i; uniq_idx[i] = i;
} }
@ -3476,7 +3476,7 @@ void MatchNode::build_internalop( ) {
rstr = (_rChild) ? ((_rChild->_internalop) ? rstr = (_rChild) ? ((_rChild->_internalop) ?
_rChild->_internalop : _rChild->_opType) : ""; _rChild->_internalop : _rChild->_opType) : "";
len += (int)strlen(lstr) + (int)strlen(rstr); len += (int)strlen(lstr) + (int)strlen(rstr);
subtree = (char *)AllocateHeap(len); subtree = (char *)AdlAllocateHeap(len);
sprintf(subtree,"_%s_%s_%s", _opType, lstr, rstr); sprintf(subtree,"_%s_%s_%s", _opType, lstr, rstr);
// Hash the subtree string in _internalOps; if a name exists, use it // Hash the subtree string in _internalOps; if a name exists, use it
iop = (char *)_AD._internalOps[subtree]; iop = (char *)_AD._internalOps[subtree];
@ -3926,7 +3926,7 @@ void MatchRule::matchrule_swap_commutative_op(const char* instr_ident, int count
MatchRule* clone = new MatchRule(_AD, this); MatchRule* clone = new MatchRule(_AD, this);
// Swap operands of commutative operation // Swap operands of commutative operation
((MatchNode*)clone)->swap_commutative_op(true, count); ((MatchNode*)clone)->swap_commutative_op(true, count);
char* buf = (char*) AllocateHeap(strlen(instr_ident) + 4); char* buf = (char*) AdlAllocateHeap(strlen(instr_ident) + 4);
sprintf(buf, "%s_%d", instr_ident, match_rules_cnt++); sprintf(buf, "%s_%d", instr_ident, match_rules_cnt++);
clone->_result = buf; clone->_result = buf;