Change #allocate to a class method for os.dir, os.file, os.stat, and os.buffer

Warning: I don't know C++ at all.

I did try it out, though, and it seemed to work:

```
$ echo 'import os.dir; dir::Dir.allocate' > os_test.mr
$ ./marius -p os_test.mr
<Dir:0x1010120b8>
```