mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 00:04:10 -08:00
C: workaround for regression in MSVC compiler
This commit is contained in:
parent
a8641de39b
commit
969ad17b6a
|
@ -609,6 +609,7 @@ public class CTarget implements TeaVMTarget, TeaVMCHost {
|
|||
if (!incremental) {
|
||||
headerWriter.println("extern TeaVM_String* teavm_stringPool[];");
|
||||
headerWriter.println("#define TEAVM_GET_STRING(i) teavm_stringPool[i]");
|
||||
headerWriter.println("#define TEAVM_GET_STRING_ADDRESS(i) (teavm_stringPool + i)");
|
||||
|
||||
includes.includePath("strings.h");
|
||||
includes.includePath("stringhash.h");
|
||||
|
|
|
@ -219,7 +219,7 @@ public class CallSiteGenerator {
|
|||
}
|
||||
|
||||
private String getStringExpr(String s) {
|
||||
return s != null ? "&TEAVM_GET_STRING(" + context.getStringPool().getStringIndex(s) + ")" : "NULL";
|
||||
return s != null ? "TEAVM_GET_STRING_ADDRESS(" + context.getStringPool().getStringIndex(s) + ")" : "NULL";
|
||||
}
|
||||
|
||||
static class HandlerContainer {
|
||||
|
|
|
@ -837,7 +837,8 @@ public class ClassGenerator {
|
|||
|
||||
String metadataName = nameOfType(type);
|
||||
String nameRef = metadataName != null
|
||||
? "(TeaVM_Object**) &TEAVM_GET_STRING(" + context.getStringPool().getStringIndex(metadataName) + ")"
|
||||
? "(TeaVM_Object**) TEAVM_GET_STRING_ADDRESS("
|
||||
+ context.getStringPool().getStringIndex(metadataName) + ")"
|
||||
: "NULL";
|
||||
String superTypeFunction = context.getNames().forSupertypeFunction(type);
|
||||
|
||||
|
@ -854,7 +855,7 @@ public class ClassGenerator {
|
|||
simpleName = "NULL";
|
||||
} else {
|
||||
int simpleNameIndex = context.getStringPool().getStringIndex(simpleName);
|
||||
simpleName = "(TeaVM_Object**) &TEAVM_GET_STRING(" + simpleNameIndex + ")";
|
||||
simpleName = "(TeaVM_Object**) TEAVM_GET_STRING_ADDRESS(" + simpleNameIndex + ")";
|
||||
}
|
||||
|
||||
includes.includePath("strings.h");
|
||||
|
|
|
@ -65,7 +65,7 @@ class MetadataCIntrinsic implements Generator {
|
|||
} else if (value instanceof String) {
|
||||
int stringIndex = context.stringPool().getStringIndex((String) value);
|
||||
context.includes().includePath("strings.h");
|
||||
context.writerBefore().print("(TeaVM_Object**) &TEAVM_GET_STRING(" + stringIndex + ")");
|
||||
context.writerBefore().print("(TeaVM_Object**) TEAVM_GET_STRING_ADDRESS(" + stringIndex + ")");
|
||||
} else if (value instanceof Boolean) {
|
||||
context.writerBefore().print((Boolean) value ? "1" : "0");
|
||||
} else if (value instanceof Integer) {
|
||||
|
@ -238,7 +238,7 @@ class MetadataCIntrinsic implements Generator {
|
|||
if (key == null) {
|
||||
context.writerBefore().print("{ NULL, NULL }");
|
||||
} else {
|
||||
context.writerBefore().print("{ &TEAVM_GET_STRING("
|
||||
context.writerBefore().print("{ TEAVM_GET_STRING_ADDRESS("
|
||||
+ context.stringPool().getStringIndex(key) + "), ");
|
||||
writeValue(context, resourceMap.get(key));
|
||||
context.writerBefore().print("}");
|
||||
|
|
Loading…
Reference in New Issue
Block a user