Skip to content

Commit 40871b0

Browse files
authored
* armv7/32bit removal (#809)
* * armv64/32bit removal Removed code related to 32 bit. Following left by purpose: - combo-boxes with only one Arm64 options; - code gen protected methods that now return direct value without marshaling; Leftovers: libllvm might be re-build by eliminating 32bit code generation * * building arm64_macos slice first as an experiment identifying github runner issue * * temporally: trace-expand to diagnose build failure * * workaround for cmake 4.0.1
1 parent fc5c92d commit 40871b0

File tree

23 files changed

+109
-325
lines changed

23 files changed

+109
-325
lines changed

compiler/compiler/src/main/java/org/robovm/compiler/BroMethodCompiler.java

Lines changed: 29 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -16,66 +16,34 @@
1616
*/
1717
package org.robovm.compiler;
1818

19-
import static org.robovm.compiler.Annotations.*;
20-
import static org.robovm.compiler.Bro.*;
21-
import static org.robovm.compiler.Functions.*;
22-
import static org.robovm.compiler.Types.*;
23-
import static org.robovm.compiler.llvm.Type.*;
24-
25-
import java.util.ArrayList;
26-
import java.util.List;
27-
import java.util.Map;
28-
2919
import org.robovm.compiler.MarshalerLookup.ArrayMarshalerMethod;
3020
import org.robovm.compiler.MarshalerLookup.MarshalSite;
3121
import org.robovm.compiler.MarshalerLookup.MarshalerMethod;
3222
import org.robovm.compiler.MarshalerLookup.ValueMarshalerMethod;
3323
import org.robovm.compiler.clazz.Clazz;
3424
import org.robovm.compiler.config.Config;
35-
import org.robovm.compiler.llvm.AggregateType;
36-
import org.robovm.compiler.llvm.Alloca;
25+
import org.robovm.compiler.llvm.*;
3726
import org.robovm.compiler.llvm.ArrayType;
38-
import org.robovm.compiler.llvm.Bitcast;
39-
import org.robovm.compiler.llvm.ConstantBitcast;
40-
import org.robovm.compiler.llvm.DataLayout;
41-
import org.robovm.compiler.llvm.Fpext;
42-
import org.robovm.compiler.llvm.Fptrunc;
43-
import org.robovm.compiler.llvm.Function;
44-
import org.robovm.compiler.llvm.FunctionRef;
45-
import org.robovm.compiler.llvm.FunctionType;
46-
import org.robovm.compiler.llvm.GlobalRef;
47-
import org.robovm.compiler.llvm.IntegerConstant;
4827
import org.robovm.compiler.llvm.IntegerType;
49-
import org.robovm.compiler.llvm.Inttoptr;
50-
import org.robovm.compiler.llvm.Load;
51-
import org.robovm.compiler.llvm.PackedStructureType;
52-
import org.robovm.compiler.llvm.PointerType;
53-
import org.robovm.compiler.llvm.PrimitiveType;
54-
import org.robovm.compiler.llvm.Ptrtoint;
55-
import org.robovm.compiler.llvm.Sext;
56-
import org.robovm.compiler.llvm.Store;
57-
import org.robovm.compiler.llvm.StructureType;
58-
import org.robovm.compiler.llvm.Trunc;
5928
import org.robovm.compiler.llvm.Type;
6029
import org.robovm.compiler.llvm.Value;
61-
import org.robovm.compiler.llvm.Variable;
62-
import org.robovm.compiler.llvm.VectorStructureType;
63-
import org.robovm.compiler.llvm.Zext;
6430
import org.robovm.compiler.trampoline.Invokestatic;
6531
import org.robovm.compiler.trampoline.LdcClass;
6632
import org.robovm.compiler.trampoline.Trampoline;
67-
68-
import soot.DoubleType;
69-
import soot.FloatType;
70-
import soot.LongType;
71-
import soot.PrimType;
72-
import soot.RefType;
73-
import soot.SootClass;
74-
import soot.SootMethod;
75-
import soot.VoidType;
33+
import soot.*;
7634
import soot.tagkit.AnnotationIntElem;
7735
import soot.tagkit.AnnotationTag;
7836

37+
import java.util.ArrayList;
38+
import java.util.List;
39+
import java.util.Map;
40+
41+
import static org.robovm.compiler.Annotations.*;
42+
import static org.robovm.compiler.Bro.*;
43+
import static org.robovm.compiler.Functions.*;
44+
import static org.robovm.compiler.Types.*;
45+
import static org.robovm.compiler.llvm.Type.*;
46+
7947

8048
/**
8149
*
@@ -286,43 +254,21 @@ protected Value marshalPointerToLong(Function fn, Value pointer) {
286254
}
287255

288256
protected Value marshalMachineSizedSIntToLong(Function fn, Value value) {
289-
if (config.getArch().is32Bit()) {
290-
Variable result = fn.newVariable(I64);
291-
fn.add(new Sext(result, value, I64));
292-
return result.ref();
293-
} else {
294-
return value;
295-
}
257+
return value;
296258
}
297259

298260
protected Value marshalMachineSizedUIntToLong(Function fn, Value value) {
299-
if (config.getArch().is32Bit()) {
300-
Variable result = fn.newVariable(I64);
301-
fn.add(new Zext(result, value, I64));
302-
return result.ref();
303-
} else {
304-
return value;
305-
}
261+
return value;
306262
}
307263

308264
protected Value marshalMachineSizedFloatToDouble(Function fn, Value value) {
309-
if (config.getArch().is32Bit()) {
310-
Variable result = fn.newVariable(DOUBLE);
311-
fn.add(new Fpext(result, value, DOUBLE));
312-
return result.ref();
313-
} else {
314-
return value;
315-
}
265+
return value;
316266
}
317267

318268
protected Value marshalMachineSizedFloatToFloat(Function fn, Value value) {
319-
if (!config.getArch().is32Bit()) {
320-
Variable result = fn.newVariable(FLOAT);
321-
fn.add(new Fptrunc(result, value, FLOAT));
322-
return result.ref();
323-
} else {
324-
return value;
325-
}
269+
Variable result = fn.newVariable(FLOAT);
270+
fn.add(new Fptrunc(result, value, FLOAT));
271+
return result.ref();
326272
}
327273

328274
protected Value marshalObjectToNative(Function fn, MarshalerMethod marshalerMethod, MarshaledArg marshaledArg,
@@ -386,33 +332,17 @@ protected Value marshalLongToPointer(Function fn, Value handle) {
386332
}
387333

388334
protected Value marshalLongToMachineSizedInt(Function fn, Value value) {
389-
if (config.getArch().is32Bit()) {
390-
Variable result = fn.newVariable(I32);
391-
fn.add(new Trunc(result, value, I32));
392-
return result.ref();
393-
} else {
394-
return value;
395-
}
335+
return value;
396336
}
397337

398338
protected Value marshalDoubleToMachineSizedFloat(Function fn, Value value) {
399-
if (config.getArch().is32Bit()) {
400-
Variable result = fn.newVariable(FLOAT);
401-
fn.add(new Fptrunc(result, value, FLOAT));
402-
return result.ref();
403-
} else {
404-
return value;
405-
}
339+
return value;
406340
}
407341

408342
protected Value marshalFloatToMachineSizedFloat(Function fn, Value value) {
409-
if (!config.getArch().is32Bit()) {
410-
Variable result = fn.newVariable(DOUBLE);
411-
fn.add(new Fpext(result, value, DOUBLE));
412-
return result.ref();
413-
} else {
414-
return value;
415-
}
343+
Variable result = fn.newVariable(DOUBLE);
344+
fn.add(new Fpext(result, value, DOUBLE));
345+
return result.ref();
416346
}
417347

418348
private Type getReturnType(String anno, SootMethod method) {
@@ -429,14 +359,14 @@ private Type getReturnType(String anno, SootMethod method) {
429359
throw new IllegalArgumentException(anno + " annotated method "
430360
+ method + " must return float or double when annotated with @MachineSizedFloat");
431361
}
432-
return config.getArch().is32Bit() ? FLOAT : DOUBLE;
362+
return DOUBLE;
433363
}
434364
if (hasMachineSizedSIntAnnotation(method) || hasMachineSizedUIntAnnotation(method)) {
435365
if (!sootType.equals(LongType.v())) {
436366
throw new IllegalArgumentException(anno + " annotated method "
437367
+ method + " must return long when annotated with @MachineSizedSInt or @MachineSizedUInt");
438368
}
439-
return config.getArch().is32Bit() ? I32 : I64;
369+
return I64;
440370
}
441371
if (isStruct(sootType)) {
442372
if (!isPassByValue(method)) {
@@ -475,7 +405,7 @@ private Type getParameterType(String anno, SootMethod method, int i) {
475405
+ " of " + anno + " annotated method " + method
476406
+ " must be of type float or double when annotated with @MachineSizedFloat.");
477407
}
478-
return config.getArch().is32Bit() ? FLOAT : DOUBLE;
408+
return DOUBLE;
479409
}
480410
if (hasMachineSizedSIntAnnotation(method, i) || hasMachineSizedUIntAnnotation(method, i)) {
481411
if (!sootType.equals(LongType.v())) {
@@ -484,7 +414,7 @@ private Type getParameterType(String anno, SootMethod method, int i) {
484414
+ " must be of type long when annotated with "
485415
+ "@MachineSizedSInt or @MachineSizedUInt");
486416
}
487-
return config.getArch().is32Bit() ? I32 : I64;
417+
return I64;
488418
}
489419
if (hasStructRetAnnotation(method, i)) {
490420
if (i > 0) {
@@ -911,10 +841,10 @@ public Type getStructMemberType(SootMethod method) {
911841
if (getter != null && hasPointerAnnotation(getter) || setter != null && hasPointerAnnotation(setter, 0)) {
912842
memberType = I8_PTR;
913843
} else if (getter != null && hasMachineSizedFloatAnnotation(getter) || setter != null && hasMachineSizedFloatAnnotation(setter, 0)) {
914-
memberType = config.getArch().is32Bit() ? FLOAT : DOUBLE;
844+
memberType = DOUBLE;
915845
} else if (getter != null && (hasMachineSizedSIntAnnotation(getter) || hasMachineSizedUIntAnnotation(getter))
916846
|| setter != null && (hasMachineSizedSIntAnnotation(setter, 0) || hasMachineSizedUIntAnnotation(setter, 0))) {
917-
memberType = config.getArch().is32Bit() ? I32 : I64;
847+
memberType = I64;
918848
} else if (type instanceof PrimType) {
919849
memberType = getType(type);
920850
} else if (getter != null && hasArrayAnnotation(getter) || setter != null && hasArrayAnnotation(setter, 0)) {

compiler/compiler/src/main/java/org/robovm/compiler/MarshalerLookup.java

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -475,29 +475,15 @@ public Type getNativeType(Arch arch) {
475475
if (hasPointerAnnotation(method)) {
476476
return I8_PTR;
477477
}
478-
if (arch.is32Bit() && (hasMachineSizedSIntAnnotation(method)
479-
|| hasMachineSizedUIntAnnotation(method))) {
480-
return I32;
481-
}
482-
if (arch.is32Bit() && (hasMachineSizedFloatAnnotation(method))) {
483-
return FLOAT;
484-
}
485-
if (!arch.is32Bit() && (hasMachineSizedFloatAnnotation(method))) {
478+
if (hasMachineSizedFloatAnnotation(method)) {
486479
return DOUBLE;
487480
}
488481
return Types.getType(method.getReturnType());
489482
} else {
490483
if (hasPointerAnnotation(method, 1)) {
491484
return I8_PTR;
492485
}
493-
if (arch.is32Bit() && (hasMachineSizedSIntAnnotation(method, 1)
494-
|| hasMachineSizedUIntAnnotation(method, 1))) {
495-
return I32;
496-
}
497-
if (arch.is32Bit() && (hasMachineSizedFloatAnnotation(method, 1))) {
498-
return FLOAT;
499-
}
500-
if (!arch.is32Bit() && (hasMachineSizedFloatAnnotation(method, 1))) {
486+
if (hasMachineSizedFloatAnnotation(method, 1)) {
501487
return DOUBLE;
502488
}
503489
return Types.getType(method.getParameterType(1));

compiler/compiler/src/main/java/org/robovm/compiler/Types.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -525,26 +525,8 @@ public static StructureType getInstanceType(OS os, Arch arch, SootClass clazz) {
525525

526526
public static int getFieldAlignment(OS os, Arch arch, SootField f) {
527527
soot.Type t = f.getType();
528-
if (arch.is32Bit() && arch.isArm()) {
529-
if (LongType.v().equals(t)) {
530-
/*
531-
* On ARM 32-bit volatile longs must be 8 byte aligned. Also,
532-
* the Java Memory Model mandates that final instance fields are
533-
* written to using volatile semantics. So we need to return 8
534-
* here for volatile long static/instance fields and final long
535-
* instance fields.
536-
*
537-
* But due to sun.misc.Unsafe's getLongVolatile() and
538-
* putLongVolatile(), which can be used for
539-
* non-volatile/non-final long fields (e.g. RxJava does this,
540-
* see #987), we always make sure long fields are 8 byte
541-
* aligned to avoid the app crashing when using those methods.
542-
*/
543-
return 8;
544-
}
545-
}
546528
if (LongType.v().equals(t) || DoubleType.v().equals(t)) {
547-
return arch.is32Bit() ? 4 : 8;
529+
return 8;
548530
}
549531
return getFieldSize(arch, f);
550532
}
@@ -558,7 +540,7 @@ public static int getFieldSize(Arch arch, SootField f) {
558540
return 4;
559541
}
560542
if (t instanceof RefLikeType) {
561-
return arch.is32Bit() ? 4 : 8;
543+
return 8;
562544
}
563545
if (ShortType.v().equals(t) || CharType.v().equals(t)) {
564546
return 2;

compiler/compiler/src/main/java/org/robovm/compiler/config/Arch.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
*/
2727
public class Arch implements Comparable<Arch> {
2828
// constants to keep old code
29-
public static final Arch thumbv7 = new Arch(CpuArch.thumbv7);
3029
public static final Arch arm64 = new Arch(CpuArch.arm64);
3130
public static final Arch x86_64 = new Arch(CpuArch.x86_64);
3231

@@ -70,7 +69,7 @@ public static Arch[] supported(OS os) {
7069
return new Arch[]{
7170
new Arch(CpuArch.x86_64, Environment.Simulator),
7271
new Arch(CpuArch.arm64, Environment.Simulator),
73-
Arch.arm64, Arch.thumbv7};
72+
Arch.arm64};
7473
default:
7574
throw new IllegalArgumentException("Unexpected OS");
7675
}
@@ -136,10 +135,6 @@ static public Arch parse(String s) {
136135
return new Arch(cpuArch, env);
137136
}
138137

139-
public boolean is32Bit() {
140-
return cpuArch.is32Bit();
141-
}
142-
143138
public ByteOrder getByteOrder() {
144139
return cpuArch.getByteOrder();
145140
}

compiler/compiler/src/main/java/org/robovm/compiler/config/CpuArch.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,27 @@
2525
*
2626
*/
2727
public enum CpuArch {
28-
x86_64("x86_64", "x86_64", "penryn", false, false),
29-
thumbv7("thumbv7", "armv7", true, true),
30-
arm64("arm64", "arm64", false, true);
28+
x86_64("x86_64", "x86_64", "penryn", false),
29+
arm64("arm64", "arm64", true);
3130

3231
private final String llvmName;
3332
private final String clangName;
3433
private final String llvmCpu;
35-
private final boolean is32Bit;
3634
private final boolean isArm;
3735
private final ByteOrder byteOrder;
3836

39-
private CpuArch(String llvmName, String clangName, boolean is32Bit, boolean isArm) {
40-
this(llvmName, clangName, "generic", is32Bit, isArm);
37+
private CpuArch(String llvmName, String clangName, boolean isArm) {
38+
this(llvmName, clangName, "generic", isArm);
4139
}
4240

43-
private CpuArch(String llvmName, String clangName, String llvmCpu, boolean is32Bit, boolean isArm) {
44-
this(llvmName, clangName, llvmCpu, is32Bit, isArm, ByteOrder.LITTLE_ENDIAN);
41+
private CpuArch(String llvmName, String clangName, String llvmCpu, boolean isArm) {
42+
this(llvmName, clangName, llvmCpu, isArm, ByteOrder.LITTLE_ENDIAN);
4543
}
4644

47-
private CpuArch(String llvmName, String clangName, String llvmCpu, boolean is32Bit, boolean isArm, ByteOrder byteOrder) {
45+
private CpuArch(String llvmName, String clangName, String llvmCpu, boolean isArm, ByteOrder byteOrder) {
4846
this.llvmName = llvmName;
4947
this.clangName = clangName;
5048
this.llvmCpu = llvmCpu;
51-
this.is32Bit = is32Bit;
5249
this.isArm = isArm;
5350
this.byteOrder = byteOrder;
5451
}
@@ -69,10 +66,6 @@ public boolean isArm() {
6966
return isArm;
7067
}
7168

72-
public boolean is32Bit() {
73-
return is32Bit;
74-
}
75-
7669
public ByteOrder getByteOrder() {
7770
return byteOrder;
7871
}

compiler/compiler/src/main/java/org/robovm/compiler/plugin/objc/ObjCBlockPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ private void generateCallbackMethod(String owner, SootMethod targetMethod,
555555

556556
// build and add encoding
557557
TypeEncoder encoder = new TypeEncoder();
558-
String typeEncoding = encoder.encode(methodForEncoder, !config.getArch().is32Bit());
558+
String typeEncoding = encoder.encode(methodForEncoder);
559559
// attach @TypeEncoding annotation to allow ObjCBlock to use it to create proper description
560560
AnnotationVisitor av = mv.visitAnnotation(TYPE_ENCODING, true);
561561
av.visit("value", typeEncoding);

compiler/compiler/src/main/java/org/robovm/compiler/plugin/objc/ObjCMemberPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ private void createCallback(SootClass sootClass, SootMethod method, SootMethod a
14661466

14671467
private String generateTypeEncoding(SootMethod method) {
14681468
TypeEncoder encoder = new TypeEncoder();
1469-
return encoder.encode(method, !config.getArch().is32Bit());
1469+
return encoder.encode(method);
14701470
}
14711471

14721472
private SootMethod findStrongRefGetter(SootClass sootClass,

0 commit comments

Comments
 (0)