null pointer exception in HS running Rect.hack

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

null pointer exception in HS running Rect.hack

cpainterwakefield
I'm getting a Null Pointer Exception from the Hardware Simulator when testing my Computer.hdl using the ComputerRect.tst.  The traceback is below.

I'm running with the slider set to Fast, no animation, view screen.

No error message is returned from the GUI - it just stops doing anything.  I find that I can continue and complete the tests by clicking on the stop button and then on the run button again.  The program sometimes stops again, this time with a different traceback (see below), but again I can continue by clicking on stop, run.  The program successfully draws the rectangle.

Java particulars:
java version "1.7.0_55"
OpenJDK Runtime Environment (IcedTea 2.4.7) (7u55-2.4.7-1ubuntu1)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

First traceback:
Exception in thread "Thread-3" java.lang.NullPointerException
        at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:526)
        at javax.swing.BufferStrategyPaintManager.copyArea(BufferStrategyPaintManager.java:322)
        at javax.swing.RepaintManager.copyArea(RepaintManager.java:1264)
        at javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1596)
        at javax.swing.JViewport.windowBlitPaint(JViewport.java:1559)
        at javax.swing.JViewport.setViewPosition(JViewport.java:1102)
        at javax.swing.JViewport.scrollRectToVisible(JViewport.java:439)
        at javax.swing.JComponent.scrollRectToVisible(JComponent.java:3098)
        at HackGUI.Utilities.tableCenterScroll(Unknown Source)
        at HackGUI.PointedMemoryComponent.setPointer(Unknown Source)
        at builtInChips.RAM.reCompute(Unknown Source)
        at Hack.Gates.Gate.doEval(Unknown Source)
        at Hack.Gates.Gate.eval(Unknown Source)
        at Hack.Gates.CompositeGate.reCompute(Unknown Source)
        at Hack.Gates.Gate.doEval(Unknown Source)
        at Hack.Gates.Gate.eval(Unknown Source)
        at Hack.Gates.CompositeGate.reCompute(Unknown Source)
        at Hack.Gates.Gate.doEval(Unknown Source)
        at Hack.Gates.Gate.tock(Unknown Source)
        at Hack.HardwareSimulator.HardwareSimulator.performTock(Unknown Source)
        at Hack.HardwareSimulator.HardwareSimulator.doCommand(Unknown Source)
        at Hack.Controller.HackController.miniStep(Unknown Source)
        at Hack.Controller.HackController.singleStep(Unknown Source)
        at Hack.Controller.HackController.access$000(Unknown Source)
        at Hack.Controller.HackController$FastForwardTask.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:744)

Second traceback:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at javax.swing.BufferStrategyPaintManager.flushAccumulatedRegion(BufferStrategyPaintManager.java:416)
        at javax.swing.BufferStrategyPaintManager.endPaint(BufferStrategyPaintManager.java:380)
        at javax.swing.RepaintManager.endPaint(RepaintManager.java:1313)
        at javax.swing.JComponent._paintImmediately(JComponent.java:5164)
        at javax.swing.JComponent.paintImmediately(JComponent.java:4969)
        at javax.swing.RepaintManager$3.run(RepaintManager.java:808)
        at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
        at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:769)
        at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:718)
        at javax.swing.RepaintManager.access$1100(RepaintManager.java:62)
        at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1677)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:694)
        at java.awt.EventQueue$3.run(EventQueue.java:692)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread "Thread-4" java.lang.NullPointerException
        at javax.swing.BufferStrategyPaintManager.prepare(BufferStrategyPaintManager.java:526)
        at javax.swing.BufferStrategyPaintManager.copyArea(BufferStrategyPaintManager.java:322)
        at javax.swing.RepaintManager.copyArea(RepaintManager.java:1264)
        at javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1596)
        at javax.swing.JViewport.windowBlitPaint(JViewport.java:1559)
        at javax.swing.JViewport.setViewPosition(JViewport.java:1102)
        at javax.swing.JViewport.scrollRectToVisible(JViewport.java:439)
        at javax.swing.JComponent.scrollRectToVisible(JComponent.java:3098)
        at HackGUI.Utilities.tableCenterScroll(Unknown Source)
        at HackGUI.PointedMemoryComponent.setPointer(Unknown Source)
        at builtInChips.ROM32K.reCompute(Unknown Source)
        at Hack.Gates.Gate.doEval(Unknown Source)
        at Hack.Gates.Gate.eval(Unknown Source)
        at Hack.Gates.CompositeGate.reCompute(Unknown Source)
        at Hack.Gates.Gate.doEval(Unknown Source)
        at Hack.Gates.Gate.tock(Unknown Source)
        at Hack.HardwareSimulator.HardwareSimulator.performTock(Unknown Source)
        at Hack.HardwareSimulator.HardwareSimulator.doCommand(Unknown Source)
        at Hack.Controller.HackController.miniStep(Unknown Source)
        at Hack.Controller.HackController.singleStep(Unknown Source)
        at Hack.Controller.HackController.access$000(Unknown Source)
        at Hack.Controller.HackController$FastForwardTask.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:744)

 
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cadet1620
Administrator
Looks like you are running Linux.

