Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created January 23, 2011 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/792205 to your computer and use it in GitHub Desktop.
Save jnthn/792205 to your computer and use it in GitHub Desktop.
.include "except_types.pasm"
.sub 'foo'
$P0 = box 1
.return ($P0)
.end
.sub 'bar'
new $P424, ['ExceptionHandler'], .CONTROL_RETURN
set_addr $P424, control_423
push_eh $P424
$P0 = box 1
.return ($P0)
control_423:
.local pmc exception
.get_results (exception)
getattribute $P428, exception, "payload"
.return ($P428)
.end
.sub 'test' :main
$N1 = time
say $N1
$I0 = 0
loop_1:
if $I0 > 10000000 goto loop_1_end
'foo'()
inc $I0
goto loop_1
loop_1_end:
$N1 = time
say $N1
$I0 = 0
loop_2:
if $I0 > 10000000 goto loop_2_end
'bar'()
inc $I0
goto loop_2
loop_2_end:
$N1 = time
say $N1
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment