< prev index next >
src/hotspot/share/adlc/adlparse.cpp
Print this page
@@ -208,11 +208,11 @@
if( instr->is_ideal_control() ) {
parse_err(SYNERR, "unique match rule expected for %s\n", rule->_name);
return;
}
assert(match_rules_cnt < 100," too many match rule clones");
- char* buf = (char*) malloc(strlen(instr->_ident) + 4);
+ char* buf = (char*) AllocateHeap(strlen(instr->_ident) + 4);
sprintf(buf, "%s_%d", instr->_ident, match_rules_cnt++);
rule->_result = buf;
// Check for commutative operations with tree operands.
matchrule_clone_and_swap(rule, instr->_ident, match_rules_cnt);
}
@@ -2856,11 +2856,11 @@
// Parse the block form of ins_encode. See ins_encode_parse for more details
void ADLParser::ins_encode_parse_block(InstructForm& inst) {
// Create a new encoding name based on the name of the instruction
// definition, which should be unique.
const char* prefix = "__ins_encode_";
- char* ec_name = (char*) malloc(strlen(inst._ident) + strlen(prefix) + 1);
+ char* ec_name = (char*) AllocateHeap(strlen(inst._ident) + strlen(prefix) + 1);
sprintf(ec_name, "%s%s", prefix, inst._ident);
assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist");
EncClass* encoding = _AD._encode->add_EncClass(ec_name);
encoding->_linenum = linenum();
@@ -3326,11 +3326,11 @@
// Parse a constant expression.
void ADLParser::constant_parse(InstructForm& inst) {
// Create a new encoding name based on the name of the instruction
// definition, which should be unique.
const char* prefix = "__constant_";
- char* ec_name = (char*) malloc(strlen(inst._ident) + strlen(prefix) + 1);
+ char* ec_name = (char*) AllocateHeap(strlen(inst._ident) + strlen(prefix) + 1);
sprintf(ec_name, "%s%s", prefix, inst._ident);
assert(_AD._encode->encClass(ec_name) == NULL, "shouldn't already exist");
EncClass* encoding = _AD._encode->add_EncClass(ec_name);
encoding->_linenum = linenum();
@@ -4458,11 +4458,11 @@
// Prepend location descriptor, for debugging.
if (_AD._adlocation_debug) {
char* location = get_line_string(line);
char* end_loc = end_line_marker();
- char* result = (char *)malloc(strlen(location) + strlen(cppBlock) + strlen(end_loc) + 1);
+ char* result = (char *)AllocateHeap(strlen(location) + strlen(cppBlock) + strlen(end_loc) + 1);
strcpy(result, location);
strcat(result, cppBlock);
strcat(result, end_loc);
cppBlock = result;
free(location);
@@ -4547,11 +4547,11 @@
int junk = 0;
if (include_location && _AD._adlocation_debug && !is_int_token(token2, junk)) {
// Prepend location descriptor, for debugging.
char* location = get_line_string(line);
char* end_loc = end_line_marker();
- char* result = (char *)malloc(strlen(location) + strlen(token2) + strlen(end_loc) + 1);
+ char* result = (char *)AllocateHeap(strlen(location) + strlen(token2) + strlen(end_loc) + 1);
strcpy(result, location);
strcat(result, token2);
strcat(result, end_loc);
token2 = result;
free(location);
@@ -4645,11 +4645,11 @@
skipws();
if (_curchar == '(') {
// Grab a constant expression.
param = get_paren_expr(description);
if (param[0] != '(') {
- char* buf = (char*) malloc(strlen(param) + 3);
+ char* buf = (char*) AllocateHeap(strlen(param) + 3);
sprintf(buf, "(%s)", param);
param = buf;
}
assert(is_literal_constant(param),
"expr must be recognizable as a constant");
@@ -5253,11 +5253,11 @@
// Prepended location descriptor, for debugging.
// Must return a malloced string (that can be freed if desired).
char* ADLParser::get_line_string(int linenum) {
const char* file = _AD._ADL_file._name;
int line = linenum ? linenum : this->linenum();
- char* location = (char *)malloc(strlen(file) + 100);
+ char* location = (char *)AllocateHeap(strlen(file) + 100);
sprintf(location, "\n#line %d \"%s\"\n", line, file);
return location;
}
//-------------------------is_literal_constant---------------------------------
< prev index next >