@@ -228,7 +228,7 @@ class Context {
228
228
public:
229
229
Context (System* s, Allocator* a, Zone* zone):
230
230
s (s), zone(zone), client(0 ), code(s, a, 1024 ), tasks(0 ), result(0 ),
231
- firstBlock (new (zone-> allocate ( sizeof (MyBlock)) ) MyBlock(this , 0 )),
231
+ firstBlock (new (zone) MyBlock(this , 0 )),
232
232
lastBlock (firstBlock), poolOffsetHead(0 ), poolOffsetTail(0 ),
233
233
constantPool (0 ), constantPoolCount(0 )
234
234
{ }
@@ -346,8 +346,7 @@ class Offset: public Promise {
346
346
Promise*
347
347
offset (Context* c, bool forTrace = false )
348
348
{
349
- return new (c->zone ->allocate (sizeof (Offset)))
350
- Offset (c, c->lastBlock , c->code .length (), forTrace);
349
+ return new (c->zone ) Offset (c, c->lastBlock , c->code .length (), forTrace);
351
350
}
352
351
353
352
bool
@@ -414,8 +413,7 @@ class OffsetTask: public Task {
414
413
void
415
414
appendOffsetTask (Context* c, Promise* promise, Promise* instructionOffset)
416
415
{
417
- c->tasks = new (c->zone ->allocate (sizeof (OffsetTask))) OffsetTask
418
- (c->tasks , promise, instructionOffset);
416
+ c->tasks = new (c->zone ) OffsetTask (c->tasks , promise, instructionOffset);
419
417
}
420
418
421
419
inline unsigned
@@ -628,17 +626,14 @@ appendConstantPoolEntry(Context* c, Promise* constant, Promise* callOffset)
628
626
if (constant->resolved ()) {
629
627
// make a copy, since the original might be allocated on the
630
628
// stack, and we need our copy to live until assembly is complete
631
- constant = new (c->zone ->allocate (sizeof (ResolvedPromise)))
632
- ResolvedPromise (constant->value ());
629
+ constant = new (c->zone ) ResolvedPromise (constant->value ());
633
630
}
634
631
635
- c->constantPool = new (c->zone ->allocate (sizeof (ConstantPoolEntry)))
636
- ConstantPoolEntry (c, constant, c->constantPool , callOffset);
632
+ c->constantPool = new (c->zone ) ConstantPoolEntry (c, constant, c->constantPool , callOffset);
637
633
638
634
++ c->constantPoolCount ;
639
635
640
- PoolOffset* o = new (c->zone ->allocate (sizeof (PoolOffset))) PoolOffset
641
- (c->lastBlock , c->constantPool , c->code .length () - c->lastBlock ->offset );
636
+ PoolOffset* o = new (c->zone ) PoolOffset (c->lastBlock , c->constantPool , c->code .length () - c->lastBlock ->offset );
642
637
643
638
if (DebugPool) {
644
639
fprintf (stderr, " add pool offset %p %d to block %p\n " ,
657
652
appendPoolEvent (Context* c, MyBlock* b, unsigned offset, PoolOffset* head,
658
653
PoolOffset* tail)
659
654
{
660
- PoolEvent* e = new (c->zone ->allocate (sizeof (PoolEvent))) PoolEvent
661
- (head, tail, offset);
655
+ PoolEvent* e = new (c->zone ) PoolEvent (head, tail, offset);
662
656
663
657
if (b->poolEventTail ) {
664
658
b->poolEventTail ->next = e;
@@ -1522,8 +1516,7 @@ branchCM(Context* c, TernaryOperation op, unsigned size,
1522
1516
ShiftMaskPromise*
1523
1517
shiftMaskPromise (Context* c, Promise* base, unsigned shift, int64_t mask)
1524
1518
{
1525
- return new (c->zone ->allocate (sizeof (ShiftMaskPromise)))
1526
- ShiftMaskPromise (base, shift, mask);
1519
+ return new (c->zone ) ShiftMaskPromise (base, shift, mask);
1527
1520
}
1528
1521
1529
1522
void
@@ -2158,9 +2151,7 @@ class MyAssembler: public Assembler {
2158
2151
{
2159
2152
Register stack (StackRegister);
2160
2153
Memory stackLimit (ThreadRegister, stackLimitOffsetFromThread);
2161
- Constant handlerConstant
2162
- (new (c.zone ->allocate (sizeof (ResolvedPromise)))
2163
- ResolvedPromise (handler));
2154
+ Constant handlerConstant (new (c.zone ) ResolvedPromise (handler));
2164
2155
branchRM (&c, JumpIfGreaterOrEqual, TargetBytesPerWord, &stack, &stackLimit,
2165
2156
&handlerConstant);
2166
2157
}
@@ -2465,8 +2456,7 @@ class MyAssembler: public Assembler {
2465
2456
MyBlock* b = c.lastBlock ;
2466
2457
b->size = c.code .length () - b->offset ;
2467
2458
if (startNew) {
2468
- c.lastBlock = new (c.zone ->allocate (sizeof (MyBlock)))
2469
- MyBlock (&c, c.code .length ());
2459
+ c.lastBlock = new (c.zone ) MyBlock (&c, c.code .length ());
2470
2460
} else {
2471
2461
c.lastBlock = 0 ;
2472
2462
}
@@ -2537,8 +2527,7 @@ Assembler*
2537
2527
makeAssembler (System* system, Allocator* allocator, Zone* zone,
2538
2528
Assembler::Architecture* architecture)
2539
2529
{
2540
- return new (zone->allocate (sizeof (MyAssembler)))
2541
- MyAssembler (system , allocator, zone,
2530
+ return new (zone) MyAssembler (system , allocator, zone,
2542
2531
static_cast <MyArchitecture*>(architecture));
2543
2532
}
2544
2533
0 commit comments