Few cents about my commits

bugfix #357, #387: CGBitmapContext.create crashes

|

History CGBitmapContext.create fails on real device for big sizes #387
Fix PR394

Root case

CGBitmapContext.create(byte[] ... ) method implemented as bellow:

BytePtr ptr = new BytePtr();
ptr.set(data);
return create(ptr.as(IntPtr.class), width, height, bitsPerComponent, bytesPerRow, space, bitmapInfo, releaseCallback);

interested moments here:

  • new BytePtr(); allocate struct that contains one byte (size of struct is one byte);
  • ptr.set(data) just mem copies data over this one byte struct and corrupts all memory after it;

The fix

bro-gen: fixes + argument tuples

|

Another set of bro-gen updates it get during everyday usage. Whats new:

  • arguments tuple
  • better support for @Deprecated annotation
  • fixed visibility of default constructor

    arguments_tuple

AltPods: pods updated + new bindings(AppLovinSDK, Pollfish)

|

AltPods were update to v1.2.0-SNAPSHOTS. Changes include:

New pods

Updated pod

Unchanged pod

These pods were pushed to https://oss.sonatype.org/content/repositories/snapshots maven repo under 1.2.0-SNAPSHOTS version.
Source code @github

Updates are not tested yet, please open issue if bug found.

NB: AltPods – are robopods kept at my personal standalone repo. This is done to prevent main robopods repo from turning into code graveyard. As these pods have low interest of community and low chances to be updated.

Bro: Support for packed structures and ABI mystery

|

Packed C structures were not supported what caused and issue #374. Adding support for them seemed as a quick win but it had own pitfalls. As part of quick win following was done:

(code was delivered as PR 378)

Added @Packed(align param) annotation to mark structures to be packed:

To mark structure as packed it is enough just annotate it with @Packed.
Following C structure:

#pragma pack(push, 2)
struct PascalString { short length; long long v;};
#pragma pack(pop)

is to be bind into following Java one:

@Packed(2)
public class PascalString extends Struct<PascalString> {
    @StructMember(0) public native short length();
    @StructMember(0) public native PascalString length(short length);
    @StructMember(1) public native long v();
    @StructMember(1) public native PascalString v(long v);
}

Bro compiler generates proper LLVM IR packed Java structures:

CocoaTouch: tonns of wrong enum marshalers

|

Once Issue #373 (Wrong data type of MIDINotificationMessageID enum) was opened it is clear that cocoa-touch had to be revised for enum marshalers case.
This issue wasn’t exposed till #373 and was around for years but anyway it is just metter of time till someone finds another one.

What’s wrong

Marshalers are compilation time annotations that specifies RoboVM compiler the way how to convert native/objc object to java side and back. In case of enums it is usualy specifies size of integer used by enum type in native/objc (e.g. signed/unsigned char/short/int/long).
Using wrong size/sign integer type marshalers leads to data loss (when wrong value read from memory) and potentionaly memory corruption on write attempt.

  • using enum type as member of structure (#373)
  • accessing enum type value by pointer

Why it was in general working

iOS 12.2 bindings, what's new in bro-gen

|

iOS 12.2

iOS 12.2 has arrived as PR363. It reflects changes apple did. Beside updating API robovm-cocoatouch received following updates:

  • fixed broken structs in AudioToolBox;
  • added IntentsUI framework;
  • added UserNotificationsUI framework;

What’s new in bro-gen

LLVM7-8: vol3 -- its alive. Update#3

|

Update#3

Still waiting for official LLVM8 release but it was already tagged.
Meanwhile code was migrate to LLVM8 and commited to dkimitsa/robovm/llvm_80. Following was adapted:

  • bindings;
  • native code;
  • patches.

Code under LLVM8 branch can compile and produce runnable code.
Also both LLVM7/8 has been merged with debugger_local_resolution branch;

Next steps:

  • resurect and run RoboVm tests;
  • evaluate performance and size footprint of LLVM7 produced code;

Previous updates:

RoboVM 2.3.6 released, what's new

|

What’s new

  • [fix] Xcode project generator: added argument type to IBAction #323
  • [added] forceLinkMethods configuration option to preserve method from aggressive tree shaker, details
  • [fixed] compile dependency declaration bug with gradle 4;
  • [added] putByte/getByte support for Unsafe
  • [updated] cocoa touch bindings up to ios 12.1, new frameworks etc
  • [added] experimental option to enable incremental compilation, thanks @dthomes. #334
  • [fixed] support for vectors which unchainder ARKit, details
  • [fixed] Invalid Swift Support issue when submitting to apple build created using XCode 10.1/10.2;
  • [added] preservePorts option to Sygnals.installSignals API, to supress reporting of handled NPE to Crashlitics, details

Useful tutorials

LLVM7: vol2 -- its alive. Update#2

|

Update#2

As per today code from dkimitsa/robovm/llvm_70 is able compile and start application in simulator/device. It gets alive status. What had been done:

  • RoboVm compiler infrastructure was updated to produce llvm 7 compatible IR code;
  • DebugInformationPlugin was reworked to produce llvm7 debug information;
  • Bunch of code was changed as it was broken as per llvm7 vision and produced crashes on asserts inside LLVM.

Next steps:

  • merge with debugger_local_resolution branch;
  • resurect and run RoboVm tests;
  • evaluate performance and size footprint of LLVM7 produced code;
  • migrate to LLVM 8 – yep it has to be released this month.

Previous updates:

Crashlytics: fight for exception handler

|

This post continues tutorial for proper initialization of crash reporters t. Today it focus around issue 350:Crashlytics: Caught exceptions are being reported as crashes.

Root case

Signals.installSignals() preserves signals handlers and allows RoboVM to handle NPE. But Crashlytics also uses mach exception handler to get crash Apple way. These have priority over signals and this allows Crashlytics to see null pointer exception (EXC_BAD_ACCESS) before RoboVM detects it and report.

The fix