I'm not a Java programmer, so I can only report my experiences and observations...

I've never had any problems running the n2t tools on 32-bit Ubuntu Linux, but I haven't worked it very hard. I doubt I've tried any of the Computer tests.

The crash traces all look like drawing problems, two of them with scrolling.

Under Windows XP I've seen strange problems if the HDL contains more parts with UI than are expected.  For instance, if there are multiple RAM16Ks in Memory.hdl. (I was experimenting with caching...) The part windows end up in strange places.

There appear to be issues related to threads running on multiple processor cores. I've seen things drawn in the wrong place, which symptomatic of bad/stale pointers, which could easily result in crashes like you are getting. I was able to eliminate this problem by limiting Java to a single core. (IIRC, this was when I was playing with multiple RAMs.)

If you want to, zip up your entire projects/05 directory and send it to me. I'll let you know if I see anything and if I can reproduce the problem on 32-bit Linux or 64-bit Win7. My Dell PC hates 64-bit Ubuntu for some reason. 8-(

--Mark


Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cpainterwakefield
Mark,

I am faculty, and a Java programmer.  If you send me the source for the hardware simulator, I can debug on my end.

-Christopher
cpainter@mines.edu
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

ybakos
In reply to this post by cpainterwakefield
Christopher (hi!) -- does the Simulator only puke when you use your Computer.hdl? Do other chip tests work ok? Are you using any custom chips in your implementation within the particular project directory?
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cadet1620
Administrator
In reply to this post by cpainterwakefield
The only source I have access to is the one on the n2t web site.
http://www.nand2tetris.org/software/nand2tetris-open-source-2.5.7.zip

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cpainterwakefield
In reply to this post by ybakos
Hi Yong :)

yes, yes, no.

-Christopher
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

ybakos
Perhaps email me your Computer.hdl as a file attachment so I can take a look, just to be sure.
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cpainterwakefield
Yong, just Computer.hdl, or do you also want Memory.hdl and CPU.hdl?
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

ybakos
Tell you what, send me a zip of the entire directory, so I can try to replicate the issue.
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

cpainterwakefield
sure.  Is your Mines address active, or do you have another email I should use?

Thanks,
Christopher

On 07/31/2014 01:13 PM, ybakos [via Nand2Tetris Questions and Answers Forum] wrote:
Tell you what, send me a zip of the entire directory, so I can try to replicate the issue.



To unsubscribe from null pointer exception in HS running Rect.hack, click here.
NAML


-- 
Christopher Painter-Wakefield * [hidden email]
Department of Electrical Engineering and Computer Science
Colorado School of Mines
Reply | Threaded
Open this post in threaded view
|

Re: null pointer exception in HS running Rect.hack

ybakos
Well, this won't help much but your 05 stuff works without issues for me.

My env:
OSX 10.10
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)