Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    421517

Untitled

Sign in to follow this  
Evil Steve

54 views

Apparently we had a power cut or something today at 2pm or so. I didn't manage to get my server up till 9pm though. I got home at about 7:30pm, and tried tinkering around with things, and then tried phoning Blueyonder tech support (Who are surprisingly good). My router wasn't able to get an IP address for some reason, so they got me to plug the modem directly into the PC, and restart the modem. That worked.
So, I then plugged the router in, and it stopped working. I rebooted my server, and ipconfig said that its IP was 192.168.1.100. Which is wrong, since my router dishes out static IPs and my server should be 192.168.1.200. After more potering around, I discovered that our wireless router - which is set up in access point mode - has decided that even though it's an access point, it's going to try and grab all the IP addresses, and act as a DHCP server. So, the access point was grabbing the IP from the modem before the router had a chance, and it was then dishing out IP addresses to the PCs on the network. But since there was no port forwarding set up on the access point, nobody could get to my server from the Internet, and for some reason nobody could get on the Internet from inside the network.

So, unplugging the access point while everything else booted up, and then plugging it in after seems to have fixed it. Now I need to investigate why the hell it's started doing that now...


Druinkscript.

So. Code generation is nearly working now. The optimiser is a work in progress.

Input file:
void Test() {
int test = 12 + 5 * 4 - 100 / 50;
}


Output file:

; test.dasm
; Compiled from test.ds
; By DruinkScript Compiler v1.0


;---------------------------------------
; Function: Test
; Returns: void
; Parameters: None
func Test
{
push 50
push 100
pop r0
pop r1
div r0, r1
push r0
push 4
push 5
pop r0
pop r1
mul r0, r1
push r0
push 12
pop r0
pop r1
add r0, r1
push r0
pop r0
pop r1
sub r0, r1
push r0
pop r0
mov test, r0
}




After step 1 of optimising (Removing push/pop pairs):

func Test
{
mov r0, 100
mov r1, 50
div r0, r1
mov r0, 5
mov r1, 4
mul r0, r1
mov r0, 12
mov r1, r0
add r0, r1
mov r0, r0
mov r1, r0
sub r0, r1
mov r0, r0
mov test, r0
}



(Comments removed)

After step 2 of optimising (Removing redundant mov's):

func Test
{
mov r0, 100
div r0, 50
mov r0, 5
mul r0, 4
mov r0, 12
mov r1, r0
add r0, r1
mov r0, r0
mov r1, r0
sub r0, r1
mov r0, r0
mov test, r0
}




Hmm. Yeah. Needs some work...

I know the expression itself isn't getting optimised, but it will do eventually.

Other exciting stuff: That last line there, where it moves register 0 into test. Yeah, that's broken too. I have three choices that are immediately obvious:
  1. Make DruinkASM and DruinkVM support stack offsets, x86 style (mov eax, [esp-4]).

  2. Make DruinkASM and DruinkVM support a variable location, like I do with registers. E.g. v0..v10. That limits the number of variables I can support, however.

  3. Have an infinite number of registers (Or 65536 or something), and store variables in registers. This is my preference, and the script can say how many registers it needs, so there's no need for redundant allocations.

Still, nothing that major. I also need to give this thing some serious testing, and then I want to make some performance test apps between DruinkScript and Lua, and some profiling. Firstly, a fibonacci sequence app (Although that really just tests how expensive function calls are), and some other test, like looping 10000 times, doing something or other (Calling a C++ func?)

EDIT:
Shit. I need a stack to recurse. Looks like I'll be going for option #1. Should be easy anyway, I can just move stuff from stack to register when needed.
Sign in to follow this  


2 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now