@@ -169,7 +169,7 @@ jarHeader =
169169 ++ "if test -n \"$JAVA_HOME\"; then\n"
170170 ++ " java=\"$JAVA_HOME/bin/java\"\n"
171171 ++ "fi\n"
172− ++ "exec \"$java\" $java_args -jar $MYSELF \"$@\""
172+ ++ "exec \"$java\" $java_args -jar $MYSELF \"$@\"\n"
173173 ++ "exit 1\n"
174174
175175-----------------------------------------------------------------------
@@ -312,6 +312,7 @@ mkCompilationUnit globalInit defs hdrs out = do
312312 , ImportDecl True idrisPrelude True
313313 , ImportDecl False bigInteger False
314314 , ImportDecl False runtimeException False
315+ , ImportDecl False byteBuffer False
315316 ] ++ otherHdrs
316317 )
317318 <$> mkTypeDecl clsName globalInit defs
@@ -320,6 +321,7 @@ mkCompilationUnit globalInit defs hdrs out = do
320321 idrisPrelude = J.Name $ map Ident ["org", "idris", "rts", "Prelude"]
321322 bigInteger = J.Name $ map Ident ["java", "math", "BigInteger"]
322323 runtimeException = J.Name $ map Ident ["java", "lang", "RuntimeException"]
324+ byteBuffer = J.Name $ map Ident ["java", "nio", "ByteBuffer"]
323325 otherHdrs = map ( (\ name -> ImportDecl False name False)
324326 . J.Name
325327 . map (Ident . T.unpack)
@@ -386,9 +388,7 @@ mkMainMethod =
386388 "main"
387389 [FormalParam [] (array stringType) False (VarId $ Ident "args")]
388390 $ Block [ BlockStmt . ExpStmt
389− $ call "idris_initArgs" [ (threadType ~> "currentThread") []
390− , jConst "args"
391− ]
391+ $ call "idris_initArgs" [ jConst "args" ]
392392 , BlockStmt . ExpStmt $ call (mangle' (sMN 0 "runMain")) []
393393 ]
394394
@@ -484,6 +484,8 @@ mkExp pp (SOp LFork [arg]) =
484484 (mkThread arg) >>= ppExp pp
485485mkExp pp (SOp LPar [arg]) =
486486 (Nothing <>@! arg) >>= ppExp pp
487+mkExp pp (SOp LRegisterPtr [ptr, i]) =
488+ (Nothing <>@! ptr) >>= ppExp pp
487489mkExp pp (SOp LNoOp args) =
488490 (Nothing <>@! (last args)) >>= ppExp pp
489491mkExp pp (SOp LNullPtr args) =
@@ -707,6 +709,7 @@ mkConstant c@(AType x) = ClassLit (Just $ box (constType c))
707709mkConstant c@(StrType ) = ClassLit (Just $ stringType)
708710mkConstant c@(PtrType ) = ClassLit (Just $ objectType)
709711mkConstant c@(ManagedPtrType) = ClassLit (Just $ objectType)
712+mkConstant c@(BufferType) = ClassLit (Just $ bufferType)
710713mkConstant c@(VoidType ) = ClassLit (Just $ voidType)
711714mkConstant c@(Forgot ) = ClassLit (Just $ objectType)
712715
@@ -744,7 +747,7 @@ mkForeign pp (LANG_JAVA callType) resTy text params
744747
745748mkPrimitiveFunction :: PrimFn -> [LVar] -> CodeGeneration Exp
746749mkPrimitiveFunction op args =
747− (\ args -> (primFnType ~> opName op) args)
750+ (\ args -> (primFnType ~> opName op) (endiannessArguments op ++ args))
748751 <$> sequence (zipWith (\ a t -> (Just t) <>@! a) args (sourceTypes op))
749752
750753mkThread :: LVar -> CodeGeneration Exp