slicc: Support for setting individual message buffer size
Review Request #2801 - Created May 11, 2015 and updated
| Information | |
|---|---|
| Tony Gutierrez | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10830:15f1c291f866 --------------------------- slicc: Support for setting individual message buffer size This patch adds support for setting per-MessageBuffer buffer sizes. Prior to this patch, all buffers used the same size that was set globally. This patch also adds a "kill switch" that turns all buffers back into infinite buffers. The configuration will print warnings when either the kill switch is on and an attempt is made to set a finite buffer size or the kill switch is off and there is an attempt to set an inifinite buffer size. The global buffer size variable still exists, and is now turned into a default value if no more specific value is set (such as internal buffers created by switches).
Issue Summary
| Description | From | Last Updated | Status |
|---|---|---|---|
| It appears that this parses the buffer_size value string for a literal, variable name, or a statement containing other variables. ... | Joel Hestness | May 12, 2015, 7:23 a.m. | Open |
| I see. On my first pass here, I misread that this code allows arbitrary expressions for setting buffer_size. You're right ... | Joel Hestness | May 14, 2015, 11:10 a.m. | Open |
I like the direction of this patch, but I think the buffer_size value should be parsed differently. See below.
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
It appears that this parses the buffer_size value string for a literal, variable name, or a statement containing other variables. Correct? Since this is just parsing that the parser already does, it should probably be handled instead by extending src/mem/slicc/parser.py to allow parsing the value of key-value pairs. That would allow the code to be auto-generated here (or elsewhere) instead of using custom buffer_size-specific code.
Ship It!
-
src/mem/slicc/symbols/StateMachine.py (Diff revision 1) -
I see. On my first pass here, I misread that this code allows arbitrary expressions for setting buffer_size. You're right that the parser disallows that.
However, you should be using the pair values' types here to be consistent with other code generation rather than using isinstance, which is very out-of-place here. Each PairAST value has a type. From the parser:
def p_pair__assign(self, p): """pair : ident '=' STRING | ident '=' ident | ident '=' NUMBER""" p[0] = ast.PairAST(self, p[1], p[3])And for instance, the parser sets STRING types as follows:
def t_STRING1(self, t): r'\"[^"\n]*\"' t.type = 'STRING' t.value = t.value[1:-1] return tThus, you should be able to get the buffer_size value's type with code like:
size_type = var["buffer_size"].type
Then you can predicate code generation on whether the type is IDENT, STRING, or INT like other code here (e.g. see 'vtype' local var).
This same issue applies in review request 2814 ( http://reviews.gem5.org/r/2814/ ), which looks like it is just replicating this code?
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+51 -2) |
