adlparse.cpp (5985:1410ad6b05f1) adlparse.cpp (5988:318d0622a6d7)
1/*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *

--- 2849 unchanged lines hidden (view full) ---

2858 // Add flag to _strings list indicating we should check _rep_vars
2859 encoding->add_rep_var(rep_var);
2860
2861 skipws();
2862
2863 // Check if this instruct is a MachConstantNode.
2864 if (strcmp(rep_var, "constanttablebase") == 0) {
2865 // This instruct is a MachConstantNode.
1/*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *

--- 2849 unchanged lines hidden (view full) ---

2858 // Add flag to _strings list indicating we should check _rep_vars
2859 encoding->add_rep_var(rep_var);
2860
2861 skipws();
2862
2863 // Check if this instruct is a MachConstantNode.
2864 if (strcmp(rep_var, "constanttablebase") == 0) {
2865 // This instruct is a MachConstantNode.
2866 inst.set_is_mach_constant(true);
2866 inst.set_needs_constant_base(true);
2867 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
2868 inst.set_is_mach_constant(true);
2869 }
2867
2868 if (_curchar == '(') {
2869 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
2870 "(only constantaddress and constantoffset)", ec_name);
2871 return;
2872 }
2873 }
2874 else if ((strcmp(rep_var, "constantaddress") == 0) ||

--- 85 unchanged lines hidden (view full) ---

2960 skipws();
2961 if ( _curchar == '(' ) {
2962 next_char(); // move past '(' for parameters
2963
2964 // Parse the encode method's parameters
2965 while (_curchar != ')') {
2966 char *param = get_ident_or_literal_constant("encoding operand");
2967 if ( param != NULL ) {
2870
2871 if (_curchar == '(') {
2872 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
2873 "(only constantaddress and constantoffset)", ec_name);
2874 return;
2875 }
2876 }
2877 else if ((strcmp(rep_var, "constantaddress") == 0) ||

--- 85 unchanged lines hidden (view full) ---

2963 skipws();
2964 if ( _curchar == '(' ) {
2965 next_char(); // move past '(' for parameters
2966
2967 // Parse the encode method's parameters
2968 while (_curchar != ')') {
2969 char *param = get_ident_or_literal_constant("encoding operand");
2970 if ( param != NULL ) {
2968 // Found a parameter:
2969 // Check it is a local name, add it to the list, then check for more
2970 // New: allow hex constants as parameters to an encode method.
2971 // New: allow parenthesized expressions as parameters.
2972 // New: allow "primary", "secondary", "tertiary" as parameters.
2973 // New: allow user-defined register name as parameter
2974 if ( (inst._localNames[param] == NULL) &&
2975 !ADLParser::is_literal_constant(param) &&
2976 (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) &&
2977 ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) {
2978 parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name);
2979 return;
2971
2972 // Check if this instruct is a MachConstantNode.
2973 if (strcmp(param, "constanttablebase") == 0) {
2974 // This instruct is a MachConstantNode.
2975 inst.set_needs_constant_base(true);
2976 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
2977 inst.set_is_mach_constant(true);
2978 }
2979
2980 if (_curchar == '(') {
2981 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
2982 "(only constantaddress and constantoffset)", ec_name);
2983 return;
2984 }
2985 } else {
2986 // Found a parameter:
2987 // Check it is a local name, add it to the list, then check for more
2988 // New: allow hex constants as parameters to an encode method.
2989 // New: allow parenthesized expressions as parameters.
2990 // New: allow "primary", "secondary", "tertiary" as parameters.
2991 // New: allow user-defined register name as parameter
2992 if ( (inst._localNames[param] == NULL) &&
2993 !ADLParser::is_literal_constant(param) &&
2994 (Opcode::as_opcode_type(param) == Opcode::NOT_AN_OPCODE) &&
2995 ((_AD._register == NULL ) || (_AD._register->getRegDef(param) == NULL)) ) {
2996 parse_err(SYNERR, "Using non-locally defined parameter %s for encoding %s.\n", param, ec_name);
2997 return;
2998 }
2980 }
2981 params->add_entry(param);
2982
2983 skipws();
2984 if (_curchar == ',' ) {
2985 // More parameters to come
2986 next_char(); // move past ',' between parameters
2987 skipws(); // Skip to next parameter

--- 129 unchanged lines hidden (view full) ---

3117 if (param != NULL) {
3118 // Found a parameter:
3119
3120 // First check for constant table support.
3121
3122 // Check if this instruct is a MachConstantNode.
3123 if (strcmp(param, "constanttablebase") == 0) {
3124 // This instruct is a MachConstantNode.
2999 }
3000 params->add_entry(param);
3001
3002 skipws();
3003 if (_curchar == ',' ) {
3004 // More parameters to come
3005 next_char(); // move past ',' between parameters
3006 skipws(); // Skip to next parameter

--- 129 unchanged lines hidden (view full) ---

3136 if (param != NULL) {
3137 // Found a parameter:
3138
3139 // First check for constant table support.
3140
3141 // Check if this instruct is a MachConstantNode.
3142 if (strcmp(param, "constanttablebase") == 0) {
3143 // This instruct is a MachConstantNode.
3125 inst.set_is_mach_constant(true);
3144 inst.set_needs_constant_base(true);
3145 if (strncmp("MachCall", inst.mach_base_class(_globalNames), strlen("MachCall")) != 0 ) {
3146 inst.set_is_mach_constant(true);
3147 }
3126
3127 if (_curchar == '(') {
3128 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
3129 "(only constantaddress and constantoffset)", ec_name);
3130 return;
3131 }
3132 }
3133 else if ((strcmp(param, "constantaddress") == 0) ||

--- 2125 unchanged lines hidden ---
3148
3149 if (_curchar == '(') {
3150 parse_err(SYNERR, "constanttablebase in instruct %s cannot have an argument "
3151 "(only constantaddress and constantoffset)", ec_name);
3152 return;
3153 }
3154 }
3155 else if ((strcmp(param, "constantaddress") == 0) ||

--- 2125 unchanged lines hidden ---