1004029365 / apparat

Automatically exported from code.google.com/p/apparat
0 stars 1 forks source link

Problem with Macro #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello.

I'm trying to port my haXe library ( http://www.blooddy.by ) to apparat.

I have a problem with a macro. I get an exception:

<function0>: caught java.lang.AssertionError: assertion failed
java.lang.AssertionError: assertion failed
     at scala.Predef$.assert(Predef.scala:77)
     at apparat.abc.AbcOutputStream.writeU08(AbcOutputStream.scala:85)
     at apparat.bytecode.BytecodeEncoder$.u08$1(BytecodeEncoder.scala:36)
     at apparat.bytecode.BytecodeEncoder$.writeOp$1(BytecodeEncoder.scala:103)
     at apparat.bytecode.BytecodeEncoder$$anonfun$apply$2.apply(BytecodeEncoder.scala:201)
     at apparat.bytecode.BytecodeEncoder$$anonfun$apply$2.apply(BytecodeEncoder.scala:201)
     at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
     at scala.collection.immutable.List.foreach(List.scala:45)
     at apparat.bytecode.BytecodeEncoder$.apply(BytecodeEncoder.scala:201)
     at apparat.bytecode.Bytecode.storeIn(Bytecode.scala:49)
     at apparat.abc.Abc$$anonfun$6$$anonfun$apply$2.apply(Abc.scala:155)
     at apparat.abc.Abc$$anonfun$6$$anonfun$apply$2.apply(Abc.scala:155)
     at scala.actors.Futures$$anonfun$1.apply(Future.scala:128)
     at scala.actors.Futures$$anonfun$1.apply(Future.scala:128)
     at scala.actors.FutureActor$$anonfun$act$1.apply(Future.scala:94)
     at scala.actors.FutureActor$$anonfun$act$1.apply(Future.scala:94)
     at scala.actors.Reactor$class.seq(Reactor.scala:280)
     at scala.actors.FutureActor.seq(Future.scala:56)
     at scala.actors.Reactor$$anon$3.andThen(Reactor.scala:258)
     at scala.actors.FutureActor.act(Future.scala:95)
     at scala.actors.Reactor$$anonfun$dostart$1.apply(Reactor.scala:222)
     at scala.actors.Reactor$$anonfun$dostart$1.apply(Reactor.scala:222)
     at scala.actors.ReactorTask.run(ReactorTask.scala:36)
     at scala.concurrent.forkjoin.ForkJoinPool$AdaptedRunnable.exec(ForkJoinPool.java:611)
     at scala.concurrent.forkjoin.ForkJoinTask.quietlyExec(ForkJoinTask.java:422)
     at scala.concurrent.forkjoin.ForkJoinWorkerThread.mainLoop(ForkJoinWorkerThread.java:340)
     at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:325)

I'm compiling swc using tdsi.
The error occurs only with this class: 
https://github.com/blooddy/blooddy_crypto/blob/md5/src/by/blooddy/crypto/MD5.as

Original issue reported on code.google.com by mryzhy on 7 Mar 2011 at 9:04

GoogleCodeExporter commented 8 years ago
I cleaned my swc and received a new exception:

java.lang.StackOverflowError
    at scala.collection.immutable.Nil$.equals(List.scala:391)
    at apparat.bytecode.Bytecode.loop$1(Bytecode.scala:56)
    at apparat.bytecode.Bytecode.loop$1(Bytecode.scala:70)
    at apparat.bytecode.Bytecode.loop$1(Bytecode.scala:70)
...
    at apparat.bytecode.Bytecode.loop$1(Bytecode.scala:70)
    at apparat.bytecode.Bytecode.loop$1(Bytecode.scala:70)
java.lang.NullPointerException
    at java.util.regex.Matcher.getTextLength(Unknown Source)
    at java.util.regex.Matcher.reset(Unknown Source)
    at java.util.regex.Matcher.<init>(Unknown Source)
    at java.util.regex.Pattern.matcher(Unknown Source)
    at java.util.Formatter.parse(Unknown Source)
    at java.util.Formatter.format(Unknown Source)
    at java.util.Formatter.format(Unknown Source)
    at java.lang.String.format(Unknown Source)
    at scala.collection.immutable.StringLike$class.format(StringLike.scala:251)
    at scala.collection.immutable.StringOps.format(StringOps.scala:31)
    at apparat.log.LoggerImpl.logIf(LoggerImpl.scala:89)
    at apparat.log.LoggerImpl.fatal(LoggerImpl.scala:33)
    at apparat.tools.ApparatApplication$.apply(ApparatApplication.scala:78)
    at apparat.tools.tdsi.TurboDieselSportInjection$.main(TurboDieselSportInjection.scala:40)
    at apparat.tools.tdsi.TurboDieselSportInjection.main(TurboDieselSportInjection.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:81)
    at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:86)
    at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:81)
    at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:86)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:83)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

Original comment by mryzhy on 7 Mar 2011 at 9:15

Attachments:

GoogleCodeExporter commented 8 years ago
Working on the stack overflow error. For some reason 2.8.1 compiler did not 
complain about incorrect @tailrec annotation.

Original comment by joaebert on 21 May 2011 at 11:20

GoogleCodeExporter commented 8 years ago
Think i'm stuck with the same issue (Stack Overflow / RC9)...
In case it matters, our Macro looks like this:

public class MemoryMacro extends Macro
    {
        public static function readU32(address:uint, result:int):void {
            result = Memory.readUnsignedByte(address++);
            if ((result & 0x00000080)) {
                result = result & 0x0000007f | Memory.readUnsignedByte(address++) << 7;
                if ((result & 0x00004000)) {
                    result = result & 0x00003fff | Memory.readUnsignedByte(address++) << 14;
                    if ((result & 0x00200000)) {
                        result = result & 0x001fffff | Memory.readUnsignedByte(address++) << 21;
                        if ((result & 0x10000000)) {
                            result = result & 0x0fffffff | Memory.readUnsignedByte(address++) << 28;
                        }
                    }
                }
            }
        }

Original comment by jan.vanc...@gmail.com on 19 Oct 2011 at 8:24

GoogleCodeExporter commented 8 years ago

Original comment by joaebert on 19 Oct 2011 at 8:37

GoogleCodeExporter commented 8 years ago
Normally the tailrec is fixed in the source for apparat.bytecode.Bytecode.loop .
The one still left is in BytecodeEncoder/Decoder as Joa state.

Original comment by leclech.patrick on 19 Oct 2011 at 11:37