mirror of https://gitlab.com/camelot/kickc.git
- Optimized namespace prefix logic for global variables and fixed but to also include exported global variables used in logic.
- Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in AsmLibrary.java. - Fixed bug for hasExportAsmLibrary to use the LibraryName always and optimized the code in Pass4CodeGeneration.java. - Optimized naming of asmLibrary labels and names. Labels are to be used in assembler generation only. Names are used for all other purposes.
This commit is contained in:
parent
1a53d6a913
commit
20f3529a2d
|
@ -325,12 +325,16 @@ public class AsmFormat {
|
||||||
// Implicit reference to imported .asm library procedure.
|
// Implicit reference to imported .asm library procedure.
|
||||||
String namespace = ((Procedure)symbol).getAsmLibraryLabel();
|
String namespace = ((Procedure)symbol).getAsmLibraryLabel();
|
||||||
if (namespace != null)
|
if (namespace != null)
|
||||||
asmName = namespace + "." + asmName;
|
return namespace + "." + asmName;
|
||||||
} else if(symbol instanceof Variable var) {
|
} else if(symbol instanceof Variable var) {
|
||||||
// Implicit reference to imported global .asm library variable.
|
// Reference to imported global .asm library variable.
|
||||||
String namespace = ((Variable)symbol).getImportAsmLibrary();
|
String importLibraryName = ((Variable)symbol).getImportAsmLibraryLabel();
|
||||||
if(namespace != null)
|
if(importLibraryName != null)
|
||||||
asmName = namespace + "." + asmName;
|
return importLibraryName + "." + asmName;
|
||||||
|
// Reference to exported global .asm library variable.
|
||||||
|
String exportLibraryName = ((Variable)symbol).getExportAsmLibraryLabel();
|
||||||
|
if(exportLibraryName != null)
|
||||||
|
return exportLibraryName + "." + asmName;
|
||||||
}
|
}
|
||||||
return asmFix(asmName);
|
return asmFix(asmName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,11 +244,11 @@ public class AsmLibrary extends AsmLine {
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibrary) {
|
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibraryName) {
|
||||||
String varExportAsmLibrary = constantVar.getExportAsmLibrary();
|
if(exportAsmLibraryName != null) {
|
||||||
if(exportAsmLibrary != null) {
|
String varExportAsmLibraryName = constantVar.getExportAsmLibraryName();
|
||||||
if(varExportAsmLibrary != null) {
|
if(varExportAsmLibraryName != null) {
|
||||||
return constantVar.getExportAsmLibrary().equals(exportAsmLibrary);
|
return varExportAsmLibraryName.equals(exportAsmLibraryName);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class Variable implements Symbol {
|
||||||
constVar.setExport(variable.isExport());
|
constVar.setExport(variable.isExport());
|
||||||
constVar.setComments(variable.getComments());
|
constVar.setComments(variable.getComments());
|
||||||
constVar.setStructUnwind(variable.isStructUnwind());
|
constVar.setStructUnwind(variable.isStructUnwind());
|
||||||
constVar.setAsmImportLibrary(variable.getImportAsmLibrary());
|
constVar.setAsmImportLibrary(variable.getImportAsmLibraryName());
|
||||||
// constVar.setAsmExportLibrary(variable.getExportAsmLibrary());
|
// constVar.setAsmExportLibrary(variable.getExportAsmLibrary());
|
||||||
return constVar;
|
return constVar;
|
||||||
}
|
}
|
||||||
|
@ -336,14 +336,23 @@ public class Variable implements Symbol {
|
||||||
return this.asmImportLibrary != null;
|
return this.asmImportLibrary != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExportAsmLibrary() {
|
public String getExportAsmLibraryName() {
|
||||||
return asmExportLibrary != null ? asmExportLibrary.toString() : null;
|
return asmExportLibrary != null ? asmExportLibrary.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getImportAsmLibrary() {
|
public String getExportAsmLibraryLabel() {
|
||||||
|
return asmExportLibrary != null ? asmExportLibrary.getAsm() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImportAsmLibraryName() {
|
||||||
return asmImportLibrary != null ? asmImportLibrary.toString() : null;
|
return asmImportLibrary != null ? asmImportLibrary.toString() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getImportAsmLibraryLabel() {
|
||||||
|
return asmImportLibrary != null ? asmImportLibrary.getAsm() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isKindIntermediate() {
|
public boolean isKindIntermediate() {
|
||||||
return Kind.INTERMEDIATE.equals(getKind());
|
return Kind.INTERMEDIATE.equals(getKind());
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,11 +395,11 @@ public class Pass4CodeGeneration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibrary) {
|
private boolean hasExportAsmLibrary(Variable constantVar, String exportAsmLibraryName) {
|
||||||
String varExportAsmLibrary = constantVar.getExportAsmLibrary();
|
String varExportAsmLibraryName = constantVar.getExportAsmLibraryName();
|
||||||
if(exportAsmLibrary != null) {
|
if(exportAsmLibraryName != null) {
|
||||||
if(varExportAsmLibrary != null) {
|
if(varExportAsmLibraryName != null) {
|
||||||
return varExportAsmLibrary.equals(exportAsmLibrary);
|
return varExportAsmLibraryName.equals(exportAsmLibraryName);
|
||||||
} else {
|
} else {
|
||||||
return true; // Bugfix
|
return true; // Bugfix
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ public class Pass4CodeGeneration {
|
||||||
boolean isImportAsmLibraryGlobal = constantVar.isAsmImportLibraryGlobal();
|
boolean isImportAsmLibraryGlobal = constantVar.isAsmImportLibraryGlobal();
|
||||||
boolean isExportAsmLibraryParameter = constantVar.isAsmExportLibraryParameter();
|
boolean isExportAsmLibraryParameter = constantVar.isAsmExportLibraryParameter();
|
||||||
boolean isExportAsmLibraryReturn = constantVar.isAsmExportLibraryReturn();
|
boolean isExportAsmLibraryReturn = constantVar.isAsmExportLibraryReturn();
|
||||||
return ( varExportAsmLibrary == null || isExportAsmLibraryParameter || isExportAsmLibraryReturn )
|
return ( varExportAsmLibraryName == null || isExportAsmLibraryParameter || isExportAsmLibraryReturn )
|
||||||
&& !isImportAsmLibraryGlobal;
|
&& !isImportAsmLibraryGlobal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue