1616 */
1717package 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-
2919import org .robovm .compiler .MarshalerLookup .ArrayMarshalerMethod ;
3020import org .robovm .compiler .MarshalerLookup .MarshalSite ;
3121import org .robovm .compiler .MarshalerLookup .MarshalerMethod ;
3222import org .robovm .compiler .MarshalerLookup .ValueMarshalerMethod ;
3323import org .robovm .compiler .clazz .Clazz ;
3424import 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 .*;
3726import 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 ;
4827import 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 ;
5928import org .robovm .compiler .llvm .Type ;
6029import 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 ;
6430import org .robovm .compiler .trampoline .Invokestatic ;
6531import org .robovm .compiler .trampoline .LdcClass ;
6632import 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 .*;
7634import soot .tagkit .AnnotationIntElem ;
7735import 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 )) {
0 commit comments