Create an Account
username: password:
 
  MemeStreams Logo

Curiouser and Curiouser

search

Acidus
Picture of Acidus
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Acidus's topics
Arts
Business
Games
Health and Wellness
Home and Garden
(Miscellaneous)
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
Current Topic: Miscellaneous

Adobe Flash == Punch in the face
Topic: Miscellaneous 6:24 pm EST, Feb 19, 2009

Seriously, you would think that SWITCH statements would just get compiled into a giant if then else tree. Good guess. That’s what I thought, but you need to support case fall through. So you would think that they would have an If, then else tree where you test each case, and jump to a area of code, where at the end of each block you can Jump to the end of the switch statement (ie.e they end that case with a "break") or simply fall through to the next cases code block.

Make sense. An If/then/else tree to test cases and a layer of indirection to the code blocks to allow for fall through.

Only Adobe makes add yet another level on indirection. They have the if/then/else tree, they test each case statement for a value, then push a special value on the stack, then jump to a dispatcher, which jumps to different code block based on the magical stack value, which then jumps you to the code blocks so you can fall through.

Are you freaking kidding me?

Behold, this is the source code.

trace("before");
switch(x) {

case 1:
	trace("case 1");
	break;

case 2:
	trace("case 2");
	break;

default:
	trace("default");
	break;
}
trace("after");

Becomes because the following Flash pseudo-assembly code.

Push "before" onto stack
Call trace()

Push x onto stack

If(x == 1) {
 Push 0 onto stack
 Jump to DISPATCHER
}
If(x == 2) {
 Push 1 onto stack
 Jump to DISPATCHER
}
Push 2 onto stack
Jump to DISPATCHER
.
. //unimportant crap
.
BLOCK1:
Push "case 1" onto stack
Call trace()
Jump to POSTSWTICH:

BLOCK2:
Push "case 2" onto stack
Call trace()
Jump to POSTSWTICH:

BLOCK3:
Push "default" onto stack
Call trace()
Jump to POSTSWTICH:
.
. //unimportant crap
.
DISPATCHER:
//lookupswitch is an op code (yes, they have a freaking opcode for this)
//that reads the byte on the top of the stack and uses that as
//an index into a list of locations to jump to and then jumps to that
//corresponding label. So if say, 0, is on the stack, it will jump to
//BLOCK1, etc

Lookupswitch BLOCK1, BLOCK2, BLOCK3


POSTSWITCH:
Push "after" onto stack
Call trace()

I'm going to punch someone in the head. It's took me a solid 2 hours to trace this stuff and try to find a pattern (With default, without, swtiching on diff datatypes, etc). I too way long to figure out how to actually recognize this crap mixed into a giant mess of other nested if/else clauses, ternary ops, while loops, etc.

Oh, and I didn't even include the dead code. Yeah. That’s right, DEAD CODE! For each case the silly compiler actually generates dead code containing extra JUMPs that are impossible to get to. Just to make the jump/branch tables even more complex. As if 3 freaking levels of indirection were not enough, they have to throw in crap that will not even get executed!

And god help you if you nest switches. Holy crap.

grrrr

And then there the bloody scope stack...

Thats it Adobe, you are on the list! ;-)


HP’s Mark Hurd made $42.5 million in fiscal 2008 | SiliconBeat
Topic: Miscellaneous 5:56 pm EST, Feb 18, 2009

HP’s Mark Hurd made $42.5 million in fiscal 2008

DAMN!

HP’s Mark Hurd made $42.5 million in fiscal 2008 | SiliconBeat


The marriage that was not to be...
Topic: Miscellaneous 1:11 pm EST, Feb 18, 2009

We've long joked that the Bristol Palin-Levi Johnston marriage would be indefinitely postponed post-Obama victory. Well, we hate to say "I told you so...." Actually, scrap that. We sorta love saying "I told you so."

VAN SUSTEREN: What about Levi? How is he taking all this?

BRISTOL: Well, he's a really hands-on dad. He's just in love with him as much as I am.

VAN SUSTEREN: Does he -- how often does he see his son?

BRISTOL: He sees him every day.

VAN SUSTEREN: What are your plans?

BRISTOL: Eventually, we'd like to get married. We're focusing on, like, getting through school and just getting an education and stuff, getting a career going.

Good for Bristol and Levi. There's nothing sillier than compounding the pressure of an unplanned pregnancy with the pressure of a rushed wedding and marriage at age 18.

The marriage that was not to be...


254-63-8111
Topic: Miscellaneous 9:35 pm EST, Feb  7, 2009

... is not my social security number. Just a test number for the regexs. But mad thanks to the 5 folks who texted messaged me from Shmoocon warning me that Prajakta might have commited identity murder in from of a room full of hacekrs :-)


MSIL Decompiler Project
Topic: Miscellaneous 8:21 pm EST, Feb  5, 2009

Loops

I wish, as a decompiler writer, there would be no loops. Programmers use thousands of goto statements with if statements. But as it is not the case I must understand how to parse MSIL instructions that were generated from the loops.

HAHAHAHAHA! God this is so so true!

I'd also point out that the phrase "backward conditional branch target" should never make sense to any sane human being.

MSIL Decompiler Project


A night of drinks
Topic: Miscellaneous 11:32 am EST, Feb  4, 2009

Dan Kaminsky was in Atlanta yesterday. We and some of the usual suspects met for food and drinks at the Vortex in midtown. Some odd/funny things were said, and To keep track, I kept SMSing myself so I could preserve these for posterity.

Chris: I'm going to create Nemisis-oasis. Its the inverse of Match.com and Facebook. You type in what you like and it finds someone that you would absolutely hate.
Dan: Its like a Fuck You Cupid!

Tom: (handing me a girlie drink) Here Billy, this will make hair grow on your vagina.

(I have no context for this next quote. I have no idea why Tom said this)
Tom: I can only get off if the sheep is from Luxembourg
Billy: I'm totally putting this on Memestreams... how do you spell Luxembourg?

Tom: (About a computer scientist at a recent conference) They're proof that every now and then Appalachia produces something good. So its: Bucked Toothed Redneck, Bucked Toothed Redneck, Bucked Toothed Redneck, Cryptographer, Bucked Toothed Redneck...


One Of These Mornings - Patti Labell & Moby
Topic: Miscellaneous 9:25 pm EST, Jan 27, 2009

And I'llllllllllllllllll be gone!

I love the beat and Patti's voice in this song.

One Of These Mornings - Patti Labell & Moby


Quotes From Work
Topic: Miscellaneous 1:54 pm EST, Jan 23, 2009

Steve: Snoop Dogg's music *is* very romantic for when you are hanging with your bitch.


YouTube - NFL Fantasy Files: The Best Players
Topic: Miscellaneous 6:30 pm EST, Jan 20, 2009

I nice thing about how my social circles have expanded over the last few years is that, while I'm hardly a huge sports fan, I all the highlights. Mmmm social filters!

Anyway, got this int the mail today and absolutely loved it! The "3 ball catch" is probably the best of the clips.

YouTube - NFL Fantasy Files: The Best Players


YouTube - New Beirut video- Postcards from Italy. Director Alma Har'el
Topic: Miscellaneous 2:46 pm EST, Jan 20, 2009

Been Listening to these guys all day. Great music.

YouTube - New Beirut video- Postcards from Italy. Director Alma Har'el


(Last) Newer << 17 ++ 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 ++ 45 >> Older (First)
 
 
Powered By Industrial Memetics
RSS2.0