comparison runtime/object.c @ 12:31f8182f3433

Finished fib test and did some small work on the c backend
author Mike Pavone <pavone@retrodev.com>
date Mon, 25 May 2009 23:34:36 -0400
parents d61550e2c001
children 914ad38f9b59
comparison
equal deleted inserted replaced
11:3021dac0d8f5 12:31f8182f3433
305 bp->method_lookup = malloc(sizeof(rhope_func) * INITIAL_METHOD_LOOKUP); 305 bp->method_lookup = malloc(sizeof(rhope_func) * INITIAL_METHOD_LOOKUP);
306 if(!bp->method_lookup) { 306 if(!bp->method_lookup) {
307 fprintf(stderr, "Couldn't allocate %d bytes for method lookup table\n", sizeof(rhope_func) * INITIAL_METHOD_LOOKUP); 307 fprintf(stderr, "Couldn't allocate %d bytes for method lookup table\n", sizeof(rhope_func) * INITIAL_METHOD_LOOKUP);
308 exit(-1); 308 exit(-1);
309 } 309 }
310 if(methodid - BELOW_INITIAL_METHOD < 1) { 310 if(BELOW_INITIAL_METHOD > methodid) {
311 bp->first_methodid = 1; 311 bp->first_methodid = 1;
312 bp->last_methodid = 1+INITIAL_METHOD_LOOKUP; 312 bp->last_methodid = 1+INITIAL_METHOD_LOOKUP;
313 } else { 313 } else {
314 bp->first_methodid = methodid - BELOW_INITIAL_METHOD; 314 bp->first_methodid = methodid - BELOW_INITIAL_METHOD;
315 bp->last_methodid = bp->first_methodid + INITIAL_METHOD_LOOKUP; 315 bp->last_methodid = bp->first_methodid + INITIAL_METHOD_LOOKUP;
334 if(!bp->method_lookup) { 334 if(!bp->method_lookup) {
335 fprintf(stderr, "Couldn't resize method lookup table to %d bytes\n", (methodid+1-bp->first_methodid) * sizeof(rhope_func)); 335 fprintf(stderr, "Couldn't resize method lookup table to %d bytes\n", (methodid+1-bp->first_methodid) * sizeof(rhope_func));
336 exit(-1); 336 exit(-1);
337 } 337 }
338 memset(bp->method_lookup+bp->last_methodid, '\0', (methodid+1)-bp->last_methodid); 338 memset(bp->method_lookup+bp->last_methodid, '\0', (methodid+1)-bp->last_methodid);
339 bp->last_methodid = methodid; 339 bp->last_methodid = methodid+1;
340 } 340 }
341 } 341 }
342 bp->method_lookup[methodid-bp->first_methodid] = impl; 342 bp->method_lookup[methodid-bp->first_methodid] = impl;
343 } 343 }