link_forcer.cpp 2.92 KB
Newer Older
Kevin Modzelewski's avatar
Kevin Modzelewski committed
1
// Copyright (c) 2014 Dropbox, Inc.
Kevin Modzelewski's avatar
Kevin Modzelewski committed
2
//
Kevin Modzelewski's avatar
Kevin Modzelewski committed
3 4 5
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Kevin Modzelewski's avatar
Kevin Modzelewski committed
6
//
Kevin Modzelewski's avatar
Kevin Modzelewski committed
7
//    http://www.apache.org/licenses/LICENSE-2.0
Kevin Modzelewski's avatar
Kevin Modzelewski committed
8
//
Kevin Modzelewski's avatar
Kevin Modzelewski committed
9 10 11 12 13 14 15 16 17 18
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// This file is for forcing the inclusion of function declarations into the stdlib.
// This is so that the types of the functions are available to the compiler.

#include "core/types.h"
19
#include "gc/heap.h"
20
#include "runtime/complex.h"
21
#include "runtime/float.h"
22
#include "runtime/generator.h"
Travis Hance's avatar
Travis Hance committed
23
#include "runtime/import.h"
24
#include "runtime/inline/boxing.h"
Kevin Modzelewski's avatar
Kevin Modzelewski committed
25 26
#include "runtime/int.h"
#include "runtime/list.h"
27
#include "runtime/long.h"
Kevin Modzelewski's avatar
Kevin Modzelewski committed
28
#include "runtime/objmodel.h"
Kevin Modzelewski's avatar
Kevin Modzelewski committed
29
#include "runtime/set.h"
Kevin Modzelewski's avatar
Kevin Modzelewski committed
30 31 32 33 34 35 36 37
#include "runtime/types.h"

namespace pyston {

static void forceLink(void* x) {
    printf("%p\n", x);
}

38 39 40 41 42
extern "C" void __py_personality_v0() {
    RELEASE_ASSERT(0, "not used");
}


Kevin Modzelewski's avatar
Kevin Modzelewski committed
43 44 45 46
namespace _force {

#define FORCE(name) forceLink((void*)name)
void force() {
47
    FORCE(softspace);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
    FORCE(my_assert);

    FORCE(boxInt);
    FORCE(unboxInt);
    FORCE(boxFloat);
    FORCE(unboxFloat);
    FORCE(boxStringPtr);
    FORCE(boxCLFunction);
    FORCE(unboxCLFunction);
    FORCE(boxInstanceMethod);
    FORCE(boxBool);
    FORCE(unboxBool);
    FORCE(createTuple);
    FORCE(createDict);
    FORCE(createList);
    FORCE(createSlice);
64
    FORCE(createUserClass);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
65
    FORCE(createClosure);
66
    FORCE(createGenerator);
67
    FORCE(createLong);
68
    FORCE(createPureImaginary);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
69
    FORCE(createSet);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
70 71 72

    FORCE(getattr);
    FORCE(setattr);
73
    FORCE(delattr);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
74 75 76 77
    FORCE(print);
    FORCE(nonzero);
    FORCE(binop);
    FORCE(compare);
78
    FORCE(augbinop);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
79 80 81 82
    FORCE(unboxedLen);
    FORCE(getitem);
    FORCE(getclsattr);
    FORCE(getGlobal);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
83
    FORCE(delGlobal);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
84
    FORCE(setitem);
85
    FORCE(delitem);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
86 87
    FORCE(unaryop);
    FORCE(import);
88
    FORCE(importFrom);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
89
    FORCE(importStar);
Marius Wachtler's avatar
Marius Wachtler committed
90
    FORCE(repr);
91
    FORCE(str);
92
    FORCE(isinstance);
93
    FORCE(yield);
94
    FORCE(getiter);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
95 96 97 98 99 100

    FORCE(checkUnpackingLength);
    FORCE(raiseAttributeError);
    FORCE(raiseAttributeErrorStr);
    FORCE(raiseNotIterableError);
    FORCE(assertNameDefined);
101
    FORCE(assertFail);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
102 103 104 105 106 107 108

    FORCE(printFloat);
    FORCE(listAppendInternal);

    FORCE(runtimeCall);
    FORCE(callattr);

109
    FORCE(raise0);
110
    FORCE(raise3);
111

Kevin Modzelewski's avatar
Kevin Modzelewski committed
112 113 114 115 116
    FORCE(div_i64_i64);
    FORCE(mod_i64_i64);
    FORCE(pow_i64_i64);

    FORCE(div_float_float);
Travis Hance's avatar
Travis Hance committed
117
    FORCE(floordiv_float_float);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
118 119 120 121 122 123 124 125 126
    FORCE(mod_float_float);
    FORCE(pow_float_float);

    FORCE(boxFloat);

    FORCE(createModule);

    FORCE(gc::sizes);

127
    // FORCE(listIter);
Kevin Modzelewski's avatar
Kevin Modzelewski committed
128 129 130
}
}
}